text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).rexuiplugin=e()}(this,function(){"use strict";function c(t){return(c="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 z(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 k(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}function t(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 p(t){return(p=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 _(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function e(r){return function(){var t,e,i,n=p(r);if(function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),1}catch(t){return}}}()){var s=p(this).constructor;t=Reflect.construct(n,arguments,s)}else t=n.apply(this,arguments);return e=this,!(i=t)||"object"!=typeof i&&"function"!=typeof i?_(e):i}}function l(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}function g(t,e,i){return(g="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 s(t,e,i,n,s){if(!r(t,e,i,n||t)&&s)throw new Error("failed to set property");return i}function h(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return o(t,e)}(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 o(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 v(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 a(t,e,i,n,s,r,o,a,h){var l,u,c;o&&(r+=360),s=C(s);for(var d=((r=C(r))-s)/a,f=0;f<=a;f++)c=s+d*f,l=t+i*Math.cos(c),u=e+n*Math.sin(c),v(l,u,h);return h}var u=function(){function i(t){z(this,i),this.scene=t}return k(i,null,[{key:"register",value:function(t,e){i.prototype[t]=e}}]),i}(),d=Phaser.Utils.Objects.GetValue,f=function(){function r(t,e,i,n,s){z(this,r),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,n,s)}return k(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=d(t,"x",0),d(t,"y",0));var n=this.cornerRadius;return n.tl=m(d(t,"tl",void 0),e,i),n.tr=m(d(t,"tr",void 0),e,i),n.bl=m(d(t,"bl",void 0),e,i),n.br=m(d(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}(),m=function(t,e,i){return void 0===t?{x:e,y:i}:"number"==typeof t?{x:t,y:t}:t},b=Math.PI/180,C=function(t){return t*b},w=S;function S(t,e,i){i=i||2;var n,s,r,o,a,h,l,u=e&&e.length,c=u?e[0]*i:t.length,d=O(t,0,c,i,!0),f=[];if(!d||d.next===d.prev)return f;if(u&&(d=function(t,e,i,n){var s,r,o,a,h,l=[];for(s=0,r=e.length;s<r;s++)o=e[s]*n,a=s<r-1?e[s+1]*n:t.length,(h=O(t,o,a,n,!1))===h.next&&(h.steiner=!0),l.push(Y(h));for(l.sort(D),s=0;s<l.length;s++)I(l[s],i),i=P(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=r=t[0],s=o=t[1];for(var v=i;v<c;v+=i)(a=t[v])<n&&(n=a),(h=t[v+1])<s&&(s=h),r<a&&(r=a),o<h&&(o=h);l=0!==(l=Math.max(r-n,o-s))?1/l:0}return T(d,f,i,n,s,l),f}function O(t,e,i,n,s){var r,o;if(s===0<N(t,e,i,n))for(r=e;r<i;r+=n)o=V(r,t[r],t[r+1],o);else for(r=i-n;e<=r;r-=n)o=V(r,t[r],t[r+1],o);return o&&A(o,o.next)&&(W(o),o=o.next),o}function P(t,e){if(!t)return t;e=e||t;var i,n=t;do{if(i=!1,n.steiner||!A(n,n.next)&&0!==F(n.prev,n,n.next))n=n.next;else{if(W(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function T(t,e,i,n,s,r,o){if(t){!o&&r&&function(t,e,i,n){var s=t;for(;null===s.z&&(s.z=R(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next,s!==t;);s.prevZ.nextZ=null,s.prevZ=null,function(t){var e,i,n,s,r,o,a,h,l=1;do{for(i=t,r=t=null,o=0;i;){for(o++,n=i,e=a=0;e<l&&(a++,n=n.nextZ);e++);for(h=l;0<a||0<h&&n;)0!==a&&(0===h||!n||i.z<=n.z)?(i=(s=i).nextZ,a--):(n=(s=n).nextZ,h--),r?r.nextZ=s:t=s,s.prevZ=r,r=s;i=n}r.nextZ=null,l*=2}while(1<o)}(s)}(t,n,s,r);for(var a,h,l=t;t.prev!==t.next;)if(a=t.prev,h=t.next,r?E(t,n,s,r):M(t))e.push(a.i/i),e.push(t.i/i),e.push(h.i/i),W(t),t=h.next,l=h.next;else if((t=h)===l){o?1===o?T(t=B(t,e,i),e,i,n,s,r,2):2===o&&j(t,e,i,n,s,r):T(P(t),e,i,n,s,r,1);break}}}function M(t){var e=t.prev,i=t,n=t.next;if(!(0<=F(e,i,n))){for(var s=t.next.next;s!==t.prev;){if(L(e.x,e.y,i.x,i.y,n.x,n.y,s.x,s.y)&&0<=F(s.prev,s,s.next))return;s=s.next}return 1}}function E(t,e,i,n){var s=t.prev,r=t,o=t.next;if(!(0<=F(s,r,o))){for(var a=s.x<r.x?s.x<o.x?s.x:o.x:r.x<o.x?r.x:o.x,h=s.y<r.y?s.y<o.y?s.y:o.y:r.y<o.y?r.y:o.y,l=s.x>r.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,u=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,c=R(a,h,e,i,n),d=R(l,u,e,i,n),f=t.prevZ,v=t.nextZ;f&&f.z>=c&&v&&v.z<=d;){if(f!==t.prev&&f!==t.next&&L(s.x,s.y,r.x,r.y,o.x,o.y,f.x,f.y)&&0<=F(f.prev,f,f.next))return;if(f=f.prevZ,v!==t.prev&&v!==t.next&&L(s.x,s.y,r.x,r.y,o.x,o.y,v.x,v.y)&&0<=F(v.prev,v,v.next))return;v=v.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&L(s.x,s.y,r.x,r.y,o.x,o.y,f.x,f.y)&&0<=F(f.prev,f,f.next))return;f=f.prevZ}for(;v&&v.z<=d;){if(v!==t.prev&&v!==t.next&&L(s.x,s.y,r.x,r.y,o.x,o.y,v.x,v.y)&&0<=F(v.prev,v,v.next))return;v=v.nextZ}return 1}}function B(t,e,i){var n=t;do{var s=n.prev,r=n.next.next;!A(s,r)&&X(s,n,n.next,r)&&H(s,r)&&H(r,s)&&(e.push(s.i/i),e.push(n.i/i),e.push(r.i/i),W(n),W(n.next),n=t=r),n=n.next}while(n!==t);return n}function j(t,e,i,n,s,r){var o,a,h=t;do{for(var l=h.next.next;l!==h.prev;){if(h.i!==l.i&&(a=l,(o=h).next.i!==a.i&&o.prev.i!==a.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&X(i,i.next,t,e))return 1;i=i.next}while(i!==t);return}(o,a)&&H(o,a)&&H(a,o)&&function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;for(;i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next,i!==t;);return n}(o,a))){var u=U(h,l);return h=P(h,h.next),u=P(u,u.next),T(h,e,i,n,s,r),void T(u,e,i,n,s,r)}l=l.next}h=h.next}while(h!==t)}function D(t,e){return t.x-e.x}function I(t,e){if(e=function(t,e){var i,n=e,s=t.x,r=t.y,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){var a=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=s&&o<a){if((o=a)===s){if(r===n.y)return n;if(r===n.next.y)return n.next}i=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!i)return null;if(s===o)return i.prev;var h,l=i,u=i.x,c=i.y,d=1/0;n=i.next;for(;n!==l;)s>=n.x&&n.x>=u&&s!==n.x&&L(r<c?s:o,r,u,c,r<c?o:s,r,n.x,n.y)&&((h=Math.abs(r-n.y)/(s-n.x))<d||h===d&&n.x>i.x)&&H(n,t)&&(i=n,d=h),n=n.next;return i}(t,e)){var i=U(e,t);P(i,i.next)}}function R(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*s)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*s)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Y(t){for(var e=t,i=t;e.x<i.x&&(i=e),(e=e.next)!==t;);return i}function L(t,e,i,n,s,r,o,a){return 0<=(s-o)*(e-a)-(t-o)*(r-a)&&0<=(t-o)*(n-a)-(i-o)*(e-a)&&0<=(i-o)*(r-a)-(s-o)*(n-a)}function F(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function A(t,e){return t.x===e.x&&t.y===e.y}function X(t,e,i,n){return A(t,e)&&A(i,n)||A(t,n)&&A(i,e)||0<F(t,e,i)!=0<F(t,e,n)&&0<F(i,n,t)!=0<F(i,n,e)}function H(t,e){return F(t.prev,t,t.next)<0?0<=F(t,e,t.next)&&0<=F(t,t.prev,e):F(t,e,t.prev)<0||F(t,t.next,e)<0}function U(t,e){var i=new G(t.i,t.x,t.y),n=new G(e.i,e.x,e.y),s=t.next,r=e.prev;return(t.next=e).prev=t,(i.next=s).prev=i,(n.next=i).prev=n,(r.next=n).prev=r,n}function V(t,e,i,n){var s=new G(t,e,i);return n?(s.next=n.next,(s.prev=n).next.prev=s,n.next=s):(s.prev=s).next=s,s}function W(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function G(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function N(t,e,i,n){for(var s=0,r=e,o=i-n;r<i;r+=n)s+=(t[o]-t[r])*(t[r+1]+t[o+1]),o=r;return s}S.deviation=function(t,e,i,n){var s=e&&e.length,r=s?e[0]*i:t.length,o=Math.abs(N(t,0,r,i));if(s)for(var a=0,h=e.length;a<h;a++){var l=e[a]*i,u=a<h-1?e[a+1]*i:t.length;o-=Math.abs(N(t,l,u,i))}var c=0;for(a=0;a<n.length;a+=3){var d=n[a]*i,f=n[a+1]*i,v=n[a+2]*i;c+=Math.abs((t[d]-t[v])*(t[1+f]-t[1+d])-(t[d]-t[f])*(t[1+v]-t[1+d]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},S.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},n=0,s=0;s<t.length;s++){for(var r=0;r<t[s].length;r++)for(var o=0;o<e;o++)i.vertices.push(t[s][r][o]);0<s&&(n+=t[s-1].length,i.holes.push(n))}return i};function J(t,e,i,n,s){var r=this.pipeline,o=r._tempMatrix1,a=r._tempMatrix2,h=r._tempMatrix3;t.setPipeline(r),a.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),o.copyFrom(n.matrix),s?(o.multiplyWithOffset(s,-n.scrollX*e.scrollFactorX,-n.scrollY*e.scrollFactorY),a.e=e.x,a.f=e.y):(a.e-=n.scrollX*e.scrollFactorX,a.f-=n.scrollY*e.scrollFactorY),o.multiply(a,h);var l=e._displayOriginX,u=e._displayOriginY,c=n.alpha*e.alpha;e.isFilled&&Z(r,h,e,c,l,u),e.isStroked&&$(r,e,c,l,u)}var K=Phaser.Renderer.WebGL.Utils,Z=function(t,e,i,n,s,r){for(var o=K.getTintAppendFloatAlphaAndSwap(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,v=a[1+u]-r,p=a[0+c]-s,g=a[1+c]-r,y=a[0+d]-s,m=a[1+d]-r,x=e.getX(f,v),b=e.getY(f,v),k=e.getX(p,g),C=e.getY(p,g),w=e.getX(y,m),S=e.getY(y,m);t.setTexture2D(),t.batchTri(x,b,k,C,w,S,0,0,1,1,o,o,o,t.tintEffect)}},q=Phaser.Renderer.WebGL.Utils,$=function(t,e,i,n,s){var r=t.strokeTint,o=q.getTintAppendFloatAlphaAndSwap(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 v=a[f]-n,p=a[f+1]-s;t.setTexture2D(),t.batchLine(c,d,v,p,u,u,l,f-2,!!e.closePath&&f===h-1),c=v,d=p}},Q=function(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+")"},tt=function(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},et=Phaser.Renderer.Canvas.SetTransform,it={renderWebGL:J,renderCanvas:function(t,e,i,n,s){var r=t.currentContext;if(et(t,r,e,n,s)){var o=e._displayOriginX,a=e._displayOriginY,h=e.pathData,l=h.length-1,u=h[0]-o,c=h[1]-a;r.beginPath(),r.moveTo(u,c),e.closePath||(l-=2);for(var d=2;d<l;d+=2){var f=h[d]-o,v=h[d+1]-a;r.lineTo(f,v)}r.closePath(),e.isFilled&&(Q(r,e),r.fill()),e.isStroked&&(tt(r,e),r.stroke()),r.restore()}}},nt=Phaser.Utils.Objects.GetValue,st=function(){t(d,Phaser.GameObjects.Shape);var c=e(d);function d(t,e,i,n,s,r,o,a){var h;z(this,d),void 0===e&&(e=0),void 0===i&&(i=0);var l=nt(r,"iteration",void 0);r=nt(r,"radius",r);var u=new f(0,0,n,s,r);return(h=c.call(this,t,"RoundRectangle",u)).setIteration(l),h.setPosition(e,i),void 0!==o&&h.setFillStyle(o,a),h.updateDisplayOrigin(),h.updateData(),h}return k(d,[{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,rt(i)){var r=t.width-i.x,o=t.height-i.y;a(r,o,i.x,i.y,0,90,!1,s,e)}else v(t.width,t.height,e);if(i=n.bl,rt(i)){r=i.x,o=t.height-i.y;a(r,o,i.x,i.y,90,180,!1,s,e)}else v(0,t.height,e);if(i=n.tl,rt(i)){r=i.x,o=i.y;a(r,o,i.x,i.y,180,270,!1,s,e)}else v(0,0,e);if(i=n.tr,rt(i)){r=t.width-i.x,o=i.y;a(r,o,i.x,i.y,270,360,!1,s,e)}else v(t.width,0,e);return e.push(e[0],e[1]),this.pathIndexes=w(e),this}},{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.updateData();var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{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:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.updateData()):this._iteration=t}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.updateData()}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t}}]),d}(),rt=function(t){return 0!==t.x&&0!==t.y};Object.assign(st.prototype,it);function ot(t){return null==t||""===t||0===t.length}function at(t,e,i){if("object"===c(t)){if(ot(e)){if(null==i)return;"object"===c(i)&&(t=i)}else{"string"==typeof e&&(e=e.split("."));var n=e.pop();(function(t,e,i){var n=t;if(!ot(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"!==c(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("roundRectangle",function(t,e,i,n,s,r,o){var a=new st(this.scene,t,e,i,n,s,r,o);return this.scene.add.existing(a),a}),at(window,"RexPlugins.UI.RoundRectangle",st);function ht(t){var e=pt.create(this),i=e.getContext("2d");t.syncFont(e,i);var n=Math.ceil(i.measureText(t.testString).width*t.baselineX),s=n,r=2*s;s=s*t.baselineY|0,e.width=n,e.height=r,i.fillStyle="#f00",i.fillRect(0,0,n,r),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,s);var o={ascent:0,descent:0,fontSize:0};if(!i.getImageData(0,0,n,r))return o.ascent=s,o.descent=s+6,o.fontSize=o.ascent+o.descent,pt.remove(e),o;var a,h,l=i.getImageData(0,0,n,r).data,u=l.length,c=4*n,d=0,f=!1;for(a=0;a<s;a++){for(h=0;h<c;h+=4)if(255!==l[d+h]){f=!0;break}if(f)break;d+=c}for(o.ascent=s-a,d=u-c,f=!1,a=r;s<a;a--){for(h=0;h<c;h+=4)if(255!==l[d+h]){f=!0;break}if(f)break;d-=c}return o.descent=a-s,o.fontSize=o.ascent+o.descent,pt.remove(e),o}function lt(t){if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e]}function ut(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:lt(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 ct(){}function dt(t,e,i,n,s){n<=0&&(i=Jt);var r=qt;if($t.pushMultiple(r),!t||!t.length)return r;for(var o,a,h,l=t.split(Zt),u=0,c=l.length;u<c;u++)if(o=l[u],h=u===c-1?Wt:Gt,i!==Jt){var d,f;if(a=0===u?n-s:n,o.length<=100)if((b=e(o))<=a){r.push($t.newline(o,b,h));continue}for(var v,p="",g="",y=0,m=0,x=(d=i===Kt?o.split(" "):o).length;m<x;m++)f=d[m],i===Kt?(p+=f,m<x-1&&(p+=" ")):p+=f,a<(v=e(p))&&(0===m?r.push($t.newline("",0,Nt)):(r.push($t.newline(g,y,Nt)),p=f,i===Kt&&m<x-1&&(p+=" "),v=e(p)),a=n),g=p,y=v;r.push($t.newline(g,y,h))}else{var b=e(o);r.push($t.newline(o,b,h))}return r}var ft=Phaser.Renderer.WebGL.Utils,vt={renderWebGL:function(t,e,i,n,s){if(0!==e.width&&0!==e.height){var r=e.frame,o=r.width,a=r.height,h=ft.getTintAppendFloatAlpha;this.pipeline.batchTexture(e,r.glTexture,o,a,e.x,e.y,o/e.style.resolution,a/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,o,a,h(e._tintTL,n.alpha*e._alphaTL),h(e._tintTR,n.alpha*e._alphaTR),h(e._tintBL,n.alpha*e._alphaBL),h(e._tintBR,n.alpha*e._alphaBR),e._isTinted&&e.tintFill,0,0,n,s)}},renderCanvas:function(t,e,i,n,s){0!==e.width&&0!==e.height&&t.batchSprite(e,e.frame,n,s)}},pt=Phaser.Display.Canvas.CanvasPool,gt=0,yt=1,mt=2,xt=0,bt=1,kt=2,Ct=/(?:\r\n|\r|\n)/,wt=Phaser.Utils.Objects.GetAdvancedValue,St=Phaser.Utils.Objects.GetValue,Ot={backgroundColor:["backgroundColor",null],fontFamily:["fontFamily","Courier"],fontSize:["fontSize","16px"],fontStyle:["fontStyle",""],color:["color","#fff"],stroke:["stroke","#fff"],strokeThickness:["strokeThickness",0],shadowOffsetX:["shadow.offsetX",0],shadowOffsetY:["shadow.offsetY",0],shadowColor:["shadow.color","#000"],shadowBlur:["shadow.blur",0],shadowStroke:["shadow.stroke",!1],shadowFill:["shadow.fill",!1],underlineColor:["underline.color","#000"],underlineThickness:["underline.thickness",0],underlineOffset:["underline.offset",0],halign:["halign","left"],valign:["valign","top"],maxLines:["maxLines",0],fixedWidth:["fixedWidth",0],fixedHeight:["fixedHeight",0],resolution:["resolution",0],lineSpacing:["lineSpacing",0],rtl:["rtl",!1],testString:["testString","|MÃ‰qgy"],baselineX:["baselineX",1.2],baselineY:["baselineY",1.4],wrapMode:["wrap.mode",1],wrapWidth:["wrap.width",0]},Pt=function(){function n(t,e){z(this,n),this.parent=t,this.backgroundColor,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.rtl,this.testString,this.baselineX,this.baselineY,this._font,this.setStyle(e,!1);var i=St(e,"metrics",!1);this.metrics=i?{ascent:St(i,"ascent",0),descent:St(i,"descent",0),fontSize:St(i,"fontSize",0)}:ht(this)}return k(n,[{key:"setStyle",value:function(t,e){if(void 0===e&&(e=!0),t&&t.hasOwnProperty("wrap")){var i=t.wrap;if(i.hasOwnProperty("mode")){var n=i.mode;"string"==typeof n&&(i.mode=Tt[n])}else i.hasOwnProperty("width")&&(i.mode=1)}for(var s in t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px"),Ot)this[s]=("wrapCallback"===s||"wrapCallbackScope"===s?St:wt)(t,Ot[s][0],Ot[s][1]);var r=St(t,"font",null);this._font=null===r?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:r;var o=St(t,"fill",null);return null!==o&&(this.color=o),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=this.fontStyle+" "+this.fontSize+" "+this.fontFamily,this.metrics=ht(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t=this.fontStyle+" "+this.fontSize+" "+this.fontFamily;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=St(t,"fontFamily","Courier"),this.fontSize=St(t,"fontSize","16px"),this.fontStyle=St(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(!1)}},{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:"setBackgroundColor",value:function(t){return this.backgroundColor=t,this.update(!1)}},{key:"setFill",value:function(t){return this.color=t,this.update(!1)}},{key:"setColor",value:function(t){return this.color=t,this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=t,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=i,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=t,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=t,this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=t,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=Tt[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:"toJSON",value:function(){var t={};for(var e in Ot)t[e]=this[e];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}}]),n}(),Tt={none:xt,word:bt,char:kt,character:kt},Mt={draw:function(t,e,i,n){var s=this.penManager;this.hitAreaManager.clear();var r=this.context;r.save(),this.drawBackground(this.defatultStyle.backgroundColor);var o=this.defatultStyle;t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,v=o.valign,p=o.lineHeight,g=s.lines,y=g.length,m=o.maxLines;u=(l=0<m&&m<y?(h=m,"center"===v?Math.floor((y-h)/2):"bottom"===v?y-h:0):(h=y,0))+h,d="center"===v?Math.max((n-h*p)/2,0):"bottom"===v?Math.max(n-h*p-2,0):0,d+=e;for(var x=l;x<u;x++)if(0!==(a=s.getLineWidth(x))){c="center"===f?(i-a)/2:"right"===f?i-a:0,c+=t;for(var b=g[x],k=0,C=b.length;k<C;k++)this.drawPen(b[k],c,d)}r.restore()},drawPen:function(t,e,i){e+=t.x,i+=t.y;var n=this.canvas,s=this.context;s.save();var r=this.parser.propToContextStyle(this.defatultStyle,t.prop);r.buildFont(),r.syncFont(n,s),r.syncStyle(n,s),0<r.underlineThickness&&0<t.width&&this.drawUnderline(e,i,t.width,r),t.isTextPen&&this.drawText(e,i,t.text,r),t.isImagePen&&this.drawImage(e,i,t.prop.img,r),s.restore(),t.hasAreaMarker&&0<t.width&&this.hitAreaManager.add(t.prop.area,e,i-this.startYOffset,t.width,this.defatultStyle.lineHeight)},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawBackground:function(t){null!==t&&(this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.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.beginPath(),s.strokeStyle=n.underlineColor,s.lineWidth=n.underlineThickness,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.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){var n=this.parent.imageManager,s=n.get(i),r=n.getFrame(i);t+=s.left,e+=-this.startYOffset+s.y,this.autoRound&&(t=Math.round(t),e=Math.round(e)),this.context.drawImage(r.source.image,r.cutX,r.cutY,r.cutWidth,r.cutHeight,t,e,s.width,s.height)}},Et=function(){function t(){z(this,t),this.items=[]}return k(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}(),Bt=Phaser.Utils.Objects.GetValue,zt=gt,_t=yt,jt=function(){function e(t){z(this,e),this.prop={},this.resetFromJSON(t)}return k(e,[{key:"resetFromJSON",value:function(t){this.text=Bt(t,"text",""),this.x=Bt(t,"x",0),this.y=Bt(t,"y",0),this.width=Bt(t,"width",0);var e=Bt(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Bt(t,"newLineMode",0),this.startIndex=Bt(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!==zt&&(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}(),Dt=Phaser.Utils.Objects.GetFastValue,It=gt,Rt=mt,Yt=new Et,Lt=new Et,Ft=function(){function a(t){z(this,a),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.PensPool=Dt(t,"pensPool",Yt),this.LinesPool=Dt(t,"linesPool",Lt),this.tagToText=Dt(t,"tagToText",ct),this.tagToTextScope=Dt(t,"tagToTextScope",void 0)}return k(a,[{key:"destroy",value:function(){this.freePens(),this.tagToText=void 0,this.tagToTextScope=void 0}},{key:"freePens",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 jt),At.text=t,At.x=e,At.y=i,At.width=n,At.prop=s,At.newLineMode=r,o.resetFromJSON(At),this.addPen(o),this}},{key:"addImagePen",value:function(t,e,i,n){return this.addTextPen("",t,e,i,n,It),this}},{key:"addNewLinePen",value:function(){var t=this.lastPen,e=t?t.lastX:0,i=t?t.y:0,n=t?ut(t.prop):null;return this.addTextPen("",e,i,0,n,Rt),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!==It&&(i=this.LinesPool.pop()||[],this.lines.push(i)),this.maxLinesWidth=void 0}},{key:"clone",value:function(t){null==t&&(t=new a),t.freePens();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,ut(o.prop),o.newLineMode)}return t}},{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:"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:"lastPen",get:function(){return this.pens[this.pens.length-1]}},{key:"lastLine",get:function(){return this.lines[this.lines.length-1]}},{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}}]),a}(),At={},Xt=Phaser.Geom.Rectangle,Ht=new Et,Ut=function(){function t(){z(this,t),this.hitAreas=[]}return k(t,[{key:"destroy",value:function(){this.clear()}},{key:"clear",value:function(){return Ht.pushMultiple(this.hitAreas),this}},{key:"add",value:function(t,e,i,n,s){var r=Ht.pop();return null===r?r=new Xt(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}(),Vt=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)}},Wt=gt,Gt=yt,Nt=mt,Jt=xt,Kt=bt,Zt=Ct,qt=[],$t=new Et;$t.newline=function(t,e,i){var n=this.pop();return null===n&&(n={}),n.text=t,n.width=e,n.newLineMode=i,n};var Qt=Phaser.Utils.Objects.GetValue,te=xt,ee=gt,ie=function(){function i(t){z(this,i),this.parent=t.parent,this.context=Qt(t,"context",null),this.canvas=this.context.canvas,this.parser=Qt(t,"parser",null),this.defatultStyle=Qt(t,"style",null),this.autoRound=!0,this.pensPool=Qt(t,"pensPool",null),this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new Ut;var e=this.context;this.getTextWidth=function(t){return e.measureText(t).width}}return k(i,[{key:"destroy",value:function(){this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defatultStyle=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.freePens(),""===t)return s;for(var r,o,a,h,l,u=this.canvas,c=this.context,d=0,f=0,v=this.parser.splitText(t),p=0,g=v.length;p<g;p++)if(r=(h=this.parser.tagTextToProp(v[p],o)).plainText,(o=h.prop).img){var y=this.imageManager.getOuterWidth(o.img);0<i&&e!==te&&i<d+y&&(s.addNewLinePen(),f+=n,d=0),s.addImagePen(d,f,y,ut(o)),d+=y}else if(""!==r){var m;this.context.save(),(a=this.parser.propToContextStyle(this.defatultStyle,o)).buildFont(),a.syncFont(u,c),a.syncStyle(u,c);for(var x=0,b=(l=dt(r,this.getTextWidth,e,i,d)).length;x<b;x++)m=l[x],s.addTextPen(m.text,d,f,m.width,ut(o),m.newLineMode),m.newLineMode!==ee?(d=0,f+=n):d+=m.width;this.context.restore()}return s}},{key:"newPenManager",value:function(){return new Ft({pensPool:this.pensPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{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.defatultStyle;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.defatultStyle;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}},{key:"startXOffset",get:function(){return this.defatultStyle.strokeThickness/2}},{key:"startYOffset",get:function(){var t=this.defatultStyle;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.defatultStyle.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.defatultStyle.lineHeight*t;return 0<t&&(e-=this.defatultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}}]),i}(),ne={setInteractive:function(){this.parent.on("pointerdown",function(t,e,i,n){Vt.call(this,"areadown",t,e,i)},this).on("pointerup",function(t,e,i,n){Vt.call(this,"areaup",t,e,i)},this)}};Object.assign(ie.prototype,Mt,ne);var se,re=Phaser.Utils.Objects.GetValue,oe=function(){function e(t){z(this,e),this.textureManager=t,this.images={}}return k(e,[{key:"add",value:function(t,e){if("string"==typeof t)this._add(t,e);else if(Array.isArray(t))for(var i=0,n=(s=t).length;i<n;i++)this._add(s[i]);else{var s=t;for(var t in s)this._add(t,s[t])}return this}},{key:"_add",value:function(t,e){void 0===e&&(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:re(e,"y",0),left:re(e,"left",0),right:re(e,"right",0)}}},{key:"remove",value:function(t){return this.images.hasOwnProperty(t)&&delete this.images[t],this}},{key:"get",value:function(t){return this.images.hasOwnProperty(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}();var ae=Phaser.DOM.AddToDOM,he=Phaser.Display.Canvas.CanvasPool,le=Phaser.GameObjects.GameObject,ue=Phaser.Utils.Objects.GetValue,ce=Phaser.DOM.RemoveFromDOM,de=Ct,fe={},ve=function(){t(u,le);var l=e(u);function u(t,e,i,n,s,r,o){var a;if(z(this,u),void 0===e&&(e=0),void 0===i&&(i=0),(a=l.call(this,t,r)).renderer=t.sys.game.renderer,a.setPosition(e,i),a.setOrigin(0,0),a.initPipeline(),a.canvas=he.create(_(a)),a.context=a.canvas.getContext("2d"),s){if(s.hasOwnProperty("align")){var h=s.align;delete s.align,s.halign=h}s.hasOwnProperty("stroke")&&!s.hasOwnProperty("strokeThickness")&&(s.strokeThickness=1)}return a.style=new Pt(_(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=t.sys.game.config.resolution),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),fe.hasOwnProperty(r)||(fe[r]=new Et),a.canvasText=new ie({parent:_(a),context:a.context,parser:o,style:a.style,pensPool:fe[r]}),s&&s.padding&&a.setPadding(s.padding),a.setText(n),t.sys.game.events.on("contextrestored",function(){this.dirty=!0},_(a)),a}return k(u,[{key:"initRTL",value:function(){this.style.rtl&&(this.canvas.dir="rtl",this.context.direction="rtl",this.canvas.style.display="none",ae(this.canvas,this.scene.sys.canvas),this.originX=1)}},{key:"setText",value:function(t){return t||0===t||(t=""),Array.isArray(t)&&(t=t.join("\n")),t!==this._text&&(this._text=t.toString(),this.updateText()),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:"setFixedSize",value:function(t,e){return this.style.setFixedSize(t,e)}},{key:"setBackgroundColor",value:function(t){return this.style.setBackgroundColor(t)}},{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:"setAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setLineSpacing",value:function(t){return this.style.setLineSpacing(t)}},{key:"setPadding",value:function(t,e,i,n){if("object"===c(t)){var s=t,r=ue(s,"x",null);i=null!==r?t=r:(t=ue(s,"left",0),ue(s,"right",t));var o=ue(s,"y",null);n=null!==o?e=o:(e=ue(s,"top",0),ue(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:"setResolution",value:function(t){return this.style.setResolution(t)}},{key:"setMaxLines",value:function(t){return this.style.setMaxLines(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),e.draw(r.left,r.top,n,s),u.restore(),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 c=this.input;return c&&!c.customHitArea&&(c.hitArea.width=this.width,c.hitArea.height=this.height),this}},{key:"getTextMetrics",value:function(){return this.style.getTextMetrics()}},{key:"toJSON",value:function(){var t=pe.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:"preDestroy",value:function(){this.style.rtl&&ce(this.canvas),he.remove(this.canvas),this.canvasText.destroy()}},{key:"setInteractive",value:function(t,e,i){return le.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(de)}},{key:"getPlainText",value:function(t,e,i){return this.canvasText.getPlainText(t,e,i)}},{key:"getText",value:function(t,e,i){return this.canvasText.getText(t,e,i,!1)}},{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:"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:"text",set:function(t){this.setText(t)},get:function(){return this._text}},{key:"lineSpacing",set:function(t){this.setLineSpacing(t)},get:function(){return this.style.lineSpacing}},{key:"imageManager",get:function(){return t=this.scene.textures,void 0===se&&(se=new oe(t)),se;var t}}]),u}(),pe=Phaser.GameObjects.Components;Phaser.Class.mixin(ve,[pe.Alpha,pe.BlendMode,pe.ComputedSize,pe.Crop,pe.Depth,pe.Flip,pe.GetBounds,pe.Mask,pe.Origin,pe.Pipeline,pe.ScrollFactor,pe.Tint,pe.Transform,pe.Visible,vt]);var ge={plainText:null,prevProp:null},ye=new Pt,me={},xe={splitText:function(t,e){for(var i,n,s=[],r=0,o=t.length,a=o;i=Ce.exec(t);)n=i[0],r<(a=Ce.lastIndex-n.length)&&s.push(t.substring(r,a)),void 0===e&&s.push(n),r=Ce.lastIndex;return r<o&&s.push(t.substring(r,o)),s},tagTextToProp:function(t,e){var i,n;null==e&&(e={}),e.img&&be(e,Ue,"img"),i=we.test(t)?(be(e,Ve,"b",!0),""):Se.test(t)?(be(e,Ue,"b"),""):Oe.test(t)?(be(e,Ve,"i",!0),""):Pe.test(t)?(be(e,Ue,"i"),""):Te.test(t)?(n=t.match(Te),be(e,Ve,"size",n[1]+"px"),""):Me.test(t)?(be(e,Ue,"size"),""):Ee.test(t)?(n=t.match(Ee),be(e,Ve,"color",n[1]),""):Be.test(t)?(be(e,Ue,"color"),""):ze.test(t)?(n=t.match(ze),be(e,Ve,"u",!0),""):_e.test(t)?(n=t.match(_e),be(e,Ve,"u",n[1]),""):je.test(t)?(be(e,Ue,"u"),""):De.test(t)?(be(e,Ve,"shadow",!0),""):Ie.test(t)?(be(e,Ue,"shadow"),""):Re.test(t)?(be(e,Ve,"stroke",!0),""):Ye.test(t)?(n=t.match(Ye),be(e,Ve,"stroke",n[1]),""):Le.test(t)?(be(e,Ue,"stroke"),""):Fe.test(t)?(n=t.match(Fe),be(e,Ve,"img",n[1]),""):Ae.test(t)?(be(e,Ue,"img"),""):Xe.test(t)?(n=t.match(Xe),be(e,Ve,"area",n[1]),""):He.test(t)?(be(e,Ue,"area"),""):t;var s=ge;return s.plainText=i,s.prop=e,s},propToContextStyle:function(t,e){var i=ye;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=n.toString()+"px"),i.fontSize=n}else i.fontSize=t.fontSize;i.fontStyle=ke(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){for(var n in null==i&&(i=me),i)e.hasOwnProperty(n)||(t="[/"+n+"]"+t);var s="";for(var n in e)i[n]!==e[n]&&("size"===n?s+="[size="+e[n].replace("px","")+"]":"color"===n||"stroke"===n||"img"===n?s+="["+n+"="+e[n]+"]":"u"===n?!0===e[n]?s+="[u]":s+="[u="+e[n]+"]":s+="["+n+"]");return t=s+t}},be=function(t,e,i,n){return e===Ve?t[i]=n:t.hasOwnProperty(i)&&delete t[i],t},ke=function(t,e){return t&&e?"bold italic":t?"bold":e?"italic":""},Ce=/\[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\]|\[img=([^\]]+)\]|\[\/img\]|\[area=([^\]]+)\]|\[\/area\]/gi,we=/\[b\]/i,Se=/\[\/b\]/i,Oe=/\[i\]/i,Pe=/\[\/i\]/i,Te=/\[size=(\d+)\]/i,Me=/\[\/size\]/i,Ee=/\[color=([a-z]+|#[0-9abcdef]+)\]/i,Be=/\[\/color\]/i,ze=/\[u\]/i,_e=/\[u=([a-z]+|#[0-9abcdef]+)\]/i,je=/\[\/u\]/i,De=/\[shadow\]/i,Ie=/\[\/shadow\]/i,Re=/\[stroke\]/i,Ye=/\[stroke=([a-z]+|#[0-9abcdef]+)\]/i,Le=/\[\/stroke\]/i,Fe=/\[img=([^\]]+)\]/i,Ae=/\[\/img\]/i,Xe=/\[area=([^\]]+)\]/i,He=/\[\/area\]/i,Ue=!1,Ve=!0,We=function(){t(o,ve);var r=e(o);function o(t,e,i,n,s){return z(this,o),r.call(this,t,e,i,n,s,"rexBBCodeText",xe)}return o}();u.register("BBCodeText",function(t,e,i,n){var s=new We(this.scene,t,e,i,n);return this.scene.add.existing(s),s}),at(window,"RexPlugins.UI.BBCodeText",We);var Ge={plainText:null,prevProp:null},Ne=new Pt,Je=function(){function e(t){z(this,e),void 0===t&&(t={}),this.tags=t}return k(e,[{key:"addTag",value:function(t,e){this.tags[t]=e}},{key:"splitText",value:function(t,e){for(var i,n,s,r=[],o=0,a=t.length,h=a;i=qe.exec(t);)n=i[0],o<(h=qe.lastIndex-n.length)&&r.push(t.substring(o,h)),void 0===e?r.push(n):1===e&&($e.test(n)?(s=n.match(Qe),r.push(s[2])):ti.test(n)&&(s=n.match(ei),r.push(s[2]))),o=qe.lastIndex;return o<a&&r.push(t.substring(o,a)),r}},{key:"tagTextToProp",value:function(t){var e,i;if($e.test(t)){if(null!=(r=t.match(Qe))){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(ei))){var o=r[1];(i=Ke(o))._style=o,e=r[2]}}null==e&&(e=t),null==i&&(i={});var a=Ge;return a.plainText=e,a.prop=i,a}},{key:"propToContextStyle",value:function(t,e){var i=Ne;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=s.toString()+"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='"+e._class+"'>"+t+"</class>":e.hasOwnProperty("_style")?"<style='"+e._style+"'>"+t+"</style>":void 0}},{key:"destroy",value:function(){this.tags=void 0}},{key:"isTextTag",value:function(t){var e=this.tags[t];return!!e&&null==e.img}}]),e}(),Ke=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],!Ze(i)&&!Ze(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","")))}s[i]=n}return s},Ze=function(t){return 0===(t=t.replace(ii,"")).length},qe=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,$e=/<\s*class=/i,Qe=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,ti=/<\s*style=/i,ei=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,ii=/^\s+|\s+$/,ni=Phaser.Utils.Objects.GetValue,si=function(){t(l,ve);var h=e(l);function l(t,e,i,n,s){var r;z(this,l);var o=ni(s,"tags",void 0),a=new Je(o);return(r=h.call(this,t,e,i,n,s,"rexTagText",a)).parser=a,r}return k(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:"preDestroy",value:function(){g(p(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 si(this.scene,t,e,i,n);return this.scene.add.existing(s),s}),at(window,"RexPlugins.UI.TagText",si);var ri=Phaser.GameObjects.Zone,oi=Phaser.Utils.Array.Add,ai=Phaser.Utils.Array.Remove,hi=function(){t(a,ri);var o=e(a);function a(t,e,i,n,s){var r;return z(this,a),Array.isArray(n)&&(children=n,n=void 0),void 0===n&&(n=1),void 0===s&&(s=1),(r=o.call(this,t,e,i,n,s)).children=[],r}return k(a,[{key:"destroy",value:function(t){this.scene&&(this.clear(!t),g(p(a.prototype),"destroy",this).call(this,t))}},{key:"contains",value:function(t){return-1!==this.children.indexOf(t)}},{key:"add",value:function(t){return oi(this.children,t,0,function(t){t.on("destroy",this.remove,this)},this),this}},{key:"remove",value:function(t,e){return ai(this.children,t,function(t){t.off("destroy",this.remove,this),e&&t.destroy()}),this}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i<n;i++)(e=this.children[i]).off("destroy",this.remove,this),t&&e.destroy();return this.children.length=0,this}}]),a}(),li=Phaser.GameObjects.Components;Phaser.Class.mixin(hi,[li.Alpha,li.Flip]);function ui(t){var e;return t.hasOwnProperty("rexContainer")&&(e=t.rexContainer.parent),e}function ci(t){for(var e=ui(t);e;)e=ui(t=e);return t}function di(t){return this.setParent(t),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),gi.call(this,t),this}function fi(t,e){return t===e?1:t/e}function vi(t){return"[object Array]"===Object.prototype.toString.call(t)}var pi={setParent:function(t,e){void 0===e&&(e=this);var i=this.getLocalState(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),ui(t)},getTopmostParent:function(t){return void 0===t&&(t=this),ci(t)}},gi=hi.prototype.add,yi={add:function(t){return Array.isArray(t)?this.addMultiple(t):di.call(this,t),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)di.call(this,t[e]);return this}},mi=hi.prototype.remove,xi=hi.prototype.clear,bi={remove:function(t,e){return this.getParent(t)!==this||(this.setParent(t,null),mi.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 xi.call(this,t),this}},ki=Phaser.Math.RotateAround,Ci={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,ki(t,0,0,-this.rotation),t.x/=this.scaleX,t.y/=this.scaleY,t.x*=this.flipX?-1:1,t.y*=this.flipY?-1:1,t},localToWorld:function(t){return t.x*=this.flipX?-1:1,t.y*=this.flipY?-1:1,t.x*=this.scaleX,t.y*=this.scaleY,ki(t,0,0,this.rotation),t.x+=this.x,t.y+=this.y,t}},wi={updateChildPosition:function(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=this.getLocalState(t);return t.x=e.x,t.y=e.y,this.localToWorld(t),t.scaleX=e.scaleX*this.scaleX,t.scaleY=e.scaleY*this.scaleY,void 0!==t.flipX&&(t.flipX=this.flipX?!e.flipX:e.flipX,t.flipY=this.flipY?!e.flipY:e.flipY),t.rotation=e.rotation+this.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=this.getLocalState(t);return e.x=t.x,e.y=t.y,this.worldToLocal(e),e.scaleX=fi(t.scaleX,this.scaleX),e.scaleY=fi(t.scaleY,this.scaleY),void 0!==t.flipX&&(e.flipX=t.flipX,e.flipY=t.flipY),e.rotation=t.rotation-this.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=this.getLocalState(t);return n.x=e,n.y=i,this.updateChildPosition(t),this}},Si={updateChildVisible:function(t){return t.visible=this.visible&&this.getLocalState(t).visible,this},syncVisible:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState:function(t){return this.getLocalState(t).visible=t.visible,this},setChildVisible:function(t,e){return t.visible=e,this.resetChildVisibleState(t),this},setChildLocalVisible:function(t,e){return void 0===e&&(e=!0),this.getLocalState(t).visible=e,this.updateChildVisible(t),this}},Oi={updateChildAlpha:function(t){return t.alpha=this.alpha*this.getLocalState(t).alpha,this},syncAlpha:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState:function(t){return this.getLocalState(t).alpha=fi(t.alpha,this.alpha),this},setChildAlpha:function(t,e){return t.alpha=e,this.resetChildAlphaState(t),this._add},setChildLocalAlpha:function(t,e){return this.getLocalState(t).alpha=e,this.updateChildAlpha(t),this}},Pi={updateChildActive:function(t){return t.active=this.active&&this.getLocalState(t).active,this},syncActive:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState:function(t){return this.getLocalState(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),this.getLocalState(t).active=e,this.updateChildActive(t),this}},Ti={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}},Mi=Phaser.Utils.Array,Ei={getChildren:function(){return this.children},getAllChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,s=i.length;n<s;n++){if(e=i[n],t.push(e),e.hasOwnProperty("isRexContainerLite"))t.push.apply(t,h(e.getAllChildren()))}return t},contains:function(t){var e=this.getParent(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 Mi.GetFirst(this.children,"name",t)},getRandom:function(t,e){return Mi.GetRandom(this.children,t,e)},getFirst:function(t,e,i,n){return Mi.GetFirstElement(this.children,t,e,i,n)},getAll:function(t,e,i,n){return Mi.GetAll(this.children,t,e,i,n)},count:function(t,e,i,n){return Mi.CountAllMatching(this.children,t,e,i,n)},swap:function(t,e){return Mi.Swap(this.children,t,e),this},moveTo:function(t,e){return Mi.MoveTo(this.children,t,e),this},setAll:function(t,e,i,n){return Mi.SetAll(this.children,t,e,i,n),this}},Bi={tweenChild:function(t){var e=t.targets;vi(e)||(e=[e]);for(var i,n,s=[],r=0,o=e.length;r<o;r++)(n=e[r]).hasOwnProperty("rexContainer")&&(i=n.scene,s.push(n.rexContainer));if(i){t.targets=s;var a=i.tweens.add(t);return a.on("update",function(t,e,i){for(var n,s,r=0,o=i.length;r<o;r++)switch(n=i.parent,s=i.self,e){case"x":case"y":case"angle":case"rotation":case"scaleX":case"scaleY":case"flipX":case"flipY":n.updateChildPosition(s);break;case"alpha":n.updateChildAlpha(s)}}),a}},tween:function(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}},zi={};Object.assign(zi,pi,yi,bi,{getLocalState:function(t){return t.hasOwnProperty("rexContainer")||(t.rexContainer={}),t.rexContainer},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}},Ci,wi,Si,Oi,Pi,{updateChildScrollFactor:function(t){return t.setScrollFactor(this.scrollFactorX,this.scrollFactorY),this},syncScrollFactor:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Ti,{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}},Ei,Bi);var _i=function(){t(h,hi);var a=e(h);function h(t,e,i,n,s,r){var o;return z(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 k(h,[{key:"destroy",value:function(t){this.scene&&(this.syncChildrenEnable=!1,g(p(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 g(p(h.prototype),"rotation",this)},set:function(t){this.rotation!==t&&(s(p(h.prototype),"rotation",t,this,!0),this.syncPosition())}},{key:"scaleX",get:function(){return g(p(h.prototype),"scaleX",this)},set:function(t){this.scaleX!==t&&(s(p(h.prototype),"scaleX",t,this,!0),this.syncPosition())}},{key:"scaleY",get:function(){return g(p(h.prototype),"scaleY",this)},set:function(t){this.scaleY!==t&&(s(p(h.prototype),"scaleY",t,this,!0),this.syncPosition())}},{key:"flipX",get:function(){return g(p(h.prototype),"flipX",this)},set:function(t){g(p(h.prototype),"flipX",this)!==t&&(s(p(h.prototype),"flipX",t,this,!0),this.syncPosition())}},{key:"flipY",get:function(){return g(p(h.prototype),"flipY",this)},set:function(t){g(p(h.prototype),"flipY",this)!==t&&(s(p(h.prototype),"flipY",t,this,!0),this.syncPosition())}},{key:"visible",get:function(){return g(p(h.prototype),"visible",this)},set:function(t){g(p(h.prototype),"visible",this)!==t&&(s(p(h.prototype),"visible",t,this,!0),this.syncVisible())}},{key:"alpha",get:function(){return g(p(h.prototype),"alpha",this)},set:function(t){g(p(h.prototype),"alpha",this)!==t&&(s(p(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}}]),h}();Object.assign(_i.prototype,zi),u.register("container",function(t,e,i,n,s){var r=new _i(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),at(window,"RexPlugins.UI.Container",_i);var ji=Phaser.Renderer.WebGL.Utils,Di={renderWebGL:function(t,e,i,n,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){var r=e.frame,o=r.width,a=r.height,h=ji.getTintAppendFloatAlpha;this.pipeline.batchTexture(e,r.glTexture,o,a,e.x,e.y,o/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,o,a,h(e._tintTL,n.alpha*e._alphaTL),h(e._tintTR,n.alpha*e._alphaTR),h(e._tintBL,n.alpha*e._alphaBL),h(e._tintBR,n.alpha*e._alphaBR),e._isTinted&&e.tintFill,0,0,n,s)}},renderCanvas:function(t,e,i,n,s){0!==e.width&&0!==e.height&&t.batchSprite(e,e.frame,n,s)}},Ii=Phaser.Display.Color,Ri={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 Ii);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}},Yi={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,o=this.canvas,a=this.scene.sys,h=a.game.renderer;void 0===e&&(e=0),void 0===i&&(i=0),void 0===n?n=o.width:n*=this.resolution,void 0===s?s=o.height:s*=this.resolution;var l=(r=a.textures.exists(t)?a.textures.get(t):a.textures.createCanvas(t,n,s)).getSourceImage();l.width!==n&&(l.width=n),l.height!==s&&(l.height=s);var u=l.getContext("2d");return u.clearRect(0,0,n,s),u.drawImage(o,e,i,n,s),h.gl&&r&&h.canvasToTexture(l,r.source[0].glTexture,!0,0),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}},Li=Phaser.Display.Canvas.CanvasPool,Fi=Phaser.GameObjects.GameObject,Ai=function(){t(a,Fi);var o=e(a);function a(t,e,i,n,s){var r;return z(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=t.sys.game.config.resolution,r.canvas=Li.create(_(r),r.resolution*n,r.resolution*s),r.context=r.canvas.getContext("2d"),r.dirty=!1,r.setPosition(e,i),r.setSize(n,s),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.gl&&(r.renderer.deleteTexture(r.frame.source.glTexture),r.frame.source.glTexture=null),r.dirty=!0,t.sys.game.events.on("contextrestored",function(){this.dirty=!0},_(r)),r}return k(a,[{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:"preDestroy",value:function(){Li.remove(this.canvas)}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(this.setSize(t,e).updateDisplayOrigin(),t*=this.resolution,e*=this.resolution,t=Math.max(Math.ceil(t),1),e=Math.max(Math.ceil(e),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}}]),a}(),Xi=Phaser.GameObjects.Components;Phaser.Class.mixin(Ai,[Xi.Alpha,Xi.BlendMode,Xi.ComputedSize,Xi.Crop,Xi.Depth,Xi.Flip,Xi.GetBounds,Xi.Mask,Xi.Origin,Xi.Pipeline,Xi.ScrollFactor,Xi.Tint,Xi.Transform,Xi.Visible,Di,Ri,Yi]),u.register("canvas",function(t,e,i,n){var s=new Ai(this.scene,t,e,i,n);return this.scene.add.existing(s),s}),at(window,"RexPlugins.UI.Canvas",Ai);var Hi=Phaser.Utils.Objects.GetValue,Ui=function(){t(l,Ai);var h=e(l);function l(t,e,i,n,s,r){var o;z(this,l),(o=h.call(this,t,e,i)).type="rexCircleMaskImage";var a=Hi(r,"maskType",0);return o.setTexture(n,s,a),o}return k(l,[{key:"setTexture",value:function(t,e,i){return void 0===i?i=0:"string"==typeof i&&(i=Vi[i]),this._textureKey=t,this._frameName=e,this.loadTexture(t,e),null!==i&&function(t,e){t.width===t.height&&(e=0);var i=Math.floor(t.width/2),n=Math.floor(t.height/2),s=t.getContext("2d");s.save(),s.globalCompositeOperation="destination-in",s.beginPath(),0===e?s.arc(i,n,Math.min(i,n),0,2*Math.PI):s.ellipse(i,n,i,n,0,0,2*Math.PI),s.fill(),s.restore()}(this.canvas,i),this.dirty=!0,this}}]),l}(),Vi={circle:0,ellipse:1};u.register("circleMaskImage",function(t,e,i,n,s){var r=new Ui(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),at(window,"RexPlugins.UI.CircleMaskImage",Ui);var Wi=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},Gi=function(){t(h,Ai);var a=e(h);function h(t,e,i,n,s,r){var o;return z(this,h),(o=a.call(this,t,e,i,n,s)).type="rexChart",(o.chart=void 0)!==r&&o.setChart(r),o}return k(h,[{key:"destroy",value:function(t){this.scene&&(this.chart&&(this.chart.destroy(),this.chart=void 0),g(p(h.prototype),"destroy",this).call(this,t))}},{key:"resize",value:function(t,e){if(t===this.width&&e===this.height)return this;if(g(p(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}(),Ni={setChart:function(t){if(window.Chart)return this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,Wi(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(Gi.prototype,Ni),u.register("chart",function(t,e,i,n,s){var r=new Gi(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),at(window,"RexPlugins.UI.Chart",Gi);function Ji(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.on("destroy",function(){t[e]&&(t[e].destroy(),t[e]=void 0)})),t[e]}function Ki(t,e,i){return"__BASE"===i?"".concat(t,",").concat(e):"".concat(i,"_").concat(t,",").concat(e)}var Zi=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Utils.Objects.GetValue,$i=function(t){return"string"==typeof t&&(t=Qi[t]),t},Qi={scale:0,repeat:1},tn={setTexture:function(t,e,i,n){vi(e)&&(n=i,i=e,e=void 0),void 0===e&&(e="__BASE"),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.rows.data=n,this.rows.count=n?n.length:0,this.rows.stretch=0,this.rows.minHeight=0;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,v,p,g,y,m=c/d,x=0,b=0,k=0,C=n.length;k<C;k++){void 0===n[k]&&(n[k]=m),"number"==typeof n[k]&&(n[k]={height:n[k],stretch:k%2}),p=(f=n[k]).height,this.rows.stretch+=0|f.stretch,this.rows.minHeight+=0<f.stretch?0:p;h=x=0;for(var w=i.length;h<w;h++)void 0===i[h]&&(i[h]=u),"number"==typeof i[h]&&(i[h]={width:i[h],stretch:h%2}),g=(v=i[h]).width,0===k&&(this.columns.stretch+=0|v.stretch,this.columns.minWidth+=0<v.stretch?0:g),1<=g&&1<=p?(y=this.getFrameNameCallback(h,k,e))&&s.add(y,0,x+r.cutX,b+r.cutY,g,p):console.warn("Size of Grid(".concat(h,",").concat(k,") = ").concat(g,"x").concat(p,", which is invalid")),x+=g;b+=p}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=this.width-this.columns.minWidth;i=0<=n?(e=0<this.columns.stretch?n/this.columns.stretch:0,1):(e=0,this.width/this.columns.minWidth);var s,r,o,a,h,l,u,c=this.height-this.rows.minHeight;r=0<=c?(s=0<this.rows.stretch?c/this.rows.stretch:0,1):(s=0,this.height/this.rows.minHeight);for(var d,f=0,v=0,p=0,g=this.rows.count;p<g;p++){u=0===(h=this.rows.data[p]).stretch?h.height*r:s*h.stretch;for(var y=f=0,m=this.columns.count;y<m;y++)l=0===(a=this.columns.data[y]).stretch?a.width*i:e*a.stretch,(o=this.getFrameNameCallback(y,p,this.baseFrameName))&&0<l&&0<u&&t.has(o)&&(0===(0===h.stretch&&0===a.stretch||0===this.getStretchMode(y,p)?0:1)?(d=Ji(this,"_image","image")).setTexture(this.textureKey,o).setDisplaySize(l,u):(d=Ji(this,"_tileSprite","tileSprite")).setTexture(this.textureKey,o).setSize(l,u)),d&&(this.draw(d,f,v),d=void 0),f+=l;v+=u}},setStretchMode:function(t){return Zi(t)?(this.stretchMode.edge=$i(qi(t,"edge",0)),this.stretchMode.internal=$i(qi(t,"internal",0))):(t=$i(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}},en=Phaser.GameObjects.RenderTexture,nn=Phaser.Utils.Objects.IsPlainObject,sn=Phaser.Utils.Objects.GetValue,rn=function(){t(d,en);var c=e(d);function d(t,e,i,n,s,r,o,a,h,l){var u;return z(this,d),nn(e)?(e=sn(l=e,"x",0),i=sn(l,"y",0),n=sn(l,"width",1),s=sn(l,"height",1),r=sn(l,"key",void 0),o=sn(l,"baseFrame",void 0),a=sn(l,"columns",void 0),h=sn(l,"rows",void 0)):nn(n)?(n=sn(l=n,"width",1),s=sn(l,"height",1),r=sn(l,"key",void 0),o=sn(l,"baseFrame",void 0),a=sn(l,"columns",void 0),h=sn(l,"rows",void 0)):nn(r)?(r=sn(l=r,"key",void 0),o=sn(l,"baseFrame",void 0),a=sn(l,"columns",void 0),h=sn(l,"rows",void 0)):nn(o)?(o=sn(l=o,"baseFrame",void 0),a=sn(l,"columns",void 0),h=sn(l,"rows",void 0)):vi(o)?(l=h,h=a,a=o,o=sn(l,"baseFrame",void 0)):nn(a)&&(a=sn(l=a,"columns",void 0),h=sn(l,"rows",void 0)),(u=c.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(sn(l,"getFrameNameCallback",void 0)),u.setStretchMode(sn(l,"stretchMode",0)),u.setTexture(r,o,a,h),u}return k(d,[{key:"setGetFrameNameCallback",value:function(t){return void 0===t&&(t=Ki),this.getFrameNameCallback=t,this}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(g(p(d.prototype),"resize",this).call(this,t,e),this.updateTexture()),this}},{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}}]),d}();Object.assign(rn.prototype,tn),u.register("ninePatch",function(t,e,i,n,s,r,o,a){var h=new rn(this.scene,t,e,i,n,s,r,o,a);return this.scene.add.existing(h),h}),at(window,"RexPlugins.UI.NinePatch",rn);function on(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer}function an(t,e){void 0===e&&(void 0===hn&&(hn=new Phaser.Geom.Rectangle),e=hn);var i=t.game.config;return e.setTo(0,0,i.width,i.height),e}var hn,ln=Phaser.Display.Align,un={center:ln.CENTER,left:ln.LEFT_CENTER,right:ln.RIGHT_CENTER,top:ln.TOP_CENTER,bottom:ln.BOTTOM_CENTER,"left-top":ln.TOP_LEFT,"left-center":ln.LEFT_CENTER,"left-bottom":ln.BOTTOM_LEFT,"center-top":ln.TOP_CENTER,"center-center":ln.CENTER,"center-bottom":ln.BOTTOM_CENTER,"right-top":ln.TOP_RIGHT,"right-center":ln.RIGHT_CENTER,"right-bottom":ln.BOTTOM_RIGHT},cn=new Phaser.GameObjects.Zone({sys:{queueDepthSort:ct,events:{once:ct}}},0,0,1,1);cn.setOrigin(0);function dn(t){return void 0!==t.displayWidth?t.displayWidth:t.width}function fn(t){return void 0!==t.displayHeight?t.displayHeight:t.height}function vn(t){var e=fn(t);return t.y+e-e*t.originY}function pn(t){var e=dn(t);return t.x-e*t.originX+.5*e}function gn(t,e){var i=fn(t);return t.y=e-i+i*t.originY,t}function yn(t,e){var i=dn(t),n=i*t.originX;return t.x=e+n-.5*i,t}function mn(t){var e=dn(t);return t.x-e*t.originX}function xn(t,e){var i=dn(t);return t.x=e+i*t.originX,t}function bn(t){var e=dn(t);return t.x+e-e*t.originX}function kn(t,e){var i=dn(t);return t.x=e-i+i*t.originX,t}function Cn(t,e){var i=fn(t),n=i*t.originY;return t.y=e+n-.5*i,t}function wn(t){var e=fn(t);return t.y-e*t.originY+.5*e}function Sn(t){var e=fn(t);return t.y-e*t.originY}function On(t,e){var i=fn(t);return t.y=e+i*t.originY,t}var Pn=0,Tn=1,Mn=2,En=4,Bn=6,zn=8,_n=10,jn=12,Dn=[];Dn[11]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),yn(t,pn(e)+i),gn(t,vn(e)+n),t},Dn[_n]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),xn(t,mn(e)-i),gn(t,vn(e)+n),t},Dn[jn]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),kn(t,bn(e)+i),gn(t,vn(e)+n),t},Dn[Bn]=function(t,e,i,n){var s,r,o;return void 0===i&&(i=0),void 0===n&&(n=0),s=t,r=pn(e)+i,o=wn(e)+n,yn(s,r),Cn(s,o),t},Dn[En]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),xn(t,mn(e)-i),Cn(t,wn(e)+n),t},Dn[zn]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),kn(t,bn(e)+i),Cn(t,wn(e)+n),t},Dn[Tn]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),yn(t,pn(e)+i),On(t,Sn(e)-n),t},Dn[Pn]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),xn(t,mn(e)-i),On(t,Sn(e)-n),t},Dn[Mn]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),kn(t,bn(e)+i),On(t,Sn(e)-n),t};function In(t,e,i,n,s){return Dn[i](t,e,n,s)}function Rn(t,e){return void 0===e&&(e={}),"number"==typeof t?(e.left=t,e.right=t,e.top=t,e.bottom=t):(e.left=Nn(t,"left",0),e.right=Nn(t,"right",0),e.top=Nn(t,"top",0),e.bottom=Nn(t,"bottom",0)),e}function Yn(t,e){return void 0===this.childrenMap&&(this.childrenMap={}),this.childrenMap[t]=e,this}function Ln(){this._childrenWidth=void 0,this._childrenHeight=void 0}function Fn(t,e){void 0===e?e=new qn:!0===e&&(e=$n);var i=t.scale,n=i.canvasBounds,s=i.displayScale,r=i.autoCenter;return e.x=0<=n.x?0:-(n.x*s.x),e.y=0<=n.y?0:-(n.y*s.y),e.width=n.width*s.x-e.x,e.height=n.height*s.y-e.y,1!==r&&2!==r||(e.width-=e.x),1!==r&&3!==r||(e.height-=e.y),e}function An(t){return t instanceof es}function Xn(t){return An(t)?t:t.scene&&An(t.scene)?t.scene:t.parent&&t.parent.scene&&An(t.parent.scene)?t.parent.scene:void 0}function Hn(t){return t instanceof is}var Un=Phaser.Utils.Objects.GetValue,Vn=Phaser.GameObjects.Group,Wn=function(t){return t.add.text(0,0,"")},Gn=new Phaser.Geom.Rectangle,Nn=Phaser.Utils.Objects.GetValue,Jn=_i.prototype.add,Kn={pin:function(t){return Jn.call(this,t),this},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),this.pin(t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=Rn(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground:function(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Zn=/(\S+)\[(\d+)\]/i,qn=Phaser.Geom.Rectangle,$n=new qn,Qn=function(){function i(t,e){z(this,i),this.gameObject=t,this.scene=t.scene,this.resetFromJSON(e),this.boot()}return k(i,[{key:"resetFromJSON",value:function(t){var e,i,n,s,r,o,a,h;return 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])),this.setAlign(e,n),this.setPercentage(r,a),this.setOffset(o,h),this}},{key:"boot",value:function(){this.scene.scale.on("resize",this.anchor,this),this.gameObject.on("destroy",this.destroy,this),this.anchor()}},{key:"shutdown",value:function(){this.scene.scale.off("resize",this.anchor,this),this.gameObject=void 0,this.scene=void 0}},{key:"destroy",value:function(){this.shutdown()}},{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:"anchor",value:function(){return this.viewport=Fn(this.scene,!0),this.updatePosition(),this}},{key:"updatePosition",value:function(){var t=this.gameObject;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?this.gameObject.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}}]),i}(),ts={setEventEmitter:function(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=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):[]}},es=Phaser.Scene,is=Phaser.GameObjects.GameObject,ns=Phaser.Utils.Objects.GetValue,ss=function(){function n(t,e){z(this,n),this.parent=t,this.scene=Xn(t);var i=ns(e,"eventEmitter",!1);!0===i&&(i=void 0),this.setEventEmitter(i),this.boot()}return k(n,[{key:"boot",value:function(){Hn(this.parent)?this.parent.once&&this.parent.on("destroy",this.destroy,this):An(this.parent)&&this.parent.events.once("shutdown",this.destroy,this)}},{key:"shutdown",value:function(){return this.stop(),An(this.parent)&&this.parent.events.off("shutdown",this.destroy,this),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this}},{key:"destroy",value:function(){return this.shutdown(),this}},{key:"start",value:function(t){return this.isRunning||(this.tween=this.scene.tweens.add(t).on("complete",this.complete,this),!1===this.getEventEmitter()&&this.setEventEmitter(this.tween)),this}},{key:"restart",value:function(){return this.stop().start(),this}},{key:"stop",value:function(){return this.tween&&(this.getEventEmitter()===this.tween&&this.setEventEmitter(!1),this.tween.remove(),this.tween=void 0),this}},{key:"complete",value:function(){return this.stop(),this.getEventEmitter()&&this.emit("complete"),this}},{key:"isRunning",get:function(){return!!this.tween}}]),n}();Object.assign(ss.prototype,ts);function rs(i,n){return new Promise(function(t,e){i.once(n,function(){t()})})}function os(t){return rs(t,"complete")}function as(t,e,i,n,s){return!(!t||!t.getBounds)&&(!(n&&!n(t,e,i))&&(!!(Rs=t.getBounds(Rs)).contains(e,i)&&!(s&&!s(t,e,i))))}function hs(t,e,i,n){if(e)return as(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],as(t,e.x,e.y,i,n))return!0;return!1}function ls(t){return t&&"function"==typeof t}function us(t,e,i,n,s){return as(t,e,i,Ys(n),Ls(s))}function cs(t){return!(t.rexSizer&&t.rexSizer.hidden)}function ds(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)))}var fs=Phaser.Utils.Objects.GetValue,vs=Phaser.Utils.Objects.GetAdvancedValue,ps=function(){t(s,ss);var n=e(s);function s(t,e){var i;return z(this,s),(i=n.call(this,t)).gameObject=t,i.scaleStart={},i.scaleEnd={},i.resetFromJSON(e),i}return k(s,[{key:"resetFromJSON",value:function(t){return this.setMode(fs(t,"mode",0)),this.setScaleRange(vs(t,"start",void 0),vs(t,"end",0)),this.setDelay(vs(t,"delay",0)),this.setDuration(vs(t,"duration",1e3)),this.setEase(fs(t,"ease",void 0)),this}},{key:"toJSON",value:function(){return{mode:this.mode,startX:this.startX,startY:this.startY,endX:this.endX,endY:this.endY,delay:this.delay,duration:this.duration}}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=gs[t]),this.mode=t,this}},{key:"setScaleRange",value:function(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=vs(t,"x",this.gameObject.scaleX),this.startY=vs(t,"y",this.gameObject.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=vs(e,"x",void 0),this.endY=vs(e,"y",void 0)),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}},{key:"start",value:function(){if(this.isRunning)return this;var t={targets:this.gameObject,delay:this.delay,duration:this.duration,ease:this.ease,yoyo:2==this.mode,repeat:2==this.mode?-1:0};return void 0!==this.startX&&void 0!==this.endX&&(t.scaleX={start:this.startX,to:this.endX}),void 0!==this.startY&&void 0!==this.endY&&(t.scaleY={start:this.startY,to:this.endY}),g(p(s.prototype),"start",this).call(this,t),this}},{key:"complete",value:function(){return g(p(s.prototype),"complete",this).call(this),1===this.mode&&this.gameObject.destroy(),this}}]),s}(),gs={stop:0,destroy:1,yoyo:2},ys={},ms=Phaser.Utils.Objects.IsPlainObject,xs={popUp:function(t,e,i){if(ms(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease}this._scale=function(t,e,i,n,s){switch(i){case ys.mode=0:case"x":ys.start={x:0};break;case 1:case"y":ys.start={y:0};break;default:ys.start=0}return ys.end=1,ys.duration=e,ys.ease=void 0===n?"Cubic":n,void 0===s?s=new ps(t,ys):s.resetFromJSON(ys),s.restart(),s}(this,t,e,i,this._scale),this._scale.once("complete",function(){this.emit("popup.complete",this)},this);var s=this.getParentSizer();if(s){var r=this;this._scale.on("update",function(){s.resetChildPositionState(r)})}return this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),os(this._scale)},scaleDownDestroy:function(t,e,i,n){if(ms(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease,n=s.destroy}this._scale=function(t,e,i,n,s,r){s instanceof ps&&(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 ps(t,o):r.resetFromJSON(o),r.restart(),r}(this,t,e,i,n,this._scale),this._scale.once("complete",function(){this.emit("scaledown.complete",this)},this);var r=this.getParentSizer();if(r){var o=this;this._scale.on("update",function(){r.resetChildPositionState(o)})}return this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),os(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),os(this._scale)}},bs=Phaser.Utils.Objects.GetValue,ks=Phaser.Utils.Objects.GetAdvancedValue,Cs=function(){t(s,ss);var n=e(s);function s(t,e){var i;return z(this,s),(i=n.call(this,t)).gameObject=t,i.alphaStart=void 0,i.alphaEnd=void 0,i.resetFromJSON(e),i}return k(s,[{key:"resetFromJSON",value:function(t){return this.setMode(bs(t,"mode",0)),this.setAlphaRange(ks(t,"start",this.gameObject.alpha),ks(t,"end",0)),this.setDelay(ks(t,"delay",0)),this.setDuration(ks(t,"duration",1e3)),this}},{key:"toJSON",value:function(){return{mode:this.mode,start:this.alphaStart,end:this.alphaEnd,delay:this.delay,duration:this.duration}}},{key:"shutdown",value:function(){return g(p(s.prototype),"shutdown",this).call(this),this.gameObject=void 0,this}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=ws[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"start",value:function(){return this.isRunning||g(p(s.prototype),"start",this).call(this,{targets:this.gameObject,alpha:{start:this.alphaStart,to:this.alphaEnd},delay:this.delay,duration:this.duration,ease:"Linear",yoyo:2==this.mode,repeat:2==this.mode?-1:0}),this}},{key:"complete",value:function(){return g(p(s.prototype),"complete",this).call(this),1===this.mode&&this.gameObject.destroy(),this}}]),s}(),ws={stop:0,destroy:1,yoyo:2},Ss=Phaser.Utils.Objects.IsPlainObject,Os={},Ps={},Ts=Phaser.Utils.Objects.IsPlainObject,Ms={fadeIn:function(t,e){var i,n,s,r,o,a;Ts(t)&&(t=t.duration);this._fade=(n=t,s=e,r=(i=this)._fade,a=Ss(s)?(o=s.start,s.end):s,void 0===o&&(o=0),void 0===a&&(a=i.alpha),Os.mode=0,Os.start=o,Os.end=a,Os.duration=n,void 0===r?r=new Cs(i,Os):r.resetFromJSON(Os),r.restart(),r),this._fade.once("complete",function(){this.emit("fadein.complete",this)},this);var h=this.getParentSizer();if(h){var l=this;this._fade.on("update",function(){h.resetChildAlphaState(l)})}return this},fadeInPromoise:function(t,e){return this.fadeIn(t,e),os(this._fade)},fadeOutDestroy:function(t,e){if(Ts(t)){var i=t;t=i.duration,e=i.destroy}var n,s,r,o;this._fade=(s=t,r=e,o=(n=this)._fade,r instanceof Cs&&(o=r,r=void 0),void 0===r&&(r=!0),Ps.mode=r?1:0,Ps.end=0,Ps.duration=s,void 0===o?o=new Cs(n,Ps):o.resetFromJSON(Ps),o.restart(),o),this._fade.once("complete",function(){this.emit("fadeout.complete",this)},this);var a=this.getParentSizer();if(a){var h=this;this._fade.on("update",function(){a.resetChildAlphaState(h)})}return this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),os(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),os(this._fade)}},Es=Phaser.Utils.Objects.GetValue,Bs=Phaser.Utils.Objects.GetAdvancedValue,zs=function(){t(s,ss);var n=e(s);function s(t,e){var i;return z(this,s),(i=n.call(this,t)).gameObject=t,i.resetFromJSON(e),i}return k(s,[{key:"resetFromJSON",value:function(t){if(this.setMode(Es(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Bs(t,"x",void 0),i=Bs(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this.setDelay(Bs(t,"delay",0)),this.setDuration(Bs(t,"duration",1e3)),this.setEase(Es(t,"ease",void 0)),this}},{key:"toJSON",value:function(){return{mode:this.mode,startX:this.startX,startY:this.startY,endX:this.endX,endY:this.endY,delay:this.delay,duration:this.duration}}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=_s[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.gameObject.x,this.startY=this.gameObject.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Bs(i,"startX",void 0),this.startY=Bs(i,"startY",void 0),this.endX=Bs(i,"endX",void 0),this.endY=Bs(i,"endY",void 0)}return 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}},{key:"start",value:function(){if(this.isRunning)return this;var t={targets:this.gameObject,delay:this.delay,duration:this.duration,ease:this.ease,yoyo:2==this.mode,repeat:2==this.mode?-1:0};return void 0!==this.startX&&void 0!==this.endX&&(t.x={start:this.startX,to:this.endX}),void 0!==this.startY&&void 0!==this.endY&&(t.y={start:this.startY,to:this.endY}),g(p(s.prototype),"start",this).call(this,t),this}},{key:"complete",value:function(){return g(p(s.prototype),"complete",this).call(this),1===this.mode&&this.gameObject.destroy(),this}}]),s}(),_s={stop:0,destroy:1,yoyo:2},js=function(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}},Ds=Phaser.Utils.Objects.IsPlainObject,Is={moveFrom:function(t,e,i,n,s){if(Ds(e)){var r=e;e=r.x,i=r.y,t=r.duration,n=r.ease}this._easeMove=function(t,e,i,n,s,r,o){r instanceof zs&&(o=r,r=void 0),void 0===r&&(r=!1);var a={};return a.mode=r?1:0,void 0!==i&&(a.startX=js(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=js(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===s?"Linear":s,void 0===o?o=new zs(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,s,this._easeMove),this._easeMove.once("complete",function(){this.emit("movefrom.complete",this)},this);var o=this.getParentSizer();if(o){var a=this;this._easeMove.on("update",function(){o.resetChildPositionState(a)})}return this},moveFromPromise:function(t,e,i,n,s){return this.moveFrom(t,e,i,n,s),os(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),os(this._easeMove)},moveTo:function(t,e,i,n,s){if(Ds(e)){var r=e;e=r.x,i=r.y,t=r.duration,n=r.ease}this._easeMove=function(t,e,i,n,s,r,o){r instanceof zs&&(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=js(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=js(n,t.y)),a.duration=e,a.ease=void 0===s?"Linear":s,void 0===o?o=new zs(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,s,this._easeMove),this._easeMove.once("complete",function(){this.emit("moveto.complete",this)},this);var o=this.getParentSizer();if(o){var a=this;this._easeMove.on("update",function(){o.resetChildPositionState(a)})}return this},moveToPromise:function(t,e,i,n,s){return this.moveTo(t,e,i,n,s),os(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),os(this._easeMove)}},Rs=void 0,Ys=function(n){return n?function(t,e,i){return!!cs(t)&&(n(t,e,i),!0)}:cs},Ls=function(t){return t},Fs=Phaser.Display.Align.CENTER,As=function(t,e,i){var n=this.getTopmostSizer();n.x+=e-this.x,n.y+=i-this.y},Xs={getSizerConfig:on,pushIntoBounds:function(t){return void 0===t&&(t=an(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,n,s,r,o=t.scene;if("number"==typeof e)i=e;else{i=Un(e,"color",16777215);var a=Un(e,"name",!1);a&&(n=Un(a,"createTextCallback",Wn),s=Un(a,"createTextCallbackScope",void 0),"string"==typeof(r=Un(a,"align","left-top"))&&(r=un[r]))}if(n&&!t.children){t.children=new Vn(o),t.on("destroy",function(){t.children.destroy(!0),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.getAllChildren([this]),d=0,f=c.length;d<f;d++)(l=c[d]).getBounds&&(i&&t.lineStyle(1,i).strokeRectShape(l.getBounds(Gn)),l.name&&n&&(u=s?n.call(s,o):n(o))&&(u.setText(l.name),t.children.add(u),cn.setPosition(Gn.x,Gn.y).setSize(Gn.width,Gn.height),In(u,cn,r)));return this},getChildrenWidth:function(){return 0},getChildrenHeight:function(){return 0},addChildrenMap:Yn,addElement:Yn,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(Zn);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:function(t){if(!t){this._layoutInit();for(var e,i=this.getChildrenSizers(),n=0,s=i.length;n<s;n++)!(e=i[n]).rexSizer.hidden&&e.dirty&&i[n].preLayout()}},_layoutInit:Ln,layout:function(t,e,i){return this.rexSizer.hidden||!this.dirty?this:(this.preLayout(t),void 0===e&&(e=Math.max(this.childrenWidth,this.minWidth)),void 0===i&&(i=Math.max(this.childrenHeight,this.minHeight)),this.resize(this.minWidth,this.minHeight),this.layoutBackgrounds(),this.postLayout())},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||(n=h+(i=e.padding).left,s=l+i.top,r=u-i.left-i.right,o=c-i.top-i.bottom,ds(t,r,o),cn.setPosition(n,s).setSize(r,o),In(t,cn,Fs),this.resetChildPositionState(t))},postLayout:function(){return this._anchor&&this._anchor.updatePosition(),this},setAnchor:function(t){return void 0===this._anchor?this._anchor=new Qn(this,t):this._anchor.resetFromJSON(t),this},isInTouching:function(t,e){return void 0===e&&(e=this),hs(e,t)},pointToChild:function(t,e,i,n,s){if(ls(i)||(s=i,n=i=void 0),void 0===s&&(s=this.sizerChildren?this.sizerChildren:this.children),vi(s)){for(var r,o=0,a=s.length;o<a;o++)if(r=s[o],us(r,t,e,i,n))return r}else for(var h in s)if(r=s[h],us(r,t,e,i,n))return r;return null},setDraggable:function(t,e){var i=c(t);return"string"===i?t=this.getElement(t):void 0!==t&&"object"==i||(e=t,t=this),void 0===e&&(e=!0),t.input&&t.input.hasOwnProperty("draggable")?t.input.draggable=e:e&&(t.setInteractive(),t.scene.input.setDraggable(t),t.on("drag",As,this)),this}};Object.assign(Xs,Kn,{getParentSizer:function(t){return this.getParent(t)},getTopmostSizer:function(t){return this.getTopmostParent(t)}},xs,Ms,Is);var Hs=Phaser.Utils.Objects.GetValue,Us=function(){t(l,_i);var h=e(l);function l(t,e,i,n,s,r){var o;z(this,l),(o=h.call(this,t,e,i,2,2)).isRexSizer=!0,o.setMinSize(n,s),o.setName(Hs(r,"name","")),o.rexSizer={},o.backgroundChildren=void 0,o.sizerChildren=void 0;var a=Hs(r,"anchor",void 0);return a&&o.setAnchor(a),o.space=Rn(Hs(r,"space",0)),o.setDraggable(Hs(r,"draggable",!1)),o.setDirty(!0),o}return k(l,[{key:"destroy",value:function(t){this.scene&&(void 0!==this.backgroundChildren&&(this.backgroundChildren.length=0),g(p(l.prototype),"destroy",this).call(this,t))}},{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:"alignLeft",value:function(t){return this.left=t,this}},{key:"alignRight",value:function(t){return this.right=t,this}},{key:"alignCenterX",value:function(t){return this.centerX=t,this}},{key:"alignTop",value:function(t){return this.top=t,this}},{key:"alignBottom",value:function(t){return this.bottom=t,this}},{key:"alignCenterY",value:function(t){return this.centerY=t,this}},{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-dn(this)*this.originX},set:function(t){this.x+=t-this.left}},{key:"right",get:function(){return this.left+dn(this)},set:function(t){this.x+=t-this.right}},{key:"centerX",get:function(){return this.left+dn(this)/2},set:function(t){this.x+=t-this.centerX}},{key:"top",get:function(){return this.y-fn(this)*this.originY},set:function(t){this.y+=t-this.top}},{key:"bottom",get:function(){return this.top+fn(this)},set:function(t){this.y+=t-this.bottom}},{key:"centerY",get:function(){return this.top+fn(this)/2},set:function(t){this.y+=t-this.centerY}},{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}}]),l}();Object.assign(Us.prototype,Xs);function Vs(t,e,i,n,s,r,o){this.pin(t);var a=c(e);if(null===e)return this;if("number"!==a)if("string"===a)e=Js[e];else if(Ws(e)){var h;e=Gs(h=e,"proportion",0),i=Gs(h,"align",Ns),n=Gs(h,"padding",0),s=Gs(h,"expand",!1),r=Gs(h,"key",void 0),o=Gs(h,"index",void 0)}return"string"==typeof i&&(i=un[i]),void 0===e&&(e=0),void 0===i&&(i=Ns),void 0===n&&(n=0),void 0===s&&(s=!1),(h=this.getSizerConfig(t)).proportion=e,h.align=i,h.padding=Rn(n),h.expand=s,void 0===o||o>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(o,0,t),void 0!==r&&this.addChildrenMap(r,t),this}var Ws=Phaser.Utils.Objects.IsPlainObject,Gs=Phaser.Utils.Objects.GetValue,Ns=Phaser.Display.Align.CENTER,Js={min:0,full:-1},Ks={add:Vs,addSpace:function(t){var e,i;return void 0===t&&(t=1),Vs.call(this,(e=this.scene,(i=e.add.zone(0,0,1,1)).isRexSpace=!0,i),t),this},insert:function(t,e,i,n,s,r,o){return Vs.call(this,e,i,n,s,r,o,t),this}},Zs=Phaser.Utils.Array.Remove,qs=_i.prototype.remove,$s=_i.prototype.clear,Qs={remove:function(t,e){return this.getParentSizer(t)!==this||(Zs(this.sizerChildren,t),qs.call(this,t,e)),this},removeAll:function(t){for(var e=0,i=this.sizerChildren;e<i;e++)this.remove(this.sizerChildren[e],t);return this.sizerChildren.length=0,this},clear:function(t){return this.sizerChildren.length=0,this.backgroundChildren&&(this.backgroundChildren.length=0),$s.call(this,t),this}},tr={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&&!e.isRexSpace&&0<e.rexSizer.proportion?e.isRexSizer?Math.max(e.minWidth,e.childrenWidth):dn(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||(n=e.isRexSizer?Math.max(e.minWidth,e.childrenWidth):dn(e),n+=(i=e.rexSizer.padding).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||(n=e.isRexSizer?Math.max(e.minHeight,e.childrenHeight):fn(e),n+=(i=e.rexSizer.padding).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||(n=0===e.rexSizer.proportion||t&&!e.isRexSpace&&0<e.rexSizer.proportion?e.isRexSizer?Math.max(e.minHeight,e.childrenHeight):fn(e):0,n+=(i=e.rexSizer.padding).top+i.bottom,0<o&&(n+=this.space.item),s+=n));return s+this.space.top+this.space.bottom},getChildrenProportion: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},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},layout:function(t,e,i){if(this.rexSizer.hidden||!this.dirty)return this;var n;if(this.preLayout(t),void 0===e&&(e=Math.max(this.childrenWidth,this.minWidth)),void 0===i&&(i=Math.max(this.childrenHeight,this.minHeight)),this.resize(e,i),0<this.childrenProportion){var s=0===this.orientation?this.width-this.childrenWidth:this.height-this.childrenHeight;n=0<s?(s=0===this.orientation?this.width-this.getChildrenWidth(!1):this.height-this.getChildrenHeight(!1))/this.childrenProportion:0}else n=0;this.proportionLength=n;for(var r,o,a,h,l,u,c,d,f,v,p,g,y,m,x,b,k,C=this.sizerChildren,w=this.innerLeft,S=this.innerTop,O=this.innerWidth,P=this.innerHeight,T=w,M=S,E=0,B=C.length;E<B;E++)(r=C[E]).rexSizer.hidden||(a=(o=r.rexSizer).padding,m=this,x=void 0,b=r.rexSizer,k=b.padding,0===m.orientation?0<b.proportion&&0<m.proportionLength&&(x=b.proportion*m.proportionLength):b.expand&&(x=m.innerWidth-k.left-k.right),d=x,v=this,p=void 0,g=r.rexSizer,y=g.padding,0===v.orientation?g.expand&&(p=v.innerHeight-y.top-y.bottom):0<g.proportion&&0<v.proportionLength&&(p=g.proportion*v.proportionLength),f=p,r.isRexSizer?r.layout(this,d,f):ds(r,d,f),void 0===d&&(d=dn(r)),void 0===f&&(f=fn(r)),c=0===this.orientation?(h=T+a.left,u=0===o.proportion||0===n?d:o.proportion*n,l=M+a.top,P-a.top-a.bottom):(h=T+a.left,u=O-a.left-a.right,l=M+a.top,0===o.proportion||0===n?f:o.proportion*n),cn.setPosition(h,l).setSize(u,c),In(r,cn,o.align),this.resetChildPositionState(r),0===this.orientation?T+=u+a.left+a.right+this.space.item:M+=c+a.top+a.bottom+this.space.item);return this.layoutBackgrounds(),this.postLayout()},_layoutInit:function(){Ln.call(this),this._childrenProportion=void 0}};Object.assign(tr,Ks,Qs);var er={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},ir=Phaser.Utils.Objects.IsPlainObject,nr=Phaser.Utils.Objects.GetValue,sr=function(){t(l,Us);var h=e(l);function l(t,e,i,n,s,r,o){var a;return z(this,l),ir(e)?(e=nr(o=e,"x",0),i=nr(o,"y",0),n=nr(o,"width",void 0),s=nr(o,"height",void 0),r=nr(o,"orientation",0)):ir(n)?(n=nr(o=n,"width",void 0),s=nr(o,"height",void 0),r=nr(o,"orientation",0)):ir(r)&&(r=nr(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(nr(o,"space.item",0)),a.addChildrenMap("items",a.sizerChildren),a}return k(l,[{key:"destroy",value:function(t){this.scene&&(this.sizerChildren.length=0,g(p(l.prototype),"destroy",this).call(this,t))}},{key:"setOrientation",value:function(t){return"string"==typeof t&&(t=er[t]),this.orientation=t,this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=this.getChildrenProportion()),this._childrenProportion}}]),l}();Object.assign(sr.prototype,tr),u.register("sizer",function(t,e,i,n,s,r){var o=new sr(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o}),at(window,"RexPlugins.UI.Sizer",sr);function rr(){return Array.prototype.reduce.call(arguments,lr,0)}function or(t,e){var i,n=t.rexSizer;if(n.expand){var s=n.padding;i=e-s.left-s.right}return i}function ar(t,e){var i,n=t.rexSizer;if(n.expand){var s=n.padding;i=e-s.top-s.bottom}return i}function hr(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 lr=function(t,e){return t+e},ur=Phaser.Utils.Objects.IsPlainObject,cr=Phaser.Utils.Objects.GetValue,dr=Phaser.Display.Align.CENTER,fr={add:function(t,e,i,n,s,r,o){this.pin(t),ur(e)&&(e=cr(a=e,"column",void 0),i=cr(a,"row",void 0),n=cr(a,"align",dr),s=cr(a,"padding",0),r=cr(a,"expand",!1),o=cr(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=un[n]),void 0===n&&(n=dr),void 0===s&&(s=0),void 0===r&&(r=!0),(a=this.getSizerConfig(t)).align=n,a.padding=Rn(s),a.expand=r,this.sizerChildren[h]=t,void 0!==o&&this.addChildrenMap(o,t)),this}},vr=Phaser.Utils.Array.Remove,pr=_i.prototype.remove,gr=_i.prototype.clear,yr={remove:function(t,e){if(this.getParentSizer(t)!==this)return this;if(this.isBackground(t))vr(this.backgroundChildren,t);else{var i=this.sizerChildren.indexOf(t);-1!==i&&(this.sizerChildren[i]=null)}return pr.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=0,i=this.sizerChildren;e<i;e++)this.sizerChildren[e]&&this.remove(this.sizerChildren[e],t);return this},clear:function(t){return hr(this.sizerChildren,null),this.backgroundChildren&&(this.backgroundChildren.length=0),gr.call(this,t),this}},mr=Phaser.Utils.Objects.GetValue,xr={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||(n=e.isRexSizer?Math.max(e.minWidth,e.childrenWidth):dn(e),n+=(i=e.rexSizer.padding).left+i.right,t=Math.max(t,n)));s+=t}this.columnWidth[o]=t}return s+rr.apply(void 0,[this.space.left].concat(h(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):fn(e),n+=(i=e.rexSizer.padding).top+i.bottom,t=Math.max(t,n)));s+=t}this.rowHeight[o]=t}return s+rr.apply(void 0,[this.space.top].concat(h(this.space.row),[this.space.bottom]))},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},layout:function(t,e,i){if(this.rexSizer.hidden||!this.dirty)return this;this.preLayout(t);var n,s,r,o,a=this.totalColumnProportions,h=this.totalRowProportions;if(void 0===e)if(t&&0<a){var l=this.rexSizer.padding;e=t.width-l.left-l.right}else e=Math.max(this.childrenWidth,this.minWidth);if(void 0===i)if(t&&0<h){var l=this.rexSizer.padding;i=t.height-l.top-l.bottom}else i=Math.max(this.childrenHeight,this.minHeight);this.resize(e,i),n=0<a?(this.width-this.childrenWidth)/a:0,s=0<h?(this.height-this.childrenHeight)/h:0;for(var u,c,d,f,v,p,g,y,m,x,b=this.innerLeft,k=b,C=this.innerTop,w=this.space.column,S=this.space.row,O=0;O<this.rowCount;O++){x=0===(y=this.rowProportions[O])?this.rowHeight[O]:y*s,k=b;for(var P=0;P<this.columnCount;P++)m=0===(g=this.columnProportions[P])?this.columnWidth[P]:g*n,(r=this.getChildAt(P,O))&&!r.rexSizer.hidden&&(v=or(r,m),p=ar(r,x),r.isRexSizer?r.layout(this,v,p):ds(r,v,p),u=k+(l=(o=r.rexSizer).padding).left,d=m-l.left-l.right,c=C+l.top,f=x-l.top-l.bottom,cn.setPosition(u,c).setSize(d,f),In(r,cn,o.align),this.resetChildPositionState(r)),k+=m+w[P];C+=x+S[O]}return this.layoutBackgrounds(),this.postLayout()},resetGrid:function(t,e,i,n,s){if(void 0===i&&(i=0),void 0===n&&(n=0),this.columnCount=t,this.rowCount=e,void 0===this.sizerChildren?this.sizerChildren=[]:this.removeAll(),this.sizerChildren.length=t*e,hr(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)hr(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)hr(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=mr(s,"column",0);if("number"==typeof o)hr(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=mr(s,"row",0);if("number"==typeof h)hr(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(xr,fr,yr);var br=Phaser.Utils.Objects.IsPlainObject,kr=Phaser.Utils.Objects.GetValue,Cr=function(){t(d,Us);var c=e(d);function d(t,e,i,n,s,r,o,a,h,l){var u;return z(this,d),br(e)?(e=kr(l=e,"x",0),i=kr(l,"y",0),n=kr(l,"width",void 0),s=kr(l,"height",void 0),r=kr(l,"column",0),o=kr(l,"row",0),a=kr(l,"columnProportions",0),h=kr(l,"rowProportions",0)):br(n)?(n=kr(l=n,"width",void 0),s=kr(l,"height",void 0),r=kr(l,"column",0),o=kr(l,"row",0),a=kr(l,"columnProportions",0),h=kr(l,"rowProportions",0)):br(r)?(r=kr(l=r,"column",0),o=kr(l,"row",0),a=kr(l,"columnProportions",0),h=kr(l,"rowProportions",0)):br(a)&&(a=kr(l=a,"columnProportions",0),h=kr(l,"rowProportions",0)),(u=c.call(this,t,e,i,n,s,l)).type="rexGridSizer",u.resetGrid(r,o,a,h,kr(l,"space",void 0)),u.addChildrenMap("items",u.sizerChildren),u}return k(d,[{key:"destroy",value:function(t){this.scene&&(this.sizerChildren.length=0,g(p(d.prototype),"destroy",this).call(this,t))}},{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:"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:"totalColumnProportions",get:function(){for(var t,e=0,i=0;i<this.columnCount;i++)0<(t=this.columnProportions[i])&&(e+=t);return e}},{key:"totalRowProportions",get:function(){for(var t,e=0,i=0;i<this.rowCount;i++)0<(t=this.rowProportions[i])&&(e+=t);return e}}]),d}();Object.assign(Cr.prototype,xr),u.register("gridSizer",function(t,e,i,n,s,r,o,a,h){var l=new Cr(this.scene,t,e,i,n,s,r,o,a,h);return this.scene.add.existing(l),l}),at(window,"RexPlugins.UI.GridSizer",Cr);function wr(t,e,i,n){return"\n"===t?this.addNewLine():(this.pin(t),Tr(e)&&(e=Mr(s=e,"padding",0),i=Mr(s,"key",void 0),n=Mr(s,"index",void 0)),void 0===e&&(e=0),(s=this.getSizerConfig(t)).align=Er,s.padding=Rn(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 Sr=function(t){var e=t.rexSizer.padding;return dn(t)+e.left+e.right},Or=function(t){var e=t.rexSizer.padding;return fn(t)+e.top+e.bottom},Pr=function(t,e,i){return e/t<=.25?e/(i-1):0},Tr=Phaser.Utils.Objects.IsPlainObject,Mr=Phaser.Utils.Objects.GetValue,Er=Phaser.Display.Align.CENTER,Br={add:function(t,e,i){if(vi(t))for(var n=t,s=0,r=n.length;s<r;s++)wr.call(this,n[s],e);else wr.call(this,t,e,i);return this},addNewLine:function(){return this.sizerChildren.push("\n"),this},insert:function(t,e,i,n){return wr.call(this,e,i,n,t),this}},zr=Phaser.Utils.Array.Remove,_r=_i.prototype.remove,jr=_i.prototype.clear,Dr={remove:function(t,e){return this.getParentSizer(t)!==this||(zr(this.sizerChildren,t),_r.call(this,t,e)),this},removeAll:function(t){for(var e=0,i=this.sizerChildren;e<i;e++)this.remove(this.sizerChildren[e],t);return this.sizerChildren.length=0,this},clear:function(t){return this.sizerChildren.length=0,this.backgroundChildren&&(this.backgroundChildren.length=0),jr.call(this,t),this}},Ir={getChildrenWidth:function(){return this.rexSizer.hidden?0:(0===this.orientation?this.maxChildWidth:0)+this.space.left+this.space.right},getChildrenHeight:function(){return this.rexSizer.hidden?0:(0===this.orientation?0:this.maxChildHeight)+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},layout:function(t,e,i){if(this.rexSizer.hidden||!this.dirty)return this;var n;this.preLayout(t),void 0===e&&(e=Math.max(this.maxChildWidth+this.space.left+this.space.right,this.minWidth)),void 0===i&&(i=Math.max(this.maxChildHeight+this.space.top+this.space.bottom,this.minHeight)),n=0===this.orientation?e-this.space.left-this.space.right:i-this.space.top-this.space.bottom;var s=function(t){for(var e,i,n,s,r,o={lines:[],width:0,height:0},a=this.sizerChildren,h=0,l=o.lines,u=0,c=a.length;u<c;u++){if("\n"===(e=a[u]))e=void 0,r=!(i=0);else{if(e.rexSizer.hidden)continue;e.isRexSizer&&e.layout(),r=h<(i=(0===this.orientation?Sr:Or)(e))}r&&(s&&(s.width=t-(h+this.space.item),o.width=Math.max(o.width,s.width),o.height+=s.height+this.space.line),s={children:[],height:0},l.push(s),h=t),h-=i+this.space.item,e&&(s.children.push(e),n=(0===this.orientation?Or:Sr)(e),s.height=Math.max(s.height,n))}return s&&(s.width=t-(h+this.space.item),o.width=Math.max(o.width,s.width),o.height+=s.height),o}.call(this,n);0===this.orientation?i=Math.max(i,s.height+this.space.top+this.space.bottom):e=Math.max(e,s.height+this.space.left+this.space.right),this.resize(e,i);for(var r,o,a,h,l,u,c,d,f,v,p=0,g=this.innerLeft,y=this.innerTop,m=g,x=y,b=s.lines,k=0,C=b.length;k<C;k++){switch(f=(d=b[k]).children,this.rtl&&f.reverse(),v=n-d.width,this.align){case 0:break;case 1:0===this.orientation?m+=v:x+=v;break;case 2:0===this.orientation?m+=v/2:x+=v/2;break;case 3:p=Pr(n,v,f.length);break;case 4:0===(p=Pr(n,v,f.length))&&(0===this.orientation?m+=v:x+=v);break;case 5:0===(p=Pr(n,v,f.length))&&(0===this.orientation?m+=v/2:x+=v/2)}for(var w=0,S=f.length;w<S;w++)a=(o=(r=f[w]).rexSizer).padding,0===this.orientation?(h=m+a.left,0<w&&(h+=this.space.item),l=x+a.top,u=dn(r),c=fn(r),m=h+u+a.right+p):(h=m+a.left,l=x+a.top,0<w&&(l+=this.space.item),u=dn(r),x=l+(c=fn(r))+a.bottom+p),cn.setPosition(h,l).setSize(u,c),In(r,cn,o.align),this.resetChildPositionState(r);0===this.orientation?(m=g,x+=d.height+this.space.line):(m+=d.height+this.space.line,x=y)}return this.layoutBackgrounds(),this.postLayout()},_layoutInit:function(){Ln.call(this),this._maxChildWidth=void 0,this._maxChildHeight=void 0}};Object.assign(Ir,Br,Dr);var Rr=Phaser.Utils.Objects.IsPlainObject,Yr=Phaser.Utils.Objects.GetValue,Lr=function(){t(h,Us);var a=e(h);function h(t,e,i,n,s,r){var o;return z(this,h),Rr(e)?(e=Yr(r=e,"x",0),i=Yr(r,"y",0),n=Yr(r,"width",void 0),s=Yr(r,"height",void 0)):Rr(n)&&(n=Yr(r=n,"width",void 0),s=Yr(r,"height",void 0)),(o=a.call(this,t,e,i,n,s,r)).type="rexFixWidthSizer",o.sizerChildren=[],o.setOrientation(Yr(r,"orientation",0)),o.setItemSpacing(Yr(r,"space.item",0)),o.setLineSpacing(Yr(r,"space.line",0)),o.setAlign(Yr(r,"align",0)),o.setRTL(Yr(r,"rtl",!1)),o.addChildrenMap("items",o.sizerChildren),o}return k(h,[{key:"destroy",value:function(t){this.scene&&(this.sizerChildren.length=0,g(p(h.prototype),"destroy",this).call(this,t))}},{key:"setOrientation",value:function(t){return"string"==typeof t&&(t=er[t]),this.orientation=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=Fr[t]),this.align=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=e.isRexSizer?Math.max(e.minWidth,e.childrenWidth):dn(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):fn(e),n=Math.max(i,n));return n}.call(this)),this._maxChildHeight}}]),h}(),Fr={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(Lr.prototype,Ir),u.register("fixWidthSizer",function(t,e,i,n,s){var r=new Lr(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),at(window,"RexPlugins.UI.FixWidthSizer",Lr);var Ar=Phaser.Utils.Objects.IsPlainObject,Xr=Phaser.Utils.Objects.GetValue,Hr=Phaser.Display.Align.CENTER,Ur={add:function(t,e,i,n,s){var r;this.pin(t),Ar(e)&&(e=Xr(r=e,"key",void 0),i=Xr(r,"align",Hr),n=Xr(r,"padding",0),s=Xr(r,"expand",!0));return void 0===e||("string"==typeof i&&(i=un[i]),void 0===i&&(i=Hr),void 0===n&&(n=0),void 0===s&&(s=!0),(r=this.getSizerConfig(t)).align=i,r.padding=Rn(n),Ar(s)?(r.expandWidth=Xr(s,"width",!1),r.expandHeight=Xr(s,"height",!1)):(r.expandWidth=s,r.expandHeight=s),this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t),this}},Vr={getChildrenWidth: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.minWidth,t.childrenWidth):dn(t),i+=(e=t.rexSizer.padding).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):fn(t),i+=(e=t.rexSizer.padding).top+e.bottom,n=Math.max(i,n);return n+this.space.top+this.space.bottom},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},layout:function(t,e,i){if(this.rexSizer.hidden||!this.dirty)return this;var n,s,r;this.preLayout(t),void 0===e&&(e=Math.max(this.childrenWidth,this.minWidth)),void 0===i&&(i=Math.max(this.childrenHeight,this.minHeight)),this.resize(e,i);var o,a,h,l,u,c,d,f,v,p,g,y,m,x,b=this.innerLeft,k=this.innerTop,C=this.innerWidth,w=this.innerHeight,S=this.sizerChildren;for(var O in S)r=(s=(n=S[O]).rexSizer).padding,n.isRexSizer?n.layout(this,(g=this,y=void 0,m=n.rexSizer,x=m.padding,m.expandWidth&&(y=g.innerWidth-x.left-x.right),y),(d=this,f=void 0,v=n.rexSizer,p=v.padding,v.expandHeight&&(f=d.innerHeight-p.top-p.bottom),f)):(c=u=void 0,s.expandWidth&&(u=C-r.left-r.right),s.expandHeight&&(c=w-r.top-r.bottom),ds(n,u,c)),o=b+r.left,h=C-r.left-r.right,a=k+r.top,l=w-r.top-r.bottom,cn.setPosition(o,a).setSize(h,l),In(n,cn,s.align),this.resetChildPositionState(n);return this.layoutBackgrounds(),this.postLayout()}};Object.assign(Vr,Ur,{});var Wr=Phaser.Utils.Objects.IsPlainObject,Gr=Phaser.Utils.Objects.GetValue,Nr=function(){t(h,Us);var a=e(h);function h(t,e,i,n,s,r){var o;return z(this,h),Wr(e)?(e=Gr(r=e,"x",0),i=Gr(r,"y",0),n=Gr(r,"width",void 0),s=Gr(r,"height",void 0)):Wr(n)&&(n=Gr(r=n,"width",void 0),s=Gr(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 k(h,[{key:"destroy",value:function(t){this.scene&&(lt(this.sizerChildren),g(p(h.prototype),"destroy",this).call(this,t))}}]),h}();Object.assign(Nr.prototype,Vr),u.register("overlapSizer",function(t,e,i,n,s){var r=new Nr(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}),at(window,"RexPlugins.UI.OverlapSizer",Nr);function Jr(t,e,i,n){var s=new Zr(e,i,n);return t&&!t.isRexSizer&&t.setMask(s.createGeometryMask()),this.pin(s),s}var Kr=Phaser.GameObjects.Graphics,Zr=function(){t(r,Kr);var s=e(r);function r(t,e,i){var n;return z(this,r),void 0===e&&(e=0),"string"==typeof e&&(shaep=qr[e]),void 0===i&&(i=0),(n=s.call(this,t.scene)).parent=t,n.shape=e,n.padding=i,n.setPosition().resize(),n}return k(r,[{key:"destroy",value:function(){return this.parent=void 0,g(p(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),g(p(r.prototype),"setPosition",this).call(this,t,e),this}},{key:"resize",value:function(t,e,i){var n=this.parent;if(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)return this;switch(this.clear().fillStyle(16777215),this.shape){case 1:var s=Math.min(t,e)/2;this.fillCircle(0,0,s+i);break;default:this.fillRect(-(t*n.originX)-i,-(e*n.originY)-i,t+2*i,e+2*i)}return this.widthSave=t,this.heightSave=e,this.paddingSave=i,this}}]),r}(),qr={rectangle:0,circle:1},$r=Phaser.Utils.Objects.GetValue,Qr=function(){t(m,sr);var y=e(m);function m(t,e){var i;z(this,m),(i=y.call(this,t,e)).type="rexLabel";var n=$r(e,"background",void 0),s=$r(e,"icon",void 0),r=$r(e,"iconMask",void 0),o=$r(e,"text",void 0),a=$r(e,"action",void 0),h=$r(e,"actionMask",void 0),l=$r(e,"align",void 0),u=$r(e,"space.icon",0),c=$r(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&&i.addChildMask(s,s,1));if(o){var d,f,v,p=$r(e,"expandTextWidth",!1),g=$r(e,"expandTextHeight",!1);v=0===i.orientation?(d=p?1:0,a&&(f={right:c}),g):(d=g?1:0,a&&(f={bottom:c}),p),i.add(o,d,"center",f,v)}return a&&(i.add(a),h=h&&i.addChildMask(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 k(m,[{key:"setText",value:function(t){return this.text=t,this}},{key:"appendText",value:function(t){this.text+=t}},{key:"layout",value:function(t,e,i){if(this.rexSizer.hidden||!this.dirty)return this;g(p(m.prototype),"layout",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){g(p(m.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}},{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))}}]),m}(),to={addChildMask:Jr};Object.assign(Qr.prototype,to),u.register("label",function(t){var e=new Qr(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.Label",Qr);var eo=Phaser.Utils.Objects.GetValue,io=function(){function i(t,e){z(this,i),this.gameObject=t,this.scene=Xn(t),this.setEventEmitter(eo(e,"eventEmitter",void 0)),this._enable=void 0,t.setInteractive(eo(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}return k(i,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(eo(t,"enable",!0)),this.setMode(eo(t,"mode",1)),this.setClickInterval(eo(t,"clickInterval",100)),this.setDragThreshold(eo(t,"threshold",void 0)),this}},{key:"boot",value:function(){this.gameObject.on("pointerdown",this.onPress,this),this.gameObject.on("pointerup",this.onRelease,this),this.gameObject.on("pointerout",this.onPointOut,this),this.gameObject.on("pointermove",this.onMove,this),this.gameObject.on("destroy",this.destroy,this)}},{key:"shutdown",value:function(){this.destroyEventEmitter(),this.pointer=null,this.gameObject=null,this.scene=null}},{key:"destroy",value:function(){this.shutdown()}},{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=co[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.gameObject,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.gameObject,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{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.gameObject)}}}]),i}();Object.assign(io.prototype,ts);function no(s,t){s._buttonBehavior=new io(s,t),s._buttonBehavior.on("click",function(t,e,i,n){fo.call(this,"button.click",e,i,n)},this).on("enable",function(t,e){fo.call(this,"button.enable",e)},this).on("disable",function(t,e){fo.call(this,"button.disable",e)},this),s.on("pointerover",function(t,e,i,n){fo.call(this,"button.over",s,t,n)},this).on("pointerout",function(t,e){fo.call(this,"button.out",s,t,e)},this)}function so(t){if(0===this.buttons.length){if(!this.buttonsExpand)switch(this.buttonsAlign){case"right":case"bottom":case"center":po.call(this)}vo.call(this,t,this.buttonProportion,"center",0,!0),this.buttonsExpand||"center"===this.buttonsAlign&&po.call(this)}else{var e=this.sizerChildren.length-1;this.sizerChildren[e].isRexSpace?go.call(this,e,t,this.buttonProportion,"center",0,!0):vo.call(this,t,this.buttonProportion,"center",0,!0)}return this.buttons.push(t),no.call(this,t,this.clickConfig),this}function ro(t,e){return(t=this.getButton(t))&&(1===this.buttons.length?this.clear(e):(mo(this.buttons,t),xo.call(this,t,e))),this}function oo(t){wo(t,!1)}function ao(t){wo(t,!0)}function ho(t){return!!t&&!on(t).hidden}function lo(t,e){void 0===e&&(e=!1);var i=Oo(t,"dataManager",void 0),s=Oo(t,"setValueCallback",void 0),r=Oo(t,"setValueCallbackScope",void 0);void 0===i&&(this.setDataEnabled(),i=this.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)},this),i.set(t,void 0),i.set(t,e)}),this._dataManager=i}function uo(t){var e=Po(t,"type",void 0);e&&To.hasOwnProperty(e)&&To[e].call(this,t)}var co={press:0,pointerdown:0,release:1,pointerup:1},fo=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&&this.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)},vo=sr.prototype.add,po=sr.prototype.addSpace,go=sr.prototype.insert,yo={addButton:function(t){if(vi(t))for(var e=t,i=0,n=e.length;i<n;i++)so.call(this,e[i]);else so.call(this,t);return this},addButtons:function(t){for(var e=0,i=t.length;e<i;e++)so.call(this,t[e]);return this}},mo=Phaser.Utils.Array.Remove,xo=sr.prototype.remove,bo=sr.prototype.clear,ko={remove:function(t,e){if(vi(t))for(var i=t,n=0,s=i.length;n<s;n++)ro.call(this,i[n],e);else ro.call(this,t,e);return this},clear:function(t){return this.buttons.length=0,bo.call(this,t),this},removeButton:function(t,e){return this.remove(t,e),this},clearButtons:function(t){return this.clear(t),this}},Co=function(t,e){return t?t.hasOwnProperty("name")?t.name===e?t:null:GetElementByName(t,e):null},wo=function(t,e){t&&(on(t).hidden=e,t.setVisible(!e))},So={getButton:function(t){var e;switch(c(t)){case"number":e=this.buttons[t];break;case"string":e=function(t,e){if(!t)return null;if(vi(t)){for(var i,n=0,s=t.length;n<s;n++)if(i=Co(t[n],e))return i}else for(var r in t)if(i=Co(t[r],e))return i}(this.buttons,t);break;default:e=t,-1===this.buttons.indexOf(e)&&(e=void 0)}return e},setButtonEnable:function(t,e){if(void 0===t||"boolean"==typeof t){e=t;for(var i=0,n=this.buttons.length;i<n;i++)this.buttons[i]._buttonBehavior.setEnable(e)}else this.getButton(t)._buttonBehavior.setEnable(e);return this},toggleButtonEnable:function(t){if(void 0===t||"boolean"==typeof t)for(var e=0,i=this.buttons.length;e<i;e++)this.buttons[e]._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 fo.call(this,"button.click",t),this},showButton:function(t){return oo(this.getButton(t)),this},hideButton:function(t){return ao(this.getButton(t)),this},isButtonShown:function(t){return ho(this.getButton(t)),this},forEachButtton:function(t,e){for(var i=0,n=this.buttons.length;i<n;i++)e?t.call(e,this.buttons[i],i,this.buttons):t(this.buttons[i],i,this.buttons);return this}},Oo=Phaser.Utils.Objects.GetValue,Po=Phaser.Utils.Objects.GetValue,To={radio:function(t){lo.call(this,t),this._value=void 0,Object.defineProperty(this,"value",{get:function(){return this._value}.bind(this),set:function(n){if(n!==this._value){this._value=n;var s=this._dataManager;this.buttons.forEach(function(t){var e=t.name,i=s.get(e);e===n?i||s.set(e,!0):i&&s.set(e,!1)})}}.bind(this),enumerable:!0,configurable:!0}),this.on("button.click",function(t){this.value=t.name},this)},checkboxes:function(t){lo.call(this,t),this.on("button.click",function(t){var e=this._dataManager,i=t.name,n=e.get(i);e.set(i,!n)},this)}},Mo=Phaser.Utils.Objects.GetValue,Eo=function(){t(a,sr);var o=e(a);function a(t,e){var i;z(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.eventEmitter=Mo(e,"eventEmitter",_(i)),i.groupName=Mo(e,"groupName",void 0),i.buttons=[];var s=Mo(e,"background",void 0),r=Mo(e,"buttons",void 0);return i.buttonsExpand=Mo(e,"expand",!1),i.buttonsAlign=Mo(e,"align",void 0),i.buttonProportion=i.buttonsExpand?1:0,i.clickConfig=Mo(e,"click",void 0),s&&i.addBackground(s),r&&i.addButtons(r),uo.call(_(i),e),i.addChildrenMap("background",s),i.addChildrenMap("buttons",i.buttons),i}return a}();Object.assign(Eo.prototype,yo,ko,So),u.register("buttons",function(t){var e=new Eo(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.Buttons",Eo);function Bo(t){return _o.call(this,t),this.buttons.push(t),no.call(this,t,this.clickConfig),this}function zo(t,e){return(t=this.getButton(t))&&(1===this.buttons.length?this.clear(e):(Do(this.buttons,t),Io.call(this,t,e))),this}var _o=Lr.prototype.add,jo={addButton:function(t){if(vi(t))for(var e=t,i=0,n=e.length;i<n;i++)Bo.call(this,e[i]);else Bo.call(this,t);return this},addButtons:function(t){if(vi(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++)Bo.call(this,e[r]);s<n&&_o.addNewLine(this)}else for(r=0,o=t.length;r<o;r++)Bo.call(this,t[r]);return this}},Do=Phaser.Utils.Array.Remove,Io=Lr.prototype.remove,Ro=Lr.prototype.clear,Yo={remove:function(t,e){if(vi(t))for(var i=t,n=0,s=i.length;n<s;n++)zo.call(this,i[n],e);else zo.call(this,t,e);return this},clear:function(t){return this.buttons.length=0,Ro.call(this,t),this},removeButton:function(t,e){return this.remove(t,e),this},clearButtons:function(t){return this.clear(t),this}},Lo=Phaser.Utils.Objects.GetValue,Fo=function(){t(a,Lr);var o=e(a);function a(t,e){var i;z(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.eventEmitter=Lo(e,"eventEmitter",_(i)),i.groupName=Lo(e,"groupName",void 0),i.buttons=[];var s=Lo(e,"background",void 0),r=Lo(e,"buttons",void 0);return i.buttonsAlign=Lo(e,"align",void 0),i.clickConfig=Lo(e,"click",void 0),s&&i.addBackground(s),r&&i.addButtons(r),uo.call(_(i),e),i.addChildrenMap("background",s),i.addChildrenMap("buttons",i.buttons),i}return a}();Object.assign(Fo.prototype,jo,Yo,So),u.register("fixWidthButtons",function(t){var e=new Fo(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.FixWidthButtons",Fo);function Ao(t,e){return(t=this.getButton(t))&&(Uo(this.buttons,t),Vo.call(this,t,e)),this}var Xo=Cr.prototype.add,Ho={addButton:function(t,e,i){return Xo.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttons.push(t),no.call(this,t,this.clickConfig),this},addButtons:function(t,e){for(var i=0,n=t;i<n;i++)this.addButton(t[i],void 0,e);return this}},Uo=Phaser.Utils.Array.Remove,Vo=Cr.prototype.remove,Wo=Cr.prototype.clear,Go={remove:function(t,e){if(vi(t))for(var i=t,n=0,s=i.length;n<s;n++)Ao.call(this,i[n],e);else Ao.call(this,t,e);return this},clear:function(t){return this.buttons.length=0,Wo.call(this,t),this},removeButton:function(t,e){return this.remove(t,e),this},clearButtons:function(t){return this.clear(t),this}},No=Phaser.Utils.Objects.GetValue,Jo=function(){t(m,Cr);var y=e(m);function m(t,e){var i;z(this,m),void 0===e&&(e={});var n=No(e,"row",0),s=No(e,"col",0),r=No(e,"buttons",void 0),o=No(e,"expand",!0),a=o?1:0;if(void 0!==r){n=Math.max(n,r.length);for(var h=0,l=r.length;h<l;h++)s=Math.max(s,r[h].length)}e.row=n,e.column=s,e.columnProportions=a,e.rowProportions=a,(i=y.call(this,t,e)).type="rexGridButtons",i.eventEmitter=No(e,"eventEmitter",_(i)),i.groupName=No(e,"groupName",void 0),i.buttons=[];var u=No(e,"background",void 0);i.buttonsExpand=o;var c=No(e,"space",void 0);if("number"==typeof c&&(c={itemX:c,itemY:c}),i.clickConfig=No(e,"click",void 0),u&&i.addBackground(u),r)for(var d,f=0,v=r.length;f<v;f++)for(var p=0,g=r.length;p<g;p++)(d=r[f][p])&&i.addButton(d,p,f);return uo.call(_(i),e),i.addChildrenMap("background",u),i.addChildrenMap("buttons",i.buttons),i}return m}();Object.assign(Jo.prototype,Ho,Go,So),u.register("gridButtons",function(t){var e=new Jo(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.GridButtons",Jo);var Ko=Phaser.Utils.Objects.GetValue,Zo=function(){t(B,sr);var E=e(B);function B(t,e){var i;z(this,B),void 0===e&&(e={}),e.orientation=1,(i=E.call(this,t,e)).type="rexDialog",i.eventEmitter=Ko(e,"eventEmitter",_(i));var n,s,r,o,a=Ko(e,"background",void 0),h=Ko(e,"title",void 0),l=Ko(e,"toolbar",void 0),u=Ko(e,"toolbarBackground",void 0),c=Ko(e,"leftToolbar",void 0),d=Ko(e,"leftToolbarBackground",void 0),f=Ko(e,"content",void 0),v=Ko(e,"description",void 0),p=Ko(e,"choices",void 0),g=Ko(e,"choicesBackground",void 0),y=Ko(e,"actions",void 0),m=Ko(e,"actionsBackground",void 0),x=Ko(e,"click",void 0);if(a&&i.addBackground(a),l&&(r=new Eo(t,{groupName:"toolbar",background:u,buttons:l,orientation:0,space:{item:Ko(e,"space.toolbarItem",0)},click:x,eventEmitter:i.eventEmitter})),c&&(o=new Eo(t,{groupName:"leftToolbar",background:d,buttons:c,orientation:0,space:{item:Ko(e,"space.leftToolbarItem",0)},click:x,eventEmitter:i.eventEmitter})),h&&!l&&!c){var b=Ko(e,"align.title","center"),k=Ko(e,"space.title",0);(f||v||p||y)&&(S={bottom:k});var C=Ko(e,"expand.title",!0);i.add(h,0,b,S,C)}if(l&&!h&&!c){k=Ko(e,"space.title",0);(f||v||p||y)&&(S={bottom:k});C=Ko(e,"expand.toolbar",!0);i.add(r,0,"right",S,C)}if(c&&!h&&!l){k=Ko(e,"space.title",0);(f||v||p||y)&&(S={bottom:k});C=Ko(e,"expand.leftToolbar",!0);i.add(o,0,"left",S,C)}if(h&&(l||c)){var w=new sr(t,{orientation:0});o&&w.add(o,0,"right",0,!1);b=Ko(e,"align.title","left");(C=Ko(e,"expand.title",!0))||"right"!==b&&"center"!==b||w.addSpace();var S={left:Ko(e,"space.titleLeft",0),right:Ko(e,"space.titleRight",0)},O=C?1:0;w.add(h,O,"center",S,C),C||"left"!==b&&"center"!==b||w.addSpace(),r&&w.add(r,0,"right",0,!1);k=Ko(e,"space.title",0);(f||v||p||y)&&(S={bottom:k}),i.add(w,0,"center",S,!0)}if(f){b=Ko(e,"align.content","center");var P=Ko(e,"space.content",0);S={left:Ko(e,"space.contentLeft",0),right:Ko(e,"space.contentRight",0),bottom:v||p||y?P:0},C=Ko(e,"expand.content",!0);i.add(f,0,b,S,C)}if(v){b=Ko(e,"align.description","center");var T=Ko(e,"space.description",0);S={left:Ko(e,"space.descriptionLeft",0),right:Ko(e,"space.descriptionRight",0),bottom:p||y?T:0},C=Ko(e,"expand.description",!0);i.add(v,0,b,S,C)}if(p){b=Ko(e,"align.choices","center");n=new Eo(t,{groupName:"choices",background:g,buttons:p,orientation:1,space:{item:Ko(e,"space.choice",0)},click:x,eventEmitter:i.eventEmitter,type:Ko(e,"choicesType",void 0),setValueCallback:Ko(e,"choicesSetValueCallback",void 0),setValueCallbackScope:Ko(e,"choicesSetValueCallbackScope",void 0)});var M=Ko(e,"space.choices",0);S={left:Ko(e,"space.choicesLeft",0),right:Ko(e,"space.choicesRight",0),bottom:y?M:0},C=Ko(e,"expand.choices",!0);i.add(n,0,b,S,C)}if(y){s=new Eo(t,{groupName:"actions",background:m,buttons:y,orientation:0,space:{item:Ko(e,"space.action",0)},expand:Ko(e,"expand.actions",!1),align:Ko(e,"align.actions","center"),click:x,eventEmitter:i.eventEmitter});S={left:Ko(e,"space.actionsLeft",0),right:Ko(e,"space.actionsRight",0)};i.add(s,0,"center",S,!0)}return i.addChildrenMap("background",a),i.addChildrenMap("title",h),i.addChildrenMap("toolbar",l),i.addChildrenMap("leftToolbar",c),i.addChildrenMap("content",f),i.addChildrenMap("choices",p),i.addChildrenMap("actions",y),i.addChildrenMap("choicesSizer",n),i.addChildrenMap("actionsSizer",s),i.addChildrenMap("toolbarSizer",r),i.addChildrenMap("leftToolbarSizer",o),i}return B}();Object.assign(Zo.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 Zo(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.Dialog",Zo);var qo={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 oo(this.getButton(t,e)),this},showLeftButton:function(t){return oo(this.getLeftButton(t)),this},showRightButton:function(t){return oo(this.getRightButton(t)),this},showTopButton:function(t){return oo(this.getTopButton(t)),this},showBottomButton:function(t){return oo(this.getBottomButton(t)),this},hideButton:function(t,e){return ao(this.getButton(t,e)),this},hideLeftButton:function(t){return ao(this.getLeftButton(t)),this},hideRightButton:function(t){return ao(this.getRightButton(t)),this},hideTopButton:function(t){return ao(this.getTopButton(t)),this},hideBottomButton:function(t){return ao(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},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}},$o=Phaser.Utils.Objects.GetValue,Qo=function(){t(M,Cr);var T=e(M);function M(t,e){var i;z(this,M),void 0===e&&(e={}),e.column=3,e.row=3,(i=T.call(this,t,e)).type="rexTabs",i.eventEmitter=$o(e,"eventEmitter",_(i));var n,s,r,o,a=$o(e,"background",void 0),h=$o(e,"panel",void 0),l=$o(e,"leftButtons",void 0),u=$o(e,"leftButtonsBackground",void 0),c=$o(e,"rightButtons",void 0),d=$o(e,"rightButtonsBackground",void 0),f=$o(e,"topButtons",void 0),v=$o(e,"topButtonsBackground",void 0),p=$o(e,"bottomButtons",void 0),g=$o(e,"bottomButtonsBackground",void 0),y=$o(e,"click",void 0);if(a&&i.addBackground(a),h&&i.add(h,1,1,"center",0,!0),l){var m=$o(e,"space.leftButtonsOffset",0),x=$o(e,"space.leftButton",0);n=new Eo(t,{groupName:"left",background:u,buttons:l,orientation:1,space:{item:x},align:$o(e,"align.leftButtons",void 0),click:y,eventEmitter:i.eventEmitter});var b={top:m};i.add(n,0,1,"top",b,!1)}if(c){var k=$o(e,"space.rightButtonsOffset",0),C=$o(e,"space.rightButton",0);s=new Eo(t,{groupName:"right",background:d,buttons:c,orientation:1,space:{item:C},align:$o(e,"align.rightButtons",void 0),click:y,eventEmitter:i.eventEmitter});b={top:k};i.add(s,2,1,"top",b,!1)}if(f){var w=$o(e,"space.topButtonsOffset",0),S=$o(e,"space.topButton",0);r=new Eo(t,{groupName:"top",background:v,buttons:f,orientation:0,space:{item:S},align:$o(e,"align.topButtons",void 0),click:y,eventEmitter:i.eventEmitter});b={left:w};i.add(r,1,0,"left",b,!1)}if(p){var O=$o(e,"space.bottomButtonsOffset",0),P=$o(e,"space.bottomButton",0);o=new Eo(t,{groupName:"bottom",background:g,buttons:p,orientation:0,space:{item:P},align:$o(e,"align.bottomButtons",void 0),click:y,eventEmitter:i.eventEmitter});b={left:O};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",p),i.addChildrenMap("leftButtonsSizer",n),i.addChildrenMap("rightButtonsSizer",s),i.addChildrenMap("topButtonsSizer",r),i.addChildrenMap("bottomButtonsSizer",o),i}return M}();Object.assign(Qo.prototype,qo),u.register("tabs",function(t){var e=new Qo(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.Tabs",Qo);function ta(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=sa(i.x,n,s)):t.x===e.x&&(n=Math.min(t.y,e.y),s=Math.max(t.y,e.y),r=sa(i.y,n,s)),r}function ea(t,e,i){this.enable&&(ra.x=e,ra.y=i,this.value=ta(this.getStartPoint(),this.getEndPoint(),ra))}function ia(t){this.enable&&t.isDown&&(oa.x=t.worldX,oa.y=t.worldY,this.value=ta(this.getStartPoint(),this.getEndPoint(),oa))}function na(t,e){void 0===e&&(e=aa);var i=this.childrenMap.thumb,n=i.x,s=i.y;return In(i,this,t),e.x=i.x,e.y=i.y,i.x=n,i.y=s,e}var sa=Phaser.Math.Percent,ra={},oa={},aa={},ha=Phaser.Display.Align.LEFT_CENTER,la=Phaser.Display.Align.TOP_CENTER,ua={},ca=Phaser.Display.Align.RIGHT_CENTER,da=Phaser.Display.Align.BOTTOM_CENTER,fa={},va=Phaser.Math.Linear,pa={},ga=Phaser.Display.Align.LEFT_CENTER,ya=Phaser.Display.Align.TOP_CENTER,ma=Phaser.Utils.Objects.GetValue,xa=Phaser.Math.Clamp,ba=Phaser.Math.Linear,ka=Phaser.Math.Percent,Ca=Phaser.Math.Snap.To,wa=function(){t(c,sr);var u=e(c);function c(t,e){var i;z(this,c),(i=u.call(this,t,e)).type="rexSlider",i.eventEmitter=ma(e,"eventEmitter",_(i));var n=ma(e,"background",void 0),s=ma(e,"track",void 0),r=ma(e,"indicator",void 0),o=ma(e,"thumb",void 0);n&&i.addBackground(n),s&&i.add(s,1,"center",0,!0),r&&i.pin(r),o&&i.pin(o);var a=ma(e,"input",0);switch("string"==typeof a&&(a=Sa[a]),a){case 0:o&&(o.setInteractive(),i.scene.input.setDraggable(o),o.on("drag",ea,_(i)));break;case 1:i.setInteractive().on("pointerdown",ia,_(i)).on("pointermove",ia,_(i))}i.addChildrenMap("background",n),i.addChildrenMap("track",s),i.addChildrenMap("indicator",r),i.addChildrenMap("thumb",o);var h=ma(e,"valuechangeCallback",null);if(null!==h){var l=ma(e,"valuechangeCallbackScope",void 0);i.eventEmitter.on("valuechange",h,l)}return i.setEnable(ma(e,"enable",void 0)),i.setGap(ma(e,"gap",void 0)),i.setValue(ma(e,"value",0)),i}return k(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:"setValue",value:function(t,e,i){return null==t||(void 0!==e&&(t=ka(t,e,i)),this.value=t),this}},{key:"addValue",value:function(t,e,i){return void 0!==e&&(t=ka(t,e,i)),this.value+=t,this}},{key:"getValue",value:function(t,e){var i=this.value;return void 0!==t&&(i=ba(t,e,i)),i}},{key:"layout",value:function(t,e,i){return this.rexSizer.hidden||!this.dirty||(g(p(c.prototype),"layout",this).call(this,t,e,i),this.updateThumb(),this.updateIndicator()),this}},{key:"value",get:function(){return this._value},set:function(t){void 0!==this.gap&&(t=Ca(t,this.gap));var e=this._value;this._value=xa(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}}]),c}(),Sa={drag:0,click:1,none:-1},Oa={getStartPoint:function(t){if(void 0===t&&(t=ua),this.childrenMap.thumb){var e=0===this.orientation?ha:la;na.call(this,e,t)}else 0===this.orientation?(t.x=this.left+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.top+1);return t},getEndPoint:function(t){if(void 0===t&&(t=fa),this.childrenMap.thumb){var e=0===this.orientation?ca:da;na.call(this,e,t)}else 0===this.orientation?(t.x=this.right-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.bottom-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=pa),s.x=va(i.x,n.x,e),s.y=va(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=dn(s);e=s.x-r*s.originX+r-this.left}else{var o=fn(s);i=s.y-o*s.originY+o-this.top}else 0===this.orientation?e=this.width*t:i=this.height*t;ds(n,e,i);var a=0===this.orientation?ga:ya;In(n,this,a),this.resetChildPositionState(n)}};Object.assign(wa.prototype,Oa),u.register("slider",function(t){var e=new wa(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.Slider",wa);function Pa(t){var e=Ma(t,"scrollMode",0);return"string"==typeof e&&(e=Ta[e]),e}var Ta={v:0,vertical:0,h:1,horizontal:1},Ma=Phaser.Utils.Objects.GetValue,Ea=function(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},Ba=function(){function o(t){z(this,o);var e=Ea(t,"states",void 0);e&&this.addStates(e);var i=Ea(t,"extend",void 0);if(i)for(var n in i)this.hasOwnProperty(n)&&void 0!==this[n]||(this[n]=i[n]);var s=Ea(t,"eventEmitter",void 0),r=Ea(t,"EventEmitterClass",void 0);this.setEventEmitter(s,r),this._stateLock=!1,this.resetFromJSON(t)}return k(o,[{key:"shutdown",value:function(){this.destroyEventEmitter()}},{key:"destroy",value:function(){this.shutdown()}},{key:"resetFromJSON",value:function(t){this.setEnable(Ea(t,"enable",!0)),this.start(Ea(t,"start",void 0));var e=Ea(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:"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=Ea(e,"next",void 0);i&&(this["next_"+t]=i);var n=Ea(e,"exit",void 0);n&&(this["exit_"+t]=n);var s=Ea(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")}},{key:"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)}}},get:function(){return this._state}},{key:"prevState",get:function(){return this._prevState}}]),o}();Object.assign(Ba.prototype,ts);var za=function(){t(s,Ba);var n=e(s);function s(t,e){var i;return z(this,s),(i=n.call(this,e)).parent=t,i.init(),i}return k(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}(),_a=Phaser.Utils.Objects.GetValue,ja=Phaser.Math.Distance.Between,Da=function(){function i(t,e){z(this,i),this.gameObject=t,this.scene=Xn(t),this.setEventEmitter(_a(e,"eventEmitter",void 0)),this._enable=void 0,t.setInteractive(_a(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}return k(i,[{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(_a(t,"enable",!0)),this.holdThreshold=_a(t,"holdThreshold",50),this}},{key:"boot",value:function(){this.gameObject.on("pointerdown",this.onPointIn,this),this.gameObject.on("pointerover",this.onPointIn,this),this.gameObject.on("pointerup",this.onPointOut,this),this.gameObject.on("pointerout",this.onPointOut,this),this.gameObject.on("pointermove",this.onPointerMove,this),this.gameObject.on("destroy",this.destroy,this),this.scene.events.on("preupdate",this.preupdate,this)}},{key:"shutdown",value:function(){this.scene&&this.scene.events.off("preupdate",this.preupdate,this),this.pointer=void 0,this.gameObject=void 0,this.scene=void 0,this.destroyEventEmitter()}},{key:"destroy",value:function(){this.shutdown()}},{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:"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))}}},{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:"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:ja(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)}}]),i}();Object.assign(Da.prototype,ts);var Ia=Phaser.Utils.Objects.GetValue,Ra=function(){function e(t){z(this,e),this.resetFromJSON(t)}return k(e,[{key:"resetFromJSON",value:function(t){return this.setValue(Ia(t,"value",0)),this.setSpeed(Ia(t,"speed",0)),this.setAcceleration(Ia(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}(),Ya=function(){function t(){z(this,t),this.value,this.dir,this.movement=new Ra}return k(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}(),La=Phaser.Utils.Objects.GetValue,Fa=function(){function a(t,e){z(this,a),this.gameObject=t,this.scene=Xn(t),this.setEventEmitter(La(e,"eventEmitter",void 0));var i=La(e,"enable",!0),n={enable:i,eventEmitter:!1};this._state=new za(this,n);var s={inputConfig:La(e,"inputConfig",void 0),enable:i,eventEmitter:!1};this.dragState=new Da(t,s),this._enable=void 0,this._value=void 0,this._slowDown=new Ya;var r=La(e,"valuechangeCallback",null);if(null!==r){var o=La(e,"valuechangeCallbackScope",void 0);this.on("valuechange",r,o)}if(null!==(r=La(e,"overmaxCallback",null))){o=La(e,"overmaxCallbackScope",void 0);this.on("overmax",r,o)}if(null!==(r=La(e,"overminCallback",null))){o=La(e,"overminCallbackScope",void 0);this.on("overmin",r,o)}this.resetFromJSON(e),this.boot()}return k(a,[{key:"resetFromJSON",value:function(t){this.setOrientationMode(La(t,"orientation",0)),this.setDragThreshold(La(t,"threshold",10)),this.setSlidingDeceleration(La(t,"slidingDeceleration",5e3)),this.setBackDeceleration(La(t,"backDeceleration",2e3));var e=La(t,"bounds",void 0);return e?this.setBounds(e):this.setBounds(La(t,"max",0),La(t,"min",0)),this.setValue(La(t,"value",this.maxValue||0)),this.setEnable(La(t,"enable",!0)),this}},{key:"boot",value:function(){this.scene.events.on("update",this._state.update,this._state),this.gameObject.on("destroy",this.destroy,this)}},{key:"shutdown",value:function(){this.destroyEventEmitter(),this.scene&&this.scene.events.off("update",this._state.update,this._state),this.gameObject=void 0,this.scene=void 0,this._state.destroy(),this.dragState.destroy()}},{key:"destroy",value:function(){this.shutdown()}},{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=Aa[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:"setValue",value:function(t){this.value=t}},{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:"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()}},{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:"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:"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:"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}}]),a}();Object.assign(Fa.prototype,ts);var Aa={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Xa=Phaser.Utils.Objects.GetValue,Ha=Phaser.Utils.Objects.GetValue,Ua=function(){t(v,sr);var f=e(v);function v(t,e){var i;z(this,v),void 0===e&&(e={});var n=Pa(e);e.orientation=0===n?1:0,(i=f.call(this,t,e)).type=Ha(e,"type","rexScrollable");var s=Ha(e,"background",void 0),r=function(t){var e,i,n=this.scene,s=Pa(t),r=new sr(n,{orientation:s}),o=Xa(t,"child.gameObject",void 0),a=Xa(t,"slider",void 0),h=Xa(t,"scroller",!0);if(o){var l=Xa(t,"space.child",0);if(this.childPadding={},"number"!=typeof l){var u=l;0===s?(l=Xa(u,"right",0),this.childPadding.top=Xa(u,"top",0),this.childPadding.bottom=Xa(u,"bottom",0)):(l=Xa(u,"bottom",0),this.childPadding.top=Xa(u,"left",0),this.childPadding.bottom=Xa(u,"right",0))}else this.childPadding.top=0,this.childPadding.bottom=0;var c,d=Xa(t,"child.proportion",1),f=Xa(t,"child.expand",!0);if(r.add(o,d,"center",0,f),a)!0===a&&(a={}),c=0===s?{left:l}:{top:l},a.orientation=0===r.orientation?1:0,e=new wa(n,a),r.add(e,0,"center",c,!0);h&&(!0===h&&(h={}),h.orientation=s,i=new Fa(o,h))}return e&&e.on("valuechange",function(t){this.t=t},this),i&&i.on("valuechange",function(t){this.childOY=t},this),this.addChildrenMap("child",o),this.addChildrenMap("slider",e),this.addChildrenMap("scroller",i),r}.call(_(i),e),o=Ha(e,"header",void 0),a=Ha(e,"footer",void 0);if(s&&i.addBackground(s),o){var h=Ha(e,"align.header","center"),l=Ha(e,"space.header",0);c=0===n?{bottom:l}:{right:l};var u=Ha(e,"expand.header",!0);i.add(o,0,h,c,u)}if(r&&i.add(r,1,"center",0,!0),a){h=Ha(e,"align.footer","center");var c,d=Ha(e,"space.footer",0);c=0===n?{top:d}:{left:d};u=Ha(e,"expand.footer",!0);i.add(a,0,h,c,u)}return i.addChildrenMap("background",s),i.addChildrenMap("header",o),i.addChildrenMap("footer",a),i}return k(v,[{key:"layout",value:function(t,e,i){return this.rexSizer.hidden||!this.dirty||(g(p(v.prototype),"layout",this).call(this,t,e,i),this.resizeController()),this}},{key:"setChildOY",value:function(t){return this.childOY=t,this}},{key:"setT",value:function(t){return this.t=t,this}},{key:"scrollToTop",value:function(){return this.t=0,this}},{key:"scrollToBottom",value:function(){return this.t=1,this}},{key:"setSliderEnable",value:function(t){return void 0===t&&(t=!0),this.sliderEnable=t,this}},{key:"setScrollerEnable",value:function(t){return void 0===t&&(t=!0),this.scrollerEnable=t,this}},{key:"t",set:function(t){var e=this.childPadding;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()},get:function(){var t=this.childrenMap.child.t,e=this.childPadding;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}},{key:"childOY",set:function(t){this.childrenMap.child.childOY=t,this.updateController()},get:function(){return this.childrenMap.child.childOY}},{key:"topChildOY",get:function(){return this.childrenMap.child.topChildOY+this.childPadding.top}},{key:"bottomChildOY",get:function(){return this.childrenMap.child.bottomChildOY-this.childPadding.bottom}},{key:"sliderEnable",get:function(){var t=this.childrenMap.slider;if(t)return t.enable},set:function(t){var e=this.childrenMap.slider;e&&e.setEnable(t)}},{key:"scrollerEnable",get:function(){var t=this.childrenMap.scroller;if(t)return t.enable},set:function(t){var e=this.childrenMap.scroller;e&&e.setEnable(t)}}]),v}(),Va={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(Ua.prototype,Va);var Wa={enableData:function(){return void 0===this.data&&(this.data={}),this},getData:function(t,e){return this.enableData(),void 0===t?this.data:Ea(this.data,t,e)},setData:function(t,e){return this.enableData(),this.data[t]=e,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&&lt(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?ut(this.data):{}}},Ga=function(){function i(t,e){z(this,i),this.container=null,this._deltaHeight=0,this.setParent(t)}return k(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:"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:"setDeltaHeight",value:function(t){return this.deltaHeight=t,this}},{key:"setDeltaWidth",value:function(t){return this.deltaHeight=t,this}},{key:"setHeight",value:function(t){return this.height=t,this}},{key:"setWidth",value:function(t){return this.width=t,this}},{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:"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--,this._deltaHeight=t}},{key:"deltaWidth",get:function(){return this.deltaHeight},set:function(t){this.deltaHeight=t}},{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:"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:"scene",get:function(){return this.parentContainer.scene}}]),i}();Object.assign(Ga.prototype,Wa);function Na(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask}function Ja(t,e,i){if(e){void 0===i&&(i=t.getAllChildren());for(var n,s,r=t.getBounds(),o=Na(e),a=0,h=i.length;a<h;a++)if(!(n=i[a]).hasOwnProperty("isRexContainerLite")&&n!==o)if(n.getBounds)switch(s=n.getBounds(s),sh(r,s)){case 4:rh(t,n);break;case 0:ih(r,s)||nh(r,s)?oh(t,n,e):ah(t,n);break;default:oh(t,n,e)}else oh(t,n,e)}}function Ka(t){if(this.emit("cellinvisible",t),this.cellContainersPool){var e=t.popContainer();e&&this.cellContainersPool.killAndHide(e)}t.destroyContainer()}function Za(){var t=this.preVisibleCells,e=this.visibleCells;t.iterate(function(t){e.contains(t)||Ka.call(this,t)},this)}function qa(t){var e=null;if(this.cellContainersPool&&null!==(e=this.cellContainersPool.getFirstDead())&&e.setActive(!0).setVisible(!0),this.emit("cellvisible",t,e,this),this.cellContainersPool){var i=t.getContainer();i?null===e?this.cellContainersPool.add(i):e!==i&&(this.cellContainersPool.add(i),this.cellContainersPool.killAndHide(e)):null!==e&&this.cellContainersPool.killAndHide(e)}}function $a(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 Qa=Phaser.Utils.Objects.GetValue,th=Phaser.Utils.Array.SpliceOne,eh=function(){function i(t,e){z(this,i),this.parent=t,this.cells=[],this.cellPool=new Et,this.resetFromJSON(e)}return k(i,[{key:"resetFromJSON",value:function(t){return this.colCount=void 0,this._nonZeroDeltaHeightCount=0,this.resetTotalRowsHeight(),this.setDefaultCellHeight(Qa(t,"cellHeight",30)),this.setDefaultCellWidth(Qa(t,"cellWidth",30)),this.initCells(Qa(t,"cellsCount",0)),this.setColumnCount(Qa(t,"columns",1)),this}},{key:"destroy",value:function(t){for(var e=0,i=this.cells.length;e<i;e++)this.freeCell(this.cells[e],t);this.cellPool.destroy(),this.cells=void 0,this.parent=void 0}},{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?th(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:"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:"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 Ga(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,e){return"number"==typeof t&&(t=this.cells[t]),t&&(t.destroy(e),e||this.cellPool.push(t)),this}},{key:"nonZeroDeltaHeightCount",get:function(){return this._nonZeroDeltaHeightCount},set:function(t){this._nonZeroDeltaHeightCount!==t&&(this._nonZeroDeltaHeightCount=t,this.resetTotalRowsHeight())}},{key:"defaultCellHeightMode",get:function(){return 0===this.nonZeroDeltaHeightCount}},{key:"rowCount",get:function(){return Math.ceil(this.cells.length/this.colCount)}},{key:"cellsCount",get:function(){return this.cells.length}},{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}}]),i}(),ih=Phaser.Geom.Intersects.RectangleToRectangle,nh=Phaser.Geom.Rectangle.Overlaps,sh=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},rh=function(t,e){t.setChildLocalVisible(e,!0),e.clearMask&&e.clearMask()},oh=function(t,e,i){t.setChildLocalVisible(e,!0),e.setMask&&e.setMask(i)},ah=function(t,e){t.setChildLocalVisible(e,!1),e.clearMask&&e.clearMask()},hh=function(t){var e=0===this.scrollMode?this.topLeftX:this.topLeftY;return this.tableOX+this.table.colIndexToWidth(0,t-1)+e},lh=function(t){var e=0===this.scrollMode?this.topLeftY:this.topLeftX;return this.tableOY+this.table.rowIndexToHeight(0,t-1)+e},uh=function(){var t=this.preVisibleCells;this.preVisibleCells=this.visibleCells,this.visibleCells=t,this.visibleCells.clear()},ch=Phaser.Math.Clamp,dh={setTableOY:function(t){var e=this.table,i=this.topTableOY,n=this.bottomTableOY,s=t>this.topTableOY,r=t<this.bottomTableOY;this.clampTableOXYMode&&(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.clampTableOXYMode&&(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},maskCells:function(){if(!this.cellsMask)return this;if(1===this.maskUpdateMode&&(0===this.alpha||!this.visible))return this;for(var t,e=[],i=this.visibleCells.entries,n=0,s=i.length;n<s;n++)(t=i[n].getContainer())&&(t.hasOwnProperty("isRexContainerLite")?t.getAllChildren(e):e.push(t));return Ja(this,this.cellsMask,e),this},updateTable:function(t){return void 0===t&&(t=!1),t&&(uh.call(this),Za.call(this)),uh.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=hh.call(this,s),c=u,d=lh.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)||qa.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),Za.call(this),0===this.maskUpdateMode&&this.maskCells(),this},isCellVisible:function(t){var e=this.table.getCell(t,!1);return e&&this.visibleCells.contains(e)},pointToCellIndex:$a,pointToCellContainer:function(t,e){var i=$a.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"===c(t)&&(t=t.index),void 0===e&&(e=1),e<=0||(t=ch(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"===c(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)&&(Ka.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}},fh=Phaser.GameObjects.Group,vh=Phaser.GameObjects.Components,ph=Phaser.Structs.Set,gh=Phaser.Utils.Objects.GetValue,yh=function(){t(f,_i);var d=e(f);function f(t,e,i,n,s,r){var o;z(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 ph,o.preVisibleCells=new ph,o.execeedTopState=!1,o.execeedBottomState=!1,o.execeedLeftState=!1,o.execeedRightState=!1,gh(r,"reuseCellContainer",!1)&&(o.cellContainersPool=new fh(t));var a=gh(r,"cellVisibleCallback",null);if(null!==a){var h=gh(r,"cellVisibleCallbackScope",void 0);o.on("cellvisible",a,h)}if(null!==(a=gh(r,"cellInvisibleCallback",null))){h=gh(r,"cellInvisibleCallbackScope",void 0);o.on("cellinvisible",a,h)}if(o.setCellsMask(gh(r,"mask",!0)),o.setScrollMode(gh(r,"scrollMode",0)),o.setClampMode(gh(r,"clamplTableOXY",!0)),0===o.scrollMode){var l=gh(r,"cellWidth",void 0);if(o.expandCellSize=void 0===l,void 0===l){var u=gh(r,"columns",1);r.cellWidth=o.width/u}}else{l=gh(r,"cellHeight",void 0);var c=gh(r,"cellWidth",void 0);o.expandCellSize=void 0===l,r.cellWidth=l,r.cellHeight=c}return o.table=new eh(_(o),r),o.updateTable(),o}return k(f,[{key:"destroy",value:function(t){this.scene&&(1===this.maskUpdateMode&&this.scene.game.events.off("poststep",this.maskCells,this),this.table.destroy(t),this.table=void 0,this.cellContainersPool&&(this.cellContainersPool.destroy(!0),this.cellContainersPool=void 0),g(p(f.prototype),"destroy",this).call(this,t))}},{key:"setScrollMode",value:function(t){return"string"==typeof t&&(t=xh[t.toLowerCase()]),this.scrollMode=t,this}},{key:"setClampMode",value:function(t){return this.clampTableOXYMode=t,this}},{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:"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:"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:"setCellsMask",value:function(t){var e,i,n;if(!0===t?(e=!0,n=i=0):!1===t?e=!1:(e=gh(t,"mask",!0),i=gh(t,"padding",0),n=gh(t,"updateMode",0)),this.maskUpdateMode=n,e){var s=new Zr(this,0,i);this.cellsMask=s.createGeometryMask(),this.add(s),"string"==typeof n&&(n=bh[n]),1===n&&this.scene.game.events.on("poststep",this.maskCells,this)}return this}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(g(p(f.prototype),"resize",this).call(this,t,e),this.cellsMask&&ds(Na(this.cellsMask),t,e),this.expandCellSize&&this.table.setDefaultCellWidth(this.instWidth/this.table.colCount),this.updateTable(!0)),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:"t",set:function(t){this.setTableOYByPercentage(t).updateTable()},get:function(){return this.getTableOYPercentage()}},{key:"cellsCount",get:function(){return this.table.cellsCount}},{key:"columnCount",get:function(){return this.table.colCount}},{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}}]),f}();Object.assign(yh.prototype,vh.GetBounds,dh);function mh(t,e,i,n,s,r){var o;if(null!=(o=void 0===s?n:i.pointToCellIndex(n,s))){var a=i.getCellContainer(o);t.emit(e,a,o,r)}}var xh={v:0,vertical:0,h:1,horizontal:1},bh={update:0,everyTick:1},kh=function(t){var e=this.childrenMap.child,i=e.pointToCellIndex(t.x,t.y);if(i!==e.input.lastOverCellIndex){var n=e.input.lastOverCellIndex;e.input.lastOverCellIndex=i,mh(this.eventEmitter,"cell.out",e,n,void 0,t),mh(this.eventEmitter,"cell.over",e,i,void 0,t)}},Ch=function(t){var e=this.childrenMap.child,i=e.input.lastOverCellIndex;e.input.lastOverCellIndex=void 0,mh(this.eventEmitter,"cell.out",e,i,void 0,t)},wh=Phaser.Utils.Objects.GetValue,Sh=Phaser.Utils.Objects.GetValue,Oh=function(){function i(t,e){z(this,i),this.parent=t,this._isRunning=!1,this.tickingState=!1,this.setEventEmitter(Sh(e,"eventEmitter",void 0)),this.setTickingMode(Sh(e,"tickingMode",1))}return k(i,[{key:"boot",value:function(){2!==this.tickingMode||this.tickingState||this.startTicking()}},{key:"shutdown",value:function(){this.destroyEventEmitter(),this.tickingState&&this.stopTicking()}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=Ph[t]),this.tickingMode=t}},{key:"startTicking",value:function(){this.tickingState=!0}},{key:"stopTicking",value:function(){this.tickingState=!1}},{key:"start",value:function(){return this.isRunning=!0,this}},{key:"pause",value:function(){return this.isRunning=!1,this}},{key:"resume",value:function(){return this.isRunning=!0,this}},{key:"stop",value:function(){return this.isRunning=!1,this}},{key:"complete",value:function(){this.isRunning=!1,this.emit("complete",this.parent,this)}},{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()))}}]),i}();Object.assign(Oh.prototype,ts);var Ph={no:0,lazy:1,always:2},Th=Phaser.Utils.Objects.GetValue,Mh=function(){t(r,Oh);var s=e(r);function r(t,e){var i;z(this,r);var n=Xn(t);return n===t&&(t=void 0),(i=s.call(this,n,e)).scene=n,(i.gameObject=t)&&t.setInteractive(Th(e,"inputConfig",void 0)),i._enable=void 0,i.resetFromJSON(e),i.boot(),i}return k(r,[{key:"resetFromJSON",value:function(t){return this.setEnable(Th(t,"enable",!0)),void 0===this.gameObject?this.bounds=Th(t,"bounds",void 0):this.bounds=void 0,this.tracerState=Eh,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,this.isTouchingAnyObject=!1,this}},{key:"boot",value:function(){g(p(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(){this.gameObject?this.gameObject.off("pointerdown",this.onPointerDown,this):this.scene&&this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene&&(this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.events.off("destroy",this.destroy,this),this.scene=void 0),this.scene=void 0,this.gameObject=void 0,this.bounds=void 0,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,g(p(r.prototype),"shutdown",this).call(this)}},{key:"destroy",value:function(){this.shutdown()}},{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,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=Bh,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=Eh,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===Bh&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Eh,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(){g(p(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(){g(p(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:"cancel",value:function(){return this.state=zh,this}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t}}]),r}(),Eh=0,Bh=1,zh="IDLE",_h=Phaser.Utils.Objects.GetValue,jh=Phaser.Math.Distance.Between,Dh=function(){t(o,Mh);var r=e(o);function o(t,e){var i;z(this,o);var n=_(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=Ih},eventEmitter:!1};return i.setRecongizedStateObject(new Ba(s)),i}return k(o,[{key:"resetFromJSON",value:function(t){g(p(o.prototype),"resetFromJSON",this).call(this,t),this.setMaxHoldTime(_h(t,"time",250)),this.setTapInterval(_h(t,"tapInterval",200)),this.setDragThreshold(_h(t,"threshold",9)),this.setTapOffset(_h(t,"tapOffset",10));var e=_h(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(_h(t,"maxTaps",void 0)),this.setMinTaps(_h(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){switch(this.state){case Ih:this.state=Rh;break;case Rh:var t=this.lastPointer;jh(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Yh,this.state=Rh);break;case Yh:this.state=Rh}}},{key:"onDragEnd",value:function(){this.state===Rh&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Yh))}},{key:"onDrag",value:function(){this.state!==Ih&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Ih)}},{key:"preUpdate",value:function(t){if(this.state===Rh){var e=this.lastPointer;if(e.isDown)t-e.downTime>this.holdTime&&(this.state=Ih);else t-e.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Yh:this.state=Ih)}}},{key:"postUpdate",value:function(){this.state===Yh&&(this.state=Ih)}},{key:"setMaxHoldTime",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}},{key:"isTapped",get:function(){return this.state===Yh}}]),o}(),Ih="IDLE",Rh="BEGIN",Yh="RECOGNIZED",Lh=Phaser.Utils.Objects.GetValue,Fh=Phaser.Utils.Objects.GetValue,Ah=function(){t(o,Mh);var r=e(o);function o(t,e){var i;z(this,o);var n=_(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=Xh},eventEmitter:!1};return i.setRecongizedStateObject(new Ba(s)),i}return k(o,[{key:"resetFromJSON",value:function(t){return g(p(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Fh(t,"threshold",9)),this.setMinHoldTime(Fh(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=0===this.holdTime?Uh:Hh}},{key:"onDragEnd",value:function(){this.state=Xh}},{key:"onDrag",value:function(){this.state!==Xh&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Xh)}},{key:"preUpdate",value:function(t){this.state===Hh&&t-this.pointer.downTime>=this.holdTime&&(this.state=Uh)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setMinHoldTime",value:function(t){return this.holdTime=t,this}},{key:"isPressed",get:function(){return this.state===Uh}}]),o}(),Xh="IDLE",Hh="BEGIN",Uh="RECOGNIZED",Vh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Math.Distance.Between,Gh=Phaser.Math.Angle.Between,Nh={getDt:function(){return this.scene.sys.game.loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Wh(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 Gh(e.x,e.y,t.x,t.y)}},Jh={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Kh={},Zh=Phaser.Utils.Objects.GetValue,qh=Phaser.Math.RadToDeg,$h=function(){t(o,Mh);var r=e(o);function o(t,e){var i;z(this,o);var n=_(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=tl},eventEmitter:!1};return i.setRecongizedStateObject(new Ba(s)),i.clearDirectionStates(),i}return k(o,[{key:"resetFromJSON",value:function(t){return g(p(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Zh(t,"threshold",10)),this.setMinDragVelocity(Zh(t,"velocityThreshold",1e3)),this.setDirectionMode(Zh(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=el}},{key:"onDragEnd",value:function(){this.state=tl}},{key:"onDrag",value:function(){this.state===el&&(this.vaildDrag||(this.vaildDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.vaildDrag&&this.dragVelocity>this.minDragVelocity&&(this.state=il))}},{key:"postUpdate",value:function(){this.state===il&&(this.state=tl)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setMinDragVelocity",value:function(t){return this.minDragVelocity=t,this}},{key:"setDirectionMode",value:function(t){return"string"==typeof t&&(t=Jh[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Kh),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)}}(qh(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}},{key:"isSwiped",get:function(){return this.state===il}},{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}}]),o}();Object.assign($h.prototype,Nh);function Qh(t,e){t.setInteractive(),function(e){e.on("pointerdown",function(t){mh(this.eventEmitter,"cell.down",e,t.x,t.y,t)},this).on("pointerup",function(t){mh(this.eventEmitter,"cell.up",e,t.x,t.y,t)},this)}.call(this,t,e),function(t){t.on("pointermove",kh,this).on("pointerover",kh,this).on("pointerout",Ch,this)}.call(this,t,e),function(t,e){var i=wh(e,"button",void 0);!1!==i&&(void 0===i&&(i={}),i.threshold=10,t._click=new io(t,i),t._click.on("click",function(t,e,i){mh(this.eventEmitter,"cell.click",e,i.x,i.y,i)},this))}.call(this,t,e),function(t,e){var i=Lh(e,"press",void 0);!1!==i&&(t._tap=new Dh(t,i),t._tap.on("tap",function(t,e,i){var n="cell.".concat(t.tapsCount,"tap");mh(this.eventEmitter,n,t.gameObject,t.x,t.y,i)},this))}.call(this,t,e),function(n,t){var e=Vh(t,"press",void 0);!1!==e&&(n._press=new Ah(n,e),n._press.on("pressstart",function(t,e,i){mh(this.eventEmitter,"cell.pressstart",n,t.x,t.y,i)},this).on("pressend",function(t,e,i){mh(this.eventEmitter,"cell.pressend",n,t.x,t.y,i)},this))}.call(this,t,e),function(s,t){var e=nl(t,"swipe",void 0);!1!==e&&(void 0===e&&(e={}),e.dir="4dir",s._swipe=new $h(s,e),s._swipe.on("swipe",function(t,e,i){var n=t.left?"left":t.right?"right":t.up?"up":"down";mh(this.eventEmitter,"cell.swipe".concat(n),s,t.x,t.y,i)},this))}.call(this,t,e)}var tl="IDLE",el="BEGIN",il="RECOGNIZED",nl=Phaser.Utils.Objects.GetValue,sl=Phaser.Utils.Objects.GetValue,rl=function(){t(p,Ua);var v=e(p);function p(t,e){var i;z(this,p),void 0===e&&(e={});var n=Pa(e),s=sl(e,"table",void 0);void 0===s&&(s={}),s.scrollMode=n,s.clamplTableOXY=sl(e,"clamplChildOY",!1);var r,o,a,h=sl(s,"width",void 0),l=sl(s,"height",void 0),u=new yh(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=sl(e,"space",void 0);c&&(c.child=c.table),(i=v.call(this,t,e)).addChildrenMap("table",u),i.eventEmitter=sl(e,"eventEmitter",_(i));var d=sl(e,"createCellContainerCallback",ct),f=sl(e,"createCellContainerCallbackScope",void 0);return 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(_(i),u),sl(s,"interactive",!0)&&Qh.call(_(i),u,s),i.setItems(sl(e,"items",[])),i}return k(p,[{key:"setCreateCellContainerCallback",value:function(t,e){return this.createCellContainerCallback=t,this.createCellContainerCallbackScope=e,this}},{key:"refresh",value:function(){return this.setItems(this.items),this}}]),p}(),ol={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(rl.prototype,ol),u.register("gridTable",function(t){var e=new rl(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.GridTable",rl);function al(t,e){return e.orientation=t.orientation,e}var hl={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.parentMenu),this.scaleDownDestroy(al(this,this.root.easeOut)),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}},ll=Phaser.Utils.Objects.GetValue,ul=function(){t(b,Eo);var x=e(b);function b(t,e){var i;z(this,b),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=ll(e,"items",void 0),d=ll(e,"createBackgroundCallback",void 0),f=ll(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 v=ll(e,"createButtonCallback",void 0),p=ll(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,v,p),(i=x.call(this,t,e)).type="rexMenu",i.items=c,i.root=void 0===h?_(i):h,i.parentMenu=l,i.parentButton=u;var g=i.root===_(i);g&&(void 0===(m=e.bounds)&&(m=an(t)),i.bounds=m,i.expandEventName=ll(e,"expandEvent","button.click"),i.toggleOrientation=ll(e,"toggleOrientation",!1),i.easeIn=ll(e,"easeIn",0),"number"==typeof i.easeIn&&(i.easeIn={duration:i.easeIn}),i.easeOut=ll(e,"easeOut",0),"number"==typeof i.easeOut&&(i.easeOut={duration:i.easeOut}),i.createBackgroundCallback=d,i.createBackgroundCallbackScope=f,i.createButtonCallback=v,i.createButtonCallbackScope=p,i._isPassedEvent=!1);i.setOrigin(0).layout();var y,m=i.root.bounds;if(g)i.expandOrientation=[i.y<m.centerY?1:3,i.x<m.centerX?0:2];else switch(i.root.expandOrientation[l.orientation]){case 0:i.alignTop(u.top).alignLeft(u.right);break;case 1:i.alignLeft(u.left).alignTop(u.bottom);break;case 2:i.alignTop(u.top).alignRight(u.left);break;case 3:i.alignLeft(u.left).alignBottom(u.top)}return i.pushIntoBounds(m),(y=_(i)).on(y.root.expandEventName,function(t,e){if(!this._isPassedEvent){var i=this.items[e].children;i&&this.expandSubMenu(t,i)}},y).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)},y).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)},y).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)},y),i.popUp(al(_(i),i.root.easeIn)),i}return k(b,[{key:"isInTouching",value:function(t){return!!g(p(b.prototype),"isInTouching",this).call(this,t)||!!this.childrenMap.subMenu&&this.childrenMap.subMenu.isInTouching(t)}}]),b}();Object.assign(ul.prototype,hl),u.register("menu",function(t){var e=new ul(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.Menu",ul);function cl(t){return t instanceof dl}var dl=Phaser.GameObjects.Text,fl=Phaser.Utils.Objects.GetValue,vl=Phaser.Math.Clamp,pl=function(){function i(t,e){z(this,i),this.gameObject=t,this.scene=Xn(t),this.setTextObjectType(),this.lines=void 0,this.resetFromJSON(e),this.boot()}return k(i,[{key:"resetFromJSON",value:function(t){return this.setText(fl(t,"text","")),this.setStartIdx(fl(t,"start",0)),this.setPageIdx(fl(t,"page",-1)),this}},{key:"toJSON",value:function(){return{text:this.text,start:this.startLineIdx,page:this.pageIndex,pageCount:this.pageCount}}},{key:"boot",value:function(){this.gameObject.on("destroy",this.destroy,this)}},{key:"shutdown",value:function(){return void 0===this.lines||(0===this.textObjectType?this.lines.length=0:this.lines.destroy()),this.gameObject=void 0,this.scene=void 0,this}},{key:"destroy",value:function(){this.shutdown()}},{key:"setTextObjectType",value:function(){return this.textObjectType=cl(this.gameObject)?0:1,this}},{key:"setText",value:function(t,e){return void 0===e&&(e=!0),this.text=gl(t),0===this.textObjectType?this.lines=this.gameObject.getWrappedText(this.text):this.lines=this.gameObject.getPenManager(this.text,this.lines),this.pageCount=Math.ceil(this.totalLinesCount/this.pageLinesCount),e&&this.resetPageIdx(),this}},{key:"appendText",value:function(t){return this.setText(this.text.concat(gl(t))),this}},{key:"getPage",value:function(t){return void 0===t&&(t=this.pageIndex),this.setPageIdx(t).getLines()}},{key:"getNextPage",value:function(){return this.getPage(this.pageIndex+1)}},{key:"getPreviousPage",value:function(){return this.getPage(this.pageIndex-1)}},{key:"showPage",value:function(){return this.displayText(this.getPage()),this}},{key:"showNextPage",value:function(){return this.displayText(this.getNextPage()),this}},{key:"showPreviousPage",value:function(){return this.displayText(this.getPreviousPage()),this}},{key:"show",value:function(){return this.displayText(this.getLines()),this}},{key:"showNextLine",value:function(){return this.displayText(this.setStartIdx(this.startLineIdx+1).getLines()),this}},{key:"showPreviousLine",value:function(){return this.displayText(this.setStartIdx(this.startLineIdx-1).getLines()),this}},{key:"setStartIdx",value:function(t){return t=vl(t,0,this.totalLinesCount-1),this.startLineIdx=t,this}},{key:"resetPageIdx",value:function(){this.pageIndex=-1}},{key:"setPageIdx",value:function(t){return t=vl(t,0,this.pageCount-1),this.pageIndex=t,this.setStartIdx(this.pageIndex*this.pageLinesCount),this}},{key:"getLines",value:function(t){void 0===t&&(t=this.startLineIdx);var e,i=t+this.pageLinesCount;if(0===this.textObjectType)e=this.lines.slice(t,i).join("\n");else{var n=this.lines.getLineStartIndex(t),s=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(n,s,!0)}return e}},{key:"displayText",value:function(t){this.gameObject.setText(t)}},{key:"isFirstPage",get:function(){return this.pageIndex<=0}},{key:"isLastPage",get:function(){return this.pageIndex>=this.pageCount-1}},{key:"totalLinesCount",get:function(){return 0===this.textObjectType?this.lines.length:this.lines.linesCount}},{key:"pageLinesCount",get:function(){var t=this.gameObject.style.maxLines;return 0<t?t:this.totalLinesCount}}]),i}(),gl=function(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},yl=Phaser.Utils.Objects.GetFastValue,ml=Phaser.Utils.Objects.GetValue,xl=function(){function i(t,e){z(this,i),this.gameObject=t,this.scene=Xn(t),this.setEventEmitter(ml(e,"eventEmitter",void 0)),this.timer=null,this.resetFromJSON(e),this.boot()}return k(i,[{key:"resetFromJSON",value:function(t){this.setTypeMode(ml(t,"typeMode",0)),this.setTypeSpeed(ml(t,"speed",333)),this.setTextCallback=yl(t,"setTextCallback",null),this.setTextCallbackScope=yl(t,"setTextCallbackScope",null),this.typingIdx=yl(t,"typingIdx",0),this.text=bl(yl(t,"text","")),this.textLen=yl(t,"textLen",0),this.insertIdx=yl(t,"insertIdx",null);var e=yl(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIdx,e),this}},{key:"toJSON",value:function(){var t,e=this.getTimer();return t=e?e.elapsed:null,{typeMode:this.typeMode,speed:this.speed,setTextCallback:this.setTextCallback,setTextCallbackScope:this.setTextCallbackScope,typingIdx:this.typingIdx,text:this.text,textLen:this.textLen,insertIdx:this.insertIdx,elapsed:t}}},{key:"boot",value:function(){return this.gameObject.once&&this.gameObject.on("destroy",this.destroy,this),this}},{key:"shutdown",value:function(){return this.destroyEventEmitter(),this.freeTimer(),this.gameObject=void 0,this.scene=void 0,this}},{key:"destroy",value:function(){return this.shutdown(),this}},{key:"setTypeMode",value:function(t){return"string"==typeof t&&(t=kl[t]),this.typeMode=t,this}},{key:"setTypeSpeed",value:function(t){return this.speed=t,this}},{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.startTimer(n),this}},{key:"appendText",value:function(t){var e=this.text.concat(bl(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.gameObject)),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=bl(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.gameObject)):(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:(this.speed,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.gameObject.setText(t)}},{key:"getTextLength",value:function(t){var e=this.gameObject;return e.getPlainText?e.getPlainText(t).length:t.length}},{key:"getSubString",value:function(t,e,i){var n=this.gameObject;return n.getSubString?n.getSubString(t,e,i):t.slice(e,i)}},{key:"isTyping",get:function(){return null!==this.getTimer()}},{key:"isLastChar",get:function(){return this.typingIdx===this.textLen}}]),i}();Object.assign(xl.prototype,ts);var bl=function(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},kl={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3},Cl=Phaser.Utils.Objects.GetValue,wl=function(){t(r,Qr);var s=e(r);function r(t,e){var i;z(this,r),void 0===e&&(e={text:Sl(t)}),(i=s.call(this,t,e)).type="rexTextBox";var n=i.childrenMap.text;return i.page=new pl(n,Cl(e,"page",void 0)),i.typing=new xl(n,Cl(e,"type",void 0)),i.typing.on("complete",i.onPageEnd,_(i)).on("type",i.onType,_(i)),i.textWidth=n.width,i.textHeight=n.height,i}return k(r,[{key:"start",value:function(t,e){return this.page.setText(t),void 0!==e&&this.typing.setTypeSpeed(e),this.typeNextPage(),this}},{key:"typeNextPage",value:function(){if(this.page.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:"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")}},{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}}]),r}(),Sl=function(t){return t.add.text(0,0,"",{wordWrap:{width:200},maxLines:5})};u.register("textBox",function(t){var e=new wl(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.TextBox",wl);var Ol=Phaser.Utils.Objects.GetValue,Pl=Phaser.Math.Percent,Tl=Phaser.Math.Linear,Ml=function(){t(g,sr);var p=e(g);function g(t,e){var i;z(this,g),(i=p.call(this,t,e)).type="rexNumberBar";var n,s=Ol(e,"background",void 0),r=Ol(e,"icon",void 0),o=Ol(e,"iconMask",void 0),a=Ol(e,"slider",void 0),h=Ol(e,"text",void 0),l=Ol(e,"space.icon",0),u=Ol(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&&i.addChildMask(r,r,1));if(a){var c,d;if(a.orientation=i.orientation,a.eventEmitter=_(i),a.value=null,a.hasOwnProperty("input")||(a.input=-1),n=new wa(t,a),0===i.orientation?h&&(c={right:u}):h&&(c={bottom:u}),0===i.orientation)d=void 0===Ol(a,"width",void 0)?1:0;else d=void 0===Ol(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=Ol(e,"valuechangeCallback",null);if(null!==f){var v=Ol(e,"valuechangeCallbackScope",void 0);i.on("valuechange",f,v)}return i.setEnable(Ol(e,"enable",void 0)),i.setValue(Ol(e,"value",0)),i}return k(g,[{key:"setEnable",value:function(t){return this.childrenMap.slider||(void 0===t&&(t=!0),this.childrenMap.slider.enable=t),this}},{key:"setValue",value:function(t,e,i){return void 0!==e&&(t=Pl(t,e,i)),this.value=t,this}},{key:"addValue",value:function(t,e,i){return void 0!==e&&(t=Pl(t,e,i)),this.value+=t,this}},{key:"getValue",value:function(t,e){var i=this.value;return void 0!==t&&(i=Tl(t,e,i)),i}},{key:"setText",value:function(t){return this.text=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:"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))}}]),g}(),El={addChildMask:Jr};Object.assign(Ml.prototype,El),u.register("numberBar",function(t){var e=new Ml(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.NumberBar",Ml);var Bl=_i.prototype.setChildVisible,zl={addPage:function(t,e,i,n,s){return t.setVisible(!1),this.add(t,e,i,n,s),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?(Bl.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&&(Bl.call(this,i,!0),this.emit("pagevisible",i,this._currentKey,this)),this}},_l=Phaser.Utils.Objects.GetValue,jl=function(){t(s,Nr);var n=e(s);function s(t,e){var i;return z(this,s),(i=n.call(this,t,e)).type="rexPages",i.childrenMap=i.sizerChildren,i._previousKey=void 0,i._currentKey=void 0,i.setSwapMode(_l(e,"swapMode",0)),i}return k(s,[{key:"setSwapMode",value:function(t){return"string"==typeof t&&(t=Dl[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(jl.prototype,zl);var Dl={invisible:0,destroy:1};u.register("pages",function(t){var e=new jl(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.Pages",jl);function Il(t){return(t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)}function Rl(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing}function Yl(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject)}var Ll=Phaser.Display.Align.TOP_LEFT,Fl={addChildMask:Jr,setTextObject:function(t,e){void 0===e&&(e=!0),this.add(t);var i=this.getSizerConfig(t);return i.align=Ll,i.padding=Rn(0),i.expand=!0,this.textObject=t,this.textObjectType=cl(t)?0:1,i.preOffsetY=0,i.offsetY=0,e&&(this.textMask=this.addChildMask(this.textObject,this)),this},setText:function(t){return void 0!==t&&(this.text=t),0===this.textObjectType?this.lines=this.textObject.getWrappedText(this.text):this.lines=this.textObject.getPenManager(this.text,this.lines),this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Il.call(this,-this.textOY)),0),e=Rl.call(this,t)+this.textOY;return this.textObject.setText(function(t){var e,i=t+this.textObject.style.maxLines;if(0===this.textObjectType)e=this.lines.slice(t,i).join("\n");else{var n=this.lines.getLineStartIndex(t),s=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(n,s,!0)}return e}.call(this,t)),this.textObject.rexSizer.offsetY=e,Yl.call(this),this},layout:function(t,e,i){if(this.rexSizer.hidden||!this.dirty)return this;var n,s,r;this.preLayout(t),void 0===e&&(e=this.minWidth),void 0===i&&(i=this.minHeight),this.resize(e,i);var o,a,h,l,u=this.left,c=this.top;return(n=this.textObject).rexSizer.hidden||(o=u+(r=(s=n.rexSizer).padding).left,a=c+r.top,h=this.width-r.left-r.right,l=this.height-r.top-r.bottom,function(t,e,i){if(i+=this.textLineHeight+this.textLineSpacing,t.width!==e||t.height!==i){t.setFixedSize(e,i);var n=t.style,s=Math.max(e,0),r=Math.ceil(Il.call(this,i))+1;0===this.textObjectType?n.wordWrapWidth=s:n.wrapWidth=s,n.maxLines=r,this.setText()}}.call(this,n,h,l),cn.setPosition(o,a).setSize(h,l),In(n,cn,s.align),s.preOffsetY=0,Yl.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask))),this.layoutBackgrounds(),this.postLayout()}},Al=Phaser.Utils.Objects.IsPlainObject,Xl=Phaser.Utils.Objects.GetValue,Hl=function(){t(c,Us);var u=e(c);function c(t,e,i,n,s,r){var o;z(this,c),Al(e)?(e=Xl(r=e,"x",0),i=Xl(r,"y",0),n=Xl(r,"width",void 0),s=Xl(r,"height",void 0)):Al(n)&&(n=Xl(r=n,"width",void 0),s=Xl(r,"height",void 0)),(o=u.call(this,t,e,i,n,s,r)).type="rexTextBlock",o.textObject=void 0,o.textMask=void 0,o.textObjectType=void 0,o.lines=void 0,o.text=Xl(r,"content",""),o._textOY=0,o.execeedTopState=!1,o.execeedBottomState=!1,o.setClampMode(Xl(r,"clamplTextOY",!0));var a=Xl(r,"background",void 0),h=Xl(r,"text",void 0);void 0===h&&(h=Ul(t));var l=Xl(r,"textMask",!0);return a&&o.addBackground(a),o.setTextObject(h,l),o.addChildrenMap("background",a),o.addChildrenMap("text",h),o}return k(c,[{key:"destroy",value:function(t){this.scene&&(this.textObject=void 0,(this.textMask=void 0)===this.lines||(0===this.textObjectType?this.lines.length=0:this.lines.destroy()),g(p(c.prototype),"destroy",this).call(this,t))}},{key:"setClampMode",value:function(t){return this.clampTextOYMode=t,this}},{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:"setTextOY",value:function(t){return this.textOY=t,this}},{key:"setTextOYByPercentage",value:function(t){return this.t=t,this}},{key:"textLineHeight",get:function(){var t=this.textObject.style;return t.metrics.fontSize+t.strokeThickness}},{key:"textLineSpacing",get:function(){return this.textObject.lineSpacing}},{key:"linesCount",get:function(){return void 0===this.lines?0:0===this.textObjectType?this.lines.length:this.lines.linesCount}},{key:"visibleLinesCount",get:function(){return Math.floor(Il.call(this,this.textObject.height))}},{key:"topTextOY",get:function(){return 0}},{key:"bottomTextOY",get:function(){return-this.textVisibleHeight}},{key:"textHeight",get:function(){return Rl.call(this,this.linesCount)}},{key:"textObjectHeight",get:function(){return this.textObject.height-this.textLineHeight-this.textLineSpacing}},{key:"textVisibleHeight",get:function(){var t=this.textHeight,e=this.textObjectHeight;return e<t?t-e:0}},{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.clampTextOYMode&&(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:"t",set:function(t){this.textOY=-this.textVisibleHeight*t},get:function(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}}]),c}(),Ul=function(t){return t.add.text(0,0,"")};Object.assign(Hl.prototype,Fl),u.register("textBlock",function(t,e,i,n,s,r){var o=new Hl(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o}),at(window,"RexPlugins.UI.TextBlock",Hl);var Vl=Phaser.Utils.Objects.GetValue,Wl=function(){t(v,Ua);var f=e(v);function v(t,e){var i;z(this,v),void 0===e&&(e={});var n=Vl(e,"text",void 0),s=Vl(e,"textWidth",void 0),r=Vl(e,"textHeight",void 0),o=Vl(e,"textMask",!0),a=Vl(e,"content",""),h=new Hl(t,{width:s,height:r,text:n,textMask:o,content:a,clamplTextOY:Vl(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=Vl(e,"space",void 0);return d&&(d.child=d.text),(i=f.call(this,t,e)).addChildrenMap("text",n),i}return k(v,[{key:"text",get:function(){return this.childrenMap.child.text}},{key:"linesCount",get:function(){return this.childrenMap.child.linesCount}}]),v}(),Gl={setText:function(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText:function(t){return this.setText(this.text+t),this}};Object.assign(Wl.prototype,Gl),u.register("textArea",function(t){var e=new Wl(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.TextArea",Wl);var Nl=Phaser.Utils.Objects.GetValue,Jl=Phaser.Display.Align.TOP_LEFT,Kl={update:0,everyTick:1},Zl={addChildMask:Jr,enableChildrenMask:function(t){var e=this.addChildMask(null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},maskChildren:function(t){return void 0===t&&(t=this.getAllChildren()),Ja(this,this.childrenMask,t),this},layoutChildrenMask:function(){if(void 0===this.childrenMask)return this;var t=Na(this.childrenMask);return t.setPosition().resize(),this.resetChildPositionState(t),this}},ql={setChild:function(t,e,i){t.setOrigin&&t.setOrigin(0),this.add(t);var n,s,r,o=this.getSizerConfig(t);return o.align=Jl,o.expand=e,this.child=t,!0===i?(n=!0,r=s=0):!1===i?n=!1:(n=Nl(i,"mask",!0),s=Nl(i,"padding",0),r=Nl(o,"updateMode",0)),this.maskUpdateMode=r,n&&("string"==typeof r&&(r=Kl[r]),1===r&&this.scene.game.events.on("poststep",this.maskChildren,this),this.enableChildrenMask(s)),this},getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t=this.child;return!t.rexSizer.hidden&&0===this.scrollMode?t.isRexSizer?Math.max(t.minWidth,t.childrenWidth):dn(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):fn(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),0===this.maskUpdateMode&&this.maskChildren()},layout:function(t,e,i){if(this.rexSizer.hidden||!this.dirty)return this;this.preLayout(t),void 0===e&&(e=Math.max(this.childrenWidth,this.minWidth)),void 0===i&&(i=Math.max(this.childrenHeight,this.minHeight)),this.resize(e,i);var n,s,r=this.child;return r.rexSizer.hidden||(0===this.scrollMode?n=this.width:s=this.height,r.isRexSizer?r.layout(this,n,s):ds(r,n,s),this.layoutChildrenMask(),this.resetChildPosition()),this.postLayout()}};Object.assign(ql,Zl);var $l=Phaser.Utils.Objects.IsPlainObject,Ql=Phaser.Utils.Objects.GetValue,tu=function(){t(c,Us);var u=e(c);function c(t,e,i,n,s,r){var o;z(this,c),$l(e)?(e=Ql(r=e,"x",0),i=Ql(r,"y",0),n=Ql(r,"width",void 0),s=Ql(r,"height",void 0)):$l(n)&&(n=Ql(r=n,"width",void 0),s=Ql(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(Ql(r,"scrollMode",!0)),o.setClampMode(Ql(r,"clamplChildOY",!0));var a=Ql(r,"child",void 0),h=Ql(r,"expand",!0),l=Ql(r,"mask",void 0);return o.setChild(a,h,l),o}return k(c,[{key:"destroy",value:function(t){this.scene&&(1===this.maskUpdateMode&&this.scene.game.events.off("poststep",this.maskChildren,this),this.child=void 0,this.childrenMask&&(this.childrenMask.destroy(),this.childrenMask=void 0),g(p(c.prototype),"destroy",this).call(this,t))}},{key:"setScrollMode",value:function(t){return"string"==typeof t&&(t=Ta[t.toLowerCase()]),this.scrollMode=t,this}},{key:"setClampMode",value:function(t){return this.clampChildOYMode=t,this}},{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:"setChildOY",value:function(t){return this.childOY=t,this}},{key:"setChildOYByPercentage",value:function(t){return this.t=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?fn:dn)(this.child)}},{key:"childWidth",get:function(){return(0===this.scrollMode?dn:fn)(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:"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.clampChildOYMode&&(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:"t",set:function(t){this.childOY=-this.visibleHeight*t},get:function(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}}]),c}();Object.assign(tu.prototype,ql),u.register("scrollableBlock",function(t){var e=new tu(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.ScrollableBlock",tu);var eu=Phaser.Utils.Objects.GetValue,iu=function(){t(d,Ua);var c=e(d);function d(t,e){var i;z(this,d),void 0===e&&(e={});var n=Pa(e),s=eu(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=n,s.clamplChildOY=eu(e,"clamplChildOY",!1);var r=new tu(t,s);t.add.existing(r);var o,a,h=eu(s,"width",void 0),l=eu(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=eu(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 iu(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.ScrollablePanel",iu);function nu(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 su(t){return"string"!=typeof t||(""===t?t=null:cu.test(t)?t=parseFloat(t):"false"===screen?t=!1:"true"===t&&(t=!0)),t}function ru(t,e,i){var n,s=du(i,"reverse",!1);if(vi(t[0]))if(s)for(r=(o=t.length)-1;0<=r;r--)n=ru(t[r],e,i);else for(var r=0,o=t.length;r<o;r++)n=ru(t[r],e,i);else n=fu(t,e,i);return n}var ou={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},au=function(t,e){t.popUp(e)},hu=function(t,e){t.scaleDown(e)},lu=function(t,e){t.fadeIn(e)},uu=function(t,e){t.fadeOut(e)},cu=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,du=Phaser.Utils.Objects.GetValue,fu=function(t,e,i){var n,s=du(i,"argsConvert",void 0),r=du(i,"argsConvertScope",void 0),o=t[0];if(vu=nu(vu,t,1),s){!0===s&&(s=su,r=void 0);for(var a=0,h=vu.length;a<h;a++)vu[a]=r?s.call(r,vu[a],t):s(vu[a],t)}return"string"==typeof o?null==(n=e[o])&&(n=du(e,o,null)):n=o,n.apply(e,vu)},vu=[],pu=function(){t(s,Oh);var n=e(s);function s(t,e){var i;return z(this,s),(i=n.call(this,t,e)).parent=t,i.scene=Xn(t),i.resetFromJSON(e),i.boot(),i}return k(s,[{key:"resetFromJSON",value:function(t){return this.isRunning=Ea(t,"isRunning",!1),this.state=Ea(t,"state",0),this.commands=Ea(t,"commands",[]),this.scope=Ea(t,"scope",void 0),this.setTimeUnit(Ea(t,"timeUnit",0)),this.setDtMode(Ea(t,"dtMode",0)),this.setTimeScale(Ea(t,"timeScale",1)),this.index=Ea(t,"index",0),this.nextDt=Ea(t,"nextDt",0),this.seek(Ea(t,"now",0)),this.timeScale=Ea(t,"timeScale",1),this}},{key:"toJSON",value:function(){return{isRunning:this.isRunning,state:this.state,commands:this.commands,scope:this.scope,timeUnit:this.timeUnit,dtMode:this.dtMode,index:this.index,nextDt:this.nextDt,now:this.now,timeScale:this.timeScale,tickingMode:this.tickingMode}}},{key:"boot",value:function(){g(p(s.prototype),"boot",this).call(this);var t,e=(t=this.parent,An(t)?t.events:t.on?t:void 0);e&&e.on("destroy",this.destroy,this)}},{key:"shutdown",value:function(){g(p(s.prototype),"shutdown",this).call(this),this.parent=void 0,this.scene=void 0,this.commands=void 0}},{key:"destroy",value:function(){this.shutdown()}},{key:"startTicking",value:function(){g(p(s.prototype),"startTicking",this).call(this),this.scene.events.on("update",this.update,this)}},{key:"stopTicking",value:function(){g(p(s.prototype),"stopTicking",this).call(this),this.scene&&this.scene.events.off("update",this.update,this)}},{key:"load",value:function(t,e,i){this.stop();var n=Ea(i,"timeUnit",void 0);void 0!==n&&this.setTimeUnit(n);var s=Ea(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.isRunning=!0,this.state=1,this.nextDt=this.getNextDt(0),this.seek(t),this.update(),this}},{key:"pause",value:function(){return this.isRunning=!1,this}},{key:"resume",value:function(){return this.isRunning=!0,this}},{key:"stop",value:function(){return this.isRunning=!1,this.state=0,this}},{key:"seek",value:function(t){return this.now=t,this}},{key:"setTimeScale",value:function(t){this.timeScale=t}},{key:"update",value:function(t,e){if(!this.isRunning)return this;if(void 0!==t){if(0===this.timeScale||0===e)return this;this.now+=e*this.timeScale}if(this.nextDt>this.now)return this;for(;;){var i=this.commands[this.index],n=i[1];if(vi(n)||(n=nu(gu,i,1)),ru(n,this.scope),this.emit("runcommand",n,this.scope),this.index===this.commands.length-1)return this.complete(),this;if(this.index++,this.nextDt=this.getNextDt(this.nextDt),this.nextDt>this.now)return this}}},{key:"complete",value:function(){g(p(s.prototype),"complete",this).call(this),this.state=2}},{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=mu[t]),this.dtMode=t,this}},{key:"setTimeUnit",value:function(t){return"string"==typeof t&&(t=yu[t]),this.timeUnit=t,this}},{key:"isPlaying",get:function(){return this.isRunning}},{key:"completed",get:function(){return 2===this.state}}]),s}(),gu=[],yu={ms:0,s:1,sec:1},mu={abs:0,absolute:0,inc:1,increment:1},xu=Phaser.Utils.Objects.GetValue,bu=function(){t(s,Qr);var n=e(s);function s(t,e){var i;return z(this,s),void 0===e&&(e={text:createDefaultTextObject(t)}),(i=n.call(this,t,e)).type="rexToast",i.setTransitInTime(xu(e,"duration.in",200)),i.setDisplayTime(xu(e,"duration.hold",1200)),i.setTransitOutTime(xu(e,"duration.out",200)),i.setTransitInCallback(xu(e,"transitIn",ou.popUp)),i.setTransitOutCallback(xu(e,"transitOut",ou.scaleDown)),i.player=new pu(_(i),{dtMode:1}),i.messages=[],i.setVisible(!1),i}return k(s,[{key:"destroy",value:function(t){this.scene&&(this.player.destroy(),this.player=void 0,this.messages=void 0,g(p(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=ou[t]),t){case ou.popUp:t=au;break;case ou.fadeIn:t=lu}return this.transitInCallback=t,this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=ou[t]),t){case ou.scaleDown:t=hu;break;case ou.fadeOut:t=uu}return this.transitOutCallback=t,this}},{key:"show",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,[ct]],[this.displayTime,[this.transitOutCallback,this,this.transitOutTime]],[this.transitOutTime,[this.setVisible,!1]],[30,[ct]]];return this.player.load(e,this).once("complete",function(){this.show()},this).start(),this}}]),s}();u.register("toast",function(t){var e=new bu(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.Toast",bu);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 Cu=_i.prototype.setChildVisible,wu={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),Cu.call(this,t,e),this}},Su={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?os(t._fade):Promise.resolve()}},Ou={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=dn(t);break;case"topSide":case"bottomSide":n=fn(t);break;default:if(l){var u=this.sizerChildren[this.previousChildKey];switch(this.previousChildKey){case"leftSide":case"rightSide":n=dn(u);break;case"topSide":case"bottomSide":n=fn(u)}}else{var c=this.sizerChildren[this.currentChildKey];switch(this.currentChildKey){case"leftSide":case"rightSide":n=dn(c);break;case"topSide":case"bottomSide":n=fn(c)}}}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),this},moveChildPromise:function(t,e,i,n){return"string"==typeof t&&(t=this.sizerChildren[key]),this.moveChild(t,e,i,n),t._easeMove?os(t._easeMove):Promise.resolve()}},Pu={};Object.assign(Pu,wu,Su,Ou);var Tu=Phaser.Utils.Objects.GetValue,Mu=function(){t(p,Nr);var v=e(p);function p(t,e){var i;z(this,p),(i=v.call(this,t,e)).type="rexSides",i.childrenMap=i.sizerChildren,i.previousChildKey=void 0,i.currentChildKey=void 0;var n=Tu(e,"showChildCallback",void 0),s=Tu(e,"showChildCallbackScope",void 0),r=Tu(e,"hideChildCallback",void 0),o=Tu(e,"hideChildCallbackScope",void 0);n&&i.on("showchild",n,s),r&&i.on("hidechild",r,o);var a=Tu(e,"background",void 0),h=Tu(e,"panel",void 0),l=Tu(e,"leftSide",void 0),u=Tu(e,"rightSide",void 0),c=Tu(e,"topSide",void 0),d=Tu(e,"bottomSide",void 0);if(a&&i.addBackground(a),h&&i.add(h,"panel","center",0,!0),l){var f=Tu(e,"expand.left",!0);i.add(l,"leftSide","left-top",0,{height:f})}if(u){f=Tu(e,"expand.right",!0);i.add(u,"rightSide","right-top",0,{height:f})}if(c){f=Tu(e,"expand.top",!0);i.add(c,"topSide","left-top",0,{width:f})}if(d){f=Tu(e,"expand.bottom",!0);i.add(d,"bottomSide","left-bottom",0,{width:f})}return i.currentChildKey="panel",i.showChild("panel"),i.hideChild("leftSide"),i.hideChild("rightSide"),i.hideChild("topSide"),i.hideChild("bottomSide"),i}return p}();Object.assign(Mu.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}},Pu),u.register("sides",function(t){var e=new Mu(this.scene,t);return this.scene.add.existing(e),e}),at(window,"RexPlugins.UI.Sides",Mu),u.register("click",function(t,e){return Hn(t)||(e=t,t=this.scene),new io(t,e)}),at(window,"RexPlugins.UI.Click",io),u.register("tap",function(t,e){return Hn(t)||(e=t,t=this.scene),new Dh(t,e)}),at(window,"RexPlugins.UI.Tap",Dh),u.register("press",function(t,e){return Hn(t)||(e=t,t=this.scene),new Ah(t,e)}),at(window,"RexPlugins.UI.Press",Ah),u.register("swipe",function(t,e){return Hn(t)||(e=t,t=this.scene),new $h(t,e)}),at(window,"RexPlugins.UI.Swipe",$h);var Eu=Phaser.Utils.Objects.GetValue,Bu=function(){t(o,Mh);var r=e(o);function o(t,e){var i;z(this,o);var n=_(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=zu},eventEmitter:!1};return i.setRecongizedStateObject(new Ba(s)),i}return k(o,[{key:"resetFromJSON",value:function(t){return g(p(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Eu(t,"threshold",10)),this}},{key:"onDragStart",value:function(){this.state=0===this.dragThreshold?ju:_u}},{key:"onDragEnd",value:function(){this.state=zu}},{key:"onDrag",value:function(){switch(this.state){case _u:this.pointer.getDistance()>=this.dragThreshold&&(this.state=ju);break;case ju: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:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPan",get:function(){return this.state===ju}}]),o}(),zu="IDLE",_u="BEGIN",ju="RECOGNIZED";u.register("pan",function(t,e){return Hn(t)||(e=t,t=this.scene),new Bu(t,e)}),at(window,"RexPlugins.UI.Pan",Bu);var Du=Phaser.Utils.Objects.GetValue,Iu=Phaser.Utils.Array.SpliceOne,Ru=Phaser.Math.Distance.Between,Yu=Phaser.Math.Angle.Between,Lu=function(){function n(t,e){z(this,n);var i=t.input.manager.pointersTotal-1;i<2&&t.input.addPointer(2-i),this.scene=t,this.setEventEmitter(Du(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}return k(n,[{key:"resetFromJSON",value:function(t){return this.setEnable(Du(t,"enable",!0)),this.bounds=Du(t,"bounds",void 0),this.tracerState=Au,this.pointers.length=0,lt(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.destroyEventEmitter(),this.pointers.length=0,lt(this.movedState),this.scene&&(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("destroy",this.destroy,this),this.scene=void 0),this.scene=void 0}},{key:"destroy",value:function(){this.shutdown()}},{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 Au:this.tracerState=Xu,this.onDrag1Start();break;case Xu:this.tracerState=Hu,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],Iu(this.pointers,e),this.tracerState){case Xu:this.tracerState=Au,this.onDrag1End();break;case Hu:this.tracerState=Xu,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 Xu:this.onDrag1();break;case Hu:this.onDrag2()}}}},{key:"dragCancel",value:function(){return this.tracerState===Hu&&this.onDrag2End(),this.pointers.length=0,lt(this.movedState),this.tracerState=Au,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:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"cancel",value:function(){return this.state=Uu,this}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"distanceBetween",get:function(){if(this.tracerState!==Hu)return 0;var t=this.pointers[0],e=this.pointers[1];return Ru(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==Hu)return 0;var t=this.pointers[0],e=this.pointers[1];return Yu(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;Fu.x=e.x-i.x,Fu.y=e.y-i.y}else Fu.x=0,Fu.y=0;return Fu}},{key:"centerX",get:function(){if(this.tracerState!==Hu)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!==Hu)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!==Hu)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!==Hu)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:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t}}]),n}();Object.assign(Lu.prototype,ts);var Fu={},Au=0,Xu=1,Hu=2,Uu="IDLE",Vu=Phaser.Utils.Objects.GetValue,Wu=function(){t(o,Lu);var r=e(o);function o(t,e){var i;z(this,o);var n=_(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=Gu},eventEmitter:!1};return i.setRecongizedStateObject(new Ba(s)),i}return k(o,[{key:"resetFromJSON",value:function(t){return g(p(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Vu(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=0===this.dragThreshold?Ju:Nu}},{key:"onDrag2End",value:function(){this.state=Gu}},{key:"onDrag2",value:function(){switch(this.state){case Nu: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=Ju}break;case Ju:t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPinch",get:function(){return this.state===Ju}}]),o}(),Gu="IDLE",Nu="BEGIN",Ju="RECOGNIZED";u.register("pinch",function(t){return new Wu(this.scene,t)}),at(window,"RexPlugins.UI.Pinch",Wu);function Ku(t,e,i,n){return Zu(t,e,i,n),t.rotation+=n,t}var Zu=Phaser.Math.RotateAround,qu={},$u=Phaser.Utils.Objects.GetValue,Qu=Phaser.Math.Angle.WrapDegrees,tc=Phaser.Math.Angle.ShortestBetween,ec=Phaser.Math.RadToDeg,ic=Phaser.Math.DegToRad,nc=function(){t(o,Lu);var r=e(o);function o(t,e){var i;z(this,o);var n=_(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=rc},eventEmitter:!1};return i.setRecongizedStateObject(new Ba(s)),i}return k(o,[{key:"resetFromJSON",value:function(t){return g(p(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold($u(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Qu(ec(this.angleBetween)),this.state=0===this.rotationThreshold?ac:oc}},{key:"onDrag2End",value:function(){this.state=rc}},{key:"onDrag2",value:function(){switch(this.state){case oc:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Qu(ec(this.angleBetween));this.angle=tc(this.prevAngle,t),this.prevAngle=t,this.state=ac}break;case ac:t=Qu(ec(this.angleBetween));this.angle=tc(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isRotation",get:function(){return this.state===ac}},{key:"rotation",get:function(){return ic(this.angle)}}]),o}(),sc={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,qu);var s=qu.x,r=qu.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,Ku(t,s,r,o);else t.x+=i,t.y+=n,Ku(t,x,y,o);return this}};Object.assign(nc.prototype,sc);var rc="IDLE",oc="BEGIN",ac="RECOGNIZED";u.register("rotate",function(t){return new nc(this.scene,t)}),at(window,"RexPlugins.UI.Rotate",nc);function hc(e,i,t){var n;if(void 0===e)e=t.texture.key,i=t.frame.name;else if(lc(e)){var s=e;e=uc(s,"key",t.texture.key),i=uc(s,"frame",t.frame.name)}else"string"==typeof e||(n=e);return void 0===n&&(n=function(t){t.setTexture(e,i)}),n}var lc=Phaser.Utils.Objects.IsPlainObject,uc=Phaser.Utils.Objects.GetValue,cc=Phaser.Utils.Objects.GetValue,dc=Phaser.Utils.Objects.GetAdvancedValue,fc=function(){t(s,ss);var n=e(s);function s(t,e){var i;return z(this,s),(i=n.call(this,t,{eventEmitter:!0})).gameObject=t,i.resetFromJSON(e),i}return k(s,[{key:"resetFromJSON",value:function(t){return this.setOrientation(cc(t,"orientation",0)),this.setDelay(dc(t,"delay",0)),this.setDuration(dc(t,"duration",500)),this.setEase(cc(t,"ease","Sine")),this.setFrontFace(cc(t,"front",void 0)),this.setBackFace(cc(t,"back",void 0)),this.setFace(cc(t,"face",0)),this}},{key:"shutdown",value:function(){return g(p(s.prototype),"shutdown",this).call(this),this.gameObject=void 0,this}},{key:"setOrientation",value:function(t){return"string"==typeof t&&(t=vc[t]),this.orientation=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}},{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=hc(t,e,this.gameObject),this}},{key:"setBackFace",value:function(t,e){return this.backFaceCallback=hc(t,e,this.gameObject),this}},{key:"start",value:function(){if(this.isRunning)return this;var t={targets:this.gameObject,delay:this.delay,duration:this.duration/2,ease:this.ease,yoyo:!0,repeat:0,onYoyo:this.toggleFace,onYoyoScope:this};return t[0===this.orientation?"scaleX":"scaleY"]={start:1,to:0},g(p(s.prototype),"start",this).call(this,t),this}},{key:"flip",value:function(t){return this.isRunning||(void 0!==t&&this.setDuration(t),this.start()),this}},{key:"face",get:function(){return this._face},set:function(t){"string"==typeof t&&(t=pc[t]),0===(this._face=t)&&this.frontFaceCallback?this.frontFaceCallback(this.gameObject):1===t&&this.backFaceCallback&&this.backFaceCallback(this.gameObject)}}]),s}(),vc={x:0,horizontal:0,y:1,vertical:1},pc={front:0,back:1};u.register("flip",function(t,e){return new fc(t,e)}),at(window,"RexPlugins.UI.Flip",fc);function gc(t,e,i){var n,s;for(var r in void 0===i&&(i={}),t)n=t[r],void 0!==(s=bc(e,r,n[1]))&&(i[n[0]]=s);return i}function yc(i,t,n){function e(e){t[n[e]]=function(t){i.emit(e,i,t)}}for(var s in n)e(s)}var mc=ui,xc=ci,bc=Phaser.Utils.Objects.GetValue,kc=function(t){t.stopPropagation()},Cc=Phaser.GameObjects.DOMElement,wc=Phaser.Utils.Objects.IsPlainObject,Sc=Phaser.Utils.Objects.GetValue,Oc=function(){t(v,Cc);var f=e(v);function v(t,e,i,n,s,r){var o,a;z(this,v),wc(e)?(e=Sc(r=e,"x",0),i=Sc(r,"y",0),n=Sc(r,"width",0),s=Sc(r,"height",0)):wc(n)&&(n=Sc(r=n,"width",0),s=Sc(r,"height",0)),void 0===r&&(r={});var h=Sc(r,"type","text");"textarea"===h?(a=document.createElement("textarea")).style.resize="none":(a=document.createElement("input")).type=h,gc(Ec,r,a);var l=Sc(r,"style",void 0);l=gc(Bc,r,l);var u,c=a.style;for(var d in r)d in Ec||d in Bc||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),yc(_(o),a,zc),(u=a).addEventListener("touchstart",kc,!1),u.addEventListener("touchmove",kc,!1),u.addEventListener("touchend",kc,!1),u.addEventListener("mousedown",kc,!1),u.addEventListener("mouseup",kc,!1),u.addEventListener("mousemove",kc,!1),o}return k(v,[{key:"setText",value:function(t){return this.text=t,this}},{key:"selectText",value:function(){return this.node.select(),this}},{key:"setPlaceholder",value:function(t){return this.placeholder=t,this}},{key:"setTooltip",value:function(t){return this.tooltip=t,this}},{key:"setTextChangedCallback",value:function(t){return this.onTextChanged=t,this}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}},{key:"setSpellCheck",value:function(t){return this.spellCheck=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:"text",get:function(){return this.node.value},set:function(t){this.node.value=t}},{key:"placeholder",get:function(){return this.node.placeholder},set:function(t){this.node.placeholder=t}},{key:"tooltip",get:function(){return this.node.title},set:function(t){this.node.title=t}},{key:"readOnly",get:function(){return this.node.readOnly},set:function(t){this.node.readOnly=t}},{key:"spellCheck",get:function(){return this.node.spellcheck},set:function(t){this.node.spellcheck=t}}]),v}(),Pc={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(Oc.prototype,Pc);function Tc(t,e,i){for(var n,s=0,r=t.length;s<r;s++)if(n=t[s],us(n,e,i))return n.pointToChild(e,i);return null}function Mc(t,e,i,n,s,r){var o;(o=void 0===s?n:Tc(i,n,s))&&t.emit(e,o,r)}var Ec={id:["id",void 0],text:["value",void 0],placeholder:["placeholder",void 0],tooltip:["title",void 0],readOnly:["readonly",!1],spellCheck:["spellcheck",!1],autoComplete:["autocomplete","off"]},Bc={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"]},zc={textchange:"oninput",click:"onclick",dblclick:"ondblclick",focus:"onfocus",blur:"onblur"},_c=Phaser.Utils.Objects.GetValue,jc=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"},Dc=Phaser.Utils.Objects.GetValue,Ic=function(){function e(t){z(this,e),this.gameObject=t,this.scene=Xn(t),this.inputText=void 0,this.onClose=void 0,this.delayCall=void 0,this.boot()}return k(e,[{key:"boot",value:function(){return this.gameObject.on("destroy",this.destroy,this),this}},{key:"shutdown",value:function(){return this.close(),this.gameObject=void 0,this.scene=void 0,Rc===this&&(Rc=void 0),this}},{key:"destroy",value:function(){return this.shutdown(),this}},{key:"open",value:function(t,e){void 0!==Rc&&Rc.close(),Rc=this,ls(t)&&(e=t,t=void 0),void 0===e&&(e=Dc(t,"onClose",void 0));var i=Dc(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={});var i=t.scene,n=t.style,s=_c(e,"backgroundColor",n.backgroundColor);null===s&&(s="transparent"),e.text=_c(e,"text",t.text),e.fontFamily=_c(e,"fontFamily",n.fontFamily),e.fontSize=_c(e,"fontSize",n.fontSize),e.color=_c(e,"color",n.color),e.backgroundColor=s,e.align=_c(e,"align",jc(n));var r=new Oc(i,t.x,t.y,_c(e,"width",t.width),_c(e,"height",t.height),e);return r.setOrigin(t.originX,t.originY),i.add.existing(r),r}(this.gameObject,t).on("textchange",function(t){var e=t.text;i?i(this.gameObject,e):this.gameObject.text=e},this).setFocus(),this.gameObject.setVisible(!1),this.onClose=e,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)},[],this),this}},{key:"close",value:function(){return Rc=void 0,this.inputText&&(this.gameObject.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.gameObject)),this}},{key:"isOpened",get:function(){return void 0!==this.inputText}},{key:"text",get:function(){return this.isOpened?this.inputText.text:this.gameObject.text}}]),e}(),Rc=void 0,Yc=Phaser.Utils.Objects.GetValue,Lc=Phaser.Utils.Objects.GetValue,Fc=function(t){var e=Tc(this.input.targetSizers,t.x,t.y),i=this.input.lastOverChild;e&&i&&e===i||(this.input.lastOverChild=e,Mc(this.eventEmitter,"".concat(this.input.eventNamePrefix,"out"),this.input.targetSizers,i,void 0,t),Mc(this.eventEmitter,"".concat(this.input.eventNamePrefix,"over"),this.input.targetSizers,e,void 0,t))},Ac=function(t){var e=this.input.lastOverChild;this.input.lastOverChild=null,Mc(this.eventEmitter,"".concat(this.input.eventNamePrefix,"out"),this.input.targetSizers,e,void 0,t)},Xc=Phaser.Utils.Objects.GetValue,Hc=Phaser.Utils.Objects.GetValue,Uc=Phaser.Utils.Objects.GetValue,Vc=Phaser.Utils.Objects.GetValue,Wc=function(){t(s,Phaser.Plugins.ScenePlugin);var n=e(s);function s(t,e){var i;return z(this,s),(i=n.call(this,t,e)).add=new u(t),i}return k(s,[{key:"viewport",get:function(){return Fn(this.scene,!0)}}]),s}(),Gc={getParentSizer:mc,getTopmostSizer:xc,hide:ao,show:oo,isShown:ho,edit:function(t,e,i){return t._edit||(t._edit=new Ic(t)),t._edit.open(e,i),t._edit},isInTouching:hs,waitEvent:rs,waitComplete:os,setChildrenInteractive:function(t,e){return t.setInteractive(),t.eventEmitter=Vc(e,"eventEmitter",t),t.input.targetSizers=Vc(e,"targets",[t]),t.input.eventNamePrefix=Vc(e,"inputEventPrefix","child."),function(t){var e=Yc(t,"click",void 0);!1!==e&&(void 0===e&&(e={}),e.hasOwnProperty("threshold")||(e.threshold=10),this._click=new io(this,e),this._click.on("click",function(t,e,i){Mc(this.eventEmitter,"".concat(this.input.eventNamePrefix,"click"),this.input.targetSizers,i.x,i.y,i)},this))}.call(t,e),function(t){!1!==Lc(t,"over",void 0)&&this.on("pointermove",Fc,this).on("pointerover",Fc,this).on("pointerout",Ac,this)}.call(t,e),function(t){var e=Xc(t,"tap",void 0);!1!==e&&(this._tap=new Dh(this,e),this._tap.on("tap",function(t,e,i){Mc(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=Hc(t,"press",void 0);!1!==e&&(this._press=new Ah(this,e),this._press.on("pressstart",function(t,e,i){Mc(this.eventEmitter,"".concat(this.input.eventNamePrefix,"pressstart"),this.input.targetSizers,t.x,t.y,i)},this).on("pressend",function(t,e,i){Mc(this.eventEmitter,"".concat(this.input.eventNamePrefix,"pressend"),this.input.targetSizers,t.x,t.y,i)},this))}.call(t,e),function(t){var e=Uc(t,"swipe",void 0);!1!==e&&(void 0===e&&(e={}),e.dir="4dir",this._swipe=new $h(this,e),this._swipe.on("swipe",function(t,e,i){var n=t.left?"left":t.right?"right":t.up?"up":"down";Mc(this.eventEmitter,"".concat(this.input.eventNamePrefix,"swipe").concat(n),this.input.targetSizers,t.x,t.y,i)},this))}.call(t,e),t}};return Object.assign(Wc.prototype,Gc),Wc});
  