text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).rexbuttons=e()}(this,function(){"use strict";function u(t){return(u="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 c(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 t(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}function e(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 l(t){return(l=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 a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function s(s){var o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e,i,n=l(s);if(o){var r=l(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return e=this,!(i=t)||"object"!=typeof i&&"function"!=typeof i?a(e):i}}function d(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}function f(t,e,i){return(f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=d(t,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(i):r.value}})(t,e,i||t)}function o(t,e,i,n){return(o="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,i,n){var r,s,o,h,a=d(t,e);if(a){if((r=Object.getOwnPropertyDescriptor(a,e)).set)return r.set.call(n,i),!0;if(!r.writable)return!1}if(r=Object.getOwnPropertyDescriptor(n,e)){if(!r.writable)return!1;r.value=i,Object.defineProperty(n,e,r)}else h=i,(o=e)in(s=n)?Object.defineProperty(s,o,{value:h,enumerable:!0,configurable:!0,writable:!0}):s[o]=h;return!0})(t,e,i,n)}function r(t,e,i,n,r){if(!o(t,e,i,n||t)&&r)throw new Error("failed to set property");return i}function h(t){return function(t){if(Array.isArray(t))return p(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 p(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(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return p(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 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}var v=Phaser.GameObjects.Zone,y=Phaser.Utils.Array.Add,g=Phaser.Utils.Array.Remove,m=function(){e(h,v);var o=s(h);function h(t,e,i,n,r){var s;return c(this,h),Array.isArray(n)&&(children=n,n=void 0),void 0===n&&(n=1),void 0===r&&(r=1),(s=o.call(this,t,e,i,n,r)).children=[],s}return t(h,[{key:"destroy",value:function(t){this.scene&&(this.clear(!t),f(l(h.prototype),"destroy",this).call(this,t))}},{key:"contains",value:function(t){return-1!==this.children.indexOf(t)}},{key:"add",value:function(t){return y(this.children,t,0,function(t){t.on("destroy",this.remove,this)},this),this}},{key:"remove",value:function(t,e){return g(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}}]),h}(),b=Phaser.GameObjects.Components;Phaser.Class.mixin(m,[b.Alpha,b.Flip]);function k(t){var e;return t.hasOwnProperty("rexContainer")&&(e=t.rexContainer.parent),e}function C(t){return this.setParent(t),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),x.call(this,t),this}function S(t,e){return t===e?1:t/e}function O(t){return"[object Array]"===Object.prototype.toString.call(t)}var P={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),k(t)},getTopmostParent:function(t){return void 0===t&&(t=this),function(t){for(var e=k(t);e;)e=k(t=e);return t}(t)}},x=m.prototype.add,E={add:function(t){return Array.isArray(t)?this.addMultiple(t):C.call(this,t),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)C.call(this,t[e]);return this}},_=m.prototype.remove,w=m.prototype.clear,j={remove:function(t,e){return this.getParent(t)!==this||(this.setParent(t,null),_.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 w.call(this,t),this}},z=Phaser.Math.RotateAround,X={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,z(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,z(t,0,0,this.rotation),t.x+=this.x,t.y+=this.y,t}},Y={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=S(t.scaleX,this.scaleX),e.scaleY=S(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}},M={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}},A={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=S(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}},T={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}},R={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}},F=Phaser.Utils.Array,L={getChildren:function(){return this.children},getAllChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n<r;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,r=[this];r.length;)for(var s=0,o=(i=r.shift()).children.length;s<o;s++){if((n=i.children[s]).name===t)return n;n.isRexContainerLite&&r.push(n)}return null}return F.GetFirst(this.children,"name",t)},getRandom:function(t,e){return F.GetRandom(this.children,t,e)},getFirst:function(t,e,i,n){return F.GetFirstElement(this.children,t,e,i,n)},getAll:function(t,e,i,n){return F.GetAll(this.children,t,e,i,n)},count:function(t,e,i,n){return F.CountAllMatching(this.children,t,e,i,n)},swap:function(t,e){return F.Swap(this.children,t,e),this},moveTo:function(t,e){return F.MoveTo(this.children,t,e),this},setAll:function(t,e,i,n){return F.SetAll(this.children,t,e,i,n),this}},D={tweenChild:function(t){var e=t.targets;O(e)||(e=[e]);for(var i,n,r=[],s=0,o=e.length;s<o;s++)(n=e[s]).hasOwnProperty("rexContainer")&&(i=n.scene,r.push(n.rexContainer));if(i){t.targets=r;var h=i.tweens.add(t);return h.on("update",function(t,e,i){for(var n,r,s=0,o=i.length;s<o;s++)switch(n=i.parent,r=i.self,e){case"x":case"y":case"angle":case"rotation":case"scaleX":case"scaleY":case"flipX":case"flipY":n.updateChildPosition(r);break;case"alpha":n.updateChildAlpha(r)}}),h}},tween:function(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}},B={};Object.assign(B,P,E,j,{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}},X,Y,M,A,T,{updateChildScrollFactor:function(t){return t.setScrollFactor(this.scrollFactorX,this.scrollFactorY),this},syncScrollFactor:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},R,{setDepth:function(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),n=0,r=i.length;n<r;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}},L,D);var N=function(){e(a,m);var h=s(a);function a(t,e,i,n,r,s){var o;return c(this,a),(o=h.call(this,t,e,i,n,r)).type="rexContainerLite",o.isRexContainerLite=!0,o.syncChildrenEnable=!0,o._active=!0,o._mask=null,o._scrollFactorX=1,o._scrollFactorY=1,s&&o.add(s),o}return t(a,[{key:"destroy",value:function(t){this.scene&&(this.syncChildrenEnable=!1,f(l(a.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 f(l(a.prototype),"rotation",this)},set:function(t){this.rotation!==t&&(r(l(a.prototype),"rotation",t,this,!0),this.syncPosition())}},{key:"scaleX",get:function(){return f(l(a.prototype),"scaleX",this)},set:function(t){this.scaleX!==t&&(r(l(a.prototype),"scaleX",t,this,!0),this.syncPosition())}},{key:"scaleY",get:function(){return f(l(a.prototype),"scaleY",this)},set:function(t){this.scaleY!==t&&(r(l(a.prototype),"scaleY",t,this,!0),this.syncPosition())}},{key:"flipX",get:function(){return f(l(a.prototype),"flipX",this)},set:function(t){f(l(a.prototype),"flipX",this)!==t&&(r(l(a.prototype),"flipX",t,this,!0),this.syncPosition())}},{key:"flipY",get:function(){return f(l(a.prototype),"flipY",this)},set:function(t){f(l(a.prototype),"flipY",this)!==t&&(r(l(a.prototype),"flipY",t,this,!0),this.syncPosition())}},{key:"visible",get:function(){return f(l(a.prototype),"visible",this)},set:function(t){f(l(a.prototype),"visible",this)!==t&&(r(l(a.prototype),"visible",t,this,!0),this.syncVisible())}},{key:"alpha",get:function(){return f(l(a.prototype),"alpha",this)},set:function(t){f(l(a.prototype),"alpha",this)!==t&&(r(l(a.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}}]),a}();Object.assign(N.prototype,B);function G(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer}function H(){}var U,V=Phaser.Display.Align,W={center:V.CENTER,left:V.LEFT_CENTER,right:V.RIGHT_CENTER,top:V.TOP_CENTER,bottom:V.BOTTOM_CENTER,"left-top":V.TOP_LEFT,"left-center":V.LEFT_CENTER,"left-bottom":V.BOTTOM_LEFT,"center-top":V.TOP_CENTER,"center-center":V.CENTER,"center-bottom":V.BOTTOM_CENTER,"right-top":V.TOP_RIGHT,"right-center":V.RIGHT_CENTER,"right-bottom":V.BOTTOM_RIGHT},I=new Phaser.GameObjects.Zone({sys:{queueDepthSort:H,events:{once:H}}},0,0,1,1);I.setOrigin(0);function J(t){return void 0!==t.displayWidth?t.displayWidth:t.width}function Z(t){return void 0!==t.displayHeight?t.displayHeight:t.height}function q(t){var e=Z(t);return t.y+e-e*t.originY}function $(t){var e=J(t);return t.x-e*t.originX+.5*e}function K(t,e){var i=Z(t);return t.y=e-i+i*t.originY,t}function Q(t,e){var i=J(t),n=i*t.originX;return t.x=e+n-.5*i,t}function tt(t){var e=J(t);return t.x-e*t.originX}function et(t,e){var i=J(t);return t.x=e+i*t.originX,t}function it(t){var e=J(t);return t.x+e-e*t.originX}function nt(t,e){var i=J(t);return t.x=e-i+i*t.originX,t}function rt(t,e){var i=Z(t),n=i*t.originY;return t.y=e+n-.5*i,t}function st(t){var e=Z(t);return t.y-e*t.originY+.5*e}function ot(t){var e=Z(t);return t.y-e*t.originY}function ht(t,e){var i=Z(t);return t.y=e+i*t.originY,t}var at=0,ut=1,ct=2,lt=4,dt=6,ft=8,pt=10,vt=12,yt=[];yt[11]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),Q(t,$(e)+i),K(t,q(e)+n),t},yt[pt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),et(t,tt(e)-i),K(t,q(e)+n),t},yt[vt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),nt(t,it(e)+i),K(t,q(e)+n),t},yt[dt]=function(t,e,i,n){var r,s,o;return void 0===i&&(i=0),void 0===n&&(n=0),r=t,s=$(e)+i,o=st(e)+n,Q(r,s),rt(r,o),t},yt[lt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),et(t,tt(e)-i),rt(t,st(e)+n),t},yt[ft]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),nt(t,it(e)+i),rt(t,st(e)+n),t},yt[ut]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),Q(t,$(e)+i),ht(t,ot(e)-n),t},yt[at]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),et(t,tt(e)-i),ht(t,ot(e)-n),t},yt[ct]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),nt(t,it(e)+i),ht(t,ot(e)-n),t};function gt(t,e,i,n,r){return yt[i](t,e,n,r)}function mt(t,e){return void 0===e&&(e={}),"number"==typeof t?(e.left=t,e.right=t,e.top=t,e.bottom=t):(e.left=_t(t,"left",0),e.right=_t(t,"right",0),e.top=_t(t,"top",0),e.bottom=_t(t,"bottom",0)),e}function bt(t,e){return void 0===this.childrenMap&&(this.childrenMap={}),this.childrenMap[t]=e,this}function kt(){this._childrenWidth=void 0,this._childrenHeight=void 0}function Ct(t){return t instanceof Tt}function St(t){return Ct(t)?t:t.scene&&Ct(t.scene)?t.scene:t.parent&&t.parent.scene&&Ct(t.parent.scene)?t.parent.scene:void 0}var Ot=Phaser.Utils.Objects.GetValue,Pt=Phaser.GameObjects.Group,xt=function(t){return t.add.text(0,0,"")},Et=new Phaser.Geom.Rectangle,_t=Phaser.Utils.Objects.GetValue,wt=N.prototype.add,jt={pin:function(t){return wt.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=mt(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground:function(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},zt=/(\S+)\[(\d+)\]/i,Xt=Phaser.Geom.Rectangle,Yt=new Xt,Mt=function(){function i(t,e){c(this,i),this.gameObject=t,this.scene=t.scene,this.resetFromJSON(e),this.boot()}return t(i,[{key:"resetFromJSON",value:function(t){var e,i,n,r,s,o,h,a;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,r=t.y):void 0!==t.top?(n=0,r=t.top):void 0!==t.bottom?(n=1,r=t.bottom):void 0!==t.centerY&&(n=.5,r=t.centerY),void 0!==i&&(i=i.replace("left","0%").replace("right","100%").replace("center","50%").split("%"),s=parseFloat(i[0])/100,o=""===i[1]?0:parseFloat(i[1])),void 0!==r&&(r=r.replace("top","0%").replace("bottom","100%").replace("center","50%").split("%"),h=parseFloat(r[0])/100,a=""===r[1]?0:parseFloat(r[1])),this.setAlign(e,n),this.setPercentage(s,h),this.setOffset(o,a),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=function(t,e){void 0===e?e=new Xt:!0===e&&(e=Yt);var i=t.scale,n=i.canvasBounds,r=i.displayScale,s=i.autoCenter;return e.x=0<=n.x?0:-(n.x*r.x),e.y=0<=n.y?0:-(n.y*r.y),e.width=n.width*r.x-e.x,e.height=n.height*r.y-e.y,1!==s&&2!==s||(e.width-=e.x),1!==s&&3!==s||(e.height-=e.y),e}(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}(),At={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):[]}},Tt=Phaser.Scene,Rt=Phaser.GameObjects.GameObject,Ft=Phaser.Utils.Objects.GetValue,Lt=function(){function n(t,e){c(this,n),this.parent=t,this.scene=St(t);var i=Ft(e,"eventEmitter",!1);!0===i&&(i=void 0),this.setEventEmitter(i),this.boot()}return t(n,[{key:"boot",value:function(){this.parent instanceof Rt?this.parent.once&&this.parent.on("destroy",this.destroy,this):Ct(this.parent)&&this.parent.events.once("shutdown",this.destroy,this)}},{key:"shutdown",value:function(){return this.stop(),Ct(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(Lt.prototype,At);function Dt(t){return i=t,n="complete",new Promise(function(t,e){i.once(n,function(){t()})});var i,n}function Bt(t,e,i,n,r){return!(!t||!t.getBounds)&&(!(n&&!n(t,e,i))&&(!!(fe=t.getBounds(fe)).contains(e,i)&&!(r&&!r(t,e,i))))}function Nt(t,e,i,n,r){return Bt(t,e,i,pe(n),ve(r))}function Gt(t){return!(t.rexSizer&&t.rexSizer.hidden)}function Ht(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 Ut=Phaser.Utils.Objects.GetValue,Vt=Phaser.Utils.Objects.GetAdvancedValue,Wt=function(){e(r,Lt);var n=s(r);function r(t,e){var i;return c(this,r),(i=n.call(this,t)).gameObject=t,i.scaleStart={},i.scaleEnd={},i.resetFromJSON(e),i}return t(r,[{key:"resetFromJSON",value:function(t){return this.setMode(Ut(t,"mode",0)),this.setScaleRange(Vt(t,"start",void 0),Vt(t,"end",0)),this.setDelay(Vt(t,"delay",0)),this.setDuration(Vt(t,"duration",1e3)),this.setEase(Ut(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=It[t]),this.mode=t,this}},{key:"setScaleRange",value:function(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Vt(t,"x",this.gameObject.scaleX),this.startY=Vt(t,"y",this.gameObject.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Vt(e,"x",void 0),this.endY=Vt(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}),f(l(r.prototype),"start",this).call(this,t),this}},{key:"complete",value:function(){return f(l(r.prototype),"complete",this).call(this),1===this.mode&&this.gameObject.destroy(),this}}]),r}(),It={stop:0,destroy:1,yoyo:2},Jt={},Zt=Phaser.Utils.Objects.IsPlainObject,qt={popUp:function(t,e,i){if(Zt(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease}this._scale=function(t,e,i,n,r){switch(i){case Jt.mode=0:case"x":Jt.start={x:0};break;case 1:case"y":Jt.start={y:0};break;default:Jt.start=0}return Jt.end=1,Jt.duration=e,Jt.ease=void 0===n?"Cubic":n,void 0===r?r=new Wt(t,Jt):r.resetFromJSON(Jt),r.restart(),r}(this,t,e,i,this._scale),this._scale.once("complete",function(){this.emit("popup.complete",this)},this);var r=this.getParentSizer();if(r){var s=this;this._scale.on("update",function(){r.resetChildPositionState(s)})}return this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),Dt(this._scale)},scaleDownDestroy:function(t,e,i,n){if(Zt(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy}this._scale=function(t,e,i,n,r,s){r instanceof Wt&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?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===s?s=new Wt(t,o):s.resetFromJSON(o),s.restart(),s}(this,t,e,i,n,this._scale),this._scale.once("complete",function(){this.emit("scaledown.complete",this)},this);var s=this.getParentSizer();if(s){var o=this;this._scale.on("update",function(){s.resetChildPositionState(o)})}return this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),Dt(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),Dt(this._scale)}},$t=Phaser.Utils.Objects.GetValue,Kt=Phaser.Utils.Objects.GetAdvancedValue,Qt=function(){e(r,Lt);var n=s(r);function r(t,e){var i;return c(this,r),(i=n.call(this,t)).gameObject=t,i.alphaStart=void 0,i.alphaEnd=void 0,i.resetFromJSON(e),i}return t(r,[{key:"resetFromJSON",value:function(t){return this.setMode($t(t,"mode",0)),this.setAlphaRange(Kt(t,"start",this.gameObject.alpha),Kt(t,"end",0)),this.setDelay(Kt(t,"delay",0)),this.setDuration(Kt(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 f(l(r.prototype),"shutdown",this).call(this),this.gameObject=void 0,this}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=te[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||f(l(r.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 f(l(r.prototype),"complete",this).call(this),1===this.mode&&this.gameObject.destroy(),this}}]),r}(),te={stop:0,destroy:1,yoyo:2},ee=Phaser.Utils.Objects.IsPlainObject,ie={},ne={},re=Phaser.Utils.Objects.IsPlainObject,se={fadeIn:function(t,e){var i,n,r,s,o,h;re(t)&&(t=t.duration);this._fade=(n=t,r=e,s=(i=this)._fade,h=ee(r)?(o=r.start,r.end):r,void 0===o&&(o=0),void 0===h&&(h=i.alpha),ie.mode=0,ie.start=o,ie.end=h,ie.duration=n,void 0===s?s=new Qt(i,ie):s.resetFromJSON(ie),s.restart(),s),this._fade.once("complete",function(){this.emit("fadein.complete",this)},this);var a=this.getParentSizer();if(a){var u=this;this._fade.on("update",function(){a.resetChildAlphaState(u)})}return this},fadeInPromoise:function(t,e){return this.fadeIn(t,e),Dt(this._fade)},fadeOutDestroy:function(t,e){if(re(t)){var i=t;t=i.duration,e=i.destroy}var n,r,s,o;this._fade=(r=t,s=e,o=(n=this)._fade,s instanceof Qt&&(o=s,s=void 0),void 0===s&&(s=!0),ne.mode=s?1:0,ne.end=0,ne.duration=r,void 0===o?o=new Qt(n,ne):o.resetFromJSON(ne),o.restart(),o),this._fade.once("complete",function(){this.emit("fadeout.complete",this)},this);var h=this.getParentSizer();if(h){var a=this;this._fade.on("update",function(){h.resetChildAlphaState(a)})}return this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),Dt(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Dt(this._fade)}},oe=Phaser.Utils.Objects.GetValue,he=Phaser.Utils.Objects.GetAdvancedValue,ae=function(){e(r,Lt);var n=s(r);function r(t,e){var i;return c(this,r),(i=n.call(this,t)).gameObject=t,i.resetFromJSON(e),i}return t(r,[{key:"resetFromJSON",value:function(t){if(this.setMode(oe(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=he(t,"x",void 0),i=he(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this.setDelay(he(t,"delay",0)),this.setDuration(he(t,"duration",1e3)),this.setEase(oe(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=ue[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=he(i,"startX",void 0),this.startY=he(i,"startY",void 0),this.endX=he(i,"endX",void 0),this.endY=he(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}),f(l(r.prototype),"start",this).call(this,t),this}},{key:"complete",value:function(){return f(l(r.prototype),"complete",this).call(this),1===this.mode&&this.gameObject.destroy(),this}}]),r}(),ue={stop:0,destroy:1,yoyo:2},ce=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}},le=Phaser.Utils.Objects.IsPlainObject,de={moveFrom:function(t,e,i,n,r){if(le(e)){var s=e;e=s.x,i=s.y,t=s.duration,n=s.ease}this._easeMove=function(t,e,i,n,r,s,o){s instanceof ae&&(o=s,s=void 0),void 0===s&&(s=!1);var h={};return h.mode=s?1:0,void 0!==i&&(h.startX=ce(i,t.x),h.endX=t.x),void 0!==n&&(h.startY=ce(n,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===o?o=new ae(t,h):o.resetFromJSON(h),o.restart(),o}(this,t,e,i,n,r,this._easeMove),this._easeMove.once("complete",function(){this.emit("movefrom.complete",this)},this);var o=this.getParentSizer();if(o){var h=this;this._easeMove.on("update",function(){o.resetChildPositionState(h)})}return this},moveFromPromise:function(t,e,i,n,r){return this.moveFrom(t,e,i,n,r),Dt(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),Dt(this._easeMove)},moveTo:function(t,e,i,n,r){if(le(e)){var s=e;e=s.x,i=s.y,t=s.duration,n=s.ease}this._easeMove=function(t,e,i,n,r,s,o){s instanceof ae&&(o=s,s=void 0),void 0===s&&(s=!1);var h={};return h.mode=s?1:0,void 0!==i&&(h.startX=t.x,h.endX=ce(i,t.x)),void 0!==n&&(h.startY=t.y,h.endY=ce(n,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===o?o=new ae(t,h):o.resetFromJSON(h),o.restart(),o}(this,t,e,i,n,r,this._easeMove),this._easeMove.once("complete",function(){this.emit("moveto.complete",this)},this);var o=this.getParentSizer();if(o){var h=this;this._easeMove.on("update",function(){o.resetChildPositionState(h)})}return this},moveToPromise:function(t,e,i,n,r){return this.moveTo(t,e,i,n,r),Dt(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),Dt(this._easeMove)}},fe=void 0,pe=function(n){return n?function(t,e,i){return!!Gt(t)&&(n(t,e,i),!0)}:Gt},ve=function(t){return t},ye=Phaser.Display.Align.CENTER,ge=function(t,e,i){var n=this.getTopmostSizer();n.x+=e-this.x,n.y+=i-this.y},me={getSizerConfig:G,pushIntoBounds:function(t){return void 0===t&&(t=function(t,e){void 0===e&&(void 0===U&&(U=new Phaser.Geom.Rectangle),e=U);var i=t.game.config;return e.setTo(0,0,i.width,i.height),e}(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,r,s,o=t.scene;if("number"==typeof e)i=e;else{i=Ot(e,"color",16777215);var h=Ot(e,"name",!1);h&&(n=Ot(h,"createTextCallback",xt),r=Ot(h,"createTextCallbackScope",void 0),"string"==typeof(s=Ot(h,"align","left-top"))&&(s=W[s]))}if(n&&!t.children){t.children=new Pt(o),t.on("destroy",function(){t.children.destroy(!0),t.children=void 0});var a=t.clear.bind(t);t.clear=function(){a(),t.children.clear(!1,!0)}}for(var u,c,l=this.getAllChildren([this]),d=0,f=l.length;d<f;d++)(u=l[d]).getBounds&&(i&&t.lineStyle(1,i).strokeRectShape(u.getBounds(Et)),u.name&&n&&(c=r?n.call(r,o):n(o))&&(c.setText(u.name),t.children.add(c),I.setPosition(Et.x,Et.y).setSize(Et.width,Et.height),gt(c,I,s)));return this},getChildrenWidth:function(){return 0},getChildrenHeight:function(){return 0},addChildrenMap:bt,addElement:bt,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 r=i.match(zt);if(null!=r&&this.childrenMap){var s=this.childrenMap[r[1]];s&&(n=s[r[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,r=e;r<n;r++)i[r].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,r=i.length;n<r;n++)!(e=i[n]).rexSizer.hidden&&e.dirty&&i[n].preLayout()}},_layoutInit:kt,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,r,s,o,h=this.backgroundChildren,a=this.left,u=this.top,c=this.width,l=this.height,d=0,f=h.length;d<f;d++)(e=(t=h[d]).rexSizer).hidden||(n=a+(i=e.padding).left,r=u+i.top,s=c-i.left-i.right,o=l-i.top-i.bottom,Ht(t,s,o),I.setPosition(n,r).setSize(s,o),gt(t,I,ye),this.resetChildPositionState(t))},postLayout:function(){return this._anchor&&this._anchor.updatePosition(),this},setAnchor:function(t){return void 0===this._anchor?this._anchor=new Mt(this,t):this._anchor.resetFromJSON(t),this},isInTouching:function(t,e){return void 0===e&&(e=this),function(t,e,i,n){if(e)return Bt(t,e.x,e.y,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,h=0;h<s;h++)if(e=o[h],Bt(t,e.x,e.y,i,n))return!0;return!1}(e,t)},pointToChild:function(t,e,i,n,r){var s;if((s=i)&&"function"==typeof s||(r=i,n=i=void 0),void 0===r&&(r=this.sizerChildren?this.sizerChildren:this.children),O(r)){for(var o,h=0,a=r.length;h<a;h++)if(o=r[h],Nt(o,t,e,i,n))return o}else for(var u in r)if(o=r[u],Nt(o,t,e,i,n))return o;return null},setDraggable:function(t,e){var i=u(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",ge,this)),this}};Object.assign(me,jt,{getParentSizer:function(t){return this.getParent(t)},getTopmostSizer:function(t){return this.getTopmostParent(t)}},qt,se,de);var be=Phaser.Utils.Objects.GetValue,ke=function(){e(u,N);var a=s(u);function u(t,e,i,n,r,s){var o;c(this,u),(o=a.call(this,t,e,i,2,2)).isRexSizer=!0,o.setMinSize(n,r),o.setName(be(s,"name","")),o.rexSizer={},o.backgroundChildren=void 0,o.sizerChildren=void 0;var h=be(s,"anchor",void 0);return h&&o.setAnchor(h),o.space=mt(be(s,"space",0)),o.setDraggable(be(s,"draggable",!1)),o.setDirty(!0),o}return t(u,[{key:"destroy",value:function(t){this.scene&&(void 0!==this.backgroundChildren&&(this.backgroundChildren.length=0),f(l(u.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-J(this)*this.originX},set:function(t){this.x+=t-this.left}},{key:"right",get:function(){return this.left+J(this)},set:function(t){this.x+=t-this.right}},{key:"centerX",get:function(){return this.left+J(this)/2},set:function(t){this.x+=t-this.centerX}},{key:"top",get:function(){return this.y-Z(this)*this.originY},set:function(t){this.y+=t-this.top}},{key:"bottom",get:function(){return this.top+Z(this)},set:function(t){this.y+=t-this.bottom}},{key:"centerY",get:function(){return this.top+Z(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}}]),u}();Object.assign(ke.prototype,me);function Ce(t,e,i,n,r,s,o){this.pin(t);var h=u(e);if(null===e)return this;if("number"!==h)if("string"===h)e=xe[e];else if(Se(e)){var a;e=Oe(a=e,"proportion",0),i=Oe(a,"align",Pe),n=Oe(a,"padding",0),r=Oe(a,"expand",!1),s=Oe(a,"key",void 0),o=Oe(a,"index",void 0)}return"string"==typeof i&&(i=W[i]),void 0===e&&(e=0),void 0===i&&(i=Pe),void 0===n&&(n=0),void 0===r&&(r=!1),(a=this.getSizerConfig(t)).proportion=e,a.align=i,a.padding=mt(n),a.expand=r,void 0===o||o>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(o,0,t),void 0!==s&&this.addChildrenMap(s,t),this}var Se=Phaser.Utils.Objects.IsPlainObject,Oe=Phaser.Utils.Objects.GetValue,Pe=Phaser.Display.Align.CENTER,xe={min:0,full:-1},Ee={add:Ce,addSpace:function(t){var e,i;return void 0===t&&(t=1),Ce.call(this,(e=this.scene,(i=e.add.zone(0,0,1,1)).isRexSpace=!0,i),t),this},insert:function(t,e,i,n,r,s,o){return Ce.call(this,e,i,n,r,s,o,t),this}},_e=Phaser.Utils.Array.Remove,we=N.prototype.remove,je=N.prototype.clear,ze={remove:function(t,e){return this.getParentSizer(t)!==this||(_e(this.sizerChildren,t),we.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),je.call(this,t),this}},Xe={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=0,h=s.length;o<h;o++)(e=s[o]).rexSizer.hidden||(n=0===e.rexSizer.proportion||t&&!e.isRexSpace&&0<e.rexSizer.proportion?e.isRexSizer?Math.max(e.minWidth,e.childrenWidth):J(e):0,n+=(i=e.rexSizer.padding).left+i.right,0<o&&(n+=this.space.item),r+=n);else for(o=0,h=s.length;o<h;o++)(e=s[o]).hasOwnProperty("rexSizer")&&(e.rexSizer.hidden||(n=e.isRexSizer?Math.max(e.minWidth,e.childrenWidth):J(e),n+=(i=e.rexSizer.padding).left+i.right,r=Math.max(n,r)));return r+this.space.left+this.space.right},getChildrenHeight:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=0,h=s.length;o<h;o++)(e=s[o]).rexSizer.hidden||(n=e.isRexSizer?Math.max(e.minHeight,e.childrenHeight):Z(e),n+=(i=e.rexSizer.padding).top+i.bottom,r=Math.max(n,r));else for(o=0,h=s.length;o<h;o++)(e=s[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):Z(e):0,n+=(i=e.rexSizer.padding).top+i.bottom,0<o&&(n+=this.space.item),r+=n));return r+this.space.top+this.space.bottom},getChildrenProportion:function(){for(var t,e,i=0,n=this.sizerChildren,r=0,s=n.length;r<s;r++)(t=n[r]).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,r=i.length;n<r;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 r=0===this.orientation?this.width-this.childrenWidth:this.height-this.childrenHeight;n=0<r?(r=0===this.orientation?this.width-this.getChildrenWidth(!1):this.height-this.getChildrenHeight(!1))/this.childrenProportion:0}else n=0;this.proportionLength=n;for(var s,o,h,a,u,c,l,d,f,p,v,y,g,m,b,k,C,S=this.sizerChildren,O=this.innerLeft,P=this.innerTop,x=this.innerWidth,E=this.innerHeight,_=O,w=P,j=0,z=S.length;j<z;j++)(s=S[j]).rexSizer.hidden||(h=(o=s.rexSizer).padding,m=this,b=void 0,k=s.rexSizer,C=k.padding,0===m.orientation?0<k.proportion&&0<m.proportionLength&&(b=k.proportion*m.proportionLength):k.expand&&(b=m.innerWidth-C.left-C.right),d=b,p=this,v=void 0,y=s.rexSizer,g=y.padding,0===p.orientation?y.expand&&(v=p.innerHeight-g.top-g.bottom):0<y.proportion&&0<p.proportionLength&&(v=y.proportion*p.proportionLength),f=v,s.isRexSizer?s.layout(this,d,f):Ht(s,d,f),void 0===d&&(d=J(s)),void 0===f&&(f=Z(s)),l=0===this.orientation?(a=_+h.left,c=0===o.proportion||0===n?d:o.proportion*n,u=w+h.top,E-h.top-h.bottom):(a=_+h.left,c=x-h.left-h.right,u=w+h.top,0===o.proportion||0===n?f:o.proportion*n),I.setPosition(a,u).setSize(c,l),gt(s,I,o.align),this.resetChildPositionState(s),0===this.orientation?_+=c+h.left+h.right+this.space.item:w+=l+h.top+h.bottom+this.space.item);return this.layoutBackgrounds(),this.postLayout()},_layoutInit:function(){kt.call(this),this._childrenProportion=void 0}};Object.assign(Xe,Ee,ze);var Ye={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Me=Phaser.Utils.Objects.IsPlainObject,Ae=Phaser.Utils.Objects.GetValue,Te=function(){e(u,ke);var a=s(u);function u(t,e,i,n,r,s,o){var h;return c(this,u),Me(e)?(e=Ae(o=e,"x",0),i=Ae(o,"y",0),n=Ae(o,"width",void 0),r=Ae(o,"height",void 0),s=Ae(o,"orientation",0)):Me(n)?(n=Ae(o=n,"width",void 0),r=Ae(o,"height",void 0),s=Ae(o,"orientation",0)):Me(s)&&(s=Ae(o=s,"orientation",0)),void 0===s&&(s=0),(h=a.call(this,t,e,i,n,r,o)).type="rexSizer",h.sizerChildren=[],h.setOrientation(s),h.setItemSpacing(Ae(o,"space.item",0)),h.addChildrenMap("items",h.sizerChildren),h}return t(u,[{key:"destroy",value:function(t){this.scene&&(this.sizerChildren.length=0,f(l(u.prototype),"destroy",this).call(this,t))}},{key:"setOrientation",value:function(t){return"string"==typeof t&&(t=Ye[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}}]),u}();Object.assign(Te.prototype,Xe);var Re=Phaser.Utils.Objects.GetValue,Fe=function(){function i(t,e){c(this,i),this.gameObject=t,this.scene=St(t),this.setEventEmitter(Re(e,"eventEmitter",void 0)),this._enable=void 0,t.setInteractive(Re(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}return t(i,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Re(t,"enable",!0)),this.setMode(Re(t,"mode",1)),this.setClickInterval(Re(t,"clickInterval",100)),this.setDragThreshold(Re(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=Ne[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(Fe.prototype,At);function Le(t){if(0===this.buttons.length){if(!this.buttonsExpand)switch(this.buttonsAlign){case"right":case"bottom":case"center":Ue.call(this)}He.call(this,t,this.buttonProportion,"center",0,!0),this.buttonsExpand||"center"===this.buttonsAlign&&Ue.call(this)}else{var e=this.sizerChildren.length-1;this.sizerChildren[e].isRexSpace?Ve.call(this,e,t,this.buttonProportion,"center",0,!0):He.call(this,t,this.buttonProportion,"center",0,!0)}return this.buttons.push(t),function(r,t){r._buttonBehavior=new Fe(r,t),r._buttonBehavior.on("click",function(t,e,i,n){Ge.call(this,"button.click",e,i,n)},this).on("enable",function(t,e){Ge.call(this,"button.enable",e)},this).on("disable",function(t,e){Ge.call(this,"button.disable",e)},this),r.on("pointerover",function(t,e,i,n){Ge.call(this,"button.over",r,t,n)},this).on("pointerout",function(t,e){Ge.call(this,"button.out",r,t,e)},this)}.call(this,t,this.clickConfig),this}function De(t,e){return(t=this.getButton(t))&&(1===this.buttons.length?this.clear(e):(Ie(this.buttons,t),Je.call(this,t,e))),this}function Be(t,e){void 0===e&&(e=!1);var i=ti(t,"dataManager",void 0),r=ti(t,"setValueCallback",void 0),s=ti(t,"setValueCallbackScope",void 0);void 0===i&&(this.setDataEnabled(),i=this.data),this.buttons.forEach(function(n){var t=n.name;r&&i.events.on("changedata-".concat(t),function(t,e,i){s?r.call(s,n,e,i):r(n,e,i)},this),i.set(t,void 0),i.set(t,e)}),this._dataManager=i}var Ne={press:0,pointerdown:0,release:1,pointerup:1},Ge=function(t,e,i,n){var r;if("number"==typeof e){if(r=e,!(e=this.buttons[r]))return}else if(-1===(r=this.buttons.indexOf(e)))return;this.eventEmitter!==this&&this.emit(t,e,r,i,n),void 0!==this.groupName?this.eventEmitter.emit(t,e,this.groupName,r,i,n):this.eventEmitter.emit(t,e,r,i,n)},He=Te.prototype.add,Ue=Te.prototype.addSpace,Ve=Te.prototype.insert,We={addButton:function(t){if(O(t))for(var e=t,i=0,n=e.length;i<n;i++)Le.call(this,e[i]);else Le.call(this,t);return this},addButtons:function(t){for(var e=0,i=t.length;e<i;e++)Le.call(this,t[e]);return this}},Ie=Phaser.Utils.Array.Remove,Je=Te.prototype.remove,Ze=Te.prototype.clear,qe={remove:function(t,e){if(O(t))for(var i=t,n=0,r=i.length;n<r;n++)De.call(this,i[n],e);else De.call(this,t,e);return this},clear:function(t){return this.buttons.length=0,Ze.call(this,t),this},removeButton:function(t,e){return this.remove(t,e),this},clearButtons:function(t){return this.clear(t),this}},$e=function(t,e){return t?t.hasOwnProperty("name")?t.name===e?t:null:GetElementByName(t,e):null},Ke=function(t,e){t&&(G(t).hidden=e,t.setVisible(!e))},Qe={getButton:function(t){var e;switch(u(t)){case"number":e=this.buttons[t];break;case"string":e=function(t,e){if(!t)return null;if(O(t)){for(var i,n=0,r=t.length;n<r;n++)if(i=$e(t[n],e))return i}else for(var s in t)if(i=$e(t[s],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 Ge.call(this,"button.click",t),this},showButton:function(t){var e;return e=this.getButton(t),Ke(e,!1),this},hideButton:function(t){var e;return e=this.getButton(t),Ke(e,!0),this},isButtonShown:function(t){var e;return(e=this.getButton(t))&&G(e).hidden,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}},ti=Phaser.Utils.Objects.GetValue,ei=Phaser.Utils.Objects.GetValue,ii={radio:function(t){Be.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 r=this._dataManager;this.buttons.forEach(function(t){var e=t.name,i=r.get(e);e===n?i||r.set(e,!0):i&&r.set(e,!1)})}}.bind(this),enumerable:!0,configurable:!0}),this.on("button.click",function(t){this.value=t.name},this)},checkboxes:function(t){Be.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)}},ni=Phaser.Utils.Objects.GetValue,ri=function(){e(h,Te);var o=s(h);function h(t,e){var i;c(this,h),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=ni(e,"eventEmitter",a(i)),i.groupName=ni(e,"groupName",void 0),i.buttons=[];var r=ni(e,"background",void 0),s=ni(e,"buttons",void 0);return i.buttonsExpand=ni(e,"expand",!1),i.buttonsAlign=ni(e,"align",void 0),i.buttonProportion=i.buttonsExpand?1:0,i.clickConfig=ni(e,"click",void 0),r&&i.addBackground(r),s&&i.addButtons(s),function(t){var e=ei(t,"type",void 0);e&&ii.hasOwnProperty(e)&&ii[e].call(this,t)}.call(a(i),e),i.addChildrenMap("background",r),i.addChildrenMap("buttons",i.buttons),i}return h}();return Object.assign(ri.prototype,We,qe,Qe),ri});
  