phaser3-rex-plugins
Version:
6 lines • 822 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexuiplugin=e();}(undefined,(function(){function t(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n);}return i}function e(e){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?t(Object(n),!0).forEach((function(t){h(e,t,n[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t));}));}return e}function i(){i=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,s=Object.defineProperty||function(t,e,i){t[e]=i.value;},r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",h=r.toStringTag||"@@toStringTag";function l(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"");}catch(t){l=function(t,e,i){return t[e]=i};}function u(t,e,i,n){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),a=new T(n||[]);return s(o,"_invoke",{value:C(t,i,a)}),o}function c(t,e,i){try{return {type:"normal",arg:t.call(e,i)}}catch(t){return {type:"throw",arg:t}}}t.wrap=u;var d={};function f(){}function p(){}function v(){}var g={};l(g,o,(function(){return this}));var y=Object.getPrototypeOf,k=y&&y(y(O([])));k&&k!==e&&n.call(k,o)&&(g=k);var m=v.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}));}));}function x(t,e){function i(s,r,o,a){var h=c(t[s],t,r);if("throw"!==h.type){var l=h.arg,u=l.value;return u&&"object"==typeof u&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,o,a);}),(function(t){i("throw",t,o,a);})):e.resolve(u).then((function(t){l.value=t,o(l);}),(function(t){return i("throw",t,o,a)}))}a(h.arg);}var r;s(this,"_invoke",{value:function(t,n){function s(){return new e((function(e,s){i(t,n,e,s);}))}return r=r?r.then(s,s):s()}});}function C(t,e,i){var n="suspendedStart";return function(s,r){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===s)throw r;return M()}for(i.method=s,i.arg=r;;){var o=i.delegate;if(o){var a=w(o,i);if(a){if(a===d)continue;return a}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if("suspendedStart"===n)throw n="completed",i.arg;i.dispatchException(i.arg);}else "return"===i.method&&i.abrupt("return",i.arg);n="executing";var h=c(t,e,i);if("normal"===h.type){if(n=i.done?"completed":"suspendedYield",h.arg===d)continue;return {value:h.arg,done:i.done}}"throw"===h.type&&(n="completed",i.method="throw",i.arg=h.arg);}}}function w(t,e){var i=e.method,n=t.iterator[i];if(void 0===n)return e.delegate=null,"throw"===i&&t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method)||"return"!==i&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+i+"' method")),d;var s=c(n,t.iterator,e.arg);if("throw"===s.type)return e.method="throw",e.arg=s.arg,e.delegate=null,d;var r=s.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0);}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,s=function e(){for(;++i<t.length;)if(n.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=void 0,e.done=!0,e};return s.next=s}}return {next:M}}function M(){return {value:void 0,done:!0}}return p.prototype=v,s(m,"constructor",{value:v,configurable:!0}),s(v,"constructor",{value:p,configurable:!0}),p.displayName=l(v,h,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return !!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,l(t,h,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return {__await:t}},b(x.prototype),l(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,i,n,s,r){void 0===r&&(r=Promise);var o=new x(u(e,i,n,s),r);return t.isGeneratorFunction(i)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},b(m),l(m,h,"Generator"),l(m,o,(function(){return this})),l(m,"toString",(function(){return "[object Generator]"})),t.keys=function(t){var e=Object(t),i=[];for(var n in e)i.push(n);return i.reverse(),function t(){for(;i.length;){var n=i.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=O,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(P),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0);},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function i(i,n){return o.type="throw",o.arg=t,e.next=i,n&&(e.method="next",e.arg=void 0),!!n}for(var s=this.tryEntries.length-1;s>=0;--s){var r=this.tryEntries[s],o=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var a=n.call(r,"catchLoc"),h=n.call(r,"finallyLoc");if(a&&h){if(this.prev<r.catchLoc)return i(r.catchLoc,!0);if(this.prev<r.finallyLoc)return i(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return i(r.catchLoc,!0)}else {if(!h)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return i(r.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var r=s;break}}r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=t,o.arg=e,r?(this.method="next",this.next=r.finallyLoc,d):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return "break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),P(i),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var n=i.completion;if("throw"===n.type){var s=n.arg;P(i);}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,i){return this.delegate={iterator:O(t),resultName:e,nextLoc:i},"next"===this.method&&(this.arg=void 0),d}},t}function n(t){return n="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},n(t)}function s(t,e,i,n,s,r,o){try{var a=t[r](o),h=a.value;}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(n,s);}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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,O(n.key),n);}}function a(t,e,i){return e&&o(t.prototype,e),i&&o(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function h(t,e,i){return (e=O(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function l(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}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e);}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}function d(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return d(t)}function p(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return !1}}();return function(){var i,n=u(t);if(e){var s=u(this).constructor;i=Reflect.construct(n,arguments,s);}else i=n.apply(this,arguments);return f(this,i)}}function v(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var n=v(t,e);if(n){var s=Object.getOwnPropertyDescriptor(n,e);return s.get?s.get.call(arguments.length<3?t:i):s.value}},g.apply(this,arguments)}function y(t,e,i,n){return y="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,i,n){var s,r=v(t,e);if(r){if((s=Object.getOwnPropertyDescriptor(r,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 h(n,e,i);return !0},y(t,e,i,n)}function k(t,e,i,n,s){if(!y(t,e,i,n||t)&&s)throw new TypeError("failed to set property");return i}function m(t,e){return C(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,s,r,o,a=[],h=!0,l=!1;try{if(r=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;h=!1;}else for(;!(h=(n=r.call(i)).done)&&(a.push(n.value),a.length!==e);h=!0);}catch(t){l=!0,s=t;}finally{try{if(!h&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(l)throw s}}return a}}(t,e)||S(t,e)||T()}function b(t){return C(t)||w(t)||S(t)||T()}function x(t){return function(t){if(Array.isArray(t))return P(t)}(t)||w(t)||S(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 C(t){if(Array.isArray(t))return t}function w(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function S(t,e){if(t){if("string"==typeof t)return P(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return "Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?P(t,e):void 0}}function P(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 T(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function O(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return ("string"===e?String:Number)(t)}(t,"string");return "symbol"==typeof e?e:String(e)}var M=function(){function t(e){r(this,t),this.scene=e,this.displayList=e.sys.displayList,this.updateList=e.sys.updateList,e.events.once("destroy",this.destroy,this);}return a(t,[{key:"destroy",value:function(){this.scene=null,this.displayList=null,this.updateList=null;}}],[{key:"register",value:function(e,i){t.prototype[e]=i;}}]),t}(),E=function(t,e,i){return "__BASE"===i?"".concat(t,",").concat(e):"".concat(i,"_").concat(t,",").concat(e)},_=function t(e){var i,s,r;if(null==e||"object"!==n(e))return e;if(i=Array.isArray(e)?[]:{},function(t){if("object"!==n(t)||t.nodeType||t===t.window)return !1;try{if(t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(e))for(r in e)s=e[r],i[r]=t(s);else i=e;return i},R=Phaser.Utils.Objects.IsPlainObject,L=Phaser.Utils.Objects.GetValue,B=function(t){return "string"==typeof t&&(t=D[t]),t},D={scale:0,repeat:1},I=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},j=function(){},z={_beginDraw:j,_drawImage:j,_drawTileSprite:j,_endDraw:j,setGetFrameNameCallback:function(t){return void 0===t&&(t=E),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):(i=_(i),s=_(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var o=r.get(e),a=o.width,h=0,l=0,u=i.length;l<u;l++)void 0===i[l]?h++:"number"==typeof i[l]?a-=i[l]:a-=i[l].width;var c=a/h,d=o.height,f=0;for(l=0,u=s.length;l<u;l++)void 0===s[l]?f++:"number"==typeof s[l]?d-=s[l]:d-=s[l].width;for(var p,v,g,y,k,m=d/f,b=0,x=0,C=0,w=s.length;C<w;C++){void 0===s[C]&&(s[C]=m),"number"==typeof s[C]&&(s[C]={height:s[C],stretch:C%2}),g=(p=s[C]).height,this.rows.stretch+=0|p.stretch,this.rows.minHeight+=p.stretch>0?0:g,b=0;l=0;for(var S=i.length;l<S;l++){if(void 0===i[l]&&(i[l]=c),"number"==typeof i[l]&&(i[l]={width:i[l],stretch:l%2}),y=(v=i[l]).width,0===C&&(this.columns.stretch+=0|v.stretch,this.columns.minWidth+=v.stretch>0?0:y),y>=1&&g>=1){var P=n(k=this.getFrameNameCallback(l,C,e));"string"!==P&&"number"!==P||r.add(k,0,b+o.cutX,x+o.cutY,y,g);}b+=y;}x+=g;}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,n,s,r,o,a,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,f=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var p=Math.min(d,f);if(d>p){var v=(d-p)*h;u>=0?u+=v:u=v,d=p;}if(f>p){var g=(f-p)*l;c>=0?c+=g:c=g,f=p;}}this.columns.scale=d,this.rows.scale=f,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var y=0,k=0;this._beginDraw();for(var m=0,b=this.rows.count;m<b;m++){a=0===(r=this.rows.data[m]).stretch?r.height*f:i*r.stretch,y=0;for(var x=0,C=this.columns.count;x<C;x++)o=0===(s=this.columns.data[x]).stretch?s.width*d:e*s.stretch,n=this.getFrameNameCallback(x,m,this.baseFrameName),t.has(n)&&o>0&&a>0&&(0===(0===r.stretch&&0===s.stretch||0===this.getStretchMode(x,m)?0:1)?this._drawImage(this.textureKey,n,y,k,o,a):this._drawTileSprite(this.textureKey,n,y,k,o,a)),y+=o;k+=a;}this._endDraw();},setStretchMode:function(t){return R(t)?(this.stretchMode.edge=B(L(t,"edge",0)),this.stretchMode.internal=B(L(t,"internal",0))):(t=B(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return I.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}},A=Phaser.Utils.Objects.IsPlainObject,F=Phaser.Utils.Objects.GetValue,Y=function(t,e){var i=function(t){l(n,t);var i=p(n);function n(t,s,o,a,h,l,u,c,d,f){var p;if(r(this,n),A(s)?(s=F(f=s,"x",0),o=F(f,"y",0),a=F(f,"width",1),h=F(f,"height",1),l=F(f,"key",void 0),u=F(f,"baseFrame",void 0),c=F(f,"columns",void 0),d=F(f,"rows",void 0)):A(a)?(a=F(f=a,"width",1),h=F(f,"height",1),l=F(f,"key",void 0),u=F(f,"baseFrame",void 0),c=F(f,"columns",void 0),d=F(f,"rows",void 0)):A(l)?(l=F(f=l,"key",void 0),u=F(f,"baseFrame",void 0),c=F(f,"columns",void 0),d=F(f,"rows",void 0)):A(u)?(u=F(f=u,"baseFrame",void 0),c=F(f,"columns",void 0),d=F(f,"rows",void 0)):Array.isArray(u)?(f=d,d=c,c=u,u=F(f,"baseFrame",void 0)):A(c)&&(c=F(f=c,"columns",void 0),d=F(f,"rows",void 0)),void 0===c){var v=F(f,"leftWidth",void 0),g=F(f,"rightWidth",void 0);void 0!==v&&void 0!==g&&(c=[v,void 0,g]);}if(void 0===d){var y=F(f,"topHeight",void 0),k=F(f,"bottomHeight",void 0);void 0!==y&&void 0!==k&&(d=[y,void 0,k]);}(p=i.call(this,t)).type=e,p.setPosition(s,o).setSize(a,h).setOrigin(.5,.5),p.columns={},p.rows={},p.stretchMode={},p._tileSprite=void 0,p._image=void 0,p.setGetFrameNameCallback(F(f,"getFrameNameCallback",void 0)),p.setStretchMode(F(f,"stretchMode",0)),p.setPreserveRatio(F(f,"preserveRatio",!0));var m=F(f,"maxFixedPartScale",1),b=F(f,"maxFixedPartScaleX",m),x=F(f,"maxFixedPartScaleY",void 0);return p.setMaxFixedPartScale(b,x),p.setBaseTexture(l,u,c,d),p}return a(n,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(g(u(n.prototype),"resize",this)?g(u(n.prototype),"resize",this).call(this,t,e):g(u(n.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),n}(t);return Object.assign(i.prototype,z),i},W=Phaser.Game,V=function(t){return t instanceof W},X=Phaser.Scene,G=function(t){return t instanceof X},H=function(t){return null==t||"object"!==n(t)?null:V(t)?t:V(t.game)?t.game:G(t)?t.sys.game:G(t.scene)?t.scene.sys.game:void 0},U=Phaser.GameObjects,N=void 0,K=function(t,e){if(N||(N={},H(t).events.once("destroy",(function(){for(var t in N)N[t].destroy();N=void 0;}))),!N.hasOwnProperty(e)){var i=H(t).scene.systemScene;(t=new U[e](i)).setOrigin(0),N[e]=t;}return N[e]},J=function(t){l(i,t);var e=p(i);function i(){return r(this,i),e.apply(this,arguments)}return a(i)}(Y(Phaser.GameObjects.RenderTexture,"rexNinePatch")),Z={_drawImage:function(t,e,i,n,s,r){var o=K(this,"Image").setTexture(t,e).setDisplaySize(s,r);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,s,r){var o=K(this,"TileSprite").setTexture(t,e).setSize(s,r);this.draw(o,i,n);}};Object.assign(J.prototype,Z);var q=function(t){return null==t||""===t||0===t.length},$=function(t,e,i,s){if(void 0===s&&(s="."),"object"===n(t)){if(q(e)){if(null==i)return;"object"===n(i)&&(t=i);}else {"string"==typeof e&&(e=e.split(s));var r=e.pop(),o=function(t,e,i){var s=t;if(q(e));else {var r;"string"==typeof e&&(e=e.split("."));for(var o=0,a=e.length;o<a;o++){var h;null!=s[r=e[o]]&&"object"===n(s[r])||(h=o===a-1?void 0===i?{}:i:{},s[r]=h),s=s[r];}}return s}(t,e);o[r]=i;}return t}};M.register("ninePatch",(function(t,e,i,n,s,r,o,a){var h=new J(this.scene,t,e,i,n,s,r,o,a);return this.scene.add.existing(h),h})),$(window,"RexPlugins.UI.NinePatch",J);var Q=Phaser.GameObjects.GetCalcMatrix,tt=Phaser.Renderer.Canvas.SetTransform,et={renderWebGL:function(t,e,i,n){var s=e.getRenderList();if(0!==s.length){i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),o=e.frame.glTexture,a=r.setGameObject(e),h=i.roundPixels,l=Q(e,i,n),u=r.calcMatrix.copyFrom(l.calc),c=e._displayOriginX,d=e._displayOriginY,f=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var p=0,v=s.length;p<v;p++)s[p].webglRender(r,u,f,c,d,o,a,h);t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){var s=t.currentContext,r=e.getRenderList();if(0!==r.length&&tt(t,s,e,i,n)){i.addToRenderList(e);var o=i.roundPixels,a=-e._displayOriginX,h=-e._displayOriginY;s.translate(a,h);for(var l=0,u=r.length;l<u;l++)r[l].canvasRender(s,a,h,o);s.restore();}}},it=function(t,e){if(this.width===t&&this.height===e)return this;this.width=t,this.height=e,this.updateDisplayOrigin();var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this},nt=Phaser.Utils.Array.Remove,st=function(){return this.poolManager&&this.poolManager.freeMultiple(this.children.list),this.children.list.length=0,this.lastAppendedChildren.length=0,this.dirty=!0,this},rt={setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.frame=this.texture.get(e),this},resize:it,setSize:it,addChild:function(t){var e;(this.lastAppendedChildren.length=0,Array.isArray(t))?(this.children.add(t),(e=this.lastAppendedChildren).push.apply(e,x(t))):(this.children.add(t),this.lastAppendedChildren.push(t));return this},removeChild:function(t){return this.poolManager&&this.poolManager.free(t),nt(this.children.list,t),this.lastAppendedChildren.length=0,this.dirty=!0,this},removeChildren:st,clear:st,getLastAppendedChildren:function(){return this.lastAppendedChildren},getChildren:function(){return this.children.list}};Object.assign(rt,{setTint:function(t){return this.tint=t,this.tintFill=!1,this},setTintFill:function(t){return this.tint=t,this.tintFill=!0,this},clearTint:function(){return this.setTint(16777215),this}});var ot=function(){function t(){r(this,t),this.items=[];}return a(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0;}},{key:"pop",value:function(){return this.items.length>0?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}(),at=Phaser.Utils.Objects.GetValue,ht={},lt=function(){function t(e){r(this,t),this.pools=at(e,"pools",ht);}return a(t,[{key:"destroy",value:function(){this.pools=void 0;}},{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new ot),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;e<i;e++)this.free(t[e]);return this}},{key:"allocate",value:function(t){return this.pools&&this.pools.hasOwnProperty(t)?this.pools[t].pop():null}}]),t}(),ut=!1,ct=function(t){ut||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])<t&&console.error("Minimum supported version : 3.".concat(t)),ut=!0);};ct();var dt=Phaser.GameObjects.GameObject,ft=Phaser.Utils.Objects.IsPlainObject,pt=Phaser.Utils.Objects.GetValue,vt=Phaser.Structs.List,gt=Phaser.Utils.Array.StableSort,yt=function(t){l(i,t);var e=p(i);function i(t,n,s,o,a,h){var l;r(this,i),ft(n)&&(n=pt(h=n,"x",0),s=pt(h,"y",0),o=pt(h,"texture"),a=pt(h,"frame")),void 0===n&&(n=0),void 0===s&&(s=0),(l=e.call(this,t,"rexBlitter")).children=new vt,l.renderList=[],l.displayListDirty=!1,l.lastAppendedChildren=[];var u=pt(h,"reuseBob",!0);return l.poolManager=u?new lt(h):void 0,l.setTexture(o,a),l.setPosition(n,s),l.setOrigin(0,0),l.clearTint(),l.initPipeline(),l.initPostPipeline(),l}return a(i,[{key:"preDestroy",value:function(){this.removeChildren(),this.children.destroy(),this.renderList.length=0,this.poolManager&&this.poolManager.destroy();}},{key:"getRenderList",value:function(){if(this.displayListDirty){this.renderList.length=0;for(var t=!1,e=this.children.list,i=0,n=e.length;i<n;i++){var s=e[i];kt(s)&&(this.renderList.push(s),t||(t=0!==s.depth));}t&>(this.renderList,mt),this.displayListDirty=!1;}return this.renderList}}]),i}(dt),kt=function(t){return t.active&&t.visible&&t.alpha>0},mt=function(t,e){return t._depth-e._depth},bt=Phaser.GameObjects.Components;Phaser.Class.mixin(yt,[bt.Alpha,bt.BlendMode,bt.ComputedSize,bt.Depth,bt.GetBounds,bt.Mask,bt.Origin,bt.Pipeline,bt.PostPipeline,bt.ScrollFactor,bt.Transform,bt.Visible,et,rt]);var xt="image",Ct=function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1!==e.indexOf(".")){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}return i},wt=function(t){if("object"!==n(t)||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},St={enableData:function(){return void 0===this.data&&(this.data={}),this},setData:function(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t];}else this.data[t]=e;return this},getData:function(t,e){return this.enableData(),void 0===t?this.data:Ct(this.data,t,e)},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&&wt(this.data),this}},Pt=function(){function t(e,i){r(this,t),this.type=i,this.data=void 0,this.setParent(e).reset().setActive();}return a(t,[{key:"destroy",value:function(){this.parent&&this.parent.removeChild(this);}},{key:"setParent",value:function(t){return this.parent=t,this}},{key:"setDisplayListDirty",value:function(t){return t&&this.parent&&(this.parent.displayListDirty=!0),this}},{key:"active",get:function(){return this._active},set:function(t){this.setDisplayListDirty(this._active!=t),this._active=t;}},{key:"setActive",value:function(t){return void 0===t&&(t=!0),this.active=t,this}},{key:"modifyPorperties",value:function(t){return this}},{key:"reset",value:function(){this.clearData();}},{key:"onFree",value:function(){this.reset().setActive(!1).setParent();}}]),t}();
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/Object.assign(Pt.prototype,St);var Tt=Phaser.Math.DegToRad,Ot=Phaser.Math.RadToDeg,Mt=Phaser.Utils.Objects.GetValue,Et=function(t){l(i,t);var e=p(i);function i(){return r(this,i),e.apply(this,arguments)}return a(i,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDisplayListDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDisplayListDirty(!!this._alpha!=!!t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"setX",value:function(t){return this.x=t,this}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return Ot(this.rotation)},set:function(t){this.rotation=Tt(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return this._width},set:function(t){this._width=t;}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"height",get:function(){return this._height},set:function(t){this._height=t;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"displayWidth",get:function(){return this._width*this.scaleX},set:function(t){this.scaleX=t/this._width;}},{key:"setDisplayWidth",value:function(t,e){return void 0===e&&(e=!1),this.displayWidth=t,e&&(this.scaleY=this.scaleX),this}},{key:"displayHeight",get:function(){return this._height*this.scaleY},set:function(t){this.scaleY=t/this._height;}},{key:"setDisplayHeight",value:function(t,e){return void 0===e&&(e=!1),this.displayHeight=t,e&&(this.scaleX=this.scaleY),this}},{key:"setOriginX",value:function(t){return this.originX=t,this._displayOriginX=this.width*t,this}},{key:"setOriginY",value:function(t){return this.originY=t,this._displayOriginY=this.height*t,this}},{key:"setOrigin",value:function(t,e){return void 0===e&&(e=t),this.setOriginX(t).setOriginY(e),this}},{key:"depth",get:function(){return this._depth},set:function(t){this.setDisplayListDirty(this._depth!=t),this._depth=t;}},{key:"setDepth",value:function(t){return void 0===t&&(t=0),this.depth=t,this}},{key:"modifyPorperties",value:function(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Mt(t,"width",void 0),i=Mt(t,"height",void 0),n=Mt(t,"scale",void 0),s=Mt(t,"scaleX",n),r=Mt(t,"scaleY",n);void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s?this.setScaleX(s):t.hasOwnProperty("displayWidth")&&this.setDisplayWidth(t.displayWidth),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r?this.setScaleY(r):t.hasOwnProperty("displayHeight")&&this.setDisplayHeight(t.displayHeight);var o=Mt(t,"origin",void 0);return void 0!==o?this.setOrigin(o):(t.hasOwnProperty("originX")&&this.setOriginX(t.originX),t.hasOwnProperty("originY")&&this.setOriginY(t.originY)),t.hasOwnProperty("depth")&&this.setDepth(t.depth),this}},{key:"reset",value:function(){return g(u(i.prototype),"reset",this).call(this),this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setOrigin(0).setDepth(0),this}},{key:"webglRender",value:function(t,e,i,n,s,r,o,a){}},{key:"canvasRender",value:function(t,e,i,n){}}]),i}(Pt),_t=Phaser.GameObjects.Components.TransformMatrix,Rt=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha,Lt=new _t,Bt=Phaser.Utils.Objects.IsPlainObject,Dt=function(t){l(i,t);var e=p(i);function i(t,n){var s;return r(this,i),(s=e.call(this,t,xt)).setFrame(n),s}return a(i,[{key:"width",get:function(){return this._width},set:function(t){}},{key:"height",get:function(){return this._height},set:function(t){}},{key:"setFrame",value:function(t){return arguments.length>0&&!Bt(t)&&(t=this.parent.texture.get(t)),this.frame=t,this._width=t?t.width:0,this._height=t?t.height:0,this}},{key:"setFlipX",value:function(t){return void 0===t&&(t=!0),this.flipX=t,this}},{key:"setFlipY",value:function(t){return void 0===t&&(t=!0),this.flipY=t,this}},{key:"resetFlip",value:function(){return this.flipX=!1,this.flipY=!1,this}},{key:"tint",get:function(){return void 0===this._tint?this.parent.tint:this._tint},set:function(t){this._tint=t;}},{key:"setTint",value:function(t){return this.tint=t,this.tintFill=!1,this}},{key:"setTintFill",value:function(t){return this.tint=t,this.tintFill=!0,this}},{key:"clearTint",value:function(){return this.setTint(16777215),this}},{key:"resetTint",value:function(){return this.tint=void 0,this.tintFill=void 0,this}},{key:"tintFill",get:function(){return void 0===this._tintFill?this.parent.tintFill:this._tintFill},set:function(t){this._tintFill=t;}},{key:"reset",value:function(){return g(u(i.prototype),"reset",this).call(this),this.resetFlip().resetTint().setFrame(),this}},{key:"modifyPorperties",value:function(t){return t?(t.hasOwnProperty("width")&&(t.displayWidth=t.width,delete t.width),t.hasOwnProperty("height")&&(t.displayHeight=t.height,delete t.height),t.hasOwnProperty("frame")&&this.setFrame(t.frame),g(u(i.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("flipX")&&this.setFlipX(t.flipX),t.hasOwnProperty("flipY")&&this.setFlipY(t.flipY),t.hasOwnProperty("tint")&&this.setTint(t.tint),t.hasOwnProperty("tintFill")&&this.setTintFill(t.tintFill),this):this}}]),i}(Et),It={webglRender:function(t,e,i,n,s,r,o,a){var h=this._width,l=this._height,u=h*this.originX,c=l*this.originY,d=this.x-n,f=this.y-s,p=1,v=1;this.flipX&&(d+=h-2*u,p=-1),this.flipY&&(f+=l-2*c,v=-1),Lt.applyITRS(d,f,this.rotation,this.scaleX*p,this.scaleY*v),e.multiply(Lt,Lt);var g=-u,y=-c,k=g+h,m=y+l,b=Lt.setQuad(g,y,k,m,a),x=this.frame.u0,C=this.frame.v0,w=this.frame.u1,S=this.frame.v1,P=Rt(this.tint,this.alpha*i);t.batchQuad(this.parent,b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],x,C,w,S,P,P,P,P,this.tintFill,r,o);},canvasRender:function(t,e,i,n){t.save();var s=this._width,r=this._height,o=s*this.originX,a=r*this.originY,h=this.x-o,l=this.y-a,u=1,c=1;this.flipX&&(h+=s,u=-1),this.flipY&&(l+=r,c=-1),n&&(h=Math.round(h),l=Math.round(l)),t.translate(h,l),t.rotate(this.rotation),t.scale(this.scaleX*u,this.scaleY*c);var d=this.frame;t.drawImage(d.source.image,d.cutX,d.cutY,s,r,0,0,s,r),t.restore();}};Object.assign(Dt.prototype,It);var jt=function(t,e){"string"==typeof e&&(e={frame:e});var i=t.poolManager?t.poolManager.allocate(xt):null;return null===i?i=new Dt(t):i.setParent(t).setActive(),i.modifyPorperties(e),t.addChild(i),i},zt={_drawImage:function(t,e,i,n,s,r){jt(this,{frame:e,x:i,y:n,width:s,height:r});},_drawTileSprite:function(t,e,i,n,s,r){var o=this.texture.get(e),a=o.width,h=o.height,l=Math.floor(s/a),u=Math.floor(r/h);i+=(s-l*a)/2,n+=(r-u*h)/2;for(var c=0;c<l;c++)for(var d=0;d<u;d++)jt(this,{frame:e,x:i+c*a,y:n+d*h});}},At=function(t){l(i,t);var e=p(i);function i(){return r(this,i),e.apply(this,arguments)}return a(i,[{key:"setBaseTexture",value:function(t,e,n,s){return this.setTexture(t,e),g(u(i.prototype),"setBaseTexture",this).call(this,t,e,n,s),this}}]),i}(Y(yt,"rexNinePatch2"));Object.assign(At.prototype,zt),M.register("ninePatch2",(function(t,e,i,n,s,r,o,a){var h=new At(this.scene,t,e,i,n,s,r,o,a);return this.scene.add.existing(h),h})),$(window,"RexPlugins.UI.NinePatch2",At);var Ft=Phaser.Utils.Objects.GetValue,Yt=function(){function t(e,i,n,s,o){r(this,t),void 0===e&&(e=0),void 0===i&&(i=e),void 0===n&&(n=0),void 0===s&&(s=0),void 0===o&&(o=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(e,i,n,s,o);}return a(t,[{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 this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,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)},set:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ft(t,"x",0),i=Ft(t,"y",0));var n=this.cornerRadius;n.tl=Wt(Ft(t,"tl",void 0),e,i),n.tr=Wt(Ft(t,"tr",void 0),e,i),n.bl=Wt(Ft(t,"bl",void 0),e,i),n.br=Wt(Ft(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){Vt(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){Vt(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){Vt(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){Vt(this.cornerRadius.br,t);}}]),t}(),Wt=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xt(t),t},Vt=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ft(e,"x",0),t.y=Ft(e,"y",0)),Xt(t);},Xt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},Gt=function(t,e,i){var n=i.length;if(n>=2){var s=i[n-2],r=i[n-1];if(t===s&&e===r)return i}return i.push(t,e),i},Ht=Phaser.Math.DegToRad,Ut=function(t,e,i,n,s,r,o,a,h){o&&r>s?r-=360:!o&&r<s&&(r+=360);var l=Ht(r-s)/a;s=Ht(s);for(var u=0;u<=a;u++){var c=s+l*u,d=t+i*Math.cos(c),f=e+n*Math.sin(c);Gt(d,f,h);}return h},Nt=Phaser.Renderer.WebGL.Utils,Kt=function(t,e,i,n,s,r){for(var o=Nt.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*n),a=i.pathData,h=i.pathIndexes,l=0;l<h.length;l+=3){var u=2*h[l],c=2*h[l+1],d=2*h[l+2],f=a[u+0]-s,p=a[u+1]-r,v=a[c+0]-s,g=a[c+1]-r,y=a[d+0]-s,k=a[d+1]-r,m=e.getX(f,p),b=e.getY(f,p),x=e.getX(v,g),C=e.getY(v,g),w=e.getX(y,k),S=e.getY(y,k);t.batchTri(i,m,b,x,C,w,S,0,0,1,1,o,o,o,2);}},Jt=Phaser.Renderer.WebGL.Utils,Zt=function(t,e,i,n,s){var r=t.strokeTint,o=Jt.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*i);r.TL=o,r.TR=o,r.BL=o,r.BR=o;var a=e.pathData,h=a.length-1,l=e.lineWidth,u=l/2,c=a[0]-n,d=a[1]-s;e.closePath||(h-=2);for(var f=2;f<h;f+=2){var p=a[f]-n,v=a[f+1]-s;t.batchLine(c,d,p,v,u,u,l,f-2,!!e.closePath&&f===h-1),c=p,d=v;}},qt=Phaser.GameObjects.GetCalcMatrix,$t=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+")";},Qt=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;},te=Phaser.Renderer.Canvas.SetTransform,ee={renderWebGL:function(t,e,i,n){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var s=t.pipelines.set(e.pipeline),r=qt(e,i,n),o=s.calcMatrix.copyFrom(r.calc),a=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Kt(s,o,e,l,a,h),e.isStroked&&Zt(s,e,l,a,h),t.pipelines.postBatch(e);},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var s=t.currentContext;if(te(t,s,e,i,n)){var r=e._displayOriginX,o=e._displayOriginY,a=e.pathData,h=a.length-1,l=a[0]-r,u=a[1]-o;s.beginPath(),s.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c<h;c+=2){var d=a[c]-r,f=a[c+1]-o;s.lineTo(d,f);}s.closePath(),e.isFilled&&($t(s,e),s.fill()),e.isStroked&&(Qt(s,e),s.stroke()),s.restore();}}},ie=Phaser.GameObjects.Shape,ne=Phaser.Utils.Objects.IsPlainObject,se=Phaser.Utils.Objects.GetValue,re=Phaser.Geom.Polygon.Earcut,oe=function(t){l(i,t);var e=p(i);function i(t,n,s,o,a,h,l,u){var c,d,f,p,v;if(r(this,i),ne(n)){var g=n;n=g.x,s=g.y,o=g.width,a=g.height,h=g.radius,l=g.color,u=g.alpha,d=g.strokeColor,f=g.strokeAlpha,p=g.strokeWidth,v=g.shape;}void 0===n&&(n=0),void 0===s&&(s=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===h&&(h=0),void 0===v&&(v=0);var y=new Yt;if((c=e.call(this,t,"rexRoundRectangleShape",y)).setShapeType(v),0===c.shapeType){var k=se(h,"radius",h);y.setTo(0,0,o,a,k);}else {k={x:o/2,y:a/2};y.setTo(0,0,o,a,k);}var m=se(h,"iteration",void 0);return c.setIteration(m),c.setPosition(n,s),c.setFillStyle(l,u),void 0!==d&&void 0===p&&(p=2),c.setStrokeStyle(p,d,f),c.updateDisplayOrigin(),c.dirty=!0,c}return a(i,[{key:"fillColor",get:function(){return this._fillColor},set:function(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,s=t.height,r=t.cornerRadius,o=this.iteration+1;if(i=r.tl,ae(i))if(i.convex){var a=i.x,h=i.y;Ut(a,h,i.x,i.y,180,270,!1,o,e);}else {Ut(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else Gt(0,0,e);if(i=r.tr,ae(i))if(i.convex){a=n-i.x,h=i.y;Ut(a,h,i.x,i.y,270,360,!1,o,e);}else {Ut(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else Gt(n,0,e);if(i=r.br,ae(i))if(i.convex){a=n-i.x,h=s-i.y;Ut(a,h,i.x,i.y,0,90,!1,o,e);}else {Ut(a=n,h=s,i.x,i.y,270,180,!0,o,e);}else Gt(n,s,e);if(i=r.bl,ae(i))if(i.convex){a=i.x,h=s-i.y;Ut(a,h,i.x,i.y,90,180,!1,o,e);}else {Ut(a=0,h=s,i.x,i.y,360,270,!0,o,e);}else Gt(0,s,e);return e.push(e[0],e[1]),this.pathIndexes=re(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=he[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),i}(ie),ae=function(t){return t.x>0&&t.y>0},he={rectangle:0,circle:1};Object.assign(oe.prototype,ee),M.register("roundRectangle",(function(t,e,i,n,s,r,o){var a=new oe(this.scene,t,e,i,n,s,r,o);return this.scene.add.existing(a),a})),$(window,"RexPlugins.UI.RoundRectangle",oe);var le=Phaser.Renderer.WebGL.Utils,ue={renderWebGL:function(t,e,i,n){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var s=e.frame,r=s.width,o=s.height,a=le.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(s.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,s.glTexture,r,o,e.x,e.y,r/e.resolution,o/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,r,o,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},ce=Phaser.Display.Color,de={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},drawFrame:function(t,e,i,n,s,r,o,a,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=c),void 0===r&&(r=d),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=c),void 0===l&&(l=d);var f=u.cutX+o,p=u.cutY+a;return this.context.drawImage(u.source.image,f,p,h,l,i,n,s,r),this.dirty=!0,this},getDataURL:function(t,e){return this.canvas.toDataURL(t,e)},getPixel:function(t,e,i){void 0===i&&(i=new ce);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}},fe=function(t,e,i,n,s,r,o){var a,h=t.sys.textures,l=t.renderer;void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=e.width),void 0===o&&(o=e.height);var u=(a=h.exists(i)?h.get(i):h.createCanvas(i,r,o)).getSourceImage();u.width!==r&&(u.width=r),u.height!==o&&(u.height=o);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,r,o),c.drawImage(e,n,s,r,o),l.gl&&a&&l.canvasToTexture(u,a.source[0].glTexture,!0,0);},pe={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&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!1;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=this.width,i.hitArea.height=this.height),this},generateTexture:function(t,e,i,n,s){var r=this.canvas;return void 0===n?n=r.width:n*=this.resolution,void 0===s?s=r.height:s*=this.resolution,fe(this.scene,r,t,e,i,n,s),this},loadTexture:function(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};ct();var ve=Phaser.Display.Canvas.CanvasPool,ge=function(t){l(i,t);var e=p(i);function i(t,n,s,o,a){var h;return r(this,i),void 0===n&&(n=0),void 0===s&&(s=0),void 0===o&&(o=1),void 0===a&&(a=1),(h=e.call(this,t,"rexCanvas")).renderer=t.sys.game.renderer,h.resolution=1,h._width=o,h._height=a,o=Math.max(Math.ceil(o*h.resolution),1),a=Math.max(Math.ceil(a*h.resolution),1),h.canvas=ve.create(d(h),o,a),h.context=h.canvas.getContext("2d",{willReadFrequently:!0}),h.dirty=!1,h.setPosition(n,s),h.setOrigin(.5,.5),h.initPipeline(),h.initPostPipeline(!0),h._crop=h.resetCropObject(),h.texture=t.sys.textures.addCanvas(null,h.canvas,!0),h.frame=h.texture.get(),h.frame.source.resolution=h.resolution,h.renderer&&h.renderer.gl&&(h.renderer.deleteTexture(h.frame.source.glTexture),h.frame.source.glTexture=null),h.dirty=!0,h}return a(i,[{key:"preDestroy",value:function(){ve.remove(this.canvas),this.texture.destroy(),this.canvas=null,this.context=null;}},{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height);}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t);}},{key:"setCanvasSize",value:function(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}},{key:"setSize",value:function(t,e){return this.setCanvasSize(t,e),this}},{key:"displayWidth",get:function(){return this.scaleX*this._width},set:function(t){this.scaleX=t/this._width;}},{key:"displayHeight",get:function(){return this.scaleY*this._height},set:function(t){this.scaleY=t/this._height;}},{key:"setDisplaySize",value:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}},{key:"getCanvas",value:function(t){return t||(this.dirty=!0),this.canvas}},{key:"getContext",value:function(t){return t||(this.dirty=!0),this.context}},{key:"needRedraw",value:function(){return this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}}]),i}(Phaser.GameObjects.GameObject),ye=Phaser.GameObjects.Components;Phaser.Class.mixin(ge,[ye.Alpha,ye.BlendMode,ye.Crop,ye.Depth,ye.Flip,ye.GetBounds,ye.Mask,ye.Origin,ye.Pipeline,ye.PostPipeline,ye.ScrollFactor,ye.Tint,ye.Transform,ye.Visible,ue,de,pe]);var ke=Phaser.Utils.String.Pad,me=function(t,e,i){if(null==t)return t;switch(n(t)){case"string":default:return t;case"number":return "#".concat(ke(Math.floor(t).toString(16),6,"0",1));case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?"rgba(".concat(t.r,",").concat(t.g,",").concat(t.b,",").concat(t.a,")"):"rgb(".concat(t.r,",").concat(t.g,",").concat(t.b,")"):t.hasOwnProperty("h")?t.hasOwnProperty("a")?"hsla(".concat(t.h,",").concat(t.s,",").concat(t.l,",").concat(t.a,")"):"hsl(".concat(t.h,",").concat(t.s,",").concat(t.l,")"):t}},be=Phaser.Math.DegToRad,xe=fun