-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrexuiplugin.min.js
More file actions
1 lines (1 loc) · 430 KB
/
rexuiplugin.min.js
File metadata and controls
1 lines (1 loc) · 430 KB
1
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexuiplugin=e()}(this,function(){"use strict";function P(t){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function B(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function m(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}function w(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}function C(t){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function z(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function T(n){var s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=C(n);if(s){var i=C(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return z(t)}(this,t)}}function l(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=C(t)););return t}function O(t,e,i){return(O="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=l(t,e);if(n){var s=Object.getOwnPropertyDescriptor(n,e);return s.get?s.get.call(i):s.value}})(t,e,i||t)}function r(t,e,i,n){return(r="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,i,n){var s,r,o,a,h=l(t,e);if(h){if((s=Object.getOwnPropertyDescriptor(h,e)).set)return s.set.call(n,i),!0;if(!s.writable)return!1}if(s=Object.getOwnPropertyDescriptor(n,e)){if(!s.writable)return!1;s.value=i,Object.defineProperty(n,e,s)}else a=i,(o=e)in(r=n)?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a;return!0})(t,e,i,n)}function e(t,e,i,n,s){if(!r(t,e,i,n||t)&&s)throw new Error("failed to set property");return i}function S(t){return function(t){if(Array.isArray(t))return t}(t)||s(t)||o(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(t){return function(t){if(Array.isArray(t))return a(t)}(t)||s(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function E(t){var e,i,n;if("object"!==P(t)||null===t)return t;for(n in e=Array.isArray(t)?[]:{},t)i=t[n],e[n]=E(i);return e}function _(t,e,i){return void 0===i&&(i="image"),t[e]||(t[e]=t.scene.make[i]({add:!1,origin:{x:0,y:0}}),t.once("destroy",function(){t[e]&&(t[e].destroy(),t[e]=void 0)})),t[e]}function h(t,e,i){return"__BASE"===i?"".concat(t,",").concat(e):"".concat(i,"_").concat(t,",").concat(e)}var u=function(){function i(t){B(this,i),this.scene=t,this.displayList=t.sys.displayList,this.updateList=t.sys.updateList,t.events.once("destroy",this.destroy,this)}return m(i,[{key:"destroy",value:function(){this.scene=null,this.displayList=null,this.updateList=null}}],[{key:"register",value:function(t,e){i.prototype[t]=e}}]),i}(),c=Phaser.Utils.Objects.IsPlainObject,d=Phaser.Utils.Objects.GetValue,f=function(t){return"string"==typeof t&&(t=p[t]),t},p={scale:0,repeat:1},t={setTexture:function(t,e,i,n){Array.isArray(e)&&(n=i,i=e,e=void 0),void 0===e&&(e="__BASE"),i=E(i),n=E(n),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=n,this.rows.count=n?n.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var s=this.scene.textures.get(t);if(!s)return this.clear(),this;if(!i||!n)return this.clear(),this;for(var r=s.frames[e],o=r.width,a=0,h=0,l=i.length;h<l;h++)void 0===i[h]?a++:"number"==typeof i[h]?o-=i[h]:o-=i[h].width;var u=o/a,c=r.height,d=0;for(h=0,l=n.length;h<l;h++)void 0===n[h]?d++:"number"==typeof n[h]?c-=n[h]:c-=n[h].width;for(var f,p,v,g,y,k=c/d,m=0,b=0,x=0,C=n.length;x<C;x++){void 0===n[x]&&(n[x]=k),"number"==typeof n[x]&&(n[x]={height:n[x],stretch:x%2}),v=(f=n[x]).height,this.rows.stretch+=0|f.stretch,this.rows.minHeight+=0<f.stretch?0:v;h=m=0;for(var w=i.length;h<w;h++){if(void 0===i[h]&&(i[h]=u),"number"==typeof i[h]&&(i[h]={width:i[h],stretch:h%2}),g=(p=i[h]).width,0===x&&(this.columns.stretch+=0|p.stretch,this.columns.minWidth+=0<p.stretch?0:g),1<=g&&1<=v){var S=P(y=this.getFrameNameCallback(h,x,e));"string"!==S&&"number"!==S||s.add(y,0,m+r.cutX,b+r.cutY,g,v)}m+=g}b+=v}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.textures.get(this.textureKey);if(!t)return this;var e,i,n,s,r,o,a,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=0<=u?this.maxFixedPartScaleX:this.width/h,f=0<=c?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var p=Math.min(d,f);if(p<d){var v=(d-p)*h;0<=u?u+=v:u=v,d=p}if(p<f){var g=(f-p)*l;0<=c?c+=g:c=g,f=p}}this.columns.scale=d,this.rows.scale=f,e=0<u&&0<this.columns.stretch?u/this.columns.stretch:0,i=0<c&&0<this.rows.stretch?c/this.rows.stretch:0;for(var y,k=0,m=0,b=0,x=this.rows.count;b<x;b++){a=0===(r=this.rows.data[b]).stretch?r.height*f:i*r.stretch;for(var C=k=0,w=this.columns.count;C<w;C++)o=0===(s=this.columns.data[C]).stretch?s.width*d:e*s.stretch,n=this.getFrameNameCallback(C,b,this.baseFrameName),t.has(n)&&0<o&&0<a&&(0===(0===r.stretch&&0===s.stretch||0===this.getStretchMode(C,b)?0:1)?(y=_(this,"_image","image")).setTexture(this.textureKey,n).setDisplaySize(o,a):(y=_(this,"_tileSprite","tileSprite")).setTexture(this.textureKey,n).setSize(o,a)),y&&(this.draw(y,k,m),y=void 0),k+=o;m+=a}},setStretchMode:function(t){return c(t)?(this.stretchMode.edge=f(d(t,"edge",0)),this.stretchMode.internal=f(d(t,"internal",0))):(t=f(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1}.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}},g=Phaser.GameObjects.RenderTexture,y=Phaser.Utils.Objects.IsPlainObject,k=Phaser.Utils.Objects.GetValue,v=function(){w(v,g);var p=T(v);function v(t,e,i,n,s,r,o,a,h,l){var u;B(this,v),y(e)?(e=k(l=e,"x",0),i=k(l,"y",0),n=k(l,"width",1),s=k(l,"height",1),r=k(l,"key",void 0),o=k(l,"baseFrame",void 0),a=k(l,"columns",void 0),h=k(l,"rows",void 0)):y(n)?(n=k(l=n,"width",1),s=k(l,"height",1),r=k(l,"key",void 0),o=k(l,"baseFrame",void 0),a=k(l,"columns",void 0),h=k(l,"rows",void 0)):y(r)?(r=k(l=r,"key",void 0),o=k(l,"baseFrame",void 0),a=k(l,"columns",void 0),h=k(l,"rows",void 0)):y(o)?(o=k(l=o,"baseFrame",void 0),a=k(l,"columns",void 0),h=k(l,"rows",void 0)):Array.isArray(o)?(l=h,h=a,a=o,o=k(l,"baseFrame",void 0)):y(a)&&(a=k(l=a,"columns",void 0),h=k(l,"rows",void 0)),(u=p.call(this,t,e,i,n,s)).columns={},u.rows={},u.stretchMode={},u._tileSprite=void 0,u._image=void 0,u.setOrigin(.5,.5),u.setGetFrameNameCallback(k(l,"getFrameNameCallback",void 0)),u.setStretchMode(k(l,"stretchMode",0)),u.setPreserveRatio(k(l,"preserveRatio",!0));var c=k(l,"maxFixedPartScale",1),d=k(l,"maxFixedPartScaleX",c),f=k(l,"maxFixedPartScaleY",void 0);return u.setMaxFixedPartScale(d,f),u.setTexture(r,o,a,h),u}return m(v,[{key:"setGetFrameNameCallback",value:function(t){return void 0===t&&(t=h),this.getFrameNameCallback=t,this}},{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(O(C(v.prototype),"resize",this).call(this,t,e),this.updateTexture()),this}}]),v}();Object.assign(v.prototype,t);function b(t){return null==t||""===t||0===t.length}function x(t,e,i){if("object"===P(t)){if(b(e)){if(null==i)return;"object"===P(i)&&(t=i)}else{"string"==typeof e&&(e=e.split("."));var n=e.pop();(function(t,e,i){var n=t;if(!b(e)){var s;"string"==typeof e&&(e=e.split("."));for(var r=0,o=e.length;r<o;r++){var a;if(null==n[s=e[r]]||"object"!==P(n[s]))a=r!==o-1||void 0===i?{}:i,n[s]=a;n=n[s]}}return n})(t,e)[n]=i}return t}}u.register("ninePatch",function(t,e,i,n,s,r,o,a){var h=new v(this.scene,t,e,i,n,s,r,o,a);return this.scene.add.existing(h),h}),x(window,"RexPlugins.UI.NinePatch",v);function R(t,e,i){var n=i.length;if(2<=n){var s=i[n-2],r=i[n-1];if(t===s&&e===r)return i}return i.push(t,e),i}function I(t,e,i,n,s,r,o,a,h){o&&s<r?r-=360:!o&&r<s&&(r+=360);var l=G(r-s)/a;s=G(s);for(var u=0;u<=a;u++){var c=s+l*u,d=t+i*Math.cos(c),f=e+n*Math.sin(c);R(d,f,h)}return h}function D(t,e,i,n,s,r){for(var o=U.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*n),a=i.pathData,h=i.pathIndexes,l=0;l<h.length;l+=3){var u=2*h[l],c=2*h[l+1],d=2*h[l+2],f=a[0+u]-s,p=a[1+u]-r,v=a[0+c]-s,g=a[1+c]-r,y=a[0+d]-s,k=a[1+d]-r,m=e.getX(f,p),b=e.getY(f,p),x=e.getX(v,g),C=e.getY(v,g),w=e.getX(y,k),S=e.getY(y,k);t.batchTri(i,m,b,x,C,w,S,0,0,1,1,o,o,o,2)}}function L(t,e,i,n,s){var r=t.strokeTint,o=H.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*i);r.TL=o,r.TR=o,r.BL=o,r.BR=o;var a=e.pathData,h=a.length-1,l=e.lineWidth,u=l/2,c=a[0]-n,d=a[1]-s;e.closePath||(h-=2);for(var f=2;f<h;f+=2){var p=a[f]-n,v=a[f+1]-s;t.batchLine(c,d,p,v,u,u,l,f-2,!!e.closePath&&f===h-1),c=p,d=v}}function j(t,e,i){var n=N,s=J,r=K;return s.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),n.copyFrom(e.matrix),i?(n.multiplyWithOffset(i,-e.scrollX*t.scrollFactorX,-e.scrollY*t.scrollFactorY),s.e=t.x,s.f=t.y):(s.e-=e.scrollX*t.scrollFactorX,s.f-=e.scrollY*t.scrollFactorY),n.multiply(s,r),Z}function A(t,e,i,n){var s=i||e.fillColor,r=n||e.fillAlpha,o=(16711680&s)>>>16,a=(65280&s)>>>8,h=255&s;t.fillStyle="rgba("+o+","+a+","+h+","+r+")"}function F(t,e,i,n){var s=i||e.strokeColor,r=n||e.strokeAlpha,o=(16711680&s)>>>16,a=(65280&s)>>>8,h=255&s;t.strokeStyle="rgba("+o+","+a+","+h+","+r+")",t.lineWidth=e.lineWidth}var Y=Phaser.Utils.Objects.GetValue,V=function(){function r(t,e,i,n,s){B(this,r),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,n,s)}return m(r,[{key:"setTo",value:function(t,e,i,n,s){return this.setPosition(t,e),this.setRadius(s),this.setSize(i,n),this}},{key:"setPosition",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){var e,i;void 0===t&&(t=0),i="number"==typeof t?e=t:(e=Y(t,"x",0),Y(t,"y",0));var n=this.cornerRadius;return n.tl=W(Y(t,"tl",void 0),e,i),n.tr=W(Y(t,"tr",void 0),e,i),n.bl=W(Y(t,"bl",void 0),e,i),n.br=W(Y(t,"br",void 0),e,i),this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}},{key:"radius",get:function(){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)}}]),r}(),W=function(t,e,i){return void 0===t?{x:e,y:i}:"number"==typeof t?{x:t,y:t}:t},G=Phaser.Math.DegToRad,U=Phaser.Renderer.WebGL.Utils,H=Phaser.Renderer.WebGL.Utils,X=Phaser.GameObjects.Components.TransformMatrix,N=new X,J=new X,K=new X,Z={camera:N,sprite:J,calc:K},q=Phaser.Renderer.Canvas.SetTransform,$={renderWebGL:function(t,e,i,n){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var s=t.pipelines.set(e.pipeline),r=j(e,i,n),o=s.calcMatrix.copyFrom(r.calc),a=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&D(s,o,e,l,a,h),e.isStroked&&L(s,e,l,a,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var s=t.currentContext;if(q(t,s,e,i,n)){var r=e._displayOriginX,o=e._displayOriginY,a=e.pathData,h=a.length-1,l=a[0]-r,u=a[1]-o;s.beginPath(),s.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c<h;c+=2){var d=a[c]-r,f=a[c+1]-o;s.lineTo(d,f)}s.closePath(),e.isFilled&&(A(s,e),s.fill()),e.isStroked&&(F(s,e),s.stroke()),s.restore()}}},Q=Phaser.GameObjects.Shape,tt=Phaser.Utils.Objects.GetValue,et=Phaser.Geom.Polygon.Earcut,it=function(){w(f,Q);var d=T(f);function f(t,e,i,n,s,r,o,a){var h;B(this,f),void 0===e&&(e=0),void 0===i&&(i=0);var l=new V;h=d.call(this,t,"rexRoundRectangleShape",l);var u=tt(r,"radius",r);l.setTo(0,0,n,s,u);var c=tt(r,"iteration",void 0);return h.setIteration(c),h.setPosition(e,i),void 0!==o&&h.setFillStyle(o,a),h.updateDisplayOrigin(),h.dirty=!0,h}return m(f,[{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.cornerRadius,s=this.iteration+1;if(i=n.br,nt(i)){var r=t.width-i.x,o=t.height-i.y;I(r,o,i.x,i.y,0,90,!1,s,e)}else R(t.width,t.height,e);if(i=n.bl,nt(i)){r=i.x,o=t.height-i.y;I(r,o,i.x,i.y,90,180,!1,s,e)}else R(0,t.height,e);if(i=n.tl,nt(i)){r=i.x,o=i.y;I(r,o,i.x,i.y,180,270,!1,s,e)}else R(0,0,e);if(i=n.tr,nt(i)){r=t.width-i.x,o=i.y;I(r,o,i.x,i.y,270,360,!1,s,e)}else R(t.width,0,e);return e.push(e[0],e[1]),this.pathIndexes=et(e),this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height)}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t)}},{key:"resize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.height=e,this.geom.width=t,this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}}]),f}(),nt=function(t){return 0!==t.x&&0!==t.y};Object.assign(it.prototype,$),u.register("roundRectangle",function(t,e,i,n,s,r,o){var a=new it(this.scene,t,e,i,n,s,r,o);return this.scene.add.existing(a),a}),x(window,"RexPlugins.UI.RoundRectangle",it);function st(t,e,i,n,s,r,o){var a,h=t.textures,l=t.renderer;void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=e.width),void 0===o&&(o=e.height);var u=(a=h.exists(i)?h.get(i):h.createCanvas(i,r,o)).getSourceImage();u.width!==r&&(u.width=r),u.height!==o&&(u.height=o);var c=u.getContext("2d");c.clearRect(0,0,r,o),c.drawImage(e,n,s,r,o),l.gl&&a&&l.canvasToTexture(u,a.source[0].glTexture,!0,0)}var rt=Phaser.Renderer.WebGL.Utils,ot={renderWebGL:function(t,e,i,n){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var s=e.frame,r=s.width,o=s.height,a=rt.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(s.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,s.glTexture,r,o,e.x,e.y,r/e.resolution,o/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,r,o,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,n,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n))}},at=Phaser.Display.Color,ht={clear:function(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill:function(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},loadFromURL:function(t,e){var i=this,n=new Image;return n.onload=function(){i.width!==n.width||i.height!==n.height?i.resize(n.width,n.height):i.clear(),i.context.drawImage(n,0,0),i.updateTexture(),e&&e(),n.onload=null,n.src="",n.remove()},n.src=t,this},loadFromURLPromise:function(i){var n=this;return new Promise(function(t,e){n.loadFromURL(i,t)})},getDataURL:function(t,e){return this.canvas.toDataURL(t,e)},getPixel:function(t,e,i){void 0===i&&(i=new at);var n=this.context.getImageData(t,e,1,1);return i.setTo(n.data[0],n.data[1],n.data[2],n.data[3]),i},setPixel:function(t,e,i,n,s,r){if("number"!=typeof i){var o=i;i=o.red,n=o.green,s=o.blue,r=o.alpha}void 0===r&&(r=0!==i||0!==n||0!==s?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=n,a.data[2]=s,a.data[3]=r,this.context.putImageData(a,t,e),this.dirty=!0,this}},lt={updateTexture:function(t,e){t&&(e?t.call(e,this.canvas,this.context):t(this.canvas,this.context)),this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!1;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=this.width,i.hitArea.height=this.height),this},generateTexture:function(t,e,i,n,s){var r=this.canvas;return void 0===n?n=r.width:n*=this.resolution,void 0===s?s=r.height:s*=this.resolution,st(this.scene,r,t,e,i,n,s),this},loadTexture:function(t,e){var i=this.scene.textures.getFrame(t,e);return i&&(this.width!==i.cutWidth||this.height!==i.cutHeight?this.resize(i.cutWidth,i.cutHeight):this.clear(),this.context.drawImage(i.source.image,i.cutX,i.cutY,i.cutWidth,i.cutHeight,0,0,this.canvas.width,this.canvas.height),this.dirty=!0),this}},ut=Phaser.Display.Canvas.CanvasPool,ct=Phaser.GameObjects.GameObject,dt=function(){w(a,ct);var o=T(a);function a(t,e,i,n,s){var r;return B(this,a),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=1),(r=o.call(this,t,"rexCanvas")).renderer=t.sys.game.renderer,r.resolution=1,r._width=n,r._height=s,n=Math.max(Math.ceil(n*r.resolution),1),s=Math.max(Math.ceil(s*r.resolution),1),r.canvas=ut.create(z(r),n,s),r.context=r.canvas.getContext("2d"),r.dirty=!1,r.setPosition(e,i),r.setOrigin(.5,.5),r.initPipeline(),r._crop=r.resetCropObject(),r.texture=t.sys.textures.addCanvas(null,r.canvas,!0),r.frame=r.texture.get(),r.frame.source.resolution=r.resolution,r.renderer&&r.renderer.gl&&(r.renderer.deleteTexture(r.frame.source.glTexture),r.frame.source.glTexture=null),r.dirty=!0,t.sys.game.events.on("contextrestored",r.onContextRestored,z(r)),r}return m(a,[{key:"onContextRestored",value:function(){this.dirty=!0}},{key:"preDestroy",value:function(){this.scene.sys.game.events.off("contextrestored",this.onContextRestored,this),ut.remove(this.canvas),this.texture.destroy(),this.canvas=null,this.context=null}},{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height)}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t)}},{key:"setSize",value:function(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}},{key:"displayWidth",get:function(){return this.scaleX*this._width},set:function(t){this.scaleX=t/this._width}},{key:"displayHeight",get:function(){return this.scaleY*this._height},set:function(t){this.scaleY=t/this._height}},{key:"setDisplaySize",value:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}},{key:"getCanvas",value:function(t){return t||(this.dirty=!0),this.canvas}},{key:"getContext",value:function(t){return t||(this.dirty=!0),this.context}},{key:"needRedraw",value:function(){return this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}}]),a}(),ft=Phaser.GameObjects.Components;Phaser.Class.mixin(dt,[ft.Alpha,ft.BlendMode,ft.Crop,ft.Depth,ft.Flip,ft.GetBounds,ft.Mask,ft.Origin,ft.Pipeline,ft.ScrollFactor,ft.Tint,ft.Transform,ft.Visible,ot,ht,lt]);function pt(t,e,i){if(null==t)return t;switch(P(t)){case"string":return t;case"number":return"#".concat(yt(Math.floor(t).toString(16),6,"0",1));case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?"rgba(".concat(t.r,",").concat(t.g,",").concat(t.b,",").concat(t.a,")"):"rgb(".concat(t.r,",").concat(t.g,",").concat(t.b,")"):t.hasOwnProperty("h")?t.hasOwnProperty("a")?"hsla(".concat(t.h,",").concat(t.s,",").concat(t.l,",").concat(t.a,")"):"hsl(".concat(t.h,",").concat(t.s,",").concat(t.l,")"):t;default:return t}}function vt(t,e,i,n,s,r,o){var a,h,l,u,c,d=new V(e,i,n,s,r),f=d.minWidth,p=d.minHeight,v=f<=n?1:n/f,g=p<=s?1:s/p,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),u=n-(h=(a=y.br).x*v),c=s-(l=a.y*g),t.moveTo(n,c),0<h&&0<l?wt(t,u,c,h,l,mt,bt,o):(t.lineTo(n,s),t.lineTo(u,s)),u=h=(a=y.bl).x*v,c=s-(l=a.y*g),t.lineTo(h,s),0<h&&0<l?wt(t,u,c,h,l,bt,xt,o):(t.lineTo(0,s),t.lineTo(0,c)),u=h=(a=y.tl).x*v,c=l=a.y*g,t.lineTo(0,c),0<h&&0<l?wt(t,u,c,h,l,xt,Ct,o):(t.lineTo(0,0),t.lineTo(u,0)),u=n-(h=(a=y.tr).x*v),c=l=a.y*g,t.lineTo(u,0),0<h&&0<l?wt(t,u,c,h,l,Ct,mt,o):(t.lineTo(n,0),t.lineTo(n,c)),t.closePath(),t.restore()}function gt(t,e,i,n,s,r,o,a){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(n=0);var u=n/2;h-=n,l-=n,function(t,e,i,n,s,r,o,a,h,l,u,c){if(vt(t,e,i,n,s,r,c),null!=o){var d;if(null!=l)(d=u?t.createLinearGradient(0,0,n,0):t.createLinearGradient(0,0,0,s)).addColorStop(0,o),d.addColorStop(1,l),o=d;t.fillStyle=o,t.fill()}null!=a&&0<h&&(t.strokeStyle=a,t.lineWidth=h,t.stroke())}((t.canvas,t.context),u,u,h,l,s,e,i,n,r,o,a)}}var yt=Phaser.Utils.String.Pad,kt=Phaser.Math.DegToRad,mt=kt(0),bt=kt(90),xt=kt(180),Ct=kt(270),wt=function(t,e,i,n,s,r,o,a){if(null==a)t.ellipse(e,i,n,s,0,r,o);else for(var h,l,u,c=(o-r)/(a+=1),d=0;d<=a;d++)u=r+c*d,h=e+n*Math.cos(u),l=i+s*Math.sin(u),t.lineTo(h,l)},St=Phaser.Utils.Objects.GetValue,Pt=function(){w(v,dt);var p=T(v);function v(t,e,i,n,s,r,o,a,h,l,u){var c;B(this,v),(c=p.call(this,t,e,i,n,s)).type="rexRoundRectangleCanvas";var d=St(r,"radius",r),f=St(r,"iteration",void 0);return c.setRadius(d),c.setIteration(f),c.setFillStyle(o,l,u),c.setStrokeStyle(a,h),c}return m(v,[{key:"radius",get:function(){return this._radius},set:function(t){this.dirty|=this._radius!=t,this._radius=t}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"iteration",get:function(){return this._iteration},set:function(t){this.dirty|=this._iteration!=t,this._iteration=t}},{key:"setIteration",value:function(t){return this.iteration=t,this}},{key:"fillStyle",get:function(){return this._fillStyle},set:function(t){t=pt(t,this.canvas,this.context),this.dirty|=this._fillStyle!=t,this._fillStyle=t}},{key:"fillColor2",get:function(){return this._fillColor2},set:function(t){t=pt(t,this.canvas,this.context),this.dirty|=this._fillColor2!=t,this._fillColor2=t}},{key:"isHorizontalGradient",get:function(){return this._fillStyle},set:function(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}},{key:"setFillStyle",value:function(t,e,i){return void 0===i&&(i=!0),this.fillStyle=t,this.fillColor2=e,this.isHorizontalGradient=i,this}},{key:"strokeStyle",get:function(){return this._strokeStyle},set:function(t){t=pt(t,this.canvas,this.context),this.dirty|=this._strokeStyle!=t,this._strokeStyle=t}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this.dirty|=this._lineWidth!=t,this._lineWidth=t}},{key:"setStrokeStyle",value:function(t,e){return this.strokeStyle=t,this.lineWidth=e,this}},{key:"updateTexture",value:function(){return this.clear(),function(){gt(this,this.fillStyle,this.strokeStyle,this.lineWidth,this.radius,this.fillColor2,this.isHorizontalGradient,this.iteration)}.call(this),O(C(v.prototype),"updateTexture",this).call(this),this}}]),v}();u.register("roundRectangleCanvas",function(t,e,i,n,s,r,o,a,h,l){var u=new Pt(this.scene,t,e,i,n,s,r,o,a,h,l);return this.scene.add.existing(u),u}),x(window,"RexPlugins.UI.RoundRectangleCanvas",Pt);function Tt(t){var e=It.create(this),i=e.getContext("2d");t.syncFont(e,i);var n=i.measureText(t.testString);if("actualBoundingBoxAscent"in n){var s=n.actualBoundingBoxAscent,r=n.actualBoundingBoxDescent,o={ascent:s,descent:r,fontSize:s+r};return It.remove(e),o}var a=Math.ceil(n.width*t.baselineX),h=a,l=2*h;if(h=h*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,h),o={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return o.ascent=h,o.descent=h+6,o.fontSize=o.ascent+o.descent,It.remove(e),o;var u,c,d=i.getImageData(0,0,a,l).data,f=d.length,p=4*a,v=0,g=!1;for(u=0;u<h;u++){for(c=0;c<p;c+=4)if(255!==d[v+c]){g=!0;break}if(g)break;v+=p}for(o.ascent=h-u,v=f-p,g=!1,u=l;h<u;u--){for(c=0;c<p;c+=4)if(255!==d[v+c]){g=!0;break}if(g)break;v-=p}return o.descent=u-h,o.fontSize=o.ascent+o.descent,It.remove(e),o}function Ot(t){if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e]}function Mt(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:Ot(e),i){e.length=t.length;for(var n=0,s=t.length;n<s;n++)e[n]=t[n]}else for(var r in t)e[r]=t[r];return e}function Et(){}function _t(t,e,i){var n=ce.pop();return null===n&&(n={}),n.text=t,n.width=e,n.newLineMode=i,n}function Bt(t,e,i,n,s){n<=0&&(i=ve);var r=[];if(!t||!t.length)return r;for(var o,a,h,l,u=i===ve,c=i===ge,d=t.split(ke),f=0,p=d.length;f<p;f++)if(o=d[f],h=f===p-1?de:fe,u){var v=e(o);r.push(_t(o,v,h))}else{var g,y,k,m,b;if(a=0===f?n-s:n,o.length<=100)if((v=e(o))<=a){r.push(_t(o,v,h));continue}c?(y=""===(g=o.split(" "))[g.length-1])&&--g.length:g=o;for(var x,C="",w=0,S=c?e(" "):void 0,P=0,T=g.length;P<T;P++)if(m=e(k=g[P]),b=P===T-1,!c||b&&!y||(k+=" ",m+=S),c&&n<m){""!==C?r.push(_t(C,w,pe)):0===P&&0<s&&r.push(_t("",0,pe)),r.push.apply(r,M(Bt(k,e,ye,n,0)));var O=r.pop();C=O.text,w=O.width,(l=O)&&ce.push(l)," "===C&&(C="",w=0)}else a<(x=w+m)?(r.push(_t(C,w,pe)),C=k,w=m,a=n):(C+=k,w=x),b&&r.push(_t(C,w,h))}return r}var zt=Phaser.Renderer.WebGL.Utils,Rt={renderWebGL:function(t,e,i,n){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var s=e.frame,r=s.width,o=s.height,a=zt.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(s.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,s.glTexture,r,o,e.x,e.y,r/e.style.resolution,o/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,r,o,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,n,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,n){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n))}},It=Phaser.Display.Canvas.CanvasPool,Dt=0,Lt=1,jt=2,At=0,Ft=1,Yt=2,Vt=/(?:\r\n|\r|\n)/,Wt=Phaser.Utils.Objects.GetAdvancedValue,Gt=Phaser.Utils.Objects.GetValue,Ut={backgroundColor:["backgroundColor",null,pt],backgroundColor2:["backgroundColor2",null,pt],backgroundHorizontalGradient:["backgroundHorizontalGradient",!0,null],backgroundStrokeColor:["backgroundStrokeColor",null,pt],backgroundStrokeLineWidth:["backgroundStrokeLineWidth",2,null],backgroundCornerRadius:["backgroundCornerRadius",0,null],backgroundCornerIteration:["backgroundCornerIteration",null,null],fontFamily:["fontFamily","Courier",null],fontSize:["fontSize","16px",null],fontStyle:["fontStyle","",null],color:["color","#fff",pt],stroke:["stroke","#fff",pt],strokeThickness:["strokeThickness",0,null],shadowOffsetX:["shadow.offsetX",0,null],shadowOffsetY:["shadow.offsetY",0,null],shadowColor:["shadow.color","#000",pt],shadowBlur:["shadow.blur",0,null],shadowStroke:["shadow.stroke",!1,null],shadowFill:["shadow.fill",!1,null],underlineColor:["underline.color","#000",pt],underlineThickness:["underline.thickness",0,null],underlineOffset:["underline.offset",0,null],halign:["halign","left",null],valign:["valign","top",null],maxLines:["maxLines",0,null],fixedWidth:["fixedWidth",0,null],fixedHeight:["fixedHeight",0,null],resolution:["resolution",0,null],lineSpacing:["lineSpacing",0,null],xOffset:["xOffset",0,null],rtl:["rtl",!1,null],testString:["testString","|MÉqgy",null],baselineX:["baselineX",1.2,null],baselineY:["baselineY",1.4,null],wrapMode:["wrap.mode",0,null],wrapWidth:["wrap.width",0,null],wrapCallback:["wrap.callback",null],wrapCallbackScope:["wrap.callbackScope",null]},Ht=function(){function n(t,e){B(this,n),this.parent=t,this.backgroundColor,this.backgroundColor2,this.backgroundHorizontalGradient,this.backgroundStrokeColor,this.backgroundStrokeLineWidth,this.backgroundCornerRadius,this.backgroundCornerIteration,this.fontFamily,this.fontSize,this.fontStyle,this.color,this.stroke,this.strokeThickness,this.shadowOffsetX,this.shadowOffsetY,this.shadowColor,this.shadowBlur,this.shadowStroke,this.shadowFill,this.underlineColor,this.underlineThickness,this.underlineOffset,this.halign,this.valign,this.maxLines,this.fixedWidth,this.fixedHeight,this.resolution,this.lineSpacing,this.xOffset,this.rtl,this.testString,this.baselineX,this.baselineY,this.wrapMode,this.wrapWidth,this.wrapCallback,this.wrapCallbackScope,this._font,this.setStyle(e,!1,!0);var i=Gt(e,"metrics",!1);this.metrics=i?{ascent:Gt(i,"ascent",0),descent:Gt(i,"descent",0),fontSize:Gt(i,"fontSize",0)}:Tt(this)}return m(n,[{key:"canvas",get:function(){return this.parent.canvasText.canvas}},{key:"context",get:function(){return this.parent.canvasText.context}},{key:"isWrapFitMode",get:function(){return 0<this.fixedWidth&&this.wrapMode!==At&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var s=n.mode;"string"==typeof s&&(n.mode=Xt[s])}else n.hasOwnProperty("width")&&(n.mode=1)}for(var r in t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px"),Ut){var o=Ut[r],a=o[0],h=i?o[1]:this[r],l=o[2];if("wrapCallback"===r||"wrapCallbackScope"===r)this[r]=Gt(t,a,h);else{var u=Wt(t,a,h);l&&(u=l(u)),this[r]=u}}var c=Gt(t,"font",null);this._font=null===c?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:c;var d=Gt(t,"fill",null);null!==d&&(this.color=pt(d));var f=Gt(t,"images",void 0);return f&&this.parent.addImage(f),e?this.update(!0):this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}},{key:"syncShadow",value:function(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)}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=Tt(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Gt(t,"fontFamily","Courier"),this.fontSize=Gt(t,"fontSize","16px"),this.fontStyle=Gt(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=pt(t,this.canvas,this.context),this.backgroundColor2=pt(e,this.canvas,this.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=pt(t,this.canvas,this.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=pt(t,this.canvas,this.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=pt(t,this.canvas,this.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=pt(t,this.canvas,this.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===s&&(s=!1),void 0===r&&(r=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=pt(i,this.canvas,this.context),this.shadowBlur=n,this.shadowStroke=s,this.shadowFill=r,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=pt(t,this.canvas,this.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=pt(t,this.canvas,this.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=pt(t,this.canvas,this.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return"string"==typeof t&&(t=Xt[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,"string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Gt(e,"fontFamily",this.fontFamily),this.fontSize=Gt(e,"fontSize",this.fontSize),this.fontStyle=Gt(e,"fontStyle",this.fontStyle)),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={};for(var e in Ut)t[e]=this[e];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0}}]),n}(),Xt={none:At,word:Ft,char:Yt,character:Yt},Nt=Phaser.Display.Canvas.CanvasPool,Jt={draw:function(t,e,i,n){var s=this.penManager;this.hitAreaManager.clear();var r=this.context;r.save();var o=this.defaultStyle;this.clear(),gt(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,p=o.valign,v=o.lineHeight,g=s.lines,y=g.length,k=o.maxLines;u=(l=0<k&&k<y?(h=k,"center"===p?Math.floor((y-h)/2):"bottom"===p?y-h:0):(h=y,0))+h;var m=this.rtl,b=m?this.parent.width:void 0;d="center"===p?Math.max((n-h*v)/2,0):"bottom"===p?Math.max(n-h*v-2,0):0,d+=e;for(var x=l;x<u;x++)if(0!==(a=s.getLineWidth(x))){for(var C=g[x],w=C.length,S=f,P=0;P<w;P++){var T=C[P].prop.align;if(T){S=T;break}}c="center"===S?(i-a)/2:"right"===S?m?0:i-a:m?i-a:0,c+=t;for(P=0;P<w;P++)this.drawPen(C[P],c,d,b)}r.restore()},drawPen:function(t,e,i,n){e+=t.x,i+=t.y+(t.prop.y||0),void 0!==n&&(e=n-e);var s=this.canvas,r=this.context;r.save();var o=this.parser.propToContextStyle(this.defaultStyle,t.prop);o.buildFont(),o.syncFont(s,r),o.syncStyle(s,r),0<o.underlineThickness&&0<t.width&&this.drawUnderline(e,i,t.width,o),t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),r.restore(),t.hasAreaMarker&&0<t.width&&this.hitAreaManager.add(t.prop.area,e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight)},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawUnderline:function(t,e,i,n){e+=n.underlineOffset-n.underlineThickness/2,this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context,r=s.lineCap;s.lineCap="butt",s.strokeStyle=n.underlineColor,s.lineWidth=n.underlineThickness,s.beginPath(),s.moveTo(t,e),s.lineTo(t+i,e),s.stroke(),s.lineCap=r},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context;n.stroke&&"none"!==n.stroke&&0<n.strokeThickness&&(n.syncShadow(s,n.shadowStroke),s.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(s,n.shadowFill),s.fillText(i,t,e))},drawImage:function(t,e,i){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound)}},Kt=function(){function t(){B(this,t),this.items=[]}return m(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0}},{key:"pop",value:function(){return 0<this.items.length?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),Zt=Phaser.Utils.Objects.GetValue,qt=Dt,$t=Lt,Qt=function(){function e(t){B(this,e),this.prop={},this.resetFromJSON(t)}return m(e,[{key:"resetFromJSON",value:function(t){this.text=Zt(t,"text",""),this.x=Zt(t,"x",0),this.y=Zt(t,"y",0),this.width=Zt(t,"width",0);var e=Zt(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Zt(t,"newLineMode",0),this.startIndex=Zt(t,"startIndex",0)}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===$t&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==qt&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===$t&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return""!==this.text}},{key:"isImagePen",get:function(){return!!this.prop.img}},{key:"hasAreaMarker",get:function(){return!!this.prop.area}}]),e}(),te=Phaser.Utils.Objects.GetFastValue,ee=Dt,ie=jt,ne=new Kt,se=new Kt,re=function(){function a(t){B(this,a),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.PensPool=te(t,"pensPool",ne),this.LinesPool=te(t,"linesPool",se),this.tagToText=te(t,"tagToText",Et),this.tagToTextScope=te(t,"tagToTextScope",void 0)}return m(a,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}},{key:"clear",value:function(){for(var t=0,e=this.lines.length;t<e;t++)this.lines[t].length=0;this.PensPool.pushMultiple(this.pens),this.LinesPool.pushMultiple(this.lines),this.maxLinesWidth=void 0}},{key:"addTextPen",value:function(t,e,i,n,s,r){var o=this.PensPool.pop();return null==o&&(o=new Qt),oe.text=t,oe.x=e,oe.y=i,oe.width=n,oe.prop=s,oe.newLineMode=r,o.resetFromJSON(oe),this.addPen(o),this}},{key:"addImagePen",value:function(t,e,i,n){return this.addTextPen("",t,e,i,n,ee),this}},{key:"addNewLinePen",value:function(){var t=this.lastPen,e=t?t.lastX:0,i=t?t.y:0,n=t?Mt(t.prop):null;return this.addTextPen("",e,i,0,n,ie),this}},{key:"addPen",value:function(t){var e=this.lastPen;t.startIndex=null==e?0:e.endIndex,this.pens.push(t);var i=this.lastLine;null==i&&(i=this.LinesPool.pop()||[],this.lines.push(i)),i.push(t),t.newLineMode!==ee&&(i=this.LinesPool.pop()||[],this.lines.push(i)),this.maxLinesWidth=void 0}},{key:"clone",value:function(t){null==t&&(t=new a),t.clear();for(var e=0,i=this.lines.length;e<i;e++)for(var n=this.lines[e],s=0,r=n.length;s<r;s++){var o=n[s];t.addPen(o.text,o.x,o.y,o.width,Mt(o.prop),o.newLineMode)}return t}},{key:"lastPen",get:function(){return this.pens[this.pens.length-1]}},{key:"lastLine",get:function(){return this.lines[this.lines.length-1]}},{key:"getLineStartIndex",value:function(t){if(t>=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;0<=e&&!(n=null!=(i=this.lines[e])&&0<i.length);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;i<n;i++)e<(t=this.getLineWidth(i))&&(e=t);return this.maxLinesWidth=e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e<i;e++)t.push(this.getLineWidth(e));return t}},{key:"linesCount",get:function(){return this.lines.length}},{key:"plainText",get:function(){for(var t="",e=this.pens,i=0,n=e.length;i<n;i++)t+=e[i].plainText;return t}},{key:"rawTextLength",get:function(){for(var t=0,e=this.pens,i=0,n=this.pens.length;i<n;i++)t+=e[i].rawTextLength;return t}},{key:"getSliceTagText",value:function(t,e,i){if(void 0===t&&(t=0),void 0===e){var n=this.lastPen;if(null==n)return"";e=n.endIndex}void 0===i&&(i=!1);for(var s,r,o,a,h,l,u="",c=0,d=this.pens.length;c<d&&((a=(s=this.pens[c]).endIndex)<=t||(s=this.pens[c],r=i?s.wrapText:s.plainText,h=s.prop,t<=(o=s.startIndex)&&a<=e||(r=r.substring(t-o,e-o)),this.tagToTextScope?u+=this.tagToText.call(this.tagToTextScope,r,h,l):u+=this.tagToText(r,h,l),l=h,!(e<=a)));c++);return u}},{key:"length",get:function(){return this.lines.length},set:function(){this.clear()}}]),a}(),oe={},ae=Phaser.Geom.Rectangle,he=new Kt,le=function(){function t(){B(this,t),this.hitAreas=[]}return m(t,[{key:"destroy",value:function(){this.clear()}},{key:"clear",value:function(){return he.pushMultiple(this.hitAreas),this}},{key:"add",value:function(t,e,i,n,s){var r=he.pop();return null===r?r=new ae(e,i,n,s):r.setTo(e,i,n,s),r.key=t,this.hitAreas.push(r),this}},{key:"getFirstHitArea",value:function(t,e){for(var i,n=this.hitAreas,s=0,r=n.length;s<r;s++)if((i=n[s]).contains(t,e))return i;return null}},{key:"drawBounds",value:function(t,e,i){void 0===e&&(e=16777215),i&&t.save().scaleCanvas(i.scaleX,i.scaleY).rotateCanvas(i.rotation).translateCanvas(i.x,i.y);for(var n,s=this.hitAreas,r=0,o=s.length;r<o;r++)n=s[r],t.lineStyle(1,e).strokeRect(n.x,n.y,n.width,n.height);return i&&t.restore(),this}}]),t}(),ue=function(t,e,i,n){var s=this.hitAreaManager.getFirstHitArea(i,n);if(null!==s){var r=s.key;this.parent.emit("".concat(t,"-").concat(r),e,i,n),this.parent.emit(t,r,e,i,n)}},ce=new Kt,de=Dt,fe=Lt,pe=jt,ve=At,ge=Ft,ye=Yt,ke=Vt,me=Phaser.Utils.Objects.GetValue,be=At,xe=Dt,Ce=function(){function i(t){B(this,i),this.parent=t.parent,this.context=me(t,"context",null),this.canvas=this.context.canvas,this.parser=me(t,"parser",null),this.defaultStyle=me(t,"style",null),this.autoRound=!0,this.pensPool=me(t,"pensPool",null),this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new le;var e=this.context;this.getTextWidth=function(t){return e.measureText(t).width}}return m(i,[{key:"destroy",value:function(){this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0)}},{key:"updatePenManager",value:function(t,e,i,n,s){if(void 0===s&&(s=this.penManager),s.clear(),""===t)return s;var r=this.parent.style;if(r.isWrapFitMode){var o=this.parent.padding;i=r.fixedWidth-o.left-o.right}for(var a,h,l,u,c,d,f=this.canvas,p=this.context,v=function(t){return p.measureText(t).width},g=0,y=0,k=r.wrapCallback,m=r.wrapCallbackScope,b=!0,x=this.parser.splitText(t),C=0,w=x.length;C<w;C++)if(a=(u=this.parser.tagTextToProp(x[C],h)).plainText,(h=u.prop).img){var S=this.imageManager.getOuterWidth(h.img);0<i&&e!==be&&i<g+S&&(s.addNewLinePen(),y+=n,g=0),s.addImagePen(g,y,S,Mt(h)),g+=S}else if(""!==a){if(p.save(),(l=this.parser.propToContextStyle(this.defaultStyle,h)).buildFont(),l.syncFont(f,p),l.syncStyle(f,p),k){"string"==typeof(c=k.call(m,a,v,i,g))&&(c=c.split("\n"));for(var P=0,T=c.length;P<T;P++)"string"==typeof(O=c[P])?c[P]=_t(O,v(O),P<T-1?2:0):b=!1}else c=Bt(a,v,e,i,g);var O;for(P=0,T=c.length;P<T;P++)O=c[P],s.addTextPen(O.text,g,y,O.width,Mt(h),O.newLineMode),O.newLineMode!==xe?(g=0,y+=n):g+=O.width;b&&(d=c)&&ce.pushMultiple(d),c=null,p.restore()}return s}},{key:"startXOffset",get:function(){var t=this.defaultStyle;return t.strokeThickness/2+t.xOffset}},{key:"startYOffset",get:function(){var t=this.defaultStyle;return t.strokeThickness/2+t.metrics.ascent}},{key:"lines",get:function(){return this.penManager.lines}},{key:"desplayLinesCount",get:function(){var t=this.penManager.linesCount,e=this.defaultStyle.maxLines;return 0<e&&e<t&&(t=e),t}},{key:"linesWidth",get:function(){return this.penManager.getMaxLineWidth()}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return 0<t&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new re({pensPool:this.pensPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else{var s=this.parser.splitText(t,1);n="";for(var r=0,o=s.length;r<o;r++)n+=s[r]}return null==e&&null==i||(null==e&&(e=0),null==i&&(i=n.length),n=n.substring(e,i)),n}},{key:"getPenManager",value:function(t,e){if(void 0===t)return this.copyPenManager(e,this.penManager);void 0===e&&(e=this.newPenManager());var i=this.defaultStyle;return this.updatePenManager(t,i.wrapMode,i.wrapWidth,i.lineHeight,e),e}},{key:"getText",value:function(t,e,i,n){if(null==t)return this.penManager.getSliceTagText(e,i,n);var s=this.tmpPenManager,r=this.defaultStyle;return this.updatePenManager(t,r.wrapMode,r.wrapWidth,r.lineHeight,s),s.getSliceTagText(e,i,n)}},{key:"copyPenManager",value:function(t,e){return void 0===e&&(e=this.penManager),e.copy(t)}},{key:"getTextWidth",value:function(t){return void 0===t&&(t=this.penManager),t.getMaxLineWidth()}},{key:"getLastPen",value:function(t){return void 0===t&&(t=this.penManager),t.lastPen}}]),i}(),we={setInteractive:function(){this.parent.on("pointerdown",function(t,e,i,n){ue.call(this,"areadown",t,e,i)},this).on("pointerup",function(t,e,i,n){ue.call(this,"areaup",t,e,i)},this)}};Object.assign(Ce.prototype,Jt,we);function Se(t,e){void 0===e&&(e={key:t}),e.hasOwnProperty("key")||(e.key=t);var i=e.key,n=e.frame,s=e.width,r=e.height;if(void 0===s||void 0===r){var o=this.textureManager.getFrame(i,n),a=o?o.cutWidth:0,h=o?o.cutHeight:0;void 0===s&&void 0===r?(s=a,r=h):void 0===s?s=a*(r/h):void 0===r&&(r=h*(s/a))}this.images[t]={key:i,frame:n,width:s,height:r,y:Pe(e,"y",0),left:Pe(e,"left",0),right:Pe(e,"right",0)}}var Pe=Phaser.Utils.Objects.GetValue,Te=function(){function e(t){B(this,e),this.textureManager=t.textures,this.images={}}return m(e,[{key:"destroy",value:function(){this.textureManager=void 0,this.images=void 0}},{key:"add",value:function(t,e){if("string"==typeof t)Se.call(this,t,e);else if(Array.isArray(t))for(var i=0,n=(s=t).length;i<n;i++)Se.call(this,s[i]);else{var s=t;for(var t in s)Se.call(this,t,s[t])}return this}},{key:"has",value:function(t){return this.images.hasOwnProperty(t)}},{key:"remove",value:function(t){return this.has(t)&&delete this.images[t],this}},{key:"get",value:function(t){return this.has(t)||this.textureManager.exists(t)&&this.add(t),this.images[t]}},{key:"getOuterWidth",value:function(t){var e=this.get(t);return e?e.width+e.left+e.right:0}},{key:"getFrame",value:function(t){var e=this.get(t);return e?this.textureManager.getFrame(e.key,e.frame):void 0}},{key:"hasTexture",value:function(t){return!!this.getFrame(t)}}]),e}(),Oe={draw:function(t,e,i,n,s){var r=this.get(t);i+=r.left,n+=r.y,s&&(i=Math.round(i),n=Math.round(n));var o=this.textureManager.getFrame(r.key,r.frame);e.drawImage(o.source.image,o.cutX,o.cutY,o.cutWidth,o.cutHeight,i,n,r.width,r.height)}};Object.assign(Te.prototype,Oe);var Me=Phaser.Utils.Objects.IsPlainObject,Ee=Phaser.DOM.AddToDOM,_e=Phaser.Display.Canvas.CanvasPool,Be=Phaser.GameObjects.GameObject,ze=Phaser.Utils.Objects.GetValue,Re=Phaser.DOM.RemoveFromDOM,Ie=Vt,De={},Le=function(){w(c,Be);var u=T(c);function c(t,e,i,n,s,r,o){var a;if(B(this,c),Me(e)){var h=e;e=ze(h,"x",0),i=ze(h,"y",0),n=ze(h,"text",""),s=ze(h,"style","")}if(void 0===e&&(e=0),void 0===i&&(i=0),(a=u.call(this,t,r)).renderer=t.sys.game.renderer,a.setPosition(e,i),a.setOrigin(0,0),a.initPipeline(),a.canvas=_e.create(z(a)),a.context=a.canvas.getContext("2d"),a._imageManager=void 0,s){if(s.hasOwnProperty("align")){var l=s.align;delete s.align,s.halign=l}s.hasOwnProperty("stroke")&&!s.hasOwnProperty("strokeThickness")&&(s.strokeThickness=1)}return a.style=new Ht(z(a),s),a.autoRound=!0,a._text=void 0,a.padding={left:0,right:0,top:0,bottom:0},a.width=1,a.height=1,a.dirty=!1,0===a.style.resolution&&(a.style.resolution=1),a._crop=a.resetCropObject(),a.texture=t.sys.textures.addCanvas(null,a.canvas,!0),a.frame=a.texture.get(),a.frame.source.resolution=a.style.resolution,a.renderer.gl&&(a.renderer.deleteTexture(a.frame.source.glTexture),a.frame.source.glTexture=null),De.hasOwnProperty(r)||(De[r]=new Kt),a.canvasText=new Ce({parent:z(a),context:a.context,parser:o,style:a.style,pensPool:De[r]}),a.initRTL(),s&&s.padding&&a.setPadding(s.padding),a.setText(n),t.sys.game.events.on("contextrestored",a.onContextRestored,z(a)),a}return m(c,[{key:"onContextRestored",value:function(){this.dirty=!0}},{key:"preDestroy",value:function(){this.style.rtl&&Re(this.canvas),this.scene.sys.game.events.off("contextrestored",this.onContextRestored,this),this.canvasText.destroy(),this.canvasText=void 0,this._imageManager&&(this._imageManager.destroy(),this._imageManager=void 0),_e.remove(this.canvas),this.texture.destroy()}},{key:"text",get:function(){return this._text},set:function(t){this.setText(t)}},{key:"initRTL",value:function(){this.style.rtl&&(this.canvas.dir="rtl",this.context.direction="rtl",this.canvas.style.display="none",Ee(this.canvas,this.scene.sys.canvas),this.originX=1)}},{key:"setText",value:function(t){return null==t&&(t=""),Array.isArray(t)&&(t=t.join("\n")),t!==this._text&&(this._text=t.toString(),this.updateText()),this}},{key:"appendText",value:function(t){return null==t||(Array.isArray(t)&&(t=t.join("\n")),this.setText(this.text+t.toString())),this}},{key:"setStyle",value:function(t){return this.style.setStyle(t)}},{key:"setFont",value:function(t){return this.style.setFont(t)}},{key:"setFontFamily",value:function(t){return this.style.setFontFamily(t)}},{key:"setFontSize",value:function(t){return this.style.setFontSize(t)}},{key:"setFontStyle",value:function(t){return this.style.setFontStyle(t)}},{key:"setTestString",value:function(t){return this.style.setTestString(t)}},{key:"setFixedSize",value:function(t,e){return this.style.setFixedSize(t,e)}},{key:"setBackgroundColor",value:function(t,e,i){return this.style.setBackgroundColor(t,e,i)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.style.setBackgroundStrokeColor(t,e)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.style.setBackgroundCornerRadius(t,e)}},{key:"setFill",value:function(t){return this.style.setFill(t)}},{key:"setColor",value:function(t){return this.style.setColor(t)}},{key:"setStroke",value:function(t,e){return this.style.setStroke(t,e)}},{key:"setShadow",value:function(t,e,i,n,s,r){return this.style.setShadow(t,e,i,n,s,r)}},{key:"setShadowOffset",value:function(t,e){return this.style.setShadowOffset(t,e)}},{key:"setShadowColor",value:function(t){return this.style.setShadowColor(t)}},{key:"setShadowBlur",value:function(t){return this.style.setShadowBlur(t)}},{key:"setShadowStroke",value:function(t){return this.style.setShadowStroke(t)}},{key:"setShadowFill",value:function(t){return this.style.setShadowFill(t)}},{key:"setWrapMode",value:function(t){return this.style.setWrapMode(t)}},{key:"setWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setWordWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setHAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setVAlign",value:function(t){return this.style.setVAlign(t)}},{key:"setLineSpacing",value:function(t){return this.style.setLineSpacing(t)}},{key:"setXOffset",value:function(t){return this.style.setXOffset(t)}},{key:"setPadding",value:function(t,e,i,n){if("object"===P(t)){var s=t,r=ze(s,"x",null);i=null!==r?t=r:(t=ze(s,"left",0),ze(s,"right",t));var o=ze(s,"y",null);n=null!==o?e=o:(e=ze(s,"top",0),ze(s,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===n&&(n=e);return this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=n,this.updateText(!1)}},{key:"setMaxLines",value:function(t){return this.style.setMaxLines(t)}},{key:"setResolution",value:function(t){return this.style.setResolution(t)}},{key:"updateText",value:function(t){void 0===t&&(t=!0);var e=this.canvasText,i=this.style;t&&e.updatePenManager(this._text,i.wrapMode,i.wrapWidth,i.lineHeight);var n,s,r=this.padding;0===i.fixedWidth?(this.width=e.linesWidth+r.left+r.right,n=e.linesWidth):(this.width=i.fixedWidth,(n=this.width-r.left-r.right)<e.linesWidth&&(n=e.linesWidth)),0===i.fixedHeight?(this.height=e.linesHeight+r.top+r.bottom,s=e.linesHeight):(this.height=i.fixedHeight,(s=this.height-r.top-r.bottom)<e.linesHeight&&(s=e.linesHeight));var o=this.width,a=this.height;this.updateDisplayOrigin();var h=i.resolution;o*=h,a*=h,o=Math.max(Math.ceil(o),1),a=Math.max(Math.ceil(a),1);var l=this.canvas,u=this.context;l.width!==o||l.height!==a?(l.width=o,l.height=a,this.frame.setSize(o,a)):u.clearRect(0,0,o,a),u.save(),u.scale(h,h);var c=this.style.rtl?r.right:r.left,d=r.top;e.draw(c,d,n,s),u.restore(),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(l,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!0;var f=this.input;return f&&!f.customHitArea&&(f.hitArea.width=this.width,f.hitArea.height=this.height),this}},{key:"getTextMetrics",value:function(){return this.style.getTextMetrics()}},{key:"setTextMetrics",value:function(t,e){return this.style.setTextMetrics(t,e)}},{key:"toJSON",value:function(){var t=je.ToJSON(this),e={autoRound:this.autoRound,text:this._text,style:this.style.toJSON(),resolution:this.resolution,padding:{left:this.padding.left,right:this.padding.right,top:this.padding.top,bottom:this.padding.bottom}};return t.data=e,t}},{key:"setInteractive",value:function(t,e,i){return Be.prototype.setInteractive.call(this,t,e,i),this.canvasText.setInteractive(),this}},{key:"getWrappedText",value:function(t,e,i){return(t=this.canvasText.getText(t,e,i,!0)).split(Ie)}},{key:"getPlainText",value:function(t,e,i){return this.canvasText.getPlainText(t,e,i)}},{key:"getText",value:function(t,e,i,n){return void 0===n&&(n=!1),this.canvasText.getText(t,e,i,n)}},{key:"getSubString",value:function(t,e,i){return this.getText(t,e,i)}},{key:"copyPenManager",value:function(t){return this.canvasText.copyPenManager(t)}},{key:"getPenManager",value:function(t,e){return this.canvasText.getPenManager(t,e)}},{key:"setSize",value:function(t,e){return this.setFixedSize(t,e)}},{key:"resize",value:function(t,e){return this.setFixedSize(t,e)}},{key:"lineSpacing",get:function(){return this.style.lineSpacing},set:function(t){this.setLineSpacing(t)}},{key:"imageManager",get:function(){return this._imageManager||(this._imageManager=new Te(this.scene)),this._imageManager}},{key:"addImage",value:function(t,e){return this.imageManager.add(t,e),this}},{key:"drawAreaBounds",value:function(t,e){return this.canvasText.hitAreaManager.drawBounds(t,e,this),this}},{key:"measureTextMargins",value:function(t,e){return function(t,e,i){void 0===i&&(i={});var n=Nt.create(this),s=n.getContext("2d");t.syncFont(n,s);var r=s.measureText(e),o=Math.ceil(r.width*t.baselineX),a=o,h=2*a;if(a=a*t.baselineY|0,n.width=o,n.height=h,s.fillStyle="#f00",s.fillRect(0,0,o,h),s.font=t._font,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(t.testString,0,a),(i.left=0)===o||0==h||!s.getImageData(0,0,o,h))return Nt.remove(n),i;for(var l=s.getImageData(0,0,o,h).data,u=!1,c=0;c<o;c++){for(var d=0;d<h;d++){if(255!==l[4*(d*o+c)]){i.left=c,u=!0;break}}if(u)break}return Nt.remove(n),i}(this.style,t,e)}},{key:"generateTexture",value:function(t,e,i,n,s){var r=this.canvas;return void 0===n?n=r.width:n*=this.resolution,void 0===s?s=r.height:s*=this.resolution,st(this.scene,r,t,e,i,n,s),this}}]),c}(),je=Phaser.GameObjects.Components;Phaser.Class.mixin(Le,[je.Alpha,je.BlendMode,je.ComputedSize,je.Crop,je.Depth,je.Flip,je.GetBounds,je.Mask,je.Origin,je.Pipeline,je.ScrollFactor,je.Tint,je.Transform,je.Visible,Rt]);var Ae={plainText:null,prevProp:null},Fe=new Ht,Ye={},Ve={splitText:function(t,e){for(var i=[],n=0;;){var s=Ue.exec(t);if(!s){var r=t.length;return n<r&&i.push(t.substring(n,r)),i}var o=s[0],a=Ue.lastIndex-o.length;n<a&&i.push(t.substring(n,a)),void 0===e&&i.push(o),n=Ue.lastIndex}},tagTextToProp:function(t,e){var i,n;null==e&&(e={}),e.img&&We(e,vi,"img"),i=He.test(t)?(We(e,gi,"b",!0),""):Xe.test(t)?(We(e,vi,"b"),""):Ne.test(t)?(We(e,gi,"i",!0),""):Je.test(t)?(We(e,vi,"i"),""):Ke.test(t)?(n=t.match(Ke),We(e,gi,"size","".concat(n[1],"px")),""):Ze.test(t)?(We(e,vi,"size"),""):qe.test(t)?(n=t.match(qe),We(e,gi,"color",n[1]),""):$e.test(t)?(We(e,vi,"color"),""):Qe.test(t)?(n=t.match(Qe),We(e,gi,"u",!0),""):ti.test(t)?(n=t.match(ti),We(e,gi,"u",n[1]),""):ei.test(t)?(We(e,vi,"u"),""):ii.test(t)?(We(e,gi,"shadow",!0),""):ni.test(t)?(We(e,vi,"shadow"),""):si.test(t)?(We(e,gi,"stroke",!0),""):ri.test(t)?(n=t.match(ri),We(e,gi,"stroke",n[1]),""):oi.test(t)?(We(e,vi,"stroke"),""):ai.test(t)?(n=t.match(ai),We(e,gi,"y",parseFloat(n[1])),""):hi.test(t)?(We(e,vi,"y"),""):li.test(t)?(n=t.match(li),We(e,gi,"img",n[1]),""):ui.test(t)?(We(e,vi,"img"),""):ci.test(t)?(n=t.match(ci),We(e,gi,"area",n[1]),""):di.test(t)?(We(e,vi,"area"),""):fi.test(t)?(n=t.match(fi),We(e,gi,"align",n[1]),""):pi.test(t)?(We(e,vi,"align"),""):t;var s=Ae;return s.plainText=i,s.prop=e,s},propToContextStyle:function(t,e){var i=Fe;if(e.hasOwnProperty("img"))i.image=e.img;else{if(i.image=null,e.hasOwnProperty("family")?i.fontFamily=e.family:i.fontFamily=t.fontFamily,e.hasOwnProperty("size")){var n=e.size;"number"==typeof n&&(n="".concat(n,"px")),i.fontSize=n}else i.fontSize=t.fontSize;i.fontStyle=Ge(e.b,e.i),e.hasOwnProperty("color")?i.color=e.color:i.color=t.color,e.hasOwnProperty("stroke")?(!0===e.stroke?i.stroke=t.stroke:i.stroke=e.stroke,i.strokeThickness=t.strokeThickness):(i.stroke=t.stroke,i.strokeThickness=0)}return e.hasOwnProperty("shadow")?(!0===e.shadow?i.shadowColor=t.shadowColor:i.shadowColor=e.shadow,i.shadowOffsetX=t.shadowOffsetX,i.shadowOffsetY=t.shadowOffsetY,i.shadowBlur=t.shadowBlur,i.shadowStroke=!0,i.shadowFill=!0):(i.shadowColor="#000",i.shadowOffsetX=0,i.shadowOffsetY=0,i.shadowBlur=0,i.shadowStroke=!1,i.shadowFill=!1),e.hasOwnProperty("u")?(!0===e.u?i.underlineColor=t.underlineColor:i.underlineColor=e.u,i.underlineThickness=t.underlineThickness,i.underlineOffset=t.underlineOffset):(i.underlineColor="#000",i.underlineThickness=0,i.underlineOffset=0),i},propToTagText:function(t,e,i){null==i&&(i=Ye);var n=[];for(var s in i)e.hasOwnProperty(s)||n.push("[/".concat(s,"]"));for(var s in e){var r=e[s];if(i[s]!==r)switch(s){case"size":n.push("[size=".concat(r.replace("px",""),"]"));break;case"color":case"stroke":case"y":case"img":case"area":case"align":n.push("[".concat(s,"=").concat(r,"]"));break;case"u":!0===r?n.push("[u]"):n.push("[u=".concat(r,"]"));break;default:n.push("[".concat(s,"]"))}}return n.push(t),n.join("")}},We=function(t,e,i,n){return e===gi?t[i]=n:t.hasOwnProperty(i)&&delete t[i],t},Ge=function(t,e){return t&&e?"bold italic":t?"bold":e?"italic":""},Ue=/\[b\]|\[\/b\]|\[i\]|\[\/i\]|\[size=(\d+)\]|\[\/size\]|\[color=([a-z]+|#[0-9abcdef]+)\]|\[\/color\]|\[u\]|\[u=([a-z]+|#[0-9abcdef]+)\]|\[\/u\]|\[shadow\]|\[\/shadow\]|\[stroke\]|\[stroke=([a-z]+|#[0-9abcdef]+)\]|\[\/stroke\]|\[y=([-.0-9]+)\]|\[\/y\]|\[img=([^\]]+)\]|\[\/img\]|\[area=([^\]]+)\]|\[\/area\]|\[align=([^\]]+)\]|\[\/align\]/gi,He=/\[b\]/i,Xe=/\[\/b\]/i,Ne=/\[i\]/i,Je=/\[\/i\]/i,Ke=/\[size=(\d+)\]/i,Ze=/\[\/size\]/i,qe=/\[color=([a-z]+|#[0-9abcdef]+)\]/i,$e=/\[\/color\]/i,Qe=/\[u\]/i,ti=/\[u=([a-z]+|#[0-9abcdef]+)\]/i,ei=/\[\/u\]/i,ii=/\[shadow\]/i,ni=/\[\/shadow\]/i,si=/\[stroke\]/i,ri=/\[stroke=([a-z]+|#[0-9abcdef]+)\]/i,oi=/\[\/stroke\]/i,ai=/\[y=([-.0-9]+)\]/i,hi=/\[\/y\]/i,li=/\[img=([^\]]+)\]/i,ui=/\[\/img\]/i,ci=/\[area=([^\]]+)\]/i,di=/\[\/area\]/i,fi=/\[align=([^\]]+)\]/i,pi=/\[\/align\]/i,vi=!1,gi=!0,yi=function(){w(o,Le);var r=T(o);function o(t,e,i,n,s){return B(this,o),r.call(this,t,e,i,n,s,"rexBBCodeText",Ve)}return o}();u.register("BBCodeText",function(t,e,i,n){var s=new yi(this.scene,t,e,i,n);return this.scene.add.existing(s),s}),x(window,"RexPlugins.UI.BBCodeText",yi);var ki={plainText:null,prevProp:null},mi=new Ht,bi=function(){function e(t){B(this,e),void 0===t&&(t={}),this.tags=t}return m(e,[{key:"addTag",value:function(t,e){this.tags[t]=e}},{key:"getTag",value:function(t){return this.tags[t]}},{key:"splitText",value:function(t,e){for(var i=[],n=0;;){var s=wi.exec(t);if(!s){var r=t.length;return n<r&&i.push(t.substring(n,r)),i}var o=s[0],a=wi.lastIndex-o.length;if(n<a&&i.push(t.substring(n,a)),void 0===e)i.push(o);else if(1===e)if(Si.test(o)){var h=o.match(Pi);i.push(h[2])}else if(Ti.test(o)){h=o.match(Oi);i.push(h[2])}n=wi.lastIndex}}},{key:"tagTextToProp",value:function(t){var e,i;if(Si.test(t)){if(null!=(r=t.match(Pi))){var n=r[1],s=this.tags;(i=s.hasOwnProperty(n)?s[n]:{})._class=n,e=r[2]}}else if(Ti.test(t)){var r;if(null!=(r=t.match(Oi))){var o=r[1];(i=xi(o))._style=o,e=r[2]}}null==e&&(e=t),null==i&&(i={});var a=ki;return a.plainText=e,a.prop=i,a}},{key:"propToContextStyle",value:function(t,e){var i=mi;if(e.hasOwnProperty("img"))i.image=e.img;else{if(i.image=null,e.hasOwnProperty("family")||e.hasOwnProperty("fontFamily")||e.hasOwnProperty("font-family")){var n=e.hasOwnProperty("family")?e.family:e.hasOwnProperty("fontFamily")?e.fontFamily:e["font-family"];i.fontFamily=n}else i.fontFamily=t.fontFamily;if(e.hasOwnProperty("size")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("font-size")){var s=e.hasOwnProperty("size")?e.size:e.hasOwnProperty("fontSize")?e.fontSize:e["font-size"];"number"==typeof s&&(s="".concat(s,"px")),i.fontSize=s}else i.fontSize=t.fontSize;if(e.hasOwnProperty("style")||e.hasOwnProperty("fontStyle")||e.hasOwnProperty("font-style")){var r=e.hasOwnProperty("style")?e.style:e.hasOwnProperty("fontStyle")?e.fontStyle:e["font-style"];i.fontStyle=r}else i.fontStyle=t.fontStyle;if(e.hasOwnProperty("color")||e.hasOwnProperty("font-color")){var o=e.hasOwnProperty("color")?e.color:e["font-color"];i.color=o}else i.color=t.color;if(e.hasOwnProperty("stroke")){var a=e.stroke;i.stroke=a.hasOwnProperty("color")?a.color:t.stroke,i.strokeThickness=a.hasOwnProperty("thinkness")?a.thinkness:t.strokeThickness}else i.stroke=t.stroke,i.strokeThickness=t.strokeThickness}if(e.hasOwnProperty("shadow")){var h=e.shadow;i.shadowColor=h.hasOwnProperty("color")?h.color:t.shadowColor,i.shadowOffsetX=h.hasOwnProperty("offsetX")?h.offsetX:t.shadowOffsetX,i.shadowOffsetY=h.hasOwnProperty("offsetY")?h.offsetY:t.shadowOffsetY,i.shadowBlur=h.hasOwnProperty("blur")?h.blur:t.shadowBlur,i.shadowStroke=!0,i.shadowFill=!0}else i.shadowColor=t.shadowColor,i.shadowOffsetX=t.shadowOffsetX,i.shadowOffsetY=t.shadowOffsetY,i.shadowBlur=t.shadowBlur,i.shadowStroke=t.shadowStroke,i.shadowFill=t.shadowFill;if(e.hasOwnProperty("u")||e.hasOwnProperty("underline")){var l=e.hasOwnProperty("u")?e.u:e.underline;i.underlineColor=l.hasOwnProperty("color")?l.color:t.underlineColor,i.underlineThickness=l.hasOwnProperty("thinkness")?l.thinkness:t.underlineThickness,i.underlineOffset=l.hasOwnProperty("offset")?l.offset:t.underlineOffset}else i.underlineColor=t.underlineColor,i.underlineThickness=t.underlineThickness,i.underlineOffset=t.underlineOffset;return i}},{key:"propToTagText",value:function(t,e){return e.hasOwnProperty("_class")?""===t&&this.isTextTag(e._class)?"":"<class='".concat(e._class,"'>").concat(t,"</class>"):e.hasOwnProperty("_style")?"<style='".concat(e._style,"'>").concat(t,"</style>"):t}},{key:"destroy",value:function(){this.tags=void 0}},{key:"isTextTag",value:function(t){var e=this.tags[t];return!!e&&null==e.img}}]),e}(),xi=function(t){for(var e,i,n,s={},r=0,o=(t=t.split(";")).length;r<o;r++)if(i=(e=t[r].split(":"))[0],n=e[1],!Ci(i)&&!Ci(n)){switch(i){case"stroke":var a=n.split(" ");n={},1<=(l=a.length)&&(n.color=a[0]),2<=l&&(n.thinkness=parseInt(a[1].replace("px","")));break;case"shadow":var h=n.split(" ");n={},1<=(l=h.length)&&(n.color=h[0]),2<=l&&(n.offsetX=parseInt(h[1].replace("px",""))),3<=l&&(n.offsetY=parseInt(h[2].replace("px",""))),4<=l&&(n.blur=parseInt(h[3].replace("px","")));break;case"u":case"underline":var l,u=n.split(" ");n={},1<=(l=u.length)&&(n.color=u[0]),2<=l&&(n.thinkness=parseInt(u[1].replace("px",""))),3<=l&&(n.offset=parseInt(u[2].replace("px","")));break;case"y":n=parseFloat(n)}s[i]=n}return s},Ci=function(t){return 0===(t=t.replace(Mi,"")).length},wi=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,Si=/<\s*class=/i,Pi=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,Ti=/<\s*style=/i,Oi=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,Mi=/^\s+|\s+$/,Ei=Phaser.Utils.Objects.GetValue,_i=function(){w(l,Le);var h=T(l);function l(t,e,i,n,s){var r;B(this,l);var o=Ei(s,"tags",void 0),a=new bi(o);return(r=h.call(this,t,e,i,n,s,"rexTagText",a)).parser=a,r}return m(l,[{key:"addTag",value:function(t,e){return this.parser.addTag(t,e),this.updateText(!0)}},{key:"addTags",value:function(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}},{key:"getTag",value:function(t){return this.parser.getTag(t)}},{key:"preDestroy",value:function(){O(C(l.prototype),"preDestroy",this).call(this),this.parser.destroy(),this.parser=void 0}}]),l}();u.register("tagText",function(t,e,i,n){var s=new _i(this.scene,t,e,i,n);return this.scene.add.existing(s),s}),x(window,"RexPlugins.UI.TagText",_i);var Bi=Phaser.GameObjects.Zone,zi=Phaser.Utils.Array.Add,Ri=Phaser.Utils.Array.Remove,Ii=function(){w(a,Bi);var o=T(a);function a(t,e,i,n,s){var r;return B(this,a),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=1),(r=o.call(this,t,e,i,n,s)).children=[],r}return m(a,[{key:"destroy",value:function(t){if(this.scene){if(t)for(var e,i=this.children.length-1;0<=i;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),O(C(a.prototype),"destroy",this).call(this,t)}}},{key:"contains",value:function(t){return-1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return zi(this.children,t,0,function(t){t.once("destroy",e.onChildDestroy,e)},this),this}},{key:"remove",value:function(t,e){var i=this;return Ri(this.children,t,function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()}),this}},{key:"onChildDestroy",value:function(t){this.remove(t,!1)}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i<n;i++)(e=this.children[i]).off("destroy",this.onChildDestroy,this),t&&e.destroy();return this.children.length=0,this}}]),a}(),Di=Phaser.GameObjects.Components;Phaser.Class.mixin(Ii,[Di.Alpha,Di.Flip]);function Li(t){var e;return t.hasOwnProperty("rexContainer")&&(e=t.rexContainer.parent),e}function ji(t){for(var e=Li(t);e;)e=Li(t=e);return t}function Ai(e){if(!e.hasOwnProperty("rexContainer")){var t={parent:null,self:null,x:0,y:0,rotation:0,scaleX:0,scaleY:0,alpha:0,visible:!0,active:!0};Object.defineProperty(t,"angle",{get:function(){return Ni(this.rotation)},set:function(t){this.rotation=Xi(t)}}),Object.defineProperty(t,"displayWidth",{get:function(){return e.width*this.scaleX},set:function(t){this.scaleX=t/e.width}}),Object.defineProperty(t,"displayHeight",{get:function(){return e.height*this.scaleY},set:function(t){this.scaleY=t/e.height}}),e.rexContainer=t}return e.rexContainer}function Fi(t){return this.setParent(t),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),Ki.call(this,t),this}function Yi(t){this.setParent(t);var e=Ai(t);return e.x=t.x,e.y=t.y,e.rotation=t.rotation,e.scaleX=t.scaleX,e.scaleY=t.scaleY,e.alpha=t.alpha,e.visible=t.visible,e.active=t.active,this.updateChildPosition(t).updateChildAlpha(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),Ki.call(this,t),this}function Vi(t,e){return t===e?1:t/e}function Wi(t,e){if(0===t.length)return t;void 0===e&&(e=!1);var i=t[0].scene.sys.displayList;return i.depthSort(),e?t.sort(function(t,e){return i.getIndex(e)-i.getIndex(t)}):t.sort(function(t,e){return i.getIndex(t)-i.getIndex(e)}),t}function Gi(t,e){for(var i=[t];0<i.length;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,M(n.children))}}function Ui(t){return"[object Array]"===Object.prototype.toString.call(t)}function Hi(t){var e=this.getAllChildren([this]);return Wi(e),t.add(e),this}var Xi=Phaser.Math.DegToRad,Ni=Phaser.Math.RadToDeg,Ji={setParent:function(t,e){void 0===e&&(e=this);var i=Ai(t);return e?(i.parent=e,i.self=t):(i.parent=null,i.self=null),this},getParent:function(t){return void 0===t&&(t=this),Li(t)},getTopmostParent:function(t){return void 0===t&&(t=this),ji(t)}},Ki=Ii.prototype.add,Zi={add:function(t){return Array.isArray(t)?this.addMultiple(t):Fi.call(this,t),this},pin:function(t){return Array.isArray(t)?this.addMultiple(t):Fi.call(this,t),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)Fi.call(this,t[e]);return this},addLocal:function(t){return Array.isArray(t)?this.addMultiple(t):Yi.call(this,t),this},addLocalMultiple:function(t){for(var e=0,i=t.length;e<i;e++)Yi.call(this,t[e]);return this}},qi=Ii.prototype.remove,$i=Ii.prototype.clear,Qi={remove:function(t,e){return Li(t)!==this||(this.setParent(t,null),qi.call(this,t,e)),this},clear:function(t){for(var e=0,i=this.children.length;e<i;e++)this.setParent(this.children[e],null);return $i.call(this,t),this}},tn={getLocalState:function(t){return Ai(t)},resetChildState:function(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState:function(t){for(var e=0,i=t.length;e<i;e++)this.resetChildState(t[e]);return this},syncProperties:function(){return this.syncPosition().syncVisible().syncAlpha().syncActive().syncScrollFactor().syncMask(),this}},en=Phaser.Math.RotateAround,nn={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,en(t,0,0,-this.rotation),t.x/=this.scaleX,t.y/=this.scaleY,t},localToWorld:function(t){return t.x*=this.scaleX,t.y*=this.scaleY,en(t,0,0,this.rotation),t.x+=this.x,t.y+=this.y,t}},sn={updateChildPosition:function(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=Ai(t),i=e.parent;return t.x=e.x,t.y=e.y,i.localToWorld(t),t.scaleX=e.scaleX*i.scaleX,t.scaleY=e.scaleY*i.scaleY,t.rotation=e.rotation+i.rotation,t.isRexContainerLite&&(t.syncChildrenEnable=!0,t.syncPosition()),this},syncPosition:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildPosition,this),this},resetChildPositionState:function(t){var e=Ai(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=Vi(t.scaleX,i.scaleX),e.scaleY=Vi(t.scaleY,i.scaleY),e.rotation=t.rotation-i.rotation,this},setChildPosition:function(t,e,i){return t.x=e,t.y=i,this.resetChildPositionState(t),this},setChildLocalPosition:function(t,e,i){var n=Ai(t);return n.x=e,n.y=i,this.updateChildPosition(t),this},resetLocalPositionState:function(){var t=Ai(this).parent;return t&&t.resetChildPositionState(this),this}},rn={updateChildRotation:function(t){var e=Ai(t),i=e.parent;return t.rotation=i.rotation+e.rotation,this},syncRotation:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState:function(t){var e=Ai(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation:function(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle:function(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation:function(t,e){return Ai(t).rotation=e,this.updateChildRotation(t),this},resetLocalRotationState:function(){var t=Ai(this).parent;return t&&t.resetChildRotationState(this),this}},on={updateChildScale:function(t){var e=Ai(t),i=e.parent;return t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY,this},syncScale:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState:function(t){var e=Ai(t),i=e.parent;return e.scaleX=Vi(t.scaleX,i.scaleX),e.scaleY=Vi(t.scaleY,i.scaleY),this},setChildScale:function(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale:function(t,e,i){void 0===i&&(i=e);var n=Ai(t);return n.scaleX=e,n.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize:function(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState:function(){var t=Ai(this).parent;return t&&t.resetChildScaleState(this),this}},an={updateChildVisible:function(t){var e=Ai(t),i=e.parent,n=!e.hasOwnProperty("maskVisible")||e.maskVisible;return t.visible=i.visible&&e.visible&&n,this},syncVisible:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState:function(t){var e=Ai(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible:function(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible:function(t,e){return void 0===e&&(e=!0),Ai(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible:function(t,e){return void 0===e&&(e=!0),Ai(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState:function(){var t=Ai(this).parent;return t&&t.resetChildVisibleState(this),this}},hn={updateChildAlpha:function(t){var e=Ai(t),i=e.parent;return t.alpha=i.alpha*e.alpha,this},syncAlpha:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState:function(t){var e=Ai(t),i=e.parent;return e.alpha=Vi(t.alpha,i.alpha),this},setChildAlpha:function(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha:function(t,e){return Ai(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState:function(){var t=Ai(this).parent;return t&&t.resetChildAlphaState(this),this}},ln={updateChildActive:function(t){var e=Ai(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState:function(t){return Ai(t).active=t.active,this},setChildActive:function(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive:function(t,e){return void 0===e&&(e=!0),Ai(t).active=e,this.updateChildActive(t),this},resetLocalActiveState:function(){var t=Ai(this).parent;return t&&t.resetChildActiveState(this),this}},un={updateChildScrollFactor:function(t){var e=Ai(t).parent;return t.setScrollFactor(e.scrollFactorX,e.scrollFactorY),this},syncScrollFactor:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},cn={updateChildMask:function(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask:function(t){return this.mask=t,this},clearMask:function(t){return void 0===t&&(t=!1),t&&this.mask&&this.mask.destroy(),this.mask=null,this}},dn={setDepth:function(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),n=0,s=i.length;n<s;n++)i[n].depth=t;return this},swapDepth:function(t){var e=this.depth,i=t.depth;return this.setDepth(i),t.setDepth(e),this},incDepth:function(t){if(this.depth+=t,this.children)for(var e=this.getAllChildren(),i=0,n=e.length;i<n;i++)e[i].depth+=t;return this},moveDepthBelow:function(t){var e=t.scene.children,i=this.getAllChildren([this]);Wi(i);for(var n=0,s=i.length;n<s;n++){var r=i[n];if(e.exists(r)){e.moveBelow(t,r);break}}return this},moveDepthAbove:function(t){var e=t.scene.children,i=this.getAllChildren([this]);Wi(i,!0);for(var n=0,s=i.length;n<s;n++){var r=i[n];if(e.exists(r)){e.moveAbove(t,r);break}}return this}},fn=Phaser.Utils.Array,pn={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e<i;e++)t.push(this.children[e]);else t=this.children;return t},getAllChildren:function(e){void 0===e&&(e=[]);var i=this;return Gi(i,function(t){t!==i&&e.push(t)}),e},getAllVisibleChildren:function(e){void 0===e&&(e=[]);var i=this;return Gi(i,function(t){if(t!==i)return!t.visible||void e.push(t)}),e},bfs:function(t,e){return void 0===e&&(e=this),Gi(e,t),this},dfs:function(t,e){return void 0===e&&(e=this),function t(e,i){if(!i(e)&&e.isRexContainerLite)for(var n=e.children,s=0,r=n.length;s<r;s++)t(n[s],i)}(e,t),this},contains:function(t){var e=Li(t);return!!e&&(e===this||this.contains(e))},getByName:function(t,e){if(e){for(var i,n,s=[this];s.length;)for(var r=0,o=(i=s.shift()).children.length;r<o;r++){if((n=i.children[r]).name===t)return n;n.isRexContainerLite&&s.push(n)}return null}return fn.GetFirst(this.children,"name",t)},getRandom:function(t,e){return fn.GetRandom(this.children,t,e)},getFirst:function(t,e,i,n){return fn.GetFirstElement(this.children,t,e,i,n)},getAll:function(t,e,i,n){return fn.GetAll(this.children,t,e,i,n)},count:function(t,e,i,n){return fn.CountAllMatching(this.children,t,e,i,n)},swap:function(t,e){return fn.Swap(this.children,t,e),this},setAll:function(t,e,i,n){return fn.SetAll(this.children,t,e,i,n),this}},vn={tweenChild:function(t){var e=t.targets;Ui(e)||(e=[e]);for(var r,i,n=[],s=0,o=e.length;s<o;s++)(i=e[s]).hasOwnProperty("rexContainer")&&(r=i.scene,n.push(i.rexContainer));if(r){t.targets=n;var a=r.tweens.add(t);return a.on("update",function(t,e,i){if(i.parent){var n=i.parent,s=i.self;switch(e){case"x":case"y":n.updateChildPosition(s);break;case"angle":case"rotation":n.updateChildRotation(s);break;case"scaleX":case"scaleY":case"displayWidth":case"displayHeight":n.updateChildScale(s);break;case"alpha":n.updateChildAlpha(s)}}else r.tweens.remove(t)}),a}},tween:function(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}},gn={addToLayer:Hi,addToContainer:Hi},yn=Phaser.Math.RotateAround,kn={changeOrigin:function(t,e){this.syncChildrenEnable=!1,function(t,e,i){void 0===i&&(i=e);var n={x:(e-t.originX)*t.displayWidth,y:(i-t.originY)*t.displayHeight};yn(n,0,0,t.rotation),t.originX=e,t.originY=i,t.x=t.x+n.x,t.y=t.y+n.y}(this,t,e),this.syncChildrenEnable=!0;for(var i=this.getAllChildren(),n=0,s=i.length;n<s;n++)this.resetChildPositionState(i[n]);return this}};Object.assign(kn,Ji,Zi,Qi,tn,nn,sn,rn,on,an,hn,ln,un,cn,dn,pn,vn,gn);var mn=function(){w(h,Ii);var a=T(h);function h(t,e,i,n,s,r){var o;return B(this,h),(o=a.call(this,t,e,i,n,s)).type="rexContainerLite",o.isRexContainerLite=!0,o.syncChildrenEnable=!0,o._active=!0,o._mask=null,o._scrollFactorX=1,o._scrollFactorY=1,r&&o.add(r),o}return m(h,[{key:"destroy",value:function(t){this.scene&&(this.syncChildrenEnable=!1,O(C(h.prototype),"destroy",this).call(this,t))}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"x",get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.syncPosition())}},{key:"y",get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.syncPosition())}},{key:"rotation",get:function(){return O(C(h.prototype),"rotation",this)},set:function(t){this.rotation!==t&&(e(C(h.prototype),"rotation",t,this,!0),this.syncPosition())}},{key:"scaleX",get:function(){return O(C(h.prototype),"scaleX",this)},set:function(t){this.scaleX!==t&&(e(C(h.prototype),"scaleX",t,this,!0),this.syncPosition())}},{key:"scaleY",get:function(){return O(C(h.prototype),"scaleY",this)},set:function(t){this.scaleY!==t&&(e(C(h.prototype),"scaleY",t,this,!0),this.syncPosition())}},{key:"visible",get:function(){return O(C(h.prototype),"visible",this)},set:function(t){O(C(h.prototype),"visible",this)!==t&&(e(C(h.prototype),"visible",t,this,!0),this.syncVisible())}},{key:"alpha",get:function(){return O(C(h.prototype),"alpha",this)},set:function(t){O(C(h.prototype),"alpha",this)!==t&&(e(C(h.prototype),"alpha",t,this,!0),this.syncAlpha())}},{key:"active",get:function(){return this._active},set:function(t){this._active!==t&&(this._active=t,this.syncActive())}},{key:"mask",get:function(){return this._mask},set:function(t){this._mask!==t&&(this._mask=t,this.syncMask())}},{key:"scrollFactorX",get:function(){return this._scrollFactorX},set:function(t){this._scrollFactorX!==t&&(this._scrollFactorX=t,this.syncScrollFactor())}},{key:"scrollFactorY",get:function(){return this._scrollFactorY},set:function(t){this._scrollFactorY!==t&&(this._scrollFactorY=t,this.syncScrollFactor())}},{key:"list",get:function(){return this.children}}],[{key:"GetParent",value:function(t){return Li(t)}}]),h}();Object.assign(mn.prototype,kn),u.register("container",function(t,e,i,n,s){var r=new mn(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),x(window,"RexPlugins.UI.Container",mn),u.register("canvas",function(t,e,i,n){var s=new dt(this.scene,t,e,i,n);return this.scene.add.existing(s),s}),x(window,"RexPlugins.UI.Canvas",dt);var bn=Phaser.Utils.Objects.GetValue,xn=function(){w(h,dt);var a=T(h);function h(t,e,i,n,s,r){var o;return B(this,h),(o=a.call(this,t,e,i)).type="rexCircleMaskImage",o.setTexture(n,s,r),o}return m(h,[{key:"setTexture",value:function(t,e,i){var n,s;if("object"===P(e)&&(i=e,e=void 0),s="string"==typeof i?void(n=i):(n=bn(i,"maskType",0),bn(i,"backgroundColor",void 0)),void 0===n?n=0:"string"==typeof n&&(n=Cn[n]),this._textureKey=t,this._frameName=e,null===n)return this.loadTexture(t,e),this.dirty=!0,this;var r=null!=s;r||this.loadTexture(t,e);var o=this.canvas,a=this.context,h=o.width,l=o.height;switch(a.save(),a.globalCompositeOperation=r?"source-over":"destination-in",a.beginPath(),n){case 2:var u=bn(i,"radius",0),c=bn(i,"iteration",void 0);vt(a,0,0,h,l,u,c);break;default:var d=Math.floor(h/2),f=Math.floor(l/2);0===n?a.arc(d,f,Math.min(d,f),0,2*Math.PI):a.ellipse(d,f,d,f,0,0,2*Math.PI)}return r&&(a.fillStyle=s),a.fill(),a.restore(),r&&(a.save(),a.globalCompositeOperation="destination-atop",this.loadTexture(t,e),a.restore()),this.dirty=!0,this}}]),h}(),Cn={circle:0,ellipse:1,roundRectangle:2};u.register("circleMaskImage",function(t,e,i,n,s){var r=new xn(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),x(window,"RexPlugins.UI.CircleMaskImage",xn);function wn(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;for(var n=e.split("."),s=t,r=i,o=0;o<n.length;o++){if(!s.hasOwnProperty(n[o])){r=i;break}r=s[n[o]],s=s[n[o]]}return r}return i}var Sn={enableData:function(){return void 0===this.data&&(this.data={}),this},getData:function(t,e){return this.enableData(),void 0===t?this.data:wn(this.data,t,e)},setData:function(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},incData:function(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData:function(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData:function(){return this.data&&Ot(this.data),this},resetData:function(t){if(this.clearData(),t)for(var e in this.enableData(),t)this.data[e]=t[e];return this},cloneData:function(){return this.data?Mt(this.data):{}}},Pn=Phaser.Math.DegToRad,Tn=Phaser.Math.RadToDeg,On=Phaser.Utils.Objects.GetValue,Mn=function(){function i(t,e){B(this,i),this.setParent(t),this.type=e,this.setActive().setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setDrawBelowCallback().setDrawAboveCallback(),this.originX=0,this.offsetX=0,this.offsetY=0}return m(i,[{key:"setParent",value:function(t){return this.parent=t,this}},{key:"scene",get:function(){return this.parent.scene}},{key:"canvas",get:function(){return this.parent?this.parent.canvas:null}},{key:"context",get:function(){return this.parent?this.parent.context:null}},{key:"setDirty",value:function(t){return t&&this.parent&&(this.parent.dirty=!0),this}},{key:"active",get:function(){return this._active},set:function(t){this.setDirty(this._active!=t),this._active=t}},{key:"setActive",value:function(t){return void 0===t&&(t=!0),this.active=t,this}},{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return Tn(this._rotation)},set:function(t){this.rotation=Pn(t)}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"modifyPorperties",value:function(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=On(t,"width",void 0),i=On(t,"height",void 0),n=On(t,"scaleX",void 0),s=On(t,"scaleY",void 0);return void 0!==e&&(void 0===i&&void 0===s?this.setWidth(e,!0):this.setWidth(e)),void 0!==i&&(void 0===e&&void 0===n?this.setHeight(i,!0):this.setHeight(i)),void 0!==n&&void 0===e&&this.setScaleX(n),void 0!==s&&void 0===i&&this.setScaleY(s),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setLeftSpace(t.rightSpace),this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"onFree",value:function(){this.setParent().setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setDrawBelowCallback().setDrawAboveCallback()}},{key:"drawContent",value:function(){}},{key:"draw",value:function(){var t=this.context;t.save();var e=this.x+this.leftSpace+this.offsetX-this.originX*this.width,i=this.y+this.offsetY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.globalAlpha=this.alpha,t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation),this.drawBelowCallback&&this.drawBelowCallback.call(this),this.drawContent(),this.drawAboveCallback&&this.drawAboveCallback.call(this),t.restore()}}]),i}();Object.assign(Mn.prototype,Sn);function En(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]}function _n(t,e){return void 0===e?t:t[e]}function Bn(t,e,i){var n=P(e);"string"===n?t[e]=i:"number"===n?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Nn(e,"left",0),t.right=Nn(e,"right",0),t.top=Nn(e,"top",0),t.bottom=Nn(e,"bottom",0))}function zn(t){var e=t.type;return e===Jn||e===Kn}function Rn(t){return t.type===Jn&&"\n"===t.text}function In(t,e){e&&this.textStyle.modify(e);for(var i=this.lastAppendedChildren.length=0,n=t.length;i<n;i++){var s=t.charAt(i),r=this.poolManager.allocate(Jn);null===r?r=new qn(this,s,this.textStyle):r.setParent(this).setActive().modifyStyle(this.textStyle).setText(s),this.children.push(r),this.lastAppendedChildren.push(r)}return this}function Dn(t,e,i){var n=this.poolManager.allocate(Kn);return null===n?n=new $n(this,t,e):n.setParent(this).setActive().setTexture(t,e),n.modifyPorperties(i),this.lastAppendedChildren.length=0,this.children.push(n),this.lastAppendedChildren.push(n),this}function Ln(t,e,i,n){var s=this.poolManager.allocate(Zn);return null===s?s=new Qn(this,t,e,i,n):s.setParent(this).setActive().setName(t).setCallback(e,n).setParameter(i),this.lastAppendedChildren.length=0,this.children.push(s),this.lastAppendedChildren.push(s),this}function jn(t,e){if(!e)return t;for(var i in null==t&&(t={}),e)t.hasOwnProperty(i)||(t[i]=e[i]);return t}function An(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var s=t.length,r=e,o=n.word,a=0;r<s;){var h=t[r];if(h.type!==Jn||" "===h.text||"\n"===h.text){r===e&&(o.push(h),a+=h.outerWidth);break}if(o.push(h),a+=h.outerWidth,r++,i)break}return n.width=a,n}function Fn(t){var e,i=is(t,"start",0),n=is(t,"padding.top",0),s=is(t,"padding.bottom",0),r=is(t,"lineHeight",void 0);if(void 0===r)e=is(t,"maxLines",0),r=0<this.fixedHeight?(o=this.fixedHeight-this.padding.top-this.padding.bottom-n-s)/e:0;else if(0<this.fixedHeight){if(void 0===(e=is(t,"maxLines",void 0))){var o=this.fixedHeight-this.padding.top-this.padding.bottom-n-s;e=Math.floor(o/r)}}else e=is(t,"maxLines",0);var a=0===e,h=is(t,"wrapWidth",void 0);void 0===h&&(h=0<this.fixedWidth?this.fixedWidth-this.padding.left-this.padding.right:1/0);for(var l=is(t,"letterSpacing",0),u=is(t,"hAlign",0),c=is(t,"vAlign",0),d=is(t,"charWrap",!1),f={start:i,isLastPage:!1,padding:{top:n,bottom:s},lineHeight:r,maxLines:e,wrapWidth:h,letterSpacing:l,hAlign:u,vAlign:c,charWrap:d,children:[],lines:[],maxLineWidth:0,linesHeight:0},p=this.children,v=0,g=p.length;v<g;v++)p[v].setActive(!1);h+=l;for(var y,k=this.padding.left,m=k,b=this.padding.top+r+n,x=h,C=i,w=p.length,S=f.children,P=f.lines,T=[],O=0,M=0;C<w;){var E=p[C];if(zn(E)){var _=(y=An(p,C,d,y)).word,B=_.length,z=y.width+B*l;C+=B;var R=Rn(_[0]);if(x<z||R){if(R)(I=_[0]).setActive().setPosition(m,b),S.push(I),T.push(I);if(m=k,b+=r,x=h,P.push({children:T,width:O}),M=Math.max(M,O),O=0,T=[],!a&&P.length===e)break;if(R)continue}x-=z,O+=z;for(v=0,g=_.length;v<g;v++){var I;(I=_[v]).setActive().setPosition(m,b),S.push(I),T.push(I),m+=I.outerWidth+l}}else C++,E.setActive(),S.push(E),T.push(E)}0<T.length&&(P.push({children:T,width:O}),M=Math.max(M,O)),f.start+=S.length,f.isLastPage=f.start===w,f.maxLineWidth=M,f.linesHeight=P.length*r+n+s;var D=0<this.fixedWidth?this.fixedWidth:f.maxLineWidth+this.padding.left+this.padding.right,L=0<this.fixedHeight?this.fixedHeight:f.linesHeight+this.padding.top+this.padding.bottom;return function(t,e,i){var n=t.hAlign,s=t.vAlign;if("string"==typeof n&&(n=ts[n],t.hAlign=n),"string"==typeof s&&(s=es[s],t.vAlign=s),0!==n)for(var r=t.lines,o=0,a=r.length;o<a;o++){var h,l=r[o],u=l.width,c=l.children;switch(n){case 1:h=(e-u)/2;break;case 2:h=e-u}for(var d=0,f=c.length;d<f;d++){c[d].x+=h}}if(0!==s){var p,v=t.linesHeight;switch(s){case 1:p=(i-v)/2;break;case 2:p=i-v}for(d=0,f=(c=t.children).length;d<f;d++){c[d].y+=p}}}(f,D-this.padding.left-this.padding.right,o=L-this.padding.top-this.padding.bottom-n-s),this.setSize(D,L),f}function Yn(t){var e,i=ns(t,"start",0),n=ns(t,"padding.top",0),s=ns(t,"padding.bottom",0),r=ns(t,"padding.left",0),o=ns(t,"padding.right",0),a=ns(t,"lineWidth",void 0);if(void 0===a)e=ns(t,"maxLines",0),a=0<this.fixedWidth?(h=this.fixedWidth-this.padding.left-this.padding.right-r-o)/e:0;else if(0<this.fixedWidth){if(void 0===(e=ns(t,"maxLines",void 0))){var h=this.fixedWidth-this.padding.left-this.padding.right;e=Math.floor(h/a)}}else e=ns(t,"maxLines",0);var l=0===e,u=ns(t,"fixedChildHeight",void 0);if(void 0===u){var c=ns(t,"charPerLine",void 0);if(void 0!==c){var d=this.fixedHeight-this.padding.top-this.padding.bottom-n-s;u=Math.floor(d/c)}}var f=ns(t,"wrapHeight",void 0);void 0===f&&(f=0<this.fixedHeight?this.fixedHeight-this.padding.top-this.padding.bottom:1/0);for(var p=ns(t,"letterSpacing",0),v=ns(t,"rtl",!0),g={start:i,isLastPage:!1,padding:{top:n,bottom:s,left:r,right:o},lineWidth:a,maxLines:e,fixedChildHeight:u,wrapHeight:f,letterSpacing:p,hAlign:ns(t,"hAlign",v?2:0),vAlign:ns(t,"vAlign",0),rtl:v,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,k=0,m=y.length;k<m;k++)y[k].setActive(!1);f+=p;for(var b=this.padding.left+r,x=this.padding.top+n,C=b,w=x,S=f,P=i,T=y.length,O=g.children,M=g.lines,E=[],_=0,B=0;P<T;){var z=y[P];if(P++,zn(z)){var R=(void 0!==u?u:z.height)+p,I=Rn(z);if(S<R||I){if(I&&(z.setActive().setPosition(C,w).setOrigin(.5),O.push(z),E.push(z)),C=b,w=x,S=f,M.push({children:E,height:_}),B=Math.max(B,_),_=0,E=[],!l&&M.length===e)break;if(I)continue}S-=R,_+=R,z.setActive().setPosition(C,w).setOrigin(.5),O.push(z),E.push(z),w+=R}else z.setActive(),O.push(z),E.push(z)}0<E.length&&(M.push({children:E,height:_}),B=Math.max(B,_)),g.start+=O.length,g.isLastPage=g.start===T,g.maxLineHeight=B,g.linesWidth=M.length*a+r+o;var D=0<this.fixedWidth?this.fixedWidth:g.linesWidth+this.padding.left+this.padding.right,L=0<this.fixedHeight?this.fixedHeight:g.maxLineHeight+this.padding.top+this.padding.bottom;return function(t,e,i){var n=t.hAlign,s=t.vAlign;"string"==typeof n&&(n=ts[n],t.hAlign=n),"string"==typeof s&&(s=es[s],t.vAlign=s);var r,o=t.rtl,a=t.lines,h=t.lineWidth,l=t.linesWidth;switch(n){case 0:r=0;break;case 1:r=(e-l)/2;break;case 2:r=e-l}o&&(r+=h);for(var u=0,c=a.length;u<c;u++){var d,f=a[o?c-u-1:u],p=f.children,v=f.height;switch(s){case 0:d=0;break;case 1:d=(i-v)/2;break;case 2:d=i-v}for(var g=0,y=p.length;g<y;g++){var k=p[g];k.x+=r,k.y+=d}r+=h}}(g,h=D-this.padding.left-this.padding.right-r-o,d=L-this.padding.top-this.padding.bottom-n-s),this.setSize(D,L),g}var Vn=Phaser.Utils.Objects.GetValue,Wn=function(){w(s,Mn);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,"background")).setColor(Vn(e,"color",null),Vn(e,"color2",null),Vn(e,"horizontalGradient",!0)),i.setStroke(Vn(e,"stroke",null),Vn(e,"strokeThickness",2)),i.setCornerRadius(Vn(e,"cornerRadius",0),Vn(e,"cornerIteration",null)),i}return m(s,[{key:"color",get:function(){return this._color},set:function(t){t=pt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}},{key:"color2",get:function(){return this._color2},set:function(t){t=pt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=pt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}},{key:"setStroke",value:function(t,e){return this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"drawContent",value:function(){gt(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}]),s}(),Gn=Phaser.Utils.Objects.GetValue,Un=function(){w(s,Mn);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,"background")).setColor(Gn(e,"color",null),Gn(e,"color2",null),Gn(e,"horizontalGradient",!0)),i.setStroke(Gn(e,"stroke",null),Gn(e,"strokeThickness",2)),i}return m(s,[{key:"color",get:function(){return this._color},set:function(t){t=pt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}},{key:"color2",get:function(){return this._color2},set:function(t){t=pt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=pt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}},{key:"setStroke",value:function(t,e){return this.stroke=t,this.strokeThickness=e,this}},{key:"drawContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,s=this.parent.height-t.top-t.bottom,r=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?r.createLinearGradient(0,0,n,0):r.createLinearGradient(0,0,0,s)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;r.fillStyle=o,r.fillRect(e,i,n,s)}null!=this.stroke&&0<this.strokeThickness&&(r.strokeStyle=this.stroke,r.lineWidth=this.strokeThickness,r.strokeRect(e,i,n,s))}}]),s}(),Hn=Phaser.Utils.Objects.GetValue,Xn=function(){function e(t){B(this,e),this.set(t)}return m(e,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){this.setBold(Hn(t,"bold",!1)),this.setItalic(Hn(t,"italic",!1)),this.setFontSize(Hn(t,"fontSize","16px")),this.setFontFamily(Hn(t,"fontFamily","Courier")),this.setColor(Hn(t,"color","#fff")),this.setStrokeStyle(Hn(t,"stroke",null),Hn(t,"strokeThickness",0)),this.setShadow(Hn(t,"shadowColor",null),Hn(t,"shadowOffsetX",0),Hn(t,"shadowOffsetY",0),Hn(t,"shadowBlur",0)),this.setOffset(Hn(t,"offsetX",0),Hn(t,"offsetY",0))}},{key:"modify",value:function(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(En("stroke",t,this),En("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(En("shadowOffsetX",t,this),En("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return"number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this}},{key:"font",get:function(){return"".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=pt(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=pt(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&0<this.strokeThickness}},{key:"setShadowColor",value:function(t){return this.shadowColor=pt(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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)}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),e}(),Nn=Phaser.Utils.Objects.GetValue,Jn="text",Kn="image",Zn="command",qn=function(){w(r,Mn);var s=T(r);function r(t,e,i){var n;return B(this,r),(n=s.call(this,t,Jn)).style=new Xn(i),n.setText(e),n}return m(r,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(){}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(){}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this}},{key:"modifyPorperties",value:function(t){return t&&(this.modifyStyle(t),O(C(r.prototype),"modifyPorperties",this).call(this,t)),this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){if("\n"===this.text||""===this.text)this.textWidth=0,this.textHeight=0;else{var t,e,i=this.style.getTextMetrics(this.context,this.text);this.textWidth=i.width,e=i.hasOwnProperty("actualBoundingBoxAscent")?(t=i.actualBoundingBoxAscent,i.actualBoundingBoxDescent):t=0,this.textHeight=t+e}return this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){0<this.textWidth?this.scaleX=t/this.textWidth:this.scaleX=1}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){0<this.textHeight?this.scaleY=t/this.textHeight:this.scaleY=1}},{key:"drawContent",value:function(){var t=this.style,e=t.hasFill,i=t.hasStroke;if(e||i){var n=this.context;t.syncFont(n).syncStyle(n),i&&(t.syncShadow(n),n.strokeText(this.text,0,0)),e&&(t.syncShadow(n),n.fillText(this.text,0,0))}}},{key:"draw",value:function(){if(!this.visible||""===this.text||"\n"===this.text)return this;O(C(r.prototype),"draw",this).call(this)}}]),r}(),$n=function(){w(r,Mn);var s=T(r);function r(t,e,i){var n;return B(this,r),(n=s.call(this,t,Kn)).setTexture(e,i),n}return m(r,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return-this.height},set:function(){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"drawContent",value:function(){var t=this.context,e=this.frameObj;t.drawImage(e.source.image,e.cutX,e.cutY,e.cutWidth,e.cutHeight)}},{key:"draw",value:function(){if(!this.visible)return this;O(C(r.prototype),"draw",this).call(this)}}]),r}(),Qn=function(){w(a,Mn);var o=T(a);function a(t,e,i,n,s){var r;return B(this,a),(r=o.call(this,t,Zn)).setName(e).setParameter(n).setCallback(i,s),r}return m(a,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"draw",value:function(){}},{key:"onFree",value:function(){O(C(a.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter()}}]),a}(),ts={left:0,center:1,right:2},es={top:0,center:1,bottom:2},is=Phaser.Utils.Objects.GetValue,ns=Phaser.Utils.Objects.GetValue,ss=Phaser.Utils.Array.GetAll,rs={setPadding:function(t,e){var i=this.padding,n=i.left,s=i.right,r=i.top,o=i.bottom;return Bn(this.padding,t,e),this.dirty=this.dirty||n!=this.padding.left||s!=this.padding.right||r!=this.padding.top||o!=this.padding.bottom,this},getPadding:function(t){return _n(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.dirty=!0,this},clearContent:function(){return this.setText(),this},setText:function(t,e){return void 0===t&&(t=""),this.removeChildren(),In.call(this,t,e),this.dirty=!0,this},appendText:In,appendImage:Dn,appendCommand:Ln,setWrapConfig:function(t){return this.wrapConfig=t,this},runWordWrap:function(t){return t=jn(t,this.wrapConfig),Fn.call(this,t)},runVerticalWrap:function(t){return t=jn(t,this.wrapConfig),Yn.call(this,t)},drawContent:function(){var t,e=0<this.fixedWidth?this.fixedWidth:this.width,i=0<this.fixedHeight?this.fixedHeight:this.height;this.setSize(e,i),this.background.active&&this.background.draw();for(var n=0,s=this.children.length;n<s;n++)(t=this.children[n]).active&&t.draw();this.innerBounds.active&&this.innerBounds.draw()},getChildren:function(){return this.children},getLastAppendedChildren:function(){return this.lastAppendedChildren},getActiveChildren:function(){return ss(this.children,"active",!0)}},os=Phaser.Utils.Objects.GetFastValue,as={},hs=function(){function e(t){B(this,e),this.pools=os(t,"pools",as)}return m(e,[{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Kt),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;e<i;e++)this.free(t[e]);return this}},{key:"allocate",value:function(t){return this.pools&&this.pools.hasOwnProperty(t)?this.pools[t].pop():null}}]),e}(),ls=Phaser.Utils.Objects.IsPlainObject,us=Phaser.Utils.Objects.GetValue,cs=function(){w(c,dt);var u=T(c);function c(t,e,i,n,s,r){var o;B(this,c),ls(e)?(e=us(r=e,"x",0),i=us(r,"y",0),n=us(r,"width",0),s=us(r,"height",0)):ls(n)&&(n=us(r=n,"width",0),s=us(r,"height",0));var a=0===n?1:n,h=0===s?1:s;(o=u.call(this,t,e,i,a,h)).type="rexDynamicText",o.autoRound=!0,o.padding={},o.textStyle=new Xn(us(r,"style",void 0)),o.background=new Wn(z(o),us(r,"background",void 0)),o.innerBounds=new Un(z(o),us(r,"innerBounds",void 0)),o.children=[],o.lastAppendedChildren=[],o.poolManager=new hs(r),o.setFixedSize(n,s),o.setPadding(us(r,"padding",0)),o.setWrapConfig(us(r,"wrap",void 0));var l=us(r,"text",void 0);return l&&o.setText(l),o}return m(c,[{key:"setFixedSize",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),0<t&&0<e&&this.fixedWidth===t&&this.fixedHeight===e||(this.dirty=!0),this.fixedWidth=t,this.fixedHeight=e,this}},{key:"updateTexture",value:function(){return this.clear(),this.drawContent(),O(C(c.prototype),"updateTexture",this).call(this),this}}]),c}();Object.assign(cs.prototype,rs),u.register("dynamicText",function(t,e,i,n,s){var r=new cs(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),x(window,"RexPlugins.UI.DynamicText",cs);function ds(t){return t.replace(gs,"\\$&").replace(ys,"\\x2d")}function fs(t){return"string"!=typeof t||(""===t?t=null:ks.test(t)?t=parseFloat(t):"false"===t?t=!1:"true"===t&&(t=!0)),t}function ps(t){return t}var vs={setEventEmitter:function(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter:function(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter:function(){return this._eventEmitter},on:function(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once:function(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off:function(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit:function(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener:function(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener:function(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners:function(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount:function(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners:function(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames:function(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}},gs=/[|\\{}()[\]^$+*?.]/g,ys=/-/g,ks=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,ms=function(){function i(t){B(this,i),this.setEventEmitter(wn(t,"eventEmitter",void 0)),this.setTagExpression(wn(t,"regex.tag","[a-z0-9-_.]+")),this.setValueExpression(wn(t,"regex.value","[ #a-z-_.0-9,|&]+")),this.setValueConverter(wn(t,"valueConvert",!0));var e=wn(t,"delimiters","<>");this.setDelimiters(e[0],e[1]),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}return m(i,[{key:"shutdown",value:function(){this.destroyEventEmitter()}},{key:"destroy",value:function(){this.shutdown()}},{key:"setTagExpression",value:function(t){return this.tagExpression=t,this}},{key:"setValueExpression",value:function(t){return this.valueExpression=t,this}},{key:"setValueConverter",value:function(t){return t=!0===t?fs:t||ps,this.valueConverter=t,this}},{key:"setDelimiters",value:function(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=ds(t),e=ds(e);var i="".concat(t,"(").concat(this.tagExpression,")(=(").concat(this.valueExpression,"))?").concat(e),n="".concat(t,"/(").concat(this.tagExpression,")").concat(e);return this.reTagOn=RegExp(i,"i"),this.reTagOff=RegExp(n,"i"),this.reSplit=RegExp("".concat(i,"|").concat(n),"gi"),this}},{key:"setSource",value:function(t){return this.source=t,this}},{key:"resetIndex",value:function(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this}},{key:"start",value:function(t){return this.setSource(t).restart(),this}},{key:"restart",value:function(){this.resetIndex().next()}},{key:"next",value:function(){this.isPaused&&this.onResume();var t=this.source,e=t.length;for(0===this.reSplit.lastIndex&&this.onStart();!this.isPaused;){var i=this.reSplit.exec(t);if(!i)return this.progressIndex<e&&this.onContent(t.substring(this.progressIndex,e)),void this.onComplete();var n=i[0],s=this.reSplit.lastIndex-n.length;this.progressIndex<s&&this.onContent(t.substring(this.progressIndex,s)),this.reTagOff.test(n)?this.onTagEnd(n):this.onTagStart(n),this.progressIndex=this.reSplit.lastIndex}}},{key:"skipEvent",value:function(){return this.skipEventFlag=!0,this}},{key:"pause",value:function(){return this.isPaused||this.onPause(),this}},{key:"onContent",value:function(t){this.emit("content",t),this.lastContent=t}},{key:"onTagStart",value:function(t){var e=t.match(this.reTagOn),i=e[1],n=function(t,e){if(null==t)return[];for(var i=t.split(","),n=0,s=i.length;n<s;n++)i[n]=e(i[n]);return i}(e[3],this.valueConverter);this.skipEventFlag=!1,this.emit.apply(this,["+".concat(i)].concat(M(n))),this.skipEventFlag||this.emit.apply(this,["+",i].concat(M(n))),this.lastTagStart=i}},{key:"onTagEnd",value:function(t){var e=t.match(this.reTagOff)[1];this.skipEventFlag=!1,this.emit("-".concat(e)),this.skipEventFlag||this.emit("-",e),this.lastTagEnd=e}},{key:"onStart",value:function(){this.isRunning=!0,this.emit("start",this)}},{key:"onComplete",value:function(){this.isRunning=!1,this.emit("complete",this),this.resetIndex()}},{key:"onPause",value:function(){this.isPaused=!0,this.emit("pause",this)}},{key:"onResume",value:function(){this.isPaused=!1,this.emit("resume",this)}}]),i}();Object.assign(ms.prototype,vs);function bs(t){this.typeWriter.setSpeed(t)}function xs(t){this.typeWriter.wait(t)}function Cs(t,e){return 2===t.length&&t[0]===e}function ws(t,e){return 3===t.length&&t[0]===e&&"play"===t[2]}function Ss(t,e){var i="tag.".concat(e);null==t?this.emit(i):this.emit.apply(this,[i].concat(M(t)))}function Ps(i,n){return new Promise(function(t,e){i.once(n,function(){t()})})}function Ts(t){return Ps(t,"complete")}function Os(t,e,i,n,s){return function(){t.emit(ro,s),e.apply(n,i)}}function Ms(t,e,i,n,s){var r=Os(t,i,n,s,"custom"),o=e?"wait.".concat(e):"wait";t.emit(o,r)}function Es(t,e,i,n,s){var r,o,a,h,l,u=Os(t,i,n,s,"time");t.once(ro,function(){r&&(r.remove(),r=void 0)}),o=e,a=u,r=t.typeWriter.timeline.delayCall(o,a,h,l),t.emit("wait.time",e)}function _s(t,e,i,n){var s=Os(t,e,i,n,"click"),r=t.clickEE;t.once(ro,function(){r.off("pointerdown",s,t)}),r.once("pointerdown",s,t),t.emit("wait.click")}function Bs(t,e,i,n,s){var r=Os(t,i,n,s,"music");e&&(t.once(ro,function(){e.off("complete",r,t)}),e.once("complete",r,t)),t.emit("wait.music",e),e||r()}function zs(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 1;default:return}}function Rs(e,t,i,n,s){var r,o,a=Os(e,i,n,s,"camera.".concat(t)),h=e.camera;switch(t){case"camera.fadein":r=h.fadeEffect,o="camerafadeincomplete";break;case"camera.fadeout":r=h.fadeEffect,o="camerafadeoutcomplete";break;case"camera.flash":r=h.flashEffect,o="cameraflashcomplete";break;case"camera.shake":r=h.shakeEffect,o="camerashakecomplete";break;case"camera.zoom":r=h.zoomEffect,o="camerazoomcomplete";break;case"camera.rotate":r=h.rotateToEffect,o="camerarotatecomplete";break;case"camera.scroll":r=h.panEffect,o="camerapancomplete"}r.isRunning?(e.once(ro,function(t){h.off(o,a,e)}),h.once(o,a,e),e.emit("wait.camera",t)):(e.emit("wait.camera",t),a())}function Is(t,e,i,n,s){var r=Os(t,i,n,s,"keydown"),o="keydown-".concat(e.toUpperCase()),a=t.scene.input.keyboard;t.once(ro,function(){a.off(o,r,t)}),a.once(o,r,t),t.emit("wait.keydown",e)}function Ds(e,t,i,n,s){var r=Os(e,i,n,s),o=t.split("."),a=e.spriteManager;switch(o.length){case 1:a.isEmpty?(e.emit("wait.sprite"),r()):(e.once(ro,function(t){a.off("empty",r,e)}),a.once("empty",r,e),e.emit("wait.sprite"));break;case 2:var h=o[1];if(a.has(h)){var l=e.spriteManager.get(h).sprite;e.once(ro,function(){l.off("destroy",r,e)}),l.once("destroy",r,e),e.emit("wait.sprite",h)}else e.emit("wait.sprite",h),r();break;case 3:h=o[1];var u=o[2],c=e.spriteManager.getTweenTask(h,u);c?(e.once(ro,function(){c.off("complete",r,e)}),c.once("complete",r,e),e.emit("wait.sprite",h,u)):(e.emit("wait.sprite",h,u),r())}}function Ls(t,e,i,n,s){for(var r=0,o=(e="string"==typeof e&&1<e.length&&-1!==e.indexOf("|")?e.split("|"):[e]).length;r<o;r++){var a=e[r];if(null==a||"wait"===a)Ms(t,void 0,i,n,s);else if("number"!=typeof a&&isNaN(a))if("click"===a)_s(t,i,n,s);else if("se"===a){var h=t.soundManager.getLastSoundEffect();Bs(t,h,i,n,s)}else if("bgm"===a){h=t.soundManager.getBackgroundMusic();Bs(t,h,i,n,s)}else ho.hasOwnProperty(a.toUpperCase())?Is(t,a,i,n,s):zs(a)?Rs(t,a,i,n,s):("sprite"===(l=a.split("."))[0]&&l.length<=3?Ds:Ms)(t,a,i,n,s);else Es(t,parseFloat(a),i,n,s)}var l}function js(t){return t instanceof uo}function As(t){return null==t||"object"!==P(t)?null:js(t)?t:t.scene&&js(t.scene)?t.scene:t.parent&&t.parent.scene&&js(t.parent.scene)?t.parent.scene:void 0}var Fs=Phaser.Utils.Objects.GetValue,Ys=Phaser.Utils.Objects.GetValue,Vs=Phaser.Utils.Objects.GetValue,Ws=Phaser.Utils.Objects.GetValue,Gs=Phaser.Utils.Objects.GetValue,Us=Phaser.Utils.Objects.GetValue,Hs=Phaser.Utils.Objects.GetValue,Xs=Phaser.Utils.Objects.GetValue,Ns=Phaser.Utils.Objects.GetValue,Js=function(t,e){Ln.call(t,"speed",bs,e,t)},Ks=Phaser.Utils.Objects.GetValue,Zs=function(t){if(!this.skipSoundEffect){var e=t[0],i=t[1];this.soundManager.playSoundEffect(e),i&&this.soundManager.fadeInSoundEffect(i)}},qs=Phaser.Utils.Objects.GetValue,$s=function(t){this.soundManager.fadeInSoundEffect(t)},Qs=Phaser.Utils.Objects.GetValue,tr=function(t){var e;(e=this.soundManager).fadeOutSoundEffect.apply(e,M(t))},er=Phaser.Utils.Objects.GetValue,ir=function(t){this.soundManager.setSoundEffectVolume(t)},nr=Phaser.Utils.Objects.GetValue,sr=function(t){var e=t[0],i=t[1];this.soundManager.playBackgroundMusic(e),i&&this.soundManager.fadeInBackgroundMusic(i)},rr=function(){this.soundManager.stopBackgroundMusic()},or=Phaser.Utils.Objects.GetValue,ar=function(t){this.soundManager.fadeInBackgroundMusic(t)},hr=Phaser.Utils.Objects.GetValue,lr=function(t){var e;(e=this.soundManager).fadeOutBackgroundMusic.apply(e,M(t))},ur=Phaser.Utils.Objects.GetValue,cr=function(t){var e;(e=this.soundManager).crossFadeBackgroundMusic.apply(e,M(t))},dr=Phaser.Utils.Objects.GetValue,fr=function(){this.soundManager.pauseBackgroundMusic()},pr=function(){this.soundManager.resumeBackgroundMusic()},vr=Phaser.Utils.Objects.GetValue,gr=function(t){var e;(e=this.camera).fadeIn.apply(e,M(t))},yr=Phaser.Utils.Objects.GetValue,kr=function(t){var e;(e=this.camera).fadeOut.apply(e,M(t))},mr=Phaser.Utils.Objects.GetValue,br=function(t){var e;(e=this.camera).shake.apply(e,M(t))},xr=Phaser.Utils.Objects.GetValue,Cr=function(t){var e;(e=this.camera).flash.apply(e,M(t))},wr=Phaser.Utils.Objects.GetValue,Sr=function(t){this.camera.setZoom(t)},Pr=function(t){var e;(e=this.camera).zoomTo.apply(e,M(t))},Tr=Phaser.Utils.Objects.GetValue,Or=Phaser.Math.DegToRad,Mr=function(t){this.camera.setRotation(t)},Er=function(t){var e=t[0],i=t[1],n=t[2];this.camera.rotateTo(e,!1,i,n)},_r=Phaser.Utils.Objects.GetValue,Br=function(t){var e;(e=this.camera).setScroll.apply(e,M(t))},zr=function(t){var e=t[0],i=t[1],n=t[2],s=t[3],r=this.camera,o=r.scrollX,a=r.scrollY;r.setScroll(e,i),e+=r.centerX,i+=r.centerY,r.setScroll(o,a),r.pan(e,i,n,s)},Rr=Phaser.Utils.Objects.GetValue,Ir=function(t,e){Ln.call(t,"wait",xs,e,t)},Dr=Phaser.Utils.Objects.GetValue,Lr=function(t){var e;(e=this.spriteManager).add.apply(e,M(t))},jr=function(t){this.spriteManager.remove(t)},Ar=Phaser.Utils.Objects.GetValue,Fr=function(){this.spriteManager.removeAll()},Yr=Phaser.Utils.Objects.GetValue,Vr=function(t){var e;(e=this.spriteManager).setTexture.apply(e,M(t))},Wr=Phaser.Utils.Objects.GetValue,Gr=function(t){var e=t[0],i=t[1],n=i.shift();this.spriteManager.playAnimation(e,n),0<i.length&&this.spriteManager.chainAnimation(e,i)},Ur=function(t){this.spriteManager.stopAnimation(t)},Hr=Phaser.Utils.Objects.GetValue,Xr=function(t){var e;(e=this.spriteManager).chainAnimation.apply(e,M(t))},Nr=Phaser.Utils.Objects.GetValue,Jr=function(t){this.spriteManager.pauseAnimation(t)},Kr=Phaser.Utils.Objects.GetValue,Zr=function(t){var e;(e=this.spriteManager).setProperty.apply(e,M(t))},qr=Phaser.Utils.Objects.GetValue,$r={to:!0,yoyo:!0},Qr=function(t){var e;(e=this.spriteManager).easeProperty.apply(e,M(t))},to=function(t,e,i){Ln.call(t,e,Ss,i,t)},eo=Phaser.Utils.Objects.GetValue,io=[function(e,i,t){var n,s=Fs(t,"tags.color","color");i.on("start",function(){n=e.textStyle.color}).on("+".concat(s),function(t){e.textStyle.setColor(t),i.skipEvent()}).on("-".concat(s),function(){e.textStyle.setColor(n),i.skipEvent()}).on("complete",function(){e.textStyle.setColor(n)})},function(e,i,t){var n,s=Ys(t,"tags.stroke","stroke");i.on("start",function(){n=e.textStyle.stroke,e.textStyle.setStrokeStyle(null)}).on("+".concat(s),function(t){void 0===t&&(t=n),e.textStyle.setStrokeStyle(t),i.skipEvent()}).on("-".concat(s),function(){e.textStyle.setStrokeStyle(null),i.skipEvent()}).on("complete",function(){e.textStyle.setStrokeStyle(n)})},function(t,e,i){var n=Vs(i,"tags.b","b");e.on("start",function(){t.textStyle.setBold(!1)}).on("+".concat(n),function(){t.textStyle.setBold(!0),e.skipEvent()}).on("-".concat(n),function(){t.textStyle.setBold(!1),e.skipEvent()})},function(t,e,i){var n=Ws(i,"tags.i","i");e.on("start",function(){t.textStyle.setItalic(!1)}).on("+".concat(n),function(){t.textStyle.setItalic(!0),e.skipEvent()}).on("-".concat(n),function(){t.textStyle.setItalic(!1),e.skipEvent()})},function(e,i,t){var n,s=Gs(t,"tags.size","size");i.on("start",function(){n=e.textStyle.fontSize}).on("+".concat(s),function(t){e.textStyle.setFontSize(t),i.skipEvent()}).on("-".concat(s),function(){e.textStyle.setFontSize(n),i.skipEvent()}).on("complete",function(){e.textStyle.setFontSize(n)})},function(e,i,t){var n,s=Us(t,"tags.y","y");i.on("start",function(){n=e.textStyle.offsetY,e.textStyle.setOffsetY(0)}).on("+".concat(s),function(t){void 0===t&&(t=n),e.textStyle.setOffsetY(t),i.skipEvent()}).on("-".concat(s),function(){e.textStyle.setOffsetY(0),i.skipEvent()}).on("complete",function(){e.textStyle.setOffsetY(0)})},function(e,i,t){var n,s=Hs(t,"tags.shadow","shadow");i.on("start",function(){n=e.textStyle.shadowColor,e.textStyle.setShadowColor(null)}).on("+".concat(s),function(t){void 0===t&&(t=n),e.textStyle.setShadowColor(t),i.skipEvent()}).on("-".concat(s),function(){e.textStyle.setShadowColor(null),i.skipEvent()}).on("complete",function(){e.textStyle.setShadowColor(n)})},function(i,n,t){var e=Xs(t,"tags.img","img");n.on("+".concat(e),function(t){var e=i.imageManager.get(t);Dn.call(i,e.key,e.frame,{width:e.width,hieght:e.height,leftSpace:e.left,rightSpace:e.right}),n.skipEvent()}).on("-".concat(e),function(){n.skipEvent()})},function(e,i,t){var n,s=Ns(t,"tags.speed","speed");i.on("start",function(){n=e.typeWriter.speed}).on("+".concat(s),function(t){Js(e,t),i.skipEvent()}).on("-".concat(s),function(){Js(e,n),i.skipEvent()}).on("complete",function(){e.typeWriter.speed=n})},function(i,n,t){var e=Ks(t,"tags.se","se");n.on("+".concat(e),function(t,e){Ln.call(i,"se",Zs,[t,e],i),n.skipEvent()}).on("-".concat(e),function(){n.skipEvent()})},function(e,i,t){var n=qs(t,"tags.se.fadein","se.fadein");i.on("+".concat(n),function(t){Ln.call(e,"se.fadein",$s,t,e),i.skipEvent()}).on("-".concat(n),function(){i.skipEvent()})},function(i,n,t){var e=Qs(t,"tags.se.fadeout","se.fadeout");n.on("+".concat(e),function(t,e){Ln.call(i,"se.fadeout",tr,[t,e="stop"===e],i),n.skipEvent()}).on("-".concat(e),function(){n.skipEvent()})},function(e,i,t){var n=er(t,"tags.se.volume","se.volume");i.on("+".concat(n),function(t){Ln.call(e,"se.volume",ir,t,e),i.skipEvent()}).on("-".concat(n),function(){i.skipEvent()})},function(i,n,t){var e=nr(t,"tags.bgm","bgm");n.on("+".concat(e),function(t,e){Ln.call(i,"bgm",sr,[t,e],i),n.skipEvent()}).on("-".concat(e),function(){Ln.call(i,"bgm.stop",rr,void 0,i),n.skipEvent()})},function(e,i,t){var n=or(t,"tags.bgm.fadein","bgm.fadein");i.on("+".concat(n),function(t){Ln.call(e,"bgm.fadein",ar,t,e),i.skipEvent()}).on("-".concat(n),function(){i.skipEvent()})},function(i,n,t){var e=hr(t,"tags.bgm.fadeout","bgm.fadeout");n.on("+".concat(e),function(t,e){Ln.call(i,"bgm.fadeout",lr,[t,e],i),n.skipEvent()}).on("-".concat(e),function(){n.skipEvent()})},function(i,n,t){var e=ur(t,"tags.bgm.cross","bgm.cross");n.on("+".concat(e),function(t,e){Ln.call(i,"bgm.cross",cr,[t,e],i),n.skipEvent()}).on("-".concat(e),function(){n.skipEvent()})},function(t,e,i){var n=dr(i,"tags.bgm.pause","bgm.pause");e.on("+".concat(n),function(){Ln.call(t,"bgm.pause",fr,void 0,t),e.skipEvent()}).on("-".concat(n),function(){Ln.call(t,"bgm.resume",pr,void 0,t),e.skipEvent()})},function(s,r,t){var e=vr(t,"tags.camera.fadein","camera.fadein");r.on("+".concat(e),function(t,e,i,n){Ln.call(s,"camera.fadein",gr,[t,e,i,n],s),r.skipEvent()})},function(s,r,t){var e=yr(t,"tags.camera.fadeout","camera.fadeout");r.on("+".concat(e),function(t,e,i,n){Ln.call(s,"camera.fadeout",kr,[t,e,i,n],s),r.skipEvent()})},function(i,n,t){var e=mr(t,"tags.camera.shake","camera.shake");n.on("+".concat(e),function(t,e){Ln.call(i,"camera.shake",br,[t,e],i),n.skipEvent()})},function(s,r,t){var e=xr(t,"tags.camera.flash","camera.flash");r.on("+".concat(e),function(t,e,i,n){Ln.call(s,"camera.flash",Cr,[t,e,i,n],s),r.skipEvent()})},function(n,s,t){var e=wr(t,"tags.camera.zoom","camera.zoom");s.on("+".concat(e),function(t){Ln.call(n,"camera.zoom",Sr,t,n),s.skipEvent()}).on("+".concat(e,".to"),function(t,e,i){Ln.call(n,"camera.zoom.to",Pr,[t,e,i],n),s.skipEvent()})},function(n,s,t){var e=Tr(t,"tags.camera.rotate","camera.rotate");s.on("+".concat(e),function(t){t=Or(t),Ln.call(n,"camera.rotate",Mr,t,n),s.skipEvent()}).on("+".concat(e,".to"),function(t,e,i){t=Or(t),Ln.call(n,"camera.rotate.to",Er,[t,e,i],n),s.skipEvent()})},function(s,r,t){var e=_r(t,"tags.camera.scroll","camera.scroll");r.on("+".concat(e),function(t,e){Ln.call(s,"camera.scroll",Br,[t,e],s),r.skipEvent()}).on("+".concat(e,".to"),function(t,e,i,n){Ln.call(s,"camera.scroll.to",zr,[t,e,i,n],s),r.skipEvent()})},function(e,i,t){var n=Rr(t,"tags.wait","wait"),s=Rr(t,"tags.click","click");i.on("+".concat(n),function(t){Ir(e,t),i.skipEvent()}).on("-".concat(n),function(){i.skipEvent()}).on("+".concat(s),function(){Ir(e,"click"),i.skipEvent()}).on("-".concat(s),function(){i.skipEvent()})},function(o,a,t){var h=Dr(t,"sprite","sprite");h&&a.on("+",function(t){if(!a.skipEventFlag){var e=t.split(".");if(Cs(e,h)){for(var i=e[1],n=arguments.length,s=new Array(1<n?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];Ln.call(o,"sprite.add",Lr,[i].concat(s),o),a.skipEvent()}}}).on("-",function(t){if(!a.skipEventFlag){var e=t.split(".");if(Cs(e,h)){var i=e[1];Ln.call(o,"sprite.remove",jr,i,o),a.skipEvent()}}})},function(e,i,t){var n=Ar(t,"sprite","sprite");n&&i.on("-",function(t){i.skipEventFlag||t===n&&(Ln.call(e,"sprite.removeall",Fr,void 0,e),i.skipEvent())})},function(a,h,t){var l=Yr(t,"sprite","sprite");l&&h.on("+",function(t,e,i){if(!h.skipEventFlag){var n=t.split(".");if(r=l,3===(s=n).length&&s[0]===r&&"texture"===s[2]){var s,r,o=n[1];Ln.call(a,"sprite.texture",Vr,[o,e,i],a),h.skipEvent()}}})},function(r,o,t){var a=Wr(t,"sprite","sprite");a&&o.on("+",function(t){if(!o.skipEventFlag){var e,i=t.split(".");if(ws(i,a)){e=i[1];var n=Array.prototype.slice.call(arguments,1);Ln.call(r,"sprite.play",Gr,[e,n],r),o.skipEvent()}}}).on("+",function(t){if(!o.skipEventFlag){var e,i,n,s=t.split(".");if(n=a,3===(i=s).length&&i[0]===n&&"stop"===i[2])e=s[1],Ln.call(r,"sprite.stop",Ur,e,r),o.skipEvent()}}).on("-",function(t){if(!o.skipEventFlag){var e,i=t.split(".");ws(i,a)&&(e=i[1],Ln.call(r,"sprite.stop",Ur,e,r),o.skipEvent())}})},function(o,a,t){var h=Hr(t,"sprite","sprite");h&&a.on("+",function(t){if(!a.skipEventFlag){var e,i=t.split(".");if(s=h,3===(n=i).length&&n[0]===s&&"chain"===n[2]){var n,s;e=i[1];var r=Array.prototype.slice.call(arguments,1);Ln.call(o,"sprite.chain",Xr,[e,r],o),a.skipEvent()}}})},function(r,o,t){var a=Nr(t,"sprite","sprite");a&&o.on("+",function(t){if(!o.skipEventFlag){var e,i,n,s=t.split(".");if(n=a,3===(i=s).length&&i[0]===n&&"pause"===i[2])e=s[1],Ln.call(r,"sprite.pause",Jr,e,r),o.skipEvent()}})},function(a,h,t){var l=Kr(t,"sprite","sprite");l&&h.on("+",function(t,e){if(!h.skipEventFlag){var i,n,s,r,o=t.split(".");if(r=l,3===(s=o).length&&s[0]===r)i=o[1],n=o[2],Ln.call(a,"sprite.set",Zr,[i,n,e],a),h.skipEvent()}})},function(u,c,t){var d=qr(t,"sprite","sprite");d&&c.on("+",function(t,e,i,n){if(!c.skipEventFlag){var s,r,o,a,h,l=t.split(".");if(h=d,4===(a=l).length&&a[0]===h&&$r[a[3]])s=l[1],r=l[2],o="yoyo"===l[3],Ln.call(u,"sprite.ease",Qr,[s,r,e,i,n,o],u),c.skipEvent()}})},function(r,o){o.on("start",function(){r.emit("parser.start",o)}).on("+",function(t){if(!o.skipEventFlag){for(var e="+".concat(t),i=arguments.length,n=new Array(1<i?i-1:0),s=1;s<i;s++)n[s-1]=arguments[s];r.emit.apply(r,["parser.".concat(e),o].concat(n)),to(r,e,n)}}).on("-",function(t){if(!o.skipEventFlag){var e="-".concat(t);r.emit("parser.".concat(e),o),to(r,e)}}).on("complete",function(){r.emit("parser.complete",o)})},function(t,e,i){var n=eo(i,"tags.r","r");e.on("+".concat(n),function(){In.call(t,"\n"),e.skipEvent()}).on("-".concat(n),function(){e.skipEvent()})},function(e,t){t.on("content",function(t){In.call(e,t)})}],no=Phaser.Utils.Objects.GetValue,so=function(){w(s,ms);var n=T(s);function s(t,e){var i;return B(this,s),void 0===e&&(e={}),e.hasOwnProperty("delimiters")||(e.delimiters="[]"),function(t,e,i){for(var n=0,s=io.length;n<s;n++)io[n](t,e,i)}(t,z(i=n.call(this,e)),e),i.setCommentLineStartSymbol(no(e,"comment","//")),i}return m(s,[{key:"setCommentLineStartSymbol",value:function(t){return this.commentLineStart=t,this}},{key:"start",value:function(t){return O(C(s.prototype),"start",this).call(this,function(t,e){for(var i=t.commentLineStart,n=e.split("\n"),s=0,r=n.length;s<r;s++){var o=n[s];""===o||(0===o.trim().length||i&&o.startsWith(i))&&(n[s]="")}return n.join("")}(this,t)),this}}]),s}(),ro="_remove.wait",oo="_remove.play",ao=[ro,oo],ho=Phaser.Input.Keyboard.KeyCodes,lo={start:function(t){return this.children=t,this.index=0,this.isPageTyping=!0,this.onTypeStart&&this.onTypeStart(t),this.typing(),Ts(this)},typing:function n(t){void 0===t&&(t=0);var e=0;for(this.inTypingProcessLoop=!0;this.inTypingProcessLoop;){var i=this.getNextChild();if(!i){this.timeline.isRunning?this.timeline.once("complete",function(){this.isPageTyping=!1,this.emit("complete")},this):(this.isPageTyping=!1,this.emit("complete"));break}if(zn(i)){var s=this.animationConfig;if(0<s.duration){var r=this.timeline.addTimer({name:"anim",target:i,duration:s.duration,yoyo:s.yoyo,onStart:s.onStart,onProgress:s.onProgress,onComplete:s.onComplete});this.skipTypingAnimation&&r.seek(1)}else s.onStart&&s.onStart(i,0);this.textPlayer.emit("typing",i),e+=this.speed+t,t=0;var o=this.index===this.children.length;if(0<e&&!o){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:e,onComplete:function(t,e,i){t.typingTimer=void 0,n.call(t,i.remainder)}});break}}else i.type===Zn&&i.exec()}this.inTypingProcessLoop=!1},pause:function(){return this.timeline.pause(),this},resume:function(){return this.timeline.resume(),this},pauseTyping:function(){return this.isTypingPaused||(this.typingTimer?(this.typingTimer.pause(),this.isTypingPaused=!0):this.inTypingProcessLoop&&(this.inTypingProcessLoop=!1,this.isTypingPaused=!0)),this},resumeTyping:function(t){return this.isTypingPaused&&(void 0===t&&(t=0),this.typingTimer?(this.isTypingPaused=!1,this.typingTimer.resume(),this.typingTimer.remainder+=t):this.isTypingPaused&&(this.isTypingPaused=!1,this.typing(t))),this},wait:function(t){return this.ignoreWait||(this.pauseTyping(),Ls(this.textPlayer,t,this.resumeTyping,[],this)),this},setTimeScale:function(t){return this.timeline.setTimeScale(t),this},setIgnoreWait:function(t){return void 0===t&&(t=!0),this.ignoreWait=t,this},setSkipTypingAnimation:function(t){if(void 0===t&&(t=!0),this.skipTypingAnimation=t)for(var e=this.timeline.getTimers("anim"),i=0,n=e.length;i<n;i++)e[i].seek(1);return this},setSkipSoundEffect:function(t){if(void 0===t&&(t=!0),this.skipSoundEffect=t){var e=this.textPlayer._soundManager;e&&e.fadeOutAllSoundEffects(100,!0)}return this},skipCurrentTypingDelay:function(){return this.typingTimer&&this.typingTimer.seek(1),this}},uo=Phaser.Scene,co=Phaser.Utils.Objects.GetValue,fo=function(){function i(t,e){B(this,i),this.parent=t,this.scene=As(t),this.isShutdown=!1,this.setEventEmitter(co(e,"eventEmitter",!0)),this.parent&&this.parent===this.scene?this.scene.events.once("shutdown",this.onSceneDestroy,this):this.parent&&this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this)}return m(i,[{key:"shutdown",value:function(){this.isShutdown||(this.parent&&this.parent===this.scene?this.scene.events.off("shutdown",this.onSceneDestroy,this):this.parent&&this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.isShutdown=!0)}},{key:"destroy",value:function(t){this.shutdown(t)}},{key:"onSceneDestroy",value:function(){this.destroy(!0)}},{key:"onParentDestroy",value:function(t,e){this.destroy(e)}}]),i}();Object.assign(fo.prototype,vs);var po=Phaser.Utils.Objects.GetValue,vo=function(){w(s,fo);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,e))._isRunning=!1,i.isPaused=!1,i.tickingState=!1,i.setTickingMode(po(e,"tickingMode",1)),i}return m(s,[{key:"boot",value:function(){2!==this.tickingMode||this.tickingState||this.startTicking()}},{key:"shutdown",value:function(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),O(C(s.prototype),"shutdown",this).call(this,t))}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=go[t]),this.tickingMode=t}},{key:"startTicking",value:function(){this.tickingState=!0}},{key:"stopTicking",value:function(){this.tickingState=!1}},{key:"isRunning",get:function(){return this._isRunning},set:function(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}},{key:"start",value:function(){return this.isPaused=!1,this.isRunning=!0,this}},{key:"pause",value:function(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}},{key:"resume",value:function(){return this.isPaused&&(this.isRunning=!0),this}},{key:"stop",value:function(){return this.isPaused=!1,this.isRunning=!1,this}},{key:"complete",value:function(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}]),s}(),go={no:0,lazy:1,always:2},yo=Phaser.Utils.Objects.GetValue,ko=function(){w(s,vo);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,e)).resetFromJSON(e),i.boot(),i}return m(s,[{key:"resetFromJSON",value:function(t){return this.isRunning=yo(t,"isRunning",!1),this.timeScale=yo(t,"timeScale",1),this.now=yo(t,"now",0),this}},{key:"toJSON",value:function(){return{isRunning:this.isRunning,timeScale:this.timeScale,now:this.now,tickingMode:this.tickingMode}}},{key:"start",value:function(t){return void 0===t&&(t=0),this.delta=0,this.now=t,O(C(s.prototype),"start",this).call(this),this}},{key:"seek",value:function(t){return this.now=t,this}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"tick",value:function(t){return t*=this.timeScale,this.now+=t,this.delta=t,this.emit("update",this.now,this.delta),this}}]),s}(),mo=function(){w(e,ko);var t=T(e);function e(){return B(this,e),t.apply(this,arguments)}return m(e,[{key:"startTicking",value:function(){O(C(e.prototype),"startTicking",this).call(this),this.scene.events.on("update",this.update,this)}},{key:"stopTicking",value:function(){O(C(e.prototype),"stopTicking",this).call(this),this.scene&&this.scene.events.off("update",this.update,this)}},{key:"update",value:function(t,e){return this.isRunning&&0!==this.timeScale&&this.tick(e),this}}]),e}(),bo=Phaser.Math.Clamp,xo=function(){function i(t,e){B(this,i),this.setTimeline(t).reset(e)}return m(i,[{key:"setTimeline",value:function(t){return this.timeline=t,this}},{key:"setName",value:function(t){return this.name=t,this}},{key:"setCallbacks",value:function(t,e,i,n){return this.target=t,this.onStart=e,this.onProgress=i,this.onComplete=n,this}},{key:"setDuration",value:function(t,e){return void 0===e&&(e=!1),this.duration=t,this.remainder=t,this.t=0,this.yoyo=e,this}},{key:"setPaused",value:function(t){return this.isPaused=t,this}},{key:"pause",value:function(){return this.isPaused=!0,this}},{key:"resume",value:function(){return this.isPaused=!1,this}},{key:"setRemoved",value:function(t){return this.removed=t,this}},{key:"remove",value:function(){return this.removed=!0,this}},{key:"seek",value:function(t){return this.remainder=this.duration*(1-t),this}},{key:"reset",value:function(t){return this.setName(t.name).setDuration(t.duration,t.yoyo).setCallbacks(t.target,t.onStart,t.onProgress,t.onComplete).setPaused(!1).setRemoved(!1),this}},{key:"onFree",value:function(){this.setTimeline().setCallbacks()}},{key:"getProgress",value:function(){var t,e,i=1-this.remainder/this.duration;return i=bo(i,0,1),this.yoyo&&(void 0===e&&(e=.5),(t=i)<=e?t/=e:t=1-(t-e)/(1-e),i=t),i}},{key:"setProgress",value:function(t){t=bo(t,0,1),this.remainder=this.duration*(1-t)}},{key:"runCallback",value:function(t){t&&t(this.target,this.t,this)}},{key:"update",value:function(t,e){if(this.removed)return!0;if(this.isPaused)return!1;this.remainder-=e,this.t=this.getProgress(),this.runCallback(this.onProgress);var i=this.remainder<=0;return i&&this.runCallback(this.onComplete),i}}]),i}(),Co=function(){w(e,Kt);var t=T(e);function e(){return B(this,e),t.apply(this,arguments)}return m(e,[{key:"allocate",value:function(){return this.pop()}},{key:"free",value:function(t){t.onFree(),this.push(t)}},{key:"freeMultiple",value:function(t){for(var e=0,i=t.length;e<i;e++)this.free(t[e]);return this}}]),e}(),wo=Phaser.Utils.Objects.GetValue,So=new Co,Po=function(){w(a,mo);var n=T(a);function a(t,e){var i;return B(this,a),(i=n.call(this,t,e)).addedTimers=[],i.timers=[],i.timerPool=wo(e,"pool",So),i}return m(a,[{key:"shutdown",value:function(){this.isShutdown||(this.timerPool.freeMultiple(this.addedTimers).freeMultiple(this.timers),this.timerPool=void 0,this.addedTimers=void 0,this.timers=void 0,O(C(a.prototype),"shutdown",this).call(this))}},{key:"addTimer",value:function(t){var e=this.timerPool.allocate();return e?e.setTimeline(this).reset(t):e=new xo(this,t),this.addedTimers.push(e),e.runCallback(e.onStart),this.isRunning||this.start(),e}},{key:"delayCall",value:function(t,n,s,r){return this.addTimer({duration:t,onComplete:function(t,e,i){void 0===s&&(s=[]),s.push(i),n.apply(r,s)}})}},{key:"getTimers",value:function(t){for(var e=[],i=[this.addedTimers,this.timers],n=0,s=i.length;n<s;n++)for(var r=i[n],o=0,a=r.length;o<a;o++){var h=r[o];h.name===t&&e.push(h)}return e}},{key:"update",value:function(t,e){var i;O(C(a.prototype),"update",this).call(this,t,e),(i=this.timers).push.apply(i,M(this.addedTimers));for(var n=[],s=this.addedTimers.length=0,r=this.timers.length;s<r;s++){var o=this.timers[s];o.update(this.now,this.delta)?this.timerPool.free(o):n.push(o)}this.timers=n,0===this.timers.length&&0===this.addedTimers.length&&this.complete()}}]),a}(),To=Phaser.Utils.Objects.GetValue,Oo=function(){function i(t,e){B(this,i),this.setEventEmitter(),this.textPlayer=t,this.isPageTyping=!1,this.timeline=new Po(t),this.typingTimer=void 0,this.pauseTypingTimer=void 0,this.inTypingProcessLoop=!1,this.isTypingPaused=!1,this.setIgnoreWait(!1),this.setSkipTypingAnimation(!1),this.setTypingStartCallback(To(e,"onTypingStart",Eo)),this.setSpeed(To(e,"speed",250)),this.setAnimationConfig(To(e,"animation",void 0))}return m(i,[{key:"destroy",value:function(){this.destroyEventEmitter(),this.textPlayer=void 0,this.timeline.destroy(),this.timeline=void 0,this.typingTimer=void 0,this.pauseTypingTimer=void 0,this.onTypeStart=void 0,this.animationConfig=void 0}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"setTypingStartCallback",value:function(t){return this.onTypeStart=t,this}},{key:"setAnimationConfig",value:function(t){return void 0===t?t={}:!1===t&&(t={duration:0}),t.hasOwnProperty("duration")||(t.duration=1e3),t.hasOwnProperty("onStart")||(t.onStart=Mo),this.animationConfig=t,this}},{key:"getNextChild",value:function(){var t=this.children[this.index];return this.index=Math.min(this.index+1,this.children.length),t}}]),i}(),Mo=function(t){t.setVisible()},Eo=function(t){for(var e=0,i=t.length;e<i;e++)t[e].setVisible(!1)};Object.assign(Oo.prototype,vs,lo);function _o(t,e,i,n,s){void 0===n&&(n=1),void 0===s&&(s=0);var r,o={mode:0,volume:{start:s,end:n},duration:i};return"string"==typeof e&&(e=t.sound.add(e)),e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(o):(r=new Ko(t,e,o),e._fade=r),r.start(),e.isPlaying||e.setVolume(s).play(),e}function Bo(t,e,i,n){void 0===n&&(n=!0);var s,r={mode:n?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(s=e._fade).stop().resetFromJSON(r):(s=new Ko(t,e,r),e._fade=s),s.start(),e.isPlaying||e.play(),e}function zo(i,t){return i.hasOwnProperty("tintR")||(void 0===t&&(t=16777215),Object.defineProperty(i,"tint",{get:function(){return i._tintRGB},set:function(t){t=16777215&Math.floor(t),i.setTint(t),i._tintRGB!==t&&(i._tintRGB=t,i._tintR=t>>16&255,i._tintG=t>>8&255,i._tintB=255&t)}}),Object.defineProperty(i,"tintR",{get:function(){return i._tintR},set:function(t){var e;t=255&Math.floor(t),i._tintR!==t&&(i._tintR=t,i._tintRGB=(e=i._tintRGB,(255&t)<<16|65535&e),i.tint=i._tintRGB)}}),Object.defineProperty(i,"tintG",{get:function(){return i._tintG},set:function(t){var e;t=255&Math.floor(t),i._tintG!==t&&(i._tintG=t,i._tintRGB=(e=i._tintRGB,(255&t)<<8|16711935&e),i.tint=i._tintRGB)}}),Object.defineProperty(i,"tintB",{get:function(){return i._tintB},set:function(t){var e;t=255&Math.floor(t),i._tintB!==t&&(i._tintB=t,i._tintRGB=(e=i._tintRGB,255&t|16776960&e),i.tint=i._tintRGB)}}),Object.defineProperty(i,"tintGray",{get:function(){return Math.floor((i._tintR+i._tintG+i._tintB)/3)},set:function(t){t=255&Math.floor(t),i._tintR===t&&i._tintG===t&&i._tintB===t||(i._tintR=t,i._tintG=t,i._tintB=t,i._tintRGB=(i._tintRGB,(255&t)<<16|(255&t)<<8|255&t),i.tint=i._tintRGB)}}),i.tint=t),i}var Ro=function(){w(e,vo);var t=T(e);function e(){return B(this,e),t.apply(this,arguments)}return m(e,[{key:"startTicking",value:function(){O(C(e.prototype),"startTicking",this).call(this),this.scene.events.on("update",this.update,this)}},{key:"stopTicking",value:function(){O(C(e.prototype),"stopTicking",this).call(this),this.scene&&this.scene.events.off("update",this.update,this)}}]),e}(),Io=Phaser.Utils.Objects.GetValue,Do=Phaser.Math.Clamp,Lo=function(){function e(t){B(this,e),this.resetFromJSON(t)}return m(e,[{key:"resetFromJSON",value:function(t){this.state=Io(t,"state",jo),this.timeScale=Io(t,"timeScale",1),this.delay=Io(t,"delay",0),this.repeat=Io(t,"repeat",0),this.repeatCounter=Io(t,"repeatCounter",0),this.duration=Io(t,"duration",0),this.nowTime=Io(t,"nowTime",0),this.justRestart=Io(t,"justRestart",!1)}},{key:"toJSON",value:function(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}},{key:"destroy",value:function(){}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"setDelay",value:function(t){return void 0===t&&(t=0),this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatInfinity",value:function(){return this.repeat=-1,this}},{key:"start",value:function(){return this.nowTime=0<this.delay?-this.delay:0,this.state=0<=this.nowTime?Fo:Ao,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=jo,this}},{key:"update",value:function(t,e){this.state!==jo&&this.state!==Yo&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.state=0<=this.nowTime?Fo:Ao,this.justRestart=!1,this.nowTime>=this.duration&&(-1===this.repeat||this.repeatCounter<this.repeat?(this.repeatCounter++,this.justRestart=!0,this.nowTime-=this.duration):(this.nowTime=this.duration,this.state=Yo)))}},{key:"t",get:function(){var t;switch(this.state){case jo:case Ao:t=0;break;case Fo:t=this.nowTime/this.duration;break;case Yo:t=1}return Do(t,0,1)},set:function(t){(t=Do(t,-1,1))<0?(this.state=Ao,this.nowTime=-this.delay*t):(this.state=Fo,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}},{key:"isIdle",get:function(){return this.state===jo}},{key:"isDelay",get:function(){return this.state===Ao}},{key:"isCountDown",get:function(){return this.state===Fo}},{key:"isRunning",get:function(){return this.state===Ao||this.state===Fo}},{key:"isDone",get:function(){return this.state===Yo}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),e}(),jo=0,Ao=1,Fo=2,Yo=-1,Vo=function(){w(s,Ro);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,e)).timer=new Lo,i}return m(s,[{key:"shutdown",value:function(t){this.isShutdown||(O(C(s.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0)}},{key:"start",value:function(){return this.timer.start(),O(C(s.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),O(C(s.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),O(C(s.prototype),"complete",this).call(this),this}}]),s}(),Wo=Phaser.Utils.Objects.GetValue,Go=Phaser.Utils.Objects.GetAdvancedValue,Uo=Phaser.Tweens.Builders.GetEaseFunction,Ho=function(){w(e,Vo);var t=T(e);function e(){return B(this,e),t.apply(this,arguments)}return m(e,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Wo(t,"timer")),this.setEnable(Wo(t,"enable",!0)),this.setDelay(Go(t,"delay",0)),this.setDuration(Go(t,"duration",1e3)),this.setEase(Wo(t,"ease","Linear")),this.setRepeat(Wo(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Uo(t),this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"start",value:function(){return this.timer.isRunning||O(C(e.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;var n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(){}}]),e}(),Xo=Phaser.Utils.Objects.GetValue,No=Phaser.Utils.Objects.GetAdvancedValue,Jo=Phaser.Math.Linear,Ko=function(){w(r,Ho);var s=T(r);function r(t,e,i){var n;return B(this,r),e.scene=t,e.active=!0,(n=s.call(this,e,i)).volume={},n.resetFromJSON(i),n}return m(r,[{key:"resetFromJSON",value:function(t){return O(C(r.prototype),"resetFromJSON",this).call(this,t),this.setMode(Xo(t,"mode",0)),this.setEnable(Xo(t,"enable",!0)),this.setVolumeRange(No(t,"volume.start",this.parent.volume),No(t,"volume.end",0)),this}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=Zo[t]),this.mode=t,this}},{key:"setVolumeRange",value:function(t,e){return this.volume.start=t,this.volume.end=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),O(C(r.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){t.volume=Jo(this.volume.start,this.volume.end,e.t)}},{key:"complete",value:function(){switch(O(C(r.prototype),"complete",this).call(this),this.mode){case 1:this.parent.stop();break;case 2:this.parent.destroy()}return this}}]),r}(),Zo={stop:1,destroy:2},qo=Phaser.Utils.Objects.GetValue,$o=Phaser.Utils.Array.Remove,Qo=function(){function n(t,e){B(this,n),this.scene=t,this.soundEffects=[],this.backgroundMusic=void 0,this.setBackgroundMusicLoopValue(qo(e,"bgm.loop",!0)),this.setBackgroundMusicFadeTime(qo(e,"bgm.fade",500));var i=qo(e,"bgm.initial",void 0);i&&this.setCurrentBackgroundMusic(i)}return m(n,[{key:"destroy",value:function(t){if(this.soundEffects.length&&!t)for(var e=this.soundEffects.length-1;0<=e;e--)this.soundEffects[e].destroy();this.soundEffects.length=0,this.backgroundMusic&&!t&&this.backgroundMusic.destroy(),this.backgroundMusic=void 0,this.scene=void 0}},{key:"setBackgroundMusicLoopValue",value:function(t){return this.backgroundMusicLoopValue=t,this}},{key:"setBackgroundMusicFadeTime",value:function(t){return this.backgroundMusicFadeTime=t,this}},{key:"getSoundEffects",value:function(){return this.soundEffects}},{key:"getLastSoundEffect",value:function(){return this.soundEffects[this.soundEffects.length-1]}},{key:"getBackgroundMusic",value:function(){return this.backgroundMusic}},{key:"playSoundEffect",value:function(t){var e=this.scene.sound.add(t);return this.soundEffects.push(e),e.once("complete",function(){e.destroy(),this.scene&&$o(this.soundEffects,e)},this).once("destroy",function(){this.scene&&$o(this.soundEffects,e)},this).play(),this}},{key:"setSoundEffectVolume",value:function(t){var e=this.getLastSoundEffect();return e&&e.setVolume(t),this}},{key:"fadeInSoundEffect",value:function(t){var e=this.getLastSoundEffect();return e&&_o(this.scene,e,t),this}},{key:"fadeOutSoundEffect",value:function(t,e){var i=this.getLastSoundEffect();return i&&Bo(this.scene,i,t,e),this}},{key:"fadeOutAllSoundEffects",value:function(t,e){for(var i=this.soundEffects.length-1;0<=i;i--)Bo(this.scene,this.soundEffects[i],t,e);return this}},{key:"setCurrentBackgroundMusic",value:function(t){(this.backgroundMusic=t)&&(t.setLoop(this.backgroundMusicLoopValue),t.once("complete",function(){this.backgroundMusic.destroy(),this.backgroundMusic=void 0},this).once("destroy",function(){this.backgroundMusic=void 0},this),t.isPlaying||t.play())}},{key:"playBackgroundMusic",value:function(t){return this.backgroundMusic&&this.backgroundMusic.key===t||(this.stopBackgroundMusic(),this.setCurrentBackgroundMusic(this.scene.sound.add(t)),0<this.backgroundMusicFadeTime&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime)),this}},{key:"pauseBackgroundMusic",value:function(){return this.backgroundMusic&&this.backgroundMusic.pause(),this}},{key:"resumeBackgroundMusic",value:function(){return this.backgroundMusic&&this.backgroundMusic.resume(),this}},{key:"stopBackgroundMusic",value:function(){return this.backgroundMusic&&(0<this.backgroundMusicFadeTime?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this}},{key:"fadeInBackgroundMusic",value:function(t){return this.backgroundMusic&&_o(this.scene,this.backgroundMusic,t),this}},{key:"fadeOutBackgroundMusic",value:function(t,e){return this.backgroundMusic&&Bo(this.scene,this.backgroundMusic,t,e),this}},{key:"crossFadeBackgroundMusic",value:function(t,e){var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this}}]),n}(),ta=function(){function n(t,e,i){B(this,n),this.spriteManager=t,this.sprite=e.setName(i),this.tweens={},this.name=i}return m(n,[{key:"scene",get:function(){return this.spriteManager.scene}},{key:"destroy",value:function(){this.freeSprite().freeTweens(),this.spriteManager=void 0}},{key:"freeSprite",value:function(){return this.sprite.destroy(),this.sprite=void 0,this}},{key:"freeTweens",value:function(){var t=this.tweens;for(var e in t)t[e].remove(),delete t[e];return this}},{key:"setProperty",value:function(t,e){return this.sprite[t]=e,this}},{key:"easeProperty",value:function(t,e,i,n,s,r){var o=this.tweens;o.hasOwnProperty(t)&&o[t].remove();var a={targets:this.sprite,duration:i,ease:n,yoyo:s,onComplete:function(){o[t].remove(),delete o[t],r&&r()},onCompleteScope:this};return a[t]=e,o[t]=this.scene.tweens.add(a),this}},{key:"setTexture",value:function(t,e){return this.sprite.setTexture(t,e),this}},{key:"playAnimation",value:function(t){return this.sprite.play(t),this}},{key:"stopAnimation",value:function(){return this.sprite.stop(),this}},{key:"chainAnimation",value:function(t){return this.sprite.chain(t),this}},{key:"pauseAnimation",value:function(){return this.sprite.anims.pause(),this}}]),n}(),ea=Phaser.Utils.Objects.GetValue,ia=Phaser.Utils.Array.Remove,na=function(){function i(t,e){B(this,i),this.scene=t,this.setEventEmitter(ea(e,"eventEmitter",void 0)),this.setCreateCallback(ea(e,"createCallback","sprite")),this.setSpriteFadeTime(ea(e,"fade",500)),this.sprites={},this.removedSprites=[]}return m(i,[{key:"destroy",value:function(t){this.clear(!t),this.createCallback=void 0,this.scene=void 0}},{key:"setCreateCallback",value:function(t){return this.createCallback="sprite"===t?function(t,e,i){return t.add.sprite(0,0,e,i)}:"image"===t?function(t,e,i){return t.add.image(0,0,e,i)}:t,this}},{key:"setSpriteFadeTime",value:function(t){return this.fadeTime=t,this}},{key:"has",value:function(t){return this.sprites.hasOwnProperty(t)}},{key:"get",value:function(t){return this.sprites[t]}},{key:"getTweenTask",value:function(t,e){if(this.has(t)){var i=this.get(t).tweens;if(i.hasOwnProperty(e))return i[e]}return null}},{key:"isEmpty",get:function(){return function(t){for(var e in t)return!1;return!0}(this.sprites)&&0===this.removedSprites.length}},{key:"clear",value:function(t){for(var e in void 0===t&&(t=!0),this.sprites)t&&this.sprites[e].destroy(),delete this.sprites[e];return this.removedSprites.length=0,this}},{key:"add",value:function(t,e,i){var n;if(this.remove(t),3===arguments.length)n=this.createCallback(this.scene,e,i);else{var s=Array.prototype.slice.call(arguments,1);n=this.createCallback.apply(this,[this.scene].concat(M(s)))}0<this.fadeTime&&zo(n),n.once("destroy",function(){ia(this.removedSprites,n),this.isEmpty&&this.emit("empty")},this);var r=new ta(this,n,t);return this.sprites[t]=r,0<this.fadeTime&&r.setProperty("tintGray",0).easeProperty("tintGray",255,this.fadeTime),this}},{key:"setProperty",value:function(t,e,i){return this.has(t)&&this.get(t).setProperty(e,i),this}},{key:"easeProperty",value:function(t,e,i,n,s,r,o){return this.has(t)&&(void 0===n&&(n=1e3),void 0===s&&(s="Linear"),this.get(t).easeProperty(e,i,n,s,r,o)),this}},{key:"remove",value:function(t){if(!this.has(t))return this;var e=this.get(t);return delete this.sprites[t],this.removedSprites.push(e.sprite),0<this.fadeTime?e.easeProperty("tintGray",0,this.fadeTime,"Linear",!1,function(){e.destroy()}):e.destroy(),this}},{key:"removeAll",value:function(){for(var t in this.sprites)this.remove(t);return this}},{key:"setTexture",value:function(t,e,i){return this.has(t)&&this.get(t).setTexture(e,i),this}},{key:"playAnimation",value:function(t,e){return this.has(t)||this.add(t),this.get(t).playAnimation(e),this}},{key:"stopAnimation",value:function(t){return this.has(t)&&this.get(t).stopAnimation(),this}},{key:"chainAnimation",value:function(t,e){return this.has(t)&&this.get(t).chainAnimation(e),this}},{key:"pauseAnimation",value:function(t){return this.has(t)&&this.get(t).pauseAnimation(),this}}]),i}();Object.assign(na.prototype,vs);var sa=Phaser.Utils.Objects.GetValue,ra={setClickTarget:function(t){return js(t)?this.clickEE=t.input:this.clickEE=t.setInteractive(),this},setTargetCamera:function(t){return this.camera=t,this},setNextPageInput:function(s){var r=this;this.nextPageInput=s?"function"==typeof s?function(t,e,i){var n=Os(r,t,e,i);s.call(r,n)}:function(t,e,i){Ls(r,s,t,e,i)}:null},addImage:function(t,e){return this.imageManager.add(t,e),this},play:function(t){return this.isPlaying||(this.removeChildren(),this.parser.start(t),this.isPlaying=!0,this.once("complete",function(){this.isPlaying=!1},this),this.lastWrapResult=void 0,this.typingNextPage()),this},playPromise:function(t){var e=Ts(this);return this.play(t),e},typingNextPage:function t(){if(!this.isPlaying||this.isPageTyping)return this;var e=sa(this.wrapConfig,"callback",this.runWordWrap);"string"==typeof e&&(e=this[e]);var i=e.call(this,this.lastWrapResult);this.lastWrapResult=i,this.emit("page.start");function n(){this.emit(oo),i.isLastPage?this.emit("complete"):(this.emit("page.complete"),this.nextPageInput&&this.nextPageInput(t,[],this))}this.once(oo,function(){this.typeWriter.off("complete",n,this)}),this.typeWriter.once("complete",n,this).start(i.children)},pause:function(){return this.typeWriter.pause(),this},resume:function(){return this.typeWriter.resume(),this},setTimeScale:function(t){return this.typeWriter.setTimeScale(t),this},setIgnoreWait:function(t){return this.typeWriter.setIgnoreWait(t),this},showPage:function(){if(!this.isPlaying||!this.isPageTyping)return this;var t=this.typeWriter.speed,e=this.typeWriter.ignoreWait,i=this.typeWriter.skipTypingAnimation,n=this.typeWriter.skipSoundEffect;return this.typeWriter.once("complete",function(){this.typeWriter.setSpeed(t).setIgnoreWait(e).setSkipTypingAnimation(i).setSkipSoundEffect(n)},this).setSpeed(0).skipCurrentTypingDelay().setIgnoreWait(!0).setSkipTypingAnimation(!0).setSkipSoundEffect(!0),this}},oa=Phaser.Utils.Objects.IsPlainObject,aa=Phaser.Utils.Objects.GetValue,ha=function(){w(d,cs);var c=T(d);function d(t,e,i,n,s,r){var o;B(this,d),oa(e)?r=e:oa(n)&&(r=n),void 0===r&&(r={});var a=r.text;delete r.text,(o=c.call(this,t,e,i,n,s,r)).type="rexTextPlayer",o.parser=new so(z(o),aa(r,"parser",void 0)),o.typeWriter=new Oo(z(o),aa(r,"typing",void 0)),o._imageManager=void 0;var h=aa(r,"images",void 0);h&&o.addImage(h),o._soundManager=void 0;var l=aa(r,"sounds",void 0);l&&(o._soundManager=new Qo(o.scene,l)),o.setTargetCamera(aa(r,"camera",o.scene.cameras.main)),o._spriteManager=void 0;var u=aa(r,"sprites",void 0);return u&&(o._spriteManager=new na(o.scene,u)),o.setClickTarget(aa(r,"clickTarget",z(o))),o.setNextPageInput(aa(r,"nextPageInput",null)),o.isPlaying=!1,a&&o.play(a),o}return m(d,[{key:"imageManager",get:function(){return void 0===this._imageManager&&(this._imageManager=new Te(this.scene)),this._imageManager}},{key:"soundManager",get:function(){return void 0===this._soundManager&&(this._soundManager=new Qo(this.scene)),this._soundManager}},{key:"spriteManager",get:function(){return void 0===this._spriteManager&&(this._spriteManager=new na(this.scene)),this._spriteManager}},{key:"destroy",value:function(t){this.scene&&(function(t){for(var e=0,i=ao.length;e<i;e++)t.emit(ao[e])}(this),this.parser.destroy(),this.parser=void 0,this.typeWriter.destroy(t),this.typeWriter=void 0,this._imageManager&&this._imageManager.destroy(t),this._imageManager=void 0,this._soundManager&&this._soundManager.destroy(t),this._soundManager=void 0,this.camera=void 0,this._spriteManager&&this._spriteManager.destroy(t),this._spriteManager=void 0,this.clickEE=void 0,O(C(d.prototype),"destroy",this).call(this,t))}},{key:"isPageTyping",get:function(){return this.typeWriter.isPageTyping}}]),d}();Object.assign(ha.prototype,ra),u.register("textPlayer",function(t,e,i,n,s){var r=new ha(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),x(window,"RexPlugins.UI.TextPlayer",ha);function la(t,e,i,n,s,r,o,a,h,l,u,c){void 0===l&&(l=0),void 0===u&&(u=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,n,s,r,0,l,u,c),null!=o&&(e.fillStyle=o,e.fill()),null!=a&&(e.strokeStyle=a,e.lineWidth=h,e.stroke())}var ua=Phaser.Utils.Objects.GetValue,ca=Phaser.Math.Linear,da=function(){w(s,Ho);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,e)).resetFromJSON(),i.boot(),i}return m(s,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.parent;this.propertyKey=ua(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ua(t,"from",i),this.toValue=ua(t,"to",i),this.setEase(ua(t,"ease",this.ease)),this.setDuration(ua(t,"duration",this.duration)),this.timer.setDuration(this.duration),e[this.propertyKey]=this.fromValue,O(C(s.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ca(this.fromValue,this.toValue,i)}}]),s}(),fa=Phaser.Math.Percent,pa={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=fa(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new da(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this}},va=Phaser.Utils.Objects.GetValue,ga=Phaser.Utils.Objects.IsPlainObject,ya=Phaser.Math.Clamp,ka=Phaser.Math.Linear,ma=Phaser.Math.Percent,ba=Phaser.Math.DegToRad(270),xa=function(){w(f,dt);var d=T(f);function f(t,e,i,n,s,r,o){var a;B(this,f),ga(e)&&(e=va(o=e,"x",0),i=va(o,"y",0),n=va(o,"radius",1),s=va(o,"barColor",void 0),r=va(o,"value",0));var h=2*n;(a=d.call(this,t,e,i,h,h)).type="rexCircularProgressCanvas",a.eventEmitter=va(o,"eventEmitter",z(a)),a.setRadius(n),a.setTrackColor(va(o,"trackColor",void 0)),a.setBarColor(s),a.setCenterColor(va(o,"centerColor",void 0)),a.setThickness(va(o,"thickness",.2)),a.setStartAngle(va(o,"startAngle",ba)),a.setAnticlockwise(va(o,"anticlockwise",!1)),a.setTextColor(va(o,"textColor",void 0)),a.setTextStrokeColor(va(o,"textStrokeColor",void 0),va(o,"textStrokeThickness",void 0));var l=va(o,"textFont",void 0);l?a.setTextFont(l):a.setTextFont(va(o,"textSize","16px"),va(o,"textFamily","Courier"),va(o,"textStyle","")),a.setTextFormatCallback(va(o,"textFormatCallback",void 0),va(o,"textFormatCallbackScope",void 0));var u=va(o,"valuechangeCallback",null);if(null!==u){var c=va(o,"valuechangeCallbackScope",void 0);a.eventEmitter.on("valuechange",u,c)}return a.setEaseValuePropName("value").setEaseValueDuration(va(o,"easeValue.duration",0)).setEaseValueFunction(va(o,"easeValue.ease","Linear")),a.setValue(r),a}return m(f,[{key:"resize",value:function(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(O(C(f.prototype),"resize",this).call(this,t,t),this.setRadius(t/2)),this}},{key:"value",get:function(){return this._value},set:function(t){t=ya(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)}},{key:"setValue",value:function(t,e,i){return null==t||(void 0!==e&&(t=ma(t,e,i)),this.value=t),this}},{key:"addValue",value:function(t,e,i){return void 0!==e&&(t=ma(t,e,i)),this.value+=t,this}},{key:"getValue",value:function(t,e){var i=this.value;return void 0!==t&&(i=ka(t,e,i)),i}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t;var e=2*(this._radius=t);this.resize(e,e)}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"trackColor",get:function(){return this._trackColor},set:function(t){t=pt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){t=pt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}},{key:"setStartAngle",value:function(t){return this.startAngle=t,this}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}},{key:"setAnticlockwise",value:function(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}},{key:"thickness",get:function(){return this._thickness},set:function(t){t=ya(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}},{key:"setThickness",value:function(t){return this.thickness=t,this}},{key:"centerColor",get:function(){return this._centerColor},set:function(t){t=pt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}},{key:"centerColor2",get:function(){return this._centerColor2},set:function(t){t=pt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t}},{key:"setCenterColor",value:function(t,e){return this.centerColor=t,this.centerColor2=e,this}},{key:"textColor",get:function(){return this._textColor},set:function(t){t=pt(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t}},{key:"setTextColor",value:function(t){return this.textColor=t,this}},{key:"textStrokeColor",get:function(){return this._textStrokeColor},set:function(t){t=pt(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t}},{key:"textStrokeThickness",get:function(){return this._textStrokeThickness},set:function(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t}},{key:"setTextStrokeColor",value:function(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}},{key:"textFont",get:function(){return this._textFont},set:function(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t}},{key:"setTextFont",value:function(t,e,i){var n;return n=void 0===e?t:i+" "+t+" "+e,this.textFont=n,this}},{key:"setTextFormatCallback",value:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}},{key:"updateTexture",value:function(){return this.clear(),function(){var t,e,i,n,s,r,o,a,h,l,u,c=this.radius,d=this.thickness*this.radius,f=this.radius-d/2,p=this.radius-d,v=(this.canvas,this.context);if(this.trackColor&&0<d&&(v.save(),la(0,v,c,c,f,f,void 0,this.trackColor,d),v.restore()),this.barColor&&0<f){var g,y,k;if(1===this.value)g=!1,y=0,k=2*Math.PI;else g=this.anticlockwise,y=this.startAngle,k=2*Math.PI*(g?1-this.value:this.value)+y;v.save(),la(0,v,c,c,f,f,void 0,this.barColor,d,y,k,g),v.restore()}this.centerColor&&0<p&&(this.centerColor2?((t=this.context.createRadialGradient(c,c,0,c,c,p)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,v.save(),la(0,v,c,c,p,p,t),v.restore());this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(v.save(),e=v,n=i=c,s=this.getFormatText(),r=this.textFont,o=this.textColor,a=this.textStrokeColor,void 0===(h=this.textStrokeThickness)&&null!=a&&(h=2),void 0===(l="center")&&(l="start"),void 0===(u="middle")&&(u="alphabetic"),e.font=r,e.textAlign=l,e.textBaseline=u,e.fillStyle=o,e.strokeStyle=a,e.lineWidth=h,e.lineCap="round",e.lineJoin="round",null!=a&&"none"!==a&&0<h&&e.strokeText(s,i,n),null!=o&&"none"!==o&&e.fillText(s,i,n),v.restore())}.call(this),O(C(f.prototype),"updateTexture",this).call(this),this}},{key:"getFormatText",value:function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}]),f}();Object.assign(xa.prototype,pa),u.register("circularProgressCanvas",function(t,e,i,n,s,r){var o=new xa(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o}),x(window,"RexPlugins.UI.CircularProgressCanvas",xa);var Ca=Phaser.Renderer.Canvas.SetTransform,wa={renderWebGL:function(t,e,i,n){e.updateData(),i.addToRenderList(e);var s=t.pipelines.set(e.pipeline),r=j(e,i,n),o=s.calcMatrix.copyFrom(r.calc),a=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u=e.geom,c=0,d=u.length;c<d;c++)u[c].webglRender(s,o,l,a,h);t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,n){e.updateData(),i.addToRenderList(e);var s=t.currentContext;if(Ca(t,s,e,i,n)){for(var r=e._displayOriginX,o=e._displayOriginY,a=e.geom,h=0,l=a.length;h<l;h++)a[h].canvasRender(s,r,o);s.restore()}}},Sa=Phaser.GameObjects.Shape,Pa=Phaser.Utils.Array.Remove,Ta=function(){w(a,Sa);var o=T(a);function a(t,e,i,n,s){var r;return B(this,a),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=n),(r=o.call(this,t,"rexShapes",[]))._width=-1,r._height=-1,r.dirty=!0,r.isSizeChanged=!0,r.shapes={},r.setPosition(e,i),r.setSize(n,s),r.updateDisplayOrigin(),r}return m(a,[{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height)}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t)}},{key:"setDirty",value:function(t){return void 0===t&&(t=!0),this.dirty=t,this}},{key:"setSize",value:function(t,e){this.isSizeChanged=this.isSizeChanged||this._width!==t||this._height!==e,this.dirty=this.dirty||this.isSizeChanged,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}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.fillColor!==t||this.fillAlpha!==e,this.fillColor=t,this.fillAlpha=e,this}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.lineWidth!==t||this.strokeColor!==e||this.strokeAlpha!==i,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateShapes",value:function(){}},{key:"updateData",value:function(){if(!this.dirty)return this;this.updateShapes();for(var t=this.geom,e=0,i=t.length;e<i;e++){var n=t[e];n.dirty&&n.updateData()}return this.dirty=!1,this.isSizeChanged=!1,this}},{key:"clear",value:function(){return this.geom.length=0,Ot(this.shapes),this}},{key:"getShape",value:function(t){return this.shapes[t]}},{key:"getShapes",value:function(){return this.geom}},{key:"addShape",value:function(t){this.geom.push(t);var e=t.name;return e&&(this.shapes[e]=t),this.dirty=!0,this}},{key:"deleteShape",value:function(t){var e=this.getShape(t);return e&&(delete this.shapes[t],Pa(this.geom,e)),this}}]),a}();Object.assign(Ta.prototype,wa);var Oa={fillStyle:function(t,e){return void 0===t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return void 0===t||void 0===e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},Ma={setData:function(t,e){return void 0===this.data&&(this.data={}),this.data[t]=e,this},getData:function(t,e){return void 0===this.data&&(this.data={}),this.data.hasOwnProperty(t)||(this.data[t]=e),this.data[t]}},Ea=function(){function t(){B(this,t),this.name=void 0,this.dirty=!0,this.data=void 0,this.isFilled=!1,this.fillColor=void 0,this.fillAlpha=1,this.isStroked=!1,this.lineWidth=1,this.strokeColor=void 0,this.strokeAlpha=1}return m(t,[{key:"setName",value:function(t){return this.name=t,this}},{key:"reset",value:function(){return this.fillStyle(),this.lineStyle(),this}},{key:"webglRender",value:function(){}},{key:"canvasRender",value:function(){}},{key:"updateData",value:function(){}}]),t}();Object.assign(Ea.prototype,Oa,Ma);function _a(t,e,i,n,s,r){for(var o=r.length,a=r[o-2],h=r[o-1],l=1,u=s-1;l<=u;l++){var c=l/u;r.push(Fa(c,a,t,i),Fa(c,h,e,n))}return r}var Ba=Phaser.Geom.Polygon.Earcut,za=function(){w(i,Ea);var e=T(i);function i(){var t;return B(this,i),(t=e.call(this)).pathData=[],t.pathIndexes=[],t.closePath=!1,t}return m(i,[{key:"updateData",value:function(){return this.pathIndexes=Ba(this.pathData),this}},{key:"webglRender",value:function(t,e,i,n,s){this.isFilled&&D(t,e,this,i,n,s),this.isStroked&&L(t,this,i,n,s)}},{key:"canvasRender",value:function(t,e,i){var n=this.pathData,s=n.length-1,r=n[0]-e,o=n[1]-i;t.beginPath(),t.moveTo(r,o),this.closePath||(s-=2);for(var a=2;a<s;a+=2){var h=n[a]-e,l=n[a+1]-i;t.lineTo(h,l)}this.closePath&&t.closePath(),this.isFilled&&(A(t,this),t.fill()),this.isStroked&&(F(t,this),t.stroke())}}]),i}(),Ra=Phaser.Math.DegToRad,Ia=function(){w(u,za);var l=T(u);function u(t,e,i,n,s,r,o,a){var h;return B(this,u),void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=360),void 0===o&&(o=!1),void 0===a&&(a=!1),(h=l.call(this)).setCenterPosition(t,e),h.setRadius(i,n),h.setAngle(s,r,o),h.setPie(a),h.setIterations(32),h}return m(u,[{key:"x",get:function(){return this._x},set:function(t){this.dirty=this.dirty||this._x!==t,this._x=t}},{key:"y",get:function(){return this._y},set:function(t){this.dirty=this.dirty||this._y!==t,this._y=t}},{key:"setCenterPosition",value:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this}},{key:"radiusX",get:function(){return this._radiusX},set:function(t){this.dirty=this.dirty||this._radiusX!==t,this._radiusX=t}},{key:"radiusY",get:function(){return this._radiusY},set:function(t){this.dirty=this.dirty||this._radiusY!==t,this._radiusY=t}},{key:"setRadius",value:function(t,e){return void 0===e&&(e=t),this.radiusX=t,this.radiusY=e,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){this.dirty=this.dirty||this._startAngle!==t,this._startAngle=t}},{key:"endAngle",get:function(){return this._endAngle},set:function(t){this.dirty=this.dirty||this._endAngle!==t,this._endAngle=t}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!==t,this._anticlockwise=t}},{key:"setAngle",value:function(t,e,i){return void 0===i&&(i=!1),this.startAngle=t,this.endAngle=e,this.anticlockwise=i,this}},{key:"pie",get:function(){return this._pie},set:function(t){this.dirty=this.dirty||this._pie!==t,this._pie=t}},{key:"setPie",value:function(t){return void 0===t&&(t=!0),this.pie=t,this}},{key:"iterations",get:function(){return this._iterations},set:function(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}},{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"updateData",value:function(){return this.pathData.length=0,this.pie&&this.pathData.push(this.x,this.y),I(this.x,this.y,this.radiusX,this.radiusY,this.startAngle,this.endAngle,this.anticlockwise,this.iterations,this.pathData),this.pie&&this.pathData.push(this.x,this.y),this.pathData.push(this.pathData[0],this.pathData[1]),O(C(u.prototype),"updateData",this).call(this),this}},{key:"canvasRender",value:function(t,e,i){t.beginPath();var n=this.x-e,s=this.y-i,r=Ra(this.startAngle),o=Ra(this.endAngle);this.pie&&(t.moveTo(n,s),t.lineTo(n+Math.cos(r)*this.radiusX,s+Math.sin(r)*this.radiusY)),t.ellipse(n,s,this.radiusX,this.radiusY,0,r,o,this.anticlockwise),this.pie&&t.lineTo(n,s),this.isFilled&&(A(t,this),t.fill()),this.isStroked&&(F(t,this),t.stroke())}}]),u}(),Da=function(){w(s,Ia);var n=T(s);function s(t,e,i){return B(this,s),n.call(this,t,e,i,i,0,360)}return s}(),La=function(){w(n,za);var i=T(n);function n(t){var e;return B(this,n),(e=i.call(this)).setCurve(t),e.setIterations(32),e}return m(n,[{key:"curve",get:function(){return this._curve},set:function(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}},{key:"setCurve",value:function(t){return this.curve=t,this}},{key:"iterations",get:function(){return this._iterations},set:function(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}},{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"updateData",value:function(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;e<i;e++)this.pathData.push(t[e].x,t[e].y);return this.pathData.push(t[0].x,t[0].y),O(C(n.prototype),"updateData",this).call(this),this}}]),n}(),ja=function(){w(r,Ia);var s=T(r);function r(t,e,i,n){return B(this,r),s.call(this,t,e,i,n,0,360)}return r}(),Aa=function(){w(o,za);var r=T(o);function o(t,e,i,n){var s;return B(this,o),void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),(s=r.call(this)).setP0(t,e),s.setP1(i,n),s}return m(o,[{key:"x0",get:function(){return this._x0},set:function(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}},{key:"y0",get:function(){return this._y0},set:function(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}},{key:"setP0",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"x1",get:function(){return this._x1},set:function(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}},{key:"y1",get:function(){return this._y1},set:function(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}},{key:"setP1",value:function(t,e){return this.x1=t,this.y1=e,this}},{key:"updateData",value:function(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x0,this.y0),O(C(o.prototype),"updateData",this).call(this),this}}]),o}(),Fa=Phaser.Math.Interpolation.QuadraticBezier,Ya=Phaser.Math.RotateAround,Va=Phaser.Geom.Polygon,Wa=Phaser.Math.DegToRad,Ga=function(){function e(t){B(this,e),void 0===t&&(t=[]),this.pathData=t,this.closePath=!1,this.setIterations(32),this.lastPointX=void 0,this.lastPointY=void 0}return m(e,[{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"startAt",value:function(t,e){var i,n,s;return i=t,n=e,(s=this.pathData).length=0,s.push(i,n),this.lastPointX=t,this.lastPointY=e,this}},{key:"lineTo",value:function(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),R(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this}},{key:"verticalLineTo",value:function(t,e){return this.lineTo(t,this.lastPointY,e),this}},{key:"horizontalLineTo",value:function(t,e){return this.lineTo(this.lastPointX,t,e),this}},{key:"ellipticalArc",value:function(t,e,i,n,s,r,o){void 0===o&&(o=!1),I(t,e,i,n,s,r,o,this.iterations,this.pathData);var a=this.pathData.length;return this.lastPointX=this.pathData[a-2],this.lastPointY=this.pathData[a-1],this}},{key:"arc",value:function(t,e,i,n,s,r){return this.ellipticalArc(t,e,i,i,n,s,r),this}},{key:"quadraticBezierTo",value:function(t,e,i,n){return _a(t,e,i,n,this.iterations,this.pathData),this.lastPointX=i,this.lastPointY=n,this.lastCX=t,this.lastCY=e,this}},{key:"smoothQuadraticBezierTo",value:function(t,e){var i=2*this.lastPointX-this.lastCX,n=2*this.lastPointY-this.lastCY;return this.quadraticBezierTo(i,n,t,e),this}},{key:"cubicBezierCurveTo",value:function(t,e,i,n,s,r){return _a(t,e,i,n,s,r,this.iterations,this.pathData),this.lastPointX=s,this.lastPointY=r,this.lastCX=i,this.lastCY=n,this}},{key:"smoothCubicBezierCurveTo",value:function(t,e,i,n){var s=2*this.lastPointX-this.lastCX,r=2*this.lastPointY-this.lastCY;return this.cubicBezierCurveTo(s,r,t,e,i,n),this}},{key:"close",value:function(){return this.closePath=!0,this}},{key:"end",value:function(){return this.pathData.push(this.lastPointX,this.lastPointY),this}},{key:"rotateAround",value:function(t,e,i){if(0===this.pathData.length)return this;!function(t,e,i,n){for(var s={x:0,y:0},r=0,o=n.length-1;r<o;r+=2)s.x=n[r],s.y=n[r+1],Ya(s,t,e,i),n[r]=s.x,n[r+1]=s.y}(t,e,i=Wa(i),this.pathData);var n=this.pathData.length;if(this.lastPointX=this.pathData[n-2],this.lastPointY=this.pathData[n-1],void 0!==this.lastCX){var s={x:this.lastCX,y:this.lastCY};PointRotateAround(s,t,e,i),this.lastCX=s.x,this.lastCY=s.y}return this}},{key:"offset",value:function(t,e){return function(t,e,i){for(var n=0,s=i.length-1;n<s;n+=2)i[n]+=t,i[n+1]+=e}(t,e,this.pathData),this}},{key:"toPoints",value:function(){return function(t,e){void 0===e&&(e=[]);for(var i=0,n=t.length-1;i<n;i+=2)e.push({x:t[i],y:t[i+1]});return e}(this.pathData)}},{key:"toPolygon",value:function(t){return e=this.pathData,void 0===(i=t)&&(i=new Va),i.setTo(e),i;var e,i}},{key:"draw",value:function(t,e,i){var n=this.toPoints();return e&&t.fillPoints(n,this.closePath,this.closePath),i&&t.strokePoints(n,this.closePath,this.closePath),this}}]),e}(),Ua=function(){w(i,za);var e=T(i);function i(){var t;return B(this,i),(t=e.call(this)).builder=new Ga(t.pathData),t}return m(i,[{key:"iterations",get:function(){return this.builder.iterations},set:function(t){this.dirty=this.dirty||this.builder.iterations!==t,this.builder.setIterations(t)}},{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"lastPointX",get:function(){return this.builder.lastPointX}},{key:"lastPointY",get:function(){return this.builder.lastPointY}},{key:"startAt",value:function(t,e){return this.builder.startAt(t,e),this.dirty=!0,this}},{key:"lineTo",value:function(t,e,i){return this.builder.lineTo(t,e,i),this.dirty=!0,this}},{key:"verticalLineTo",value:function(t,e){return this.builder.verticalLineTo(t,e),this.dirty=!0,this}},{key:"horizontalLineTo",value:function(t,e){return this.builder.horizontalLineTo(t,e),this.dirty=!0,this}},{key:"ellipticalArc",value:function(t,e,i,n,s,r,o){return this.builder.ellipticalArc(t,e,i,n,s,r,o),this.dirty=!0,this}},{key:"arc",value:function(t,e,i,n,s,r){return this.builder.arc(t,e,i,n,s,r),this.dirty=!0,this}},{key:"quadraticBezierTo",value:function(t,e,i,n){return this.builder.quadraticBezierTo(t,e,i,n),this.dirty=!0,this}},{key:"smoothQuadraticBezierTo",value:function(t,e){return this.builder.smoothQuadraticBezierTo(t,e),this.dirty=!0,this}},{key:"cubicBezierCurveTo",value:function(t,e,i,n,s,r){return this.builder.cubicBezierCurveTo(t,e,i,n,s,r),this.dirty=!0,this}},{key:"smoothCubicBezierCurveTo",value:function(t,e,i,n){return this.builder.smoothCubicBezierCurveTo(t,e,i,n),this.dirty=!0,this}},{key:"close",value:function(){return this.builder.close(),this.closePath=this.builder.closePath,this.dirty=!0,this}},{key:"end",value:function(){return this.builder.end(),this.dirty=!0,this}},{key:"rotateAround",value:function(t,e,i){return this.builder.rotateAround(t,e,i),this.dirty=!0,this}},{key:"offset",value:function(t,e){return this.builder.offset(t,e),this.dirty=!0,this}},{key:"toPolygon",value:function(t){return this.builder.toPolygon(t)}}]),i}();Phaser.Math.Distance.Between,Phaser.Math.Linear;var Ha=Phaser.Renderer.WebGL.Utils,Xa=function(){w(o,Ea);var r=T(o);function o(t,e,i,n){var s;return B(this,o),void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=i),(s=r.call(this)).pathData=[],s.closePath=!0,s.setTopLeftPosition(t,e),s.setSize(i,n),s}return m(o,[{key:"x",get:function(){return this._x},set:function(t){this.dirty=this.dirty||this._x!==t,this._x=t}},{key:"y",get:function(){return this._y},set:function(t){this.dirty=this.dirty||this._y!==t,this._y=t}},{key:"setTopLeftPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"width",get:function(){return this._width},set:function(t){this.dirty=this.dirty||this._width!==t,this._width=t}},{key:"height",get:function(){return this._height},set:function(t){this.dirty=this.dirty||this._height!==t,this._height=t}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"updateData",value:function(){this.pathData.length=0;var t=this.x,e=t+this.width,i=this.y,n=i+this.height;return this.pathData.push(t,i),this.pathData.push(e,i),this.pathData.push(e,n),this.pathData.push(t,n),this.pathData.push(t,i),this}},{key:"webglRender",value:function(t,e,i,n,s){if(this.isFilled){var r=t.fillTint,o=Ha.getTintAppendFloatAlpha(this.fillColor,this.fillAlpha*i);r.TL=o,r.TR=o,r.BL=o,r.BR=o,t.batchFillRect(-n+this.x,-s+this.y,this.width,this.height)}this.isStroked&&L(t,this,i,n,s)}},{key:"canvasRender",value:function(t,e,i){this.isFilled&&(A(t,this),t.fillRect(-e,-i,this.width,this.height)),this.isStroked&&(F(t,this),t.beginPath(),t.rect(-e,-i,this.width,this.height),t.stroke())}}]),o}(),Na=Phaser.Renderer.WebGL.Utils,Ja=function(){w(h,Ea);var a=T(h);function h(t,e,i,n,s,r){var o;return B(this,h),void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),(o=a.call(this)).pathData=[],o.closePath=!0,o.setP0(t,e),o.setP1(i,n),o.setP2(s,r),o}return m(h,[{key:"x0",get:function(){return this._x0},set:function(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}},{key:"y0",get:function(){return this._y0},set:function(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}},{key:"setP0",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"x1",get:function(){return this._x1},set:function(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}},{key:"y1",get:function(){return this._y1},set:function(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}},{key:"setP1",value:function(t,e){return this.x1=t,this.y1=e,this}},{key:"x2",get:function(){return this._x2},set:function(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}},{key:"y2",get:function(){return this._y2},set:function(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}},{key:"setP2",value:function(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}},{key:"updateData",value:function(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),this}},{key:"webglRender",value:function(t,e,i,n,s){if(this.isFilled){var r=Na.getTintAppendFloatAlpha(this.fillColor,this.fillAlpha*i),o=this.x0-n,a=this.y0-s,h=this.x1-n,l=this.y1-s,u=this.x2-n,c=this.y2-s,d=e.getX(o,a),f=e.getY(o,a),p=e.getX(h,l),v=e.getY(h,l),g=e.getX(u,c),y=e.getY(u,c);t.batchTri(d,f,p,v,g,y,r,r,r)}this.isStroked&&L(t,this,i,n,s)}},{key:"canvasRender",value:function(t,e,i){var n=this.x1-e,s=this.y1-i,r=this.x2-e,o=this.y2-i,a=this.x3-e,h=this.y3-i;t.beginPath(),t.moveTo(n,s),t.lineTo(r,o),t.lineTo(a,h),t.closePath(),this.isFilled&&(A(t,this),t.fill()),this.isStroked&&(F(t,this),t.stroke())}}]),h}(),Ka=Phaser.Utils.Objects.GetValue,Za=Phaser.Utils.Objects.IsPlainObject,qa=Phaser.Math.Clamp,$a=Phaser.Math.Linear,Qa=Phaser.Math.Percent,th=Phaser.Math.DegToRad(270),eh=Phaser.Math.RadToDeg,ih=function(){w(d,Ta);var c=T(d);function d(t,e,i,n,s,r,o){var a;B(this,d),Za(e)&&(e=Ka(o=e,"x",0),i=Ka(o,"y",0),n=Ka(o,"radius",1),s=Ka(o,"barColor",void 0),r=Ka(o,"value",0));var h=2*n;(a=c.call(this,t,e,i,h,h)).type="rexCircularProgress",a.eventEmitter=Ka(o,"eventEmitter",z(a)),a.addShape((new Da).setName("track")).addShape((new Ia).setName("bar")).addShape((new Da).setName("center")),a.setRadius(n),a.setTrackColor(Ka(o,"trackColor",void 0)),a.setBarColor(s),a.setCenterColor(Ka(o,"centerColor",void 0)),a.setThickness(Ka(o,"thickness",.2)),a.setStartAngle(Ka(o,"startAngle",th)),a.setAnticlockwise(Ka(o,"anticlockwise",!1));var l=Ka(o,"valuechangeCallback",null);if(null!==l){var u=Ka(o,"valuechangeCallbackScope",void 0);a.eventEmitter.on("valuechange",l,u)}return a.setEaseValuePropName("value").setEaseValueDuration(Ka(o,"easeValue.duration",0)).setEaseValueFunction(Ka(o,"easeValue.ease","Linear")),a.setValue(r),a}return m(d,[{key:"resize",value:function(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(O(C(d.prototype),"resize",this).call(this,t,t),this.setRadius(t/2)),this}},{key:"value",get:function(){return this._value},set:function(t){t=qa(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)}},{key:"setValue",value:function(t,e,i){return null==t||(void 0!==e&&(t=Qa(t,e,i)),this.value=t),this}},{key:"addValue",value:function(t,e,i){return void 0!==e&&(t=Qa(t,e,i)),this.value+=t,this}},{key:"getValue",value:function(t,e){var i=this.value;return void 0!==t&&(i=$a(t,e,i)),i}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t;var e=2*(this._radius=t);this.resize(e,e)}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"trackColor",get:function(){return this._trackColor},set:function(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}},{key:"setStartAngle",value:function(t){return this.startAngle=t,this}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}},{key:"setAnticlockwise",value:function(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}},{key:"thickness",get:function(){return this._thickness},set:function(t){t=qa(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}},{key:"setThickness",value:function(t){return this.thickness=t,this}},{key:"centerColor",get:function(){return this._centerColor},set:function(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}},{key:"setCenterColor",value:function(t){return this.centerColor=t,this}},{key:"updateShapes",value:function(){var t=this.radius,e=this.thickness*this.radius,i=this.radius-e/2,n=this.radius-e,s=this.getShape("track");this.trackColor&&0<e?s.setCenterPosition(t,t).setRadius(i).lineStyle(e,this.trackColor):s.reset();var r=this.getShape("bar");if(this.barColor&&0<i){var o,a,h;if(1===this.value)o=!1,a=0,h=360;else o=this.anticlockwise,a=eh(this.startAngle),h=360*(o?1-this.value:this.value)+a;r.setCenterPosition(t,t).setRadius(i).setAngle(a,h,o).lineStyle(e,this.barColor)}else r.reset();var l=this.getShape("center");this.centerColor&&0<n?l.setCenterPosition(t,t).setRadius(n).fillStyle(this.centerColor):l.reset()}}]),d}();Object.assign(ih.prototype,pa),u.register("circularProgress",function(t,e,i,n,s,r){var o=new ih(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o}),x(window,"RexPlugins.UI.CircularProgress",ih);function nh(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer}function sh(t,e){void 0===e&&(void 0===rh&&(rh=new Phaser.Geom.Rectangle),e=rh);var i=t.game.config;return e.setTo(0,0,i.width,i.height),e}var rh,oh=Phaser.Display.Align,ah={center:oh.CENTER,left:oh.LEFT_CENTER,right:oh.RIGHT_CENTER,top:oh.TOP_CENTER,bottom:oh.BOTTOM_CENTER,"left-top":oh.TOP_LEFT,"left-center":oh.LEFT_CENTER,"left-bottom":oh.BOTTOM_LEFT,"center-top":oh.TOP_CENTER,"center-center":oh.CENTER,"center-bottom":oh.BOTTOM_CENTER,"right-top":oh.TOP_RIGHT,"right-center":oh.RIGHT_CENTER,"right-bottom":oh.BOTTOM_RIGHT},hh=new Phaser.GameObjects.Zone({sys:{queueDepthSort:Et,events:{once:Et}}},0,0,1,1);hh.setOrigin(0);function lh(t){return void 0!==t.displayWidth?t.displayWidth:t.width}function uh(t){return void 0!==t.displayHeight?t.displayHeight:t.height}function ch(t){var e=uh(t);return t.y+e-e*t.originY}function dh(t){var e=lh(t);return t.x-e*t.originX+.5*e}function fh(t,e){var i=uh(t);return t.y=e-i+i*t.originY,t}function ph(t,e){var i=lh(t),n=i*t.originX;return t.x=e+n-.5*i,t}function vh(t){var e=lh(t);return t.x-e*t.originX}function gh(t,e){var i=lh(t);return t.x=e+i*t.originX,t}function yh(t){var e=lh(t);return t.x+e-e*t.originX}function kh(t,e){var i=lh(t);return t.x=e-i+i*t.originX,t}function mh(t,e){var i=uh(t),n=i*t.originY;return t.y=e+n-.5*i,t}function bh(t){var e=uh(t);return t.y-e*t.originY+.5*e}function xh(t){var e=uh(t);return t.y-e*t.originY}function Ch(t,e){var i=uh(t);return t.y=e+i*t.originY,t}var wh=0,Sh=1,Ph=2,Th=4,Oh=6,Mh=8,Eh=10,_h=12,Bh=[];Bh[11]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ph(t,dh(e)+i),fh(t,ch(e)+n),t},Bh[Eh]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),gh(t,vh(e)-i),fh(t,ch(e)+n),t},Bh[_h]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),kh(t,yh(e)+i),fh(t,ch(e)+n),t},Bh[Oh]=function(t,e,i,n){var s,r,o;return void 0===i&&(i=0),void 0===n&&(n=0),s=t,r=dh(e)+i,o=bh(e)+n,ph(s,r),mh(s,o),t},Bh[Th]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),gh(t,vh(e)-i),mh(t,bh(e)+n),t},Bh[Mh]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),kh(t,yh(e)+i),mh(t,bh(e)+n),t},Bh[Sh]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ph(t,dh(e)+i),Ch(t,xh(e)-n),t},Bh[wh]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),gh(t,vh(e)-i),Ch(t,xh(e)-n),t},Bh[Ph]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),kh(t,yh(e)+i),Ch(t,xh(e)-n),t};function zh(t,e,i,n,s){return Bh[i](t,e,n,s)}function Rh(t,e,i,n,s,r){hh.setPosition(e,i).setSize(n,s),zh(t,hh,r)}function Ih(t,e){return void 0===e&&(e={}),"number"==typeof t?(e.left=t,e.right=t,e.top=t,e.bottom=t):(e.left=Hh(t,"left",0),e.right=Hh(t,"right",0),e.top=Hh(t,"top",0),e.bottom=Hh(t,"bottom",0)),e}function Dh(t){return Xh.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this}function Lh(t,e){return void 0===this.childrenMap&&(this.childrenMap={}),this.childrenMap[t]=e,this}function jh(t){return void 0===t&&(t=Math.max(this.childrenWidth,this.minWidth)),t}function Ah(t){var e=Math.max(this.childrenHeight,this.minHeight);return void 0===t&&(t=e),t}function Fh(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i<n;i++)(t=e[i]).ignoreLayout||t.preLayout()}function Yh(t){var e,i;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer&&(i=e.resolveWidth(i)),e.runWidthWrap(i));return this}var Vh=Phaser.Utils.Objects.GetValue,Wh=Phaser.GameObjects.Group,Gh=function(t){return t.add.text(0,0,"")},Uh=new Phaser.Geom.Rectangle,Hh=Phaser.Utils.Objects.GetValue,Xh=mn.prototype.add,Nh={addBackground:function(t,e,i){return void 0===this.backgroundChildren&&(this.backgroundChildren=[]),"string"==typeof e&&(i=e,e=void 0),void 0===e&&(e=0),Dh.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=Ih(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground:function(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Jh=/(\S+)\[(\d+)\]/i,Kh={getInnerPadding:function(t){return _n(this.space,t)},setInnerPadding:function(t,e){return Bn(this.space,t,e),this},getOutterPadding:function(t){return _n(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Bn(this.getSizerConfig(this).padding,t,e),this},getChildOutterPadding:function(t,e){return"string"==typeof t&&(t=this.getElement(t)),_n(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Bn(this.getSizerConfig(t).padding,e,i),this}},Zh={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,s=i.length;n<s;n++)(e=i[n]).rexSizer&&e.rexSizer.hidden||t.push(e);return t},getAllShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,s=i.length;n<s;n++){if(!(e=i[n]).rexSizer||!e.rexSizer.hidden)if(t.push(e),e.hasOwnProperty("isRexContainerLite"))t.push.apply(t,M(e.getAllShownChildren()))}return t}},qh=Phaser.Geom.Rectangle;Phaser.Scale.Center;function $h(t,e){void 0===e?e=new qh:!0===e&&(e=bl);var i,n,s=t.scale,r=s.baseSize,o=s.parentSize,a=s.canvasBounds,h=s.displayScale,l=0<=a.x?0:-(a.x*h.x),u=0<=a.y?0:-(a.y*h.y);return i=o.width>=a.width?r.width:r.width-(a.width-o.width)*h.x,n=o.height>=a.height?r.height:r.height-(a.height-o.height)*h.y,e.setTo(l,u,i,n),e}function Qh(t,e,i,n,s){var r;switch(i){case 0:case"x":r={x:0};break;case 1:case"y":r={y:0};break;default:r=0}var o={mode:0,start:r,end:1,duration:e,ease:void 0===n?"Cubic":n};return void 0===s?s=new Pl(t,o):s.resetFromJSON(o),s.restart(),s}function tl(t,e,i,n,s,r){s instanceof Pl&&(r=s,s=void 0),void 0===s&&(s=!0);var o={};switch(o.mode=s?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0}return o.duration=e,o.ease=void 0===n?"Linear":n,void 0===r?r=new Pl(t,o):r.resetFromJSON(o),r.restart(),r}function el(e,t){t.completeEventName=void 0,t.on("complete",function(){t.completeEventName&&(e.emit(t.completeEventName,e),t.completeEventName=void 0)}),t.on("update",function(){var t=e.getParentSizer();t&&t.resetChildPositionState(e)})}function il(t,e,i,n){var s,r;r=Il(i)?(s=i.start,i.end):i,void 0===s&&(s=0),void 0===r&&(r=1);var o={mode:0,start:s,end:r,duration:e};return void 0===n?n=new zl(t,o):n.resetFromJSON(o),n.restart(),n}function nl(t,e,i,n){i instanceof zl&&(n=i,i=void 0),void 0===i&&(i=!0);var s={mode:i?1:0,end:0,duration:e};return void 0===n?n=new zl(t,s):n.resetFromJSON(s),n.restart(),n}function sl(e,t){t.completeEventName=void 0,t.on("complete",function(){t.completeEventName&&(e.emit(t.completeEventName,e),t.completeEventName=void 0)}),t.on("update",function(){var t=e.getParentSizer();t&&t.resetChildAlphaState(e)})}function rl(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}}function ol(t,e,i,n,s,r,o){r instanceof Yl&&(o=r,r=void 0),void 0===r&&(r=!1);var a={};return a.mode=r?1:0,void 0!==i&&(a.startX=t.x,a.endX=rl(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=rl(n,t.y)),a.duration=e,a.ease=void 0===s?"Linear":s,void 0===o?o=new Yl(t,a):o.resetFromJSON(a),o.restart(),o}function al(t,e,i,n,s,r,o){r instanceof Yl&&(o=r,r=void 0),void 0===r&&(r=!1);var a={};return a.mode=r?1:0,void 0!==i&&(a.startX=rl(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=rl(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===s?"Linear":s,void 0===o?o=new Yl(t,a):o.resetFromJSON(a),o.restart(),o}function hl(e,t){t.completeEventName=void 0,t.on("complete",function(){t.completeEventName&&(e.emit(t.completeEventName,e),t.completeEventName=void 0)}),t.on("update",function(){var t=e.getParentSizer();t&&t.resetChildPositionState(e)})}function ll(t){Hl(t,!1)}function ul(t){Hl(t,!0)}function cl(t){return!!t&&!nh(t).hidden}function dl(t,e,i,n,s){return!(!t||!t.getBounds)&&(!(n&&!n(t,e,i))&&(!!(Nl=t.getBounds(Nl)).contains(e,i)&&!(s&&!s(t,e,i))))}function fl(t,e,i,n){if(e)return dl(t,e.x,e.y,i,n);for(var s=t.scene.input.manager,r=s.pointersTotal,o=s.pointers,a=0;a<r;a++)if(e=o[a],dl(t,e.x,e.y,i,n))return!0;return!1}function pl(t){return t&&"function"==typeof t}function vl(t,e,i,n,s){return dl(t,e,i,Jl(n),Kl(s))}function gl(t){return!(t.rexSizer&&t.rexSizer.hidden)}function yl(t,e,i){!t||void 0===e&&void 0===i||(t.resize?(void 0===e&&(e=t.width),void 0===i&&(i=t.height),t.resize(e,i)):(void 0!==e&&(t.displayWidth=e),void 0!==i&&(t.displayHeight=i)))}function kl(t){var e,i;this.sizerEventsEnable&&(e=t,void 0===(i=this.getChildPrevState(t))?i={}:!0===i&&(i=Zl),i.x=e.x,i.y=e.y,i.scaleX=e.scaleX,i.scaleY=e.scaleY,i.width=e.width,i.height=e.height,i.displayWidth=e.displayWidth,i.displayHeight=e.displayHeight,this.layoutedChildren.push(t))}function ml(t,e,i,n,s,r,o,a){Rh(t,e,i,n,s,r),void 0!==o&&(t.x+=o),void 0!==a&&(t.y+=a),this.resetChildPositionState(t),this.sizerEventsEnable&&t.emit("sizer.postlayout",t,this)}var bl=new qh,xl=function(){w(s,fo);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,{eventEmitter:!1})).viewport=void 0,i.resetFromJSON(e),i.boot(),i}return m(s,[{key:"resetFromJSON",value:function(t){var e,i,n,s,r,o,a,h;void 0===t&&(t={}),void 0!==t.x?(e=null,i=t.x):void 0!==t.left?(e=0,i=t.left):void 0!==t.right?(e=1,i=t.right):void 0!==t.centerX&&(e=.5,i=t.centerX),void 0!==t.y?(n=null,s=t.y):void 0!==t.top?(n=0,s=t.top):void 0!==t.bottom?(n=1,s=t.bottom):void 0!==t.centerY&&(n=.5,s=t.centerY),void 0!==i&&(i=i.replace("left","0%").replace("right","100%").replace("center","50%").split("%"),r=parseFloat(i[0])/100,o=""===i[1]?0:parseFloat(i[1])),void 0!==s&&(s=s.replace("top","0%").replace("bottom","100%").replace("center","50%").split("%"),a=parseFloat(s[0])/100,h=""===s[1]?0:parseFloat(s[1]));var l,u,c=t.width;void 0!==c&&(c=c.split("%"),l=parseFloat(c[0])/100,u=""===c[1]?0:parseFloat(c[1]));var d,f,p=t.height;void 0!==p&&(p=p.split("%"),d=parseFloat(p[0])/100,f=""===p[1]?0:parseFloat(p[1])),this.setAlign(e,n),this.setPercentage(r,a),this.setOffset(o,h),this.setSizePercentage(l,d),this.setSizePadding(u,f);var v=t.onResizeCallback,g=t.onResizeCallbackScope;void 0!==v&&this.setResizeCallback(v,g);var y=t.onUpdateViewportCallback,k=t.onUpdateViewportCallbackScope;return void 0!==y&&this.setUpdateViewportCallback(y,k),this}},{key:"boot",value:function(){this.scene.scale.on("resize",this.anchor,this),this.anchor()}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.scale.off("resize",this.anchor,this),this.viewport=void 0,this.onUpdateViewportCallback=void 0,this.onUpdateViewportCallbackScope=void 0,this.onResizeCallback=void 0,this.onResizeCallbackScope=void 0,O(C(s.prototype),"shutdown",this).call(this,t))}},{key:"setAlign",value:function(t,e){return this.alignX=t,this.alignY=e,this}},{key:"setPercentage",value:function(t,e){return this.percentageX=t,this.percentageY=e,this}},{key:"setOffset",value:function(t,e){return this.offsetX=t,this.offsetY=e,this}},{key:"setSizePercentage",value:function(t,e){return this.percentageWidth=t,this.percentageHeight=e,this}},{key:"setSizePadding",value:function(t,e){return this.paddingWidth=t,this.paddingHeight=e,this}},{key:"setResizeCallback",value:function(t,e){return this.onResizeCallback=t,this.onResizeCallbackScope=e,this}},{key:"setUpdateViewportCallback",value:function(t,e){return this.onUpdateViewportCallback=t,this.onUpdateViewportCallbackScope=e,this}},{key:"anchor",value:function(){return this.updateViewport(),this.updateSize(),this.updatePosition(),this}},{key:"updateSize",value:function(){var t=this.onResizeCallback,e=this.onResizeCallbackScope,i=this.anchorWidth,n=this.anchorHeight;if((void 0!==i||void 0!==n)&&t){var s=this.parent;void 0===i&&(i=s.width),void 0===n&&(n=s.height),e?t.call(e,i,n,s,this):t(i,n,s,this)}}},{key:"updatePosition",value:function(){var t=this.parent;return null===this.alignX?t.x=this.anchorX:void 0!==this.alignX&&(t.x=this.anchorX+t.displayWidth*(t.originX-this.alignX)),null===this.alignY?t.y=this.anchorY:void 0!==this.alignY&&(t.y=this.anchorY+t.displayHeight*(t.originY-this.alignY)),this}},{key:"anchorX",get:function(){return this.viewport.x+this.viewport.width*this.percentageX+this.offsetX}},{key:"anchorY",get:function(){return this.viewport.y+this.viewport.height*this.percentageY+this.offsetY}},{key:"anchorWidth",get:function(){if(void 0!==this.percentageWidth)return this.viewport.width*this.percentageWidth+this.paddingWidth}},{key:"anchorHeight",get:function(){if(void 0!==this.percentageHeight)return this.viewport.height*this.percentageHeight+this.paddingHeight}},{key:"updateViewport",value:function(){this.viewport=$h(this.scene,!this.viewport||this.viewport);var t=this.onUpdateViewportCallback,e=this.onUpdateViewportCallbackScope;t&&(e?t.call(e,this.viewport,this.parent,this):t(this.viewport,this.parent,this))}}]),s}(),Cl=Phaser.Utils.Objects.GetValue,wl=Phaser.Utils.Objects.GetAdvancedValue,Sl=Phaser.Math.Linear,Pl=function(){w(s,Ho);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,e)).scaleStart={},i.scaleEnd={},i.resetFromJSON(e),i.boot(),i}return m(s,[{key:"resetFromJSON",value:function(t){return O(C(s.prototype),"resetFromJSON",this).call(this,t),this.setMode(Cl(t,"mode",0)),this.setScaleRange(wl(t,"start",void 0),wl(t,"end",0)),this}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=Tl[t]),this.mode=t,this}},{key:"setScaleRange",value:function(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wl(t,"x",this.parent.scaleX),this.startY=wl(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wl(e,"x",void 0),this.endY=wl(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}},{key:"start",value:function(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),O(C(s.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Sl(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Sl(this.startY,this.endY,i))}},{key:"complete",value:function(){return O(C(s.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),s}(),Tl={stop:0,destroy:1,yoyo:2},Ol=Phaser.Utils.Objects.IsPlainObject,Ml={popUp:function(t,e,i){if(Ol(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease}var s=void 0===this._scale;return this._scale=Qh(this,t,e,i,this._scale),s&&el(this,this._scale),this._scale.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),Ts(this._scale)},scaleDownDestroy:function(t,e,i,n){if(Ol(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease,n=s.destroy}var r=void 0===this._scale;return this._scale=tl(this,t,e,i,n,this._scale),r&&el(this,this._scale),this._scale.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),Ts(this._scale)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),Ts(this._scale)}},El=Phaser.Utils.Objects.GetValue,_l=Phaser.Utils.Objects.GetAdvancedValue,Bl=Phaser.Math.Linear,zl=function(){w(s,Ho);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,e)).resetFromJSON(e),i.boot(),i}return m(s,[{key:"resetFromJSON",value:function(t){return O(C(s.prototype),"resetFromJSON",this).call(this,t),this.setMode(El(t,"mode",0)),this.setAlphaRange(_l(t,"start",this.parent.alpha),_l(t,"end",0)),this}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=Rl[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),O(C(s.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Bl(this.alphaStart,this.alphaEnd,i)}},{key:"complete",value:function(){return O(C(s.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),s}(),Rl={stop:0,destroy:1,yoyo:2},Il=Phaser.Utils.Objects.IsPlainObject,Dl=Phaser.Utils.Objects.IsPlainObject,Ll={fadeIn:function(t,e){Dl(t)&&(t=t.duration);var i=void 0===this._fade;return this._fade=il(this,t,e,this._fade),i&&sl(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromoise:function(t,e){return this.fadeIn(t,e),Ts(this._fade)},fadeOutDestroy:function(t,e){if(Dl(t)){var i=t;t=i.duration,e=i.destroy}var n=void 0===this._fade;return this._fade=nl(this,t,e,this._fade),n&&sl(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),Ts(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Ts(this._fade)}},jl=Phaser.Utils.Objects.GetValue,Al=Phaser.Utils.Objects.GetAdvancedValue,Fl=Phaser.Math.Linear,Yl=function(){w(s,Ho);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,e)).resetFromJSON(e),i.boot(),i}return m(s,[{key:"resetFromJSON",value:function(t){if(O(C(s.prototype),"resetFromJSON",this).call(this,t),this.setMode(jl(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Al(t,"x",void 0),i=Al(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=Vl[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(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=Al(i,"startX",void 0),this.startY=Al(i,"startY",void 0),this.endX=Al(i,"endX",void 0),this.endY=Al(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}},{key:"start",value:function(){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),O(C(s.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Fl(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Fl(this.startY,this.endY,i))}},{key:"complete",value:function(){return O(C(s.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),s}(),Vl={stop:0,destroy:1,yoyo:2},Wl=Phaser.Utils.Objects.IsPlainObject,Gl=Phaser.Math.Distance.Between,Ul={moveFrom:function(t,e,i,n,s){if(Wl(t)){var r=t;e=r.x,i=r.y,t=r.hasOwnProperty("speed")?1e3*Gl(e,i,this.x,this.y)/r.speed:r.duration,n=r.ease}var o=void 0===this._easeMove;return this._easeMove=al(this,t,e,i,n,s,this._easeMove),o&&hl(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,s){return this.moveFrom(t,e,i,n,s),Ts(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),Ts(this._easeMove)},moveTo:function(t,e,i,n,s){if(Wl(t)){var r=t;e=r.x,i=r.y,t=r.hasOwnProperty("speed")?1e3*Gl(e,i,this.x,this.y)/r.speed:r.duration,n=r.ease}var o=void 0===this._easeMove;return this._easeMove=ol(this,t,e,i,n,s,this._easeMove),o&&hl(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,s){return this.moveTo(t,e,i,n,s),Ts(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),Ts(this._easeMove)}},Hl=function(t,e){t&&(nh(t).hidden=e,t.rexContainer.parent.setChildVisible(t,!e))},Xl={show:function(t){return void 0===t&&(t=this),ll(t),this},hide:function(t){return void 0===t&&(t=this),ul(t),this},isShow:function(t){return void 0===t&&(t=this),cl(t)}},Nl=void 0,Jl=function(n){return n?function(t,e,i){return!!gl(t)&&(n(t,e,i),!0)}:gl},Kl=function(t){return t},Zl={},ql=Phaser.Display.Align.CENTER,$l=Phaser.Utils.Objects.GetValue,Ql=function(){w(s,fo);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,e))._enable=void 0,t.setInteractive($l(e,"inputConfig",void 0)),i.resetFromJSON(e),i.boot(),i}return m(s,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable($l(t,"enable",!0)),this.setMode($l(t,"mode",1)),this.setClickInterval($l(t,"clickInterval",100)),this.setDragThreshold($l(t,"threshold",void 0)),this}},{key:"boot",value:function(){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)}},{key:"shutdown",value:function(t){this.isShutdown||(this.pointer=null,O(C(s.prototype),"shutdown",this).call(this,t))}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel();var e=(this._enable=t)?"enable":"disable";this.emit(e,this,this.parent)}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=tu[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"onPress",value:function(t,e,i,n){void 0===this.pointer&&(this.pointer=t,0===this.mode&&this.click(t.downTime,t,n))}},{key:"onRelease",value:function(t,e,i,n){this.pointer===t&&(1===this.mode&&this.click(t.upTime,t,n),this.pointer=void 0)}},{key:"onPointOut",value:function(t){this.pointer===t&&this.cancel()}},{key:"onMove",value:function(t){this.pointer===t&&void 0!==this.dragThreshold&&t.getDistance()>=this.dragThreshold&&this.cancel()}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),s}(),tu={press:0,pointerdown:0,release:1,pointerup:1},eu={onClick:function(t,e,i){return t&&(void 0===this._click&&(this._click=new Ql(this,i)),this._click.on("click",t,e)),this},offClick:function(t,e){return void 0===this._click||this._click.off("click",t,e),this},enableClick:function(t){return void 0===this._click||this._click.setEnable(t),this},disableClick:function(){return void 0===this._click||this._click.setEnable(!1),this}},iu={getSizerConfig:nh,getChildPrevState:function(t){var e=nh(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=sh(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,n,s,r,o=t.scene;if("number"==typeof e)i=e;else{i=Vh(e,"color",16777215);var a=Vh(e,"name",!1);a&&(n=Vh(a,"createTextCallback",Gh),s=Vh(a,"createTextCallbackScope",void 0),"string"==typeof(r=Vh(a,"align","left-top"))&&(r=ah[r]))}if(n&&!t.children){t.children=new Wh(o),t.once("destroy",function(t,e){t.children.destroy(!e),t.children=void 0});var h=t.clear.bind(t);t.clear=function(){h(),t.children.clear(!1,!0)}}for(var l,u,c=this.getAllShownChildren([this]),d=0,f=c.length;d<f;d++)(l=c[d]).getBounds&&(i&&t.lineStyle(1,i).strokeRectShape(l.getBounds(Uh)),l.name&&n&&(u=s?n.call(s,o):n(o))&&(u.setText(l.name),t.children.add(u),Rh(u,Uh.x,Uh.y,Uh.width,Uh.height,r)));return this},resolveWidth:jh,resolveChildrenWidth:function(t){var e,i;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(i=this.getExpandedChildWidth(e,t),i=e.resolveWidth(i),e.resolveChildrenWidth(i))},resolveHeight:Ah,getChildWidth:function(t){return t.isRexSizer?Math.max(t.minWidth,t.childrenWidth):void 0!==t.minWidth?t.minWidth:lh(t)},getChildHeight:function(t){return t.isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:uh(t)},getExpandedChildWidth:function(t,e){return e},getExpandedChildHeight:function(t,e){return e},getChildrenWidth:function(){return 0},getChildrenHeight:function(){return 0},addChildrenMap:Lh,addElement:Lh,getElement:function(t,e){if("string"==typeof t&&(t=t.split(".")),0!==t.length){var i=t.shift(),n=null;if("#"===i.charAt(0))i=i.substring(1),n=this.getByName(i,e);else if(-1===i.indexOf("["))this.childrenMap&&(n=this.childrenMap[i]);else{var s=i.match(Jh);if(null!=s&&this.childrenMap){var r=this.childrenMap[s[1]];r&&(n=r[s[2]])}}return 0===t.length?n:n&&n.childrenMap?n.getElement(t):null}},getAllChildrenSizers:function(t){void 0===t&&(t=[]);for(var e=t.length,i=this.getChildrenSizers(t),n=t.length,s=e;s<n;s++)i[s].getAllChildrenSizers(t);return t},getChildrenSizers:function(t){return void 0===t&&(t=[]),t},preLayout:Fh,layout:function(){return this.runLayout(),this},runLayout:function(t,e,i){if(this.ignoreLayout)return this;var n=!t;return n&&this.preLayout(),e=this.resolveWidth(e),n&&(this.resolveChildrenWidth(e),this.runWidthWrap(e)),i=this.resolveHeight(i),this.resize(e,i),this.sizerEventsEnable&&void 0===this.layoutedChildren&&(this.layoutedChildren=[]),this.layoutChildren(),this.layoutBackgrounds(),this.sizerEventsEnable&&(this.emit("postlayout",this.layoutedChildren,this),this.layoutedChildren.length=0),this.postLayout()},layoutChildren:function(){},runWidthWrap:Yh,layoutBackgrounds:function(){if(void 0!==this.backgroundChildren)for(var t,e,i,n,s,r,o,a=this.backgroundChildren,h=this.left,l=this.top,u=this.width,c=this.height,d=0,f=a.length;d<f;d++)(e=(t=a[d]).rexSizer).hidden||(i=e.padding,kl.call(this,t),n=h+i.left,s=l+i.top,r=u-i.left-i.right,o=c-i.top-i.bottom,yl(t,r,o),ml.call(this,t,n,s,r,o,ql))},postLayout:function(){return this._anchor&&this._anchor.updatePosition(),this},setAnchor:function(t){void 0===t&&(t={});var n=t.hasOwnProperty("width"),s=t.hasOwnProperty("height"),e=t.hasOwnProperty("onResizeCallback");return!n&&!s||e||(t.onResizeCallback=function(t,e,i){n&&i.setMinWidth(t),s&&i.setMinHeight(e),i.layout()}),void 0===this._anchor?this._anchor=new xl(this,t):this._anchor.resetFromJSON(t),this},isInTouching:function(t,e){return void 0===e&&(e=this),fl(e,t)},pointToChild:function(t,e,i,n,s){if(pl(i)||(s=i,n=i=void 0),void 0===s&&(s=this.sizerChildren?this.sizerChildren:this.children),Ui(s)){for(var r,o=0,a=s.length;o<a;o++)if(r=s[o],vl(r,t,e,i,n))return r}else for(var h in s)if(r=s[h],vl(r,t,e,i,n))return r;return null},setDraggable:function(s,t){var e=P(s);return"string"===e?s=this.getElement(s):void 0!==s&&"object"==e||(t=s,s=this),void 0===t&&(t=!0),s.input&&s.input.hasOwnProperty("draggable")?s.input.draggable=t:t&&(s.setInteractive(),s.scene.input.setDraggable(s),s.on("drag",function(t,e,i){var n=this.getTopmostSizer();n.x+=e-s.x,n.y+=i-s.y},this)),this},broadcastEvent:function(){for(var t=this.getAllChildren([this]),e=0,i=t.length;e<i;e++){var n=t[e];n.emit.apply(n,arguments)}return this}};Object.assign(iu,Kh,Nh,{getParentSizer:function(t){return this.getParent(t)},getTopmostSizer:function(t){return this.getTopmostParent(t)}},Ml,Ll,Ul,eu,Xl,Zh);var nu=Phaser.Utils.Objects.GetValue,su=function(){w(l,mn);var h=T(l);function l(t,e,i,n,s,r){var o;B(this,l),(o=h.call(this,t,e,i,2,2)).isRexSizer=!0,o.setMinSize(n,s),o.setName(nu(r,"name","")),o.rexSizer={},o.space={},o.backgroundChildren=void 0,o.sizerChildren=void 0,o.layoutedChildren=void 0;var a=nu(r,"anchor",void 0);return a&&o.setAnchor(a),o.setInnerPadding(nu(r,"space",0)),o.setDraggable(nu(r,"draggable",!1)),o.setSizerEventsEnable(nu(r,"sizerEvents",!1)),o.setDirty(!0),o}return m(l,[{key:"destroy",value:function(t){if(this.scene){if(t)for(var e=this.getAllChildrenSizers([this]),i=0,n=e.length;i<n;i++)e[i].sizerEventsEnable=!1;O(C(l.prototype),"destroy",this).call(this,t),this.backgroundChildren=void 0,this.sizerChildren=void 0,this.childrenMap=void 0,this.space=void 0,this.rexSizer=void 0,this.layoutedChildren=void 0}}},{key:"setMinSize",value:function(t,e){return this.setMinWidth(t).setMinHeight(e),this}},{key:"setMinWidth",value:function(t){return null==t&&(t=0),this.minWidth=t,this}},{key:"setMinHeight",value:function(t){return null==t&&(t=0),this.minHeight=t,this}},{key:"setDirty",value:function(t){return void 0===t&&(t=!0),this.dirty=t,this}},{key:"setSizerEventsEnable",value:function(t){return void 0===t&&(t=!0),this.sizerEventsEnable=t,this}},{key:"ignoreLayout",get:function(){return this.rexSizer.hidden||!this.dirty}},{key:"childrenWidth",get:function(){return void 0===this._childrenWidth&&(this._childrenWidth=this.getChildrenWidth()),this._childrenWidth}},{key:"childrenHeight",get:function(){return void 0===this._childrenHeight&&(this._childrenHeight=this.getChildrenHeight()),this._childrenHeight}},{key:"left",get:function(){return this.x-lh(this)*this.originX},set:function(t){this.x+=t-this.left}},{key:"alignLeft",value:function(t){return this.left=t,this}},{key:"right",get:function(){return this.left+lh(this)},set:function(t){this.x+=t-this.right}},{key:"alignRight",value:function(t){return this.right=t,this}},{key:"centerX",get:function(){return this.left+lh(this)/2},set:function(t){this.x+=t-this.centerX}},{key:"alignCenterX",value:function(t){return this.centerX=t,this}},{key:"top",get:function(){return this.y-uh(this)*this.originY},set:function(t){this.y+=t-this.top}},{key:"alignTop",value:function(t){return this.top=t,this}},{key:"bottom",get:function(){return this.top+uh(this)},set:function(t){this.y+=t-this.bottom}},{key:"alignBottom",value:function(t){return this.bottom=t,this}},{key:"centerY",get:function(){return this.top+uh(this)/2},set:function(t){this.y+=t-this.centerY}},{key:"alignCenterY",value:function(t){return this.centerY=t,this}},{key:"innerLeft",get:function(){return this.left+this.space.left}},{key:"innerRight",get:function(){return this.right-this.space.right}},{key:"innerTop",get:function(){return this.top+this.space.top}},{key:"innerBottom",get:function(){return this.bottom-this.space.bottom}},{key:"innerWidth",get:function(){return this.width-this.space.left-this.space.right}},{key:"innerHeight",get:function(){return this.height-this.space.top-this.space.bottom}},{key:"minInnerWidth",get:function(){var t=this.minWidth-this.space.left-this.space.right;return Math.max(t,0)}},{key:"minInnerHeight",get:function(){var t=this.minHeight-this.space.top-this.space.bottom;return Math.max(t,0)}}]),l}();Object.assign(su.prototype,iu);function ru(t,e){t.width<t.childrenWidth&&console.warn("Layout width error: Parent=".concat(e.constructor.name,", Child=").concat(t.constructor.name)),t.height<t.childrenHeight&&console.warn("Layout height error: Parent=".concat(e.constructor.name,", Child=").concat(t.constructor.name))}function ou(t,e){return this.isBackground(t)&&fu(this.backgroundChildren,t),pu.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this}function au(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),vu.call(this,t),i)for(var n,s=0,r=e.length;s<r;s++)(n=e[s]).emit("sizer.remove",n,this),this.emit("remove",n,this);return this}var hu=Phaser.Utils.Objects.IsPlainObject,lu=Phaser.Utils.Objects.GetValue,uu=Phaser.Display.Align.CENTER,cu=Phaser.Utils.String.UUID,du={add:function(t,e,i,n,s,r,o,a,h){Dh.call(this,t),hu(e)&&(e=lu(l=e,"key",void 0),i=lu(l,"align",uu),a=lu(l,"offsetX",0),h=lu(l,"offsetY",0),n=lu(l,"padding",0),s=lu(l,"expand",!0),t.isRexSizer||(r=lu(l,"minWidth",t._minWidth),o=lu(l,"minHeight",t._minHeighted)));var l,u=void 0!==e;return u||(e=cu()),"string"==typeof i&&(i=ah[i]),void 0===i&&(i=uu),void 0===a&&(a=0),void 0===h&&(h=0),void 0===n&&(n=0),void 0===s&&(s=!0),t.isRexSizer||(void 0===r&&(r=t._minWidth),void 0===o&&(o=t._minHeight)),(l=this.getSizerConfig(t)).align=i,l.alignOffsetX=a,l.alignOffsetY=h,l.padding=Ih(n),hu(s)?(l.expandWidth=lu(s,"width",!1),l.expandHeight=lu(s,"height",!1)):(l.expandWidth=s,l.expandHeight=s),t.isRexSizer||(l.expandWidth?t.minWidth=void 0===r?lh(t):r:t.minWidth=void 0,l.expandHeight?t.minHeight=void 0===o?uh(t):o:t.minHeight=void 0),this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,u&&this.addChildrenMap(e,t),this}},fu=Phaser.Utils.Array.Remove,pu=mn.prototype.remove,vu=mn.prototype.clear,gu={remove:function(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]),ou.call(this,t,e),this},removeAll:function(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear:function(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return au.call(this,t),this}},yu={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,s=this.sizerChildren;for(var r in s)e=(t=s[r]).rexSizer.padding,i=this.getChildWidth(t)+e.left+e.right,n=Math.max(i,n);return n+this.space.left+this.space.right},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,s=this.sizerChildren;for(var r in s)i=(t=s[r]).isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:uh(t),i+=(e=t.rexSizer.padding).top+e.bottom,n=Math.max(i,n);return n+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer;if(n.expandWidth){var s=e-this.space.left-this.space.right,r=n.padding;i=s-r.left-r.right}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer;if(n.expandHeight){var s=e-this.space.top-this.space.bottom,r=n.padding;i=s-r.top-r.bottom}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var n in i)(e=i[n]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,n,s,r,o,a,h,l=this.innerLeft,u=this.innerTop,c=this.innerWidth,d=this.innerHeight,f=this.sizerChildren;for(var p in f)(t=f[p]).rexSizer.hidden||(i=(e=t.rexSizer).padding,kl.call(this,t),t.isRexSizer?(t.runLayout(this,this.getExpandedChildWidth(t),this.getExpandedChildHeight(t)),ru(t,this)):(h=a=void 0,e.expandWidth&&(a=c-i.left-i.right),e.expandHeight&&(h=d-i.top-i.bottom),yl(t,a,h)),n=l+i.left,r=c-i.left-i.right,s=u+i.top,o=d-i.top-i.bottom,ml.call(this,t,n,s,r,o,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(yu,du,gu);function ku(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}var mu=Phaser.Utils.Objects.IsPlainObject,bu=Phaser.Utils.Objects.GetValue,xu=function(){w(h,su);var a=T(h);function h(t,e,i,n,s,r){var o;return B(this,h),mu(e)?(e=bu(r=e,"x",0),i=bu(r,"y",0),n=bu(r,"width",void 0),s=bu(r,"height",void 0)):mu(n)&&(n=bu(r=n,"width",void 0),s=bu(r,"height",void 0)),(o=a.call(this,t,e,i,n,s,r)).type="rexOverlapSizer",o.sizerChildren={},o.addChildrenMap("items",o.sizerChildren),o}return m(h,[{key:"childToKey",value:function(t){if("string"!=typeof t)return ku(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}]),h}();Object.assign(xu.prototype,yu);function Cu(t,e,i){var n=t.width/2;return Mu(n,n,e,i)<=n}function wu(t,e,i){if(this.enable&&t.isDown){var n=this.sizerChildren.knob;if(Cu(n,e,i)){var s=n.width/2,r=n.startAngle,o=Eu(s,s,e,i),a=n.anticlockwise?r-o:o-r,h=_u(a)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h)}}}function Su(t,e,i){if(this.enable&&!this.panPointer){var n=this.sizerChildren.knob;Cu(n,e,i)&&Ru.call(this,t)}}function Pu(t,e,i){if(this.enable&&t.isDown){var n=this.sizerChildren.knob;switch(this.panState){case Lu:Cu(n,e,i)&&Ru.call(this,t);break;case ju:Cu(n,e,i)?Du.call(this):Iu.call(this)}}}function Tu(t){this.enable&&this.panPointer===t&&Iu.call(this)}function Ou(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}var Mu=Phaser.Math.Distance.Between,Eu=Phaser.Math.Angle.Between,_u=Phaser.Math.Angle.Normalize,Bu=Phaser.Math.Angle.Between,zu=Phaser.Math.Angle.Wrap,Ru=function(t){this.panPointer=t,this.panState=ju},Iu=function(){this.panPointer=void 0,this.panState=Lu},Du=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,n=Bu(i.x,i.y,t.x,t.y),s=Bu(i.x,i.y,e.x,e.y),r=i.anticlockwise?n-s:s-n,o=zu(r)/(2*Math.PI);this.stopEaseValue(),this.value+=o},Lu=0,ju=1,Au={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:Ou,updateText:function(){var t=this.sizerChildren.text;return t&&(t.setText(Ou.call(this)),t.layout&&t.layout()),this}},Fu=Phaser.Utils.Objects.GetValue,Yu=Phaser.Math.Linear,Vu=Phaser.Math.Percent,Wu=Phaser.Math.Snap.To,Gu=function(){w(u,xu);var l=T(u);function u(t,e){var i;B(this,u),void 0===e&&(e={}),(i=l.call(this,t,e)).type="rexKnob",i.eventEmitter=Fu(e,"eventEmitter",z(i));var n=Fu(e,"background",void 0),s=Fu(e,"text",void 0);n&&i.addBackground(n),s&&(e.textColor=void 0,e.textStrokeColor=void 0,i.setTextFormatCallback(Fu(e,"textFormatCallback",void 0),Fu(e,"textFormatCallbackScope",void 0)));var r=new ih(t,e);r.setDepth(Fu(e,"knobDepth",0)),r._value=-1,t.add.existing(r),i.add(r,"knob"),s&&i.add(s,"text","center",0,!1),i.addChildrenMap("background",n),i.addChildrenMap("knob",r),i.addChildrenMap("text",s);var o=Fu(e,"valuechangeCallback",null);if(null!==o){var a=Fu(e,"valuechangeCallbackScope",void 0);i.eventEmitter.on("valuechange",o,a)}i.setEnable(Fu(e,"enable",void 0)),i.setEaseValuePropName("value").setEaseValueDuration(Fu(e,"easeValue.duration",0)).setEaseValueFunction(Fu(e,"easeValue.ease","Linear")),i.setGap(Fu(e,"gap",void 0)),i.setValue(Fu(e,"value",0),Fu(e,"min",void 0),Fu(e,"max",void 0));var h=Fu(e,"input",0);switch("string"==typeof h&&(h=Uu[h]),h){case 0:(function(){this.sizerChildren.knob.setInteractive().on("pointerdown",Su,this).on("pointermove",Pu,this).on("pointerup",Tu,this),this.panPointer=void 0,this.panState=Lu}).call(z(i));break;case 1:(function(){this.sizerChildren.knob.setInteractive().on("pointerdown",wu,this).on("pointermove",wu,this)}).call(z(i))}return i}return m(u,[{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setGap",value:function(t){return this.gap=t,this}},{key:"value",get:function(){return this.sizerChildren.knob.value},set:function(t){void 0!==this.gap&&(t=Wu(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))}},{key:"setValue",value:function(t,e,i){return null==t||(void 0!==e&&(t=Vu(t,e,i)),this.value=t),this}},{key:"addValue",value:function(t,e,i){return void 0!==e&&(t=Vu(t,e,i)),this.value+=t,this}},{key:"getValue",value:function(t,e){var i=this.value;return void 0!==t&&(i=Yu(t,e,i)),i}}]),u}(),Uu={pan:0,drag:0,click:1,none:-1};Object.assign(Gu.prototype,Au,pa),u.register("knob",function(t){var e=new Gu(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.Knob",Gu);function Hu(){for(var t=this.getShapes(),e=0,i=t.length;e<i;e++)t[e].lineStyle().fillStyle()}var Xu={arc:Ia,circle:Da,curve:La,ellipse:ja,line:Aa,lines:Ua,rectangle:Xa,triangle:Ja},Nu=Phaser.Utils.Objects.GetValue,Ju=Phaser.Utils.Objects.IsPlainObject,Ku={createShape:function(t,e){var i=new Xu[t];return e&&i.setName(e),i},buildShapes:function(t){var e=Nu(t,"create",void 0);if(Ju(e)){var i=e;for(var n in i){var s=i[n];switch(P(s)){case"number":for(var r=0;r<s;r++)this.addShape(this.createShape(n));break;case"string":this.addShape(this.createShape(n,s));break;default:for(var o=s,a=(r=0,o.length);r<a;r++)this.addShape(this.createShape(n,o[r]))}}}else if(Array.isArray(e))for(r=0,a=(i=e).length;r<a;r++){var h=i[r];this.addShape(this.createShape(h.type,h.name))}else"function"==typeof e&&e.call(this);this.setUpdateShapesCallback(Nu(t,"update"))},setUpdateShapesCallback:function(t){return void 0===t&&(t=Hu),this.dirty=this.dirty||this.updateCallback!==t,this.updateCallback=t,this},updateShapes:function(){this.updateCallback.call(this)}},Zu=Phaser.Utils.Objects.GetValue,qu=Phaser.Utils.Objects.IsPlainObject,$u=function(){w(h,Ta);var a=T(h);function h(t,e,i,n,s,r){var o;return B(this,h),qu(e)&&(e=Zu(r=e,"x",0),i=Zu(r,"y",0),n=Zu(r,"width",2),s=Zu(r,"height",2)),(o=a.call(this,t,e,i,n,s)).type=Zu(r,"type","rexCustomShapes"),o.buildShapes(r),o}return h}();Object.assign($u.prototype,Ku),u.register("customShapes",function(t,e,i,n,s){var r=new $u(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),x(window,"RexPlugins.UI.CustomShapes",$u);var Qu=Phaser.Utils.Objects.GetValue,tc=Phaser.Utils.Objects.IsPlainObject,ec=Phaser.Math.Clamp,ic=Phaser.Math.Linear,nc=Phaser.Math.Percent,sc=function(){w(u,$u);var l=T(u);function u(t,e,i,n,s,r){var o;B(this,u),tc(e)&&(e=Qu(r=e,"x",0),i=Qu(r,"y",0),n=Qu(r,"width",2),s=Qu(r,"height",2)),void 0===r&&(r={}),r.type||(r.type="rexCustomProgress"),(o=l.call(this,t,e,i,n,s,r)).eventEmitter=Qu(r,"eventEmitter",z(o));var a=Qu(r,"valuechangeCallback",null);if(null!==a){var h=Qu(r,"valuechangeCallbackScope",void 0);o.eventEmitter.on("valuechange",a,h)}return o.setEaseValuePropName("value").setEaseValueDuration(Qu(r,"easeValue.duration",0)).setEaseValueFunction(Qu(r,"easeValue.ease","Linear")),o.setValue(Qu(r,"value",0)),o}return m(u,[{key:"centerX",get:function(){return this.width/2}},{key:"centerY",get:function(){return this.height/2}},{key:"radius",get:function(){return Math.min(this.centerX,this.centerY)}},{key:"value",get:function(){return this._value},set:function(t){t=ec(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)}},{key:"setValue",value:function(t,e,i){return null==t||(void 0!==e&&(t=nc(t,e,i)),this.value=t),this}},{key:"addValue",value:function(t,e,i){return void 0!==e&&(t=nc(t,e,i)),this.value+=t,this}},{key:"getValue",value:function(t,e){var i=this.value;return void 0!==t&&(i=ic(t,e,i)),i}}]),u}();Object.assign(sc.prototype,pa),u.register("customProgress",function(t,e,i,n,s){var r=new sc(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),x(window,"RexPlugins.UI.CustomProgress",sc);function rc(t,e,i,n,s){switch(this.clear().fillStyle(16777215),this.shape){case 1:var r=Math.min(t,e)/2;this.fillCircle(-t*(n-.5),-e*(s-.5),r+i);break;default:this.fillRect(-t*n-i,-e*s-i,t+2*i,e+2*i)}}function oc(t,e,i,n,s,r){var o,a;null==i&&(i="__BASE"),pl(r)||(void 0===(a=r)&&(a=","),r="__BASE"===(o=i)?function(t,e){return"".concat(t).concat(a).concat(e)}:function(t,e){return"".concat(o,"_").concat(t).concat(a).concat(e)});for(var h,l=t.textures.get(e),u=l.frames[i],c=u.width/n,d=u.height/s,f=0,p=0,v=0;v<s;v++){for(var g=f=0;g<n;g++)h=r(g,v),l.add(h,0,f+u.cutX,p+u.cutY,c,d),f+=c;p+=d}return{getFrameNameCallback:r,cellWidth:c,cellHeight:d,columns:n,rows:s}}var ac=Phaser.Utils.Objects.IsPlainObject,hc=Phaser.Utils.Objects.GetValue,lc={out:0,in:1},uc={setTransitionDirection:function(t){return"string"==typeof t&&(t=lc[t]),this.dir=t,this},setDuration:function(t){return this.duration=t,this},setEaseFunction:function(t){return this.easeFunction=t,this},setNextTexture:function(t,e){return this.nextImage.setTexture(t,e),this},transit:function(t,e){if(this.isRunning&&(this.ignoreCompleteEvent=!0,this.stop(),this.ignoreCompleteEvent=!1),ac(t)){var i=t;t=hc(i,"key",void 0),e=hc(i,"frame",void 0),this.setDuration(hc(i,"duration",this.duration)).setEaseFunction(hc(i,"ease",this.easeFunction)).setTransitionDirection(hc(i,"dir",this.dir));var n=hc(i,"mask",void 0);n&&this.setMaskGameObject(n),this.setMaskEnable(!0===n);var s=hc(i,"onStart",void 0),r=hc(i,"onProgress",void 0),o=hc(i,"onComplete",void 0);void 0===s&&void 0===r&&void 0===o||this.setTransitionStartCallback(s,hc(i,"onStartScope",void 0)).setTransitionProgressCallback(r,hc(i,"onProgressScope",void 0)).setTransitionCompleteCallback(o,hc(i,"onCompleteScope",void 0))}return this.setNextTexture(t,e),this.start(),this},start:function(){return void 0===this.easeValueTask&&(this.easeValueTask=new da(this,{eventEmitter:null})),this.easeValueTask.restart({key:"t",from:0,to:1,duration:this.duration,ease:this.easeFunction}),this},pause:function(){return this.easeValueTask&&this.easeValueTask.pause(),this},resume:function(){return this.easeValueTask&&this.easeValueTask.resume(),this},stop:function(){return this.easeValueTask&&this.easeValueTask.stop(),this.setT(1),this}},cc=Phaser.GameObjects.Graphics,dc=function(){w(r,cc);var s=T(r);function r(t,e,i){var n;return B(this,r),void 0===e&&(e=0),"string"==typeof e&&(e=fc[e]),void 0===i&&(i=0),(n=s.call(this,t.scene)).parent=t,n.shape=e,n.padding=i,n.setPosition().resize().setVisible(!1),n}return m(r,[{key:"destroy",value:function(){return this.parent=void 0,O(C(r.prototype),"destroy",this).call(this),this}},{key:"setPosition",value:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),O(C(r.prototype),"setPosition",this).call(this,t,e),this}},{key:"resize",value:function(t,e,i){var n=this.parent;return void 0===t&&(t=n.width),void 0===e&&(e=n.height),void 0===i&&(i=this.padding),this.widthSave===t&&this.heightSave===e&&this.paddingSave===i||(this.widthSave=t,this.heightSave=e,this.paddingSave=i,this.originXSave=n.originX,this.originYSave=n.originY,rc.call(this,t,e,i,n.originX,n.originY)),this}},{key:"setOrigin",value:function(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.originXSave===t&&this.originYSave===e||(this.originXSave=t,this.originYSave=e,rc.call(this,this.widthSave,this.heightSave,this.paddingSave,t,e)),this}}]),r}(),fc={rectangle:0,circle:1},pc={setMaskGameObject:function(t){if(!t)return this.removeMaskGameObject(),this;if(this.maskGameObject){if(!0===t&&this.maskGameObject instanceof dc)return this;if(this.maskGameObject===t)return this;this.removeMaskGameObject()}return!0===t&&(t=new dc(this)),this.maskGameObject=t,this.maskGameObject.resize(this.width,this.height).setOrigin(this.originX,this.originY).setPosition(0,0).setScale(1).setVisible(!1),this.addLocal(this.maskGameObject),this.childrenMask=this.maskGameObject.createGeometryMask(),this},removeMaskGameObject:function(){return this.backImage.clearMask(),this.frontImage.clearMask(),this.childrenMask=void 0,this.remove(this.maskGameObject,!0),this.maskGameObject=void 0,this},setImageMaskEnable:function(t,e,i){return void 0===e&&(e=!0),this.childrenMask||this.setMaskGameObject(!0),e?(t.setMask(this.childrenMask),i&&this.childrenMask.setInvertAlpha()):t.clearMask(),this},setCurrentImageMaskEnable:function(t,e){return this.setImageMaskEnable(this.currentImage,t,e),this},setNextImageMaskEnable:function(t,e){return this.setImageMaskEnable(this.nextImage,t,e),this},setCellImagesMaskEnable:function(t,e){for(var i=this.getCellImages(),n=0,s=i.length;n<s;n++)this.setImageMaskEnable(i[n],t,e);return this},setMaskEnable:function(t,e){return this.setImageMaskEnable(this.backImage,t,e),this.setImageMaskEnable(this.frontImage,t,e),this.setCellImagesMaskEnable(t,e),this}},vc=Phaser.Utils.Objects.GetValue,gc=Phaser.GameObjects.Image,yc=Phaser.Utils.Objects.IsPlainObject,kc=Phaser.Math.RotateAround,mc={gridCutImage:function(t,e,i,n){void 0===n&&(n={}),n.objectPool=this.imagesPool;for(var s,r=function(t,e,i,n){yc(e)&&(e=vc(n=e,"columns",1),i=vc(n,"rows",1));for(var s=vc(n,"ImageClass",gc),r=vc(n,"originX",.5),o=vc(n,"originY",.5),a=vc(n,"add",!0),h=vc(n,"align",a),l=vc(n,"objectPool",void 0),u=t.scene,c=t.texture.key,d=t.frame.name,f=oc(u,c,d,e,i),p=f.getFrameNameCallback,v=t.scaleX,g=t.scaleY,y=t.rotation,k=t.getTopLeft(),m=k.x,b=k.y,x=[],C=f.cellWidth*v,w=f.cellHeight*g,S=0;S<i;S++)for(var P=0;P<e;P++){var T,O=p(P,S);T=l&&0<l.length?l.pop().setTexture(c,O):new s(u,0,0,c,O),a&&u.add.existing(T);var M=m+C*P+r*C,E=b+w*S+o*w;h&&(T.setOrigin(r,o).setPosition(M,E).setScale(v,g).setRotation(y),kc(T,m,b,y)),x.push(T)}return x}(t,e,i,n),o=0,a=r.length;o<a;o++)(s=r[o]).setVisible(!0),this.add(s);return this.cellImages=r,this.setChildLocalVisible(t,!1),r},gridCutCurrentImage:function(t,e,i){return this.gridCutImage(this.currentImage,t,e,i)},gridCutNextImage:function(t,e,i){return this.gridCutImage(this.nextImage,t,e,i)},getCellImages:function(){return this.cellImages},freeCellImages:function(){var t;if(0===this.cellImages.length)return this;for(var e,i,n=this.cellImages[0].texture,s=this.cellImages,r=0,o=s.length;r<o;r++)e=s[r],this.setChildLocalAlpha(e,1).setChildLocalScale(e,1).setChildLocalVisible(e,!1),e.clearMask(),i=e.frame.name,e.setTexture(),n.remove(i);return(t=this.imagesPool).push.apply(t,M(s)),s.length=0,this}},bc={};Object.assign(bc,{setTransitionStartCallback:function(t,e){return this.onStartCallback=t,this.onStartCallbackScope=e,this},setTransitionProgressCallback:function(t,e){return this.onProgressCallback=t,this.onProgressCallbackScope=e,this},setTransitionCompleteCallback:function(t,e){return this.onCompleteCallback=t,this.onCompleteCallbackScope=e,this}},uc,pc,mc);function xc(){}function Cc(t,e,i,n){t.setChildLocalAlpha(e,1-n).setChildLocalAlpha(i,n)}function wc(t,e){t.setChildLocalAlpha(e,1)}var Sc=Phaser.Utils.Objects.IsPlainObject,Pc=Phaser.Utils.Objects.GetValue,Tc=Phaser.Math.Clamp,Oc=function(){w(y,mn);var g=T(y);function y(t,e,i,n,s,r){var o;B(this,y),Sc(e)?(e=Pc(r=e,"x",0),i=Pc(r,"y",0),n=Pc(r,"key",void 0),s=Pc(r,"frame",void 0)):Sc(s)&&(r=s,s=void 0);var a=Pc(r,"back",void 0),h=Pc(r,"front",void 0);a=a||t.add.image(e,i,n,s),h=h||t.add.image(e,i,n,s);var l=Pc(r,"width",h.width),u=Pc(r,"height",h.height);o=g.call(this,t,e,i,l,u),a.setVisible(!1),o.addMultiple([a,h]),o.type="rexTransitionImage",o.backImage=a,o.frontImage=h,o.maskGameObject=void 0,o.cellImages=[],o.imagesPool=[];var c=Pc(r,"onStart",void 0),d=Pc(r,"onProgress",void 0),f=Pc(r,"onComplete",void 0),p=Pc(r,"dir",0);void 0===c&&void 0===d&&void 0===f&&(c=xc,d=Cc,f=wc,p=0),o.setTransitionStartCallback(c,Pc(r,"onStartScope",void 0)).setTransitionProgressCallback(d,Pc(r,"onProgressScope",void 0)).setTransitionCompleteCallback(f,Pc(r,"onCompleteScope",void 0)).setTransitionDirection(p).setDuration(Pc(r,"duration",1e3)).setEaseFunction(Pc(r,"ease","Linear"));var v=Pc(r,"mask",void 0);return v&&o.setMaskGameObject(v),o.setMaskEnable(!1),o.ignoreCompleteEvent=!1,o}return m(y,[{key:"destroy",value:function(t){this.scene&&(this.childrenMask&&(this.childrenMask.destroy(),this.childrenMask=void 0),this.backImage=void 0,this.frontImage=void 0,this.maskGameObject=void 0,this.cellImages.length=0,this.imagesPool.length=0,O(C(y.prototype),"destroy",this).call(this,t),this.onStartCallback=void 0,this.onStartCallbackScope=void 0,this.onProgressCallback=void 0,this.onProgressCallbackScope=void 0,this.onCompleteCallback=void 0,this.onCompleteCallbackScope=void 0,this.easeValueTask=void 0)}},{key:"currentImage",get:function(){return 0===this.dir?this.frontImage:this.backImage}},{key:"nextImage",get:function(){return 0===this.dir?this.backImage:this.frontImage}},{key:"texture",get:function(){return this.nextImage.texture}},{key:"frame",get:function(){return this.nextImage.frame}},{key:"t",get:function(){return this._t},set:function(t){if(t=Tc(t,0,1),this._t!==t){this._t=t;var e=this.currentImage,i=this.nextImage;if(0===t&&(this.setChildVisible(this.frontImage,!0).setChildVisible(this.backImage,!0),Mc(this.onStartCallback,this.onStartCallbackScope,this,e,i,t)),Mc(this.onProgressCallback,this.onProgressCallbackScope,this,e,i,t),1===t){Mc(this.onCompleteCallback,this.onCompleteCallbackScope,this,e,i,t);var n=i.texture.key,s=i.frame.name;this.frontImage.setTexture(n,s),this.backImage.setTexture(n,s),this.setChildVisible(this.frontImage,!0).setChildVisible(this.backImage,!1).setMaskEnable(!1).freeCellImages()}1!==t||this.ignoreCompleteEvent||this.emit("complete")}}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isRunning",get:function(){return!!this.easeValueTask&&this.easeValueTask.isRunning}},{key:"setOrigin",value:function(t,e){return O(C(y.prototype),"setOrigin",this).call(this,t,e),this.backImage.setOrigin(t,e),this.frontImage.setOrigin(t,e),this.maskGameObject&&this.maskGameObject.setOrigin(t,e),this}},{key:"setTexture",value:function(t,e){return this.frontImage.setTexture(t,e),this.backImage.setTexture(t,e).setVisible(!1),this}}]),y}(),Mc=function(t,e,i,n,s,r){t&&(e?t.call(e,i,n,s,r):t(i,n,s,r))};Object.assign(Oc.prototype,bc),u.register("transitionImage",function(t,e,i,n,s){var r=new Oc(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),x(window,"RexPlugins.UI.TransitionImage",Oc);var Ec=Phaser.GameObjects.Rectangle,_c=function(){w(r,Ec);var s=T(r);function r(t,e,i){var n;return B(this,r),(n=s.call(this,t,0,0,2,2,e,1)).setAlpha(i),n.setScrollFactor(0),n.boot(),n}return m(r,[{key:"boot",value:function(){this.scene.events.on("prerender",this.resize,this)}},{key:"destroy",value:function(t){this.scene&&(this.scene.events.off("prerender",this.resize,this),O(C(r.prototype),"destroy",this).call(this,t))}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha)}},{key:"resize",value:function(){var t=this.scene,e=t.scale.gameSize,i=t.cameras.main,n=e.width,s=e.height,r=1/i.zoom,o=n/2,a=s/2,h=n*r,l=s*r;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5)}}]),r}();u.register("fullWindowRectangle",function(t,e){var i=new _c(this.scene,t,e);return this.scene.add.existing(i),i}),x(window,"RexPlugins.UI.FullWindowRectangle",_c);var Bc=Phaser.Utils.Objects.GetValue,zc=function(){w(s,fo);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,{eventEmitter:!1})).resetFromJSON(e),i.boot(),i}return m(s,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(Bc(t,"hitAreaMode",0)),this.setEnable(Bc(t,"enable",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",function(t,e,i,n){n.stopPropagation()}).on("pointerup",function(t,e,i,n){n.stopPropagation()}).on("pointermove",function(t,e,i,n){n.stopPropagation()}).on("pointerover",function(t,e,i,n){n.stopPropagation()}).on("pointerout",function(t,e){e.stopPropagation()})}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Rc[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),s}(),Rc={default:0,fullWindow:1},Ic=Phaser.Utils.Objects.GetValue,Dc=function(){w(o,_c);var r=T(o);function o(t,e){var i;B(this,o);var n=Ic(e,"color",0),s=Ic(e,"alpha",.8);return(i=r.call(this,t,n,s)).touchEventStop=new zc(z(i),{hitAreaMode:1}),i}return o}();u.register("cover",function(t){var e=new Dc(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.Cover",Dc);var Lc=function(e,t){void 0===t&&(t={}),void 0===t.options&&(t.options={});var i=t.options;i.responsive=!1,i.maintainAspectRatio=!1,i.hasOwnProperty("devicePixelRatio")||(i.devicePixelRatio=1);var n=!1;void 0===i.animation?i.animation={}:!1===i.animation&&(n=!0,i.animation={});var s=i.animation;n&&(s.duration=0);var r=s.onProgress;s.onProgress=function(t){r&&r(t),e.needRedraw()};var o=s.onComplete;return s.onComplete=function(t){o&&o(t),e.needRedraw()},t},jc=function(){w(h,dt);var a=T(h);function h(t,e,i,n,s,r){var o;return B(this,h),(o=a.call(this,t,e,i,n,s)).type="rexChart",(o.chart=void 0)!==r&&o.setChart(r),o}return m(h,[{key:"destroy",value:function(t){this.scene&&(this.chart&&(this.chart.destroy(),this.chart=void 0),O(C(h.prototype),"destroy",this).call(this,t))}},{key:"resize",value:function(t,e){if(t===this.width&&e===this.height)return this;if(O(C(h.prototype),"resize",this).call(this,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}}]),h}(),Ac={setChart:function(t){if(window.Chart)return this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,Lc(this,t)),this;return console.error("Can not find chartjs! Load chartjs in preload stage.\nscene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/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,n=0,s=i.length;n<s;n++)if((e=i[n]).label===t)return e}},getChartData:function(t,e){var i=this.getChartDataset(t);if(void 0!==i){if("string"==typeof e)if(-1===(e=this.chart.data.labels.indexOf(e)))return;return i.data[e]}},setChartData:function(t,e,i){if(void 0===this.chart)return this;var n=this.getChartDataset(t);if("string"==typeof e&&-1===(e=this.chart.data.labels.indexOf(e)))return this;return n.data[e]=i,this},updateChart:function(){if(void 0===this.chart)return this;this.chart.update()}};Object.assign(jc.prototype,Ac),u.register("chart",function(t,e,i,n,s){var r=new jc(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),x(window,"RexPlugins.UI.Chart",jc);function Fc(t,e,i,n,s,r,o,a){Dh.call(this,t);var h=P(e);if(null===e)return this;if("number"!==h)if("string"===h)e=Hc[e];else if(Wc(e)){var l;e=Gc(l=e,"proportion",0),i=Gc(l,"align",Uc),n=Gc(l,"padding",0),s=Gc(l,"expand",!1),r=Gc(l,"key",void 0),o=Gc(l,"index",void 0),t.isRexSizer||(a=0===this.orientation?Gc(l,"minWidth",void 0):Gc(l,"minHeight",void 0))}return"string"==typeof i&&(i=ah[i]),void 0===e&&(e=0),void 0===i&&(i=Uc),void 0===n&&(n=0),void 0===s&&(s=!1),t.isRexSizer||void 0!==a||(a=0===this.orientation?t._minWidth:t._minHeight),(l=this.getSizerConfig(t)).proportion=e,l.align=i,l.padding=Ih(n),l.expand=s,void 0===o||o>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(o,0,t),!t.isRexSizer&&0<e&&(0===this.orientation?(t.minWidth=void 0===a?lh(t):a,t.minHeight=void 0):(t.minWidth=void 0,t.minHeight=void 0===a?uh(t):a)),void 0!==r&&this.addChildrenMap(r,t),this}var Yc=Phaser.GameObjects.Zone,Vc=function(){w(n,Yc);var i=T(n);function n(t){var e;return B(this,n),(e=i.call(this,t,0,0,1,1)).isRexSpace=!0,e}return n}(),Wc=Phaser.Utils.Objects.IsPlainObject,Gc=Phaser.Utils.Objects.GetValue,Uc=Phaser.Display.Align.CENTER,Hc={min:0,full:-1},Xc={add:Fc,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),Fc.call(this,new Vc(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,s,r,o){return Fc.call(this,e,i,n,s,r,o,t),this}},Nc=Phaser.Utils.Array.Remove,Jc={remove:function(t,e){return this.getParentSizer(t)!==this||(Nc(this.sizerChildren,t),ou.call(this,t,e)),this},removeAll:function(t){for(var e=this.sizerChildren.length-1;0<=e;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,au.call(this,t),this}},Kc={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,s=0,r=this.sizerChildren;if(0===this.orientation)for(var o=0,a=r.length;o<a;o++)(e=r[o]).rexSizer.hidden||(n=0===e.rexSizer.proportion||t&&0<e.rexSizer.proportion?this.getChildWidth(e):0,n+=(i=e.rexSizer.padding).left+i.right,0<o&&(n+=this.space.item),s+=n);else for(o=0,a=r.length;o<a;o++)(e=r[o]).hasOwnProperty("rexSizer")&&(e.rexSizer.hidden||(i=e.rexSizer.padding,n=this.getChildWidth(e)+i.left+i.right,s=Math.max(n,s)));return s+this.space.left+this.space.right},getChildrenHeight:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,s=0,r=this.sizerChildren;if(0===this.orientation)for(var o=0,a=r.length;o<a;o++)(e=r[o]).rexSizer.hidden||(i=e.rexSizer.padding,n=this.getChildHeight(e)+i.top+i.bottom,s=Math.max(n,s));else for(o=0,a=r.length;o<a;o++)(e=r[o]).hasOwnProperty("rexSizer")&&(e.rexSizer.hidden||(i=e.rexSizer.padding,n=0===e.rexSizer.proportion||t&&0<e.rexSizer.proportion?this.getChildHeight(e):0,n+=i.top+i.bottom,0<o&&(n+=this.space.item),s+=n));return s+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer,s=n.padding;0===this.orientation?0<n.proportion&&0<this.proportionLength&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-s.left-s.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,s=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-s.top-s.bottom):0<n.proportion&&0<this.proportionLength&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,s=i.length;n<s;n++)(e=i[n]).isRexSizer&&t.push(e);return t},preLayout:function(){return this._childrenProportion=void 0,this.proportionLength=void 0,Fh.call(this),this},layoutChildren:function(){for(var t,e,i,n,s,r,o,a,h,l=this.sizerChildren,u=this.innerLeft,c=this.innerTop,d=this.innerWidth,f=this.innerHeight,p=u,v=c,g=0,y=l.length;g<y;g++)(t=this.rtl?l[y-g-1]:l[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,kl.call(this,t),h=t.isRexSpace?a=0:(a=this.getExpandedChildWidth(t),this.getExpandedChildHeight(t)),t.isRexSizer?(t.runLayout(this,a,h),ru(t,this)):yl(t,a,h),void 0===a&&(a=lh(t)),void 0===h&&(h=uh(t)),o=0===this.orientation?(n=p+i.left,r=0===e.proportion||0===this.proportionLength?a:e.proportion*this.proportionLength,s=v+i.top,f-i.top-i.bottom):(n=p+i.left,r=d-i.left-i.right,s=v+i.top,0===e.proportion||0===this.proportionLength?h:e.proportion*this.proportionLength),ml.call(this,t,n,s,r,o,e.align),0===this.orientation?p+=r+i.left+i.right+this.space.item:v+=o+i.top+i.bottom+this.space.item)},resolveWidth:function(t){t=jh.call(this,t);if(void 0===this.proportionLength&&0===this.orientation){var e=t-this.childrenWidth;0<e?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t,e){e=Ah.call(this,t,e);if(void 0===this.proportionLength&&1===this.orientation){var i=e-this.childrenHeight;0<i?(i=e-this.getChildrenHeight(!1),this.proportionLength=i/this.childrenProportion):this.proportionLength=0}return e}};Object.assign(Kc,Xc,Jc);function Zc(t){return"string"==typeof t&&(t=qc[t]),t}var qc={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},$c=Phaser.Utils.Objects.IsPlainObject,Qc=Phaser.Utils.Objects.GetValue,td=function(){w(l,su);var h=T(l);function l(t,e,i,n,s,r,o){var a;return B(this,l),$c(e)?(e=Qc(o=e,"x",0),i=Qc(o,"y",0),n=Qc(o,"width",void 0),s=Qc(o,"height",void 0),r=Qc(o,"orientation",0)):$c(n)?(n=Qc(o=n,"width",void 0),s=Qc(o,"height",void 0),r=Qc(o,"orientation",0)):$c(r)&&(r=Qc(o=r,"orientation",0)),void 0===r&&(r=0),(a=h.call(this,t,e,i,n,s,o)).type="rexSizer",a.sizerChildren=[],a.setOrientation(r),a.setItemSpacing(Qc(o,"space.item",0)),a.setRTL(Qc(o,"rtl",!1)),a.addChildrenMap("items",a.sizerChildren),a}return m(l,[{key:"setOrientation",value:function(t){return this.orientation=Zc(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=function(){for(var t,e,i=0,n=this.sizerChildren,s=0,r=n.length;s<r;s++)(t=n[s]).rexSizer.hidden||0<(e=t.rexSizer.proportion)&&(i+=e);return i}.call(this)),this._childrenProportion}}]),l}();Object.assign(td.prototype,Kc),u.register("sizer",function(t,e,i,n,s,r){var o=new td(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o}),x(window,"RexPlugins.UI.Sizer",td);function ed(){return Array.prototype.reduce.call(arguments,nd,0)}function id(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=t.length-1);for(var s=i;s<=n;s++)t[s]=e;return t}var nd=function(t,e){return t+e},sd=Phaser.Utils.Objects.IsPlainObject,rd=Phaser.Utils.Objects.GetValue,od=Phaser.Display.Align.CENTER,ad={add:function(t,e,i,n,s,r,o){Dh.call(this,t),sd(e)&&(e=rd(a=e,"column",void 0),i=rd(a,"row",void 0),n=rd(a,"align",od),s=rd(a,"padding",0),r=rd(a,"expand",!1),o=rd(a,"key",void 0));var a,h=function(t,e,i,n,s){if("number"==typeof t||"number"==typeof e)if(void 0===t){for(var r=0;r<n;r++)if(!i[o=e*n+r])return o}else if(void 0===e){for(r=0;r<s;r++)if(!i[o=r*n+t])return o}else{if(!i[o=e*n+t])return o}else if(!0===e){var o;for(r=0;r<n;r++)for(var a=0;a<s;a++)if(!i[o=a*n+r])return o}else{r=0;for(var h=i.length;r<h;r++)if(!i[r])return r}return null}(e,i,this.sizerChildren,this.columnCount,this.rowCount);return null===h||("string"==typeof n&&(n=ah[n]),void 0===n&&(n=od),void 0===s&&(s=0),void 0===r&&(r=!0),(a=this.getSizerConfig(t)).align=n,a.padding=Ih(s),a.expand=r,this.sizerChildren[h]=t,void 0!==o&&this.addChildrenMap(o,t)),this}},hd={remove:function(t,e){if(this.getParentSizer(t)!==this)return this;var i=this.sizerChildren.indexOf(t);return-1!==i&&(this.sizerChildren[i]=null),ou.call(this,t,e),this},removeAt:function(t,e,i){var n=this.getChildAt(t,e);return n&&this.remove(n,i),this},removeAll:function(t){for(var e=this.sizerChildren.length-1;0<=e;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear:function(t){return id(this.sizerChildren,null),au.call(this,t),this}},ld=Phaser.Utils.Objects.GetValue,ud={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;for(var t,e,i,n,s=0,r=this.sizerChildren,o=0;o<this.columnCount;o++){if((t=0)===this.columnProportions[o]){for(var a=0;a<this.rowCount;a++)(e=r[a*this.columnCount+o])&&(e.rexSizer.hidden||(i=e.rexSizer.padding,n=this.getChildWidth(e)+i.left+i.right,t=Math.max(t,n)));s+=t}this.columnWidth[o]=t}return s+ed.apply(void 0,[this.space.left].concat(M(this.space.column),[this.space.right]))},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;for(var t,e,i,n,s=0,r=this.sizerChildren,o=0;o<this.rowCount;o++){if((t=0)===this.rowProportions[o]){for(var a=0;a<this.columnCount;a++)(e=r[o*this.columnCount+a])&&(e.rexSizer.hidden||(n=e.isRexSizer?Math.max(e.minHeight,e.childrenHeight):e.hasOwnProperty("minHeight")?e.minHeight:uh(e),n+=(i=e.rexSizer.padding).top+i.bottom,t=Math.max(t,n)));s+=t}this.rowHeight[o]=t}return s+ed.apply(void 0,[this.space.top].concat(M(this.space.row),[this.space.bottom]))},getExpandedChildWidth:function(t,e){var i,n=t.rexSizer;if(n.expand){var s=n.padding;i=e-s.left-s.right}return i},getExpandedChildHeight:function(t,e){var i,n=t.rexSizer;if(n.expand){var s=n.padding;i=e-s.top-s.bottom}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,s=i.length;n<s;n++)(e=i[n])&&e.isRexSizer&&t.push(e);return t},preLayout:function(){return this._totalColumnProportions=void 0,this._totalRowProportions=void 0,this.proportionWidthLength=void 0,this.proportionHeightLength=void 0,Fh.call(this),this},layoutChildren:function(){for(var t,e,i,n,s,r,o,a,h,l,u,c=this.innerLeft,d=c,f=this.innerTop,p=this.space.column,v=this.space.row,g=0;g<this.rowCount;g++){u=this.getRowHeight(g),d=c;for(var y=0;y<this.columnCount;y++)l=this.getColumnWidth(y),(t=this.getChildAt(y,g))&&!t.rexSizer.hidden&&(kl.call(this,t),a=this.getExpandedChildWidth(t,l),h=this.getExpandedChildHeight(t,u),t.isRexSizer?(t.runLayout(this,a,h),ru(t,this)):yl(t,a,h),n=d+(i=(e=t.rexSizer).padding).left,r=l-i.left-i.right,s=f+i.top,o=u-i.top-i.bottom,ml.call(this,t,n,s,r,o,e.align)),d+=l+p[y];f+=u+v[g]}},resolveWidth:function(t){t=jh.call(this,t);if(void 0===this.proportionWidthLength){var e=this.totalColumnProportions;if(0<e){var i=t-this.childrenWidth;0<=i&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t,e){e=Ah.call(this,t,e);if(void 0===this.proportionHeightLength){var i=this.totalRowProportions;if(0<i){var n=e-this.childrenHeight;0<=n&&(this.proportionHeightLength=n/i)}else this.proportionHeightLength=0}return e},resolveChildrenWidth:function(){var t,e,i;for(var n in this.sizerChildren)(t=this.sizerChildren[n])&&t.isRexSizer&&!t.ignoreLayout&&(i=this.getColumnWidth(parseInt(n)%this.columnCount),e=this.getExpandedChildWidth(t,i),e=t.resolveWidth(e),t.resolveChildrenWidth(e))},runWidthWrap:function(){var t,e,i;for(var n in this.sizerChildren)!(t=this.sizerChildren[n])||t.isRexSizer&&t.ignoreLayout||!t.runWidthWrap||(i=this.getColumnWidth(parseInt(n)%this.columnCount),e=this.getExpandedChildWidth(t,i),t.isRexSizer&&(e=t.resolveWidth(e)),t.runWidthWrap(e));return this},resetGrid:function(t,e,i,n,s){if(void 0===i&&(i=0),void 0===n&&(n=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,void 0===this.sizerChildren?this.sizerChildren=[]:this.removeAll(),this.sizerChildren.length=t*e,id(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)id(this.columnProportions,i);else for(var r=0;r<t;r++)this.columnProportions[r]=i[r]||0;if(this.rowProportions=[],this.rowProportions.length=e,"number"==typeof n)id(this.rowProportions,n);else for(r=0;r<e;r++)this.rowProportions[r]=n[r]||0;this.columnWidth=[],this.columnWidth.length=t,this.rowHeight=[],this.rowHeight.length=e,this.space.column=[],this.space.column.length=t-1;var o=ld(s,"column",0);if("number"==typeof o)id(this.space.column,o);else{r=0;for(var a=this.space.column.length;r<a;r++)this.space.column[r]=o[r]||0}this.space.row=[],this.space.row.length=e-1;var h=ld(s,"row",0);if("number"==typeof h)id(this.space.row,h);else for(r=0,a=this.space.row.length;r<a;r++)this.space.row[r]=h[r]||0;return this}};Object.assign(ud,ad,hd);var cd=Phaser.Utils.Objects.IsPlainObject,dd=Phaser.Utils.Objects.GetValue,fd=function(){w(y,su);var g=T(y);function y(t,e,i,n,s,r,o,a,h,l){var u;B(this,y),cd(e)?(e=dd(l=e,"x",0),i=dd(l,"y",0),n=dd(l,"width",void 0),s=dd(l,"height",void 0),r=dd(l,"column",0),o=dd(l,"row",0),a=dd(l,"columnProportions",0),h=dd(l,"rowProportions",0)):cd(n)?(n=dd(l=n,"width",void 0),s=dd(l,"height",void 0),r=dd(l,"column",0),o=dd(l,"row",0),a=dd(l,"columnProportions",0),h=dd(l,"rowProportions",0)):cd(r)?(r=dd(l=r,"column",0),o=dd(l,"row",0),a=dd(l,"columnProportions",0),h=dd(l,"rowProportions",0)):cd(a)&&(a=dd(l=a,"columnProportions",0),h=dd(l,"rowProportions",0)),(u=g.call(this,t,e,i,n,s,l)).type="rexGridSizer",u.resetGrid(r,o,a,h,dd(l,"space",void 0)),u.addChildrenMap("items",u.sizerChildren);var c=dd(l,"createCellContainerCallback");if(c){i=0;for(var d=u.rowCount;i<d;i++){e=0;for(var f=u.columnCount;e<f;e++){var p={column:e,row:i},v=c(t,e,i,p);v&&u.add(v,p)}}}return u}return m(y,[{key:"destroy",value:function(t){this.scene&&(O(C(y.prototype),"destroy",this).call(this,t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0)}},{key:"setColumnProportion",value:function(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}},{key:"setRowProportion",value:function(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}},{key:"totalColumnProportions",get:function(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=function(){for(var t,e=0,i=0;i<this.columnCount;i++)0<(t=this.columnProportions[i])&&(e+=t);return e}.call(this)),this._totalColumnProportions}},{key:"totalRowProportions",get:function(){return void 0===this._totalRowProportions&&(this._totalRowProportions=function(){for(var t,e=0,i=0;i<this.rowCount;i++)0<(t=this.rowProportions[i])&&(e+=t);return e}.call(this)),this._totalRowProportions}},{key:"getChildAt",value:function(t,e){return this.sizerChildren[e*this.columnCount+t]}},{key:"childToGridIndex",value:function(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)}},{key:"getColumnWidth",value:function(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}},{key:"getRowHeight",value:function(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}}]),y}();Object.assign(fd.prototype,ud),u.register("gridSizer",function(t,e,i,n,s,r,o,a,h){var l=new fd(this.scene,t,e,i,n,s,r,o,a,h);return this.scene.add.existing(l),l}),x(window,"RexPlugins.UI.GridSizer",fd);function pd(t,e,i,n){return"\n"===t?this.addNewLine():(Dh.call(this,t),kd(e)&&(e=md(s=e,"padding",0),i=md(s,"key",void 0),n=md(s,"index",void 0)),void 0===e&&(e=0),(s=this.getSizerConfig(t)).align=bd,s.padding=Ih(e),void 0===n||n>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(n,0,t),void 0!==i&&this.addChildrenMap(i,t)),this;var s}var vd=function(t,e,i,n){return e/t<=i?e/(n-1):0},gd=function(t){var e=t.rexSizer.padding;return lh(t)+e.left+e.right},yd=function(t){var e=t.rexSizer.padding;return uh(t)+e.top+e.bottom},kd=Phaser.Utils.Objects.IsPlainObject,md=Phaser.Utils.Objects.GetValue,bd=Phaser.Display.Align.CENTER,xd={add:function(t,e,i){if(Ui(t))for(var n=t,s=0,r=n.length;s<r;s++)pd.call(this,n[s],e);else pd.call(this,t,e,i);return this},addNewLine:function(){return this.sizerChildren.push("\n"),this},insert:function(t,e,i,n){return pd.call(this,e,i,n,t),this}},Cd=Phaser.Utils.Array.Remove,wd={remove:function(t,e){return this.getParentSizer(t)!==this||(Cd(this.sizerChildren,t),ou.call(this,t,e)),this},removeAll:function(t){for(var e=this.sizerChildren.length-1;0<=e;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,au.call(this,t),this}},Sd={getChildrenWidth:function(){return this.rexSizer.hidden?0:this.maxChildWidth+this.space.left+this.space.right},getChildrenHeight:function(){return this.rexSizer.hidden?0:this.widthWrapResult.height+this.space.top+this.space.bottom},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,s=i.length;n<s;n++)"\n"!==(e=i[n])&&e.isRexSizer&&t.push(e);return t},preLayout:function(){return this._maxChildWidth=void 0,this._maxChildHeight=void 0,Fh.call(this),this},layoutChildren:function(){for(var t,e,i,n,s,r,o,a,h,l,u=this.innerWidth,c=this.justifyPercentage,d=0,f=this.innerLeft,p=f,v=this.innerTop,g=this.widthWrapResult.lines,y=0,k=g.length;y<k;y++){switch(h=(a=g[y]).children,this.rtl&&h.reverse(),l=u-a.width,this.align){case 0:break;case 1:p+=l;break;case 2:p+=l/2;break;case 3:d=vd(u,l,c,h.length);break;case 4:0===(d=vd(u,l,c,h.length))&&(p+=l);break;case 5:0===(d=vd(u,l,c,h.length))&&(p+=l/2)}for(var m=0,b=h.length;m<b;m++)(t=h[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,kl.call(this,t),n=p+i.left,0<m&&(n+=this.space.item),s=v+i.top,r=lh(t),o=uh(t),p=n+r+i.right+d,ml.call(this,t,n,s,r,o,e.align));p=f,v+=a.height+this.space.line}},runWidthWrap:function(t){var e=t-this.space.left-this.space.right;this.widthWrapResult=function(t,e){void 0===e?e={lines:[],width:0,height:0}:(e.lines.length=0,e.width=0,e.height=0);for(var i,n,s,r,o,a=this.sizerChildren,h=0,l=e.lines,u=0,c=a.length;u<c;u++){if("\n"===(i=a[u]))i=void 0,o=!(n=0);else{if(i.rexSizer.hidden)continue;i.isRexSizer&&i.layout(),o=h<(n=gd(i))}o&&(r&&(r.width=t-(h+this.space.item),e.width=Math.max(e.width,r.width),e.height+=r.height+this.space.line),r={children:[],height:0},l.push(r),h=t),h-=n+this.space.item,i&&(r.children.push(i),s=yd(i),r.height=Math.max(r.height,s))}return r&&(r.width=t-(h+this.space.item),e.width=Math.max(e.width,r.width),e.height+=r.height),e}.call(this,e,this.widthWrapResult),Yh.call(this,t)}};Object.assign(Sd,xd,wd);var Pd=Phaser.Utils.Objects.IsPlainObject,Td=Phaser.Utils.Objects.GetValue,Od=function(){w(h,su);var a=T(h);function h(t,e,i,n,s,r){var o;return B(this,h),Pd(e)?(e=Td(r=e,"x",0),i=Td(r,"y",0),n=Td(r,"width",void 0),s=Td(r,"height",void 0)):Pd(n)&&(n=Td(r=n,"width",void 0),s=Td(r,"height",void 0)),(o=a.call(this,t,e,i,n,s,r)).type="rexFixWidthSizer",o.sizerChildren=[],o.setOrientation(Td(r,"orientation",0)),o.setItemSpacing(Td(r,"space.item",0)),o.setLineSpacing(Td(r,"space.line",0)),o.setAlign(Td(r,"align",0)),o.setJustifyPercentage(Td(r,"justifyPercentage",.25)),o.setRTL(Td(r,"rtl",!1)),o.addChildrenMap("items",o.sizerChildren),o}return m(h,[{key:"setOrientation",value:function(t){return this.orientation=Zc(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setLineSpacing",value:function(t){return this.space.line=t,this}},{key:"setAlign",value:function(t){return"string"==typeof t&&(t=Md[t]),this.align=t,this}},{key:"setJustifyPercentage",value:function(t){return this.justifyPercentage=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"maxChildWidth",get:function(){return void 0===this._maxChildWidth&&(this._maxChildWidth=function(t){void 0===t&&(t=this.sizerChildren);for(var e,i,n=0,s=0,r=t.length;s<r;s++)"\n"!==(e=t[s])&&(i=this.getChildWidth(e),n=Math.max(i,n));return n}.call(this)),this._maxChildWidth}},{key:"maxChildHeight",get:function(){return void 0===this._maxChildHeight&&(this._maxChildHeight=function(t){void 0===t&&(t=this.sizerChildren);for(var e,i,n=0,s=0,r=t.length;s<r;s++)"\n"!==(e=t[s])&&(i=e.isRexSizer?Math.max(e.minHeight,e.childrenHeight):e.hasOwnProperty("minHeight")?e.minHeight:uh(e),n=Math.max(i,n));return n}.call(this)),this._maxChildHeight}}]),h}(),Md={left:0,top:0,right:1,bottom:1,center:2,justify:3,"justify-left":3,"justify-top":3,"justify-right":4,"justify-bottom":4,"justify-center":5};Object.assign(Od.prototype,Sd),u.register("fixWidthSizer",function(t,e,i,n,s){var r=new Od(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),x(window,"RexPlugins.UI.FixWidthSizer",Od),u.register("overlapSizer",function(t,e,i,n,s){var r=new xu(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),x(window,"RexPlugins.UI.OverlapSizer",xu),u.register("space",function(){return new Vc(this.scene)}),x(window,"RexPlugins.UI.Space",Vc);function Ed(t,e,i,n){var s=new dc(e,i,n);if(t&&!t.isRexSizer){var r=s.createGeometryMask();t.setMask(r),this.once("destroy",function(){t.setMask(),r.destroy()})}return this.pin(s),s}var _d=Phaser.Utils.Objects.GetValue,Bd=function(){w(k,td);var y=T(k);function k(t,e){var i;B(this,k),(i=y.call(this,t,e)).type="rexLabel";var n=_d(e,"background",void 0),s=_d(e,"icon",void 0),r=_d(e,"iconMask",void 0),o=_d(e,"text",void 0),a=_d(e,"action",void 0),h=_d(e,"actionMask",void 0),l=_d(e,"align",void 0),u=_d(e,"space.icon",0),c=_d(e,"space.text",0);n&&i.addBackground(n),"right"!==l&&"bottom"!==l&&"center"!==l||i.addSpace(),s&&(0===i.orientation?(o||a)&&(f={right:u}):(o||a)&&(f={bottom:u}),i.add(s,0,"center",f),r=r&&Ed.call(z(i),s,s,1));if(o){var d,f,p,v=_d(e,"expandTextWidth",!1),g=_d(e,"expandTextHeight",!1);p=0===i.orientation?(d=v?1:0,a&&(f={right:c}),g):(d=g?1:0,a&&(f={bottom:c}),v),i.add(o,d,"center",f,p)}return a&&(i.add(a),h=h&&Ed.call(z(i),a,a,1)),"center"===l&&i.addSpace(),i.addChildrenMap("background",n),i.addChildrenMap("icon",s),i.addChildrenMap("iconMask",r),i.addChildrenMap("text",o),i.addChildrenMap("action",a),i.addChildrenMap("actionMask",h),i}return m(k,[{key:"text",get:function(){var t=this.childrenMap.text;return void 0===t?"":t.text},set:function(t){var e=this.childrenMap.text;void 0!==e&&e.setText(t)}},{key:"setText",value:function(t){return this.text=t,this}},{key:"appendText",value:function(t){return this.text+=t,this}},{key:"setTexture",value:function(t,e){var i=this.childrenMap.icon;if(void 0!==i)return i.setTexture(t,e),this}},{key:"texture",get:function(){var t=this.childrenMap.icon;if(void 0!==t)return t.texture}},{key:"frame",get:function(){var t=this.childrenMap.icon;if(void 0!==t)return t.frame}},{key:"runLayout",value:function(t,e,i){if(this.ignoreLayout)return this;O(C(k.prototype),"runLayout",this).call(this,t,e,i);var n=this.childrenMap.iconMask;n&&(n.setPosition(),this.resetChildPositionState(n));var s=this.childrenMap.actionMask;return s&&(s.setPosition(),this.resetChildPositionState(s)),this}},{key:"resize",value:function(t,e){O(C(k.prototype),"resize",this).call(this,t,e);var i=this.childrenMap.iconMask;i&&i.resize();var n=this.childrenMap.actionMask;return n&&n.resize(),this}}]),k}();u.register("label",function(t){var e=new Bd(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.Label",Bd);function zd(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)&&Ld.call(this),Dd.call(this,t,{proportion:i,expand:!0});var n=!this.buttonsExpand&&"center"===this.buttonsAlign;n&&Ld.call(this),this.hasTailSpace=n}else Dd.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var s=this.sizerChildren.length-1;Dd.call(this,t,{index:s,proportion:i,expand:!0})}else Dd.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this}function Rd(t,e){if(this.getParentSizer(t)!==this)return this;var i=this.buttonGroup.buttons;return Ad(i,t),Fd.call(this,t,e),this}function Id(t,e){void 0===e&&(e=!1);var s,r,i=Gd(t,"dataManager",void 0);if(s=Gd(t,"setValueCallback",void 0),r=Gd(t,"setValueCallbackScope",void 0),void 0===s&&(s=Gd(t,"setButtonStateCallback",void 0),r=Gd(t,"setButtonStateCallbackScope",void 0)),void 0===i){var n=this.parent;n.setDataEnabled(),i=n.data}this.buttons.forEach(function(n){var t=n.name;s&&i.events.on("changedata-".concat(t),function(t,e,i){r?s.call(r,n,e,i):s(n,e,i)}),i.set(t,void 0),i.set(t,e)}),this.dataManager=i}var Dd=td.prototype.add,Ld=td.prototype.addSpace,jd={addButton:function(t){if(Ui(t))for(var e=t,i=0,n=e.length;i<n;i++)zd.call(this,e[i]);else zd.call(this,t);return this},addButtons:function(t){for(var e=0,i=t.length;e<i;e++)zd.call(this,t[e]);return this}},Ad=Phaser.Utils.Array.Remove,Fd=td.prototype.remove,Yd=td.prototype.clear,Vd={remove:function(t,e){if(Ui(t))for(var i=t,n=0,s=i.length;n<s;n++)Rd.call(this,i[n],e);else Rd.call(this,t,e);return this},clear:function(t){return this.buttonGroup.buttons.length=0,Yd.call(this,t),this},removeButton:function(t,e){return(t=this.getButton(t))&&this.remove(t,e),this},clearButtons:function(t){for(var e=this.buttonGroup.buttons,i=e.length-1;0<=i;i--)Rd.call(this,e[i],t);return this}},Wd={add:function(s){return this.buttons.push(s),s._buttonBehavior=new Ql(s,this.clickConfig),s._buttonBehavior.on("click",function(t,e,i,n){this.fireEvent("button.click",e,i,n)},this).on("enable",function(t,e){this.fireEvent("button.enable",e)},this).on("disable",function(t,e){this.fireEvent("button.disable",e)},this),s.on("pointerover",function(t,e,i,n){this.fireEvent("button.over",s,t,n)},this).on("pointerout",function(t,e){this.fireEvent("button.out",s,t,e)},this),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)this.add(gameObject[e]);return this}},Gd=Phaser.Utils.Objects.GetValue,Ud={setType:function(t){var e=Gd(t,"type",void 0);switch(this.buttonsType=e){case"radio":this.setRadioType(t);break;case"checkboxes":this.setCheckboxesType(t)}return this},setRadioType:function(t){Id.call(this,t);var e=void 0,i=this.parent,s=this.buttons,r=this.dataManager;return Object.defineProperty(i,"value",{get:function(){return e},set:function(n){n!==e&&(e=n,s.forEach(function(t){var e=t.name,i=r.get(e);e===n?i||r.set(e,!0):i&&r.set(e,!1)}))},enumerable:!0,configurable:!0}),i.on("button.click",function(t){i.value=t.name}),this},setCheckboxesType:function(t){Id.call(this,t);var e=this.parent,i=this.dataManager;return e.on("button.click",function(t){i.toggle(t.name)}),this},setSelectedButtonName:function(t){return this.parent.value=t,this},getSelectedButtonName:function(){return this.parent.value},setButtonState:function(t,e){return void 0===e&&(e=!0),this.dataManager.set(t,e),this},getButtonState:function(t){return this.dataManager.get(t)}},Hd=function(t,e){return t?t.hasOwnProperty("name")?t.name===e?t:null:GetElementByName(t,e):null},Xd={getButton:function(t){var e,i=this.buttons;switch(P(t)){case"number":e=i[t];break;case"string":e=function(t,e){if(!t)return null;if(Ui(t)){for(var i,n=0,s=t.length;n<s;n++)if(i=Hd(t[n],e))return i}else for(var r in t)if(i=Hd(t[r],e))return i}(i,t);break;default:e=t,-1===i.indexOf(e)&&(e=void 0)}return e},setButtonEnable:function(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var n=0,s=i.length;n<s;n++)i[n]._buttonBehavior.setEnable(e)}else this.getButton(t)._buttonBehavior.setEnable(e);return this},toggleButtonEnable:function(t){var e=this.buttons;if(void 0===t||"boolean"==typeof t)for(var i=0,n=e.length;i<n;i++)e[i]._buttonBehavior.toggleEnable();else this.getButton(t)._buttonBehavior.toggleEnable();return this},getButtonEnable:function(t){return void 0===t&&(t=0),this.getButton(t)._buttonBehavior.enable},emitButtonClick:function(t){return(this.buttonGroup?this.buttonGroup:this).fireEvent("button.click",t),this},showButton:function(t){return ll(this.getButton(t)),this},hideButton:function(t){return ul(this.getButton(t)),this},isButtonShown:function(t){return cl(this.getButton(t)),this},forEachButtton:function(t,e){for(var i=this.buttons,n=0,s=i.length;n<s;n++)e?t.call(e,i[n],n,i):t(i[n],n,i);return this}},Nd=function(){function e(t){B(this,e),this.parent=t.parent,this.eventEmitter=t.eventEmitter,this.groupName=t.groupName,this.clickConfig=t.clickConfig,this.buttons=[]}return m(e,[{key:"destroy",value:function(){this.parent=void 0,this.eventEmitter=void 0,this.clickConfig=void 0,this.buttons=void 0}}]),e}(),Jd={fireEvent:function(t,e,i,n){var s;if("number"==typeof e){if(s=e,!(e=this.buttons[s]))return}else if(-1===(s=this.buttons.indexOf(e)))return;this.eventEmitter!==this.parent&&this.parent.emit(t,e,s,i,n),void 0!==this.groupName?this.eventEmitter.emit(t,e,this.groupName,s,i,n):this.eventEmitter.emit(t,e,s,i,n)}};Object.assign(Nd.prototype,Wd,Ud,Xd,Jd);var Kd={setSelectedButtonName:function(t){return this.buttonGroup.setSelectedButtonName(t),this},getSelectedButtonName:function(){return this.buttonGroup.getSelectedButtonName()},setButtonState:function(t,e){return this.buttonGroup.setButtonState(t,e),this},getButtonState:function(t){return this.buttonGroup.getButtonState(t)}},Zd=Phaser.Utils.Objects.GetValue,qd=function(){w(a,td);var o=T(a);function a(t,e){var i;B(this,a),void 0===e&&(e={});var n=e.space;"number"==typeof n&&(e.space={item:n}),(i=o.call(this,t,e)).type="rexButtons",i.buttonGroup=new Nd({parent:z(i),eventEmitter:Zd(e,"eventEmitter",z(i)),groupName:Zd(e,"groupName",void 0),clickConfig:Zd(e,"click",void 0)});var s=Zd(e,"background",void 0),r=Zd(e,"buttons",void 0);return i.buttonsExpand=Zd(e,"expand",!1),i.buttonsAlign=Zd(e,"align",void 0),s&&i.addBackground(s),r&&i.addButtons(r),i.buttonGroup.setType(e),i.addChildrenMap("background",s),i.addChildrenMap("buttons",i.buttonGroup.buttons),i}return m(a,[{key:"destroy",value:function(t){this.scene&&(O(C(a.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),a}();Object.assign(qd.prototype,jd,Vd,Xd,Kd),u.register("buttons",function(t){var e=new qd(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.Buttons",qd);function $d(t,e){if(!(t=this.getButton(t)))return this;var i=this.buttonGroup.buttons;return ef(i,t),nf.call(this,t,e),this}var Qd=fd.prototype.add,tf={addButton:function(t,e,i){return Qd.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons:function(t,e){for(var i=0,n=t;i<n;i++)this.addButton(t[i],void 0,e);return this}},ef=Phaser.Utils.Array.Remove,nf=fd.prototype.remove,sf=fd.prototype.clear,rf={remove:function(t,e){if(Ui(t))for(var i=t,n=0,s=i.length;n<s;n++)$d.call(this,i[n],e);else $d.call(this,t,e);return this},clear:function(t){return this.buttonGroup.buttons.length=0,sf.call(this,t),this},removeButton:function(t,e){return this.remove(t,e),this},clearButtons:function(t){for(var e=this.buttonGroup.buttons,i=e.length-1;0<=i;i--)$d.call(this,e[i],t);return this}},of=Phaser.Utils.Objects.GetValue,af=function(){w(x,fd);var b=T(x);function x(t,e){var i;B(this,x),void 0===e&&(e={});var n=of(e,"row",0),s=of(e,"col",0),r=of(e,"createCellContainerCallback"),o=of(e,"buttons",void 0),a=of(e,"expand",!0),h=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==o){n=Math.max(n,o.length);for(var l=0,u=o.length;l<u;l++)s=Math.max(s,o[l].length)}e.row=n,e.column=s,e.columnProportions=h,e.rowProportions=h,(i=b.call(this,t,e)).type="rexGridButtons",i.buttonGroup=new Nd({parent:z(i),eventEmitter:of(e,"eventEmitter",z(i)),groupName:of(e,"groupName",void 0),clickConfig:of(e,"click",void 0)});var c=of(e,"background",void 0);if(i.buttonsExpand=a,of(e,"space",void 0),c&&i.addBackground(c),o)for(var d,f=0,p=o.length;f<p;f++)for(var v=0,g=(d=o[f]).length;v<g;v++)(m=d[v])&&i.addButton(m,v,f);else if(r)for(var y=0;y<n;y++)for(var k=0;k<s;k++){var m;(m=r(t,k,y))&&i.addButton(m,k,y)}return i.buttonGroup.setType(e),i.addChildrenMap("background",c),i.addChildrenMap("buttons",i.buttonGroup.buttons),i}return m(x,[{key:"destroy",value:function(t){this.scene&&(O(C(x.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),x}();Object.assign(af.prototype,tf,rf,Xd,Kd),u.register("gridButtons",function(t){var e=new af(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.GridButtons",af);function hf(t){return uf.call(this,t),this.buttonGroup.add(t),this}function lf(t,e){if(!(t=this.getButton(t)))return this;var i=this.buttonGroup.buttons;return df(i,t),ff.call(this,t,e),this}var uf=Od.prototype.add,cf={addButton:function(t){if(Ui(t))for(var e=t,i=0,n=e.length;i<n;i++)hf.call(this,e[i]);else hf.call(this,t);return this},addButtons:function(t){if(Ui(t[0]))for(var e,i=t,n=0,s=i.length-1;n<=s;n++){for(var r=0,o=(e=i[n]).length;r<o;r++)hf.call(this,e[r]);s<n&&uf.addNewLine(this)}else for(r=0,o=t.length;r<o;r++)hf.call(this,t[r]);return this}},df=Phaser.Utils.Array.Remove,ff=Od.prototype.remove,pf=Od.prototype.clear,vf={remove:function(t,e){if(Ui(t))for(var i=t,n=0,s=i.length;n<s;n++)lf.call(this,i[n],e);else lf.call(this,t,e);return this},clear:function(t){return this.buttonGroup.buttons.length=0,pf.call(this,t),this},removeButton:function(t,e){return this.remove(t,e),this},clearButtons:function(t){for(var e=this.buttonGroup.buttons,i=e.length-1;0<=i;i--)lf.call(this,e[i],t);return this}},gf=Phaser.Utils.Objects.GetValue,yf=function(){w(a,Od);var o=T(a);function a(t,e){var i;B(this,a),void 0===e&&(e={});var n=e.space;"number"==typeof n&&(e.space={item:n,line:n}),(i=o.call(this,t,e)).type="rexFixWidthButtons",i.buttonGroup=new Nd({parent:z(i),eventEmitter:gf(e,"eventEmitter",z(i)),groupName:gf(e,"groupName",void 0),clickConfig:gf(e,"click",void 0)});var s=gf(e,"background",void 0),r=gf(e,"buttons",void 0);return i.buttonsAlign=gf(e,"align",void 0),s&&i.addBackground(s),r&&i.addButtons(r),i.buttonGroup.setType(e),i.addChildrenMap("background",s),i.addChildrenMap("buttons",i.buttonGroup.buttons),i}return m(a,[{key:"destroy",value:function(t){this.scene&&(O(C(a.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),a}();Object.assign(yf.prototype,cf,vf,Xd,Kd),u.register("fixWidthButtons",function(t){var e=new yf(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.FixWidthButtons",yf);var kf=Phaser.Utils.Objects.GetValue,mf=function(){w(_,td);var E=T(_);function _(t,e){var i;B(this,_),void 0===e&&(e={}),e.orientation=1,(i=E.call(this,t,e)).type="rexDialog",i.eventEmitter=kf(e,"eventEmitter",z(i));var n,s,r,o,a=kf(e,"background",void 0),h=kf(e,"title",void 0),l=kf(e,"toolbar",void 0),u=kf(e,"toolbarBackground",void 0),c=kf(e,"leftToolbar",void 0),d=kf(e,"leftToolbarBackground",void 0),f=kf(e,"content",void 0),p=kf(e,"description",void 0),v=kf(e,"choices",void 0),g=kf(e,"choicesBackground",void 0),y=kf(e,"actions",void 0),k=kf(e,"actionsBackground",void 0),m=kf(e,"click",void 0);if(a&&i.addBackground(a),l&&(r=new qd(t,{groupName:"toolbar",background:u,buttons:l,orientation:0,space:{item:kf(e,"space.toolbarItem",0)},click:m,eventEmitter:i.eventEmitter})),c&&(o=new qd(t,{groupName:"leftToolbar",background:d,buttons:c,orientation:0,space:{item:kf(e,"space.leftToolbarItem",0)},click:m,eventEmitter:i.eventEmitter})),h&&!l&&!c){var b=kf(e,"align.title","center"),x=kf(e,"space.title",0);(f||p||v||y)&&(S={bottom:x});var C=kf(e,"expand.title",!0);i.add(h,{align:b,padding:S,expand:C})}if(l&&!h&&!c){x=kf(e,"space.title",0);(f||p||v||y)&&(S={bottom:x});C=kf(e,"expand.toolbar",!0);i.add(r,{align:"right",padding:S,expand:C})}if(c&&!h&&!l){x=kf(e,"space.title",0);(f||p||v||y)&&(S={bottom:x});C=kf(e,"expand.leftToolbar",!0);i.add(o,{align:"left",padding:S,expand:C})}if(h&&(l||c)){var w=new td(t,{orientation:0});o&&w.add(o,{align:"right",expand:!1});b=kf(e,"align.title","left");(C=kf(e,"expand.title",!0))||"right"!==b&&"center"!==b||w.addSpace();var S={left:kf(e,"space.titleLeft",0),right:kf(e,"space.titleRight",0)},P=C?1:0;w.add(h,{proportion:P,align:"center",padding:S,expand:C}),C||"left"!==b&&"center"!==b||w.addSpace(),r&&w.add(r,{align:"right",expand:!1});x=kf(e,"space.title",0);(f||p||v||y)&&(S={bottom:x}),i.add(w,{align:"center",padding:S,expand:!0})}if(f){b=kf(e,"align.content","center");var T=kf(e,"space.content",0);S={left:kf(e,"space.contentLeft",0),right:kf(e,"space.contentRight",0),bottom:p||v||y?T:0},C=kf(e,"expand.content",!0);i.add(f,{align:b,padding:S,expand:C})}if(p){b=kf(e,"align.description","center");var O=kf(e,"space.description",0);S={left:kf(e,"space.descriptionLeft",0),right:kf(e,"space.descriptionRight",0),bottom:v||y?O:0},C=kf(e,"expand.description",!0);i.add(p,{align:b,padding:S,expand:C})}if(v){b=kf(e,"align.choices","center");n=new qd(t,{groupName:"choices",background:g,buttons:v,orientation:1,space:{item:kf(e,"space.choice",0)},click:m,eventEmitter:i.eventEmitter,type:kf(e,"choicesType",void 0),setValueCallback:kf(e,"choicesSetValueCallback",void 0),setValueCallbackScope:kf(e,"choicesSetValueCallbackScope",void 0)});var M=kf(e,"space.choices",0);S={left:kf(e,"space.choicesLeft",0),right:kf(e,"space.choicesRight",0),bottom:y?M:0},C=kf(e,"expand.choices",!0);i.add(n,{align:b,padding:S,expand:C})}if(y){s=new qd(t,{groupName:"actions",background:k,buttons:y,orientation:0,space:{item:kf(e,"space.action",0)},expand:kf(e,"expand.actions",!1),align:kf(e,"align.actions","center"),click:m,eventEmitter:i.eventEmitter});S={left:kf(e,"space.actionsLeft",0),right:kf(e,"space.actionsRight",0)};i.add(s,{align:"center",padding:S,expand:!0})}return i.addChildrenMap("background",a),i.addChildrenMap("title",h),i.addChildrenMap("toolbar",l),i.addChildrenMap("leftToolbar",c),i.addChildrenMap("content",f),i.addChildrenMap("description",p),i.addChildrenMap("choices",v),i.addChildrenMap("actions",y),i.addChildrenMap("choicesSizer",n),i.addChildrenMap("actionsSizer",s),i.addChildrenMap("toolbarSizer",r),i.addChildrenMap("leftToolbarSizer",o),i}return _}();Object.assign(mf.prototype,{getChoice:function(t){return this.childrenMap.choicesSizer.getButton(t)},getAction:function(t){return this.childrenMap.actionsSizer.getButton(t)},getToolbar:function(t){return this.childrenMap.toolbarSizer.getButton(t)},getLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.getButton(t)},setChoiceEnable:function(t,e){return this.childrenMap.choicesSizer.setButtonEnable(t,e),this},setActionEnable:function(t,e){return this.childrenMap.actionsSizer.setButtonEnable(t,e),this},setToolbarEnable:function(t,e){return this.childrenMap.toolbarSizer.setButtonEnable(t,e),this},setLeftToolbarEnable:function(t,e){return this.childrenMap.leftToolbarSizer.setButtonEnable(t,e),this},toggleChoiceEnable:function(t){return this.childrenMap.choicesSizer.toggleButtonEnable(t),this},toggleActionEnable:function(t){return this.childrenMap.actionsSizer.toggleButtonEnable(t),this},toggleToolbarEnable:function(t){return this.childrenMap.toolbarSizer.toggleButtonEnable(t),this},toggleLeftToolbarEnable:function(t){return this.childrenMap.leftToolbarSizer.toggleButtonEnable(t),this},getChoiceEnable:function(t){return this.childrenMap.choicesSizer.getButtonEnable(t)},getActionEnable:function(t){return this.childrenMap.actionsSizer.getButtonEnable(t)},getToolbarEnable:function(t){return this.childrenMap.toolbarSizer.getButtonEnable(t)},getLeftToolbarEnable:function(t){return this.childrenMap.leftToolbarSizer.getButtonEnable(t)},emitChoiceClick:function(t){return this.childrenMap.choicesSizer.emitButtonClick(t),this},emitActionClick:function(t){return this.childrenMap.actionsSizer.emitButtonClick(t),this},emitToolbarClick:function(t){return this.childrenMap.toolbarSizer.emitButtonClick(t),this},emitLeftToolbarClick:function(t){return this.childrenMap.leftToolbarSizer.emitButtonClick(t),this},showChoice:function(t){return this.childrenMap.choicesSizer.showButton(t),this},showAction:function(t){return this.childrenMap.actionsSizer.showButton(t),this},showToolbar:function(t){return this.childrenMap.toolbarSizer.showButton(t),this},showLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.showButton(t),this},hideChoice:function(t){return this.childrenMap.choicesSizer.hideButton(t),this},hideAction:function(t){return this.childrenMap.actionsSizer.hideButton(t),this},hideToolbar:function(t){return this.childrenMap.toolbarSizer.hideButton(t),this},hideLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.hideButton(t),this},addChoice:function(t){return this.childrenMap.choicesSizer.addButton(t),this},addAction:function(t){return this.childrenMap.actionsSizer.addButton(t),this},addToolbar:function(t){return this.childrenMap.toolbarSizer.addButton(t),this},addLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.addButton(t),this},removeChoice:function(t,e){return this.childrenMap.choicesSizer.removeButton(t,e),this},removeAction:function(t,e){return this.childrenMap.actionsSizer.removeButton(t,e),this},removeToolbar:function(t,e){return this.childrenMap.toolbarSizer.removeButton(t,e),this},removeLeftToolbar:function(t,e){return this.childrenMap.leftToolbarSizer.removeButton(t,e),this},clearChoices:function(t){return this.childrenMap.choicesSizer.clearButtons(t),this},clearActions:function(t){return this.childrenMap.actionsSizer.clearButtons(t),this},clearToolbar:function(t){return this.childrenMap.toolbarSizer.clearButtons(t),this},clearLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.clearButtons(t),this},forEachChoice:function(t,e){return this.childrenMap.choicesSizer.forEachButtton(t,e),this},forEachAction:function(t,e){return this.childrenMap.actionsSizer.forEachButtton(t,e),this},forEachToolbar:function(t,e){return this.childrenMap.toolbarSizer.forEachButtton(t,e),this},forEachLeftToolbar:function(t,e){return this.childrenMap.leftToolbarSizer.forEachButtton(t,e),this}}),u.register("dialog",function(t){var e=new mf(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.Dialog",mf);var bf={getButtonsSizer:function(t){return this.childrenMap["".concat(t,"ButtonsSizer")]},getButton:function(t,e){var i=this.getButtonsSizer(t);return i?i.getButton(e):void 0},setButtonEnable:function(t,e,i){return this.getButtonsSizer(t).setButtonEnable(e,i),this},setLeftButtonEnable:function(t,e){return this.childrenMap.leftButtonsSizer.setButtonEnable(t,e),this},setRightButtonEnable:function(t,e){return this.childrenMap.rightButtonsSizer.setButtonEnable(t,e),this},setTopButtonEnable:function(t,e){return this.childrenMap.topButtonsSizer.setButtonEnable(t,e),this},setBottomButtonEnable:function(t,e){return this.childrenMap.bottomButtonsSizer.setButtonEnable(t,e),this},toggleButtonEnable:function(t,e){return this.getButtonsSizer(t).toggleButtonEnable(e),this},toggleLeftButtonEnable:function(t){return this.childrenMap.leftButtonsSizer.toggleButtonEnable(t),this},toggleRightButtonEnable:function(t){return this.childrenMap.rightButtonsSizer.toggleButtonEnable(t),this},toggleTopButtonEnable:function(t){return this.childrenMap.topButtonsSizer.toggleButtonEnable(t),this},toggleBottomButtonEnable:function(t){return this.childrenMap.bottomButtonsSizer.toggleButtonEnable(t),this},getButtonEnable:function(t,e){return this.getButtonsSizer(t).getButtonEnable(e)},getLeftButtonEnable:function(t){return this.childrenMap.leftButtonsSizer.getButtonEnable(t)},getRightButtonEnable:function(t){return this.childrenMap.rightButtonsSizer.getButtonEnable(t)},getTopButtonEnable:function(t){return this.childrenMap.topButtonsSizer.getButtonEnable(t)},getBottomButtonEnable:function(t){return this.childrenMap.bottomButtonsSizer.getButtonEnable(t)},emitButtonClick:function(t,e){var i=this.getButtonsSizer(t);return i&&i.emitButtonClick(e),this},emitLeftButtonClick:function(t){return this.childrenMap.leftButtonsSizer.emitButtonClick(t),this},emitRightButtonClick:function(t){return this.childrenMap.rightButtonsSizer.emitButtonClick(t),this},emitTopButtonClick:function(t){return this.childrenMap.topButtonsSizer.emitButtonClick(t),this},emitBottomButtonClick:function(t){return this.childrenMap.bottomButtonsSizer.emitButtonClick(t),this},getLeftButton:function(t){return this.childrenMap.leftButtonsSizer.getButton(t)},getRightButton:function(t){return this.childrenMap.rightButtonsSizer.getButton(t)},getTopButton:function(t){return this.childrenMap.topButtonsSizer.getButton(t)},getBottomButton:function(t){return this.childrenMap.bottomButtonsSizer.getButton(t)},showButton:function(t,e){return ll(this.getButton(t,e)),this},showLeftButton:function(t){return ll(this.getLeftButton(t)),this},showRightButton:function(t){return ll(this.getRightButton(t)),this},showTopButton:function(t){return ll(this.getTopButton(t)),this},showBottomButton:function(t){return ll(this.getBottomButton(t)),this},hideButton:function(t,e){return ul(this.getButton(t,e)),this},hideLeftButton:function(t){return ul(this.getLeftButton(t)),this},hideRightButton:function(t){return ul(this.getRightButton(t)),this},hideTopButton:function(t){return ul(this.getTopButton(t)),this},hideBottomButton:function(t){return ul(this.getBottomButton(t)),this},addButton:function(t,e){return this.getButtonsSizer(t).addButton(e),this},addLeftButton:function(t){return this.addButton("left",t),this},addRightButton:function(t){return this.addButton("right",t),this},addTopButton:function(t){return this.addButton("top",t),this},removeButton:function(t,e,i){return this.getButtonsSizer(t).removeButton(e,i),this},removeLeftButton:function(t,e){return this.removeButton("left",t,e),this},removeRightButton:function(t,e){return this.removeButton("right",t,e),this},removeTopButton:function(t,e){return this.removeButton("top",t,e),this},removeBottomButton:function(t,e){return this.removeButton("bottom",t,e),this},clearButtons:function(t,e){return this.getButtonsSizer(t).clearButtons(e),this},clearLeftButtons:function(t){return this.clearButtons("left",t),this},clearRightButtons:function(t){return this.clearButtons("right",t),this},clearTopButtons:function(t){return this.clearButtons("top",t),this},clearBottomButtonss:function(t){return this.clearButtons("bottom",t),this},forEachButton:function(t,e,i){return this.getButtonsSizer(t).forEachButtton(e,i),this},forEachLeftButton:function(t,e){return this.childrenMap.leftButtonsSizer.forEachButtton(t,e),this},forEachRightButton:function(t,e){return this.childrenMap.rightButtonsSizer.forEachButtton(t,e),this},forEachTopButton:function(t,e){return this.childrenMap.topButtonsSizer.forEachButtton(t,e),this},forEachBottomButton:function(t,e){return this.childrenMap.bottomButtonsSizer.forEachButtton(t,e),this}},xf=Phaser.Utils.Objects.GetValue,Cf=function(){w(M,fd);var O=T(M);function M(t,e){var i;B(this,M),void 0===e&&(e={}),e.column=3,e.row=3,(i=O.call(this,t,e)).type="rexTabs",i.eventEmitter=xf(e,"eventEmitter",z(i));var n,s,r,o,a=xf(e,"background",void 0),h=xf(e,"panel",void 0),l=xf(e,"leftButtons",void 0),u=xf(e,"leftButtonsBackground",void 0),c=xf(e,"rightButtons",void 0),d=xf(e,"rightButtonsBackground",void 0),f=xf(e,"topButtons",void 0),p=xf(e,"topButtonsBackground",void 0),v=xf(e,"bottomButtons",void 0),g=xf(e,"bottomButtonsBackground",void 0),y=xf(e,"click",void 0);if(a&&i.addBackground(a),h&&i.add(h,1,1,"center",0,!0),l){var k=xf(e,"space.leftButtonsOffset",0),m=xf(e,"space.leftButton",0);n=new qd(t,{groupName:"left",background:u,buttons:l,orientation:1,space:{item:m},align:xf(e,"align.leftButtons",void 0),click:y,eventEmitter:i.eventEmitter});var b={top:k};i.add(n,0,1,"top",b,!1)}if(c){var x=xf(e,"space.rightButtonsOffset",0),C=xf(e,"space.rightButton",0);s=new qd(t,{groupName:"right",background:d,buttons:c,orientation:1,space:{item:C},align:xf(e,"align.rightButtons",void 0),click:y,eventEmitter:i.eventEmitter});b={top:x};i.add(s,2,1,"top",b,!1)}if(f){var w=xf(e,"space.topButtonsOffset",0),S=xf(e,"space.topButton",0);r=new qd(t,{groupName:"top",background:p,buttons:f,orientation:0,space:{item:S},align:xf(e,"align.topButtons",void 0),click:y,eventEmitter:i.eventEmitter});b={left:w};i.add(r,1,0,"left",b,!1)}if(v){var P=xf(e,"space.bottomButtonsOffset",0),T=xf(e,"space.bottomButton",0);o=new qd(t,{groupName:"bottom",background:g,buttons:v,orientation:0,space:{item:T},align:xf(e,"align.bottomButtons",void 0),click:y,eventEmitter:i.eventEmitter});b={left:P};i.add(o,1,2,"left",b,!1)}return i.addChildrenMap("background",a),i.addChildrenMap("panel",h),i.addChildrenMap("leftButtons",l),i.addChildrenMap("rightButtons",c),i.addChildrenMap("topButtons",f),i.addChildrenMap("bottomButtons",v),i.addChildrenMap("leftButtonsSizer",n),i.addChildrenMap("rightButtonsSizer",s),i.addChildrenMap("topButtonsSizer",r),i.addChildrenMap("bottomButtonsSizer",o),i}return M}();Object.assign(Cf.prototype,bf),u.register("tabs",function(t){var e=new Cf(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.Tabs",Cf);function wf(t,e,i){var n,s,r;return t.y===e.y?(n=Math.min(t.x,e.x),s=Math.max(t.x,e.x),r=Of(i.x,n,s)):t.x===e.x&&(n=Math.min(t.y,e.y),s=Math.max(t.y,e.y),r=Of(i.y,n,s)),r}function Sf(t,e,i){this.enable&&(Mf.x=e,Mf.y=i,this.value=wf(this.getStartPoint(),this.getEndPoint(),Mf))}function Pf(t){if(this.enable&&t.isDown){Ef.x=t.worldX,Ef.y=t.worldY;var e=wf(this.getStartPoint(),this.getEndPoint(),Ef);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-e)<.1?this.value=e:this.easeValueTo(e)}}function Tf(t,e){void 0===e&&(e=_f);var i=this.childrenMap.thumb,n=i.x,s=i.y;return Rh(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=n,i.y=s,e}var Of=Phaser.Math.Percent,Mf={},Ef={},_f={},Bf=Phaser.Display.Align.LEFT_CENTER,zf=Phaser.Display.Align.TOP_CENTER,Rf={},If=Phaser.Display.Align.RIGHT_CENTER,Df=Phaser.Display.Align.BOTTOM_CENTER,Lf={},jf=Phaser.Math.Linear,Af={},Ff=Phaser.Display.Align.LEFT_CENTER,Yf=Phaser.Display.Align.TOP_CENTER,Vf=Phaser.Utils.Objects.GetValue,Wf=Phaser.Math.Clamp,Gf=Phaser.Math.Linear,Uf=Phaser.Math.Percent,Hf=Phaser.Math.Snap.To,Xf=function(){w(c,td);var u=T(c);function c(t,e){var i;B(this,c),(i=u.call(this,t,e)).type="rexSlider",i.eventEmitter=Vf(e,"eventEmitter",z(i));var n=Vf(e,"background",void 0),s=Vf(e,"track",void 0),r=Vf(e,"indicator",void 0),o=Vf(e,"thumb",void 0);n&&i.addBackground(n),s&&i.add(s,{proportion:1,expand:!0,minWidth:0,minHeight:0}),r&&i.pin(r),o&&i.pin(o);var a=Vf(e,"input",0);switch("string"==typeof a&&(a=Nf[a]),a){case 0:o&&(o.setInteractive(),i.scene.input.setDraggable(o),o.on("drag",Sf,z(i)));break;case 1:i.setInteractive().on("pointerdown",Pf,z(i)).on("pointermove",Pf,z(i))}i.addChildrenMap("background",n),i.addChildrenMap("track",s),i.addChildrenMap("indicator",r),i.addChildrenMap("thumb",o);var h=Vf(e,"valuechangeCallback",null);if(null!==h){var l=Vf(e,"valuechangeCallbackScope",void 0);i.eventEmitter.on("valuechange",h,l)}return i.setEnable(Vf(e,"enable",void 0)),i.setGap(Vf(e,"gap",void 0)),i.setValue(Vf(e,"value",0),Vf(e,"min",void 0),Vf(e,"max",void 0)),i.setEaseValuePropName("value").setEaseValueDuration(Vf(e,"easeValue.duration",0)).setEaseValueFunction(Vf(e,"easeValue.ease","Linear")),i}return m(c,[{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setGap",value:function(t){return this.gap=t,this}},{key:"value",get:function(){return this._value},set:function(t){void 0!==this.gap&&(t=Hf(t,this.gap));var e=this._value;this._value=Wf(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}},{key:"setValue",value:function(t,e,i){return null==t||(void 0!==e&&(t=Uf(t,e,i)),this.value=t),this}},{key:"addValue",value:function(t,e,i){return void 0!==e&&(t=Uf(t,e,i)),this.value+=t,this}},{key:"getValue",value:function(t,e){var i=this.value;return void 0!==t&&(i=Gf(t,e,i)),i}},{key:"runLayout",value:function(t,e,i){return this.ignoreLayout||(O(C(c.prototype),"runLayout",this).call(this,t,e,i),this.updateThumb(),this.updateIndicator()),this}}]),c}(),Nf={pan:0,drag:0,click:1,none:-1},Jf={getStartPoint:function(t){if(void 0===t&&(t=Rf),this.childrenMap.thumb){var e=0===this.orientation?Bf:zf;Tf.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=Lf),this.childrenMap.thumb){var e=0===this.orientation?If:Df;Tf.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,n,s,r=this.childrenMap.thumb;return void 0===r||(void 0===t&&(t=this.value),e=t,i=this.getStartPoint(),n=this.getEndPoint(),void 0===(s=r)&&(s=Af),s.x=jf(i.x,n.x,e),s.y=jf(i.y,n.y,e),this.resetChildPositionState(r)),this},updateIndicator:function(t){var e,i,n=this.childrenMap.indicator;if(void 0===n)return this;void 0===t&&(t=this.value);var s=this.childrenMap.thumb;if(s)if(0===this.orientation){var r=lh(s);e=s.x-r*s.originX+r-this.left}else{var o=uh(s);i=s.y-o*s.originY+o-this.top}else 0===this.orientation?e=this.width*t:i=this.height*t;yl(n,e,i);var a=0===this.orientation?Ff:Yf;zh(n,this,a),this.resetChildPositionState(n)}};Object.assign(Xf.prototype,Jf,pa),u.register("slider",function(t){var e=new Xf(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.Slider",Xf);function Kf(t){var e=qf(t,"scrollMode",0);return"string"==typeof e&&(e=Zf[e]),e}var Zf={v:0,vertical:0,h:1,horizontal:1},qf=Phaser.Utils.Objects.GetValue,$f=function(){function o(t){B(this,o);var e=wn(t,"states",void 0);e&&this.addStates(e);var i=wn(t,"extend",void 0);if(i)for(var n in i)this.hasOwnProperty(n)&&void 0!==this[n]||(this[n]=i[n]);var s=wn(t,"eventEmitter",void 0),r=wn(t,"EventEmitterClass",void 0);this.setEventEmitter(s,r),this._stateLock=!1,this.resetFromJSON(t)}return m(o,[{key:"shutdown",value:function(){this.destroyEventEmitter()}},{key:"destroy",value:function(){this.shutdown()}},{key:"resetFromJSON",value:function(t){this.setEnable(wn(t,"enable",!0)),this.start(wn(t,"start",void 0));var e=wn(t,"init",void 0);return e&&e.call(this),this}},{key:"toJSON",value:function(){return{curState:this.state,prevState:this.prevState,enable:this.enable,start:this._start}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"state",get:function(){return this._state},set:function(t){if(this.enable&&!this._stateLock&&this._state!==t){if(this._prevState=this._state,this._state=t,this._stateLock=!0,this.emit("statechange",this),null!=this._prevState){var e="exit_"+this._prevState,i=this[e];i&&i.call(this),this.emit(e,this)}if(this._stateLock=!1,null!=this._state){var n="enter_"+this._state,s=this[n];s&&s.call(this),this.emit(n,this)}}}},{key:"prevState",get:function(){return this._prevState}},{key:"start",value:function(t){return this._start=t,this._prevState=void 0,this._state=t,this}},{key:"goto",value:function(t){return null!=t&&(this.state=t),this}},{key:"next",value:function(){var t,e=this["next_"+this.state];return e&&(t="string"==typeof e?e:e.call(this)),this.goto(t),this}},{key:"addState",value:function(t,e){var i=wn(e,"next",void 0);i&&(this["next_"+t]=i);var n=wn(e,"exit",void 0);n&&(this["exit_"+t]=n);var s=wn(e,"enter",void 0);return s&&(this["enter_"+t]=s),this}},{key:"addStates",value:function(t){for(var e in t)this.addState(e,t[e]);return this}},{key:"update",value:function(t,e,i){void 0===i&&(i="update");var n=this[i+"_"+this.state];n&&n.call(this,t,e)}},{key:"preupdate",value:function(t,e){this.update(t,e,"preupdate")}},{key:"postupdate",value:function(t,e){this.update(t,e,"postupdate")}}]),o}();Object.assign($f.prototype,vs);var Qf=function(){w(s,$f);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,e)).parent=t,i.init(),i}return m(s,[{key:"init",value:function(){this.start("IDLE")}},{key:"next_IDLE",value:function(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}},{key:"update_IDLE",value:function(){this.next()}},{key:"next_DRAGBEGIN",value:function(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}},{key:"update_DRAGBEGIN",value:function(){this.next()}},{key:"next_DRAG",value:function(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}},{key:"update_DRAG",value:function(){var t=this.parent;t.dragState.justMoved&&t.dragging(),this.next()}},{key:"next_SLIDE",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}},{key:"enter_SLIDE",value:function(){this.parent.onSliding()}},{key:"exit_SLIDE",value:function(){this.parent.stop()}},{key:"update_SLIDE",value:function(t,e){this.parent.sliding(t,e),this.next()}},{key:"next_BACK",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}},{key:"enter_BACK",value:function(){this.parent.onPullBack()}},{key:"exit_BACK",value:function(){this.parent.stop()}},{key:"update_BACK",value:function(t,e){this.parent.pullBack(t,e),this.next()}}]),s}(),tp=Phaser.Utils.Objects.GetValue,ep=Phaser.Math.Distance.Between,ip=function(){w(s,fo);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,e))._enable=void 0,t.setInteractive(tp(e,"inputConfig",void 0)),i.resetFromJSON(e),i.boot(),i}return m(s,[{key:"resetFromJSON",value:function(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(tp(t,"enable",!0)),this.holdThreshold=tp(t,"holdThreshold",50),this.pointerOutReleaseEnable=tp(t,"pointerOutRelease",!0),this}},{key:"boot",value:function(){this.parent.on("pointerdown",this.onPointIn,this),this.parent.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&this.parent.on("pointerout",this.onPointOut,this),this.parent.on("pointermove",this.onPointerMove,this),this.scene.events.on("preupdate",this.preupdate,this)}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.events.off("preupdate",this.preupdate,this),this.pointer=void 0,O(C(s.prototype),"shutdown",this).call(this,t))}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setPointerOutReleaseEnable",value:function(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}},{key:"isDown",get:function(){return this.pointer&&this.pointer.isDown}},{key:"isUp",get:function(){return!this.isDown}},{key:"dx",get:function(){return this.x-this.preX}},{key:"dy",get:function(){return this.y-this.preY}},{key:"dt",get:function(){return this.scene.sys.game.loop.delta}},{key:"speed",get:function(){return this.x===this.preX&&this.y===this.preY?0:ep(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}},{key:"speedX",get:function(){return this.dx/(.001*this.dt)}},{key:"speedY",get:function(){return this.dy/(.001*this.dt)}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.localX=e,this.localY=i)}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}},{key:"onPointerMove",value:function(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.localX=e,this.localY=i)}},{key:"preupdate",value:function(t){if(this.enable){var e=this.pointer;this.justMoved=!1,e&&!this.isInTouched?(this.x=e.x,this.y=e.y,this.preX=e.x,this.preY=e.y,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",e,this.localX,this.localY)):e&&this.isInTouched?this.x===e.x&&this.y===e.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=e.x,this.y=e.y,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",e,this.localX,this.localY)):!e&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",e))}}}]),s}(),np=Phaser.Utils.Objects.GetValue,sp=function(){function e(t){B(this,e),this.resetFromJSON(t)}return m(e,[{key:"resetFromJSON",value:function(t){return this.setValue(np(t,"value",0)),this.setSpeed(np(t,"speed",0)),this.setAcceleration(np(t,"acceleration",0)),this}},{key:"reset",value:function(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"setAcceleration",value:function(t){return this.acceleration=t,this}},{key:"updateSpeed",value:function(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}},{key:"getDeltaValue",value:function(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}},{key:"update",value:function(t){return this.updateSpeed(t),0<this.speed&&(this.value+=this.getDeltaValue(t)),this}},{key:"isMoving",get:function(){return 0<this.speed}}]),e}(),rp=function(){function t(){B(this,t),this.value,this.dir,this.movement=new sp}return m(t,[{key:"init",value:function(t,e,i,n,s){return this.value=t,this.end=s,this.dir=void 0!==s?t<s:e,this.movement.setSpeed(i).setAcceleration(-n),this}},{key:"stop",value:function(){this.movement.reset()}},{key:"update",value:function(t){var e=this.movement.getDeltaValue(t);return this.dir||(e=-e),void 0===this.end?this.value+=e:0===e?this.value=this.end:(this.value+=e,this.dir?this.value>this.end&&(this.value=this.end):this.value<this.end&&(this.value=this.end)),this}},{key:"isMoving",get:function(){return this.movement.isMoving}}]),t}(),op=Phaser.Utils.Objects.GetValue,ap=Phaser.Math.Clamp,hp=function(){w(h,fo);var a=T(h);function h(t,e){var i;B(this,h),i=a.call(this,t,e);var n=op(e,"enable",!0);i._state=new Qf(z(i),{enable:n,eventEmitter:!1});var s={inputConfig:op(e,"inputConfig",void 0),enable:n,pointerOutRelease:op(e,"pointerOutRelease",!0),eventEmitter:!1};i.dragState=new ip(t,s),i._enable=void 0,i._value=void 0,i._slowDown=new rp;var r=op(e,"valuechangeCallback",null);if(null!==r){var o=op(e,"valuechangeCallbackScope",void 0);i.on("valuechange",r,o)}if(null!==(r=op(e,"overmaxCallback",null))){o=op(e,"overmaxCallbackScope",void 0);i.on("overmax",r,o)}if(null!==(r=op(e,"overminCallback",null))){o=op(e,"overminCallbackScope",void 0);i.on("overmin",r,o)}return i.resetFromJSON(e),i.boot(),i}return m(h,[{key:"resetFromJSON",value:function(t){this.setOrientationMode(op(t,"orientation",0)),this.setDragThreshold(op(t,"threshold",10)),this.setSlidingDeceleration(op(t,"slidingDeceleration",5e3)),this.setBackDeceleration(op(t,"backDeceleration",2e3));var e=op(t,"bounds",void 0);return e?this.setBounds(e):this.setBounds(op(t,"max",0),op(t,"min",0)),this.setValue(op(t,"value",this.maxValue||0)),this.setEnable(op(t,"enable",!0)),this}},{key:"boot",value:function(){this.scene.events.on("update",this._state.update,this._state)}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.events.off("update",this._state.update,this._state),this._state.destroy(t),this.dragState.destroy(t),this._state=void 0,this.dragState=void 0,O(C(h.prototype),"shutdown",this).call(this,t))}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return this._enable=t,this._state.setEnable(t),this.dragState.setEnable(t),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setOrientationMode",value:function(t){return"string"==typeof t&&(t=lp[t]),this.orientationMode=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setSlidingDeceleration",value:function(t){return this.slidingDeceleration=t,this}},{key:"setBackDeceleration",value:function(t){return this.backDeceleration=t,this}},{key:"setBounds",value:function(t,e){if(Array.isArray(t)){var i=t;t=i[0],e=i[1]}return t<e?(this.minValue=t,this.maxValue=e):(this.minValue=e,this.maxValue=t),this}},{key:"value",get:function(){return this._value},set:function(t){if(t!==this._value){var e=this._value,i=this.overMax(t),n=this.overMin(t);i&&this.emit("overmax",t,e),n&&this.emit("overmin",t,e),this.backEnable||(i&&(t=this.maxValue),n&&(t=this.minValue)),this._value=t,this.emit("valuechange",t,e)}}},{key:"setValue",value:function(t,e){return void 0===e&&(e=!1),e&&(t=ap(t,this.minValue,this.maxValue)),this.value=t,this}},{key:"addValue",value:function(t,e){return this.setValue(this.value+t,e),this}},{key:"state",get:function(){return this._state.state}},{key:"isDragging",get:function(){return this.dragState.isInTouched}},{key:"outOfMaxBound",get:function(){return this.overMax(this.value)}},{key:"outOfMinBound",get:function(){return this.overMin(this.value)}},{key:"outOfBounds",get:function(){return this.outOfMinBound||this.outOfMaxBound}},{key:"overMax",value:function(t){return null!=this.maxValue&&t>this.maxValue}},{key:"overMin",value:function(t){return null!=this.minValue&&t<this.minValue}},{key:"backEnable",get:function(){return"number"==typeof this.backDeceleration}},{key:"isPullBack",get:function(){return this._slowDown.isMoving}},{key:"slidingEnable",get:function(){return"number"==typeof this.slidingDeceleration}},{key:"isSliding",get:function(){return this._slowDown.isMoving}},{key:"dragDelta",get:function(){return 0===this.orientationMode?this.dragState.dy:1===this.orientationMode?this.dragState.dx:0}},{key:"dragSpeed",get:function(){return 0===this.orientationMode?this.dragState.speedY:1===this.orientationMode?this.dragState.speedX:0}},{key:"dragging",value:function(){this.value+=this.dragDelta}},{key:"onSliding",value:function(){var t=this.value,e=this.dragSpeed;if(0===e)return this._slowDown.stop(),void this._state.next();var i=this.slidingDeceleration;this._slowDown.init(t,0<e,Math.abs(e),i)}},{key:"sliding",value:function(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}},{key:"onPullBack",value:function(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),n=this.backDeceleration,s=Math.sqrt(2*n*i);this._slowDown.init(t,void 0,s,n,e)}},{key:"pullBack",value:function(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}},{key:"stop",value:function(){this._slowDown.stop()}}]),h}(),lp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},up=Phaser.Utils.Objects.GetValue,cp=function(){w(s,fo);var n=T(s);function s(t,e){var i;(B(this,s),(i=n.call(this,t,e)).parent!==i.scene?i.focusMode=up(e,"focus",!1):i.focusMode=!1,i.setSpeed(up(e,"speed",.1)),i.setEnable(up(e,"enable",!0)),i.focusMode)?(t=i.parent).setInteractive(up(e,"inputConfig",void 0)).on("wheel",function(t,e,i,n,s){this.enable&&this.scroll(i)},z(i)):i.scene.input.on("wheel",i.onSceneScroll,z(i));return i}return m(s,[{key:"destroy",value:function(){this.focusMode||this.scene.input.off("wheel",this.onSceneScroll,this)}},{key:"onSceneScroll",value:function(t,e,i,n){this.enable&&this.scroll(n)}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"scroll",value:function(t){t*=this.speed,this.emit("scroll",t,this.parent,this)}}]),s}(),dp=Phaser.Utils.Objects.GetValue,fp={right:0,left:1,bottom:0,top:1},pp=Phaser.Utils.Objects.GetValue,vp=Phaser.Math.Clamp,gp=function(){w(p,td);var f=T(p);function p(t,e){var i;B(this,p),void 0===e&&(e={});var n=Kf(e);e.orientation=0===n?1:0,(i=f.call(this,t,e)).type=pp(e,"type","rexScrollable");var s=pp(e,"background",void 0),r=function(e,t){var i,n=e.scene,s=Kf(t),r=new td(n,{orientation:s}),o=dp(t,"child.gameObject",void 0),a=dp(t,"slider",void 0),h=dp(a,"position",0);"string"==typeof h&&(h=fp[h]);var l,u,c=0===h,d=dp(t,"scroller",!0),f=dp(t,"mouseWheelScroller",!1);if(o){var p=dp(t,"space.child",0),v={};if(e.childMargin={},"number"!=typeof p){var g=p;0===s?(v.left=dp(g,"left",0),v.right=dp(g,"right",0),e.childMargin.top=dp(g,"top",0),e.childMargin.bottom=dp(g,"bottom",0)):(v.top=dp(g,"top",0),v.bottom=dp(g,"bottom",0),e.childMargin.top=dp(g,"left",0),e.childMargin.bottom=dp(g,"right",0))}else a&&(v=0===s?c?{right:p}:{left:p}:c?{bottom:p}:{top:p}),e.childMargin.top=0,e.childMargin.bottom=0;a&&(!0===a&&(a={}),a.orientation=0===r.orientation?1:0,i=new Xf(n,a)),d&&(!0===d&&(d={}),d.orientation=s,l=new hp(o,d)),f&&(u=new cp(o,f)),i&&!c&&r.add(i,{proportion:0,align:"center",expand:!0});var y=dp(t,"child.proportion",1),k=dp(t,"child.expand",!0);r.add(o,{proportion:y,align:"center",padding:v,expand:k}),i&&c&&r.add(i,{proportion:0,align:"center",expand:!0})}return i&&i.on("valuechange",function(t){e.t=t,e.emit("scroll",e)}),l&&l.on("valuechange",function(t){e.childOY=t,e.emit("scroll",e)}),u&&u.on("scroll",function(t){e.addChildOY(-t,!0)}),e.addChildrenMap("child",o),e.addChildrenMap("slider",i),e.addChildrenMap("scroller",l),e.addChildrenMap("mouseWheelScroller",u),r}(z(i),e),o=pp(e,"header",void 0),a=pp(e,"footer",void 0);if(s&&i.addBackground(s),o){var h=pp(e,"align.header","center"),l=pp(e,"space.header",0);c=0===n?{bottom:l}:{right:l};var u=pp(e,"expand.header",!0);i.add(o,{proportion:0,align:h,padding:c,expand:u})}if(r&&i.add(r,{proportion:1,align:"center",padding:0,expand:!0}),a){h=pp(e,"align.footer","center");var c,d=pp(e,"space.footer",0);c=0===n?{top:d}:{left:d};u=pp(e,"expand.footer",!0);i.add(a,{proportion:0,align:h,padding:c,expand:u})}return i.addChildrenMap("background",s),i.addChildrenMap("header",o),i.addChildrenMap("footer",a),i}return m(p,[{key:"runLayout",value:function(t,e,i){return this.ignoreLayout||(O(C(p.prototype),"runLayout",this).call(this,t,e,i),this.resizeController()),this}},{key:"t",get:function(){var t=this.childrenMap.child.t,e=this.childMargin;if(0!==e.top||0!==e.bottom){var i=this.childrenMap.child,n=i.topChildOY-i.bottomChildOY,s=n+e.top+e.bottom;t=(n*t+e.top)/s}return t},set:function(t){var e=this.childMargin;if(0!==e.top||0!==e.bottom){var i=this.childrenMap.child,n=i.topChildOY-i.bottomChildOY;t=((n+e.top+e.bottom)*t-e.top)/n}this.childrenMap.child.t=t,this.updateController()}},{key:"childOY",get:function(){return this.childrenMap.child.childOY},set:function(t){this.childrenMap.child.childOY=t,this.updateController()}},{key:"topChildOY",get:function(){return this.childrenMap.child.topChildOY+this.childMargin.top}},{key:"bottomChildOY",get:function(){return this.childrenMap.child.bottomChildOY-this.childMargin.bottom}},{key:"isOverflow",get:function(){var t=this.childrenMap.child;return t.topChildOY!==t.bottomChildOY}},{key:"scrollMode",get:function(){return 0===this.orientation?1:0}},{key:"setChildOY",value:function(t,e){return void 0===e&&(e=!1),e&&(t=vp(t,this.bottomChildOY,this.topChildOY)),this.childOY=t,this}},{key:"addChildOY",value:function(t,e){return this.setChildOY(this.childOY+t,e),this}},{key:"setT",value:function(t,e){return void 0===e&&(e=!1),e&&(t=vp(t,0,1)),this.t=t,this}},{key:"addT",value:function(t,e){return this.setT(this.t+t,e),this}},{key:"scrollToTop",value:function(){return this.t=0,this}},{key:"scrollToBottom",value:function(){return this.t=1,this}},{key:"sliderEnable",get:function(){var t=this.childrenMap.slider;return!!t&&t.enable},set:function(t){var e=this.childrenMap.slider;e&&e.setEnable(t)}},{key:"setSliderEnable",value:function(t){return void 0===t&&(t=!0),this.sliderEnable=t,this}},{key:"scrollerEnable",get:function(){var t=this.childrenMap.scroller;return!!t&&t.enable},set:function(t){var e=this.childrenMap.scroller;e&&e.setEnable(t)}},{key:"setScrollerEnable",value:function(t){return void 0===t&&(t=!0),this.scrollerEnable=t,this}},{key:"mouseWheelScrollerEnable",get:function(){var t=this.childrenMap.mouseWheelScroller;return!!t&&t.enable},set:function(t){var e=this.childrenMap.mouseWheelScrollerEnable;e&&e.setEnable(t)}},{key:"setMouseWheelScrollerEnable",value:function(t){return void 0===t&&(t=!0),this.mouseWheelScrollerEnable=t,this}}]),p}(),yp={resizeController:function(){var t=this.topChildOY,e=this.bottomChildOY,i=this.childrenMap.scroller,n=this.childrenMap.slider;return i&&i.setBounds(e,t),n&&n.setEnable(e!==t),this.updateController(),this},updateController:function(){var t=this.childrenMap.scroller,e=this.childrenMap.slider;t&&t.setValue(this.childOY),e&&e.setValue(this.t)}};Object.assign(gp.prototype,yp);var kp=function(){function i(t,e){B(this,i),this.container=null,this._deltaHeight=0,this.setParent(t)}return m(i,[{key:"setParent",value:function(t){this.parent=t,this.parentContainer=t.getParentContainer()}},{key:"destroy",value:function(t){void 0===t&&(t=!1),t||this.destroyContainer(),this.deltaHeight=0,this.data=void 0,this.container=null,this.parent=void 0,this.parentContainer=void 0}},{key:"table",get:function(){return this.parent}},{key:"scrollMode",get:function(){return this.parentContainer.scrollMode}},{key:"colIndx",get:function(){return this.parent.cellIndxeToColIndex(this.index)}},{key:"rowIndx",get:function(){return this.parent.cellIndxeToRowIndex(this.index)}},{key:"getContainer",value:function(){return this.container}},{key:"setContainer",value:function(t){return t?(this.container&&this.container.destroy(),this.container=t,this.parentContainer.add(t)):this.destroyContainer(),this}},{key:"destroyContainer",value:function(){return this.container&&(this.container.destroy(),this.container=null),this}},{key:"popContainer",value:function(){if(this.container){var t=this.container;return this.container=null,this.parentContainer.remove(t),t}return null}},{key:"setXY",value:function(t,e){return this.container&&this.parentContainer.setChildLocalPosition(this.container,t,e),this}},{key:"deltaHeight",get:function(){return this._deltaHeight},set:function(t){null==t&&(t=0);var e=this.parent;0===this._deltaHeight&&0!==t?e.nonZeroDeltaHeightCount++:0!==this._deltaHeight&&0===t&&e.nonZeroDeltaHeightCount--;var i=this._deltaHeight!==t;if(this._deltaHeight=t,i){e.resetTotalRowsHeight();var n=0===this.scrollMode?"cellheightchange":"cellwidthchange";this.parentContainer.emit(n,this,this.container,this.parentContainer)}}},{key:"deltaWidth",get:function(){return this.deltaHeight},set:function(t){this.deltaHeight=t}},{key:"setDeltaHeight",value:function(t){return this.deltaHeight=t,this}},{key:"setDeltaWidth",value:function(t){return this.deltaHeight=t,this}},{key:"height",get:function(){return 0===this.scrollMode?this.deltaHeight+this.parent.defaultCellHeight:this.parent.defaultCellWidth},set:function(t){1!==this.scrollMode&&this.setDeltaHeight(t-this.parent.defaultCellHeight)}},{key:"setHeight",value:function(t){return this.height=t,this}},{key:"width",get:function(){return 0===this.scrollMode?this.parent.defaultCellWidth:this.deltaHeight+this.parent.defaultCellHeight},set:function(t){0!==this.scrollMode&&this.setDeltaHeight(t-this.parent.defaultCellHeight)}},{key:"setWidth",value:function(t){return this.width=t,this}},{key:"scene",get:function(){return this.parentContainer.scene}}]),i}();Object.assign(kp.prototype,Sn);function mp(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask}function bp(t){if(this.emit("cellinvisible",t),this.cellContainersPool){var e=t.popContainer();e&&this.cellContainersPool.killAndHide(e)}t.destroyContainer()}function xp(){var t=this.preVisibleCells,e=this.visibleCells;t.iterate(function(t){e.contains(t)||bp.call(this,t)},this)}function Cp(t){var e,i=null;(e=t.getContainer())?(i=e,t.popContainer()):this.cellContainersPool&&null!==(i=this.cellContainersPool.getFirstDead())&&i.setActive(!0).setVisible(!0),this.emit("cellvisible",t,i,this),this.cellContainersPool&&((e=t.getContainer())?null===i?this.cellContainersPool.add(e):i!==e&&(this.cellContainersPool.add(e),this.cellContainersPool.killAndHide(i)):null!==i&&this.cellContainersPool.killAndHide(i))}function wp(t,e){e-=this.y+this.topLeftY,t-=this.x+this.topLeftX;var i=this.tableOY-(0===this.scrollMode?e:t),n=this.tableOX-(0===this.scrollMode?t:e),s=this.table,r=s.heightToRowIndex(-i),o=s.widthToColIndex(-n),a=s.colRowToCellIndex(o,r);return null!==a&&this.isCellVisible(a)?a:null}var Sp=Phaser.Utils.Objects.GetValue,Pp=Phaser.Utils.Array.SpliceOne,Tp=function(){function i(t,e){B(this,i),this.parent=t,this.cells=[],this.cellPool=new Kt,this.resetFromJSON(e)}return m(i,[{key:"resetFromJSON",value:function(t){return this.colCount=void 0,this.nonZeroDeltaHeightCount=0,this.resetTotalRowsHeight(),this.setDefaultCellHeight(Sp(t,"cellHeight",30)),this.setDefaultCellWidth(Sp(t,"cellWidth",30)),this.initCells(Sp(t,"cellsCount",0)),this.setColumnCount(Sp(t,"columns",1)),this}},{key:"destroy",value:function(){this.cellPool.destroy(),this.cells=void 0,this.parent=void 0}},{key:"defaultCellHeightMode",get:function(){return 0===this.nonZeroDeltaHeightCount}},{key:"setDefaultCellHeight",value:function(t){return this.defaultCellHeight=t,this}},{key:"setDefaultCellWidth",value:function(t){return this.defaultCellWidth=t,this}},{key:"initCells",value:function(t){var e=this.cells;e.length=t;for(var i=0;i<t;i++)e[i]=null;return this}},{key:"insertNewCells",value:function(t,e){var i=this.cells;if(t===i.length){var n=t+e;i.legth=n;for(var s=t;s<n;s++)i[s]=null}else{var r,o=[];o.length=e;for(s=0;s<e;s++)o[s]=null;(r=this.cells).splice.apply(r,[t,0].concat(o))}return this.resetTotalRowsHeight(),this}},{key:"removeCells",value:function(t,e){for(var i=t+e,n=t;n<i;n++)this.freeCell(n);return i===this.cells.length?this.cells.length=t:(1===e?Pp(this.cells,t):this.cells.splice(t,e),this.buildCellIndex(t)),this.resetTotalRowsHeight(),this}},{key:"setColumnCount",value:function(t){return this.colCount=t,this.resetTotalRowsHeight(),this}},{key:"rowCount",get:function(){return Math.ceil(this.cells.length/this.colCount)}},{key:"cellsCount",get:function(){return this.cells.length}},{key:"isValidCellIdx",value:function(t){return 0<=t&&t<this.cells.length}},{key:"heightToRowIndex",value:function(t,e){if(this.defaultCellHeightMode){var i=t/this.defaultCellHeight;return i=e?Math.ceil(i):Math.floor(i)}var n,s=this.rowCount,r=t;for(i=0;;){if(n=0<=i&&i<s,!(0<(r-=this.getRowHeight(i))&&n)){if(0===r)return i;if(e){var o=i;(n=0<=(i+=1)&&i<s)||(i=o)}return i}i+=1}}},{key:"widthToColIndex",value:function(t,e){var i=t/this.defaultCellWidth;return i=e?Math.ceil(i):Math.floor(i)}},{key:"colRowToCellIndex",value:function(t,e){return t>=this.colCount?null:e*this.colCount+t}},{key:"rowIndexToHeight",value:function(t,e){if(this.defaultCellHeightMode)return(e-t+1)*this.defaultCellHeight;for(var i=0,n=t;n<=e;n++)i+=this.getRowHeight(n);return i}},{key:"colIndexToWidth",value:function(t,e){return(e-t+1)*this.defaultCellWidth}},{key:"getRowHeight",value:function(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,n=0,s=0;s<e;s++)n<(i=this.getCellHeight(this.colRowToCellIndex(s,t)))&&(n=i);return n}},{key:"getColWidth",value:function(){return this.defaultCellWidth}},{key:"getCellHeight",value:function(t){if(!this.isValidCellIdx(t))return 0;var e;if(this.defaultCellHeightMode)e=this.defaultCellHeight;else{var i=this.getCell(t,!1),n=i?i.deltaHeight:0;e=this.defaultCellHeight+n}return e}},{key:"resetTotalRowsHeight",value:function(){this._totalRowsHeight=null}},{key:"totalRowsHeight",get:function(){return null===this._totalRowsHeight&&(this._totalRowsHeight=this.rowIndexToHeight(0,this.rowCount-1)),this._totalRowsHeight}},{key:"totalColumnWidth",get:function(){return this.colCount*this.defaultCellWidth}},{key:"cellIndxeToColIndex",value:function(t){return t%this.colCount}},{key:"cellIndxeToRowIndex",value:function(t){return Math.floor(t/this.colCount)}},{key:"getCell",value:function(t,e){if(!this.isValidCellIdx(t))return null;if(void 0===e&&(e=!0),null===this.cells[t]&&e){var i=this.newCell(t);this.cells[t]=i}return this.cells[t]}},{key:"newCell",value:function(t){var e=this.cellPool.pop();return null===e?e=new kp(this):e.setParent(this),e.index=t,e}},{key:"buildCellIndex",value:function(t){void 0===t&&(t=0);for(var e,i=this.cells,n=t,s=i.length;n<s;n++)(e=i[n])&&(e.index=n);return this}},{key:"getParentContainer",value:function(){return this.parent}},{key:"freeCell",value:function(t){return"number"==typeof t&&(t=this.cells[t]),t&&(t.destroy(),this.cellPool.push(t)),this}}]),i}(),Op=Phaser.Geom.Intersects.RectangleToRectangle,Mp=Phaser.Geom.Rectangle.Overlaps,Ep=function(t){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}},_p=function(t,e){var i=0,n=e.top,s=e.bottom,r=e.left,o=e.right;return i+=t.contains(r,n)?1:0,i+=t.contains(r,s)?1:0,i+=t.contains(o,n)?1:0,i+=t.contains(o,s)?1:0},Bp=function(t,e){t.setChildMaskVisible(e,!0),e.clearMask&&e.clearMask()},zp=function(t,e,i){t.setChildMaskVisible(e,!0),e.setMask&&e.setMask(i)},Rp=function(t,e){t.setChildMaskVisible(e,!1),e.clearMask&&e.clearMask()},Ip=Phaser.Utils.Objects.GetValue,Dp={update:0,everyTick:1},Lp={setupChildrenMask:function(t){return!1===t||(this.setMaskUpdateMode(Ip(t,"updateMode",0)),this.enableChildrenMask(Ip(t,"padding",0)),this.setMaskLayer(Ip(t,"layer",void 0)),this.startMaskUpdate()),this},destroyChildrenMask:function(){return this.childrenMask&&(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0),this},setMaskUpdateMode:function(t){return"string"==typeof t&&(t=Dp[t]),this.maskUpdateMode=t,this},startMaskUpdate:function(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate:function(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask:function(t){var e=Ed.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag:function(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer:function(t){return this.maskLayer=t,this},maskChildren:function(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible&&(this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function(t,e,i){if(e){void 0===i&&(i=t.getAllChildren());for(var n,s,r=t.getBounds(),o=mp(e),a=0,h=i.length;a<h;a++)if(!(n=i[a]).hasOwnProperty("isRexContainerLite")&&n!==o&&Ep(n))if(n.getBounds)switch(s=n.getBounds(s),_p(r,s)){case 4:Bp(t,n);break;case 0:Op(r,s)||Mp(r,s)?zp(t,n,e):Rp(t,n);break;default:zp(t,n,e)}else zp(t,n,e)}}(this,this.childrenMask,this.getAllChildren(),this.maskLayer),0===this.maskUpdateMode&&(this.maskChildrenFlag=!1)),this},layoutChildrenMask:function(){if(!this.childrenMask)return this;var t=mp(this.childrenMask);return t.setPosition().resize(),this.resetChildPositionState(t),this}},jp=function(t){var e=0===this.scrollMode?this.topLeftX:this.topLeftY;return this.tableOX+this.table.colIndexToWidth(0,t-1)+e},Ap=function(t){var e=0===this.scrollMode?this.topLeftY:this.topLeftX;return this.tableOY+this.table.rowIndexToHeight(0,t-1)+e},Fp=function(){var t=this.preVisibleCells;this.preVisibleCells=this.visibleCells,this.visibleCells=t,this.visibleCells.clear()},Yp=Phaser.Math.Clamp,Vp={setTableOY:function(t){var e=this.table,i=this.topTableOY,n=this.bottomTableOY,s=t>this.topTableOY,r=t<this.bottomTableOY;this.clampTableOXY&&(e.rowCount<e.heightToRowIndex(this.instHeight,!0)?t=0:s?t=i:r&&(t=n));return this._tableOY!==t&&(this._tableOY=t),s&&(this.execeedTopState||this.emit("execeedtop",this,t,i)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,n)),this.execeedBottomState=r,this},setTableOX:function(t){var e=this.table,i=this.leftTableOX,n=this.rightTableOX,s=t>this.leftTableOX,r=t<this.rightTableOX;this.clampTableOXY&&(e.colCount<e.widthToColIndex(this.instWidth,!0)?t=0:s?t=i:r&&(t=n));return this._tableOX!==t&&(this._tableOX=t),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,i)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,n)),this.execeedRightState=r,this},updateTable:function(t){return void 0===t&&(t=!1),t&&(Fp.call(this),xp.call(this)),Fp.call(this),function(){if(0!==this.cellsCount){var t=this.table,e=t.heightToRowIndex(-this.tableOY);e<=0&&(e=0);var i=e,n=t.widthToColIndex(-this.tableOX);n<=0&&(n=0);for(var s=n,r=t.colRowToCellIndex(s,i),o=this.bottomBound,a=this.rightBound,h=t.cellsCount-1,l=t.colCount-1,u=jp.call(this,s),c=u,d=Ap.call(this,i);d<o&&r<=h;){if(this.table.isValidCellIdx(r)){var f=t.getCell(r,!0);this.visibleCells.set(f),this.preVisibleCells.contains(f)||Cp.call(this,f),0===this.scrollMode?f.setXY(c,d):f.setXY(d,c)}c<a&&s<l?(c+=t.getColWidth(s),s+=1):(c=u,d+=t.getRowHeight(i),s=n,i+=1),r=t.colRowToCellIndex(s,i)}}}.call(this),xp.call(this),this.setMaskChildrenFlag(),this},isCellVisible:function(t){var e=this.table.getCell(t,!1);return e&&this.visibleCells.contains(e)},pointToCellIndex:wp,pointToCellContainer:function(t,e){var i=wp.call(this,t,e);if(null!==i)return this.getCellContainer(i)},eachVisibleCell:function(t,e){return this.visibleCells.each(t,e),this},iterateVisibleCell:function(t,e){return this.visibleCells.iterate(t,e),this},eachCell:function(t,e){return this.table.cells.slice().forEach(t,e),this},iterateCell:function(t,e){return this.table.cells.forEach(t,e),this},setCellsCount:function(t){var e=this.cellsCount;return e===t||(t<e?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return"object"===P(t)&&(t=t.index),void 0===e&&(e=1),e<=0||(t=Yp(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"===P(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,n=t,s=t+e;n<s;n++)(i=this.getCell(n,!1))&&(this.visibleCells.contains(i)&&(bp.call(this,i),this.visibleCells.delete(i)),this.preVisibleCells.delete(i));return this.table.removeCells(t,e),this},setColumnCount:function(t){return this.table.colCount===t||this.table.setColumnCount(t),this},setGridSize:function(t,e){return this.setCellsCount(t*e),this.table.setColumnCount(t),this},updateVisibleCell:function(t){var e=this.table.getCell(t,!1);return e&&e.container&&Cp.call(this,e),this}};Object.assign(Vp,Lp);var Wp=Phaser.GameObjects.Group,Gp=Phaser.Structs.Set,Up=Phaser.Utils.Objects.GetValue,Hp=function(){w(f,mn);var d=T(f);function f(t,e,i,n,s,r){var o;B(this,f),void 0===r&&(r={}),(o=d.call(this,t,e,i,n,s)).type="rexGridTable",o._tableOX=0,o._tableOY=0,o.visibleCells=new Gp,o.preVisibleCells=new Gp,o.execeedTopState=!1,o.execeedBottomState=!1,o.execeedLeftState=!1,o.execeedRightState=!1,Up(r,"reuseCellContainer",!1)&&(o.cellContainersPool=new Wp(t));var a=Up(r,"cellVisibleCallback",null);if(null!==a){var h=Up(r,"cellVisibleCallbackScope",void 0);o.on("cellvisible",a,h)}if(null!==(a=Up(r,"cellInvisibleCallback",null))){h=Up(r,"cellInvisibleCallbackScope",void 0);o.on("cellinvisible",a,h)}if(o.setupChildrenMask(Up(r,"mask",void 0)),o.setScrollMode(Up(r,"scrollMode",0)),o.setClampMode(Up(r,"clamplTableOXY",!0)),0===o.scrollMode){var l=Up(r,"cellWidth",void 0);if(o.expandCellSize=void 0===l,void 0===l){var u=Up(r,"columns",1);r.cellWidth=o.width/u}}else{l=Up(r,"cellHeight",void 0);var c=Up(r,"cellWidth",void 0);o.expandCellSize=void 0===l,r.cellWidth=l,r.cellHeight=c}return o.table=new Tp(z(o),r),o.updateTable(),o}return m(f,[{key:"destroy",value:function(t){this.scene&&(this.destroyChildrenMask(),this.table.destroy(t),this.table=void 0,this.cellContainersPool&&(this.cellContainersPool.destroy(!0),this.cellContainersPool=void 0),O(C(f.prototype),"destroy",this).call(this,t))}},{key:"setScrollMode",value:function(t){return"string"==typeof t&&(t=Np[t.toLowerCase()]),this.scrollMode=t,this}},{key:"setClampMode",value:function(t){return void 0===t&&(t=!0),this.clampTableOXY=t,this}},{key:"tableOY",get:function(){return this._tableOY},set:function(t){this.setTableOY(t).updateTable()}},{key:"tableOX",get:function(){return this._tableOX},set:function(t){this.setTableOX(t).updateTable()}},{key:"setTableOXY",value:function(t,e){return this.setTableOY(e).setTableOX(t),this}},{key:"addTableOY",value:function(t){return this.setTableOY(this.tableOY+t),this}},{key:"addTableOX",value:function(t){return this.setTableOX(this.tableOX+t),this}},{key:"addTableOXY",value:function(t,e){return this.addTableOY(e).addTableOX(t),this}},{key:"setTableOYByPercentage",value:function(t){return this.setTableOY(-this.tableVisibleHeight*t),this}},{key:"getTableOYPercentage",value:function(){var t=this.tableVisibleHeight;return 0===t?0:this.tableOY/-t}},{key:"t",get:function(){return this.getTableOYPercentage()},set:function(t){this.setTableOYByPercentage(t).updateTable()}},{key:"getCell",value:function(t){return this.table.getCell(t,!0)}},{key:"getCellContainer",value:function(t){var e,i=this.table.getCell(t,!1);return i&&(e=i.getContainer()),e}},{key:"cellsCount",get:function(){return this.table.cellsCount}},{key:"columnCount",get:function(){return this.table.colCount}},{key:"setCellHeight",value:function(t,e){return("number"==typeof t?this.table.getCell(t,!0):t).height=e,this}},{key:"setCellWidth",value:function(t,e){return("number"==typeof t?this.table.getCell(t,!0):t).width=e,this}},{key:"instHeight",get:function(){return 0===this.scrollMode?this.height:this.width}},{key:"instWidth",get:function(){return 0===this.scrollMode?this.width:this.height}},{key:"tableHeight",get:function(){return this.table.totalRowsHeight}},{key:"tableWidth",get:function(){return this.table.totalColumnWidth}},{key:"topTableOY",get:function(){return 0}},{key:"bottomTableOY",get:function(){return-this.tableVisibleHeight}},{key:"leftTableOX",get:function(){return 0}},{key:"rightTableOX",get:function(){return-this.tableVisibleWidth}},{key:"tableVisibleHeight",get:function(){var t=this.tableHeight,e=this.instHeight;return e<t?t-e:0}},{key:"tableVisibleWidth",get:function(){var t=this.tableWidth,e=this.instWidth;return e<t?t-e:0}},{key:"bottomLeftY",get:function(){return-(this.displayHeight*this.originY)+this.displayHeight}},{key:"topRightX",get:function(){return-(this.displayWidth*this.originX)+this.displayWidth}},{key:"topLeftX",get:function(){return-(this.displayWidth*this.originX)}},{key:"topLeftY",get:function(){return-(this.displayHeight*this.originY)}},{key:"bottomBound",get:function(){return 0===this.scrollMode?this.bottomLeftY:this.topRightX}},{key:"rightBound",get:function(){return 0===this.scrollMode?this.topRightX:this.bottomLeftY}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(O(C(f.prototype),"resize",this).call(this,t,e),this.expandCellSize&&this.table.setDefaultCellWidth(this.instWidth/this.table.colCount),this.updateTable(!0),this.layoutChildrenMask(),this.maskChildren()),this}}]),f}();Object.assign(Hp.prototype,Vp);function Xp(t,e,i,n,s,r,o){var a;if(null!=(a=void 0===s?n:i.pointToCellIndex(n,s))){var h=i.getCellContainer(a);h&&t.emit(e,h,a,r,o)}}var Np={v:0,vertical:0,h:1,horizontal:1},Jp=function(t,e,i,n){var s=this.childrenMap.child,r=s.pointToCellIndex(t.x,t.y);if(r!==s.input.lastOverCellIndex){var o=s.input.lastOverCellIndex;s.input.lastOverCellIndex=r,Xp(this.eventEmitter,"cell.out",s,o,void 0,t,n),Xp(this.eventEmitter,"cell.over",s,r,void 0,t,n)}},Kp=function(t,e){var i=this.childrenMap.child,n=i.input.lastOverCellIndex;i.input.lastOverCellIndex=void 0,Xp(this.eventEmitter,"cell.out",i,n,void 0,t,e)},Zp=Phaser.Utils.Objects.GetValue,qp=Phaser.Utils.Objects.GetValue,$p=function(){w(r,vo);var s=T(r);function r(t,e){var i;B(this,r);var n=As(t);return n===t&&(t=void 0),((i=s.call(this,n,e)).gameObject=t)&&t.setInteractive(qp(e,"inputConfig",void 0)),i._enable=void 0,i.resetFromJSON(e),i.boot(),i}return m(r,[{key:"resetFromJSON",value:function(t){return this.setEnable(qp(t,"enable",!0)),this.setDetectBounds(),void 0===this.gameObject?this.setDetectBounds(qp(t,"bounds",void 0)):this.setDetectBounds(),this.tracerState=Qp,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,this.isTouchingAnyObject=!1,this}},{key:"boot",value:function(){O(C(r.prototype),"boot",this).call(this),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("pointermove",this.onPointerMove,this),this.scene.events.once("shutdown",this.destroy,this)}},{key:"shutdown",value:function(t){this.scene&&(this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.events.off("shutdown",this.destroy,this),this.gameObject=void 0,this.bounds=void 0,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,O(C(r.prototype),"shutdown",this).call(this,t))}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setDetectBounds",value:function(t){return this.bounds=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(t,e){this.enable&&void 0===this.pointer&&(this.bounds&&!this.bounds.contains(t.x,t.y)||this.pointer===t||(this.pointer=t,this.lastPointer=t,this.movedState=!1,this.tracerState=tv,void 0===this.gameObject&&(this.isTouchingAnyObject=0<e.length),this.onDragStart()))}},{key:"onPointerUp",value:function(t){this.enable&&(this.bounds&&!this.bounds.contains(t.x,t.y)||this.pointer!==t||(this.pointer=void 0,this.movedState=!1,this.tracerState=Qp,this.onDragEnd()))}},{key:"onPointerMove",value:function(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()))}}},{key:"dragCancel",value:function(){return this.tracerState===tv&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Qp,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this)}},{key:"onDragEnd",value:function(){this.emit("dragend",this)}},{key:"onDrag",value:function(){this.emit("drag",this)}},{key:"preUpdate",value:function(){}},{key:"postUpdate",value:function(){}},{key:"startTicking",value:function(){O(C(r.prototype),"startTicking",this).call(this),this.scene.events.on("preupdate",this.preUpdate,this),this.scene.events.on("postupdate",this.postUpdate,this)}},{key:"stopTicking",value:function(){O(C(r.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.events.off("preupdate",this.preUpdate,this),this.scene.events.off("postupdate",this.postUpdate,this))}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t}},{key:"cancel",value:function(){return this.state=ev,this}}]),r}(),Qp=0,tv=1,ev="IDLE",iv=Phaser.Utils.Objects.GetValue,nv=Phaser.Math.Distance.Between,sv=function(){w(o,$p);var r=T(o);function o(t,e){var i;B(this,o);var n=z(i=r.call(this,t,e)),s={states:{IDLE:{enter:function(){n.stop(),n.tapsCount=0,n.x=0,n.y=0,n.worldX=0,n.worldY=0},exit:function(){var t=n.lastPointer;n.x=t.x,n.y=t.y,n.worldX=t.worldX,n.worldY=t.worldY}},BEGIN:{enter:function(){n.start(),n.tapsCount=0,n.emit("tappingstart",n,n.gameObject,n.lastPointer)}},RECOGNIZED:{enter:function(){n.start(),n.emit("tap",n,n.gameObject,n.lastPointer),n.emit("".concat(n.tapsCount,"tap"),n,n.gameObject,n.lastPointer)}}},init:function(){this.state=rv},eventEmitter:!1};return i.setRecongizedStateObject(new $f(s)),i}return m(o,[{key:"resetFromJSON",value:function(t){O(C(o.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(iv(t,"time",250)),this.setTapInterval(iv(t,"tapInterval",200)),this.setDragThreshold(iv(t,"threshold",9)),this.setTapOffset(iv(t,"tapOffset",10));var e=iv(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(iv(t,"maxTaps",void 0)),this.setMinTaps(iv(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){switch(this.state){case rv:this.state=ov;break;case ov:var t=this.lastPointer;nv(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=av,this.state=ov);break;case av:this.state=ov}}},{key:"onDragEnd",value:function(){this.state===ov&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=av))}},{key:"onDrag",value:function(){this.state!==rv&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rv)}},{key:"preUpdate",value:function(t){if(this.isRunning&&this.enable&&this.state===ov){var e=this.lastPointer;if(e.isDown)t-e.downTime>this.holdTime&&(this.state=rv);else t-e.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=av:this.state=rv)}}},{key:"postUpdate",value:function(){this.isRunning&&this.enable&&this.state===av&&(this.state=rv)}},{key:"isTapped",get:function(){return this.state===av}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),o}(),rv="IDLE",ov="BEGIN",av="RECOGNIZED",hv=Phaser.Utils.Objects.GetValue,lv=function(){w(o,$p);var r=T(o);function o(t,e){var i;B(this,o);var n=z(i=r.call(this,t,e)),s={states:{IDLE:{enter:function(){n.x=0,n.y=0,n.worldX=0,n.worldY=0},exit:function(){var t=n.lastPointer;n.x=t.x,n.y=t.y,n.worldX=t.worldX,n.worldY=t.worldY}},BEGIN:{enter:function(){n.start()},exit:function(){n.stop()}},RECOGNIZED:{enter:function(){n.emit("pressstart",n,n.gameObject,n.lastPointer)},exit:function(){n.emit("pressend",n,n.gameObject,n.lastPointer)}}},init:function(){this.state=uv},eventEmitter:!1};return i.setRecongizedStateObject(new $f(s)),i}return m(o,[{key:"resetFromJSON",value:function(t){return O(C(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(hv(t,"threshold",9)),this.setHoldTime(hv(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=cv,0===this.holdTime&&(this.state=dv)}},{key:"onDragEnd",value:function(){this.state=uv}},{key:"onDrag",value:function(){this.state!==uv&&this.pointer.getDistance()>this.dragThreshold&&(this.state=uv)}},{key:"preUpdate",value:function(t){this.isRunning&&this.enable&&this.state===cv&&t-this.pointer.downTime>=this.holdTime&&(this.state=dv)}},{key:"isPressed",get:function(){return this.state===dv}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(),uv="IDLE",cv="BEGIN",dv="RECOGNIZED",fv=Phaser.Utils.Objects.GetValue,pv=function(){w(o,$p);var r=T(o);function o(t,e){var i;B(this,o);var n=z(i=r.call(this,t,e)),s={states:{IDLE:{},BEGIN:{enter:function(){var t=n.pointer;n.startX=t.x,n.startY=t.y,n.startWorldX=t.worldX,n.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){n.emit("panstart",n,n.gameObject,n.lastPointer)},exit:function(){var t=n.lastPointer;n.endX=t.x,n.endY=t.y,n.endWorldX=t.worldX,n.endWorldY=t.worldY,n.emit("panend",n,n.gameObject,n.lastPointer)}}},init:function(){this.state=vv},eventEmitter:!1};return i.setRecongizedStateObject(new $f(s)),i}return m(o,[{key:"resetFromJSON",value:function(t){return O(C(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(fv(t,"threshold",10)),this}},{key:"onDragStart",value:function(){this.state=gv,0===this.dragThreshold&&(this.state=yv)}},{key:"onDragEnd",value:function(){this.state=vv}},{key:"onDrag",value:function(){switch(this.state){case gv:this.pointer.getDistance()>=this.dragThreshold&&(this.state=yv);break;case yv:var t=this.pointer.position,e=this.pointer.prevPosition;this.dx=t.x-e.x,this.dy=t.y-e.y;var i=this.pointer;this.x=i.x,this.y=i.y,this.worldX=i.worldX,this.worldY=i.worldY,this.emit("pan",this,this.gameObject,this.lastPointer)}}},{key:"isPanned",get:function(){return this.state===yv}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(),vv="IDLE",gv="BEGIN",yv="RECOGNIZED",kv=Phaser.Math.Distance.Between,mv=Phaser.Math.Angle.Between,bv={getDt:function(){return this.scene.sys.game.loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return kv(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 mv(e.x,e.y,t.x,t.y)}},xv={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Cv={},wv=Phaser.Utils.Objects.GetValue,Sv=Phaser.Math.RadToDeg,Pv=function(){w(o,$p);var r=T(o);function o(t,e){var i;B(this,o);var n=z(i=r.call(this,t,e)),s={states:{IDLE:{enter:function(){n.x=0,n.y=0,n.worldX=0,n.worldY=0},exit:function(){var t=n.lastPointer;n.x=t.x,n.y=t.y,n.worldX=t.worldX,n.worldY=t.worldY}},BEGIN:{enter:function(){n.validDrag=!1}},RECOGNIZED:{enter:function(){n.start(),n.updateDirectionStates(),n.emit("swipe",n,n.gameObject,n.lastPointer)},exit:function(){n.stop(),n.clearDirectionStates()}}},init:function(){this.state=Tv},eventEmitter:!1};return i.setRecongizedStateObject(new $f(s)),i.clearDirectionStates(),i}return m(o,[{key:"resetFromJSON",value:function(t){return O(C(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(wv(t,"threshold",10)),this.setVelocityThreshold(wv(t,"velocityThreshold",1e3)),this.setDirectionMode(wv(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=Ov}},{key:"onDragEnd",value:function(){this.state=Tv}},{key:"onDrag",value:function(){this.state===Ov&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Mv))}},{key:"postUpdate",value:function(){this.isRunning&&this.enable&&this.state===Mv&&(this.state=Tv)}},{key:"isSwiped",get:function(){return this.state===Mv}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return"string"==typeof t&&(t=xv[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Cv),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:90<t&&t<=270?i.left=!0:i.right=!0;break;case 2:45<t&&t<=135?i.down=!0:135<t&&t<=225?i.left=!0:225<t&&t<=315?i.up=!0:i.right=!0;break;case 3:22.5<t&&t<=67.5?(i.down=!0,i.right=!0):67.5<t&&t<=112.5?i.down=!0:112.5<t&&t<=157.5?(i.down=!0,i.left=!0):157.5<t&&t<=202.5?i.left=!0:202.5<t&&t<=247.5?(i.left=!0,i.up=!0):247.5<t&&t<=292.5?i.up=!0:(292.5<t&&t<=337.5&&(i.up=!0),i.right=!0)}}(Sv(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}();Object.assign(Pv.prototype,bv);var Tv="IDLE",Ov="BEGIN",Mv="RECOGNIZED",Ev=Phaser.Utils.Objects.GetValue,_v=Phaser.Utils.Array.SpliceOne,Bv=Phaser.Math.Distance.Between,zv=Phaser.Math.Angle.Between,Rv=function(){function n(t,e){B(this,n);var i=t.input.manager.pointersTotal-1;i<2&&t.input.addPointer(2-i),this.scene=t,this.setEventEmitter(Ev(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}return m(n,[{key:"resetFromJSON",value:function(t){return this.setEnable(Ev(t,"enable",!0)),this.bounds=Ev(t,"bounds",void 0),this.tracerState=Lv,this.pointers.length=0,Ot(this.movedState),this}},{key:"boot",value:function(){this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.events.once("shutdown",this.destroy,this)}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Ot(this.movedState),this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.events.off("shutdown",this.destroy,this),this.scene=void 0)}},{key:"destroy",value:function(){this.shutdown()}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case Lv:this.tracerState=jv,this.onDrag1Start();break;case jv:this.tracerState=Av,this.onDrag2Start()}}},{key:"onPointerUp",value:function(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],_v(this.pointers,e),this.tracerState){case jv:this.tracerState=Lv,this.onDrag1End();break;case Av:this.tracerState=jv,this.onDrag2End(),this.onDrag1Start()}}}},{key:"onPointerMove",value:function(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)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 jv:this.onDrag1();break;case Av:this.onDrag2()}}}},{key:"dragCancel",value:function(){return this.tracerState===Av&&this.onDrag2End(),this.pointers.length=0,Ot(this.movedState),this.tracerState=Lv,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this)}},{key:"onDrag1End",value:function(){this.emit("drag1end",this)}},{key:"onDrag1",value:function(){this.emit("drag1",this)}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this)}},{key:"onDrag2End",value:function(){this.emit("drag2end",this)}},{key:"onDrag2",value:function(){this.emit("drag2",this)}},{key:"distanceBetween",get:function(){if(this.tracerState!==Av)return 0;var t=this.pointers[0],e=this.pointers[1];return Bv(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==Av)return 0;var t=this.pointers[0],e=this.pointers[1];return zv(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Dv.x=e.x-i.x,Dv.y=e.y-i.y}else Dv.x=0,Dv.y=0;return Dv}},{key:"centerX",get:function(){if(this.tracerState!==Av)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==Av)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==Av)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==Av)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t}},{key:"cancel",value:function(){return this.state=Fv,this}}]),n}();Object.assign(Rv.prototype,vs);function Iv(t,e,i,n){return Hv(t,e,i,n),t.rotation+=n,t}var Dv={},Lv=0,jv=1,Av=2,Fv="IDLE",Yv=Phaser.Utils.Objects.GetValue,Vv=function(){w(o,Rv);var r=T(o);function o(t,e){var i;B(this,o);var n=z(i=r.call(this,t,e)),s={states:{IDLE:{enter:function(){n.prevDistance=void 0,n.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){n.emit("pinchstart",n)},exit:function(){n.emit("pinchend",n)}}},init:function(){this.state=Wv},eventEmitter:!1};return i.setRecongizedStateObject(new $f(s)),i}return m(o,[{key:"resetFromJSON",value:function(t){return O(C(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Yv(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=Gv,0===this.dragThreshold&&(this.state=Uv)}},{key:"onDrag2End",value:function(){this.state=Wv}},{key:"onDrag2",value:function(){switch(this.state){case Gv: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=Uv}break;case Uv:t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}},{key:"isPinched",get:function(){return this.state===Uv}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(),Wv="IDLE",Gv="BEGIN",Uv="RECOGNIZED",Hv=Phaser.Math.RotateAround,Xv={},Nv=Phaser.Utils.Objects.GetValue,Jv=Phaser.Math.Angle.WrapDegrees,Kv=Phaser.Math.Angle.ShortestBetween,Zv=Phaser.Math.RadToDeg,qv=Phaser.Math.DegToRad,$v=function(){w(o,Rv);var r=T(o);function o(t,e){var i;B(this,o);var n=z(i=r.call(this,t,e)),s={states:{IDLE:{enter:function(){n.prevAngle=void 0,n.angle=0}},BEGIN:{},RECOGNIZED:{enter:function(){n.emit("rotatestart",n)},exit:function(){n.emit("rotateend",n)}}},init:function(){this.state=eg},eventEmitter:!1};return i.setRecongizedStateObject(new $f(s)),i}return m(o,[{key:"resetFromJSON",value:function(t){return O(C(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Nv(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Jv(Zv(this.angleBetween)),this.state=ig,0===this.dragThreshold&&(this.state=ng)}},{key:"onDrag2End",value:function(){this.state=eg}},{key:"onDrag2",value:function(){switch(this.state){case ig:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Jv(Zv(this.angleBetween));this.angle=Kv(this.prevAngle,t),this.prevAngle=t,this.state=ng}break;case ng:t=Jv(Zv(this.angleBetween));this.angle=Kv(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}},{key:"isRotated",get:function(){return this.state===ng}},{key:"rotation",get:function(){return qv(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(),Qv={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY;e.getWorldPoint(this.centerX,this.centerY,Xv);var s=Xv.x,r=Xv.y,o=this.rotation;if(Array.isArray(t))for(var a=t,h=0,l=a.length;h<l;h++)(t=a[h]).x+=i,t.y+=n,Iv(t,s,r,o);else t.x+=i,t.y+=n,Iv(t,s,r,o);return this}};Object.assign($v.prototype,Qv);function tg(t,e){t.setInteractive(),function(s){s.on("pointerdown",function(t,e,i,n){Xp(this.eventEmitter,"cell.down",s,t.x,t.y,t,n)},this).on("pointerup",function(t,e,i,n){Xp(this.eventEmitter,"cell.up",s,t.x,t.y,t,n)},this)}.call(this,t,e),function(t){t.on("pointermove",Jp,this).on("pointerover",Jp,this).on("pointerout",Kp,this)}.call(this,t,e),function(t,e){var i=Zp(e,"click",void 0);!1!==i&&(void 0===i&&(i={}),i.threshold=10,t._click=new Ql(t,i),t._click.on("click",function(t,e,i,n){Xp(this.eventEmitter,"cell.click",e,i.x,i.y,i,n)},this))}.call(this,t,e),function(t,e){var i=sg(e,"tap",void 0);!1!==i&&(t._tap=new sv(t,i),t._tap.on("tap",function(t,e,i){var n="cell.".concat(t.tapsCount,"tap");Xp(this.eventEmitter,n,t.gameObject,t.x,t.y,i)},this))}.call(this,t,e),function(n,t){var e=rg(t,"press",void 0);!1!==e&&(n._press=new lv(n,e),n._press.on("pressstart",function(t,e,i){Xp(this.eventEmitter,"cell.pressstart",n,t.x,t.y,i)},this).on("pressend",function(t,e,i){Xp(this.eventEmitter,"cell.pressend",n,t.x,t.y,i)},this))}.call(this,t,e),function(s,t){var e=og(t,"swipe",void 0);!1!==e&&(void 0===e&&(e={}),e.dir="4dir",s._swipe=new Pv(s,e),s._swipe.on("swipe",function(t,e,i){var n=t.left?"left":t.right?"right":t.up?"up":"down";Xp(this.eventEmitter,"cell.swipe".concat(n),s,t.x,t.y,i)},this))}.call(this,t,e)}var eg="IDLE",ig="BEGIN",ng="RECOGNIZED",sg=Phaser.Utils.Objects.GetValue,rg=Phaser.Utils.Objects.GetValue,og=Phaser.Utils.Objects.GetValue,ag=Phaser.Utils.Objects.GetValue,hg=function(){w(g,gp);var v=T(g);function g(t,e){var i;B(this,g),void 0===e&&(e={});var n=Kf(e),s=ag(e,"table",void 0);void 0===s&&(s={}),s.scrollMode=n,s.clamplTableOXY=ag(e,"clamplChildOY",!1);var r,o,a,h=ag(s,"width",void 0),l=ag(s,"height",void 0),u=new Hp(t,0,0,h,l,s);t.add.existing(u),o=0===n?(r=void 0===h?1:0,void 0===l):(r=void 0===l?1:0,void 0===h),a=u,Object.defineProperty(a,"childOY",{configurable:!0,get:function(){return a.tableOY},set:function(t){a.tableOY=t}}),Object.defineProperty(a,"topChildOY",{get:function(){return a.topTableOY}}),Object.defineProperty(a,"bottomChildOY",{get:function(){return a.bottomTableOY}}),e.type="rexGridTable",e.child={gameObject:u,proportion:r,expand:o};var c=ag(e,"space",void 0);c&&(c.child=c.table),(i=v.call(this,t,e)).addChildrenMap("table",u),i.eventEmitter=ag(e,"eventEmitter",z(i));var d=ag(e,"createCellContainerCallback",Et),f=ag(e,"createCellContainerCallbackScope",void 0);i.setCreateCellContainerCallback(d,f),function(t){t.on("cellvisible",function(t,e,i){var n=this.createCellContainerCallback,s=this.createCellContainerCallbackScope;t.item=this.items[t.index],(e=s?n.call(s,t,e,i):n(t,e,i))&&(e.setOrigin&&e.setOrigin(0),e.isRexSizer&&e.layout()),t.item=void 0,t.setContainer(e)},this)}.call(z(i),u),i.resizeControllerFlag=!1;var p=0===n?"cellheightchange":"cellwidthchange";return u.on(p,function(){this.resizeControllerFlag=!0},z(i)),ag(s,"interactive",!0)&&tg.call(z(i),u,s),i.setItems(ag(e,"items",[])),t.game.events.on("poststep",i.onPostStep,z(i)),i}return m(g,[{key:"destroy",value:function(t){this.scene&&(this.scene.game.events.off("poststep",this.onPostStep,this),O(C(g.prototype),"destroy",this).call(this,t))}},{key:"setCreateCellContainerCallback",value:function(t,e){return this.createCellContainerCallback=t,this.createCellContainerCallbackScope=e,this}},{key:"refresh",value:function(){return this.setItems(this.items),this}},{key:"getCell",value:function(t){return this.childrenMap.child.getCell(t)}},{key:"getCellContainer",value:function(t){return this.childrenMap.child.getCellContainer(t)}},{key:"updateVisibleCell",value:function(t){return this.childrenMap.child.updateVisibleCell(t)}},{key:"onPostStep",value:function(){this.resizeControllerFlag&&(this.resizeController(),this.resizeControllerFlag=!1)}}]),g}(),lg={setItems:function(t){void 0===t?this.items.length=0:this.items=t;var e=this.childrenMap.child;return e.setCellsCount(this.items.length),e.updateTable(!0),this.resizeController(),this}};Object.assign(hg.prototype,lg),u.register("gridTable",function(t){var e=new hg(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.GridTable",hg);function ug(t,e){return t.sameOrientation?t.orientation=e.orientation:t.orientation=0===e.orientation?1:0,t}var cg={expandSubMenu:function(t,e){var i;this.collapseSubMenu(),i=this.root.toggleOrientation?0===this.orientation?1:0:this.orientation;var n=new this.constructor(this.scene,{items:e,orientation:i,createBackgroundCallback:this.root.createBackgroundCallback,createBackgroundCallbackScope:this.root.createBackgroundCallbackScope,createButtonCallback:this.root.createButtonCallback,createButtonCallbackScope:this.root.createButtonCallbackScope,easeIn:this.root.easeIn,easeOut:this.root.easeOut,_rootMenu:this.root,_parentMenu:this,_parentButton:t});return this.pin(n),this.childrenMap.subMenu=n,this.root.emit("expand",n,t,this),this},collapse:function(){return this.root.emit("collapse",this,this.parentButton,this.root),this.scaleDownDestroy(ug(this.root.easeOut,this)),this.collapseSubMenu(),this},collapseSubMenu:function(){if(void 0===this.childrenMap.subMenu)return this;var t=this.childrenMap.subMenu;return this.childrenMap.subMenu=void 0,this.remove(t),t.collapse(),this}},dg=Phaser.Utils.Objects.GetValue,fg=function(){w(P,qd);var S=T(P);function P(t,e){var i;B(this,P),void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1);var n,s,r,o,a,h=e._rootMenu,l=e._parentMenu,u=e._parentButton,c=dg(e,"items",void 0),d=dg(e,"createBackgroundCallback",void 0),f=dg(e,"createBackgroundCallbackScope",void 0);e.background=(n=t,s=c,o=f,(r=d)&&(s.scene=n,a=o?r.call(o,s):r(s),s.scene=void 0),a);var p=dg(e,"createButtonCallback",void 0),v=dg(e,"createButtonCallbackScope",void 0);e.buttons=function(t,e,i,n){var s,r,o=[];if(e&&i)for(var a=0,h=e.length;a<h;a++)(s=e[a]).scene=t,r=n?i.call(n,s,a,e):i(s,a,e),s.scene=void 0,o.push(r);return o}(t,c,p,v),(i=S.call(this,t,e)).type="rexMenu",i.items=c,i.root=void 0===h?z(i):h,i.parentMenu=l,i.parentButton=u;var g=i.root===z(i);if(g){var y=e.bounds;void 0===y&&(y=sh(t)),i.bounds=y,i.subMenuSide=[i.y<y.centerY?kg:yg,i.x<y.centerX?gg:vg],void 0!==(w=dg(e,"subMenuSide",void 0))&&("string"==typeof w&&(w=mg[w]),i.subMenuSide[i.orientation]=w),i.toggleOrientation=dg(e,"toggleOrientation",!1),i.expandEventName=dg(e,"expandEvent","button.click"),i.easeIn=pg(z(i),dg(e,"easeIn",0)),i.easeOut=pg(z(i),dg(e,"easeOut",0)),i.createBackgroundCallback=d,i.createBackgroundCallbackScope=f,i.createButtonCallback=p,i.createButtonCallbackScope=v,i._isPassedEvent=!1}var k,m=0,b=0;if(!i.root.easeIn.sameOrientation){var x=ug(i.root.easeIn,z(i)).orientation,C=l?l.orientation:i.orientation,w=i.root.subMenuSide[C];0===x&&w===vg&&(m=1),1===x&&w===yg&&(b=1)}if(i.setOrigin(m,b).layout(),!g)switch(w=i.root.subMenuSide[l.orientation]){case vg:i.alignTop(u.top).alignRight(u.left);break;case gg:i.alignTop(u.top).alignLeft(u.right);break;case yg:i.alignLeft(u.left).alignBottom(u.top);break;case kg:i.alignLeft(u.left).alignTop(u.bottom)}return i.pushIntoBounds(i.root.bounds),(k=z(i)).on(k.root.expandEventName,function(t,e){if(!this._isPassedEvent){var i=this.items[e].children;i&&this.expandSubMenu(t,i)}},k).on("button.click",function(t,e,i,n){this!==this.root&&(this.root._isPassedEvent=!0,this.root.emit("button.click",t,e,i,n),this.root._isPassedEvent=!1)},k).on("button.over",function(t,e,i,n){this!==this.root&&(this.root._isPassedEvent=!0,this.root.emit("button.over",t,e,i,n),this.root._isPassedEvent=!1)},k).on("button.out",function(t,e,i,n){this!==this.root&&(this.root._isPassedEvent=!0,this.root.emit("button.out",t,e,i,n),this.root._isPassedEvent=!1)},k),i.popUp(ug(i.root.easeIn,z(i))),i.once("popup.complete",function(){this!==this.root&&this.root.emit("popup.complete",this)},z(i)),i}return m(P,[{key:"isInTouching",value:function(t){return!!O(C(P.prototype),"isInTouching",this).call(this,t)||!!this.childrenMap.subMenu&&this.childrenMap.subMenu.isInTouching(t)}}]),P}(),pg=function(t,e){return"number"==typeof e&&(e={duration:e}),e.hasOwnProperty("orientation")&&void 0!==e.orientation?e.sameOrientation=Zc(e.orientation)===t.orientation:e.sameOrientation=!0,e},vg=2,gg=0,yg=3,kg=1,mg={up:yg,down:kg,left:vg,right:gg};Object.assign(fg.prototype,cg),u.register("menu",function(t){var e=new fg(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.Menu",fg);function bg(t){return t instanceof Tg}function xg(t){return t instanceof Og}function Cg(t){return xg(t)?2:bg(t)?0:1}function wg(t,e,i){switch(Cg(t)){case 0:i=t.getWrappedText(e);break;case 1:i=t.getPenManager(e,i);break;case 2:i=t.setText(e).getTextBounds().wrappedText.split("\n")}return i}function Sg(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t}function Pg(t,e){switch(Cg(t)){case 0:var i=(s=t.style).wordWrapWidth,n=s.wordWrapCallback;s.wordWrapWidth=0,s.wordWrapCallback=void 0,t.setText(e),s.wordWrapWidth=i,s.wordWrapCallback=n;break;case 1:var s,r=(s=t.style).wrapMode;s.wrapMode=0,t.setText(e),s.wrapMode=r;break;case 2:var o=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=o}}var Tg=Phaser.GameObjects.Text,Og=Phaser.GameObjects.BitmapText,Mg={clearText:function(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage:function(t){var e=this.totalLinesCount;this.sections.push(Sg(t));t=this.sections.join("\n");this.lines=wg(this.parent,t,this.lines);for(var i=this.totalLinesCount-e,n=Math.ceil(i/this.pageLinesCount),s=0;s<n;s++)this.pageStartIndexes.push(e+s*this.pageLinesCount);return this},setText:function(t,e){void 0===e&&(e=!0),e&&this.resetPageIdx(),this.clearText();for(var i=Sg(t).split(this.pageBreak),n=0,s=i.length;n<s;n++)this.appendPage(i[n]);return this},appendText:function(t){var e=this.content+Sg(t);return this.setText(e,!1),this}},Eg=Phaser.Math.Clamp,_g={getPage:function(t){return void 0===t&&(t=this.pageIndex),this.setPageIndex(t).getLines(this.startLineIndex,this.endLineIndex)},getNextPage:function(){return this.getPage(this.pageIndex+1)},getPreviousPage:function(){return this.getPage(this.pageIndex-1)},resetPageIdx:function(){return this.pageIndex=-1,this},setPageIndex:function(t){return t=Eg(t,0,this.pageCount-1),this.pageIndex=t,this.startLineIndex=this.pageStartIndexes[t],this.endLineIndex=this.pageStartIndexes[t+1],this}},Bg={showPage:function(t){return this.displayText(this.getPage(t)),this},showNextPage:function(){return this.displayText(this.getNextPage()),this},showPreviousPage:function(){return this.displayText(this.getPreviousPage()),this},show:function(){return this.displayText(this.getLines()),this},showNextLine:function(){return this.displayText(this.setStartLineIndex(this.startLineIndex+1).getLines()),this},showPreviousLine:function(){return this.displayText(this.setStartLineIndex(this.startLineIndex-1).getLines()),this},displayText:function(t){Pg(this.parent,t)}},zg={getLines:function(t,e){var i;switch(void 0===t&&(t=this.startLineIndex),void 0===e&&(e=t+this.pageLinesCount),this.textObjectType){case 0:case 2:i=this.lines.slice(t,e).join("\n");break;case 1:var n=this.lines.getLineStartIndex(t),s=this.lines.getLineEndIndex(e-1);i=this.lines.getSliceTagText(n,s,!0)}return i}};Object.assign(zg,Mg,_g,Bg);var Rg=Phaser.Utils.Objects.GetValue,Ig=Phaser.Math.Clamp,Dg=function(){w(s,fo);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,{eventEmitter:!1})).textObjectType=Cg(i.parent),i.pageStartIndexes=[],i.lines=wg(i.parent,""),i.sections=[],i.resetFromJSON(e),i}return m(s,[{key:"resetFromJSON",value:function(t){return this.setMaxLines(Rg(t,"maxLines",void 0)),this.setPageBreak(Rg(t,"pageBreak","\f\n")),this.setText(Rg(t,"text","")),this.setStartLineIndex(Rg(t,"start",0)),this.setPageIndex(Rg(t,"page",-1)),this}},{key:"toJSON",value:function(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}},{key:"shutdown",value:function(t){if(!this.isShutdown){switch(this.textObjectType){case 0:this.lines.length=0;break;case 1:this.lines.destroy();break;case 2:this.lines.length=0}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,O(C(s.prototype),"shutdown",this).call(this,t)}}},{key:"setMaxLines",value:function(t){return this.maxLines=t,this}},{key:"setPageBreak",value:function(t){return this.pageBreak=t,this}},{key:"pageCount",get:function(){return this.pageStartIndexes.length}},{key:"isFirstPage",get:function(){return this.pageIndex<=0}},{key:"isLastPage",get:function(){return this.pageIndex>=this.pageCount-1}},{key:"totalLinesCount",get:function(){return this.lines?this.lines.length:0}},{key:"startLineIndex",get:function(){return this._startLineIndex},set:function(t){t=Ig(t,0,this.totalLinesCount-1),this._startLineIndex=t}},{key:"setStartLineIndex",value:function(t){return this.startLineIndex=t,this}},{key:"pageLinesCount",get:function(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=0<e?e:this.totalLinesCount;break;case 2:t=this.totalLinesCount}return t}},{key:"content",get:function(){return this.sections.join(this.pageBreak)}}]),s}();Object.assign(Dg.prototype,zg);var Lg=Phaser.Utils.Objects.GetFastValue,jg=Phaser.Utils.Objects.GetValue,Ag=function(){w(s,fo);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,e)).timer=null,i.resetFromJSON(e),i}return m(s,[{key:"resetFromJSON",value:function(t){this.setTextWrapEnable(jg(t,"wrap",!1)),this.setTypeMode(jg(t,"typeMode",0)),this.setTypeSpeed(jg(t,"speed",333)),this.setTextCallback=Lg(t,"setTextCallback",null),this.setTextCallbackScope=Lg(t,"setTextCallbackScope",null),this.setTypingContent(Lg(t,"text","")),this.typingIdx=Lg(t,"typingIdx",0),this.insertIdx=Lg(t,"insertIdx",null);var e=Lg(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIdx,e),this}},{key:"shutdown",value:function(t){this.isShutdown||(this.freeTimer(),O(C(s.prototype),"shutdown",this).call(this,t))}},{key:"setTypeMode",value:function(t){return"string"==typeof t&&(t=Yg[t]),this.typeMode=t,this}},{key:"setTypeSpeed",value:function(t){return this.speed=t,this}},{key:"setTextWrapEnable",value:function(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}},{key:"text",get:function(){return this._text},set:function(t){var e=Fg(t);this.textWrapEnable&&(e=function(t,e){switch(Cg(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}},{key:"isTyping",get:function(){return null!==this.getTimer()}},{key:"isLastChar",get:function(){return this.typingIdx===this.textLen}},{key:"start",value:function(t,e,i,n){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIdx=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(n)),this}},{key:"appendText",value:function(t){var e=this.text.concat(Fg(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLen),this}},{key:"stop",value:function(t){return this.getTimer()&&this.freeTimer(),t&&(this.typingIdx=this.textLen,this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)),this}},{key:"pause",value:function(){var t=this.getTimer();return t&&(t.paused=!0),this}},{key:"resume",value:function(){var t=this.getTimer();return t&&(t.paused=!1),this}},{key:"setTypingContent",value:function(t){return this.text=t,this.textLen=this.getTextLength(this.text),this}},{key:"onTyping",value:function(){var t=this.getTypingString(this.text,this.typingIdx,this.textLen,this.typeMode);this.setText(t),this.emit("type"),this.isLastChar?(this.freeTimer(),this.emit("complete",this,this.parent)):(this.timer.delay=this.speed,this.typingIdx++)}},{key:"getTypingString",value:function(t,e,i,n){var s;if(0===n){var r=0,o=e;this.insertIdx=o,s=this.getSubString(t,r,o)}else if(1===n){r=(o=i)-e;this.insertIdx=0,s=this.getSubString(t,r,o)}else if(2===n){var a=i/2;o=(r=Math.floor(a-e/2))+e;this.insertIdx=e%2?e:0,s=this.getSubString(t,r,o)}else if(3===n){var h,l=Math.floor(e/2);if(0<l){r=(o=i)-l;h=this.getSubString(t,r,o)}else h="";var u,c=e-l;if(0<c){o=(r=0)+c;this.insertIdx=o,u=this.getSubString(t,r,o)}else u="",this.insertIdx=0;s=u+h}return s}},{key:"startTimer",value:function(t){var e;return this.timer&&this.freeTimer(),e=void 0===t?0:t,this.timer=this.scene.time.addEvent({delay:0,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}},{key:"getTimer",value:function(){return this.timer}},{key:"freeTimer",value:function(){return this.timer&&(this.timer.remove(),this.timer=null),this}},{key:"setText",value:function(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIdx):this.setTextCallback(t,this.isLastChar,this.insertIdx)),this.textWrapEnable?Pg(this.parent,t):this.parent.setText(t)}},{key:"getTextLength",value:function(t){var e=this.parent;return e.getPlainText?e.getPlainText(t).length:t.length}},{key:"getSubString",value:function(t,e,i){var n=this.parent;return n.getSubString?n.getSubString(t,e,i):t.slice(e,i)}}]),s}(),Fg=function(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Yg={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3},Vg=Phaser.Utils.Objects.GetValue,Wg=function(){w(r,Bd);var s=T(r);function r(t,e){var i;B(this,r),void 0===e&&(e={text:Gg(t)}),(i=s.call(this,t,e)).type="rexTextBox";var n=i.childrenMap.text;return i.page=new Dg(n,Vg(e,"page",void 0)),i.typing=new Ag(n,Vg(e,"type",void 0)),i.typing.on("complete",i.onPageEnd,z(i)).on("type",i.onType,z(i)),i.textWidth=n.width,i.textHeight=n.height,i}return m(r,[{key:"start",value:function(t,e){return this.page.setText(t),void 0!==e&&this.setTypeSpeed(e),this.typeNextPage(),this}},{key:"typeNextPage",value:function(){if(this.isLastPage)this.emit("complete");else{var t=this.page.getNextPage();this.typing.start(t)}return this}},{key:"pause",value:function(){return this.typing.pause(),this}},{key:"resume",value:function(){return this.typing.resume(),this}},{key:"stop",value:function(t){return this.typing.stop(t),this}},{key:"setTypeSpeed",value:function(t){return this.typing.setTypeSpeed(t),this}},{key:"isTyping",get:function(){return this.typing.isTyping}},{key:"isLastPage",get:function(){return this.page.isLastPage}},{key:"isFirstPage",get:function(){return this.page.isFirstPage}},{key:"pageCount",get:function(){return this.page.pageCount}},{key:"pageIndex",get:function(){return this.page.pageIndex}},{key:"onType",value:function(){var t=this.childrenMap.text;this.textWidth===t.width&&this.textHeight===t.height||(this.textWidth=t.width,this.textHeight=t.height,this.getTopmostSizer().layout()),this.emit("type")}},{key:"onPageEnd",value:function(){this.emit("pageend"),this.isLastPage&&this.emit("complete")}}]),r}(),Gg=function(t){return t.add.text(0,0,"",{wordWrap:{width:200},maxLines:5})};u.register("textBox",function(t){var e=new Wg(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.TextBox",Wg);var Ug=Phaser.Utils.Objects.GetValue,Hg=function(){w(g,td);var v=T(g);function g(t,e){var i;B(this,g),(i=v.call(this,t,e)).type="rexNumberBar";var n,s=Ug(e,"background",void 0),r=Ug(e,"icon",void 0),o=Ug(e,"iconMask",void 0),a=Ug(e,"slider",void 0),h=Ug(e,"text",void 0),l=Ug(e,"space.icon",0),u=Ug(e,"space.slider",0);s&&i.addBackground(s),r&&(0===i.orientation?(a||h)&&(c={right:l}):(a||h)&&(c={bottom:l}),i.add(r,0,"center",c),o=o&&Ed.call(z(i),r,r,1));if(a){var c,d;if(a.orientation=i.orientation,a.eventEmitter=z(i),a.value=null,a.hasOwnProperty("input")||(a.input=-1),n=new Xf(t,a),0===i.orientation?h&&(c={right:u}):h&&(c={bottom:u}),0===i.orientation)d=void 0===Ug(a,"width",void 0)?1:0;else d=void 0===Ug(a,"height",void 0)?1:0;i.add(n,d,"center",c)}h&&i.add(h),i.addChildrenMap("background",s),i.addChildrenMap("icon",r),i.addChildrenMap("iconMask",o),i.addChildrenMap("slider",n),i.addChildrenMap("text",h);var f=Ug(e,"valuechangeCallback",null);if(null!==f){var p=Ug(e,"valuechangeCallbackScope",void 0);i.on("valuechange",f,p)}return i.setEnable(Ug(e,"enable",void 0)),i.setValue(Ug(e,"value",0)),i}return m(g,[{key:"enable",get:function(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable},set:function(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"value",get:function(){return this.childrenMap.slider?this.childrenMap.slider.value:0},set:function(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}},{key:"setValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}},{key:"addValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}},{key:"getValue",value:function(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}},{key:"easeValueTo",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}},{key:"stopEaseValue",value:function(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}},{key:"setEaseValueDuration",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}},{key:"setEaseValueFunction",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}},{key:"text",get:function(){var t=this.childrenMap.text;return void 0===t?"":t.text?t.text:t.getData("text")},set:function(t){var e=this.childrenMap.text;void 0!==e&&(e.setText?e.setText(t):e.setData("text",t))}},{key:"setText",value:function(t){return this.text=t,this}}]),g}();u.register("numberBar",function(t){var e=new Hg(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.NumberBar",Hg);var Xg=Phaser.Utils.Objects.GetValue,Ng={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"},Jg=function(){w(h,xu);var a=T(h);function h(t,e){var i;B(this,h),(i=a.call(this,t,e)).type="rexBadge";var n=Xg(e,"background",void 0);n&&i.addBackground(n),i.addChildrenMap("background",n);var s=Xg(e,"main",void 0);for(var r in s&&i.add(s,{key:"main",align:"center",expand:!1}),i.addChildrenMap("main",s),Ng){var o=Xg(e,r,void 0);o&&(i.add(o,{key:r,align:Ng[r],expand:!1}),i.addChildrenMap(r,o))}return i}return h}();u.register("badgeLabel",function(t){var e=new Jg(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.BadgeLabel",Jg);var Kg=mn.prototype.setChildVisible,Zg={addPage:function(t,e,i,n,s,r,o){return t.setVisible(!1),this.add(t,e,i,n,s,r,o),this},getPage:function(t){return void 0!==t&&this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t){this._previousKey=this._currentKey;var e=this.previousPage;e&&(0===this.swapMode?(Kg.call(this,e,!1),this.emit("pageinvisible",e,this._previousKey,this)):e.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var i=this.currentPage;return i&&(Kg.call(this,i,!0),this.emit("pagevisible",i,this._currentKey,this)),this}},qg=Phaser.Utils.Objects.GetValue,$g=function(){w(s,xu);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,e)).type="rexPages",i.childrenMap=i.sizerChildren,i._previousKey=void 0,i._currentKey=void 0,i.setSwapMode(qg(e,"swapMode",0)),i}return m(s,[{key:"setSwapMode",value:function(t){return"string"==typeof t&&(t=Qg[t]),this.swapMode=t,this}},{key:"previousKey",get:function(){return this._previousKey}},{key:"currentKey",get:function(){return this._currentKey},set:function(t){this.swapPage(t)}},{key:"currentPage",get:function(){return this.getPage(this.currentKey)}},{key:"previousPage",get:function(){return this.getPage(this.previousKey)}},{key:"keys",get:function(){return Object.keys(this.sizerChildren)}}]),s}();Object.assign($g.prototype,Zg);var Qg={invisible:0,destroy:1};u.register("pages",function(t){var e=new $g(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.Pages",$g);function ty(t){return(t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)}function ey(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing}function iy(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject)}var ny={setText:function(t){return void 0!==t&&(this.text=t),this.lines=wg(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(ty.call(this,-this.textOY)),0),e=ey.call(this,t)+this.textOY,i=function(t){var e,i=t+this.visibleLinesCount;switch(this.textObjectType){case 0:e=this.lines.slice(t,i).join("\n");break;case 1:var n=this.lines.getLineStartIndex(t),s=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(n,s,!0);break;case 2:e=this.lines.slice(t,i).join("\n")}return e}.call(this,t);return Pg(this.textObject,i),this.textObject.rexSizer.offsetY=e,iy.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,Fh.call(this),this},layoutChildren:function(){var t,e,i,n,s,r,o,a=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(n=a+(i=(e=t.rexSizer).padding).left,s=h+i.top,r=this.width-i.left-i.right,o=this.height-i.top-i.bottom,function(t,e,i){if(i+=this.textLineHeight+this.textLineSpacing,this.textObjectWidth!==e||this.textObjectHeight!==i){switch(this.textObjectWidth=e,this.textObjectHeight=i,this.textObjectType){case 0:case 1:t.setFixedSize(e,i);var n=t.style,s=Math.max(e,0);0===this.textObjectType?n.wordWrapWidth=s:(0===n.wrapMode&&(n.wrapMode=1),n.wrapWidth=s);break;case 2:t.setMaxWidth(e)}this.setText()}}.call(this,t,r,o),Rh(t,n,s,r,o,e.align),e.preOffsetY=0,iy.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}},sy=Phaser.Utils.Objects.IsPlainObject,ry=Phaser.Utils.Objects.GetValue,oy=Phaser.Display.Align.TOP_LEFT,ay=function(){w(d,su);var c=T(d);function d(t,e,i,n,s,r){var o;B(this,d),sy(e)?(e=ry(r=e,"x",0),i=ry(r,"y",0),n=ry(r,"width",void 0),s=ry(r,"height",void 0)):sy(n)&&(n=ry(r=n,"width",void 0),s=ry(r,"height",void 0)),(o=c.call(this,t,e,i,n,s,r)).type="rexTextBlock",o.textObject=void 0,o.linesCount=0,o.textMask=void 0,o.textObjectType=void 0,o._textLineHeight=void 0,o._textLineSpacing=void 0,o._visibleLinesCount=void 0,o._textHeight=void 0,o._textVisibleHeight=void 0,o.lines=void 0,o.text=ry(r,"content",""),o._textOY=0,o.execeedTopState=!1,o.execeedBottomState=!1,o.setClampMode(ry(r,"clamplTextOY",!0));var a=ry(r,"background",void 0),h=ry(r,"text",void 0);void 0===h&&(h=hy(t));var l=ry(r,"textMask",!0);a&&o.addBackground(a),o.add(h),o.sizerChildren=[h];var u=o.getSizerConfig(h);return u.align=oy,u.padding=Ih(0),u.expand=!0,o.textObject=h,o.textObjectType=Cg(h),u.preOffsetY=0,u.offsetY=0,l&&(o.textMask=Ed.call(z(o),o.textObject,z(o))),o.addChildrenMap("background",a),o.addChildrenMap("text",h),o}return m(d,[{key:"destroy",value:function(t){if(this.scene){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:this.lines.length=0;break;case 1:this.lines.destroy();break;case 2:this.lines.length=0}this.lines=void 0}O(C(d.prototype),"destroy",this).call(this,t)}}},{key:"setClampMode",value:function(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}},{key:"textLineHeight",get:function(){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}},{key:"textLineSpacing",get:function(){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}},{key:"visibleLinesCount",get:function(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(ty.call(this,this.textObjectHeight))),this._visibleLinesCount}},{key:"topTextOY",get:function(){return 0}},{key:"bottomTextOY",get:function(){return-this.textVisibleHeight}},{key:"textHeight",get:function(){return void 0===this._textHeight&&(this._textHeight=ey.call(this,this.linesCount)),this._textHeight}},{key:"textVisibleHeight",get:function(){if(void 0===this._textVisibleHeight){var t,e=this.textHeight,i=this.textObjectHeight-this.textLineHeight-this.textLineSpacing;t=i<e?e-i:0,this._textVisibleHeight=t}return this._textVisibleHeight}},{key:"textOYExceedTop",value:function(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}},{key:"textOYExeceedBottom",value:function(t){return void 0===t&&(t=this.textOY),t<this.bottomTextOY}},{key:"textOY",get:function(){return this._textOY},set:function(t){var e=this.topTextOY,i=this.bottomTextOY,n=this.textOYExceedTop(t),s=this.textOYExeceedBottom(t);this.clampTextOY&&(this.visibleLinesCount>this.linesCount?t=0:n?t=e:s&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,s&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=s}},{key:"setTextOY",value:function(t){return this.textOY=t,this}},{key:"t",get:function(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t},set:function(t){this.textOY=-this.textVisibleHeight*t}},{key:"setTextOYByPercentage",value:function(t){return this.t=t,this}}]),d}(),hy=function(t){return t.add.text(0,0,"")};Object.assign(ay.prototype,ny);var ly=Phaser.Utils.Objects.GetValue,uy=function(){w(p,gp);var f=T(p);function p(t,e){var i;B(this,p),void 0===e&&(e={});var n=ly(e,"text",void 0),s=ly(e,"textWidth",void 0),r=ly(e,"textHeight",void 0),o=ly(e,"textMask",!0),a=ly(e,"content",""),h=new ay(t,{width:s,height:r,text:n,textMask:o,content:a,clamplTextOY:ly(e,"clamplChildOY",!1)});t.add.existing(h);var l,u=void 0===s?1:0,c=void 0===r;l=h,Object.defineProperty(l,"childOY",{configurable:!0,get:function(){return l.textOY},set:function(t){l.textOY=t}}),Object.defineProperty(l,"topChildOY",{get:function(){return l.topTextOY}}),Object.defineProperty(l,"bottomChildOY",{get:function(){return l.bottomTextOY}}),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,proportion:u,expand:c};var d=ly(e,"space",void 0);return d&&(d.child=d.text),(i=f.call(this,t,e)).addChildrenMap("text",n),i}return m(p,[{key:"text",get:function(){return this.childrenMap.child.text}},{key:"linesCount",get:function(){return this.childrenMap.child.linesCount}},{key:"contentHeight",get:function(){return this.childrenMap.child.textHeight}}]),p}(),cy={setText:function(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText:function(t){return this.setText(this.text+t),this}};Object.assign(uy.prototype,cy),u.register("textArea",function(t){var e=new uy(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.TextArea",uy);var dy={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t=this.child;return!t.rexSizer.hidden&&0===this.scrollMode?this.getChildWidth(t):0},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t=this.child;return t.rexSizer.hidden||0===this.scrollMode?0:t.isRexSizer?Math.max(t.minHeight,t.childrenHeight):t.hasOwnProperty("minHeight")?t.minHeight:uh(t)},getChildrenSizers:function(t){return void 0===t&&(t=[]),this.child&&this.child.isRexSizer&&t.push(this.child),t},resetChildPosition:function(){var t=this.left,e=this.top;0===this.scrollMode?e+=this.childOY:t+=this.childOY,this.child.setPosition(t,e),this.resetChildPositionState(this.child),this.setMaskChildrenFlag()},layoutChildren:function(){var t,e,i=this.child;i.rexSizer.hidden||(0===this.scrollMode?t=this.width:e=this.height,i.isRexSizer?i.runLayout(this,t,e):yl(i,t,e),this.resetChildPosition(),this.layoutChildrenMask(),this.maskChildren())}};Object.assign(dy,Lp);var fy=Phaser.Utils.Objects.IsPlainObject,py=Phaser.Utils.Objects.GetValue,vy=Phaser.Display.Align.TOP_LEFT,gy=function(){w(c,su);var u=T(c);function c(t,e,i,n,s,r){var o;B(this,c),fy(e)?(e=py(r=e,"x",0),i=py(r,"y",0),n=py(r,"width",void 0),s=py(r,"height",void 0)):fy(n)&&(n=py(r=n,"width",void 0),s=py(r,"height",void 0)),(o=u.call(this,t,e,i,n,s,r)).type="rexScrollableBlock",o.child=void 0,o.childrenMask=void 0,o._childOY=0,o.execeedTopState=!1,o.execeedBottomState=!1,o.setScrollMode(py(r,"scrollMode",!0)),o.setClampMode(py(r,"clamplChildOY",!0));var a=py(r,"child",void 0),h=py(r,"expand",!0);a.setOrigin&&a.setOrigin(0),o.add(a),o.sizerChildren=[a];var l=o.getSizerConfig(a);return l.align=vy,l.expand=h,o.child=a,o.setupChildrenMask(py(r,"mask",void 0)),o}return m(c,[{key:"destroy",value:function(t){this.scene&&(this.destroyChildrenMask(),this.child=void 0,O(C(c.prototype),"destroy",this).call(this,t))}},{key:"setScrollMode",value:function(t){return"string"==typeof t&&(t=Zf[t.toLowerCase()]),this.scrollMode=t,this}},{key:"setClampMode",value:function(t){return void 0===t&&(t=!0),this.clampChildOY=t,this}},{key:"instHeight",get:function(){return 0===this.scrollMode?this.height:this.width}},{key:"instWidth",get:function(){return 0===this.scrollMode?this.width:this.height}},{key:"childHeight",get:function(){return(0===this.scrollMode?uh:lh)(this.child)}},{key:"childWidth",get:function(){return(0===this.scrollMode?lh:uh)(this.child)}},{key:"topChildOY",get:function(){return 0}},{key:"bottomChildOY",get:function(){return-this.visibleHeight}},{key:"visibleHeight",get:function(){var t=this.childHeight,e=this.instHeight;return e<t?t-e:0}},{key:"childOYExceedTop",value:function(t){return void 0===t&&(t=this.childOY),t>this.topChildOY}},{key:"childOYExeceedBottom",value:function(t){return void 0===t&&(t=this.childOY),t<this.bottomChildOY}},{key:"childOY",get:function(){return this._childOY},set:function(t){var e=this.topChildOY,i=this.bottomChildOY,n=this.childOYExceedTop(t),s=this.childOYExeceedBottom(t);this.clampChildOY&&(this.instHeight>this.childHeight?t=0:n?t=e:s&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,s&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=s}},{key:"setChildOY",value:function(t){return this.childOY=t,this}},{key:"t",get:function(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t},set:function(t){this.childOY=-this.visibleHeight*t}},{key:"setChildOYByPercentage",value:function(t){return this.t=t,this}}]),c}();Object.assign(gy.prototype,dy);var yy=Phaser.Utils.Objects.GetValue,ky=function(){w(d,gp);var c=T(d);function d(t,e){var i;B(this,d),void 0===e&&(e={});var n=Kf(e),s=yy(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=n,s.clamplChildOY=yy(e,"clamplChildOY",!1);var r=new gy(t,s);t.add.existing(r);var o,a,h=yy(s,"width",void 0),l=yy(s,"height",void 0);a=0===n?(o=void 0===h?1:0,void 0===l):(o=void 0===l?1:0,void 0===h),e.type="rexScrollablePanel",e.child={gameObject:r,proportion:o,expand:a};var u=yy(e,"space",void 0);return u&&(u.child=u.panel),(i=c.call(this,t,e)).addChildrenMap("panel",i.childrenMap.child.child),i}return d}();u.register("scrollablePanel",function(t){var e=new ky(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.ScrollablePanel",ky);function my(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=e.length),t.length=n-i;for(var s=0,r=t.length;s<r;s++)t[s]=e[s+i];return t}function by(t,e,i){var n,s=Py(i,"reverse",!1);if(Ui(t[0]))if(s)for(r=(o=t.length)-1;0<=r;r--)n=by(t[r],e,i);else for(var r=0,o=t.length;r<o;r++)n=by(t[r],e,i);else n=Ty(t,e,i);return n}var xy=function(t,e){t.popUp(e)},Cy=function(t,e){t.scaleDown(e)},wy=function(t,e){t.fadeIn(e)},Sy=function(t,e){t.fadeOut(e)},Py=Phaser.Utils.Objects.GetValue,Ty=function(t,e,i){var n,s=Py(i,"argsConvert",void 0),r=Py(i,"argsConvertScope",void 0),o=t[0];if(Oy=my(Oy,t,1),s){!0===s&&(s=fs,r=void 0);for(var a=0,h=Oy.length;a<h;a++)Oy[a]=r?s.call(r,Oy[a],t):s(Oy[a],t)}return"string"==typeof o?null==(n=e[o])&&(n=Py(e,o,null)):n=o,n.apply(e,Oy)},Oy=[],My=Phaser.Utils.Objects.GetValue,Ey=function(){w(r,fo);var s=T(r);function r(t,e){var i;B(this,r),i=s.call(this,t,e);var n=My(e,"clock",void 0);return n=n||new mo(t),i.clock=n,i.clock.on("update",i.update,z(i)),i.resetFromJSON(e),i}return m(r,[{key:"resetFromJSON",value:function(t){return this.clock.resetFromJSON(My(t,"clock",void 0)),this.state=My(t,"state",0),this.commands=My(t,"commands",[]),this.scope=My(t,"scope",void 0),this.setTimeUnit(My(t,"timeUnit",0)),this.setDtMode(My(t,"dtMode",0)),this.index=My(t,"index",0),this.nextTime=My(t,"nextTime",0),this}},{key:"toJSON",value:function(){return{clock:this.clock.toJSON(),state:this.state,commands:this.commands,scope:this.scope,timeUnit:this.timeUnit,dtMode:this.dtMode,index:this.index,nextTime:this.nextTime}}},{key:"shutdown",value:function(t){this.isShutdown||(this.clock.shutdown(t),this.commands=void 0,O(C(r.prototype),"shutdown",this).call(this,t))}},{key:"load",value:function(t,e,i){this.stop();var n=My(i,"timeUnit",void 0);void 0!==n&&this.setTimeUnit(n);var s=My(i,"dtMode",void 0);return void 0!==s&&this.setDtMode(s),t=t.filter(function(t){var e=t[0];return!isNaN(e)}).map(function(t){return"string"==typeof t[0]&&(t[0]=parseFloat(t[0])),t}),0===this.dtMode&&t.sort(function(t,e){var i=t[0],n=e[0];return n<i?1:i<n?-1:0}),this.commands=t,this.scope=e,this}},{key:"start",value:function(t){return void 0===t&&(t=0),this.stop(),this.index=0,this.state=1,this.nextTime=this.getNextDt(0),this.clock.start(t),this.update(t),this.emit("start",this.parent,this),this}},{key:"pause",value:function(){return this.clock.pause(),this.emit("pause",this.parent,this),this}},{key:"resume",value:function(){return this.clock.resume(),this.emit("resume",this.parent,this),this}},{key:"stop",value:function(){return this.clock.stop(),this.state=0,this.emit("stop",this.parent,this),this}},{key:"seek",value:function(t){return this.clock.seek(t),this}},{key:"isPlaying",get:function(){return this.clock.isRunning}},{key:"completed",get:function(){return 2===this.state}},{key:"timeScale",get:function(){return this.clock.timeScale},set:function(t){this.clock.timeScale=t}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"now",get:function(){return this.clock.now}},{key:"update",value:function(t){if(this.nextTime>t)return this;for(var e=this.commands.length-1;;){var i=this.commands[this.index],n=i[1];if(Ui(n)||(n=my(_y,i,1)),by(n,this.scope),this.emit("runcommand",n,this.scope),this.index===e)return this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}},{key:"complete",value:function(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}},{key:"getNextDt",value:function(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}},{key:"setDtMode",value:function(t){return"string"==typeof t&&(t=zy[t]),this.dtMode=t,this}},{key:"setTimeUnit",value:function(t){return"string"==typeof t&&(t=By[t]),this.timeUnit=t,this}}]),r}(),_y=[],By={ms:0,s:1,sec:1},zy={abs:0,absolute:0,inc:1,increment:1},Ry=Phaser.Utils.Objects.GetValue,Iy=function(){w(s,Bd);var n=T(s);function s(t,e){var i;return B(this,s),void 0===e&&(e={text:createDefaultTextObject(t)}),(i=n.call(this,t,e)).type="rexToast",i.setTransitInTime(Ry(e,"duration.in",200)),i.setDisplayTime(Ry(e,"duration.hold",1200)),i.setTransitOutTime(Ry(e,"duration.out",200)),i.setTransitInCallback(Ry(e,"transitIn",Dy.popUp)),i.setTransitOutCallback(Ry(e,"transitOut",Dy.scaleDown)),i.player=new Ey(z(i),{dtMode:1}),i.messages=[],i.setVisible(!1),i}return m(s,[{key:"destroy",value:function(t){this.scene&&(this.player.destroy(),this.player=void 0,this.messages=void 0,O(C(s.prototype),"destroy",this).call(this,t))}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitOutTime",value:function(t){return this.transitOutTime=t,this}},{key:"setTransitInTime",value:function(t){return this.transitInTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=Dy[t]),t){case Dy.popUp:t=xy;break;case Dy.fadeIn:t=wy}return this.transitInCallback=t,this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=Dy[t]),t){case Dy.scaleDown:t=Cy;break;case Dy.fadeOut:t=Sy}return this.transitOutCallback=t,this}},{key:"showMessage",value:function(t){if(void 0===t){if(0===this.messages.length)return this;t=this.messages.shift()}if(this.player.isPlaying)return this.messages.push(t),this;this.setScale(1,1).setVisible(!0),"string"==typeof t?this.setText(t):t(this),this.layout();var e=[[0,[this.transitInCallback,this,this.transitInTime]],[this.transitInTime,[Et]],[this.displayTime,[this.transitOutCallback,this,this.transitOutTime]],[this.transitOutTime,[this.setVisible,!1]],[30,[Et]]];return this.player.load(e,this).once("complete",function(){this.showMessage()},this).start(),this}}]),s}(),Dy={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};u.register("toast",function(t){var e=new Iy(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.Toast",Iy);function Ly(s,r){return function(t,e,i,n){"panel"!==e&&i.moveChild(t,n?0:s,r)}}function jy(s,r){return function(t,e,i,n){"panel"===e&&i.moveChild(t,n?0:s,r)}}var Ay={visible:{show:function(){return function(t,e,i,n){"panel"!==e&&i.setChildVisible(t,!0)}},hide:function(){return function(t,e,i,n){"panel"!==e&&i.setChildVisible(t,!1)}}},fade:{show:function(s,r){return void 0===r&&(r=1),function(t,e,i,n){"panel"!==e&&i.fadeChild(t,n?0:s,r)}},hide:function(s,r){return void 0===r&&(r=0),function(t,e,i,n){"panel"!==e&&i.fadeChild(t,n?0:s,r)}}},move:{show:Ly,hide:Ly},"move-panel":{show:jy,hide:jy}},Fy=mn.prototype.setChildVisible,Yy={setChildVisible:function(t,e){if("string"==typeof t){var i=t;t=this.sizerChildren[i]}else i=ku(this.sizerChildren,t);return void 0===e&&(e=this.currentChildKey===i),Fy.call(this,t,e),this}},Vy={fadeChild:function(t,e,i){var n;return"string"==typeof t?(n=t,t=this.sizerChildren[n]):n=ku(this.sizerChildren,t),void 0===e&&(e=500),void 0===i&&(i=this.currentChildKey===n?1:0),t.fadeIn(e,{start:t.alpha,end:i}),this},fadeChildPromise:function(t,e,i){return"string"==typeof t&&(t=this.sizerChildren[key]),this.fadeChild(t,e,i),t._fade?Ts(t._fade):Promise.resolve()}},Wy={moveChild:function(t,e,i,n){var s;"string"==typeof t?(s=t,t=this.sizerChildren[s]):s=ku(this.sizerChildren,t),void 0===e&&(e=500);var r,o,a,h,l=this.currentChildKey===s;if(void 0===n)switch(s){case"leftSide":case"rightSide":n=lh(t);break;case"topSide":case"bottomSide":n=uh(t);break;default:if(l)switch(this.previousChildKey){case"leftSide":case"rightSide":n=lh(this.sizerChildren[this.previousChildKey]);break;case"topSide":case"bottomSide":n=uh(this.sizerChildren[this.previousChildKey]);break;default:n=0}else switch(this.currentChildKey){case"leftSide":case"rightSide":n=lh(this.sizerChildren[this.currentChildKey]);break;case"topSide":case"bottomSide":n=uh(this.sizerChildren[this.currentChildKey]);break;default:n=0}}if(l)switch(s){case"panel":switch(this.previousChildKey){case"leftSide":r=!0;break;case"rightSide":o=!0;break;case"topSide":a=!0;break;case"bottomSide":h=!0}break;case"leftSide":o=!0;break;case"rightSide":r=!0;break;case"topSide":h=!0;break;case"bottomSide":a=!0}else switch(s){case"panel":switch(this.currentChildKey){case"leftSide":o=!0;break;case"rightSide":r=!0;break;case"topSide":h=!0;break;case"bottomSide":a=!0}break;case"leftSide":r=!0;break;case"rightSide":o=!0;break;case"topSide":a=!0;break;case"bottomSide":h=!0}return r?t.moveTo(e,"-=".concat(n),void 0,i):o?t.moveTo(e,"+=".concat(n),void 0,i):a?t.moveTo(e,void 0,"-=".concat(n),i):h?t.moveTo(e,void 0,"+=".concat(n),i):t.moveTo(0),this},moveChildPromise:function(t,e,i,n){return"string"==typeof t&&(t=this.sizerChildren[key]),this.moveChild(t,e,i,n),t._easeMove?Ts(t._easeMove):Promise.resolve()}},Gy={};Object.assign(Gy,Yy,Vy,Wy);var Uy=Phaser.Utils.Objects.GetValue,Hy=function(){w(C,xu);var x=T(C);function C(t,e){var i;B(this,C),(i=x.call(this,t,e)).type="rexSides",i.childrenMap=i.sizerChildren,i.previousChildKey=void 0,i.currentChildKey=void 0;var n,s,r,o,a,h,l=Uy(e,"showChildCallback",void 0);if(l)if(pl(l)){var u=Uy(e,"showChildCallbackScope",void 0);i.on("showchild",l,u);var c=Uy(e,"hideChildCallback",void 0),d=Uy(e,"hideChildCallbackScope",void 0);i.on("hidechild",c,d)}else{var f=(h=S("string"==typeof(n=l)?[n]:n),s=h[0],r=h.slice(1),a=Ay.hasOwnProperty(s)?(o=Ay[s].show.apply(null,r),Ay[s].hide.apply(null,r)):o=Et,{show:o,hide:a});i.on("showchild",f.show),i.on("hidechild",f.hide)}var p=Uy(e,"background",void 0),v=Uy(e,"panel",void 0),g=Uy(e,"leftSide",void 0),y=Uy(e,"rightSide",void 0),k=Uy(e,"topSide",void 0),m=Uy(e,"bottomSide",void 0);if(p&&i.addBackground(p),v&&i.add(v,"panel","center",0,!0),g){var b=Uy(e,"expand.left",!0);i.add(g,"leftSide","left-top",0,{height:b})}if(y){b=Uy(e,"expand.right",!0);i.add(y,"rightSide","right-top",0,{height:b})}if(k){b=Uy(e,"expand.top",!0);i.add(k,"topSide","left-top",0,{width:b})}if(m){b=Uy(e,"expand.bottom",!0);i.add(m,"bottomSide","left-bottom",0,{width:b})}return i}return m(C,[{key:"reset",value:function(){return this.previousChildKey=void 0,this.currentChildKey="panel",this.showChild("panel",!0),this.hideChild("leftSide",!0),this.hideChild("rightSide",!0),this.hideChild("topSide",!0),this.hideChild("bottomSide",!0),this}}]),C}();Object.assign(Hy.prototype,{showChild:function(t,e){var i=this.sizerChildren[t];return i&&(this.emit("showchild",i,t,this,e),this.resetChildState(i)),this},hideChild:function(t,e){var i=this.sizerChildren[t];return i&&(this.emit("hidechild",i,t,this,e),this.resetChildState(i)),this},swapChild:function(t,e){return this.currentChildKey===t||("panel"===this.currentChildKey||"panel"===t?(this.previousChildKey=this.currentChildKey,this.currentChildKey=t,this.hideChild(this.previousChildKey,e),this.showChild(this.currentChildKey,e)):(this.swapChild("panel",e),this.swapChild(t,e))),this},showPanel:function(t){return this.swapChild("panel",t),this},showLeftSide:function(){return this.swapChild("leftSide"),this},showRightSide:function(){return this.swapChild("rightSide"),this},showTopSide:function(){return this.swapChild("topSide"),this},showBottomSide:function(){return this.swapChild("bottomSide"),this},hideLeftSide:function(){return"leftSide"==this.currentChildKey&&this.showPanel(),this},hideRightSide:function(){return"rightSide"==this.currentChildKey&&this.showPanel(),this},hideTopSide:function(){return"topSide"==this.currentChildKey&&this.showPanel(),this},hideBottomSide:function(){return"bottomSide"==this.currentChildKey&&this.showPanel(),this},toggleLeftSide:function(){var t="panel"!==this.currentChildKey?"panel":"leftSide";return this.swapChild(t),this},toggleRightSide:function(){var t="panel"!==this.currentChildKey?"panel":"rightSide";return this.swapChild(t),this},toggleTopSide:function(){var t="panel"!==this.currentChildKey?"panel":"topSide";return this.swapChild(t),this},toggleBottomSide:function(){var t="panel"!==this.currentChildKey?"panel":"bottomSide";return this.swapChild(t),this}},Gy),u.register("sides",function(t){var e=new Hy(this.scene,t);return this.scene.add.existing(e),e}),x(window,"RexPlugins.UI.Sides",Hy);function Xy(t){return t instanceof Ny}var Ny=Phaser.GameObjects.GameObject;u.register("click",function(t,e){return Xy(t)||(e=t,t=this.scene),new Ql(t,e)}),x(window,"RexPlugins.UI.Click",Ql),u.register("tap",function(t,e){return Xy(t)||(e=t,t=this.scene),new sv(t,e)}),x(window,"RexPlugins.UI.Tap",sv),u.register("press",function(t,e){return Xy(t)||(e=t,t=this.scene),new lv(t,e)}),x(window,"RexPlugins.UI.Press",lv),u.register("swipe",function(t,e){return Xy(t)||(e=t,t=this.scene),new Pv(t,e)}),x(window,"RexPlugins.UI.Swipe",Pv),u.register("pan",function(t,e){return Xy(t)||(e=t,t=this.scene),new pv(t,e)}),x(window,"RexPlugins.UI.Pan",pv),u.register("pinch",function(t){return new Vv(this.scene,t)}),x(window,"RexPlugins.UI.Pinch",Vv),u.register("rotate",function(t){return new $v(this.scene,t)}),x(window,"RexPlugins.UI.Rotate",$v);function Jy(e,i,t){var n;if(void 0===e)e=t.texture.key,i=t.frame.name;else if(Ky(e)){var s=e;e=Zy(s,"key",t.texture.key),i=Zy(s,"frame",t.frame.name)}else"string"==typeof e||(n=e);return void 0===n&&(n=function(t){t.setTexture(e,i)}),n}var Ky=Phaser.Utils.Objects.IsPlainObject,Zy=Phaser.Utils.Objects.GetValue,qy=Phaser.Utils.Objects.GetValue,$y=Phaser.Utils.Objects.GetAdvancedValue,Qy=Phaser.Math.Linear,tk=function(){w(s,Ho);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,e)).resetFromJSON(e),i.boot(),i}return m(s,[{key:"resetFromJSON",value:function(t){return O(C(s.prototype),"resetFromJSON",this).call(this,t),this.setDuration($y(t,"duration",500)),this.setEase(qy(t,"ease","Sine")),this.setOrientation(qy(t,"orientation",0)),this.setFrontFace(qy(t,"front",void 0)),this.setBackFace(qy(t,"back",void 0)),this.setFace(qy(t,"face",0)),this}},{key:"setOrientation",value:function(t){return"string"==typeof t&&(t=ek[t]),this.orientation=t,this}},{key:"face",get:function(){return this._face},set:function(t){"string"==typeof t&&(t=ik[t]),0===(this._face=t)&&this.frontFaceCallback?this.frontFaceCallback(this.parent):1===t&&this.backFaceCallback&&this.backFaceCallback(this.parent)}},{key:"setFace",value:function(t){return this.face=t,this}},{key:"toggleFace",value:function(){var t=0===this.face?1:0;return this.setFace(t),this}},{key:"setFrontFace",value:function(t,e){return this.frontFaceCallback=Jy(t,e,this.parent),this}},{key:"setBackFace",value:function(t,e){return this.backFaceCallback=Jy(t,e,this.parent),this}},{key:"start",value:function(){return this.timer.isRunning||(this.timer.setDelay(this.delay).setDuration(this.duration/2).setRepeat(1),O(C(s.prototype),"start",this).call(this)),this}},{key:"flip",value:function(t){return this.isRunning||(void 0!==t&&this.setDuration(t),this.start()),this}},{key:"updateGameObject",value:function(t,e){e.justRestart&&this.toggleFace();var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i);var n=Qy(1,0,i);0===this.orientation?t.scaleX=n:t.scaleY=n}}]),s}(),ek={x:0,horizontal:0,y:1,vertical:1},ik={front:0,back:1};u.register("flip",function(t,e){return new tk(t,e)}),x(window,"RexPlugins.UI.Flip",tk),u.register("touchEventStop",function(t,e){return new zc(t,e)}),x(window,"RexPlugins.UI.TouchEventStop",zc);var nk=Phaser.Math.Vector3,sk=Phaser.Math.Matrix4,rk=new nk,ok=new nk,ak=new sk,hk=Phaser.GameObjects.Mesh,lk=Phaser.Utils.Objects.IsPlainObject,uk=Phaser.Utils.Objects.GetValue,ck=Phaser.Geom.Mesh.GenerateGridVerts,dk=Phaser.Math.RadToDeg,fk=Phaser.Math.DegToRad,pk=1+1/Math.sin(fk(45)),vk=function(){w(u,hk);var l=T(u);function u(t,e,i,n,s,r){var o;B(this,u),lk(e)&&(e=uk(r=e,"x",0),i=uk(r,"y",0),n=uk(r,"key",null),s=uk(r,"frame",null)),(o=l.call(this,t,e,i,n,s)).type="rexPerspectiveImage",o.setSizeToFrame(),o.resetPerspective(),o.panZ(pk),o.hideCCW=uk(r,"hideCCW",!0);var a=uk(r,"gridWidth",32),h=uk(r,"gridHeight",a);return o.resetVerts(a,h),o}return m(u,[{key:"resetPerspective",value:function(){return this.setPerspective(this.width,this.height,45),this}},{key:"resetVerts",value:function(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,n=this.frame.cutHeight;return ck({mesh:this,texture:this.texture.key,frame:this.frame.name,width:i/this.height,height:n/this.height,widthSegments:Math.ceil(i/this.gridWidth),heightSegments:Math.ceil(n/this.gridHeight),flipY:this.frame.source.isRenderTexture}),this}},{key:"syncSize",value:function(){return this.setSizeToFrame(),this.resetPerspective(),this.resetVerts(),this}},{key:"rotationX",get:function(){return this.modelRotation.x},set:function(t){this.modelRotation.x=t}},{key:"angleX",get:function(){return dk(this.rotationX)},set:function(t){this.rotationX=fk(t)}},{key:"rotationY",get:function(){return this.modelRotation.y},set:function(t){this.modelRotation.y=t}},{key:"angleY",get:function(){return dk(this.rotationY)},set:function(t){this.rotationY=fk(t)}},{key:"rotationZ",get:function(){return this.modelRotation.z},set:function(t){this.modelRotation.z=t}},{key:"angleZ",get:function(){return dk(this.rotationZ)},set:function(t){this.rotationZ=fk(t)}},{key:"transformVerts",value:function(t,e,i,n,s,r){return function(t,e,i,n,s,r,o){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=0),rk.set(e,i,n),ok.set(s,r,o),ak.fromRotationXYTranslation(ok,rk,!0);for(var a=0,h=t.vertices.length;a<h;a++)t.vertices[a].transformMat4(ak)}(this,t,e,i,n,s,r),this}},{key:"forceUpdate",value:function(){return this.dirtyCache[10]=1,this}},{key:"tint",get:function(){return 0===this.vertices.length?16777215:this.vertices[0].color},set:function(t){for(var e=this.vertices,i=0,n=e.length;i<n;i++)e[i].color=t}},{key:"setTint",value:function(t){return this.tint=t,this}}]),u}(),gk=Phaser.GameObjects.RenderTexture,yk=Phaser.Utils.Objects.IsPlainObject,kk=Phaser.Utils.Objects.GetValue,mk=function(){w(l,vk);var h=T(l);function l(t,e,i,n,s,r){var o;B(this,l),yk(e)&&(e=kk(r=e,"x",0),i=kk(r,"y",0),n=kk(r,"width",32),s=kk(r,"height",32));var a=new gk(t,e,i,n,s).setOrigin(.5);return(o=h.call(this,t,e,i,a.texture.key,null,r)).type="rexPerspectiveRenderTexture",o.rt=a,o}return m(l,[{key:"destroy",value:function(t){O(C(l.prototype),"destroy",this).call(this,t),this.rt.destroy(),this.rt=null}}]),l}();Phaser.Animations.AnimationState,Phaser.Utils.Objects.IsPlainObject,Phaser.Utils.Objects.GetValue,Phaser.Math.RadToDeg,Phaser.Math.DegToRad,Phaser.Utils.Objects.IsPlainObject,(0,Phaser.Math.DegToRad)(180),Phaser.Utils.Objects.GetValue,Phaser.Math.Linear,Phaser.Utils.Objects.IsPlainObject,Phaser.Utils.Objects.GetValue,Phaser.Utils.Objects.GetValue,Phaser.Math.RadToDeg,Phaser.Math.DegToRad,Phaser.Math.Angle.WrapDegrees,Phaser.Math.Angle.ShortestBetween,Phaser.Math.Wrap,Phaser.Math.Linear,Phaser.Utils.Objects.IsPlainObject,Phaser.Utils.Objects.GetValue,Phaser.Math.DegToRad,Phaser.Math.RadToDeg,Phaser.Math.Angle.WrapDegrees,Phaser.Math.Linear,Phaser.Math.Wrap,Phaser.Utils.Objects.IsPlainObject,Phaser.Utils.Objects.GetValue,Phaser.Math.Wrap;function bk(t){var e=t.gameObjects,i=t.renderTexture;if(0===e.length)return i&&i.setSize(1,1).clear(),i;var n,s,r=Pk(t,"x",void 0),o=Pk(t,"y",void 0),a=Pk(t,"width",void 0),h=Pk(t,"height",void 0),l=Pk(t,"originX",0),u=Pk(t,"originY",0);if(void 0===a||void 0===h||void 0===r||void 0===o){var c=function(t,e){var i;void 0===e?e=new wk:!0===e&&(void 0===Ck&&(Ck=new wk),e=Ck);for(var n=!0,s=0,r=t.length;s<r;s++)(i=t[s]).getBounds&&(xk=i.getBounds(xk),n?(e.setTo(xk.x,xk.y,xk.width,xk.height),n=!1):Sk(xk,e,e));return e}(e,!0);u=l=void 0!==r&&void 0!==o?(a=2*Math.max(r-c.left,c.right-r),h=2*Math.max(o-c.top,c.bottom-o),.5):(r=c.x,o=c.y,a=c.width,h=c.height,0),n=c.x,s=c.y}else n=r+(0-l)*a,s=o+(0-u)*h;return i?(i.setPosition(r,o),i.width===a&&i.height===h||i.setSize(a,h)):i=e[0].scene.add.renderTexture(r,o,a,h),i.setOrigin(l,u),i.camera.setScroll(n,s),e=Wi(Mt(e)),i.draw(e),i}var xk,Ck,wk=Phaser.Geom.Rectangle,Sk=Phaser.Geom.Rectangle.Union,Pk=Phaser.Utils.Objects.GetValue,Tk=mn.prototype.add,Ok=Phaser.Utils.Objects.GetValue,Mk=function(){w(r,mk);var s=T(r);function r(t,e){var i;B(this,r);var n=t.scene;return i=s.call(this,n,t.x,t.y,1,1,e),n.add.existing(z(i)),i.setVisible(!1),Tk.call(t,z(i)),i.visibleSibling=[],i.perspectiveState=!1,i.useParentBounds=Ok(e,"useParentBounds",!1),i.boot(),i}return m(r,[{key:"boot",value:function(){this.rexContainer.parent.once("destroy",this.onParentDestroy,this)}},{key:"destroy",value:function(t){this.scene&&(this.exit(),this.rexContainer.parent.off("destroy",this.onParentDestroy,this),O(C(r.prototype),"destroy",this).call(this,t))}},{key:"onParentDestroy",value:function(t,e){this.destroy(e)}},{key:"enter",value:function(){this.exit();var e=this.rexContainer.parent;return bk({gameObjects:e.getAllVisibleChildren(),renderTexture:this.rt,x:this.x,y:this.y,width:this.useParentBounds?e.displayWidth:void 0,height:this.useParentBounds?e.displayHeighth:void 0,originX:this.useParentBounds?e.originX:void 0,originY:this.useParentBounds?e.originY:void 0}),this.syncSize(),e.setChildVisible(this,!0),e.children.forEach(function(t){t!==this&&(e.setChildVisible(t,!1),this.visibleSibling.push(t))},this),this.perspectiveState=!0,this}},{key:"exit",value:function(){var e=this.rexContainer.parent;return this.visibleSibling.forEach(function(t){e.setChildVisible(t,!0)},this),this.visibleSibling.length=0,e.setChildVisible(this,!1),this.perspectiveState=!1,this}}]),r}();u.register("perspective",function(t,e){return new Mk(t,e)}),x(window,"RexPlugins.UI.Perspective",Mk),u.register("anchor",function(t,e){return new xl(t,e)}),x(window,"RexPlugins.UI.Anchor",xl);function Ek(t,e,i){var n,s;for(var r in void 0===i&&(i={}),t)n=t[r],void 0!==(s=Bk(e,r,n[1]))&&(i[n[0]]=s);return i}function _k(i,t,n){function e(e){t[n[e]]=function(t){i.emit(e,i,t)}}for(var s in n)e(s)}var Bk=Phaser.Utils.Objects.GetValue,zk=function(t){t.stopPropagation()},Rk=Phaser.GameObjects.DOMElement,Ik=Phaser.Utils.Objects.IsPlainObject,Dk=Phaser.Utils.Objects.GetValue,Lk=function(){w(p,Rk);var f=T(p);function p(t,e,i,n,s,r){var o,a;B(this,p),Ik(e)?(e=Dk(r=e,"x",0),i=Dk(r,"y",0),n=Dk(r,"width",0),s=Dk(r,"height",0)):Ik(n)&&(n=Dk(r=n,"width",0),s=Dk(r,"height",0)),void 0===r&&(r={});var h=Dk(r,"type","text");"textarea"===h?(a=document.createElement("textarea")).style.resize="none":(a=document.createElement("input")).type=h,Ek(Vk,r,a);var l=Dk(r,"style",void 0);l=Ek(Wk,r,l);var u,c=a.style;for(var d in r)d in Vk||d in Wk||d in c&&(l[d]=r[d]);return l["box-sizing"]="border-box",(o=f.call(this,t,e,i,a,l)).type="rexInputText",o.resize(n,s),_k(z(o),a,Gk),(u=a).addEventListener("touchstart",zk,!1),u.addEventListener("touchmove",zk,!1),u.addEventListener("touchend",zk,!1),u.addEventListener("mousedown",zk,!1),u.addEventListener("mouseup",zk,!1),u.addEventListener("mousemove",zk,!1),Dk(r,"selectAll",!1)&&o.selectAll(),o}return m(p,[{key:"text",get:function(){return this.node.value},set:function(t){this.node.value=t}},{key:"setText",value:function(t){return this.text=t,this}},{key:"maxLength",get:function(){return this.node.maxLength},set:function(t){this.node.maxLength=t}},{key:"setMaxLength",value:function(t){return this.maxLength=t,this}},{key:"minLength",get:function(){return this.node.minLength},set:function(t){this.node.minLength=t}},{key:"setMinLength",value:function(t){return this.minLength=t,this}},{key:"placeholder",get:function(){return this.node.placeholder},set:function(t){this.node.placeholder=t}},{key:"setPlaceholder",value:function(t){return this.placeholder=t,this}},{key:"selectText",value:function(){return this.node.select(),this}},{key:"tooltip",get:function(){return this.node.title},set:function(t){this.node.title=t}},{key:"setTooltip",value:function(t){return this.tooltip=t,this}},{key:"setTextChangedCallback",value:function(t){return this.onTextChanged=t,this}},{key:"readOnly",get:function(){return this.node.readOnly},set:function(t){this.node.readOnly=t}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}},{key:"spellCheck",get:function(){return this.node.spellcheck},set:function(t){this.node.spellcheck=t}},{key:"setSpellCheck",value:function(t){return this.spellCheck=t,this}},{key:"fontColor",get:function(){return this.node.style.color},set:function(t){this.node.style.color=t}},{key:"setFontColor",value:function(t){return this.fontColor=t,this}},{key:"setStyle",value:function(t,e){return this.node.style[t]=e,this}},{key:"getStyle",value:function(t){return this.node.style[t]}},{key:"scrollToBottom",value:function(){return this.node.scrollTop=this.node.scrollHeight,this}},{key:"setEnabled",value:function(t){return void 0===t&&(t=!0),this.node.disabled=!t,this}},{key:"setBlur",value:function(){return this.node.blur(),this}},{key:"setFocus",value:function(){return this.node.focus(),this}},{key:"selectAll",value:function(){return this.node.select(),this}}]),p}(),jk={resize:function(t,e){if(this.scene.scale.autoRound&&(t=Math.floor(t),e=Math.floor(e)),this.width===t&&this.height===e)return this;var i=this.node.style;return i.width="".concat(t,"px"),i.height="".concat(e,"px"),this.updateSize(),this}};Object.assign(Lk.prototype,jk);function Ak(t,e,i){for(var n,s=0,r=t.length;s<r;s++)if(n=t[s],vl(n,e,i))return n.pointToChild(e,i);return null}function Fk(t,e,i,n,s,r){var o;(o=void 0===s?n:Ak(i,n,s))&&t.emit(e,o,r)}function Yk(e,t){var i=new um(e,t);return i.on("open",function(){e.emit("modal.open",i)}),i.on("close",function(t){e.emit("modal.close",t,i)}),e.on("modal.requestClose",i.requestClose,i),i.on("close",function(){e.off("modal.requestClose",i.requestClose,i)}),i}var Vk={id:["id",void 0],text:["value",void 0],maxLength:["maxLength",void 0],minLength:["minLength",void 0],placeholder:["placeholder",void 0],tooltip:["title",void 0],readOnly:["readOnly",!1],spellCheck:["spellcheck",!1],autoComplete:["autocomplete","off"]},Wk={align:["textAlign",void 0],paddingLeft:["padding-left",void 0],paddingRight:["padding-right",void 0],paddingTop:["padding-top",void 0],paddingBottom:["padding-bottom",void 0],fontFamily:["fontFamily",void 0],fontSize:["font-size",void 0],color:["color","#ffffff"],backgroundColor:["backgroundColor","transparent"],border:["border",0],borderColor:["borderColor","transparent"],outline:["outline","none"],direction:["direction",void 0]},Gk={textchange:"oninput",click:"onclick",dblclick:"ondblclick",focus:"onfocus",blur:"onblur"},Uk=Phaser.Utils.Objects.GetValue,Hk=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"},Xk=Phaser.Utils.Objects.GetValue,Nk=void 0,Jk=function(){w(n,fo);var i=T(n);function n(t){var e;return B(this,n),(e=i.call(this,t,{eventEmitter:!1})).inputText=void 0,e.onClose=void 0,e.delayCall=void 0,e}return m(n,[{key:"shutdown",value:function(t){this.isShutdown||(this.close(),Nk===this&&(Nk=void 0),O(C(n.prototype),"shutdown",this).call(this,t))}},{key:"open",value:function(t,e){void 0!==Nk&&Nk.close(),Nk=this,pl(t)&&(e=t,t=void 0),void 0===e&&(e=Xk(t,"onClose",void 0));var i=Xk(t,"onOpen",void 0),n=Xk(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={});var i=t.scene,n=t.style,s=Uk(e,"backgroundColor",n.backgroundColor);null===s&&(s="transparent"),e.text=Uk(e,"text",t.text),e.fontFamily=Uk(e,"fontFamily",n.fontFamily),e.fontSize=Uk(e,"fontSize",n.fontSize),e.color=Uk(e,"color",n.color),e.backgroundColor=s,e.direction=Uk(e,"rtl",n.rtl)?"rtl":"ltr",e.align=Uk(e,"align",Hk(n)),"rtl"===e.direction&&bg(t)&&(e.align="right");var r=new Lk(i,t.x,t.y,Uk(e,"width",t.width),Uk(e,"height",t.height),e);return r.setOrigin(t.originX,t.originY),i.add.existing(r),r}(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,Xk(t,"enterClose",!0)&&this.scene.input.keyboard.once("keydown-ENTER",this.close,this),this.delayCall=this.scene.time.delayedCall(0,function(){this.scene.input.once("pointerdown",this.close,this),i&&i(this.parent)},[],this),this}},{key:"close",value:function(){return Nk=void 0,this.inputText&&(this.parent.setVisible(!0),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}},{key:"isOpened",get:function(){return void 0!==this.inputText}},{key:"text",get:function(){return this.isOpened?this.inputText.text:this.parent.text}}]),n}(),Kk=Phaser.Utils.Objects.GetValue,Zk=Phaser.Utils.Objects.GetValue,qk=function(t){var e=Ak(this.input.targetSizers,t.x,t.y),i=this.input.lastOverChild;e&&i&&e===i||(this.input.lastOverChild=e,Fk(this.eventEmitter,"".concat(this.input.eventNamePrefix,"out"),this.input.targetSizers,i,void 0,t),Fk(this.eventEmitter,"".concat(this.input.eventNamePrefix,"over"),this.input.targetSizers,e,void 0,t))},$k=function(t){var e=this.input.lastOverChild;this.input.lastOverChild=null,Fk(this.eventEmitter,"".concat(this.input.eventNamePrefix,"out"),this.input.targetSizers,e,void 0,t)},Qk=Phaser.Utils.Objects.GetValue,tm=Phaser.Utils.Objects.GetValue,em=Phaser.Utils.Objects.GetValue,im=Phaser.Utils.Objects.GetValue,nm=function(t,e){Qh(t,e)},sm=function(t,e){tl(t,e,void 0,void 0,!1)},rm=function(t,e){il(t,e)},om=function(t,e){nl(t,e,!1)},am=function(){w(s,$f);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,e)).parent=t,i.init(),i}return m(s,[{key:"init",value:function(){this.start("IDLE")}},{key:"next_IDLE",value:function(){return"TRANS_OPNE"}},{key:"next_TRANS_OPNE",value:function(){return"OPEN"}},{key:"enter_TRANS_OPNE",value:function(){var t=this.parent;t.transitionIn(),t.delayCall(t.transitInTime,this.next,this)}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall()}},{key:"next_OPEN",value:function(){return"TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){var t=this.parent,e=t.displayTime;0<=e&&t.delayCall(e,t.requestClose,t),t.onOpen()}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall()}},{key:"next_TRANS_CLOSE",value:function(){return"CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;t.transitionOut(),t.delayCall(t.transitOutTime,this.next,this)}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall()}},{key:"next_CLOSE",value:function(){}},{key:"enter_CLOSE",value:function(){this.parent.onClose()}},{key:"exit_CLOSE",value:function(){}}]),s}(),hm=Phaser.Utils.Objects.GetValue,lm=Phaser.Time.TimerEvent,um=function(){w(l,fo);var h=T(l);function l(t,e){var i;B(this,l),i=h.call(this,t,e);var n,s,r,o,a=hm(e,"cover");(i.cover=!1!==a?(s=a,r=(n=t).scene,o=new Dc(r,s),r.add.existing(o),n.isRexContainerLite?n.moveDepthBelow(o):r.children.moveBelow(o,n),o):void 0,hm(e,"manualClose",!0))?i.setDisplayTime(-1):(i.setDisplayTime(hm(e,"duration.hold",2e3)),hm(e,"anyTouchClose",!0)&&i.anyTouchClose());return i.setTransitInTime(hm(e,"duration.in",200)),i.setTransitOutTime(hm(e,"duration.out",200)),i.setTransitInCallback(hm(e,"transitIn",cm.popUp)),i.setTransitOutCallback(hm(e,"transitOut",cm.scaleDown)),i.destroyParent=hm(e,"destroy",!0),i.timer=new lm,i._state=new am(z(i),{eventEmitter:!1}),i.closeEventData=void 0,i._state.next(),i}return m(l,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.requestClose,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),this.transitInCallback=void 0,this.transitOutCallback=void 0,this.closeEventData=void 0,this.removeDelayCall(),O(C(l.prototype),"shutdown",this).call(this,t))}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.requestClose,this):this.scene.input.once("pointerup",this.requestClose,this),this}},{key:"transitionIn",value:function(){var t=this.transitInTime;this.transitInCallback&&this.transitInCallback(this.parent,t);var e=this.cover;return e&&il(e,t,e.alpha),this}},{key:"transitionOut",value:function(){var t=this.transitOutTime;this.transitOutCallback&&this.transitOutCallback(this.parent,t);var e=this.cover;return e&&nl(e,t,!1),this}},{key:"onOpen",value:function(){this.emit("open",this.parent,this)}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),this.destroyParent?this.parent.destroy():this.destroy()}},{key:"delayCall",value:function(t,e,i,n){return this.timer=this.scene.time.delayedCall(t,e,n,i),this}},{key:"removeDelayCall",value:function(){return this.timer&&(this.timer.remove(!1),this.timer=void 0),this}},{key:"setTransitInTime",value:function(t){return this.transitInTime=t,this}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitOutTime",value:function(t){return this.transitOutTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=cm[t]),t){case cm.popUp:t=nm;break;case cm.fadeIn:t=rm}return this.transitInCallback=t,this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=cm[t]),t){case cm.scaleDown:t=sm;break;case cm.fadeOut:t=om}return this.transitOutCallback=t,this}},{key:"requestClose",value:function(t){return"OPEN"===this._state.state&&(this.closeEventData=0<arguments.length?t:this.parent,this._state.next()),this}}]),l}(),cm={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},dm=function(){w(s,Phaser.Plugins.ScenePlugin);var n=T(s);function s(t,e){var i;return B(this,s),(i=n.call(this,t,e)).add=new u(t),i}return m(s,[{key:"start",value:function(){this.scene.events.on("destroy",this.destroy,this)}},{key:"isInTouching",value:function(t,e,i,n){return!!t.visible&&fl(t,e,i,n)}},{key:"viewport",get:function(){return $h(this.scene,!0)}}]),s}(),fm={getParentSizer:Li,getTopmostSizer:ji,hide:ul,show:ll,isShown:cl,edit:function(t,e,i){return t._edit||(t._edit=new Jk(t)),t._edit.open(e,i),t._edit},wrapExpandText:function(t,e){var s,i,n;return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=t instanceof cs?(n=t,function(t){return n.setFixedSize(t,0).runWordWrap(),n}):xg(t)?(i=t,function(t){return i.setMaxWidth(t),i}):(s=t,function(t){var e=s.padding,i=t-e.left-e.right,n=s.style;return bg(s)?n.wordWrapWidth=i:(0===n.wrapMode&&(n.wrapMode=1),n.wrapWidth=i),n.maxLines=0,s.setFixedSize(t,0),s}),t},waitEvent:Ps,waitComplete:Ts,setChildrenInteractive:function(t,e){return t.setInteractive(),t.eventEmitter=im(e,"eventEmitter",t),t.input.targetSizers=im(e,"targets",[t]),t.input.eventNamePrefix=im(e,"inputEventPrefix","child."),function(t){var e=Kk(t,"click",void 0);!1!==e&&(void 0===e&&(e={}),e.hasOwnProperty("threshold")||(e.threshold=10),this._click=new Ql(this,e),this._click.on("click",function(t,e,i){Fk(this.eventEmitter,"".concat(this.input.eventNamePrefix,"click"),this.input.targetSizers,i.x,i.y,i)},this))}.call(t,e),function(t){!1!==Zk(t,"over",void 0)&&this.on("pointermove",qk,this).on("pointerover",qk,this).on("pointerout",$k,this)}.call(t,e),function(t){var e=Qk(t,"tap",void 0);!1!==e&&(this._tap=new sv(this,e),this._tap.on("tap",function(t,e,i){Fk(this.eventEmitter,"".concat(this.input.eventNamePrefix).concat(t.tapsCount,"tap"),this.input.targetSizers,t.x,t.y,i)},this))}.call(t,e),function(t){var e=tm(t,"press",void 0);!1!==e&&(this._press=new lv(this,e),this._press.on("pressstart",function(t,e,i){Fk(this.eventEmitter,"".concat(this.input.eventNamePrefix,"pressstart"),this.input.targetSizers,t.x,t.y,i)},this).on("pressend",function(t,e,i){Fk(this.eventEmitter,"".concat(this.input.eventNamePrefix,"pressend"),this.input.targetSizers,t.x,t.y,i)},this))}.call(t,e),function(t){var e=em(t,"swipe",void 0);!1!==e&&(void 0===e&&(e={}),e.dir="4dir",this._swipe=new Pv(this,e),this._swipe.on("swipe",function(t,e,i){var n=t.left?"left":t.right?"right":t.up?"up":"down";Fk(this.eventEmitter,"".concat(this.input.eventNamePrefix,"swipe").concat(n),this.input.targetSizers,t.x,t.y,i)},this))}.call(t,e),t},fadeIn:il,fadeOutDestroy:nl,easeMoveTo:ol,easeMoveFrom:al,modal:Yk,modalPromise:function(t,e){var i=Yk(t,e);return new Promise(function(e,t){i.once("close",function(t){e(t)})})},modalClose:function(t,e){t.emit("modal.requestClose",e)}};return Object.assign(dm.prototype,fm),dm});