var t,e;t=void 0,e=function(){var t=Phaser.Renderer.WebGL.Utils,e={renderWebGL:function(e,i,s,r){if(0!==i.width&&0!==i.height){s.addToRenderList(i);var n=i.frame,a=n.width,h=n.height,o=t.getTintAppendFloatAlpha,l=e.pipelines.set(i.pipeline,i),u=l.setTexture2D(n.glTexture,i);e.pipelines.preBatch(i),l.batchTexture(i,n.glTexture,a,h,i.x,i.y,a/i.style.resolution,h/i.style.resolution,i.scaleX,i.scaleY,i.rotation,i.flipX,i.flipY,i.scrollFactorX,i.scrollFactorY,i.displayOriginX,i.displayOriginY,0,0,a,h,o(i.tintTopLeft,s.alpha*i._alphaTL),o(i.tintTopRight,s.alpha*i._alphaTR),o(i.tintBottomLeft,s.alpha*i._alphaBL),o(i.tintBottomRight,s.alpha*i._alphaBR),i.tintFill,0,0,s,r,!1,u),e.pipelines.postBatch(i)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const i=Phaser.Display.Canvas.CanvasPool;var s=!1;!function(t){if(!s){void 0===t&&(t=60);var e=Phaser.VERSION.split("."),i=parseInt(e[0]);if(3===i){var r=parseInt(e[1]);r * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ const u=Phaser.Display.Canvas.CanvasPool;var d=function(t){var e=u.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 u.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,u.remove(e),a;var d,g,c=i.getImageData(0,0,h,l).data,p=c.length,f=4*h,v=0,x=!1;for(d=0;do;d--){for(g=0;g0&&this.wrapMode!==f&&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=w[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 l=a[h],u=l[0],g=i?l[1]:this[h],c=l[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=S(t,u,g);else{var p=E(t,u,g);c&&(p=c(p)),this[h]=p}}var f=S(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var v=S(t,"fill",null);null!==v&&(this.color=o(v));var x=S(t,"metrics",!1);return x?this.metrics={ascent:S(x,"ascent",0),descent:S(x,"descent",0),fontSize:S(x,"fontSize",0)}:!e&&this.metrics||(this.metrics=d(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=d(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=S(t,"fontFamily","Courier"),this.fontSize=S(t,"fontSize","16px"),this.fontStyle=S(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=o(t,this.parent.canvas,this.parent.context),this.backgroundColor2=o(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=o(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=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=o(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=o(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=o(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=o(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=o(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=o(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=o(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=o(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=w[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=S(e,"fontFamily",this.fontFamily),this.fontSize=S(e,"fontSize",this.fontSize),this.fontStyle=S(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 T=Phaser.Utils.Objects.GetValue;class R{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=T(t,"x",0),i=T(t,"y",0));var s=this.cornerRadius;s.tl=m(T(t,"tl",void 0),e,i),s.tr=m(T(t,"tr",void 0),e,i),s.bl=m(T(t,"bl",void 0),e,i),s.br=m(T(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){k(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){k(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){k(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){k(this.cornerRadius.br,t)}}var m=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),_(t),t},k=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=T(e,"x",0),t.y=T(e,"y",0)),_(t)},_=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const P=Phaser.Math.DegToRad;var C=function(t){return!t.hasOwnProperty("convex")||t.convex},b=function(t){return t.x>0&&t.y>0},L=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,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,o,l,o,l,180,270,!1,a):L(t,0,0,o,l,90,0,!0,a),u=0,d=l):(t.lineTo(0,0),u=0,d=0),h=x.tr,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,s-o,l,o,l,270,360,!1,a):L(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=x.br,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,s-o,r-l,o,l,0,90,!1,a):L(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=x.bl,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,o,r-l,o,l,90,180,!1,a):L(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())},A={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),M(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 F=Phaser.Utils.Objects.GetValue,I=g,N=c;class W{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=F(t,"text",""),this.x=F(t,"x",0),this.y=F(t,"y",0),this.width=F(t,"width",0);var e=F(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=F(t,"newLineMode",0),this.startIndex=F(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===N&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==I&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===N&&(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 H=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}: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]}(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 U={};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 X=Phaser.Geom.Rectangle;var Y=new j;class K{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&dt(f)){""!==w?a.push(n.getLine(w,E,rt)):0===S&&r>0&&a.push(n.getLine("",0,rt)),a.push(...lt(f,e,ht,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,rt)),w=f,E=v,o=s):(w+=f,E=x),S===O-1&&a.push(n.getLine(w,E,l))}return a},ut=function(t,e){var i;switch(e){case at:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==ct&&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 D({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