UNPKG

phaser3-rex-plugins

Version:
1 lines 920 kB
var t,e;t=void 0,e=function(){class t{constructor(t){this.scene=t,t.events.once("destroy",this.destroy,this)}destroy(){this.scene=null}static register(e,i){t.prototype[e]=i}}var e=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};function i(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>i(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;l<d;l++)void 0===s[l]?h++:"number"==typeof s[l]?o-=s[l]:o-=s[l].width;var c=h>0?o/h:0,u=a.height,p=0;for(l=0,d=r.length;l<d;l++)void 0===r[l]?p++:"number"==typeof r[l]?u-=r[l]:u-=r[l].width;for(var g,v,f,m,b,y=p?u/p:0,x=0,C=0,k=0,w=r.length;k<w;k++){void 0===r[k]&&(r[k]=y),"number"==typeof r[k]&&(r[k]={height:r[k],stretch:k%2}),f=(g=r[k]).height,this.rows.stretch+=0|g.stretch,this.rows.minHeight+=g.stretch>0?0:f,x=0,l=0;for(var S=s.length;l<S;l++){if(void 0===s[l]&&(s[l]=c),"number"==typeof s[l]&&(s[l]={width:s[l],stretch:l%2}),m=(v=s[l]).width,0===k&&(this.columns.stretch+=0|v.stretch,this.columns.minWidth+=v.stretch>0?0:m),m>=1&&f>=1){var T=typeof(b=this.getFrameNameCallback(l,k,e));"string"!==T&&"number"!==T||n.add(b,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,b=0;this._beginDraw();for(var y=0,x=this.rows.count;y<x;y++){o=0===(n=this.rows.data[y]).stretch?n.height*p:i*n.stretch,m=0;for(var C=0,k=this.columns.count;C<k;C++)a=0===(r=this.columns.data[C]).stretch?r.width*u:e*r.stretch,s=this.getFrameNameCallback(C,y,this.baseFrameName),t.has(s)&&a>0&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,y)?0:1)?this._drawImage(this.textureKey,s,m,b,a,o):this._drawTileSprite(this.textureKey,s,m,b,a,o)),m+=a;b+=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),b=c(u,"maxFixedPartScaleX",m),y=c(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(b,y),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 b=Phaser.GameObjects;var y=void 0,x=function(t,e){if(y||(y={},m(t).events.once("destroy",(function(){for(var t in y)y[t].destroy();y=void 0}))),!y.hasOwnProperty(e)){var i=m(t).scene.systemScene;(t=new b[e](i)).setOrigin(0),y[e]=t}return y[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&&"object"==typeof t},T=function(t,e,i,s="."){if(!S(t))return t;if(function(t){return null==t}(e)||""===e||Array.isArray(e)&&0===e.length)return t;if("string"==typeof e&&-1===e.indexOf(s)||"number"==typeof e)return t[e]=i,t;var r=function(t,e){return Array.isArray(t)||(t="string"!=typeof t||""===t.trim()?[]:t.split(e).filter(Boolean)),t}(e,s);if(0===r.length)return t;for(var n=t,a=r.length,o=0;o<a-1;o++){var h=r[o],l=n[h];S(l)||(n[h]={}),n=n[h]}return n[r[a-1]]=i,t};t.register("ninePatch",(function(t,e,i,s,r,n,a,o){var h=new k(this.scene,t,e,i,s,r,n,a,o);return this.scene.add.existing(h),h})),T(window,"RexPlugins.UI.NinePatch",k);const P=Phaser.GameObjects.GetCalcMatrix,O=Phaser.Renderer.Canvas.SetTransform;var M={renderWebGL:function(t,e,i,s){var r=e.getRenderList();if(0!==r.length){i.addToRenderList(e);var n=t.pipelines.set(e.pipeline),a=e.frame.glTexture,o=n.setGameObject(e),h=i.roundPixels,l=P(e,i,s),d=n.calcMatrix.copyFrom(l.calc),c=e._displayOriginX,u=e._displayOriginY,p=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var g=0,v=r.length;g<v;g++)r[g].webglRender(n,d,p,c,u,a,o,h);t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){var r=t.currentContext,n=e.getRenderList();if(0!==n.length&&O(t,r,e,i,s)){i.addToRenderList(e);var a=i.roundPixels,o=-e._displayOriginX,h=-e._displayOriginY;r.translate(o,h);for(var l=0,d=n.length;l<d;l++)n[l].canvasRender(r,o,h,a);r.restore()}}},E=function(t,e){if(this.width===t&&this.height===e)return this;this.width=t,this.height=e,this.updateDisplayOrigin();var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this};const _=Phaser.Utils.Array.Remove;var R=function(){return this.poolManager&&this.poolManager.freeMultiple(this.children.list),this.children.list.length=0,this.lastAppendedChildren.length=0,this.dirty=!0,this},L={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}},B={setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.frame=this.texture.get(e),this},resize:E,setSize:E,addChild:function(t){return this.lastAppendedChildren.length=0,Array.isArray(t)?(this.children.add(t),this.lastAppendedChildren.push(...t)):(this.children.add(t),this.lastAppendedChildren.push(t)),this},removeChild:function(t){return this.poolManager&&this.poolManager.free(t),_(this.children.list,t),this.lastAppendedChildren.length=0,this.dirty=!0,this},removeChildren:R,clear:R,getLastAppendedChildren:function(){return this.lastAppendedChildren},getChildren:function(){return this.children.list}};Object.assign(B,L);class I{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 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;e<i;e++)this.free(t[e]);return this}allocate(t){return this.pools&&this.pools.hasOwnProperty(t)?this.pools[t].pop():null}};var z=!1,F=function(t){if(!z){void 0===t&&(t=60);var e=Phaser.VERSION.split("."),i=parseInt(e[0]);if(3===i){var s=parseInt(e[1]);s<t&&console.error(`Minimum supported version : ${i}.${s}`)}else console.error(`Can't supported version : ${i}`);z=!0}};F();const Y=Phaser.GameObjects.GameObject,W=Phaser.Utils.Objects.IsPlainObject,X=Phaser.Utils.Objects.GetValue,V=Phaser.Structs.List,G=Phaser.Utils.Array.StableSort;class H extends Y{constructor(t,e,i,s,r,n){W(e)&&(e=X(n=e,"x",0),i=X(n,"y",0),s=X(n,"texture"),r=X(n,"frame")),void 0===e&&(e=0),void 0===i&&(i=0),super(t,"rexBlitter"),this.children=new V,this.renderList=[],this.displayListDirty=!1,this.lastAppendedChildren=[];var a=X(n,"reuseBob",!0);this.poolManager=a?new j(n):void 0,this.setTexture(s,r),this.setPosition(e,i),this.setOrigin(0,0),this.clearTint(),this.initPipeline(),this.initPostPipeline()}preDestroy(){this.removeChildren(),this.children.destroy(),this.renderList.length=0,this.poolManager&&this.poolManager.destroy()}getRenderList(){if(this.displayListDirty){this.renderList.length=0;for(var t=!1,e=this.children.list,i=0,s=e.length;i<s;i++){var r=e[i];U(r)&&(this.renderList.push(r),t||(t=0!==r.depth))}t&&G(this.renderList,N),this.displayListDirty=!1}return this.renderList}}var U=function(t){return t.active&&t.visible&&t.alpha>0},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,s){var r=t&&("object"==typeof t||"function"==typeof t),n=s&&("object"==typeof s||"function"==typeof s);if(!r&&!n)return i;var a=String(e);if(r&&a in t)return t[a];if(n&&a in s)return s[a];if(-1===a.indexOf("."))return i;var o=a.split(".");if(r){var h=q(t,o,i);if(h.found)return h.value}if(n){var l=q(s,o,i);if(l.found)return l.value}return i},q=function(t,e,i){for(var s=t,r=i,n=0,a=e.length;n<a;n++){var o=e[n];if(!s||"object"!=typeof s&&"function"!=typeof s||!(o in s))return Z.found=!1,Z;s=r=s[o]}return Z.found=!0,Z.value=r,Z},Z={},Q=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},tt={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:J(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&&Q(this.data),this}};let et=class{constructor(t,e){this.type=e,this.data=void 0,this.setParent(t).reset().setActive()}destroy(){this.parent&&this.parent.removeChild(this)}setParent(t){return this.parent=t,this}setDisplayListDirty(t){return t&&this.parent&&(this.parent.displayListDirty=!0),this}get active(){return this._active}set active(t){this.setDisplayListDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}reset(){this.clearData()}onFree(){this.reset().setActive(!1).setParent()}};Object.assign(et.prototype,tt);const it=Phaser.Math.DegToRad,st=Phaser.Math.RadToDeg,rt=Phaser.Utils.Objects.GetValue;let nt=class extends et{get visible(){return this._visible}set visible(t){this.setDisplayListDirty(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.setDisplayListDirty(!!this._alpha!=!!t),this._alpha=t}setAlpha(t){return this.alpha=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setRotation(t){return this.rotation=t,this}get angle(){return st(this.rotation)}set angle(t){this.rotation=it(t)}setAngle(t){return this.angle=t,this}setScaleX(t){return this.scaleX=t,this}get width(){return this._width}set width(t){this._width=t}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}setScaleY(t){return this.scaleY=t,this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}get height(){return this._height}set height(t){this._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}get displayWidth(){return this._width*this.scaleX}set displayWidth(t){this.scaleX=t/this._width}setDisplayWidth(t,e){return void 0===e&&(e=!1),this.displayWidth=t,e&&(this.scaleY=this.scaleX),this}get displayHeight(){return this._height*this.scaleY}set displayHeight(t){this.scaleY=t/this._height}setDisplayHeight(t,e){return void 0===e&&(e=!1),this.displayHeight=t,e&&(this.scaleX=this.scaleY),this}setOriginX(t){return this.originX=t,this._displayOriginX=this.width*t,this}setOriginY(t){return this.originY=t,this._displayOriginY=this.height*t,this}setOrigin(t,e){return void 0===e&&(e=t),this.setOriginX(t).setOriginY(e),this}get depth(){return this._depth}set depth(t){this.setDisplayListDirty(this._depth!=t),this._depth=t}setDepth(t){return void 0===t&&(t=0),this.depth=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=rt(t,"width",void 0),i=rt(t,"height",void 0),s=rt(t,"scale",void 0),r=rt(t,"scaleX",s),n=rt(t,"scaleY",s);void 0!==e?void 0===i&&void 0===n?this.setWidth(e,!0):this.setWidth(e):void 0!==r?this.setScaleX(r):t.hasOwnProperty("displayWidth")&&this.setDisplayWidth(t.displayWidth),void 0!==i?void 0===e&&void 0===r?this.setHeight(i,!0):this.setHeight(i):void 0!==n?this.setScaleY(n):t.hasOwnProperty("displayHeight")&&this.setDisplayHeight(t.displayHeight);var a=rt(t,"origin",void 0);return void 0!==a?this.setOrigin(a):(t.hasOwnProperty("originX")&&this.setOriginX(t.originX),t.hasOwnProperty("originY")&&this.setOriginY(t.originY)),t.hasOwnProperty("depth")&&this.setDepth(t.depth),this}reset(){return super.reset(),this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setOrigin(0).setDepth(0),this}webglRender(t,e,i,s,r,n,a,o){}canvasRender(t,e,i,s){}};const at=Phaser.GameObjects.Components.TransformMatrix,ot=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var ht=new at;const lt=Phaser.Utils.Objects.IsPlainObject;let dt=class extends nt{constructor(t,e){super(t,K),this._crop=ct(),this.setFrame(e)}get width(){return this._width}set width(t){}get height(){return this._height}set height(t){}setFrame(t){return arguments.length>0&&!lt(t)&&(t=this.parent.texture.get(t)),this.frame=t,t?(this._width=t.realWidth,this._height=t.realHeight):(this._width=0,this._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}setCrop(t,e,i,s){return void 0===t?(this.isCropped=!1,this):this.frame?0===t&&0===e&&i===this._width&&s===this._height?(this.isCropped=!1,this):(this.frame.setCropUVs(this._crop,t,e,i,s,this.flipX,this.flipY),this.isCropped=!0,this):this}reset(){return super.reset(),this.resetFlip().resetTint().setFrame().setCrop(),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 ct=function(t){return void 0===t&&(t={}),t.u0=0,t.v0=0,t.u1=0,t.v1=0,t.x=0,t.y=0,t.width=0,t.height=0,t.flipX=!1,t.flipY=!1,t.cx=0,t.cy=0,t.cw=0,t.ch=0,t},ut={webglRender:function(t,e,i,s,r,n,a,o){var h=this.frame;if(h){var l,d,c,u,p,g,v,f,m=this._width,b=this._height,y=m*this.originX,x=b*this.originY,C=this.x-s,k=this.y-r;if(this.isCropped){var w=this._crop;w.flipX===this.flipX&&w.flipY===this.flipY||h.updateCropUVs(w,this.flipX,this.flipY),l=w.u0,d=w.v0,c=w.u1,u=w.v1,v=w.width,f=w.height,p=w.x,g=w.y}else l=this.frame.u0,d=this.frame.v0,c=this.frame.u1,u=this.frame.v1,v=m,f=b,p=0,g=0;var S=1,T=1;this.flipX&&(C+=m-2*y,S=-1),this.flipY&&(k+=b-2*x,T=-1),ht.applyITRS(C,k,this.rotation,this.scaleX*S,this.scaleY*T),e.multiply(ht,ht);var P=-y+p,O=-x+g,M=P+v,E=O+f,_=ht.setQuad(P,O,M,E,o),R=ot(this.tint,this.alpha*i);t.batchQuad(this.parent,_[0],_[1],_[2],_[3],_[4],_[5],_[6],_[7],l,d,c,u,R,R,R,R,this.tintFill,n,a)}},canvasRender:function(t,e,i,s){var r=this.frame;if(r){t.save();var n,a,o,h,l=this._width,d=this._height,c=l*this.originX,u=d*this.originY,p=this.x-c,g=this.y-u;if(this.isCropped){var v=this._crop;v.flipX===this.flipX&&v.flipY===this.flipY||r.updateCropUVs(v,this.flipX,this.flipY),o=v.cw,h=v.ch,n=v.cx,a=v.cy}else o=r.cutWidth,h=r.cutHeight,n=r.cutX,a=r.cutY;var f=1,m=1;this.flipX&&(p+=l,f=-1),this.flipY&&(g+=d,m=-1);var b=r.source.resolution,y=o/b,x=h/b;s&&(p=Math.floor(p+.5),g=Math.floor(g+.5),y+=.5,x+=.5),t.translate(p,g),t.rotate(this.rotation),t.scale(this.scaleX*f,this.scaleY*m),t.drawImage(r.source.image,n,a,o,h,0,0,y,x),t.restore()}}};Object.assign(dt.prototype,ut);var pt=function(t,e){"string"==typeof e&&(e={frame:e});var i=t.poolManager?t.poolManager.allocate(K):null;return null===i?i=new dt(t):i.setParent(t).setActive(),i.modifyPorperties(e),t.addChild(i),i},gt={_drawImage:function(t,e,i,s,r,n){pt(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=r%o,d=n%h;0===l&&(l=o),0===d&&(d=h);for(var c=Math.ceil(r/o),u=Math.ceil(n/h),p=c-1,g=u-1,v=0;v<c;v++)for(var f=0;f<u;f++){let t=pt(this,{frame:e,x:i+v*o,y:s+f*h});var m=v===p?l:o,b=f===g?d:h;m===o&&b===h||t.setCrop(0,0,m,b)}}};class vt extends(u(H,"rexNinePatch2")){setBaseTexture(t,e,i,s){return this.setTexture(t,e),super.setBaseTexture(t,e,i,s),this}}Object.assign(vt.prototype,gt),t.register("ninePatch2",(function(t,e,i,s,r,n,a,o){var h=new vt(this.scene,t,e,i,s,r,n,a,o);return this.scene.add.existing(h),h})),T(window,"RexPlugins.UI.NinePatch2",vt);var ft=Phaser.Renderer.WebGL.Utils,mt=function(t,e,i,s,r,n){for(var a=ft.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),o=i.pathData,h=i.pathIndexes,l=0;l<h.length;l+=3){var d=2*h[l],c=2*h[l+1],u=2*h[l+2],p=o[d+0]-r,g=o[d+1]-n,v=o[c+0]-r,f=o[c+1]-n,m=o[u+0]-r,b=o[u+1]-n,y=e.getX(p,g),x=e.getY(p,g),C=e.getX(v,f),k=e.getY(v,f),w=e.getX(m,b),S=e.getY(m,b);t.batchTri(i,y,x,C,k,w,S,0,0,1,1,a,a,a,2)}},bt=Phaser.Renderer.WebGL.Utils,yt=function(t,e,i,s,r){var n=t.strokeTint,a=bt.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*i);n.TL=a,n.TR=a,n.BL=a,n.BR=a;var o,h,l=e.isDashed&&!!e.strokePathData,d=l?e.strokePathData:e.pathData,c=d.length-1,u=e.lineWidth,p=u/2,g=d[0]-s,v=d[1]-r;if(e.closePath||(c-=2),l){var f=e.strokePathMask,m=0,b=0;for(y=2;y<c;y+=2)o=d[y]-s,h=d[y+1]-r,f[m]?(t.batchLine(g,v,o,h,p,p,u,b,!1),b++):b=0,g=o,v=h,m++}else for(var y=2;y<c;y+=2)o=d[y]-s,h=d[y+1]-r,t.batchLine(g,v,o,h,p,p,u,y-2,!!e.closePath&&y===c-1),g=o,v=h};const xt=Phaser.GameObjects.GetCalcMatrix;var Ct=function(t,e,i,s){var r=i||e.fillColor,n=s||e.fillAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},kt=function(t,e,i,s){var r=e.pathData;if(r&&!(r.length<4)){var n=r.length-1,a=r[0]-i,o=r[1]-s;t.beginPath(),t.moveTo(a,o),e.closePath||(n-=2);for(var h=2;h<n;h+=2){var l=r[h]-i,d=r[h+1]-s;t.lineTo(l,d)}e.closePath&&t.closePath(),Ct(t,e),t.fill()}},wt=function(t,e,i,s){var r=e.isDashed&&!!e.strokePathData,n=r?e.strokePathData:e.pathData;if(n&&!(n.length<4)){var a=n.length-1,o=n[0]-i,h=n[1]-s;if(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}(t,e),t.beginPath(),e.closePath||(a-=2),r){var l=e.strokePathMask,d=0;for(c=2;c<a;c+=2)u=n[c]-i,p=n[c+1]-s,l[d]&&(t.moveTo(o,h),t.lineTo(u,p)),o=u,h=p,d++}else{t.moveTo(o,h);for(var c=2;c<a;c+=2){var u=n[c]-i,p=n[c+1]-s;t.lineTo(u,p)}e.closePath&&t.closePath()}t.stroke()}};const St=Phaser.Renderer.Canvas.SetTransform;var Tt={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=xt(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&&mt(r,a,e,l,o,h),e.isStroked&&yt(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(St(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY;e.isFilled&&kt(r,e,n,a),e.isStroked&&wt(r,e,n,a),r.restore()}}};const Pt=1e-6,Ot=10,Mt=.5;var Et=function(t,e){return function(t){if(!Array.isArray(t))return null;for(var e=[],i=0,s=t.length;i<s;i++){var r=Number(t[i]);isFinite(r)&&r>0&&e.push(r)}return e.length>0?e:null}(t)||function(t,e){var{segments:i=Ot,drawRatio:s=Mt}=t;if(i=Math.round(i),!isFinite(i)||i<=0)return null;if(!(e>Pt))return null;var r=e/i;if(!(r>Pt))return null;if((s=Math.max(0,Math.min(1,s)))>=.999999)return null;var n=r*s;n<=Pt&&(n=Pt);var a=r-n;return a<=Pt?null:[n,a]}(t,e)},_t=function(t,e,i){if(t&&!(t.length<4)){var s=t.length-1;if(e||(s-=2),!(s<2))for(var r=t[0],n=t[1],a=2;a<s;a+=2){var o=t[a],h=t[a+1];i(r,n,o,h),r=o,n=h}}},Rt=function(t,e,i){void 0===e&&(e={}),void 0===i&&(i={});var{closePath:s=!1,dashPattern:r,dashOffset:n=0}=e,a=function(t,e){var i=0;return _t(t,e,(function(t,e,s,r){var n=s-t,a=r-e;i+=Math.sqrt(n*n+a*a)})),i}(t,s);if(null===(r=Et(r,a)))return null;for(var o=[],h=[],l=0,d=0,c=r.length;d<c;d++)l+=r[d];if(l<=Pt)return i.strokePathData=t?t.slice():[],i.strokePathMask=void 0,i;for(var u=0,p=!0,g=r[u],v=function(){u=(u+1)%r.length,p=!p,g=r[u]},f=function(t,e){return isFinite(t)||(t=0),(t%=e)<0&&(t+=e),t}(n,l);f>Pt;)f<g-Pt?(g-=f,f=0):(f-=g,v());var m=function(t,e,i,s,r){if(0===o.length)o.push(t,e);else{var n=o[o.length-2],a=o[o.length-1];n===t&&a===e||o.push(t,e)}o.push(i,s),h.push(r?1:0)};return _t(t,s,(function(t,e,i,s){var r=i-t,n=s-e,a=Math.sqrt(r*r+n*n);if(!(a<=Pt))for(var o=0;o<a-Pt;){var h=Math.min(g,a-o);if(h<=Pt)v();else{var l=o/a,d=(o+h)/a;m(t+r*l,e+n*l,t+r*d,e+n*d,p),o+=h,(g-=h)<=Pt&&v()}}})),!s&&o.length>=2&&o.push(o[o.length-2],o[o.length-1]),i.strokePathData=o,i.strokePathMask=h,i},Lt={setDashPattern:function(t,e){return this.dashPattern=t,this.dashOffset=e||0,this.isDashed=!!t,this},clearDashPattern:function(){return this.setDashPattern(),this},setDashed:function(t){return void 0===t&&(t=!0),this.isDashed=t,this}},Bt={buildStrokePath:function(){if(this.isDashed){var t=Rt(this.pathData,{closePath:this.closePath,dashPattern:this.dashPattern,dashOffset:this.dashOffset},this);t?(this.strokePathData=t.strokePathData,this.strokePathMask=t.strokePathMask):this.isDashed=!1}return this}};Object.assign(Bt,Lt);const It=Phaser.GameObjects.Shape;class Dt extends It{init(){this.isDashed=!1,this.strokePathData=void 0,this.strokePathMask=void 0,this.dashPattern=void 0,this.dashOffset=0}get fillColor(){return this._fillColor}set fillColor(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this.buildStrokePath(),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(Dt.prototype,Bt,Tt);const At=Phaser.Utils.Objects.GetValue;let jt=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=At(t,"x",0),i=At(t,"y",0));var s=this.cornerRadius;s.tl=zt(At(t,"tl",void 0),e,i),s.tr=zt(At(t,"tr",void 0),e,i),s.bl=zt(At(t,"bl",void 0),e,i),s.br=zt(At(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ft(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ft(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ft(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ft(this.cornerRadius.br,t)}};var zt=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Yt(t),t},Ft=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=At(e,"x",0),t.y=At(e,"y",0)),Yt(t)},Yt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Wt=function(t){return t.x>0&&t.y>0},Xt=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 Vt=Phaser.Math.DegToRad;var Gt=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n<r&&(n+=360);var l=Vt(n-r)/o;r=Vt(r);for(var d=0;d<=o;d++){var c=r+l*d,u=t+i*Math.cos(c),p=e+s*Math.sin(c);Xt(u,p,h)}return h};const Ht=Phaser.Utils.Objects.IsPlainObject,Ut=Phaser.Utils.Objects.GetValue,Nt=Phaser.Geom.Polygon.Earcut;let $t=class extends Dt{constructor(t,e,i,s,r,n,a,o){var h,l,d,c,u,p;if(Ht(e)){var g=e;e=g.x,i=g.y,s=g.width,r=g.height,n=g.radius,a=g.color,o=g.alpha,h=g.strokeColor,l=g.strokeAlpha,d=g.strokeWidth,c=g.shape,u=g.dashPattern,p=g.dashOffset}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=0);var v=new jt;if(super(t,"rexRoundRectangleShape",v),this.init(),this.setShapeType(c),0===this.shapeType){var f=Ut(n,"radius",n);v.setTo(0,0,s,r,f)}else f={x:s/2,y:r/2},v.setTo(0,0,s,r,f);this.setIteration(Ut(n,"iteration",void 0)),this.setPosition(e,i),this.setFillStyle(a,o),void 0===d&&(d=2),this.setStrokeStyle(d,h,l),u&&this.setDashPattern(u,p),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i,s=t.width,r=t.height,n=t.cornerRadius,a=this.iteration+1;if(i=n.tl,Wt(i))if(i.convex){var o=i.x,h=i.y;Gt(o,h,i.x,i.y,180,270,!1,a,e)}else Gt(o=0,h=0,i.x,i.y,90,0,!0,a,e);else Xt(0,0,e);return i=n.tr,Wt(i)?i.convex?(o=s-i.x,h=i.y,Gt(o,h,i.x,i.y,270,360,!1,a,e)):Gt(o=s,h=0,i.x,i.y,180,90,!0,a,e):Xt(s,0,e),i=n.br,Wt(i)?i.convex?(o=s-i.x,h=r-i.y,Gt(o,h,i.x,i.y,0,90,!1,a,e)):Gt(o=s,h=r,i.x,i.y,270,180,!0,a,e):Xt(s,r,e),i=n.bl,Wt(i)?i.convex?(o=i.x,h=r-i.y,Gt(o,h,i.x,i.y,90,180,!1,a,e)):Gt(o=0,h=r,i.x,i.y,360,270,!0,a,e):Xt(0,r,e),e.push(e[0],e[1]),this.pathIndexes=Nt(e),super.updateData(),this}setShapeType(t){return"string"==typeof t&&(t=Kt[t]),this.shapeType=t,this}setSize(t,e){return void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e||(this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,e)),this}get radius(){return this.geom.radius}set radius(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}get radiusTL(){return this.geom.radiusTL}set radiusTL(t){this.geom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.geom.radiusTR}set radiusTR(t){this.geom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.geom.radiusBL}set radiusBL(t){this.geom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.geom.radiusBR}set radiusBR(t){this.geom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.geom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}};const Kt={rectangle:0,circle:1};t.register("roundRectangle",(function(t,e,i,s,r,n,a){var o=new $t(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),T(window,"RexPlugins.UI.RoundRectangle",$t);const Jt=Phaser.Renderer.WebGL.Utils;var qt={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Jt.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Zt=Phaser.Display.Color;var Qt={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=u);var p=d.cutX+a,g=d.cutY+o;return this.context.drawImage(d.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Zt);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},te=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(d,o.source[0].glTexture,!0,0)},ee={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,te(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}};F();const ie=Phaser.Display.Canvas.CanvasPool,se=Phaser.GameObjects.GameObject,re=Phaser.Utils.String.UUID;let ne=class extends se{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=ie.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=re(),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(){ie.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 ae=Phaser.GameObjects.Components;Phaser.Class.mixin(ne,[ae.Alpha,ae.BlendMode,ae.Crop,ae.Depth,ae.Flip,ae.GetBounds,ae.Mask,ae.Origin,ae.Pipeline,ae.PostPipeline,ae.ScrollFactor,ae.Tint,ae.Transform,ae.Visible,qt,Qt,ee]);const oe=Phaser.Utils.String.Pad;var he=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${oe(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}};const le=Phaser.Math.DegToRad;var de=function(t,e,i,s,r,n,a){var o,h,l,d,c,u=new jt(e,i,s,r,n),p=u.minWidth,g=u.minHeight,v=s>=p?1:s/p,f=r>=g?1:r/g,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,ue(o)?(h=o.x*v,l=o.y*f,ce(o)?pe(t,h,l,h,l,180,270,!1,a):pe(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,ue(o)?(h=o.x*v,l=o.y*f,ce(o)?pe(t,s-h,l,h,l,270,360,!1,a):pe(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,ue(o)?(h=o.x*v,l=o.y*f,ce(o)?pe(t,s-h,r-l,h,l,0,90,!1,a):pe(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,ue(o)?(h=o.x*v,l=o.y*f,ce(o)?pe(t,h,r-l,h,l,90,180,!1,a):pe(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()},ce=function(t){return!t.hasOwnProperty("convex")||t.convex},ue=function(t){return t.x>0&&t.y>0},pe=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a<n&&(a+=360),n=le(n),a=le(a),null==h)t.ellipse(e,i,s,r,0,n,a,o);else for(var l,d,c,u=(a-n)/(h+=1),p=0;p<=h;p++)c=n+u*p,l=e+s*Math.cos(c),d=i+r*Math.sin(c),t.lineTo(l,d)},ge=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),function(t,e,i,s,r,n,a,o,h,l,d,c,u){var p;(de(e,i,s,r,n,a,u),null!=o)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,d),o=p),e.fillStyle=o,e.fill());null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())}(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}},ve=function(){ge(this,this.fillStyle,this.strokeStyle,this.lineWidth,this.radius,this.fillColor2,this.isHorizontalGradient,this.iteration)};const fe=Phaser.Utils.Objects.GetValue;let me=class extends ne{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=fe(n,"radius",n),p=fe(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=he(t,this.canvas,this.context),this.dirty|=this._fillStyle!=t,this._fillStyle=t}get fillColor2(){return this._fillColor2}set fillColor2(t){t=he(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=he(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(),ve.call(this)}),this),this}};t.register("roundRectangleCanvas",(function(t,e,i,s,r,n,a,o,h,l){var d=new me(this.scene,t,e,i,s,r,n,a,o,h,l);return this.scene.add.existing(d),d})),T(window,"RexPlugins.UI.RoundRectangleCanvas",me);var be=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},ye=function(t,e,i){e&&!be(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}}))},xe={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<o;a++)n=r[a],this.geom.insertTopSidePoint(n.t,n.x,n.y),ye(this,n.key,r[r.length-1]);else this.geom.insertTopSidePoint(t,e,i),ye(this,s,r[r.length-1]);return this.dirty=!0,this},insertRightSidePoint(t,e,i,s){var r=this.geom.rightSidePoints;if(Array.isArray(t))for(var n,a=0,o=(r=t).length;a<o;a++)n=r[a],this.geom.insertRightSidePoint(n.t,n.x,n.y),ye(this,n.key,r[r.length-1]);else this.geom.insertRightSidePoint(t,e,i),ye(this,s,r[r.length-1]);return this.dirty=!0,this},insertBottomSidePoint(t,e,i,s){var r=this.geom.bottomSidePoints;if(Array.isArray(t))for(var n,a=0,o=(r=t).length;a<o;a++)n=r[a],this.geom.insertBottomSidePoint(n.t,n.x,n.y),ye(this,n.key,r[r.length-1]);else this.geom.insertBottomSidePoint(t,e,i),ye(this,s,r[r.length-1]);return this.dirty=!0,this},insertLeftSidePoint(t,e,i,s){var r=this.geom.leftSidePoints;if(Array.isArray(t))for(var n,a=0,o=(r=t).length;a<o;a++)n=r[a],this.geom.insertLeftSidePoint(n.t,n.x,n.y),ye(this,n.key,r[r.length-1]);else this.geom.insertLeftSidePoint(t,e,i),ye(this,s,r[r.length-1]);return this.dirty=!0,this},clearTopSidePoints(){return this.geom.clearTopSidePoints(),this.dirty=!0,this},clearRightSidePoints(){return this.geom.clearRightSidePoints(),this.dirty=!0,this},clearBottomSidePoints(){return this.geom.clearBottomSidePoints(),this.dirty=!0,this},clearLeftSidePoints(){return this.geom.clearLeftSidePoints(),this.dirty=!0,this},clearAllSidesPoints(){return this.geom.clearAllSidesPoints(),this.dirty=!0,this}};class Ce{constructor(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),this.setTo(t,e,i,s),this.tlx=0,this.tly=0,this.trx=0,this.try=0,this.blx=0,this.bly=0,this.brx=0,this.bry=0,this.topSidePoints=[],this.rightSidePoints=[],this.bottomSidePoints=[],this.leftSidePoints=[]}setTo(t,e,i,s){return this.setPosition(t,e),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setSize(t,e){return this.width=t,this.height=e,this}setTLPosition(t,e){return this.tlx=t,this.tly=e,this}setTRPosition(t,e){return this.trx=t,this.try=e,this}setBLPosition(t,e){return this.blx=t,this.bly=e,this}setBRPosition(t,e){return this.brx=t,this.bry=e,this}resetCornerPosition(){return this.setTLPosition(0,0).setTRPosition(0,0).setBLPosition(0,0).setBRPosition(0,0),this}insertTopSidePoint(t,e,i){return ke(this.topSidePoints,t,e,i),this}insertRightSidePoint(t,e,i){return ke(this.rightSidePoints,t,e,i),this}insertBottomSidePoint(t,e,i){return ke(this.bottomSidePoints,t,e,i),this}insertLeftSidePoint(t,e,i){return ke(this.leftSidePoints,t,e,i),this}clearTopSidePoints(){return this.topSidePoints.length=0,this}clearRightSidePoints(){return this.rightSidePoints.length=0,this}clearBottomSidePoints(){return this.bottomSidePoints.length=0,this}clearLeftSidePoints(){return this.leftSidePoints.length=0,this}clearAllSidesPoints(){return this.clearTopSidePoints().clearRightSidePoints().clearBottomSidePoints().clearLeftSidePoints(),this}}var ke=function(t,e,i,s){if("number"!=typeof e){var r=e;e=r.t,i=r.x,s=r.y}t.push({t:e,x:i,y:s})};const we=Phaser.Utils.Objects.IsPlainObject,Se=Phaser.Utils.Objects.GetValue,Te=Phaser.Math.Linear,Pe=Phaser.Geom.Polygon.Earcut;class Oe extends Dt{constructor(t,e,i,s,r,n,a){var o,h,l;if(we(e)){var d=e;e=d.x,i=d.y,s=d.width,r=d.height,n=d.color,a=d.alpha,o=d.strokeColor,h=d.strokeAlpha,l=d.strokeWidth}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s);var c=new Ce;super(t,"rexQuadShape",c),this.init(),c.setTo(0,0,s,r),this.setPosition(e,i),this.setFillStyle(n,a),void 0!==o&&void 0===l&&(l=2),this.setStrokeStyle(l,o,h),this.setTLPosition(Se(d,"tlx",0),Se(d,"tly",0)).setTRPosition(Se(d,"trx",0),Se(d,"try",0)).setBLPosition(Se(d,"blx",0),Se(d,"bly",0)).setBRPosition(Se(d,"brx",0),Se(d,"bry",0));var u=Se(d,"leftSidePoints");u&&this.insertLeftSidePoint(u);var p=Se(d,"topSidePoints");p&&this.insertTopSidePoint(p);var g=Se(d,"rightSidePoints");g&&this.insertRightSidePoint(g);var v=Se(d,"bottomSidePoints");v&&this.insertBottomSidePoint(v),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i=t.width,s=t.height,r=0+t.tlx,n=0+t.tly,a=i+t.trx,o=0+t.try,h=i+t.brx,l=s+t.bry,d=0+t.blx,c=s+t.bly,u=t.topSidePoints,p=t.rightSidePoints,g=t.bottomSidePoints,v=t.leftSidePoints;Xt(r,n,e),Me(u);for(var f=0,m=u.length;f<m;f++){var b=u[f],y=Te(r,a,b.t)+b.x,x=Te(n,o,b.t)+b.y;Xt(y,x,e)}for(Xt(a,o,e),Me(p),f=0,m=p.length;f<m;f++)b=p[f],y=Te(a,h,b.t)+b.x,x=Te(o,l,b.t)+b.y,Xt(y,x,e);for(Xt(h,l,e),Me(g),f=g.length-1;f>=0;f--)b=g[f],y=Te(d,h,b.t)+b.x,x=Te(c,l,b.t)+b.y,Xt(y,x,e);for(Xt(d,c,e),Me(v),f=v.length-1;f>=0;f--)b=v[f],y=Te(r,d,b.t)+b.x,x=Te(n,c,b.t)+b.y,Xt(y,x,e);return e.push(e[0],e[1]),this.pathIndexes=Pe(e),super.updateData(),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 Me=function(t){t.length<=1||t.sort((function(t,e){return t.t-e.t}))};Object.assign(Oe.prototype,xe),t.register("QuadShape",(function(t,e,i,s,r,n){var a=new Oe(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),T(window,"RexPlugins.UI.QuadShape",Oe);var Ee=Phaser.Renderer.WebGL.Utils,_e={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=Ee.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.displa