diff --git a/dist/rexbbcodetext.js b/dist/rexbbcodetext.js index f4a47c3ef7..224da67820 100644 --- a/dist/rexbbcodetext.js +++ b/dist/rexbbcodetext.js @@ -3932,6 +3932,12 @@ } else if (TagRegex.RE_SIZE_CLOSE.test(text)) { UpdateProp(prevProp, PROP_REMOVE, 'size'); + } else if (TagRegex.RE_FAMILY_OPEN.test(text)) { + var innerMatch = text.match(TagRegex.RE_FAMILY_OPEN); + UpdateProp(prevProp, PROP_ADD, 'family', innerMatch[1]); + } else if (TagRegex.RE_FAMILY_CLOSE.test(text)) { + UpdateProp(prevProp, PROP_REMOVE, 'family'); + } else if (TagRegex.RE_COLOR_OPEN.test(text)) { var innerMatch = text.match(TagRegex.RE_COLOR_OPEN); UpdateProp(prevProp, PROP_ADD, 'color', innerMatch[1]); @@ -4209,6 +4215,7 @@ case 'color': case 'weight': + case 'family': case 'stroke': case 'bgcolor': case 'y': @@ -4323,6 +4330,10 @@ var SIZE_OPEN = GetOpenTagRegString(delimiterLeft, delimiterRight, SIZE, NUMBER_PARAM); var SIZE_CLOSE = GetCloseTagRegString(delimiterLeft, delimiterRight, SIZE); + var FAMILY = 'family'; + var FAMILY_OPEN = GetOpenTagRegString(delimiterLeft, delimiterRight, FAMILY, STR_PARAM); + var FAMILY_CLOSE = GetCloseTagRegString(delimiterLeft, delimiterRight, FAMILY); + var COLOR = 'color'; var COLOR_OPEN = GetOpenTagRegString(delimiterLeft, delimiterRight, COLOR, COLOR_PARAM); var COLOR_CLOSE = GetCloseTagRegString(delimiterLeft, delimiterRight, COLOR); @@ -4393,6 +4404,9 @@ TagRegexSave.RE_SIZE_OPEN = new RegExp(SIZE_OPEN, 'i'); TagRegexSave.RE_SIZE_CLOSE = new RegExp(SIZE_CLOSE, 'i'); + TagRegexSave.RE_FAMILY_OPEN = new RegExp(FAMILY_OPEN, 'i'); + TagRegexSave.RE_FAMILY_CLOSE = new RegExp(FAMILY_CLOSE, 'i'); + TagRegexSave.RE_COLOR_OPEN = new RegExp(COLOR_OPEN, 'i'); TagRegexSave.RE_COLOR_CLOSE = new RegExp(COLOR_CLOSE, 'i'); @@ -4442,6 +4456,7 @@ WEIGHT_OPEN, WEIGHT_CLOSE, SIZE_OPEN, SIZE_CLOSE, + FAMILY_OPEN, FAMILY_CLOSE, COLOR_OPEN, COLOR_CLOSE, UNDERLINE_OPEN, UNDERLINE_OPENC, UNDERLINE_CLOSE, STRIKETHROUGH_OPEN, STRIKETHROUGH_OPENC, STRIKETHROUGH_CLOSE, diff --git a/dist/rexbbcodetext.min.js b/dist/rexbbcodetext.min.js index 41e70d3c82..cc21ca4cd1 100644 --- a/dist/rexbbcodetext.min.js +++ b/dist/rexbbcodetext.min.js @@ -4,4 +4,4 @@ var t,e;t=void 0,e=function(){var t=Phaser.Renderer.WebGL.Utils,e={renderWebGL:f * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -const d=Phaser.Display.Canvas.CanvasPool;var g=function(t){var e=d.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 d.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,d.remove(e),a;var u,g,c=i.getImageData(0,0,h,l).data,p=c.length,f=4*h,v=0,x=!1;for(u=0;uo;u--){for(g=0;g0&&this.wrapMode!==v&&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=S[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 h in a){var o=a[h],u=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=O(t,u,d);else{var p=E(t,u,d);c&&(p=c(p)),this[h]=p}}var f=O(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var v=O(t,"fill",null);null!==v&&(this.color=l(v));var x=O(t,"metrics",!1);return x?this.metrics={ascent:O(x,"ascent",0),descent:O(x,"descent",0),fontSize:O(x,"fontSize",0)}:!e&&this.metrics||(this.metrics=g(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=g(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=O(t,"fontFamily","Courier"),this.fontSize=O(t,"fontSize","16px"),this.fontStyle=O(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=l(t,this.parent.canvas,this.parent.context),this.backgroundColor2=l(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=l(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=l(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=l(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=l(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=l(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=l(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=l(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=l(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=l(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=l(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=S[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=O(e,"fontFamily",this.fontFamily),this.fontSize=O(e,"fontSize",this.fontSize),this.fontStyle=O(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}}const R=Phaser.Utils.Objects.GetValue;class m{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=R(t,"x",0),i=R(t,"y",0));var s=this.cornerRadius;s.tl=k(R(t,"tl",void 0),e,i),s.tr=k(R(t,"tr",void 0),e,i),s.bl=k(R(t,"bl",void 0),e,i),s.br=k(R(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){_(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){_(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){_(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){_(this.cornerRadius.br,t)}}var k=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),P(t),t},_=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=R(e,"x",0),t.y=R(e,"y",0)),P(t)},P=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const C=Phaser.Math.DegToRad;var b=function(t){return!t.hasOwnProperty("convex")||t.convex},L=function(t){return t.x>0&&t.y>0},M=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=c?1:s/c,v=r>=p?1:r/p,x=g.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=x.tl,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,o,l,o,l,180,270,!1,a):M(t,0,0,o,l,90,0,!0,a),u=0,d=l):(t.lineTo(0,0),u=0,d=0),h=x.tr,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,s-o,l,o,l,270,360,!1,a):M(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=x.br,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,s-o,r-l,o,l,0,90,!1,a):M(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=x.bl,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,o,r-l,o,l,90,180,!1,a):M(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,d),t.closePath(),t.restore()}(e,i,s,r,n,a,g),null!=h)&&(null!=u&&((c=d?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),c.addColorStop(1,u),h=c),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},F={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),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 u=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),A(t.canvas,t.context,u,u,o,l,r,e,i,s,n,a,h)}}(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,u,d,g,c=a.halign,p=a.valign,f=a.lineHeight,v=r.lines,x=v.length,w=a.maxLines;w>0&&x>w?(o=w,l="center"===p?Math.floor((x-o)/2):"bottom"===p?x-o:0):(o=x,l=0),u=l+o;var y=this.rtl,S=y?this.parent.width:void 0;g="center"===p?Math.max((s-o*f)/2,0):"bottom"===p?Math.max(s-o*f-2,0):0,g+=e;for(var E=l;E0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,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)),n.restore(),t.hasAreaMarker&&t.width>0){var d,g=t.prop.area;if(g)d={key:g};else{var c=t.prop.url;d={key:`url:${c}`,url:c}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,d)}},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 h=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=h},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 I=Phaser.Utils.Objects.GetValue,N=c,W=p;class H{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=I(t,"text",""),this.x=I(t,"x",0),this.y=I(t,"y",0),this.width=I(t,"width",0);var e=I(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=I(t,"newLineMode",0),this.startIndex=I(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===W&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==N&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===W&&(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 $=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},B=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:$(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&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?d+=this.tagToText.call(this.tagToTextScope,a,l,u):d+=this.tagToText(a,l,u),u=l,!(o>=e)));g++);return d}get length(){return this.lines.length}set length(t){this.clear()}}var Y={};class j{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?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 K=Phaser.Geom.Rectangle;var V=new j;class J{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&>(f)){""!==y?a.push(n.getLine(y,S,nt)):0===E&&r>0&&a.push(n.getLine("",0,nt)),a.push(...ut(f,e,ot,s,0,n));var T=a.pop();y=T.text,S=T.width,n.freeLine(T)," "===y&&(y="",S=0)}else(x=S+v)>o?(a.push(n.getLine(y,S,nt)),y=f,S=v,o=s):(y+=f,S=x),E===O-1&&a.push(n.getLine(y,S,l))}return a},dt=function(t,e){var i;switch(e){case ht:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==pt&&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 X({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;no;u--){for(g=0;g0&&this.wrapMode!==v&&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=E[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 h in a){var o=a[h],u=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=O(t,u,d);else{var p=S(t,u,d);c&&(p=c(p)),this[h]=p}}var f=O(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var v=O(t,"fill",null);null!==v&&(this.color=l(v));var x=O(t,"metrics",!1);return x?this.metrics={ascent:O(x,"ascent",0),descent:O(x,"descent",0),fontSize:O(x,"fontSize",0)}:!e&&this.metrics||(this.metrics=g(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=g(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=O(t,"fontFamily","Courier"),this.fontSize=O(t,"fontSize","16px"),this.fontStyle=O(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=l(t,this.parent.canvas,this.parent.context),this.backgroundColor2=l(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=l(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=l(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=l(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=l(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=l(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=l(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=l(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=l(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=l(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=l(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=E[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=O(e,"fontFamily",this.fontFamily),this.fontSize=O(e,"fontSize",this.fontSize),this.fontStyle=O(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}}const R=Phaser.Utils.Objects.GetValue;class m{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=R(t,"x",0),i=R(t,"y",0));var s=this.cornerRadius;s.tl=k(R(t,"tl",void 0),e,i),s.tr=k(R(t,"tr",void 0),e,i),s.bl=k(R(t,"bl",void 0),e,i),s.br=k(R(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){_(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){_(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){_(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){_(this.cornerRadius.br,t)}}var k=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),P(t),t},_=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=R(e,"x",0),t.y=R(e,"y",0)),P(t)},P=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const C=Phaser.Math.DegToRad;var b=function(t){return!t.hasOwnProperty("convex")||t.convex},L=function(t){return t.x>0&&t.y>0},M=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=c?1:s/c,v=r>=p?1:r/p,x=g.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=x.tl,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,o,l,o,l,180,270,!1,a):M(t,0,0,o,l,90,0,!0,a),u=0,d=l):(t.lineTo(0,0),u=0,d=0),h=x.tr,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,s-o,l,o,l,270,360,!1,a):M(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=x.br,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,s-o,r-l,o,l,0,90,!1,a):M(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=x.bl,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,o,r-l,o,l,90,180,!1,a):M(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,d),t.closePath(),t.restore()}(e,i,s,r,n,a,g),null!=h)&&(null!=u&&((c=d?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),c.addColorStop(1,u),h=c),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},F={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),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 u=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),A(t.canvas,t.context,u,u,o,l,r,e,i,s,n,a,h)}}(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,u,d,g,c=a.halign,p=a.valign,f=a.lineHeight,v=r.lines,x=v.length,y=a.maxLines;y>0&&x>y?(o=y,l="center"===p?Math.floor((x-o)/2):"bottom"===p?x-o:0):(o=x,l=0),u=l+o;var w=this.rtl,E=w?this.parent.width:void 0;g="center"===p?Math.max((s-o*f)/2,0):"bottom"===p?Math.max(s-o*f-2,0):0,g+=e;for(var S=l;S0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,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)),n.restore(),t.hasAreaMarker&&t.width>0){var d,g=t.prop.area;if(g)d={key:g};else{var c=t.prop.url;d={key:`url:${c}`,url:c}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,d)}},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 h=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=h},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 I=Phaser.Utils.Objects.GetValue,N=c,W=p;class H{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=I(t,"text",""),this.x=I(t,"x",0),this.y=I(t,"y",0),this.width=I(t,"width",0);var e=I(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=I(t,"newLineMode",0),this.startIndex=I(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===W&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==N&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===W&&(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 $=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},B=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:$(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&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?d+=this.tagToText.call(this.tagToTextScope,a,l,u):d+=this.tagToText(a,l,u),u=l,!(o>=e)));g++);return d}get length(){return this.lines.length}set length(t){this.clear()}}var Y={};class j{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?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 K=Phaser.Geom.Rectangle;var V=new j;class J{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&>(f)){""!==w?a.push(n.getLine(w,E,nt)):0===S&&r>0&&a.push(n.getLine("",0,nt)),a.push(...ut(f,e,ot,s,0,n));var T=a.pop();w=T.text,E=T.width,n.freeLine(T)," "===w&&(w="",E=0)}else(x=E+v)>o?(a.push(n.getLine(w,E,nt)),w=f,E=v,o=s):(w+=f,E=x),S===O-1&&a.push(n.getLine(w,E,l))}return a},dt=function(t,e){var i;switch(e){case ht:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==pt&&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 X({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;no;u--){for(g=0;g0&&this.wrapMode!==v&&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=S[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 h in a){var o=a[h],u=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=O(t,u,d);else{var p=E(t,u,d);c&&(p=c(p)),this[h]=p}}var f=O(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var v=O(t,"fill",null);null!==v&&(this.color=l(v));var x=O(t,"metrics",!1);return x?this.metrics={ascent:O(x,"ascent",0),descent:O(x,"descent",0),fontSize:O(x,"fontSize",0)}:!e&&this.metrics||(this.metrics=g(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=g(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=O(t,"fontFamily","Courier"),this.fontSize=O(t,"fontSize","16px"),this.fontStyle=O(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=l(t,this.parent.canvas,this.parent.context),this.backgroundColor2=l(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=l(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=l(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=l(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=l(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=l(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=l(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=l(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=l(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=l(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=l(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=S[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=O(e,"fontFamily",this.fontFamily),this.fontSize=O(e,"fontSize",this.fontSize),this.fontStyle=O(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}}const R=Phaser.Utils.Objects.GetValue;class m{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=R(t,"x",0),i=R(t,"y",0));var s=this.cornerRadius;s.tl=k(R(t,"tl",void 0),e,i),s.tr=k(R(t,"tr",void 0),e,i),s.bl=k(R(t,"bl",void 0),e,i),s.br=k(R(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){_(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){_(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){_(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){_(this.cornerRadius.br,t)}}var k=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),P(t),t},_=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=R(e,"x",0),t.y=R(e,"y",0)),P(t)},P=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const C=Phaser.Math.DegToRad;var b=function(t){return!t.hasOwnProperty("convex")||t.convex},L=function(t){return t.x>0&&t.y>0},M=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=c?1:s/c,v=r>=p?1:r/p,x=g.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=x.tl,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,o,l,o,l,180,270,!1,a):M(t,0,0,o,l,90,0,!0,a),u=0,d=l):(t.lineTo(0,0),u=0,d=0),h=x.tr,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,s-o,l,o,l,270,360,!1,a):M(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=x.br,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,s-o,r-l,o,l,0,90,!1,a):M(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=x.bl,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,o,r-l,o,l,90,180,!1,a):M(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,d),t.closePath(),t.restore()}(e,i,s,r,n,a,g),null!=h)&&(null!=u&&((c=d?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),c.addColorStop(1,u),h=c),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},F={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),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 u=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),A(t.canvas,t.context,u,u,o,l,r,e,i,s,n,a,h)}}(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,u,d,g,c=a.halign,p=a.valign,f=a.lineHeight,v=r.lines,x=v.length,y=a.maxLines;y>0&&x>y?(o=y,l="center"===p?Math.floor((x-o)/2):"bottom"===p?x-o:0):(o=x,l=0),u=l+o;var w=this.rtl,S=w?this.parent.width:void 0;g="center"===p?Math.max((s-o*f)/2,0):"bottom"===p?Math.max(s-o*f-2,0):0,g+=e;for(var E=l;E0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,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)),n.restore(),t.hasAreaMarker&&t.width>0){var d,g=t.prop.area;if(g)d={key:g};else{var c=t.prop.url;d={key:`url:${c}`,url:c}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,d)}},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 h=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=h},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 I=Phaser.Utils.Objects.GetValue,N=c,W=p;class H{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=I(t,"text",""),this.x=I(t,"x",0),this.y=I(t,"y",0),this.width=I(t,"width",0);var e=I(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=I(t,"newLineMode",0),this.startIndex=I(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===W&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==N&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===W&&(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 B=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},$=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:B(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&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?d+=this.tagToText.call(this.tagToTextScope,a,l,u):d+=this.tagToText(a,l,u),u=l,!(o>=e)));g++);return d}get length(){return this.lines.length}set length(t){this.clear()}}var X={};class Y{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?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 K=Phaser.Geom.Rectangle;var V=new Y;class J{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&>(f)){""!==w?a.push(n.getLine(w,S,nt)):0===E&&r>0&&a.push(n.getLine("",0,nt)),a.push(...ut(f,e,ot,s,0,n));var T=a.pop();w=T.text,S=T.width,n.freeLine(T)," "===w&&(w="",S=0)}else(x=S+v)>o?(a.push(n.getLine(w,S,nt)),w=f,S=v,o=s):(w+=f,S=x),E===O-1&&a.push(n.getLine(w,S,l))}return a},dt=function(t,e){var i;switch(e){case ht:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==pt&&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 j({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;no;u--){for(g=0;g0&&this.wrapMode!==v&&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=E[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 h in a){var o=a[h],u=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=O(t,u,d);else{var p=S(t,u,d);c&&(p=c(p)),this[h]=p}}var f=O(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var v=O(t,"fill",null);null!==v&&(this.color=l(v));var x=O(t,"metrics",!1);return x?this.metrics={ascent:O(x,"ascent",0),descent:O(x,"descent",0),fontSize:O(x,"fontSize",0)}:!e&&this.metrics||(this.metrics=g(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=g(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=O(t,"fontFamily","Courier"),this.fontSize=O(t,"fontSize","16px"),this.fontStyle=O(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=l(t,this.parent.canvas,this.parent.context),this.backgroundColor2=l(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=l(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=l(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=l(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=l(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=l(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=l(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=l(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=l(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=l(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=l(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=E[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=O(e,"fontFamily",this.fontFamily),this.fontSize=O(e,"fontSize",this.fontSize),this.fontStyle=O(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}}const R=Phaser.Utils.Objects.GetValue;class m{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=R(t,"x",0),i=R(t,"y",0));var s=this.cornerRadius;s.tl=k(R(t,"tl",void 0),e,i),s.tr=k(R(t,"tr",void 0),e,i),s.bl=k(R(t,"bl",void 0),e,i),s.br=k(R(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){_(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){_(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){_(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){_(this.cornerRadius.br,t)}}var k=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),P(t),t},_=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=R(e,"x",0),t.y=R(e,"y",0)),P(t)},P=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const C=Phaser.Math.DegToRad;var b=function(t){return!t.hasOwnProperty("convex")||t.convex},L=function(t){return t.x>0&&t.y>0},M=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=c?1:s/c,v=r>=p?1:r/p,x=g.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=x.tl,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,o,l,o,l,180,270,!1,a):M(t,0,0,o,l,90,0,!0,a),u=0,d=l):(t.lineTo(0,0),u=0,d=0),h=x.tr,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,s-o,l,o,l,270,360,!1,a):M(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=x.br,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,s-o,r-l,o,l,0,90,!1,a):M(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=x.bl,L(h)?(o=h.x*f,l=h.y*v,b(h)?M(t,o,r-l,o,l,90,180,!1,a):M(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,d),t.closePath(),t.restore()}(e,i,s,r,n,a,g),null!=h)&&(null!=u&&((c=d?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),c.addColorStop(1,u),h=c),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},F={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),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 u=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),A(t.canvas,t.context,u,u,o,l,r,e,i,s,n,a,h)}}(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,u,d,g,c=a.halign,p=a.valign,f=a.lineHeight,v=r.lines,x=v.length,y=a.maxLines;y>0&&x>y?(o=y,l="center"===p?Math.floor((x-o)/2):"bottom"===p?x-o:0):(o=x,l=0),u=l+o;var w=this.rtl,E=w?this.parent.width:void 0;g="center"===p?Math.max((s-o*f)/2,0):"bottom"===p?Math.max(s-o*f-2,0):0,g+=e;for(var S=l;S0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,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)),n.restore(),t.hasAreaMarker&&t.width>0){var d,g=t.prop.area;if(g)d={key:g};else{var c=t.prop.url;d={key:`url:${c}`,url:c}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,d)}},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 h=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=h},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 I=Phaser.Utils.Objects.GetValue,N=c,W=p;class H{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=I(t,"text",""),this.x=I(t,"x",0),this.y=I(t,"y",0),this.width=I(t,"width",0);var e=I(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=I(t,"newLineMode",0),this.startIndex=I(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===W&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==N&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===W&&(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 B=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},$=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:B(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&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?d+=this.tagToText.call(this.tagToTextScope,a,l,u):d+=this.tagToText(a,l,u),u=l,!(o>=e)));g++);return d}get length(){return this.lines.length}set length(t){this.clear()}}var X={};class Y{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?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 K=Phaser.Geom.Rectangle;var V=new Y;class J{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&>(f)){""!==w?a.push(n.getLine(w,E,nt)):0===S&&r>0&&a.push(n.getLine("",0,nt)),a.push(...ut(f,e,ot,s,0,n));var T=a.pop();w=T.text,E=T.width,n.freeLine(T)," "===w&&(w="",E=0)}else(x=E+v)>o?(a.push(n.getLine(w,E,nt)),w=f,E=v,o=s):(w+=f,E=x),S===O-1&&a.push(n.getLine(w,E,l))}return a},dt=function(t,e){var i;switch(e){case ht:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==pt&&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 j({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 * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Mc=Phaser.Display.Canvas.CanvasPool;var Rc=function(t){var e=Mc.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 Mc.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,Mc.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!==Jh&&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=Qh[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]=Dc(t,l,d);else{var u=Lc(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Dc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Dc(t,"fill",null);null!==v&&(this.color=Aa(v));var g=Dc(t,"metrics",!1);return g?this.metrics={ascent:Dc(g,"ascent",0),descent:Dc(g,"descent",0),fontSize:Dc(g,"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=Dc(t,"fontFamily","Courier"),this.fontSize=Dc(t,"fontSize","16px"),this.fontStyle=Dc(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=Aa(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Aa(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Aa(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=Aa(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Aa(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=Aa(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=Aa(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=Aa(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=Aa(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=Aa(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=Aa(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=Aa(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=Qh[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=Dc(e,"fontFamily",this.fontFamily),this.fontSize=Dc(e,"fontSize",this.fontSize),this.fontStyle=Dc(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 Yc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ga(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 x=this.rtl,b=x?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 C=l;C0){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 Xc=Phaser.Utils.Objects.GetValue,Wc=Gh,zc=Uh;class Fc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Xc(t,"text",""),this.x=Xc(t,"x",0),this.y=Xc(t,"y",0),this.width=Xc(t,"width",0);var e=Xc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Xc(t,"newLineMode",0),this.startIndex=Xc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===zc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Wc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===zc&&(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 jc=Phaser.Utils.Objects.GetFastValue,Ic=Gh,Bc=$h;class Hc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=jc(t,"tagToText",Wt),this.tagToTextScope=jc(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 Nc={};const Vc=Phaser.Geom.Rectangle;var Gc=new tl;class Uc{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&au(g)){""!==x?h.push(n.getLine(x,b,tu)):0===C&&r>0&&h.push(n.getLine("",0,tu)),h.push(...nu(g,e,su,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,tu)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},hu=function(t,e){var i;switch(e){case iu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==lu&&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 Hc({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=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return gp(this.sizerChildren,null),vh.call(this,t),this}},mp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)gp(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},Cp={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=We.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,gp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)gp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Sp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Op=Phaser.Utils.Objects.IsPlainObject,Pp=Phaser.Utils.Objects.GetValue;class Tp extends th{constructor(t,e,i,s,r,n,h,a,o,l){Op(e)?(e=Pp(l=e,"x",0),i=Pp(l,"y",0),s=Pp(l,"width",void 0),r=Pp(l,"height",void 0),n=Pp(l,"column",l.col||0),h=Pp(l,"row",0),a=Pp(l,"columnProportions",0),o=Pp(l,"rowProportions",0)):Op(s)?(s=Pp(l=s,"width",void 0),r=Pp(l,"height",void 0),n=Pp(l,"column",l.col||0),h=Pp(l,"row",0),a=Pp(l,"columnProportions",0),o=Pp(l,"rowProportions",0)):Op(n)?(n=Pp(l=n,"column",l.col||0),h=Pp(l,"row",0),a=Pp(l,"columnProportions",0),o=Pp(l,"rowProportions",0)):Op(a)&&(a=Pp(l=a,"columnProportions",0),o=Pp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Pp(l,"createCellContainerCallback")),this.setIndentLeft(Pp(l,"space.indentLeftOdd",0),Pp(l,"space.indentLeftEven",0)),this.setIndentTop(Pp(l,"space.indentTopOdd",0),Pp(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Pp(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=wp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Sp.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(Tp.prototype,Cp);const _p=Phaser.Utils.Objects.GetValue,kp=Phaser.Math.Percent;var Ep=function(t,e,i){var s;return t.y===e.y?s=kp(i.x,t.x,e.x):t.x===e.x&&(s=kp(i.y,t.y,e.y)),s},Mp=function(t,e,i){var s,r;this.enable&&(Rp.x=e,Rp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Ep(s,r,Rp))},Rp={},Lp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Dp.x=t.worldX,Dp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Ep(s,r,Dp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Dp={},Ap=function(t,e){void 0===e&&(e=Yp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(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},Yp={};const Xp=Phaser.Display.Align.LEFT_CENTER,Wp=Phaser.Display.Align.TOP_CENTER;var zp={};const Fp=Phaser.Display.Align.RIGHT_CENTER,jp=Phaser.Display.Align.BOTTOM_CENTER;var Ip={};const Bp=Phaser.Math.Linear;var Hp={};const Np=Phaser.Display.Align.LEFT_CENTER,Vp=Phaser.Display.Align.TOP_CENTER,Gp=Phaser.Display.Align.RIGHT_CENTER,Up=Phaser.Display.Align.BOTTOM_CENTER,$p=Phaser.Utils.Objects.GetValue,Jp=Phaser.Utils.Objects.IsPlainObject,Kp=Phaser.Math.Clamp,qp=Phaser.Math.Snap.To;class Zp extends(rd(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=$p(e,"reverseAxis",!1);var i=$p(e,"background",void 0),s=$p(e,"track",void 0),r=$p(e,"indicator",void 0),n=$p(e,"thumb",void 0);if(i&&(Jp(i)&&(i=xc(t,i)),this.addBackground(i)),s&&(Jp(s)&&(s=xc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Jp(r)&&(r=xc(t,r)),this.pin(r)),n){Jp(n)&&(n=xc(t,n)),this.pin(n);var h=$p(e,"thumbOffsetX",0),a=$p(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=$p(e,"input",0);switch("string"==typeof o&&(o=Qp[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Mp,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",Lp,this).on("pointermove",Lp,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($p(e,"enable",void 0)),this.setGap($p(e,"gap",void 0)),this.setValue($p(e,"value",0),$p(e,"min",void 0),$p(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=qp(t,this.gap));var e=this._value;this._value=Kp(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 Qp={pan:0,drag:0,click:1,none:-1};var tv={getStartPoint:function(t){if(void 0===t&&(t=zp),this.childrenMap.thumb){var e=0===this.orientation?Xp:Wp;Ap.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=Ip),this.childrenMap.thumb){var e=0===this.orientation?Fp:jp;Ap.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=Hp),s.x=Bp(e.x,i.x,t),s.y=Bp(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,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?Gp:Up:0===this.orientation?Np:Vp,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Zp.prototype,tv);const ev=Phaser.Utils.Objects.GetValue;class iv extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=ev(e,"background",void 0),n=ev(e,"buttons",void 0),h=ev(n,"top",ev(n,"left",void 0)),a=ev(n,"bottom",ev(n,"right",void 0)),o=ev(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===ev(o,"width",void 0)?1:0:void 0===ev(o,"height",void 0)?1:0,i=new Zp(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=ev(e,"valuechangeCallback",null);if(null!==d){var c=ev(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(ev(e,"enable",void 0)),this.setValue(ev(e,"value",0)),this.setScrollStep(ev(n,"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 sv extends Rs{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 rv=Phaser.Utils.Objects.GetValue,nv=Phaser.Math.Distance.Between;class hv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=rv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(rv(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(rv(t,"enable",!0)),this.holdThreshold=rv(t,"holdThreshold",50),this.pointerOutReleaseEnable=rv(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 dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:nv(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 av=Phaser.Utils.Objects.GetValue;class ov{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(av(t,"value",0)),this.setSpeed(av(t,"speed",0)),this.setAcceleration(av(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 lv{constructor(){this.value,this.dir,this.movement=new ov}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 pv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},vv=Phaser.Utils.Objects.GetValue;class gv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=vv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(vv(e,"speed",.1)),this.setEnable(vv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(vv(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 fv=Phaser.Utils.Objects.GetValue;var mv=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)?fv(s,l,void 0):fv(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 iv(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=fv(r,"position",0);"string"==typeof p&&(p=yv[p]);var v,g,f=fv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=fv(s,"space.slider",void 0))&&(a?f=0:v=fv(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:fv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:fv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:fv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:fv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=fv(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=fv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=fv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=fv(s,"scrollDetectionMode");"string"==typeof x&&(x=xv[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?fv(s,b,!0):fv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new uv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,T=fv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==x&&(T.focus=1===x?2:0),C=new gv(o,T)),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?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const yv={right:0,left:1,bottom:0,top:1},xv={gameObject:0,rectBounds:1},bv=Phaser.Utils.Objects.GetValue;var Cv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=bv(e,"width"),h=bv(e,"height");n||bv(e,"child.expandWidth",!0)||(s[1]=0),h||bv(e,"child.expandHeight",!0)||(r[1]=0);var a=new Tp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=_p(i,"child"),r=_p(s,"gameObject",void 0);if(r){var n=_p(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=_p(n,"top",0),h.bottom=_p(n,"bottom",0),a.left=_p(n,"left",0),a.right=_p(n,"right",0);break;case 1:h.top=_p(n,"left",0),h.bottom=_p(n,"right",0),a.top=_p(n,"top",0),a.bottom=_p(n,"bottom",0);break;default:h.top=_p(n,"top",0),h.bottom=_p(n,"bottom",0),h.left=_p(n,"left",0),h.right=_p(n,"right",0)}e.add(r,{column:1,row:1,align:_p(s,"align","center"),padding:a,expand:{width:_p(s,"expandWidth",!0),height:_p(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:mv(t,a,"y",e);break;case 1:mv(t,a,"x",e);break;default:mv(t,a,"y",e),mv(t,a,"x",e)}return a},wv=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)},Sv=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)}},Ov=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(Mv.call(this,-this.textOY)),0),e=Rv.call(this,t)+this.textOY,i=Lv.call(this,t);return function(t,e){switch(Ih(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,Dv.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,Ie.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,Yv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Dv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Wv=Phaser.Utils.Objects.IsPlainObject,zv=Phaser.Utils.Objects.GetValue,Fv=Phaser.Display.Align.TOP_LEFT;class jv extends th{constructor(t,e,i,s,r,n){Wv(e)?(e=zv(n=e,"x",0),i=zv(n,"y",0),s=zv(n,"width",void 0),r=zv(n,"height",void 0)):Wv(s)&&(s=zv(n=s,"width",void 0),r=zv(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=zv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(zv(n,"clampTextOY",!0)),this.alwaysScrollable=zv(n,"alwaysScrollable",!1);var h=zv(n,"background",void 0),a=zv(n,"text",void 0);void 0===a&&(a=Iv(t)),this.textCropEnable=zv(n,"textCrop",!!a.setCrop);var o=zv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Fv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Ih(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Xh.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(Mv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Rv.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 Iv=function(t){return t.add.text(0,0,"")};Object.assign(jv.prototype,Xv);var Bv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Hv={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 Nv=Phaser.Utils.Objects.GetValue;class Vv extends kv{constructor(t,e){void 0===e&&(e={});var i=Nv(e,"text",void 0),s=Nv(e,"textWidth",void 0),r=Nv(e,"textHeight",void 0),n=Nv(e,"textCrop",!!i.setCrop),h=Nv(e,"textMask",!n),a=Nv(e,"content",""),o=new jv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Nv(e,"clampChildOY",!1),alwaysScrollable:Nv(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=Nv(e,"space",void 0);l&&(l.child=Nv(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(Vv.prototype,Bv,Hv);const Gv=Phaser.Utils.Objects.GetValue;var Uv=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 np(t,e);break;case"bbcodetext":case"bbcode":s=new ep(t,0,0,"",e);break;case"label":s=new Kv(t,e);break;case"textarea":s=function(t,e,i){e=e?yo(e):{};var s=Gv(i,"background",xc),r=Gv(i,"text",Uv),n=Gv(i,"track",xc),h=Gv(i,"thumb",xc);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 Vv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new wc(t,e)}return yc(s,e),t.add.existing(s),s},$v=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 fc(t,e):new $d(t,e);break;case"roundRectangle":s=new Hl(t,e);break;default:s=new Zd(t,e)}return yc(s,e),t.add.existing(s),s};const Jv=Phaser.Utils.Objects.GetValue;class Kv extends gl{constructor(t,e,i){e=function(t,e,i){e=e?yo(e):{};var s=Jv(i,"background",xc),r=Jv(i,"text",Uv),n=Jv(i,"icon",$v),h=Jv(i,"action",$v);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 qv(this.getChildren(),"setActiveState",t),this}setHoverState(t){return qv(this.getChildren(),"setHoverState",t),this}setDisableState(t){return qv(this.getChildren(),"setDisableState",t),this}}var qv=function(t,e,i){for(var s=0,r=t.length;s=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)):(mg(this),yg(this)),this}setNumberInput(){return this.onUpdateCallback=fg,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Cg=Phaser.Utils.Objects.GetValue,wg=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Sg=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}Mg.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(Rg(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 Lg=new Mg,Dg=/^[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,Ag=/\S/,Yg=new Mg;Yg.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Ag.test(t)&&!Ag.test(e)},Yg.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(Fg(t,null,null,i),i," ")},zg.equals=function(t,e){return Mg.prototype.equals.call(zg,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const jg=new Mg;jg.tokenize=function(t){return t.slice()},jg.join=jg.removeEmpty=function(t){return t};const Ig=Phaser.Utils.Array.Remove;var Bg=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Ig(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Lg.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},Ug={cursorMoveLeft(){if(!this.isOpened)return this;var t=Ng(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Ng(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Vg(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Ng(Gg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Vg(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Ng(Gg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const $g=Phaser.Utils.Objects.IsPlainObject;class Jg extends hl{constructor(t,e,i,s,r,n){$g(e)?n=e:$g(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Sg(e,"wrap.vAlign")||Xd(e,"wrap.vAlign",s=i?"center":"top"),Sg(e,"wrap.wrapMode")||Xd(e,"wrap.wrapMode","char"),Sg(e,"wrap.maxLines")||Xd(e,"wrap.maxLines",s=i?1:void 0),i&&Xd(e,"wrap.wrapWidth",1/0),Sg(e,"wrap.useDefaultTextHeight")||Xd(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Sg(e.edit,"inputType")){var s=i?"text":"textarea";Xd(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Pg(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Xl(n.background,"focus"),o=Xl(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=Cg(e,"edit");return void 0===i&&(i={}),tg(e,i,wg),new bg(t,i)}(this,n),Tg.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Eg.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),kg.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;so;d--){for(c=0;c0&&this.wrapMode!==Jh&&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=Qh[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]=Dc(t,l,d);else{var u=Lc(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Dc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Dc(t,"fill",null);null!==v&&(this.color=Aa(v));var g=Dc(t,"metrics",!1);return g?this.metrics={ascent:Dc(g,"ascent",0),descent:Dc(g,"descent",0),fontSize:Dc(g,"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=Dc(t,"fontFamily","Courier"),this.fontSize=Dc(t,"fontSize","16px"),this.fontStyle=Dc(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=Aa(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Aa(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Aa(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=Aa(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Aa(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=Aa(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=Aa(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=Aa(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=Aa(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=Aa(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=Aa(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=Aa(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=Qh[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=Dc(e,"fontFamily",this.fontFamily),this.fontSize=Dc(e,"fontSize",this.fontSize),this.fontStyle=Dc(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 Yc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ga(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 x=this.rtl,b=x?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 C=l;C0){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 Xc=Phaser.Utils.Objects.GetValue,Wc=Gh,zc=Uh;class Fc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Xc(t,"text",""),this.x=Xc(t,"x",0),this.y=Xc(t,"y",0),this.width=Xc(t,"width",0);var e=Xc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Xc(t,"newLineMode",0),this.startIndex=Xc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===zc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Wc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===zc&&(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 jc=Phaser.Utils.Objects.GetFastValue,Ic=Gh,Bc=$h;class Hc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=jc(t,"tagToText",Wt),this.tagToTextScope=jc(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 Nc={};const Vc=Phaser.Geom.Rectangle;var Gc=new tl;class Uc{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&au(g)){""!==x?h.push(n.getLine(x,b,tu)):0===C&&r>0&&h.push(n.getLine("",0,tu)),h.push(...nu(g,e,su,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,tu)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},hu=function(t,e){var i;switch(e){case iu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==lu&&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 Hc({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=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return gp(this.sizerChildren,null),vh.call(this,t),this}},mp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)gp(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},Cp={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=We.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,gp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)gp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Sp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Op=Phaser.Utils.Objects.IsPlainObject,Pp=Phaser.Utils.Objects.GetValue;class Tp extends th{constructor(t,e,i,s,r,n,h,a,o,l){Op(e)?(e=Pp(l=e,"x",0),i=Pp(l,"y",0),s=Pp(l,"width",void 0),r=Pp(l,"height",void 0),n=Pp(l,"column",l.col||0),h=Pp(l,"row",0),a=Pp(l,"columnProportions",0),o=Pp(l,"rowProportions",0)):Op(s)?(s=Pp(l=s,"width",void 0),r=Pp(l,"height",void 0),n=Pp(l,"column",l.col||0),h=Pp(l,"row",0),a=Pp(l,"columnProportions",0),o=Pp(l,"rowProportions",0)):Op(n)?(n=Pp(l=n,"column",l.col||0),h=Pp(l,"row",0),a=Pp(l,"columnProportions",0),o=Pp(l,"rowProportions",0)):Op(a)&&(a=Pp(l=a,"columnProportions",0),o=Pp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Pp(l,"createCellContainerCallback")),this.setIndentLeft(Pp(l,"space.indentLeftOdd",0),Pp(l,"space.indentLeftEven",0)),this.setIndentTop(Pp(l,"space.indentTopOdd",0),Pp(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Pp(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=wp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Sp.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(Tp.prototype,Cp);const _p=Phaser.Utils.Objects.GetValue,kp=Phaser.Math.Percent;var Ep=function(t,e,i){var s;return t.y===e.y?s=kp(i.x,t.x,e.x):t.x===e.x&&(s=kp(i.y,t.y,e.y)),s},Mp=function(t,e,i){var s,r;this.enable&&(Rp.x=e,Rp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Ep(s,r,Rp))},Rp={},Lp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Dp.x=t.worldX,Dp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Ep(s,r,Dp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Dp={},Ap=function(t,e){void 0===e&&(e=Yp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(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},Yp={};const Xp=Phaser.Display.Align.LEFT_CENTER,Wp=Phaser.Display.Align.TOP_CENTER;var zp={};const Fp=Phaser.Display.Align.RIGHT_CENTER,jp=Phaser.Display.Align.BOTTOM_CENTER;var Ip={};const Bp=Phaser.Math.Linear;var Hp={};const Np=Phaser.Display.Align.LEFT_CENTER,Vp=Phaser.Display.Align.TOP_CENTER,Gp=Phaser.Display.Align.RIGHT_CENTER,Up=Phaser.Display.Align.BOTTOM_CENTER,$p=Phaser.Utils.Objects.GetValue,Jp=Phaser.Utils.Objects.IsPlainObject,Kp=Phaser.Math.Clamp,qp=Phaser.Math.Snap.To;class Zp extends(rd(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=$p(e,"reverseAxis",!1);var i=$p(e,"background",void 0),s=$p(e,"track",void 0),r=$p(e,"indicator",void 0),n=$p(e,"thumb",void 0);if(i&&(Jp(i)&&(i=xc(t,i)),this.addBackground(i)),s&&(Jp(s)&&(s=xc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Jp(r)&&(r=xc(t,r)),this.pin(r)),n){Jp(n)&&(n=xc(t,n)),this.pin(n);var h=$p(e,"thumbOffsetX",0),a=$p(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=$p(e,"input",0);switch("string"==typeof o&&(o=Qp[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Mp,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",Lp,this).on("pointermove",Lp,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($p(e,"enable",void 0)),this.setGap($p(e,"gap",void 0)),this.setValue($p(e,"value",0),$p(e,"min",void 0),$p(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=qp(t,this.gap));var e=this._value;this._value=Kp(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 Qp={pan:0,drag:0,click:1,none:-1};var tv={getStartPoint:function(t){if(void 0===t&&(t=zp),this.childrenMap.thumb){var e=0===this.orientation?Xp:Wp;Ap.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=Ip),this.childrenMap.thumb){var e=0===this.orientation?Fp:jp;Ap.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=Hp),s.x=Bp(e.x,i.x,t),s.y=Bp(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,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?Gp:Up:0===this.orientation?Np:Vp,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Zp.prototype,tv);const ev=Phaser.Utils.Objects.GetValue;class iv extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=ev(e,"background",void 0),n=ev(e,"buttons",void 0),h=ev(n,"top",ev(n,"left",void 0)),a=ev(n,"bottom",ev(n,"right",void 0)),o=ev(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===ev(o,"width",void 0)?1:0:void 0===ev(o,"height",void 0)?1:0,i=new Zp(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=ev(e,"valuechangeCallback",null);if(null!==d){var c=ev(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(ev(e,"enable",void 0)),this.setValue(ev(e,"value",0)),this.setScrollStep(ev(n,"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 sv extends Rs{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 rv=Phaser.Utils.Objects.GetValue,nv=Phaser.Math.Distance.Between;class hv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=rv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(rv(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(rv(t,"enable",!0)),this.holdThreshold=rv(t,"holdThreshold",50),this.pointerOutReleaseEnable=rv(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 dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:nv(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 av=Phaser.Utils.Objects.GetValue;class ov{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(av(t,"value",0)),this.setSpeed(av(t,"speed",0)),this.setAcceleration(av(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 lv{constructor(){this.value,this.dir,this.movement=new ov}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 pv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},vv=Phaser.Utils.Objects.GetValue;class gv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=vv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(vv(e,"speed",.1)),this.setEnable(vv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(vv(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 fv=Phaser.Utils.Objects.GetValue;var mv=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)?fv(s,l,void 0):fv(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 iv(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=fv(r,"position",0);"string"==typeof p&&(p=yv[p]);var v,g,f=fv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=fv(s,"space.slider",void 0))&&(a?f=0:v=fv(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:fv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:fv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:fv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:fv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=fv(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=fv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=fv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=fv(s,"scrollDetectionMode");"string"==typeof x&&(x=xv[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?fv(s,b,!0):fv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new uv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,T=fv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==x&&(T.focus=1===x?2:0),C=new gv(o,T)),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?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const yv={right:0,left:1,bottom:0,top:1},xv={gameObject:0,rectBounds:1},bv=Phaser.Utils.Objects.GetValue;var Cv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=bv(e,"width"),h=bv(e,"height");n||bv(e,"child.expandWidth",!0)||(s[1]=0),h||bv(e,"child.expandHeight",!0)||(r[1]=0);var a=new Tp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=_p(i,"child"),r=_p(s,"gameObject",void 0);if(r){var n=_p(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=_p(n,"top",0),h.bottom=_p(n,"bottom",0),a.left=_p(n,"left",0),a.right=_p(n,"right",0);break;case 1:h.top=_p(n,"left",0),h.bottom=_p(n,"right",0),a.top=_p(n,"top",0),a.bottom=_p(n,"bottom",0);break;default:h.top=_p(n,"top",0),h.bottom=_p(n,"bottom",0),h.left=_p(n,"left",0),h.right=_p(n,"right",0)}e.add(r,{column:1,row:1,align:_p(s,"align","center"),padding:a,expand:{width:_p(s,"expandWidth",!0),height:_p(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:mv(t,a,"y",e);break;case 1:mv(t,a,"x",e);break;default:mv(t,a,"y",e),mv(t,a,"x",e)}return a},wv=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)},Sv=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)}},Ov=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(Mv.call(this,-this.textOY)),0),e=Rv.call(this,t)+this.textOY,i=Lv.call(this,t);return function(t,e){switch(Ih(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,Dv.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,Ie.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,Yv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Dv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Wv=Phaser.Utils.Objects.IsPlainObject,zv=Phaser.Utils.Objects.GetValue,Fv=Phaser.Display.Align.TOP_LEFT;class jv extends th{constructor(t,e,i,s,r,n){Wv(e)?(e=zv(n=e,"x",0),i=zv(n,"y",0),s=zv(n,"width",void 0),r=zv(n,"height",void 0)):Wv(s)&&(s=zv(n=s,"width",void 0),r=zv(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=zv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(zv(n,"clampTextOY",!0)),this.alwaysScrollable=zv(n,"alwaysScrollable",!1);var h=zv(n,"background",void 0),a=zv(n,"text",void 0);void 0===a&&(a=Iv(t)),this.textCropEnable=zv(n,"textCrop",!!a.setCrop);var o=zv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Fv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Ih(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Xh.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(Mv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Rv.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 Iv=function(t){return t.add.text(0,0,"")};Object.assign(jv.prototype,Xv);var Bv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Hv={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 Nv=Phaser.Utils.Objects.GetValue;class Vv extends kv{constructor(t,e){void 0===e&&(e={});var i=Nv(e,"text",void 0),s=Nv(e,"textWidth",void 0),r=Nv(e,"textHeight",void 0),n=Nv(e,"textCrop",!!i.setCrop),h=Nv(e,"textMask",!n),a=Nv(e,"content",""),o=new jv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Nv(e,"clampChildOY",!1),alwaysScrollable:Nv(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=Nv(e,"space",void 0);l&&(l.child=Nv(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(Vv.prototype,Bv,Hv);const Gv=Phaser.Utils.Objects.GetValue;var Uv=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 np(t,e);break;case"bbcodetext":case"bbcode":s=new ep(t,0,0,"",e);break;case"label":s=new Kv(t,e);break;case"textarea":s=function(t,e,i){e=e?yo(e):{};var s=Gv(i,"background",xc),r=Gv(i,"text",Uv),n=Gv(i,"track",xc),h=Gv(i,"thumb",xc);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 Vv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new wc(t,e)}return yc(s,e),t.add.existing(s),s},$v=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 fc(t,e):new $d(t,e);break;case"roundRectangle":s=new Hl(t,e);break;default:s=new Zd(t,e)}return yc(s,e),t.add.existing(s),s};const Jv=Phaser.Utils.Objects.GetValue;class Kv extends gl{constructor(t,e,i){e=function(t,e,i){e=e?yo(e):{};var s=Jv(i,"background",xc),r=Jv(i,"text",Uv),n=Jv(i,"icon",$v),h=Jv(i,"action",$v);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 qv(this.getChildren(),"setActiveState",t),this}setHoverState(t){return qv(this.getChildren(),"setHoverState",t),this}setDisableState(t){return qv(this.getChildren(),"setDisableState",t),this}}var qv=function(t,e,i){for(var s=0,r=t.length;s=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)):(mg(this),yg(this)),this}setNumberInput(){return this.onUpdateCallback=fg,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Cg=Phaser.Utils.Objects.GetValue,wg=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Sg=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}Mg.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(Rg(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 Lg=new Mg,Dg=/^[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,Ag=/\S/,Yg=new Mg;Yg.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Ag.test(t)&&!Ag.test(e)},Yg.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(Fg(t,null,null,i),i," ")},zg.equals=function(t,e){return Mg.prototype.equals.call(zg,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const jg=new Mg;jg.tokenize=function(t){return t.slice()},jg.join=jg.removeEmpty=function(t){return t};const Ig=Phaser.Utils.Array.Remove;var Bg=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Ig(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Lg.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},Ug={cursorMoveLeft(){if(!this.isOpened)return this;var t=Ng(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Ng(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Vg(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Ng(Gg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Vg(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Ng(Gg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const $g=Phaser.Utils.Objects.IsPlainObject;class Jg extends hl{constructor(t,e,i,s,r,n){$g(e)?n=e:$g(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Sg(e,"wrap.vAlign")||Xd(e,"wrap.vAlign",s=i?"center":"top"),Sg(e,"wrap.wrapMode")||Xd(e,"wrap.wrapMode","char"),Sg(e,"wrap.maxLines")||Xd(e,"wrap.maxLines",s=i?1:void 0),i&&Xd(e,"wrap.wrapWidth",1/0),Sg(e,"wrap.useDefaultTextHeight")||Xd(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Sg(e.edit,"inputType")){var s=i?"text":"textarea";Xd(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Pg(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Xl(n.background,"focus"),o=Xl(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=Cg(e,"edit");return void 0===i&&(i={}),tg(e,i,wg),new bg(t,i)}(this,n),Tg.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Eg.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),kg.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;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 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}},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}},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}},_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 Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=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=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=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}},Ye=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},We=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}},Xe=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},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?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==xi&&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=yi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case xi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,xi=-1;class bi extends di{constructor(t,e){super(t,e),this.timer=new vi}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 Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(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 Oi=Phaser.Utils.Objects.GetValue,ki=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let _i=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(Oi(t,"mode",0)),this.setScaleRange(ki(t,"start",void 0),ki(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=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=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 Ei={stop:0,destroy:1,yoyo:2};var Mi=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},Ri=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},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={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(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(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(Ai(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=Ri(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(Ai(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),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Yi),zi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Xi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Fi extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(Xi(t,"start",this.parent.alpha),Xi(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=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(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 Fi(t,h):s.resetFromJSON(h),s.restart(),s},Gi=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 Vi=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(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(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(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(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()}},Ui={};Object.assign(Ui,Ni),Ui.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[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=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(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=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={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 ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={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(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(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 Ki&&(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 Ki(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(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(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 Ki&&(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 Ki(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}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(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=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[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=rs(i,"magnitude",void 0),t=rs(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 hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(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 cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps 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=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(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]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{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 ps(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(vs(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(vs(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 fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(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),Li(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}},ms=Phaser.Utils.Array.Remove,ys={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=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}},As={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}},Ys={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}},Ws={};Object.assign(Ws,Ds,As,Ys,zs);const Xs=Phaser.Utils.Objects.GetValue;class js extends ii{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(js.prototype,Ws);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Fs(e):t};class Is extends ii{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,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 Bs=Phaser.GameObjects.Rectangle;let Hs=class extends Bs{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 Gs=Phaser.Utils.Objects.GetValue;class Vs extends ii{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 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 Vs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Gi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},Ks=function(t,e){Gi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{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",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));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 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 yr(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 Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Pr=Phaser.Utils.Objects.GetValue;class Or extends ii{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?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 kr={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 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 _r 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 Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,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 Rr={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 Mr(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 Mr(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}},Lr={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=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===qr&&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&&or(t,s,e,i)}}const Jr=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{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=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(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 en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}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 en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{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 Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}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=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(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 un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{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(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=bn}onDragEnd(){this.state=xn}onDrag(){this.state===bn&&(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=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),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}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const xn="IDLE",bn="BEGIN",Cn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,On=Phaser.Math.Angle.Between;class kn{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(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=_n,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 _n:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,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=_n,this.onDrag1End();break;case Mn: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 Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(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!==Mn)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!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(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!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)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!==Mn)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=Rn,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,$e);var Tn={};const _n=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,Wn=Phaser.Math.Angle.ShortestBetween,Xn=Phaser.Math.RadToDeg,jn=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=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=zn(Xn(this.angleBetween));this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=zn(Xn(this.angleBetween)),this.angle=Wn(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,Fn);const In="IDLE",Bn="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 tn(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 Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(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 $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(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 yn(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 Kn=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.")},zr.call(t,e),jr.call(t,e),Br.call(t,e),Nr.call(t,e),Vn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={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",ce),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)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var 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 ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?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),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,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},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.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,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},yh={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}},bh={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&&(Ge(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,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,x=this.startChildIndex,b=0,C=u.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.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)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Xe.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.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],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ch,uh,fh,mh,yh,xh,bh);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},Sh={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=Sh[t]),t};const Oh=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Utils.Objects.GetValue;class Th extends th{constructor(t,e,i,s,r,n,h){Oh(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)):Oh(s)?(s=kh(h=s,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Oh(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(Th.prototype,Ch);var _h=Phaser.Renderer.WebGL.Utils,Eh=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+")"},Ah=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 Yh=Phaser.Renderer.Canvas.SetTransform;var zh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Lh(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&&Eh(r,h,e,l,a,o),e.isStroked&&Rh(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(Yh(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(Xh.prototype,zh);const jh=Phaser.Utils.Objects.GetValue;let Fh=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=jh(t,"x",0),i=jh(t,"y",0));var s=this.cornerRadius;s.tl=Ih(jh(t,"tl",void 0),e,i),s.tr=Ih(jh(t,"tr",void 0),e,i),s.bl=Ih(jh(t,"bl",void 0),e,i),s.br=Ih(jh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Bh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Bh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Bh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Bh(this.cornerRadius.br,t)}};var Ih=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Hh(t),t},Bh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=jh(e,"x",0),t.y=jh(e,"y",0)),Hh(t)},Hh=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},Vh=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 Nh=Phaser.Math.DegToRad;var Uh=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(Ra.prototype,Ta);const La=Phaser.Utils.String.Pad;var Da=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${La(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}},Aa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ya=Phaser.Math.DegToRad;var za=function(t){return!t.hasOwnProperty("convex")||t.convex},Wa=function(t){return t.x>0&&t.y>0},Xa=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,za(a)?Xa(t,o,l,o,l,180,270,!1,h):Xa(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,za(a)?Xa(t,s-o,l,o,l,270,360,!1,h):Xa(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,za(a)?Xa(t,s-o,r-l,o,l,0,90,!1,h):Xa(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,za(a)?Xa(t,o,r-l,o,l,90,180,!1,h):Xa(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())},Fa=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)}};const Ia=Phaser.Utils.Objects.GetValue;class Ba extends Ra{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=Da(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Da(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=Da(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,Aa("color2",t,this),Aa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Aa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Aa("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(){Fa(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ha=Phaser.Utils.Objects.GetValue;class Ga extends Ra{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=Da(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Da(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=Da(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 Va=Phaser.Utils.Objects.GetValue;let Na=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(Va(t,"bold",!1)),this.setItalic(Va(t,"italic",!1)),this.setFontSize(Va(t,"fontSize","16px")),this.setFontFamily(Va(t,"fontFamily","Courier")),this.setColor(Va(t,"color","#fff")),this.setStrokeStyle(Va(t,"stroke",null),Va(t,"strokeThickness",0)),this.setShadow(Va(t,"shadowColor",null),Va(t,"shadowOffsetX",0),Va(t,"shadowOffsetY",0),Va(t,"shadowBlur",0)),this.setOffset(Va(t,"offsetX",0),Va(t,"offsetY",0)),this.setSpace(Va(t,"leftSpace",0),Va(t,"rightSpace",0)),this.setAlign(Va(t,"align",void 0)),this.setBackgroundColor(Va(t,"backgroundColor",null)),this.setBackgroundHeight(Va(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Va(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(Aa("stroke",t,this),Aa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Aa("shadowOffsetX",t,this),Aa("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=Da(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Da(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=Da(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=Da(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 Ra{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;var ho=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)};Phaser.Display.Canvas.CanvasPool;class ao extends Ra{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(){ho(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 oo extends Ra{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 lo extends Ra{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 co extends ca{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 uo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>uo(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}var po=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 vo={none:0,word:1,char:2,character:2,mix:3};var go=/^[\x00-\x7F]+$/,fo=function(t){return go.test(t)},mo=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=So(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=So(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=So(t,"wrapMode");void 0===c&&(c=So(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=vo[c]);var u=So(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=So(t,"letterSpacing",0),v=So(t,"hAlign",0),g=So(t,"vAlign",0),f=So(t,"justifyPercentage",.25),m=po({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=ko(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=ko(t,"maxLines",0);var a=0===i,o=ko(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=ko(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=ko(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=ko(t,"letterSpacing",0),p=ko(t,"rtl",!0),v=ko(t,"hAlign",p?2:0),g=ko(t,"vAlign",0),f=po({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 Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(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)),ka(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 Ko=Phaser.Utils.Objects.GetFastValue;var Zo={};class Qo{constructor(t){this.pools=Ko(t,"pools",Zo)}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;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)):(wl(this),Sl(this)),this}setNumberInput(){return this.onUpdateCallback=Cl,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const kl=Phaser.Utils.Objects.GetValue,Tl=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var _l=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}Fl.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(Il(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 Bl=new Fl,Hl=/^[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,Gl=/\S/,Vl=new Fl;Vl.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Gl.test(t)&&!Gl.test(e)},Vl.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(Jl(t,null,null,i),i," ")},$l.equals=function(t,e){return Fl.prototype.equals.call($l,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const ql=new Fl;ql.tokenize=function(t){return t.slice()},ql.join=ql.removeEmpty=function(t){return t};const Kl=Phaser.Utils.Array.Remove;var Zl=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Kl(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Bl.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},sd={cursorMoveLeft(){if(!this.isOpened)return this;var t=td(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=td(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=ed(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=td(id(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=ed(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=td(id(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const rd=Phaser.Utils.Objects.IsPlainObject;class nd extends il{constructor(t,e,i,s,r,n){rd(e)?n=e:rd(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(_l(e,"wrap.vAlign")||Ml(e,"wrap.vAlign",s=i?"center":"top"),_l(e,"wrap.wrapMode")||Ml(e,"wrap.wrapMode","char"),_l(e,"wrap.maxLines")||Ml(e,"wrap.maxLines",s=i?1:void 0),i&&Ml(e,"wrap.wrapWidth",1/0),_l(e,"wrap.useDefaultTextHeight")||Ml(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!_l(e.edit,"inputType")){var s=i?"text":"textarea";Ml(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Ll(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Dl(n.background,"focus"),o=Dl(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=kl(e,"edit");return void 0===i&&(i={}),nl(e,i,Tl),new Ol(t,i)}(this,n),Al.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),jl.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Xl.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)),(u=this.getSizerConfig(t)).align=i,u.padding=ge(s),_d(r)?(u.expandWidth=Ed(r,"width",!1),u.expandHeight=Ed(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),u.alignOffsetX=a,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Dd={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]),Pe.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 vh.call(this,t),this}},Ad={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,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,pr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(kd.width=e.aspectRatio,kd.height=1,Td.width=l,Td.height=d,l=(c=Sd(kd,Td,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),eh(t,this)):Ge(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,h=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),a=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,vr.call(this,t,s,r,n,h,e.align,a,o))}};Object.assign(Ad,Ld,Dd);const Yd=Phaser.Utils.Objects.IsPlainObject,zd=Phaser.Utils.Objects.GetValue;class Wd extends th{constructor(t,e,i,s,r,n){Yd(e)?(e=zd(n=e,"x",0),i=zd(n,"y",0),s=zd(n,"width",void 0),r=zd(n,"height",void 0)):Yd(s)&&(s=zd(n=s,"width",void 0),r=zd(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(Wd.prototype,Ad);var Xd={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 jd extends oa{}Object.assign(jd.prototype,Xd);const Fd=Phaser.Display.Color,Id=Phaser.Math.Percent,Bd=Phaser.Display.Color,Hd=Phaser.Math.Percent,Gd=Phaser.Display.Color.ColorToRGBA,Vd=Phaser.Display.Color.HSVToRGB;class Nd extends jd{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 Bd,this.setOrientation(n),this.setSize(s,r)}setOrientation(t){return this.orientation=Ph(t),this}updateTexture(){return function(t,e,i){void 0===i&&(i=!1);var s=t.width,r=t.height,n=new Fd;if(i)for(var h=0;h0&&r.push(o.join("")),r},Pc=0,Oc=1,kc=2,Tc=0,_c=1,Ec=2,Mc=/(?:\r\n|\r|\n)/;const Rc={none:Tc,word:_c,char:Ec,character:Ec,mix:3};var Lc=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof il}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):bc(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 yc(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 Dc=65535;var Ac=function(t,e,i){if(null==e)return t;if(0===e)return Wc(t,0,i),t;var s=t.text.length;if(0===s)return Wc(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=zc(t,r,e,i,n),a=0;a<=Dc&&0!==h;a++){if((r+=h)<0){r=0;break}h=zc(t,r,e,i,n)}return a===Dc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Wc(t,e,i),t},Yc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},zc=function(t,e,i,s,r){var n,h=Yc(t,e,r),a=Yc(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)},Wc=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 Xc=Phaser.Utils.Objects.GetValue,jc=Phaser.Utils.Objects.GetValue;class Fc extends cc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=jc(e,"background",void 0),r=jc(e,"icon",void 0),n=jc(e,"iconMask",void 0),h=jc(e,"text",void 0),a=jc(e,"action",void 0),o=jc(e,"actionMask",void 0),l=jc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:jc(e,"space.icon",0),top:jc(e,"space.iconTop",0),bottom:jc(e,"space.iconBottom",0),left:jc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:jc(e,"space.icon",0),left:jc(e,"space.iconLeft",0),right:jc(e,"space.iconRight",0),top:jc(e,"space.iconTop",0)});var d=jc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=fc.call(this,r,r,1)),!d){var c=jc(e,"iconSize",void 0);this.setIconSize(jc(e,"iconWidth",c),jc(e,"iconHeight",c))}}if(h){var u=jc(e,"wrapText",!1),p=jc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Cc(t)){case 0:switch("string"==typeof e&&(e=Rc[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=wc;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Rc[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,Lc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Xc(e,"minWidth",0),s=Xc(e,"minHeight",0),r=Xc(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=jc(e,"space.text",0),m=jc(e,"expandTextWidth",!1),y=jc(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:jc(e,"space.actionTop",0),bottom:jc(e,"space.actionBottom",0),right:jc(e,"space.actionRight",0)}:{left:jc(e,"space.actionLeft",0),right:jc(e,"space.actionRight",0),bottom:jc(e,"space.actionBottom",0)},d=jc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=fc.call(this,a,a,1)),!d)){var x=jc(e,"actionSize");this.setActionSize(jc(e,"actionWidth",x),jc(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 Ic=Phaser.Utils.Objects.GetValue;class Bc extends ii{constructor(t,e){super(t,e),this.style=Ic(e,"style",this);var i=Ic(e,"propertiesMap");this.activeStyle=Hc(e,"active",i),this.hoverStyle=Hc(e,"hover",i),this.disableStyle=Hc(e,"disable",i),this.onModifyStyle=Ic(e,"onModifyStyle")}getStyle(t){return zl(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 Wl(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return Gc.call(this,"active",t),this}setHoverState(t){return Gc.call(this,"hover",t),this}setDisableState(t){return Gc.call(this,"disable",t),this}}var Hc=function(t,e,i){var s=Dl(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},Gc=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))},Vc={addStyleManager(t){return this.styleManager=new Bc(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 Nc extends Kh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=Uc,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const Uc={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(Nc.prototype,Vc);const $c=Phaser.GameObjects.GetCalcMatrix,Jc=Phaser.Renderer.Canvas.SetTransform;var qc={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=$c(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 Au=Phaser.Utils.Objects.GetValue,Yu=Phaser.Utils.Objects.IsPlainObject;class zu extends(au(Qc)){constructor(t,e,i,s,r,n,h,a){Yu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Yu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Yu(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 Lu).setName("trackFill")).addShape((new Lu).setName("bar")).addShape((new Lu).setName("trackStroke")),this.setTrackColor(Au(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Au(a,"trackStrokeThickness",2),Au(a,"trackStrokeColor",void 0)),this.setSkewX(Au(a,"skewX",0)),this.setRTL(Au(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 Wu={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&&Du(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),Du(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Du(a,0,0,e,i,t)}};Object.assign(zu.prototype,Wu);class Xu extends zu{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"),Ml(e,"easeValue.duration",e.easeDuration),Ml(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=ju,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 ju={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(Xu.prototype,Vc);var Fu=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},Iu=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Bu=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=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),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 ep(t)?(this.stretchMode.edge=sp(ip(t,"edge",0)),this.stretchMode.internal=sp(ip(t,"internal",0))):(t=sp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return np.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 ap=Phaser.Utils.Objects.IsPlainObject,op=Phaser.Utils.Objects.GetValue,lp=Phaser.GameObjects;var dp=void 0,cp=function(t,e){if(dp||(dp={},ti(t).events.once("destroy",(function(){for(var t in dp)dp[t].destroy();dp=void 0}))),!dp.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new lp[e](i)).setOrigin(0),dp[e]=t}return dp[e]};const up=Phaser.GameObjects.RenderTexture;class pp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(ap(i)?(i=op(d=i,"x",0),s=op(d,"y",0),r=op(d,"width",1),n=op(d,"height",1),h=op(d,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(r)?(r=op(d=r,"width",1),n=op(d,"height",1),h=op(d,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(h)?(h=op(d=h,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(a)?(a=op(d=a,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=op(d,"baseFrame",void 0)):ap(o)&&(o=op(d=o,"columns",void 0),l=op(d,"rows",void 0)),void 0===a&&(a=op(d,"frame",void 0)),void 0===o){var c=op(d,"leftWidth",void 0),u=op(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[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(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,hp),i}(up,"rexNinePatch")){}var vp={_drawImage:function(t,e,i,s,r,n){var h=cp(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=cp(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(pp.prototype,vp);let gp=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Fu(t,e))return t[e];var i=t.parent;return Fu(i,e)?i[e]:void 0}set(t,e,i){return Fu(t,e)?t[e]=i:Fu(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 fp=Phaser.Utils.Objects.GetValue;class mp extends pp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=fp(e,"effects",!0);i&&Vu(this,i),this.style=new gp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(mp.prototype,Vc);const yp=["alpha","tint","flipX","flipY"];var xp=function(t,e){if(!e)return t;for(var i=0,s=yp.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=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}},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}},_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 Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=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=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=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}},Ye=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},We=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}},Xe=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},Fe=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?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==xi&&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=yi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case xi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,xi=-1;class bi extends di{constructor(t,e){super(t,e),this.timer=new vi}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 Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(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 Pi=Phaser.Utils.Objects.GetValue,ki=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let _i=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(ki(t,"start",void 0),ki(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=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=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 Ei={stop:0,destroy:1,yoyo:2};var Mi=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},Ri=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},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={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(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(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(Ai(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=Ri(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(Ai(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),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Yi),zi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Xi=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(Xi(t,"start",this.parent.alpha),Xi(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=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(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},Gi=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 Vi=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(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(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(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(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()}},Ui={};Object.assign(Ui,Ni),Ui.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[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=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(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=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={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 ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={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(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(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 Ki&&(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 Ki(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(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(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 Ki&&(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 Ki(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}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(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=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[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=rs(i,"magnitude",void 0),t=rs(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 hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(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 cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(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]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{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 ps(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(vs(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(vs(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 fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(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),Li(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}},ms=Phaser.Utils.Array.Remove,ys={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=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}},As={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}},Ys={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}},Ws={};Object.assign(Ws,Ds,As,Ys,zs);const Xs=Phaser.Utils.Objects.GetValue;class Fs extends ii{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(Fs.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 ii{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 Bs=Phaser.GameObjects.Rectangle;let Hs=class extends Bs{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 Gs=Phaser.Utils.Objects.GetValue;class Vs extends ii{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 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 Vs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Gi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},Ks=function(t,e){Gi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Fs{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",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));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 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 yr(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 Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(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(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(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?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 kr={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 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 _r 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 Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,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 Rr={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 Mr(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 Mr(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}},Lr={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=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===qr&&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&&or(t,s,e,i)}}const Jr=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{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=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(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 en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}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 en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{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 Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}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=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(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 un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{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(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=bn}onDragEnd(){this.state=xn}onDrag(){this.state===bn&&(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=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),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}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const xn="IDLE",bn="BEGIN",Cn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class kn{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(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=_n,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 _n:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,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=_n,this.onDrag1End();break;case Mn: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 Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(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!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)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;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!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)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!==Mn)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=Rn,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,$e);var Tn={};const _n=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,Wn=Phaser.Math.Angle.ShortestBetween,Xn=Phaser.Math.RadToDeg,Fn=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=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=zn(Xn(this.angleBetween));this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=zn(Xn(this.angleBetween)),this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const In="IDLE",Bn="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 tn(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 Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(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 $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(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 yn(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 Kn=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.")},zr.call(t,e),Fr.call(t,e),Br.call(t,e),Nr.call(t,e),Vn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={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",ce),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)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var 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 ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?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),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,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},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.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,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},yh={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}},bh={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&&(Ge(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,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,x=this.startChildIndex,b=0,C=u.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.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)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Xe.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),Fe.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,uh,fh,mh,yh,xh,bh);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},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Oh=function(t){return"string"==typeof t&&(t=Sh[t]),t};const Ph=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Utils.Objects.GetValue;class Th extends th{constructor(t,e,i,s,r,n,h){Ph(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)):Ph(s)?(s=kh(h=s,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Ph(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=Oh(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(Th.prototype,Ch);var _h=Phaser.Renderer.WebGL.Utils,Eh=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+")"},Ah=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 Yh=Phaser.Renderer.Canvas.SetTransform;var zh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Lh(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&&Eh(r,h,e,l,a,o),e.isStroked&&Rh(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(Yh(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(Xh.prototype,zh);const Fh=Phaser.Utils.Objects.GetValue;let jh=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=Fh(t,"x",0),i=Fh(t,"y",0));var s=this.cornerRadius;s.tl=Ih(Fh(t,"tl",void 0),e,i),s.tr=Ih(Fh(t,"tr",void 0),e,i),s.bl=Ih(Fh(t,"bl",void 0),e,i),s.br=Ih(Fh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Bh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Bh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Bh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Bh(this.cornerRadius.br,t)}};var Ih=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Hh(t),t},Bh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Fh(e,"x",0),t.y=Fh(e,"y",0)),Hh(t)},Hh=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},Vh=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 Nh=Phaser.Math.DegToRad;var Uh=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(Ra.prototype,Ta);const La=Phaser.Utils.String.Pad;var Da=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${La(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}},Aa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ya=Phaser.Math.DegToRad;var za=function(t){return!t.hasOwnProperty("convex")||t.convex},Wa=function(t){return t.x>0&&t.y>0},Xa=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,za(a)?Xa(t,o,l,o,l,180,270,!1,h):Xa(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,za(a)?Xa(t,s-o,l,o,l,270,360,!1,h):Xa(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,za(a)?Xa(t,s-o,r-l,o,l,0,90,!1,h):Xa(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,za(a)?Xa(t,o,r-l,o,l,90,180,!1,h):Xa(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),Fa(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ia=Phaser.Utils.Objects.GetValue;class Ba extends Ra{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=Da(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Da(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=Da(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,Aa("color2",t,this),Aa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Aa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Aa("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 Ha=Phaser.Utils.Objects.GetValue;class Ga extends Ra{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=Da(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Da(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=Da(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 Va=Phaser.Utils.Objects.GetValue;let Na=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(Va(t,"bold",!1)),this.setItalic(Va(t,"italic",!1)),this.setFontSize(Va(t,"fontSize","16px")),this.setFontFamily(Va(t,"fontFamily","Courier")),this.setColor(Va(t,"color","#fff")),this.setStrokeStyle(Va(t,"stroke",null),Va(t,"strokeThickness",0)),this.setShadow(Va(t,"shadowColor",null),Va(t,"shadowOffsetX",0),Va(t,"shadowOffsetY",0),Va(t,"shadowBlur",0)),this.setOffset(Va(t,"offsetX",0),Va(t,"offsetY",0)),this.setSpace(Va(t,"leftSpace",0),Va(t,"rightSpace",0)),this.setAlign(Va(t,"align",void 0)),this.setBackgroundColor(Va(t,"backgroundColor",null)),this.setBackgroundHeight(Va(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Va(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(Aa("stroke",t,this),Aa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Aa("shadowOffsetX",t,this),Aa("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=Da(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Da(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=Da(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=Da(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 Ra{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;var ho=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)};Phaser.Display.Canvas.CanvasPool;class ao extends Ra{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(){ho(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 oo extends Ra{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 lo extends Ra{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 co extends ca{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 uo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>uo(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}var po=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 vo={none:0,word:1,char:2,character:2,mix:3};var go=/^[\x00-\x7F]+$/,fo=function(t){return go.test(t)},mo=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=So(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=So(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=So(t,"wrapMode");void 0===c&&(c=So(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=vo[c]);var u=So(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=So(t,"letterSpacing",0),v=So(t,"hAlign",0),g=So(t,"vAlign",0),f=So(t,"justifyPercentage",.25),m=po({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 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=ko(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=ko(t,"maxLines",0);var a=0===i,o=ko(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=ko(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=ko(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=ko(t,"letterSpacing",0),p=ko(t,"rtl",!0),v=ko(t,"hAlign",p?2:0),g=ko(t,"vAlign",0),f=po({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 Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(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)),ka(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 Ko=Phaser.Utils.Objects.GetFastValue;var Zo={};class Qo{constructor(t){this.pools=Ko(t,"pools",Zo)}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;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)):(wl(this),Sl(this)),this}setNumberInput(){return this.onUpdateCallback=Cl,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const kl=Phaser.Utils.Objects.GetValue,Tl=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var _l=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}jl.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(Il(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 Bl=new jl,Hl=/^[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,Gl=/\S/,Vl=new jl;Vl.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Gl.test(t)&&!Gl.test(e)},Vl.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(Jl(t,null,null,i),i," ")},$l.equals=function(t,e){return jl.prototype.equals.call($l,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const ql=new jl;ql.tokenize=function(t){return t.slice()},ql.join=ql.removeEmpty=function(t){return t};const Kl=Phaser.Utils.Array.Remove;var Zl=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Kl(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Bl.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},sd={cursorMoveLeft(){if(!this.isOpened)return this;var t=td(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=td(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=ed(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=td(id(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=ed(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=td(id(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const rd=Phaser.Utils.Objects.IsPlainObject;class nd extends il{constructor(t,e,i,s,r,n){rd(e)?n=e:rd(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(_l(e,"wrap.vAlign")||Ml(e,"wrap.vAlign",s=i?"center":"top"),_l(e,"wrap.wrapMode")||Ml(e,"wrap.wrapMode","char"),_l(e,"wrap.maxLines")||Ml(e,"wrap.maxLines",s=i?1:void 0),i&&Ml(e,"wrap.wrapWidth",1/0),_l(e,"wrap.useDefaultTextHeight")||Ml(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!_l(e.edit,"inputType")){var s=i?"text":"textarea";Ml(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Ll(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Dl(n.background,"focus"),o=Dl(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=kl(e,"edit");return void 0===i&&(i={}),nl(e,i,Tl),new Pl(t,i)}(this,n),Al.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Fl.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Xl.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)),(u=this.getSizerConfig(t)).align=i,u.padding=ge(s),_d(r)?(u.expandWidth=Ed(r,"width",!1),u.expandHeight=Ed(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),u.alignOffsetX=a,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Dd={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]),Oe.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 vh.call(this,t),this}},Ad={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,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,pr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(kd.width=e.aspectRatio,kd.height=1,Td.width=l,Td.height=d,l=(c=Sd(kd,Td,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),eh(t,this)):Ge(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,h=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),a=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,vr.call(this,t,s,r,n,h,e.align,a,o))}};Object.assign(Ad,Ld,Dd);const Yd=Phaser.Utils.Objects.IsPlainObject,zd=Phaser.Utils.Objects.GetValue;class Wd extends th{constructor(t,e,i,s,r,n){Yd(e)?(e=zd(n=e,"x",0),i=zd(n,"y",0),s=zd(n,"width",void 0),r=zd(n,"height",void 0)):Yd(s)&&(s=zd(n=s,"width",void 0),r=zd(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(Wd.prototype,Ad);var Xd={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 Fd extends oa{}Object.assign(Fd.prototype,Xd);const jd=Phaser.Display.Color,Id=Phaser.Math.Percent,Bd=Phaser.Display.Color,Hd=Phaser.Math.Percent,Gd=Phaser.Display.Color.ColorToRGBA,Vd=Phaser.Display.Color.HSVToRGB;class Nd extends Fd{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 Bd,this.setOrientation(n),this.setSize(s,r)}setOrientation(t){return this.orientation=Oh(t),this}updateTexture(){return function(t,e,i){void 0===i&&(i=!1);var s=t.width,r=t.height,n=new jd;if(i)for(var h=0;h0&&r.push(o.join("")),r},Oc=0,Pc=1,kc=2,Tc=0,_c=1,Ec=2,Mc=/(?:\r\n|\r|\n)/;const Rc={none:Tc,word:_c,char:Ec,character:Ec,mix:3};var Lc=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof il}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):bc(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 yc(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 Dc=65535;var Ac=function(t,e,i){if(null==e)return t;if(0===e)return Wc(t,0,i),t;var s=t.text.length;if(0===s)return Wc(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=zc(t,r,e,i,n),a=0;a<=Dc&&0!==h;a++){if((r+=h)<0){r=0;break}h=zc(t,r,e,i,n)}return a===Dc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Wc(t,e,i),t},Yc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},zc=function(t,e,i,s,r){var n,h=Yc(t,e,r),a=Yc(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)},Wc=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 Xc=Phaser.Utils.Objects.GetValue,Fc=Phaser.Utils.Objects.GetValue;class jc extends cc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Fc(e,"background",void 0),r=Fc(e,"icon",void 0),n=Fc(e,"iconMask",void 0),h=Fc(e,"text",void 0),a=Fc(e,"action",void 0),o=Fc(e,"actionMask",void 0),l=Fc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Fc(e,"space.icon",0),top:Fc(e,"space.iconTop",0),bottom:Fc(e,"space.iconBottom",0),left:Fc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Fc(e,"space.icon",0),left:Fc(e,"space.iconLeft",0),right:Fc(e,"space.iconRight",0),top:Fc(e,"space.iconTop",0)});var d=Fc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=fc.call(this,r,r,1)),!d){var c=Fc(e,"iconSize",void 0);this.setIconSize(Fc(e,"iconWidth",c),Fc(e,"iconHeight",c))}}if(h){var u=Fc(e,"wrapText",!1),p=Fc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Cc(t)){case 0:switch("string"==typeof e&&(e=Rc[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=wc;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Rc[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,Lc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Xc(e,"minWidth",0),s=Xc(e,"minHeight",0),r=Xc(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=Fc(e,"space.text",0),m=Fc(e,"expandTextWidth",!1),y=Fc(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:Fc(e,"space.actionTop",0),bottom:Fc(e,"space.actionBottom",0),right:Fc(e,"space.actionRight",0)}:{left:Fc(e,"space.actionLeft",0),right:Fc(e,"space.actionRight",0),bottom:Fc(e,"space.actionBottom",0)},d=Fc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=fc.call(this,a,a,1)),!d)){var x=Fc(e,"actionSize");this.setActionSize(Fc(e,"actionWidth",x),Fc(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 Ic=Phaser.Utils.Objects.GetValue;class Bc extends ii{constructor(t,e){super(t,e),this.style=Ic(e,"style",this);var i=Ic(e,"propertiesMap");this.activeStyle=Hc(e,"active",i),this.hoverStyle=Hc(e,"hover",i),this.disableStyle=Hc(e,"disable",i),this.onModifyStyle=Ic(e,"onModifyStyle")}getStyle(t){return zl(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 Wl(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return Gc.call(this,"active",t),this}setHoverState(t){return Gc.call(this,"hover",t),this}setDisableState(t){return Gc.call(this,"disable",t),this}}var Hc=function(t,e,i){var s=Dl(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},Gc=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))},Vc={addStyleManager(t){return this.styleManager=new Bc(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 Nc extends Kh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=Uc,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const Uc={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(Nc.prototype,Vc);const $c=Phaser.GameObjects.GetCalcMatrix,Jc=Phaser.Renderer.Canvas.SetTransform;var qc={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=$c(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 Au=Phaser.Utils.Objects.GetValue,Yu=Phaser.Utils.Objects.IsPlainObject;class zu extends(au(Qc)){constructor(t,e,i,s,r,n,h,a){Yu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Yu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Yu(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 Lu).setName("trackFill")).addShape((new Lu).setName("bar")).addShape((new Lu).setName("trackStroke")),this.setTrackColor(Au(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Au(a,"trackStrokeThickness",2),Au(a,"trackStrokeColor",void 0)),this.setSkewX(Au(a,"skewX",0)),this.setRTL(Au(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 Wu={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&&Du(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),Du(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Du(a,0,0,e,i,t)}};Object.assign(zu.prototype,Wu);class Xu extends zu{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"),Ml(e,"easeValue.duration",e.easeDuration),Ml(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=Fu,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 Fu={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(Xu.prototype,Vc);var ju=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},Iu=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Bu=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=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),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 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,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 ep(t)?(this.stretchMode.edge=sp(ip(t,"edge",0)),this.stretchMode.internal=sp(ip(t,"internal",0))):(t=sp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return np.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 ap=Phaser.Utils.Objects.IsPlainObject,op=Phaser.Utils.Objects.GetValue,lp=Phaser.GameObjects;var dp=void 0,cp=function(t,e){if(dp||(dp={},ti(t).events.once("destroy",(function(){for(var t in dp)dp[t].destroy();dp=void 0}))),!dp.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new lp[e](i)).setOrigin(0),dp[e]=t}return dp[e]};const up=Phaser.GameObjects.RenderTexture;class pp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(ap(i)?(i=op(d=i,"x",0),s=op(d,"y",0),r=op(d,"width",1),n=op(d,"height",1),h=op(d,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(r)?(r=op(d=r,"width",1),n=op(d,"height",1),h=op(d,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(h)?(h=op(d=h,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(a)?(a=op(d=a,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=op(d,"baseFrame",void 0)):ap(o)&&(o=op(d=o,"columns",void 0),l=op(d,"rows",void 0)),void 0===a&&(a=op(d,"frame",void 0)),void 0===o){var c=op(d,"leftWidth",void 0),u=op(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[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(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,hp),i}(up,"rexNinePatch")){}var vp={_drawImage:function(t,e,i,s,r,n){var h=cp(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=cp(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(pp.prototype,vp);let gp=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ju(t,e))return t[e];var i=t.parent;return ju(i,e)?i[e]:void 0}set(t,e,i){return ju(t,e)?t[e]=i:ju(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 fp=Phaser.Utils.Objects.GetValue;class mp extends pp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=fp(e,"effects",!0);i&&Vu(this,i),this.style=new gp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(mp.prototype,Vc);const yp=["alpha","tint","flipX","flipY"];var xp=function(t,e){if(!e)return t;for(var i=0,s=yp.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Rp=Phaser.Display.Canvas.CanvasPool;var Lp=function(t){var e=Rp.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 Rp.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,Rp.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!==Tc&&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=Rc[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]=Ap(t,l,d);else{var u=Dp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Ap(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Ap(t,"fill",null);null!==v&&(this.color=Da(v));var g=Ap(t,"metrics",!1);return g?this.metrics={ascent:Ap(g,"ascent",0),descent:Ap(g,"descent",0),fontSize:Ap(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Lp(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=Lp(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=Ap(t,"fontFamily","Courier"),this.fontSize=Ap(t,"fontSize","16px"),this.fontStyle=Ap(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=Da(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Da(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Da(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=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Da(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=Da(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=Da(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=Da(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=Da(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=Da(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=Da(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=Da(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=Rc[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=Ap(e,"fontFamily",this.fontFamily),this.fontSize=Ap(e,"fontSize",this.fontSize),this.fontStyle=Ap(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 zp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Fa(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 x=this.rtl,b=x?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 C=l;C0){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 Wp=Phaser.Utils.Objects.GetValue,Xp=Pc,jp=Oc;class Fp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Wp(t,"text",""),this.x=Wp(t,"x",0),this.y=Wp(t,"y",0),this.width=Wp(t,"width",0);var e=Wp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Wp(t,"newLineMode",0),this.startIndex=Wp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===jp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Xp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===jp&&(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 Ip=Phaser.Utils.Objects.GetFastValue,Bp=Pc,Hp=kc;class Gp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Ip(t,"tagToText",Wt),this.tagToTextScope=Ip(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 Vp={};const Np=Phaser.Geom.Rectangle;var Up=new qo;class $p{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&ov(g)){""!==x?h.push(n.getLine(x,b,ev)):0===C&&r>0&&h.push(n.getLine("",0,ev)),h.push(...hv(g,e,rv,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,ev)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},av=function(t,e){var i;switch(e){case sv:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==dv&&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 Gp({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=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return fg(this.sizerChildren,null),vh.call(this,t),this}},yg={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)fg(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},wg={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=We.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,fg(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)fg(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Pg=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Og=Phaser.Utils.Objects.IsPlainObject,kg=Phaser.Utils.Objects.GetValue;class Tg extends th{constructor(t,e,i,s,r,n,h,a,o,l){Og(e)?(e=kg(l=e,"x",0),i=kg(l,"y",0),s=kg(l,"width",void 0),r=kg(l,"height",void 0),n=kg(l,"column",l.col||0),h=kg(l,"row",0),a=kg(l,"columnProportions",0),o=kg(l,"rowProportions",0)):Og(s)?(s=kg(l=s,"width",void 0),r=kg(l,"height",void 0),n=kg(l,"column",l.col||0),h=kg(l,"row",0),a=kg(l,"columnProportions",0),o=kg(l,"rowProportions",0)):Og(n)?(n=kg(l=n,"column",l.col||0),h=kg(l,"row",0),a=kg(l,"columnProportions",0),o=kg(l,"rowProportions",0)):Og(a)&&(a=kg(l=a,"columnProportions",0),o=kg(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(kg(l,"createCellContainerCallback")),this.setIndentLeft(kg(l,"space.indentLeftOdd",0),kg(l,"space.indentLeftEven",0)),this.setIndentTop(kg(l,"space.indentTopOdd",0),kg(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,kg(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=Sg.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Pg.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(Tg.prototype,wg);const _g=Phaser.Utils.Objects.GetValue,Eg=Phaser.Math.Percent;var Mg=function(t,e,i){var s;return t.y===e.y?s=Eg(i.x,t.x,e.x):t.x===e.x&&(s=Eg(i.y,t.y,e.y)),s},Rg=function(t,e,i){var s,r;this.enable&&(Lg.x=e,Lg.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Mg(s,r,Lg))},Lg={},Dg=function(t,e,i){if(this.enable&&t.isDown){var s,r;Ag.x=t.worldX,Ag.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Mg(s,r,Ag);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Ag={},Yg=function(t,e){void 0===e&&(e=zg);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(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},zg={};const Wg=Phaser.Display.Align.LEFT_CENTER,Xg=Phaser.Display.Align.TOP_CENTER;var jg={};const Fg=Phaser.Display.Align.RIGHT_CENTER,Ig=Phaser.Display.Align.BOTTOM_CENTER;var Bg={};const Hg=Phaser.Math.Linear;var Gg={};const Vg=Phaser.Display.Align.LEFT_CENTER,Ng=Phaser.Display.Align.TOP_CENTER,Ug=Phaser.Display.Align.RIGHT_CENTER,$g=Phaser.Display.Align.BOTTOM_CENTER,Jg=Phaser.Utils.Objects.GetValue,qg=Phaser.Utils.Objects.IsPlainObject,Kg=Phaser.Math.Clamp,Zg=Phaser.Math.Snap.To;class Qg extends(au(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Jg(e,"reverseAxis",!1);var i=Jg(e,"background",void 0),s=Jg(e,"track",void 0),r=Jg(e,"indicator",void 0),n=Jg(e,"thumb",void 0);if(i&&(qg(i)&&(i=bp(t,i)),this.addBackground(i)),s&&(qg(s)&&(s=bp(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(qg(r)&&(r=bp(t,r)),this.pin(r)),n){qg(n)&&(n=bp(t,n)),this.pin(n);var h=Jg(e,"thumbOffsetX",0),a=Jg(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=Jg(e,"input",0);switch("string"==typeof o&&(o=tf[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Rg,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",Dg,this).on("pointermove",Dg,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(Jg(e,"enable",void 0)),this.setGap(Jg(e,"gap",void 0)),this.setValue(Jg(e,"value",0),Jg(e,"min",void 0),Jg(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=Zg(t,this.gap));var e=this._value;this._value=Kg(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 tf={pan:0,drag:0,click:1,none:-1};var ef={getStartPoint:function(t){if(void 0===t&&(t=jg),this.childrenMap.thumb){var e=0===this.orientation?Wg:Xg;Yg.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=Bg),this.childrenMap.thumb){var e=0===this.orientation?Fg:Ig;Yg.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=Gg),s.x=Hg(e.x,i.x,t),s.y=Hg(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,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ge(e,i,s),r=n?0===this.orientation?Ug:$g:0===this.orientation?Vg:Ng,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Qg.prototype,ef);const sf=Phaser.Utils.Objects.GetValue;class rf extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=sf(e,"background",void 0),n=sf(e,"buttons",void 0),h=sf(n,"top",sf(n,"left",void 0)),a=sf(n,"bottom",sf(n,"right",void 0)),o=sf(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===sf(o,"width",void 0)?1:0:void 0===sf(o,"height",void 0)?1:0,i=new Qg(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=sf(e,"valuechangeCallback",null);if(null!==d){var c=sf(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(sf(e,"enable",void 0)),this.setValue(sf(e,"value",0)),this.setScrollStep(sf(n,"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 nf extends Rs{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 hf=Phaser.Utils.Objects.GetValue,af=Phaser.Math.Distance.Between;class of extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=hf(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(hf(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(hf(t,"enable",!0)),this.holdThreshold=hf(t,"holdThreshold",50),this.pointerOutReleaseEnable=hf(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 dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:af(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 lf=Phaser.Utils.Objects.GetValue;class df{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(lf(t,"value",0)),this.setSpeed(lf(t,"speed",0)),this.setAcceleration(lf(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 cf{constructor(){this.value,this.dir,this.movement=new df}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 gf={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},ff=Phaser.Utils.Objects.GetValue;class mf extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=ff(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(ff(e,"speed",.1)),this.setEnable(ff(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(ff(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 yf=Phaser.Utils.Objects.GetValue;var xf=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)?yf(s,l,void 0):yf(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 rf(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=yf(r,"position",0);"string"==typeof p&&(p=bf[p]);var v,g,f=yf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=yf(s,"space.slider",void 0))&&(a?f=0:v=yf(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:yf(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:yf(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:yf(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:yf(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=yf(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=yf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=yf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=yf(s,"scrollDetectionMode");"string"==typeof x&&(x=Cf[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?yf(s,b,!0):yf(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new vf(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,P,O,k=yf(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==x&&(k.focus=1===x?2:0),C=new mf(o,k)),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?(w=h?"t":"s",P=`scroll${i}`):(w="t",P="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(P,t)}))),y&&(a?(S=`childO${i}`,P=`scroll${i}`):(S="childOY",P="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(P,t)}))),C&&(O=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[O](-e,!0)})))};const bf={right:0,left:1,bottom:0,top:1},Cf={gameObject:0,rectBounds:1},wf=Phaser.Utils.Objects.GetValue;var Sf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=wf(e,"width"),h=wf(e,"height");n||wf(e,"child.expandWidth",!0)||(s[1]=0),h||wf(e,"child.expandHeight",!0)||(r[1]=0);var a=new Tg(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=_g(i,"child"),r=_g(s,"gameObject",void 0);if(r){var n=_g(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=_g(n,"top",0),h.bottom=_g(n,"bottom",0),a.left=_g(n,"left",0),a.right=_g(n,"right",0);break;case 1:h.top=_g(n,"left",0),h.bottom=_g(n,"right",0),a.top=_g(n,"top",0),a.bottom=_g(n,"bottom",0);break;default:h.top=_g(n,"top",0),h.bottom=_g(n,"bottom",0),h.left=_g(n,"left",0),h.right=_g(n,"right",0)}e.add(r,{column:1,row:1,align:_g(s,"align","center"),padding:a,expand:{width:_g(s,"expandWidth",!0),height:_g(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:xf(t,a,"y",e);break;case 1:xf(t,a,"x",e);break;default:xf(t,a,"y",e),xf(t,a,"x",e)}return a},Pf=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)},Of=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)}},kf=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(Lf.call(this,-this.textOY)),0),e=Df.call(this,t)+this.textOY,i=Af.call(this,t);return function(t,e){switch(Cc(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,Yf.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,Ie.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,Wf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Yf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const jf=Phaser.Utils.Objects.IsPlainObject,Ff=Phaser.Utils.Objects.GetValue,If=Phaser.Display.Align.TOP_LEFT;class Bf extends th{constructor(t,e,i,s,r,n){jf(e)?(e=Ff(n=e,"x",0),i=Ff(n,"y",0),s=Ff(n,"width",void 0),r=Ff(n,"height",void 0)):jf(s)&&(s=Ff(n=s,"width",void 0),r=Ff(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=Ff(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Ff(n,"clampTextOY",!0)),this.alwaysScrollable=Ff(n,"alwaysScrollable",!1);var h=Ff(n,"background",void 0),a=Ff(n,"text",void 0);void 0===a&&(a=Hf(t)),this.textCropEnable=Ff(n,"textCrop",!!a.setCrop);var o=Ff(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=If,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Cc(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=fc.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(Lf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Df.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 Hf=function(t){return t.add.text(0,0,"")};Object.assign(Bf.prototype,Xf);var Gf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Vf={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 Nf=Phaser.Utils.Objects.GetValue;class Uf extends Mf{constructor(t,e){void 0===e&&(e={});var i=Nf(e,"text",void 0),s=Nf(e,"textWidth",void 0),r=Nf(e,"textHeight",void 0),n=Nf(e,"textCrop",!!i.setCrop),h=Nf(e,"textMask",!n),a=Nf(e,"content",""),o=new Bf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Nf(e,"clampChildOY",!1),alwaysScrollable:Nf(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=Nf(e,"space",void 0);l&&(l.child=Nf(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(Uf.prototype,Gf,Vf);const $f=Phaser.Utils.Objects.GetValue;var Jf=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 hg(t,e);break;case"bbcodetext":case"bbcode":s=new ig(t,0,0,"",e);break;case"label":s=new Zf(t,e);break;case"textarea":s=function(t,e,i){e=e?uo(e):{};var s=$f(i,"background",bp),r=$f(i,"text",Jf),n=$f(i,"track",bp),h=$f(i,"thumb",bp);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 Uf(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Sp(t,e)}return xp(s,e),t.add.existing(s),s},qf=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 mp(t,e):new Ju(t,e);break;case"roundRectangle":s=new Nc(t,e);break;default:s=new Qu(t,e)}return xp(s,e),t.add.existing(s),s};const Kf=Phaser.Utils.Objects.GetValue;class Zf extends Fc{constructor(t,e,i){e=function(t,e,i){e=e?uo(e):{};var s=Kf(i,"background",bp),r=Kf(i,"text",Jf),n=Kf(i,"icon",qf),h=Kf(i,"action",qf);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 Qf(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Qf(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Qf(this.getChildren(),"setDisableState",t),this}}var Qf=function(t,e,i){for(var s=0,r=t.length;s0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var h=new am(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(h),h};const lm=Phaser.Utils.Objects.GetValue;var dm=function(t,e){var i=lm(e,"expandDirection",void 0);"string"==typeof i&&(i=cm[i]);var s,r,n,h,a,o,l,d=(n="alignTargetX",_l(s=e,r="alignTarget")?ks(s,r):n&&_l(s,n)?ks(s,n):h&&_l(s,h)?ks(s,h):a),c=lm(e,"alignTargetY",d),u=lm(e,"alignOffsetX",0),p=lm(e,"alignOffsetY",0),v=lm(e,"alignSide","").includes("right"),g=lm(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,x=f||m?0:1;t.setOrigin(y,x),o=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var b=g;b||(b=Dt(t.scene)),m&&t.getBottomLeft().y>b.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const cm={down:0,up:1},um=Phaser.Utils.Objects.GetValue;class pm extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Mi(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 _i(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),dm(t,e),t.isRexSizer&&t.layout();var i=um(e,"touchOutsideClose",!1),s=um(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&&Zs(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 vm={openColorPicker:function(){if(!this.colorPicker){var t=om.call(this).layout(),e=new pm(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(vm,Cd);const gm=Phaser.Utils.Objects.GetValue;class fm extends bd{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(gm(i,"width",160),gm(i,"height",170));var n=gm(i,"background");r=n?function(t){return bp(t,n)}:gm(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(gm(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(gm(i,"expandDirection")),this.setColorPickerEaseInDuration(gm(i,"easeIn",200)),this.setColorPickerEaseOutDuration(gm(i,"easeOut",200)),this.setColorPickerTransitInCallback(gm(i,"transitIn")),this.setColorPickerTransitOutCallback(gm(i,"transitOut")),this.setColorPickerBounds(gm(i,"bounds"));var h=gm(i,"space");void 0===h&&(h={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(h)}var a=e.colorComponents;if(s&&!1!==a&&null!==a){this.setColorComponentsHeight(gm(a,"height",30)),this.setColorComponentsFormatLabelConfig(gm(a,"formatLabel"));var o=gm(a,"inputText");o||(o=gm(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=gm(a,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}return Object.assign(fm.prototype,vm),fm},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcolorinput=e(); + */const Rp=Phaser.Display.Canvas.CanvasPool;var Lp=function(t){var e=Rp.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 Rp.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,Rp.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!==Tc&&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=Rc[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]=Ap(t,l,d);else{var u=Dp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Ap(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Ap(t,"fill",null);null!==v&&(this.color=Da(v));var g=Ap(t,"metrics",!1);return g?this.metrics={ascent:Ap(g,"ascent",0),descent:Ap(g,"descent",0),fontSize:Ap(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Lp(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=Lp(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=Ap(t,"fontFamily","Courier"),this.fontSize=Ap(t,"fontSize","16px"),this.fontStyle=Ap(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=Da(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Da(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Da(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=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Da(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=Da(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=Da(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=Da(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=Da(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=Da(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=Da(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=Da(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=Rc[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=Ap(e,"fontFamily",this.fontFamily),this.fontSize=Ap(e,"fontSize",this.fontSize),this.fontStyle=Ap(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 zp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),ja(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 x=this.rtl,b=x?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 C=l;C0){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 Wp=Phaser.Utils.Objects.GetValue,Xp=Oc,Fp=Pc;class jp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Wp(t,"text",""),this.x=Wp(t,"x",0),this.y=Wp(t,"y",0),this.width=Wp(t,"width",0);var e=Wp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Wp(t,"newLineMode",0),this.startIndex=Wp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Fp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Xp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Fp&&(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 Ip=Phaser.Utils.Objects.GetFastValue,Bp=Oc,Hp=kc;class Gp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Ip(t,"tagToText",Wt),this.tagToTextScope=Ip(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 Vp={};const Np=Phaser.Geom.Rectangle;var Up=new qo;class $p{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&ov(g)){""!==x?h.push(n.getLine(x,b,ev)):0===C&&r>0&&h.push(n.getLine("",0,ev)),h.push(...hv(g,e,rv,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,ev)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},av=function(t,e){var i;switch(e){case sv:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==dv&&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 Gp({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=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return fg(this.sizerChildren,null),vh.call(this,t),this}},yg={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)fg(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},wg={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=We.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,fg(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)fg(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Og=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Pg=Phaser.Utils.Objects.IsPlainObject,kg=Phaser.Utils.Objects.GetValue;class Tg extends th{constructor(t,e,i,s,r,n,h,a,o,l){Pg(e)?(e=kg(l=e,"x",0),i=kg(l,"y",0),s=kg(l,"width",void 0),r=kg(l,"height",void 0),n=kg(l,"column",l.col||0),h=kg(l,"row",0),a=kg(l,"columnProportions",0),o=kg(l,"rowProportions",0)):Pg(s)?(s=kg(l=s,"width",void 0),r=kg(l,"height",void 0),n=kg(l,"column",l.col||0),h=kg(l,"row",0),a=kg(l,"columnProportions",0),o=kg(l,"rowProportions",0)):Pg(n)?(n=kg(l=n,"column",l.col||0),h=kg(l,"row",0),a=kg(l,"columnProportions",0),o=kg(l,"rowProportions",0)):Pg(a)&&(a=kg(l=a,"columnProportions",0),o=kg(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(kg(l,"createCellContainerCallback")),this.setIndentLeft(kg(l,"space.indentLeftOdd",0),kg(l,"space.indentLeftEven",0)),this.setIndentTop(kg(l,"space.indentTopOdd",0),kg(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,kg(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=Sg.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Og.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(Tg.prototype,wg);const _g=Phaser.Utils.Objects.GetValue,Eg=Phaser.Math.Percent;var Mg=function(t,e,i){var s;return t.y===e.y?s=Eg(i.x,t.x,e.x):t.x===e.x&&(s=Eg(i.y,t.y,e.y)),s},Rg=function(t,e,i){var s,r;this.enable&&(Lg.x=e,Lg.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Mg(s,r,Lg))},Lg={},Dg=function(t,e,i){if(this.enable&&t.isDown){var s,r;Ag.x=t.worldX,Ag.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Mg(s,r,Ag);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Ag={},Yg=function(t,e){void 0===e&&(e=zg);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(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},zg={};const Wg=Phaser.Display.Align.LEFT_CENTER,Xg=Phaser.Display.Align.TOP_CENTER;var Fg={};const jg=Phaser.Display.Align.RIGHT_CENTER,Ig=Phaser.Display.Align.BOTTOM_CENTER;var Bg={};const Hg=Phaser.Math.Linear;var Gg={};const Vg=Phaser.Display.Align.LEFT_CENTER,Ng=Phaser.Display.Align.TOP_CENTER,Ug=Phaser.Display.Align.RIGHT_CENTER,$g=Phaser.Display.Align.BOTTOM_CENTER,Jg=Phaser.Utils.Objects.GetValue,qg=Phaser.Utils.Objects.IsPlainObject,Kg=Phaser.Math.Clamp,Zg=Phaser.Math.Snap.To;class Qg extends(au(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Jg(e,"reverseAxis",!1);var i=Jg(e,"background",void 0),s=Jg(e,"track",void 0),r=Jg(e,"indicator",void 0),n=Jg(e,"thumb",void 0);if(i&&(qg(i)&&(i=bp(t,i)),this.addBackground(i)),s&&(qg(s)&&(s=bp(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(qg(r)&&(r=bp(t,r)),this.pin(r)),n){qg(n)&&(n=bp(t,n)),this.pin(n);var h=Jg(e,"thumbOffsetX",0),a=Jg(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=Jg(e,"input",0);switch("string"==typeof o&&(o=tf[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Rg,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",Dg,this).on("pointermove",Dg,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(Jg(e,"enable",void 0)),this.setGap(Jg(e,"gap",void 0)),this.setValue(Jg(e,"value",0),Jg(e,"min",void 0),Jg(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=Zg(t,this.gap));var e=this._value;this._value=Kg(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 tf={pan:0,drag:0,click:1,none:-1};var ef={getStartPoint:function(t){if(void 0===t&&(t=Fg),this.childrenMap.thumb){var e=0===this.orientation?Wg:Xg;Yg.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=Bg),this.childrenMap.thumb){var e=0===this.orientation?jg:Ig;Yg.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=Gg),s.x=Hg(e.x,i.x,t),s.y=Hg(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,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ge(e,i,s),r=n?0===this.orientation?Ug:$g:0===this.orientation?Vg:Ng,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Qg.prototype,ef);const sf=Phaser.Utils.Objects.GetValue;class rf extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=sf(e,"background",void 0),n=sf(e,"buttons",void 0),h=sf(n,"top",sf(n,"left",void 0)),a=sf(n,"bottom",sf(n,"right",void 0)),o=sf(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===sf(o,"width",void 0)?1:0:void 0===sf(o,"height",void 0)?1:0,i=new Qg(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=sf(e,"valuechangeCallback",null);if(null!==d){var c=sf(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(sf(e,"enable",void 0)),this.setValue(sf(e,"value",0)),this.setScrollStep(sf(n,"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 nf extends Rs{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 hf=Phaser.Utils.Objects.GetValue,af=Phaser.Math.Distance.Between;class of extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=hf(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(hf(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(hf(t,"enable",!0)),this.holdThreshold=hf(t,"holdThreshold",50),this.pointerOutReleaseEnable=hf(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 dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:af(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 lf=Phaser.Utils.Objects.GetValue;class df{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(lf(t,"value",0)),this.setSpeed(lf(t,"speed",0)),this.setAcceleration(lf(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 cf{constructor(){this.value,this.dir,this.movement=new df}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 gf={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},ff=Phaser.Utils.Objects.GetValue;class mf extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=ff(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(ff(e,"speed",.1)),this.setEnable(ff(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(ff(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 yf=Phaser.Utils.Objects.GetValue;var xf=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)?yf(s,l,void 0):yf(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 rf(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=yf(r,"position",0);"string"==typeof p&&(p=bf[p]);var v,g,f=yf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=yf(s,"space.slider",void 0))&&(a?f=0:v=yf(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:yf(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:yf(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:yf(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:yf(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=yf(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=yf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=yf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=yf(s,"scrollDetectionMode");"string"==typeof x&&(x=Cf[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?yf(s,b,!0):yf(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new vf(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,k=yf(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==x&&(k.focus=1===x?2:0),C=new mf(o,k)),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?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const bf={right:0,left:1,bottom:0,top:1},Cf={gameObject:0,rectBounds:1},wf=Phaser.Utils.Objects.GetValue;var Sf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=wf(e,"width"),h=wf(e,"height");n||wf(e,"child.expandWidth",!0)||(s[1]=0),h||wf(e,"child.expandHeight",!0)||(r[1]=0);var a=new Tg(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=_g(i,"child"),r=_g(s,"gameObject",void 0);if(r){var n=_g(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=_g(n,"top",0),h.bottom=_g(n,"bottom",0),a.left=_g(n,"left",0),a.right=_g(n,"right",0);break;case 1:h.top=_g(n,"left",0),h.bottom=_g(n,"right",0),a.top=_g(n,"top",0),a.bottom=_g(n,"bottom",0);break;default:h.top=_g(n,"top",0),h.bottom=_g(n,"bottom",0),h.left=_g(n,"left",0),h.right=_g(n,"right",0)}e.add(r,{column:1,row:1,align:_g(s,"align","center"),padding:a,expand:{width:_g(s,"expandWidth",!0),height:_g(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:xf(t,a,"y",e);break;case 1:xf(t,a,"x",e);break;default:xf(t,a,"y",e),xf(t,a,"x",e)}return a},Of=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)},Pf=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)}},kf=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(Lf.call(this,-this.textOY)),0),e=Df.call(this,t)+this.textOY,i=Af.call(this,t);return function(t,e){switch(Cc(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,Yf.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,Ie.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,Wf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Yf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Ff=Phaser.Utils.Objects.IsPlainObject,jf=Phaser.Utils.Objects.GetValue,If=Phaser.Display.Align.TOP_LEFT;class Bf extends th{constructor(t,e,i,s,r,n){Ff(e)?(e=jf(n=e,"x",0),i=jf(n,"y",0),s=jf(n,"width",void 0),r=jf(n,"height",void 0)):Ff(s)&&(s=jf(n=s,"width",void 0),r=jf(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=jf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(jf(n,"clampTextOY",!0)),this.alwaysScrollable=jf(n,"alwaysScrollable",!1);var h=jf(n,"background",void 0),a=jf(n,"text",void 0);void 0===a&&(a=Hf(t)),this.textCropEnable=jf(n,"textCrop",!!a.setCrop);var o=jf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=If,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Cc(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=fc.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(Lf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Df.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 Hf=function(t){return t.add.text(0,0,"")};Object.assign(Bf.prototype,Xf);var Gf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Vf={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 Nf=Phaser.Utils.Objects.GetValue;class Uf extends Mf{constructor(t,e){void 0===e&&(e={});var i=Nf(e,"text",void 0),s=Nf(e,"textWidth",void 0),r=Nf(e,"textHeight",void 0),n=Nf(e,"textCrop",!!i.setCrop),h=Nf(e,"textMask",!n),a=Nf(e,"content",""),o=new Bf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Nf(e,"clampChildOY",!1),alwaysScrollable:Nf(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=Nf(e,"space",void 0);l&&(l.child=Nf(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(Uf.prototype,Gf,Vf);const $f=Phaser.Utils.Objects.GetValue;var Jf=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 hg(t,e);break;case"bbcodetext":case"bbcode":s=new ig(t,0,0,"",e);break;case"label":s=new Zf(t,e);break;case"textarea":s=function(t,e,i){e=e?uo(e):{};var s=$f(i,"background",bp),r=$f(i,"text",Jf),n=$f(i,"track",bp),h=$f(i,"thumb",bp);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 Uf(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Sp(t,e)}return xp(s,e),t.add.existing(s),s},qf=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 mp(t,e):new Ju(t,e);break;case"roundRectangle":s=new Nc(t,e);break;default:s=new Qu(t,e)}return xp(s,e),t.add.existing(s),s};const Kf=Phaser.Utils.Objects.GetValue;class Zf extends jc{constructor(t,e,i){e=function(t,e,i){e=e?uo(e):{};var s=Kf(i,"background",bp),r=Kf(i,"text",Jf),n=Kf(i,"icon",qf),h=Kf(i,"action",qf);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 Qf(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Qf(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Qf(this.getChildren(),"setDisableState",t),this}}var Qf=function(t,e,i){for(var s=0,r=t.length;s0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var h=new am(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(h),h};const lm=Phaser.Utils.Objects.GetValue;var dm=function(t,e){var i=lm(e,"expandDirection",void 0);"string"==typeof i&&(i=cm[i]);var s,r,n,h,a,o,l,d=(n="alignTargetX",_l(s=e,r="alignTarget")?ks(s,r):n&&_l(s,n)?ks(s,n):h&&_l(s,h)?ks(s,h):a),c=lm(e,"alignTargetY",d),u=lm(e,"alignOffsetX",0),p=lm(e,"alignOffsetY",0),v=lm(e,"alignSide","").includes("right"),g=lm(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,x=f||m?0:1;t.setOrigin(y,x),o=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var b=g;b||(b=Dt(t.scene)),m&&t.getBottomLeft().y>b.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const cm={down:0,up:1},um=Phaser.Utils.Objects.GetValue;class pm extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Mi(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 _i(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),dm(t,e),t.isRexSizer&&t.layout();var i=um(e,"touchOutsideClose",!1),s=um(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&&Zs(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 vm={openColorPicker:function(){if(!this.colorPicker){var t=om.call(this).layout(),e=new pm(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(vm,Cd);const gm=Phaser.Utils.Objects.GetValue;class fm extends bd{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(gm(i,"width",160),gm(i,"height",170));var n=gm(i,"background");r=n?function(t){return bp(t,n)}:gm(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(gm(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(gm(i,"expandDirection")),this.setColorPickerEaseInDuration(gm(i,"easeIn",200)),this.setColorPickerEaseOutDuration(gm(i,"easeOut",200)),this.setColorPickerTransitInCallback(gm(i,"transitIn")),this.setColorPickerTransitOutCallback(gm(i,"transitOut")),this.setColorPickerBounds(gm(i,"bounds"));var h=gm(i,"space");void 0===h&&(h={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(h)}var a=e.colorComponents;if(s&&!1!==a&&null!==a){this.setColorComponentsHeight(gm(a,"height",30)),this.setColorComponentsFormatLabelConfig(gm(a,"formatLabel"));var o=gm(a,"inputText");o||(o=gm(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=gm(a,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}return Object.assign(fm.prototype,vm),fm},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcolorinput=e(); diff --git a/dist/rexconfirmdialog.js b/dist/rexconfirmdialog.js index e555ee1dd4..28d2332abe 100644 --- a/dist/rexconfirmdialog.js +++ b/dist/rexconfirmdialog.js @@ -31607,6 +31607,12 @@ } else if (TagRegex.RE_SIZE_CLOSE.test(text)) { UpdateProp(prevProp, PROP_REMOVE, 'size'); + } else if (TagRegex.RE_FAMILY_OPEN.test(text)) { + var innerMatch = text.match(TagRegex.RE_FAMILY_OPEN); + UpdateProp(prevProp, PROP_ADD, 'family', innerMatch[1]); + } else if (TagRegex.RE_FAMILY_CLOSE.test(text)) { + UpdateProp(prevProp, PROP_REMOVE, 'family'); + } else if (TagRegex.RE_COLOR_OPEN.test(text)) { var innerMatch = text.match(TagRegex.RE_COLOR_OPEN); UpdateProp(prevProp, PROP_ADD, 'color', innerMatch[1]); @@ -31884,6 +31890,7 @@ case 'color': case 'weight': + case 'family': case 'stroke': case 'bgcolor': case 'y': @@ -31998,6 +32005,10 @@ var SIZE_OPEN = GetOpenTagRegString(delimiterLeft, delimiterRight, SIZE, NUMBER_PARAM); var SIZE_CLOSE = GetCloseTagRegString(delimiterLeft, delimiterRight, SIZE); + var FAMILY = 'family'; + var FAMILY_OPEN = GetOpenTagRegString(delimiterLeft, delimiterRight, FAMILY, STR_PARAM); + var FAMILY_CLOSE = GetCloseTagRegString(delimiterLeft, delimiterRight, FAMILY); + var COLOR = 'color'; var COLOR_OPEN = GetOpenTagRegString(delimiterLeft, delimiterRight, COLOR, COLOR_PARAM); var COLOR_CLOSE = GetCloseTagRegString(delimiterLeft, delimiterRight, COLOR); @@ -32068,6 +32079,9 @@ TagRegexSave.RE_SIZE_OPEN = new RegExp(SIZE_OPEN, 'i'); TagRegexSave.RE_SIZE_CLOSE = new RegExp(SIZE_CLOSE, 'i'); + TagRegexSave.RE_FAMILY_OPEN = new RegExp(FAMILY_OPEN, 'i'); + TagRegexSave.RE_FAMILY_CLOSE = new RegExp(FAMILY_CLOSE, 'i'); + TagRegexSave.RE_COLOR_OPEN = new RegExp(COLOR_OPEN, 'i'); TagRegexSave.RE_COLOR_CLOSE = new RegExp(COLOR_CLOSE, 'i'); @@ -32117,6 +32131,7 @@ WEIGHT_OPEN, WEIGHT_CLOSE, SIZE_OPEN, SIZE_CLOSE, + FAMILY_OPEN, FAMILY_CLOSE, COLOR_OPEN, COLOR_CLOSE, UNDERLINE_OPEN, UNDERLINE_OPENC, UNDERLINE_CLOSE, STRIKETHROUGH_OPEN, STRIKETHROUGH_OPENC, STRIKETHROUGH_CLOSE, diff --git a/dist/rexconfirmdialog.min.js b/dist/rexconfirmdialog.min.js index bd40ff004b..92f513b7ff 100644 --- a/dist/rexconfirmdialog.min.js +++ b/dist/rexconfirmdialog.min.js @@ -3,4 +3,4 @@ var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),pars * @author Richard Davey * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Op=Phaser.Display.Canvas.CanvasPool;var Pp=function(t){var e=Op.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 Op.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,Op.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!==Vo&&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=Ko[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]=Tp(t,l,d);else{var u=_p(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Tp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Tp(t,"fill",null);null!==v&&(this.color=Rl(v));var g=Tp(t,"metrics",!1);return g?this.metrics={ascent:Tp(g,"ascent",0),descent:Tp(g,"descent",0),fontSize:Tp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Pp(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=Pp(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=Tp(t,"fontFamily","Courier"),this.fontSize=Tp(t,"fontSize","16px"),this.fontStyle=Tp(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=Rl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Rl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Rl(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=Rl(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Rl(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=Rl(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=Rl(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=Rl(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=Rl(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=Rl(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=Rl(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=Rl(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=Ko[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=Tp(e,"fontFamily",this.fontFamily),this.fontSize=Tp(e,"fontSize",this.fontSize),this.fontStyle=Tp(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 Ep={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Hl(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 C=l;C0){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 Mp=Phaser.Utils.Objects.GetValue,Rp=Ho,Lp=No;class Dp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Mp(t,"text",""),this.x=Mp(t,"x",0),this.y=Mp(t,"y",0),this.width=Mp(t,"width",0);var e=Mp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Mp(t,"newLineMode",0),this.startIndex=Mp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Lp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Rp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Lp&&(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 zp=Phaser.Utils.Objects.GetFastValue,Ap=Ho,Yp=Go;class Xp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=zp(t,"tagToText",Xt),this.tagToTextScope=zp(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 Bp={};const Wp=Phaser.Geom.Rectangle;var jp=new Kd;class Ip{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&ev(g)){""!==b?h.push(n.getLine(b,x,$p)):0===C&&r>0&&h.push(n.getLine("",0,$p)),h.push(...Qp(g,e,qp,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,$p)),b=g,x=f,o=s):(b+=g,x=m),C===S-1&&h.push(n.getLine(b,x,l))}return h},tv=function(t,e){var i;switch(e){case Kp:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==sv&&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 Xp({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 Dg=Phaser.Utils.Objects.GetValue,zg=Phaser.Math.Distance.Between;class Ag extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Dg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Dg(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(Dg(t,"enable",!0)),this.holdThreshold=Dg(t,"holdThreshold",50),this.pointerOutReleaseEnable=Dg(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 vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:zg(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&&!cr(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&&!cr(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 Yg=Phaser.Utils.Objects.GetValue;class Xg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Yg(t,"value",0)),this.setSpeed(Yg(t,"speed",0)),this.setAcceleration(Yg(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 Bg{constructor(){this.value,this.dir,this.movement=new Xg}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 Fg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Hg=Phaser.Utils.Objects.GetValue;class Ng extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Hg(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Hg(e,"speed",.1)),this.setEnable(Hg(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Hg(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||cr(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 Gg=Phaser.Utils.Objects.GetValue;var Vg=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)?Gg(s,l,void 0):Gg(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 Rg(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=Gg(r,"position",0);"string"==typeof p&&(p=Ug[p]);var v,g,f=Gg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Gg(s,"space.slider",void 0))&&(a?f=0:v=Gg(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:Gg(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Gg(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Gg(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Gg(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Gg(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Gg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Gg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Gg(s,"scrollDetectionMode");"string"==typeof b&&(b=$g[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Gg(s,x,!0):Gg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Ig(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,P,_=Gg(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),C=new Ng(o,_)),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&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const Ug={right:0,left:1,bottom:0,top:1},$g={gameObject:0,rectBounds:1},Jg=Phaser.Utils.Objects.GetValue;var Kg=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Jg(e,"width"),h=Jg(e,"height");n||Jg(e,"child.expandWidth",!0)||(s[1]=0),h||Jg(e,"child.expandHeight",!0)||(r[1]=0);var a=new ho(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=ig(i,"child"),r=ig(s,"gameObject",void 0);if(r){var n=ig(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=ig(n,"top",0),h.bottom=ig(n,"bottom",0),a.left=ig(n,"left",0),a.right=ig(n,"right",0);break;case 1:h.top=ig(n,"left",0),h.bottom=ig(n,"right",0),a.top=ig(n,"top",0),a.bottom=ig(n,"bottom",0);break;default:h.top=ig(n,"top",0),h.bottom=ig(n,"bottom",0),h.left=ig(n,"left",0),h.right=ig(n,"right",0)}e.add(r,{column:1,row:1,align:ig(s,"align","center"),padding:a,expand:{width:ig(s,"expandWidth",!0),height:ig(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Vg(t,a,"y",e);break;case 1:Vg(t,a,"x",e);break;default:Vg(t,a,"y",e),Vg(t,a,"x",e)}return a},qg=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)},Zg=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)}},Qg=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(hf.call(this,-this.textOY)),0),e=af.call(this,t)+this.textOY,i=of.call(this,t);return function(t,e){switch(Bo(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,lf.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,Ie.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,cf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,lf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const pf=Phaser.Utils.Objects.IsPlainObject,vf=Phaser.Utils.Objects.GetValue,gf=Phaser.Display.Align.TOP_LEFT;class ff extends rh{constructor(t,e,i,s,r,n){pf(e)?(e=vf(n=e,"x",0),i=vf(n,"y",0),s=vf(n,"width",void 0),r=vf(n,"height",void 0)):pf(s)&&(s=vf(n=s,"width",void 0),r=vf(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=vf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(vf(n,"clampTextOY",!0)),this.alwaysScrollable=vf(n,"alwaysScrollable",!1);var h=vf(n,"background",void 0),a=vf(n,"text",void 0);void 0===a&&(a=mf(t)),this.textCropEnable=vf(n,"textCrop",!!a.setCrop);var o=vf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=gf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Bo(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Do.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(hf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=af.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 mf=function(t){return t.add.text(0,0,"")};Object.assign(ff.prototype,uf);var yf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},bf={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 xf=Phaser.Utils.Objects.GetValue;class Cf extends rf{constructor(t,e){void 0===e&&(e={});var i=xf(e,"text",void 0),s=xf(e,"textWidth",void 0),r=xf(e,"textHeight",void 0),n=xf(e,"textCrop",!!i.setCrop),h=xf(e,"textMask",!n),a=xf(e,"content",""),o=new ff(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:xf(e,"clampChildOY",!1),alwaysScrollable:xf(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=xf(e,"space",void 0);l&&(l.child=xf(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(Cf.prototype,yf,bf);const Sf=Phaser.Utils.Objects.GetValue;var wf=function(t,e,i){e=e?vd(e):{};var s=Sf(i,"background",pp),r=Sf(i,"text",Of),n=Sf(i,"track",pp),h=Sf(i,"thumb",pp);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 Cf(t,e);return t.add.existing(o),o},Of=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 Qv(t,e);break;case"bbcodetext":case"bbcode":s=new Jv(t,0,0,"",e);break;case"label":s=new Tf(t,e);break;case"textarea":s=wf(t,e);break;default:s=new fp(t,e)}return up(s,e),t.add.existing(s),s},Pf=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 dp(t,e):new Fu(t,e);break;case"roundRectangle":s=new Xc(t,e);break;default:s=new Vu(t,e)}return up(s,e),t.add.existing(s),s};const _f=Phaser.Utils.Objects.GetValue;class Tf extends cc{constructor(t,e,i){e=function(t,e,i){e=e?vd(e):{};var s=_f(i,"background",pp),r=_f(i,"text",Of),n=_f(i,"icon",Pf),h=_f(i,"action",Pf);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 kf(this.getChildren(),"setActiveState",t),this}setHoverState(t){return kf(this.getChildren(),"setHoverState",t),this}setDisableState(t){return kf(this.getChildren(),"setDisableState",t),this}}var kf=function(t,e,i){for(var s=0,r=t.length;so;d--){for(c=0;c0&&this.wrapMode!==Vo&&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=Ko[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]=Tp(t,l,d);else{var u=_p(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Tp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Tp(t,"fill",null);null!==v&&(this.color=Rl(v));var g=Tp(t,"metrics",!1);return g?this.metrics={ascent:Tp(g,"ascent",0),descent:Tp(g,"descent",0),fontSize:Tp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Pp(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=Pp(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=Tp(t,"fontFamily","Courier"),this.fontSize=Tp(t,"fontSize","16px"),this.fontStyle=Tp(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=Rl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Rl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Rl(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=Rl(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Rl(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=Rl(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=Rl(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=Rl(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=Rl(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=Rl(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=Rl(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=Rl(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=Ko[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=Tp(e,"fontFamily",this.fontFamily),this.fontSize=Tp(e,"fontSize",this.fontSize),this.fontStyle=Tp(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 Ep={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Hl(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 C=l;C0){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 Mp=Phaser.Utils.Objects.GetValue,Rp=Ho,Lp=No;class Dp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Mp(t,"text",""),this.x=Mp(t,"x",0),this.y=Mp(t,"y",0),this.width=Mp(t,"width",0);var e=Mp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Mp(t,"newLineMode",0),this.startIndex=Mp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Lp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Rp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Lp&&(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 zp=Phaser.Utils.Objects.GetFastValue,Ap=Ho,Yp=Go;class Xp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=zp(t,"tagToText",Xt),this.tagToTextScope=zp(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 Bp={};const Wp=Phaser.Geom.Rectangle;var jp=new Kd;class Ip{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&ev(g)){""!==b?h.push(n.getLine(b,x,$p)):0===C&&r>0&&h.push(n.getLine("",0,$p)),h.push(...Qp(g,e,qp,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,$p)),b=g,x=f,o=s):(b+=g,x=m),C===S-1&&h.push(n.getLine(b,x,l))}return h},tv=function(t,e){var i;switch(e){case Kp:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==sv&&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 Xp({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 Dg=Phaser.Utils.Objects.GetValue,zg=Phaser.Math.Distance.Between;class Ag extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Dg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Dg(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(Dg(t,"enable",!0)),this.holdThreshold=Dg(t,"holdThreshold",50),this.pointerOutReleaseEnable=Dg(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 vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:zg(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&&!cr(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&&!cr(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 Yg=Phaser.Utils.Objects.GetValue;class Xg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Yg(t,"value",0)),this.setSpeed(Yg(t,"speed",0)),this.setAcceleration(Yg(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 Bg{constructor(){this.value,this.dir,this.movement=new Xg}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 Fg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Hg=Phaser.Utils.Objects.GetValue;class Ng extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Hg(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Hg(e,"speed",.1)),this.setEnable(Hg(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Hg(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||cr(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 Gg=Phaser.Utils.Objects.GetValue;var Vg=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)?Gg(s,l,void 0):Gg(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 Rg(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=Gg(r,"position",0);"string"==typeof p&&(p=Ug[p]);var v,g,f=Gg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Gg(s,"space.slider",void 0))&&(a?f=0:v=Gg(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:Gg(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Gg(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Gg(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Gg(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Gg(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Gg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Gg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Gg(s,"scrollDetectionMode");"string"==typeof b&&(b=$g[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Gg(s,x,!0):Gg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Ig(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,P,_=Gg(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),C=new Ng(o,_)),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&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const Ug={right:0,left:1,bottom:0,top:1},$g={gameObject:0,rectBounds:1},Jg=Phaser.Utils.Objects.GetValue;var Kg=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Jg(e,"width"),h=Jg(e,"height");n||Jg(e,"child.expandWidth",!0)||(s[1]=0),h||Jg(e,"child.expandHeight",!0)||(r[1]=0);var a=new ho(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=ig(i,"child"),r=ig(s,"gameObject",void 0);if(r){var n=ig(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=ig(n,"top",0),h.bottom=ig(n,"bottom",0),a.left=ig(n,"left",0),a.right=ig(n,"right",0);break;case 1:h.top=ig(n,"left",0),h.bottom=ig(n,"right",0),a.top=ig(n,"top",0),a.bottom=ig(n,"bottom",0);break;default:h.top=ig(n,"top",0),h.bottom=ig(n,"bottom",0),h.left=ig(n,"left",0),h.right=ig(n,"right",0)}e.add(r,{column:1,row:1,align:ig(s,"align","center"),padding:a,expand:{width:ig(s,"expandWidth",!0),height:ig(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Vg(t,a,"y",e);break;case 1:Vg(t,a,"x",e);break;default:Vg(t,a,"y",e),Vg(t,a,"x",e)}return a},qg=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)},Zg=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)}},Qg=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(hf.call(this,-this.textOY)),0),e=af.call(this,t)+this.textOY,i=of.call(this,t);return function(t,e){switch(Bo(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,lf.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,Ie.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,cf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,lf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const pf=Phaser.Utils.Objects.IsPlainObject,vf=Phaser.Utils.Objects.GetValue,gf=Phaser.Display.Align.TOP_LEFT;class ff extends rh{constructor(t,e,i,s,r,n){pf(e)?(e=vf(n=e,"x",0),i=vf(n,"y",0),s=vf(n,"width",void 0),r=vf(n,"height",void 0)):pf(s)&&(s=vf(n=s,"width",void 0),r=vf(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=vf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(vf(n,"clampTextOY",!0)),this.alwaysScrollable=vf(n,"alwaysScrollable",!1);var h=vf(n,"background",void 0),a=vf(n,"text",void 0);void 0===a&&(a=mf(t)),this.textCropEnable=vf(n,"textCrop",!!a.setCrop);var o=vf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=gf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Bo(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Do.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(hf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=af.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 mf=function(t){return t.add.text(0,0,"")};Object.assign(ff.prototype,uf);var yf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},bf={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 xf=Phaser.Utils.Objects.GetValue;class Cf extends rf{constructor(t,e){void 0===e&&(e={});var i=xf(e,"text",void 0),s=xf(e,"textWidth",void 0),r=xf(e,"textHeight",void 0),n=xf(e,"textCrop",!!i.setCrop),h=xf(e,"textMask",!n),a=xf(e,"content",""),o=new ff(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:xf(e,"clampChildOY",!1),alwaysScrollable:xf(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=xf(e,"space",void 0);l&&(l.child=xf(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(Cf.prototype,yf,bf);const Sf=Phaser.Utils.Objects.GetValue;var wf=function(t,e,i){e=e?vd(e):{};var s=Sf(i,"background",pp),r=Sf(i,"text",Of),n=Sf(i,"track",pp),h=Sf(i,"thumb",pp);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 Cf(t,e);return t.add.existing(o),o},Of=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 Qv(t,e);break;case"bbcodetext":case"bbcode":s=new Jv(t,0,0,"",e);break;case"label":s=new Tf(t,e);break;case"textarea":s=wf(t,e);break;default:s=new fp(t,e)}return up(s,e),t.add.existing(s),s},Pf=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 dp(t,e):new Fu(t,e);break;case"roundRectangle":s=new Xc(t,e);break;default:s=new Vu(t,e)}return up(s,e),t.add.existing(s),s};const _f=Phaser.Utils.Objects.GetValue;class Tf extends cc{constructor(t,e,i){e=function(t,e,i){e=e?vd(e):{};var s=_f(i,"background",pp),r=_f(i,"text",Of),n=_f(i,"icon",Pf),h=_f(i,"action",Pf);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 kf(this.getChildren(),"setActiveState",t),this}setHoverState(t){return kf(this.getChildren(),"setHoverState",t),this}setDisableState(t){return kf(this.getChildren(),"setDisableState",t),this}}var kf=function(t,e,i){for(var s=0,r=t.length;s * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Jp=Phaser.Display.Canvas.CanvasPool;var qp=function(t){var e=Jp.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 Jp.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,Jp.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!==Sl&&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=Tl[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]=tg(t,l,d);else{var u=Qp(t,l,d);c&&(u=c(u)),this[o]=u}}var p=tg(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=tg(t,"fill",null);null!==g&&(this.color=hd(g));var v=tg(t,"metrics",!1);return v?this.metrics={ascent:tg(v,"ascent",0),descent:tg(v,"descent",0),fontSize:tg(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=qp(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=qp(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=tg(t,"fontFamily","Courier"),this.fontSize=tg(t,"fontSize","16px"),this.fontStyle=tg(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=hd(t,this.parent.canvas,this.parent.context),this.backgroundColor2=hd(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=hd(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=hd(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=hd(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=hd(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=hd(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=hd(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=hd(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=hd(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=hd(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=hd(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=Tl[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=tg(e,"fontFamily",this.fontFamily),this.fontSize=tg(e,"fontSize",this.fontSize),this.fontStyle=tg(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 ig={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),xd(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 sg=Phaser.Utils.Objects.GetValue,rg=xl,ng=Cl;class ag{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=sg(t,"text",""),this.x=sg(t,"x",0),this.y=sg(t,"y",0),this.width=sg(t,"width",0);var e=sg(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=sg(t,"newLineMode",0),this.startIndex=sg(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===ng&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==rg&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===ng&&(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 og=Phaser.Utils.Objects.GetFastValue,hg=xl,lg=wl;class dg{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=og(t,"tagToText",Rr),this.tagToTextScope=og(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,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 cg={};const ug=Phaser.Geom.Rectangle;var pg=new Pc;class gg{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&_g(v)){""!==b?a.push(n.getLine(b,x,Cg)):0===C&&r>0&&a.push(n.getLine("",0,Cg)),a.push(...Pg(v,e,Og,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>h?(a.push(n.getLine(b,x,Cg)),b=v,x=f,h=s):(b+=v,x=m),C===w-1&&a.push(n.getLine(b,x,l))}return a},Tg=function(t,e){var i;switch(e){case Sg:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Eg&&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 dg({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 Yv(this.sizerChildren,null),Ch.call(this,t),this}},Xv={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Yv(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},Hv={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=En.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,Yv(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Yv(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Nv=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const $v=Phaser.Utils.Objects.IsPlainObject,Kv=Phaser.Utils.Objects.GetValue;class Zv extends oh{constructor(t,e,i,s,r,n,a,o,h,l){$v(e)?(e=Kv(l=e,"x",0),i=Kv(l,"y",0),s=Kv(l,"width",void 0),r=Kv(l,"height",void 0),n=Kv(l,"column",l.col||0),a=Kv(l,"row",0),o=Kv(l,"columnProportions",0),h=Kv(l,"rowProportions",0)):$v(s)?(s=Kv(l=s,"width",void 0),r=Kv(l,"height",void 0),n=Kv(l,"column",l.col||0),a=Kv(l,"row",0),o=Kv(l,"columnProportions",0),h=Kv(l,"rowProportions",0)):$v(n)?(n=Kv(l=n,"column",l.col||0),a=Kv(l,"row",0),o=Kv(l,"columnProportions",0),h=Kv(l,"rowProportions",0)):$v(o)&&(o=Kv(l=o,"columnProportions",0),h=Kv(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Kv(l,"createCellContainerCallback")),this.setIndentLeft(Kv(l,"space.indentLeftOdd",0),Kv(l,"space.indentLeftEven",0)),this.setIndentTop(Kv(l,"space.indentTopOdd",0),Kv(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,Kv(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=Uv.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Nv.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(Zv.prototype,Hv);const Jv=Phaser.Utils.Objects.GetValue,qv=Phaser.Math.Percent;var Qv=function(t,e,i){var s;return t.y===e.y?s=qv(i.x,t.x,e.x):t.x===e.x&&(s=qv(i.y,t.y,e.y)),s},tf=function(t,e,i){var s,r;this.enable&&(ef.x=e,ef.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Qv(s,r,ef))},ef={},sf=function(t,e,i){if(this.enable&&t.isDown){var s,r;rf.x=t.worldX,rf.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Qv(s,r,rf);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},rf={},nf=function(t,e){void 0===e&&(e=af);var i=this.childrenMap.thumb,s=i.x,r=i.y;return en(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},af={};const of=Phaser.Display.Align.LEFT_CENTER,hf=Phaser.Display.Align.TOP_CENTER;var lf={};const df=Phaser.Display.Align.RIGHT_CENTER,cf=Phaser.Display.Align.BOTTOM_CENTER;var uf={};const pf=Phaser.Math.Linear;var gf={};const vf=Phaser.Display.Align.LEFT_CENTER,ff=Phaser.Display.Align.TOP_CENTER,mf=Phaser.Display.Align.RIGHT_CENTER,yf=Phaser.Display.Align.BOTTOM_CENTER,bf=Phaser.Utils.Objects.GetValue,xf=Phaser.Utils.Objects.IsPlainObject,Cf=Phaser.Math.Clamp,wf=Phaser.Math.Snap.To;class Sf extends(Eu(Ah)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=bf(e,"reverseAxis",!1);var i=bf(e,"background",void 0),s=bf(e,"track",void 0),r=bf(e,"indicator",void 0),n=bf(e,"thumb",void 0);if(i&&(xf(i)&&(i=Ip(t,i)),this.addBackground(i)),s&&(xf(s)&&(s=Ip(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(xf(r)&&(r=Ip(t,r)),this.pin(r)),n){xf(n)&&(n=Ip(t,n)),this.pin(n);var a=bf(e,"thumbOffsetX",0),o=bf(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=bf(e,"input",0);switch("string"==typeof h&&(h=Of[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",tf,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",sf,this).on("pointermove",sf,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(bf(e,"enable",void 0)),this.setGap(bf(e,"gap",void 0)),this.setValue(bf(e,"value",0),bf(e,"min",void 0),bf(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=wf(t,this.gap));var e=this._value;this._value=Cf(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 Of={pan:0,drag:0,click:1,none:-1};var kf={getStartPoint:function(t){if(void 0===t&&(t=lf),this.childrenMap.thumb){var e=0===this.orientation?of:hf;nf.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=uf),this.childrenMap.thumb){var e=0===this.orientation?df:cf;nf.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=gf),s.x=pf(e.x,i.x,t),s.y=pf(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,h=p(a);if(n)o=a.x-h*a.originX,i=this.right-o;else i=(o=a.x-h*a.originX)+h-this.left}else{var l,d=g(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;zn(e,i,s),r=n?0===this.orientation?mf:yf:0===this.orientation?vf:ff,tn(e,this,r),this.resetChildPositionState(e)}};Object.assign(Sf.prototype,kf);const Pf=Phaser.Utils.Objects.GetValue;class Tf extends Ah{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=Pf(e,"background",void 0),n=Pf(e,"buttons",void 0),a=Pf(n,"top",Pf(n,"left",void 0)),o=Pf(n,"bottom",Pf(n,"right",void 0)),h=Pf(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Ao(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,s=0===this.orientation?void 0===Pf(h,"width",void 0)?1:0:void 0===Pf(h,"height",void 0)?1:0,i=new Sf(t,h),t.add.existing(i),this.add(i,{proportion:s}));o&&(this.add(o),new Ao(o).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,o];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=Pf(e,"valuechangeCallback",null);if(null!==d){var c=Pf(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(Pf(e,"enable",void 0)),this.setValue(Pf(e,"value",0)),this.setScrollStep(Pf(n,"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 _f extends N{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 Mf=Phaser.Utils.Objects.GetValue,Ef=Phaser.Math.Distance.Between;class Rf extends l{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Mf(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Mf(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(Mf(t,"enable",!0)),this.holdThreshold=Mf(t,"holdThreshold",50),this.pointerOutReleaseEnable=Mf(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 dt(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Ef(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&&!R(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&&!R(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 Lf=Phaser.Utils.Objects.GetValue;class Df{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Lf(t,"value",0)),this.setSpeed(Lf(t,"speed",0)),this.setAcceleration(Lf(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 Af{constructor(){this.value,this.dir,this.movement=new Df}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 Wf={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Yf=Phaser.Utils.Objects.GetValue;class If extends l{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Yf(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Yf(e,"speed",.1)),this.setEnable(Yf(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Yf(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||R(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 Xf=Phaser.Utils.Objects.GetValue;var Ff=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)?Xf(s,l,void 0):Xf(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=Gi(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 Tf(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=Xf(r,"position",0);"string"==typeof p&&(p=Vf[p]);var g,v,f=Xf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Xf(s,"space.slider",void 0))&&(o?f=0:g=Xf(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:Xf(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:Xf(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:Xf(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:Xf(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Xf(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Xf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Xf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Xf(s,"scrollDetectionMode");"string"==typeof b&&(b=Gf[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?Xf(s,x,!0):Xf(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new zf(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,w,S,O,k,P=Xf(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&h&&(void 0!==b&&(P.focus=1===b?2:0),C=new If(h,P)),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?(w=a?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(o?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(k=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[k](-e,!0)})))};const Vf={right:0,left:1,bottom:0,top:1},Gf={gameObject:0,rectBounds:1},Hf=Phaser.Utils.Objects.GetValue;var Uf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Hf(e,"width"),a=Hf(e,"height");n||Hf(e,"child.expandWidth",!0)||(s[1]=0),a||Hf(e,"child.expandHeight",!0)||(r[1]=0);var o=new Zv(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Jv(i,"child"),r=Jv(s,"gameObject",void 0);if(r){var n=Jv(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=Jv(n,"top",0),a.bottom=Jv(n,"bottom",0),o.left=Jv(n,"left",0),o.right=Jv(n,"right",0);break;case 1:a.top=Jv(n,"left",0),a.bottom=Jv(n,"right",0),o.top=Jv(n,"top",0),o.bottom=Jv(n,"bottom",0);break;default:a.top=Jv(n,"top",0),a.bottom=Jv(n,"bottom",0),a.left=Jv(n,"left",0),a.right=Jv(n,"right",0)}e.add(r,{column:1,row:1,align:Jv(s,"align","center"),padding:o,expand:{width:Jv(s,"expandWidth",!0),height:Jv(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:Ff(t,o,"y",e);break;case 1:Ff(t,o,"x",e);break;default:Ff(t,o,"y",e),Ff(t,o,"x",e)}return o},Nf=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)},$f=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)}},Kf=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}(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(em.call(this,-this.textOY)),0),e=im.call(this,t)+this.textOY,i=sm.call(this,t);return function(t,e){switch(vl(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}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,rm.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,An.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,am.call(this,t,n,a),en(t,s,r,n,a,e.align),e.preOffsetY=0,rm.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const hm=Phaser.Utils.Objects.IsPlainObject,lm=Phaser.Utils.Objects.GetValue,dm=Phaser.Display.Align.TOP_LEFT;class cm extends oh{constructor(t,e,i,s,r,n){hm(e)?(e=lm(n=e,"x",0),i=lm(n,"y",0),s=lm(n,"width",void 0),r=lm(n,"height",void 0)):hm(s)&&(s=lm(n=s,"width",void 0),r=lm(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=lm(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(lm(n,"clampTextOY",!0)),this.alwaysScrollable=lm(n,"alwaysScrollable",!1);var a=lm(n,"background",void 0),o=lm(n,"text",void 0);void 0===o&&(o=um(t)),this.textCropEnable=lm(n,"textCrop",!!o.setCrop);var h=lm(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=dm,l.padding=dn(0),l.expand=!0,this.textObject=o,this.textObjectType=vl(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=dl.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(em.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=im.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 um=function(t){return t.add.text(0,0,"")};Object.assign(cm.prototype,om);var pm={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},gm={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 vm=Phaser.Utils.Objects.GetValue;class fm extends Qf{constructor(t,e){void 0===e&&(e={});var i=vm(e,"text",void 0),s=vm(e,"textWidth",void 0),r=vm(e,"textHeight",void 0),n=vm(e,"textCrop",!!i.setCrop),a=vm(e,"textMask",!n),o=vm(e,"content",""),h=new cm(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:vm(e,"clampChildOY",!1),alwaysScrollable:vm(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=vm(e,"space",void 0);l&&(l.child=vm(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(fm.prototype,pm,gm);const mm=Phaser.Utils.Objects.GetValue;var ym=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 Pv(t,e);break;case"bbcodetext":case"bbcode":s=new wv(t,0,0,"",e);break;case"label":s=new Tv(t,e);break;case"textarea":s=function(t,e,i){e=e?ze(e):{};var s=mm(i,"background",Ip),r=mm(i,"text",ym),n=mm(i,"track",Ip),a=mm(i,"thumb",Ip);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 fm(t,e);return t.add.existing(h),h}(t,e);break;default:s=new Vp(t,e)}return Yp(s,e),t.add.existing(s),s},bm=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 zp(t,e):new vp(t,e);break;case"roundRectangle":s=new vu(t,e);break;default:s=new bp(t,e)}return Yp(s,e),t.add.existing(s),s};const xm=Phaser.Utils.Objects.GetValue;var Cm=function(t,e,i){e=e?ze(e):{};var s=xm(i,"background",Ip),r=xm(i,"text",ym),n=xm(i,"icon",bm),a=xm(i,"action",bm);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};class wm extends Xc{constructor(t,e){super(t,e=Cm(t,e)),this.type="rexTweaker.Title"}setTitle(t){return(t=t?ze(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}Phaser.Math.Wrap;const Sm=Phaser.Math.Linear;var Om=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=Sm(b.a.x,x.a.x,C),e=Sm(b.a.y,x.a.y,C),i=Sm(b.b.x,x.b.x,C),s=Sm(b.b.y,x.b.y,C),r=Sm(b.c.x,x.c.x,C),n=Sm(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const km=(0,Phaser.Math.DegToRad)(120);var Pm=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+km),i+s*Math.sin(r+km)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-km),i+s*Math.sin(r-km)),this.arrowOnly?t.end():t.close()},Tm={buildShapes(){this.addShape((new ip).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?Om.call(this):Pm.call(this)}},_m={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new La(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 Mm=Phaser.Utils.Objects.GetValue,Em=Phaser.Utils.Objects.IsPlainObject,Rm=Phaser.Math.DegToRad,Lm=Phaser.Math.RadToDeg;class Dm extends wu{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Em(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=Bm(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=Mm(r,"x",null);null!==n?(t=n,i=n):(t=Mm(r,"left",0),i=Mm(r,"right",t));var a=Mm(r,"y",null);null!==a?(e=a,s=a):(e=Mm(r,"top",0),s=Mm(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 Lm(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Rm(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Am={right:0,down:1,left:2,up:3};var Bm=function(t){return"string"==typeof t&&(t=Am[t]),t%=4};Object.assign(Dm.prototype,Tm,_m);class jm extends wm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new Dm(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}} + */const Jp=Phaser.Display.Canvas.CanvasPool;var qp=function(t){var e=Jp.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 Jp.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,Jp.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!==Sl&&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=Tl[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]=tg(t,l,d);else{var u=Qp(t,l,d);c&&(u=c(u)),this[o]=u}}var p=tg(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=tg(t,"fill",null);null!==g&&(this.color=hd(g));var v=tg(t,"metrics",!1);return v?this.metrics={ascent:tg(v,"ascent",0),descent:tg(v,"descent",0),fontSize:tg(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=qp(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=qp(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=tg(t,"fontFamily","Courier"),this.fontSize=tg(t,"fontSize","16px"),this.fontStyle=tg(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=hd(t,this.parent.canvas,this.parent.context),this.backgroundColor2=hd(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=hd(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=hd(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=hd(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=hd(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=hd(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=hd(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=hd(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=hd(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=hd(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=hd(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=Tl[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=tg(e,"fontFamily",this.fontFamily),this.fontSize=tg(e,"fontSize",this.fontSize),this.fontStyle=tg(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 ig={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),xd(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 sg=Phaser.Utils.Objects.GetValue,rg=xl,ng=Cl;class ag{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=sg(t,"text",""),this.x=sg(t,"x",0),this.y=sg(t,"y",0),this.width=sg(t,"width",0);var e=sg(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=sg(t,"newLineMode",0),this.startIndex=sg(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===ng&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==rg&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===ng&&(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 og=Phaser.Utils.Objects.GetFastValue,hg=xl,lg=wl;class dg{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=og(t,"tagToText",Rr),this.tagToTextScope=og(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,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 cg={};const ug=Phaser.Geom.Rectangle;var pg=new Pc;class gg{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&_g(v)){""!==b?a.push(n.getLine(b,x,Cg)):0===C&&r>0&&a.push(n.getLine("",0,Cg)),a.push(...Pg(v,e,Og,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>h?(a.push(n.getLine(b,x,Cg)),b=v,x=f,h=s):(b+=v,x=m),C===w-1&&a.push(n.getLine(b,x,l))}return a},Tg=function(t,e){var i;switch(e){case Sg:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Eg&&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 dg({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 Yv(this.sizerChildren,null),Ch.call(this,t),this}},Xv={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Yv(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},Hv={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=En.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,Yv(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Yv(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Nv=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const $v=Phaser.Utils.Objects.IsPlainObject,Kv=Phaser.Utils.Objects.GetValue;class Zv extends oh{constructor(t,e,i,s,r,n,a,o,h,l){$v(e)?(e=Kv(l=e,"x",0),i=Kv(l,"y",0),s=Kv(l,"width",void 0),r=Kv(l,"height",void 0),n=Kv(l,"column",l.col||0),a=Kv(l,"row",0),o=Kv(l,"columnProportions",0),h=Kv(l,"rowProportions",0)):$v(s)?(s=Kv(l=s,"width",void 0),r=Kv(l,"height",void 0),n=Kv(l,"column",l.col||0),a=Kv(l,"row",0),o=Kv(l,"columnProportions",0),h=Kv(l,"rowProportions",0)):$v(n)?(n=Kv(l=n,"column",l.col||0),a=Kv(l,"row",0),o=Kv(l,"columnProportions",0),h=Kv(l,"rowProportions",0)):$v(o)&&(o=Kv(l=o,"columnProportions",0),h=Kv(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Kv(l,"createCellContainerCallback")),this.setIndentLeft(Kv(l,"space.indentLeftOdd",0),Kv(l,"space.indentLeftEven",0)),this.setIndentTop(Kv(l,"space.indentTopOdd",0),Kv(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,Kv(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=Uv.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Nv.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(Zv.prototype,Hv);const Jv=Phaser.Utils.Objects.GetValue,qv=Phaser.Math.Percent;var Qv=function(t,e,i){var s;return t.y===e.y?s=qv(i.x,t.x,e.x):t.x===e.x&&(s=qv(i.y,t.y,e.y)),s},tf=function(t,e,i){var s,r;this.enable&&(ef.x=e,ef.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Qv(s,r,ef))},ef={},sf=function(t,e,i){if(this.enable&&t.isDown){var s,r;rf.x=t.worldX,rf.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Qv(s,r,rf);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},rf={},nf=function(t,e){void 0===e&&(e=af);var i=this.childrenMap.thumb,s=i.x,r=i.y;return en(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},af={};const of=Phaser.Display.Align.LEFT_CENTER,hf=Phaser.Display.Align.TOP_CENTER;var lf={};const df=Phaser.Display.Align.RIGHT_CENTER,cf=Phaser.Display.Align.BOTTOM_CENTER;var uf={};const pf=Phaser.Math.Linear;var gf={};const vf=Phaser.Display.Align.LEFT_CENTER,ff=Phaser.Display.Align.TOP_CENTER,mf=Phaser.Display.Align.RIGHT_CENTER,yf=Phaser.Display.Align.BOTTOM_CENTER,bf=Phaser.Utils.Objects.GetValue,xf=Phaser.Utils.Objects.IsPlainObject,Cf=Phaser.Math.Clamp,wf=Phaser.Math.Snap.To;class Sf extends(Eu(Ah)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=bf(e,"reverseAxis",!1);var i=bf(e,"background",void 0),s=bf(e,"track",void 0),r=bf(e,"indicator",void 0),n=bf(e,"thumb",void 0);if(i&&(xf(i)&&(i=Ip(t,i)),this.addBackground(i)),s&&(xf(s)&&(s=Ip(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(xf(r)&&(r=Ip(t,r)),this.pin(r)),n){xf(n)&&(n=Ip(t,n)),this.pin(n);var a=bf(e,"thumbOffsetX",0),o=bf(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=bf(e,"input",0);switch("string"==typeof h&&(h=Of[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",tf,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",sf,this).on("pointermove",sf,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(bf(e,"enable",void 0)),this.setGap(bf(e,"gap",void 0)),this.setValue(bf(e,"value",0),bf(e,"min",void 0),bf(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=wf(t,this.gap));var e=this._value;this._value=Cf(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 Of={pan:0,drag:0,click:1,none:-1};var kf={getStartPoint:function(t){if(void 0===t&&(t=lf),this.childrenMap.thumb){var e=0===this.orientation?of:hf;nf.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=uf),this.childrenMap.thumb){var e=0===this.orientation?df:cf;nf.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=gf),s.x=pf(e.x,i.x,t),s.y=pf(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,h=p(a);if(n)o=a.x-h*a.originX,i=this.right-o;else i=(o=a.x-h*a.originX)+h-this.left}else{var l,d=g(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;zn(e,i,s),r=n?0===this.orientation?mf:yf:0===this.orientation?vf:ff,tn(e,this,r),this.resetChildPositionState(e)}};Object.assign(Sf.prototype,kf);const Pf=Phaser.Utils.Objects.GetValue;class Tf extends Ah{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=Pf(e,"background",void 0),n=Pf(e,"buttons",void 0),a=Pf(n,"top",Pf(n,"left",void 0)),o=Pf(n,"bottom",Pf(n,"right",void 0)),h=Pf(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Ao(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,s=0===this.orientation?void 0===Pf(h,"width",void 0)?1:0:void 0===Pf(h,"height",void 0)?1:0,i=new Sf(t,h),t.add.existing(i),this.add(i,{proportion:s}));o&&(this.add(o),new Ao(o).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,o];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=Pf(e,"valuechangeCallback",null);if(null!==d){var c=Pf(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(Pf(e,"enable",void 0)),this.setValue(Pf(e,"value",0)),this.setScrollStep(Pf(n,"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 _f extends N{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 Mf=Phaser.Utils.Objects.GetValue,Ef=Phaser.Math.Distance.Between;class Rf extends l{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Mf(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Mf(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(Mf(t,"enable",!0)),this.holdThreshold=Mf(t,"holdThreshold",50),this.pointerOutReleaseEnable=Mf(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 dt(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Ef(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&&!R(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&&!R(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 Lf=Phaser.Utils.Objects.GetValue;class Df{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Lf(t,"value",0)),this.setSpeed(Lf(t,"speed",0)),this.setAcceleration(Lf(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 Af{constructor(){this.value,this.dir,this.movement=new Df}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 Wf={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Yf=Phaser.Utils.Objects.GetValue;class If extends l{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Yf(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Yf(e,"speed",.1)),this.setEnable(Yf(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Yf(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||R(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 Xf=Phaser.Utils.Objects.GetValue;var Ff=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)?Xf(s,l,void 0):Xf(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=Gi(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 Tf(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=Xf(r,"position",0);"string"==typeof p&&(p=Vf[p]);var g,v,f=Xf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Xf(s,"space.slider",void 0))&&(o?f=0:g=Xf(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:Xf(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:Xf(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:Xf(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:Xf(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Xf(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Xf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Xf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Xf(s,"scrollDetectionMode");"string"==typeof b&&(b=Gf[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?Xf(s,x,!0):Xf(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new zf(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,w,S,O,k,P=Xf(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&h&&(void 0!==b&&(P.focus=1===b?2:0),C=new If(h,P)),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?(w=a?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(o?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(k=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[k](-e,!0)})))};const Vf={right:0,left:1,bottom:0,top:1},Gf={gameObject:0,rectBounds:1},Hf=Phaser.Utils.Objects.GetValue;var Uf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Hf(e,"width"),a=Hf(e,"height");n||Hf(e,"child.expandWidth",!0)||(s[1]=0),a||Hf(e,"child.expandHeight",!0)||(r[1]=0);var o=new Zv(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Jv(i,"child"),r=Jv(s,"gameObject",void 0);if(r){var n=Jv(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=Jv(n,"top",0),a.bottom=Jv(n,"bottom",0),o.left=Jv(n,"left",0),o.right=Jv(n,"right",0);break;case 1:a.top=Jv(n,"left",0),a.bottom=Jv(n,"right",0),o.top=Jv(n,"top",0),o.bottom=Jv(n,"bottom",0);break;default:a.top=Jv(n,"top",0),a.bottom=Jv(n,"bottom",0),a.left=Jv(n,"left",0),a.right=Jv(n,"right",0)}e.add(r,{column:1,row:1,align:Jv(s,"align","center"),padding:o,expand:{width:Jv(s,"expandWidth",!0),height:Jv(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:Ff(t,o,"y",e);break;case 1:Ff(t,o,"x",e);break;default:Ff(t,o,"y",e),Ff(t,o,"x",e)}return o},Nf=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)},$f=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)}},Kf=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}(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(em.call(this,-this.textOY)),0),e=im.call(this,t)+this.textOY,i=sm.call(this,t);return function(t,e){switch(vl(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}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,rm.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,An.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,am.call(this,t,n,a),en(t,s,r,n,a,e.align),e.preOffsetY=0,rm.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const hm=Phaser.Utils.Objects.IsPlainObject,lm=Phaser.Utils.Objects.GetValue,dm=Phaser.Display.Align.TOP_LEFT;class cm extends oh{constructor(t,e,i,s,r,n){hm(e)?(e=lm(n=e,"x",0),i=lm(n,"y",0),s=lm(n,"width",void 0),r=lm(n,"height",void 0)):hm(s)&&(s=lm(n=s,"width",void 0),r=lm(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=lm(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(lm(n,"clampTextOY",!0)),this.alwaysScrollable=lm(n,"alwaysScrollable",!1);var a=lm(n,"background",void 0),o=lm(n,"text",void 0);void 0===o&&(o=um(t)),this.textCropEnable=lm(n,"textCrop",!!o.setCrop);var h=lm(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=dm,l.padding=dn(0),l.expand=!0,this.textObject=o,this.textObjectType=vl(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=dl.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(em.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=im.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 um=function(t){return t.add.text(0,0,"")};Object.assign(cm.prototype,om);var pm={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},gm={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 vm=Phaser.Utils.Objects.GetValue;class fm extends Qf{constructor(t,e){void 0===e&&(e={});var i=vm(e,"text",void 0),s=vm(e,"textWidth",void 0),r=vm(e,"textHeight",void 0),n=vm(e,"textCrop",!!i.setCrop),a=vm(e,"textMask",!n),o=vm(e,"content",""),h=new cm(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:vm(e,"clampChildOY",!1),alwaysScrollable:vm(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=vm(e,"space",void 0);l&&(l.child=vm(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(fm.prototype,pm,gm);const mm=Phaser.Utils.Objects.GetValue;var ym=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 Pv(t,e);break;case"bbcodetext":case"bbcode":s=new wv(t,0,0,"",e);break;case"label":s=new Tv(t,e);break;case"textarea":s=function(t,e,i){e=e?ze(e):{};var s=mm(i,"background",Ip),r=mm(i,"text",ym),n=mm(i,"track",Ip),a=mm(i,"thumb",Ip);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 fm(t,e);return t.add.existing(h),h}(t,e);break;default:s=new Vp(t,e)}return Yp(s,e),t.add.existing(s),s},bm=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 zp(t,e):new vp(t,e);break;case"roundRectangle":s=new vu(t,e);break;default:s=new bp(t,e)}return Yp(s,e),t.add.existing(s),s};const xm=Phaser.Utils.Objects.GetValue;var Cm=function(t,e,i){e=e?ze(e):{};var s=xm(i,"background",Ip),r=xm(i,"text",ym),n=xm(i,"icon",bm),a=xm(i,"action",bm);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};class wm extends Xc{constructor(t,e){super(t,e=Cm(t,e)),this.type="rexTweaker.Title"}setTitle(t){return(t=t?ze(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}Phaser.Math.Wrap;const Sm=Phaser.Math.Linear;var Om=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=Sm(b.a.x,x.a.x,C),e=Sm(b.a.y,x.a.y,C),i=Sm(b.b.x,x.b.x,C),s=Sm(b.b.y,x.b.y,C),r=Sm(b.c.x,x.c.x,C),n=Sm(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const km=(0,Phaser.Math.DegToRad)(120);var Pm=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+km),i+s*Math.sin(r+km)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-km),i+s*Math.sin(r-km)),this.arrowOnly?t.end():t.close()},Tm={buildShapes(){this.addShape((new ip).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?Om.call(this):Pm.call(this)}},_m={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new La(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 Mm=Phaser.Utils.Objects.GetValue,Em=Phaser.Utils.Objects.IsPlainObject,Rm=Phaser.Math.DegToRad,Lm=Phaser.Math.RadToDeg;class Dm extends wu{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Em(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=Bm(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=Mm(r,"x",null);null!==n?(t=n,i=n):(t=Mm(r,"left",0),i=Mm(r,"right",t));var a=Mm(r,"y",null);null!==a?(e=a,s=a):(e=Mm(r,"top",0),s=Mm(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 Lm(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Rm(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Am={right:0,down:1,left:2,up:3};var Bm=function(t){return"string"==typeof t&&(t=Am[t]),t%=4};Object.assign(Dm.prototype,Tm,_m);class jm extends wm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new Dm(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}} /** * @author Richard Davey * @copyright 2019 Photon Storm Ltd. diff --git a/dist/rexmdscenario.js b/dist/rexmdscenario.js index 46e000329d..54d91c62bc 100644 --- a/dist/rexmdscenario.js +++ b/dist/rexmdscenario.js @@ -54052,6 +54052,12 @@ void main () { } else if (TagRegex.RE_SIZE_CLOSE.test(text)) { UpdateProp(prevProp, PROP_REMOVE, 'size'); + } else if (TagRegex.RE_FAMILY_OPEN.test(text)) { + var innerMatch = text.match(TagRegex.RE_FAMILY_OPEN); + UpdateProp(prevProp, PROP_ADD, 'family', innerMatch[1]); + } else if (TagRegex.RE_FAMILY_CLOSE.test(text)) { + UpdateProp(prevProp, PROP_REMOVE, 'family'); + } else if (TagRegex.RE_COLOR_OPEN.test(text)) { var innerMatch = text.match(TagRegex.RE_COLOR_OPEN); UpdateProp(prevProp, PROP_ADD, 'color', innerMatch[1]); @@ -54329,6 +54335,7 @@ void main () { case 'color': case 'weight': + case 'family': case 'stroke': case 'bgcolor': case 'y': @@ -54432,6 +54439,10 @@ void main () { var SIZE_OPEN = GetOpenTagRegString(delimiterLeft, delimiterRight, SIZE, NUMBER_PARAM); var SIZE_CLOSE = GetCloseTagRegString(delimiterLeft, delimiterRight, SIZE); + var FAMILY = 'family'; + var FAMILY_OPEN = GetOpenTagRegString(delimiterLeft, delimiterRight, FAMILY, STR_PARAM); + var FAMILY_CLOSE = GetCloseTagRegString(delimiterLeft, delimiterRight, FAMILY); + var COLOR = 'color'; var COLOR_OPEN = GetOpenTagRegString(delimiterLeft, delimiterRight, COLOR, COLOR_PARAM); var COLOR_CLOSE = GetCloseTagRegString(delimiterLeft, delimiterRight, COLOR); @@ -54502,6 +54513,9 @@ void main () { TagRegexSave.RE_SIZE_OPEN = new RegExp(SIZE_OPEN, 'i'); TagRegexSave.RE_SIZE_CLOSE = new RegExp(SIZE_CLOSE, 'i'); + TagRegexSave.RE_FAMILY_OPEN = new RegExp(FAMILY_OPEN, 'i'); + TagRegexSave.RE_FAMILY_CLOSE = new RegExp(FAMILY_CLOSE, 'i'); + TagRegexSave.RE_COLOR_OPEN = new RegExp(COLOR_OPEN, 'i'); TagRegexSave.RE_COLOR_CLOSE = new RegExp(COLOR_CLOSE, 'i'); @@ -54551,6 +54565,7 @@ void main () { WEIGHT_OPEN, WEIGHT_CLOSE, SIZE_OPEN, SIZE_CLOSE, + FAMILY_OPEN, FAMILY_CLOSE, COLOR_OPEN, COLOR_CLOSE, UNDERLINE_OPEN, UNDERLINE_OPENC, UNDERLINE_CLOSE, STRIKETHROUGH_OPEN, STRIKETHROUGH_OPENC, STRIKETHROUGH_CLOSE, diff --git a/dist/rexmdscenario.min.js b/dist/rexmdscenario.min.js index 141e14253a..fd26b2844d 100644 --- a/dist/rexmdscenario.min.js +++ b/dist/rexmdscenario.min.js @@ -25,4 +25,4 @@ * @author Richard Davey * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const aC=Phaser.Display.Canvas.CanvasPool;var oC=function(t){var e=aC.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 aC.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,aC.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!==Tm&&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=Dm[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]=lC(t,l,u);else{var d=hC(t,l,u);c&&(d=c(d)),this[o]=d}}var p=lC(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=lC(t,"fill",null);null!==g&&(this.color=dy(g));var f=lC(t,"metrics",!1);return f?this.metrics={ascent:lC(f,"ascent",0),descent:lC(f,"descent",0),fontSize:lC(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=oC(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=oC(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=lC(t,"fontFamily","Courier"),this.fontSize=lC(t,"fontSize","16px"),this.fontStyle=lC(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=dy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=dy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=dy(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=dy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=dy(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=dy(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=dy(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=dy(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=dy(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=dy(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=dy(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=dy(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=Dm[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=lC(e,"fontFamily",this.fontFamily),this.fontSize=lC(e,"fontSize",this.fontSize),this.fontStyle=lC(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 cC={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),wy(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 dC=Phaser.Utils.Objects.GetValue,pC=wm,gC=_m;class fC{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=dC(t,"text",""),this.x=dC(t,"x",0),this.y=dC(t,"y",0),this.width=dC(t,"width",0);var e=dC(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=dC(t,"newLineMode",0),this.startIndex=dC(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===gC&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==pC&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===gC&&(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 vC=Phaser.Utils.Objects.GetFastValue,mC=wm,yC=Em;class bC{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=vC(t,"tagToText",ud),this.tagToTextScope=vC(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 xC={};const CC=Phaser.Geom.Rectangle;var kC=new Da;class SC{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&IC(f)){""!==b?a.push(n.getLine(b,x,MC)):0===C&&r>0&&a.push(n.getLine("",0,MC)),a.push(...FC(f,e,LC,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,MC)),b=f,x=v,h=s):(b+=f,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},BC=function(t,e){var i;switch(e){case AC:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==zC&&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 bC({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 Vk(this.sizerChildren,null),Qv.call(this,t),this}},Uk={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Vk(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},Zk={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=hp.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,Vk(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Vk(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},tS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const eS=Phaser.Utils.Objects.IsPlainObject,iS=Phaser.Utils.Objects.GetValue;class sS extends zv{constructor(t,e,i,s,r,n,a,o,h,l){eS(e)?(e=iS(l=e,"x",0),i=iS(l,"y",0),s=iS(l,"width",void 0),r=iS(l,"height",void 0),n=iS(l,"column",l.col||0),a=iS(l,"row",0),o=iS(l,"columnProportions",0),h=iS(l,"rowProportions",0)):eS(s)?(s=iS(l=s,"width",void 0),r=iS(l,"height",void 0),n=iS(l,"column",l.col||0),a=iS(l,"row",0),o=iS(l,"columnProportions",0),h=iS(l,"rowProportions",0)):eS(n)?(n=iS(l=n,"column",l.col||0),a=iS(l,"row",0),o=iS(l,"columnProportions",0),h=iS(l,"rowProportions",0)):eS(o)&&(o=iS(l=o,"columnProportions",0),h=iS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(iS(l,"createCellContainerCallback")),this.setIndentLeft(iS(l,"space.indentLeftOdd",0),iS(l,"space.indentLeftEven",0)),this.setIndentTop(iS(l,"space.indentTopOdd",0),iS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,iS(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=Qk.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=tS.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(sS.prototype,Zk);const rS=Phaser.Utils.Objects.GetValue;const nS=Phaser.Math.Percent;var aS=function(t,e,i){var s;return t.y===e.y?s=nS(i.x,t.x,e.x):t.x===e.x&&(s=nS(i.y,t.y,e.y)),s},oS=function(t,e,i){var s,r;this.enable&&(hS.x=e,hS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=aS(s,r,hS))},hS={},lS=function(t,e,i){if(this.enable&&t.isDown){var s,r;uS.x=t.worldX,uS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=aS(s,r,uS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},uS={},cS=function(t,e){void 0===e&&(e=dS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return Rd(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},dS={};const pS=Phaser.Display.Align.LEFT_CENTER,gS=Phaser.Display.Align.TOP_CENTER;var fS={};const vS=Phaser.Display.Align.RIGHT_CENTER,mS=Phaser.Display.Align.BOTTOM_CENTER;var yS={};const bS=Phaser.Math.Linear;var xS={};const CS=Phaser.Display.Align.LEFT_CENTER,kS=Phaser.Display.Align.TOP_CENTER,SS=Phaser.Display.Align.RIGHT_CENTER,wS=Phaser.Display.Align.BOTTOM_CENTER;const _S=Phaser.Utils.Objects.GetValue,ES=Phaser.Utils.Objects.IsPlainObject,TS=Phaser.Math.Clamp,OS=Phaser.Math.Snap.To;class PS extends(rc(dm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=_S(e,"reverseAxis",!1);var i=_S(e,"background",void 0),s=_S(e,"track",void 0),r=_S(e,"indicator",void 0),n=_S(e,"thumb",void 0);if(i&&(ES(i)&&(i=qx(t,i)),this.addBackground(i)),s&&(ES(s)&&(s=qx(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(ES(r)&&(r=qx(t,r)),this.pin(r)),n){ES(n)&&(n=qx(t,n)),this.pin(n);var a=_S(e,"thumbOffsetX",0),o=_S(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=_S(e,"input",0);switch("string"==typeof h&&(h=MS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",oS,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",lS,this).on("pointermove",lS,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(_S(e,"enable",void 0)),this.setGap(_S(e,"gap",void 0)),this.setValue(_S(e,"value",0),_S(e,"min",void 0),_S(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=OS(t,this.gap));var e=this._value;this._value=TS(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 MS={pan:0,drag:0,click:1,none:-1};var DS={getStartPoint:function(t){if(void 0===t&&(t=fS),this.childrenMap.thumb){var e=0===this.orientation?pS:gS;cS.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=yS),this.childrenMap.thumb){var e=0===this.orientation?vS:mS;cS.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=xS),s.x=bS(e.x,i.x,t),s.y=bS(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;fp(e,i,s),r=n?0===this.orientation?SS:wS:0===this.orientation?CS:kS,Ld(e,this,r),this.resetChildPositionState(e)}};Object.assign(PS.prototype,DS);const AS=Phaser.Utils.Objects.GetValue;class LS extends dm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=AS(e,"background",void 0),r=AS(e,"buttons",void 0),n=AS(r,"top",AS(r,"left",void 0)),a=AS(r,"bottom",AS(r,"right",void 0)),o=AS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new vf(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===AS(o,"width",void 0)?1:0;else h=void 0===AS(o,"height",void 0)?1:0;i=new PS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new vf(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=AS(e,"valuechangeCallback",null);if(null!==u){var c=AS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(AS(e,"enable",void 0)),this.setValue(AS(e,"value",0)),this.setScrollStep(AS(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 RS extends mg{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 FS=Phaser.Utils.Objects.GetValue,BS=Phaser.Math.Distance.Between;class IS extends In{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=FS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(FS(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(FS(t,"enable",!0)),this.holdThreshold=FS(t,"holdThreshold",50),this.pointerOutReleaseEnable=FS(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 qf(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:BS(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&&!Vg(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&&!Vg(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 jS=Phaser.Utils.Objects.GetValue;class zS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(jS(t,"value",0)),this.setSpeed(jS(t,"speed",0)),this.setAcceleration(jS(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 NS{constructor(){this.value,this.dir,this.movement=new zS}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 WS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},$S=Phaser.Utils.Objects.GetValue;class VS extends In{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=$S(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed($S(e,"speed",.1)),this.setEnable($S(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive($S(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||Vg(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 HS=Phaser.Utils.Objects.GetValue;var US=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)?HS(s,l,void 0):HS(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=lo(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 LS(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=HS(r,"position",0);"string"==typeof p&&(p=qS[p]);var g,f,v=HS(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=HS(s,"space.slider",void 0))&&(o?v=0:g=HS(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:HS(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:HS(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:HS(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:HS(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=HS(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=HS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=HS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=HS(s,"scrollDetectionMode");"string"==typeof b&&(b=KS[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?HS(s,x,!0):HS(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new XS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,S,w,_,E=HS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(E&&h&&(void 0!==b&&(E.focus=1===b?2:0),C=new VS(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 qS={right:0,left:1,bottom:0,top:1},KS={gameObject:0,rectBounds:1},JS=Phaser.Utils.Objects.GetValue;var ZS=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=JS(e,"width"),a=JS(e,"height");n||(JS(e,"child.expandWidth",!0)||(s[1]=0));a||(JS(e,"child.expandHeight",!0)||(r[1]=0));var o=new sS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=rS(i,"child"),r=rS(s,"gameObject",void 0);if(r){var n=rS(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=rS(n,"top",0),a.bottom=rS(n,"bottom",0),o.left=rS(n,"left",0),o.right=rS(n,"right",0);break;case 1:a.top=rS(n,"left",0),a.bottom=rS(n,"right",0),o.top=rS(n,"top",0),o.bottom=rS(n,"bottom",0);break;default:a.top=rS(n,"top",0),a.bottom=rS(n,"bottom",0),a.left=rS(n,"left",0),a.right=rS(n,"right",0)}e.add(r,{column:1,row:1,align:rS(s,"align","center"),padding:o,expand:{width:rS(s,"expandWidth",!0),height:rS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:US(t,o,"y",e);break;case 1:US(t,o,"x",e);break;default:US(t,o,"y",e),US(t,o,"x",e)}return o},QS=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)},tw=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)}},ew=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 yw=function(t){return t.add.text(0,0,"")};Object.assign(mw.prototype,pw);var bw={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},xw={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 Cw=Phaser.Utils.Objects.GetValue;class kw extends nw{constructor(t,e){void 0===e&&(e={});var i=Cw(e,"text",void 0),s=Cw(e,"textWidth",void 0),r=Cw(e,"textHeight",void 0),n=Cw(e,"textCrop",!!i.setCrop),a=Cw(e,"textMask",!n),o=Cw(e,"content",""),h=new mw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Cw(e,"clampChildOY",!1),alwaysScrollable:Cw(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=Cw(e,"space",void 0);l&&(l.child=Cw(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(kw.prototype,bw,xw);const Sw=Phaser.Utils.Objects.GetValue;var ww=function(t,e,i){e=e?y(e):{};var s=Sw(i,"background",qx),r=Sw(i,"text",_w),n=Sw(i,"track",qx),a=Sw(i,"thumb",qx);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 kw(t,e);return t.add.existing(h),h},_w=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 Ak(t,e);break;case"bbcodetext":case"bbcode":s=new Ok(t,0,0,"",e);break;case"label":s=new Fk(t,e);break;case"textarea":s=ww(t,e);break;default:s=new Zx(t,e)}return Ux(s,e),t.add.existing(s),s},Ew=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 Vx(t,e):new wx(t,e);break;case"roundRectangle":s=new dx(t,e);break;default:s=new Ox(t,e)}return Ux(s,e),t.add.existing(s),s};const Tw=Phaser.Utils.Objects.GetValue;var Ow=function(t,e,i){e=e?y(e):{};var s=Tw(i,"background",qx),r=Tw(i,"text",_w),n=Tw(i,"icon",Ew),a=Tw(i,"action",Ew);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 Pw=Phaser.Utils.Objects.GetValue;var Mw=function(t,e,i){var s,r,n=Pw(i,"innerBackground",qx),a=Pw(i,"separator",qx),o=Pw(i,"title",_w);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Ow(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 Dw extends Hb{constructor(t,e,i){super(t,e=Mw(t,e,i))}}var Aw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ol(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 Lw=Phaser.Utils.Objects.GetValue;class Rw extends Ul{constructor(t,e){super(t,Lw(e,"x",0),Lw(e,"y",0),Lw(e,"width",64),Lw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Lw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Lw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Lw(t,"ease",i)),i=e?0:this.delay,this.setDelay(Lw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Lw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Lw(t,"color",i)),i=e?0:this.value,this.setValue(Lw(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(Rw.prototype,Aw);const Fw=Phaser.Math.DegToRad,Bw=Phaser.Math.Linear,Iw=Phaser.Math.Easing.Expo.In,jw={right:0,down:1,left:2,up:3};var zw=function(t,e,i,s,r,n,a,o,h,l,u){var c=Gw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=Gw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=Gw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=Gw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=Gw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=Gw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Nw={},Gw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Nw.x=a*u+o*c+r,Nw.y=h*u+l*c+n,Nw},Yw={setDirection(t){return"string"==typeof t&&(t=jw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Ru)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Fw(315);i=Math.cos(a),s=Math.sin(a);var o=Fw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Fw(135);i=Math.cos(a),s=Math.sin(a);o=Fw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Fw(225);i=Math.cos(a),s=Math.sin(a);o=Fw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Fw(45);i=Math.cos(a),s=Math.sin(a);o=Fw(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)),(d=this.getSizerConfig(t)).align=i,d.padding=Cl(s),K_(r)?(d.expandWidth=J_(r,"width",!1),d.expandHeight=J_(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Ir(t):n),d.expandHeight&&(t.minHeight=void 0===a?jr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},eE={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]),qd.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 Qv.call(this,t),this}},iE={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,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,Zg.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(U_.width=e.aspectRatio,U_.height=1,q_.width=l,q_.height=u,l=(c=hl(U_,q_,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Nv(t,this)):fp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Ir(t)),void 0===u&&(u=jr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,Qg.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(iE,tE,eE);const sE=Phaser.Utils.Objects.IsPlainObject,rE=Phaser.Utils.Objects.GetValue;class nE extends zv{constructor(t,e,i,s,r,n){sE(e)?(e=rE(n=e,"x",0),i=rE(n,"y",0),s=rE(n,"width",void 0),r=rE(n,"height",void 0)):sE(s)&&(s=rE(n=s,"width",void 0),r=rE(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(nE.prototype,iE);const aE=dm.prototype.add,oE=dm.prototype.addSpace;var hE=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)&&oE.call(this),aE.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&oE.call(this),this.hasTailSpace=s}else aE.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;aE.call(this,t,{index:r,proportion:i,expand:!0})}else aE.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},lE={addButton(t){if(Hg(t))for(var e=t,i=0,s=e.length;i=0;i--)dE.call(this,e[i],t);return this}},gE=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)}},fE=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,gE.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},vE={add(t){return this.buttons.push(t),t._click||(t._click=new rf(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`),fE.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=ME(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=ME(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const AE=Phaser.Utils.Objects.IsPlainObject,LE=Phaser.Utils.Objects.GetValue,RE=Phaser.Display.Align.CENTER;var FE=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(Yd.call(this,t),AE(e))&&(e=LE(h=e,"padding",0),i=LE(h,"key",void 0),s=LE(h,"index",void 0),r=LE(h,"offsetX",0),n=LE(h,"offsetY",0),a=LE(h,"offsetOriginX",0),o=LE(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=RE,h.padding=Cl(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,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},BE={add(t,e,i){if(Hg(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,Qv.call(this,t),this}},zE={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&&VE.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)JE.call(this,e[i],t);return this}};const QE=Phaser.Utils.Objects.GetValue;class tT extends WE{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 SE({parent:this,eventEmitter:QE(e,"eventEmitter",this),groupName:QE(e,"groupName",void 0),clickConfig:QE(e,"click",void 0)}).setButtonsType(e);var s=QE(e,"background",void 0),r=QE(e,"buttons",void 0);this.buttonsAlign=QE(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(tT.prototype,UE,ZE,kE,_E);const eT=sS.prototype.add;var iT={addButton(t,e,i){return eT.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--)nT.call(this,e[i],t);return this}};const oT=Phaser.Utils.Objects.GetValue;class hT extends sS{constructor(t,e){void 0===e&&(e={});var i=oT(e,"row",0),s=oT(e,"column",e.col||0),r=oT(e,"createCellContainerCallback"),n=oT(e,"buttons",void 0),a=oT(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)):(rO(this),nO(this)),this}setNumberInput(){return this.onUpdateCallback=sO,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const hO=Phaser.Utils.Objects.GetValue,lO=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var uO=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)},cO=function(t){pr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=ax(t.style,e);kl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},dO=function(t){pr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=ax(t,e);kl(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 pO(){}function gO(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}pO.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(gO(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 fO=new pO;const vO=/^[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,mO=/\S/,yO=new pO;yO.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!mO.test(t)&&!mO.test(e)},yO.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(kO(t,null,null,i),i," ")},CO.equals=function(t,e){return pO.prototype.equals.call(CO,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const SO=new pO;SO.tokenize=function(t){return t.slice()},SO.join=SO.removeEmpty=function(t){return t};const wO=Phaser.Utils.Array.Remove;var _O=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),wO(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,fO.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},MO={cursorMoveLeft(){if(!this.isOpened)return this;var t=TO(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=TO(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=OO(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=TO(PO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=OO(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=TO(PO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const DO=Phaser.Utils.Objects.IsPlainObject;class AO extends Fb{constructor(t,e,i,s,r,n){DO(e)?n=e:DO(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 $o(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=nx(n.background,"focus"),h=nx(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=hO(e,"edit");return void 0===i&&(i={}),WT(e,i,lO),new oO(t,i)}(this,n),uO.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),dO.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),cO.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 vc(t,e);return Ux(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 L_(t,e);return Ux(i,e),t.add.existing(i),i},y=!0);var b,x,C=new Dw(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)),kc(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=F_[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=F_[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}}(I_(e,`styles.${Uo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Uo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{typing:Mc,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=_c(e,`creators.${Vo}`,void 0);if(!1!==s){if(Ec(s)&&(s=void 0),void 0===s){_c(e,`styles.${Vo}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new vc(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 kc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Vo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{cross:wc,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=FT(e,`creators.${Ko}`,void 0);if(!1!==s){var r;if(BT(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 LT(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,kc(u),u}}(FT(e,`styles.${Ko}`,{}),{viewport:i},r);t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{choice:RT,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=zO(e,`creators.${Jo}`,void 0);if(!1!==s){var r;if(NO(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 IO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,kc(u),u}}(zO(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{input:jO,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=V_(e,`creators.${qo}`,void 0);if(!1!==s){var r;if(H_(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 vc(t,e);return Ux(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,C=new z_(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,kc(C),C}}(V_(e,`styles.${qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{setText:G_,popUp:Y_,shake:Sc}})}}];var YO=[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))}))}],XO={$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},WO=function(t,e){var{defaultVariables:i}=e;for(var s in i=function(t,e){var i=lo(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i}(i,XO),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=on(t,t.cameras.main));for(var a=new To(t,{layers:r?No:Go,layerDepth:i,rootLayer:s}),o=0,h=GO.length;oh;u--){for(c=0;c0&&this.wrapMode!==Tm&&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=Dm[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]=lC(t,l,u);else{var d=hC(t,l,u);c&&(d=c(d)),this[o]=d}}var p=lC(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=lC(t,"fill",null);null!==g&&(this.color=dy(g));var f=lC(t,"metrics",!1);return f?this.metrics={ascent:lC(f,"ascent",0),descent:lC(f,"descent",0),fontSize:lC(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=oC(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=oC(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=lC(t,"fontFamily","Courier"),this.fontSize=lC(t,"fontSize","16px"),this.fontStyle=lC(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=dy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=dy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=dy(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=dy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=dy(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=dy(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=dy(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=dy(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=dy(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=dy(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=dy(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=dy(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=Dm[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=lC(e,"fontFamily",this.fontFamily),this.fontSize=lC(e,"fontSize",this.fontSize),this.fontStyle=lC(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 cC={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),wy(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 dC=Phaser.Utils.Objects.GetValue,pC=wm,gC=_m;class fC{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=dC(t,"text",""),this.x=dC(t,"x",0),this.y=dC(t,"y",0),this.width=dC(t,"width",0);var e=dC(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=dC(t,"newLineMode",0),this.startIndex=dC(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===gC&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==pC&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===gC&&(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 vC=Phaser.Utils.Objects.GetFastValue,mC=wm,yC=Em;class bC{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=vC(t,"tagToText",ud),this.tagToTextScope=vC(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 xC={};const CC=Phaser.Geom.Rectangle;var kC=new Da;class SC{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&IC(f)){""!==b?a.push(n.getLine(b,x,MC)):0===C&&r>0&&a.push(n.getLine("",0,MC)),a.push(...FC(f,e,LC,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,MC)),b=f,x=v,h=s):(b+=f,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},BC=function(t,e){var i;switch(e){case AC:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==zC&&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 bC({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 Vk(this.sizerChildren,null),Qv.call(this,t),this}},Uk={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Vk(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},Zk={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=hp.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,Vk(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Vk(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},tS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const eS=Phaser.Utils.Objects.IsPlainObject,iS=Phaser.Utils.Objects.GetValue;class sS extends zv{constructor(t,e,i,s,r,n,a,o,h,l){eS(e)?(e=iS(l=e,"x",0),i=iS(l,"y",0),s=iS(l,"width",void 0),r=iS(l,"height",void 0),n=iS(l,"column",l.col||0),a=iS(l,"row",0),o=iS(l,"columnProportions",0),h=iS(l,"rowProportions",0)):eS(s)?(s=iS(l=s,"width",void 0),r=iS(l,"height",void 0),n=iS(l,"column",l.col||0),a=iS(l,"row",0),o=iS(l,"columnProportions",0),h=iS(l,"rowProportions",0)):eS(n)?(n=iS(l=n,"column",l.col||0),a=iS(l,"row",0),o=iS(l,"columnProportions",0),h=iS(l,"rowProportions",0)):eS(o)&&(o=iS(l=o,"columnProportions",0),h=iS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(iS(l,"createCellContainerCallback")),this.setIndentLeft(iS(l,"space.indentLeftOdd",0),iS(l,"space.indentLeftEven",0)),this.setIndentTop(iS(l,"space.indentTopOdd",0),iS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,iS(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=Qk.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=tS.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(sS.prototype,Zk);const rS=Phaser.Utils.Objects.GetValue;const nS=Phaser.Math.Percent;var aS=function(t,e,i){var s;return t.y===e.y?s=nS(i.x,t.x,e.x):t.x===e.x&&(s=nS(i.y,t.y,e.y)),s},oS=function(t,e,i){var s,r;this.enable&&(hS.x=e,hS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=aS(s,r,hS))},hS={},lS=function(t,e,i){if(this.enable&&t.isDown){var s,r;uS.x=t.worldX,uS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=aS(s,r,uS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},uS={},cS=function(t,e){void 0===e&&(e=dS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return Rd(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},dS={};const pS=Phaser.Display.Align.LEFT_CENTER,gS=Phaser.Display.Align.TOP_CENTER;var fS={};const vS=Phaser.Display.Align.RIGHT_CENTER,mS=Phaser.Display.Align.BOTTOM_CENTER;var yS={};const bS=Phaser.Math.Linear;var xS={};const CS=Phaser.Display.Align.LEFT_CENTER,kS=Phaser.Display.Align.TOP_CENTER,SS=Phaser.Display.Align.RIGHT_CENTER,wS=Phaser.Display.Align.BOTTOM_CENTER;const _S=Phaser.Utils.Objects.GetValue,ES=Phaser.Utils.Objects.IsPlainObject,TS=Phaser.Math.Clamp,OS=Phaser.Math.Snap.To;class PS extends(rc(dm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=_S(e,"reverseAxis",!1);var i=_S(e,"background",void 0),s=_S(e,"track",void 0),r=_S(e,"indicator",void 0),n=_S(e,"thumb",void 0);if(i&&(ES(i)&&(i=qx(t,i)),this.addBackground(i)),s&&(ES(s)&&(s=qx(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(ES(r)&&(r=qx(t,r)),this.pin(r)),n){ES(n)&&(n=qx(t,n)),this.pin(n);var a=_S(e,"thumbOffsetX",0),o=_S(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=_S(e,"input",0);switch("string"==typeof h&&(h=MS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",oS,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",lS,this).on("pointermove",lS,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(_S(e,"enable",void 0)),this.setGap(_S(e,"gap",void 0)),this.setValue(_S(e,"value",0),_S(e,"min",void 0),_S(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=OS(t,this.gap));var e=this._value;this._value=TS(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 MS={pan:0,drag:0,click:1,none:-1};var DS={getStartPoint:function(t){if(void 0===t&&(t=fS),this.childrenMap.thumb){var e=0===this.orientation?pS:gS;cS.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=yS),this.childrenMap.thumb){var e=0===this.orientation?vS:mS;cS.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=xS),s.x=bS(e.x,i.x,t),s.y=bS(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;fp(e,i,s),r=n?0===this.orientation?SS:wS:0===this.orientation?CS:kS,Ld(e,this,r),this.resetChildPositionState(e)}};Object.assign(PS.prototype,DS);const AS=Phaser.Utils.Objects.GetValue;class LS extends dm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=AS(e,"background",void 0),r=AS(e,"buttons",void 0),n=AS(r,"top",AS(r,"left",void 0)),a=AS(r,"bottom",AS(r,"right",void 0)),o=AS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new vf(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===AS(o,"width",void 0)?1:0;else h=void 0===AS(o,"height",void 0)?1:0;i=new PS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new vf(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=AS(e,"valuechangeCallback",null);if(null!==u){var c=AS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(AS(e,"enable",void 0)),this.setValue(AS(e,"value",0)),this.setScrollStep(AS(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 RS extends mg{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 FS=Phaser.Utils.Objects.GetValue,BS=Phaser.Math.Distance.Between;class IS extends In{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=FS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(FS(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(FS(t,"enable",!0)),this.holdThreshold=FS(t,"holdThreshold",50),this.pointerOutReleaseEnable=FS(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 qf(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:BS(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&&!Vg(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&&!Vg(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 jS=Phaser.Utils.Objects.GetValue;class zS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(jS(t,"value",0)),this.setSpeed(jS(t,"speed",0)),this.setAcceleration(jS(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 NS{constructor(){this.value,this.dir,this.movement=new zS}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 WS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},$S=Phaser.Utils.Objects.GetValue;class VS extends In{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=$S(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed($S(e,"speed",.1)),this.setEnable($S(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive($S(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||Vg(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 HS=Phaser.Utils.Objects.GetValue;var US=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)?HS(s,l,void 0):HS(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=lo(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 LS(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=HS(r,"position",0);"string"==typeof p&&(p=qS[p]);var g,f,v=HS(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=HS(s,"space.slider",void 0))&&(o?v=0:g=HS(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:HS(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:HS(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:HS(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:HS(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=HS(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=HS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=HS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=HS(s,"scrollDetectionMode");"string"==typeof b&&(b=KS[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?HS(s,x,!0):HS(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new XS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,S,w,_,E=HS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(E&&h&&(void 0!==b&&(E.focus=1===b?2:0),C=new VS(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 qS={right:0,left:1,bottom:0,top:1},KS={gameObject:0,rectBounds:1},JS=Phaser.Utils.Objects.GetValue;var ZS=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=JS(e,"width"),a=JS(e,"height");n||(JS(e,"child.expandWidth",!0)||(s[1]=0));a||(JS(e,"child.expandHeight",!0)||(r[1]=0));var o=new sS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=rS(i,"child"),r=rS(s,"gameObject",void 0);if(r){var n=rS(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=rS(n,"top",0),a.bottom=rS(n,"bottom",0),o.left=rS(n,"left",0),o.right=rS(n,"right",0);break;case 1:a.top=rS(n,"left",0),a.bottom=rS(n,"right",0),o.top=rS(n,"top",0),o.bottom=rS(n,"bottom",0);break;default:a.top=rS(n,"top",0),a.bottom=rS(n,"bottom",0),a.left=rS(n,"left",0),a.right=rS(n,"right",0)}e.add(r,{column:1,row:1,align:rS(s,"align","center"),padding:o,expand:{width:rS(s,"expandWidth",!0),height:rS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:US(t,o,"y",e);break;case 1:US(t,o,"x",e);break;default:US(t,o,"y",e),US(t,o,"x",e)}return o},QS=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)},tw=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)}},ew=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 yw=function(t){return t.add.text(0,0,"")};Object.assign(mw.prototype,pw);var bw={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},xw={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 Cw=Phaser.Utils.Objects.GetValue;class kw extends nw{constructor(t,e){void 0===e&&(e={});var i=Cw(e,"text",void 0),s=Cw(e,"textWidth",void 0),r=Cw(e,"textHeight",void 0),n=Cw(e,"textCrop",!!i.setCrop),a=Cw(e,"textMask",!n),o=Cw(e,"content",""),h=new mw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Cw(e,"clampChildOY",!1),alwaysScrollable:Cw(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=Cw(e,"space",void 0);l&&(l.child=Cw(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(kw.prototype,bw,xw);const Sw=Phaser.Utils.Objects.GetValue;var ww=function(t,e,i){e=e?y(e):{};var s=Sw(i,"background",qx),r=Sw(i,"text",_w),n=Sw(i,"track",qx),a=Sw(i,"thumb",qx);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 kw(t,e);return t.add.existing(h),h},_w=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 Ak(t,e);break;case"bbcodetext":case"bbcode":s=new Ok(t,0,0,"",e);break;case"label":s=new Fk(t,e);break;case"textarea":s=ww(t,e);break;default:s=new Zx(t,e)}return Ux(s,e),t.add.existing(s),s},Ew=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 Vx(t,e):new wx(t,e);break;case"roundRectangle":s=new dx(t,e);break;default:s=new Ox(t,e)}return Ux(s,e),t.add.existing(s),s};const Tw=Phaser.Utils.Objects.GetValue;var Ow=function(t,e,i){e=e?y(e):{};var s=Tw(i,"background",qx),r=Tw(i,"text",_w),n=Tw(i,"icon",Ew),a=Tw(i,"action",Ew);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 Pw=Phaser.Utils.Objects.GetValue;var Mw=function(t,e,i){var s,r,n=Pw(i,"innerBackground",qx),a=Pw(i,"separator",qx),o=Pw(i,"title",_w);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Ow(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 Dw extends Hb{constructor(t,e,i){super(t,e=Mw(t,e,i))}}var Aw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ol(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 Lw=Phaser.Utils.Objects.GetValue;class Rw extends Ul{constructor(t,e){super(t,Lw(e,"x",0),Lw(e,"y",0),Lw(e,"width",64),Lw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Lw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Lw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Lw(t,"ease",i)),i=e?0:this.delay,this.setDelay(Lw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Lw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Lw(t,"color",i)),i=e?0:this.value,this.setValue(Lw(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(Rw.prototype,Aw);const Fw=Phaser.Math.DegToRad,Bw=Phaser.Math.Linear,Iw=Phaser.Math.Easing.Expo.In,jw={right:0,down:1,left:2,up:3};var zw=function(t,e,i,s,r,n,a,o,h,l,u){var c=Gw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=Gw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=Gw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=Gw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=Gw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=Gw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Nw={},Gw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Nw.x=a*u+o*c+r,Nw.y=h*u+l*c+n,Nw},Yw={setDirection(t){return"string"==typeof t&&(t=jw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Ru)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Fw(315);i=Math.cos(a),s=Math.sin(a);var o=Fw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Fw(135);i=Math.cos(a),s=Math.sin(a);o=Fw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Fw(225);i=Math.cos(a),s=Math.sin(a);o=Fw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Fw(45);i=Math.cos(a),s=Math.sin(a);o=Fw(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)),(d=this.getSizerConfig(t)).align=i,d.padding=Cl(s),K_(r)?(d.expandWidth=J_(r,"width",!1),d.expandHeight=J_(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Ir(t):n),d.expandHeight&&(t.minHeight=void 0===a?jr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},eE={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]),qd.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 Qv.call(this,t),this}},iE={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,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,Zg.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(U_.width=e.aspectRatio,U_.height=1,q_.width=l,q_.height=u,l=(c=hl(U_,q_,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Nv(t,this)):fp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Ir(t)),void 0===u&&(u=jr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,Qg.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(iE,tE,eE);const sE=Phaser.Utils.Objects.IsPlainObject,rE=Phaser.Utils.Objects.GetValue;class nE extends zv{constructor(t,e,i,s,r,n){sE(e)?(e=rE(n=e,"x",0),i=rE(n,"y",0),s=rE(n,"width",void 0),r=rE(n,"height",void 0)):sE(s)&&(s=rE(n=s,"width",void 0),r=rE(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(nE.prototype,iE);const aE=dm.prototype.add,oE=dm.prototype.addSpace;var hE=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)&&oE.call(this),aE.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&oE.call(this),this.hasTailSpace=s}else aE.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;aE.call(this,t,{index:r,proportion:i,expand:!0})}else aE.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},lE={addButton(t){if(Hg(t))for(var e=t,i=0,s=e.length;i=0;i--)dE.call(this,e[i],t);return this}},gE=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)}},fE=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,gE.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},vE={add(t){return this.buttons.push(t),t._click||(t._click=new rf(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`),fE.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=ME(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=ME(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const AE=Phaser.Utils.Objects.IsPlainObject,LE=Phaser.Utils.Objects.GetValue,RE=Phaser.Display.Align.CENTER;var FE=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(Yd.call(this,t),AE(e))&&(e=LE(h=e,"padding",0),i=LE(h,"key",void 0),s=LE(h,"index",void 0),r=LE(h,"offsetX",0),n=LE(h,"offsetY",0),a=LE(h,"offsetOriginX",0),o=LE(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=RE,h.padding=Cl(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,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},BE={add(t,e,i){if(Hg(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,Qv.call(this,t),this}},zE={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&&VE.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)JE.call(this,e[i],t);return this}};const QE=Phaser.Utils.Objects.GetValue;class tT extends WE{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 SE({parent:this,eventEmitter:QE(e,"eventEmitter",this),groupName:QE(e,"groupName",void 0),clickConfig:QE(e,"click",void 0)}).setButtonsType(e);var s=QE(e,"background",void 0),r=QE(e,"buttons",void 0);this.buttonsAlign=QE(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(tT.prototype,UE,ZE,kE,_E);const eT=sS.prototype.add;var iT={addButton(t,e,i){return eT.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--)nT.call(this,e[i],t);return this}};const oT=Phaser.Utils.Objects.GetValue;class hT extends sS{constructor(t,e){void 0===e&&(e={});var i=oT(e,"row",0),s=oT(e,"column",e.col||0),r=oT(e,"createCellContainerCallback"),n=oT(e,"buttons",void 0),a=oT(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)):(rO(this),nO(this)),this}setNumberInput(){return this.onUpdateCallback=sO,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const hO=Phaser.Utils.Objects.GetValue,lO=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var uO=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)},cO=function(t){pr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=ax(t.style,e);kl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},dO=function(t){pr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=ax(t,e);kl(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 pO(){}function gO(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}pO.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(gO(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 fO=new pO;const vO=/^[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,mO=/\S/,yO=new pO;yO.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!mO.test(t)&&!mO.test(e)},yO.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(kO(t,null,null,i),i," ")},CO.equals=function(t,e){return pO.prototype.equals.call(CO,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const SO=new pO;SO.tokenize=function(t){return t.slice()},SO.join=SO.removeEmpty=function(t){return t};const wO=Phaser.Utils.Array.Remove;var _O=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),wO(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,fO.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},MO={cursorMoveLeft(){if(!this.isOpened)return this;var t=TO(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=TO(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=OO(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=TO(PO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=OO(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=TO(PO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const DO=Phaser.Utils.Objects.IsPlainObject;class AO extends Fb{constructor(t,e,i,s,r,n){DO(e)?n=e:DO(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 $o(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=nx(n.background,"focus"),h=nx(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=hO(e,"edit");return void 0===i&&(i={}),WT(e,i,lO),new oO(t,i)}(this,n),uO.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),dO.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),cO.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 vc(t,e);return Ux(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 L_(t,e);return Ux(i,e),t.add.existing(i),i},y=!0);var b,x,C=new Dw(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)),kc(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=F_[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=F_[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}}(I_(e,`styles.${Uo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Uo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{typing:Mc,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=_c(e,`creators.${Vo}`,void 0);if(!1!==s){if(Ec(s)&&(s=void 0),void 0===s){_c(e,`styles.${Vo}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new vc(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 kc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Vo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{cross:wc,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=FT(e,`creators.${Ko}`,void 0);if(!1!==s){var r;if(BT(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 LT(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,kc(u),u}}(FT(e,`styles.${Ko}`,{}),{viewport:i},r);t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{choice:RT,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=zO(e,`creators.${Jo}`,void 0);if(!1!==s){var r;if(NO(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 IO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,kc(u),u}}(zO(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{input:jO,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=V_(e,`creators.${qo}`,void 0);if(!1!==s){var r;if(H_(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 vc(t,e);return Ux(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,C=new z_(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,kc(C),C}}(V_(e,`styles.${qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{setText:G_,popUp:Y_,shake:Sc}})}}];var YO=[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))}))}],XO={$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},WO=function(t,e){var{defaultVariables:i}=e;for(var s in i=function(t,e){var i=lo(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i}(i,XO),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=on(t,t.cameras.main));for(var a=new To(t,{layers:r?No:Go,layerDepth:i,rootLayer:s}),o=0,h=GO.length;o * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const uk=Phaser.Display.Canvas.CanvasPool;var ck=function(t){var e=uk.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 uk.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,uk.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!==Dm&&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=Bm[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]=pk(t,l,u);else{var d=dk(t,l,u);c&&(d=c(d)),this[o]=d}}var p=pk(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=pk(t,"fill",null);null!==g&&(this.color=vy(g));var f=pk(t,"metrics",!1);return f?this.metrics={ascent:pk(f,"ascent",0),descent:pk(f,"descent",0),fontSize:pk(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=ck(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=ck(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=pk(t,"fontFamily","Courier"),this.fontSize=pk(t,"fontSize","16px"),this.fontStyle=pk(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=vy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=vy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=vy(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=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=vy(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=vy(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=vy(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=vy(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=vy(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=vy(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=vy(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=vy(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=Bm[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=pk(e,"fontFamily",this.fontFamily),this.fontSize=pk(e,"fontSize",this.fontSize),this.fontStyle=pk(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 fk={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),_y(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 k=l;k0){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 vk=Phaser.Utils.Objects.GetValue,mk=_m,yk=Em;class bk{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=vk(t,"text",""),this.x=vk(t,"x",0),this.y=vk(t,"y",0),this.width=vk(t,"width",0);var e=vk(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=vk(t,"newLineMode",0),this.startIndex=vk(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===yk&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==mk&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===yk&&(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 xk=Phaser.Utils.Objects.GetFastValue,kk=_m,Ck=Mm;class Sk{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=xk(t,"tagToText",gd),this.tagToTextScope=xk(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 wk={};const Tk=Phaser.Geom.Rectangle;var Pk=new Ra;class Ok{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Gk(f)){""!==b?a.push(n.getLine(b,x,Rk)):0===k&&r>0&&a.push(n.getLine("",0,Rk)),a.push(...zk(f,e,Ik,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,Rk)),b=f,x=v,h=s):(b+=f,x=m),k===C-1&&a.push(n.getLine(b,x,l))}return a},Nk=function(t,e){var i;switch(e){case Fk:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Vk&&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 Sk({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 JC(this.sizerChildren,null),sm.call(this,t),this}},QC={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)JC(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},sS={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=dp.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,JC(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)JC(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},nS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const aS=Phaser.Utils.Objects.IsPlainObject,oS=Phaser.Utils.Objects.GetValue;class hS extends Vv{constructor(t,e,i,s,r,n,a,o,h,l){aS(e)?(e=oS(l=e,"x",0),i=oS(l,"y",0),s=oS(l,"width",void 0),r=oS(l,"height",void 0),n=oS(l,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(s)?(s=oS(l=s,"width",void 0),r=oS(l,"height",void 0),n=oS(l,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(n)?(n=oS(l=n,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(o)&&(o=oS(l=o,"columnProportions",0),h=oS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(oS(l,"createCellContainerCallback")),this.setIndentLeft(oS(l,"space.indentLeftOdd",0),oS(l,"space.indentLeftEven",0)),this.setIndentTop(oS(l,"space.indentTopOdd",0),oS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,oS(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=rS.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=nS.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(hS.prototype,sS);const lS=Phaser.Utils.Objects.GetValue;const uS=Phaser.Math.Percent;var cS=function(t,e,i){var s;return t.y===e.y?s=uS(i.x,t.x,e.x):t.x===e.x&&(s=uS(i.y,t.y,e.y)),s},dS=function(t,e,i){var s,r;this.enable&&(pS.x=e,pS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=cS(s,r,pS))},pS={},gS=function(t,e,i){if(this.enable&&t.isDown){var s,r;fS.x=t.worldX,fS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=cS(s,r,fS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},fS={},vS=function(t,e){void 0===e&&(e=mS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return jd(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},mS={};const yS=Phaser.Display.Align.LEFT_CENTER,bS=Phaser.Display.Align.TOP_CENTER;var xS={};const kS=Phaser.Display.Align.RIGHT_CENTER,CS=Phaser.Display.Align.BOTTOM_CENTER;var SS={};const wS=Phaser.Math.Linear;var TS={};const PS=Phaser.Display.Align.LEFT_CENTER,OS=Phaser.Display.Align.TOP_CENTER,_S=Phaser.Display.Align.RIGHT_CENTER,ES=Phaser.Display.Align.BOTTOM_CENTER;const MS=Phaser.Utils.Objects.GetValue,DS=Phaser.Utils.Objects.IsPlainObject,LS=Phaser.Math.Clamp,AS=Phaser.Math.Snap.To;class RS extends(hc(vm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=MS(e,"reverseAxis",!1);var i=MS(e,"background",void 0),s=MS(e,"track",void 0),r=MS(e,"indicator",void 0),n=MS(e,"thumb",void 0);if(i&&(DS(i)&&(i=Qx(t,i)),this.addBackground(i)),s&&(DS(s)&&(s=Qx(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(DS(r)&&(r=Qx(t,r)),this.pin(r)),n){DS(n)&&(n=Qx(t,n)),this.pin(n);var a=MS(e,"thumbOffsetX",0),o=MS(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=MS(e,"input",0);switch("string"==typeof h&&(h=BS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",dS,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",gS,this).on("pointermove",gS,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(MS(e,"enable",void 0)),this.setGap(MS(e,"gap",void 0)),this.setValue(MS(e,"value",0),MS(e,"min",void 0),MS(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=AS(t,this.gap));var e=this._value;this._value=LS(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 BS={pan:0,drag:0,click:1,none:-1};var FS={getStartPoint:function(t){if(void 0===t&&(t=xS),this.childrenMap.thumb){var e=0===this.orientation?yS:bS;vS.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=SS),this.childrenMap.thumb){var e=0===this.orientation?kS:CS;vS.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=TS),s.x=wS(e.x,i.x,t),s.y=wS(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=zr(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=Nr(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;bp(e,i,s),r=n?0===this.orientation?_S:ES:0===this.orientation?PS:OS,Id(e,this,r),this.resetChildPositionState(e)}};Object.assign(RS.prototype,FS);const IS=Phaser.Utils.Objects.GetValue;class jS extends vm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=IS(e,"background",void 0),r=IS(e,"buttons",void 0),n=IS(r,"top",IS(r,"left",void 0)),a=IS(r,"bottom",IS(r,"right",void 0)),o=IS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new xf(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===IS(o,"width",void 0)?1:0;else h=void 0===IS(o,"height",void 0)?1:0;i=new RS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new xf(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=IS(e,"valuechangeCallback",null);if(null!==u){var c=IS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(IS(e,"enable",void 0)),this.setValue(IS(e,"value",0)),this.setScrollStep(IS(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 zS extends kg{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 NS=Phaser.Utils.Objects.GetValue,GS=Phaser.Math.Distance.Between;class WS extends Nn{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=NS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(NS(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(NS(t,"enable",!0)),this.holdThreshold=NS(t,"holdThreshold",50),this.pointerOutReleaseEnable=NS(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 Qf(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:GS(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&&!qg(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&&!qg(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 VS=Phaser.Utils.Objects.GetValue;class YS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(VS(t,"value",0)),this.setSpeed(VS(t,"speed",0)),this.setAcceleration(VS(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 XS{constructor(){this.value,this.dir,this.movement=new YS}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 KS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},qS=Phaser.Utils.Objects.GetValue;class JS extends Nn{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=qS(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(qS(e,"speed",.1)),this.setEnable(qS(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(qS(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||qg(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 ZS=Phaser.Utils.Objects.GetValue;var QS=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)?ZS(s,l,void 0):ZS(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=po(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 jS(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=ZS(r,"position",0);"string"==typeof p&&(p=tw[p]);var g,f,v=ZS(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=ZS(s,"space.slider",void 0))&&(o?v=0:g=ZS(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:ZS(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:ZS(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:ZS(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:ZS(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=ZS(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=ZS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=ZS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=ZS(s,"scrollDetectionMode");"string"==typeof b&&(b=ew[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?ZS(s,x,!0):ZS(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new US(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var k,C,S,w,T,P=ZS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(P&&h&&(void 0!==b&&(P.focus=1===b?2:0),k=new JS(h,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,k),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",k)),n)&&(o?(C=a?"t":"s",w=`scroll${i}`):(C="t",w="scroll"),n.on("valuechange",(function(e){t[C]=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)})));k&&(T=o?`addChildO${i}`:"addChildOY",k.on("scroll",(function(e){t[T](-e,!0)})))};const tw={right:0,left:1,bottom:0,top:1},ew={gameObject:0,rectBounds:1},iw=Phaser.Utils.Objects.GetValue;var sw=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=iw(e,"width"),a=iw(e,"height");n||(iw(e,"child.expandWidth",!0)||(s[1]=0));a||(iw(e,"child.expandHeight",!0)||(r[1]=0));var o=new hS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=lS(i,"child"),r=lS(s,"gameObject",void 0);if(r){var n=lS(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=lS(n,"top",0),a.bottom=lS(n,"bottom",0),o.left=lS(n,"left",0),o.right=lS(n,"right",0);break;case 1:a.top=lS(n,"left",0),a.bottom=lS(n,"right",0),o.top=lS(n,"top",0),o.bottom=lS(n,"bottom",0);break;default:a.top=lS(n,"top",0),a.bottom=lS(n,"bottom",0),a.left=lS(n,"left",0),a.right=lS(n,"right",0)}e.add(r,{column:1,row:1,align:lS(s,"align","center"),padding:o,expand:{width:lS(s,"expandWidth",!0),height:lS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:QS(t,o,"y",e);break;case 1:QS(t,o,"x",e);break;default:QS(t,o,"y",e),QS(t,o,"x",e)}return o},rw=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)},nw=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)}},aw=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 Sw=function(t){return t.add.text(0,0,"")};Object.assign(Cw.prototype,yw);var ww={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Tw={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 Pw=Phaser.Utils.Objects.GetValue;class Ow extends uw{constructor(t,e){void 0===e&&(e={});var i=Pw(e,"text",void 0),s=Pw(e,"textWidth",void 0),r=Pw(e,"textHeight",void 0),n=Pw(e,"textCrop",!!i.setCrop),a=Pw(e,"textMask",!n),o=Pw(e,"content",""),h=new Cw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Pw(e,"clampChildOY",!1),alwaysScrollable:Pw(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=Pw(e,"space",void 0);l&&(l.child=Pw(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(Ow.prototype,ww,Tw);const _w=Phaser.Utils.Objects.GetValue;var Ew=function(t,e,i){e=e?y(e):{};var s=_w(i,"background",Qx),r=_w(i,"text",Mw),n=_w(i,"track",Qx),a=_w(i,"thumb",Qx);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 Ow(t,e);return t.add.existing(h),h},Mw=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 FC(t,e);break;case"bbcodetext":case"bbcode":s=new LC(t,0,0,"",e);break;case"label":s=new zC(t,e);break;case"textarea":s=Ew(t,e);break;default:s=new ik(t,e)}return Zx(s,e),t.add.existing(s),s},Dw=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 qx(t,e):new _x(t,e);break;case"roundRectangle":s=new vx(t,e);break;default:s=new Lx(t,e)}return Zx(s,e),t.add.existing(s),s};const Lw=Phaser.Utils.Objects.GetValue;var Aw=function(t,e,i){e=e?y(e):{};var s=Lw(i,"background",Qx),r=Lw(i,"text",Mw),n=Lw(i,"icon",Dw),a=Lw(i,"action",Dw);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 Rw=Phaser.Utils.Objects.GetValue;var Bw=function(t,e,i){var s,r,n=Rw(i,"innerBackground",Qx),a=Rw(i,"separator",Qx),o=Rw(i,"title",Mw);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Aw(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 Fw extends Jb{constructor(t,e,i){super(t,e=Bw(t,e,i))}}var Iw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ul(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 jw=Phaser.Utils.Objects.GetValue;class zw extends Jl{constructor(t,e){super(t,jw(e,"x",0),jw(e,"y",0),jw(e,"width",64),jw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),jw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(jw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(jw(t,"ease",i)),i=e?0:this.delay,this.setDelay(jw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(jw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(jw(t,"color",i)),i=e?0:this.value,this.setValue(jw(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(zw.prototype,Iw);const Nw=Phaser.Math.DegToRad,Gw=Phaser.Math.Linear,Ww=Phaser.Math.Easing.Expo.In,Vw={right:0,down:1,left:2,up:3};var Yw=function(t,e,i,s,r,n,a,o,h,l,u){var c=Hw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=Hw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=Hw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=Hw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=Hw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=Hw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Xw={},Hw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Xw.x=a*u+o*c+r,Xw.y=h*u+l*c+n,Xw},$w={setDirection(t){return"string"==typeof t&&(t=Vw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Iu)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Nw(315);i=Math.cos(a),s=Math.sin(a);var o=Nw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Nw(135);i=Math.cos(a),s=Math.sin(a);o=Nw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Nw(225);i=Math.cos(a),s=Math.sin(a);o=Nw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Nw(45);i=Math.cos(a),s=Math.sin(a);o=Nw(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)),(d=this.getSizerConfig(t)).align=i,d.padding=wl(s),eP(r)?(d.expandWidth=iP(r,"width",!1),d.expandHeight=iP(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?zr(t):n),d.expandHeight&&(t.minHeight=void 0===a?Nr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},aP={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]),Qd.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 sm.call(this,t),this}},oP={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,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,sf.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(QT.width=e.aspectRatio,QT.height=1,tP.width=l,tP.height=u,l=(c=cl(QT,tP,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Yv(t,this)):bp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=zr(t)),void 0===u&&(u=Nr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,rf.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(oP,nP,aP);const hP=Phaser.Utils.Objects.IsPlainObject,lP=Phaser.Utils.Objects.GetValue;class uP extends Vv{constructor(t,e,i,s,r,n){hP(e)?(e=lP(n=e,"x",0),i=lP(n,"y",0),s=lP(n,"width",void 0),r=lP(n,"height",void 0)):hP(s)&&(s=lP(n=s,"width",void 0),r=lP(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(uP.prototype,oP);const cP=vm.prototype.add,dP=vm.prototype.addSpace;var pP=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)&&dP.call(this),cP.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&dP.call(this),this.hasTailSpace=s}else cP.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;cP.call(this,t,{index:r,proportion:i,expand:!0})}else cP.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},gP={addButton(t){if(Jg(t))for(var e=t,i=0,s=e.length;i=0;i--)mP.call(this,e[i],t);return this}},bP=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)}},xP=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,bP.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},kP={add(t){return this.buttons.push(t),t._click||(t._click=new hf(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`),xP.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=BP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=BP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const IP=Phaser.Utils.Objects.IsPlainObject,jP=Phaser.Utils.Objects.GetValue,zP=Phaser.Display.Align.CENTER;var NP=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(Hd.call(this,t),IP(e))&&(e=jP(h=e,"padding",0),i=jP(h,"key",void 0),s=jP(h,"index",void 0),r=jP(h,"offsetX",0),n=jP(h,"offsetY",0),a=jP(h,"offsetOriginX",0),o=jP(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=zP,h.padding=wl(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,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},GP={add(t,e,i){if(Jg(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,sm.call(this,t),this}},YP={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&&JP.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)iO.call(this,e[i],t);return this}};const rO=Phaser.Utils.Objects.GetValue;class nO extends KP{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 _P({parent:this,eventEmitter:rO(e,"eventEmitter",this),groupName:rO(e,"groupName",void 0),clickConfig:rO(e,"click",void 0)}).setButtonsType(e);var s=rO(e,"background",void 0),r=rO(e,"buttons",void 0);this.buttonsAlign=rO(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(nO.prototype,QP,sO,OP,MP);const aO=hS.prototype.add;var oO={addButton(t,e,i){return aO.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--)uO.call(this,e[i],t);return this}};const dO=Phaser.Utils.Objects.GetValue;class pO extends hS{constructor(t,e){void 0===e&&(e={});var i=dO(e,"row",0),s=dO(e,"column",e.col||0),r=dO(e,"createCellContainerCallback"),n=dO(e,"buttons",void 0),a=dO(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)):(l_(this),u_(this)),this}setNumberInput(){return this.onUpdateCallback=h_,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const p_=Phaser.Utils.Objects.GetValue,g_=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var f_=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)},v_=function(t){fr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=ux(t.style,e);Tl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},m_=function(t){fr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=ux(t,e);Tl(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 y_(){}function b_(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}y_.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(b_(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 x_=new y_;const k_=/^[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,C_=/\S/,S_=new y_;S_.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!C_.test(t)&&!C_.test(e)},S_.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(O_(t,null,null,i),i," ")},P_.equals=function(t,e){return y_.prototype.equals.call(P_,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const __=new y_;__.tokenize=function(t){return t.slice()},__.join=__.removeEmpty=function(t){return t};const E_=Phaser.Utils.Array.Remove;var M_=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),E_(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,x_.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},B_={cursorMoveLeft(){if(!this.isOpened)return this;var t=L_(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=L_(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=A_(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=L_(R_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=A_(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=L_(R_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const F_=Phaser.Utils.Objects.IsPlainObject;class I_ extends zb{constructor(t,e,i,s,r,n){F_(e)?n=e:F_(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 Uo(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=lx(n.background,"focus"),h=lx(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=p_(e,"edit");return void 0===i&&(i={}),KO(e,i,g_),new d_(t,i)}(this,n),f_.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),m_.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),v_.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 xc(t,e);return Zx(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 jT(t,e);return Zx(i,e),t.add.existing(i),i},y=!0);var b,x,k=new Fw(r,t,i);k.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(k),wr(k,e),k.vpx=l,k.vpy=u,k.frameDelimiter=c,y&&(b=k.getElement("action"),k.setChildVisible(b,!1)),Pc(k),k.emitClick=function(){k.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:k.setInteractive()),x&&k.bindEvent(x,"pointerdown",(function(){k.emitClick()})),k.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=NT[t.keyCode];-1!==e.indexOf(i)&&k.emitClick()}}));var C=function(){k.isTyping?k.once("click",C).stop(!0):k.isLastPage?k.complete2Flag||(k.complete2Flag=!0,k.emit("complete2")):k.once("click",C).typeNextPage()},S=function(){k.isPageEnd&&(k.off("click",S),y&&(b.stop(),k.setChildVisible(b,!1)),v.emit("resume.input"))};k._typeNextPage=S,k.on("pageend",(function(){y&&(b.start(),k.setChildVisible(b,!0)),k.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,k.emitClick)),v.emit("pause.input")})).on("start",(function(){k.off("click",C).once("click",C)}));var w=v.getData("$fastTyping"),T=v.getData("$autoNextPage");k.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(k.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=k.normalTypingSpeed),k.setTypingSpeed(e)}else t&&k.emitClick();else e===T||t||k.isTyping||e&&k.emitClick();w=t,T=e}));var P=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=NT[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return k.bindEvent(r.input.keyboard,"keydown",(function(t){P(t,!0)})),k.bindEvent(r.input.keyboard,"keyup",(function(t){P(t,!1)})),k}}(WT(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{typing:Rc,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=Ec(e,`creators.${Ko}`,void 0);if(!1!==s){if(Mc(s)&&(s=void 0),void 0===s){Ec(e,`styles.${Ko}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new xc(t,i);t.add.existing(s),wr(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 Pc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Do,commands:{cross:_c,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=NO(e,`creators.${Qo}`,void 0);if(!1!==s){var r;if(GO(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 jO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Pc(u),u}}(NO(e,`styles.${Qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{choice:zO,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=Y_(e,`creators.${th}`,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=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new W_(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Pc(u),u}}(Y_(e,`styles.${th}`,{}),{viewport:i},r);t.addGameObjectManager({name:th,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{input:V_,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=JT(e,`creators.${Zo}`,void 0);if(!1!==s){var r;if(ZT(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 xc(t,e);return Zx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,k=new YT(s,t,i);return g&&k.setTitle(g),f&&k.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,k.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(k),wr(k,e),k.vpx=h,k.vpy=l,Pc(k),k}}(JT(e,`styles.${Zo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Zo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{setText:HT,popUp:$T,shake:Oc}})}}];var $_=[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))}))}],U_={$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},K_=function(t,e){var i=po(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i};class q_ 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=un(t,t.cameras.main));for(var a=new Mo(t,{layers:r?Vo:Yo,layerDepth:i,rootLayer:s}),o=0,h=H_.length;o0&&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=aE(r,"x",null);null!==n?(t=n,i=n):(t=aE(r,"left",0),i=aE(r,"right",t));var a=aE(r,"y",null);null!==a?(e=a,s=a):(e=aE(r,"top",0),s=aE(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 lE(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=hE(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const cE={right:0,down:1,left:2,up:3};var dE=function(t){return"string"==typeof t&&(t=cE[t]),t%=4};Object.assign(uE.prototype,rE,nE);class pE extends Q_{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new uE(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}}var gE=function(t,e,i){return Qx(t,K_(e,i))};class fE extends Eg{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 vE={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;(this.show(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();return 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}},mE=function(t,e){Ip.popUp.call(t,e,this.expandDirection)},yE=function(t,e){Ip.scaleDown.call(t,e,this.expandDirection)},bE={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=mE.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=yE.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const xE=Phaser.Utils.Objects.GetValue;let kE=class extends vm{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=xE(e,"space"),a=1===this.orientation?"left":"top",o=xE(e,"align.title",a),h=xE(e,"expand.title",!0);this.add(s,{proportion:0,align:o,expand:h,padding:{left:xE(n,"titleLeft",0),right:xE(n,"titleRight",0),top:xE(n,"titleTop",0),bottom:xE(n,"titleBottom",0)}});var l=xE(e,"toggleByTarget",void 0),u=xE(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&uf.onClick.call(l,(function(){this.toggle()}),this,u),this.childTransition=new fE(r),!xE(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}o=xE(e,"align.child","left");var d=(h=xE(e,"expand.child",!0))?1:0;this.add(r,{proportion:d,align:o,expand:h,padding:{left:xE(n,"childLeft",0),right:xE(n,"childRight",0),top:xE(n,"childTop",0),bottom:xE(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(xE(p,"duration",200)),this.setExpandCallback(xE(p,"expandCallback",void 0)),this.setCollapseCallback(xE(p,"collapseCallback",void 0)),this.reLayoutTarget=xE(e,"reLayoutTarget",void 0);var g=e.onExpandStart;g&&this.on("expand.start",g);var f=e.onExpandComplete;f&&this.on("expand.complete",f);var v=e.onCollapseStart;v&&this.on("collapse.start",v);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=xE(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(kE.prototype,vE,bE);var CE={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},SE={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class wE extends kE{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(wE.prototype,CE,SE);const TE=Phaser.Utils.Objects.GetValue;const PE=Phaser.Utils.Objects.GetValue;const OE=uP.prototype.add;var _E=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),OE.call(this,t,e,i,s,r,n,a,o,h),this},EE={add:_E,addPage:_E};const ME=al.prototype.setChildVisible;var DE={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?(ME.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&&(ME.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(DE,EE);const LE=Phaser.Utils.Objects.GetValue;class AE extends uP{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(LE(e,"swapMode",0)),this.setFadeInDuration(LE(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=RE[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(AE.prototype,DE);const RE={invisible:0,destroy:1};const BE=Phaser.Utils.Objects.IsPlainObject,FE=Phaser.Utils.Objects.GetValue,IE=Phaser.Utils.String.UUID;var jE={swapPage:function(t,e){var i,s;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));return 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}},zE={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}},NE={top:1,left:3,right:5,bottom:7},GE={top:"bottom",left:"right",right:"left",bottom:"top"},WE={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},VE={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;i0,setInputRowTitleWidth(t){return this}};const aM=Phaser.Utils.Objects.GetValue;class oM extends vm{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=aM(e,"background",void 0),s=aM(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:aM(e,"space.title",0)}});var r=aM(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(oM.prototype,rM,nM);const hM=Phaser.Utils.Objects.GetValue;const lM=Phaser.Utils.Objects.GetValue;var uM=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const cM=Phaser.Geom.Intersects.RectangleToRectangle,dM=Phaser.Geom.Rectangle.Overlaps;var pM=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},gM=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},fM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},vM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},mM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const yM=Phaser.Utils.Objects.GetValue,bM={update:0,everyTick:1};var xM={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(yM(t,"updateMode",0)),this.enableChildrenMask(yM(t,"padding",0)),this.setMaskLayer(yM(t,"layer",void 0)),this.onMaskGameObjectVisible=yM(t,"onVisivle"),this.onMaskGameObjectInvisible=yM(t,"onInvisible"),this.maskGameObjectCallbackScope=yM(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=bM[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=km.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,o,h,l=!!s||!!r,u=t.getBounds(),c=uM(e),d=0,p=i.length;dthis.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(TM.prototype,kM);const PM=["top","bottom","centerY","center"],OM=["left","right","centerX","center"];var _M=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=PM.length;a=0?0:Math.abs(l)<=Math.abs(u)?l:u}}else{if(i)for(a=0,o=OM.length;a=0?0:Math.abs(c)<=Math.abs(d)?c:d}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const EM=Phaser.Utils.Objects.GetValue;class MM extends uw{constructor(t,e){void 0===e&&(e={});var i=WC(e),s=EM(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=EM(e,"clampChildOY",!1),s.clampChildOX=EM(e,"clampChildOX",!1);var r,n,a=new TM(t,s);switch(t.add.existing(a),i){case 0:r=EM(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=EM(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:EM(e,"align.panel","center")};var o=EM(e,"space",void 0);o&&(o.child=EM(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]),Nv(this.childrenMap.child,t),this}}var DM={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:_M.call(this,t,"y",e);break;case 1:_M.call(this,t,"x",e);break;default:_M.call(this,t,"y",e),_M.call(this,t,"x",e)}return this}};Object.assign(MM.prototype,DM);var LM={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},AM={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class RM extends MM{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(RM.prototype,LM,AM);const BM=Phaser.Utils.Objects.GetValue;const FM=Phaser.Utils.Objects.GetValue;const IM=Phaser.Utils.Objects.GetValue;var jM={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=IM(t,"onGetValue"),this.onSetValue=IM(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},zM={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},NM={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const GM=Phaser.Utils.Objects.GetValue;class WM extends vm{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=GM(e,"proportion.title",0),o=GM(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0);a=GM(e,"proportion.inputField",h);this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(WM.prototype,jM,zM,NM);var VM=function(t,e,i){var s=new Q_(t,i);return t.add.existing(s),s},YM=function(t){void 0===t&&(t=vm);return class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},XM=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0}));i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange);return n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=JM(this.styles,"inputRow")||{},r=qM(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return Qx(t,K_(e,i))}(this.scene,t,ZM(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),QM(this,y(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=z_(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},rD={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},nD={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 aD=Phaser.Utils.Objects.GetValue;class oD extends uw{constructor(t,e){void 0===e&&(e={});var i,s=aD(e,"text");fn(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new I_(t,s),t.add.existing(i)),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.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,o,h=aD(e,"space",void 0);h&&(h.child=aD(h,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=o!==e;a=t,o=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=aD(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(oD.prototype,rD,nD);var hD={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new oD(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},lD={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=z_(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const uD=Phaser.Utils.Objects.GetValue,cD=Phaser.Math.Linear,dD=Phaser.Math.Snap.Floor;var pD={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=uD(s,r),a=function(t,e){var i=new RS(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=uD(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var u=e.inputNumber||e.inputText,c=z_(i,u).setNumberInput();o=e.defaultExpandWidth?1:0,h=uD(e,"proportion.range.inputText",o);t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=cD(t.minValue,t.maxValue,a.value);t.step&&(e=dD(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},gD=function(t,e){var i=new LP(t,e);return t.add.existing(i),i};const fD=Phaser.Utils.Objects.GetValue;var vD={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=fD(e,"incDec")||{},r={text:null,action:null},n=gD(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=z_(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(y(r),s.incButton||{}),u=CO(i,l),c=Object.assign(y(r),s.decButton||{}),d=CO(i,c);n.addButton(u),n.addButton(d);var p=s.inputTextIndex||0;n.insert(p,h,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new lL(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};const cL=Phaser.Utils.Objects.GetValue;var dL=function(t,e){var i=cL(e,"expandDirection",void 0);"string"==typeof i&&(i=pL[i]);var s,r,n,a,o,h,l,u=(n="alignTargetX",tt(s=e,r="alignTarget")?Q(s,r):n&&tt(s,n)?Q(s,n):a&&tt(s,a)?Q(s,a):o),c=cL(e,"alignTargetY",u),d=cL(e,"alignOffsetX",0),p=cL(e,"alignOffsetY",0),g=cL(e,"alignSide","").includes("right"),f=cL(e,"bounds"),v=0===i,m=!v&&!(1===i),y=g?1:0,b=v||m?0:1;t.setOrigin(y,b),h=g?u.getTopRight().x:u.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+d,l+p);var x=f;x||(x=un(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+p))};const pL={down:0,up:1},gL=Phaser.Utils.Objects.GetValue;class fL extends Eg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Dp(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 Ep(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),dL(t,e),t.isRexSizer&&t.layout();var i=gL(e,"touchOutsideClose",!1),s=gL(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&&Ng(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 vL={openColorPicker:function(){if(!this.colorPicker){var t=uL.call(this).layout(),e=new fL(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(vL,MD);const mL=Phaser.Utils.Objects.GetValue;class yL extends ED{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(mL(i,"width",160),mL(i,"height",170));var n=mL(i,"background");r=n?function(t){return Qx(t,n)}:mL(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(mL(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(mL(i,"expandDirection")),this.setColorPickerEaseInDuration(mL(i,"easeIn",200)),this.setColorPickerEaseOutDuration(mL(i,"easeOut",200)),this.setColorPickerTransitInCallback(mL(i,"transitIn")),this.setColorPickerTransitOutCallback(mL(i,"transitOut")),this.setColorPickerBounds(mL(i,"bounds"));var a=mL(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(mL(o,"height",30)),this.setColorComponentsFormatLabelConfig(mL(o,"formatLabel"));var h=mL(o,"inputText");h||(h=mL(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=mL(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var u=this.childrenMap.swatch;u&&s&&this.onClick(u,this.openColorPicker,this)}}Object.assign(yL.prototype,vL);var bL={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new yL(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},xL={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},kL={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},CL={buildShapes(){this.addShape((new Nu).setName("box")).addShape((new Iu).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 u=s*(1-this.boxSize)/2,c=a/2,d=s*this.boxSize-a;h.setTopLeftPosition(r+c+u,n+c+u).setSize(d,d),this.isCircleShape?h.setRadius(d/2):h.setRadius(0);u=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,f=2*p,v=3*p;l.startAt(g,f).lineTo(f,v).lineTo(v,g).offset(r+u,n+u).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)}},SL={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new ul(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}},wL={};Object.assign(wL,xL,kL,CL,SL);const TL=23730,PL=Phaser.Utils.Objects.GetValue,OL=Phaser.Utils.Objects.IsPlainObject;class _L extends Jl{constructor(t,e,i,s,r,n,a){OL(e)?(e=PL(a=e,"x",0),i=PL(a,"y",0),s=PL(a,"width",2),r=PL(a,"height",2),n=PL(a,"color",TL)):OL(n)&&(n=PL(a=n,"color",TL)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=TL),this.setBoxShape(PL(a,"circleBox",!1)),this.setBoxFillStyle(n,PL(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(PL(a,"uncheckedColor",null),PL(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(PL(a,"boxLineWidth",4),PL(a,"boxStrokeColor",n),PL(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,PL(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),PL(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(PL(a,"checkerColor",16777215),PL(a,"checkerAlpha",1)),this.setBoxSize(PL(a,"boxSize",1)),this.setCheckerSize(PL(a,"checkerSize",1)),this.setCheckerAnimationDuration(PL(a,"animationDuration",150)),this.buildShapes();var o=PL(a,"checked");void 0===o&&(o=PL(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(_L.prototype,wL);const EL=Phaser.Utils.Objects.GetValue,ML=Phaser.Utils.Objects.IsPlainObject;class DL extends _L{constructor(t,e,i,s,r,n,a){ML(e)?(e=EL(a=e,"x",0),i=EL(a,"y",0),s=EL(a,"width",2),r=EL(a,"height",2),n=EL(a,"color",TL)):ML(n)&&(n=EL(a=n,"color",TL)),super(t,e,i,s,r,n,a),this._click=new hf(this,EL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(EL(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}}var LL={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new DL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},AL={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}},RL={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}},BL={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}},FL=function(t,e,i){return(e-t)*i+t};const IL=Phaser.Math.Linear;var jL={buildShapes(){this.addShape((new Nu).setName("track")).addShape((new Nu).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,u,c,d=(l=this.falseValueTrackColor,u=this.trackFillColor,c=i,(255&FL(yr(l),yr(u),c))<<16|(255&FL(br(l),br(u),c))<<8|255&FL(xr(l),xr(u),c)),p=IL(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(d,p);var g=this.getShape("thumb");if(this.isSizeChanged){var f=t*this.thumbWidth,v=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(f,v).setRadius(m)}var y=IL(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)}},zL={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new ul(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}},NL={};Object.assign(NL,AL,RL,BL,jL,zL);const GL=Phaser.Utils.Objects.GetValue,WL=Phaser.Utils.Objects.IsPlainObject,VL=23730;class YL extends Jl{constructor(t,e,i,s,r,n,a){WL(e)?(e=GL(a=e,"x",0),i=GL(a,"y",0),s=GL(a,"width",2),r=GL(a,"height",2),n=GL(a,"color",VL)):WL(n)&&(n=GL(a=n,"color",VL)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=VL),this.setTrackFillStyle(n,GL(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(GL(a,"falseValueTrackColor",function(t){var e=.3*yr(t)+.59*br(t)+.11*xr(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),GL(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(GL(a,"thumbColor",16777215),GL(a,"thumbAlpha",1)),this.setTrackSize(GL(a,"trackWidth",.9),GL(a,"trackHeight",.5)),this.setTrackRadius(GL(a,"trackRadius",.5*this.trackHeight));var o=GL(a,"thumbHeight",void 0),h=GL(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(GL(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(GL(a,"thumbLeft",.3),GL(a,"thumbRight",void 0)),this.setRTL(GL(a,"rtl",!1)),this.setToggleAnimationDuration(GL(a,"animationDuration",150)),this.buildShapes(),this.setValue(GL(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(YL.prototype,NL);const XL=Phaser.Utils.Objects.GetValue;class HL extends YL{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new hf(this,XL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(XL(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}}var $L={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new HL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},UL={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=KL[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 KL={down:0,up:1},qL=Phaser.Utils.Objects.GetValue;var JL=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)){s=ZL(e,d);if(this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(u=s)),!u){0===c&&(c=this.listMaxHeight);var p=QL(e,this.listCreateSliderTrackCallback),g=QL(e,this.listCreateSliderThumbCallback);u=new MM(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:qL(this.listSpace,"panel",0)}}),e.add.existing(u)}}else d.height=c,s=ZL(e,d),u=s;return t&&u.addBackground(t,"background"),this.listDraggable&&u.setDraggable(!0),u!==s&&s.on("button.over",(function(t,e,i,s){u.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){u.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){u.emit("button.click",t,e,i,s)})),u},ZL=function(t,e,i){var s;return i?(e.orientation="x",s=new nO(t,e)):(e.orientation="y",s=new LP(t,e)),t.add.existing(s),s},QL=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},tA={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;void 0===e?t=0:t=(e+1)%this.listPanel.getButtons().length;return 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}},eA={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=JL.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 fL(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(eA,UL,tA);const iA=Phaser.Utils.Objects.GetValue;class sA extends jC{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(iA(e,"options"));var i=iA(e,"list");this.setWrapEnable(iA(i,"wrap",!1)),this.setCreateButtonCallback(iA(i,"createButtonCallback")),this.setCreateListBackgroundCallback(iA(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(iA(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(iA(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(iA(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(iA(i,"scroller")),this.setListMouseWheelScrollerConfig(iA(i,"mouseWheelScroller")),this.setButtonClickCallback(iA(i,"onButtonClick")),this.setButtonOverCallback(iA(i,"onButtonOver")),this.setButtonOutCallback(iA(i,"onButtonOut")),this.setListExpandDirection(iA(i,"expandDirection")),this.setListEaseInDuration(iA(i,"easeIn",500)),this.setListEaseOutDuration(iA(i,"easeOut",100)),this.setListTransitInCallback(iA(i,"transitIn")),this.settListTransitOutCallback(iA(i,"transitOut")),this.setListMaxHeight(iA(i,"maxHeight",0)),this.setListSize(iA(i,"width"),iA(i,"height",0)),this.setListAlignmentMode(iA(i,"alignParent","text")),this.setListAlignmentSide(iA(i,"alignSide","")),this.setListBounds(iA(i,"bounds")),this.setListSpace(iA(i,"space")),this.setListDraggable(iA(i,"draggable",!1)),this.setValueChangeCallback(iA(e,"setValueCallback"),iA(e,"setValueCallbackScope")),this.setValue(iA(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(sA.prototype,eA);var rA=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?y(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,o=Aw(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=CO(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var h=e.track;h&&(o.list.createTrackCallback=function(t){return Qx(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return Qx(t,l)},delete e.thumb),o.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},o.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},o}(t,e);var i=new sA(t,e);return t.add.existing(i),i},nA=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=rA(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=nA(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const oA=Phaser.Utils.Objects.GetValue;var hA={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?y(e.button):{},r=oA(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=gD(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n0?r.addScrollable():r).addRows(s,i,!0),r}(t,e,i,s)}}var dA={csv2md:function(t,e={}){"string"==typeof e&&(e={title:e});for(var i,s,r,{title:n}=e,a=lr.parse(t).data,o=!1,h=!1,l=[],u=0,c=a.length;uh;u--){for(c=0;c0&&this.wrapMode!==Dm&&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=Bm[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]=pk(t,l,u);else{var d=dk(t,l,u);c&&(d=c(d)),this[o]=d}}var p=pk(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=pk(t,"fill",null);null!==g&&(this.color=vy(g));var f=pk(t,"metrics",!1);return f?this.metrics={ascent:pk(f,"ascent",0),descent:pk(f,"descent",0),fontSize:pk(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=ck(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=ck(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=pk(t,"fontFamily","Courier"),this.fontSize=pk(t,"fontSize","16px"),this.fontStyle=pk(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=vy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=vy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=vy(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=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=vy(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=vy(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=vy(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=vy(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=vy(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=vy(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=vy(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=vy(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=Bm[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=pk(e,"fontFamily",this.fontFamily),this.fontSize=pk(e,"fontSize",this.fontSize),this.fontStyle=pk(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 fk={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),_y(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 k=l;k0){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 vk=Phaser.Utils.Objects.GetValue,mk=_m,yk=Em;class bk{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=vk(t,"text",""),this.x=vk(t,"x",0),this.y=vk(t,"y",0),this.width=vk(t,"width",0);var e=vk(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=vk(t,"newLineMode",0),this.startIndex=vk(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===yk&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==mk&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===yk&&(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 xk=Phaser.Utils.Objects.GetFastValue,kk=_m,Ck=Mm;class Sk{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=xk(t,"tagToText",gd),this.tagToTextScope=xk(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 wk={};const Tk=Phaser.Geom.Rectangle;var Pk=new Ra;class Ok{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Gk(f)){""!==b?a.push(n.getLine(b,x,Rk)):0===k&&r>0&&a.push(n.getLine("",0,Rk)),a.push(...zk(f,e,Ik,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,Rk)),b=f,x=v,h=s):(b+=f,x=m),k===C-1&&a.push(n.getLine(b,x,l))}return a},Nk=function(t,e){var i;switch(e){case Fk:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Vk&&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 Sk({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 JC(this.sizerChildren,null),sm.call(this,t),this}},QC={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)JC(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},sS={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=dp.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,JC(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)JC(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},nS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const aS=Phaser.Utils.Objects.IsPlainObject,oS=Phaser.Utils.Objects.GetValue;class hS extends Vv{constructor(t,e,i,s,r,n,a,o,h,l){aS(e)?(e=oS(l=e,"x",0),i=oS(l,"y",0),s=oS(l,"width",void 0),r=oS(l,"height",void 0),n=oS(l,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(s)?(s=oS(l=s,"width",void 0),r=oS(l,"height",void 0),n=oS(l,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(n)?(n=oS(l=n,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(o)&&(o=oS(l=o,"columnProportions",0),h=oS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(oS(l,"createCellContainerCallback")),this.setIndentLeft(oS(l,"space.indentLeftOdd",0),oS(l,"space.indentLeftEven",0)),this.setIndentTop(oS(l,"space.indentTopOdd",0),oS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,oS(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=rS.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=nS.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(hS.prototype,sS);const lS=Phaser.Utils.Objects.GetValue;const uS=Phaser.Math.Percent;var cS=function(t,e,i){var s;return t.y===e.y?s=uS(i.x,t.x,e.x):t.x===e.x&&(s=uS(i.y,t.y,e.y)),s},dS=function(t,e,i){var s,r;this.enable&&(pS.x=e,pS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=cS(s,r,pS))},pS={},gS=function(t,e,i){if(this.enable&&t.isDown){var s,r;fS.x=t.worldX,fS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=cS(s,r,fS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},fS={},vS=function(t,e){void 0===e&&(e=mS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return jd(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},mS={};const yS=Phaser.Display.Align.LEFT_CENTER,bS=Phaser.Display.Align.TOP_CENTER;var xS={};const kS=Phaser.Display.Align.RIGHT_CENTER,CS=Phaser.Display.Align.BOTTOM_CENTER;var SS={};const wS=Phaser.Math.Linear;var TS={};const PS=Phaser.Display.Align.LEFT_CENTER,OS=Phaser.Display.Align.TOP_CENTER,_S=Phaser.Display.Align.RIGHT_CENTER,ES=Phaser.Display.Align.BOTTOM_CENTER;const MS=Phaser.Utils.Objects.GetValue,DS=Phaser.Utils.Objects.IsPlainObject,LS=Phaser.Math.Clamp,AS=Phaser.Math.Snap.To;class RS extends(hc(vm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=MS(e,"reverseAxis",!1);var i=MS(e,"background",void 0),s=MS(e,"track",void 0),r=MS(e,"indicator",void 0),n=MS(e,"thumb",void 0);if(i&&(DS(i)&&(i=Qx(t,i)),this.addBackground(i)),s&&(DS(s)&&(s=Qx(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(DS(r)&&(r=Qx(t,r)),this.pin(r)),n){DS(n)&&(n=Qx(t,n)),this.pin(n);var a=MS(e,"thumbOffsetX",0),o=MS(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=MS(e,"input",0);switch("string"==typeof h&&(h=BS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",dS,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",gS,this).on("pointermove",gS,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(MS(e,"enable",void 0)),this.setGap(MS(e,"gap",void 0)),this.setValue(MS(e,"value",0),MS(e,"min",void 0),MS(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=AS(t,this.gap));var e=this._value;this._value=LS(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 BS={pan:0,drag:0,click:1,none:-1};var FS={getStartPoint:function(t){if(void 0===t&&(t=xS),this.childrenMap.thumb){var e=0===this.orientation?yS:bS;vS.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=SS),this.childrenMap.thumb){var e=0===this.orientation?kS:CS;vS.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=TS),s.x=wS(e.x,i.x,t),s.y=wS(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=zr(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=Nr(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;bp(e,i,s),r=n?0===this.orientation?_S:ES:0===this.orientation?PS:OS,Id(e,this,r),this.resetChildPositionState(e)}};Object.assign(RS.prototype,FS);const IS=Phaser.Utils.Objects.GetValue;class jS extends vm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=IS(e,"background",void 0),r=IS(e,"buttons",void 0),n=IS(r,"top",IS(r,"left",void 0)),a=IS(r,"bottom",IS(r,"right",void 0)),o=IS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new xf(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===IS(o,"width",void 0)?1:0;else h=void 0===IS(o,"height",void 0)?1:0;i=new RS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new xf(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=IS(e,"valuechangeCallback",null);if(null!==u){var c=IS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(IS(e,"enable",void 0)),this.setValue(IS(e,"value",0)),this.setScrollStep(IS(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 zS extends kg{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 NS=Phaser.Utils.Objects.GetValue,GS=Phaser.Math.Distance.Between;class WS extends Nn{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=NS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(NS(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(NS(t,"enable",!0)),this.holdThreshold=NS(t,"holdThreshold",50),this.pointerOutReleaseEnable=NS(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 Qf(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:GS(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&&!qg(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&&!qg(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 VS=Phaser.Utils.Objects.GetValue;class YS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(VS(t,"value",0)),this.setSpeed(VS(t,"speed",0)),this.setAcceleration(VS(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 XS{constructor(){this.value,this.dir,this.movement=new YS}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 KS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},qS=Phaser.Utils.Objects.GetValue;class JS extends Nn{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=qS(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(qS(e,"speed",.1)),this.setEnable(qS(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(qS(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||qg(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 ZS=Phaser.Utils.Objects.GetValue;var QS=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)?ZS(s,l,void 0):ZS(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=po(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 jS(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=ZS(r,"position",0);"string"==typeof p&&(p=tw[p]);var g,f,v=ZS(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=ZS(s,"space.slider",void 0))&&(o?v=0:g=ZS(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:ZS(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:ZS(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:ZS(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:ZS(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=ZS(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=ZS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=ZS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=ZS(s,"scrollDetectionMode");"string"==typeof b&&(b=ew[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?ZS(s,x,!0):ZS(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new US(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var k,C,S,w,T,P=ZS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(P&&h&&(void 0!==b&&(P.focus=1===b?2:0),k=new JS(h,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,k),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",k)),n)&&(o?(C=a?"t":"s",w=`scroll${i}`):(C="t",w="scroll"),n.on("valuechange",(function(e){t[C]=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)})));k&&(T=o?`addChildO${i}`:"addChildOY",k.on("scroll",(function(e){t[T](-e,!0)})))};const tw={right:0,left:1,bottom:0,top:1},ew={gameObject:0,rectBounds:1},iw=Phaser.Utils.Objects.GetValue;var sw=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=iw(e,"width"),a=iw(e,"height");n||(iw(e,"child.expandWidth",!0)||(s[1]=0));a||(iw(e,"child.expandHeight",!0)||(r[1]=0));var o=new hS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=lS(i,"child"),r=lS(s,"gameObject",void 0);if(r){var n=lS(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=lS(n,"top",0),a.bottom=lS(n,"bottom",0),o.left=lS(n,"left",0),o.right=lS(n,"right",0);break;case 1:a.top=lS(n,"left",0),a.bottom=lS(n,"right",0),o.top=lS(n,"top",0),o.bottom=lS(n,"bottom",0);break;default:a.top=lS(n,"top",0),a.bottom=lS(n,"bottom",0),a.left=lS(n,"left",0),a.right=lS(n,"right",0)}e.add(r,{column:1,row:1,align:lS(s,"align","center"),padding:o,expand:{width:lS(s,"expandWidth",!0),height:lS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:QS(t,o,"y",e);break;case 1:QS(t,o,"x",e);break;default:QS(t,o,"y",e),QS(t,o,"x",e)}return o},rw=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)},nw=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)}},aw=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 Sw=function(t){return t.add.text(0,0,"")};Object.assign(Cw.prototype,yw);var ww={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Tw={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 Pw=Phaser.Utils.Objects.GetValue;class Ow extends uw{constructor(t,e){void 0===e&&(e={});var i=Pw(e,"text",void 0),s=Pw(e,"textWidth",void 0),r=Pw(e,"textHeight",void 0),n=Pw(e,"textCrop",!!i.setCrop),a=Pw(e,"textMask",!n),o=Pw(e,"content",""),h=new Cw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Pw(e,"clampChildOY",!1),alwaysScrollable:Pw(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=Pw(e,"space",void 0);l&&(l.child=Pw(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(Ow.prototype,ww,Tw);const _w=Phaser.Utils.Objects.GetValue;var Ew=function(t,e,i){e=e?y(e):{};var s=_w(i,"background",Qx),r=_w(i,"text",Mw),n=_w(i,"track",Qx),a=_w(i,"thumb",Qx);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 Ow(t,e);return t.add.existing(h),h},Mw=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 FC(t,e);break;case"bbcodetext":case"bbcode":s=new LC(t,0,0,"",e);break;case"label":s=new zC(t,e);break;case"textarea":s=Ew(t,e);break;default:s=new ik(t,e)}return Zx(s,e),t.add.existing(s),s},Dw=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 qx(t,e):new _x(t,e);break;case"roundRectangle":s=new vx(t,e);break;default:s=new Lx(t,e)}return Zx(s,e),t.add.existing(s),s};const Lw=Phaser.Utils.Objects.GetValue;var Aw=function(t,e,i){e=e?y(e):{};var s=Lw(i,"background",Qx),r=Lw(i,"text",Mw),n=Lw(i,"icon",Dw),a=Lw(i,"action",Dw);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 Rw=Phaser.Utils.Objects.GetValue;var Bw=function(t,e,i){var s,r,n=Rw(i,"innerBackground",Qx),a=Rw(i,"separator",Qx),o=Rw(i,"title",Mw);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Aw(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 Fw extends Jb{constructor(t,e,i){super(t,e=Bw(t,e,i))}}var Iw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ul(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 jw=Phaser.Utils.Objects.GetValue;class zw extends Jl{constructor(t,e){super(t,jw(e,"x",0),jw(e,"y",0),jw(e,"width",64),jw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),jw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(jw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(jw(t,"ease",i)),i=e?0:this.delay,this.setDelay(jw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(jw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(jw(t,"color",i)),i=e?0:this.value,this.setValue(jw(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(zw.prototype,Iw);const Nw=Phaser.Math.DegToRad,Gw=Phaser.Math.Linear,Ww=Phaser.Math.Easing.Expo.In,Vw={right:0,down:1,left:2,up:3};var Yw=function(t,e,i,s,r,n,a,o,h,l,u){var c=Hw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=Hw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=Hw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=Hw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=Hw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=Hw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Xw={},Hw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Xw.x=a*u+o*c+r,Xw.y=h*u+l*c+n,Xw},$w={setDirection(t){return"string"==typeof t&&(t=Vw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Iu)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Nw(315);i=Math.cos(a),s=Math.sin(a);var o=Nw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Nw(135);i=Math.cos(a),s=Math.sin(a);o=Nw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Nw(225);i=Math.cos(a),s=Math.sin(a);o=Nw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Nw(45);i=Math.cos(a),s=Math.sin(a);o=Nw(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)),(d=this.getSizerConfig(t)).align=i,d.padding=wl(s),eP(r)?(d.expandWidth=iP(r,"width",!1),d.expandHeight=iP(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?zr(t):n),d.expandHeight&&(t.minHeight=void 0===a?Nr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},aP={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]),Qd.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 sm.call(this,t),this}},oP={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,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,sf.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(QT.width=e.aspectRatio,QT.height=1,tP.width=l,tP.height=u,l=(c=cl(QT,tP,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Yv(t,this)):bp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=zr(t)),void 0===u&&(u=Nr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,rf.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(oP,nP,aP);const hP=Phaser.Utils.Objects.IsPlainObject,lP=Phaser.Utils.Objects.GetValue;class uP extends Vv{constructor(t,e,i,s,r,n){hP(e)?(e=lP(n=e,"x",0),i=lP(n,"y",0),s=lP(n,"width",void 0),r=lP(n,"height",void 0)):hP(s)&&(s=lP(n=s,"width",void 0),r=lP(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(uP.prototype,oP);const cP=vm.prototype.add,dP=vm.prototype.addSpace;var pP=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)&&dP.call(this),cP.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&dP.call(this),this.hasTailSpace=s}else cP.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;cP.call(this,t,{index:r,proportion:i,expand:!0})}else cP.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},gP={addButton(t){if(Jg(t))for(var e=t,i=0,s=e.length;i=0;i--)mP.call(this,e[i],t);return this}},bP=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)}},xP=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,bP.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},kP={add(t){return this.buttons.push(t),t._click||(t._click=new hf(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`),xP.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=BP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=BP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const IP=Phaser.Utils.Objects.IsPlainObject,jP=Phaser.Utils.Objects.GetValue,zP=Phaser.Display.Align.CENTER;var NP=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(Hd.call(this,t),IP(e))&&(e=jP(h=e,"padding",0),i=jP(h,"key",void 0),s=jP(h,"index",void 0),r=jP(h,"offsetX",0),n=jP(h,"offsetY",0),a=jP(h,"offsetOriginX",0),o=jP(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=zP,h.padding=wl(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,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},GP={add(t,e,i){if(Jg(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,sm.call(this,t),this}},YP={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&&JP.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)iO.call(this,e[i],t);return this}};const rO=Phaser.Utils.Objects.GetValue;class nO extends KP{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 _P({parent:this,eventEmitter:rO(e,"eventEmitter",this),groupName:rO(e,"groupName",void 0),clickConfig:rO(e,"click",void 0)}).setButtonsType(e);var s=rO(e,"background",void 0),r=rO(e,"buttons",void 0);this.buttonsAlign=rO(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(nO.prototype,QP,sO,OP,MP);const aO=hS.prototype.add;var oO={addButton(t,e,i){return aO.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--)uO.call(this,e[i],t);return this}};const dO=Phaser.Utils.Objects.GetValue;class pO extends hS{constructor(t,e){void 0===e&&(e={});var i=dO(e,"row",0),s=dO(e,"column",e.col||0),r=dO(e,"createCellContainerCallback"),n=dO(e,"buttons",void 0),a=dO(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)):(l_(this),u_(this)),this}setNumberInput(){return this.onUpdateCallback=h_,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const p_=Phaser.Utils.Objects.GetValue,g_=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var f_=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)},v_=function(t){fr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=ux(t.style,e);Tl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},m_=function(t){fr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=ux(t,e);Tl(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 y_(){}function b_(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}y_.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(b_(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 x_=new y_;const k_=/^[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,C_=/\S/,S_=new y_;S_.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!C_.test(t)&&!C_.test(e)},S_.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(O_(t,null,null,i),i," ")},P_.equals=function(t,e){return y_.prototype.equals.call(P_,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const __=new y_;__.tokenize=function(t){return t.slice()},__.join=__.removeEmpty=function(t){return t};const E_=Phaser.Utils.Array.Remove;var M_=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),E_(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,x_.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},B_={cursorMoveLeft(){if(!this.isOpened)return this;var t=L_(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=L_(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=A_(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=L_(R_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=A_(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=L_(R_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const F_=Phaser.Utils.Objects.IsPlainObject;class I_ extends zb{constructor(t,e,i,s,r,n){F_(e)?n=e:F_(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 Uo(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=lx(n.background,"focus"),h=lx(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=p_(e,"edit");return void 0===i&&(i={}),KO(e,i,g_),new d_(t,i)}(this,n),f_.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),m_.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),v_.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 xc(t,e);return Zx(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 jT(t,e);return Zx(i,e),t.add.existing(i),i},y=!0);var b,x,k=new Fw(r,t,i);k.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(k),wr(k,e),k.vpx=l,k.vpy=u,k.frameDelimiter=c,y&&(b=k.getElement("action"),k.setChildVisible(b,!1)),Pc(k),k.emitClick=function(){k.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:k.setInteractive()),x&&k.bindEvent(x,"pointerdown",(function(){k.emitClick()})),k.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=NT[t.keyCode];-1!==e.indexOf(i)&&k.emitClick()}}));var C=function(){k.isTyping?k.once("click",C).stop(!0):k.isLastPage?k.complete2Flag||(k.complete2Flag=!0,k.emit("complete2")):k.once("click",C).typeNextPage()},S=function(){k.isPageEnd&&(k.off("click",S),y&&(b.stop(),k.setChildVisible(b,!1)),v.emit("resume.input"))};k._typeNextPage=S,k.on("pageend",(function(){y&&(b.start(),k.setChildVisible(b,!0)),k.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,k.emitClick)),v.emit("pause.input")})).on("start",(function(){k.off("click",C).once("click",C)}));var w=v.getData("$fastTyping"),T=v.getData("$autoNextPage");k.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(k.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=k.normalTypingSpeed),k.setTypingSpeed(e)}else t&&k.emitClick();else e===T||t||k.isTyping||e&&k.emitClick();w=t,T=e}));var P=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=NT[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return k.bindEvent(r.input.keyboard,"keydown",(function(t){P(t,!0)})),k.bindEvent(r.input.keyboard,"keyup",(function(t){P(t,!1)})),k}}(WT(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{typing:Rc,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=Ec(e,`creators.${Ko}`,void 0);if(!1!==s){if(Mc(s)&&(s=void 0),void 0===s){Ec(e,`styles.${Ko}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new xc(t,i);t.add.existing(s),wr(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 Pc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Do,commands:{cross:_c,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=NO(e,`creators.${Qo}`,void 0);if(!1!==s){var r;if(GO(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 jO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Pc(u),u}}(NO(e,`styles.${Qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{choice:zO,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=Y_(e,`creators.${th}`,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=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new W_(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Pc(u),u}}(Y_(e,`styles.${th}`,{}),{viewport:i},r);t.addGameObjectManager({name:th,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{input:V_,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=JT(e,`creators.${Zo}`,void 0);if(!1!==s){var r;if(ZT(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 xc(t,e);return Zx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,k=new YT(s,t,i);return g&&k.setTitle(g),f&&k.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,k.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(k),wr(k,e),k.vpx=h,k.vpy=l,Pc(k),k}}(JT(e,`styles.${Zo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Zo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{setText:HT,popUp:$T,shake:Oc}})}}];var $_=[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))}))}],U_={$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},K_=function(t,e){var i=po(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i};class q_ 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=un(t,t.cameras.main));for(var a=new Mo(t,{layers:r?Vo:Yo,layerDepth:i,rootLayer:s}),o=0,h=H_.length;o0&&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=aE(r,"x",null);null!==n?(t=n,i=n):(t=aE(r,"left",0),i=aE(r,"right",t));var a=aE(r,"y",null);null!==a?(e=a,s=a):(e=aE(r,"top",0),s=aE(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 lE(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=hE(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const cE={right:0,down:1,left:2,up:3};var dE=function(t){return"string"==typeof t&&(t=cE[t]),t%=4};Object.assign(uE.prototype,rE,nE);class pE extends Q_{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new uE(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}}var gE=function(t,e,i){return Qx(t,K_(e,i))};class fE extends Eg{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 vE={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;(this.show(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();return 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}},mE=function(t,e){Ip.popUp.call(t,e,this.expandDirection)},yE=function(t,e){Ip.scaleDown.call(t,e,this.expandDirection)},bE={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=mE.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=yE.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const xE=Phaser.Utils.Objects.GetValue;let kE=class extends vm{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=xE(e,"space"),a=1===this.orientation?"left":"top",o=xE(e,"align.title",a),h=xE(e,"expand.title",!0);this.add(s,{proportion:0,align:o,expand:h,padding:{left:xE(n,"titleLeft",0),right:xE(n,"titleRight",0),top:xE(n,"titleTop",0),bottom:xE(n,"titleBottom",0)}});var l=xE(e,"toggleByTarget",void 0),u=xE(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&uf.onClick.call(l,(function(){this.toggle()}),this,u),this.childTransition=new fE(r),!xE(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}o=xE(e,"align.child","left");var d=(h=xE(e,"expand.child",!0))?1:0;this.add(r,{proportion:d,align:o,expand:h,padding:{left:xE(n,"childLeft",0),right:xE(n,"childRight",0),top:xE(n,"childTop",0),bottom:xE(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(xE(p,"duration",200)),this.setExpandCallback(xE(p,"expandCallback",void 0)),this.setCollapseCallback(xE(p,"collapseCallback",void 0)),this.reLayoutTarget=xE(e,"reLayoutTarget",void 0);var g=e.onExpandStart;g&&this.on("expand.start",g);var f=e.onExpandComplete;f&&this.on("expand.complete",f);var v=e.onCollapseStart;v&&this.on("collapse.start",v);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=xE(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(kE.prototype,vE,bE);var CE={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},SE={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class wE extends kE{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(wE.prototype,CE,SE);const TE=Phaser.Utils.Objects.GetValue;const PE=Phaser.Utils.Objects.GetValue;const OE=uP.prototype.add;var _E=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),OE.call(this,t,e,i,s,r,n,a,o,h),this},EE={add:_E,addPage:_E};const ME=al.prototype.setChildVisible;var DE={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?(ME.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&&(ME.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(DE,EE);const LE=Phaser.Utils.Objects.GetValue;class AE extends uP{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(LE(e,"swapMode",0)),this.setFadeInDuration(LE(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=RE[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(AE.prototype,DE);const RE={invisible:0,destroy:1};const BE=Phaser.Utils.Objects.IsPlainObject,FE=Phaser.Utils.Objects.GetValue,IE=Phaser.Utils.String.UUID;var jE={swapPage:function(t,e){var i,s;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));return 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}},zE={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}},NE={top:1,left:3,right:5,bottom:7},GE={top:"bottom",left:"right",right:"left",bottom:"top"},WE={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},VE={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;i0,setInputRowTitleWidth(t){return this}};const aM=Phaser.Utils.Objects.GetValue;class oM extends vm{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=aM(e,"background",void 0),s=aM(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:aM(e,"space.title",0)}});var r=aM(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(oM.prototype,rM,nM);const hM=Phaser.Utils.Objects.GetValue;const lM=Phaser.Utils.Objects.GetValue;var uM=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const cM=Phaser.Geom.Intersects.RectangleToRectangle,dM=Phaser.Geom.Rectangle.Overlaps;var pM=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},gM=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},fM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},vM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},mM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const yM=Phaser.Utils.Objects.GetValue,bM={update:0,everyTick:1};var xM={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(yM(t,"updateMode",0)),this.enableChildrenMask(yM(t,"padding",0)),this.setMaskLayer(yM(t,"layer",void 0)),this.onMaskGameObjectVisible=yM(t,"onVisivle"),this.onMaskGameObjectInvisible=yM(t,"onInvisible"),this.maskGameObjectCallbackScope=yM(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=bM[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=km.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,o,h,l=!!s||!!r,u=t.getBounds(),c=uM(e),d=0,p=i.length;dthis.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(TM.prototype,kM);const PM=["top","bottom","centerY","center"],OM=["left","right","centerX","center"];var _M=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=PM.length;a=0?0:Math.abs(l)<=Math.abs(u)?l:u}}else{if(i)for(a=0,o=OM.length;a=0?0:Math.abs(c)<=Math.abs(d)?c:d}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const EM=Phaser.Utils.Objects.GetValue;class MM extends uw{constructor(t,e){void 0===e&&(e={});var i=WC(e),s=EM(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=EM(e,"clampChildOY",!1),s.clampChildOX=EM(e,"clampChildOX",!1);var r,n,a=new TM(t,s);switch(t.add.existing(a),i){case 0:r=EM(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=EM(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:EM(e,"align.panel","center")};var o=EM(e,"space",void 0);o&&(o.child=EM(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]),Nv(this.childrenMap.child,t),this}}var DM={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:_M.call(this,t,"y",e);break;case 1:_M.call(this,t,"x",e);break;default:_M.call(this,t,"y",e),_M.call(this,t,"x",e)}return this}};Object.assign(MM.prototype,DM);var LM={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},AM={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class RM extends MM{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(RM.prototype,LM,AM);const BM=Phaser.Utils.Objects.GetValue;const FM=Phaser.Utils.Objects.GetValue;const IM=Phaser.Utils.Objects.GetValue;var jM={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=IM(t,"onGetValue"),this.onSetValue=IM(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},zM={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},NM={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const GM=Phaser.Utils.Objects.GetValue;class WM extends vm{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=GM(e,"proportion.title",0),o=GM(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0);a=GM(e,"proportion.inputField",h);this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(WM.prototype,jM,zM,NM);var VM=function(t,e,i){var s=new Q_(t,i);return t.add.existing(s),s},YM=function(t){void 0===t&&(t=vm);return class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},XM=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0}));i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange);return n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=JM(this.styles,"inputRow")||{},r=qM(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return Qx(t,K_(e,i))}(this.scene,t,ZM(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),QM(this,y(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=z_(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},rD={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},nD={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 aD=Phaser.Utils.Objects.GetValue;class oD extends uw{constructor(t,e){void 0===e&&(e={});var i,s=aD(e,"text");fn(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new I_(t,s),t.add.existing(i)),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.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,o,h=aD(e,"space",void 0);h&&(h.child=aD(h,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=o!==e;a=t,o=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=aD(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(oD.prototype,rD,nD);var hD={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new oD(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},lD={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=z_(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const uD=Phaser.Utils.Objects.GetValue,cD=Phaser.Math.Linear,dD=Phaser.Math.Snap.Floor;var pD={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=uD(s,r),a=function(t,e){var i=new RS(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=uD(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var u=e.inputNumber||e.inputText,c=z_(i,u).setNumberInput();o=e.defaultExpandWidth?1:0,h=uD(e,"proportion.range.inputText",o);t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=cD(t.minValue,t.maxValue,a.value);t.step&&(e=dD(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},gD=function(t,e){var i=new LP(t,e);return t.add.existing(i),i};const fD=Phaser.Utils.Objects.GetValue;var vD={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=fD(e,"incDec")||{},r={text:null,action:null},n=gD(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=z_(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(y(r),s.incButton||{}),u=CO(i,l),c=Object.assign(y(r),s.decButton||{}),d=CO(i,c);n.addButton(u),n.addButton(d);var p=s.inputTextIndex||0;n.insert(p,h,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new lL(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};const cL=Phaser.Utils.Objects.GetValue;var dL=function(t,e){var i=cL(e,"expandDirection",void 0);"string"==typeof i&&(i=pL[i]);var s,r,n,a,o,h,l,u=(n="alignTargetX",tt(s=e,r="alignTarget")?Q(s,r):n&&tt(s,n)?Q(s,n):a&&tt(s,a)?Q(s,a):o),c=cL(e,"alignTargetY",u),d=cL(e,"alignOffsetX",0),p=cL(e,"alignOffsetY",0),g=cL(e,"alignSide","").includes("right"),f=cL(e,"bounds"),v=0===i,m=!v&&!(1===i),y=g?1:0,b=v||m?0:1;t.setOrigin(y,b),h=g?u.getTopRight().x:u.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+d,l+p);var x=f;x||(x=un(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+p))};const pL={down:0,up:1},gL=Phaser.Utils.Objects.GetValue;class fL extends Eg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Dp(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 Ep(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),dL(t,e),t.isRexSizer&&t.layout();var i=gL(e,"touchOutsideClose",!1),s=gL(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&&Ng(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 vL={openColorPicker:function(){if(!this.colorPicker){var t=uL.call(this).layout(),e=new fL(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(vL,MD);const mL=Phaser.Utils.Objects.GetValue;class yL extends ED{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(mL(i,"width",160),mL(i,"height",170));var n=mL(i,"background");r=n?function(t){return Qx(t,n)}:mL(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(mL(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(mL(i,"expandDirection")),this.setColorPickerEaseInDuration(mL(i,"easeIn",200)),this.setColorPickerEaseOutDuration(mL(i,"easeOut",200)),this.setColorPickerTransitInCallback(mL(i,"transitIn")),this.setColorPickerTransitOutCallback(mL(i,"transitOut")),this.setColorPickerBounds(mL(i,"bounds"));var a=mL(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(mL(o,"height",30)),this.setColorComponentsFormatLabelConfig(mL(o,"formatLabel"));var h=mL(o,"inputText");h||(h=mL(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=mL(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var u=this.childrenMap.swatch;u&&s&&this.onClick(u,this.openColorPicker,this)}}Object.assign(yL.prototype,vL);var bL={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new yL(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},xL={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},kL={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},CL={buildShapes(){this.addShape((new Nu).setName("box")).addShape((new Iu).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 u=s*(1-this.boxSize)/2,c=a/2,d=s*this.boxSize-a;h.setTopLeftPosition(r+c+u,n+c+u).setSize(d,d),this.isCircleShape?h.setRadius(d/2):h.setRadius(0);u=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,f=2*p,v=3*p;l.startAt(g,f).lineTo(f,v).lineTo(v,g).offset(r+u,n+u).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)}},SL={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new ul(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}},wL={};Object.assign(wL,xL,kL,CL,SL);const TL=23730,PL=Phaser.Utils.Objects.GetValue,OL=Phaser.Utils.Objects.IsPlainObject;class _L extends Jl{constructor(t,e,i,s,r,n,a){OL(e)?(e=PL(a=e,"x",0),i=PL(a,"y",0),s=PL(a,"width",2),r=PL(a,"height",2),n=PL(a,"color",TL)):OL(n)&&(n=PL(a=n,"color",TL)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=TL),this.setBoxShape(PL(a,"circleBox",!1)),this.setBoxFillStyle(n,PL(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(PL(a,"uncheckedColor",null),PL(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(PL(a,"boxLineWidth",4),PL(a,"boxStrokeColor",n),PL(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,PL(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),PL(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(PL(a,"checkerColor",16777215),PL(a,"checkerAlpha",1)),this.setBoxSize(PL(a,"boxSize",1)),this.setCheckerSize(PL(a,"checkerSize",1)),this.setCheckerAnimationDuration(PL(a,"animationDuration",150)),this.buildShapes();var o=PL(a,"checked");void 0===o&&(o=PL(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(_L.prototype,wL);const EL=Phaser.Utils.Objects.GetValue,ML=Phaser.Utils.Objects.IsPlainObject;class DL extends _L{constructor(t,e,i,s,r,n,a){ML(e)?(e=EL(a=e,"x",0),i=EL(a,"y",0),s=EL(a,"width",2),r=EL(a,"height",2),n=EL(a,"color",TL)):ML(n)&&(n=EL(a=n,"color",TL)),super(t,e,i,s,r,n,a),this._click=new hf(this,EL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(EL(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}}var LL={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new DL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},AL={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}},RL={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}},BL={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}},FL=function(t,e,i){return(e-t)*i+t};const IL=Phaser.Math.Linear;var jL={buildShapes(){this.addShape((new Nu).setName("track")).addShape((new Nu).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,u,c,d=(l=this.falseValueTrackColor,u=this.trackFillColor,c=i,(255&FL(yr(l),yr(u),c))<<16|(255&FL(br(l),br(u),c))<<8|255&FL(xr(l),xr(u),c)),p=IL(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(d,p);var g=this.getShape("thumb");if(this.isSizeChanged){var f=t*this.thumbWidth,v=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(f,v).setRadius(m)}var y=IL(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)}},zL={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new ul(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}},NL={};Object.assign(NL,AL,RL,BL,jL,zL);const GL=Phaser.Utils.Objects.GetValue,WL=Phaser.Utils.Objects.IsPlainObject,VL=23730;class YL extends Jl{constructor(t,e,i,s,r,n,a){WL(e)?(e=GL(a=e,"x",0),i=GL(a,"y",0),s=GL(a,"width",2),r=GL(a,"height",2),n=GL(a,"color",VL)):WL(n)&&(n=GL(a=n,"color",VL)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=VL),this.setTrackFillStyle(n,GL(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(GL(a,"falseValueTrackColor",function(t){var e=.3*yr(t)+.59*br(t)+.11*xr(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),GL(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(GL(a,"thumbColor",16777215),GL(a,"thumbAlpha",1)),this.setTrackSize(GL(a,"trackWidth",.9),GL(a,"trackHeight",.5)),this.setTrackRadius(GL(a,"trackRadius",.5*this.trackHeight));var o=GL(a,"thumbHeight",void 0),h=GL(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(GL(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(GL(a,"thumbLeft",.3),GL(a,"thumbRight",void 0)),this.setRTL(GL(a,"rtl",!1)),this.setToggleAnimationDuration(GL(a,"animationDuration",150)),this.buildShapes(),this.setValue(GL(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(YL.prototype,NL);const XL=Phaser.Utils.Objects.GetValue;class HL extends YL{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new hf(this,XL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(XL(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}}var $L={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new HL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},UL={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=KL[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 KL={down:0,up:1},qL=Phaser.Utils.Objects.GetValue;var JL=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)){s=ZL(e,d);if(this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(u=s)),!u){0===c&&(c=this.listMaxHeight);var p=QL(e,this.listCreateSliderTrackCallback),g=QL(e,this.listCreateSliderThumbCallback);u=new MM(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:qL(this.listSpace,"panel",0)}}),e.add.existing(u)}}else d.height=c,s=ZL(e,d),u=s;return t&&u.addBackground(t,"background"),this.listDraggable&&u.setDraggable(!0),u!==s&&s.on("button.over",(function(t,e,i,s){u.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){u.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){u.emit("button.click",t,e,i,s)})),u},ZL=function(t,e,i){var s;return i?(e.orientation="x",s=new nO(t,e)):(e.orientation="y",s=new LP(t,e)),t.add.existing(s),s},QL=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},tA={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;void 0===e?t=0:t=(e+1)%this.listPanel.getButtons().length;return 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}},eA={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=JL.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 fL(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(eA,UL,tA);const iA=Phaser.Utils.Objects.GetValue;class sA extends jC{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(iA(e,"options"));var i=iA(e,"list");this.setWrapEnable(iA(i,"wrap",!1)),this.setCreateButtonCallback(iA(i,"createButtonCallback")),this.setCreateListBackgroundCallback(iA(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(iA(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(iA(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(iA(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(iA(i,"scroller")),this.setListMouseWheelScrollerConfig(iA(i,"mouseWheelScroller")),this.setButtonClickCallback(iA(i,"onButtonClick")),this.setButtonOverCallback(iA(i,"onButtonOver")),this.setButtonOutCallback(iA(i,"onButtonOut")),this.setListExpandDirection(iA(i,"expandDirection")),this.setListEaseInDuration(iA(i,"easeIn",500)),this.setListEaseOutDuration(iA(i,"easeOut",100)),this.setListTransitInCallback(iA(i,"transitIn")),this.settListTransitOutCallback(iA(i,"transitOut")),this.setListMaxHeight(iA(i,"maxHeight",0)),this.setListSize(iA(i,"width"),iA(i,"height",0)),this.setListAlignmentMode(iA(i,"alignParent","text")),this.setListAlignmentSide(iA(i,"alignSide","")),this.setListBounds(iA(i,"bounds")),this.setListSpace(iA(i,"space")),this.setListDraggable(iA(i,"draggable",!1)),this.setValueChangeCallback(iA(e,"setValueCallback"),iA(e,"setValueCallbackScope")),this.setValue(iA(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(sA.prototype,eA);var rA=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?y(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,o=Aw(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=CO(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var h=e.track;h&&(o.list.createTrackCallback=function(t){return Qx(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return Qx(t,l)},delete e.thumb),o.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},o.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},o}(t,e);var i=new sA(t,e);return t.add.existing(i),i},nA=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=rA(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=nA(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const oA=Phaser.Utils.Objects.GetValue;var hA={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?y(e.button):{},r=oA(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=gD(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n0?r.addScrollable():r).addRows(s,i,!0),r}(t,e,i,s)}}var dA={csv2md:function(t,e={}){"string"==typeof e&&(e={title:e});for(var i,s,r,{title:n}=e,a=lr.parse(t).data,o=!1,h=!1,l=[],u=0,c=a.length;u * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Rp=Phaser.Display.Canvas.CanvasPool;var Lp=function(t){var e=Rp.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 Rp.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,Rp.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!==qo&&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=el[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]=Dp(t,l,d);else{var u=zp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Dp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Dp(t,"fill",null);null!==v&&(this.color=Yl(v));var g=Dp(t,"metrics",!1);return g?this.metrics={ascent:Dp(g,"ascent",0),descent:Dp(g,"descent",0),fontSize:Dp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Lp(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=Lp(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=Dp(t,"fontFamily","Courier"),this.fontSize=Dp(t,"fontSize","16px"),this.fontStyle=Dp(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=Yl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Yl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Yl(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=Yl(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Yl(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=Yl(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=Yl(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=Yl(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=Yl(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=Yl(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=Yl(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=Yl(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=el[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=Dp(e,"fontFamily",this.fontFamily),this.fontSize=Dp(e,"fontSize",this.fontSize),this.fontStyle=Dp(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 Yp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),$l(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 C=l;C0){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 Xp=Phaser.Utils.Objects.GetValue,Wp=$o,Bp=Jo;class jp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Xp(t,"text",""),this.x=Xp(t,"x",0),this.y=Xp(t,"y",0),this.width=Xp(t,"width",0);var e=Xp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Xp(t,"newLineMode",0),this.startIndex=Xp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Bp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Wp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Bp&&(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 Ip=Phaser.Utils.Objects.GetFastValue,Fp=$o,Np=Ko;class Hp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Ip(t,"tagToText",Xt),this.tagToTextScope=Ip(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 Gp={};const Vp=Phaser.Geom.Rectangle;var Up=new ec;class $p{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&ov(g)){""!==b?h.push(n.getLine(b,x,ev)):0===C&&r>0&&h.push(n.getLine("",0,ev)),h.push(...hv(g,e,rv,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,ev)),b=g,x=f,o=s):(b+=g,x=m),C===S-1&&h.push(n.getLine(b,x,l))}return h},av=function(t,e){var i;switch(e){case sv:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==dv&&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 Hp({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 jg=Phaser.Utils.Objects.GetValue,Ig=Phaser.Math.Distance.Between;class Fg extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=jg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(jg(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(jg(t,"enable",!0)),this.holdThreshold=jg(t,"holdThreshold",50),this.pointerOutReleaseEnable=jg(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 vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Ig(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&&!cr(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&&!cr(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 Ng=Phaser.Utils.Objects.GetValue;class Hg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Ng(t,"value",0)),this.setSpeed(Ng(t,"speed",0)),this.setAcceleration(Ng(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 Gg{constructor(){this.value,this.dir,this.movement=new Hg}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 Jg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Kg=Phaser.Utils.Objects.GetValue;class qg extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Kg(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Kg(e,"speed",.1)),this.setEnable(Kg(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Kg(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||cr(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 Zg=Phaser.Utils.Objects.GetValue;var Qg=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)?Zg(s,l,void 0):Zg(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 Wg(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=Zg(r,"position",0);"string"==typeof p&&(p=tf[p]);var v,g,f=Zg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Zg(s,"space.slider",void 0))&&(a?f=0:v=Zg(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:Zg(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Zg(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Zg(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Zg(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Zg(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Zg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Zg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Zg(s,"scrollDetectionMode");"string"==typeof b&&(b=ef[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Zg(s,x,!0):Zg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new $g(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,P,T=Zg(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==b&&(T.focus=1===b?2:0),C=new qg(o,T)),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&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const tf={right:0,left:1,bottom:0,top:1},ef={gameObject:0,rectBounds:1},sf=Phaser.Utils.Objects.GetValue;var rf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=sf(e,"width"),h=sf(e,"height");n||sf(e,"child.expandWidth",!0)||(s[1]=0),h||sf(e,"child.expandHeight",!0)||(r[1]=0);var a=new ho(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=lg(i,"child"),r=lg(s,"gameObject",void 0);if(r){var n=lg(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=lg(n,"top",0),h.bottom=lg(n,"bottom",0),a.left=lg(n,"left",0),a.right=lg(n,"right",0);break;case 1:h.top=lg(n,"left",0),h.bottom=lg(n,"right",0),a.top=lg(n,"top",0),a.bottom=lg(n,"bottom",0);break;default:h.top=lg(n,"top",0),h.bottom=lg(n,"bottom",0),h.left=lg(n,"left",0),h.right=lg(n,"right",0)}e.add(r,{column:1,row:1,align:lg(s,"align","center"),padding:a,expand:{width:lg(s,"expandWidth",!0),height:lg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Qg(t,a,"y",e);break;case 1:Qg(t,a,"x",e);break;default:Qg(t,a,"y",e),Qg(t,a,"x",e)}return a},nf=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)},hf=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)}},af=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(pf.call(this,-this.textOY)),0),e=vf.call(this,t)+this.textOY,i=gf.call(this,t);return function(t,e){switch(No(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,ff.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,Ie.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,yf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,ff.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const xf=Phaser.Utils.Objects.IsPlainObject,Cf=Phaser.Utils.Objects.GetValue,Sf=Phaser.Display.Align.TOP_LEFT;class wf extends rh{constructor(t,e,i,s,r,n){xf(e)?(e=Cf(n=e,"x",0),i=Cf(n,"y",0),s=Cf(n,"width",void 0),r=Cf(n,"height",void 0)):xf(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=Of(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=Sf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=No(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Wo.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(pf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=vf.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 Of=function(t){return t.add.text(0,0,"")};Object.assign(wf.prototype,bf);var Pf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Tf={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 kf=Phaser.Utils.Objects.GetValue;class _f extends cf{constructor(t,e){void 0===e&&(e={});var i=kf(e,"text",void 0),s=kf(e,"textWidth",void 0),r=kf(e,"textHeight",void 0),n=kf(e,"textCrop",!!i.setCrop),h=kf(e,"textMask",!n),a=kf(e,"content",""),o=new wf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:kf(e,"clampChildOY",!1),alwaysScrollable:kf(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=kf(e,"space",void 0);l&&(l.child=kf(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(_f.prototype,Pf,Tf);const Ef=Phaser.Utils.Objects.GetValue;var Mf=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 hg(t,e);break;case"bbcodetext":case"bbcode":s=new ig(t,0,0,"",e);break;case"label":s=new zf(t,e);break;case"textarea":s=function(t,e,i){e=e?bd(e):{};var s=Ef(i,"background",xp),r=Ef(i,"text",Mf),n=Ef(i,"track",xp),h=Ef(i,"thumb",xp);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 _f(t,e);return t.add.existing(o),o}(t,e);break;default:s=new wp(t,e)}return bp(s,e),t.add.existing(s),s},Rf=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 mp(t,e):new Ju(t,e);break;case"roundRectangle":s=new Hc(t,e);break;default:s=new Qu(t,e)}return bp(s,e),t.add.existing(s),s};const Lf=Phaser.Utils.Objects.GetValue;class zf extends fc{constructor(t,e,i){e=function(t,e,i){e=e?bd(e):{};var s=Lf(i,"background",xp),r=Lf(i,"text",Mf),n=Lf(i,"icon",Rf),h=Lf(i,"action",Rf);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 Df(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Df(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Df(this.getChildren(),"setDisableState",t),this}}var Df=function(t,e,i){for(var s=0,r=t.length;s=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)):(em(this),im(this)),this}setNumberInput(){return this.onUpdateCallback=tm,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const nm=Phaser.Utils.Objects.GetValue,hm=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var am=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}vm.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(gm(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 fm=new vm,mm=/^[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,ym=/\S/,bm=new vm;bm.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!ym.test(t)&&!ym.test(e)},bm.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(wm(t,null,null,i),i," ")},Sm.equals=function(t,e){return vm.prototype.equals.call(Sm,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Om=new vm;Om.tokenize=function(t){return t.slice()},Om.join=Om.removeEmpty=function(t){return t};const Pm=Phaser.Utils.Array.Remove;var Tm=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Pm(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,fm.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},Rm={cursorMoveLeft(){if(!this.isOpened)return this;var t=_m(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=_m(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Em(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=_m(Mm(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Em(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=_m(Mm(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Lm=Phaser.Utils.Objects.IsPlainObject;class zm extends ac{constructor(t,e,i,s,r,n){Lm(e)?n=e:Lm(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(am(e,"wrap.vAlign")||Xu(e,"wrap.vAlign",s=i?"center":"top"),am(e,"wrap.wrapMode")||Xu(e,"wrap.wrapMode","char"),am(e,"wrap.maxLines")||Xu(e,"wrap.maxLines",s=i?1:void 0),i&&Xu(e,"wrap.wrapWidth",1/0),am(e,"wrap.useDefaultTextHeight")||Xu(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!am(e.edit,"inputType")){var s=i?"text":"textarea";Xu(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new lm(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Xc(n.background,"focus"),o=Xc(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=nm(e,"edit");return void 0===i&&(i={}),Wf(e,i,hm),new rm(t,i)}(this,n),dm.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),pm.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),um.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;so;d--){for(c=0;c0&&this.wrapMode!==qo&&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=el[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]=Dp(t,l,d);else{var u=zp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Dp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Dp(t,"fill",null);null!==v&&(this.color=Yl(v));var g=Dp(t,"metrics",!1);return g?this.metrics={ascent:Dp(g,"ascent",0),descent:Dp(g,"descent",0),fontSize:Dp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Lp(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=Lp(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=Dp(t,"fontFamily","Courier"),this.fontSize=Dp(t,"fontSize","16px"),this.fontStyle=Dp(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=Yl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Yl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Yl(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=Yl(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Yl(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=Yl(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=Yl(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=Yl(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=Yl(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=Yl(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=Yl(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=Yl(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=el[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=Dp(e,"fontFamily",this.fontFamily),this.fontSize=Dp(e,"fontSize",this.fontSize),this.fontStyle=Dp(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 Yp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),$l(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 C=l;C0){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 Xp=Phaser.Utils.Objects.GetValue,Wp=$o,Bp=Jo;class jp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Xp(t,"text",""),this.x=Xp(t,"x",0),this.y=Xp(t,"y",0),this.width=Xp(t,"width",0);var e=Xp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Xp(t,"newLineMode",0),this.startIndex=Xp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Bp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Wp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Bp&&(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 Ip=Phaser.Utils.Objects.GetFastValue,Fp=$o,Np=Ko;class Hp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Ip(t,"tagToText",Xt),this.tagToTextScope=Ip(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 Gp={};const Vp=Phaser.Geom.Rectangle;var Up=new ec;class $p{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&ov(g)){""!==b?h.push(n.getLine(b,x,ev)):0===C&&r>0&&h.push(n.getLine("",0,ev)),h.push(...hv(g,e,rv,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,ev)),b=g,x=f,o=s):(b+=g,x=m),C===S-1&&h.push(n.getLine(b,x,l))}return h},av=function(t,e){var i;switch(e){case sv:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==dv&&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 Hp({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 jg=Phaser.Utils.Objects.GetValue,Ig=Phaser.Math.Distance.Between;class Fg extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=jg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(jg(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(jg(t,"enable",!0)),this.holdThreshold=jg(t,"holdThreshold",50),this.pointerOutReleaseEnable=jg(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 vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Ig(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&&!cr(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&&!cr(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 Ng=Phaser.Utils.Objects.GetValue;class Hg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Ng(t,"value",0)),this.setSpeed(Ng(t,"speed",0)),this.setAcceleration(Ng(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 Gg{constructor(){this.value,this.dir,this.movement=new Hg}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 Jg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Kg=Phaser.Utils.Objects.GetValue;class qg extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Kg(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Kg(e,"speed",.1)),this.setEnable(Kg(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Kg(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||cr(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 Zg=Phaser.Utils.Objects.GetValue;var Qg=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)?Zg(s,l,void 0):Zg(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 Wg(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=Zg(r,"position",0);"string"==typeof p&&(p=tf[p]);var v,g,f=Zg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Zg(s,"space.slider",void 0))&&(a?f=0:v=Zg(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:Zg(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Zg(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Zg(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Zg(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Zg(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Zg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Zg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Zg(s,"scrollDetectionMode");"string"==typeof b&&(b=ef[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Zg(s,x,!0):Zg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new $g(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,P,T=Zg(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==b&&(T.focus=1===b?2:0),C=new qg(o,T)),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&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const tf={right:0,left:1,bottom:0,top:1},ef={gameObject:0,rectBounds:1},sf=Phaser.Utils.Objects.GetValue;var rf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=sf(e,"width"),h=sf(e,"height");n||sf(e,"child.expandWidth",!0)||(s[1]=0),h||sf(e,"child.expandHeight",!0)||(r[1]=0);var a=new ho(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=lg(i,"child"),r=lg(s,"gameObject",void 0);if(r){var n=lg(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=lg(n,"top",0),h.bottom=lg(n,"bottom",0),a.left=lg(n,"left",0),a.right=lg(n,"right",0);break;case 1:h.top=lg(n,"left",0),h.bottom=lg(n,"right",0),a.top=lg(n,"top",0),a.bottom=lg(n,"bottom",0);break;default:h.top=lg(n,"top",0),h.bottom=lg(n,"bottom",0),h.left=lg(n,"left",0),h.right=lg(n,"right",0)}e.add(r,{column:1,row:1,align:lg(s,"align","center"),padding:a,expand:{width:lg(s,"expandWidth",!0),height:lg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Qg(t,a,"y",e);break;case 1:Qg(t,a,"x",e);break;default:Qg(t,a,"y",e),Qg(t,a,"x",e)}return a},nf=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)},hf=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)}},af=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(pf.call(this,-this.textOY)),0),e=vf.call(this,t)+this.textOY,i=gf.call(this,t);return function(t,e){switch(No(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,ff.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,Ie.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,yf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,ff.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const xf=Phaser.Utils.Objects.IsPlainObject,Cf=Phaser.Utils.Objects.GetValue,Sf=Phaser.Display.Align.TOP_LEFT;class wf extends rh{constructor(t,e,i,s,r,n){xf(e)?(e=Cf(n=e,"x",0),i=Cf(n,"y",0),s=Cf(n,"width",void 0),r=Cf(n,"height",void 0)):xf(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=Of(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=Sf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=No(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Wo.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(pf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=vf.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 Of=function(t){return t.add.text(0,0,"")};Object.assign(wf.prototype,bf);var Pf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Tf={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 kf=Phaser.Utils.Objects.GetValue;class _f extends cf{constructor(t,e){void 0===e&&(e={});var i=kf(e,"text",void 0),s=kf(e,"textWidth",void 0),r=kf(e,"textHeight",void 0),n=kf(e,"textCrop",!!i.setCrop),h=kf(e,"textMask",!n),a=kf(e,"content",""),o=new wf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:kf(e,"clampChildOY",!1),alwaysScrollable:kf(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=kf(e,"space",void 0);l&&(l.child=kf(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(_f.prototype,Pf,Tf);const Ef=Phaser.Utils.Objects.GetValue;var Mf=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 hg(t,e);break;case"bbcodetext":case"bbcode":s=new ig(t,0,0,"",e);break;case"label":s=new zf(t,e);break;case"textarea":s=function(t,e,i){e=e?bd(e):{};var s=Ef(i,"background",xp),r=Ef(i,"text",Mf),n=Ef(i,"track",xp),h=Ef(i,"thumb",xp);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 _f(t,e);return t.add.existing(o),o}(t,e);break;default:s=new wp(t,e)}return bp(s,e),t.add.existing(s),s},Rf=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 mp(t,e):new Ju(t,e);break;case"roundRectangle":s=new Hc(t,e);break;default:s=new Qu(t,e)}return bp(s,e),t.add.existing(s),s};const Lf=Phaser.Utils.Objects.GetValue;class zf extends fc{constructor(t,e,i){e=function(t,e,i){e=e?bd(e):{};var s=Lf(i,"background",xp),r=Lf(i,"text",Mf),n=Lf(i,"icon",Rf),h=Lf(i,"action",Rf);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 Df(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Df(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Df(this.getChildren(),"setDisableState",t),this}}var Df=function(t,e,i){for(var s=0,r=t.length;s=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)):(em(this),im(this)),this}setNumberInput(){return this.onUpdateCallback=tm,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const nm=Phaser.Utils.Objects.GetValue,hm=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var am=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}vm.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(gm(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 fm=new vm,mm=/^[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,ym=/\S/,bm=new vm;bm.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!ym.test(t)&&!ym.test(e)},bm.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(wm(t,null,null,i),i," ")},Sm.equals=function(t,e){return vm.prototype.equals.call(Sm,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Om=new vm;Om.tokenize=function(t){return t.slice()},Om.join=Om.removeEmpty=function(t){return t};const Pm=Phaser.Utils.Array.Remove;var Tm=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Pm(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,fm.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},Rm={cursorMoveLeft(){if(!this.isOpened)return this;var t=_m(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=_m(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Em(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=_m(Mm(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Em(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=_m(Mm(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Lm=Phaser.Utils.Objects.IsPlainObject;class zm extends ac{constructor(t,e,i,s,r,n){Lm(e)?n=e:Lm(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(am(e,"wrap.vAlign")||Xu(e,"wrap.vAlign",s=i?"center":"top"),am(e,"wrap.wrapMode")||Xu(e,"wrap.wrapMode","char"),am(e,"wrap.maxLines")||Xu(e,"wrap.maxLines",s=i?1:void 0),i&&Xu(e,"wrap.wrapWidth",1/0),am(e,"wrap.useDefaultTextHeight")||Xu(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!am(e.edit,"inputType")){var s=i?"text":"textarea";Xu(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new lm(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Xc(n.background,"focus"),o=Xc(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=nm(e,"edit");return void 0===i&&(i={}),Wf(e,i,hm),new rm(t,i)}(this,n),dm.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),pm.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),um.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;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 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}},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}},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}},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 Me=/(\S+)\[(\d+)\]/i,Re=Phaser.Utils.Objects.GetValue;var Le=function(t,e){return void 0===e?t:t[e]},De=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=Re(e,"left",0),t.right=Re(e,"right",0),t.top=Re(e,"top",0),t.bottom=Re(e,"bottom",0)),t},Ye={getInnerPadding(t){return Le(this.space,t)},setInnerPadding(t,e){return De(this.space,t,e),this},getOuterPadding(t){return Le(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return De(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e,i),this}},Xe=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}},Ae=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},We=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}},Be=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},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}},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?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==xi&&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=xi):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case xi:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,xi=-1;class Ci extends ci{constructor(t,e){super(t,e),this.timer=new gi}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 Si=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Tweens.Builders.GetEaseFunction;class ki extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(Si(t,"timer")),this.setEnable(Si(t,"enable",!0)),this.setTarget(Si(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Si(t,"ease","Linear")),this.setRepeat(Si(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=Oi(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 Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let Ei=class extends ki{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Mi[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=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 Mi={stop:0,destroy:1,yoyo:2};var Ri=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 Ei(t,a):r.resetFromJSON(a),r.restart(),r},Li=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 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 Ei(t,h):n.resetFromJSON(h),n.restart(),n},Di=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Yi=function(t){return Di(t,"complete")};const Xi=Phaser.Utils.Objects.IsPlainObject;var Ai={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(Xi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(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),Yi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Xi(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=Li(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),Yi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Yi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Xi(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 Ei(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),Yi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Ai),zi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Ii extends ki{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(Bi(t,"start",this.parent.alpha),Bi(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=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Gi=function(t,e,i,s){var r,n;Hi(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},Ni=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 Vi=Phaser.Utils.Objects.IsPlainObject;var Ui={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=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Yi(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=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Yi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Yi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ui),$i.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ji=Phaser.Utils.Objects.GetValue,Ki=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Zi extends ki{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ki(t,"x",void 0),i=Ki(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=Ki(i,"startX",void 0),this.startY=Ki(i,"startY",void 0),this.endX=Ki(i,"endX",void 0),this.endY=Ki(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=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(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 ts=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 es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={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(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(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 Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=ts(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=ts(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(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),Yi(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),Yi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(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 Zi&&(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=ts(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=ts(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(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),Yi(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),Yi(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}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class hs extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(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=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[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=ns(i,"magnitude",void 0),t=ns(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 as={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new hs(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),Yi(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends ki{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(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]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{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 vs(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(gs(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(gs(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 ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(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),Di(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}},ys=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 zs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(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}},Ws={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}},Bs={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}},js={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,zs,Ws,Bs,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new As(this,{eventEmitter:!1,initState:Fs(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(Hs.prototype,Is);var Gs=function(t){if(t.parentContainer)return Gs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Gs(e):t};class Ns extends si{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=Gs(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 Vs=Phaser.GameObjects.Rectangle;class Us extends Vs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ns(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const $s=Phaser.Utils.Objects.GetValue;class Js extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(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=Ks[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 Ks={default:0,fullWindow:1};const qs=Phaser.Utils.Objects.GetValue;class Zs extends Us{constructor(t,e){super(t,qs(e,"color",0),qs(e,"alpha",.8)),this.touchEventStop=new Js(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ri(t,e)},scaleDown(t,e){Li(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e,t.alpha)},er=function(t,e){Ni(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(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(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),h=sr(e,"anyTouchClose",!1);sr(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),sr(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&&ir(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=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var hr=function(t){return t&&"function"==typeof t},ar={modal(t,e){return hr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(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}},or=function(t,e,i,s,r){hr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={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 or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(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 Or={press:0,pointerdown:0,release:1,pointerup:1};var kr={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 wr(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}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(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 Tr.length=0,!0;return Tr.length=0,!1},Tr=[];const Er=Phaser.Utils.Objects.GetValue;class Mr extends si{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=Rr[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?Pr:ur)(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 Rr={press:0,pointerdown:0,release:1,pointerup:1};var Lr={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 Mr(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 Dr extends Xs{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 Yr=Phaser.Utils.Objects.GetValue;class Xr extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Dr,this.parent.setInteractive(Yr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Yr(t,"enable",!0)),this.setCooldown(Yr(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 Ar={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ur(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 Xr(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 Xr(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}},Wr=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=tn,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===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,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=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class hn 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=an},eventEmitter:!1};this.setRecongizedStateObject(new Xs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case an:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln: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=ln))}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=an):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=an)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=an)}get isTapped(){return this.state===ln}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 an="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;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,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=un},eventEmitter:!1};this.setRecongizedStateObject(new Xs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=vn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=vn)}get isPressed(){return this.state===vn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",vn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var gn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var yn={getDt:function(){return gn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(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 mn(e.x,e.y,t.x,t.y)}},bn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},xn={};const Cn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Math.RadToDeg;class wn 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=On},eventEmitter:!1};this.setRecongizedStateObject(new Xs(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=kn}onDragEnd(){this.state=On}onDrag(){this.state===kn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=On)}get isSwiped(){return this.state===Pn}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=bn[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}}(Sn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(wn.prototype,yn);const On="IDLE",kn="BEGIN",Pn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Tn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,Mn=Phaser.Math.Angle.Between;class Rn{constructor(t,e){var i=Ze(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(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=Dn,this.pointers.length=0,mt(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,mt(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 Dn:this.tracerState=Yn,this.onDrag1Start();break;case Yn: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],Tn(this.pointers,e),this.tracerState){case Yn:this.tracerState=Dn,this.onDrag1End();break;case Xn:this.tracerState=Yn,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 Yn:this.onDrag1();break;case Xn:this.onDrag2()}}}dragCancel(){return this.tracerState===Xn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Dn,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 En(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 Mn(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;Ln.x=e.x-i.x,Ln.y=e.y-i.y}else Ln.x=0,Ln.y=0;return Ln}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=An,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Rn.prototype,Je);var Ln={};const Dn=0,Yn=1,Xn=2,An="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var Wn=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},Bn={};const jn=Phaser.Utils.Objects.GetValue,In=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Gn=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=Bn),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=In(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=In(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Gn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Nn);const Vn="IDLE",Un="BEGIN",$n="RECOGNIZED",Jn=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=Jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new hn(this,e),this._tap.on("tap",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=qn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var th=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 wn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Br(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const eh=Phaser.Utils.Objects.GetValue;var ih=function(t,e){return t.setInteractive(),eh(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:eh(e,"targets",[t]),targetMode:eh(e,"targetMode","parent"),eventEmitter:eh(e,"eventEmitter",t),eventNamePrefix:eh(e,"inputEventPrefix","child.")},Ir.call(t,e),Gr.call(t,e),Ur.call(t,e),qr.call(t,e),Kn.call(t,e),Zn.call(t,e),th.call(t,e),t},sh={getSizerConfig:function(t){return void 0===t&&(t=this),Rt(t)},getChildPrevState:function(t){var e=Rt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Yt(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=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(h=le(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(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)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var 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 uh=Phaser.Utils.Objects.IsPlainObject,ph=Phaser.Utils.Objects.GetValue,vh=Phaser.Display.Align.CENTER,gh={min:0,full:-1};var fh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;ye.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=gh[e];else if(uh(e)){var f;e=ph(f=e,"proportion",void 0),i=ph(f,"align",vh),s=ph(f,"padding",0),r=ph(f,"expand",!1),n=ph(f,"key",void 0),h=ph(f,"index",void 0),t.isRexSizer||(a=ph(f,"minWidth",void 0),o=ph(f,"minHeight",void 0)),l=ph(f,"fitRatio",0),d=ph(f,"offsetX",0),c=ph(f,"offsetY",0),u=ph(f,"offsetOriginX",0),p=ph(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=vh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?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),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,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},mh={add:fh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fh.call(this,new dh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return uh(i)&&(i.index=t),fh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ch.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const yh=Mt.prototype.clear;var bh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),yh.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,bh.call(this,t),this}},Sh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[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}},Oh={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}},Ph={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&&(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,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.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)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Be.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oh.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],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,mh,Ch,Sh,wh,Oh,kh);var _h=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},Eh=function(t){return"string"==typeof t&&(t=Th[t]),t};const Mh=Phaser.Utils.Objects.IsPlainObject,Rh=Phaser.Utils.Objects.GetValue;class Lh extends nh{constructor(t,e,i,s,r,n,h){Mh(e)?(e=Rh(h=e,"x",0),i=Rh(h,"y",0),s=Rh(h,"width",void 0),r=Rh(h,"height",void 0),n=Rh(h,"orientation",0)):Mh(s)?(s=Rh(h=s,"width",void 0),r=Rh(h,"height",void 0),n=Rh(h,"orientation",0)):Mh(n)&&(n=Rh(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(Rh(h,"space.item",0)),this.setStartChildIndex(Rh(h,"startChildIndex",0)),this.setRTL(Rh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Eh(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=_h.call(this)),this._childrenProportion}}Object.assign(Lh.prototype,Ph);var Dh=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}},Yh=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},Xh={appendText:Yh,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 Ah extends Lh{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&&(Dh(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&&(Dh(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&&Dh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Dh(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(Ah.prototype,Xh);var zh=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)},Wh=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 Bh=Phaser.GameObjects.Graphics;class jh extends Bh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Ih[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=fe(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=fe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Wh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&yt(i,this.padding),this.originX=s.originX,this.originY=s.originY,zh.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,zh.call(this,this.width,this.height,this.padding,t,e)),this}}const Ih={rectangle:0,circle:1};var Fh=function(t,e,i,s){var r=new jh(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 Hh=Phaser.GameObjects.Text;var Gh=function(t){return t instanceof Hh};const Nh=Phaser.GameObjects.BitmapText;var Vh=function(t){return t instanceof Nh},Uh=function(t){return Vh(t)?2:Gh(t)?0:1},$h=/^[\x00-\x7F]+$/,Jh=function(t){return $h.test(t)},Kh=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},Zh=0,Qh=1,ta=2,ea=0,ia=1,sa=2,ra=/(?:\r\n|\r|\n)/;const na={none:ea,word:ia,char:sa,character:sa,mix:3},ha=Phaser.Renderer.WebGL.Utils;var aa={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=ha.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 oa=Phaser.Display.Color;var la={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 oa);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}},da=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)},ca={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,da(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 ua=Phaser.Display.Canvas.CanvasPool,pa=Phaser.GameObjects.GameObject,va=Phaser.Utils.String.UUID;class ga extends pa{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=ua.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=va(),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(){ua.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 fa=Phaser.GameObjects.Components;Phaser.Class.mixin(ga,[fa.Alpha,fa.BlendMode,fa.Crop,fa.Depth,fa.Flip,fa.GetBounds,fa.Mask,fa.Origin,fa.Pipeline,fa.PostPipeline,fa.ScrollFactor,fa.Tint,fa.Transform,fa.Visible,aa,la,ca]);var ma={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:Ms(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&&mt(this.data),this}};class ya{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(ya.prototype,ma);var ba={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 xa=Phaser.Math.RotateAround;var Ca;const Sa=Phaser.Geom.Rectangle;var wa,Oa=function(t){void 0===wa&&(wa=new Sa);var e=t.drawTLX,i=t.drawTLY;return wa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),wa};const ka=Phaser.Math.RotateAround;var Pa,_a=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Pa&&(Pa={}),s=Pa),s.x=e,s.y=i,0!==t.rotation&&ka(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Ta=Phaser.GameObjects.Components.TransformMatrix;var Ea,Ma,Ra={},La=function(t,e,i,s,r){var n=_a(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ra);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ea&&(Ea=new Ta,Ma=new Ta),t.parentContainer?t.getWorldTransformMatrix(Ea,Ma):Ea.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ea.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Da=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 La(t,e,n,h,r)},Ya={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&&xa(s,0,0,-i.rotation),s}(t,e,this,!0);return Oa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Da(this.parent,this,t,e,i)}};Object.assign(Ya,ba);const Xa=Phaser.Math.DegToRad,Aa=Phaser.Math.RadToDeg,za=Phaser.Utils.Objects.GetValue;class Wa extends ya{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 Aa(this._rotation)}set angle(t){this.rotation=Xa(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=za(t,"width",void 0),i=za(t,"height",void 0),s=za(t,"scaleX",void 0),r=za(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(Wa.prototype,Ya);const Ba=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`#${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}},Ia=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Fa=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=Fa(t,"x",0),i=Fa(t,"y",0));var s=this.cornerRadius;s.tl=Ga(Fa(t,"tl",void 0),e,i),s.tr=Ga(Fa(t,"tr",void 0),e,i),s.bl=Ga(Fa(t,"bl",void 0),e,i),s.br=Ga(Fa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Na(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Na(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Na(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Na(this.cornerRadius.br,t)}};var Ga=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Va(t),t},Na=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Fa(e,"x",0),t.y=Fa(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)};const Ua=Phaser.Math.DegToRad;var $a=function(t){return!t.hasOwnProperty("convex")||t.convex},Ja=function(t){return t.x>0&&t.y>0},Ka=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,$a(a)?Ka(t,o,l,o,l,180,270,!1,h):Ka(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,$a(a)?Ka(t,s-o,l,o,l,270,360,!1,h):Ka(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,$a(a)?Ka(t,s-o,r-l,o,l,0,90,!1,h):Ka(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,$a(a)?Ka(t,o,r-l,o,l,90,180,!1,h):Ka(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())},Za=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),qa(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Qa=Phaser.Utils.Objects.GetValue;class to extends Wa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Qa(e,"color",null),Qa(e,"color2",null),Qa(e,"horizontalGradient",!0)),this.setStroke(Qa(e,"stroke",null),Qa(e,"strokeThickness",2)),this.setCornerRadius(Qa(e,"cornerRadius",0),Qa(e,"cornerIteration",null))}set color(t){t=ja(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ja(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=ja(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,Ia("color2",t,this),Ia("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ia("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ia("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(){Za(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const eo=Phaser.Utils.Objects.GetValue;class io extends Wa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(eo(e,"color",null),eo(e,"color2",null),eo(e,"horizontalGradient",!0)),this.setStroke(eo(e,"stroke",null),eo(e,"strokeThickness",2))}set color(t){t=ja(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ja(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=ja(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,eo(t,"color2",null),eo(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,eo(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 so=Phaser.Utils.Objects.GetValue;let ro=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(so(t,"bold",!1)),this.setItalic(so(t,"italic",!1)),this.setFontSize(so(t,"fontSize","16px")),this.setFontFamily(so(t,"fontFamily","Courier")),this.setColor(so(t,"color","#fff")),this.setStrokeStyle(so(t,"stroke",null),so(t,"strokeThickness",0)),this.setShadow(so(t,"shadowColor",null),so(t,"shadowOffsetX",0),so(t,"shadowOffsetY",0),so(t,"shadowBlur",0)),this.setOffset(so(t,"offsetX",0),so(t,"offsetY",0)),this.setSpace(so(t,"leftSpace",0),so(t,"rightSpace",0)),this.setAlign(so(t,"align",void 0)),this.setBackgroundColor(so(t,"backgroundColor",null)),this.setBackgroundHeight(so(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(so(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(Ia("stroke",t,this),Ia("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ia("shadowOffsetX",t,this),Ia("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=ja(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ja(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=ja(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=ja(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 no=Phaser.Utils.Array.Remove,ho=Phaser.Utils.Array.Remove,ao="text",oo="image",lo="drawer",co="space",uo="command";var po=function(t){return t.type===ao&&"\n"===t.text},vo=function(t){return t.type===ao&&"\f"===t.text},go=function(t){return t.type===ao};class fo extends Wa{constructor(t,e,i){super(t,ao),this.updateTextFlag=!1,this.style=new ro(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 mo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const yo=Phaser.Display.Canvas.CanvasPool;var bo=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=yo.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),yo.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 xo extends Wa{constructor(t,e,i){super(t,oo),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(){bo(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 Wa{constructor(t,e,i,s){super(t,lo),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 So extends Wa{constructor(t,e){super(t,co),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 wo extends ya{constructor(t,e,i,s,r){super(t,uo),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 ko=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 _o=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=Ro.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Ro.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Do(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Do(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Do(t,"wrapMode");void 0===c&&(c=Do(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Po[c]);var u=Do(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Do(t,"letterSpacing",0),v=Do(t,"hAlign",0),g=Do(t,"vAlign",0),f=Do(t,"justifyPercentage",.25),m=ko({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=Ao(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Ao(t,"maxLines",0);var a=0===i,o=Ao(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Ao(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Ao(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Ao(t,"letterSpacing",0),p=Ao(t,"rtl",!0),v=Ao(t,"hAlign",p?2:0),g=Ao(t,"vAlign",0),f=ko({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 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 De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Le(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),no(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 ho(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(ao);return null===i?i=new fo(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)),Da(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 al=Phaser.Utils.Objects.GetFastValue;var ol={};class ll{constructor(t){this.pools=al(t,"pools",ol)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new hl),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=ml(t,r,e,i,n),a=0;a<=vl&&0!==h;a++){if((r+=h)<0){r=0;break}h=ml(t,r,e,i,n)}return a===vl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),yl(t,e,i),t},fl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},ml=function(t,e,i,s,r){var n,h=fl(t,e,r),a=fl(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)},yl=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 bl=Phaser.Utils.Objects.GetValue,xl=Phaser.Utils.Objects.GetValue;class Cl extends Ah{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=xl(e,"background",void 0),r=xl(e,"icon",void 0),n=xl(e,"iconMask",void 0),h=xl(e,"text",void 0),a=xl(e,"action",void 0),o=xl(e,"actionMask",void 0),l=xl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:xl(e,"space.icon",0),top:xl(e,"space.iconTop",0),bottom:xl(e,"space.iconBottom",0),left:xl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:xl(e,"space.icon",0),left:xl(e,"space.iconLeft",0),right:xl(e,"space.iconRight",0),top:xl(e,"space.iconTop",0)});var d=xl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Fh.call(this,r,r,1)),!d){var c=xl(e,"iconSize",void 0);this.setIconSize(xl(e,"iconWidth",c),xl(e,"iconHeight",c))}}if(h){var u=xl(e,"wrapText",!1),p=xl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Uh(t)){case 0:switch("string"==typeof e&&(e=na[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Kh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=na[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,pl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=bl(e,"minWidth",0),s=bl(e,"minHeight",0),r=bl(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 gl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),gl(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=xl(e,"space.text",0),m=xl(e,"expandTextWidth",!1),y=xl(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:xl(e,"space.actionTop",0),bottom:xl(e,"space.actionBottom",0),right:xl(e,"space.actionRight",0)}:{left:xl(e,"space.actionLeft",0),right:xl(e,"space.actionRight",0),bottom:xl(e,"space.actionBottom",0)},d=xl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Fh.call(this,a,a,1)),!d)){var b=xl(e,"actionSize");this.setActionSize(xl(e,"actionWidth",b),xl(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 Sl={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=wl[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 wl={down:0,up:1},Ol=Lh.prototype.add,kl=Lh.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)&&kl.call(this),Ol.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&kl.call(this),this.hasTailSpace=s}else Ol.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Ol.call(this,t,{index:r,proportion:i,expand:!0})}else Ol.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},_l={addButton(t){if(pr(t))for(var e=t,i=0,s=e.length;i=0;i--)Ml.call(this,e[i],t);return this}},Ll=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)}},Dl=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,Ll.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Yl={add(t){return this.buttons.push(t),t._click||(t._click=new wr(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`),Dl.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=$l(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=$l(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const Kl=Phaser.Utils.Objects.IsPlainObject,ql=Phaser.Utils.Objects.GetValue,Zl=Phaser.Display.Align.CENTER;var Ql=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ye.call(this,t),Kl(e)&&(e=ql(o=e,"padding",0),i=ql(o,"key",void 0),s=ql(o,"index",void 0),r=ql(o,"offsetX",0),n=ql(o,"offsetY",0),h=ql(o,"offsetOriginX",0),a=ql(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Zl,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,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,n,h,a,o},td={add(t,e,i){if(pr(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,bh.call(this,t),this}},sd={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&&dd.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)gd.call(this,e[i],t);return this}};const md=Phaser.Utils.Objects.GetValue;class yd extends od{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 Il({parent:this,eventEmitter:md(e,"eventEmitter",this),groupName:md(e,"groupName",void 0),clickConfig:md(e,"click",void 0)}).setButtonsType(e);var s=md(e,"background",void 0),r=md(e,"buttons",void 0);this.buttonsAlign=md(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(yd.prototype,ud,fd,jl,Hl);var bd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},xd=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Cd(t));var i=t[e];return"string"==typeof i&&(i=bd[i]),i},Cd=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Sd=function(){return Array.prototype.reduce.call(arguments,wd,0)},wd=function(t,e){return t+e};const Od=Phaser.Utils.Objects.IsPlainObject,kd=Phaser.Utils.Objects.GetValue,Pd=Phaser.Display.Align.CENTER;var _d=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 Ed(this.sizerChildren,null),bh.call(this,t),this}},Rd={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ed(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},Xd={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=We.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,Ed(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ed(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},zd=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Wd=Phaser.Utils.Objects.IsPlainObject,Bd=Phaser.Utils.Objects.GetValue;class jd extends nh{constructor(t,e,i,s,r,n,h,a,o,l){Wd(e)?(e=Bd(l=e,"x",0),i=Bd(l,"y",0),s=Bd(l,"width",void 0),r=Bd(l,"height",void 0),n=Bd(l,"column",l.col||0),h=Bd(l,"row",0),a=Bd(l,"columnProportions",0),o=Bd(l,"rowProportions",0)):Wd(s)?(s=Bd(l=s,"width",void 0),r=Bd(l,"height",void 0),n=Bd(l,"column",l.col||0),h=Bd(l,"row",0),a=Bd(l,"columnProportions",0),o=Bd(l,"rowProportions",0)):Wd(n)?(n=Bd(l=n,"column",l.col||0),h=Bd(l,"row",0),a=Bd(l,"columnProportions",0),o=Bd(l,"rowProportions",0)):Wd(a)&&(a=Bd(l=a,"columnProportions",0),o=Bd(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Bd(l,"createCellContainerCallback")),this.setIndentLeft(Bd(l,"space.indentLeftOdd",0),Bd(l,"space.indentLeftEven",0)),this.setIndentTop(Bd(l,"space.indentTopOdd",0),Bd(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Bd(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=Ad.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=zd.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(jd.prototype,Xd);const Id=Phaser.Utils.Objects.GetValue;var Fd=Phaser.Renderer.WebGL.Utils,Hd=function(t,e,i,s,r,n){for(var h=Fd.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+")"},$d=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 Jd=Phaser.Renderer.Canvas.SetTransform;var Kd={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Vd(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&&Hd(r,h,e,l,a,o),e.isStroked&&Nd(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(Jd(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(Zd.prototype,Kd);var Qd=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 ec=Phaser.Math.DegToRad;var ic=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,iu=Phaser.Utils.Objects.IsPlainObject;class su extends(Tc(xc)){constructor(t,e,i,s,r,n,h,a){iu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):iu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):iu(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 Qc).setName("trackFill")).addShape((new Qc).setName("bar")).addShape((new Qc).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 ru={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&&tu(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),tu(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&tu(a,0,0,e,i,t)}};Object.assign(su.prototype,ru);var nu=function(t){return null==t||""===t||0===t.length},hu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(nu(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(nu(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=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,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 Ou(t)?(this.stretchMode.edge=Pu(ku(t,"edge",0)),this.stretchMode.internal=Pu(ku(t,"internal",0))):(t=Pu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Tu.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,Ru=Phaser.Utils.Objects.GetValue,Lu=Phaser.GameObjects;var Du=void 0,Yu=function(t,e){if(Du||(Du={},ei(t).events.once("destroy",(function(){for(var t in Du)Du[t].destroy();Du=void 0}))),!Du.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Lu[e](i)).setOrigin(0),Du[e]=t}return Du[e]};const Xu=Phaser.GameObjects.RenderTexture;class Au extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Mu(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)):Mu(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)):Mu(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)):Mu(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)):Mu(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 c=Ru(d,"leftWidth",void 0),u=Ru(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}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,Eu),i}(Xu,"rexNinePatch")){}var zu={_drawImage:function(t,e,i,s,r,n){var h=Yu(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Yu(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Au.prototype,zu);let Wu=class extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(lu(t,e))return t[e];var i=t.parent;return lu(i,e)?i[e]:void 0}set(t,e,i){return lu(t,e)?t[e]=i:lu(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 Bu=Phaser.Utils.Objects.GetValue;class ju extends Au{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Bu(e,"effects",!0);i&&vu(this,i),this.style=new Wu(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(ju.prototype,uc);const Iu=["alpha","tint","flipX","flipY"];var Fu=function(t,e){if(!e)return t;for(var i=0,s=Iu.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 xp=Phaser.Utils.Objects.GetValue,Cp=Phaser.Math.Distance.Between;class Sp extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=xp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(xp(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(xp(t,"enable",!0)),this.holdThreshold=xp(t,"holdThreshold",50),this.pointerOutReleaseEnable=xp(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 gn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Cp(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&&!ur(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&&!ur(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 wp=Phaser.Utils.Objects.GetValue;class Op{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(wp(t,"value",0)),this.setSpeed(wp(t,"speed",0)),this.setAcceleration(wp(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 kp{constructor(){this.value,this.dir,this.movement=new Op}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 Ep={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Mp=Phaser.Utils.Objects.GetValue;class Rp extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Mp(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Mp(e,"speed",.1)),this.setEnable(Mp(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Mp(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||ur(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 Lp=Phaser.Utils.Objects.GetValue;var Dp=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)?Lp(s,l,void 0):Lp(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=yt(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 yp(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=Lp(r,"position",0);"string"==typeof p&&(p=Yp[p]);var v,g,f=Lp(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Lp(s,"space.slider",void 0))&&(a?f=0:v=Lp(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:Lp(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Lp(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Lp(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Lp(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Lp(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Lp(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Lp(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Lp(s,"scrollDetectionMode");"string"==typeof b&&(b=Xp[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Lp(s,x,!0):Lp(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Tp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,k,P=Lp(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new Rp(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 Yp={right:0,left:1,bottom:0,top:1},Xp={gameObject:0,rectBounds:1},Ap=Phaser.Utils.Objects.GetValue;var zp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Ap(e,"width"),h=Ap(e,"height");n||Ap(e,"child.expandWidth",!0)||(s[1]=0),h||Ap(e,"child.expandHeight",!0)||(r[1]=0);var a=new jd(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Id(i,"child"),r=Id(s,"gameObject",void 0);if(r){var n=Id(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=Id(n,"top",0),h.bottom=Id(n,"bottom",0),a.left=Id(n,"left",0),a.right=Id(n,"right",0);break;case 1:h.top=Id(n,"left",0),h.bottom=Id(n,"right",0),a.top=Id(n,"top",0),a.bottom=Id(n,"bottom",0);break;default:h.top=Id(n,"top",0),h.bottom=Id(n,"bottom",0),h.left=Id(n,"left",0),h.right=Id(n,"right",0)}e.add(r,{column:1,row:1,align:Id(s,"align","center"),padding:a,expand:{width:Id(s,"expandWidth",!0),height:Id(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Dp(t,a,"y",e);break;case 1:Dp(t,a,"x",e);break;default:Dp(t,a,"y",e),Dp(t,a,"x",e)}return a},Wp=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)},Bp=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)}},jp=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(av.prototype,sv);const ov=["top","bottom","centerY","center"],lv=["left","right","centerX","center"];var dv=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=ov.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=lv.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 cv=Phaser.Utils.Objects.GetValue;class uv extends Gp{constructor(t,e){void 0===e&&(e={});var i=xd(e),s=cv(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=cv(e,"clampChildOY",!1),s.clampChildOX=cv(e,"clampChildOX",!1);var r,n,h=new av(t,s);switch(t.add.existing(h),i){case 0:r=cv(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=cv(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:cv(e,"align.panel","center")};var a=cv(e,"space",void 0);a&&(a.child=cv(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]),ih(this.childrenMap.child,t),this}}var pv={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:dv.call(this,t,"y",e);break;case 1:dv.call(this,t,"x",e);break;default:dv.call(this,t,"y",e),dv.call(this,t,"x",e)}return this}};Object.assign(uv.prototype,pv);const vv=Phaser.Utils.Objects.GetValue;var gv=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=fv(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=mv(e,this.listCreateSliderTrackCallback),v=mv(e,this.listCreateSliderThumbCallback);d=new uv(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:vv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=fv(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},fv=function(t,e,i){var s;return i?(e.orientation="x",s=new yd(t,e)):(e.orientation="y",s=new Nl(t,e)),t.add.existing(s),s},mv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},yv=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 Cv={down:0,up:1},Sv=Phaser.Utils.Objects.GetValue;class wv extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ri(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 Ei(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),xv(t,e),t.isRexSizer&&t.layout();var i=Sv(e,"touchOutsideClose",!1),s=Sv(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&&ir(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 Ov={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}},kv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=gv.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 wv(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(kv,Sl,Ov);const Pv=Phaser.Utils.Objects.GetValue;class _v extends Cl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(Pv(e,"options"));var i=Pv(e,"list");this.setWrapEnable(Pv(i,"wrap",!1)),this.setCreateButtonCallback(Pv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(Pv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(Pv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(Pv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(Pv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(Pv(i,"scroller")),this.setListMouseWheelScrollerConfig(Pv(i,"mouseWheelScroller")),this.setButtonClickCallback(Pv(i,"onButtonClick")),this.setButtonOverCallback(Pv(i,"onButtonOver")),this.setButtonOutCallback(Pv(i,"onButtonOut")),this.setListExpandDirection(Pv(i,"expandDirection")),this.setListEaseInDuration(Pv(i,"easeIn",500)),this.setListEaseOutDuration(Pv(i,"easeOut",100)),this.setListTransitInCallback(Pv(i,"transitIn")),this.settListTransitOutCallback(Pv(i,"transitOut")),this.setListMaxHeight(Pv(i,"maxHeight",0)),this.setListSize(Pv(i,"width"),Pv(i,"height",0)),this.setListAlignmentMode(Pv(i,"alignParent","text")),this.setListAlignmentSide(Pv(i,"alignSide","")),this.setListBounds(Pv(i,"bounds")),this.setListSpace(Pv(i,"space")),this.setListDraggable(Pv(i,"draggable",!1)),this.setValueChangeCallback(Pv(e,"setValueCallback"),Pv(e,"setValueCallbackScope")),this.setValue(Pv(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(_v.prototype,kv);const Tv=Phaser.GameObjects.Text,Ev=Phaser.Utils.Objects.GetValue;class Mv extends Tv{constructor(t,e){void 0===e&&(e={}),super(t,Ev(e,"x",0),Ev(e,"y",0),Ev(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(Mv.prototype,uc);var Rv=Phaser.Renderer.WebGL.Utils,Lv={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=Rv.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 Dv=Phaser.Display.Canvas.CanvasPool;e();const Yv=Phaser.GameObjects.GameObject;class Xv extends Yv{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=Dv.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 Dv.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}},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 Me=/(\S+)\[(\d+)\]/i,Re=Phaser.Utils.Objects.GetValue;var Le=function(t,e){return void 0===e?t:t[e]},De=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=Re(e,"left",0),t.right=Re(e,"right",0),t.top=Re(e,"top",0),t.bottom=Re(e,"bottom",0)),t},Ye={getInnerPadding(t){return Le(this.space,t)},setInnerPadding(t,e){return De(this.space,t,e),this},getOuterPadding(t){return Le(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return De(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e,i),this}},Ae=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}},Xe=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},We=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}},Be=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},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}},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?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==xi&&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=xi):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case xi:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,xi=-1;class Ci extends ci{constructor(t,e){super(t,e),this.timer=new gi}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 Si=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Tweens.Builders.GetEaseFunction;class ki extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(Si(t,"timer")),this.setEnable(Si(t,"enable",!0)),this.setTarget(Si(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Si(t,"ease","Linear")),this.setRepeat(Si(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=Oi(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 Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let Ei=class extends ki{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Mi[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=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 Mi={stop:0,destroy:1,yoyo:2};var Ri=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 Ei(t,a):r.resetFromJSON(a),r.restart(),r},Li=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 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 Ei(t,h):n.resetFromJSON(h),n.restart(),n},Di=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Yi=function(t){return Di(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Xi={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(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(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),Yi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(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=Li(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),Yi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Yi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(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 Ei(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),Yi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Xi),zi.onInitScale=function(){Xi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Ii extends ki{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(Bi(t,"start",this.parent.alpha),Bi(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=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Gi=function(t,e,i,s){var r,n;Hi(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},Ni=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 Vi=Phaser.Utils.Objects.IsPlainObject;var Ui={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=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Yi(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=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Yi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Yi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ui),$i.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ji=Phaser.Utils.Objects.GetValue,Ki=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Zi extends ki{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ki(t,"x",void 0),i=Ki(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=Ki(i,"startX",void 0),this.startY=Ki(i,"startY",void 0),this.endX=Ki(i,"endX",void 0),this.endY=Ki(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=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(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 ts=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 es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={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(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(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 Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=ts(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=ts(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(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),Yi(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),Yi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(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 Zi&&(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=ts(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=ts(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(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),Yi(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),Yi(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}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class hs extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(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=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[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=ns(i,"magnitude",void 0),t=ns(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 as={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new hs(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),Yi(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends ki{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(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]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{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 vs(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(gs(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(gs(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 ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(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),Di(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}},ys=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 zs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(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}},Ws={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}},Bs={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}},js={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,zs,Ws,Bs,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Xs(this,{eventEmitter:!1,initState:Fs(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(Hs.prototype,Is);var Gs=function(t){if(t.parentContainer)return Gs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Gs(e):t};class Ns extends si{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=Gs(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 Vs=Phaser.GameObjects.Rectangle;class Us extends Vs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ns(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const $s=Phaser.Utils.Objects.GetValue;class Js extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(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=Ks[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 Ks={default:0,fullWindow:1};const qs=Phaser.Utils.Objects.GetValue;class Zs extends Us{constructor(t,e){super(t,qs(e,"color",0),qs(e,"alpha",.8)),this.touchEventStop=new Js(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ri(t,e)},scaleDown(t,e){Li(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e,t.alpha)},er=function(t,e){Ni(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(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(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),h=sr(e,"anyTouchClose",!1);sr(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),sr(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&&ir(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=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var hr=function(t){return t&&"function"==typeof t},ar={modal(t,e){return hr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(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}},or=function(t,e,i,s,r){hr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={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 or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(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 Or={press:0,pointerdown:0,release:1,pointerup:1};var kr={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 wr(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}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(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 Tr.length=0,!0;return Tr.length=0,!1},Tr=[];const Er=Phaser.Utils.Objects.GetValue;class Mr extends si{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=Rr[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?Pr:ur)(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 Rr={press:0,pointerdown:0,release:1,pointerup:1};var Lr={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 Mr(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 Dr extends As{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 Yr=Phaser.Utils.Objects.GetValue;class Ar extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Dr,this.parent.setInteractive(Yr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Yr(t,"enable",!0)),this.setCooldown(Yr(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 Xr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ur(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 Ar(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 Ar(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}},Wr=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=tn,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===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,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=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class hn 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=an},eventEmitter:!1};this.setRecongizedStateObject(new As(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case an:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln: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=ln))}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=an):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=an)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=an)}get isTapped(){return this.state===ln}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 an="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;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,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=un},eventEmitter:!1};this.setRecongizedStateObject(new As(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=vn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=vn)}get isPressed(){return this.state===vn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",vn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var gn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var yn={getDt:function(){return gn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(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 mn(e.x,e.y,t.x,t.y)}},bn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},xn={};const Cn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Math.RadToDeg;class wn 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=On},eventEmitter:!1};this.setRecongizedStateObject(new As(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=kn}onDragEnd(){this.state=On}onDrag(){this.state===kn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=On)}get isSwiped(){return this.state===Pn}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=bn[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}}(Sn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(wn.prototype,yn);const On="IDLE",kn="BEGIN",Pn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Tn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,Mn=Phaser.Math.Angle.Between;class Rn{constructor(t,e){var i=Ze(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(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=Dn,this.pointers.length=0,mt(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,mt(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 Dn:this.tracerState=Yn,this.onDrag1Start();break;case Yn:this.tracerState=An,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],Tn(this.pointers,e),this.tracerState){case Yn:this.tracerState=Dn,this.onDrag1End();break;case An:this.tracerState=Yn,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 Yn:this.onDrag1();break;case An:this.onDrag2()}}}dragCancel(){return this.tracerState===An&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Dn,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!==An)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!==An)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(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;Ln.x=e.x-i.x,Ln.y=e.y-i.y}else Ln.x=0,Ln.y=0;return Ln}get centerX(){if(this.tracerState!==An)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==An)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==An)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!==An)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=Xn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Rn.prototype,Je);var Ln={};const Dn=0,Yn=1,An=2,Xn="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var Wn=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},Bn={};const jn=Phaser.Utils.Objects.GetValue,In=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Gn=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=Bn),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=In(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=In(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Gn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Nn);const Vn="IDLE",Un="BEGIN",$n="RECOGNIZED",Jn=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=Jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new hn(this,e),this._tap.on("tap",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=qn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var th=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 wn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Br(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const eh=Phaser.Utils.Objects.GetValue;var ih=function(t,e){return t.setInteractive(),eh(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:eh(e,"targets",[t]),targetMode:eh(e,"targetMode","parent"),eventEmitter:eh(e,"eventEmitter",t),eventNamePrefix:eh(e,"inputEventPrefix","child.")},Ir.call(t,e),Gr.call(t,e),Ur.call(t,e),qr.call(t,e),Kn.call(t,e),Zn.call(t,e),th.call(t,e),t},sh={getSizerConfig:function(t){return void 0===t&&(t=this),Rt(t)},getChildPrevState:function(t){var e=Rt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Yt(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=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(h=le(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(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)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var 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 uh=Phaser.Utils.Objects.IsPlainObject,ph=Phaser.Utils.Objects.GetValue,vh=Phaser.Display.Align.CENTER,gh={min:0,full:-1};var fh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;ye.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=gh[e];else if(uh(e)){var f;e=ph(f=e,"proportion",void 0),i=ph(f,"align",vh),s=ph(f,"padding",0),r=ph(f,"expand",!1),n=ph(f,"key",void 0),h=ph(f,"index",void 0),t.isRexSizer||(a=ph(f,"minWidth",void 0),o=ph(f,"minHeight",void 0)),l=ph(f,"fitRatio",0),d=ph(f,"offsetX",0),c=ph(f,"offsetY",0),u=ph(f,"offsetOriginX",0),p=ph(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=vh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?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),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,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},mh={add:fh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fh.call(this,new dh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return uh(i)&&(i.index=t),fh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ch.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const yh=Mt.prototype.clear;var bh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),yh.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,bh.call(this,t),this}},Sh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[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}},Oh={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}},Ph={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&&(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,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.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)||Xe.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Be.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oh.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],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,mh,Ch,Sh,wh,Oh,kh);var _h=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},Eh=function(t){return"string"==typeof t&&(t=Th[t]),t};const Mh=Phaser.Utils.Objects.IsPlainObject,Rh=Phaser.Utils.Objects.GetValue;class Lh extends nh{constructor(t,e,i,s,r,n,h){Mh(e)?(e=Rh(h=e,"x",0),i=Rh(h,"y",0),s=Rh(h,"width",void 0),r=Rh(h,"height",void 0),n=Rh(h,"orientation",0)):Mh(s)?(s=Rh(h=s,"width",void 0),r=Rh(h,"height",void 0),n=Rh(h,"orientation",0)):Mh(n)&&(n=Rh(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(Rh(h,"space.item",0)),this.setStartChildIndex(Rh(h,"startChildIndex",0)),this.setRTL(Rh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Eh(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=_h.call(this)),this._childrenProportion}}Object.assign(Lh.prototype,Ph);var Dh=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}},Yh=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},Ah={appendText:Yh,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 Xh extends Lh{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&&(Dh(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&&(Dh(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&&Dh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Dh(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(Xh.prototype,Ah);var zh=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)},Wh=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 Bh=Phaser.GameObjects.Graphics;class jh extends Bh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Ih[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=fe(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=fe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Wh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&yt(i,this.padding),this.originX=s.originX,this.originY=s.originY,zh.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,zh.call(this,this.width,this.height,this.padding,t,e)),this}}const Ih={rectangle:0,circle:1};var Fh=function(t,e,i,s){var r=new jh(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 Hh=Phaser.GameObjects.Text;var Gh=function(t){return t instanceof Hh};const Nh=Phaser.GameObjects.BitmapText;var Vh=function(t){return t instanceof Nh},Uh=function(t){return Vh(t)?2:Gh(t)?0:1},$h=/^[\x00-\x7F]+$/,Jh=function(t){return $h.test(t)},Kh=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},Zh=0,Qh=1,ta=2,ea=0,ia=1,sa=2,ra=/(?:\r\n|\r|\n)/;const na={none:ea,word:ia,char:sa,character:sa,mix:3},ha=Phaser.Renderer.WebGL.Utils;var aa={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=ha.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 oa=Phaser.Display.Color;var la={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 oa);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}},da=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)},ca={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,da(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 ua=Phaser.Display.Canvas.CanvasPool,pa=Phaser.GameObjects.GameObject,va=Phaser.Utils.String.UUID;class ga extends pa{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=ua.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=va(),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(){ua.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 fa=Phaser.GameObjects.Components;Phaser.Class.mixin(ga,[fa.Alpha,fa.BlendMode,fa.Crop,fa.Depth,fa.Flip,fa.GetBounds,fa.Mask,fa.Origin,fa.Pipeline,fa.PostPipeline,fa.ScrollFactor,fa.Tint,fa.Transform,fa.Visible,aa,la,ca]);var ma={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:Ms(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&&mt(this.data),this}};class ya{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(ya.prototype,ma);var ba={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 xa=Phaser.Math.RotateAround;var Ca;const Sa=Phaser.Geom.Rectangle;var wa,Oa=function(t){void 0===wa&&(wa=new Sa);var e=t.drawTLX,i=t.drawTLY;return wa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),wa};const ka=Phaser.Math.RotateAround;var Pa,_a=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Pa&&(Pa={}),s=Pa),s.x=e,s.y=i,0!==t.rotation&&ka(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Ta=Phaser.GameObjects.Components.TransformMatrix;var Ea,Ma,Ra={},La=function(t,e,i,s,r){var n=_a(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ra);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ea&&(Ea=new Ta,Ma=new Ta),t.parentContainer?t.getWorldTransformMatrix(Ea,Ma):Ea.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ea.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Da=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 La(t,e,n,h,r)},Ya={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&&xa(s,0,0,-i.rotation),s}(t,e,this,!0);return Oa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Da(this.parent,this,t,e,i)}};Object.assign(Ya,ba);const Aa=Phaser.Math.DegToRad,Xa=Phaser.Math.RadToDeg,za=Phaser.Utils.Objects.GetValue;class Wa extends ya{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 Xa(this._rotation)}set angle(t){this.rotation=Aa(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=za(t,"width",void 0),i=za(t,"height",void 0),s=za(t,"scaleX",void 0),r=za(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(Wa.prototype,Ya);const Ba=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`#${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}},Ia=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Fa=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=Fa(t,"x",0),i=Fa(t,"y",0));var s=this.cornerRadius;s.tl=Ga(Fa(t,"tl",void 0),e,i),s.tr=Ga(Fa(t,"tr",void 0),e,i),s.bl=Ga(Fa(t,"bl",void 0),e,i),s.br=Ga(Fa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Na(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Na(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Na(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Na(this.cornerRadius.br,t)}};var Ga=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Va(t),t},Na=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Fa(e,"x",0),t.y=Fa(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)};const Ua=Phaser.Math.DegToRad;var $a=function(t){return!t.hasOwnProperty("convex")||t.convex},Ja=function(t){return t.x>0&&t.y>0},Ka=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,$a(a)?Ka(t,o,l,o,l,180,270,!1,h):Ka(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,$a(a)?Ka(t,s-o,l,o,l,270,360,!1,h):Ka(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,$a(a)?Ka(t,s-o,r-l,o,l,0,90,!1,h):Ka(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,$a(a)?Ka(t,o,r-l,o,l,90,180,!1,h):Ka(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())},Za=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),qa(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Qa=Phaser.Utils.Objects.GetValue;class to extends Wa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Qa(e,"color",null),Qa(e,"color2",null),Qa(e,"horizontalGradient",!0)),this.setStroke(Qa(e,"stroke",null),Qa(e,"strokeThickness",2)),this.setCornerRadius(Qa(e,"cornerRadius",0),Qa(e,"cornerIteration",null))}set color(t){t=ja(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ja(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=ja(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,Ia("color2",t,this),Ia("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ia("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ia("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(){Za(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const eo=Phaser.Utils.Objects.GetValue;class io extends Wa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(eo(e,"color",null),eo(e,"color2",null),eo(e,"horizontalGradient",!0)),this.setStroke(eo(e,"stroke",null),eo(e,"strokeThickness",2))}set color(t){t=ja(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ja(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=ja(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,eo(t,"color2",null),eo(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,eo(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 so=Phaser.Utils.Objects.GetValue;let ro=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(so(t,"bold",!1)),this.setItalic(so(t,"italic",!1)),this.setFontSize(so(t,"fontSize","16px")),this.setFontFamily(so(t,"fontFamily","Courier")),this.setColor(so(t,"color","#fff")),this.setStrokeStyle(so(t,"stroke",null),so(t,"strokeThickness",0)),this.setShadow(so(t,"shadowColor",null),so(t,"shadowOffsetX",0),so(t,"shadowOffsetY",0),so(t,"shadowBlur",0)),this.setOffset(so(t,"offsetX",0),so(t,"offsetY",0)),this.setSpace(so(t,"leftSpace",0),so(t,"rightSpace",0)),this.setAlign(so(t,"align",void 0)),this.setBackgroundColor(so(t,"backgroundColor",null)),this.setBackgroundHeight(so(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(so(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(Ia("stroke",t,this),Ia("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ia("shadowOffsetX",t,this),Ia("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=ja(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ja(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=ja(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=ja(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 no=Phaser.Utils.Array.Remove,ho=Phaser.Utils.Array.Remove,ao="text",oo="image",lo="drawer",co="space",uo="command";var po=function(t){return t.type===ao&&"\n"===t.text},vo=function(t){return t.type===ao&&"\f"===t.text},go=function(t){return t.type===ao};class fo extends Wa{constructor(t,e,i){super(t,ao),this.updateTextFlag=!1,this.style=new ro(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 mo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const yo=Phaser.Display.Canvas.CanvasPool;var bo=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=yo.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),yo.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 xo extends Wa{constructor(t,e,i){super(t,oo),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(){bo(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 Wa{constructor(t,e,i,s){super(t,lo),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 So extends Wa{constructor(t,e){super(t,co),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 wo extends ya{constructor(t,e,i,s,r){super(t,uo),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 ko=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 _o=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=Ro.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Ro.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Do(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Do(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Do(t,"wrapMode");void 0===c&&(c=Do(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Po[c]);var u=Do(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Do(t,"letterSpacing",0),v=Do(t,"hAlign",0),g=Do(t,"vAlign",0),f=Do(t,"justifyPercentage",.25),m=ko({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=Xo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Xo(t,"maxLines",0);var a=0===i,o=Xo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Xo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Xo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Xo(t,"letterSpacing",0),p=Xo(t,"rtl",!0),v=Xo(t,"hAlign",p?2:0),g=Xo(t,"vAlign",0),f=ko({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 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 De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Le(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),no(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 ho(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(ao);return null===i?i=new fo(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)),Da(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 al=Phaser.Utils.Objects.GetFastValue;var ol={};class ll{constructor(t){this.pools=al(t,"pools",ol)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new hl),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=ml(t,r,e,i,n),a=0;a<=vl&&0!==h;a++){if((r+=h)<0){r=0;break}h=ml(t,r,e,i,n)}return a===vl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),yl(t,e,i),t},fl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},ml=function(t,e,i,s,r){var n,h=fl(t,e,r),a=fl(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)},yl=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 bl=Phaser.Utils.Objects.GetValue,xl=Phaser.Utils.Objects.GetValue;class Cl extends Xh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=xl(e,"background",void 0),r=xl(e,"icon",void 0),n=xl(e,"iconMask",void 0),h=xl(e,"text",void 0),a=xl(e,"action",void 0),o=xl(e,"actionMask",void 0),l=xl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:xl(e,"space.icon",0),top:xl(e,"space.iconTop",0),bottom:xl(e,"space.iconBottom",0),left:xl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:xl(e,"space.icon",0),left:xl(e,"space.iconLeft",0),right:xl(e,"space.iconRight",0),top:xl(e,"space.iconTop",0)});var d=xl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Fh.call(this,r,r,1)),!d){var c=xl(e,"iconSize",void 0);this.setIconSize(xl(e,"iconWidth",c),xl(e,"iconHeight",c))}}if(h){var u=xl(e,"wrapText",!1),p=xl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Uh(t)){case 0:switch("string"==typeof e&&(e=na[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Kh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=na[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,pl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=bl(e,"minWidth",0),s=bl(e,"minHeight",0),r=bl(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 gl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),gl(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=xl(e,"space.text",0),m=xl(e,"expandTextWidth",!1),y=xl(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:xl(e,"space.actionTop",0),bottom:xl(e,"space.actionBottom",0),right:xl(e,"space.actionRight",0)}:{left:xl(e,"space.actionLeft",0),right:xl(e,"space.actionRight",0),bottom:xl(e,"space.actionBottom",0)},d=xl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Fh.call(this,a,a,1)),!d)){var b=xl(e,"actionSize");this.setActionSize(xl(e,"actionWidth",b),xl(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 Sl={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=wl[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 wl={down:0,up:1},Ol=Lh.prototype.add,kl=Lh.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)&&kl.call(this),Ol.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&kl.call(this),this.hasTailSpace=s}else Ol.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Ol.call(this,t,{index:r,proportion:i,expand:!0})}else Ol.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},_l={addButton(t){if(pr(t))for(var e=t,i=0,s=e.length;i=0;i--)Ml.call(this,e[i],t);return this}},Ll=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)}},Dl=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,Ll.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Yl={add(t){return this.buttons.push(t),t._click||(t._click=new wr(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`),Dl.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=$l(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=$l(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const Kl=Phaser.Utils.Objects.IsPlainObject,ql=Phaser.Utils.Objects.GetValue,Zl=Phaser.Display.Align.CENTER;var Ql=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ye.call(this,t),Kl(e)&&(e=ql(o=e,"padding",0),i=ql(o,"key",void 0),s=ql(o,"index",void 0),r=ql(o,"offsetX",0),n=ql(o,"offsetY",0),h=ql(o,"offsetOriginX",0),a=ql(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Zl,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,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,n,h,a,o},td={add(t,e,i){if(pr(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,bh.call(this,t),this}},sd={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&&dd.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)gd.call(this,e[i],t);return this}};const md=Phaser.Utils.Objects.GetValue;class yd extends od{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 Il({parent:this,eventEmitter:md(e,"eventEmitter",this),groupName:md(e,"groupName",void 0),clickConfig:md(e,"click",void 0)}).setButtonsType(e);var s=md(e,"background",void 0),r=md(e,"buttons",void 0);this.buttonsAlign=md(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(yd.prototype,ud,fd,jl,Hl);var bd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},xd=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Cd(t));var i=t[e];return"string"==typeof i&&(i=bd[i]),i},Cd=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Sd=function(){return Array.prototype.reduce.call(arguments,wd,0)},wd=function(t,e){return t+e};const Od=Phaser.Utils.Objects.IsPlainObject,kd=Phaser.Utils.Objects.GetValue,Pd=Phaser.Display.Align.CENTER;var _d=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 Ed(this.sizerChildren,null),bh.call(this,t),this}},Rd={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ed(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},Ad={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=We.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,Ed(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ed(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},zd=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Wd=Phaser.Utils.Objects.IsPlainObject,Bd=Phaser.Utils.Objects.GetValue;class jd extends nh{constructor(t,e,i,s,r,n,h,a,o,l){Wd(e)?(e=Bd(l=e,"x",0),i=Bd(l,"y",0),s=Bd(l,"width",void 0),r=Bd(l,"height",void 0),n=Bd(l,"column",l.col||0),h=Bd(l,"row",0),a=Bd(l,"columnProportions",0),o=Bd(l,"rowProportions",0)):Wd(s)?(s=Bd(l=s,"width",void 0),r=Bd(l,"height",void 0),n=Bd(l,"column",l.col||0),h=Bd(l,"row",0),a=Bd(l,"columnProportions",0),o=Bd(l,"rowProportions",0)):Wd(n)?(n=Bd(l=n,"column",l.col||0),h=Bd(l,"row",0),a=Bd(l,"columnProportions",0),o=Bd(l,"rowProportions",0)):Wd(a)&&(a=Bd(l=a,"columnProportions",0),o=Bd(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Bd(l,"createCellContainerCallback")),this.setIndentLeft(Bd(l,"space.indentLeftOdd",0),Bd(l,"space.indentLeftEven",0)),this.setIndentTop(Bd(l,"space.indentTopOdd",0),Bd(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Bd(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=Xd.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=zd.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(jd.prototype,Ad);const Id=Phaser.Utils.Objects.GetValue;var Fd=Phaser.Renderer.WebGL.Utils,Hd=function(t,e,i,s,r,n){for(var h=Fd.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+")"},$d=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 Jd=Phaser.Renderer.Canvas.SetTransform;var Kd={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Vd(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&&Hd(r,h,e,l,a,o),e.isStroked&&Nd(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(Jd(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(Zd.prototype,Kd);var Qd=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 ec=Phaser.Math.DegToRad;var ic=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,iu=Phaser.Utils.Objects.IsPlainObject;class su extends(Tc(xc)){constructor(t,e,i,s,r,n,h,a){iu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):iu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):iu(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 Qc).setName("trackFill")).addShape((new Qc).setName("bar")).addShape((new Qc).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 ru={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&&tu(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),tu(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&tu(a,0,0,e,i,t)}};Object.assign(su.prototype,ru);var nu=function(t){return null==t||""===t||0===t.length},hu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(nu(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(nu(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=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,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 Ou(t)?(this.stretchMode.edge=Pu(ku(t,"edge",0)),this.stretchMode.internal=Pu(ku(t,"internal",0))):(t=Pu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Tu.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,Ru=Phaser.Utils.Objects.GetValue,Lu=Phaser.GameObjects;var Du=void 0,Yu=function(t,e){if(Du||(Du={},ei(t).events.once("destroy",(function(){for(var t in Du)Du[t].destroy();Du=void 0}))),!Du.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Lu[e](i)).setOrigin(0),Du[e]=t}return Du[e]};const Au=Phaser.GameObjects.RenderTexture;class Xu extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Mu(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)):Mu(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)):Mu(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)):Mu(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)):Mu(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 c=Ru(d,"leftWidth",void 0),u=Ru(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}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,Eu),i}(Au,"rexNinePatch")){}var zu={_drawImage:function(t,e,i,s,r,n){var h=Yu(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Yu(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Xu.prototype,zu);let Wu=class extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(lu(t,e))return t[e];var i=t.parent;return lu(i,e)?i[e]:void 0}set(t,e,i){return lu(t,e)?t[e]=i:lu(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 Bu=Phaser.Utils.Objects.GetValue;class ju extends Xu{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Bu(e,"effects",!0);i&&vu(this,i),this.style=new Wu(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(ju.prototype,uc);const Iu=["alpha","tint","flipX","flipY"];var Fu=function(t,e){if(!e)return t;for(var i=0,s=Iu.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 xp=Phaser.Utils.Objects.GetValue,Cp=Phaser.Math.Distance.Between;class Sp extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=xp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(xp(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(xp(t,"enable",!0)),this.holdThreshold=xp(t,"holdThreshold",50),this.pointerOutReleaseEnable=xp(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 gn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Cp(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&&!ur(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&&!ur(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 wp=Phaser.Utils.Objects.GetValue;class Op{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(wp(t,"value",0)),this.setSpeed(wp(t,"speed",0)),this.setAcceleration(wp(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 kp{constructor(){this.value,this.dir,this.movement=new Op}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 Ep={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Mp=Phaser.Utils.Objects.GetValue;class Rp extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Mp(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Mp(e,"speed",.1)),this.setEnable(Mp(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Mp(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||ur(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 Lp=Phaser.Utils.Objects.GetValue;var Dp=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)?Lp(s,l,void 0):Lp(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=yt(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 yp(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=Lp(r,"position",0);"string"==typeof p&&(p=Yp[p]);var v,g,f=Lp(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Lp(s,"space.slider",void 0))&&(a?f=0:v=Lp(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:Lp(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Lp(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Lp(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Lp(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Lp(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Lp(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Lp(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Lp(s,"scrollDetectionMode");"string"==typeof b&&(b=Ap[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Lp(s,x,!0):Lp(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Tp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,k,P=Lp(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new Rp(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 Yp={right:0,left:1,bottom:0,top:1},Ap={gameObject:0,rectBounds:1},Xp=Phaser.Utils.Objects.GetValue;var zp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Xp(e,"width"),h=Xp(e,"height");n||Xp(e,"child.expandWidth",!0)||(s[1]=0),h||Xp(e,"child.expandHeight",!0)||(r[1]=0);var a=new jd(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Id(i,"child"),r=Id(s,"gameObject",void 0);if(r){var n=Id(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=Id(n,"top",0),h.bottom=Id(n,"bottom",0),a.left=Id(n,"left",0),a.right=Id(n,"right",0);break;case 1:h.top=Id(n,"left",0),h.bottom=Id(n,"right",0),a.top=Id(n,"top",0),a.bottom=Id(n,"bottom",0);break;default:h.top=Id(n,"top",0),h.bottom=Id(n,"bottom",0),h.left=Id(n,"left",0),h.right=Id(n,"right",0)}e.add(r,{column:1,row:1,align:Id(s,"align","center"),padding:a,expand:{width:Id(s,"expandWidth",!0),height:Id(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Dp(t,a,"y",e);break;case 1:Dp(t,a,"x",e);break;default:Dp(t,a,"y",e),Dp(t,a,"x",e)}return a},Wp=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)},Bp=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)}},jp=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(av.prototype,sv);const ov=["top","bottom","centerY","center"],lv=["left","right","centerX","center"];var dv=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=ov.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=lv.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 cv=Phaser.Utils.Objects.GetValue;class uv extends Gp{constructor(t,e){void 0===e&&(e={});var i=xd(e),s=cv(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=cv(e,"clampChildOY",!1),s.clampChildOX=cv(e,"clampChildOX",!1);var r,n,h=new av(t,s);switch(t.add.existing(h),i){case 0:r=cv(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=cv(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:cv(e,"align.panel","center")};var a=cv(e,"space",void 0);a&&(a.child=cv(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]),ih(this.childrenMap.child,t),this}}var pv={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:dv.call(this,t,"y",e);break;case 1:dv.call(this,t,"x",e);break;default:dv.call(this,t,"y",e),dv.call(this,t,"x",e)}return this}};Object.assign(uv.prototype,pv);const vv=Phaser.Utils.Objects.GetValue;var gv=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=fv(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=mv(e,this.listCreateSliderTrackCallback),v=mv(e,this.listCreateSliderThumbCallback);d=new uv(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:vv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=fv(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},fv=function(t,e,i){var s;return i?(e.orientation="x",s=new yd(t,e)):(e.orientation="y",s=new Nl(t,e)),t.add.existing(s),s},mv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},yv=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 Cv={down:0,up:1},Sv=Phaser.Utils.Objects.GetValue;class wv extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ri(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 Ei(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),xv(t,e),t.isRexSizer&&t.layout();var i=Sv(e,"touchOutsideClose",!1),s=Sv(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&&ir(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 Ov={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}},kv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=gv.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 wv(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(kv,Sl,Ov);const Pv=Phaser.Utils.Objects.GetValue;class _v extends Cl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(Pv(e,"options"));var i=Pv(e,"list");this.setWrapEnable(Pv(i,"wrap",!1)),this.setCreateButtonCallback(Pv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(Pv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(Pv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(Pv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(Pv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(Pv(i,"scroller")),this.setListMouseWheelScrollerConfig(Pv(i,"mouseWheelScroller")),this.setButtonClickCallback(Pv(i,"onButtonClick")),this.setButtonOverCallback(Pv(i,"onButtonOver")),this.setButtonOutCallback(Pv(i,"onButtonOut")),this.setListExpandDirection(Pv(i,"expandDirection")),this.setListEaseInDuration(Pv(i,"easeIn",500)),this.setListEaseOutDuration(Pv(i,"easeOut",100)),this.setListTransitInCallback(Pv(i,"transitIn")),this.settListTransitOutCallback(Pv(i,"transitOut")),this.setListMaxHeight(Pv(i,"maxHeight",0)),this.setListSize(Pv(i,"width"),Pv(i,"height",0)),this.setListAlignmentMode(Pv(i,"alignParent","text")),this.setListAlignmentSide(Pv(i,"alignSide","")),this.setListBounds(Pv(i,"bounds")),this.setListSpace(Pv(i,"space")),this.setListDraggable(Pv(i,"draggable",!1)),this.setValueChangeCallback(Pv(e,"setValueCallback"),Pv(e,"setValueCallbackScope")),this.setValue(Pv(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(_v.prototype,kv);const Tv=Phaser.GameObjects.Text,Ev=Phaser.Utils.Objects.GetValue;class Mv extends Tv{constructor(t,e){void 0===e&&(e={}),super(t,Ev(e,"x",0),Ev(e,"y",0),Ev(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(Mv.prototype,uc);var Rv=Phaser.Renderer.WebGL.Utils,Lv={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=Rv.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 Dv=Phaser.Display.Canvas.CanvasPool;e();const Yv=Phaser.GameObjects.GameObject;class Av extends Yv{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=Dv.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 Dv.remove(s),i;for(var l=r.getImageData(0,0,h,o).data,d=!1,c=0;c * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Wv=Phaser.Display.Canvas.CanvasPool;var Bv=function(t){var e=Wv.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 Wv.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,Wv.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!==ea&&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=na[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]=Iv(t,l,d);else{var u=jv(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Iv(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Iv(t,"fill",null);null!==v&&(this.color=ja(v));var g=Iv(t,"metrics",!1);return g?this.metrics={ascent:Iv(g,"ascent",0),descent:Iv(g,"descent",0),fontSize:Iv(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Bv(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=Bv(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=Iv(t,"fontFamily","Courier"),this.fontSize=Iv(t,"fontSize","16px"),this.fontStyle=Iv(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=ja(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ja(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=ja(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=ja(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=ja(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=ja(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=ja(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=ja(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=ja(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=ja(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=ja(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=ja(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=na[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=Iv(e,"fontFamily",this.fontFamily),this.fontSize=Iv(e,"fontSize",this.fontSize),this.fontStyle=Iv(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 Hv={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Za(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 C=l;C0){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 Gv=Phaser.Utils.Objects.GetValue,Nv=Zh,Vv=Qh;class Uv{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Gv(t,"text",""),this.x=Gv(t,"x",0),this.y=Gv(t,"y",0),this.width=Gv(t,"width",0);var e=Gv(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Gv(t,"newLineMode",0),this.startIndex=Gv(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Vv&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Nv&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Vv&&(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 $v=Phaser.Utils.Objects.GetFastValue,Jv=Zh,Kv=ta;class qv{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=$v(t,"tagToText",Wt),this.tagToTextScope=$v(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 Zv={};const Qv=Phaser.Geom.Rectangle;var tg=new hl;class eg{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&gg(g)){""!==b?h.push(n.getLine(b,x,og)):0===C&&r>0&&h.push(n.getLine("",0,og)),h.push(...pg(g,e,cg,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,og)),b=g,x=f,o=s):(b+=g,x=m),C===S-1&&h.push(n.getLine(b,x,l))}return h},vg=function(t,e){var i;switch(e){case dg:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==mg&&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 qv({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;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(mf.call(this,-this.textOY)),0),e=yf.call(this,t)+this.textOY,i=bf.call(this,t);return function(t,e){switch(Uh(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,xf.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,Fe.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,Sf.call(this,t,n,h),oe(t,s,r,n,h,e.align),e.preOffsetY=0,xf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Of=Phaser.Utils.Objects.IsPlainObject,kf=Phaser.Utils.Objects.GetValue,Pf=Phaser.Display.Align.TOP_LEFT;class _f extends nh{constructor(t,e,i,s,r,n){Of(e)?(e=kf(n=e,"x",0),i=kf(n,"y",0),s=kf(n,"width",void 0),r=kf(n,"height",void 0)):Of(s)&&(s=kf(n=s,"width",void 0),r=kf(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=kf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(kf(n,"clampTextOY",!0)),this.alwaysScrollable=kf(n,"alwaysScrollable",!1);var h=kf(n,"background",void 0),a=kf(n,"text",void 0);void 0===a&&(a=Tf(t)),this.textCropEnable=kf(n,"textCrop",!!a.setCrop);var o=kf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Pf,l.padding=fe(0),l.expand=!0,this.textObject=a,this.textObjectType=Uh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Fh.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(mf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=yf.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 Tf=function(t){return t.add.text(0,0,"")};Object.assign(_f.prototype,wf);var Ef={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Mf={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 Rf=Phaser.Utils.Objects.GetValue;class Lf extends Gp{constructor(t,e){void 0===e&&(e={});var i=Rf(e,"text",void 0),s=Rf(e,"textWidth",void 0),r=Rf(e,"textHeight",void 0),n=Rf(e,"textCrop",!!i.setCrop),h=Rf(e,"textMask",!n),a=Rf(e,"content",""),o=new _f(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Rf(e,"clampChildOY",!1),alwaysScrollable:Rf(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=Rf(e,"space",void 0);l&&(l.child=Rf(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(Lf.prototype,Ef,Mf);const Df=Phaser.Utils.Objects.GetValue;var Yf=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 vf(t,e);break;case"bbcodetext":case"bbcode":s=new df(t,0,0,"",e);break;case"label":s=new gf(t,e);break;case"textarea":s=function(t,e,i){e=e?Oo(e):{};var s=Df(i,"background",Hu),r=Df(i,"text",Yf),n=Df(i,"track",Hu),h=Df(i,"thumb",Hu);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 Lf(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Mv(t,e)}return Fu(s,e),t.add.existing(s),s},Xf=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 ju(t,e):new yu(t,e);break;case"roundRectangle":s=new pc(t,e);break;default:s=new Su(t,e)}return Fu(s,e),t.add.existing(s),s};const Af=Phaser.Utils.Objects.GetValue;var zf=function(t,e,i){e=e?Oo(e):{};var s=Af(i,"background",Hu),r=Af(i,"text",Yf),n=Af(i,"icon",Xf),h=Af(i,"action",Xf);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},Wf=function(t,e,i){void 0===i&&(i={});var s=(e=e?Oo(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,h=i.button||i.label||i,a=zf(t,s,n);a.list=e.list||{},a.list.createButtonCallback=function(t,e){var i=function(t,e,i){var s=new gf(t,e,i);return t.add.existing(s),s}(t,r,h).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var o=e.track;o&&(a.list.createTrackCallback=function(t){return Hu(t,o)},delete e.track);var l=e.thumb;return l&&(a.list.createThumbCallback=function(t){return Hu(t,l)},delete e.thumb),a.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},a.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},a};return class extends _v{constructor(t,e,i){super(t,e=Wf(t,e,i)),this.type="rexSimpleDropDownList"}setOptions(t){void 0===t&&(t=[]);for(var e=0,i=t.length;eo;d--){for(c=0;c0&&this.wrapMode!==ea&&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=na[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]=Iv(t,l,d);else{var u=jv(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Iv(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Iv(t,"fill",null);null!==v&&(this.color=ja(v));var g=Iv(t,"metrics",!1);return g?this.metrics={ascent:Iv(g,"ascent",0),descent:Iv(g,"descent",0),fontSize:Iv(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Bv(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=Bv(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=Iv(t,"fontFamily","Courier"),this.fontSize=Iv(t,"fontSize","16px"),this.fontStyle=Iv(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=ja(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ja(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=ja(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=ja(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=ja(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=ja(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=ja(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=ja(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=ja(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=ja(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=ja(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=ja(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=na[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=Iv(e,"fontFamily",this.fontFamily),this.fontSize=Iv(e,"fontSize",this.fontSize),this.fontStyle=Iv(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 Hv={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Za(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 C=l;C0){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 Gv=Phaser.Utils.Objects.GetValue,Nv=Zh,Vv=Qh;class Uv{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Gv(t,"text",""),this.x=Gv(t,"x",0),this.y=Gv(t,"y",0),this.width=Gv(t,"width",0);var e=Gv(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Gv(t,"newLineMode",0),this.startIndex=Gv(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Vv&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Nv&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Vv&&(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 $v=Phaser.Utils.Objects.GetFastValue,Jv=Zh,Kv=ta;class qv{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=$v(t,"tagToText",Wt),this.tagToTextScope=$v(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 Zv={};const Qv=Phaser.Geom.Rectangle;var tg=new hl;class eg{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&gg(g)){""!==b?h.push(n.getLine(b,x,og)):0===C&&r>0&&h.push(n.getLine("",0,og)),h.push(...pg(g,e,cg,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,og)),b=g,x=f,o=s):(b+=g,x=m),C===S-1&&h.push(n.getLine(b,x,l))}return h},vg=function(t,e){var i;switch(e){case dg:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==mg&&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 qv({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;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(mf.call(this,-this.textOY)),0),e=yf.call(this,t)+this.textOY,i=bf.call(this,t);return function(t,e){switch(Uh(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,xf.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,Fe.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,Sf.call(this,t,n,h),oe(t,s,r,n,h,e.align),e.preOffsetY=0,xf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Of=Phaser.Utils.Objects.IsPlainObject,kf=Phaser.Utils.Objects.GetValue,Pf=Phaser.Display.Align.TOP_LEFT;class _f extends nh{constructor(t,e,i,s,r,n){Of(e)?(e=kf(n=e,"x",0),i=kf(n,"y",0),s=kf(n,"width",void 0),r=kf(n,"height",void 0)):Of(s)&&(s=kf(n=s,"width",void 0),r=kf(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=kf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(kf(n,"clampTextOY",!0)),this.alwaysScrollable=kf(n,"alwaysScrollable",!1);var h=kf(n,"background",void 0),a=kf(n,"text",void 0);void 0===a&&(a=Tf(t)),this.textCropEnable=kf(n,"textCrop",!!a.setCrop);var o=kf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Pf,l.padding=fe(0),l.expand=!0,this.textObject=a,this.textObjectType=Uh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Fh.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(mf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=yf.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 Tf=function(t){return t.add.text(0,0,"")};Object.assign(_f.prototype,wf);var Ef={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Mf={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 Rf=Phaser.Utils.Objects.GetValue;class Lf extends Gp{constructor(t,e){void 0===e&&(e={});var i=Rf(e,"text",void 0),s=Rf(e,"textWidth",void 0),r=Rf(e,"textHeight",void 0),n=Rf(e,"textCrop",!!i.setCrop),h=Rf(e,"textMask",!n),a=Rf(e,"content",""),o=new _f(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Rf(e,"clampChildOY",!1),alwaysScrollable:Rf(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=Rf(e,"space",void 0);l&&(l.child=Rf(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(Lf.prototype,Ef,Mf);const Df=Phaser.Utils.Objects.GetValue;var Yf=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 vf(t,e);break;case"bbcodetext":case"bbcode":s=new df(t,0,0,"",e);break;case"label":s=new gf(t,e);break;case"textarea":s=function(t,e,i){e=e?Oo(e):{};var s=Df(i,"background",Hu),r=Df(i,"text",Yf),n=Df(i,"track",Hu),h=Df(i,"thumb",Hu);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 Lf(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Mv(t,e)}return Fu(s,e),t.add.existing(s),s},Af=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 ju(t,e):new yu(t,e);break;case"roundRectangle":s=new pc(t,e);break;default:s=new Su(t,e)}return Fu(s,e),t.add.existing(s),s};const Xf=Phaser.Utils.Objects.GetValue;var zf=function(t,e,i){e=e?Oo(e):{};var s=Xf(i,"background",Hu),r=Xf(i,"text",Yf),n=Xf(i,"icon",Af),h=Xf(i,"action",Af);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},Wf=function(t,e,i){void 0===i&&(i={});var s=(e=e?Oo(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,h=i.button||i.label||i,a=zf(t,s,n);a.list=e.list||{},a.list.createButtonCallback=function(t,e){var i=function(t,e,i){var s=new gf(t,e,i);return t.add.existing(s),s}(t,r,h).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var o=e.track;o&&(a.list.createTrackCallback=function(t){return Hu(t,o)},delete e.track);var l=e.thumb;return l&&(a.list.createThumbCallback=function(t){return Hu(t,l)},delete e.thumb),a.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},a.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},a};return class extends _v{constructor(t,e,i){super(t,e=Wf(t,e,i)),this.type="rexSimpleDropDownList"}setOptions(t){void 0===t&&(t=[]);for(var e=0,i=t.length;e * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const kc=Phaser.Display.Canvas.CanvasPool;var Ec=function(t){var e=kc.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 kc.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,kc.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!==Jh&&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=Qh[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]=Rc(t,l,d);else{var u=Mc(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Rc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Rc(t,"fill",null);null!==v&&(this.color=Ya(v));var g=Rc(t,"metrics",!1);return g?this.metrics={ascent:Rc(g,"ascent",0),descent:Rc(g,"descent",0),fontSize:Rc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Ec(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=Ec(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=Rc(t,"fontFamily","Courier"),this.fontSize=Rc(t,"fontSize","16px"),this.fontStyle=Rc(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=Ya(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Ya(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Ya(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=Ya(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Ya(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=Ya(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=Ya(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=Ya(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=Ya(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=Ya(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=Ya(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=Ya(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=Qh[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=Rc(e,"fontFamily",this.fontFamily),this.fontSize=Rc(e,"fontSize",this.fontSize),this.fontStyle=Rc(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 Dc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Va(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 w=l;w0){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 Yc=Phaser.Utils.Objects.GetValue,Ac=Vh,Xc=Uh;class zc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Yc(t,"text",""),this.x=Yc(t,"x",0),this.y=Yc(t,"y",0),this.width=Yc(t,"width",0);var e=Yc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Yc(t,"newLineMode",0),this.startIndex=Yc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Xc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Ac&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Xc&&(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 Wc=Phaser.Utils.Objects.GetFastValue,Fc=Vh,jc=$h;class Ic{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Wc(t,"tagToText",zt),this.tagToTextScope=Wc(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 Bc={};const Hc=Phaser.Geom.Rectangle;var Nc=new tl;class Gc{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&nu(g)){""!==b?h.push(n.getLine(b,x,Zc)):0===w&&r>0&&h.push(n.getLine("",0,Zc)),h.push(...su(g,e,eu,s,0,n));var C=h.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,Zc)),b=g,x=f,o=s):(b+=g,x=m),w===S-1&&h.push(n.getLine(b,x,l))}return h},ru=function(t,e){var i;switch(e){case tu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==au&&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 Ic({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=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return pp(this.sizerChildren,null),vh.call(this,t),this}},gp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)pp(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},bp={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,pp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)pp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},wp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Sp=Phaser.Utils.Objects.IsPlainObject,Cp=Phaser.Utils.Objects.GetValue;class Op extends th{constructor(t,e,i,s,r,n,h,a,o,l){Sp(e)?(e=Cp(l=e,"x",0),i=Cp(l,"y",0),s=Cp(l,"width",void 0),r=Cp(l,"height",void 0),n=Cp(l,"column",l.col||0),h=Cp(l,"row",0),a=Cp(l,"columnProportions",0),o=Cp(l,"rowProportions",0)):Sp(s)?(s=Cp(l=s,"width",void 0),r=Cp(l,"height",void 0),n=Cp(l,"column",l.col||0),h=Cp(l,"row",0),a=Cp(l,"columnProportions",0),o=Cp(l,"rowProportions",0)):Sp(n)?(n=Cp(l=n,"column",l.col||0),h=Cp(l,"row",0),a=Cp(l,"columnProportions",0),o=Cp(l,"rowProportions",0)):Sp(a)&&(a=Cp(l=a,"columnProportions",0),o=Cp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Cp(l,"createCellContainerCallback")),this.setIndentLeft(Cp(l,"space.indentLeftOdd",0),Cp(l,"space.indentLeftEven",0)),this.setIndentTop(Cp(l,"space.indentTopOdd",0),Cp(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Cp(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=xp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=wp.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,bp);const Pp=Phaser.Utils.Objects.GetValue,_p=Phaser.Math.Percent;var Tp=function(t,e,i){var s;return t.y===e.y?s=_p(i.x,t.x,e.x):t.x===e.x&&(s=_p(i.y,t.y,e.y)),s},kp=function(t,e,i){var s,r;this.enable&&(Ep.x=e,Ep.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Tp(s,r,Ep))},Ep={},Mp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Rp.x=t.worldX,Rp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Tp(s,r,Rp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Rp={},Lp=function(t,e){void 0===e&&(e=Dp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(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},Dp={};const Yp=Phaser.Display.Align.LEFT_CENTER,Ap=Phaser.Display.Align.TOP_CENTER;var Xp={};const zp=Phaser.Display.Align.RIGHT_CENTER,Wp=Phaser.Display.Align.BOTTOM_CENTER;var Fp={};const jp=Phaser.Math.Linear;var Ip={};const Bp=Phaser.Display.Align.LEFT_CENTER,Hp=Phaser.Display.Align.TOP_CENTER,Np=Phaser.Display.Align.RIGHT_CENTER,Gp=Phaser.Display.Align.BOTTOM_CENTER,Vp=Phaser.Utils.Objects.GetValue,Up=Phaser.Utils.Objects.IsPlainObject,$p=Phaser.Math.Clamp,Jp=Phaser.Math.Snap.To;class Kp extends(id(_h)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Vp(e,"reverseAxis",!1);var i=Vp(e,"background",void 0),s=Vp(e,"track",void 0),r=Vp(e,"indicator",void 0),n=Vp(e,"thumb",void 0);if(i&&(Up(i)&&(i=mc(t,i)),this.addBackground(i)),s&&(Up(s)&&(s=mc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Up(r)&&(r=mc(t,r)),this.pin(r)),n){Up(n)&&(n=mc(t,n)),this.pin(n);var h=Vp(e,"thumbOffsetX",0),a=Vp(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=Vp(e,"input",0);switch("string"==typeof o&&(o=qp[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",kp,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",Mp,this).on("pointermove",Mp,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(Vp(e,"enable",void 0)),this.setGap(Vp(e,"gap",void 0)),this.setValue(Vp(e,"value",0),Vp(e,"min",void 0),Vp(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=Jp(t,this.gap));var e=this._value;this._value=$p(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 qp={pan:0,drag:0,click:1,none:-1};var Zp={getStartPoint:function(t){if(void 0===t&&(t=Xp),this.childrenMap.thumb){var e=0===this.orientation?Yp:Ap;Lp.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=Fp),this.childrenMap.thumb){var e=0===this.orientation?zp:Wp;Lp.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=Ip),s.x=jp(e.x,i.x,t),s.y=jp(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,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?Np:Gp:0===this.orientation?Bp:Hp,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Kp.prototype,Zp);const Qp=Phaser.Utils.Objects.GetValue;class tv extends _h{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=Qp(e,"background",void 0),n=Qp(e,"buttons",void 0),h=Qp(n,"top",Qp(n,"left",void 0)),a=Qp(n,"bottom",Qp(n,"right",void 0)),o=Qp(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===Qp(o,"width",void 0)?1:0:void 0===Qp(o,"height",void 0)?1:0,i=new Kp(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=Qp(e,"valuechangeCallback",null);if(null!==d){var c=Qp(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(Qp(e,"enable",void 0)),this.setValue(Qp(e,"value",0)),this.setScrollStep(Qp(n,"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 ev extends Rs{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 iv=Phaser.Utils.Objects.GetValue,sv=Phaser.Math.Distance.Between;class rv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=iv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(iv(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(iv(t,"enable",!0)),this.holdThreshold=iv(t,"holdThreshold",50),this.pointerOutReleaseEnable=iv(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 dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:sv(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 nv=Phaser.Utils.Objects.GetValue;class hv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(nv(t,"value",0)),this.setSpeed(nv(t,"speed",0)),this.setAcceleration(nv(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 av{constructor(){this.value,this.dir,this.movement=new hv}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 cv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},uv=Phaser.Utils.Objects.GetValue;class pv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=uv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(uv(e,"speed",.1)),this.setEnable(uv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(uv(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 vv=Phaser.Utils.Objects.GetValue;var gv=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)?vv(s,l,void 0):vv(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 tv(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=vv(r,"position",0);"string"==typeof p&&(p=fv[p]);var v,g,f=vv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=vv(s,"space.slider",void 0))&&(a?f=0:v=vv(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:vv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:vv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:vv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:vv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=vv(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=vv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=vv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=vv(s,"scrollDetectionMode");"string"==typeof b&&(b=mv[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?vv(s,x,!0):vv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new dv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var w,S,C,O,P,_=vv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),w=new pv(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,w),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",w)),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?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),w&&(P=a?`addChildO${i}`:"addChildOY",w.on("scroll",(function(e){t[P](-e,!0)})))};const fv={right:0,left:1,bottom:0,top:1},mv={gameObject:0,rectBounds:1},yv=Phaser.Utils.Objects.GetValue;var bv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=yv(e,"width"),h=yv(e,"height");n||yv(e,"child.expandWidth",!0)||(s[1]=0),h||yv(e,"child.expandHeight",!0)||(r[1]=0);var a=new Op(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Pp(i,"child"),r=Pp(s,"gameObject",void 0);if(r){var n=Pp(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=Pp(n,"top",0),h.bottom=Pp(n,"bottom",0),a.left=Pp(n,"left",0),a.right=Pp(n,"right",0);break;case 1:h.top=Pp(n,"left",0),h.bottom=Pp(n,"right",0),a.top=Pp(n,"top",0),a.bottom=Pp(n,"bottom",0);break;default:h.top=Pp(n,"top",0),h.bottom=Pp(n,"bottom",0),h.left=Pp(n,"left",0),h.right=Pp(n,"right",0)}e.add(r,{column:1,row:1,align:Pp(s,"align","center"),padding:a,expand:{width:Pp(s,"expandWidth",!0),height:Pp(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:gv(t,a,"y",e);break;case 1:gv(t,a,"x",e);break;default:gv(t,a,"y",e),gv(t,a,"x",e)}return a},xv=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)},wv=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)}},Sv=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(kv.call(this,-this.textOY)),0),e=Ev.call(this,t)+this.textOY,i=Mv.call(this,t);return function(t,e){switch(Ih(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,Rv.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,Ie.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,Dv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Rv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Av=Phaser.Utils.Objects.IsPlainObject,Xv=Phaser.Utils.Objects.GetValue,zv=Phaser.Display.Align.TOP_LEFT;class Wv extends th{constructor(t,e,i,s,r,n){Av(e)?(e=Xv(n=e,"x",0),i=Xv(n,"y",0),s=Xv(n,"width",void 0),r=Xv(n,"height",void 0)):Av(s)&&(s=Xv(n=s,"width",void 0),r=Xv(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=Xv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Xv(n,"clampTextOY",!0)),this.alwaysScrollable=Xv(n,"alwaysScrollable",!1);var h=Xv(n,"background",void 0),a=Xv(n,"text",void 0);void 0===a&&(a=Fv(t)),this.textCropEnable=Xv(n,"textCrop",!!a.setCrop);var o=Xv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=zv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Ih(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Xh.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(kv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Ev.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 Fv=function(t){return t.add.text(0,0,"")};Object.assign(Wv.prototype,Yv);var jv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Iv={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 Bv=Phaser.Utils.Objects.GetValue;class Hv extends _v{constructor(t,e){void 0===e&&(e={});var i=Bv(e,"text",void 0),s=Bv(e,"textWidth",void 0),r=Bv(e,"textHeight",void 0),n=Bv(e,"textCrop",!!i.setCrop),h=Bv(e,"textMask",!n),a=Bv(e,"content",""),o=new Wv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Bv(e,"clampChildOY",!1),alwaysScrollable:Bv(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=Bv(e,"space",void 0);l&&(l.child=Bv(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(Hv.prototype,jv,Iv);const Nv=Phaser.Utils.Objects.GetValue;var Gv=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 sp(t,e);break;case"bbcodetext":case"bbcode":s=new Qu(t,0,0,"",e);break;case"label":s=new $v(t,e);break;case"textarea":s=function(t,e,i){e=e?yo(e):{};var s=Nv(i,"background",mc),r=Nv(i,"text",Gv),n=Nv(i,"track",mc),h=Nv(i,"thumb",mc);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 Hv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new xc(t,e)}return fc(s,e),t.add.existing(s),s},Vv=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 vc(t,e):new Vd(t,e);break;case"roundRectangle":s=new Il(t,e);break;default:s=new Kd(t,e)}return fc(s,e),t.add.existing(s),s};const Uv=Phaser.Utils.Objects.GetValue;class $v extends gl{constructor(t,e,i){e=function(t,e,i){e=e?yo(e):{};var s=Uv(i,"background",mc),r=Uv(i,"text",Gv),n=Uv(i,"icon",Vv),h=Uv(i,"action",Vv);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 Jv(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Jv(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Jv(this.getChildren(),"setDisableState",t),this}}var Jv=function(t,e,i){for(var s=0,r=t.length;so;d--){for(c=0;c0&&this.wrapMode!==Jh&&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=Qh[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]=Rc(t,l,d);else{var u=Mc(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Rc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Rc(t,"fill",null);null!==v&&(this.color=Ya(v));var g=Rc(t,"metrics",!1);return g?this.metrics={ascent:Rc(g,"ascent",0),descent:Rc(g,"descent",0),fontSize:Rc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Ec(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=Ec(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=Rc(t,"fontFamily","Courier"),this.fontSize=Rc(t,"fontSize","16px"),this.fontStyle=Rc(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=Ya(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Ya(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Ya(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=Ya(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Ya(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=Ya(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=Ya(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=Ya(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=Ya(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=Ya(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=Ya(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=Ya(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=Qh[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=Rc(e,"fontFamily",this.fontFamily),this.fontSize=Rc(e,"fontSize",this.fontSize),this.fontStyle=Rc(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 Dc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Va(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 w=l;w0){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 Yc=Phaser.Utils.Objects.GetValue,Ac=Vh,Xc=Uh;class zc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Yc(t,"text",""),this.x=Yc(t,"x",0),this.y=Yc(t,"y",0),this.width=Yc(t,"width",0);var e=Yc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Yc(t,"newLineMode",0),this.startIndex=Yc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Xc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Ac&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Xc&&(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 Wc=Phaser.Utils.Objects.GetFastValue,Fc=Vh,jc=$h;class Ic{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Wc(t,"tagToText",zt),this.tagToTextScope=Wc(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 Bc={};const Hc=Phaser.Geom.Rectangle;var Nc=new tl;class Gc{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&nu(g)){""!==b?h.push(n.getLine(b,x,Zc)):0===w&&r>0&&h.push(n.getLine("",0,Zc)),h.push(...su(g,e,eu,s,0,n));var C=h.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,Zc)),b=g,x=f,o=s):(b+=g,x=m),w===S-1&&h.push(n.getLine(b,x,l))}return h},ru=function(t,e){var i;switch(e){case tu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==au&&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 Ic({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=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return pp(this.sizerChildren,null),vh.call(this,t),this}},gp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)pp(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},bp={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,pp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)pp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},wp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Sp=Phaser.Utils.Objects.IsPlainObject,Cp=Phaser.Utils.Objects.GetValue;class Op extends th{constructor(t,e,i,s,r,n,h,a,o,l){Sp(e)?(e=Cp(l=e,"x",0),i=Cp(l,"y",0),s=Cp(l,"width",void 0),r=Cp(l,"height",void 0),n=Cp(l,"column",l.col||0),h=Cp(l,"row",0),a=Cp(l,"columnProportions",0),o=Cp(l,"rowProportions",0)):Sp(s)?(s=Cp(l=s,"width",void 0),r=Cp(l,"height",void 0),n=Cp(l,"column",l.col||0),h=Cp(l,"row",0),a=Cp(l,"columnProportions",0),o=Cp(l,"rowProportions",0)):Sp(n)?(n=Cp(l=n,"column",l.col||0),h=Cp(l,"row",0),a=Cp(l,"columnProportions",0),o=Cp(l,"rowProportions",0)):Sp(a)&&(a=Cp(l=a,"columnProportions",0),o=Cp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Cp(l,"createCellContainerCallback")),this.setIndentLeft(Cp(l,"space.indentLeftOdd",0),Cp(l,"space.indentLeftEven",0)),this.setIndentTop(Cp(l,"space.indentTopOdd",0),Cp(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Cp(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=xp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=wp.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,bp);const Pp=Phaser.Utils.Objects.GetValue,_p=Phaser.Math.Percent;var Tp=function(t,e,i){var s;return t.y===e.y?s=_p(i.x,t.x,e.x):t.x===e.x&&(s=_p(i.y,t.y,e.y)),s},kp=function(t,e,i){var s,r;this.enable&&(Ep.x=e,Ep.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Tp(s,r,Ep))},Ep={},Mp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Rp.x=t.worldX,Rp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Tp(s,r,Rp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Rp={},Lp=function(t,e){void 0===e&&(e=Dp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(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},Dp={};const Yp=Phaser.Display.Align.LEFT_CENTER,Ap=Phaser.Display.Align.TOP_CENTER;var Xp={};const zp=Phaser.Display.Align.RIGHT_CENTER,Wp=Phaser.Display.Align.BOTTOM_CENTER;var Fp={};const jp=Phaser.Math.Linear;var Ip={};const Bp=Phaser.Display.Align.LEFT_CENTER,Hp=Phaser.Display.Align.TOP_CENTER,Np=Phaser.Display.Align.RIGHT_CENTER,Gp=Phaser.Display.Align.BOTTOM_CENTER,Vp=Phaser.Utils.Objects.GetValue,Up=Phaser.Utils.Objects.IsPlainObject,$p=Phaser.Math.Clamp,Jp=Phaser.Math.Snap.To;class Kp extends(id(_h)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Vp(e,"reverseAxis",!1);var i=Vp(e,"background",void 0),s=Vp(e,"track",void 0),r=Vp(e,"indicator",void 0),n=Vp(e,"thumb",void 0);if(i&&(Up(i)&&(i=mc(t,i)),this.addBackground(i)),s&&(Up(s)&&(s=mc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Up(r)&&(r=mc(t,r)),this.pin(r)),n){Up(n)&&(n=mc(t,n)),this.pin(n);var h=Vp(e,"thumbOffsetX",0),a=Vp(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=Vp(e,"input",0);switch("string"==typeof o&&(o=qp[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",kp,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",Mp,this).on("pointermove",Mp,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(Vp(e,"enable",void 0)),this.setGap(Vp(e,"gap",void 0)),this.setValue(Vp(e,"value",0),Vp(e,"min",void 0),Vp(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=Jp(t,this.gap));var e=this._value;this._value=$p(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 qp={pan:0,drag:0,click:1,none:-1};var Zp={getStartPoint:function(t){if(void 0===t&&(t=Xp),this.childrenMap.thumb){var e=0===this.orientation?Yp:Ap;Lp.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=Fp),this.childrenMap.thumb){var e=0===this.orientation?zp:Wp;Lp.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=Ip),s.x=jp(e.x,i.x,t),s.y=jp(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,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?Np:Gp:0===this.orientation?Bp:Hp,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Kp.prototype,Zp);const Qp=Phaser.Utils.Objects.GetValue;class tv extends _h{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=Qp(e,"background",void 0),n=Qp(e,"buttons",void 0),h=Qp(n,"top",Qp(n,"left",void 0)),a=Qp(n,"bottom",Qp(n,"right",void 0)),o=Qp(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===Qp(o,"width",void 0)?1:0:void 0===Qp(o,"height",void 0)?1:0,i=new Kp(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=Qp(e,"valuechangeCallback",null);if(null!==d){var c=Qp(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(Qp(e,"enable",void 0)),this.setValue(Qp(e,"value",0)),this.setScrollStep(Qp(n,"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 ev extends Rs{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 iv=Phaser.Utils.Objects.GetValue,sv=Phaser.Math.Distance.Between;class rv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=iv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(iv(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(iv(t,"enable",!0)),this.holdThreshold=iv(t,"holdThreshold",50),this.pointerOutReleaseEnable=iv(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 dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:sv(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 nv=Phaser.Utils.Objects.GetValue;class hv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(nv(t,"value",0)),this.setSpeed(nv(t,"speed",0)),this.setAcceleration(nv(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 av{constructor(){this.value,this.dir,this.movement=new hv}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 cv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},uv=Phaser.Utils.Objects.GetValue;class pv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=uv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(uv(e,"speed",.1)),this.setEnable(uv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(uv(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 vv=Phaser.Utils.Objects.GetValue;var gv=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)?vv(s,l,void 0):vv(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 tv(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=vv(r,"position",0);"string"==typeof p&&(p=fv[p]);var v,g,f=vv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=vv(s,"space.slider",void 0))&&(a?f=0:v=vv(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:vv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:vv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:vv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:vv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=vv(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=vv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=vv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=vv(s,"scrollDetectionMode");"string"==typeof b&&(b=mv[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?vv(s,x,!0):vv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new dv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var w,S,C,O,P,_=vv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),w=new pv(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,w),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",w)),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?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),w&&(P=a?`addChildO${i}`:"addChildOY",w.on("scroll",(function(e){t[P](-e,!0)})))};const fv={right:0,left:1,bottom:0,top:1},mv={gameObject:0,rectBounds:1},yv=Phaser.Utils.Objects.GetValue;var bv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=yv(e,"width"),h=yv(e,"height");n||yv(e,"child.expandWidth",!0)||(s[1]=0),h||yv(e,"child.expandHeight",!0)||(r[1]=0);var a=new Op(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Pp(i,"child"),r=Pp(s,"gameObject",void 0);if(r){var n=Pp(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=Pp(n,"top",0),h.bottom=Pp(n,"bottom",0),a.left=Pp(n,"left",0),a.right=Pp(n,"right",0);break;case 1:h.top=Pp(n,"left",0),h.bottom=Pp(n,"right",0),a.top=Pp(n,"top",0),a.bottom=Pp(n,"bottom",0);break;default:h.top=Pp(n,"top",0),h.bottom=Pp(n,"bottom",0),h.left=Pp(n,"left",0),h.right=Pp(n,"right",0)}e.add(r,{column:1,row:1,align:Pp(s,"align","center"),padding:a,expand:{width:Pp(s,"expandWidth",!0),height:Pp(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:gv(t,a,"y",e);break;case 1:gv(t,a,"x",e);break;default:gv(t,a,"y",e),gv(t,a,"x",e)}return a},xv=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)},wv=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)}},Sv=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(kv.call(this,-this.textOY)),0),e=Ev.call(this,t)+this.textOY,i=Mv.call(this,t);return function(t,e){switch(Ih(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,Rv.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,Ie.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,Dv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Rv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Av=Phaser.Utils.Objects.IsPlainObject,Xv=Phaser.Utils.Objects.GetValue,zv=Phaser.Display.Align.TOP_LEFT;class Wv extends th{constructor(t,e,i,s,r,n){Av(e)?(e=Xv(n=e,"x",0),i=Xv(n,"y",0),s=Xv(n,"width",void 0),r=Xv(n,"height",void 0)):Av(s)&&(s=Xv(n=s,"width",void 0),r=Xv(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=Xv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Xv(n,"clampTextOY",!0)),this.alwaysScrollable=Xv(n,"alwaysScrollable",!1);var h=Xv(n,"background",void 0),a=Xv(n,"text",void 0);void 0===a&&(a=Fv(t)),this.textCropEnable=Xv(n,"textCrop",!!a.setCrop);var o=Xv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=zv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Ih(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Xh.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(kv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Ev.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 Fv=function(t){return t.add.text(0,0,"")};Object.assign(Wv.prototype,Yv);var jv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Iv={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 Bv=Phaser.Utils.Objects.GetValue;class Hv extends _v{constructor(t,e){void 0===e&&(e={});var i=Bv(e,"text",void 0),s=Bv(e,"textWidth",void 0),r=Bv(e,"textHeight",void 0),n=Bv(e,"textCrop",!!i.setCrop),h=Bv(e,"textMask",!n),a=Bv(e,"content",""),o=new Wv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Bv(e,"clampChildOY",!1),alwaysScrollable:Bv(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=Bv(e,"space",void 0);l&&(l.child=Bv(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(Hv.prototype,jv,Iv);const Nv=Phaser.Utils.Objects.GetValue;var Gv=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 sp(t,e);break;case"bbcodetext":case"bbcode":s=new Qu(t,0,0,"",e);break;case"label":s=new $v(t,e);break;case"textarea":s=function(t,e,i){e=e?yo(e):{};var s=Nv(i,"background",mc),r=Nv(i,"text",Gv),n=Nv(i,"track",mc),h=Nv(i,"thumb",mc);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 Hv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new xc(t,e)}return fc(s,e),t.add.existing(s),s},Vv=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 vc(t,e):new Vd(t,e);break;case"roundRectangle":s=new Il(t,e);break;default:s=new Kd(t,e)}return fc(s,e),t.add.existing(s),s};const Uv=Phaser.Utils.Objects.GetValue;class $v extends gl{constructor(t,e,i){e=function(t,e,i){e=e?yo(e):{};var s=Uv(i,"background",mc),r=Uv(i,"text",Gv),n=Uv(i,"icon",Vv),h=Uv(i,"action",Vv);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 Jv(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Jv(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Jv(this.getChildren(),"setDisableState",t),this}}var Jv=function(t,e,i){for(var s=0,r=t.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 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}},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 Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=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=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=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}},Ye=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},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}},We=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},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?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&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=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}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 wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(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 Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(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=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(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 Mi=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},Ri=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},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={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(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(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(Ai(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=Ri(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(Ai(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()}},zi={};Object.assign(zi,Yi),zi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Fi extends Oi{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(Wi(t,"start",this.parent.alpha),Wi(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=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(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 Fi(t,h):s.resetFromJSON(h),s.restart(),s},Ni=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 Gi=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(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(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(Gi(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()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[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=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(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=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={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 ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={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(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(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 qi&&(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 qi(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(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(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 qi&&(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 qi(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}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(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=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[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=rs(i,"magnitude",void 0),t=rs(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 hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(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 cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(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]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{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 ps(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(vs(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(vs(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 fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(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),Li(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}},ms=Phaser.Utils.Array.Remove,ys={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=qe(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}},Ys={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}},Xs={};Object.assign(Xs,Ds,As,Ys,zs);const Ws=Phaser.Utils.Objects.GetValue;class js extends ii{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(js.prototype,Xs);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Fs(e):t};class Is extends ii{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,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 Bs=Phaser.GameObjects.Rectangle;class Hs extends Bs{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 ii{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,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},qs=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{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 br={press:0,pointerdown:0,release:1,pointerup:1};var xr={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 yr(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)||!Sr(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 Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(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(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(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: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 _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 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 kr 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 Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,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 Rr={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 Mr(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 Mr(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}},Lr={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=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===Kr&&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,Kr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{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=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(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 en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}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 en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{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 Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}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=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(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 un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{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 Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=xn}onDragEnd(){this.state=bn}onDrag(){this.state===xn&&(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=bn)}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=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),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}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",xn="BEGIN",wn="RECOGNIZED",Sn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=qe(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(Sn(e,"inputConfig",void 0)),this.setEventEmitter(Sn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Sn(t,"enable",!0)),this.bounds=Sn(t,"bounds",void 0),this.tracerState=kn,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 kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,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 En:this.tracerState=kn,this.onDrag1End();break;case Mn: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 Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(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!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)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;_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!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)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!==Mn)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=Rn,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,$e);var _n={};const kn=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,Xn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,jn=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=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=zn(Wn(this.angleBetween));this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=zn(Wn(this.angleBetween)),this.angle=Xn(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,Fn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(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){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(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 $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(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 yn(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 Kn=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},zr.call(t,e),jr.call(t,e),Br.call(t,e),Vr.call(t,e),Gn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={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",ce),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)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var 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 ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?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),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,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},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.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,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},yh={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}},xh={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&&(Ne(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,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,w=u.length;x0?(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)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.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],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(wh,uh,fh,mh,yh,bh,xh);var Sh=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},Oh=function(t){return"string"==typeof t&&(t=Ch[t]),t};const Ph=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class _h extends th{constructor(t,e,i,s,r,n,h){Ph(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)):Ph(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):Ph(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=Oh(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=Sh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,wh);var kh=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 Eh extends js{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 Mh={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}},Rh=function(t,e){zi.popUp.call(t,e,this.expandDirection)},Lh=function(t,e){zi.scaleDown.call(t,e,this.expandDirection)},Dh={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=Rh.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Lh.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const Ah=Phaser.Utils.Objects.GetValue;class Yh extends _h{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=Ah(e,"space"),h=1===this.orientation?"left":"top",a=Ah(e,"align.title",h),o=Ah(e,"expand.title",!0);this.add(s,{proportion:0,align:a,expand:o,padding:{left:Ah(n,"titleLeft",0),right:Ah(n,"titleRight",0),top:Ah(n,"titleTop",0),bottom:Ah(n,"titleBottom",0)}});var l=Ah(e,"toggleByTarget",void 0),d=Ah(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&xr.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Eh(r),!Ah(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}a=Ah(e,"align.child","left");var u=(o=Ah(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:a,expand:o,padding:{left:Ah(n,"childLeft",0),right:Ah(n,"childRight",0),top:Ah(n,"childTop",0),bottom:Ah(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(Ah(p,"duration",200)),this.setExpandCallback(Ah(p,"expandCallback",void 0)),this.setCollapseCallback(Ah(p,"collapseCallback",void 0)),this.reLayoutTarget=Ah(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=Ah(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}}Object.assign(Yh.prototype,Mh,Dh);var zh={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}},Xh=function(t,e,i,s,r=!1){var n;return bt(e)?(n=e,delete e[key]):ir(e)?(n=e(t,i))&&t.add.existing(n):(r||e)&&s&&(n=s(t,e,i)),n},Wh=Phaser.Renderer.WebGL.Utils,jh=function(t,e,i,s,r,n){for(var h=Wh.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+")"},Nh=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 Gh=Phaser.Renderer.Canvas.SetTransform;var Vh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Bh(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&&Ih(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(Gh(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($h.prototype,Vh);const Jh=Phaser.Utils.Objects.GetValue;let Kh=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=Jh(t,"x",0),i=Jh(t,"y",0));var s=this.cornerRadius;s.tl=qh(Jh(t,"tl",void 0),e,i),s.tr=qh(Jh(t,"tr",void 0),e,i),s.bl=qh(Jh(t,"bl",void 0),e,i),s.br=qh(Jh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Zh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Zh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Zh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Zh(this.cornerRadius.br,t)}};var qh=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Qh(t),t},Zh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Jh(e,"x",0),t.y=Jh(e,"y",0)),Qh(t)},Qh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ta=function(t){return t.x>0&&t.y>0},ea=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 sa=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 ro=Phaser.Utils.Objects.GetValue,no=Phaser.Utils.Objects.IsPlainObject;class ho extends(Ma(Sa)){constructor(t,e,i,s,r,n,h,a){no(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):no(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):no(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 io).setName("trackFill")).addShape((new io).setName("bar")).addShape((new io).setName("trackStroke")),this.setTrackColor(ro(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ro(a,"trackStrokeThickness",2),ro(a,"trackStrokeColor",void 0)),this.setSkewX(ro(a,"skewX",0)),this.setRTL(ro(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 ao={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&&so(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),so(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&so(a,0,0,e,i,t)}};Object.assign(ho.prototype,ao);var oo=function(t){return null==t||""===t||0===t.length},lo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(oo(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(oo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nko(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}const Eo=Phaser.Utils.Objects.IsPlainObject,Mo=Phaser.Utils.Objects.GetValue;var Ro=function(t){return"string"==typeof t&&(t=Lo[t]),t};const Lo={scale:0,repeat:1};var Do=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ao={_beginDraw:Xt,_drawImage:Xt,_drawTileSprite:Xt,_endDraw:Xt,setGetFrameNameCallback:function(t){return void 0===t&&(t=_o),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=ko(i),s=ko(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 Eo(t)?(this.stretchMode.edge=Ro(Mo(t,"edge",0)),this.stretchMode.internal=Ro(Mo(t,"internal",0))):(t=Ro(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Do.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,zo=Phaser.Utils.Objects.GetValue,Xo=Phaser.GameObjects;var Wo=void 0,jo=function(t,e){if(Wo||(Wo={},ti(t).events.once("destroy",(function(){for(var t in Wo)Wo[t].destroy();Wo=void 0}))),!Wo.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new Xo[e](i)).setOrigin(0),Wo[e]=t}return Wo[e]};const Fo=Phaser.GameObjects.RenderTexture;class Io extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Yo(i)?(i=zo(d=i,"x",0),s=zo(d,"y",0),r=zo(d,"width",1),n=zo(d,"height",1),h=zo(d,"key",void 0),a=zo(d,"baseFrame",void 0),o=zo(d,"columns",void 0),l=zo(d,"rows",void 0)):Yo(r)?(r=zo(d=r,"width",1),n=zo(d,"height",1),h=zo(d,"key",void 0),a=zo(d,"baseFrame",void 0),o=zo(d,"columns",void 0),l=zo(d,"rows",void 0)):Yo(h)?(h=zo(d=h,"key",void 0),a=zo(d,"baseFrame",void 0),o=zo(d,"columns",void 0),l=zo(d,"rows",void 0)):Yo(a)?(a=zo(d=a,"baseFrame",void 0),o=zo(d,"columns",void 0),l=zo(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=zo(d,"baseFrame",void 0)):Yo(o)&&(o=zo(d=o,"columns",void 0),l=zo(d,"rows",void 0)),void 0===a&&(a=zo(d,"frame",void 0)),void 0===o){var c=zo(d,"leftWidth",void 0),u=zo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=zo(d,"topHeight",void 0),v=zo(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(zo(d,"getFrameNameCallback",void 0)),this.setStretchMode(zo(d,"stretchMode",0)),this.setPreserveRatio(zo(d,"preserveRatio",!0));var g=zo(d,"maxFixedPartScale",1),f=zo(d,"maxFixedPartScaleX",g),m=zo(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,Ao),i}(Fo,"rexNinePatch")){}var Bo={_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(Io.prototype,Bo);let Ho=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(po(t,e))return t[e];var i=t.parent;return po(i,e)?i[e]:void 0}set(t,e,i){return po(t,e)?t[e]=i:po(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 No=Phaser.Utils.Objects.GetValue;class Go extends Io{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=No(e,"effects",!0);i&&yo(this,i),this.style=new Ho(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Go.prototype,va);const Vo=["alpha","tint","flipX","flipY"];var Uo=function(t,e){if(!e)return t;for(var i=0,s=Vo.length;i0&&r.push(o.join("")),r},vl=0,gl=1,fl=2,ml=0,yl=1,bl=2,xl=/(?:\r\n|\r|\n)/;const wl={none:ml,word:yl,char:bl,character:bl,mix:3},Sl=Phaser.Renderer.WebGL.Utils;var Cl={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=Sl.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 Ol=Phaser.Display.Color;var Pl={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 Ol);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}},Tl=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)},_l={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,Tl(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 kl=Phaser.Display.Canvas.CanvasPool,El=Phaser.GameObjects.GameObject,Ml=Phaser.Utils.String.UUID;class Rl 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=kl.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=Ml(),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(){kl.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(Rl,[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,Cl,Pl,_l]);class Dl{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(Dl.prototype,La);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 Yl=Phaser.Math.RotateAround;var zl;const Xl=Phaser.Geom.Rectangle;var Wl,jl=function(t){void 0===Wl&&(Wl=new Xl);var e=t.drawTLX,i=t.drawTLY;return Wl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Wl};const Fl=Phaser.Math.RotateAround;var Il,Bl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Il&&(Il={}),s=Il),s.x=e,s.y=i,0!==t.rotation&&Fl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Hl=Phaser.GameObjects.Components.TransformMatrix;var Nl,Gl,Vl={},Ul=function(t,e,i,s,r){var n=Bl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Vl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Nl&&(Nl=new Hl,Gl=new Hl),t.parentContainer?t.getWorldTransformMatrix(Nl,Gl):Nl.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Nl.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},$l=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 Ul(t,e,n,h,r)},Jl={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===zl&&(zl={}),s=zl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Yl(s,0,0,-i.rotation),s}(t,e,this,!0);return jl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return $l(this.parent,this,t,e,i)}};Object.assign(Jl,Al);const Kl=Phaser.Math.DegToRad,ql=Phaser.Math.RadToDeg,Zl=Phaser.Utils.Objects.GetValue;class Ql extends Dl{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 ql(this._rotation)}set angle(t){this.rotation=Kl(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=Zl(t,"width",void 0),i=Zl(t,"height",void 0),s=Zl(t,"scaleX",void 0),r=Zl(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(Ql.prototype,Jl);const td=Phaser.Utils.String.Pad;var ed=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${td(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}},id=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const sd=Phaser.Math.DegToRad;var rd=function(t){return!t.hasOwnProperty("convex")||t.convex},nd=function(t){return t.x>0&&t.y>0},hd=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,nd(a)?(o=a.x*g,l=a.y*f,rd(a)?hd(t,o,l,o,l,180,270,!1,h):hd(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,nd(a)?(o=a.x*g,l=a.y*f,rd(a)?hd(t,s-o,l,o,l,270,360,!1,h):hd(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,nd(a)?(o=a.x*g,l=a.y*f,rd(a)?hd(t,s-o,r-l,o,l,0,90,!1,h):hd(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,nd(a)?(o=a.x*g,l=a.y*f,rd(a)?hd(t,o,r-l,o,l,90,180,!1,h):hd(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())},od=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),ad(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const ld=Phaser.Utils.Objects.GetValue;class dd extends Ql{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(ld(e,"color",null),ld(e,"color2",null),ld(e,"horizontalGradient",!0)),this.setStroke(ld(e,"stroke",null),ld(e,"strokeThickness",2)),this.setCornerRadius(ld(e,"cornerRadius",0),ld(e,"cornerIteration",null))}set color(t){t=ed(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ed(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=ed(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,id("color2",t,this),id("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,id("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,id("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(){od(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const cd=Phaser.Utils.Objects.GetValue;class ud extends Ql{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(cd(e,"color",null),cd(e,"color2",null),cd(e,"horizontalGradient",!0)),this.setStroke(cd(e,"stroke",null),cd(e,"strokeThickness",2))}set color(t){t=ed(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ed(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=ed(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,cd(t,"color2",null),cd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,cd(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 pd=Phaser.Utils.Objects.GetValue;let vd=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(pd(t,"bold",!1)),this.setItalic(pd(t,"italic",!1)),this.setFontSize(pd(t,"fontSize","16px")),this.setFontFamily(pd(t,"fontFamily","Courier")),this.setColor(pd(t,"color","#fff")),this.setStrokeStyle(pd(t,"stroke",null),pd(t,"strokeThickness",0)),this.setShadow(pd(t,"shadowColor",null),pd(t,"shadowOffsetX",0),pd(t,"shadowOffsetY",0),pd(t,"shadowBlur",0)),this.setOffset(pd(t,"offsetX",0),pd(t,"offsetY",0)),this.setSpace(pd(t,"leftSpace",0),pd(t,"rightSpace",0)),this.setAlign(pd(t,"align",void 0)),this.setBackgroundColor(pd(t,"backgroundColor",null)),this.setBackgroundHeight(pd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(pd(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(id("stroke",t,this),id("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(id("shadowOffsetX",t,this),id("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=ed(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ed(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=ed(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=ed(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 gd=Phaser.Utils.Array.Remove,fd=Phaser.Utils.Array.Remove,md="text",yd="image",bd="drawer",xd="space",wd="command";var Sd=function(t){return t.type===md&&"\n"===t.text},Cd=function(t){return t.type===md&&"\f"===t.text},Od=function(t){return t.type===md};class Pd extends Ql{constructor(t,e,i){super(t,md),this.updateTextFlag=!1,this.style=new vd(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 Td=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const _d=Phaser.Display.Canvas.CanvasPool;var kd=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=_d.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),_d.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 Ed extends Ql{constructor(t,e,i){super(t,yd),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(){kd(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 Md extends Ql{constructor(t,e,i,s){super(t,bd),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 Rd extends Ql{constructor(t,e){super(t,xd),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 Ld extends Dl{constructor(t,e,i,s,r){super(t,wd),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 Dd=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 Ad={none:0,word:1,char:2,character:2,mix:3};var Yd=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=jd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=jd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Id(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Id(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Id(t,"wrapMode");void 0===c&&(c=Id(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Ad[c]);var u=Id(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Id(t,"letterSpacing",0),v=Id(t,"hAlign",0),g=Id(t,"vAlign",0),f=Id(t,"justifyPercentage",.25),m=Dd({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=Nd(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Nd(t,"maxLines",0);var a=0===i,o=Nd(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Nd(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Nd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Nd(t,"letterSpacing",0),p=Nd(t,"rtl",!0),v=Nd(t,"hAlign",p?2:0),g=Nd(t,"vAlign",0),f=Dd({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 Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(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),gd(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 fd(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(md);return null===i?i=new Pd(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)),$l(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 gc=Phaser.Utils.Objects.GetFastValue;var fc={};class mc{constructor(t){this.pools=gc(t,"pools",fc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new vc),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=Pc(t,r,e,i,n),a=0;a<=Sc&&0!==h;a++){if((r+=h)<0){r=0;break}h=Pc(t,r,e,i,n)}return a===Sc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Tc(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]},Pc=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)},Tc=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 _c=Phaser.Utils.Objects.GetValue,kc=Phaser.Utils.Objects.GetValue;class Ec extends Qo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=kc(e,"background",void 0),r=kc(e,"icon",void 0),n=kc(e,"iconMask",void 0),h=kc(e,"text",void 0),a=kc(e,"action",void 0),o=kc(e,"actionMask",void 0),l=kc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:kc(e,"space.icon",0),top:kc(e,"space.iconTop",0),bottom:kc(e,"space.iconBottom",0),left:kc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:kc(e,"space.icon",0),left:kc(e,"space.iconLeft",0),right:kc(e,"space.iconRight",0),top:kc(e,"space.iconTop",0)});var d=kc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=rl.call(this,r,r,1)),!d){var c=kc(e,"iconSize",void 0);this.setIconSize(kc(e,"iconWidth",c),kc(e,"iconHeight",c))}}if(h){var u=kc(e,"wrapText",!1),p=kc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(ll(t)){case 0:switch("string"==typeof e&&(e=wl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=ul;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=wl[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,wc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=_c(e,"minWidth",0),s=_c(e,"minHeight",0),r=_c(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 Cc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Cc(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=kc(e,"space.text",0),m=kc(e,"expandTextWidth",!1),y=kc(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:kc(e,"space.actionTop",0),bottom:kc(e,"space.actionBottom",0),right:kc(e,"space.actionRight",0)}:{left:kc(e,"space.actionLeft",0),right:kc(e,"space.actionRight",0),bottom:kc(e,"space.actionBottom",0)},d=kc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=rl.call(this,a,a,1)),!d)){var b=kc(e,"actionSize");this.setActionSize(kc(e,"actionWidth",b),kc(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 Mc=Phaser.GameObjects.Text,Rc=Phaser.Utils.Objects.GetValue;class Lc extends Mc{constructor(t,e){void 0===e&&(e={}),super(t,Rc(e,"x",0),Rc(e,"y",0),Rc(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(Lc.prototype,va);var Dc=Phaser.Renderer.WebGL.Utils,Ac={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=Dc.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 Yc=Phaser.Display.Canvas.CanvasPool;e();const zc=Phaser.GameObjects.GameObject;class Xc extends zc{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=Yc.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 Yc.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 _=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 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}},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 Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=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=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=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}},Ye=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},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}},We=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},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?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&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=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}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 wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(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 Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(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=_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=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 Ei={stop:0,destroy:1,yoyo:2};var Mi=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},Ri=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},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={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(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(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(Ai(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=Ri(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(Ai(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()}},zi={};Object.assign(zi,Yi),zi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Fi extends Oi{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(Wi(t,"start",this.parent.alpha),Wi(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=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(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 Fi(t,h):s.resetFromJSON(h),s.restart(),s},Ni=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 Gi=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(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(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(Gi(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()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[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=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(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=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={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 ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={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(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(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 qi&&(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 qi(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(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(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 qi&&(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 qi(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}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(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=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[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=rs(i,"magnitude",void 0),t=rs(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 hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(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 cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(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]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{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 ps(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(vs(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(vs(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 fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(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),Li(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}},ms=Phaser.Utils.Array.Remove,ys={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=qe(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}},Ys={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}},Xs={};Object.assign(Xs,Ds,As,Ys,zs);const Ws=Phaser.Utils.Objects.GetValue;class js extends ii{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(js.prototype,Xs);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Fs(e):t};class Is extends ii{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,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 Bs=Phaser.GameObjects.Rectangle;class Hs extends Bs{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 ii{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,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},qs=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{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 br={press:0,pointerdown:0,release:1,pointerup:1};var xr={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 yr(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)||!Sr(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 Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(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(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(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?wr: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 _r={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 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 kr 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 Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,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 Rr={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 Mr(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 Mr(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}},Lr={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=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===Kr&&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,Kr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{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=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(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 en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}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 en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{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 Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}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=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(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 un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{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 Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=xn}onDragEnd(){this.state=bn}onDrag(){this.state===xn&&(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=bn)}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=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),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}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",xn="BEGIN",wn="RECOGNIZED",Sn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=qe(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(Sn(e,"inputConfig",void 0)),this.setEventEmitter(Sn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Sn(t,"enable",!0)),this.bounds=Sn(t,"bounds",void 0),this.tracerState=kn,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 kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,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 En:this.tracerState=kn,this.onDrag1End();break;case Mn: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 Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(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!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)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;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!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)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!==Mn)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=Rn,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(_n.prototype,$e);var Tn={};const kn=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,Xn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,jn=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=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=zn(Wn(this.angleBetween));this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=zn(Wn(this.angleBetween)),this.angle=Xn(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,Fn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(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){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(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 $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(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 yn(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 Kn=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},zr.call(t,e),jr.call(t,e),Br.call(t,e),Vr.call(t,e),Gn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={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",ce),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)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var 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 ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?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),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,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},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.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,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},yh={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}},xh={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&&(Ne(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,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,w=u.length;x0?(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)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.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],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(wh,uh,fh,mh,yh,bh,xh);var Sh=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},Oh=function(t){return"string"==typeof t&&(t=Ch[t]),t};const Ph=Phaser.Utils.Objects.IsPlainObject,_h=Phaser.Utils.Objects.GetValue;class Th extends th{constructor(t,e,i,s,r,n,h){Ph(e)?(e=_h(h=e,"x",0),i=_h(h,"y",0),s=_h(h,"width",void 0),r=_h(h,"height",void 0),n=_h(h,"orientation",0)):Ph(s)?(s=_h(h=s,"width",void 0),r=_h(h,"height",void 0),n=_h(h,"orientation",0)):Ph(n)&&(n=_h(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(_h(h,"space.item",0)),this.setStartChildIndex(_h(h,"startChildIndex",0)),this.setRTL(_h(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Oh(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=Sh.call(this)),this._childrenProportion}}Object.assign(Th.prototype,wh);var kh=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 Eh extends js{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 Mh={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}},Rh=function(t,e){zi.popUp.call(t,e,this.expandDirection)},Lh=function(t,e){zi.scaleDown.call(t,e,this.expandDirection)},Dh={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=Rh.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Lh.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const Ah=Phaser.Utils.Objects.GetValue;class Yh extends Th{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=Ah(e,"space"),h=1===this.orientation?"left":"top",a=Ah(e,"align.title",h),o=Ah(e,"expand.title",!0);this.add(s,{proportion:0,align:a,expand:o,padding:{left:Ah(n,"titleLeft",0),right:Ah(n,"titleRight",0),top:Ah(n,"titleTop",0),bottom:Ah(n,"titleBottom",0)}});var l=Ah(e,"toggleByTarget",void 0),d=Ah(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&xr.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Eh(r),!Ah(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}a=Ah(e,"align.child","left");var u=(o=Ah(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:a,expand:o,padding:{left:Ah(n,"childLeft",0),right:Ah(n,"childRight",0),top:Ah(n,"childTop",0),bottom:Ah(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(Ah(p,"duration",200)),this.setExpandCallback(Ah(p,"expandCallback",void 0)),this.setCollapseCallback(Ah(p,"collapseCallback",void 0)),this.reLayoutTarget=Ah(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=Ah(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}}Object.assign(Yh.prototype,Mh,Dh);var zh={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}},Xh=function(t,e,i,s,r=!1){var n;return bt(e)?(n=e,delete e[key]):ir(e)?(n=e(t,i))&&t.add.existing(n):(r||e)&&s&&(n=s(t,e,i)),n},Wh=Phaser.Renderer.WebGL.Utils,jh=function(t,e,i,s,r,n){for(var h=Wh.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+")"},Nh=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 Gh=Phaser.Renderer.Canvas.SetTransform;var Vh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Bh(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&&Ih(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(Gh(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($h.prototype,Vh);const Jh=Phaser.Utils.Objects.GetValue;let Kh=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=Jh(t,"x",0),i=Jh(t,"y",0));var s=this.cornerRadius;s.tl=qh(Jh(t,"tl",void 0),e,i),s.tr=qh(Jh(t,"tr",void 0),e,i),s.bl=qh(Jh(t,"bl",void 0),e,i),s.br=qh(Jh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Zh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Zh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Zh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Zh(this.cornerRadius.br,t)}};var qh=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Qh(t),t},Zh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Jh(e,"x",0),t.y=Jh(e,"y",0)),Qh(t)},Qh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ta=function(t){return t.x>0&&t.y>0},ea=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 sa=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 ro=Phaser.Utils.Objects.GetValue,no=Phaser.Utils.Objects.IsPlainObject;class ho extends(Ma(Sa)){constructor(t,e,i,s,r,n,h,a){no(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):no(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):no(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 io).setName("trackFill")).addShape((new io).setName("bar")).addShape((new io).setName("trackStroke")),this.setTrackColor(ro(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ro(a,"trackStrokeThickness",2),ro(a,"trackStrokeColor",void 0)),this.setSkewX(ro(a,"skewX",0)),this.setRTL(ro(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 ao={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&&so(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),so(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&so(a,0,0,e,i,t)}};Object.assign(ho.prototype,ao);var oo=function(t){return null==t||""===t||0===t.length},lo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(oo(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(oo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nko(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}const Eo=Phaser.Utils.Objects.IsPlainObject,Mo=Phaser.Utils.Objects.GetValue;var Ro=function(t){return"string"==typeof t&&(t=Lo[t]),t};const Lo={scale:0,repeat:1};var Do=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ao={_beginDraw:Xt,_drawImage:Xt,_drawTileSprite:Xt,_endDraw:Xt,setGetFrameNameCallback:function(t){return void 0===t&&(t=To),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=ko(i),s=ko(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 Eo(t)?(this.stretchMode.edge=Ro(Mo(t,"edge",0)),this.stretchMode.internal=Ro(Mo(t,"internal",0))):(t=Ro(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Do.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,zo=Phaser.Utils.Objects.GetValue,Xo=Phaser.GameObjects;var Wo=void 0,jo=function(t,e){if(Wo||(Wo={},ti(t).events.once("destroy",(function(){for(var t in Wo)Wo[t].destroy();Wo=void 0}))),!Wo.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new Xo[e](i)).setOrigin(0),Wo[e]=t}return Wo[e]};const Fo=Phaser.GameObjects.RenderTexture;class Io extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Yo(i)?(i=zo(d=i,"x",0),s=zo(d,"y",0),r=zo(d,"width",1),n=zo(d,"height",1),h=zo(d,"key",void 0),a=zo(d,"baseFrame",void 0),o=zo(d,"columns",void 0),l=zo(d,"rows",void 0)):Yo(r)?(r=zo(d=r,"width",1),n=zo(d,"height",1),h=zo(d,"key",void 0),a=zo(d,"baseFrame",void 0),o=zo(d,"columns",void 0),l=zo(d,"rows",void 0)):Yo(h)?(h=zo(d=h,"key",void 0),a=zo(d,"baseFrame",void 0),o=zo(d,"columns",void 0),l=zo(d,"rows",void 0)):Yo(a)?(a=zo(d=a,"baseFrame",void 0),o=zo(d,"columns",void 0),l=zo(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=zo(d,"baseFrame",void 0)):Yo(o)&&(o=zo(d=o,"columns",void 0),l=zo(d,"rows",void 0)),void 0===a&&(a=zo(d,"frame",void 0)),void 0===o){var c=zo(d,"leftWidth",void 0),u=zo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=zo(d,"topHeight",void 0),v=zo(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(zo(d,"getFrameNameCallback",void 0)),this.setStretchMode(zo(d,"stretchMode",0)),this.setPreserveRatio(zo(d,"preserveRatio",!0));var g=zo(d,"maxFixedPartScale",1),f=zo(d,"maxFixedPartScaleX",g),m=zo(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,Ao),i}(Fo,"rexNinePatch")){}var Bo={_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(Io.prototype,Bo);let Ho=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(po(t,e))return t[e];var i=t.parent;return po(i,e)?i[e]:void 0}set(t,e,i){return po(t,e)?t[e]=i:po(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 No=Phaser.Utils.Objects.GetValue;class Go extends Io{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=No(e,"effects",!0);i&&yo(this,i),this.style=new Ho(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Go.prototype,va);const Vo=["alpha","tint","flipX","flipY"];var Uo=function(t,e){if(!e)return t;for(var i=0,s=Vo.length;i0&&r.push(o.join("")),r},vl=0,gl=1,fl=2,ml=0,yl=1,bl=2,xl=/(?:\r\n|\r|\n)/;const wl={none:ml,word:yl,char:bl,character:bl,mix:3},Sl=Phaser.Renderer.WebGL.Utils;var Cl={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=Sl.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 Ol=Phaser.Display.Color;var Pl={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 Ol);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}},_l=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)},Tl={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,_l(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 kl=Phaser.Display.Canvas.CanvasPool,El=Phaser.GameObjects.GameObject,Ml=Phaser.Utils.String.UUID;class Rl 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=kl.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=Ml(),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(){kl.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(Rl,[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,Cl,Pl,Tl]);class Dl{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(Dl.prototype,La);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 Yl=Phaser.Math.RotateAround;var zl;const Xl=Phaser.Geom.Rectangle;var Wl,jl=function(t){void 0===Wl&&(Wl=new Xl);var e=t.drawTLX,i=t.drawTLY;return Wl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Wl};const Fl=Phaser.Math.RotateAround;var Il,Bl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Il&&(Il={}),s=Il),s.x=e,s.y=i,0!==t.rotation&&Fl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Hl=Phaser.GameObjects.Components.TransformMatrix;var Nl,Gl,Vl={},Ul=function(t,e,i,s,r){var n=Bl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Vl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Nl&&(Nl=new Hl,Gl=new Hl),t.parentContainer?t.getWorldTransformMatrix(Nl,Gl):Nl.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Nl.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},$l=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 Ul(t,e,n,h,r)},Jl={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===zl&&(zl={}),s=zl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Yl(s,0,0,-i.rotation),s}(t,e,this,!0);return jl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return $l(this.parent,this,t,e,i)}};Object.assign(Jl,Al);const Kl=Phaser.Math.DegToRad,ql=Phaser.Math.RadToDeg,Zl=Phaser.Utils.Objects.GetValue;class Ql extends Dl{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 ql(this._rotation)}set angle(t){this.rotation=Kl(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=Zl(t,"width",void 0),i=Zl(t,"height",void 0),s=Zl(t,"scaleX",void 0),r=Zl(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(Ql.prototype,Jl);const td=Phaser.Utils.String.Pad;var ed=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${td(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}},id=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const sd=Phaser.Math.DegToRad;var rd=function(t){return!t.hasOwnProperty("convex")||t.convex},nd=function(t){return t.x>0&&t.y>0},hd=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,nd(a)?(o=a.x*g,l=a.y*f,rd(a)?hd(t,o,l,o,l,180,270,!1,h):hd(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,nd(a)?(o=a.x*g,l=a.y*f,rd(a)?hd(t,s-o,l,o,l,270,360,!1,h):hd(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,nd(a)?(o=a.x*g,l=a.y*f,rd(a)?hd(t,s-o,r-l,o,l,0,90,!1,h):hd(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,nd(a)?(o=a.x*g,l=a.y*f,rd(a)?hd(t,o,r-l,o,l,90,180,!1,h):hd(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())},od=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),ad(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const ld=Phaser.Utils.Objects.GetValue;class dd extends Ql{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(ld(e,"color",null),ld(e,"color2",null),ld(e,"horizontalGradient",!0)),this.setStroke(ld(e,"stroke",null),ld(e,"strokeThickness",2)),this.setCornerRadius(ld(e,"cornerRadius",0),ld(e,"cornerIteration",null))}set color(t){t=ed(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ed(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=ed(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,id("color2",t,this),id("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,id("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,id("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(){od(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const cd=Phaser.Utils.Objects.GetValue;class ud extends Ql{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(cd(e,"color",null),cd(e,"color2",null),cd(e,"horizontalGradient",!0)),this.setStroke(cd(e,"stroke",null),cd(e,"strokeThickness",2))}set color(t){t=ed(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ed(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=ed(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,cd(t,"color2",null),cd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,cd(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 pd=Phaser.Utils.Objects.GetValue;let vd=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(pd(t,"bold",!1)),this.setItalic(pd(t,"italic",!1)),this.setFontSize(pd(t,"fontSize","16px")),this.setFontFamily(pd(t,"fontFamily","Courier")),this.setColor(pd(t,"color","#fff")),this.setStrokeStyle(pd(t,"stroke",null),pd(t,"strokeThickness",0)),this.setShadow(pd(t,"shadowColor",null),pd(t,"shadowOffsetX",0),pd(t,"shadowOffsetY",0),pd(t,"shadowBlur",0)),this.setOffset(pd(t,"offsetX",0),pd(t,"offsetY",0)),this.setSpace(pd(t,"leftSpace",0),pd(t,"rightSpace",0)),this.setAlign(pd(t,"align",void 0)),this.setBackgroundColor(pd(t,"backgroundColor",null)),this.setBackgroundHeight(pd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(pd(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(id("stroke",t,this),id("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(id("shadowOffsetX",t,this),id("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=ed(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ed(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=ed(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=ed(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 gd=Phaser.Utils.Array.Remove,fd=Phaser.Utils.Array.Remove,md="text",yd="image",bd="drawer",xd="space",wd="command";var Sd=function(t){return t.type===md&&"\n"===t.text},Cd=function(t){return t.type===md&&"\f"===t.text},Od=function(t){return t.type===md};class Pd extends Ql{constructor(t,e,i){super(t,md),this.updateTextFlag=!1,this.style=new vd(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 _d=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Td=Phaser.Display.Canvas.CanvasPool;var kd=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=Td.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),Td.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 Ed extends Ql{constructor(t,e,i){super(t,yd),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(){kd(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 Md extends Ql{constructor(t,e,i,s){super(t,bd),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 Rd extends Ql{constructor(t,e){super(t,xd),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 Ld extends Dl{constructor(t,e,i,s,r){super(t,wd),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 Dd=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 Ad={none:0,word:1,char:2,character:2,mix:3};var Yd=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=jd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=jd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Id(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Id(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Id(t,"wrapMode");void 0===c&&(c=Id(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Ad[c]);var u=Id(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Id(t,"letterSpacing",0),v=Id(t,"hAlign",0),g=Id(t,"vAlign",0),f=Id(t,"justifyPercentage",.25),m=Dd({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 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=Nd(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Nd(t,"maxLines",0);var a=0===i,o=Nd(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Nd(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Nd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Nd(t,"letterSpacing",0),p=Nd(t,"rtl",!0),v=Nd(t,"hAlign",p?2:0),g=Nd(t,"vAlign",0),f=Dd({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 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 Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(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),gd(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 fd(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(md);return null===i?i=new Pd(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)),$l(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 gc=Phaser.Utils.Objects.GetFastValue;var fc={};class mc{constructor(t){this.pools=gc(t,"pools",fc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new vc),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=Pc(t,r,e,i,n),a=0;a<=Sc&&0!==h;a++){if((r+=h)<0){r=0;break}h=Pc(t,r,e,i,n)}return a===Sc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),_c(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]},Pc=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)},_c=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 Tc=Phaser.Utils.Objects.GetValue,kc=Phaser.Utils.Objects.GetValue;class Ec extends Qo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=kc(e,"background",void 0),r=kc(e,"icon",void 0),n=kc(e,"iconMask",void 0),h=kc(e,"text",void 0),a=kc(e,"action",void 0),o=kc(e,"actionMask",void 0),l=kc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:kc(e,"space.icon",0),top:kc(e,"space.iconTop",0),bottom:kc(e,"space.iconBottom",0),left:kc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:kc(e,"space.icon",0),left:kc(e,"space.iconLeft",0),right:kc(e,"space.iconRight",0),top:kc(e,"space.iconTop",0)});var d=kc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=rl.call(this,r,r,1)),!d){var c=kc(e,"iconSize",void 0);this.setIconSize(kc(e,"iconWidth",c),kc(e,"iconHeight",c))}}if(h){var u=kc(e,"wrapText",!1),p=kc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(ll(t)){case 0:switch("string"==typeof e&&(e=wl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=ul;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=wl[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,wc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Tc(e,"minWidth",0),s=Tc(e,"minHeight",0),r=Tc(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 Cc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Cc(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=kc(e,"space.text",0),m=kc(e,"expandTextWidth",!1),y=kc(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:kc(e,"space.actionTop",0),bottom:kc(e,"space.actionBottom",0),right:kc(e,"space.actionRight",0)}:{left:kc(e,"space.actionLeft",0),right:kc(e,"space.actionRight",0),bottom:kc(e,"space.actionBottom",0)},d=kc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=rl.call(this,a,a,1)),!d)){var b=kc(e,"actionSize");this.setActionSize(kc(e,"actionWidth",b),kc(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 Mc=Phaser.GameObjects.Text,Rc=Phaser.Utils.Objects.GetValue;class Lc extends Mc{constructor(t,e){void 0===e&&(e={}),super(t,Rc(e,"x",0),Rc(e,"y",0),Rc(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(Lc.prototype,va);var Dc=Phaser.Renderer.WebGL.Utils,Ac={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=Dc.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 Yc=Phaser.Display.Canvas.CanvasPool;e();const zc=Phaser.GameObjects.GameObject;class Xc extends zc{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=Yc.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 Yc.remove(s),i;for(var l=r.getImageData(0,0,h,o).data,d=!1,c=0;c * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Fc=Phaser.Display.Canvas.CanvasPool;var Ic=function(t){var e=Fc.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 Fc.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,Fc.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!==ml&&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=wl[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]=Hc(t,l,d);else{var u=Bc(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Hc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Hc(t,"fill",null);null!==v&&(this.color=ed(v));var g=Hc(t,"metrics",!1);return g?this.metrics={ascent:Hc(g,"ascent",0),descent:Hc(g,"descent",0),fontSize:Hc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Ic(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=Ic(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=Hc(t,"fontFamily","Courier"),this.fontSize=Hc(t,"fontSize","16px"),this.fontStyle=Hc(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=ed(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ed(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=ed(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=ed(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=ed(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=ed(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=ed(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=ed(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=ed(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=ed(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=ed(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=ed(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=wl[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=Hc(e,"fontFamily",this.fontFamily),this.fontSize=Hc(e,"fontSize",this.fontSize),this.fontStyle=Hc(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 Gc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),od(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 w=l;w0){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 Vc=Phaser.Utils.Objects.GetValue,Uc=vl,$c=gl;class Jc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Vc(t,"text",""),this.x=Vc(t,"x",0),this.y=Vc(t,"y",0),this.width=Vc(t,"width",0);var e=Vc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Vc(t,"newLineMode",0),this.startIndex=Vc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===$c&&(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===$c&&(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 Kc=Phaser.Utils.Objects.GetFastValue,qc=vl,Zc=fl;class Qc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Kc(t,"tagToText",Xt),this.tagToTextScope=Kc(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 tu={};const eu=Phaser.Geom.Rectangle;var iu=new vc;class su{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&mu(g)){""!==b?h.push(n.getLine(b,x,du)):0===w&&r>0&&h.push(n.getLine("",0,du)),h.push(...gu(g,e,pu,s,0,n));var C=h.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,du)),b=g,x=f,o=s):(b+=g,x=m),w===S-1&&h.push(n.getLine(b,x,l))}return h},fu=function(t,e){var i;switch(e){case uu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==bu&&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 Qc({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=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Pp(this.sizerChildren,null),vh.call(this,t),this}},_p={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Pp(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},Rp={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=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,Pp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Pp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Dp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Ap=Phaser.Utils.Objects.IsPlainObject,Yp=Phaser.Utils.Objects.GetValue;class zp extends th{constructor(t,e,i,s,r,n,h,a,o,l){Ap(e)?(e=Yp(l=e,"x",0),i=Yp(l,"y",0),s=Yp(l,"width",void 0),r=Yp(l,"height",void 0),n=Yp(l,"column",l.col||0),h=Yp(l,"row",0),a=Yp(l,"columnProportions",0),o=Yp(l,"rowProportions",0)):Ap(s)?(s=Yp(l=s,"width",void 0),r=Yp(l,"height",void 0),n=Yp(l,"column",l.col||0),h=Yp(l,"row",0),a=Yp(l,"columnProportions",0),o=Yp(l,"rowProportions",0)):Ap(n)?(n=Yp(l=n,"column",l.col||0),h=Yp(l,"row",0),a=Yp(l,"columnProportions",0),o=Yp(l,"rowProportions",0)):Ap(a)&&(a=Yp(l=a,"columnProportions",0),o=Yp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Yp(l,"createCellContainerCallback")),this.setIndentLeft(Yp(l,"space.indentLeftOdd",0),Yp(l,"space.indentLeftEven",0)),this.setIndentTop(Yp(l,"space.indentTopOdd",0),Yp(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Yp(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=Lp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Dp.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(zp.prototype,Rp);const Xp=Phaser.Utils.Objects.GetValue,Wp=Phaser.Math.Percent;var jp=function(t,e,i){var s;return t.y===e.y?s=Wp(i.x,t.x,e.x):t.x===e.x&&(s=Wp(i.y,t.y,e.y)),s},Fp=function(t,e,i){var s,r;this.enable&&(Ip.x=e,Ip.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=jp(s,r,Ip))},Ip={},Bp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Hp.x=t.worldX,Hp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=jp(s,r,Hp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Hp={},Np=function(t,e){void 0===e&&(e=Gp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(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},Gp={};const Vp=Phaser.Display.Align.LEFT_CENTER,Up=Phaser.Display.Align.TOP_CENTER;var $p={};const Jp=Phaser.Display.Align.RIGHT_CENTER,Kp=Phaser.Display.Align.BOTTOM_CENTER;var qp={};const Zp=Phaser.Math.Linear;var Qp={};const tv=Phaser.Display.Align.LEFT_CENTER,ev=Phaser.Display.Align.TOP_CENTER,iv=Phaser.Display.Align.RIGHT_CENTER,sv=Phaser.Display.Align.BOTTOM_CENTER,rv=Phaser.Utils.Objects.GetValue,nv=Phaser.Utils.Objects.IsPlainObject,hv=Phaser.Math.Clamp,av=Phaser.Math.Snap.To;class ov extends(Ma(_h)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=rv(e,"reverseAxis",!1);var i=rv(e,"background",void 0),s=rv(e,"track",void 0),r=rv(e,"indicator",void 0),n=rv(e,"thumb",void 0);if(i&&(nv(i)&&(i=$o(t,i)),this.addBackground(i)),s&&(nv(s)&&(s=$o(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(nv(r)&&(r=$o(t,r)),this.pin(r)),n){nv(n)&&(n=$o(t,n)),this.pin(n);var h=rv(e,"thumbOffsetX",0),a=rv(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=rv(e,"input",0);switch("string"==typeof o&&(o=lv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Fp,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",Bp,this).on("pointermove",Bp,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(rv(e,"enable",void 0)),this.setGap(rv(e,"gap",void 0)),this.setValue(rv(e,"value",0),rv(e,"min",void 0),rv(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=av(t,this.gap));var e=this._value;this._value=hv(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 lv={pan:0,drag:0,click:1,none:-1};var dv={getStartPoint:function(t){if(void 0===t&&(t=$p),this.childrenMap.thumb){var e=0===this.orientation?Vp:Up;Np.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=qp),this.childrenMap.thumb){var e=0===this.orientation?Jp:Kp;Np.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=Qp),s.x=Zp(e.x,i.x,t),s.y=Zp(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,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?iv:sv:0===this.orientation?tv:ev,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(ov.prototype,dv);const cv=Phaser.Utils.Objects.GetValue;class uv extends _h{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=cv(e,"background",void 0),n=cv(e,"buttons",void 0),h=cv(n,"top",cv(n,"left",void 0)),a=cv(n,"bottom",cv(n,"right",void 0)),o=cv(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===cv(o,"width",void 0)?1:0:void 0===cv(o,"height",void 0)?1:0,i=new ov(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=cv(e,"valuechangeCallback",null);if(null!==d){var c=cv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(cv(e,"enable",void 0)),this.setValue(cv(e,"value",0)),this.setScrollStep(cv(n,"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 pv extends Rs{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 vv=Phaser.Utils.Objects.GetValue,gv=Phaser.Math.Distance.Between;class fv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=vv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(vv(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(vv(t,"enable",!0)),this.holdThreshold=vv(t,"holdThreshold",50),this.pointerOutReleaseEnable=vv(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 dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:gv(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 mv=Phaser.Utils.Objects.GetValue;class yv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(mv(t,"value",0)),this.setSpeed(mv(t,"speed",0)),this.setAcceleration(mv(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 bv{constructor(){this.value,this.dir,this.movement=new yv}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 Cv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Ov=Phaser.Utils.Objects.GetValue;class Pv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Ov(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Ov(e,"speed",.1)),this.setEnable(Ov(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Ov(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 Tv=Phaser.Utils.Objects.GetValue;var _v=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)?Tv(s,l,void 0):Tv(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 uv(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=Tv(r,"position",0);"string"==typeof p&&(p=kv[p]);var v,g,f=Tv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Tv(s,"space.slider",void 0))&&(a?f=0:v=Tv(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:Tv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Tv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Tv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Tv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Tv(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Tv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Tv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Tv(s,"scrollDetectionMode");"string"==typeof b&&(b=Ev[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Tv(s,x,!0):Tv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Sv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var w,S,C,O,P,T=Tv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==b&&(T.focus=1===b?2:0),w=new Pv(o,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,w),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",w)),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?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),w&&(P=a?`addChildO${i}`:"addChildOY",w.on("scroll",(function(e){t[P](-e,!0)})))};const kv={right:0,left:1,bottom:0,top:1},Ev={gameObject:0,rectBounds:1},Mv=Phaser.Utils.Objects.GetValue;var Rv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Mv(e,"width"),h=Mv(e,"height");n||Mv(e,"child.expandWidth",!0)||(s[1]=0),h||Mv(e,"child.expandHeight",!0)||(r[1]=0);var a=new zp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Xp(i,"child"),r=Xp(s,"gameObject",void 0);if(r){var n=Xp(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=Xp(n,"top",0),h.bottom=Xp(n,"bottom",0),a.left=Xp(n,"left",0),a.right=Xp(n,"right",0);break;case 1:h.top=Xp(n,"left",0),h.bottom=Xp(n,"right",0),a.top=Xp(n,"top",0),a.bottom=Xp(n,"bottom",0);break;default:h.top=Xp(n,"top",0),h.bottom=Xp(n,"bottom",0),h.left=Xp(n,"left",0),h.right=Xp(n,"right",0)}e.add(r,{column:1,row:1,align:Xp(s,"align","center"),padding:a,expand:{width:Xp(s,"expandWidth",!0),height:Xp(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:_v(t,a,"y",e);break;case 1:_v(t,a,"x",e);break;default:_v(t,a,"y",e),_v(t,a,"x",e)}return a},Lv=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)},Dv=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)}},Av=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(Fv.call(this,-this.textOY)),0),e=Iv.call(this,t)+this.textOY,i=Bv.call(this,t);return function(t,e){switch(ll(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,Hv.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,Ie.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,Gv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Hv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Uv=Phaser.Utils.Objects.IsPlainObject,$v=Phaser.Utils.Objects.GetValue,Jv=Phaser.Display.Align.TOP_LEFT;class Kv extends th{constructor(t,e,i,s,r,n){Uv(e)?(e=$v(n=e,"x",0),i=$v(n,"y",0),s=$v(n,"width",void 0),r=$v(n,"height",void 0)):Uv(s)&&(s=$v(n=s,"width",void 0),r=$v(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=$v(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode($v(n,"clampTextOY",!0)),this.alwaysScrollable=$v(n,"alwaysScrollable",!1);var h=$v(n,"background",void 0),a=$v(n,"text",void 0);void 0===a&&(a=qv(t)),this.textCropEnable=$v(n,"textCrop",!!a.setCrop);var o=$v(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Jv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=ll(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=rl.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(Fv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Iv.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 qv=function(t){return t.add.text(0,0,"")};Object.assign(Kv.prototype,Vv);var Zv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Qv={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 tg=Phaser.Utils.Objects.GetValue;class eg extends Wv{constructor(t,e){void 0===e&&(e={});var i=tg(e,"text",void 0),s=tg(e,"textWidth",void 0),r=tg(e,"textHeight",void 0),n=tg(e,"textCrop",!!i.setCrop),h=tg(e,"textMask",!n),a=tg(e,"content",""),o=new Kv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:tg(e,"clampChildOY",!1),alwaysScrollable:tg(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=tg(e,"space",void 0);l&&(l.child=tg(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(eg.prototype,Zv,Qv);const ig=Phaser.Utils.Objects.GetValue;var sg=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 gp(t,e);break;case"bbcodetext":case"bbcode":s=new cp(t,0,0,"",e);break;case"label":s=new hg(t,e);break;case"textarea":s=function(t,e,i){e=e?ko(e):{};var s=ig(i,"background",$o),r=ig(i,"text",sg),n=ig(i,"track",$o),h=ig(i,"thumb",$o);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 eg(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Lc(t,e)}return Uo(s,e),t.add.existing(s),s},rg=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 Go(t,e):new So(t,e);break;case"roundRectangle":s=new ga(t,e);break;default:s=new To(t,e)}return Uo(s,e),t.add.existing(s),s};const ng=Phaser.Utils.Objects.GetValue;class hg extends Ec{constructor(t,e,i){e=function(t,e,i){e=e?ko(e):{};var s=ng(i,"background",$o),r=ng(i,"text",sg),n=ng(i,"icon",rg),h=ng(i,"action",rg);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 ag(this.getChildren(),"setActiveState",t),this}setHoverState(t){return ag(this.getChildren(),"setHoverState",t),this}setDisableState(t){return ag(this.getChildren(),"setDisableState",t),this}}var ag=function(t,e,i){for(var s=0,r=t.length;s0&&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=Cg(r,"x",null);null!==n?(t=n,i=n):(t=Cg(r,"left",0),i=Cg(r,"right",t));var h=Cg(r,"y",null);null!==h?(e=h,s=h):(e=Cg(r,"top",0),s=Cg(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 Tg(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Pg(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const kg={right:0,down:1,left:2,up:3};var Eg=function(t){return"string"==typeof t&&(t=kg[t]),t%=4};Object.assign(_g.prototype,wg,Sg);var Mg=function(t,e,i){var s=new _g(t,e);return t.add.existing(s),s.on("expand.start",(function(t){t.setDirection("down")})).on("collapse.complete",(function(t){t.setDirection("right")})),s};const Rg=Phaser.Utils.Objects.GetValue,Lg=Phaser.Utils.Objects.GetValue,Dg=Phaser.Utils.Objects.Clone,Ag=Phaser.Utils.Objects.GetValue;class Yg extends(kh(Yh)){constructor(t,e){void 0===e&&(e={});var i=Xh(t,Ag(e,"background"),{isLeaf:!1},Jo,!1),s=function(t,e){var i=new _h(t,{orientation:Lg(e,"childrenOrientation","y")});t.add.existing(i);var s=Xh(t,Lg(e,"childrenBackground"),{isLeaf:!1},Jo,!1);return s&&i.addBackground(s),i}(t,e),r=s.childrenMap.items,n=function(t,e){var i=new dg(t,e,{isLeaf:!1});t.add.existing(i);var s=Xh(t,Rg(e,"toggleButton"),{isLeaf:!1},Mg,!0);return i.insert(0,s,{padding:{right:Rg(e,"space.toggleButton",0)},fitRatio:1}),i.addChildrenMap("toggleButton",s),i}(t,e),h=n.childrenMap.toggleButton,a=n.childrenMap.nodeBody,o=Oh(Ag(e,"orientation","y")),l=e.space;if(l){var d=Ag(l,"indent",0);l.childLeft=Ag(l,"indentLeft",1===o?d:0),l.childRight=Ag(l,"indentRight",0),l.childTop=Ag(l,"indentTop",0===o?d:0),l.childBottom=Ag(l,"indentBottom",0)}super(t,{background:i,title:n,child:s,toggleByTarget:h,transition:e.transition,orientation:o,space:l,align:e.align,expand:e.expand}),this.type="rexTree",this.rexSizer.treeParent=null,this.nodesMap={},this.configSave=e,this.nodeBody=a,this.addChildrenMap("toggleButton",h),this.addChildrenMap("nodeBody",a),this.addChildrenMap("childrenNodes",r),this.on("expand.start",(function(){h.emit("expand.start",h),zg(this,"expand.start")}),this).on("expand.complete",(function(){h.emit("expand.complete",h),zg(this,"expand.complete")})).on("collapse.start",(function(){h.emit("collapse.start",h),zg(this,"collapse.start")})).on("collapse.complete",(function(){h.emit("collapse.complete",h),zg(this,"collapse.complete")}));var c=this;c._postAddCallback=function(){var t=Ag(e,"expanded",!0);void 0!==t&&c.setExpandedState(t),delete c._postAddCallback}}destroy(t){this.scene&&!this.ignoreDestroy&&(this.configSave=void 0,Clear(this.nodesMap),this.nodesMap=void 0,super.destroy(t))}get isTree(){return!0}createTree(t){return Yg.CreateTree(this.scene,this.configSave,t)}isTreeObject(t){return t&&t instanceof Yg}}Yg.CreateTree=function(t,e,i){return new Yg(t,function(t,e){var i=t?Dg(t):{};if(!e)return i;for(var s in e)i[s]=e[s];return i}(e,i))};var zg=function(t,e){var i=t.getTreesSizer();i&&i.emit(e,t)};Object.assign(Yg.prototype,fg);const Xg=Phaser.Utils.String.UUID;var Wg={addTree(t){return bt(t)&&(t={nodeBody:t,nodeKey:nodeKey}),this.insertTree(void 0,t)},insertTree(t,e){var i;"string"==typeof e?(i=e,e=void 0):e&&(i=e.nodeKey,delete e.nodeKey),void 0===i&&(i=Xg());var s=Yg.CreateTree(this.scene,this.treeConfig,e);return cg(this,s),s.nodeKey=i,this.treesMap[i]=s,this.insert(t,s,{expand:!0}),s._postAddCallback(),s}},jg={removeTree(t,e){return"string"==typeof t&&(t=this.getTree(t)),t?(delete this.treesMap[t.nodeKey],t.nodeKey=null,this.remove(t,e),this):this},removeAllNodes(t){var e=this.treesMap;for(var i in e)this.removeTree(e[i],t);return this}},Fg={getTree(t){return this.treesMap[t]},getTrees(t){for(var e in void 0===t&&(t=[]),this.treesMap)t.push(this.treesMap[e]);return t},getNode(t){var e=t.indexOf(".");if(-1===e)return this.getTree(t);var i=this.getTree(t.substring(0,e));return i?i.getNode(t.substring(e+1)):void 0}},Ig={pointToChild:function(t,e,i,s){for(var r in this.treesMap){var n=this.treesMap[r];if(lr(n.nodeBody,t,e,i,s))return n;var h=n.pointToChild(t,e,i,s);if(h)return h}return null},setChildrenInteractive:function(t){return void 0===t&&(t={}),t.targetMode="parent",t.targetSizers=[this],qn(this,t),this}};Object.assign(Ig,Wg,jg,Fg);const Bg=Phaser.Utils.Objects.GetValue;class Hg extends _h{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation="y"),super(t,e),this.type="rexTrees",this.treesMap={},this.treeConfig=Bg(e,"tree")}destroy(t){this.scene&&!this.ignoreDestroy&&(this.treeConfig=void 0,Clear(this.treesMap),this.treesMap=void 0,super.destroy(t))}}return Object.assign(Hg.prototype,Ig),Hg},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextrees=e(); + */const Fc=Phaser.Display.Canvas.CanvasPool;var Ic=function(t){var e=Fc.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 Fc.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,Fc.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!==ml&&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=wl[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]=Hc(t,l,d);else{var u=Bc(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Hc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Hc(t,"fill",null);null!==v&&(this.color=ed(v));var g=Hc(t,"metrics",!1);return g?this.metrics={ascent:Hc(g,"ascent",0),descent:Hc(g,"descent",0),fontSize:Hc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Ic(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=Ic(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=Hc(t,"fontFamily","Courier"),this.fontSize=Hc(t,"fontSize","16px"),this.fontStyle=Hc(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=ed(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ed(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=ed(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=ed(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=ed(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=ed(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=ed(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=ed(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=ed(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=ed(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=ed(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=ed(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=wl[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=Hc(e,"fontFamily",this.fontFamily),this.fontSize=Hc(e,"fontSize",this.fontSize),this.fontStyle=Hc(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 Gc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),od(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 w=l;w0){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 Vc=Phaser.Utils.Objects.GetValue,Uc=vl,$c=gl;class Jc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Vc(t,"text",""),this.x=Vc(t,"x",0),this.y=Vc(t,"y",0),this.width=Vc(t,"width",0);var e=Vc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Vc(t,"newLineMode",0),this.startIndex=Vc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===$c&&(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===$c&&(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 Kc=Phaser.Utils.Objects.GetFastValue,qc=vl,Zc=fl;class Qc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Kc(t,"tagToText",Xt),this.tagToTextScope=Kc(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 tu={};const eu=Phaser.Geom.Rectangle;var iu=new vc;class su{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&mu(g)){""!==b?h.push(n.getLine(b,x,du)):0===w&&r>0&&h.push(n.getLine("",0,du)),h.push(...gu(g,e,pu,s,0,n));var C=h.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,du)),b=g,x=f,o=s):(b+=g,x=m),w===S-1&&h.push(n.getLine(b,x,l))}return h},fu=function(t,e){var i;switch(e){case uu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==bu&&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 Qc({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=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Pp(this.sizerChildren,null),vh.call(this,t),this}},Tp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Pp(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},Rp={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=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,Pp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Pp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Dp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Ap=Phaser.Utils.Objects.IsPlainObject,Yp=Phaser.Utils.Objects.GetValue;class zp extends th{constructor(t,e,i,s,r,n,h,a,o,l){Ap(e)?(e=Yp(l=e,"x",0),i=Yp(l,"y",0),s=Yp(l,"width",void 0),r=Yp(l,"height",void 0),n=Yp(l,"column",l.col||0),h=Yp(l,"row",0),a=Yp(l,"columnProportions",0),o=Yp(l,"rowProportions",0)):Ap(s)?(s=Yp(l=s,"width",void 0),r=Yp(l,"height",void 0),n=Yp(l,"column",l.col||0),h=Yp(l,"row",0),a=Yp(l,"columnProportions",0),o=Yp(l,"rowProportions",0)):Ap(n)?(n=Yp(l=n,"column",l.col||0),h=Yp(l,"row",0),a=Yp(l,"columnProportions",0),o=Yp(l,"rowProportions",0)):Ap(a)&&(a=Yp(l=a,"columnProportions",0),o=Yp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Yp(l,"createCellContainerCallback")),this.setIndentLeft(Yp(l,"space.indentLeftOdd",0),Yp(l,"space.indentLeftEven",0)),this.setIndentTop(Yp(l,"space.indentTopOdd",0),Yp(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Yp(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=Lp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Dp.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(zp.prototype,Rp);const Xp=Phaser.Utils.Objects.GetValue,Wp=Phaser.Math.Percent;var jp=function(t,e,i){var s;return t.y===e.y?s=Wp(i.x,t.x,e.x):t.x===e.x&&(s=Wp(i.y,t.y,e.y)),s},Fp=function(t,e,i){var s,r;this.enable&&(Ip.x=e,Ip.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=jp(s,r,Ip))},Ip={},Bp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Hp.x=t.worldX,Hp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=jp(s,r,Hp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Hp={},Np=function(t,e){void 0===e&&(e=Gp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(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},Gp={};const Vp=Phaser.Display.Align.LEFT_CENTER,Up=Phaser.Display.Align.TOP_CENTER;var $p={};const Jp=Phaser.Display.Align.RIGHT_CENTER,Kp=Phaser.Display.Align.BOTTOM_CENTER;var qp={};const Zp=Phaser.Math.Linear;var Qp={};const tv=Phaser.Display.Align.LEFT_CENTER,ev=Phaser.Display.Align.TOP_CENTER,iv=Phaser.Display.Align.RIGHT_CENTER,sv=Phaser.Display.Align.BOTTOM_CENTER,rv=Phaser.Utils.Objects.GetValue,nv=Phaser.Utils.Objects.IsPlainObject,hv=Phaser.Math.Clamp,av=Phaser.Math.Snap.To;class ov extends(Ma(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=rv(e,"reverseAxis",!1);var i=rv(e,"background",void 0),s=rv(e,"track",void 0),r=rv(e,"indicator",void 0),n=rv(e,"thumb",void 0);if(i&&(nv(i)&&(i=$o(t,i)),this.addBackground(i)),s&&(nv(s)&&(s=$o(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(nv(r)&&(r=$o(t,r)),this.pin(r)),n){nv(n)&&(n=$o(t,n)),this.pin(n);var h=rv(e,"thumbOffsetX",0),a=rv(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=rv(e,"input",0);switch("string"==typeof o&&(o=lv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Fp,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",Bp,this).on("pointermove",Bp,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(rv(e,"enable",void 0)),this.setGap(rv(e,"gap",void 0)),this.setValue(rv(e,"value",0),rv(e,"min",void 0),rv(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=av(t,this.gap));var e=this._value;this._value=hv(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 lv={pan:0,drag:0,click:1,none:-1};var dv={getStartPoint:function(t){if(void 0===t&&(t=$p),this.childrenMap.thumb){var e=0===this.orientation?Vp:Up;Np.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=qp),this.childrenMap.thumb){var e=0===this.orientation?Jp:Kp;Np.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=Qp),s.x=Zp(e.x,i.x,t),s.y=Zp(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,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?iv:sv:0===this.orientation?tv:ev,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(ov.prototype,dv);const cv=Phaser.Utils.Objects.GetValue;class uv extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=cv(e,"background",void 0),n=cv(e,"buttons",void 0),h=cv(n,"top",cv(n,"left",void 0)),a=cv(n,"bottom",cv(n,"right",void 0)),o=cv(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===cv(o,"width",void 0)?1:0:void 0===cv(o,"height",void 0)?1:0,i=new ov(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=cv(e,"valuechangeCallback",null);if(null!==d){var c=cv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(cv(e,"enable",void 0)),this.setValue(cv(e,"value",0)),this.setScrollStep(cv(n,"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 pv extends Rs{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 vv=Phaser.Utils.Objects.GetValue,gv=Phaser.Math.Distance.Between;class fv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=vv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(vv(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(vv(t,"enable",!0)),this.holdThreshold=vv(t,"holdThreshold",50),this.pointerOutReleaseEnable=vv(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 dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:gv(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 mv=Phaser.Utils.Objects.GetValue;class yv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(mv(t,"value",0)),this.setSpeed(mv(t,"speed",0)),this.setAcceleration(mv(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 bv{constructor(){this.value,this.dir,this.movement=new yv}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 Cv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Ov=Phaser.Utils.Objects.GetValue;class Pv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Ov(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Ov(e,"speed",.1)),this.setEnable(Ov(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Ov(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 _v=Phaser.Utils.Objects.GetValue;var Tv=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)?_v(s,l,void 0):_v(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 uv(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=_v(r,"position",0);"string"==typeof p&&(p=kv[p]);var v,g,f=_v(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=_v(s,"space.slider",void 0))&&(a?f=0:v=_v(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:_v(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:_v(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:_v(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:_v(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=_v(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=_v(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=_v(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=_v(s,"scrollDetectionMode");"string"==typeof b&&(b=Ev[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?_v(s,x,!0):_v(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Sv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var w,S,C,O,P,_=_v(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),w=new Pv(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,w),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",w)),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?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),w&&(P=a?`addChildO${i}`:"addChildOY",w.on("scroll",(function(e){t[P](-e,!0)})))};const kv={right:0,left:1,bottom:0,top:1},Ev={gameObject:0,rectBounds:1},Mv=Phaser.Utils.Objects.GetValue;var Rv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Mv(e,"width"),h=Mv(e,"height");n||Mv(e,"child.expandWidth",!0)||(s[1]=0),h||Mv(e,"child.expandHeight",!0)||(r[1]=0);var a=new zp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Xp(i,"child"),r=Xp(s,"gameObject",void 0);if(r){var n=Xp(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=Xp(n,"top",0),h.bottom=Xp(n,"bottom",0),a.left=Xp(n,"left",0),a.right=Xp(n,"right",0);break;case 1:h.top=Xp(n,"left",0),h.bottom=Xp(n,"right",0),a.top=Xp(n,"top",0),a.bottom=Xp(n,"bottom",0);break;default:h.top=Xp(n,"top",0),h.bottom=Xp(n,"bottom",0),h.left=Xp(n,"left",0),h.right=Xp(n,"right",0)}e.add(r,{column:1,row:1,align:Xp(s,"align","center"),padding:a,expand:{width:Xp(s,"expandWidth",!0),height:Xp(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Tv(t,a,"y",e);break;case 1:Tv(t,a,"x",e);break;default:Tv(t,a,"y",e),Tv(t,a,"x",e)}return a},Lv=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)},Dv=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)}},Av=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(Fv.call(this,-this.textOY)),0),e=Iv.call(this,t)+this.textOY,i=Bv.call(this,t);return function(t,e){switch(ll(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,Hv.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,Ie.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,Gv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Hv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Uv=Phaser.Utils.Objects.IsPlainObject,$v=Phaser.Utils.Objects.GetValue,Jv=Phaser.Display.Align.TOP_LEFT;class Kv extends th{constructor(t,e,i,s,r,n){Uv(e)?(e=$v(n=e,"x",0),i=$v(n,"y",0),s=$v(n,"width",void 0),r=$v(n,"height",void 0)):Uv(s)&&(s=$v(n=s,"width",void 0),r=$v(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=$v(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode($v(n,"clampTextOY",!0)),this.alwaysScrollable=$v(n,"alwaysScrollable",!1);var h=$v(n,"background",void 0),a=$v(n,"text",void 0);void 0===a&&(a=qv(t)),this.textCropEnable=$v(n,"textCrop",!!a.setCrop);var o=$v(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Jv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=ll(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=rl.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(Fv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Iv.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 qv=function(t){return t.add.text(0,0,"")};Object.assign(Kv.prototype,Vv);var Zv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Qv={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 tg=Phaser.Utils.Objects.GetValue;class eg extends Wv{constructor(t,e){void 0===e&&(e={});var i=tg(e,"text",void 0),s=tg(e,"textWidth",void 0),r=tg(e,"textHeight",void 0),n=tg(e,"textCrop",!!i.setCrop),h=tg(e,"textMask",!n),a=tg(e,"content",""),o=new Kv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:tg(e,"clampChildOY",!1),alwaysScrollable:tg(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=tg(e,"space",void 0);l&&(l.child=tg(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(eg.prototype,Zv,Qv);const ig=Phaser.Utils.Objects.GetValue;var sg=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 gp(t,e);break;case"bbcodetext":case"bbcode":s=new cp(t,0,0,"",e);break;case"label":s=new hg(t,e);break;case"textarea":s=function(t,e,i){e=e?ko(e):{};var s=ig(i,"background",$o),r=ig(i,"text",sg),n=ig(i,"track",$o),h=ig(i,"thumb",$o);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 eg(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Lc(t,e)}return Uo(s,e),t.add.existing(s),s},rg=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 Go(t,e):new So(t,e);break;case"roundRectangle":s=new ga(t,e);break;default:s=new _o(t,e)}return Uo(s,e),t.add.existing(s),s};const ng=Phaser.Utils.Objects.GetValue;class hg extends Ec{constructor(t,e,i){e=function(t,e,i){e=e?ko(e):{};var s=ng(i,"background",$o),r=ng(i,"text",sg),n=ng(i,"icon",rg),h=ng(i,"action",rg);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 ag(this.getChildren(),"setActiveState",t),this}setHoverState(t){return ag(this.getChildren(),"setHoverState",t),this}setDisableState(t){return ag(this.getChildren(),"setDisableState",t),this}}var ag=function(t,e,i){for(var s=0,r=t.length;s0&&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=Cg(r,"x",null);null!==n?(t=n,i=n):(t=Cg(r,"left",0),i=Cg(r,"right",t));var h=Cg(r,"y",null);null!==h?(e=h,s=h):(e=Cg(r,"top",0),s=Cg(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 _g(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Pg(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const kg={right:0,down:1,left:2,up:3};var Eg=function(t){return"string"==typeof t&&(t=kg[t]),t%=4};Object.assign(Tg.prototype,wg,Sg);var Mg=function(t,e,i){var s=new Tg(t,e);return t.add.existing(s),s.on("expand.start",(function(t){t.setDirection("down")})).on("collapse.complete",(function(t){t.setDirection("right")})),s};const Rg=Phaser.Utils.Objects.GetValue,Lg=Phaser.Utils.Objects.GetValue,Dg=Phaser.Utils.Objects.Clone,Ag=Phaser.Utils.Objects.GetValue;class Yg extends(kh(Yh)){constructor(t,e){void 0===e&&(e={});var i=Xh(t,Ag(e,"background"),{isLeaf:!1},Jo,!1),s=function(t,e){var i=new Th(t,{orientation:Lg(e,"childrenOrientation","y")});t.add.existing(i);var s=Xh(t,Lg(e,"childrenBackground"),{isLeaf:!1},Jo,!1);return s&&i.addBackground(s),i}(t,e),r=s.childrenMap.items,n=function(t,e){var i=new dg(t,e,{isLeaf:!1});t.add.existing(i);var s=Xh(t,Rg(e,"toggleButton"),{isLeaf:!1},Mg,!0);return i.insert(0,s,{padding:{right:Rg(e,"space.toggleButton",0)},fitRatio:1}),i.addChildrenMap("toggleButton",s),i}(t,e),h=n.childrenMap.toggleButton,a=n.childrenMap.nodeBody,o=Oh(Ag(e,"orientation","y")),l=e.space;if(l){var d=Ag(l,"indent",0);l.childLeft=Ag(l,"indentLeft",1===o?d:0),l.childRight=Ag(l,"indentRight",0),l.childTop=Ag(l,"indentTop",0===o?d:0),l.childBottom=Ag(l,"indentBottom",0)}super(t,{background:i,title:n,child:s,toggleByTarget:h,transition:e.transition,orientation:o,space:l,align:e.align,expand:e.expand}),this.type="rexTree",this.rexSizer.treeParent=null,this.nodesMap={},this.configSave=e,this.nodeBody=a,this.addChildrenMap("toggleButton",h),this.addChildrenMap("nodeBody",a),this.addChildrenMap("childrenNodes",r),this.on("expand.start",(function(){h.emit("expand.start",h),zg(this,"expand.start")}),this).on("expand.complete",(function(){h.emit("expand.complete",h),zg(this,"expand.complete")})).on("collapse.start",(function(){h.emit("collapse.start",h),zg(this,"collapse.start")})).on("collapse.complete",(function(){h.emit("collapse.complete",h),zg(this,"collapse.complete")}));var c=this;c._postAddCallback=function(){var t=Ag(e,"expanded",!0);void 0!==t&&c.setExpandedState(t),delete c._postAddCallback}}destroy(t){this.scene&&!this.ignoreDestroy&&(this.configSave=void 0,Clear(this.nodesMap),this.nodesMap=void 0,super.destroy(t))}get isTree(){return!0}createTree(t){return Yg.CreateTree(this.scene,this.configSave,t)}isTreeObject(t){return t&&t instanceof Yg}}Yg.CreateTree=function(t,e,i){return new Yg(t,function(t,e){var i=t?Dg(t):{};if(!e)return i;for(var s in e)i[s]=e[s];return i}(e,i))};var zg=function(t,e){var i=t.getTreesSizer();i&&i.emit(e,t)};Object.assign(Yg.prototype,fg);const Xg=Phaser.Utils.String.UUID;var Wg={addTree(t){return bt(t)&&(t={nodeBody:t,nodeKey:nodeKey}),this.insertTree(void 0,t)},insertTree(t,e){var i;"string"==typeof e?(i=e,e=void 0):e&&(i=e.nodeKey,delete e.nodeKey),void 0===i&&(i=Xg());var s=Yg.CreateTree(this.scene,this.treeConfig,e);return cg(this,s),s.nodeKey=i,this.treesMap[i]=s,this.insert(t,s,{expand:!0}),s._postAddCallback(),s}},jg={removeTree(t,e){return"string"==typeof t&&(t=this.getTree(t)),t?(delete this.treesMap[t.nodeKey],t.nodeKey=null,this.remove(t,e),this):this},removeAllNodes(t){var e=this.treesMap;for(var i in e)this.removeTree(e[i],t);return this}},Fg={getTree(t){return this.treesMap[t]},getTrees(t){for(var e in void 0===t&&(t=[]),this.treesMap)t.push(this.treesMap[e]);return t},getNode(t){var e=t.indexOf(".");if(-1===e)return this.getTree(t);var i=this.getTree(t.substring(0,e));return i?i.getNode(t.substring(e+1)):void 0}},Ig={pointToChild:function(t,e,i,s){for(var r in this.treesMap){var n=this.treesMap[r];if(lr(n.nodeBody,t,e,i,s))return n;var h=n.pointToChild(t,e,i,s);if(h)return h}return null},setChildrenInteractive:function(t){return void 0===t&&(t={}),t.targetMode="parent",t.targetSizers=[this],qn(this,t),this}};Object.assign(Ig,Wg,jg,Fg);const Bg=Phaser.Utils.Objects.GetValue;class Hg extends Th{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation="y"),super(t,e),this.type="rexTrees",this.treesMap={},this.treeConfig=Bg(e,"tree")}destroy(t){this.scene&&!this.ignoreDestroy&&(this.treeConfig=void 0,Clear(this.treesMap),this.treesMap=void 0,super.destroy(t))}}return Object.assign(Hg.prototype,Ig),Hg},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextrees=e(); diff --git a/dist/rextweaker.js b/dist/rextweaker.js index bd8a076a98..c79ebe6328 100644 --- a/dist/rextweaker.js +++ b/dist/rextweaker.js @@ -28611,6 +28611,12 @@ } else if (TagRegex.RE_SIZE_CLOSE.test(text)) { UpdateProp(prevProp, PROP_REMOVE, 'size'); + } else if (TagRegex.RE_FAMILY_OPEN.test(text)) { + var innerMatch = text.match(TagRegex.RE_FAMILY_OPEN); + UpdateProp(prevProp, PROP_ADD, 'family', innerMatch[1]); + } else if (TagRegex.RE_FAMILY_CLOSE.test(text)) { + UpdateProp(prevProp, PROP_REMOVE, 'family'); + } else if (TagRegex.RE_COLOR_OPEN.test(text)) { var innerMatch = text.match(TagRegex.RE_COLOR_OPEN); UpdateProp(prevProp, PROP_ADD, 'color', innerMatch[1]); @@ -28888,6 +28894,7 @@ case 'color': case 'weight': + case 'family': case 'stroke': case 'bgcolor': case 'y': @@ -29002,6 +29009,10 @@ var SIZE_OPEN = GetOpenTagRegString(delimiterLeft, delimiterRight, SIZE, NUMBER_PARAM); var SIZE_CLOSE = GetCloseTagRegString(delimiterLeft, delimiterRight, SIZE); + var FAMILY = 'family'; + var FAMILY_OPEN = GetOpenTagRegString(delimiterLeft, delimiterRight, FAMILY, STR_PARAM); + var FAMILY_CLOSE = GetCloseTagRegString(delimiterLeft, delimiterRight, FAMILY); + var COLOR = 'color'; var COLOR_OPEN = GetOpenTagRegString(delimiterLeft, delimiterRight, COLOR, COLOR_PARAM); var COLOR_CLOSE = GetCloseTagRegString(delimiterLeft, delimiterRight, COLOR); @@ -29072,6 +29083,9 @@ TagRegexSave.RE_SIZE_OPEN = new RegExp(SIZE_OPEN, 'i'); TagRegexSave.RE_SIZE_CLOSE = new RegExp(SIZE_CLOSE, 'i'); + TagRegexSave.RE_FAMILY_OPEN = new RegExp(FAMILY_OPEN, 'i'); + TagRegexSave.RE_FAMILY_CLOSE = new RegExp(FAMILY_CLOSE, 'i'); + TagRegexSave.RE_COLOR_OPEN = new RegExp(COLOR_OPEN, 'i'); TagRegexSave.RE_COLOR_CLOSE = new RegExp(COLOR_CLOSE, 'i'); @@ -29121,6 +29135,7 @@ WEIGHT_OPEN, WEIGHT_CLOSE, SIZE_OPEN, SIZE_CLOSE, + FAMILY_OPEN, FAMILY_CLOSE, COLOR_OPEN, COLOR_CLOSE, UNDERLINE_OPEN, UNDERLINE_OPENC, UNDERLINE_CLOSE, STRIKETHROUGH_OPEN, STRIKETHROUGH_OPENC, STRIKETHROUGH_CLOSE, diff --git a/dist/rextweaker.min.js b/dist/rextweaker.min.js index 0ed28cf87b..052b2ddf5c 100644 --- a/dist/rextweaker.min.js +++ b/dist/rextweaker.min.js @@ -1,11 +1,11 @@ -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}},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 j=Phaser.Utils.Array;var X={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Me=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,Re=Phaser.Utils.Objects.GetValue;var Le=function(t,e){return void 0===e?t:t[e]},De=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=Re(e,"left",0),t.right=Re(e,"right",0),t.top=Re(e,"top",0),t.bottom=Re(e,"bottom",0)),t},Ae={getInnerPadding(t){return Le(this.space,t)},setInnerPadding(t,e){return De(this.space,t,e),this},getOuterPadding(t){return Le(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return De(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e,i),this}},Be=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},We=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}},Ie=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},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?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==xi&&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=xi):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case xi:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,xi=-1;class Ci extends ci{constructor(t,e){super(t,e),this.timer=new gi}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 wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(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=ki(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 Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear;let Mi=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(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=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(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 Ri=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 Mi(t,h):r.resetFromJSON(h),r.restart(),r},Li=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Mi&&(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 Mi(t,a):n.resetFromJSON(a),n.restart(),n},Di=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ai=function(t){return Di(t,"complete")};const Bi=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(Bi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(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),Ai(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Bi(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=Li(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),Ai(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ai(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Bi(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 Mi(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),Ai(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Wi={};Object.assign(Wi,zi),Wi.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,Ii=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Xi extends Oi{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(Ii(t,"start",this.parent.alpha),Ii(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=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Hi(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},Gi=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 Ui=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(Ui(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),Ai(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ui(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ai(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ai(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ni),$i.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ki=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Zi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ki(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(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=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(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=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(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 ts=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 es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={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(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(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 Zi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=ts(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=ts(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Zi(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),Ai(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),Ai(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(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 Zi&&(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=ts(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=ts(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Zi(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),Ai(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),Ai(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}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class as extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(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=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[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=ns(i,"magnitude",void 0),t=ns(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 hs={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new as(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),Ai(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(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]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{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 vs(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(gs(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(gs(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 ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(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),Di(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}},ys=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 Ws={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(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=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),this.transitOutCallback=t,this}},Is={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}},js={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,Ws,Ys,Is,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new zs(this,{eventEmitter:!1,initState:Fs(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(Hs.prototype,Xs);var Vs=function(t){if(t.parentContainer)return Vs(t.parentContainer);var e=function(t){var e=t.displayList;return N(e)?e:null}(t);return e?Vs(e):t};class Gs extends si{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=Vs(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 Us=Phaser.GameObjects.Rectangle;let Ns=class extends Us{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Gs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const $s=Phaser.Utils.Objects.GetValue;class Ks extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(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 qs=Phaser.Utils.Objects.GetValue;class Zs extends Ns{constructor(t,e){super(t,qs(e,"color",0),qs(e,"alpha",.8)),this.touchEventStop=new Ks(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ri(t,e)},scaleDown(t,e){Li(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){Gi(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},er=function(t,e){Gi(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(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(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),a=sr(e,"anyTouchClose",!1);sr(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),sr(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&&ir(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=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ar=function(t){return t&&"function"==typeof t},hr={modal(t,e){return ar(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(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}},or=function(t,e,i,s,r){ar(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={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 or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(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 kr={press:0,pointerdown:0,release:1,pointerup:1};var Or={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 Sr(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}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Tr(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 _r.length=0,!0;return _r.length=0,!1},_r=[];const Mr=Phaser.Utils.Objects.GetValue;class Er extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=Mr(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(Mr(t,"enable",!0)),this.setMode(Mr(t,"mode",1)),this.setClickInterval(Mr(t,"clickInterval",100)),this.setDragThreshold(Mr(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=Rr[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?Pr:ur)(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 Rr={press:0,pointerdown:0,release:1,pointerup:1};var Lr={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 Er(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 Dr extends Bs{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 Ar=Phaser.Utils.Objects.GetValue;class Br extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Dr,this.parent.setInteractive(Ar(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Ar(t,"enable",!0)),this.setCooldown(Ar(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&&ur(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 Br(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 Br(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}},Yr=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=tn,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===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,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=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class an 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=hn},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case hn:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln: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=ln))}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=hn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=hn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=hn)}get isTapped(){return this.state===ln}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 hn="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;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,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=un},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=vn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=vn)}get isPressed(){return this.state===vn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",vn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var gn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var yn={getDt:function(){return gn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(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 mn(e.x,e.y,t.x,t.y)}},bn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},xn={};const Cn=Phaser.Utils.Objects.GetValue,wn=Phaser.Math.RadToDeg;class Sn 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=kn},eventEmitter:!1};this.setRecongizedStateObject(new Bs(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=On}onDragEnd(){this.state=kn}onDrag(){this.state===On&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=kn)}get isSwiped(){return this.state===Pn}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=bn[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(Sn.prototype,yn);const kn="IDLE",On="BEGIN",Pn="RECOGNIZED",Tn=Phaser.Utils.Objects.GetValue,_n=Phaser.Utils.Array.SpliceOne,Mn=Phaser.Math.Distance.Between,En=Phaser.Math.Angle.Between;class Rn{constructor(t,e){var i=Ze(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(Tn(e,"inputConfig",void 0)),this.setEventEmitter(Tn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Tn(t,"enable",!0)),this.bounds=Tn(t,"bounds",void 0),this.tracerState=Dn,this.pointers.length=0,mt(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,mt(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 Dn:this.tracerState=An,this.onDrag1Start();break;case An:this.tracerState=Bn,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],_n(this.pointers,e),this.tracerState){case An:this.tracerState=Dn,this.onDrag1End();break;case Bn:this.tracerState=An,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 An:this.onDrag1();break;case Bn:this.onDrag2()}}}dragCancel(){return this.tracerState===Bn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Dn,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!==Bn)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Bn)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;Ln.x=e.x-i.x,Ln.y=e.y-i.y}else Ln.x=0,Ln.y=0;return Ln}get centerX(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Bn)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!==Bn)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=zn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Rn.prototype,Ke);var Ln={};const Dn=0,An=1,Bn=2,zn="IDLE";Phaser.Utils.Objects.GetValue;const Wn=Phaser.Math.RotateAround;var Yn=function(t,e,i,s){return Wn(t,e,i,s),t.rotation+=s,t},In={};const jn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Vn=Phaser.Math.DegToRad;var Gn={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=In),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=Xn(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=Xn(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Vn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Gn);const Un="IDLE",Nn="BEGIN",$n="RECOGNIZED",Kn=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=Kn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new an(this,e),this._tap.on("tap",(function(t,e,s){Ir(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=qn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Ir(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Ir(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var ta=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 Sn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ir(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const ea=Phaser.Utils.Objects.GetValue;var ia=function(t,e){return t.setInteractive(),ea(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:ea(e,"targets",[t]),targetMode:ea(e,"targetMode","parent"),eventEmitter:ea(e,"eventEmitter",t),eventNamePrefix:ea(e,"inputEventPrefix","child.")},Xr.call(t,e),Vr.call(t,e),Nr.call(t,e),qr.call(t,e),Jn.call(t,e),Zn.call(t,e),ta.call(t,e),t},sa={getSizerConfig:function(t){return void 0===t&&(t=this),Rt(t)},getChildPrevState:function(t){var e=Rt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=At(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=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(a=le(o,"align","left-top"))&&(a=Wt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(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)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var 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 ua=Phaser.Utils.Objects.IsPlainObject,pa=Phaser.Utils.Objects.GetValue,va=Phaser.Display.Align.CENTER,ga={min:0,full:-1};var fa=function(t,e,i,s,r,n,a,h,o,l){var d,c,u,p;ye.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=ga[e];else if(ua(e)){var f;e=pa(f=e,"proportion",void 0),i=pa(f,"align",va),s=pa(f,"padding",0),r=pa(f,"expand",!1),n=pa(f,"key",void 0),a=pa(f,"index",void 0),t.isRexSizer||(h=pa(f,"minWidth",void 0),o=pa(f,"minHeight",void 0)),l=pa(f,"fitRatio",0),d=pa(f,"offsetX",0),c=pa(f,"offsetY",0),u=pa(f,"offsetOriginX",0),p=pa(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Wt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=va),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(v?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(v?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),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,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},ma={add:fa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fa.call(this,new da(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ua(i)&&(i.index=t),fa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ca.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ya=Et.prototype.clear;var ba=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ya.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,ba.call(this,t),this}},wa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Wt[e]),this.getSizerConfig(t).align=e,this}},Sa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ka={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Oa={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}},Pa={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&&(Ge(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,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(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)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oa.call(this,t,void 0),We.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ie.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oa.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(Pa,ma,Ca,wa,Sa,ka,Oa);var Ta=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},_a={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ma=function(t){return"string"==typeof t&&(t=_a[t]),t};const Ea=Phaser.Utils.Objects.IsPlainObject,Ra=Phaser.Utils.Objects.GetValue;class La extends na{constructor(t,e,i,s,r,n,a){Ea(e)?(e=Ra(a=e,"x",0),i=Ra(a,"y",0),s=Ra(a,"width",void 0),r=Ra(a,"height",void 0),n=Ra(a,"orientation",0)):Ea(s)?(s=Ra(a=s,"width",void 0),r=Ra(a,"height",void 0),n=Ra(a,"orientation",0)):Ea(n)&&(n=Ra(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(Ra(a,"space.item",0)),this.setStartChildIndex(Ra(a,"startChildIndex",0)),this.setRTL(Ra(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ma(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=Ta.call(this)),this._childrenProportion}}Object.assign(La.prototype,Pa);var Da=function(t,e,i,s){return e/t<=i?e/(s-1):0},Aa=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=Ba(h.left,h.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===h.y||r>(o=Ba(h.right,h.centerY,t,e))&&(r=o,s=n+1)}}return s};const Wa=Phaser.Utils.Objects.IsPlainObject,Ya=Phaser.Utils.Objects.GetValue,Ia=Phaser.Display.Align.CENTER;var ja=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ye.call(this,t),Wa(e)&&(e=Ya(o=e,"padding",0),i=Ya(o,"key",void 0),s=Ya(o,"index",void 0),r=Ya(o,"offsetX",0),n=Ya(o,"offsetY",0),a=Ya(o,"offsetOriginX",0),h=Ya(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===h&&(h=0),(o=this.getSizerConfig(t)).align=Ia,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=a,o.alignOffsetOriginY=h,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,n,a,h,o},Xa={add(t,e,i){if(pr(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,ba.call(this,t),this}},Va={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},yh=0,bh=1,xh=2,Ch=0,wh=1,Sh=2,kh=/(?:\r\n|\r|\n)/;const Oh={none:Ch,word:wh,char:Sh,character:Sh,mix:3},Ph=Phaser.Renderer.WebGL.Utils;var Th={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=Ph.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 _h=Phaser.Display.Color;var Mh={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 _h);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}},Eh=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)},Rh={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,Eh(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 Lh=Phaser.Display.Canvas.CanvasPool,Dh=Phaser.GameObjects.GameObject,Ah=Phaser.Utils.String.UUID;let Bh=class extends Dh{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=Lh.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=Ah(),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(){Lh.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(Bh,[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,Th,Mh,Rh]);var Wh={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:Es(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&&mt(this.data),this}};class Yh{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(Yh.prototype,Wh);var Ih={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 jh=Phaser.Math.RotateAround;var Xh;const Fh=Phaser.Geom.Rectangle;var Hh,Vh=function(t){void 0===Hh&&(Hh=new Fh);var e=t.drawTLX,i=t.drawTLY;return Hh.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Hh};const Gh=Phaser.Math.RotateAround;var Uh,Nh=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Uh&&(Uh={}),s=Uh),s.x=e,s.y=i,0!==t.rotation&&Gh(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const $h=Phaser.GameObjects.Components.TransformMatrix;var Kh,Jh,qh={},Zh=function(t,e,i,s,r){var n=Nh(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=qh);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Kh&&(Kh=new $h,Jh=new $h),t.parentContainer?t.getWorldTransformMatrix(Kh,Jh):Kh.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Kh.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Qh=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 Zh(t,e,n,a,r)},to={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===Xh&&(Xh={}),s=Xh),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&jh(s,0,0,-i.rotation),s}(t,e,this,!0);return Vh(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Qh(this.parent,this,t,e,i)}};Object.assign(to,Ih);const eo=Phaser.Math.DegToRad,io=Phaser.Math.RadToDeg,so=Phaser.Utils.Objects.GetValue;class ro extends Yh{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 io(this._rotation)}set angle(t){this.rotation=eo(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=so(t,"width",void 0),i=so(t,"height",void 0),s=so(t,"scaleX",void 0),r=so(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(ro.prototype,to);const no=Phaser.Utils.String.Pad;var ao=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${no(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}},ho=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const oo=Phaser.Utils.Objects.GetValue;let lo=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=oo(t,"x",0),i=oo(t,"y",0));var s=this.cornerRadius;s.tl=co(oo(t,"tl",void 0),e,i),s.tr=co(oo(t,"tr",void 0),e,i),s.bl=co(oo(t,"bl",void 0),e,i),s.br=co(oo(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){uo(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){uo(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){uo(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){uo(this.cornerRadius.br,t)}};var co=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),po(t),t},uo=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=oo(e,"x",0),t.y=oo(e,"y",0)),po(t)},po=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const vo=Phaser.Math.DegToRad;var go=function(t){return!t.hasOwnProperty("convex")||t.convex},fo=function(t){return t.x>0&&t.y>0},mo=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,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,o,l,o,l,180,270,!1,a):mo(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),h=m.tr,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,s-o,l,o,l,270,360,!1,a):mo(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=m.br,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,s-o,r-l,o,l,0,90,!1,a):mo(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=m.bl,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,o,r-l,o,l,90,180,!1,a):mo(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())},bo=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),yo(t.canvas,t.context,d,d,o,l,r,e,i,s,n,a,h)}};const xo=Phaser.Utils.Objects.GetValue;class Co extends ro{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(xo(e,"color",null),xo(e,"color2",null),xo(e,"horizontalGradient",!0)),this.setStroke(xo(e,"stroke",null),xo(e,"strokeThickness",2)),this.setCornerRadius(xo(e,"cornerRadius",0),xo(e,"cornerIteration",null))}set color(t){t=ao(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ao(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=ao(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,ho("color2",t,this),ho("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ho("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ho("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(){bo(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const wo=Phaser.Utils.Objects.GetValue;class So extends ro{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(wo(e,"color",null),wo(e,"color2",null),wo(e,"horizontalGradient",!0)),this.setStroke(wo(e,"stroke",null),wo(e,"strokeThickness",2))}set color(t){t=ao(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ao(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=ao(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,wo(t,"color2",null),wo(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,wo(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 ko=Phaser.Utils.Objects.GetValue;let Oo=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(ko(t,"bold",!1)),this.setItalic(ko(t,"italic",!1)),this.setFontSize(ko(t,"fontSize","16px")),this.setFontFamily(ko(t,"fontFamily","Courier")),this.setColor(ko(t,"color","#fff")),this.setStrokeStyle(ko(t,"stroke",null),ko(t,"strokeThickness",0)),this.setShadow(ko(t,"shadowColor",null),ko(t,"shadowOffsetX",0),ko(t,"shadowOffsetY",0),ko(t,"shadowBlur",0)),this.setOffset(ko(t,"offsetX",0),ko(t,"offsetY",0)),this.setSpace(ko(t,"leftSpace",0),ko(t,"rightSpace",0)),this.setAlign(ko(t,"align",void 0)),this.setBackgroundColor(ko(t,"backgroundColor",null)),this.setBackgroundHeight(ko(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ko(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(ho("stroke",t,this),ho("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ho("shadowOffsetX",t,this),ho("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=ao(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ao(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=ao(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=ao(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 Po=Phaser.Utils.Array.Remove,To=Phaser.Utils.Array.Remove,_o="text",Mo="image",Eo="drawer",Ro="space",Lo="command";var Do=function(t){return t.type===_o&&"\n"===t.text},Ao=function(t){return t.type===_o&&"\f"===t.text},Bo=function(t){return t.type===_o};class zo extends ro{constructor(t,e,i){super(t,_o),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 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 Wo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Yo=Phaser.Display.Canvas.CanvasPool;var Io=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=Yo.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),Yo.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 jo extends ro{constructor(t,e,i){super(t,Mo),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(){Io(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 Xo extends ro{constructor(t,e,i,s){super(t,Eo),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 Fo extends ro{constructor(t,e){super(t,Ro),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 Ho extends Yh{constructor(t,e,i,s,r){super(t,Lo),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 Vo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Vo(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]=Vo(t[i]));return e}var Go=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 Uo={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,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=qo.call(this)).height,a=l.ascent,i=Math.floor((o-a)/n))}else{var l;n=(l=qo.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Qo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Qo(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Qo(t,"wrapMode");void 0===c&&(c=Qo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Uo[c]);var u=Qo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Qo(t,"letterSpacing",0),v=Qo(t,"hAlign",0),g=Qo(t,"vAlign",0),f=Qo(t,"justifyPercentage",.25),m=Go({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 j=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,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=il(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=il(t,"maxLines",0);var h=0===i,o=il(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=il(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=il(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=il(t,"letterSpacing",0),p=il(t,"rtl",!0),v=il(t,"hAlign",p?2:0),g=il(t,"vAlign",0),f=Go({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,Y=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 De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Le(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),Po(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 To(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(_o);return null===i?i=new zo(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)),Qh(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 Tl=Phaser.Utils.Objects.GetFastValue;var _l={};class Ml{constructor(t){this.pools=Tl(t,"pools",_l)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Pl),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=Wl(t,r,e,i,n),h=0;h<=Al&&0!==a;h++){if((r+=a)<0){r=0;break}a=Wl(t,r,e,i,n)}return h===Al&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Yl(t,e,i),t},zl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Wl=function(t,e,i,s,r){var n,a=zl(t,e,r),h=zl(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)},Yl=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 Il=Phaser.Utils.Objects.GetValue,jl=Phaser.Utils.Objects.GetValue;class Xl extends ih{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=jl(e,"background",void 0),r=jl(e,"icon",void 0),n=jl(e,"iconMask",void 0),a=jl(e,"text",void 0),h=jl(e,"action",void 0),o=jl(e,"actionMask",void 0),l=jl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||h)&&(i={right:jl(e,"space.icon",0),top:jl(e,"space.iconTop",0),bottom:jl(e,"space.iconBottom",0),left:jl(e,"space.iconLeft",0)}):(a||h)&&(i={bottom:jl(e,"space.icon",0),left:jl(e,"space.iconLeft",0),right:jl(e,"space.iconRight",0),top:jl(e,"space.iconTop",0)});var d=jl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=oh.call(this,r,r,1)),!d){var c=jl(e,"iconSize",void 0);this.setIconSize(jl(e,"iconWidth",c),jl(e,"iconHeight",c))}}if(a){var u=jl(e,"wrapText",!1),p=jl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(ph(t)){case 0:switch("string"==typeof e&&(e=Oh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=fh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Oh[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,Dl(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Il(e,"minWidth",0),s=Il(e,"minHeight",0),r=Il(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 Bl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Bl(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=jl(e,"space.text",0),m=jl(e,"expandTextWidth",!1),y=jl(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:jl(e,"space.actionTop",0),bottom:jl(e,"space.actionBottom",0),right:jl(e,"space.actionRight",0)}:{left:jl(e,"space.actionLeft",0),right:jl(e,"space.actionRight",0),bottom:jl(e,"space.actionBottom",0)},d=jl(e,"squareFitAction",!1)?1:0,this.add(h,{proportion:0,padding:i,fitRatio:d}),o&&(o=oh.call(this,h,h,1)),!d)){var b=jl(e,"actionSize");this.setActionSize(jl(e,"actionWidth",b),jl(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 Fl=Phaser.Renderer.WebGL.Utils,Hl=function(t,e,i,s,r,n){for(var a=Fl.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+")"},$l=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 Kl=Phaser.Renderer.Canvas.SetTransform;var Jl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ul(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&&Hl(r,a,e,l,h,o),e.isStroked&&Gl(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(Kl(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(Zl.prototype,Jl);var Ql=function(t){return t.x>0&&t.y>0},td=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 ed=Phaser.Math.DegToRad;var id=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=sc(t,"tl",0),this.radiusTR=sc(t,"tr",0),this.radiusBL=sc(t,"bl",0),this.radiusBR=sc(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?id(e,e,e,e,180,270,!1,r,t):id(0,0,e,e,90,0,!0,r,t):td(0,0,t),(e=this.radiusTR)>0?this._convexTR?id(i-e,e,e,e,270,360,!1,r,t):id(i,0,e,e,180,90,!0,r,t):td(i,0,t),(e=this.radiusBR)>0?this._convexBR?id(i-e,s-e,e,e,0,90,!1,r,t):id(i,s,e,e,270,180,!0,r,t):td(i,s,t),(e=this.radiusBL)>0?this._convexBL?id(e,s-e,e,e,90,180,!1,r,t):id(0,s,e,e,360,270,!0,r,t):td(0,s,t),t.push(t[0],t[1]),jd(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var nc=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 ac=Phaser.Utils.Objects.GetValue,hc=Phaser.Utils.Objects.IsPlainObject;class oc extends(Ed(wd)){constructor(t,e,i,s,r,n,a,h){hc(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):hc(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):hc(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 ic).setName("trackFill")).addShape((new ic).setName("bar")).addShape((new ic).setName("trackStroke")),this.setTrackColor(ac(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ac(h,"trackStrokeThickness",2),ac(h,"trackStrokeColor",void 0)),this.setSkewX(ac(h,"skewX",0)),this.setRTL(ac(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 lc={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&&nc(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),nc(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&nc(h,0,0,e,i,t)}};Object.assign(oc.prototype,lc);var dc=function(t){return null==t||""===t||0===t.length},cc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(dc(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(dc(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=Vo(i),s=Vo(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 Mc(t)?(this.stretchMode.edge=Rc(Ec(t,"edge",0)),this.stretchMode.internal=Rc(Ec(t,"internal",0))):(t=Rc(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Dc.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 Bc=Phaser.Utils.Objects.IsPlainObject,zc=Phaser.Utils.Objects.GetValue,Wc=Phaser.GameObjects;var Yc=void 0,Ic=function(t,e){if(Yc||(Yc={},ei(t).events.once("destroy",(function(){for(var t in Yc)Yc[t].destroy();Yc=void 0}))),!Yc.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Wc[e](i)).setOrigin(0),Yc[e]=t}return Yc[e]};const jc=Phaser.GameObjects.RenderTexture;class Xc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Bc(i)?(i=zc(d=i,"x",0),s=zc(d,"y",0),r=zc(d,"width",1),n=zc(d,"height",1),a=zc(d,"key",void 0),h=zc(d,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Bc(r)?(r=zc(d=r,"width",1),n=zc(d,"height",1),a=zc(d,"key",void 0),h=zc(d,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Bc(a)?(a=zc(d=a,"key",void 0),h=zc(d,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Bc(h)?(h=zc(d=h,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=zc(d,"baseFrame",void 0)):Bc(o)&&(o=zc(d=o,"columns",void 0),l=zc(d,"rows",void 0)),void 0===h&&(h=zc(d,"frame",void 0)),void 0===o){var c=zc(d,"leftWidth",void 0),u=zc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=zc(d,"topHeight",void 0),v=zc(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(zc(d,"getFrameNameCallback",void 0)),this.setStretchMode(zc(d,"stretchMode",0)),this.setPreserveRatio(zc(d,"preserveRatio",!0));var g=zc(d,"maxFixedPartScale",1),f=zc(d,"maxFixedPartScaleX",g),m=zc(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,Ac),i}(jc,"rexNinePatch")){}var Fc={_drawImage:function(t,e,i,s,r,n){var a=Ic(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Ic(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Xc.prototype,Fc);let Hc=class extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(vc(t,e))return t[e];var i=t.parent;return vc(i,e)?i[e]:void 0}set(t,e,i){return vc(t,e)?t[e]=i:vc(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 Vc=Phaser.Utils.Objects.GetValue;class Gc extends Xc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Vc(e,"effects",!0);i&&bc(this,i),this.style=new Hc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Gc.prototype,vd);const Uc=["alpha","tint","flipX","flipY"];var Nc=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 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},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=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}},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 j=Phaser.Utils.Array;var X={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 Me=/(\S+)\[(\d+)\]/i,Re=Phaser.Utils.Objects.GetValue;var Le=function(t,e){return void 0===e?t:t[e]},De=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=Re(e,"left",0),t.right=Re(e,"right",0),t.top=Re(e,"top",0),t.bottom=Re(e,"bottom",0)),t},Ae={getInnerPadding(t){return Le(this.space,t)},setInnerPadding(t,e){return De(this.space,t,e),this},getOuterPadding(t){return Le(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return De(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e,i),this}},Be=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},We=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}},Ie=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},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?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==xi&&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=xi):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case xi:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,xi=-1;class Ci extends ci{constructor(t,e){super(t,e),this.timer=new gi}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 wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(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=ki(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 Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear;let Ei=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Mi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(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 Mi={stop:0,destroy:1,yoyo:2};var Ri=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},Li=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},Di=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ai=function(t){return Di(t,"complete")};const Bi=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(Bi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(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),Ai(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Bi(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=Li(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),Ai(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ai(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Bi(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),Ai(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Wi={};Object.assign(Wi,zi),Wi.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,Ii=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Xi extends Oi{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(Ii(t,"start",this.parent.alpha),Ii(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=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Hi(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},Gi=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 Ui=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(Ui(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),Ai(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ui(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ai(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ai(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ni),$i.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ki=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Zi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ki(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(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=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(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=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(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 ts=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 es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={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(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(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 Zi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=ts(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=ts(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Zi(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),Ai(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),Ai(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(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 Zi&&(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=ts(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=ts(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Zi(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),Ai(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),Ai(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}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class as extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(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=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[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=ns(i,"magnitude",void 0),t=ns(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 hs={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new as(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),Ai(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(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]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{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 vs(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(gs(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(gs(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 ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(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),Di(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}},ys=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 Ws={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(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=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),this.transitOutCallback=t,this}},Is={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}},js={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,Ws,Ys,Is,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new zs(this,{eventEmitter:!1,initState:Fs(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(Hs.prototype,Xs);var Vs=function(t){if(t.parentContainer)return Vs(t.parentContainer);var e=function(t){var e=t.displayList;return N(e)?e:null}(t);return e?Vs(e):t};class Gs extends si{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=Vs(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 Us=Phaser.GameObjects.Rectangle;let Ns=class extends Us{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Gs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const $s=Phaser.Utils.Objects.GetValue;class Ks extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(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 qs=Phaser.Utils.Objects.GetValue;class Zs extends Ns{constructor(t,e){super(t,qs(e,"color",0),qs(e,"alpha",.8)),this.touchEventStop=new Ks(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ri(t,e)},scaleDown(t,e){Li(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){Gi(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},er=function(t,e){Gi(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(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(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),a=sr(e,"anyTouchClose",!1);sr(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),sr(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&&ir(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=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ar=function(t){return t&&"function"==typeof t},hr={modal(t,e){return ar(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(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}},or=function(t,e,i,s,r){ar(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={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 or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(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 kr={press:0,pointerdown:0,release:1,pointerup:1};var Or={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 Sr(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}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Tr(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 _r.length=0,!0;return _r.length=0,!1},_r=[];const Er=Phaser.Utils.Objects.GetValue;class Mr extends si{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=Rr[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?Pr:ur)(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 Rr={press:0,pointerdown:0,release:1,pointerup:1};var Lr={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 Mr(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 Dr extends Bs{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 Ar=Phaser.Utils.Objects.GetValue;class Br extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Dr,this.parent.setInteractive(Ar(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Ar(t,"enable",!0)),this.setCooldown(Ar(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&&ur(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 Br(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 Br(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}},Yr=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=tn,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===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,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=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class an 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=hn},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case hn:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln: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=ln))}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=hn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=hn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=hn)}get isTapped(){return this.state===ln}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 hn="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;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,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=un},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=vn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=vn)}get isPressed(){return this.state===vn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",vn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var gn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var yn={getDt:function(){return gn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(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 mn(e.x,e.y,t.x,t.y)}},bn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},xn={};const Cn=Phaser.Utils.Objects.GetValue,wn=Phaser.Math.RadToDeg;class Sn 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=kn},eventEmitter:!1};this.setRecongizedStateObject(new Bs(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=On}onDragEnd(){this.state=kn}onDrag(){this.state===On&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=kn)}get isSwiped(){return this.state===Pn}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=bn[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(Sn.prototype,yn);const kn="IDLE",On="BEGIN",Pn="RECOGNIZED",Tn=Phaser.Utils.Objects.GetValue,_n=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,Mn=Phaser.Math.Angle.Between;class Rn{constructor(t,e){var i=Ze(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(Tn(e,"inputConfig",void 0)),this.setEventEmitter(Tn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Tn(t,"enable",!0)),this.bounds=Tn(t,"bounds",void 0),this.tracerState=Dn,this.pointers.length=0,mt(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,mt(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 Dn:this.tracerState=An,this.onDrag1Start();break;case An:this.tracerState=Bn,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],_n(this.pointers,e),this.tracerState){case An:this.tracerState=Dn,this.onDrag1End();break;case Bn:this.tracerState=An,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 An:this.onDrag1();break;case Bn:this.onDrag2()}}}dragCancel(){return this.tracerState===Bn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Dn,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!==Bn)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!==Bn)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(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;Ln.x=e.x-i.x,Ln.y=e.y-i.y}else Ln.x=0,Ln.y=0;return Ln}get centerX(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Bn)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!==Bn)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=zn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Rn.prototype,Ke);var Ln={};const Dn=0,An=1,Bn=2,zn="IDLE";Phaser.Utils.Objects.GetValue;const Wn=Phaser.Math.RotateAround;var Yn=function(t,e,i,s){return Wn(t,e,i,s),t.rotation+=s,t},In={};const jn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Vn=Phaser.Math.DegToRad;var Gn={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=In),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=Xn(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=Xn(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Vn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Gn);const Un="IDLE",Nn="BEGIN",$n="RECOGNIZED",Kn=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=Kn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new an(this,e),this._tap.on("tap",(function(t,e,s){Ir(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=qn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Ir(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Ir(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var ta=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 Sn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ir(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const ea=Phaser.Utils.Objects.GetValue;var ia=function(t,e){return t.setInteractive(),ea(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:ea(e,"targets",[t]),targetMode:ea(e,"targetMode","parent"),eventEmitter:ea(e,"eventEmitter",t),eventNamePrefix:ea(e,"inputEventPrefix","child.")},Xr.call(t,e),Vr.call(t,e),Nr.call(t,e),qr.call(t,e),Jn.call(t,e),Zn.call(t,e),ta.call(t,e),t},sa={getSizerConfig:function(t){return void 0===t&&(t=this),Rt(t)},getChildPrevState:function(t){var e=Rt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=At(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=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(a=le(o,"align","left-top"))&&(a=Wt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(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)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var 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 ua=Phaser.Utils.Objects.IsPlainObject,pa=Phaser.Utils.Objects.GetValue,va=Phaser.Display.Align.CENTER,ga={min:0,full:-1};var fa=function(t,e,i,s,r,n,a,h,o,l){var d,c,u,p;ye.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=ga[e];else if(ua(e)){var f;e=pa(f=e,"proportion",void 0),i=pa(f,"align",va),s=pa(f,"padding",0),r=pa(f,"expand",!1),n=pa(f,"key",void 0),a=pa(f,"index",void 0),t.isRexSizer||(h=pa(f,"minWidth",void 0),o=pa(f,"minHeight",void 0)),l=pa(f,"fitRatio",0),d=pa(f,"offsetX",0),c=pa(f,"offsetY",0),u=pa(f,"offsetOriginX",0),p=pa(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Wt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=va),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(v?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(v?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),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,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},ma={add:fa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fa.call(this,new da(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ua(i)&&(i.index=t),fa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ca.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ya=Mt.prototype.clear;var ba=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ya.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,ba.call(this,t),this}},wa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Wt[e]),this.getSizerConfig(t).align=e,this}},Sa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ka={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Oa={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}},Pa={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&&(Ge(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,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(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)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oa.call(this,t,void 0),We.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ie.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oa.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(Pa,ma,Ca,wa,Sa,ka,Oa);var Ta=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},_a={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ea=function(t){return"string"==typeof t&&(t=_a[t]),t};const Ma=Phaser.Utils.Objects.IsPlainObject,Ra=Phaser.Utils.Objects.GetValue;class La extends na{constructor(t,e,i,s,r,n,a){Ma(e)?(e=Ra(a=e,"x",0),i=Ra(a,"y",0),s=Ra(a,"width",void 0),r=Ra(a,"height",void 0),n=Ra(a,"orientation",0)):Ma(s)?(s=Ra(a=s,"width",void 0),r=Ra(a,"height",void 0),n=Ra(a,"orientation",0)):Ma(n)&&(n=Ra(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(Ra(a,"space.item",0)),this.setStartChildIndex(Ra(a,"startChildIndex",0)),this.setRTL(Ra(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ea(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=Ta.call(this)),this._childrenProportion}}Object.assign(La.prototype,Pa);var Da=function(t,e,i,s){return e/t<=i?e/(s-1):0},Aa=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=Ba(h.left,h.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===h.y||r>(o=Ba(h.right,h.centerY,t,e))&&(r=o,s=n+1)}}return s};const Wa=Phaser.Utils.Objects.IsPlainObject,Ya=Phaser.Utils.Objects.GetValue,Ia=Phaser.Display.Align.CENTER;var ja=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ye.call(this,t),Wa(e)&&(e=Ya(o=e,"padding",0),i=Ya(o,"key",void 0),s=Ya(o,"index",void 0),r=Ya(o,"offsetX",0),n=Ya(o,"offsetY",0),a=Ya(o,"offsetOriginX",0),h=Ya(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===h&&(h=0),(o=this.getSizerConfig(t)).align=Ia,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=a,o.alignOffsetOriginY=h,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,n,a,h,o},Xa={add(t,e,i){if(pr(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,ba.call(this,t),this}},Va={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},yh=0,bh=1,xh=2,Ch=0,wh=1,Sh=2,kh=/(?:\r\n|\r|\n)/;const Oh={none:Ch,word:wh,char:Sh,character:Sh,mix:3},Ph=Phaser.Renderer.WebGL.Utils;var Th={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=Ph.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 _h=Phaser.Display.Color;var Eh={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 _h);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}},Mh=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)},Rh={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,Mh(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 Lh=Phaser.Display.Canvas.CanvasPool,Dh=Phaser.GameObjects.GameObject,Ah=Phaser.Utils.String.UUID;let Bh=class extends Dh{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=Lh.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=Ah(),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(){Lh.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(Bh,[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,Th,Eh,Rh]);var Wh={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:Ms(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&&mt(this.data),this}};class Yh{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(Yh.prototype,Wh);var Ih={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 jh=Phaser.Math.RotateAround;var Xh;const Fh=Phaser.Geom.Rectangle;var Hh,Vh=function(t){void 0===Hh&&(Hh=new Fh);var e=t.drawTLX,i=t.drawTLY;return Hh.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Hh};const Gh=Phaser.Math.RotateAround;var Uh,Nh=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Uh&&(Uh={}),s=Uh),s.x=e,s.y=i,0!==t.rotation&&Gh(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const $h=Phaser.GameObjects.Components.TransformMatrix;var Kh,Jh,qh={},Zh=function(t,e,i,s,r){var n=Nh(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=qh);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Kh&&(Kh=new $h,Jh=new $h),t.parentContainer?t.getWorldTransformMatrix(Kh,Jh):Kh.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Kh.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Qh=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 Zh(t,e,n,a,r)},to={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===Xh&&(Xh={}),s=Xh),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&jh(s,0,0,-i.rotation),s}(t,e,this,!0);return Vh(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Qh(this.parent,this,t,e,i)}};Object.assign(to,Ih);const eo=Phaser.Math.DegToRad,io=Phaser.Math.RadToDeg,so=Phaser.Utils.Objects.GetValue;class ro extends Yh{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 io(this._rotation)}set angle(t){this.rotation=eo(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=so(t,"width",void 0),i=so(t,"height",void 0),s=so(t,"scaleX",void 0),r=so(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(ro.prototype,to);const no=Phaser.Utils.String.Pad;var ao=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${no(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}},ho=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const oo=Phaser.Utils.Objects.GetValue;let lo=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=oo(t,"x",0),i=oo(t,"y",0));var s=this.cornerRadius;s.tl=co(oo(t,"tl",void 0),e,i),s.tr=co(oo(t,"tr",void 0),e,i),s.bl=co(oo(t,"bl",void 0),e,i),s.br=co(oo(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){uo(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){uo(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){uo(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){uo(this.cornerRadius.br,t)}};var co=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),po(t),t},uo=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=oo(e,"x",0),t.y=oo(e,"y",0)),po(t)},po=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const vo=Phaser.Math.DegToRad;var go=function(t){return!t.hasOwnProperty("convex")||t.convex},fo=function(t){return t.x>0&&t.y>0},mo=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,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,o,l,o,l,180,270,!1,a):mo(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),h=m.tr,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,s-o,l,o,l,270,360,!1,a):mo(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=m.br,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,s-o,r-l,o,l,0,90,!1,a):mo(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=m.bl,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,o,r-l,o,l,90,180,!1,a):mo(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())},bo=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),yo(t.canvas,t.context,d,d,o,l,r,e,i,s,n,a,h)}};const xo=Phaser.Utils.Objects.GetValue;class Co extends ro{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(xo(e,"color",null),xo(e,"color2",null),xo(e,"horizontalGradient",!0)),this.setStroke(xo(e,"stroke",null),xo(e,"strokeThickness",2)),this.setCornerRadius(xo(e,"cornerRadius",0),xo(e,"cornerIteration",null))}set color(t){t=ao(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ao(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=ao(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,ho("color2",t,this),ho("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ho("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ho("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(){bo(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const wo=Phaser.Utils.Objects.GetValue;class So extends ro{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(wo(e,"color",null),wo(e,"color2",null),wo(e,"horizontalGradient",!0)),this.setStroke(wo(e,"stroke",null),wo(e,"strokeThickness",2))}set color(t){t=ao(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ao(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=ao(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,wo(t,"color2",null),wo(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,wo(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 ko=Phaser.Utils.Objects.GetValue;let Oo=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(ko(t,"bold",!1)),this.setItalic(ko(t,"italic",!1)),this.setFontSize(ko(t,"fontSize","16px")),this.setFontFamily(ko(t,"fontFamily","Courier")),this.setColor(ko(t,"color","#fff")),this.setStrokeStyle(ko(t,"stroke",null),ko(t,"strokeThickness",0)),this.setShadow(ko(t,"shadowColor",null),ko(t,"shadowOffsetX",0),ko(t,"shadowOffsetY",0),ko(t,"shadowBlur",0)),this.setOffset(ko(t,"offsetX",0),ko(t,"offsetY",0)),this.setSpace(ko(t,"leftSpace",0),ko(t,"rightSpace",0)),this.setAlign(ko(t,"align",void 0)),this.setBackgroundColor(ko(t,"backgroundColor",null)),this.setBackgroundHeight(ko(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ko(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(ho("stroke",t,this),ho("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ho("shadowOffsetX",t,this),ho("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=ao(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ao(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=ao(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=ao(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 Po=Phaser.Utils.Array.Remove,To=Phaser.Utils.Array.Remove,_o="text",Eo="image",Mo="drawer",Ro="space",Lo="command";var Do=function(t){return t.type===_o&&"\n"===t.text},Ao=function(t){return t.type===_o&&"\f"===t.text},Bo=function(t){return t.type===_o};class zo extends ro{constructor(t,e,i){super(t,_o),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 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 Wo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Yo=Phaser.Display.Canvas.CanvasPool;var Io=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=Yo.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),Yo.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 jo extends ro{constructor(t,e,i){super(t,Eo),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(){Io(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 Xo extends ro{constructor(t,e,i,s){super(t,Mo),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 Fo extends ro{constructor(t,e){super(t,Ro),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 Ho extends Yh{constructor(t,e,i,s,r){super(t,Lo),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 Vo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Vo(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]=Vo(t[i]));return e}var Go=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 Uo={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,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=qo.call(this)).height,a=l.ascent,i=Math.floor((o-a)/n))}else{var l;n=(l=qo.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Qo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Qo(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Qo(t,"wrapMode");void 0===c&&(c=Qo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Uo[c]);var u=Qo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Qo(t,"letterSpacing",0),v=Qo(t,"hAlign",0),g=Qo(t,"vAlign",0),f=Qo(t,"justifyPercentage",.25),m=Go({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&&(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 j=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,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=il(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=il(t,"maxLines",0);var h=0===i,o=il(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=il(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=il(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=il(t,"letterSpacing",0),p=il(t,"rtl",!0),v=il(t,"hAlign",p?2:0),g=il(t,"vAlign",0),f=Go({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+=T.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,Y=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 De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Le(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),Po(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 To(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(_o);return null===i?i=new zo(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)),Qh(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 Tl=Phaser.Utils.Objects.GetFastValue;var _l={};class El{constructor(t){this.pools=Tl(t,"pools",_l)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Pl),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=Wl(t,r,e,i,n),h=0;h<=Al&&0!==a;h++){if((r+=a)<0){r=0;break}a=Wl(t,r,e,i,n)}return h===Al&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Yl(t,e,i),t},zl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Wl=function(t,e,i,s,r){var n,a=zl(t,e,r),h=zl(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)},Yl=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 Il=Phaser.Utils.Objects.GetValue,jl=Phaser.Utils.Objects.GetValue;class Xl extends ih{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=jl(e,"background",void 0),r=jl(e,"icon",void 0),n=jl(e,"iconMask",void 0),a=jl(e,"text",void 0),h=jl(e,"action",void 0),o=jl(e,"actionMask",void 0),l=jl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||h)&&(i={right:jl(e,"space.icon",0),top:jl(e,"space.iconTop",0),bottom:jl(e,"space.iconBottom",0),left:jl(e,"space.iconLeft",0)}):(a||h)&&(i={bottom:jl(e,"space.icon",0),left:jl(e,"space.iconLeft",0),right:jl(e,"space.iconRight",0),top:jl(e,"space.iconTop",0)});var d=jl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=oh.call(this,r,r,1)),!d){var c=jl(e,"iconSize",void 0);this.setIconSize(jl(e,"iconWidth",c),jl(e,"iconHeight",c))}}if(a){var u=jl(e,"wrapText",!1),p=jl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(ph(t)){case 0:switch("string"==typeof e&&(e=Oh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=fh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Oh[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,Dl(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Il(e,"minWidth",0),s=Il(e,"minHeight",0),r=Il(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 Bl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Bl(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=jl(e,"space.text",0),m=jl(e,"expandTextWidth",!1),y=jl(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:jl(e,"space.actionTop",0),bottom:jl(e,"space.actionBottom",0),right:jl(e,"space.actionRight",0)}:{left:jl(e,"space.actionLeft",0),right:jl(e,"space.actionRight",0),bottom:jl(e,"space.actionBottom",0)},d=jl(e,"squareFitAction",!1)?1:0,this.add(h,{proportion:0,padding:i,fitRatio:d}),o&&(o=oh.call(this,h,h,1)),!d)){var b=jl(e,"actionSize");this.setActionSize(jl(e,"actionWidth",b),jl(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 Fl=Phaser.Renderer.WebGL.Utils,Hl=function(t,e,i,s,r,n){for(var a=Fl.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+")"},$l=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 Kl=Phaser.Renderer.Canvas.SetTransform;var Jl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ul(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&&Hl(r,a,e,l,h,o),e.isStroked&&Gl(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(Kl(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(Zl.prototype,Jl);var Ql=function(t){return t.x>0&&t.y>0},td=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 ed=Phaser.Math.DegToRad;var id=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=sc(t,"tl",0),this.radiusTR=sc(t,"tr",0),this.radiusBL=sc(t,"bl",0),this.radiusBR=sc(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?id(e,e,e,e,180,270,!1,r,t):id(0,0,e,e,90,0,!0,r,t):td(0,0,t),(e=this.radiusTR)>0?this._convexTR?id(i-e,e,e,e,270,360,!1,r,t):id(i,0,e,e,180,90,!0,r,t):td(i,0,t),(e=this.radiusBR)>0?this._convexBR?id(i-e,s-e,e,e,0,90,!1,r,t):id(i,s,e,e,270,180,!0,r,t):td(i,s,t),(e=this.radiusBL)>0?this._convexBL?id(e,s-e,e,e,90,180,!1,r,t):id(0,s,e,e,360,270,!0,r,t):td(0,s,t),t.push(t[0],t[1]),jd(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var nc=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 ac=Phaser.Utils.Objects.GetValue,hc=Phaser.Utils.Objects.IsPlainObject;class oc extends(Md(wd)){constructor(t,e,i,s,r,n,a,h){hc(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):hc(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):hc(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 ic).setName("trackFill")).addShape((new ic).setName("bar")).addShape((new ic).setName("trackStroke")),this.setTrackColor(ac(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ac(h,"trackStrokeThickness",2),ac(h,"trackStrokeColor",void 0)),this.setSkewX(ac(h,"skewX",0)),this.setRTL(ac(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 lc={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&&nc(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),nc(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&nc(h,0,0,e,i,t)}};Object.assign(oc.prototype,lc);var dc=function(t){return null==t||""===t||0===t.length},cc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(dc(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(dc(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=Vo(i),s=Vo(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 Ec(t)?(this.stretchMode.edge=Rc(Mc(t,"edge",0)),this.stretchMode.internal=Rc(Mc(t,"internal",0))):(t=Rc(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Dc.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 Bc=Phaser.Utils.Objects.IsPlainObject,zc=Phaser.Utils.Objects.GetValue,Wc=Phaser.GameObjects;var Yc=void 0,Ic=function(t,e){if(Yc||(Yc={},ei(t).events.once("destroy",(function(){for(var t in Yc)Yc[t].destroy();Yc=void 0}))),!Yc.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Wc[e](i)).setOrigin(0),Yc[e]=t}return Yc[e]};const jc=Phaser.GameObjects.RenderTexture;class Xc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Bc(i)?(i=zc(d=i,"x",0),s=zc(d,"y",0),r=zc(d,"width",1),n=zc(d,"height",1),a=zc(d,"key",void 0),h=zc(d,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Bc(r)?(r=zc(d=r,"width",1),n=zc(d,"height",1),a=zc(d,"key",void 0),h=zc(d,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Bc(a)?(a=zc(d=a,"key",void 0),h=zc(d,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Bc(h)?(h=zc(d=h,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=zc(d,"baseFrame",void 0)):Bc(o)&&(o=zc(d=o,"columns",void 0),l=zc(d,"rows",void 0)),void 0===h&&(h=zc(d,"frame",void 0)),void 0===o){var c=zc(d,"leftWidth",void 0),u=zc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=zc(d,"topHeight",void 0),v=zc(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(zc(d,"getFrameNameCallback",void 0)),this.setStretchMode(zc(d,"stretchMode",0)),this.setPreserveRatio(zc(d,"preserveRatio",!0));var g=zc(d,"maxFixedPartScale",1),f=zc(d,"maxFixedPartScaleX",g),m=zc(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,Ac),i}(jc,"rexNinePatch")){}var Fc={_drawImage:function(t,e,i,s,r,n){var a=Ic(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Ic(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Xc.prototype,Fc);let Hc=class extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(vc(t,e))return t[e];var i=t.parent;return vc(i,e)?i[e]:void 0}set(t,e,i){return vc(t,e)?t[e]=i:vc(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 Vc=Phaser.Utils.Objects.GetValue;class Gc extends Xc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Vc(e,"effects",!0);i&&bc(this,i),this.style=new Hc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Gc.prototype,vd);const Uc=["alpha","tint","flipX","flipY"];var Nc=function(t,e){if(!e)return t;for(var i=0,s=Uc.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const nu=Phaser.Display.Canvas.CanvasPool;var au=function(t){var e=nu.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 nu.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,nu.remove(e),a;var d,c,u=i.getImageData(0,0,h,l).data,p=u.length,v=4*h,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Ch&&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=Oh[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 h in a){var o=a[h],l=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=ou(t,l,d);else{var u=hu(t,l,d);c&&(u=c(u)),this[h]=u}}var p=ou(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=ou(t,"fill",null);null!==v&&(this.color=ao(v));var g=ou(t,"metrics",!1);return g?this.metrics={ascent:ou(g,"ascent",0),descent:ou(g,"descent",0),fontSize:ou(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=au(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=au(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=ou(t,"fontFamily","Courier"),this.fontSize=ou(t,"fontSize","16px"),this.fontStyle=ou(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=ao(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ao(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=ao(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=ao(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=ao(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=ao(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=ao(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=ao(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=ao(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=ao(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=ao(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=ao(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=Oh[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=ou(e,"fontFamily",this.fontFamily),this.fontSize=ou(e,"fontSize",this.fontSize),this.fontStyle=ou(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 du={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),bo(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,d,c,u,p=a.halign,v=a.valign,g=a.lineHeight,f=r.lines,m=f.length,y=a.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 C=l;C0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,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 h=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=h},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 cu=Phaser.Utils.Objects.GetValue,uu=yh,pu=bh;class vu{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=cu(t,"text",""),this.x=cu(t,"x",0),this.y=cu(t,"y",0),this.width=cu(t,"width",0);var e=cu(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=cu(t,"newLineMode",0),this.startIndex=cu(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===pu&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==uu&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===pu&&(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 gu=Phaser.Utils.Objects.GetFastValue,fu=yh,mu=xh;class yu{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=gu(t,"tagToText",Yt),this.tagToTextScope=gu(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||(a=a.substring(t-h,e-h)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var bu={};const xu=Phaser.Geom.Rectangle;var Cu=new Pl;class wu{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&zu(g)){""!==b?a.push(n.getLine(b,x,Mu)):0===C&&r>0&&a.push(n.getLine("",0,Mu)),a.push(...Au(g,e,Lu,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>o?(a.push(n.getLine(b,x,Mu)),b=g,x=f,o=s):(b+=g,x=m),C===w-1&&a.push(n.getLine(b,x,l))}return a},Bu=function(t,e){var i;switch(e){case Ru:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Yu&&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 yu({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 Np(this.sizerChildren,null),ba.call(this,t),this}},Kp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Np(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},Qp={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;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,Np(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Np(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},ev=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const iv=Phaser.Utils.Objects.IsPlainObject,sv=Phaser.Utils.Objects.GetValue;class rv extends na{constructor(t,e,i,s,r,n,a,h,o,l){iv(e)?(e=sv(l=e,"x",0),i=sv(l,"y",0),s=sv(l,"width",void 0),r=sv(l,"height",void 0),n=sv(l,"column",l.col||0),a=sv(l,"row",0),h=sv(l,"columnProportions",0),o=sv(l,"rowProportions",0)):iv(s)?(s=sv(l=s,"width",void 0),r=sv(l,"height",void 0),n=sv(l,"column",l.col||0),a=sv(l,"row",0),h=sv(l,"columnProportions",0),o=sv(l,"rowProportions",0)):iv(n)?(n=sv(l=n,"column",l.col||0),a=sv(l,"row",0),h=sv(l,"columnProportions",0),o=sv(l,"rowProportions",0)):iv(h)&&(h=sv(l=h,"columnProportions",0),o=sv(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(sv(l,"createCellContainerCallback")),this.setIndentLeft(sv(l,"space.indentLeftOdd",0),sv(l,"space.indentLeftEven",0)),this.setIndentTop(sv(l,"space.indentTopOdd",0),sv(l,"space.indentTopEven",0)),this.resetGrid(n,a,h,o,sv(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=tv.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=ev.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(rv.prototype,Qp);const nv=Phaser.Utils.Objects.GetValue,av=Phaser.Math.Percent;var hv=function(t,e,i){var s;return t.y===e.y?s=av(i.x,t.x,e.x):t.x===e.x&&(s=av(i.y,t.y,e.y)),s},ov=function(t,e,i){var s,r;this.enable&&(lv.x=e,lv.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=hv(s,r,lv))},lv={},dv=function(t,e,i){if(this.enable&&t.isDown){var s,r;cv.x=t.worldX,cv.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=hv(s,r,cv);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},cv={},uv=function(t,e){void 0===e&&(e=pv);var i=this.childrenMap.thumb,s=i.x,r=i.y;return oe(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},pv={};const vv=Phaser.Display.Align.LEFT_CENTER,gv=Phaser.Display.Align.TOP_CENTER;var fv={};const mv=Phaser.Display.Align.RIGHT_CENTER,yv=Phaser.Display.Align.BOTTOM_CENTER;var bv={};const xv=Phaser.Math.Linear;var Cv={};const wv=Phaser.Display.Align.LEFT_CENTER,Sv=Phaser.Display.Align.TOP_CENTER,kv=Phaser.Display.Align.RIGHT_CENTER,Ov=Phaser.Display.Align.BOTTOM_CENTER,Pv=Phaser.Utils.Objects.GetValue,Tv=Phaser.Utils.Objects.IsPlainObject,_v=Phaser.Math.Clamp,Mv=Phaser.Math.Snap.To;class Ev extends(Ed(La)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Pv(e,"reverseAxis",!1);var i=Pv(e,"background",void 0),s=Pv(e,"track",void 0),r=Pv(e,"indicator",void 0),n=Pv(e,"thumb",void 0);if(i&&(Tv(i)&&(i=$c(t,i)),this.addBackground(i)),s&&(Tv(s)&&(s=$c(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Tv(r)&&(r=$c(t,r)),this.pin(r)),n){Tv(n)&&(n=$c(t,n)),this.pin(n);var a=Pv(e,"thumbOffsetX",0),h=Pv(e,"thumbOffsetY",0);this.setThumbOffset(a,h)}var o=Pv(e,"input",0);switch("string"==typeof o&&(o=Rv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",ov,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",dv,this).on("pointermove",dv,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(Pv(e,"enable",void 0)),this.setGap(Pv(e,"gap",void 0)),this.setValue(Pv(e,"value",0),Pv(e,"min",void 0),Pv(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=Mv(t,this.gap));var e=this._value;this._value=_v(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 Rv={pan:0,drag:0,click:1,none:-1};var Lv={getStartPoint:function(t){if(void 0===t&&(t=fv),this.childrenMap.thumb){var e=0===this.orientation?vv:gv;uv.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=bv),this.childrenMap.thumb){var e=0===this.orientation?mv:yv;uv.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=Cv),s.x=xv(e.x,i.x,t),s.y=xv(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 h,o=Q(a);if(n)h=a.x-o*a.originX,i=this.right-h;else i=(h=a.x-o*a.originX)+o-this.left}else{var l,d=tt(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ge(e,i,s),r=n?0===this.orientation?kv:Ov:0===this.orientation?wv:Sv,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Ev.prototype,Lv);const Dv=Phaser.Utils.Objects.GetValue;class Av extends La{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=Dv(e,"background",void 0),n=Dv(e,"buttons",void 0),a=Dv(n,"top",Dv(n,"left",void 0)),h=Dv(n,"bottom",Dv(n,"right",void 0)),o=Dv(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Br(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===Dv(o,"width",void 0)?1:0:void 0===Dv(o,"height",void 0)?1:0,i=new Ev(t,o),t.add.existing(i),this.add(i,{proportion:s}));h&&(this.add(h),new Br(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,h];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=Dv(e,"valuechangeCallback",null);if(null!==d){var c=Dv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(Dv(e,"enable",void 0)),this.setValue(Dv(e,"value",0)),this.setScrollStep(Dv(n,"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 Bv extends Bs{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 zv=Phaser.Utils.Objects.GetValue,Wv=Phaser.Math.Distance.Between;class Yv extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=zv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(zv(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(zv(t,"enable",!0)),this.holdThreshold=zv(t,"holdThreshold",50),this.pointerOutReleaseEnable=zv(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 gn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Wv(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&&!ur(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&&!ur(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 Iv=Phaser.Utils.Objects.GetValue;class jv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Iv(t,"value",0)),this.setSpeed(Iv(t,"speed",0)),this.setAcceleration(Iv(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 Xv{constructor(){this.value,this.dir,this.movement=new jv}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 Gv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Uv=Phaser.Utils.Objects.GetValue;class Nv extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Uv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Uv(e,"speed",.1)),this.setEnable(Uv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Uv(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||ur(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 $v=Phaser.Utils.Objects.GetValue;var Kv=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),h=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=h||s.hasOwnProperty(l)?$v(s,l,void 0):$v(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=yt(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 Av(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=$v(r,"position",0);"string"==typeof p&&(p=Jv[p]);var v,g,f=$v(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=$v(s,"space.slider",void 0))&&(h?f=0:v=$v(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,a?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:$v(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:$v(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:$v(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:$v(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=$v(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=$v(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=$v(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=$v(s,"scrollDetectionMode");"string"==typeof b&&(b=qv[b]);var x=`scroller${i}`;(m=h||s.hasOwnProperty(x)?$v(s,x,!0):$v(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Vv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,k,O,P=$v(s,h?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new Nv(o,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),h&&!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&&(h?(w=a?"t":"s",k=`scroll${i}`):(w="t",k="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(k,t)}))),y&&(h?(S=`childO${i}`,k=`scroll${i}`):(S="childOY",k="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(k,t)}))),C&&(O=h?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[O](-e,!0)})))};const Jv={right:0,left:1,bottom:0,top:1},qv={gameObject:0,rectBounds:1},Zv=Phaser.Utils.Objects.GetValue;var Qv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Zv(e,"width"),a=Zv(e,"height");n||Zv(e,"child.expandWidth",!0)||(s[1]=0),a||Zv(e,"child.expandHeight",!0)||(r[1]=0);var h=new rv(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=nv(i,"child"),r=nv(s,"gameObject",void 0);if(r){var n=nv(i,"space.child",0);t.childMargin={};var a=t.childMargin,h={};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=nv(n,"top",0),a.bottom=nv(n,"bottom",0),h.left=nv(n,"left",0),h.right=nv(n,"right",0);break;case 1:a.top=nv(n,"left",0),a.bottom=nv(n,"right",0),h.top=nv(n,"top",0),h.bottom=nv(n,"bottom",0);break;default:a.top=nv(n,"top",0),a.bottom=nv(n,"bottom",0),a.left=nv(n,"left",0),a.right=nv(n,"right",0)}e.add(r,{column:1,row:1,align:nv(s,"align","center"),padding:h,expand:{width:nv(s,"expandWidth",!0),height:nv(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,h,e),t.scrollMode){case 0:Kv(t,h,"y",e);break;case 1:Kv(t,h,"x",e);break;default:Kv(t,h,"y",e),Kv(t,h,"x",e)}return h},tg=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)},eg=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)}},ig=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(h=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=h.childrenMap.track,s=h.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(og.call(this,-this.textOY)),0),e=lg.call(this,t)+this.textOY,i=dg.call(this,t);return function(t,e){switch(ph(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}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,cg.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,Fe.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,h=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=h+(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,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,pg.call(this,t,n,a),oe(t,s,r,n,a,e.align),e.preOffsetY=0,cg.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const gg=Phaser.Utils.Objects.IsPlainObject,fg=Phaser.Utils.Objects.GetValue,mg=Phaser.Display.Align.TOP_LEFT;class yg extends na{constructor(t,e,i,s,r,n){gg(e)?(e=fg(n=e,"x",0),i=fg(n,"y",0),s=fg(n,"width",void 0),r=fg(n,"height",void 0)):gg(s)&&(s=fg(n=s,"width",void 0),r=fg(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=fg(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(fg(n,"clampTextOY",!0)),this.alwaysScrollable=fg(n,"alwaysScrollable",!1);var a=fg(n,"background",void 0),h=fg(n,"text",void 0);void 0===h&&(h=bg(t)),this.textCropEnable=fg(n,"textCrop",!!h.setCrop);var o=fg(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(h),this.sizerChildren=[h];var l=this.getSizerConfig(h);l.align=mg,l.padding=fe(0),l.expand=!0,this.textObject=h,this.textObjectType=ph(h),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=oh.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",h)}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(og.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=lg.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 bg=function(t){return t.add.text(0,0,"")};Object.assign(yg.prototype,vg);var xg={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Cg={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 wg=Phaser.Utils.Objects.GetValue;class Sg extends ag{constructor(t,e){void 0===e&&(e={});var i=wg(e,"text",void 0),s=wg(e,"textWidth",void 0),r=wg(e,"textHeight",void 0),n=wg(e,"textCrop",!!i.setCrop),a=wg(e,"textMask",!n),h=wg(e,"content",""),o=new yg(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:h,clampTextOY:wg(e,"clampChildOY",!1),alwaysScrollable:wg(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=wg(e,"space",void 0);l&&(l.child=wg(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(Sg.prototype,xg,Cg);const kg=Phaser.Utils.Objects.GetValue;var Og=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 Ap(t,e);break;case"bbcodetext":case"bbcode":s=new Ep(t,0,0,"",e);break;case"label":s=new Bp(t,e);break;case"textarea":s=function(t,e,i){e=e?Vo(e):{};var s=kg(i,"background",$c),r=kg(i,"text",Og),n=kg(i,"track",$c),a=kg(i,"thumb",$c);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),n?h.track=n(t,h.track):delete h.track,a?h.thumb=a(t,h.thumb):delete h.thumb,e.slider=h);var o=new Sg(t,e);return t.add.existing(o),o}(t,e);break;default:s=new qc(t,e)}return Nc(s,e),t.add.existing(s),s},Pg=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 Gc(t,e):new Sc(t,e);break;case"roundRectangle":s=new gd(t,e);break;default:s=new Tc(t,e)}return Nc(s,e),t.add.existing(s),s};const Tg=Phaser.Utils.Objects.GetValue;var _g=function(t,e,i){e=e?Vo(e):{};var s=Tg(i,"background",$c),r=Tg(i,"text",Og),n=Tg(i,"icon",Pg),a=Tg(i,"action",Pg);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};class Mg extends Xl{constructor(t,e){super(t,e=_g(t,e)),this.type="rexTweaker.Title"}setTitle(t){return(t=t?Vo(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}Phaser.Math.Wrap;const Eg=Phaser.Math.Linear;var Rg=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),h=this.padding,o=this.width-h.right,l=0+h.left,d=this.height-h.bottom,c=0+h.top,u=(l+o)/2,p=(c+d)/2,v={0:{a:{x:l,y:c},b:{x:o,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:o,y:c}},2:{a:{x:o,y:c},b:{x:l,y:p},c:{x:o,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:o,y:d}}};if(void 0===this.previousDirection){var g=v[this.direction],f=g.a,m=g.b,y=g.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=v[this.previousDirection],x=v[this.direction],C=this.easeDirectionProgress;t=Eg(b.a.x,x.a.x,C),e=Eg(b.a.y,x.a.y,C),i=Eg(b.b.x,x.b.x,C),s=Eg(b.b.y,x.b.y,C),r=Eg(b.c.x,x.c.x,C),n=Eg(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const Lg=(0,Phaser.Math.DegToRad)(120);var Dg=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+Lg),i+s*Math.sin(r+Lg)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-Lg),i+s*Math.sin(r-Lg)),this.arrowOnly?t.end():t.close()},Ag={buildShapes(){this.addShape((new ic).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?Rg.call(this):Dg.call(this)}},Bg={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new vs(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 zg=Phaser.Utils.Objects.GetValue,Wg=Phaser.Utils.Objects.IsPlainObject,Yg=Phaser.Math.DegToRad,Ig=Phaser.Math.RadToDeg;class jg extends wd{constructor(t,e,i,s,r,n,a){var h,o,l,d,c,u,p,v;if(Wg(e)){var g=e;e=g.x,i=g.y,s=g.width,r=g.height,n=g.color,a=g.alpha,h=g.strokeColor,o=g.strokeAlpha,l=g.strokeWidth,d=g.arrowOnly,c=g.direction,u=g.easeDuration,p=g.padding,v=g.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===v&&(v=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==h&&void 0===l&&(l=2),this.setStrokeStyle(l,h,o),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(v),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=Fg(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=zg(r,"x",null);null!==n?(t=n,i=n):(t=zg(r,"left",0),i=zg(r,"right",t));var a=zg(r,"y",null);null!==a?(e=a,s=a):(e=zg(r,"top",0),s=zg(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 Ig(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Yg(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Xg={right:0,down:1,left:2,up:3};var Fg=function(t){return"string"==typeof t&&(t=Xg[t]),t%=4};Object.assign(jg.prototype,Ag,Bg);class Hg extends Mg{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new jg(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}} + */const nu=Phaser.Display.Canvas.CanvasPool;var au=function(t){var e=nu.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 nu.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,nu.remove(e),a;var d,c,u=i.getImageData(0,0,h,l).data,p=u.length,v=4*h,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Ch&&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=Oh[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 h in a){var o=a[h],l=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=ou(t,l,d);else{var u=hu(t,l,d);c&&(u=c(u)),this[h]=u}}var p=ou(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=ou(t,"fill",null);null!==v&&(this.color=ao(v));var g=ou(t,"metrics",!1);return g?this.metrics={ascent:ou(g,"ascent",0),descent:ou(g,"descent",0),fontSize:ou(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=au(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=au(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=ou(t,"fontFamily","Courier"),this.fontSize=ou(t,"fontSize","16px"),this.fontStyle=ou(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=ao(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ao(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=ao(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=ao(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=ao(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=ao(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=ao(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=ao(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=ao(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=ao(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=ao(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=ao(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=Oh[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=ou(e,"fontFamily",this.fontFamily),this.fontSize=ou(e,"fontSize",this.fontSize),this.fontStyle=ou(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 du={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),bo(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,d,c,u,p=a.halign,v=a.valign,g=a.lineHeight,f=r.lines,m=f.length,y=a.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 C=l;C0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,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 h=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=h},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 cu=Phaser.Utils.Objects.GetValue,uu=yh,pu=bh;class vu{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=cu(t,"text",""),this.x=cu(t,"x",0),this.y=cu(t,"y",0),this.width=cu(t,"width",0);var e=cu(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=cu(t,"newLineMode",0),this.startIndex=cu(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===pu&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==uu&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===pu&&(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 gu=Phaser.Utils.Objects.GetFastValue,fu=yh,mu=xh;class yu{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=gu(t,"tagToText",Yt),this.tagToTextScope=gu(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||(a=a.substring(t-h,e-h)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var bu={};const xu=Phaser.Geom.Rectangle;var Cu=new Pl;class wu{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&zu(g)){""!==b?a.push(n.getLine(b,x,Eu)):0===C&&r>0&&a.push(n.getLine("",0,Eu)),a.push(...Au(g,e,Lu,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>o?(a.push(n.getLine(b,x,Eu)),b=g,x=f,o=s):(b+=g,x=m),C===w-1&&a.push(n.getLine(b,x,l))}return a},Bu=function(t,e){var i;switch(e){case Ru:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Yu&&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 yu({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 Np(this.sizerChildren,null),ba.call(this,t),this}},Kp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Np(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},Qp={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;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,Np(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Np(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},ev=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const iv=Phaser.Utils.Objects.IsPlainObject,sv=Phaser.Utils.Objects.GetValue;class rv extends na{constructor(t,e,i,s,r,n,a,h,o,l){iv(e)?(e=sv(l=e,"x",0),i=sv(l,"y",0),s=sv(l,"width",void 0),r=sv(l,"height",void 0),n=sv(l,"column",l.col||0),a=sv(l,"row",0),h=sv(l,"columnProportions",0),o=sv(l,"rowProportions",0)):iv(s)?(s=sv(l=s,"width",void 0),r=sv(l,"height",void 0),n=sv(l,"column",l.col||0),a=sv(l,"row",0),h=sv(l,"columnProportions",0),o=sv(l,"rowProportions",0)):iv(n)?(n=sv(l=n,"column",l.col||0),a=sv(l,"row",0),h=sv(l,"columnProportions",0),o=sv(l,"rowProportions",0)):iv(h)&&(h=sv(l=h,"columnProportions",0),o=sv(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(sv(l,"createCellContainerCallback")),this.setIndentLeft(sv(l,"space.indentLeftOdd",0),sv(l,"space.indentLeftEven",0)),this.setIndentTop(sv(l,"space.indentTopOdd",0),sv(l,"space.indentTopEven",0)),this.resetGrid(n,a,h,o,sv(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=tv.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=ev.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(rv.prototype,Qp);const nv=Phaser.Utils.Objects.GetValue,av=Phaser.Math.Percent;var hv=function(t,e,i){var s;return t.y===e.y?s=av(i.x,t.x,e.x):t.x===e.x&&(s=av(i.y,t.y,e.y)),s},ov=function(t,e,i){var s,r;this.enable&&(lv.x=e,lv.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=hv(s,r,lv))},lv={},dv=function(t,e,i){if(this.enable&&t.isDown){var s,r;cv.x=t.worldX,cv.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=hv(s,r,cv);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},cv={},uv=function(t,e){void 0===e&&(e=pv);var i=this.childrenMap.thumb,s=i.x,r=i.y;return oe(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},pv={};const vv=Phaser.Display.Align.LEFT_CENTER,gv=Phaser.Display.Align.TOP_CENTER;var fv={};const mv=Phaser.Display.Align.RIGHT_CENTER,yv=Phaser.Display.Align.BOTTOM_CENTER;var bv={};const xv=Phaser.Math.Linear;var Cv={};const wv=Phaser.Display.Align.LEFT_CENTER,Sv=Phaser.Display.Align.TOP_CENTER,kv=Phaser.Display.Align.RIGHT_CENTER,Ov=Phaser.Display.Align.BOTTOM_CENTER,Pv=Phaser.Utils.Objects.GetValue,Tv=Phaser.Utils.Objects.IsPlainObject,_v=Phaser.Math.Clamp,Ev=Phaser.Math.Snap.To;class Mv extends(Md(La)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Pv(e,"reverseAxis",!1);var i=Pv(e,"background",void 0),s=Pv(e,"track",void 0),r=Pv(e,"indicator",void 0),n=Pv(e,"thumb",void 0);if(i&&(Tv(i)&&(i=$c(t,i)),this.addBackground(i)),s&&(Tv(s)&&(s=$c(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Tv(r)&&(r=$c(t,r)),this.pin(r)),n){Tv(n)&&(n=$c(t,n)),this.pin(n);var a=Pv(e,"thumbOffsetX",0),h=Pv(e,"thumbOffsetY",0);this.setThumbOffset(a,h)}var o=Pv(e,"input",0);switch("string"==typeof o&&(o=Rv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",ov,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",dv,this).on("pointermove",dv,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(Pv(e,"enable",void 0)),this.setGap(Pv(e,"gap",void 0)),this.setValue(Pv(e,"value",0),Pv(e,"min",void 0),Pv(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=Ev(t,this.gap));var e=this._value;this._value=_v(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 Rv={pan:0,drag:0,click:1,none:-1};var Lv={getStartPoint:function(t){if(void 0===t&&(t=fv),this.childrenMap.thumb){var e=0===this.orientation?vv:gv;uv.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=bv),this.childrenMap.thumb){var e=0===this.orientation?mv:yv;uv.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=Cv),s.x=xv(e.x,i.x,t),s.y=xv(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 h,o=Q(a);if(n)h=a.x-o*a.originX,i=this.right-h;else i=(h=a.x-o*a.originX)+o-this.left}else{var l,d=tt(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ge(e,i,s),r=n?0===this.orientation?kv:Ov:0===this.orientation?wv:Sv,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Mv.prototype,Lv);const Dv=Phaser.Utils.Objects.GetValue;class Av extends La{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=Dv(e,"background",void 0),n=Dv(e,"buttons",void 0),a=Dv(n,"top",Dv(n,"left",void 0)),h=Dv(n,"bottom",Dv(n,"right",void 0)),o=Dv(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Br(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===Dv(o,"width",void 0)?1:0:void 0===Dv(o,"height",void 0)?1:0,i=new Mv(t,o),t.add.existing(i),this.add(i,{proportion:s}));h&&(this.add(h),new Br(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,h];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=Dv(e,"valuechangeCallback",null);if(null!==d){var c=Dv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(Dv(e,"enable",void 0)),this.setValue(Dv(e,"value",0)),this.setScrollStep(Dv(n,"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 Bv extends Bs{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 zv=Phaser.Utils.Objects.GetValue,Wv=Phaser.Math.Distance.Between;class Yv extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=zv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(zv(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(zv(t,"enable",!0)),this.holdThreshold=zv(t,"holdThreshold",50),this.pointerOutReleaseEnable=zv(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 gn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Wv(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&&!ur(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&&!ur(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 Iv=Phaser.Utils.Objects.GetValue;class jv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Iv(t,"value",0)),this.setSpeed(Iv(t,"speed",0)),this.setAcceleration(Iv(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 Xv{constructor(){this.value,this.dir,this.movement=new jv}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 Gv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Uv=Phaser.Utils.Objects.GetValue;class Nv extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Uv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Uv(e,"speed",.1)),this.setEnable(Uv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Uv(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||ur(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 $v=Phaser.Utils.Objects.GetValue;var Kv=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),h=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=h||s.hasOwnProperty(l)?$v(s,l,void 0):$v(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=yt(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 Av(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=$v(r,"position",0);"string"==typeof p&&(p=Jv[p]);var v,g,f=$v(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=$v(s,"space.slider",void 0))&&(h?f=0:v=$v(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,a?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:$v(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:$v(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:$v(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:$v(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=$v(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=$v(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=$v(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=$v(s,"scrollDetectionMode");"string"==typeof b&&(b=qv[b]);var x=`scroller${i}`;(m=h||s.hasOwnProperty(x)?$v(s,x,!0):$v(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Vv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,k,O,P=$v(s,h?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new Nv(o,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),h&&!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&&(h?(w=a?"t":"s",k=`scroll${i}`):(w="t",k="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(k,t)}))),y&&(h?(S=`childO${i}`,k=`scroll${i}`):(S="childOY",k="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(k,t)}))),C&&(O=h?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[O](-e,!0)})))};const Jv={right:0,left:1,bottom:0,top:1},qv={gameObject:0,rectBounds:1},Zv=Phaser.Utils.Objects.GetValue;var Qv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Zv(e,"width"),a=Zv(e,"height");n||Zv(e,"child.expandWidth",!0)||(s[1]=0),a||Zv(e,"child.expandHeight",!0)||(r[1]=0);var h=new rv(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=nv(i,"child"),r=nv(s,"gameObject",void 0);if(r){var n=nv(i,"space.child",0);t.childMargin={};var a=t.childMargin,h={};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=nv(n,"top",0),a.bottom=nv(n,"bottom",0),h.left=nv(n,"left",0),h.right=nv(n,"right",0);break;case 1:a.top=nv(n,"left",0),a.bottom=nv(n,"right",0),h.top=nv(n,"top",0),h.bottom=nv(n,"bottom",0);break;default:a.top=nv(n,"top",0),a.bottom=nv(n,"bottom",0),a.left=nv(n,"left",0),a.right=nv(n,"right",0)}e.add(r,{column:1,row:1,align:nv(s,"align","center"),padding:h,expand:{width:nv(s,"expandWidth",!0),height:nv(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,h,e),t.scrollMode){case 0:Kv(t,h,"y",e);break;case 1:Kv(t,h,"x",e);break;default:Kv(t,h,"y",e),Kv(t,h,"x",e)}return h},tg=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)},eg=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)}},ig=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(h=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=h.childrenMap.track,s=h.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(og.call(this,-this.textOY)),0),e=lg.call(this,t)+this.textOY,i=dg.call(this,t);return function(t,e){switch(ph(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}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,cg.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,Fe.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,h=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=h+(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,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,pg.call(this,t,n,a),oe(t,s,r,n,a,e.align),e.preOffsetY=0,cg.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const gg=Phaser.Utils.Objects.IsPlainObject,fg=Phaser.Utils.Objects.GetValue,mg=Phaser.Display.Align.TOP_LEFT;class yg extends na{constructor(t,e,i,s,r,n){gg(e)?(e=fg(n=e,"x",0),i=fg(n,"y",0),s=fg(n,"width",void 0),r=fg(n,"height",void 0)):gg(s)&&(s=fg(n=s,"width",void 0),r=fg(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=fg(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(fg(n,"clampTextOY",!0)),this.alwaysScrollable=fg(n,"alwaysScrollable",!1);var a=fg(n,"background",void 0),h=fg(n,"text",void 0);void 0===h&&(h=bg(t)),this.textCropEnable=fg(n,"textCrop",!!h.setCrop);var o=fg(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(h),this.sizerChildren=[h];var l=this.getSizerConfig(h);l.align=mg,l.padding=fe(0),l.expand=!0,this.textObject=h,this.textObjectType=ph(h),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=oh.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",h)}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(og.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=lg.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 bg=function(t){return t.add.text(0,0,"")};Object.assign(yg.prototype,vg);var xg={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Cg={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 wg=Phaser.Utils.Objects.GetValue;class Sg extends ag{constructor(t,e){void 0===e&&(e={});var i=wg(e,"text",void 0),s=wg(e,"textWidth",void 0),r=wg(e,"textHeight",void 0),n=wg(e,"textCrop",!!i.setCrop),a=wg(e,"textMask",!n),h=wg(e,"content",""),o=new yg(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:h,clampTextOY:wg(e,"clampChildOY",!1),alwaysScrollable:wg(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=wg(e,"space",void 0);l&&(l.child=wg(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(Sg.prototype,xg,Cg);const kg=Phaser.Utils.Objects.GetValue;var Og=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 Ap(t,e);break;case"bbcodetext":case"bbcode":s=new Mp(t,0,0,"",e);break;case"label":s=new Bp(t,e);break;case"textarea":s=function(t,e,i){e=e?Vo(e):{};var s=kg(i,"background",$c),r=kg(i,"text",Og),n=kg(i,"track",$c),a=kg(i,"thumb",$c);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),n?h.track=n(t,h.track):delete h.track,a?h.thumb=a(t,h.thumb):delete h.thumb,e.slider=h);var o=new Sg(t,e);return t.add.existing(o),o}(t,e);break;default:s=new qc(t,e)}return Nc(s,e),t.add.existing(s),s},Pg=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 Gc(t,e):new Sc(t,e);break;case"roundRectangle":s=new gd(t,e);break;default:s=new Tc(t,e)}return Nc(s,e),t.add.existing(s),s};const Tg=Phaser.Utils.Objects.GetValue;var _g=function(t,e,i){e=e?Vo(e):{};var s=Tg(i,"background",$c),r=Tg(i,"text",Og),n=Tg(i,"icon",Pg),a=Tg(i,"action",Pg);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};class Eg extends Xl{constructor(t,e){super(t,e=_g(t,e)),this.type="rexTweaker.Title"}setTitle(t){return(t=t?Vo(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}Phaser.Math.Wrap;const Mg=Phaser.Math.Linear;var Rg=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),h=this.padding,o=this.width-h.right,l=0+h.left,d=this.height-h.bottom,c=0+h.top,u=(l+o)/2,p=(c+d)/2,v={0:{a:{x:l,y:c},b:{x:o,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:o,y:c}},2:{a:{x:o,y:c},b:{x:l,y:p},c:{x:o,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:o,y:d}}};if(void 0===this.previousDirection){var g=v[this.direction],f=g.a,m=g.b,y=g.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=v[this.previousDirection],x=v[this.direction],C=this.easeDirectionProgress;t=Mg(b.a.x,x.a.x,C),e=Mg(b.a.y,x.a.y,C),i=Mg(b.b.x,x.b.x,C),s=Mg(b.b.y,x.b.y,C),r=Mg(b.c.x,x.c.x,C),n=Mg(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const Lg=(0,Phaser.Math.DegToRad)(120);var Dg=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+Lg),i+s*Math.sin(r+Lg)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-Lg),i+s*Math.sin(r-Lg)),this.arrowOnly?t.end():t.close()},Ag={buildShapes(){this.addShape((new ic).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?Rg.call(this):Dg.call(this)}},Bg={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new vs(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 zg=Phaser.Utils.Objects.GetValue,Wg=Phaser.Utils.Objects.IsPlainObject,Yg=Phaser.Math.DegToRad,Ig=Phaser.Math.RadToDeg;class jg extends wd{constructor(t,e,i,s,r,n,a){var h,o,l,d,c,u,p,v;if(Wg(e)){var g=e;e=g.x,i=g.y,s=g.width,r=g.height,n=g.color,a=g.alpha,h=g.strokeColor,o=g.strokeAlpha,l=g.strokeWidth,d=g.arrowOnly,c=g.direction,u=g.easeDuration,p=g.padding,v=g.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===v&&(v=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==h&&void 0===l&&(l=2),this.setStrokeStyle(l,h,o),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(v),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=Fg(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=zg(r,"x",null);null!==n?(t=n,i=n):(t=zg(r,"left",0),i=zg(r,"right",t));var a=zg(r,"y",null);null!==a?(e=a,s=a):(e=zg(r,"top",0),s=zg(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 Ig(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Yg(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Xg={right:0,down:1,left:2,up:3};var Fg=function(t){return"string"==typeof t&&(t=Xg[t]),t%=4};Object.assign(jg.prototype,Ag,Bg);class Hg extends Eg{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new jg(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}} /** * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var Vg=function(t,e){var i=yt(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},Gg=function(t,e,i){return $c(t,Vg(e,i))};class Ug extends Hs{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 Ng={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}},$g=function(t,e){Wi.popUp.call(t,e,this.expandDirection)},Kg=function(t,e){Wi.scaleDown.call(t,e,this.expandDirection)},Jg={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=$g.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Kg.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const qg=Phaser.Utils.Objects.GetValue;let Zg=class extends La{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=qg(e,"space"),a=1===this.orientation?"left":"top",h=qg(e,"align.title",a),o=qg(e,"expand.title",!0);this.add(s,{proportion:0,align:h,expand:o,padding:{left:qg(n,"titleLeft",0),right:qg(n,"titleRight",0),top:qg(n,"titleTop",0),bottom:qg(n,"titleBottom",0)}});var l=qg(e,"toggleByTarget",void 0),d=qg(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&Or.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Ug(r),!qg(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}h=qg(e,"align.child","left");var u=(o=qg(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:h,expand:o,padding:{left:qg(n,"childLeft",0),right:qg(n,"childRight",0),top:qg(n,"childTop",0),bottom:qg(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(qg(p,"duration",200)),this.setExpandCallback(qg(p,"expandCallback",void 0)),this.setCollapseCallback(qg(p,"collapseCallback",void 0)),this.reLayoutTarget=qg(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=qg(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(Zg.prototype,Ng,Jg);var Qg={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},tf={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class ef extends Zg{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(ef.prototype,Qg,tf);const sf=Phaser.Utils.Objects.GetValue,rf=Phaser.Utils.Objects.GetValue,nf=La.prototype.add,af=La.prototype.addSpace;var hf=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)&&af.call(this),nf.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&af.call(this),this.hasTailSpace=s}else nf.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;nf.call(this,t,{index:r,proportion:i,expand:!0})}else nf.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},of={addButton(t){if(pr(t))for(var e=t,i=0,s=e.length;i=0;i--)cf.call(this,e[i],t);return this}},pf=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)}},vf=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,pf.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},gf={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(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`),vf.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;sr&&Tf.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)Lf.call(this,e[i],t);return this}};const Af=Phaser.Utils.Objects.GetValue;class Bf 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 wf({parent:this,eventEmitter:Af(e,"eventEmitter",this),groupName:Af(e,"groupName",void 0),clickConfig:Af(e,"click",void 0)}).setButtonsType(e);var s=Af(e,"background",void 0),r=Af(e,"buttons",void 0);this.buttonsAlign=Af(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(Bf.prototype,Mf,Df,Cf,kf);var zf=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=Wf[i])}void 0===s?s={}:!0===s&&(s=Yf);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 Wf={fit:0,FIT:0,envelop:1,ENVELOP:1};var Yf={},If={},jf={};const Xf=Phaser.Utils.Objects.IsPlainObject,Ff=Phaser.Utils.Objects.GetValue,Hf=Phaser.Display.Align.CENTER,Vf=Phaser.Utils.String.UUID;var Gf={add:function(t,e,i,s,r,n,a,h,o,l){var d,c;ye.call(this,t),Xf(e)&&(e=Ff(u=e,"key",void 0),i=Ff(u,"align",Hf),s=Ff(u,"padding",0),r=Ff(u,"expand",!0),t.isRexSizer||(n=Ff(u,"minWidth",t._minWidth),a=Ff(u,"minHeight",t._minHeighted)),h=Ff(u,"offsetX",0),o=Ff(u,"offsetY",0),d=Ff(u,"offsetOriginX",0),c=Ff(u,"offsetOriginY",0),l=Ff(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=Vf()),"string"==typeof i&&(i=Wt[i]),void 0===i&&(i=Hf),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===d&&(d=0),void 0===c&&(c=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)),(u=this.getSizerConfig(t)).align=i,u.padding=fe(s),Xf(r)?(u.expandWidth=Ff(r,"width",!1),u.expandHeight=Ff(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===a?tt(t):a)),u.alignOffsetX=h,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Uf={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]),Oe.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 ba.call(this,t),this}},Nf={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,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,yr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(If.width=e.aspectRatio,If.height=1,jf.width=l,jf.height=d,l=(c=zf(If,jf,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),aa(t,this)):Ge(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),h=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,br.call(this,t,s,r,n,a,e.align,h,o))}};Object.assign(Nf,Gf,Uf);const $f=Phaser.Utils.Objects.IsPlainObject,Kf=Phaser.Utils.Objects.GetValue;class Jf extends na{constructor(t,e,i,s,r,n){$f(e)?(e=Kf(n=e,"x",0),i=Kf(n,"y",0),s=Kf(n,"width",void 0),r=Kf(n,"height",void 0)):$f(s)&&(s=Kf(n=s,"width",void 0),r=Kf(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(Jf.prototype,Nf);const qf=Jf.prototype.add;var Zf=function(t,e,i,s,r,n,a,h,o){return t.setVisible(!1),qf.call(this,t,e,i,s,r,n,a,h,o),this},Qf={add:Zf,addPage:Zf};const tm=Et.prototype.setChildVisible;var em={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?(tm.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&&(tm.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(em,Qf);const im=Phaser.Utils.Objects.GetValue;class sm extends Jf{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(im(e,"swapMode",0)),this.setFadeInDuration(im(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=rm[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(sm.prototype,em);const rm={invisible:0,destroy:1},nm=Phaser.Utils.Objects.IsPlainObject,am=Phaser.Utils.Objects.GetValue,hm=Phaser.Utils.String.UUID;var om={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}},lm={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}},dm={top:1,left:3,right:5,bottom:7},cm={top:"bottom",left:"right",right:"left",bottom:"top"},um={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},pm={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;i0,setInputRowTitleWidth(t){return this}};const Rm=Phaser.Utils.Objects.GetValue;class Lm extends La{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=Rm(e,"background",void 0),s=Rm(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:Rm(e,"space.title",0)}});var r=Rm(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(Lm.prototype,Mm,Em);const Dm=Phaser.Utils.Objects.GetValue,Am=Phaser.Utils.Objects.GetValue;var Bm=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const zm=Phaser.Geom.Intersects.RectangleToRectangle,Wm=Phaser.Geom.Rectangle.Overlaps;var Ym=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},Im=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},jm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},Xm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},Fm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const Hm=Phaser.Utils.Objects.GetValue,Vm={update:0,everyTick:1};var Gm={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Hm(t,"updateMode",0)),this.enableChildrenMask(Hm(t,"padding",0)),this.setMaskLayer(Hm(t,"layer",void 0)),this.onMaskGameObjectVisible=Hm(t,"onVisivle"),this.onMaskGameObjectInvisible=Hm(t,"onInvisible"),this.maskGameObjectCallbackScope=Hm(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=Vm[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=oh.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,h,o,l=!!s||!!r,d=t.getBounds(),c=Bm(e),u=0,p=i.length;uthis.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(Jm.prototype,Um);const qm=["top","bottom","centerY","center"],Zm=["left","right","centerX","center"];var Qm=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,h=qm.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,h=Zm.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 ty=Phaser.Utils.Objects.GetValue;class ey extends ag{constructor(t,e){void 0===e&&(e={});var i=Yp(e),s=ty(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=ty(e,"clampChildOY",!1),s.clampChildOX=ty(e,"clampChildOX",!1);var r,n,a=new Jm(t,s);switch(t.add.existing(a),i){case 0:r=ty(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=ty(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:ty(e,"align.panel","center")};var h=ty(e,"space",void 0);h&&(h.child=ty(h,"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]),ia(this.childrenMap.child,t),this}}var iy={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Qm.call(this,t,"y",e);break;case 1:Qm.call(this,t,"x",e);break;default:Qm.call(this,t,"y",e),Qm.call(this,t,"x",e)}return this}};Object.assign(ey.prototype,iy);var sy={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},ry={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class ny extends ey{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(ny.prototype,sy,ry);const ay=Phaser.Utils.Objects.GetValue,hy=Phaser.Utils.Objects.GetValue,oy=Phaser.Utils.Objects.GetValue;var ly={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=oy(t,"onGetValue"),this.onSetValue=oy(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},dy={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},cy={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const uy=Phaser.Utils.Objects.GetValue;class py extends La{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=uy(e,"proportion.title",0),h=uy(e,"space.title",0);i=0===this.orientation?{right:h}:{bottom:h},this.add(s,{proportion:a,expand:!0,padding:i});var o=r.defaultProportion;void 0===o&&(o=e.defaultExpandWidth?1:0),a=uy(e,"proportion.inputField",o),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(py.prototype,ly,dy,cy);var vy=function(t,e,i){var s=new Mg(t,i);return t.add.existing(s),s},gy=function(t){return void 0===t&&(t=La),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},fy=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=wy(this.styles,"inputRow")||{},r=Cy(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return $c(t,Vg(e,i))}(this.scene,t,Sy(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),ky(this,Vo(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;i=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,a=t.drawX,h=t.drawY,o=a+t.drawTLX,l=a+t.drawTRX,d=h+t.drawTLY,c=h+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)):(Ny(this),$y(this)),this}setNumberInput(){return this.onUpdateCallback=Uy,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const qy=Phaser.Utils.Objects.GetValue,Zy=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Qy=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})),a.value=t.join(e)}else a.value=t.join(i.slice(h,h+a.count));h+=a.count,a.added||(o+=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}ab.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,h=t.length,o=1,l=a+h;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>=h)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=a&&u+1>=h)return n(hb(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,a=t.newPos,h=a-s,o=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const ob=new ab,lb=/^[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,db=/\S/,cb=new ab;cb.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!db.test(t)&&!db.test(e)},cb.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(gb(t,null,null,i),i," ")},vb.equals=function(t,e){return ab.prototype.equals.call(vb,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const fb=new ab;fb.tokenize=function(t){return t.slice()},fb.join=fb.removeEmpty=function(t){return t};const mb=Phaser.Utils.Array.Remove;var yb=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),mb(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,ob.diff(o,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},Sb={cursorMoveLeft(){if(!this.isOpened)return this;var t=xb(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=xb(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Cb(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=xb(wb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Cb(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=xb(wb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const kb=Phaser.Utils.Objects.IsPlainObject;class Ob extends Ll{constructor(t,e,i,s,r,n){kb(e)?n=e:kb(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Qy(e,"wrap.vAlign")||cc(e,"wrap.vAlign",s=i?"center":"top"),Qy(e,"wrap.wrapMode")||cc(e,"wrap.wrapMode","char"),Qy(e,"wrap.maxLines")||cc(e,"wrap.maxLines",s=i?1:void 0),i&&cc(e,"wrap.wrapWidth",1/0),Qy(e,"wrap.useDefaultTextHeight")||cc(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Qy(e.edit,"inputType")){var s=i?"text":"textarea";cc(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new eb(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var h=od(n.background,"focus"),o=od(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=qy(e,"edit");return void 0===i&&(i={}),Ey(e,i,Zy),new Jy(t,i)}(this,n),ib.call(this),n.focusStyle&&Object.assign(h,n.focusStyle),nb.call(this,h),n.cursorStyle&&Object.assign(o,n.cursorStyle),rb.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),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;st.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=Tb(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},Mb={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},Eb={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 Rb=Phaser.Utils.Objects.GetValue;class Lb extends ag{constructor(t,e){void 0===e&&(e={});var i,s=Rb(e,"text");xt(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new Ob(t,s),t.add.existing(i)),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.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,h,o=Rb(e,"space",void 0);o&&(o.child=Rb(o,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=h!==e;a=t,h=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=Rb(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(Lb.prototype,Mb,Eb);var Db={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?Vo(e):{}:e||(e={});var s=new Lb(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},Ab={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=Tb(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const Bb=Phaser.Utils.Objects.GetValue,zb=Phaser.Math.Linear,Wb=Phaser.Math.Snap.Floor;var Yb={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=Bb(s,r),a=function(t,e){var i=new Ev(t,e);return t.add.existing(i),i}(i,s),h=e.defaultExpandWidth?2:0,o=Bb(e,"proportion.range.slider",h),l=void 0===n;t.add(a,{proportion:o,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=Tb(i,d).setNumberInput();h=e.defaultExpandWidth?1:0,o=Bb(e,"proportion.range.inputText",h),t.add(c,{proportion:o,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=zb(t.minValue,t.maxValue,a.value);t.step&&(e=Wb(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},Ib=function(t,e){var i=new Pf(t,e);return t.add.existing(i),i};const jb=Phaser.Utils.Objects.GetValue;var Xb={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=jb(e,"incDec")||{},r={text:null,action:null},n=Ib(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var h=e.inputNumber||e.inputText,o=Tb(i,h).setNumberInput();o.on("close",(function(){t.setValue(o.value)}));var l=Object.assign(Vo(r),s.incButton||{}),d=xm(i,l),c=Object.assign(Vo(r),s.decButton||{}),u=xm(i,c);n.addButton(d),n.addButton(u);var p=s.inputTextIndex||0;n.insert(p,o,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new Ax(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};const zx=Phaser.Utils.Objects.GetValue;var Wx=function(t,e){var i=zx(e,"expandDirection",void 0);"string"==typeof i&&(i=Yx[i]);var s,r,n,a,h,o,l,d=(n="alignTargetX",Qy(s=e,r="alignTarget")?Es(s,r):n&&Qy(s,n)?Es(s,n):a&&Qy(s,a)?Es(s,a):h),c=zx(e,"alignTargetY",d),u=zx(e,"alignOffsetX",0),p=zx(e,"alignOffsetY",0),v=zx(e,"alignSide","").includes("right"),g=zx(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,b=f||m?0:1;t.setOrigin(y,b),o=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var x=g;x||(x=At(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const Yx={down:0,up:1},Ix=Phaser.Utils.Objects.GetValue;class jx extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ri(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 Mi(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Wx(t,e),t.isRexSizer&&t.layout();var i=Ix(e,"touchOutsideClose",!1),s=Ix(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&&ir(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 Xx={openColorPicker:function(){if(!this.colorPicker){var t=Bx.call(this).layout(),e=new jx(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(Xx,ex);const Fx=Phaser.Utils.Objects.GetValue;class Hx extends tx{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(Fx(i,"width",160),Fx(i,"height",170));var n=Fx(i,"background");r=n?function(t){return $c(t,n)}:Fx(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Fx(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Fx(i,"expandDirection")),this.setColorPickerEaseInDuration(Fx(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Fx(i,"easeOut",200)),this.setColorPickerTransitInCallback(Fx(i,"transitIn")),this.setColorPickerTransitOutCallback(Fx(i,"transitOut")),this.setColorPickerBounds(Fx(i,"bounds"));var a=Fx(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var h=e.colorComponents;if(s&&!1!==h&&null!==h){this.setColorComponentsHeight(Fx(h,"height",30)),this.setColorComponentsFormatLabelConfig(Fx(h,"formatLabel"));var o=Fx(h,"inputText");o||(o=Fx(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=Fx(h,"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(Hx.prototype,Xx);var Vx={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?Vo(e):{}:e||(e={});var s=new Hx(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},Gx={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},Ux={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},Nx={buildShapes(){this.addShape((new rc).setName("box")).addShape((new ic).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,h=Math.max(s/10,2),o=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;o.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?o.setRadius(u/2):o.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,v=1*p,g=2*p,f=3*p;l.startAt(v,g).lineTo(g,f).lineTo(f,v).offset(r+d,n+d).end()}this.checked?(o.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(h,this.checkerColor)):(o.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},$x={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new vs(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}},Kx={};Object.assign(Kx,Gx,Ux,Nx,$x);const Jx=23730,qx=Phaser.Utils.Objects.GetValue,Zx=Phaser.Utils.Objects.IsPlainObject;class Qx extends wd{constructor(t,e,i,s,r,n,a){Zx(e)?(e=qx(a=e,"x",0),i=qx(a,"y",0),s=qx(a,"width",2),r=qx(a,"height",2),n=qx(a,"color",Jx)):Zx(n)&&(n=qx(a=n,"color",Jx)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=Jx),this.setBoxShape(qx(a,"circleBox",!1)),this.setBoxFillStyle(n,qx(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(qx(a,"uncheckedColor",null),qx(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(qx(a,"boxLineWidth",4),qx(a,"boxStrokeColor",n),qx(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,qx(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),qx(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(qx(a,"checkerColor",16777215),qx(a,"checkerAlpha",1)),this.setBoxSize(qx(a,"boxSize",1)),this.setCheckerSize(qx(a,"checkerSize",1)),this.setCheckerAnimationDuration(qx(a,"animationDuration",150)),this.buildShapes();var h=qx(a,"checked");void 0===h&&(h=qx(a,"value",!1)),this.setValue(h)}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(Qx.prototype,Kx);const tC=Phaser.Utils.Objects.GetValue,eC=Phaser.Utils.Objects.IsPlainObject;class iC extends Qx{constructor(t,e,i,s,r,n,a){eC(e)?(e=tC(a=e,"x",0),i=tC(a,"y",0),s=tC(a,"width",2),r=tC(a,"height",2),n=tC(a,"color",Jx)):eC(n)&&(n=tC(a=n,"color",Jx)),super(t,e,i,s,r,n,a),this._click=new Sr(this,tC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(tC(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}}var sC={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new iC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},rC={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}},nC={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}},aC={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}},hC=function(t,e,i){return(e-t)*i+t},oC=function(t){return t>>16&255},lC=function(t){return t>>8&255},dC=function(t){return 255&t};const cC=Phaser.Math.Linear;var uC={buildShapes(){this.addShape((new rc).setName("track")).addShape((new rc).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,h=(e-n)/2,o=e*this.trackRadius;s.setTopLeftPosition(a,h).setSize(r,n).setRadius(o)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&hC(oC(l),oC(d),c))<<16|(255&hC(lC(l),lC(d),c))<<8|255&hC(dC(l),dC(d),c)),p=cC(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var v=this.getShape("thumb");if(this.isSizeChanged){var g=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;v.setSize(g,f).setRadius(m)}var y=cC(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;v.setCenterPosition(y,b),v.fillStyle(this.thumbColor,this.thumbAlpha)}},pC={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new vs(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}},vC={};Object.assign(vC,rC,nC,aC,uC,pC);const gC=Phaser.Utils.Objects.GetValue,fC=Phaser.Utils.Objects.IsPlainObject,mC=23730;class yC extends wd{constructor(t,e,i,s,r,n,a){fC(e)?(e=gC(a=e,"x",0),i=gC(a,"y",0),s=gC(a,"width",2),r=gC(a,"height",2),n=gC(a,"color",mC)):fC(n)&&(n=gC(a=n,"color",mC)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=mC),this.setTrackFillStyle(n,gC(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(gC(a,"falseValueTrackColor",function(t){var e=.3*oC(t)+.59*lC(t)+.11*dC(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),gC(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(gC(a,"thumbColor",16777215),gC(a,"thumbAlpha",1)),this.setTrackSize(gC(a,"trackWidth",.9),gC(a,"trackHeight",.5)),this.setTrackRadius(gC(a,"trackRadius",.5*this.trackHeight));var h=gC(a,"thumbHeight",void 0),o=gC(a,"thumbWidth",h);void 0===o&&(o=.9*this.trackHeight),this.setThumbSize(o,h),this.setThumbRadius(gC(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(gC(a,"thumbLeft",.3),gC(a,"thumbRight",void 0)),this.setRTL(gC(a,"rtl",!1)),this.setToggleAnimationDuration(gC(a,"animationDuration",150)),this.buildShapes(),this.setValue(gC(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(yC.prototype,vC);const bC=Phaser.Utils.Objects.GetValue;class xC extends yC{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new Sr(this,bC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(bC(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}}var CC={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new xC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},wC={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=SC[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 SC={down:0,up:1},kC=Phaser.Utils.Objects.GetValue;var OC=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,h=n.length;a0||this.listMaxHeight>0)){if(s=PC(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=TC(e,this.listCreateSliderTrackCallback),v=TC(e,this.listCreateSliderThumbCallback);d=new ey(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:kC(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=PC(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},PC=function(t,e,i){var s;return i?(e.orientation="x",s=new Bf(t,e)):(e.orientation="y",s=new Pf(t,e)),t.add.existing(s),s},TC=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},_C={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}},MC={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=OC.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 jx(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(MC,wC,_C);const EC=Phaser.Utils.Objects.GetValue;class RC extends Xl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(EC(e,"options"));var i=EC(e,"list");this.setWrapEnable(EC(i,"wrap",!1)),this.setCreateButtonCallback(EC(i,"createButtonCallback")),this.setCreateListBackgroundCallback(EC(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(EC(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(EC(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(EC(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(EC(i,"scroller")),this.setListMouseWheelScrollerConfig(EC(i,"mouseWheelScroller")),this.setButtonClickCallback(EC(i,"onButtonClick")),this.setButtonOverCallback(EC(i,"onButtonOver")),this.setButtonOutCallback(EC(i,"onButtonOut")),this.setListExpandDirection(EC(i,"expandDirection")),this.setListEaseInDuration(EC(i,"easeIn",500)),this.setListEaseOutDuration(EC(i,"easeOut",100)),this.setListTransitInCallback(EC(i,"transitIn")),this.settListTransitOutCallback(EC(i,"transitOut")),this.setListMaxHeight(EC(i,"maxHeight",0)),this.setListSize(EC(i,"width"),EC(i,"height",0)),this.setListAlignmentMode(EC(i,"alignParent","text")),this.setListAlignmentSide(EC(i,"alignSide","")),this.setListBounds(EC(i,"bounds")),this.setListSpace(EC(i,"space")),this.setListDraggable(EC(i,"draggable",!1)),this.setValueChangeCallback(EC(e,"setValueCallback"),EC(e,"setValueCallbackScope")),this.setValue(EC(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(RC.prototype,MC);var LC=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?Vo(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,h=_g(t,s,n);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=xm(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var o=e.track;o&&(h.list.createTrackCallback=function(t){return $c(t,o)},delete e.track);var l=e.thumb;return l&&(h.list.createThumbCallback=function(t){return $c(t,l)},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}(t,e);var i=new RC(t,e);return t.add.existing(i),i},DC=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=LC(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=DC(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const BC=Phaser.Utils.Objects.GetValue;var zC={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?Vo(e.button):{},r=BC(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=Ib(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n=0;i--)cf.call(this,e[i],t);return this}},pf=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)}},vf=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,pf.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},gf={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(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`),vf.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;sr&&Tf.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)Lf.call(this,e[i],t);return this}};const Af=Phaser.Utils.Objects.GetValue;class Bf 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 wf({parent:this,eventEmitter:Af(e,"eventEmitter",this),groupName:Af(e,"groupName",void 0),clickConfig:Af(e,"click",void 0)}).setButtonsType(e);var s=Af(e,"background",void 0),r=Af(e,"buttons",void 0);this.buttonsAlign=Af(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(Bf.prototype,Ef,Df,Cf,kf);var zf=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=Wf[i])}void 0===s?s={}:!0===s&&(s=Yf);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 Wf={fit:0,FIT:0,envelop:1,ENVELOP:1};var Yf={},If={},jf={};const Xf=Phaser.Utils.Objects.IsPlainObject,Ff=Phaser.Utils.Objects.GetValue,Hf=Phaser.Display.Align.CENTER,Vf=Phaser.Utils.String.UUID;var Gf={add:function(t,e,i,s,r,n,a,h,o,l){var d,c;ye.call(this,t),Xf(e)&&(e=Ff(u=e,"key",void 0),i=Ff(u,"align",Hf),s=Ff(u,"padding",0),r=Ff(u,"expand",!0),t.isRexSizer||(n=Ff(u,"minWidth",t._minWidth),a=Ff(u,"minHeight",t._minHeighted)),h=Ff(u,"offsetX",0),o=Ff(u,"offsetY",0),d=Ff(u,"offsetOriginX",0),c=Ff(u,"offsetOriginY",0),l=Ff(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=Vf()),"string"==typeof i&&(i=Wt[i]),void 0===i&&(i=Hf),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===d&&(d=0),void 0===c&&(c=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)),(u=this.getSizerConfig(t)).align=i,u.padding=fe(s),Xf(r)?(u.expandWidth=Ff(r,"width",!1),u.expandHeight=Ff(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===a?tt(t):a)),u.alignOffsetX=h,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Uf={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]),Oe.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 ba.call(this,t),this}},Nf={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,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,yr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(If.width=e.aspectRatio,If.height=1,jf.width=l,jf.height=d,l=(c=zf(If,jf,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),aa(t,this)):Ge(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),h=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,br.call(this,t,s,r,n,a,e.align,h,o))}};Object.assign(Nf,Gf,Uf);const $f=Phaser.Utils.Objects.IsPlainObject,Kf=Phaser.Utils.Objects.GetValue;class Jf extends na{constructor(t,e,i,s,r,n){$f(e)?(e=Kf(n=e,"x",0),i=Kf(n,"y",0),s=Kf(n,"width",void 0),r=Kf(n,"height",void 0)):$f(s)&&(s=Kf(n=s,"width",void 0),r=Kf(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(Jf.prototype,Nf);const qf=Jf.prototype.add;var Zf=function(t,e,i,s,r,n,a,h,o){return t.setVisible(!1),qf.call(this,t,e,i,s,r,n,a,h,o),this},Qf={add:Zf,addPage:Zf};const tm=Mt.prototype.setChildVisible;var em={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?(tm.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&&(tm.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(em,Qf);const im=Phaser.Utils.Objects.GetValue;class sm extends Jf{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(im(e,"swapMode",0)),this.setFadeInDuration(im(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=rm[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(sm.prototype,em);const rm={invisible:0,destroy:1},nm=Phaser.Utils.Objects.IsPlainObject,am=Phaser.Utils.Objects.GetValue,hm=Phaser.Utils.String.UUID;var om={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}},lm={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}},dm={top:1,left:3,right:5,bottom:7},cm={top:"bottom",left:"right",right:"left",bottom:"top"},um={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},pm={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;i0,setInputRowTitleWidth(t){return this}};const Rm=Phaser.Utils.Objects.GetValue;class Lm extends La{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=Rm(e,"background",void 0),s=Rm(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:Rm(e,"space.title",0)}});var r=Rm(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(Lm.prototype,Em,Mm);const Dm=Phaser.Utils.Objects.GetValue,Am=Phaser.Utils.Objects.GetValue;var Bm=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const zm=Phaser.Geom.Intersects.RectangleToRectangle,Wm=Phaser.Geom.Rectangle.Overlaps;var Ym=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},Im=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},jm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},Xm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},Fm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const Hm=Phaser.Utils.Objects.GetValue,Vm={update:0,everyTick:1};var Gm={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Hm(t,"updateMode",0)),this.enableChildrenMask(Hm(t,"padding",0)),this.setMaskLayer(Hm(t,"layer",void 0)),this.onMaskGameObjectVisible=Hm(t,"onVisivle"),this.onMaskGameObjectInvisible=Hm(t,"onInvisible"),this.maskGameObjectCallbackScope=Hm(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=Vm[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=oh.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,h,o,l=!!s||!!r,d=t.getBounds(),c=Bm(e),u=0,p=i.length;uthis.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(Jm.prototype,Um);const qm=["top","bottom","centerY","center"],Zm=["left","right","centerX","center"];var Qm=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,h=qm.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,h=Zm.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 ty=Phaser.Utils.Objects.GetValue;class ey extends ag{constructor(t,e){void 0===e&&(e={});var i=Yp(e),s=ty(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=ty(e,"clampChildOY",!1),s.clampChildOX=ty(e,"clampChildOX",!1);var r,n,a=new Jm(t,s);switch(t.add.existing(a),i){case 0:r=ty(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=ty(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:ty(e,"align.panel","center")};var h=ty(e,"space",void 0);h&&(h.child=ty(h,"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]),ia(this.childrenMap.child,t),this}}var iy={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Qm.call(this,t,"y",e);break;case 1:Qm.call(this,t,"x",e);break;default:Qm.call(this,t,"y",e),Qm.call(this,t,"x",e)}return this}};Object.assign(ey.prototype,iy);var sy={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},ry={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class ny extends ey{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(ny.prototype,sy,ry);const ay=Phaser.Utils.Objects.GetValue,hy=Phaser.Utils.Objects.GetValue,oy=Phaser.Utils.Objects.GetValue;var ly={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=oy(t,"onGetValue"),this.onSetValue=oy(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},dy={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},cy={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const uy=Phaser.Utils.Objects.GetValue;class py extends La{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=uy(e,"proportion.title",0),h=uy(e,"space.title",0);i=0===this.orientation?{right:h}:{bottom:h},this.add(s,{proportion:a,expand:!0,padding:i});var o=r.defaultProportion;void 0===o&&(o=e.defaultExpandWidth?1:0),a=uy(e,"proportion.inputField",o),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(py.prototype,ly,dy,cy);var vy=function(t,e,i){var s=new Eg(t,i);return t.add.existing(s),s},gy=function(t){return void 0===t&&(t=La),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},fy=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=wy(this.styles,"inputRow")||{},r=Cy(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return $c(t,Vg(e,i))}(this.scene,t,Sy(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),ky(this,Vo(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;i=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,a=t.drawX,h=t.drawY,o=a+t.drawTLX,l=a+t.drawTRX,d=h+t.drawTLY,c=h+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)):(Ny(this),$y(this)),this}setNumberInput(){return this.onUpdateCallback=Uy,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const qy=Phaser.Utils.Objects.GetValue,Zy=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Qy=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})),a.value=t.join(e)}else a.value=t.join(i.slice(h,h+a.count));h+=a.count,a.added||(o+=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}ab.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,h=t.length,o=1,l=a+h;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>=h)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=a&&u+1>=h)return n(hb(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,a=t.newPos,h=a-s,o=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const ob=new ab,lb=/^[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,db=/\S/,cb=new ab;cb.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!db.test(t)&&!db.test(e)},cb.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(gb(t,null,null,i),i," ")},vb.equals=function(t,e){return ab.prototype.equals.call(vb,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const fb=new ab;fb.tokenize=function(t){return t.slice()},fb.join=fb.removeEmpty=function(t){return t};const mb=Phaser.Utils.Array.Remove;var yb=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),mb(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,ob.diff(o,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},Sb={cursorMoveLeft(){if(!this.isOpened)return this;var t=xb(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=xb(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Cb(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=xb(wb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Cb(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=xb(wb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const kb=Phaser.Utils.Objects.IsPlainObject;class Ob extends Ll{constructor(t,e,i,s,r,n){kb(e)?n=e:kb(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Qy(e,"wrap.vAlign")||cc(e,"wrap.vAlign",s=i?"center":"top"),Qy(e,"wrap.wrapMode")||cc(e,"wrap.wrapMode","char"),Qy(e,"wrap.maxLines")||cc(e,"wrap.maxLines",s=i?1:void 0),i&&cc(e,"wrap.wrapWidth",1/0),Qy(e,"wrap.useDefaultTextHeight")||cc(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Qy(e.edit,"inputType")){var s=i?"text":"textarea";cc(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new eb(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var h=od(n.background,"focus"),o=od(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=qy(e,"edit");return void 0===i&&(i={}),My(e,i,Zy),new Jy(t,i)}(this,n),ib.call(this),n.focusStyle&&Object.assign(h,n.focusStyle),nb.call(this,h),n.cursorStyle&&Object.assign(o,n.cursorStyle),rb.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),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;st.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=Tb(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},Eb={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},Mb={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 Rb=Phaser.Utils.Objects.GetValue;class Lb extends ag{constructor(t,e){void 0===e&&(e={});var i,s=Rb(e,"text");xt(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new Ob(t,s),t.add.existing(i)),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.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,h,o=Rb(e,"space",void 0);o&&(o.child=Rb(o,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=h!==e;a=t,h=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=Rb(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(Lb.prototype,Eb,Mb);var Db={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?Vo(e):{}:e||(e={});var s=new Lb(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},Ab={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=Tb(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const Bb=Phaser.Utils.Objects.GetValue,zb=Phaser.Math.Linear,Wb=Phaser.Math.Snap.Floor;var Yb={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=Bb(s,r),a=function(t,e){var i=new Mv(t,e);return t.add.existing(i),i}(i,s),h=e.defaultExpandWidth?2:0,o=Bb(e,"proportion.range.slider",h),l=void 0===n;t.add(a,{proportion:o,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=Tb(i,d).setNumberInput();h=e.defaultExpandWidth?1:0,o=Bb(e,"proportion.range.inputText",h),t.add(c,{proportion:o,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=zb(t.minValue,t.maxValue,a.value);t.step&&(e=Wb(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},Ib=function(t,e){var i=new Pf(t,e);return t.add.existing(i),i};const jb=Phaser.Utils.Objects.GetValue;var Xb={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=jb(e,"incDec")||{},r={text:null,action:null},n=Ib(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var h=e.inputNumber||e.inputText,o=Tb(i,h).setNumberInput();o.on("close",(function(){t.setValue(o.value)}));var l=Object.assign(Vo(r),s.incButton||{}),d=xm(i,l),c=Object.assign(Vo(r),s.decButton||{}),u=xm(i,c);n.addButton(d),n.addButton(u);var p=s.inputTextIndex||0;n.insert(p,o,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new Ax(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};const zx=Phaser.Utils.Objects.GetValue;var Wx=function(t,e){var i=zx(e,"expandDirection",void 0);"string"==typeof i&&(i=Yx[i]);var s,r,n,a,h,o,l,d=(n="alignTargetX",Qy(s=e,r="alignTarget")?Ms(s,r):n&&Qy(s,n)?Ms(s,n):a&&Qy(s,a)?Ms(s,a):h),c=zx(e,"alignTargetY",d),u=zx(e,"alignOffsetX",0),p=zx(e,"alignOffsetY",0),v=zx(e,"alignSide","").includes("right"),g=zx(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,b=f||m?0:1;t.setOrigin(y,b),o=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var x=g;x||(x=At(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const Yx={down:0,up:1},Ix=Phaser.Utils.Objects.GetValue;class jx extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ri(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 Ei(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Wx(t,e),t.isRexSizer&&t.layout();var i=Ix(e,"touchOutsideClose",!1),s=Ix(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&&ir(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 Xx={openColorPicker:function(){if(!this.colorPicker){var t=Bx.call(this).layout(),e=new jx(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(Xx,ex);const Fx=Phaser.Utils.Objects.GetValue;class Hx extends tx{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(Fx(i,"width",160),Fx(i,"height",170));var n=Fx(i,"background");r=n?function(t){return $c(t,n)}:Fx(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Fx(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Fx(i,"expandDirection")),this.setColorPickerEaseInDuration(Fx(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Fx(i,"easeOut",200)),this.setColorPickerTransitInCallback(Fx(i,"transitIn")),this.setColorPickerTransitOutCallback(Fx(i,"transitOut")),this.setColorPickerBounds(Fx(i,"bounds"));var a=Fx(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var h=e.colorComponents;if(s&&!1!==h&&null!==h){this.setColorComponentsHeight(Fx(h,"height",30)),this.setColorComponentsFormatLabelConfig(Fx(h,"formatLabel"));var o=Fx(h,"inputText");o||(o=Fx(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=Fx(h,"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(Hx.prototype,Xx);var Vx={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?Vo(e):{}:e||(e={});var s=new Hx(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},Gx={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},Ux={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},Nx={buildShapes(){this.addShape((new rc).setName("box")).addShape((new ic).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,h=Math.max(s/10,2),o=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;o.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?o.setRadius(u/2):o.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,v=1*p,g=2*p,f=3*p;l.startAt(v,g).lineTo(g,f).lineTo(f,v).offset(r+d,n+d).end()}this.checked?(o.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(h,this.checkerColor)):(o.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},$x={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new vs(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}},Kx={};Object.assign(Kx,Gx,Ux,Nx,$x);const Jx=23730,qx=Phaser.Utils.Objects.GetValue,Zx=Phaser.Utils.Objects.IsPlainObject;class Qx extends wd{constructor(t,e,i,s,r,n,a){Zx(e)?(e=qx(a=e,"x",0),i=qx(a,"y",0),s=qx(a,"width",2),r=qx(a,"height",2),n=qx(a,"color",Jx)):Zx(n)&&(n=qx(a=n,"color",Jx)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=Jx),this.setBoxShape(qx(a,"circleBox",!1)),this.setBoxFillStyle(n,qx(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(qx(a,"uncheckedColor",null),qx(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(qx(a,"boxLineWidth",4),qx(a,"boxStrokeColor",n),qx(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,qx(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),qx(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(qx(a,"checkerColor",16777215),qx(a,"checkerAlpha",1)),this.setBoxSize(qx(a,"boxSize",1)),this.setCheckerSize(qx(a,"checkerSize",1)),this.setCheckerAnimationDuration(qx(a,"animationDuration",150)),this.buildShapes();var h=qx(a,"checked");void 0===h&&(h=qx(a,"value",!1)),this.setValue(h)}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(Qx.prototype,Kx);const tC=Phaser.Utils.Objects.GetValue,eC=Phaser.Utils.Objects.IsPlainObject;class iC extends Qx{constructor(t,e,i,s,r,n,a){eC(e)?(e=tC(a=e,"x",0),i=tC(a,"y",0),s=tC(a,"width",2),r=tC(a,"height",2),n=tC(a,"color",Jx)):eC(n)&&(n=tC(a=n,"color",Jx)),super(t,e,i,s,r,n,a),this._click=new Sr(this,tC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(tC(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}}var sC={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new iC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},rC={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}},nC={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}},aC={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}},hC=function(t,e,i){return(e-t)*i+t},oC=function(t){return t>>16&255},lC=function(t){return t>>8&255},dC=function(t){return 255&t};const cC=Phaser.Math.Linear;var uC={buildShapes(){this.addShape((new rc).setName("track")).addShape((new rc).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,h=(e-n)/2,o=e*this.trackRadius;s.setTopLeftPosition(a,h).setSize(r,n).setRadius(o)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&hC(oC(l),oC(d),c))<<16|(255&hC(lC(l),lC(d),c))<<8|255&hC(dC(l),dC(d),c)),p=cC(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var v=this.getShape("thumb");if(this.isSizeChanged){var g=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;v.setSize(g,f).setRadius(m)}var y=cC(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;v.setCenterPosition(y,b),v.fillStyle(this.thumbColor,this.thumbAlpha)}},pC={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new vs(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}},vC={};Object.assign(vC,rC,nC,aC,uC,pC);const gC=Phaser.Utils.Objects.GetValue,fC=Phaser.Utils.Objects.IsPlainObject,mC=23730;class yC extends wd{constructor(t,e,i,s,r,n,a){fC(e)?(e=gC(a=e,"x",0),i=gC(a,"y",0),s=gC(a,"width",2),r=gC(a,"height",2),n=gC(a,"color",mC)):fC(n)&&(n=gC(a=n,"color",mC)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=mC),this.setTrackFillStyle(n,gC(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(gC(a,"falseValueTrackColor",function(t){var e=.3*oC(t)+.59*lC(t)+.11*dC(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),gC(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(gC(a,"thumbColor",16777215),gC(a,"thumbAlpha",1)),this.setTrackSize(gC(a,"trackWidth",.9),gC(a,"trackHeight",.5)),this.setTrackRadius(gC(a,"trackRadius",.5*this.trackHeight));var h=gC(a,"thumbHeight",void 0),o=gC(a,"thumbWidth",h);void 0===o&&(o=.9*this.trackHeight),this.setThumbSize(o,h),this.setThumbRadius(gC(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(gC(a,"thumbLeft",.3),gC(a,"thumbRight",void 0)),this.setRTL(gC(a,"rtl",!1)),this.setToggleAnimationDuration(gC(a,"animationDuration",150)),this.buildShapes(),this.setValue(gC(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(yC.prototype,vC);const bC=Phaser.Utils.Objects.GetValue;class xC extends yC{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new Sr(this,bC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(bC(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}}var CC={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new xC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},wC={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=SC[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 SC={down:0,up:1},kC=Phaser.Utils.Objects.GetValue;var OC=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,h=n.length;a0||this.listMaxHeight>0)){if(s=PC(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=TC(e,this.listCreateSliderTrackCallback),v=TC(e,this.listCreateSliderThumbCallback);d=new ey(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:kC(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=PC(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},PC=function(t,e,i){var s;return i?(e.orientation="x",s=new Bf(t,e)):(e.orientation="y",s=new Pf(t,e)),t.add.existing(s),s},TC=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},_C={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}},EC={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=OC.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 jx(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(EC,wC,_C);const MC=Phaser.Utils.Objects.GetValue;class RC extends Xl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(MC(e,"options"));var i=MC(e,"list");this.setWrapEnable(MC(i,"wrap",!1)),this.setCreateButtonCallback(MC(i,"createButtonCallback")),this.setCreateListBackgroundCallback(MC(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(MC(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(MC(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(MC(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(MC(i,"scroller")),this.setListMouseWheelScrollerConfig(MC(i,"mouseWheelScroller")),this.setButtonClickCallback(MC(i,"onButtonClick")),this.setButtonOverCallback(MC(i,"onButtonOver")),this.setButtonOutCallback(MC(i,"onButtonOut")),this.setListExpandDirection(MC(i,"expandDirection")),this.setListEaseInDuration(MC(i,"easeIn",500)),this.setListEaseOutDuration(MC(i,"easeOut",100)),this.setListTransitInCallback(MC(i,"transitIn")),this.settListTransitOutCallback(MC(i,"transitOut")),this.setListMaxHeight(MC(i,"maxHeight",0)),this.setListSize(MC(i,"width"),MC(i,"height",0)),this.setListAlignmentMode(MC(i,"alignParent","text")),this.setListAlignmentSide(MC(i,"alignSide","")),this.setListBounds(MC(i,"bounds")),this.setListSpace(MC(i,"space")),this.setListDraggable(MC(i,"draggable",!1)),this.setValueChangeCallback(MC(e,"setValueCallback"),MC(e,"setValueCallbackScope")),this.setValue(MC(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(RC.prototype,EC);var LC=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?Vo(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,h=_g(t,s,n);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=xm(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var o=e.track;o&&(h.list.createTrackCallback=function(t){return $c(t,o)},delete e.track);var l=e.thumb;return l&&(h.list.createThumbCallback=function(t){return $c(t,l)},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}(t,e);var i=new RC(t,e);return t.add.existing(i),i},DC=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=LC(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=DC(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const BC=Phaser.Utils.Objects.GetValue;var zC={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?Vo(e.button):{},r=BC(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=Ib(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;ni(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 s in t)t.hasOwnProperty(s)&&(e[s]=i(t[s]));return e}const s=Phaser.Utils.Objects.IsPlainObject,r=Phaser.Utils.Objects.GetValue;var n=function(t){return"string"==typeof t&&(t=a[t]),t};const a={scale:0,repeat:1};var o=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},h=function(){},l={_beginDraw:h,_drawImage:h,_drawTileSprite:h,_endDraw:h,setGetFrameNameCallback:function(t){return void 0===t&&(t=e),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,s,r){Array.isArray(e)&&(r=s,s=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof s&&arguments.length>=6?(s=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):void 0===s&&void 0===r&&void 0!==this.columns.data&&void 0!==this.rows.data?(s=this.columns.data,r=this.rows.data):(s=i(s),r=i(r)),this.textureKey=t,this.baseFrameName=e,this.columns.data=s,this.columns.count=s?s.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=r,this.rows.count=r?r.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var n=this.scene.sys.textures.get(t);if(!n)return this.clear(),this;if(!s||!r)return this.clear(),this;for(var a=n.get(e),o=a.width,h=0,l=0,d=s.length;l0?o/h:0,u=a.height,p=0;for(l=0,d=r.length;l0?0:f,x=0,l=0;for(var S=s.length;l0?0:m),m>=1&&f>=1){var P=typeof(y=this.getFrameNameCallback(l,k,e));"string"!==P&&"number"!==P||n.add(y,0,x+a.cutX,C+a.cutY,m,f)}x+=m}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,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 g=Math.min(u,p);if(u>g){var v=(u-g)*h;d>=0?d+=v:d=v,u=g}if(p>g){var f=(p-g)*l;c>=0?c+=f:c=f,p=g}}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 s(t)?(this.stretchMode.edge=n(r(t,"edge",0)),this.stretchMode.internal=n(r(t,"internal",0))):(t=n(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return o.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 d=Phaser.Utils.Objects.IsPlainObject,c=Phaser.Utils.Objects.GetValue;var u=function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(d(i)?(i=c(u=i,"x",0),s=c(u,"y",0),r=c(u,"width",1),n=c(u,"height",1),a=c(u,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(r)?(r=c(u=r,"width",1),n=c(u,"height",1),a=c(u,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(a)?(a=c(u=a,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(o)?(o=c(u=o,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=c(u,"baseFrame",void 0)):d(h)&&(h=c(u=h,"columns",void 0),l=c(u,"rows",void 0)),void 0===o&&(o=c(u,"frame",void 0)),void 0===h){var p=c(u,"leftWidth",void 0),g=c(u,"rightWidth",void 0);void 0!==p&&void 0!==g&&(h=[p,void 0,g])}if(void 0===l){var v=c(u,"topHeight",void 0),f=c(u,"bottomHeight",void 0);void 0!==v&&void 0!==f&&(l=[v,void 0,f])}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(c(u,"getFrameNameCallback",void 0)),this.setStretchMode(c(u,"stretchMode",0)),this.setPreserveRatio(c(u,"preserveRatio",!0));var m=c(u,"maxFixedPartScale",1),y=c(u,"maxFixedPartScaleX",m),b=c(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(y,b),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,l),i};const p=Phaser.Game;var g=function(t){return t instanceof p};const v=Phaser.Scene;var f=function(t){return t instanceof v},m=function(t){return null==t||"object"!=typeof t?null:g(t)?t:g(t.game)?t.game:f(t)?t.sys.game:f(t.scene)?t.scene.sys.game:void 0};const y=Phaser.GameObjects;var b=void 0,x=function(t,e){if(b||(b={},m(t).events.once("destroy",(function(){for(var t in b)b[t].destroy();b=void 0}))),!b.hasOwnProperty(e)){var i=m(t).scene.systemScene;(t=new y[e](i)).setOrigin(0),b[e]=t}return b[e]};const C=Phaser.GameObjects.RenderTexture;let k=class extends(u(C,"rexNinePatch")){};var w={_drawImage:function(t,e,i,s,r,n){var a=x(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=x(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(k.prototype,w);var S=function(t){return null==t||""===t||0===t.length},P=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(S(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(S(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;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 D=Phaser.Utils.Objects.GetValue;var j={};let A=class{constructor(t){this.pools=D(t,"pools",j)}destroy(){this.pools=void 0}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new I),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e0},N=function(t,e){return t._depth-e._depth};const $=Phaser.GameObjects.Components;Phaser.Class.mixin(H,[$.Alpha,$.BlendMode,$.ComputedSize,$.Depth,$.GetBounds,$.Mask,$.Origin,$.Pipeline,$.PostPipeline,$.ScrollFactor,$.Transform,$.Visible,M,B]);const K="image";var J=function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,n=i,a=0;a0&&!ot(t)&&(t=this.parent.texture.get(t)),this.frame=t,this._width=t?t.width:0,this._height=t?t.height:0,this}setFlipX(t){return void 0===t&&(t=!0),this.flipX=t,this}setFlipY(t){return void 0===t&&(t=!0),this.flipY=t,this}resetFlip(){return this.flipX=!1,this.flipY=!1,this}get tint(){return void 0===this._tint?this.parent.tint:this._tint}set tint(t){this._tint=t}setTint(t){return this.tint=t,this.tintFill=!1,this}setTintFill(t){return this.tint=t,this.tintFill=!0,this}clearTint(){return this.setTint(16777215),this}resetTint(){return this.tint=void 0,this.tintFill=void 0,this}get tintFill(){return void 0===this._tintFill?this.parent.tintFill:this._tintFill}set tintFill(t){this._tintFill=t}reset(){return super.reset(),this.resetFlip().resetTint().setFrame(),this}modifyPorperties(t){return t?(t.hasOwnProperty("width")&&(t.displayWidth=t.width,delete t.width),t.hasOwnProperty("height")&&(t.displayHeight=t.height,delete t.height),t.hasOwnProperty("frame")&&this.setFrame(t.frame),super.modifyPorperties(t),t.hasOwnProperty("flipX")&&this.setFlipX(t.flipX),t.hasOwnProperty("flipY")&&this.setFlipY(t.flipY),t.hasOwnProperty("tint")&&this.setTint(t.tint),t.hasOwnProperty("tintFill")&&this.setTintFill(t.tintFill),this):this}};var lt={webglRender:function(t,e,i,s,r,n,a,o){var h=this._width,l=this._height,d=h*this.originX,c=l*this.originY,u=this.x-s,p=this.y-r,g=1,v=1;this.flipX&&(u+=h-2*d,g=-1),this.flipY&&(p+=l-2*c,v=-1),at.applyITRS(u,p,this.rotation,this.scaleX*g,this.scaleY*v),e.multiply(at,at);var f=-d,m=-c,y=f+h,b=m+l,x=at.setQuad(f,m,y,b,o),C=this.frame.u0,k=this.frame.v0,w=this.frame.u1,S=this.frame.v1,P=nt(this.tint,this.alpha*i);t.batchQuad(this.parent,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],C,k,w,S,P,P,P,P,this.tintFill,n,a)},canvasRender:function(t,e,i,s){t.save();var r=this._width,n=this._height,a=r*this.originX,o=n*this.originY,h=this.x-a,l=this.y-o,d=1,c=1;this.flipX&&(h+=r,d=-1),this.flipY&&(l+=n,c=-1),s&&(h=Math.round(h),l=Math.round(l)),t.translate(h,l),t.rotate(this.rotation),t.scale(this.scaleX*d,this.scaleY*c);var u=this.frame;t.drawImage(u.source.image,u.cutX,u.cutY,r,n,0,0,r,n),t.restore()}};Object.assign(ht.prototype,lt);var dt=function(t,e){"string"==typeof e&&(e={frame:e});var i=t.poolManager?t.poolManager.allocate(K):null;return null===i?i=new ht(t):i.setParent(t).setActive(),i.modifyPorperties(e),t.addChild(i),i},ct={_drawImage:function(t,e,i,s,r,n){dt(this,{frame:e,x:i,y:s,width:r,height:n})},_drawTileSprite:function(t,e,i,s,r,n){var a=this.texture.get(e),o=a.width,h=a.height,l=Math.floor(r/o),d=Math.floor(n/h);i+=(r-l*o)/2,s+=(n-d*h)/2;for(var c=0;c>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},bt=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 xt=Phaser.Renderer.Canvas.SetTransform;var Ct={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=mt(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&>(r,a,e,l,o,h),e.isStroked&&ft(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(xt(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(wt.prototype,Ct);const St=Phaser.Utils.Objects.GetValue;let Pt=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=St(t,"x",0),i=St(t,"y",0));var s=this.cornerRadius;s.tl=Tt(St(t,"tl",void 0),e,i),s.tr=Tt(St(t,"tr",void 0),e,i),s.bl=Tt(St(t,"bl",void 0),e,i),s.br=Tt(St(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ot(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ot(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ot(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ot(this.cornerRadius.br,t)}};var Tt=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Mt(t),t},Ot=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=St(e,"x",0),t.y=St(e,"y",0)),Mt(t)},Mt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Et=function(t){return t.x>0&&t.y>0},_t=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 Rt=Phaser.Math.DegToRad;var Lt=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n=p?1:s/p,f=r>=g?1:r/g,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,h,l,h,l,180,270,!1,a):ee(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,s-h,l,h,l,270,360,!1,a):ee(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,s-h,r-l,h,l,0,90,!1,a):ee(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,h,r-l,h,l,90,180,!1,a):ee(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()},Qt=function(t){return!t.hasOwnProperty("convex")||t.convex},te=function(t){return t.x>0&&t.y>0},ee=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())}(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}},se=function(){ie(this,this.fillStyle,this.strokeStyle,this.lineWidth,this.radius,this.fillColor2,this.isHorizontalGradient,this.iteration)};const re=Phaser.Utils.Objects.GetValue;let ne=class extends Nt{constructor(t,e,i,s,r,n,a,o,h,l,d,c){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=1),super(t,e,i,s,r,c),this.type="rexRoundRectangleCanvas";var u=re(n,"radius",n),p=re(n,"iteration",void 0);this.setRadius(u),this.setIteration(p),this.setFillStyle(a,l,d),this.setStrokeStyle(o,h)}get radius(){return this._radius}set radius(t){this.dirty|=this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this}get iteration(){return this._iteration}set iteration(t){this.dirty|=this._iteration!=t,this._iteration=t}setIteration(t){return this.iteration=t,this}get fillStyle(){return this._fillStyle}set fillStyle(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._fillStyle!=t,this._fillStyle=t}get fillColor2(){return this._fillColor2}set fillColor2(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._fillColor2!=t,this._fillColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setFillStyle(t,e,i){return void 0===i&&(i=!0),this.fillStyle=t,this.fillColor2=e,this.isHorizontalGradient=i,this}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._strokeStyle!=t,this._strokeStyle=t}get lineWidth(){return this._lineWidth}set lineWidth(t){this.dirty|=this._lineWidth!=t,this._lineWidth=t}setStrokeStyle(t,e){return this.strokeStyle=t,this.lineWidth=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),se.call(this)}),this),this}};t.register("roundRectangleCanvas",(function(t,e,i,s,r,n,a,o,h,l){var d=new ne(this.scene,t,e,i,s,r,n,a,o,h,l);return this.scene.add.existing(d),d})),P(window,"RexPlugins.UI.RoundRectangleCanvas",ne);var ae=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},oe=function(t,e,i){e&&!ae(t,`${e}X`)&&(Object.defineProperty(t,`${e}X`,{get:function(){return i.x},set:function(e){i.x=e,t.dirty=!0}}),Object.defineProperty(t,`${e}Y`,{get:function(){return i.y},set:function(e){i.y=e,t.dirty=!0}}),Object.defineProperty(t,`${e}T`,{get:function(){return i.t},set:function(e){i.t=e,t.dirty=!0}}))},he={setTLPosition(t,e){return this.geom.setTLPosition(t,e),this.dirty=!0,this},setTRPosition(t,e){return this.geom.setTRPosition(t,e),this.dirty=!0,this},setBLPosition(t,e){return this.geom.setBLPosition(t,e),this.dirty=!0,this},setBRPosition(t,e){return this.geom.setBRPosition(t,e),this.dirty=!0,this},resetCornerPosition(){return this.geom.resetCornerPosition(),this.dirty=!0,this},insertTopSidePoint(t,e,i,s){var r=this.geom.topSidePoints;if(Array.isArray(t))for(var n,a=0,o=(r=t).length;a=0;f--)y=g[f],b=pe(d,h,y.t)+y.x,x=pe(c,l,y.t)+y.y,_t(b,x,e);for(_t(d,c,e),fe(v),f=v.length-1;f>=0;f--)y=v[f],b=pe(r,d,y.t)+y.x,x=pe(n,c,y.t)+y.y,_t(b,x,e);return e.push(e[0],e[1]),this.pathIndexes=ge(e),this}get tlx(){return this.geom.tlx}set tlx(t){this.geom.tlx=t,this.dirty=!0}get tly(){return this.geom.tly}set tly(t){this.geom.tly=t,this.dirty=!0}get trx(){return this.geom.trx}set trx(t){this.geom.trx=t,this.dirty=!0}get try(){return this.geom.try}set try(t){this.geom.try=t,this.dirty=!0}get blx(){return this.geom.blx}set blx(t){this.geom.blx=t,this.dirty=!0}get bly(){return this.geom.bly}set bly(t){this.geom.bly=t,this.dirty=!0}get brx(){return this.geom.brx}set brx(t){this.geom.brx=t,this.dirty=!0}get bry(){return this.geom.bry}set bry(t){this.geom.bry=t,this.dirty=!0}get leftSidePoints(){return this.geom.leftSidePoints}get topSidePoints(){return this.geom.topSidePoints}get bottomSidePoints(){return this.geom.bottomSidePoints}get rightSidePoints(){return this.geom.rightSidePoints}}var fe=function(t){t.length<=1||t.sort((function(t,e){return t.t-e.t}))};Object.assign(ve.prototype,he),t.register("QuadShape",(function(t,e,i,s,r,n){var a=new ve(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.QuadShape",ve);var me=Phaser.Renderer.WebGL.Utils,ye={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=me.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.style.resolution,a/e.style.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){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const be=Phaser.Display.Canvas.CanvasPool;F();const xe=Phaser.GameObjects.GameObject;class Ce extends xe{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=be.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),a=Math.ceil(n.width*t.baselineX),o=a,h=2*o;if(o=o*t.baselineY|0,s.width=a,s.height=h,r.fillStyle="#f00",r.fillRect(0,0,a,h),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,o),i.left=0,0===a||0===h||!r.getImageData(0,0,a,h))return be.remove(s),i;for(var l=r.getImageData(0,0,a,h).data,d=!1,c=0;ci(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 s in t)t.hasOwnProperty(s)&&(e[s]=i(t[s]));return e}const s=Phaser.Utils.Objects.IsPlainObject,r=Phaser.Utils.Objects.GetValue;var n=function(t){return"string"==typeof t&&(t=a[t]),t};const a={scale:0,repeat:1};var o=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},h=function(){},l={_beginDraw:h,_drawImage:h,_drawTileSprite:h,_endDraw:h,setGetFrameNameCallback:function(t){return void 0===t&&(t=e),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,s,r){Array.isArray(e)&&(r=s,s=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof s&&arguments.length>=6?(s=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):void 0===s&&void 0===r&&void 0!==this.columns.data&&void 0!==this.rows.data?(s=this.columns.data,r=this.rows.data):(s=i(s),r=i(r)),this.textureKey=t,this.baseFrameName=e,this.columns.data=s,this.columns.count=s?s.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=r,this.rows.count=r?r.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var n=this.scene.sys.textures.get(t);if(!n)return this.clear(),this;if(!s||!r)return this.clear(),this;for(var a=n.get(e),o=a.width,h=0,l=0,d=s.length;l0?o/h:0,u=a.height,p=0;for(l=0,d=r.length;l0?0:f,x=0,l=0;for(var S=s.length;l0?0:m),m>=1&&f>=1){var P=typeof(y=this.getFrameNameCallback(l,k,e));"string"!==P&&"number"!==P||n.add(y,0,x+a.cutX,C+a.cutY,m,f)}x+=m}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,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 g=Math.min(u,p);if(u>g){var v=(u-g)*h;d>=0?d+=v:d=v,u=g}if(p>g){var f=(p-g)*l;c>=0?c+=f:c=f,p=g}}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 s(t)?(this.stretchMode.edge=n(r(t,"edge",0)),this.stretchMode.internal=n(r(t,"internal",0))):(t=n(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return o.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 d=Phaser.Utils.Objects.IsPlainObject,c=Phaser.Utils.Objects.GetValue;var u=function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(d(i)?(i=c(u=i,"x",0),s=c(u,"y",0),r=c(u,"width",1),n=c(u,"height",1),a=c(u,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(r)?(r=c(u=r,"width",1),n=c(u,"height",1),a=c(u,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(a)?(a=c(u=a,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(o)?(o=c(u=o,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=c(u,"baseFrame",void 0)):d(h)&&(h=c(u=h,"columns",void 0),l=c(u,"rows",void 0)),void 0===o&&(o=c(u,"frame",void 0)),void 0===h){var p=c(u,"leftWidth",void 0),g=c(u,"rightWidth",void 0);void 0!==p&&void 0!==g&&(h=[p,void 0,g])}if(void 0===l){var v=c(u,"topHeight",void 0),f=c(u,"bottomHeight",void 0);void 0!==v&&void 0!==f&&(l=[v,void 0,f])}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(c(u,"getFrameNameCallback",void 0)),this.setStretchMode(c(u,"stretchMode",0)),this.setPreserveRatio(c(u,"preserveRatio",!0));var m=c(u,"maxFixedPartScale",1),y=c(u,"maxFixedPartScaleX",m),b=c(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(y,b),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,l),i};const p=Phaser.Game;var g=function(t){return t instanceof p};const v=Phaser.Scene;var f=function(t){return t instanceof v},m=function(t){return null==t||"object"!=typeof t?null:g(t)?t:g(t.game)?t.game:f(t)?t.sys.game:f(t.scene)?t.scene.sys.game:void 0};const y=Phaser.GameObjects;var b=void 0,x=function(t,e){if(b||(b={},m(t).events.once("destroy",(function(){for(var t in b)b[t].destroy();b=void 0}))),!b.hasOwnProperty(e)){var i=m(t).scene.systemScene;(t=new y[e](i)).setOrigin(0),b[e]=t}return b[e]};const C=Phaser.GameObjects.RenderTexture;let k=class extends(u(C,"rexNinePatch")){};var w={_drawImage:function(t,e,i,s,r,n){var a=x(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=x(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(k.prototype,w);var S=function(t){return null==t||""===t||0===t.length},P=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(S(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(S(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;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 D=Phaser.Utils.Objects.GetValue;var A={};let j=class{constructor(t){this.pools=D(t,"pools",A)}destroy(){this.pools=void 0}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new I),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e0},N=function(t,e){return t._depth-e._depth};const $=Phaser.GameObjects.Components;Phaser.Class.mixin(H,[$.Alpha,$.BlendMode,$.ComputedSize,$.Depth,$.GetBounds,$.Mask,$.Origin,$.Pipeline,$.PostPipeline,$.ScrollFactor,$.Transform,$.Visible,M,B]);const K="image";var J=function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,n=i,a=0;a0&&!ot(t)&&(t=this.parent.texture.get(t)),this.frame=t,this._width=t?t.width:0,this._height=t?t.height:0,this}setFlipX(t){return void 0===t&&(t=!0),this.flipX=t,this}setFlipY(t){return void 0===t&&(t=!0),this.flipY=t,this}resetFlip(){return this.flipX=!1,this.flipY=!1,this}get tint(){return void 0===this._tint?this.parent.tint:this._tint}set tint(t){this._tint=t}setTint(t){return this.tint=t,this.tintFill=!1,this}setTintFill(t){return this.tint=t,this.tintFill=!0,this}clearTint(){return this.setTint(16777215),this}resetTint(){return this.tint=void 0,this.tintFill=void 0,this}get tintFill(){return void 0===this._tintFill?this.parent.tintFill:this._tintFill}set tintFill(t){this._tintFill=t}reset(){return super.reset(),this.resetFlip().resetTint().setFrame(),this}modifyPorperties(t){return t?(t.hasOwnProperty("width")&&(t.displayWidth=t.width,delete t.width),t.hasOwnProperty("height")&&(t.displayHeight=t.height,delete t.height),t.hasOwnProperty("frame")&&this.setFrame(t.frame),super.modifyPorperties(t),t.hasOwnProperty("flipX")&&this.setFlipX(t.flipX),t.hasOwnProperty("flipY")&&this.setFlipY(t.flipY),t.hasOwnProperty("tint")&&this.setTint(t.tint),t.hasOwnProperty("tintFill")&&this.setTintFill(t.tintFill),this):this}};var lt={webglRender:function(t,e,i,s,r,n,a,o){var h=this._width,l=this._height,d=h*this.originX,c=l*this.originY,u=this.x-s,p=this.y-r,g=1,v=1;this.flipX&&(u+=h-2*d,g=-1),this.flipY&&(p+=l-2*c,v=-1),at.applyITRS(u,p,this.rotation,this.scaleX*g,this.scaleY*v),e.multiply(at,at);var f=-d,m=-c,y=f+h,b=m+l,x=at.setQuad(f,m,y,b,o),C=this.frame.u0,k=this.frame.v0,w=this.frame.u1,S=this.frame.v1,P=nt(this.tint,this.alpha*i);t.batchQuad(this.parent,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],C,k,w,S,P,P,P,P,this.tintFill,n,a)},canvasRender:function(t,e,i,s){t.save();var r=this._width,n=this._height,a=r*this.originX,o=n*this.originY,h=this.x-a,l=this.y-o,d=1,c=1;this.flipX&&(h+=r,d=-1),this.flipY&&(l+=n,c=-1),s&&(h=Math.round(h),l=Math.round(l)),t.translate(h,l),t.rotate(this.rotation),t.scale(this.scaleX*d,this.scaleY*c);var u=this.frame;t.drawImage(u.source.image,u.cutX,u.cutY,r,n,0,0,r,n),t.restore()}};Object.assign(ht.prototype,lt);var dt=function(t,e){"string"==typeof e&&(e={frame:e});var i=t.poolManager?t.poolManager.allocate(K):null;return null===i?i=new ht(t):i.setParent(t).setActive(),i.modifyPorperties(e),t.addChild(i),i},ct={_drawImage:function(t,e,i,s,r,n){dt(this,{frame:e,x:i,y:s,width:r,height:n})},_drawTileSprite:function(t,e,i,s,r,n){var a=this.texture.get(e),o=a.width,h=a.height,l=Math.floor(r/o),d=Math.floor(n/h);i+=(r-l*o)/2,s+=(n-d*h)/2;for(var c=0;c>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},bt=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 xt=Phaser.Renderer.Canvas.SetTransform;var Ct={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=mt(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&>(r,a,e,l,o,h),e.isStroked&&ft(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(xt(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(wt.prototype,Ct);const St=Phaser.Utils.Objects.GetValue;let Pt=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=St(t,"x",0),i=St(t,"y",0));var s=this.cornerRadius;s.tl=Tt(St(t,"tl",void 0),e,i),s.tr=Tt(St(t,"tr",void 0),e,i),s.bl=Tt(St(t,"bl",void 0),e,i),s.br=Tt(St(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ot(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ot(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ot(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ot(this.cornerRadius.br,t)}};var Tt=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Mt(t),t},Ot=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=St(e,"x",0),t.y=St(e,"y",0)),Mt(t)},Mt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Et=function(t){return t.x>0&&t.y>0},_t=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 Rt=Phaser.Math.DegToRad;var Lt=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n=p?1:s/p,f=r>=g?1:r/g,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,h,l,h,l,180,270,!1,a):ee(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,s-h,l,h,l,270,360,!1,a):ee(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,s-h,r-l,h,l,0,90,!1,a):ee(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,h,r-l,h,l,90,180,!1,a):ee(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()},Qt=function(t){return!t.hasOwnProperty("convex")||t.convex},te=function(t){return t.x>0&&t.y>0},ee=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())}(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}},se=function(){ie(this,this.fillStyle,this.strokeStyle,this.lineWidth,this.radius,this.fillColor2,this.isHorizontalGradient,this.iteration)};const re=Phaser.Utils.Objects.GetValue;let ne=class extends Nt{constructor(t,e,i,s,r,n,a,o,h,l,d,c){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=1),super(t,e,i,s,r,c),this.type="rexRoundRectangleCanvas";var u=re(n,"radius",n),p=re(n,"iteration",void 0);this.setRadius(u),this.setIteration(p),this.setFillStyle(a,l,d),this.setStrokeStyle(o,h)}get radius(){return this._radius}set radius(t){this.dirty|=this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this}get iteration(){return this._iteration}set iteration(t){this.dirty|=this._iteration!=t,this._iteration=t}setIteration(t){return this.iteration=t,this}get fillStyle(){return this._fillStyle}set fillStyle(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._fillStyle!=t,this._fillStyle=t}get fillColor2(){return this._fillColor2}set fillColor2(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._fillColor2!=t,this._fillColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setFillStyle(t,e,i){return void 0===i&&(i=!0),this.fillStyle=t,this.fillColor2=e,this.isHorizontalGradient=i,this}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._strokeStyle!=t,this._strokeStyle=t}get lineWidth(){return this._lineWidth}set lineWidth(t){this.dirty|=this._lineWidth!=t,this._lineWidth=t}setStrokeStyle(t,e){return this.strokeStyle=t,this.lineWidth=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),se.call(this)}),this),this}};t.register("roundRectangleCanvas",(function(t,e,i,s,r,n,a,o,h,l){var d=new ne(this.scene,t,e,i,s,r,n,a,o,h,l);return this.scene.add.existing(d),d})),P(window,"RexPlugins.UI.RoundRectangleCanvas",ne);var ae=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},oe=function(t,e,i){e&&!ae(t,`${e}X`)&&(Object.defineProperty(t,`${e}X`,{get:function(){return i.x},set:function(e){i.x=e,t.dirty=!0}}),Object.defineProperty(t,`${e}Y`,{get:function(){return i.y},set:function(e){i.y=e,t.dirty=!0}}),Object.defineProperty(t,`${e}T`,{get:function(){return i.t},set:function(e){i.t=e,t.dirty=!0}}))},he={setTLPosition(t,e){return this.geom.setTLPosition(t,e),this.dirty=!0,this},setTRPosition(t,e){return this.geom.setTRPosition(t,e),this.dirty=!0,this},setBLPosition(t,e){return this.geom.setBLPosition(t,e),this.dirty=!0,this},setBRPosition(t,e){return this.geom.setBRPosition(t,e),this.dirty=!0,this},resetCornerPosition(){return this.geom.resetCornerPosition(),this.dirty=!0,this},insertTopSidePoint(t,e,i,s){var r=this.geom.topSidePoints;if(Array.isArray(t))for(var n,a=0,o=(r=t).length;a=0;f--)y=g[f],b=pe(d,h,y.t)+y.x,x=pe(c,l,y.t)+y.y,_t(b,x,e);for(_t(d,c,e),fe(v),f=v.length-1;f>=0;f--)y=v[f],b=pe(r,d,y.t)+y.x,x=pe(n,c,y.t)+y.y,_t(b,x,e);return e.push(e[0],e[1]),this.pathIndexes=ge(e),this}get tlx(){return this.geom.tlx}set tlx(t){this.geom.tlx=t,this.dirty=!0}get tly(){return this.geom.tly}set tly(t){this.geom.tly=t,this.dirty=!0}get trx(){return this.geom.trx}set trx(t){this.geom.trx=t,this.dirty=!0}get try(){return this.geom.try}set try(t){this.geom.try=t,this.dirty=!0}get blx(){return this.geom.blx}set blx(t){this.geom.blx=t,this.dirty=!0}get bly(){return this.geom.bly}set bly(t){this.geom.bly=t,this.dirty=!0}get brx(){return this.geom.brx}set brx(t){this.geom.brx=t,this.dirty=!0}get bry(){return this.geom.bry}set bry(t){this.geom.bry=t,this.dirty=!0}get leftSidePoints(){return this.geom.leftSidePoints}get topSidePoints(){return this.geom.topSidePoints}get bottomSidePoints(){return this.geom.bottomSidePoints}get rightSidePoints(){return this.geom.rightSidePoints}}var fe=function(t){t.length<=1||t.sort((function(t,e){return t.t-e.t}))};Object.assign(ve.prototype,he),t.register("QuadShape",(function(t,e,i,s,r,n){var a=new ve(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.QuadShape",ve);var me=Phaser.Renderer.WebGL.Utils,ye={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=me.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.style.resolution,a/e.style.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){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const be=Phaser.Display.Canvas.CanvasPool;F();const xe=Phaser.GameObjects.GameObject;class Ce extends xe{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=be.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),a=Math.ceil(n.width*t.baselineX),o=a,h=2*o;if(o=o*t.baselineY|0,s.width=a,s.height=h,r.fillStyle="#f00",r.fillRect(0,0,a,h),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,o),i.left=0,0===a||0===h||!r.getImageData(0,0,a,h))return be.remove(s),i;for(var l=r.getImageData(0,0,a,h).data,d=!1,c=0;c * @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,Wn=Phaser.GameObjects.Container;var Vn=function(t,e){if(void 0===e?e=new Fn:!0===e&&(void 0===Gn&&(Gn=new Fn),e=Gn),t.getBounds&&!(t instanceof Wn))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();Hn(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Un(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Nn(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,$n(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Hn(t,e),i=e.x,s=e.y,Un(t,e),r=e.x,n=e.y,Nn(t,e),a=e.x,o=e.y,$n(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},Gn=void 0,Hn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-An(t)*t.originX,e.y=t.y-zn(t)*t.originY,qn(t,e,i))},Un=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn),t.getTopRight?t.getTopRight(e):(e.x=t.x-An(t)*t.originX+An(t),e.y=t.y-zn(t)*t.originY,qn(t,e,i))},Nn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-An(t)*t.originX,e.y=t.y-zn(t)*t.originY+zn(t),qn(t,e,i))},$n=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn),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),qn(t,e,i))},Kn=function(t,e,i){void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn);var s=An(t),r=zn(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),qn(t,e,i)},Jn=void 0,qn=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 Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Zn(i,"color"),r=Zn(i,"lineWidth"),n=Zn(i,"fillColor"),a=Zn(i,"fillAlpha",1),o=Zn(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Ga:Va,this.repeatCounter=0,this}stop(){return this.state=Wa,this}update(t,e){this.state!==Wa&&this.state!==Ua&&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=Ha)):(this.nowTime=this.duration,this.state=Ua):this.nowTime>=0&&(this.state=Ga))}get t(){var t;switch(this.state){case Wa:case Va:case Ha:t=0;break;case Ga:t=this.nowTime/this.duration;break;case Ua:t=1}return Ya(t,0,1)}set t(t){(t=Ya(t,-1,1))<0?(this.state=Va,this.nowTime=-this.delay*t):(this.state=Ga,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Wa}get isDelay(){return this.state===Va}get isCountDown(){return this.state===Ga}get isRunning(){return this.state===Va||this.state===Ga}get isDone(){return this.state===Ua}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Wa=0,Va=1,Ga=2,Ha=3,Ua=-1;class Na extends Aa{constructor(t,e){super(t,e),this.timer=new Xa}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 $a=Phaser.Utils.Objects.GetValue,Ka=Phaser.Utils.Objects.GetAdvancedValue,Ja=Phaser.Tweens.Builders.GetEaseFunction;class qa extends Na{resetFromJSON(t){return this.timer.resetFromJSON($a(t,"timer")),this.setEnable($a(t,"enable",!0)),this.setTarget($a(t,"target",this.parent)),this.setDelay(Ka(t,"delay",0)),this.setDuration(Ka(t,"duration",1e3)),this.setEase($a(t,"ease","Linear")),this.setRepeat($a(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=Ja(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 Za=Phaser.Sound.BaseSound;var Qa=function(t){return t instanceof Za};const to=Phaser.Utils.Objects.GetValue,eo=Phaser.Utils.Objects.GetAdvancedValue,io=Phaser.Math.Linear;let so=class extends qa{constructor(t,e,i){Qa(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(to(t,"mode",0)),this.setEnable(to(t,"enable",!0)),this.setVolumeRange(eo(t,"volume.start",this.parent.volume),eo(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=ro[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=io(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 ro={stop:1,destroy:2};var no=function(t,e,i,s,r){Qa(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 so(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ao=function(t,e,i,s){Qa(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 so(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const oo=Phaser.Utils.Objects.GetValue;var ho={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:oo(e,"loop",this.backgroundMusicLoop),mute:oo(e,"mute",this.backgroundMusicMute),volume:oo(e,"volume",this.backgroundMusicVolume),detune:oo(e,"detune",0),rate:oo(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&&no(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ao(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 lo=Phaser.Utils.Objects.GetValue;var co={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:lo(e,"loop",this.backgroundMusicLoop),mute:lo(e,"mute",this.backgroundMusic2Mute),volume:lo(e,"volume",this.backgroundMusic2Volume),detune:lo(e,"detune",0),rate:lo(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&&no(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ao(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 uo=Phaser.Utils.Array.Remove,po=Phaser.Utils.Objects.GetValue;var go={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:po(e,"mute",this.soundEffectsMute),volume:po(e,"volume",this.soundEffectsVolume),detune:po(e,"detune",0),rate:po(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&uo(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&uo(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&&no(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ao(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ao(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&&no(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ao(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ao(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=Zo:t||(t=th),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=ih),this.tagExpression=t,this}setValueExpression(t){return t||(t=ih),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!==ih||this.valueExpression!==ih){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=Zo),void 0===i&&(i=",");for(var s=t.split(i),r=0,n=s.length;r0){var n=this.timeline.addTimer({name:ol,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,hl.call(t,i.remainder)}});break}}else cr(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},ll=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}},dl=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},cl=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 ul=Phaser.Input.Keyboard.KeyCodes;var pl=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)},Ml=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},El=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},_l=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const Rl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Tl(a,s)&&(n=a[1],xr.call(t,`${s}.play`,Ol,[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`,Ml,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Tl(n,s)&&(r=n[1],xr.call(t,`${s}.stop`,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(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(n,s)&&(r=n[1],xr.call(t,`${s}.pause`,El,[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`,_l,[s,r,a],t),e.skipEvent()}}}))}];var Ll=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=Rl,t.createGameObject=kl(t.createGameObject),this.addGameObjectManager(t,Pl)},Bl=function(t,e){return 2===t.length&&t[0]===e},Il=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},Dl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},jl=function(t){this.getGameObjectManager(t).removeAll()},Al=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])}},zl={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},Fl=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 Yl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Bl(a,s)&&(n=a[1],xr.call(t,`${s}.add`,Il,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Bl(n,s)&&(r=n[1],xr.call(t,`${s}.remove`,Dl,[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`,jl,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`,Al,[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&&zl[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`,Fl,[s,h,l,r,n,a,o,d],t),e.skipEvent())}}))}],Xl=Vo.addGameObjectManager;var Wl={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},Xl.call(this,t,e);for(var n=t.parseCallbacks,a=0,o=(n=n?[...n,...Yl]:Yl).length;a0)return ad.length=0,!0;return ad.length=0,!1},ad=[],od=void 0;const hd=Phaser.Utils.Objects.GetValue;var ld=function(t,e,i){var s,r;for(var n in void 0===i&&(i={}),t)s=t[n],void 0!==(r=hd(e,n,s[1]))&&(i[s[0]]=r);return i},dd=function(t){t.addEventListener("touchstart",cd,!1),t.addEventListener("touchmove",cd,!1),t.addEventListener("touchend",cd,!1),t.addEventListener("mousedown",cd,!1),t.addEventListener("mouseup",cd,!1),t.addEventListener("mousemove",cd,!1)},cd=function(t){t.stopPropagation()},ud=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this},pd=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",ud,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.clickOutSideTarget?(Ca.call(this.clickOutSideTarget,this.parent),xa.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)},gd=function(){this.isOpened=!1,this.updateText(),this.enterCloseEnable&&this.scene.input.keyboard.off("keydown-ENTER",ud,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 vd=Phaser.Utils.Objects.GetValue;var fd=function(t,e){var i,s=vd(e,"inputType",void 0);void 0===s&&(s=vd(e,"type","text")),"textarea"===s?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=s;var r=vd(e,"style",void 0),n=i.style;ld(id,r,n),n.position="absolute",n.opacity=0,n.pointerEvents="none",n.zIndex=0,n.transform="scale(0)",ld(ed,e,i),dd(i);var a=t.scene.sys.scale;return(a.isFullscreen?a.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){pd.call(t)})),i.addEventListener("blur",(function(e){gd.call(t)})),i},md={open:function(){return this.isOpened||this.readOnly||((t=this)!==od&&(void 0!==od&&od.close(),od=t),this.node||(this.node=fd(this,this.nodeConfig)),this.setFocus()),this;var t},close:function(){return this.isOpened?(this===od&&(od=void 0),this.setBlur(),this):this}};const yd=Phaser.Utils.Objects.GetValue;class bd extends La{constructor(t,e){super(t);var i=yd(e,"inputType",void 0);void 0===i&&(i=yd(e,"type","text")),this.setEnterCloseEnable(yd(e,"enterClose","textarea"!==i));var s=yd(e,"onOpen",void 0);s||(s=yd(e,"onFocus",void 0)),this.onOpenCallback=s,this.clickOutSideTarget=yd(e,"clickOutSideTarget",void 0);var r=yd(e,"onClose",void 0);r||(r=yd(e,"onBlur",void 0)),this.onCloseCallback=r,this.onUpdateCallback=yd(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 sd(t,e,"inputType"),sd(t,e,"type"),sd(t,e,"style"),sd(t,e,id),sd(t,e,ed),e}(e),this.node=void 0}destroy(){this.close(),this.clickOutSideTarget&&this.clickOutSideTarget.destroy(),super.destroy()}onClickOutside(t){rd(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(bd.prototype,md);var xd=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},Cd=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)):(Cd(this),kd(this)),this}setNumberInput(){return this.onUpdateCallback=xd,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}};const Pd=Phaser.Utils.Objects.GetValue,Td=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Od=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 _d=Phaser.GameObjects.Zone;let Rd=class extends _d{constructor(t){super(t,0,0,2,2),this.fullWindow=new Ed(this)}};var Ld=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},Bd=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)},Id=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}zd.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(Fd(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 Yd=new zd,Xd=/^[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,Wd=/\S/,Vd=new zd;Vd.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Wd.test(t)&&!Wd.test(e)},Vd.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(Nd(t,null,null,i),i," ")},Ud.equals=function(t,e){return zd.prototype.equals.call(Ud,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const $d=new zd;$d.tokenize=function(t){return t.slice()},$d.join=$d.removeEmpty=function(t){return t};const Kd=Phaser.Utils.Array.Remove;var Jd=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Kd(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Yd.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},ec={cursorMoveLeft(){if(!this.isOpened)return this;var t=Zd(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Zd(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Qd(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Zd(tc(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Qd(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Zd(tc(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const ic=Phaser.Utils.Objects.IsPlainObject;class sc extends hn{constructor(t,e,i,s,r,n){ic(e)?n=e:ic(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Od(e,"wrap.vAlign")||P(e,"wrap.vAlign",s=i?"center":"top"),Od(e,"wrap.wrapMode")||P(e,"wrap.wrapMode","char"),Od(e,"wrap.maxLines")||P(e,"wrap.maxLines",s=i?1:void 0),i&&P(e,"wrap.wrapWidth",1/0),Od(e,"wrap.useDefaultTextHeight")||P(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Od(e.edit,"inputType")){var s=i?"text":"textarea";P(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Rd(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=Ld(n.background,"focus"),h=Ld(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=Pd(e,"edit");return void 0===i&&(i={}),sd(e,i,Td),new Sd(t,i)}(this,n),Bd.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),Ad.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),jd.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=Kc(t,"tl",0),this.radiusTR=Kc(t,"tr",0),this.radiusBL=Kc(t,"bl",0),this.radiusBR=Kc(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]),_c(this.x,this.y,t),super.updateData(),this}}const qc=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var Zc={buildShapes(){this.addShape((new Jc).setName("box")).addShape((new Nc).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 Qc=Phaser.Utils.Objects.GetValue,tu=Phaser.Math.Linear;class eu extends qa{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=Qc(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Qc(t,"from",i),this.toValue=Qc(t,"to",i),this.setEase(Qc(t,"ease",this.ease)),this.setDuration(Qc(t,"duration",this.duration)),this.setRepeat(Qc(t,"repeat",0)),this.setDelay(Qc(t,"delay",0)),this.setRepeatDelay(Qc(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]=tu(this.fromValue,this.toValue,i)}}var iu={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new eu(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}},su={};Object.assign(su,vc,fc,Zc,iu);const ru=23730,nu=Phaser.Utils.Objects.GetValue,au=Phaser.Utils.Objects.IsPlainObject;class ou extends gc{constructor(t,e,i,s,r,n,a){au(e)?(e=nu(a=e,"x",0),i=nu(a,"y",0),s=nu(a,"width",2),r=nu(a,"height",2),n=nu(a,"color",ru)):au(n)&&(n=nu(a=n,"color",ru)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=ru),this.setBoxShape(nu(a,"circleBox",!1)),this.setBoxFillStyle(n,nu(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(nu(a,"uncheckedColor",null),nu(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(nu(a,"boxLineWidth",4),nu(a,"boxStrokeColor",n),nu(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,nu(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),nu(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(nu(a,"checkerColor",16777215),nu(a,"checkerAlpha",1)),this.setBoxSize(nu(a,"boxSize",1)),this.setCheckerSize(nu(a,"checkerSize",1)),this.setCheckerAnimationDuration(nu(a,"animationDuration",150)),this.buildShapes();var o=nu(a,"checked");void 0===o&&(o=nu(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(ou.prototype,su);const hu=Phaser.Utils.Objects.GetValue;class lu extends La{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(hu(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(hu(t,"enable",!0)),this.setMode(hu(t,"mode",1)),this.setClickInterval(hu(t,"clickInterval",100)),this.setDragThreshold(hu(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=du[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 du={press:0,pointerdown:0,release:1,pointerup:1},cu=Phaser.Utils.Objects.GetValue,uu=Phaser.Utils.Objects.IsPlainObject;class pu extends ou{constructor(t,e,i,s,r,n,a){uu(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",ru)):uu(n)&&(n=cu(a=n,"color",ru)),super(t,e,i,s,r,n,a),this._click=new lu(this,cu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(cu(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 pu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Checkbox",pu);var gu={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}},vu={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}},fu={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}},mu=function(t,e,i){return(e-t)*i+t};const yu=Phaser.Math.Linear;var bu={buildShapes(){this.addShape((new Jc).setName("track")).addShape((new Jc).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&mu(mn(l),mn(d),c))<<16|(255&mu(yn(l),yn(d),c))<<8|255&mu(bn(l),bn(d),c)),p=yu(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=yu(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)}},xu={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new eu(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}},Cu={};Object.assign(Cu,gu,vu,fu,bu,xu);const ku=Phaser.Utils.Objects.GetValue,wu=Phaser.Utils.Objects.IsPlainObject,Su=23730;class Pu extends gc{constructor(t,e,i,s,r,n,a){wu(e)?(e=ku(a=e,"x",0),i=ku(a,"y",0),s=ku(a,"width",2),r=ku(a,"height",2),n=ku(a,"color",Su)):wu(n)&&(n=ku(a=n,"color",Su)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=Su),this.setTrackFillStyle(n,ku(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(ku(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)),ku(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(ku(a,"thumbColor",16777215),ku(a,"thumbAlpha",1)),this.setTrackSize(ku(a,"trackWidth",.9),ku(a,"trackHeight",.5)),this.setTrackRadius(ku(a,"trackRadius",.5*this.trackHeight));var o=ku(a,"thumbHeight",void 0),h=ku(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(ku(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(ku(a,"thumbLeft",.3),ku(a,"thumbRight",void 0)),this.setRTL(ku(a,"rtl",!1)),this.setToggleAnimationDuration(ku(a,"animationDuration",150)),this.buildShapes(),this.setValue(ku(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(Pu.prototype,Cu);const Tu=Phaser.Utils.Objects.GetValue;class Ou extends Pu{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new lu(this,Tu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Tu(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 Ou(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.ToggleSwitch",Ou);var Mu={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 Eu extends Nt{}Object.assign(Eu.prototype,Mu),t.register("canvas",(function(t,e,i,s){var r=new Eu(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.Canvas",Eu);const _u=Phaser.Utils.Objects.GetValue;class Ru 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=_u(i,"maskType",0),r=_u(i,"backgroundColor",void 0),n=_u(i,"strokeColor",void 0),a=_u(i,"strokeWidth",null!=n?10:0);if(void 0===s?s=0:"string"==typeof s&&(s=Lu[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=_u(i,"radius",0),f=_u(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 Lu={circle:0,ellipse:1,roundRectangle:2};t.register("circleMaskImage",(function(t,e,i,s,r){var n=new Ru(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.CircleMaskImage",Ru);const Bu=Phaser.Utils.Objects.GetValue;class Iu 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=Bu(i,"mask.key"),r=Bu(i,"mask.frame"),n=Bu(i,"mask.invertAlpha",!1),a=Bu(i,"mask.scale"),o=Bu(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 Iu(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.AlphaMaskImage",Iu);const Du=Phaser.Math.Linear,ju=Phaser.Math.Percent;var Au={setValue(t,e,i){return null==t||(void 0!==e&&(t=ju(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=ju(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=Du(t,e,i)),i}};const zu=Phaser.Math.Percent;var Fu={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=zu(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new eu(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 eu(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 Yu=Phaser.Utils.Objects.GetValue,Xu=Phaser.Math.Clamp;function Wu(t){class e extends t{bootProgressBase(t){this.eventEmitter=Yu(t,"eventEmitter",this);var e=Yu(t,"valuechangeCallback",null);if(null!==e){var i=Yu(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Yu(t,"easeValue.duration",0)).setEaseValueFunction(Yu(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Xu(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,Au,Fu),e}const Vu=Phaser.Math.RadToDeg,Gu=Phaser.Math.DegToRad;var Hu=function(t,e,i,s,r,n,a,o){var h=360===Math.abs(a-n),l=Gu(n),d=Gu(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},Uu={buildShapes(){var t=this.iterations;this.addShape((new Nc).setIterations(t).setName("track")).addShape((new Nc).setIterations(t).setName("bar")).addShape((new wc).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),Hu(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=Vu(this.startAngle),o=360*(n?1-this.value:this.value)+a),h.fillStyle(this.barColor),Hu(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 Nu=Phaser.Utils.Objects.GetValue,$u=Phaser.Utils.Objects.IsPlainObject,Ku=Phaser.Math.Clamp,Ju=Phaser.Math.DegToRad(270);let qu=class extends(Wu(gc)){constructor(t,e,i,s,r,n,a){$u(e)&&(e=Nu(a=e,"x",0),i=Nu(a,"y",0),s=Nu(a,"radius",1),r=Nu(a,"barColor",void 0),n=Nu(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(Nu(a,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor(Nu(a,"centerColor",void 0)),this.setThickness(Nu(a,"thickness",.2)),this.setStartAngle(Nu(a,"startAngle",Ju)),this.setAnticlockwise(Nu(a,"anticlockwise",!1)),this.iterations=Nu(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=Ku(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(qu.prototype,Uu),t.register("circularProgress",(function(t,e,i,s,r,n){var a=new qu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgress",qu);var Zu=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 Qu=Phaser.Math.PI2;var tp=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(),Zu(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+Qu)%Qu:(o+l*this.value)%Qu,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;Zu(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(),Zu(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 ep=Phaser.Utils.Objects.GetValue,ip=Phaser.Utils.Objects.IsPlainObject,sp=Phaser.Math.Clamp,rp=Phaser.Math.DegToRad(270),np=Phaser.Math.PI2;class ap extends(Wu(Nt)){constructor(t,e,i,s,r,n,a){ip(e)&&(e=ep(a=e,"x",0),i=ep(a,"y",0),s=ep(a,"radius",1),r=ep(a,"barColor",void 0),n=ep(a,"value",0));var o=2*s;super(t,e,i,o,o,ep(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(ep(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(ep(a,"barColor2",void 0)),this.setCenterColor(ep(a,"centerColor",void 0)),this.setThickness(ep(a,"thickness",.2)),this.setStartAngle(ep(a,"startAngle",rp)),this.setEndAngle(ep(a,"endAngle",this.startAngle+np)),this.setAnticlockwise(ep(a,"anticlockwise",!1)),this.setTextColor(ep(a,"textColor",void 0)),this.setTextStrokeColor(ep(a,"textStrokeColor",void 0),ep(a,"textStrokeThickness",void 0));var h=ep(a,"textFont",void 0);h?this.setTextFont(h):this.setTextFont(ep(a,"textSize","16px"),ep(a,"textFamily","Courier"),ep(a,"textStyle","")),this.setTextFormatCallback(ep(a,"textFormatCallback",void 0),ep(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=op(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=op(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=op(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=sp(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(),tp.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 op=function(t,e,i){return i?t<=e?np+t-e:t-e:t>=e?np+e-t:e-t};t.register("circularProgressCanvas",(function(t,e,i,s,r,n){var a=new ap(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgressCanvas",ap);var hp=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 lp=Phaser.Utils.Objects.GetValue,dp=Phaser.Utils.Objects.IsPlainObject;let cp=class extends(Wu(gc)){constructor(t,e,i,s,r,n,a,o){dp(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):dp(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):dp(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 Nc).setName("trackFill")).addShape((new Nc).setName("bar")).addShape((new Nc).setName("trackStroke")),this.setTrackColor(lp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(lp(o,"trackStrokeThickness",2),lp(o,"trackStrokeColor",void 0)),this.setSkewX(lp(o,"skewX",0)),this.setRTL(lp(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 up={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&&hp(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),hp(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&hp(o,0,0,e,i,t)}};Object.assign(cp.prototype,up),t.register("lineProgress",(function(t,e,i,s,r,n,a){var o=new cp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgress",cp);var pp=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},gp=Phaser.Math.RadToDeg,vp=function(t,e,i,s,r){var n=e*r,a=s.tl;if(Et(a)){l=n>a.x?90:gp(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-gp(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-gp(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:gp(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)},fp=Phaser.Math.RadToDeg,mp=function(t,e,i,s,r){var n=i*r,a=s.tl;if(Et(a)){l=n>a.y?90:fp(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:fp(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-fp(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-fp(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)},yp=Phaser.Math.RadToDeg,bp=function(t,e,i,s,r){var n=e*r,a=s.tr;if(Et(a)){l=n>a.x?90:yp(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:yp(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-yp(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-yp(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)},xp=Phaser.Math.RadToDeg,Cp=function(t,e,i,s,r){var n=i*r,a=s.br;if(Et(a)){l=n>a.y?90:xp(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:xp(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-xp(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-xp(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)},kp={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},wp=function(t){return"string"==typeof t&&(t=kp[t]),t};const Sp=Phaser.Utils.Objects.GetValue,Pp=Phaser.Utils.Objects.IsPlainObject;class Tp extends(Wu(gc)){constructor(t,e,i,s,r,n,a,o,h){Pp(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Pp(s)?(s=(h=s).width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Pp(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 Nc).setName("trackFill")).addShape((new Nc).setName("bar")).addShape((new Nc).setName("trackStroke")),this.setTrackColor(Sp(h,"trackColor",void 0)),this.setBarColor(a),this.setTrackStroke(Sp(h,"trackStrokeThickness",2),Sp(h,"trackStrokeColor",void 0)),this.setOrientation(Sp(h,"orientation",0)),this.setRTL(Sp(h,"rtl",!1)),this.rrGeom=new Pt,this.setRadius(n),this.setIteration(Sp(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=wp(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 Op={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&&pp(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?pp(t,e,i,s,o):((0===n?a?bp:vp:a?Cp:mp)(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&&pp(l,t,e,i,a)}};Object.assign(Tp.prototype,Op),t.register("roundRectanleProgress",(function(t,e,i,s,r,n,a,o){var h=new Tp(this.scene,t,e,i,s,r,n,a,o);return this.scene.add.existing(h),h})),P(window,"RexPlugins.UI.RoundRectangleProgress",Tp);var Mp=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(),Mp(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},_p=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 Rp=Phaser.Utils.Objects.GetValue,Lp=Phaser.Utils.Objects.IsPlainObject;class Bp extends(Wu(Nt)){constructor(t,e,i,s,r,n,a,o){Lp(e)?(e=Rp(o=e,"x",0),i=Rp(o,"y",0),s=Rp(o,"width",2),r=Rp(o,"height",2),n=Rp(o,"barColor",void 0),a=Rp(o,"value",0)):Lp(s)?(s=Rp(o=s,"width",2),r=Rp(o,"height",2),n=Rp(o,"barColor",void 0),a=Rp(o,"value",0)):Lp(n)&&(n=Rp(o=n,"barColor",void 0),a=Rp(o,"value",0)),super(t,e,i,s,r,Rp(o,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(o),this.setTrackColor(Rp(o,"trackColor",void 0)),this.setBarColor(n,Rp(o,"barColor2",void 0),Rp(o,"isHorizontalGradient",void 0)),this.setTrackStroke(Rp(o,"trackStrokeThickness",2),Rp(o,"trackStrokeColor",void 0)),this.setSkewX(Rp(o,"skewX",0)),this.setRTL(Rp(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(),Ep.call(this)}),this),this}}t.register("circularProgressCanvas",(function(t,e,i,s,r,n,a){var o=new Bp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgressCanvas",Bp),Phaser.Math.Wrap;const Ip=Phaser.Math.Linear;var Dp=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=Ip(b.a.x,x.a.x,C),e=Ip(b.a.y,x.a.y,C),i=Ip(b.b.x,x.b.x,C),s=Ip(b.b.y,x.b.y,C),r=Ip(b.c.x,x.c.x,C),n=Ip(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const jp=(0,Phaser.Math.DegToRad)(120);var Ap=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+jp),i+s*Math.sin(r+jp)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-jp),i+s*Math.sin(r-jp)),this.arrowOnly?t.end():t.close()},zp={buildShapes(){this.addShape((new Nc).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?Dp.call(this):Ap.call(this)}},Fp={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new eu(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 Yp=Phaser.Utils.Objects.GetValue,Xp=Phaser.Utils.Objects.IsPlainObject,Wp=Phaser.Math.DegToRad,Vp=Phaser.Math.RadToDeg;class Gp extends gc{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Xp(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=Up(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=Yp(r,"x",null);null!==n?(t=n,i=n):(t=Yp(r,"left",0),i=Yp(r,"right",t));var a=Yp(r,"y",null);null!==a?(e=a,s=a):(e=Yp(r,"top",0),s=Yp(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 Vp(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Wp(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Hp={right:0,down:1,left:2,up:3};var Up=function(t){return"string"==typeof t&&(t=Hp[t]),t%=4};Object.assign(Gp.prototype,zp,Fp),t.register("triangle",(function(t,e,i,s,r,n){var a=new Gp(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Triangle",Gp),F();const Np=Phaser.GameObjects.Zone,$p=Phaser.Utils.Array.Add,Kp=Phaser.Utils.Array.Remove;let Jp=class extends Np{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 $p(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return Kp(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;iig(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eig(t).x,getChildLocalY:t=>ig(t).y};const yg=Phaser.Math.DegToRad;var bg={updateChildRotation(t){var e=ig(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=ig(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 ig(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return ig(t).rotation=yg(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=ig(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>ig(t).rotation},xg={updateChildScale(t){var e=ig(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=ig(t),i=e.parent;return e.scaleX=fg(t.scaleX,i.scaleX),e.scaleY=fg(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=ig(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=ig(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>ig(t).scaleX,getChildLocalScaleY:t=>ig(t).scaleY},Cg={updateChildVisible(t){var e=ig(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=ig(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),ig(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),ig(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=ig(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>ig(t).visible},kg={updateChildAlpha(t){var e=ig(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=ig(t),i=e.parent;return e.alpha=fg(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return ig(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=ig(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>ig(t).alpha},wg={updateChildActive(t){var e=ig(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 ig(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),ig(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=ig(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>ig(t).active},Sg={updateChildScrollFactor(t){var e=ig(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}},Pg={updateCameraFilter(t){var e=ig(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Tg={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}},Og=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},Mg={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}},Eg=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 Rg=Phaser.Utils.Array;var Lg={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Hv=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 Uv=/(\S+)\[(\d+)\]/i;var Nv={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}},$v=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}},Kv=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},Jv=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},qv=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}},Zv=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},Qv=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},tf={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}},ef=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 gm={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=_a(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}},vm={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}},fm={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}},mm={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}},ym={};Object.assign(ym,gm,vm,fm,mm);const bm=Phaser.Utils.Objects.GetValue;class xm extends La{constructor(t,e){super(t,e),this.setTransitInTime(bm(e,"duration.in",200)),this.setTransitOutTime(bm(e,"duration.out",200)),this.setTransitInCallback(bm(e,"transitIn")),this.setTransitOutCallback(bm(e,"transitOut")),this.oneShotMode=bm(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new pm(this,{eventEmitter:!1,initState:bm(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(xm.prototype,ym);const Cm=Phaser.GameObjects.Rectangle;class km extends Cm{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ed(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const wm=Phaser.Utils.Objects.GetValue;class Sm extends La{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(wm(t,"hitAreaMode",0)),this.setEnable(wm(t,"enable",!0)),this.setStopMode(wm(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=Pm[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 Pm={default:0,fullWindow:1};const Tm=Phaser.Utils.Objects.GetValue;class Om extends km{constructor(t,e){super(t,Tm(e,"color",0),Tm(e,"alpha",.8)),this.touchEventStop=new Sm(this,{hitAreaMode:1})}}var Mm={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,mf(t,e)},scaleDown(t,e){yf(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Mf(t,e)},fadeOut(t,e){Ef(t,e,!1)}},Em=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Mf(t,e,t.alpha)},_m=function(t,e){Ef(t,e,!1)},Rm=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Vn(t,!0).contains(e,i)||r&&!r(t,e,i))};const Lm=Phaser.Utils.Objects.GetValue;let Bm=class extends xm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Im.popUp),null==e.transitOut&&(e.transitOut=Im.scaleDown),e.destroy=Lm(e,"destroy",!0),super(t,e);var i=Lm(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Om(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(Lm(i,"transitIn",Em)),this.setCoverTransitOutCallback(Lm(i,"transitOut",_m)));var s=Lm(e,"touchOutsideClose",!1),r=Lm(e,"duration.hold",-1),n=Lm(e,"timeOutClose",r>=0),a=Lm(e,"anyTouchClose",!1);Lm(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),Lm(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&&Rm(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=Im[t]),t){case Im.popUp:t=Mm.popUp;break;case Im.fadeIn:t=Mm.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Im[t]),t){case Im.scaleDown:t=Mm.scaleDown;break;case Im.fadeOut:t=Mm.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Im={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Dm=function(t,e){var i=new Bm(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},jm=function(t,e){t.emit("modal.requestClose",e)},Am=function(t){return t&&"function"==typeof t},zm={modal(t,e){return Am(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=Dm(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 jm(this,t),this}},Fm=function(t,e,i,s,r){Am(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Ym={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 Fm.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Fm.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Fm.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Fm.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Fm.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Fm.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Fm.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Fm.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Fm.call(this,"shutdown",t,e,i,s),this}},Xm=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Wm),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Wm={},Vm=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Rm(t,e.x,e.y,i,s):!!(r=Xm(e,n,!0))&&Rm(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 iy={press:0,pointerdown:0,release:1,pointerup:1};var sy={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 ey(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 ry extends um{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 ny=Phaser.Utils.Objects.GetValue;class ay extends La{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new ry,this.parent.setInteractive(ny(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(ny(t,"enable",!0)),this.setCooldown(ny(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 oy={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Vm(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 ay(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 ay(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}},hy={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}},ly=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=Py,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===Ty&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Py,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=Oy,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Vm(t,s,e,i)}}const Py=0,Ty=1,Oy="IDLE",My=Phaser.Utils.Objects.GetValue,Ey=Phaser.Math.Distance.Between;class _y extends Sy{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=Ry},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(My(t,"time",250)),this.setTapInterval(My(t,"tapInterval",200)),this.setDragThreshold(My(t,"threshold",9)),this.setTapOffset(My(t,"tapOffset",10));var e=My(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(My(t,"maxTaps",void 0)),this.setMinTaps(My(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Ry:this.state=Ly;break;case Ly:var t=this.lastPointer;Ey(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=By,this.state=Ly);break;case By:this.state=Ly}}onDragEnd(){this.state===Ly&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=By))}onDrag(){this.state!==Ry&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Ry)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Ly){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Ry):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=By:this.state=Ry)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===By&&(this.state=Ry)}get isTapped(){return this.state===By}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 Ry="IDLE",Ly="BEGIN",By="RECOGNIZED",Iy=Phaser.Utils.Objects.GetValue;class Dy extends Sy{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=jy},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Iy(t,"threshold",9)),this.setHoldTime(Iy(t,"time",251)),this}onDragStart(){this.state=Ay,0===this.holdTime&&(this.state=zy)}onDragEnd(){this.state=jy}onDrag(){this.state!==jy&&this.pointer.getDistance()>this.dragThreshold&&(this.state=jy)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===Ay&&t-this.pointer.downTime>=this.holdTime&&(this.state=zy)}get isPressed(){return this.state===zy}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const jy="IDLE",Ay="BEGIN",zy="RECOGNIZED",Fy=Phaser.Utils.Objects.GetValue;class Yy extends Sy{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=Xm(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Xy},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Fy(t,"threshold",10)),this}onDragStart(){this.state=Wy,0===this.dragThreshold&&(this.state=Vy)}onDragEnd(){this.state=Xy}onDrag(){switch(this.state){case Wy:if(this.pointer.getDistance()>=this.dragThreshold){this.state=Vy,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 Vy: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=Xm(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===Vy}setDragThreshold(t){return this.dragThreshold=t,this}}const Xy="IDLE",Wy="BEGIN",Vy="RECOGNIZED",Gy=Phaser.Math.Distance.Between,Hy=Phaser.Math.Angle.Between;var Uy={getDt:function(){return nc(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Gy(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 Hy(e.x,e.y,t.x,t.y)}},Ny={"up&down":0,"left&right":1,"4dir":2,"8dir":3},$y={};const Ky=Phaser.Utils.Objects.GetValue,Jy=Phaser.Math.RadToDeg;class qy extends Sy{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=Zy},eventEmitter:!1};this.setRecongizedStateObject(new um(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Ky(t,"threshold",10)),this.setVelocityThreshold(Ky(t,"velocityThreshold",1e3)),this.setDirectionMode(Ky(t,"dir","8dir")),this}onDragStart(){this.state=Qy}onDragEnd(){this.state=Zy}onDrag(){this.state===Qy&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=tb))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tb&&(this.state=Zy)}get isSwiped(){return this.state===tb}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=Ny[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=$y),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}}(Jy(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(qy.prototype,Uy);const Zy="IDLE",Qy="BEGIN",tb="RECOGNIZED",eb=Phaser.Utils.Objects.GetValue,ib=Phaser.Utils.Array.SpliceOne,sb=Phaser.Math.Distance.Between,rb=Phaser.Math.Angle.Between;class nb{constructor(t,e){var i=_a(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(eb(e,"inputConfig",void 0)),this.setEventEmitter(eb(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(eb(t,"enable",!0)),this.bounds=eb(t,"bounds",void 0),this.tracerState=ob,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 ob:this.tracerState=hb,this.onDrag1Start();break;case hb:this.tracerState=lb,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],ib(this.pointers,e),this.tracerState){case hb:this.tracerState=ob,this.onDrag1End();break;case lb:this.tracerState=hb,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 hb:this.onDrag1();break;case lb:this.onDrag2()}}}dragCancel(){return this.tracerState===lb&&this.onDrag2End(),this.pointers.length=0,q(this.movedState),this.tracerState=ob,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!==lb)return 0;var t=this.pointers[0],e=this.pointers[1];return sb(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==lb)return 0;var t=this.pointers[0],e=this.pointers[1];return rb(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;ab.x=e.x-i.x,ab.y=e.y-i.y}else ab.x=0,ab.y=0;return ab}get centerX(){if(this.tracerState!==lb)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==lb)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==lb)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!==lb)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=db,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Vm(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Vm(t,s,e,i)}}Object.assign(nb.prototype,ln);var ab={};const ob=0,hb=1,lb=2,db="IDLE",cb=Phaser.Utils.Objects.GetValue;class ub extends nb{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=pb},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(cb(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=gb,0===this.dragThreshold&&(this.state=vb)}onDrag2End(){this.state=pb}onDrag2(){switch(this.state){case gb: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=vb}break;case vb:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===vb}setDragThreshold(t){return this.dragThreshold=t,this}}const pb="IDLE",gb="BEGIN",vb="RECOGNIZED",fb=Phaser.Math.RotateAround;var mb=function(t,e,i,s){return fb(t,e,i,s),t.rotation+=s,t},yb={};const bb=Phaser.Utils.Objects.GetValue,xb=Phaser.Math.Angle.WrapDegrees,Cb=Phaser.Math.Angle.ShortestBetween,kb=Phaser.Math.RadToDeg,wb=Phaser.Math.DegToRad;class Sb extends nb{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=Tb},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(bb(t,"threshold",0)),this}onDrag2Start(){this.prevAngle=xb(kb(this.angleBetween)),this.state=Ob,0===this.dragThreshold&&(this.state=Mb)}onDrag2End(){this.state=Tb}onDrag2(){switch(this.state){case Ob:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=xb(kb(this.angleBetween));this.angle=Cb(this.prevAngle,t),this.prevAngle=t,this.state=Mb}break;case Mb:t=xb(kb(this.angleBetween)),this.angle=Cb(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Mb}get rotation(){return wb(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}var Pb={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=yb),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)),(u=this.getSizerConfig(t)).align=i,u.padding=Lv(s),Ub(r)?(u.expandWidth=Nb(r,"width",!1),u.expandHeight=Nb(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?An(t):n),u.expandHeight&&(t.minHeight=void 0===a?zn(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}};const qb=qg.prototype.clear;var Zb=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),qb.call(this,t),i)for(var s,r=0,n=e.length;r0&&(Gb.width=e.aspectRatio,Gb.height=1,Hb.width=l,Hb.height=d,l=(c=Yb(Gb,Hb,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),Vb(t,this)):nf(t,l,d),s=u+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=v-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=An(t)),void 0===d&&(d=zn(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,Jm.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(tx,Jb,Qb);var ex=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 ix=Phaser.Utils.Objects.IsPlainObject,sx=Phaser.Utils.Objects.GetValue;class rx extends Fb{constructor(t,e,i,s,r,n){ix(e)?(e=sx(n=e,"x",0),i=sx(n,"y",0),s=sx(n,"width",void 0),r=sx(n,"height",void 0)):ix(s)&&(s=sx(n=s,"width",void 0),r=sx(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 ex(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(rx.prototype,tx);var nx=Phaser.Math.Distance.Between,ax=function(t,e,i){var s=t.width/2;return nx(s,s,e,i)<=s};const ox=Phaser.Math.Angle.Between,hx=Phaser.Math.Angle.Normalize;var lx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;if(ax(s,e,i)){var r=s.width/2,n=s.startAngle,a=ox(r,r,e,i),o=s.anticlockwise?n-a:a-n,h=hx(o)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h)}}},dx=function(){this.sizerChildren.knob.on("pointerdown",lx,this).on("pointermove",lx,this).setInteractive()};const cx=Phaser.Math.Angle.Between,ux=Phaser.Math.Angle.Wrap;var px=function(t,e,i){if(this.enable&&!this.panPointer){var s=this.sizerChildren.knob;ax(s,e,i)&&fx.call(this,t)}},gx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;switch(this.panState){case bx:ax(s,e,i)&&fx.call(this,t);break;case xx:ax(s,e,i)?yx.call(this):mx.call(this)}}},vx=function(t,e,i){this.enable&&this.panPointer===t&&mx.call(this)},fx=function(t){this.panPointer=t,this.panState=xx},mx=function(){this.panPointer=void 0,this.panState=bx},yx=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,s=cx(i.x,i.y,t.x,t.y),r=cx(i.x,i.y,e.x,e.y),n=i.anticlockwise?s-r:r-s,a=ux(n)/(2*Math.PI);this.stopEaseValue(),this.value+=a};const bx=0,xx=1;var Cx=function(){this.sizerChildren.knob.on("pointerdown",px,this).on("pointermove",gx,this).on("pointerup",vx,this).setInteractive(),this.panPointer=void 0,this.panState=bx},kx=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},wx={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:kx,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(kx.call(this,t)),e.layout&&e.layout()),this}};const Sx=Phaser.Utils.Objects.GetValue,Px=Phaser.Math.Snap.To;class Tx extends(Wu(rx)){constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexKnob",this.bootProgressBase(e);var i=Sx(e,"background",void 0),s=Sx(e,"text",void 0);i&&this.addBackground(i),s&&(e.textColor=void 0,e.textStrokeColor=void 0,this.setTextFormatCallback(Sx(e,"textFormatCallback",void 0),Sx(e,"textFormatCallbackScope",void 0)),e.textFormatCallback=void 0,e.textFormatCallbackScope=void 0);var r=new ap(t,e);r.setDepth(Sx(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(Sx(e,"enable",void 0)),this.setGap(Sx(e,"gap",void 0)),this.setValue(Sx(e,"value",0),Sx(e,"min",void 0),Sx(e,"max",void 0));var n=Sx(e,"input",0);switch("string"==typeof n&&(n=Ox[n]),n){case 0:Cx.call(this);break;case 1:dx.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=Px(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 Ox={pan:0,drag:0,click:1,none:-1};Object.assign(Tx.prototype,wx),t.register("knob",(function(t){var e=new Tx(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Knob",Tx);const Mx={arc:kc,circle:wc,curve:class extends xc{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),lk(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(bk.prototype,uk);const Ck={fit:1,FIT:1,envelop:2,ENVELOP:2};t.register("transitionImage",(function(t,e,i,s,r){var n=new bk(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.TransitionImage",bk);const kk=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,wk=Phaser.Utils.Objects.GetValue,Sk=Phaser.Math.Clamp;class Pk extends kk{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(wk(t,"progress",0)),this.setTransitionTargetTexture(wk(t,"toTexture","__DEFAULT"),wk(t,"toFrame",void 0),wk(t,"resizeMode",1)),this.setNoise(wk(t,"noiseX",void 0),wk(t,"noiseY",void 0),wk(t,"noiseZ",void 0)),this.setFromEdge(wk(t,"fromEdgeStart",.01),wk(t,"fromEdgeWidth",.05)),this.setToEdge(wk(t,"toEdgeStart",.01),wk(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=Sk(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=Tk[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 Tk={stretch:0,contain:1,cover:2};const Ok=Phaser.Utils.Array.SpliceOne,Mk=.1,Ek=[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-So(s),t.setChildLocalScale(e,r,r)):(e.visible&&t.setChildVisible(e,!1),r=1-So(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=So(s),r=Math.floor(255*(1-s)),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=So(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 Vx(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=So(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=So(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 Vx(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=So(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=So(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 Vx(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 Vx(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(),Ok(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,Pk),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(Mk,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(Mk,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(Mk,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(Mk,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 _k extends bk{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=Ek.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(gw.prototype,lw),t.register("fileDropZone",(function(t){var e=new gw(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileDropZone",gw);const vw=Phaser.Math.Wrap;var fw=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 xw=Phaser.Utils.Objects.IsPlainObject,Cw=Phaser.Utils.Objects.GetValue,kw=Phaser.Display.Align.CENTER,ww={min:0,full:-1};var Sw=function(t,e,i,s,r,n,a,o,h,l){var d,c,u,p;Iv.call(this,t);var g=t.isRexSpace,v=typeof e;if(null===e)return this;if("number"===v);else if("string"===v)e=ww[e];else if(xw(e)){var f;e=Cw(f=e,"proportion",void 0),i=Cw(f,"align",kw),s=Cw(f,"padding",0),r=Cw(f,"expand",!1),n=Cw(f,"key",void 0),a=Cw(f,"index",void 0),t.isRexSizer||(o=Cw(f,"minWidth",void 0),h=Cw(f,"minHeight",void 0)),l=Cw(f,"fitRatio",0),d=Cw(f,"offsetX",0),c=Cw(f,"offsetY",0),u=Cw(f,"offsetOriginX",0),p=Cw(f,"offsetOriginY",0)}return"string"==typeof i&&(i=tv[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=kw),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?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),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=Lv(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,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},Pw={add:Sw,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Sw.call(this,new yw(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return xw(i)&&(i.index=t),Sw.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=bw.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const Tw=Phaser.Utils.Array.Remove;var Ow={remove(t,e){return this.getParentSizer(t)!==this||(Tw(this.sizerChildren,t),Xv.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,Zb.call(this,t),this}},Mw={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=tv[e]),this.getSizerConfig(t).align=e,this}},Ew={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},_w={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Rw={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}},Lw={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&&(nf(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,ef.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d,c,u=this.sizerChildren,p=this.innerLeft,g=this.innerTop,v=this.innerWidth,f=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=qv.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)||Kv.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&fw.call(this,t,void 0),Jv.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Zv.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&fw.call(this,void 0,t),Qv.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(Lw,Pw,Ow,Mw,Ew,_w,Rw);var Bw=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 Iw=Phaser.Utils.Objects.IsPlainObject,Dw=Phaser.Utils.Objects.GetValue;class jw extends Fb{constructor(t,e,i,s,r,n,a){Iw(e)?(e=Dw(a=e,"x",0),i=Dw(a,"y",0),s=Dw(a,"width",void 0),r=Dw(a,"height",void 0),n=Dw(a,"orientation",0)):Iw(s)?(s=Dw(a=s,"width",void 0),r=Dw(a,"height",void 0),n=Dw(a,"orientation",0)):Iw(n)&&(n=Dw(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(Dw(a,"space.item",0)),this.setStartChildIndex(Dw(a,"startChildIndex",0)),this.setRTL(Dw(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=wp(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=Bw.call(this)),this._childrenProportion}}Object.assign(jw.prototype,Lw);var Aw=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}},zw={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 Fw extends jw{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&&(Aw(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&&(Aw(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&&Aw(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Aw(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(Fw.prototype,zw);var Yw=function(t,e,i,s){var r=new sk(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 Xw=Phaser.GameObjects.Text;var Ww=function(t){return t instanceof Xw};const Vw=Phaser.GameObjects.BitmapText;var Gw=function(t){return t instanceof Vw},Hw=function(t){return Gw(t)?2:Ww(t)?0:1},Uw=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},$w=function(t,e){switch(Hw(t)){case 0:switch("string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Uw;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e}},Kw=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):Gw(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 Ww(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 Jw=65535;var qw=function(t,e,i){if(null==e)return t;if(0===e)return tS(t,0,i),t;var s=t.text.length;if(0===s)return tS(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=Qw(t,r,e,i,n),o=0;o<=Jw&&0!==a;o++){if((r+=a)<0){r=0;break}a=Qw(t,r,e,i,n)}return o===Jw&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),tS(t,e,i),t},Zw=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Qw=function(t,e,i,s,r){var n,a=Zw(t,e,r),o=Zw(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)},tS=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 eS=Phaser.Utils.Objects.GetValue;var iS=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=eS(e,"minWidth",0),s=eS(e,"minHeight",0),r=eS(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 qw(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),qw(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const sS=Phaser.Utils.Objects.GetValue;class rS extends Fw{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=sS(e,"background",void 0),r=sS(e,"icon",void 0),n=sS(e,"iconMask",void 0),a=sS(e,"text",void 0),o=sS(e,"action",void 0),h=sS(e,"actionMask",void 0),l=sS(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:sS(e,"space.icon",0),top:sS(e,"space.iconTop",0),bottom:sS(e,"space.iconBottom",0),left:sS(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:sS(e,"space.icon",0),left:sS(e,"space.iconLeft",0),right:sS(e,"space.iconRight",0),top:sS(e,"space.iconTop",0)});var d=sS(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Yw.call(this,r,r,1)),!d){var c=sS(e,"iconSize",void 0);this.setIconSize(sS(e,"iconWidth",c),sS(e,"iconHeight",c))}}if(a){var u=sS(e,"wrapText",!1),p=sS(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),$w(a,u),e.expandTextWidth=!0,Kw(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,iS(a,{fitHeight:!0}));var g,v,f=sS(e,"space.text",0),m=sS(e,"expandTextWidth",!1),y=sS(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:sS(e,"space.actionTop",0),bottom:sS(e,"space.actionBottom",0),right:sS(e,"space.actionRight",0)}:{left:sS(e,"space.actionLeft",0),right:sS(e,"space.actionRight",0),bottom:sS(e,"space.actionBottom",0)},d=sS(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=Yw.call(this,o,o,1)),!d)){var b=sS(e,"actionSize");this.setActionSize(sS(e,"actionWidth",b),sS(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 nS=Phaser.Utils.Objects.GetValue;var aS=function(t,e){var i=nS(e,"canvas"),s=nS(i,"width",128),r=nS(i,"height",128),n=new Eu(t,0,0,s,r);t.add.existing(n);var a=nS(i,"key"),o=nS(i,"frame"),h=nS(i,"fill");return void 0!==h?n.fill(h):void 0!==a&&n.loadTexture(a,o),n.setTexture=n.loadTexture.bind(n),n};const oS=Phaser.Utils.Objects.GetValue;var hS=function(t,e){var i=oS(e,"clickTarget",this);return"string"==typeof i&&(i=t.getElement(i)),i};const lS=Phaser.Utils.Objects.GetValue,dS={accept:"image/*",multiple:!1};var cS=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)}))}},uS={async openPromise(){var t=this;return Zk(this.scene.game,dS).then((function(e){return cS(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}},pS={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(pS,uS);const gS=Phaser.Utils.Objects.GetValue;class vS extends rS{constructor(t,e){var i=function(t,e){var i=new Dk(t,{scaleUp:nS(e,"scaleUpIcon",!1),background:nS(e,"iconBackground"),image:aS(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=hS(this,e),this.clickTarget&&(gS(e,"domButton",!0)?this.fileChooser=function(t){var e=t.scene,i=new nw(e,dS);return e.add.existing(i),t.pin(i),i.on("change",(function(){cS(t,i.files)})),i}(this):this.clickBehavior=function(t,e){var i=hS(t,e);if(i){var s=lS(e,"click"),r=new lu(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(vS.prototype,pS),t.register("imageInputLabel",(function(t){var e=new vS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ImageInputLabel",vS);let fS=class extends La{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 mS=Phaser.Utils.Objects.GetValue;class yS extends La{constructor(t,e){super(t,e),this.style=mS(e,"style",this);var i=mS(e,"propertiesMap");this.activeStyle=bS(e,"active",i),this.hoverStyle=bS(e,"hover",i),this.disableStyle=bS(e,"disable",i),this.onModifyStyle=mS(e,"onModifyStyle")}getStyle(t){return Id(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 Dd(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return xS.call(this,"active",t),this}setHoverState(t){return xS.call(this,"hover",t),this}setDisableState(t){return xS.call(this,"disable",t),this}}var bS=function(t,e,i){var s=Ld(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},xS=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))},CS={addStyleManager(t){return this.styleManager=new yS(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 kS=Phaser.GameObjects.Image,wS=Phaser.Utils.Objects.GetValue;class SS extends kS{constructor(t,e){void 0===e&&(e={}),super(t,wS(e,"x",0),wS(e,"y",0),wS(e,"key",""),wS(e,"frame",void 0)),this.type="rexStatesImage";var i=wS(e,"effects",!0);i&&Mn(this,i),this.style=new fS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(SS.prototype,CS),t.register("statesImage",(function(t){var e=new SS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesImage",SS);class PS extends jt{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=TS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const TS={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(PS.prototype,CS),t.register("statesRoundRectangle",(function(t){var e=new PS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesRoundRectangle",PS);let OS=class extends La{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 MS=Phaser.GameObjects.NineSlice,ES=Phaser.Utils.Objects.GetValue;class _S extends MS{constructor(t,e){void 0===e&&(e={}),super(t,ES(e,"x",0),ES(e,"y",0),ES(e,"key",null),ES(e,"frame",null),ES(e,"width",0),ES(e,"height",0),ES(e,"leftWidth",0),ES(e,"rightWidth",0),ES(e,"topHeight",0),ES(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=ES(e,"effects",!0);i&&Mn(this,i),this.style=new OS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_S.prototype,CS),t.register("statesNineSlice",(function(t){var e=new _S(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNineSlice",_S);let RS=class extends La{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 LS=Phaser.Utils.Objects.GetValue;class BS extends k{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=LS(e,"effects",!0);i&&Mn(this,i),this.style=new RS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(BS.prototype,CS),t.register("statesNinePatch",(function(t){var e=new BS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNinePatch",BS);const IS=Phaser.GameObjects.Text,DS=Phaser.Utils.Objects.GetValue;class jS extends IS{constructor(t,e){void 0===e&&(e={}),super(t,DS(e,"x",0),DS(e,"y",0),DS(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(jS.prototype,CS),t.register("statesText",(function(t){var e=new jS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesText",jS);class AS extends La{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 zS=Phaser.GameObjects.BitmapText,FS=Phaser.Utils.Objects.GetValue;class YS extends zS{constructor(t,e){void 0===e&&(e={});var i=FS(e,"x",0),s=FS(e,"y",0),r=FS(e,"font",""),n=FS(e,"fontSize",!1),a=FS(e,"align",0),o=FS(e,"tint");super(t,i,s,r,"",n,a),this.type="rexStatesBitmapText",void 0!==o&&this.setTint(o);var h=FS(e,"effects",!0);h&&Mn(this,h),this.style=new AS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(YS.prototype,CS),t.register("statesBitmapText",(function(t){var e=new YS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBitmapText",YS);class XS extends cp{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=WS,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 WS={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(XS.prototype,CS),t.register("statesBarRectangle",(function(t){var e=new XS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBarRectangle",XS);var VS=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 GS=class extends Eu{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 HS={setChart:function(t){return window.Chart?(this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,VS(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 QS(this.sizerChildren,null),Zb.call(this,t),this}},eP={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)QS(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},nP={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=qv.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,QS(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)QS(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},oP=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const hP=Phaser.Utils.Objects.IsPlainObject,lP=Phaser.Utils.Objects.GetValue;class dP extends Fb{constructor(t,e,i,s,r,n,a,o,h,l){hP(e)?(e=lP(l=e,"x",0),i=lP(l,"y",0),s=lP(l,"width",void 0),r=lP(l,"height",void 0),n=lP(l,"column",l.col||0),a=lP(l,"row",0),o=lP(l,"columnProportions",0),h=lP(l,"rowProportions",0)):hP(s)?(s=lP(l=s,"width",void 0),r=lP(l,"height",void 0),n=lP(l,"column",l.col||0),a=lP(l,"row",0),o=lP(l,"columnProportions",0),h=lP(l,"rowProportions",0)):hP(n)?(n=lP(l=n,"column",l.col||0),a=lP(l,"row",0),o=lP(l,"columnProportions",0),h=lP(l,"rowProportions",0)):hP(o)&&(o=lP(l=o,"columnProportions",0),h=lP(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(lP(l,"createCellContainerCallback")),this.setIndentLeft(lP(l,"space.indentLeftOdd",0),lP(l,"space.indentLeftEven",0)),this.setIndentTop(lP(l,"space.indentTopOdd",0),lP(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,lP(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=aP.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=oP.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(dP.prototype,nP),t.register("gridSizer",(function(t,e,i,s,r,n,a,o,h){var l=new dP(this.scene,t,e,i,s,r,n,a,o,h);return this.scene.add.existing(l),l})),P(window,"RexPlugins.UI.GridSizer",dP);var cP=function(t,e,i,s){return e/t<=i?e/(s-1):0},uP=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=pP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=pP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const vP=Phaser.Utils.Objects.IsPlainObject,fP=Phaser.Utils.Objects.GetValue,mP=Phaser.Display.Align.CENTER;var yP=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(Iv.call(this,t),vP(e)&&(e=fP(h=e,"padding",0),i=fP(h,"key",void 0),s=fP(h,"index",void 0),r=fP(h,"offsetX",0),n=fP(h,"offsetY",0),a=fP(h,"offsetOriginX",0),o=fP(h,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=mP,h.padding=Lv(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,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,n,a,o,h},bP={add(t,e,i){if(Gm(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,Zb.call(this,t),this}},kP={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 uT=Phaser.Utils.Objects.GetValue,pT=Phaser.Math.Distance.Between;class gT extends La{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=uT(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(uT(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(uT(t,"enable",!0)),this.holdThreshold=uT(t,"holdThreshold",50),this.pointerOutReleaseEnable=uT(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 nc(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:pT(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&&!Vm(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&&!Vm(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 vT=Phaser.Utils.Objects.GetValue;class fT{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(vT(t,"value",0)),this.setSpeed(vT(t,"speed",0)),this.setAcceleration(vT(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 mT{constructor(){this.value,this.dir,this.movement=new fT}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 CT={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},kT=Phaser.Utils.Objects.GetValue;class wT extends La{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=kT(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(kT(e,"speed",.1)),this.setEnable(kT(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(kT(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||Vm(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 ST=Phaser.Utils.Objects.GetValue;var PT=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)?ST(s,l,void 0):ST(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 dT(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=ST(r,"position",0);"string"==typeof p&&(p=TT[p]);var g,v,f=ST(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=ST(s,"space.slider",void 0))&&(o?f=0:g=ST(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:ST(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:ST(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:ST(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:ST(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=ST(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=ST(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=ST(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=ST(s,"scrollDetectionMode");"string"==typeof b&&(b=OT[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?ST(s,x,!0):ST(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new xT(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,w,S,P,T=ST(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&h&&(void 0!==b&&(T.focus=1===b?2:0),C=new wT(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 TT={right:0,left:1,bottom:0,top:1},OT={gameObject:0,rectBounds:1},MT=Phaser.Utils.Objects.GetValue;var ET=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=MT(e,"width"),a=MT(e,"height");n||MT(e,"child.expandWidth",!0)||(s[1]=0),a||MT(e,"child.expandHeight",!0)||(r[1]=0);var o=new dP(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=DP(i,"child"),r=DP(s,"gameObject",void 0);if(r){var n=DP(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=DP(n,"top",0),a.bottom=DP(n,"bottom",0),o.left=DP(n,"left",0),o.right=DP(n,"right",0);break;case 1:a.top=DP(n,"left",0),a.bottom=DP(n,"right",0),o.top=DP(n,"top",0),o.bottom=DP(n,"bottom",0);break;default:a.top=DP(n,"top",0),a.bottom=DP(n,"bottom",0),a.left=DP(n,"left",0),a.right=DP(n,"right",0)}e.add(r,{column:1,row:1,align:DP(s,"align","center"),padding:o,expand:{width:DP(s,"expandWidth",!0),height:DP(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:PT(t,o,"y",e);break;case 1:PT(t,o,"x",e);break;default:PT(t,o,"y",e),PT(t,o,"x",e)}return o},_T=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)},RT=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)}},LT=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},FT=function(t){return(t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},YT=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},XT=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},WT=function(t,e){switch(Hw(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}},VT=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&>.call(this)},GT=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)}},HT=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()}},UT={setText:function(t){return void 0!==t&&(this.text=t),this.lines=zT(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(FT.call(this,-this.textOY)),0),e=YT.call(this,t)+this.textOY,i=XT.call(this,t);return WT(this.textObject,i),this.textObject.rexSizer.offsetY=e,VT.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,ef.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,HT.call(this,t,n,a),Sv(t,s,r,n,a,e.align),e.preOffsetY=0,VT.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const NT=Phaser.Utils.Objects.IsPlainObject,$T=Phaser.Utils.Objects.GetValue,KT=Phaser.Display.Align.TOP_LEFT;class JT extends Fb{constructor(t,e,i,s,r,n){NT(e)?(e=$T(n=e,"x",0),i=$T(n,"y",0),s=$T(n,"width",void 0),r=$T(n,"height",void 0)):NT(s)&&(s=$T(n=s,"width",void 0),r=$T(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=$T(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode($T(n,"clampTextOY",!0)),this.alwaysScrollable=$T(n,"alwaysScrollable",!1);var a=$T(n,"background",void 0),o=$T(n,"text",void 0);void 0===o&&(o=qT(t)),this.textCropEnable=$T(n,"textCrop",!!o.setCrop);var h=$T(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=KT,l.padding=Lv(0),l.expand=!0,this.textObject=o,this.textObjectType=Hw(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=Yw.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(FT.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=YT.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 qT=function(t){return t.add.text(0,0,"")};Object.assign(JT.prototype,UT);var ZT={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},QT={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 tO=Phaser.Utils.Objects.GetValue;class eO extends jT{constructor(t,e){void 0===e&&(e={});var i=tO(e,"text",void 0),s=tO(e,"textWidth",void 0),r=tO(e,"textHeight",void 0),n=tO(e,"textCrop",!!i.setCrop),a=tO(e,"textMask",!n),o=tO(e,"content",""),h=new JT(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:tO(e,"clampChildOY",!1),alwaysScrollable:tO(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=tO(e,"space",void 0);l&&(l.child=tO(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(eO.prototype,ZT,QT);const iO=Phaser.Utils.Objects.GetValue;var sO=function(t,e,s){e=e?i(e):{};var r=iO(s,"background",RP),n=iO(s,"text",rO),a=iO(s,"track",RP),o=iO(s,"thumb",RP);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 eO(t,e);return t.add.existing(l),l},rO=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 YS(t,e);break;case"bbcodetext":case"bbcode":s=new ds(t,0,0,"",e);break;case"label":s=new hO(t,e);break;case"textarea":s=sO(t,e);break;default:s=new jS(t,e)}return _P(s,e),t.add.existing(s),s},nO=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 BS(t,e):new _S(t,e);break;case"roundRectangle":s=new PS(t,e);break;default:s=new SS(t,e)}return _P(s,e),t.add.existing(s),s};const aO=Phaser.Utils.Objects.GetValue;var oO=function(t,e,s){e=e?i(e):{};var r=aO(s,"background",RP),n=aO(s,"text",rO),a=aO(s,"icon",nO),o=aO(s,"action",nO);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 hO extends rS{constructor(t,e,i){super(t,e=oO(t,e,i)),this.type="rexSimpleLabel"}setActiveState(t){return lO(this.getChildren(),"setActiveState",t),this}setHoverState(t){return lO(this.getChildren(),"setHoverState",t),this}setDisableState(t){return lO(this.getChildren(),"setDisableState",t),this}}var lO=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=OO(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(Gm(s)||(s=Ic(LO,i,1)),OO(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=IO[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=BO[t]),this.timeUnit=t,this}}var LO=[];const BO={ms:0,s:1,sec:1},IO={abs:0,absolute:0,inc:1,increment:1};var DO=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()},jO={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 AO=Phaser.Utils.Objects.GetValue;class zO extends PO{constructor(t,e){super(t,e),this.type="rexExpBar",this.setTotalEaseDuration(AO(e,"easeDuration",1e3)),this.levelCounter=new TO(AO(e,"levelCounter")),this.player=new RO(this,{scope:this,dtMode:1}),this.levelCounter.on("levelup",DO,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(zO.prototype,jO),t.register("expBar",(function(t){var e=new zO(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ExpBar",zO);const FO=jw.prototype.add,YO=jw.prototype.addSpace;var XO=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)&&YO.call(this),FO.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&YO.call(this),this.hasTailSpace=s}else FO.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;FO.call(this,t,{index:r,proportion:i,expand:!0})}else FO.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},WO={addButton(t){if(Gm(t))for(var e=t,i=0,s=e.length;i=0;i--)HO.call(this,e[i],t);return this}},NO=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)}},$O=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,NO.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 lu(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`),$O.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--)cM.call(this,e[i],t);return this}};const pM=Phaser.Utils.Objects.GetValue;class gM extends dP{constructor(t,e){void 0===e&&(e={});var i=pM(e,"row",0),s=pM(e,"column",e.col||0),r=pM(e,"createCellContainerCallback"),n=pM(e,"buttons",void 0),a=pM(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&&vM.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)xM.call(this,e[i],t);return this}};const kM=Phaser.Utils.Objects.GetValue;class wM extends OP{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 iM({parent:this,eventEmitter:kM(e,"eventEmitter",this),groupName:kM(e,"groupName",void 0),clickConfig:kM(e,"click",void 0)}).setButtonsType(e);var s=kM(e,"background",void 0),r=kM(e,"buttons",void 0);this.buttonsAlign=kM(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(wM.prototype,mM,CM,eM,rM),t.register("fixWidthButtons",(function(t){var e=new wM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FixWidthButtons",wM);var SM={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 PM=Phaser.Utils.Objects.GetValue;class TM extends rS{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new nw(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(PM(e,"accept","")),this.setMultiple(PM(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(TM.prototype,SM),t.register("fileSelectorButton",(function(t){var e=new TM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileSelectorButton",TM);var OM={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()}},MM={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,zm.modal.call(this,t,e),this}},EM={};Object.assign(EM,OM,MM);const _M=Phaser.Utils.Objects.GetValue;class RM extends jw{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexDialog",this.eventEmitter=_M(e,"eventEmitter",this);var i,s,r,n,a=_M(e,"background",void 0),o=_M(e,"title",void 0),h=_M(e,"toolbar",void 0),l=_M(e,"toolbarBackground",void 0),d=_M(e,"leftToolbar",void 0),c=_M(e,"leftToolbarBackground",void 0),u=_M(e,"content",void 0),p=_M(e,"description",void 0),g=_M(e,"choices",void 0),v=_M(e,"choicesBackground",void 0),f=_M(e,"actions",void 0),m=_M(e,"actionsBackground",void 0),y=_M(e,"click",void 0);if(a&&this.addBackground(a),h&&(r=new aM(t,{groupName:"toolbar",background:l,buttons:h,orientation:0,space:{item:_M(e,"space.toolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(r)),d&&(n=new aM(t,{groupName:"leftToolbar",background:c,buttons:d,orientation:0,space:{item:_M(e,"space.leftToolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(n)),o||h||d){var b,x=!!o&&_M(e,"expand.title",!0),C=_M(e,"align.title","center"),k=!(o&&!x&&"center"===C||!o&&(h||d));b=k?new jw(t,{orientation:0}):new rx(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:_M(e,"space.titleLeft",0),right:_M(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:_M(e,"space.title",0),top:_M(e,"space.titleTop",0)}),P=_M(e,"proportion.title",0),this.add(b,{padding:S,proportion:P,expand:!0})}if(u){var T=_M(e,"align.content","center"),O=_M(e,"space.content",0),M=(S={left:_M(e,"space.contentLeft",0),right:_M(e,"space.contentRight",0),bottom:p||g||f?O:0},P=_M(e,"proportion.content",0),_M(e,"expand.content",!0));this.add(u,{align:T,padding:S,proportion:P,expand:M})}if(p){T=_M(e,"align.description","center");var E=_M(e,"space.description",0);S={left:_M(e,"space.descriptionLeft",0),right:_M(e,"space.descriptionRight",0),bottom:g||f?E:0},P=_M(e,"proportion.description",0),M=_M(e,"expand.description",!0),this.add(p,{align:T,padding:S,proportion:P,expand:M})}if(g){var _=_M(e,"choicesType","").split("-"),R=LM(_,"wrap")?wM:LM(_,"grid")?gM:aM,L=LM(_,"radio")?"radio":LM(_,"checkboxes")?"checkboxes":void 0,B={left:_M(e,"space.choicesBackgroundLeft",0),right:_M(e,"space.choicesBackgroundRight",0),top:_M(e,"space.choicesBackgroundTop",0),bottom:_M(e,"space.choicesBackgroundBottom",0)},I=_M(e,"space.choice",0);R===aM?B.item=I:R===wM?(B.item=I,B.line=_M(e,"space.choiceLine",I)):(B.column=_M(e,"space.choiceColumn",I),B.row=_M(e,"space.choiceRow",I));var D={width:_M(e,"choicesWidth",void 0),height:_M(e,"choicesHeight",void 0),groupName:"choices",buttonsType:L,background:v,buttons:g,space:B,click:y,eventEmitter:this.eventEmitter,setValueCallback:_M(e,"choicesSetValueCallback",void 0),setValueCallbackScope:_M(e,"choicesSetValueCallbackScope",void 0)};R===aM&&(D.orientation=LM(_,"x")?0:1),i=new R(t,D),t.add.existing(i);var j=_M(e,"space.choices",0);S={left:_M(e,"space.choicesLeft",0),right:_M(e,"space.choicesRight",0),bottom:f?j:0},T=_M(e,"align.choices","center"),P=_M(e,"proportion.choices",0),M=_M(e,"expand.choices",!0),this.add(i,{align:T,padding:S,proportion:P,expand:M}),this.buttonsType=L}f&&(s=new aM(t,{groupName:"actions",background:m,buttons:f,orientation:0,space:{item:_M(e,"space.action",0)},expand:_M(e,"expand.actions",!1),align:_M(e,"align.actions","center"),click:y,eventEmitter:this.eventEmitter}),t.add.existing(s),S={left:_M(e,"space.actionsLeft",0),right:_M(e,"space.actionsRight",0),bottom:_M(e,"space.actionsBottom",0)},P=_M(e,"proportion.action",0),this.add(s,{align:"center",padding:S,proportion:P,expand:!0})),IM(this,"click"),IM(this,"over"),IM(this,"out"),IM(this,"enable"),IM(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 LM=function(t,e){return-1!==t.indexOf(e)},BM={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},IM=function(t,e){t.on(`button.${e}`,(function(i,s,r,n,a){BM.hasOwnProperty(s)&&t.emit(`${BM[s]}.${e}`,i,r,n,a)}))};Object.assign(RM.prototype,EM),t.register("dialog",(function(t){var e=new RM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Dialog",RM);var DM=function(t,e,i){var s=new hO(t,e,i);return t.add.existing(s),s},jM=function(t){var e=this.childrenMap.title;null===(t=t.title)?e.hide():(e.show(),e.resetDisplayContent(t))},AM=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)}},zM=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=UE(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(F_.prototype,D_);const Y_=["top","bottom","centerY","center"],X_=["left","right","centerX","center"];var W_=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=Y_.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=X_.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 V_=Phaser.Utils.Objects.GetValue;class G_ extends jT{constructor(t,e){void 0===e&&(e={});var i=BP(e),s=V_(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=V_(e,"clampChildOY",!1),s.clampChildOX=V_(e,"clampChildOX",!1);var r,n,a=new F_(t,s);switch(t.add.existing(a),i){case 0:r=V_(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=V_(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:V_(e,"align.panel","center")};var o=V_(e,"space",void 0);o&&(o.child=V_(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]),jb(this.childrenMap.child,t),this}}var H_={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:W_.call(this,t,"y",e);break;case 1:W_.call(this,t,"x",e);break;default:W_.call(this,t,"y",e),W_.call(this,t,"x",e)}return this}};Object.assign(G_.prototype,H_);const U_=Phaser.Utils.Objects.GetValue;var N_=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=$_(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=K_(e,this.listCreateSliderTrackCallback),g=K_(e,this.listCreateSliderThumbCallback);d=new G_(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:U_(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=$_(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},$_=function(t,e,i){var s;return i?(e.orientation="x",s=new wM(t,e)):(e.orientation="y",s=new aM(t,e)),t.add.existing(s),s},K_=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s};const J_=Phaser.Utils.Objects.GetValue;var q_=function(t,e){var i=J_(e,"expandDirection",void 0);"string"==typeof i&&(i=Z_[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Od(s=e,r="alignTarget")?J(s,r):n&&Od(s,n)?J(s,n):a&&Od(s,a)?J(s,a):o),c=J_(e,"alignTargetY",d),u=J_(e,"alignOffsetX",0),p=J_(e,"alignOffsetY",0),g=J_(e,"alignSide","").includes("right"),v=J_(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=oa(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const Z_={down:0,up:1},Q_=Phaser.Utils.Objects.GetValue;class tR extends xm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){mf(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 vf(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),q_(t,e),t.isRexSizer&&t.layout();var i=Q_(e,"touchOutsideClose",!1),s=Q_(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&&Rm(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 eR={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}},iR={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=N_.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 tR(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(iR,B_,eR);const sR=Phaser.Utils.Objects.GetValue;class rR extends rS{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(sR(e,"options"));var i=sR(e,"list");this.setWrapEnable(sR(i,"wrap",!1)),this.setCreateButtonCallback(sR(i,"createButtonCallback")),this.setCreateListBackgroundCallback(sR(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(sR(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(sR(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(sR(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(sR(i,"scroller")),this.setListMouseWheelScrollerConfig(sR(i,"mouseWheelScroller")),this.setButtonClickCallback(sR(i,"onButtonClick")),this.setButtonOverCallback(sR(i,"onButtonOver")),this.setButtonOutCallback(sR(i,"onButtonOut")),this.setListExpandDirection(sR(i,"expandDirection")),this.setListEaseInDuration(sR(i,"easeIn",500)),this.setListEaseOutDuration(sR(i,"easeOut",100)),this.setListTransitInCallback(sR(i,"transitIn")),this.settListTransitOutCallback(sR(i,"transitOut")),this.setListMaxHeight(sR(i,"maxHeight",0)),this.setListSize(sR(i,"width"),sR(i,"height",0)),this.setListAlignmentMode(sR(i,"alignParent","text")),this.setListAlignmentSide(sR(i,"alignSide","")),this.setListBounds(sR(i,"bounds")),this.setListSpace(sR(i,"space")),this.setListDraggable(sR(i,"draggable",!1)),this.setValueChangeCallback(sR(e,"setValueCallback"),sR(e,"setValueCallbackScope")),this.setValue(sR(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(rR.prototype,iR),t.register("dropDownList",(function(t){var e=new rR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.DropDownList",rR);var nR=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=oO(t,r,a);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=DM(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 RP(t,l)},delete e.track);var d=e.thumb;return d&&(h.list.createThumbCallback=function(t){return RP(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 aR extends rR{constructor(t,e,i){super(t,e=nR(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(cR,oR,lR,dR);const uR=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class pR extends La{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Hw(this.parent),this.pageStartIndexes=[],this.lines=zT(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(uR(t,"maxLines",void 0)),this.setPageBreak(uR(t,"pageBreak","\f\n")),this.setText(uR(t,"text","")),this.startLineIndex=uR(t,"start",-1),this.endLineIndex=uR(t,"end",void 0);var e=uR(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(Hw(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(pR.prototype,cR);var gR={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?WT(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}},vR=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},fR=function(t,e){for(var i=void 0,s=0;s0?mR(n,t,a=(o=i)-d,o):"";var c,u=e-d;u>0?(o=(a=0)+u,this.insertIndex=o,c=mR(n,t,a,o)):(c="",this.insertIndex=0),r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},bR={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=vR(this.parent,t);n=fR(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)yR.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(bR,gR);const xR=Phaser.Utils.Objects.GetFastValue,CR=Phaser.Utils.Objects.GetValue;class kR extends La{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(CR(t,"wrap",!1)),this.setTypeMode(CR(t,"typeMode",0)),this.setTypingSpeed(CR(t,"speed",333)),this.setTextCallback=xR(t,"setTextCallback",null),this.setTextCallbackScope=xR(t,"setTextCallbackScope",null),this.setTypingContent(xR(t,"text","")),this.typingIndex=xR(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=xR(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=wR[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(Hw(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=vR(this.parent,this.text).length,this}onTyping(){var t=yR.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?WT(this.parent,t):this.parent.setText(t)}}const wR={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(kR.prototype,bR);const SR=Phaser.Utils.Objects.GetValue,PR={page:0,line:1};class TR 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=SR(i,"expandTextWidth",!1),n=SR(i,"expandTextHeight",!1);if(r||n){var a=Hw(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(SR(i,"typingMode","page")),this.page=new pR(s,SR(i,"page",void 0)),this.typing=new kR(s,SR(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=PR[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()}}}(gO)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}t.register("textBox",(function(t){var e=new TR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.TextBox",TR);class OR extends TR{constructor(t,e,i){super(t,e=fO(t,e,i))}}t.register("simpleTextBox",(function(t){var e=new OR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.SimpleTextBox",OR);const MR=Phaser.Utils.Objects.GetValue;class ER extends jw{constructor(t,e){super(t,e),this.type="rexNumberBar";var i,s,r,n=MR(e,"background",void 0),a=MR(e,"icon",void 0),o=MR(e,"iconMask",void 0),h=MR(e,"slider",void 0),l=MR(e,"text",void 0),d=MR(e,"space.icon",0),c=MR(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=Yw.call(this,a,a,1))),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,h.hasOwnProperty("input")||(h.input=-1),i=new aT(t,h),t.add.existing(i),0===this.orientation?l&&(s={right:c}):l&&(s={bottom:c}),r=0===this.orientation?void 0===MR(h,"width",void 0)?1:0:void 0===MR(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=MR(e,"valuechangeCallback",null);if(null!==u){var p=MR(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,p)}this.setEnable(MR(e,"enable",void 0)),this.setValue(MR(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 ER(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.NumberBar",ER),t.register("scrollBar",(function(t){var e=new dT(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ScrollBar",dT);const _R=Phaser.Utils.Objects.GetValue,RR={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 LR extends rx{constructor(t,e){super(t,e),this.type="rexBadge";var i=_R(e,"background",void 0);i&&this.addBackground(i),this.addChildrenMap("background",i);var s=_R(e,"main",void 0);for(var r in s&&this.add(s,{key:"main",align:"center",expand:!1}),this.addChildrenMap("main",s),RR){var n=_R(e,r,void 0);n&&(this.add(n,{key:r,align:RR[r],expand:!1}),this.addChildrenMap(r,n))}}}t.register("badgeLabel",(function(t){var e=new LR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.BadgeLabel",LR);const BR=rx.prototype.add;var IR=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),BR.call(this,t,e,i,s,r,n,a,o,h),this},DR={add:IR,addPage:IR};const jR=qg.prototype.setChildVisible;var AR={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?(jR.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&&(jR.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(AR,DR);const zR=Phaser.Utils.Objects.GetValue;class FR extends rx{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(zR(e,"swapMode",0)),this.setFadeInDuration(zR(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=YR[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(FR.prototype,AR);const YR={invisible:0,destroy:1};t.register("pages",(function(t){var e=new FR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Pages",FR);const XR=Phaser.GameObjects.Mesh;class WR extends XR{get tint(){return 0===this.vertices.length?16777215:this.vertices[0].color}forceUpdate(){return this.dirtyCache[10]=1,this}}const VR=Phaser.Math.Vector3,GR=Phaser.Math.Matrix4;var HR=new VR,UR=new VR,NR=new GR;const $R=Phaser.Utils.Objects.IsPlainObject,KR=Phaser.Utils.Objects.GetValue,JR=Phaser.Geom.Mesh.GenerateGridVerts,qR=Phaser.Math.RadToDeg,ZR=Phaser.Math.DegToRad,QR=1+1/Math.sin(ZR(45));let tL=class extends WR{constructor(t,e,i,s,r,n){$R(e)&&(e=KR(n=e,"x",0),i=KR(n,"y",0),s=KR(n,"key",null),r=KR(n,"frame",null)),super(t,e,i,s,r),this.type="rexPerspectiveImage",this.setSizeToFrame(),this.resetPerspective(),this.panZ(QR),this.hideCCW=KR(n,"hideCCW",!0);var a=KR(n,"gridWidth",0),o=KR(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,JR({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 qR(this.rotationX)}set angleX(t){this.rotationX=ZR(t)}get rotationY(){return this.modelRotation.y}set rotationY(t){this.modelRotation.y=t}get angleY(){return qR(this.rotationY)}set angleY(t){this.rotationY=ZR(t)}get rotationZ(){return this.modelRotation.z}set rotationZ(t){this.modelRotation.z=t}get angleZ(){return qR(this.rotationZ)}set angleZ(t){this.rotationZ=ZR(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),HR.set(e,i,s),UR.set(r,n,a),NR.fromRotationXYTranslation(UR,HR,!0);for(var o=0,h=t.vertices.length;o=0;i--)this.removePage(e[i].name,t);return this}},YL={top:1,left:3,right:5,bottom:7},XL={top:"bottom",left:"right",right:"left",bottom:"top"},WL={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},VL={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}GB.call(r,s,a.x,a.y)}}(t,s,r,i),t.transitInCallback(e,i,t)},NB={showMessage(t){var e=function(t,e,i){var s=e(t.scene,i,t);if(WB.call(s,(function(){t.removeMessage(s)})),t.displayTime){var r=t.transitInTime+t.displayTime+10;VB.call(s,r,(function(){t.removeMessage(s)}))}return s}(this,this.createMessageLabelCallback,t);return UB(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),VB.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 WI(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},GI={openColorPicker:function(){if(!this.colorPicker){var t=VI.call(this).layout(),e=new tR(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(GI,cI);const HI=Phaser.Utils.Objects.GetValue;class UI extends dI{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(HI(i,"width",160),HI(i,"height",170));var n=HI(i,"background");r=n?function(t){return RP(t,n)}:HI(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(HI(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(HI(i,"expandDirection")),this.setColorPickerEaseInDuration(HI(i,"easeIn",200)),this.setColorPickerEaseOutDuration(HI(i,"easeOut",200)),this.setColorPickerTransitInCallback(HI(i,"transitIn")),this.setColorPickerTransitOutCallback(HI(i,"transitOut")),this.setColorPickerBounds(HI(i,"bounds"));var a=HI(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(HI(o,"height",30)),this.setColorComponentsFormatLabelConfig(HI(o,"formatLabel"));var h=HI(o,"inputText");h||(h=HI(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=HI(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(UI.prototype,GI),t.register("colorInput",(function(t){var e=new UI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInput",UI),t.register("colorInputLite",(function(t){var e=new dI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInputBase",dI),t.register("colorPicker",(function(t){var e=new BI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorPicker",BI),t.register("colorComponents",(function(t){var e=new YI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorComponents",YI);var NI=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 je=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,As=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 js=Phaser.GameObjects.Components.TransformMatrix;var zs,Fs,Ys={},Xs=function(t,e,i,s,r){var n=As(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 js,Fs=new js),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 j=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}},jn=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,Wn=Phaser.GameObjects.Container;var Vn=function(t,e){if(void 0===e?e=new Fn:!0===e&&(void 0===Gn&&(Gn=new Fn),e=Gn),t.getBounds&&!(t instanceof Wn))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();Hn(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Un(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Nn(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,$n(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Hn(t,e),i=e.x,s=e.y,Un(t,e),r=e.x,n=e.y,Nn(t,e),a=e.x,o=e.y,$n(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},Gn=void 0,Hn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-jn(t)*t.originX,e.y=t.y-zn(t)*t.originY,qn(t,e,i))},Un=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn),t.getTopRight?t.getTopRight(e):(e.x=t.x-jn(t)*t.originX+jn(t),e.y=t.y-zn(t)*t.originY,qn(t,e,i))},Nn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-jn(t)*t.originX,e.y=t.y-zn(t)*t.originY+zn(t),qn(t,e,i))},$n=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-jn(t)*t.originX+jn(t),e.y=t.y-zn(t)*t.originY+zn(t),qn(t,e,i))},Kn=function(t,e,i){void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn);var s=jn(t),r=zn(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),qn(t,e,i)},Jn=void 0,qn=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 Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Zn(i,"color"),r=Zn(i,"lineWidth"),n=Zn(i,"fillColor"),a=Zn(i,"fillAlpha",1),o=Zn(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Ga:Va,this.repeatCounter=0,this}stop(){return this.state=Wa,this}update(t,e){this.state!==Wa&&this.state!==Ua&&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=Ha)):(this.nowTime=this.duration,this.state=Ua):this.nowTime>=0&&(this.state=Ga))}get t(){var t;switch(this.state){case Wa:case Va:case Ha:t=0;break;case Ga:t=this.nowTime/this.duration;break;case Ua:t=1}return Ya(t,0,1)}set t(t){(t=Ya(t,-1,1))<0?(this.state=Va,this.nowTime=-this.delay*t):(this.state=Ga,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Wa}get isDelay(){return this.state===Va}get isCountDown(){return this.state===Ga}get isRunning(){return this.state===Va||this.state===Ga}get isDone(){return this.state===Ua}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Wa=0,Va=1,Ga=2,Ha=3,Ua=-1;class Na extends ja{constructor(t,e){super(t,e),this.timer=new Xa}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 $a=Phaser.Utils.Objects.GetValue,Ka=Phaser.Utils.Objects.GetAdvancedValue,Ja=Phaser.Tweens.Builders.GetEaseFunction;class qa extends Na{resetFromJSON(t){return this.timer.resetFromJSON($a(t,"timer")),this.setEnable($a(t,"enable",!0)),this.setTarget($a(t,"target",this.parent)),this.setDelay(Ka(t,"delay",0)),this.setDuration(Ka(t,"duration",1e3)),this.setEase($a(t,"ease","Linear")),this.setRepeat($a(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=Ja(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 Za=Phaser.Sound.BaseSound;var Qa=function(t){return t instanceof Za};const to=Phaser.Utils.Objects.GetValue,eo=Phaser.Utils.Objects.GetAdvancedValue,io=Phaser.Math.Linear;let so=class extends qa{constructor(t,e,i){Qa(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(to(t,"mode",0)),this.setEnable(to(t,"enable",!0)),this.setVolumeRange(eo(t,"volume.start",this.parent.volume),eo(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=ro[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=io(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 ro={stop:1,destroy:2};var no=function(t,e,i,s,r){Qa(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 so(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ao=function(t,e,i,s){Qa(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 so(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const oo=Phaser.Utils.Objects.GetValue;var ho={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:oo(e,"loop",this.backgroundMusicLoop),mute:oo(e,"mute",this.backgroundMusicMute),volume:oo(e,"volume",this.backgroundMusicVolume),detune:oo(e,"detune",0),rate:oo(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&&no(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ao(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 lo=Phaser.Utils.Objects.GetValue;var co={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:lo(e,"loop",this.backgroundMusicLoop),mute:lo(e,"mute",this.backgroundMusic2Mute),volume:lo(e,"volume",this.backgroundMusic2Volume),detune:lo(e,"detune",0),rate:lo(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&&no(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ao(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 uo=Phaser.Utils.Array.Remove,po=Phaser.Utils.Objects.GetValue;var go={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:po(e,"mute",this.soundEffectsMute),volume:po(e,"volume",this.soundEffectsVolume),detune:po(e,"detune",0),rate:po(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&uo(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&uo(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&&no(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ao(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ao(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&&no(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ao(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ao(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=Zo:t||(t=th),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=ih),this.tagExpression=t,this}setValueExpression(t){return t||(t=ih),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!==ih||this.valueExpression!==ih){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=Zo),void 0===i&&(i=",");for(var s=t.split(i),r=0,n=s.length;r0){var n=this.timeline.addTimer({name:ol,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,hl.call(t,i.remainder)}});break}}else cr(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},ll=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}},dl=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},cl=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 ul=Phaser.Input.Keyboard.KeyCodes;var pl=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)},Ml=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},El=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},_l=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const Rl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Tl(a,s)&&(n=a[1],xr.call(t,`${s}.play`,Ol,[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`,Ml,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Tl(n,s)&&(r=n[1],xr.call(t,`${s}.stop`,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(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(n,s)&&(r=n[1],xr.call(t,`${s}.pause`,El,[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`,_l,[s,r,a],t),e.skipEvent()}}}))}];var Ll=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=Rl,t.createGameObject=kl(t.createGameObject),this.addGameObjectManager(t,Pl)},Bl=function(t,e){return 2===t.length&&t[0]===e},Il=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},Dl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},Al=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])}},zl={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},Fl=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 Yl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Bl(a,s)&&(n=a[1],xr.call(t,`${s}.add`,Il,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Bl(n,s)&&(r=n[1],xr.call(t,`${s}.remove`,Dl,[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`,Al,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&&zl[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`,Fl,[s,h,l,r,n,a,o,d],t),e.skipEvent())}}))}],Xl=Vo.addGameObjectManager;var Wl={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},Xl.call(this,t,e);for(var n=t.parseCallbacks,a=0,o=(n=n?[...n,...Yl]:Yl).length;a0)return ad.length=0,!0;return ad.length=0,!1},ad=[],od=void 0;const hd=Phaser.Utils.Objects.GetValue;var ld=function(t,e,i){var s,r;for(var n in void 0===i&&(i={}),t)s=t[n],void 0!==(r=hd(e,n,s[1]))&&(i[s[0]]=r);return i},dd=function(t){t.addEventListener("touchstart",cd,!1),t.addEventListener("touchmove",cd,!1),t.addEventListener("touchend",cd,!1),t.addEventListener("mousedown",cd,!1),t.addEventListener("mouseup",cd,!1),t.addEventListener("mousemove",cd,!1)},cd=function(t){t.stopPropagation()},ud=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this},pd=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",ud,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.clickOutSideTarget?(Ca.call(this.clickOutSideTarget,this.parent),xa.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)},gd=function(){this.isOpened=!1,this.updateText(),this.enterCloseEnable&&this.scene.input.keyboard.off("keydown-ENTER",ud,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 vd=Phaser.Utils.Objects.GetValue;var fd=function(t,e){var i,s=vd(e,"inputType",void 0);void 0===s&&(s=vd(e,"type","text")),"textarea"===s?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=s;var r=vd(e,"style",void 0),n=i.style;ld(id,r,n),n.position="absolute",n.opacity=0,n.pointerEvents="none",n.zIndex=0,n.transform="scale(0)",ld(ed,e,i),dd(i);var a=t.scene.sys.scale;return(a.isFullscreen?a.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){pd.call(t)})),i.addEventListener("blur",(function(e){gd.call(t)})),i},md={open:function(){return this.isOpened||this.readOnly||((t=this)!==od&&(void 0!==od&&od.close(),od=t),this.node||(this.node=fd(this,this.nodeConfig)),this.setFocus()),this;var t},close:function(){return this.isOpened?(this===od&&(od=void 0),this.setBlur(),this):this}};const yd=Phaser.Utils.Objects.GetValue;class bd extends La{constructor(t,e){super(t);var i=yd(e,"inputType",void 0);void 0===i&&(i=yd(e,"type","text")),this.setEnterCloseEnable(yd(e,"enterClose","textarea"!==i));var s=yd(e,"onOpen",void 0);s||(s=yd(e,"onFocus",void 0)),this.onOpenCallback=s,this.clickOutSideTarget=yd(e,"clickOutSideTarget",void 0);var r=yd(e,"onClose",void 0);r||(r=yd(e,"onBlur",void 0)),this.onCloseCallback=r,this.onUpdateCallback=yd(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 sd(t,e,"inputType"),sd(t,e,"type"),sd(t,e,"style"),sd(t,e,id),sd(t,e,ed),e}(e),this.node=void 0}destroy(){this.close(),this.clickOutSideTarget&&this.clickOutSideTarget.destroy(),super.destroy()}onClickOutside(t){rd(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(bd.prototype,md);var xd=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},Cd=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)):(Cd(this),kd(this)),this}setNumberInput(){return this.onUpdateCallback=xd,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}};const Pd=Phaser.Utils.Objects.GetValue,Td=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Od=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 _d=Phaser.GameObjects.Zone;let Rd=class extends _d{constructor(t){super(t,0,0,2,2),this.fullWindow=new Ed(this)}};var Ld=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},Bd=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)},Id=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}zd.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(Fd(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 Yd=new zd,Xd=/^[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,Wd=/\S/,Vd=new zd;Vd.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Wd.test(t)&&!Wd.test(e)},Vd.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(Nd(t,null,null,i),i," ")},Ud.equals=function(t,e){return zd.prototype.equals.call(Ud,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const $d=new zd;$d.tokenize=function(t){return t.slice()},$d.join=$d.removeEmpty=function(t){return t};const Kd=Phaser.Utils.Array.Remove;var Jd=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Kd(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Yd.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},ec={cursorMoveLeft(){if(!this.isOpened)return this;var t=Zd(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Zd(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Qd(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Zd(tc(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Qd(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Zd(tc(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const ic=Phaser.Utils.Objects.IsPlainObject;class sc extends hn{constructor(t,e,i,s,r,n){ic(e)?n=e:ic(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Od(e,"wrap.vAlign")||P(e,"wrap.vAlign",s=i?"center":"top"),Od(e,"wrap.wrapMode")||P(e,"wrap.wrapMode","char"),Od(e,"wrap.maxLines")||P(e,"wrap.maxLines",s=i?1:void 0),i&&P(e,"wrap.wrapWidth",1/0),Od(e,"wrap.useDefaultTextHeight")||P(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Od(e.edit,"inputType")){var s=i?"text":"textarea";P(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Rd(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=Ld(n.background,"focus"),h=Ld(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=Pd(e,"edit");return void 0===i&&(i={}),sd(e,i,Td),new Sd(t,i)}(this,n),Bd.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),jd.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Ad.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=Kc(t,"tl",0),this.radiusTR=Kc(t,"tr",0),this.radiusBL=Kc(t,"bl",0),this.radiusBR=Kc(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]),_c(this.x,this.y,t),super.updateData(),this}}const qc=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var Zc={buildShapes(){this.addShape((new Jc).setName("box")).addShape((new Nc).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 Qc=Phaser.Utils.Objects.GetValue,tu=Phaser.Math.Linear;class eu extends qa{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=Qc(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Qc(t,"from",i),this.toValue=Qc(t,"to",i),this.setEase(Qc(t,"ease",this.ease)),this.setDuration(Qc(t,"duration",this.duration)),this.setRepeat(Qc(t,"repeat",0)),this.setDelay(Qc(t,"delay",0)),this.setRepeatDelay(Qc(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]=tu(this.fromValue,this.toValue,i)}}var iu={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new eu(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}},su={};Object.assign(su,vc,fc,Zc,iu);const ru=23730,nu=Phaser.Utils.Objects.GetValue,au=Phaser.Utils.Objects.IsPlainObject;class ou extends gc{constructor(t,e,i,s,r,n,a){au(e)?(e=nu(a=e,"x",0),i=nu(a,"y",0),s=nu(a,"width",2),r=nu(a,"height",2),n=nu(a,"color",ru)):au(n)&&(n=nu(a=n,"color",ru)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=ru),this.setBoxShape(nu(a,"circleBox",!1)),this.setBoxFillStyle(n,nu(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(nu(a,"uncheckedColor",null),nu(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(nu(a,"boxLineWidth",4),nu(a,"boxStrokeColor",n),nu(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,nu(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),nu(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(nu(a,"checkerColor",16777215),nu(a,"checkerAlpha",1)),this.setBoxSize(nu(a,"boxSize",1)),this.setCheckerSize(nu(a,"checkerSize",1)),this.setCheckerAnimationDuration(nu(a,"animationDuration",150)),this.buildShapes();var o=nu(a,"checked");void 0===o&&(o=nu(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(ou.prototype,su);const hu=Phaser.Utils.Objects.GetValue;class lu extends La{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(hu(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(hu(t,"enable",!0)),this.setMode(hu(t,"mode",1)),this.setClickInterval(hu(t,"clickInterval",100)),this.setDragThreshold(hu(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=du[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 du={press:0,pointerdown:0,release:1,pointerup:1},cu=Phaser.Utils.Objects.GetValue,uu=Phaser.Utils.Objects.IsPlainObject;class pu extends ou{constructor(t,e,i,s,r,n,a){uu(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",ru)):uu(n)&&(n=cu(a=n,"color",ru)),super(t,e,i,s,r,n,a),this._click=new lu(this,cu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(cu(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 pu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Checkbox",pu);var gu={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}},vu={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}},fu={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}},mu=function(t,e,i){return(e-t)*i+t};const yu=Phaser.Math.Linear;var bu={buildShapes(){this.addShape((new Jc).setName("track")).addShape((new Jc).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&mu(mn(l),mn(d),c))<<16|(255&mu(yn(l),yn(d),c))<<8|255&mu(bn(l),bn(d),c)),p=yu(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=yu(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)}},xu={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new eu(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}},Cu={};Object.assign(Cu,gu,vu,fu,bu,xu);const ku=Phaser.Utils.Objects.GetValue,wu=Phaser.Utils.Objects.IsPlainObject,Su=23730;class Pu extends gc{constructor(t,e,i,s,r,n,a){wu(e)?(e=ku(a=e,"x",0),i=ku(a,"y",0),s=ku(a,"width",2),r=ku(a,"height",2),n=ku(a,"color",Su)):wu(n)&&(n=ku(a=n,"color",Su)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=Su),this.setTrackFillStyle(n,ku(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(ku(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)),ku(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(ku(a,"thumbColor",16777215),ku(a,"thumbAlpha",1)),this.setTrackSize(ku(a,"trackWidth",.9),ku(a,"trackHeight",.5)),this.setTrackRadius(ku(a,"trackRadius",.5*this.trackHeight));var o=ku(a,"thumbHeight",void 0),h=ku(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(ku(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(ku(a,"thumbLeft",.3),ku(a,"thumbRight",void 0)),this.setRTL(ku(a,"rtl",!1)),this.setToggleAnimationDuration(ku(a,"animationDuration",150)),this.buildShapes(),this.setValue(ku(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(Pu.prototype,Cu);const Tu=Phaser.Utils.Objects.GetValue;class Ou extends Pu{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new lu(this,Tu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Tu(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 Ou(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.ToggleSwitch",Ou);var Mu={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 Eu extends Nt{}Object.assign(Eu.prototype,Mu),t.register("canvas",(function(t,e,i,s){var r=new Eu(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.Canvas",Eu);const _u=Phaser.Utils.Objects.GetValue;class Ru 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=_u(i,"maskType",0),r=_u(i,"backgroundColor",void 0),n=_u(i,"strokeColor",void 0),a=_u(i,"strokeWidth",null!=n?10:0);if(void 0===s?s=0:"string"==typeof s&&(s=Lu[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=_u(i,"radius",0),f=_u(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 Lu={circle:0,ellipse:1,roundRectangle:2};t.register("circleMaskImage",(function(t,e,i,s,r){var n=new Ru(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.CircleMaskImage",Ru);const Bu=Phaser.Utils.Objects.GetValue;class Iu 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=Bu(i,"mask.key"),r=Bu(i,"mask.frame"),n=Bu(i,"mask.invertAlpha",!1),a=Bu(i,"mask.scale"),o=Bu(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 Iu(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.AlphaMaskImage",Iu);const Du=Phaser.Math.Linear,Au=Phaser.Math.Percent;var ju={setValue(t,e,i){return null==t||(void 0!==e&&(t=Au(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=Au(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=Du(t,e,i)),i}};const zu=Phaser.Math.Percent;var Fu={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=zu(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new eu(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 eu(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 Yu=Phaser.Utils.Objects.GetValue,Xu=Phaser.Math.Clamp;function Wu(t){class e extends t{bootProgressBase(t){this.eventEmitter=Yu(t,"eventEmitter",this);var e=Yu(t,"valuechangeCallback",null);if(null!==e){var i=Yu(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Yu(t,"easeValue.duration",0)).setEaseValueFunction(Yu(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Xu(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,Fu),e}const Vu=Phaser.Math.RadToDeg,Gu=Phaser.Math.DegToRad;var Hu=function(t,e,i,s,r,n,a,o){var h=360===Math.abs(a-n),l=Gu(n),d=Gu(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},Uu={buildShapes(){var t=this.iterations;this.addShape((new Nc).setIterations(t).setName("track")).addShape((new Nc).setIterations(t).setName("bar")).addShape((new wc).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),Hu(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=Vu(this.startAngle),o=360*(n?1-this.value:this.value)+a),h.fillStyle(this.barColor),Hu(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 Nu=Phaser.Utils.Objects.GetValue,$u=Phaser.Utils.Objects.IsPlainObject,Ku=Phaser.Math.Clamp,Ju=Phaser.Math.DegToRad(270);let qu=class extends(Wu(gc)){constructor(t,e,i,s,r,n,a){$u(e)&&(e=Nu(a=e,"x",0),i=Nu(a,"y",0),s=Nu(a,"radius",1),r=Nu(a,"barColor",void 0),n=Nu(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(Nu(a,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor(Nu(a,"centerColor",void 0)),this.setThickness(Nu(a,"thickness",.2)),this.setStartAngle(Nu(a,"startAngle",Ju)),this.setAnticlockwise(Nu(a,"anticlockwise",!1)),this.iterations=Nu(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=Ku(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(qu.prototype,Uu),t.register("circularProgress",(function(t,e,i,s,r,n){var a=new qu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgress",qu);var Zu=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 Qu=Phaser.Math.PI2;var tp=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(),Zu(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+Qu)%Qu:(o+l*this.value)%Qu,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;Zu(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(),Zu(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 ep=Phaser.Utils.Objects.GetValue,ip=Phaser.Utils.Objects.IsPlainObject,sp=Phaser.Math.Clamp,rp=Phaser.Math.DegToRad(270),np=Phaser.Math.PI2;class ap extends(Wu(Nt)){constructor(t,e,i,s,r,n,a){ip(e)&&(e=ep(a=e,"x",0),i=ep(a,"y",0),s=ep(a,"radius",1),r=ep(a,"barColor",void 0),n=ep(a,"value",0));var o=2*s;super(t,e,i,o,o,ep(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(ep(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(ep(a,"barColor2",void 0)),this.setCenterColor(ep(a,"centerColor",void 0)),this.setThickness(ep(a,"thickness",.2)),this.setStartAngle(ep(a,"startAngle",rp)),this.setEndAngle(ep(a,"endAngle",this.startAngle+np)),this.setAnticlockwise(ep(a,"anticlockwise",!1)),this.setTextColor(ep(a,"textColor",void 0)),this.setTextStrokeColor(ep(a,"textStrokeColor",void 0),ep(a,"textStrokeThickness",void 0));var h=ep(a,"textFont",void 0);h?this.setTextFont(h):this.setTextFont(ep(a,"textSize","16px"),ep(a,"textFamily","Courier"),ep(a,"textStyle","")),this.setTextFormatCallback(ep(a,"textFormatCallback",void 0),ep(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=op(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=op(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=op(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=sp(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(),tp.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 op=function(t,e,i){return i?t<=e?np+t-e:t-e:t>=e?np+e-t:e-t};t.register("circularProgressCanvas",(function(t,e,i,s,r,n){var a=new ap(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgressCanvas",ap);var hp=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 lp=Phaser.Utils.Objects.GetValue,dp=Phaser.Utils.Objects.IsPlainObject;let cp=class extends(Wu(gc)){constructor(t,e,i,s,r,n,a,o){dp(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):dp(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):dp(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 Nc).setName("trackFill")).addShape((new Nc).setName("bar")).addShape((new Nc).setName("trackStroke")),this.setTrackColor(lp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(lp(o,"trackStrokeThickness",2),lp(o,"trackStrokeColor",void 0)),this.setSkewX(lp(o,"skewX",0)),this.setRTL(lp(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 up={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&&hp(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),hp(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&hp(o,0,0,e,i,t)}};Object.assign(cp.prototype,up),t.register("lineProgress",(function(t,e,i,s,r,n,a){var o=new cp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgress",cp);var pp=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},gp=Phaser.Math.RadToDeg,vp=function(t,e,i,s,r){var n=e*r,a=s.tl;if(Et(a)){l=n>a.x?90:gp(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-gp(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-gp(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:gp(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)},fp=Phaser.Math.RadToDeg,mp=function(t,e,i,s,r){var n=i*r,a=s.tl;if(Et(a)){l=n>a.y?90:fp(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:fp(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-fp(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-fp(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)},yp=Phaser.Math.RadToDeg,bp=function(t,e,i,s,r){var n=e*r,a=s.tr;if(Et(a)){l=n>a.x?90:yp(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:yp(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-yp(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-yp(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)},xp=Phaser.Math.RadToDeg,Cp=function(t,e,i,s,r){var n=i*r,a=s.br;if(Et(a)){l=n>a.y?90:xp(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:xp(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-xp(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-xp(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)},kp={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},wp=function(t){return"string"==typeof t&&(t=kp[t]),t};const Sp=Phaser.Utils.Objects.GetValue,Pp=Phaser.Utils.Objects.IsPlainObject;class Tp extends(Wu(gc)){constructor(t,e,i,s,r,n,a,o,h){Pp(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Pp(s)?(s=(h=s).width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Pp(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 Nc).setName("trackFill")).addShape((new Nc).setName("bar")).addShape((new Nc).setName("trackStroke")),this.setTrackColor(Sp(h,"trackColor",void 0)),this.setBarColor(a),this.setTrackStroke(Sp(h,"trackStrokeThickness",2),Sp(h,"trackStrokeColor",void 0)),this.setOrientation(Sp(h,"orientation",0)),this.setRTL(Sp(h,"rtl",!1)),this.rrGeom=new Pt,this.setRadius(n),this.setIteration(Sp(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=wp(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 Op={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&&pp(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?pp(t,e,i,s,o):((0===n?a?bp:vp:a?Cp:mp)(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&&pp(l,t,e,i,a)}};Object.assign(Tp.prototype,Op),t.register("roundRectanleProgress",(function(t,e,i,s,r,n,a,o){var h=new Tp(this.scene,t,e,i,s,r,n,a,o);return this.scene.add.existing(h),h})),P(window,"RexPlugins.UI.RoundRectangleProgress",Tp);var Mp=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(),Mp(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},_p=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 Rp=Phaser.Utils.Objects.GetValue,Lp=Phaser.Utils.Objects.IsPlainObject;class Bp extends(Wu(Nt)){constructor(t,e,i,s,r,n,a,o){Lp(e)?(e=Rp(o=e,"x",0),i=Rp(o,"y",0),s=Rp(o,"width",2),r=Rp(o,"height",2),n=Rp(o,"barColor",void 0),a=Rp(o,"value",0)):Lp(s)?(s=Rp(o=s,"width",2),r=Rp(o,"height",2),n=Rp(o,"barColor",void 0),a=Rp(o,"value",0)):Lp(n)&&(n=Rp(o=n,"barColor",void 0),a=Rp(o,"value",0)),super(t,e,i,s,r,Rp(o,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(o),this.setTrackColor(Rp(o,"trackColor",void 0)),this.setBarColor(n,Rp(o,"barColor2",void 0),Rp(o,"isHorizontalGradient",void 0)),this.setTrackStroke(Rp(o,"trackStrokeThickness",2),Rp(o,"trackStrokeColor",void 0)),this.setSkewX(Rp(o,"skewX",0)),this.setRTL(Rp(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(),Ep.call(this)}),this),this}}t.register("circularProgressCanvas",(function(t,e,i,s,r,n,a){var o=new Bp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgressCanvas",Bp),Phaser.Math.Wrap;const Ip=Phaser.Math.Linear;var Dp=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=Ip(b.a.x,x.a.x,C),e=Ip(b.a.y,x.a.y,C),i=Ip(b.b.x,x.b.x,C),s=Ip(b.b.y,x.b.y,C),r=Ip(b.c.x,x.c.x,C),n=Ip(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const Ap=(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+Ap),i+s*Math.sin(r+Ap)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-Ap),i+s*Math.sin(r-Ap)),this.arrowOnly?t.end():t.close()},zp={buildShapes(){this.addShape((new Nc).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?Dp.call(this):jp.call(this)}},Fp={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new eu(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 Yp=Phaser.Utils.Objects.GetValue,Xp=Phaser.Utils.Objects.IsPlainObject,Wp=Phaser.Math.DegToRad,Vp=Phaser.Math.RadToDeg;class Gp extends gc{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Xp(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=Up(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=Yp(r,"x",null);null!==n?(t=n,i=n):(t=Yp(r,"left",0),i=Yp(r,"right",t));var a=Yp(r,"y",null);null!==a?(e=a,s=a):(e=Yp(r,"top",0),s=Yp(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 Vp(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Wp(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Hp={right:0,down:1,left:2,up:3};var Up=function(t){return"string"==typeof t&&(t=Hp[t]),t%=4};Object.assign(Gp.prototype,zp,Fp),t.register("triangle",(function(t,e,i,s,r,n){var a=new Gp(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Triangle",Gp),F();const Np=Phaser.GameObjects.Zone,$p=Phaser.Utils.Array.Add,Kp=Phaser.Utils.Array.Remove;let Jp=class extends Np{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 $p(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return Kp(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;iig(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eig(t).x,getChildLocalY:t=>ig(t).y};const yg=Phaser.Math.DegToRad;var bg={updateChildRotation(t){var e=ig(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=ig(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 ig(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return ig(t).rotation=yg(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=ig(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>ig(t).rotation},xg={updateChildScale(t){var e=ig(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=ig(t),i=e.parent;return e.scaleX=fg(t.scaleX,i.scaleX),e.scaleY=fg(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=ig(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=ig(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>ig(t).scaleX,getChildLocalScaleY:t=>ig(t).scaleY},Cg={updateChildVisible(t){var e=ig(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=ig(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),ig(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),ig(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=ig(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>ig(t).visible},kg={updateChildAlpha(t){var e=ig(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=ig(t),i=e.parent;return e.alpha=fg(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return ig(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=ig(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>ig(t).alpha},wg={updateChildActive(t){var e=ig(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 ig(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),ig(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=ig(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>ig(t).active},Sg={updateChildScrollFactor(t){var e=ig(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}},Pg={updateCameraFilter(t){var e=ig(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Tg={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}},Og=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},Mg={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}},Eg=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 Rg=Phaser.Utils.Array;var Lg={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Hv=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 Uv=/(\S+)\[(\d+)\]/i;var Nv={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}},$v=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}},Kv=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},Jv=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},qv=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}},Zv=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},Qv=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},tf={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}},ef=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 gm={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=_a(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}},vm={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}},fm={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}},mm={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}},ym={};Object.assign(ym,gm,vm,fm,mm);const bm=Phaser.Utils.Objects.GetValue;class xm extends La{constructor(t,e){super(t,e),this.setTransitInTime(bm(e,"duration.in",200)),this.setTransitOutTime(bm(e,"duration.out",200)),this.setTransitInCallback(bm(e,"transitIn")),this.setTransitOutCallback(bm(e,"transitOut")),this.oneShotMode=bm(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new pm(this,{eventEmitter:!1,initState:bm(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(xm.prototype,ym);const Cm=Phaser.GameObjects.Rectangle;class km extends Cm{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ed(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const wm=Phaser.Utils.Objects.GetValue;class Sm extends La{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(wm(t,"hitAreaMode",0)),this.setEnable(wm(t,"enable",!0)),this.setStopMode(wm(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=Pm[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 Pm={default:0,fullWindow:1};const Tm=Phaser.Utils.Objects.GetValue;class Om extends km{constructor(t,e){super(t,Tm(e,"color",0),Tm(e,"alpha",.8)),this.touchEventStop=new Sm(this,{hitAreaMode:1})}}var Mm={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,mf(t,e)},scaleDown(t,e){yf(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Mf(t,e)},fadeOut(t,e){Ef(t,e,!1)}},Em=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Mf(t,e,t.alpha)},_m=function(t,e){Ef(t,e,!1)},Rm=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Vn(t,!0).contains(e,i)||r&&!r(t,e,i))};const Lm=Phaser.Utils.Objects.GetValue;let Bm=class extends xm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Im.popUp),null==e.transitOut&&(e.transitOut=Im.scaleDown),e.destroy=Lm(e,"destroy",!0),super(t,e);var i=Lm(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Om(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(Lm(i,"transitIn",Em)),this.setCoverTransitOutCallback(Lm(i,"transitOut",_m)));var s=Lm(e,"touchOutsideClose",!1),r=Lm(e,"duration.hold",-1),n=Lm(e,"timeOutClose",r>=0),a=Lm(e,"anyTouchClose",!1);Lm(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),Lm(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&&Rm(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=Im[t]),t){case Im.popUp:t=Mm.popUp;break;case Im.fadeIn:t=Mm.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Im[t]),t){case Im.scaleDown:t=Mm.scaleDown;break;case Im.fadeOut:t=Mm.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Im={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Dm=function(t,e){var i=new Bm(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},Am=function(t,e){t.emit("modal.requestClose",e)},jm=function(t){return t&&"function"==typeof t},zm={modal(t,e){return jm(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=Dm(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 Am(this,t),this}},Fm=function(t,e,i,s,r){jm(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Ym={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 Fm.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Fm.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Fm.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Fm.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Fm.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Fm.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Fm.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Fm.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Fm.call(this,"shutdown",t,e,i,s),this}},Xm=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Wm),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Wm={},Vm=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Rm(t,e.x,e.y,i,s):!!(r=Xm(e,n,!0))&&Rm(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 iy={press:0,pointerdown:0,release:1,pointerup:1};var sy={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 ey(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 ry extends um{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 ny=Phaser.Utils.Objects.GetValue;class ay extends La{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new ry,this.parent.setInteractive(ny(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(ny(t,"enable",!0)),this.setCooldown(ny(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 oy={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Vm(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 ay(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 ay(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}},hy={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}},ly=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=Py,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===Ty&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Py,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=Oy,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Vm(t,s,e,i)}}const Py=0,Ty=1,Oy="IDLE",My=Phaser.Utils.Objects.GetValue,Ey=Phaser.Math.Distance.Between;class _y extends Sy{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=Ry},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(My(t,"time",250)),this.setTapInterval(My(t,"tapInterval",200)),this.setDragThreshold(My(t,"threshold",9)),this.setTapOffset(My(t,"tapOffset",10));var e=My(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(My(t,"maxTaps",void 0)),this.setMinTaps(My(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Ry:this.state=Ly;break;case Ly:var t=this.lastPointer;Ey(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=By,this.state=Ly);break;case By:this.state=Ly}}onDragEnd(){this.state===Ly&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=By))}onDrag(){this.state!==Ry&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Ry)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Ly){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Ry):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=By:this.state=Ry)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===By&&(this.state=Ry)}get isTapped(){return this.state===By}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 Ry="IDLE",Ly="BEGIN",By="RECOGNIZED",Iy=Phaser.Utils.Objects.GetValue;class Dy extends Sy{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=Ay},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Iy(t,"threshold",9)),this.setHoldTime(Iy(t,"time",251)),this}onDragStart(){this.state=jy,0===this.holdTime&&(this.state=zy)}onDragEnd(){this.state=Ay}onDrag(){this.state!==Ay&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Ay)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===jy&&t-this.pointer.downTime>=this.holdTime&&(this.state=zy)}get isPressed(){return this.state===zy}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Ay="IDLE",jy="BEGIN",zy="RECOGNIZED",Fy=Phaser.Utils.Objects.GetValue;class Yy extends Sy{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=Xm(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Xy},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Fy(t,"threshold",10)),this}onDragStart(){this.state=Wy,0===this.dragThreshold&&(this.state=Vy)}onDragEnd(){this.state=Xy}onDrag(){switch(this.state){case Wy:if(this.pointer.getDistance()>=this.dragThreshold){this.state=Vy,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 Vy: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=Xm(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===Vy}setDragThreshold(t){return this.dragThreshold=t,this}}const Xy="IDLE",Wy="BEGIN",Vy="RECOGNIZED",Gy=Phaser.Math.Distance.Between,Hy=Phaser.Math.Angle.Between;var Uy={getDt:function(){return nc(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Gy(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 Hy(e.x,e.y,t.x,t.y)}},Ny={"up&down":0,"left&right":1,"4dir":2,"8dir":3},$y={};const Ky=Phaser.Utils.Objects.GetValue,Jy=Phaser.Math.RadToDeg;class qy extends Sy{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=Zy},eventEmitter:!1};this.setRecongizedStateObject(new um(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Ky(t,"threshold",10)),this.setVelocityThreshold(Ky(t,"velocityThreshold",1e3)),this.setDirectionMode(Ky(t,"dir","8dir")),this}onDragStart(){this.state=Qy}onDragEnd(){this.state=Zy}onDrag(){this.state===Qy&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=tb))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tb&&(this.state=Zy)}get isSwiped(){return this.state===tb}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=Ny[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=$y),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}}(Jy(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(qy.prototype,Uy);const Zy="IDLE",Qy="BEGIN",tb="RECOGNIZED",eb=Phaser.Utils.Objects.GetValue,ib=Phaser.Utils.Array.SpliceOne,sb=Phaser.Math.Distance.Between,rb=Phaser.Math.Angle.Between;class nb{constructor(t,e){var i=_a(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(eb(e,"inputConfig",void 0)),this.setEventEmitter(eb(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(eb(t,"enable",!0)),this.bounds=eb(t,"bounds",void 0),this.tracerState=ob,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 ob:this.tracerState=hb,this.onDrag1Start();break;case hb:this.tracerState=lb,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],ib(this.pointers,e),this.tracerState){case hb:this.tracerState=ob,this.onDrag1End();break;case lb:this.tracerState=hb,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 hb:this.onDrag1();break;case lb:this.onDrag2()}}}dragCancel(){return this.tracerState===lb&&this.onDrag2End(),this.pointers.length=0,q(this.movedState),this.tracerState=ob,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!==lb)return 0;var t=this.pointers[0],e=this.pointers[1];return sb(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==lb)return 0;var t=this.pointers[0],e=this.pointers[1];return rb(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;ab.x=e.x-i.x,ab.y=e.y-i.y}else ab.x=0,ab.y=0;return ab}get centerX(){if(this.tracerState!==lb)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==lb)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==lb)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!==lb)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=db,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Vm(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Vm(t,s,e,i)}}Object.assign(nb.prototype,ln);var ab={};const ob=0,hb=1,lb=2,db="IDLE",cb=Phaser.Utils.Objects.GetValue;class ub extends nb{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=pb},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(cb(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=gb,0===this.dragThreshold&&(this.state=vb)}onDrag2End(){this.state=pb}onDrag2(){switch(this.state){case gb: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=vb}break;case vb:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===vb}setDragThreshold(t){return this.dragThreshold=t,this}}const pb="IDLE",gb="BEGIN",vb="RECOGNIZED",fb=Phaser.Math.RotateAround;var mb=function(t,e,i,s){return fb(t,e,i,s),t.rotation+=s,t},yb={};const bb=Phaser.Utils.Objects.GetValue,xb=Phaser.Math.Angle.WrapDegrees,Cb=Phaser.Math.Angle.ShortestBetween,kb=Phaser.Math.RadToDeg,wb=Phaser.Math.DegToRad;class Sb extends nb{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=Tb},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(bb(t,"threshold",0)),this}onDrag2Start(){this.prevAngle=xb(kb(this.angleBetween)),this.state=Ob,0===this.dragThreshold&&(this.state=Mb)}onDrag2End(){this.state=Tb}onDrag2(){switch(this.state){case Ob:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=xb(kb(this.angleBetween));this.angle=Cb(this.prevAngle,t),this.prevAngle=t,this.state=Mb}break;case Mb:t=xb(kb(this.angleBetween)),this.angle=Cb(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Mb}get rotation(){return wb(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}var Pb={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=yb),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)),(u=this.getSizerConfig(t)).align=i,u.padding=Lv(s),Ub(r)?(u.expandWidth=Nb(r,"width",!1),u.expandHeight=Nb(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?jn(t):n),u.expandHeight&&(t.minHeight=void 0===a?zn(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}};const qb=qg.prototype.clear;var Zb=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),qb.call(this,t),i)for(var s,r=0,n=e.length;r0&&(Gb.width=e.aspectRatio,Gb.height=1,Hb.width=l,Hb.height=d,l=(c=Yb(Gb,Hb,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),Vb(t,this)):nf(t,l,d),s=u+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=v-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=jn(t)),void 0===d&&(d=zn(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,Jm.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(tx,Jb,Qb);var ex=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 ix=Phaser.Utils.Objects.IsPlainObject,sx=Phaser.Utils.Objects.GetValue;class rx extends Fb{constructor(t,e,i,s,r,n){ix(e)?(e=sx(n=e,"x",0),i=sx(n,"y",0),s=sx(n,"width",void 0),r=sx(n,"height",void 0)):ix(s)&&(s=sx(n=s,"width",void 0),r=sx(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 ex(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(rx.prototype,tx);var nx=Phaser.Math.Distance.Between,ax=function(t,e,i){var s=t.width/2;return nx(s,s,e,i)<=s};const ox=Phaser.Math.Angle.Between,hx=Phaser.Math.Angle.Normalize;var lx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;if(ax(s,e,i)){var r=s.width/2,n=s.startAngle,a=ox(r,r,e,i),o=s.anticlockwise?n-a:a-n,h=hx(o)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h)}}},dx=function(){this.sizerChildren.knob.on("pointerdown",lx,this).on("pointermove",lx,this).setInteractive()};const cx=Phaser.Math.Angle.Between,ux=Phaser.Math.Angle.Wrap;var px=function(t,e,i){if(this.enable&&!this.panPointer){var s=this.sizerChildren.knob;ax(s,e,i)&&fx.call(this,t)}},gx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;switch(this.panState){case bx:ax(s,e,i)&&fx.call(this,t);break;case xx:ax(s,e,i)?yx.call(this):mx.call(this)}}},vx=function(t,e,i){this.enable&&this.panPointer===t&&mx.call(this)},fx=function(t){this.panPointer=t,this.panState=xx},mx=function(){this.panPointer=void 0,this.panState=bx},yx=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,s=cx(i.x,i.y,t.x,t.y),r=cx(i.x,i.y,e.x,e.y),n=i.anticlockwise?s-r:r-s,a=ux(n)/(2*Math.PI);this.stopEaseValue(),this.value+=a};const bx=0,xx=1;var Cx=function(){this.sizerChildren.knob.on("pointerdown",px,this).on("pointermove",gx,this).on("pointerup",vx,this).setInteractive(),this.panPointer=void 0,this.panState=bx},kx=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},wx={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:kx,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(kx.call(this,t)),e.layout&&e.layout()),this}};const Sx=Phaser.Utils.Objects.GetValue,Px=Phaser.Math.Snap.To;class Tx extends(Wu(rx)){constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexKnob",this.bootProgressBase(e);var i=Sx(e,"background",void 0),s=Sx(e,"text",void 0);i&&this.addBackground(i),s&&(e.textColor=void 0,e.textStrokeColor=void 0,this.setTextFormatCallback(Sx(e,"textFormatCallback",void 0),Sx(e,"textFormatCallbackScope",void 0)),e.textFormatCallback=void 0,e.textFormatCallbackScope=void 0);var r=new ap(t,e);r.setDepth(Sx(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(Sx(e,"enable",void 0)),this.setGap(Sx(e,"gap",void 0)),this.setValue(Sx(e,"value",0),Sx(e,"min",void 0),Sx(e,"max",void 0));var n=Sx(e,"input",0);switch("string"==typeof n&&(n=Ox[n]),n){case 0:Cx.call(this);break;case 1:dx.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=Px(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 Ox={pan:0,drag:0,click:1,none:-1};Object.assign(Tx.prototype,wx),t.register("knob",(function(t){var e=new Tx(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Knob",Tx);const Mx={arc:kc,circle:wc,curve:class extends xc{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),lk(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(bk.prototype,uk);const Ck={fit:1,FIT:1,envelop:2,ENVELOP:2};t.register("transitionImage",(function(t,e,i,s,r){var n=new bk(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.TransitionImage",bk);const kk=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,wk=Phaser.Utils.Objects.GetValue,Sk=Phaser.Math.Clamp;class Pk extends kk{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(wk(t,"progress",0)),this.setTransitionTargetTexture(wk(t,"toTexture","__DEFAULT"),wk(t,"toFrame",void 0),wk(t,"resizeMode",1)),this.setNoise(wk(t,"noiseX",void 0),wk(t,"noiseY",void 0),wk(t,"noiseZ",void 0)),this.setFromEdge(wk(t,"fromEdgeStart",.01),wk(t,"fromEdgeWidth",.05)),this.setToEdge(wk(t,"toEdgeStart",.01),wk(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=Sk(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=Tk[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 Tk={stretch:0,contain:1,cover:2};const Ok=Phaser.Utils.Array.SpliceOne,Mk=.1,Ek=[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-So(s),t.setChildLocalScale(e,r,r)):(e.visible&&t.setChildVisible(e,!1),r=1-So(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=So(s),r=Math.floor(255*(1-s)),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=So(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 Vx(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=So(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=So(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 Vx(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=So(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=So(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 Vx(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 Vx(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(),Ok(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,Pk),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(Mk,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(Mk,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(Mk,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(Mk,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 _k extends bk{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=Ek.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(gw.prototype,lw),t.register("fileDropZone",(function(t){var e=new gw(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileDropZone",gw);const vw=Phaser.Math.Wrap;var fw=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 xw=Phaser.Utils.Objects.IsPlainObject,Cw=Phaser.Utils.Objects.GetValue,kw=Phaser.Display.Align.CENTER,ww={min:0,full:-1};var Sw=function(t,e,i,s,r,n,a,o,h,l){var d,c,u,p;Iv.call(this,t);var g=t.isRexSpace,v=typeof e;if(null===e)return this;if("number"===v);else if("string"===v)e=ww[e];else if(xw(e)){var f;e=Cw(f=e,"proportion",void 0),i=Cw(f,"align",kw),s=Cw(f,"padding",0),r=Cw(f,"expand",!1),n=Cw(f,"key",void 0),a=Cw(f,"index",void 0),t.isRexSizer||(o=Cw(f,"minWidth",void 0),h=Cw(f,"minHeight",void 0)),l=Cw(f,"fitRatio",0),d=Cw(f,"offsetX",0),c=Cw(f,"offsetY",0),u=Cw(f,"offsetOriginX",0),p=Cw(f,"offsetOriginY",0)}return"string"==typeof i&&(i=tv[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=kw),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=jn(t)/zn(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=Lv(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,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?jn(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},Pw={add:Sw,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Sw.call(this,new yw(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return xw(i)&&(i.index=t),Sw.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=bw.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const Tw=Phaser.Utils.Array.Remove;var Ow={remove(t,e){return this.getParentSizer(t)!==this||(Tw(this.sizerChildren,t),Xv.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,Zb.call(this,t),this}},Mw={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=tv[e]),this.getSizerConfig(t).align=e,this}},Ew={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},_w={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Rw={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}},Lw={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&&(nf(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,ef.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d,c,u=this.sizerChildren,p=this.innerLeft,g=this.innerTop,v=this.innerWidth,f=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=qv.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)||Kv.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&fw.call(this,t,void 0),Jv.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Zv.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&fw.call(this,void 0,t),Qv.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(Lw,Pw,Ow,Mw,Ew,_w,Rw);var Bw=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 Iw=Phaser.Utils.Objects.IsPlainObject,Dw=Phaser.Utils.Objects.GetValue;class Aw extends Fb{constructor(t,e,i,s,r,n,a){Iw(e)?(e=Dw(a=e,"x",0),i=Dw(a,"y",0),s=Dw(a,"width",void 0),r=Dw(a,"height",void 0),n=Dw(a,"orientation",0)):Iw(s)?(s=Dw(a=s,"width",void 0),r=Dw(a,"height",void 0),n=Dw(a,"orientation",0)):Iw(n)&&(n=Dw(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(Dw(a,"space.item",0)),this.setStartChildIndex(Dw(a,"startChildIndex",0)),this.setRTL(Dw(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=wp(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=Bw.call(this)),this._childrenProportion}}Object.assign(Aw.prototype,Lw);var jw=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}},zw={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 Fw extends Aw{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&&(jw(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&&(jw(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&&jw(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&jw(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(Fw.prototype,zw);var Yw=function(t,e,i,s){var r=new sk(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 Xw=Phaser.GameObjects.Text;var Ww=function(t){return t instanceof Xw};const Vw=Phaser.GameObjects.BitmapText;var Gw=function(t){return t instanceof Vw},Hw=function(t){return Gw(t)?2:Ww(t)?0:1},Uw=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},$w=function(t,e){switch(Hw(t)){case 0:switch("string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Uw;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e}},Kw=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):Gw(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 Ww(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 Jw=65535;var qw=function(t,e,i){if(null==e)return t;if(0===e)return tS(t,0,i),t;var s=t.text.length;if(0===s)return tS(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=Qw(t,r,e,i,n),o=0;o<=Jw&&0!==a;o++){if((r+=a)<0){r=0;break}a=Qw(t,r,e,i,n)}return o===Jw&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),tS(t,e,i),t},Zw=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Qw=function(t,e,i,s,r){var n,a=Zw(t,e,r),o=Zw(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)},tS=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 eS=Phaser.Utils.Objects.GetValue;var iS=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=eS(e,"minWidth",0),s=eS(e,"minHeight",0),r=eS(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 qw(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),qw(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const sS=Phaser.Utils.Objects.GetValue;class rS extends Fw{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=sS(e,"background",void 0),r=sS(e,"icon",void 0),n=sS(e,"iconMask",void 0),a=sS(e,"text",void 0),o=sS(e,"action",void 0),h=sS(e,"actionMask",void 0),l=sS(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:sS(e,"space.icon",0),top:sS(e,"space.iconTop",0),bottom:sS(e,"space.iconBottom",0),left:sS(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:sS(e,"space.icon",0),left:sS(e,"space.iconLeft",0),right:sS(e,"space.iconRight",0),top:sS(e,"space.iconTop",0)});var d=sS(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Yw.call(this,r,r,1)),!d){var c=sS(e,"iconSize",void 0);this.setIconSize(sS(e,"iconWidth",c),sS(e,"iconHeight",c))}}if(a){var u=sS(e,"wrapText",!1),p=sS(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),$w(a,u),e.expandTextWidth=!0,Kw(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,iS(a,{fitHeight:!0}));var g,v,f=sS(e,"space.text",0),m=sS(e,"expandTextWidth",!1),y=sS(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:sS(e,"space.actionTop",0),bottom:sS(e,"space.actionBottom",0),right:sS(e,"space.actionRight",0)}:{left:sS(e,"space.actionLeft",0),right:sS(e,"space.actionRight",0),bottom:sS(e,"space.actionBottom",0)},d=sS(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=Yw.call(this,o,o,1)),!d)){var b=sS(e,"actionSize");this.setActionSize(sS(e,"actionWidth",b),sS(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 nS=Phaser.Utils.Objects.GetValue;var aS=function(t,e){var i=nS(e,"canvas"),s=nS(i,"width",128),r=nS(i,"height",128),n=new Eu(t,0,0,s,r);t.add.existing(n);var a=nS(i,"key"),o=nS(i,"frame"),h=nS(i,"fill");return void 0!==h?n.fill(h):void 0!==a&&n.loadTexture(a,o),n.setTexture=n.loadTexture.bind(n),n};const oS=Phaser.Utils.Objects.GetValue;var hS=function(t,e){var i=oS(e,"clickTarget",this);return"string"==typeof i&&(i=t.getElement(i)),i};const lS=Phaser.Utils.Objects.GetValue,dS={accept:"image/*",multiple:!1};var cS=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)}))}},uS={async openPromise(){var t=this;return Zk(this.scene.game,dS).then((function(e){return cS(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}},pS={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(pS,uS);const gS=Phaser.Utils.Objects.GetValue;class vS extends rS{constructor(t,e){var i=function(t,e){var i=new Dk(t,{scaleUp:nS(e,"scaleUpIcon",!1),background:nS(e,"iconBackground"),image:aS(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=hS(this,e),this.clickTarget&&(gS(e,"domButton",!0)?this.fileChooser=function(t){var e=t.scene,i=new nw(e,dS);return e.add.existing(i),t.pin(i),i.on("change",(function(){cS(t,i.files)})),i}(this):this.clickBehavior=function(t,e){var i=hS(t,e);if(i){var s=lS(e,"click"),r=new lu(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(vS.prototype,pS),t.register("imageInputLabel",(function(t){var e=new vS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ImageInputLabel",vS);let fS=class extends La{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 mS=Phaser.Utils.Objects.GetValue;class yS extends La{constructor(t,e){super(t,e),this.style=mS(e,"style",this);var i=mS(e,"propertiesMap");this.activeStyle=bS(e,"active",i),this.hoverStyle=bS(e,"hover",i),this.disableStyle=bS(e,"disable",i),this.onModifyStyle=mS(e,"onModifyStyle")}getStyle(t){return Id(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 Dd(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return xS.call(this,"active",t),this}setHoverState(t){return xS.call(this,"hover",t),this}setDisableState(t){return xS.call(this,"disable",t),this}}var bS=function(t,e,i){var s=Ld(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},xS=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))},CS={addStyleManager(t){return this.styleManager=new yS(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 kS=Phaser.GameObjects.Image,wS=Phaser.Utils.Objects.GetValue;class SS extends kS{constructor(t,e){void 0===e&&(e={}),super(t,wS(e,"x",0),wS(e,"y",0),wS(e,"key",""),wS(e,"frame",void 0)),this.type="rexStatesImage";var i=wS(e,"effects",!0);i&&Mn(this,i),this.style=new fS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(SS.prototype,CS),t.register("statesImage",(function(t){var e=new SS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesImage",SS);class PS extends At{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=TS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const TS={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(PS.prototype,CS),t.register("statesRoundRectangle",(function(t){var e=new PS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesRoundRectangle",PS);let OS=class extends La{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 MS=Phaser.GameObjects.NineSlice,ES=Phaser.Utils.Objects.GetValue;class _S extends MS{constructor(t,e){void 0===e&&(e={}),super(t,ES(e,"x",0),ES(e,"y",0),ES(e,"key",null),ES(e,"frame",null),ES(e,"width",0),ES(e,"height",0),ES(e,"leftWidth",0),ES(e,"rightWidth",0),ES(e,"topHeight",0),ES(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=ES(e,"effects",!0);i&&Mn(this,i),this.style=new OS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_S.prototype,CS),t.register("statesNineSlice",(function(t){var e=new _S(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNineSlice",_S);let RS=class extends La{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 LS=Phaser.Utils.Objects.GetValue;class BS extends k{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=LS(e,"effects",!0);i&&Mn(this,i),this.style=new RS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(BS.prototype,CS),t.register("statesNinePatch",(function(t){var e=new BS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNinePatch",BS);const IS=Phaser.GameObjects.Text,DS=Phaser.Utils.Objects.GetValue;class AS extends IS{constructor(t,e){void 0===e&&(e={}),super(t,DS(e,"x",0),DS(e,"y",0),DS(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(AS.prototype,CS),t.register("statesText",(function(t){var e=new AS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesText",AS);class jS extends La{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 zS=Phaser.GameObjects.BitmapText,FS=Phaser.Utils.Objects.GetValue;class YS extends zS{constructor(t,e){void 0===e&&(e={});var i=FS(e,"x",0),s=FS(e,"y",0),r=FS(e,"font",""),n=FS(e,"fontSize",!1),a=FS(e,"align",0),o=FS(e,"tint");super(t,i,s,r,"",n,a),this.type="rexStatesBitmapText",void 0!==o&&this.setTint(o);var h=FS(e,"effects",!0);h&&Mn(this,h),this.style=new jS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(YS.prototype,CS),t.register("statesBitmapText",(function(t){var e=new YS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBitmapText",YS);class XS extends cp{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=WS,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 WS={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(XS.prototype,CS),t.register("statesBarRectangle",(function(t){var e=new XS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBarRectangle",XS);var VS=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 GS=class extends Eu{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 HS={setChart:function(t){return window.Chart?(this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,VS(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 QS(this.sizerChildren,null),Zb.call(this,t),this}},eP={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)QS(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},nP={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=qv.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,QS(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)QS(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},oP=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const hP=Phaser.Utils.Objects.IsPlainObject,lP=Phaser.Utils.Objects.GetValue;class dP extends Fb{constructor(t,e,i,s,r,n,a,o,h,l){hP(e)?(e=lP(l=e,"x",0),i=lP(l,"y",0),s=lP(l,"width",void 0),r=lP(l,"height",void 0),n=lP(l,"column",l.col||0),a=lP(l,"row",0),o=lP(l,"columnProportions",0),h=lP(l,"rowProportions",0)):hP(s)?(s=lP(l=s,"width",void 0),r=lP(l,"height",void 0),n=lP(l,"column",l.col||0),a=lP(l,"row",0),o=lP(l,"columnProportions",0),h=lP(l,"rowProportions",0)):hP(n)?(n=lP(l=n,"column",l.col||0),a=lP(l,"row",0),o=lP(l,"columnProportions",0),h=lP(l,"rowProportions",0)):hP(o)&&(o=lP(l=o,"columnProportions",0),h=lP(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(lP(l,"createCellContainerCallback")),this.setIndentLeft(lP(l,"space.indentLeftOdd",0),lP(l,"space.indentLeftEven",0)),this.setIndentTop(lP(l,"space.indentTopOdd",0),lP(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,lP(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=aP.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=oP.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(dP.prototype,nP),t.register("gridSizer",(function(t,e,i,s,r,n,a,o,h){var l=new dP(this.scene,t,e,i,s,r,n,a,o,h);return this.scene.add.existing(l),l})),P(window,"RexPlugins.UI.GridSizer",dP);var cP=function(t,e,i,s){return e/t<=i?e/(s-1):0},uP=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=pP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=pP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const vP=Phaser.Utils.Objects.IsPlainObject,fP=Phaser.Utils.Objects.GetValue,mP=Phaser.Display.Align.CENTER;var yP=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(Iv.call(this,t),vP(e)&&(e=fP(h=e,"padding",0),i=fP(h,"key",void 0),s=fP(h,"index",void 0),r=fP(h,"offsetX",0),n=fP(h,"offsetY",0),a=fP(h,"offsetOriginX",0),o=fP(h,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=mP,h.padding=Lv(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,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,n,a,o,h},bP={add(t,e,i){if(Gm(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,Zb.call(this,t),this}},kP={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 uT=Phaser.Utils.Objects.GetValue,pT=Phaser.Math.Distance.Between;class gT extends La{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=uT(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(uT(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(uT(t,"enable",!0)),this.holdThreshold=uT(t,"holdThreshold",50),this.pointerOutReleaseEnable=uT(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 nc(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:pT(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&&!Vm(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&&!Vm(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 vT=Phaser.Utils.Objects.GetValue;class fT{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(vT(t,"value",0)),this.setSpeed(vT(t,"speed",0)),this.setAcceleration(vT(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 mT{constructor(){this.value,this.dir,this.movement=new fT}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 CT={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},kT=Phaser.Utils.Objects.GetValue;class wT extends La{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=kT(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(kT(e,"speed",.1)),this.setEnable(kT(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(kT(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||Vm(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 ST=Phaser.Utils.Objects.GetValue;var PT=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)?ST(s,l,void 0):ST(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 dT(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=ST(r,"position",0);"string"==typeof p&&(p=TT[p]);var g,v,f=ST(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=ST(s,"space.slider",void 0))&&(o?f=0:g=ST(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:ST(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:ST(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:ST(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:ST(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=ST(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=ST(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=ST(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=ST(s,"scrollDetectionMode");"string"==typeof b&&(b=OT[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?ST(s,x,!0):ST(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new xT(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,w,S,P,T=ST(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&h&&(void 0!==b&&(T.focus=1===b?2:0),C=new wT(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 TT={right:0,left:1,bottom:0,top:1},OT={gameObject:0,rectBounds:1},MT=Phaser.Utils.Objects.GetValue;var ET=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=MT(e,"width"),a=MT(e,"height");n||MT(e,"child.expandWidth",!0)||(s[1]=0),a||MT(e,"child.expandHeight",!0)||(r[1]=0);var o=new dP(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=DP(i,"child"),r=DP(s,"gameObject",void 0);if(r){var n=DP(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=DP(n,"top",0),a.bottom=DP(n,"bottom",0),o.left=DP(n,"left",0),o.right=DP(n,"right",0);break;case 1:a.top=DP(n,"left",0),a.bottom=DP(n,"right",0),o.top=DP(n,"top",0),o.bottom=DP(n,"bottom",0);break;default:a.top=DP(n,"top",0),a.bottom=DP(n,"bottom",0),a.left=DP(n,"left",0),a.right=DP(n,"right",0)}e.add(r,{column:1,row:1,align:DP(s,"align","center"),padding:o,expand:{width:DP(s,"expandWidth",!0),height:DP(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:PT(t,o,"y",e);break;case 1:PT(t,o,"x",e);break;default:PT(t,o,"y",e),PT(t,o,"x",e)}return o},_T=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)},RT=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)}},LT=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},FT=function(t){return(t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},YT=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},XT=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},WT=function(t,e){switch(Hw(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}},VT=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&>.call(this)},GT=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)}},HT=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()}},UT={setText:function(t){return void 0!==t&&(this.text=t),this.lines=zT(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(FT.call(this,-this.textOY)),0),e=YT.call(this,t)+this.textOY,i=XT.call(this,t);return WT(this.textObject,i),this.textObject.rexSizer.offsetY=e,VT.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,ef.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,HT.call(this,t,n,a),Sv(t,s,r,n,a,e.align),e.preOffsetY=0,VT.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const NT=Phaser.Utils.Objects.IsPlainObject,$T=Phaser.Utils.Objects.GetValue,KT=Phaser.Display.Align.TOP_LEFT;class JT extends Fb{constructor(t,e,i,s,r,n){NT(e)?(e=$T(n=e,"x",0),i=$T(n,"y",0),s=$T(n,"width",void 0),r=$T(n,"height",void 0)):NT(s)&&(s=$T(n=s,"width",void 0),r=$T(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=$T(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode($T(n,"clampTextOY",!0)),this.alwaysScrollable=$T(n,"alwaysScrollable",!1);var a=$T(n,"background",void 0),o=$T(n,"text",void 0);void 0===o&&(o=qT(t)),this.textCropEnable=$T(n,"textCrop",!!o.setCrop);var h=$T(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=KT,l.padding=Lv(0),l.expand=!0,this.textObject=o,this.textObjectType=Hw(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=Yw.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(FT.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=YT.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 qT=function(t){return t.add.text(0,0,"")};Object.assign(JT.prototype,UT);var ZT={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},QT={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 tO=Phaser.Utils.Objects.GetValue;class eO extends AT{constructor(t,e){void 0===e&&(e={});var i=tO(e,"text",void 0),s=tO(e,"textWidth",void 0),r=tO(e,"textHeight",void 0),n=tO(e,"textCrop",!!i.setCrop),a=tO(e,"textMask",!n),o=tO(e,"content",""),h=new JT(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:tO(e,"clampChildOY",!1),alwaysScrollable:tO(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=tO(e,"space",void 0);l&&(l.child=tO(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(eO.prototype,ZT,QT);const iO=Phaser.Utils.Objects.GetValue;var sO=function(t,e,s){e=e?i(e):{};var r=iO(s,"background",RP),n=iO(s,"text",rO),a=iO(s,"track",RP),o=iO(s,"thumb",RP);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 eO(t,e);return t.add.existing(l),l},rO=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 YS(t,e);break;case"bbcodetext":case"bbcode":s=new ds(t,0,0,"",e);break;case"label":s=new hO(t,e);break;case"textarea":s=sO(t,e);break;default:s=new AS(t,e)}return _P(s,e),t.add.existing(s),s},nO=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 BS(t,e):new _S(t,e);break;case"roundRectangle":s=new PS(t,e);break;default:s=new SS(t,e)}return _P(s,e),t.add.existing(s),s};const aO=Phaser.Utils.Objects.GetValue;var oO=function(t,e,s){e=e?i(e):{};var r=aO(s,"background",RP),n=aO(s,"text",rO),a=aO(s,"icon",nO),o=aO(s,"action",nO);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 hO extends rS{constructor(t,e,i){super(t,e=oO(t,e,i)),this.type="rexSimpleLabel"}setActiveState(t){return lO(this.getChildren(),"setActiveState",t),this}setHoverState(t){return lO(this.getChildren(),"setHoverState",t),this}setDisableState(t){return lO(this.getChildren(),"setDisableState",t),this}}var lO=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=OO(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(Gm(s)||(s=Ic(LO,i,1)),OO(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=IO[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=BO[t]),this.timeUnit=t,this}}var LO=[];const BO={ms:0,s:1,sec:1},IO={abs:0,absolute:0,inc:1,increment:1};var DO=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()},AO={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 jO=Phaser.Utils.Objects.GetValue;class zO extends PO{constructor(t,e){super(t,e),this.type="rexExpBar",this.setTotalEaseDuration(jO(e,"easeDuration",1e3)),this.levelCounter=new TO(jO(e,"levelCounter")),this.player=new RO(this,{scope:this,dtMode:1}),this.levelCounter.on("levelup",DO,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(zO.prototype,AO),t.register("expBar",(function(t){var e=new zO(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ExpBar",zO);const FO=Aw.prototype.add,YO=Aw.prototype.addSpace;var XO=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)&&YO.call(this),FO.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&YO.call(this),this.hasTailSpace=s}else FO.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;FO.call(this,t,{index:r,proportion:i,expand:!0})}else FO.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},WO={addButton(t){if(Gm(t))for(var e=t,i=0,s=e.length;i=0;i--)HO.call(this,e[i],t);return this}},NO=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)}},$O=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,NO.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 lu(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`),$O.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--)cM.call(this,e[i],t);return this}};const pM=Phaser.Utils.Objects.GetValue;class gM extends dP{constructor(t,e){void 0===e&&(e={});var i=pM(e,"row",0),s=pM(e,"column",e.col||0),r=pM(e,"createCellContainerCallback"),n=pM(e,"buttons",void 0),a=pM(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&&vM.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)xM.call(this,e[i],t);return this}};const kM=Phaser.Utils.Objects.GetValue;class wM extends OP{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 iM({parent:this,eventEmitter:kM(e,"eventEmitter",this),groupName:kM(e,"groupName",void 0),clickConfig:kM(e,"click",void 0)}).setButtonsType(e);var s=kM(e,"background",void 0),r=kM(e,"buttons",void 0);this.buttonsAlign=kM(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(wM.prototype,mM,CM,eM,rM),t.register("fixWidthButtons",(function(t){var e=new wM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FixWidthButtons",wM);var SM={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 PM=Phaser.Utils.Objects.GetValue;class TM extends rS{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new nw(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(PM(e,"accept","")),this.setMultiple(PM(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(TM.prototype,SM),t.register("fileSelectorButton",(function(t){var e=new TM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileSelectorButton",TM);var OM={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()}},MM={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,zm.modal.call(this,t,e),this}},EM={};Object.assign(EM,OM,MM);const _M=Phaser.Utils.Objects.GetValue;class RM extends Aw{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexDialog",this.eventEmitter=_M(e,"eventEmitter",this);var i,s,r,n,a=_M(e,"background",void 0),o=_M(e,"title",void 0),h=_M(e,"toolbar",void 0),l=_M(e,"toolbarBackground",void 0),d=_M(e,"leftToolbar",void 0),c=_M(e,"leftToolbarBackground",void 0),u=_M(e,"content",void 0),p=_M(e,"description",void 0),g=_M(e,"choices",void 0),v=_M(e,"choicesBackground",void 0),f=_M(e,"actions",void 0),m=_M(e,"actionsBackground",void 0),y=_M(e,"click",void 0);if(a&&this.addBackground(a),h&&(r=new aM(t,{groupName:"toolbar",background:l,buttons:h,orientation:0,space:{item:_M(e,"space.toolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(r)),d&&(n=new aM(t,{groupName:"leftToolbar",background:c,buttons:d,orientation:0,space:{item:_M(e,"space.leftToolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(n)),o||h||d){var b,x=!!o&&_M(e,"expand.title",!0),C=_M(e,"align.title","center"),k=!(o&&!x&&"center"===C||!o&&(h||d));b=k?new Aw(t,{orientation:0}):new rx(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:_M(e,"space.titleLeft",0),right:_M(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:_M(e,"space.title",0),top:_M(e,"space.titleTop",0)}),P=_M(e,"proportion.title",0),this.add(b,{padding:S,proportion:P,expand:!0})}if(u){var T=_M(e,"align.content","center"),O=_M(e,"space.content",0),M=(S={left:_M(e,"space.contentLeft",0),right:_M(e,"space.contentRight",0),bottom:p||g||f?O:0},P=_M(e,"proportion.content",0),_M(e,"expand.content",!0));this.add(u,{align:T,padding:S,proportion:P,expand:M})}if(p){T=_M(e,"align.description","center");var E=_M(e,"space.description",0);S={left:_M(e,"space.descriptionLeft",0),right:_M(e,"space.descriptionRight",0),bottom:g||f?E:0},P=_M(e,"proportion.description",0),M=_M(e,"expand.description",!0),this.add(p,{align:T,padding:S,proportion:P,expand:M})}if(g){var _=_M(e,"choicesType","").split("-"),R=LM(_,"wrap")?wM:LM(_,"grid")?gM:aM,L=LM(_,"radio")?"radio":LM(_,"checkboxes")?"checkboxes":void 0,B={left:_M(e,"space.choicesBackgroundLeft",0),right:_M(e,"space.choicesBackgroundRight",0),top:_M(e,"space.choicesBackgroundTop",0),bottom:_M(e,"space.choicesBackgroundBottom",0)},I=_M(e,"space.choice",0);R===aM?B.item=I:R===wM?(B.item=I,B.line=_M(e,"space.choiceLine",I)):(B.column=_M(e,"space.choiceColumn",I),B.row=_M(e,"space.choiceRow",I));var D={width:_M(e,"choicesWidth",void 0),height:_M(e,"choicesHeight",void 0),groupName:"choices",buttonsType:L,background:v,buttons:g,space:B,click:y,eventEmitter:this.eventEmitter,setValueCallback:_M(e,"choicesSetValueCallback",void 0),setValueCallbackScope:_M(e,"choicesSetValueCallbackScope",void 0)};R===aM&&(D.orientation=LM(_,"x")?0:1),i=new R(t,D),t.add.existing(i);var A=_M(e,"space.choices",0);S={left:_M(e,"space.choicesLeft",0),right:_M(e,"space.choicesRight",0),bottom:f?A:0},T=_M(e,"align.choices","center"),P=_M(e,"proportion.choices",0),M=_M(e,"expand.choices",!0),this.add(i,{align:T,padding:S,proportion:P,expand:M}),this.buttonsType=L}f&&(s=new aM(t,{groupName:"actions",background:m,buttons:f,orientation:0,space:{item:_M(e,"space.action",0)},expand:_M(e,"expand.actions",!1),align:_M(e,"align.actions","center"),click:y,eventEmitter:this.eventEmitter}),t.add.existing(s),S={left:_M(e,"space.actionsLeft",0),right:_M(e,"space.actionsRight",0),bottom:_M(e,"space.actionsBottom",0)},P=_M(e,"proportion.action",0),this.add(s,{align:"center",padding:S,proportion:P,expand:!0})),IM(this,"click"),IM(this,"over"),IM(this,"out"),IM(this,"enable"),IM(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 LM=function(t,e){return-1!==t.indexOf(e)},BM={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},IM=function(t,e){t.on(`button.${e}`,(function(i,s,r,n,a){BM.hasOwnProperty(s)&&t.emit(`${BM[s]}.${e}`,i,r,n,a)}))};Object.assign(RM.prototype,EM),t.register("dialog",(function(t){var e=new RM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Dialog",RM);var DM=function(t,e,i){var s=new hO(t,e,i);return t.add.existing(s),s},AM=function(t){var e=this.childrenMap.title;null===(t=t.title)?e.hide():(e.show(),e.resetDisplayContent(t))},jM=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)}},zM=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=UE(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(F_.prototype,D_);const Y_=["top","bottom","centerY","center"],X_=["left","right","centerX","center"];var W_=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=Y_.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=X_.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 V_=Phaser.Utils.Objects.GetValue;class G_ extends AT{constructor(t,e){void 0===e&&(e={});var i=BP(e),s=V_(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=V_(e,"clampChildOY",!1),s.clampChildOX=V_(e,"clampChildOX",!1);var r,n,a=new F_(t,s);switch(t.add.existing(a),i){case 0:r=V_(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=V_(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:V_(e,"align.panel","center")};var o=V_(e,"space",void 0);o&&(o.child=V_(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]),Ab(this.childrenMap.child,t),this}}var H_={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:W_.call(this,t,"y",e);break;case 1:W_.call(this,t,"x",e);break;default:W_.call(this,t,"y",e),W_.call(this,t,"x",e)}return this}};Object.assign(G_.prototype,H_);const U_=Phaser.Utils.Objects.GetValue;var N_=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=$_(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=K_(e,this.listCreateSliderTrackCallback),g=K_(e,this.listCreateSliderThumbCallback);d=new G_(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:U_(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=$_(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},$_=function(t,e,i){var s;return i?(e.orientation="x",s=new wM(t,e)):(e.orientation="y",s=new aM(t,e)),t.add.existing(s),s},K_=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s};const J_=Phaser.Utils.Objects.GetValue;var q_=function(t,e){var i=J_(e,"expandDirection",void 0);"string"==typeof i&&(i=Z_[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Od(s=e,r="alignTarget")?J(s,r):n&&Od(s,n)?J(s,n):a&&Od(s,a)?J(s,a):o),c=J_(e,"alignTargetY",d),u=J_(e,"alignOffsetX",0),p=J_(e,"alignOffsetY",0),g=J_(e,"alignSide","").includes("right"),v=J_(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=oa(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const Z_={down:0,up:1},Q_=Phaser.Utils.Objects.GetValue;class tR extends xm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){mf(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 vf(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),q_(t,e),t.isRexSizer&&t.layout();var i=Q_(e,"touchOutsideClose",!1),s=Q_(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&&Rm(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 eR={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}},iR={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=N_.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 tR(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(iR,B_,eR);const sR=Phaser.Utils.Objects.GetValue;class rR extends rS{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(sR(e,"options"));var i=sR(e,"list");this.setWrapEnable(sR(i,"wrap",!1)),this.setCreateButtonCallback(sR(i,"createButtonCallback")),this.setCreateListBackgroundCallback(sR(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(sR(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(sR(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(sR(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(sR(i,"scroller")),this.setListMouseWheelScrollerConfig(sR(i,"mouseWheelScroller")),this.setButtonClickCallback(sR(i,"onButtonClick")),this.setButtonOverCallback(sR(i,"onButtonOver")),this.setButtonOutCallback(sR(i,"onButtonOut")),this.setListExpandDirection(sR(i,"expandDirection")),this.setListEaseInDuration(sR(i,"easeIn",500)),this.setListEaseOutDuration(sR(i,"easeOut",100)),this.setListTransitInCallback(sR(i,"transitIn")),this.settListTransitOutCallback(sR(i,"transitOut")),this.setListMaxHeight(sR(i,"maxHeight",0)),this.setListSize(sR(i,"width"),sR(i,"height",0)),this.setListAlignmentMode(sR(i,"alignParent","text")),this.setListAlignmentSide(sR(i,"alignSide","")),this.setListBounds(sR(i,"bounds")),this.setListSpace(sR(i,"space")),this.setListDraggable(sR(i,"draggable",!1)),this.setValueChangeCallback(sR(e,"setValueCallback"),sR(e,"setValueCallbackScope")),this.setValue(sR(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(rR.prototype,iR),t.register("dropDownList",(function(t){var e=new rR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.DropDownList",rR);var nR=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=oO(t,r,a);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=DM(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 RP(t,l)},delete e.track);var d=e.thumb;return d&&(h.list.createThumbCallback=function(t){return RP(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 aR extends rR{constructor(t,e,i){super(t,e=nR(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(cR,oR,lR,dR);const uR=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class pR extends La{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Hw(this.parent),this.pageStartIndexes=[],this.lines=zT(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(uR(t,"maxLines",void 0)),this.setPageBreak(uR(t,"pageBreak","\f\n")),this.setText(uR(t,"text","")),this.startLineIndex=uR(t,"start",-1),this.endLineIndex=uR(t,"end",void 0);var e=uR(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(Hw(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(pR.prototype,cR);var gR={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?WT(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(je(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},vR=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},fR=function(t,e){for(var i=void 0,s=0;s0?mR(n,t,a=(o=i)-d,o):"";var c,u=e-d;u>0?(o=(a=0)+u,this.insertIndex=o,c=mR(n,t,a,o)):(c="",this.insertIndex=0),r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},bR={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=vR(this.parent,t);n=fR(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)yR.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(bR,gR);const xR=Phaser.Utils.Objects.GetFastValue,CR=Phaser.Utils.Objects.GetValue;class kR extends La{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(CR(t,"wrap",!1)),this.setTypeMode(CR(t,"typeMode",0)),this.setTypingSpeed(CR(t,"speed",333)),this.setTextCallback=xR(t,"setTextCallback",null),this.setTextCallbackScope=xR(t,"setTextCallbackScope",null),this.setTypingContent(xR(t,"text","")),this.typingIndex=xR(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=xR(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=wR[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=je(t);this.textWrapEnable&&(e=function(t,e){switch(Hw(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=vR(this.parent,this.text).length,this}onTyping(){var t=yR.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?WT(this.parent,t):this.parent.setText(t)}}const wR={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(kR.prototype,bR);const SR=Phaser.Utils.Objects.GetValue,PR={page:0,line:1};class TR 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=SR(i,"expandTextWidth",!1),n=SR(i,"expandTextHeight",!1);if(r||n){var a=Hw(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(SR(i,"typingMode","page")),this.page=new pR(s,SR(i,"page",void 0)),this.typing=new kR(s,SR(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=PR[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()}}}(gO)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}t.register("textBox",(function(t){var e=new TR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.TextBox",TR);class OR extends TR{constructor(t,e,i){super(t,e=fO(t,e,i))}}t.register("simpleTextBox",(function(t){var e=new OR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.SimpleTextBox",OR);const MR=Phaser.Utils.Objects.GetValue;class ER extends Aw{constructor(t,e){super(t,e),this.type="rexNumberBar";var i,s,r,n=MR(e,"background",void 0),a=MR(e,"icon",void 0),o=MR(e,"iconMask",void 0),h=MR(e,"slider",void 0),l=MR(e,"text",void 0),d=MR(e,"space.icon",0),c=MR(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=Yw.call(this,a,a,1))),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,h.hasOwnProperty("input")||(h.input=-1),i=new aT(t,h),t.add.existing(i),0===this.orientation?l&&(s={right:c}):l&&(s={bottom:c}),r=0===this.orientation?void 0===MR(h,"width",void 0)?1:0:void 0===MR(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=MR(e,"valuechangeCallback",null);if(null!==u){var p=MR(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,p)}this.setEnable(MR(e,"enable",void 0)),this.setValue(MR(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 ER(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.NumberBar",ER),t.register("scrollBar",(function(t){var e=new dT(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ScrollBar",dT);const _R=Phaser.Utils.Objects.GetValue,RR={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 LR extends rx{constructor(t,e){super(t,e),this.type="rexBadge";var i=_R(e,"background",void 0);i&&this.addBackground(i),this.addChildrenMap("background",i);var s=_R(e,"main",void 0);for(var r in s&&this.add(s,{key:"main",align:"center",expand:!1}),this.addChildrenMap("main",s),RR){var n=_R(e,r,void 0);n&&(this.add(n,{key:r,align:RR[r],expand:!1}),this.addChildrenMap(r,n))}}}t.register("badgeLabel",(function(t){var e=new LR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.BadgeLabel",LR);const BR=rx.prototype.add;var IR=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),BR.call(this,t,e,i,s,r,n,a,o,h),this},DR={add:IR,addPage:IR};const AR=qg.prototype.setChildVisible;var jR={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?(AR.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&&(AR.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(jR,DR);const zR=Phaser.Utils.Objects.GetValue;class FR extends rx{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(zR(e,"swapMode",0)),this.setFadeInDuration(zR(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=YR[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(FR.prototype,jR);const YR={invisible:0,destroy:1};t.register("pages",(function(t){var e=new FR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Pages",FR);const XR=Phaser.GameObjects.Mesh;class WR extends XR{get tint(){return 0===this.vertices.length?16777215:this.vertices[0].color}forceUpdate(){return this.dirtyCache[10]=1,this}}const VR=Phaser.Math.Vector3,GR=Phaser.Math.Matrix4;var HR=new VR,UR=new VR,NR=new GR;const $R=Phaser.Utils.Objects.IsPlainObject,KR=Phaser.Utils.Objects.GetValue,JR=Phaser.Geom.Mesh.GenerateGridVerts,qR=Phaser.Math.RadToDeg,ZR=Phaser.Math.DegToRad,QR=1+1/Math.sin(ZR(45));let tL=class extends WR{constructor(t,e,i,s,r,n){$R(e)&&(e=KR(n=e,"x",0),i=KR(n,"y",0),s=KR(n,"key",null),r=KR(n,"frame",null)),super(t,e,i,s,r),this.type="rexPerspectiveImage",this.setSizeToFrame(),this.resetPerspective(),this.panZ(QR),this.hideCCW=KR(n,"hideCCW",!0);var a=KR(n,"gridWidth",0),o=KR(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,JR({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 qR(this.rotationX)}set angleX(t){this.rotationX=ZR(t)}get rotationY(){return this.modelRotation.y}set rotationY(t){this.modelRotation.y=t}get angleY(){return qR(this.rotationY)}set angleY(t){this.rotationY=ZR(t)}get rotationZ(){return this.modelRotation.z}set rotationZ(t){this.modelRotation.z=t}get angleZ(){return qR(this.rotationZ)}set angleZ(t){this.rotationZ=ZR(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),HR.set(e,i,s),UR.set(r,n,a),NR.fromRotationXYTranslation(UR,HR,!0);for(var o=0,h=t.vertices.length;o=0;i--)this.removePage(e[i].name,t);return this}},YL={top:1,left:3,right:5,bottom:7},XL={top:"bottom",left:"right",right:"left",bottom:"top"},WL={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},VL={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}GB.call(r,s,a.x,a.y)}}(t,s,r,i),t.transitInCallback(e,i,t)},NB={showMessage(t){var e=function(t,e,i){var s=e(t.scene,i,t);if(WB.call(s,(function(){t.removeMessage(s)})),t.displayTime){var r=t.transitInTime+t.displayTime+10;VB.call(s,r,(function(){t.removeMessage(s)}))}return s}(this,this.createMessageLabelCallback,t);return UB(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),VB.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 WI(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},GI={openColorPicker:function(){if(!this.colorPicker){var t=VI.call(this).layout(),e=new tR(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(GI,cI);const HI=Phaser.Utils.Objects.GetValue;class UI extends dI{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(HI(i,"width",160),HI(i,"height",170));var n=HI(i,"background");r=n?function(t){return RP(t,n)}:HI(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(HI(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(HI(i,"expandDirection")),this.setColorPickerEaseInDuration(HI(i,"easeIn",200)),this.setColorPickerEaseOutDuration(HI(i,"easeOut",200)),this.setColorPickerTransitInCallback(HI(i,"transitIn")),this.setColorPickerTransitOutCallback(HI(i,"transitOut")),this.setColorPickerBounds(HI(i,"bounds"));var a=HI(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(HI(o,"height",30)),this.setColorComponentsFormatLabelConfig(HI(o,"formatLabel"));var h=HI(o,"inputText");h||(h=HI(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=HI(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(UI.prototype,GI),t.register("colorInput",(function(t){var e=new UI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInput",UI),t.register("colorInputLite",(function(t){var e=new dI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInputBase",dI),t.register("colorPicker",(function(t){var e=new BI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorPicker",BI),t.register("colorComponents",(function(t){var e=new YI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorComponents",YI);var NI=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. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var yD=function(t,e){var i=Ve(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},bD=function(t,e,i){return RP(t,yD(e,i))},xD={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},CD={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class kD extends QL{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(kD.prototype,xD,CD);const wD=Phaser.Utils.Objects.GetValue,SD=Phaser.Utils.Objects.GetValue;var PD={setBindingTarget(t){for(var e=this.childrenMap.pages.children,i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const zD=Phaser.Utils.Objects.GetValue;class FD extends jw{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=zD(e,"background",void 0),s=zD(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:zD(e,"space.title",0)}});var r=zD(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(FD.prototype,jD,AD);const YD=Phaser.Utils.Objects.GetValue,XD=Phaser.Utils.Objects.GetValue;var WD={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},VD={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class GD extends G_{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(GD.prototype,WD,VD);const HD=Phaser.Utils.Objects.GetValue,UD=Phaser.Utils.Objects.GetValue,ND=Phaser.Utils.Objects.GetValue;var $D={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=ND(t,"onGetValue"),this.onSetValue=ND(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},KD={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},JD={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const qD=Phaser.Utils.Objects.GetValue;class ZD extends jw{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=qD(e,"proportion.title",0),o=qD(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0),a=qD(e,"proportion.inputField",h),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(ZD.prototype,$D,KD,JD);var QD=function(t,e,i){var s=new fD(t,i);return t.add.existing(s),s},tj=function(t){return void 0===t&&(t=jw),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},ej=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=oj(this.styles,"inputRow")||{},r=aj(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return RP(t,yD(e,i))}(this.scene,t,hj(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,s){return"boolean"==typeof e&&(s=e,e=void 0),void 0===s&&(s=!0),lj(this,i(t),e,s),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=aE(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},gj={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var s=t.scene;this.type="rexTweaker.TextAreaInput";var r=e.inputTextArea;void 0===r&&(r={}),r.hasOwnProperty("text")||(r.text=e.inputText),r.hasOwnProperty("slider")||(r.slider=e.slider);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new _B(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"inputText"}),n.on("close",(function(){t.setValue(n.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},vj={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=aE(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const fj=Phaser.Utils.Objects.GetValue,mj=Phaser.Math.Linear,yj=Phaser.Math.Snap.Floor;var bj={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=fj(s,r),a=function(t,e){var i=new aT(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=fj(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=aE(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=fj(e,"proportion.range.inputText",o),t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=mj(t.minValue,t.maxValue,a.value);t.step&&(e=yj(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},xj=function(t,e){var i=new aM(t,e);return t.add.existing(i),i};const Cj=Phaser.Utils.Objects.GetValue;var kj={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.IncDecInput";var r=Cj(e,"incDec")||{},n={text:null,action:null},a=xj(s,{expand:!1}),o=e.defaultExpandWidth?1:0;t.add(a,{proportion:o,expand:!0});var h=e.inputNumber||e.inputText,l=aE(s,h).setNumberInput();l.on("close",(function(){t.setValue(l.value)}));var d=Object.assign(i(n),r.incButton||{}),c=DM(s,d),u=Object.assign(i(n),r.decButton||{}),p=DM(s,u);a.addButton(c),a.addButton(p);var g=r.inputTextIndex||0;a.insert(g,l,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,a.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ColorInput";var r=e.colorInput;void 0===r&&(r={}),r.hasOwnProperty("inputText")||(r.inputText=e.inputText);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new UI(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"colorInput"}),n.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},Sj={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new pu(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},Pj={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new Ou(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},Tj=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=function(t,e){e=nR(t,e);var i=new rR(t,e);return t.add.existing(i),i}(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=Tj(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const Mj=Phaser.Utils.Objects.GetValue;var Ej={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ButtonsInput";var r=e.button?i(e.button):{},n=Mj(r,"expand",!0);n&&(r.align="center"),delete r.expand;var a=xj(s,{expand:n});a.buttonConfig=r,t.add(a,{proportion:1,expand:!0,key:"list"}),a.on("button.click",(function(e,i,s,r){var n=a.options[i];n&&(t._selectedIndex=i,t.setValue(n.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;nr?n:-n),d.localY=u+(c>s?a:-a)}};const tA=Phaser.Utils.Objects.IsPlainObject,eA=Phaser.Utils.Objects.GetValue,iA=Phaser.Math.DegToRad,sA=Phaser.Math.RadToDeg;class rA extends Zj{constructor(t,e,i,s,r){if(tA(e)){var n=e;e=eA(n,"x",0),i=eA(n,"y",0),s=eA(n,"key",null),r=eA(n,"frame",null)}super(t,e,i,s,r),this.type="rexSkewmage",this._skewX=0,this._skewY=0}get skewX(){return this._skewX}set skewX(t){this._skewX=t,Qj(this,this._skewX,this._skewY)}get skewXDeg(){return sA(this._skewX)}set skewXDeg(t){this.skewX=iA(t)}get skewY(){return this._skewY}set skewY(t){this._skewY=t,Qj(this,this._skewX,this._skewY)}get skewYDeg(){return sA(this._skewY)}set skewYDeg(t){this.skewY=iA(t)}setSkewX(t){return this.skewX=t,this}setSkewY(t){return this.skewY=t,this}setSkew(t,e){return void 0===e&&(e=t),this.skewX=t,this.skewY=e,this}setSkewXDeg(t){return this.skewXDeg=t,this}setSkewYDeg(t){return this.skewYDeg=t,this}setSkewDeg(t,e){return void 0===e&&(e=t),this.skewXDeg=t,this.skewYDeg=e,this}}const nA=Phaser.Utils.Objects.IsPlainObject,aA=Phaser.Utils.Objects.GetValue;class oA extends rA{constructor(t,e,i,s,r){if(nA(e)){var n=e;e=aA(n,"x",0),i=aA(n,"y",0),s=aA(n,"width",32),r=aA(n,"height",32)}super(t,e,i,iL(t,s,r),null),this.type="rexSkewRenderTexture",this.rt=this.texture}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.rt.destroy(),this.rt=null)}}class hA extends(OL(oA)){get skewState(){return this.isRunning}}t.register("skew",(function(t,e){return new hA(t,e)})),P(window,"RexPlugins.UI.Skew",hA),t.register("anchor",(function(t,e){return new cf(t,e)})),P(window,"RexPlugins.UI.Anchor",cf),t.register("textTyping",(function(t,e){return new kR(t,e)})),P(window,"RexPlugins.UI.TextTyping",kR),t.register("textPage",(function(t,e){return new pR(t,e)})),P(window,"RexPlugins.UI.TextPage",pR);var lA=void 0;const dA=Phaser.Utils.Objects.GetValue,cA=Phaser.Utils.Objects.Clone;var uA=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"};const pA=Phaser.Utils.Objects.GetValue,gA=Phaser.Utils.Objects.Merge;var vA={open:function(t,e){var i;void 0===t&&(t={}),t=gA(t,this.openConfig),(i=this)!==lA&&(void 0!==lA&&lA.close(),lA=i),Am(t)&&(e=t,t=void 0);var s=pA(t,"inputType",void 0);void 0===s&&(s=pA(t,"type","text")),void 0===e&&(e=pA(t,"onClose",void 0));var r=pA(t,"onOpen",void 0),n=pA(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={}),e=cA(e);var i=t.scene,s=t.style,r=dA(e,"backgroundColor",s.backgroundColor);null===r&&(r="transparent"),e.text=dA(e,"text",t.text),e.fontFamily=dA(e,"fontFamily",s.fontFamily),e.fontSize=dA(e,"fontSize",s.fontSize),e.color=dA(e,"color",s.color),e.backgroundColor=r,e.direction=dA(e,"rtl",s.rtl)?"rtl":"ltr",e.align=dA(e,"align",uA(s)),"rtl"===e.direction&&Ww(t)&&(e.align="right");var n=t.padding;n.left>0&&(e.paddingLeft=`${n.left}px`),n.right>0&&(e.paddingRight=`${n.right}px`),s.backgroundCornerRadius&&(e.borderRadius=dA(e,"borderRadius",`${s.backgroundCornerRadius}px`));var a=new Hk(i,t.x,t.y,dA(e,"width",t.width),dA(e,"height",t.height),e);a.setScale(t.scaleX,t.scaleY).setOrigin(t.originX,t.originY).setScrollFactor(t.scrollFactorX,t.scrollFactorY);var o=t.parentContainer;return o?o.add(a):i.add.existing(a),a}(this.parent,t).on("textchange",(function(t){var e=t.text;n?n(this.parent,e):this.parent.text=e}),this).setFocus(),this.parent.setVisible(!1),this.onClose=e,pA(t,"enterClose","textarea"!==s)&&this.scene.input.keyboard.once("keydown-ENTER",this.close,this),this.delayCall=function(t,e,i){return t.time.delayedCall(0,e,[],i)}(this.scene,(function(){this.scene.input.once("pointerdown",this.close,this),r&&r(this.parent),this.emit("open",this.parent)}),this),this},close:function(){return this===lA&&(lA=void 0),this.parent.setVisible(!0),this.inputText&&(this.inputText.destroy(),this.inputText=void 0),this.delayCall&&(this.delayCall.remove(),this.delayCall=void 0),this.scene.input.keyboard.off("keydown-ENTER",this.close,this),this.scene.input.off("pointerdown",this.close,this),this.onClose&&this.onClose(this.parent),this.emit("close",this.parent),this}};const fA=Phaser.Utils.Objects.GetValue;class mA extends La{constructor(t,e){super(t),this.inputText=void 0,this.onClose=void 0,this.delayCall=void 0,this.setOpenConfig(e),fA(e,"clickEnable",!0)&&t.on("pointerdown",(function(){this.open()}),this).setInteractive()}shutdown(t){this.isShutdown||(this.close(),super.shutdown(t))}setOpenConfig(t){return void 0===t&&(t={}),this.openConfig=t,this}get isOpened(){return void 0!==this.inputText}get text(){return this.isOpened?this.inputText.text:this.parent.text}}Object.assign(mA.prototype,vA),t.register("textEdit",(function(t,e){return new mA(t,e)})),P(window,"RexPlugins.UI.TextEdit",mA),t.register("layerManager",(function(t){return new Ma(this.scene,t)})),P(window,"RexPlugins.UI.LayerManager",Ma);class yA extends Phaser.Plugins.ScenePlugin{constructor(e,i){super(e,i),this.add=new t(e)}boot(){this.scene.events.on("destroy",this.destroy,this)}destroy(){this.add.destroy(),super.destroy()}isInTouching(t,e,i,s){return!!t.visible&&Vm(t,e,i,s)}get viewport(){return oa(this.scene,this.scene.cameras.main,!0)}}var bA={getParentSizer:Zp,getTopmostSizer:Qp,removeFromParent:dE,hide:rm,show:sm,isShown:nm,confirmAction:QM,edit:function(t,e,i){return t._edit||(t._edit=new mA(t,{clickEnable:!1})),t._edit.open(e,i),t._edit},wrapExpandText:Kw,fontSizeExpandText:iS,fontSizeResize:qw,setFontSizeToFitWidth:qw,waitEvent:nl,waitComplete:al,delayPromise:$k,setChildrenInteractive:jb,fadeIn:Mf,fadeOutDestroy:Ef,easeMoveTo:Ff,easeMoveFrom:Yf,modal:Dm,modalPromise:function(t,e){var i=Dm(t,e);return new Promise((function(t,e){i.once("close",(function(e){t(e)}))}))},modalClose:jm,requestDrag:NI,openFileChooser:Zk};return Object.assign(yA.prototype,bA),yA},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexuiplugin=e(); + */var yD=function(t,e){var i=Ve(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},bD=function(t,e,i){return RP(t,yD(e,i))},xD={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},CD={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class kD extends QL{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(kD.prototype,xD,CD);const wD=Phaser.Utils.Objects.GetValue,SD=Phaser.Utils.Objects.GetValue;var PD={setBindingTarget(t){for(var e=this.childrenMap.pages.children,i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const zD=Phaser.Utils.Objects.GetValue;class FD extends Aw{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=zD(e,"background",void 0),s=zD(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:zD(e,"space.title",0)}});var r=zD(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(FD.prototype,AD,jD);const YD=Phaser.Utils.Objects.GetValue,XD=Phaser.Utils.Objects.GetValue;var WD={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},VD={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class GD extends G_{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(GD.prototype,WD,VD);const HD=Phaser.Utils.Objects.GetValue,UD=Phaser.Utils.Objects.GetValue,ND=Phaser.Utils.Objects.GetValue;var $D={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=ND(t,"onGetValue"),this.onSetValue=ND(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},KD={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},JD={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const qD=Phaser.Utils.Objects.GetValue;class ZD extends Aw{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=qD(e,"proportion.title",0),o=qD(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0),a=qD(e,"proportion.inputField",h),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(ZD.prototype,$D,KD,JD);var QD=function(t,e,i){var s=new fD(t,i);return t.add.existing(s),s},tA=function(t){return void 0===t&&(t=Aw),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},eA=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=oA(this.styles,"inputRow")||{},r=aA(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return RP(t,yD(e,i))}(this.scene,t,hA(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,s){return"boolean"==typeof e&&(s=e,e=void 0),void 0===s&&(s=!0),lA(this,i(t),e,s),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=aE(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},gA={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var s=t.scene;this.type="rexTweaker.TextAreaInput";var r=e.inputTextArea;void 0===r&&(r={}),r.hasOwnProperty("text")||(r.text=e.inputText),r.hasOwnProperty("slider")||(r.slider=e.slider);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new _B(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"inputText"}),n.on("close",(function(){t.setValue(n.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},vA={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=aE(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const fA=Phaser.Utils.Objects.GetValue,mA=Phaser.Math.Linear,yA=Phaser.Math.Snap.Floor;var bA={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=fA(s,r),a=function(t,e){var i=new aT(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=fA(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=aE(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=fA(e,"proportion.range.inputText",o),t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=mA(t.minValue,t.maxValue,a.value);t.step&&(e=yA(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},xA=function(t,e){var i=new aM(t,e);return t.add.existing(i),i};const CA=Phaser.Utils.Objects.GetValue;var kA={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.IncDecInput";var r=CA(e,"incDec")||{},n={text:null,action:null},a=xA(s,{expand:!1}),o=e.defaultExpandWidth?1:0;t.add(a,{proportion:o,expand:!0});var h=e.inputNumber||e.inputText,l=aE(s,h).setNumberInput();l.on("close",(function(){t.setValue(l.value)}));var d=Object.assign(i(n),r.incButton||{}),c=DM(s,d),u=Object.assign(i(n),r.decButton||{}),p=DM(s,u);a.addButton(c),a.addButton(p);var g=r.inputTextIndex||0;a.insert(g,l,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,a.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ColorInput";var r=e.colorInput;void 0===r&&(r={}),r.hasOwnProperty("inputText")||(r.inputText=e.inputText);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new UI(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"colorInput"}),n.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},SA={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new pu(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},PA={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new Ou(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},TA=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=function(t,e){e=nR(t,e);var i=new rR(t,e);return t.add.existing(i),i}(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=TA(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const MA=Phaser.Utils.Objects.GetValue;var EA={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ButtonsInput";var r=e.button?i(e.button):{},n=MA(r,"expand",!0);n&&(r.align="center"),delete r.expand;var a=xA(s,{expand:n});a.buttonConfig=r,t.add(a,{proportion:1,expand:!0,key:"list"}),a.on("button.click",(function(e,i,s,r){var n=a.options[i];n&&(t._selectedIndex=i,t.setValue(n.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;nr?n:-n),d.localY=u+(c>s?a:-a)}};const tj=Phaser.Utils.Objects.IsPlainObject,ej=Phaser.Utils.Objects.GetValue,ij=Phaser.Math.DegToRad,sj=Phaser.Math.RadToDeg;class rj extends ZA{constructor(t,e,i,s,r){if(tj(e)){var n=e;e=ej(n,"x",0),i=ej(n,"y",0),s=ej(n,"key",null),r=ej(n,"frame",null)}super(t,e,i,s,r),this.type="rexSkewmage",this._skewX=0,this._skewY=0}get skewX(){return this._skewX}set skewX(t){this._skewX=t,QA(this,this._skewX,this._skewY)}get skewXDeg(){return sj(this._skewX)}set skewXDeg(t){this.skewX=ij(t)}get skewY(){return this._skewY}set skewY(t){this._skewY=t,QA(this,this._skewX,this._skewY)}get skewYDeg(){return sj(this._skewY)}set skewYDeg(t){this.skewY=ij(t)}setSkewX(t){return this.skewX=t,this}setSkewY(t){return this.skewY=t,this}setSkew(t,e){return void 0===e&&(e=t),this.skewX=t,this.skewY=e,this}setSkewXDeg(t){return this.skewXDeg=t,this}setSkewYDeg(t){return this.skewYDeg=t,this}setSkewDeg(t,e){return void 0===e&&(e=t),this.skewXDeg=t,this.skewYDeg=e,this}}const nj=Phaser.Utils.Objects.IsPlainObject,aj=Phaser.Utils.Objects.GetValue;class oj extends rj{constructor(t,e,i,s,r){if(nj(e)){var n=e;e=aj(n,"x",0),i=aj(n,"y",0),s=aj(n,"width",32),r=aj(n,"height",32)}super(t,e,i,iL(t,s,r),null),this.type="rexSkewRenderTexture",this.rt=this.texture}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.rt.destroy(),this.rt=null)}}class hj extends(OL(oj)){get skewState(){return this.isRunning}}t.register("skew",(function(t,e){return new hj(t,e)})),P(window,"RexPlugins.UI.Skew",hj),t.register("anchor",(function(t,e){return new cf(t,e)})),P(window,"RexPlugins.UI.Anchor",cf),t.register("textTyping",(function(t,e){return new kR(t,e)})),P(window,"RexPlugins.UI.TextTyping",kR),t.register("textPage",(function(t,e){return new pR(t,e)})),P(window,"RexPlugins.UI.TextPage",pR);var lj=void 0;const dj=Phaser.Utils.Objects.GetValue,cj=Phaser.Utils.Objects.Clone;var uj=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"};const pj=Phaser.Utils.Objects.GetValue,gj=Phaser.Utils.Objects.Merge;var vj={open:function(t,e){var i;void 0===t&&(t={}),t=gj(t,this.openConfig),(i=this)!==lj&&(void 0!==lj&&lj.close(),lj=i),jm(t)&&(e=t,t=void 0);var s=pj(t,"inputType",void 0);void 0===s&&(s=pj(t,"type","text")),void 0===e&&(e=pj(t,"onClose",void 0));var r=pj(t,"onOpen",void 0),n=pj(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={}),e=cj(e);var i=t.scene,s=t.style,r=dj(e,"backgroundColor",s.backgroundColor);null===r&&(r="transparent"),e.text=dj(e,"text",t.text),e.fontFamily=dj(e,"fontFamily",s.fontFamily),e.fontSize=dj(e,"fontSize",s.fontSize),e.color=dj(e,"color",s.color),e.backgroundColor=r,e.direction=dj(e,"rtl",s.rtl)?"rtl":"ltr",e.align=dj(e,"align",uj(s)),"rtl"===e.direction&&Ww(t)&&(e.align="right");var n=t.padding;n.left>0&&(e.paddingLeft=`${n.left}px`),n.right>0&&(e.paddingRight=`${n.right}px`),s.backgroundCornerRadius&&(e.borderRadius=dj(e,"borderRadius",`${s.backgroundCornerRadius}px`));var a=new Hk(i,t.x,t.y,dj(e,"width",t.width),dj(e,"height",t.height),e);a.setScale(t.scaleX,t.scaleY).setOrigin(t.originX,t.originY).setScrollFactor(t.scrollFactorX,t.scrollFactorY);var o=t.parentContainer;return o?o.add(a):i.add.existing(a),a}(this.parent,t).on("textchange",(function(t){var e=t.text;n?n(this.parent,e):this.parent.text=e}),this).setFocus(),this.parent.setVisible(!1),this.onClose=e,pj(t,"enterClose","textarea"!==s)&&this.scene.input.keyboard.once("keydown-ENTER",this.close,this),this.delayCall=function(t,e,i){return t.time.delayedCall(0,e,[],i)}(this.scene,(function(){this.scene.input.once("pointerdown",this.close,this),r&&r(this.parent),this.emit("open",this.parent)}),this),this},close:function(){return this===lj&&(lj=void 0),this.parent.setVisible(!0),this.inputText&&(this.inputText.destroy(),this.inputText=void 0),this.delayCall&&(this.delayCall.remove(),this.delayCall=void 0),this.scene.input.keyboard.off("keydown-ENTER",this.close,this),this.scene.input.off("pointerdown",this.close,this),this.onClose&&this.onClose(this.parent),this.emit("close",this.parent),this}};const fj=Phaser.Utils.Objects.GetValue;class mj extends La{constructor(t,e){super(t),this.inputText=void 0,this.onClose=void 0,this.delayCall=void 0,this.setOpenConfig(e),fj(e,"clickEnable",!0)&&t.on("pointerdown",(function(){this.open()}),this).setInteractive()}shutdown(t){this.isShutdown||(this.close(),super.shutdown(t))}setOpenConfig(t){return void 0===t&&(t={}),this.openConfig=t,this}get isOpened(){return void 0!==this.inputText}get text(){return this.isOpened?this.inputText.text:this.parent.text}}Object.assign(mj.prototype,vj),t.register("textEdit",(function(t,e){return new mj(t,e)})),P(window,"RexPlugins.UI.TextEdit",mj),t.register("layerManager",(function(t){return new Ma(this.scene,t)})),P(window,"RexPlugins.UI.LayerManager",Ma);class yj extends Phaser.Plugins.ScenePlugin{constructor(e,i){super(e,i),this.add=new t(e)}boot(){this.scene.events.on("destroy",this.destroy,this)}destroy(){this.add.destroy(),super.destroy()}isInTouching(t,e,i,s){return!!t.visible&&Vm(t,e,i,s)}get viewport(){return oa(this.scene,this.scene.cameras.main,!0)}}var bj={getParentSizer:Zp,getTopmostSizer:Qp,removeFromParent:dE,hide:rm,show:sm,isShown:nm,confirmAction:QM,edit:function(t,e,i){return t._edit||(t._edit=new mj(t,{clickEnable:!1})),t._edit.open(e,i),t._edit},wrapExpandText:Kw,fontSizeExpandText:iS,fontSizeResize:qw,setFontSizeToFitWidth:qw,waitEvent:nl,waitComplete:al,delayPromise:$k,setChildrenInteractive:Ab,fadeIn:Mf,fadeOutDestroy:Ef,easeMoveTo:Ff,easeMoveFrom:Yf,modal:Dm,modalPromise:function(t,e){var i=Dm(t,e);return new Promise((function(t,e){i.once("close",(function(e){t(e)}))}))},modalClose:Am,requestDrag:NI,openFileChooser:Zk};return Object.assign(yj.prototype,bj),yj},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexuiplugin=e();