UNPKG

phaser4-rex-plugins

Version:
1 lines 72 kB
var t,e;t=void 0,e=function(){var t=!1;!function(e){if(!t){void 0===e&&(e=0);var i=Phaser.VERSION.split("."),s=parseInt(i[0]);if(4===s){var r=parseInt(i[1]);r<e&&console.error(`Minimum supported version : ${s}.${r}`)}else console.error(`Can't supported version : ${s}`);t=!0}}();const e=Phaser.GameObjects.Zone,i=Phaser.Utils.Array.Add,s=Phaser.Utils.Array.Remove;let r=class extends e{constructor(t,e,i,s,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),super(t,e,i,s,r),this.children=[]}destroy(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e,i=this.children.length-1;i>=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return i(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return s(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;i<s;i++)(e=this.children[i]).off("destroy",this.onChildDestroy,this),t&&e.destroy();return this.children.length=0,this}};const a=Phaser.GameObjects.Components;Phaser.Class.mixin(r,[a.Alpha,a.Flip]);var h=function(t,e){var i;if(void 0===e)t.hasOwnProperty("rexContainer")&&(i=t.rexContainer.parent);else for(i=h(t);i&&i.name!==e;)i=h(i);return i};const n=Phaser.Math.DegToRad,o=Phaser.Math.RadToDeg;var l=function(t){if(!t.hasOwnProperty("rexContainer")){var e={parent:null,self:null,layer:null,x:0,y:0,syncPosition:!0,rotation:0,syncRotation:!0,scaleX:0,scaleY:0,syncScale:!0,alpha:0,syncAlpha:!0,syncScrollFactor:!0,syncCameraFilter:!0,syncDisplayList:!0,visible:!0,active:!0};Object.defineProperty(e,"angle",{get:function(){return o(this.rotation)},set:function(t){this.rotation=n(t)}}),Object.defineProperty(e,"displayWidth",{get:function(){return t.width*this.scaleX},set:function(e){this.scaleX=e/t.width}}),Object.defineProperty(e,"displayHeight",{get:function(){return t.height*this.scaleY},set:function(e){this.scaleY=e/t.height}}),t.rexContainer=e}return t.rexContainer},d={setParent(t,e){void 0===e&&(e=this);var i=l(t);return e?(i.parent=e,i.self=t):(i.parent=null,i.self=null),this},getParent(t,e){return"string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),h(t,e)},getTopmostParent(t){return void 0===t&&(t=this),function(t){for(var e=h(t);e;)t=e,e=h(e);return t}(t)}};const u=Phaser.Utils.Objects.GetValue,c=r.prototype.add;var p=function(t,e){this.setParent(t);var i=l(t);return y(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t).updateCameraFilter(t),c.call(this,t),g.call(this,t,i),this},v=function(t,e){this.setParent(t);var i=l(t);return y(i,e),i.x=t.x,i.y=t.y,i.rotation=t.rotation,i.scaleX=t.scaleX,i.scaleY=t.scaleY,i.alpha=t.alpha,i.visible=t.visible,i.active=t.active,this.updateChildPosition(t).updateChildAlpha(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),c.call(this,t),g.call(this,t,i),this},y=function(t,e){void 0===e&&(e=!0),"boolean"==typeof e?(t.syncPosition=e,t.syncRotation=e,t.syncScale=e,t.syncAlpha=e,t.syncScrollFactor=e,t.syncCameraFilter=e,t.syncDisplayList=e):(t.syncPosition=u(e,"syncPosition",!0),t.syncRotation=u(e,"syncRotation",!0),t.syncScale=u(e,"syncScale",!0),t.syncAlpha=u(e,"syncAlpha",!0),t.syncScrollFactor=u(e,"syncScrollFactor",!0),t.syncCameraFilter=u(e,"syncCameraFilter",!0),t.syncDisplayList=u(e,"syncDisplayList",!0))},g=function(t,e){this.addToParentContainer(t),e.syncDisplayList&&this.addToPatentLayer(t),this.addToRenderLayer(t)},f={add(t){return Array.isArray(t)?this.addMultiple(t):p.call(this,t),this},pin(t,e){return Array.isArray(t)?this.addMultiple(t,e):p.call(this,t,e),this},addMultiple(t){for(var e=Array.from(arguments),i=0,s=t.length;i<s;i++)e[0]=t[i],this.add.apply(this,e);return this},addLocal(t){return Array.isArray(t)?this.addMultiple(t):v.call(this,t),this},pinLocal(t,e){return Array.isArray(t)?this.addMultiple(t,e):v.call(this,t,e),this},addLocalMultiple(t){for(var e=0,i=t.length;e<i;e++)v.call(this,t[e]);return this}};const m=r.prototype.remove,S=r.prototype.clear;var P={remove(t,e){return h(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),m.call(this,t,e)),this},unpin(t,e){return h(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),m.call(this,t,e)),this},clear(t){for(var e=this.children,i=0,s=e.length;i<s;i++){var r=e[i];this.setParent(r,null),t||this.removeFromRenderLayer(r)}return S.call(this,t),this}},C={getLocalState:t=>l(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;e<i;e++)this.resetChildState(t[e]);return this},syncProperties(){return this.syncPosition().syncVisible().syncAlpha().syncActive().syncScrollFactor().syncMask(),this}},b={worldToLocal(t){t.x-=this.x,t.y-=this.y;var e=Math.cos(-this.rotation),i=Math.sin(-this.rotation),s=t.x,r=t.y;return t.x=s*e-r*i,t.y=s*i+r*e,t.x/=this.scaleX,t.y/=this.scaleY,t},localToWorld(t){t.x*=this.scaleX,t.y*=this.scaleY;var e=Math.cos(this.rotation),i=Math.sin(this.rotation),s=t.x,r=t.y;return t.x=s*e-r*i,t.y=s*i+r*e,t.x+=this.x,t.y+=this.y,t}},D=function(t,e){return t===e?1:t/e},x={updateChildPosition(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=l(t),i=e.parent;return e.syncPosition&&(t.x=e.x,t.y=e.y,i.localToWorld(t)),e.syncRotation&&(t.rotation=e.rotation+i.rotation),e.syncScale&&(t.scaleX=e.scaleX*i.scaleX,t.scaleY=e.scaleY*i.scaleY),t.isRexContainerLite&&(t.syncChildrenEnable=!0,t.syncPosition()),this},syncPosition(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildPosition,this),this},resetChildPositionState(t){var e=l(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=D(t.scaleX,i.scaleX),e.scaleY=D(t.scaleY,i.scaleY),e.rotation=t.rotation-i.rotation,this},setChildPosition(t,e,i){return t.x=e,t.y=i,this.resetChildPositionState(t),this},setChildLocalPosition(t,e,i){var s=l(t);return s.x=e,s.y=i,this.updateChildPosition(t),this},resetLocalPositionState(){var t=l(this).parent;return t&&t.resetChildPositionState(this),this},getChildLocalX:t=>l(t).x,getChildLocalY:t=>l(t).y};const A=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=l(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=l(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return l(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return l(t).rotation=A(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=l(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>l(t).rotation},w={updateChildScale(t){var e=l(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=l(t),i=e.parent;return e.scaleX=D(t.scaleX,i.scaleX),e.scaleY=D(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=l(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=l(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>l(t).scaleX,getChildLocalScaleY:t=>l(t).scaleY},k={updateChildVisible(t){var e=l(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=l(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),l(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),l(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=l(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>l(t).visible},_={updateChildAlpha(t){var e=l(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=l(t),i=e.parent;return e.alpha=D(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return l(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=l(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>l(t).alpha},L={updateChildActive(t){var e=l(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return l(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),l(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=l(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>l(t).active},R={updateChildScrollFactor(t){var e=l(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},M={updateCameraFilter(t){var e=l(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s<r;s++){var a=t[s];if(a.displayList?i=a.displayList:a.parentContainer&&(i=a.parentContainer.list),i)break}return i||(i=a.scene.sys.displayList),i.depthSort&&(i.depthSort(),i=i.list),e?t.sort((function(t,e){return i.indexOf(e)-i.indexOf(t)})):t.sort((function(t,e){return i.indexOf(t)-i.indexOf(e)})),t},E=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},F={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s<r;s++)i[s].depth=t;return this},swapDepth(t){var e=this.depth,i=t.depth;return this.setDepth(i),t.setDepth(e),this},incDepth(t){if(this.depth+=t,this.children)for(var e=this.getAllChildren(),i=0,s=e.length;i<s;i++)e[i].depth+=t;return this},bringToTop(){var t=this.displayList;if(!t)return this;var e=this.getAllChildren([this]);Y(e,!1);for(var i=0,s=e.length;i<s;i++){var r=e[i];t.exists(r)&&t.bringToTop(r)}return this},bringMeToTop(){return this.bringToTop()},sendToBack(){var t=this.displayList;if(!t)return this;var e=this.getAllChildren([this]);Y(e,!0);for(var i=0,s=e.length;i<s;i++){var r=e[i];t.exists(r)&&t.sendToBack(r)}return this},sendMeToBack(){return this.sendToBack()},moveDepthBelow(t){var e=this.displayList;if(!e)return this;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);Y(i,!1);for(var s=0,r=i.length;s<r;s++){var a=i[s];if(e.exists(a)){e.moveBelow(t,a);break}}return this},moveMyDepthBelow(t){return this.moveDepthBelow(t)},moveDepthAbove(t){var e=this.displayList;if(!e)return this;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);Y(i,!0);for(var s=0,r=i.length;s<r;s++){var a=i[s];if(e.exists(a)){e.moveAbove(t,a);break}}return this},moveMyDepthAbove(t){return this.moveDepthAbove(t)},bringChildToTop(t){var e;t!==this&&t.isRexContainerLite?(e=t.getAllChildren([t]),e=E(e),e=Y(e,!1)):e=[t];var i=this.getAllChildren([this]);i=E(i);for(var s=(i=Y(i,!1))[i.length-1],r=0,a=e.length;r<a;r++){var h=e[r];s!==h&&(h!==this&&s.displayList!==h.displayList||(s.displayList.moveAbove(h,s),s=h))}return this},sendChildToBack(t){var e;t!==this&&t.isRexContainerLite?(e=t.getAllChildren([t]),e=E(e),e=Y(e,!1)):e=[t];var i=this.getAllChildren([this]);i=E(i);for(var s=(i=Y(i,!1))[0],r=e.length-1;r>=0;r--){var a=e[r];s!==a&&(a!==this&&s.displayList!==a.displayList||(s.displayList.moveBelow(a,s),s=a))}return this}},O=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s<r;s++)O(i[s],e)},V=function(t,e){for(var i=[t];i.length>0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var z={getChildren(t){if(t)for(var e=0,i=this.children.length;e<i;e++)t.push(this.children[e]);else t=this.children;return t},getAllChildren(t){void 0===t&&(t=[]);var e=this;return V(e,(function(i){i!==e&&t.push(i)})),t},getAllVisibleChildren(t){void 0===t&&(t=[]);var e=this;return V(e,(function(i){if(i!==e)return!i.visible||void t.push(i)})),t},bfs(t,e){return void 0===e&&(e=this),V(e,t),this},dfs(t,e){return void 0===e&&(e=this),O(e,t),this},contains(t){var e=h(t);return!!e&&(e===this||this.contains(e))},getByName(t,e){if(e){for(var i,s,r=[this];r.length;)for(var a=0,h=(i=r.shift()).children.length;a<h;a++){if((s=i.children[a]).name===t)return s;s.isRexContainerLite&&r.push(s)}return null}return j.GetFirst(this.children,"name",t)},getRandom(t,e){return j.GetRandom(this.children,t,e)},getFirst(t,e,i,s){return j.GetFirstElement(this.children,t,e,i,s)},getAll(t,e,i,s){return j.GetAll(this.children,t,e,i,s)},count(t,e,i,s){return j.CountAllMatching(this.children,t,e,i,s)},swap(t,e){return j.Swap(this.children,t,e),this},setAll(t,e,i,s){return j.SetAll(this.children,t,e,i,s),this}},G=function(t){for(var e=[],i=0,s=t.length;i<s;i++){var r=t[i];r.hasOwnProperty("rexContainer")&&e.push(r.rexContainer)}return e},I=function(t,e,i){if(i.parent){var s=i.parent,r=i.self;switch(e){case"x":case"y":s.updateChildPosition(r);break;case"angle":case"rotation":s.updateChildRotation(r);break;case"scaleX":case"scaleY":case"displayWidth":case"displayHeight":s.updateChildScale(r);break;case"alpha":s.updateChildAlpha(r);break;default:s.updateChildPosition(r),s.updateChildRotation(r),s.updateChildScale(r),s.updateChildAlpha(r)}}else t.remove()},B={tweenChild(t){var e=t.targets;Array.isArray(e)||(e=[e]);var i=this.scene||function(t){for(var e=0,i=t.length;e<i;e++){var s=t[e].scene;if(s)return s}return null}(e);if(i){t.targets=G(e);var s=i.tweens.add(t);return s.on("update",I),s}},tweenSelf(t){return t.targets=[this],this.tweenChild(t)},createTweenChildConfig(t){var e=t.targets;e&&(Array.isArray(e)||(e=[e]),t.targets=G(e));var i=t.onUpdate;return t.onUpdate=function(t,e){i&&i(t,e),I(t,void 0,e)},t},tween(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}};const N=Phaser.GameObjects.Container,W=Phaser.GameObjects.Layer;var U=function(t){return t instanceof W},H=function(t){var e=t.getAllChildren([t]);return e=e.filter((function(t){return!!t.displayList||!!t.parentContainer}))},J=function(t){var e=H(this);-1===e.indexOf(this)&&e.push(this),Y(e),t.add(e)},K=function(t,e,i){if(this.scene){var s=H(this);Y(s,e),t.remove(s),i&&s.forEach((function(t){t.addToDisplayList()}))}},$={addToContainer(t){return t instanceof N?(this._setParentContainerFlag=!0,J.call(this,t),this._setParentContainerFlag=!1,this):this},addToLayer(t){return U(t)?(J.call(this,t),this):this},removeFromContainer(){return this.parentContainer?(this._setParentContainerFlag=!0,K.call(this,this.parentContainer,!0,!1),this._setParentContainerFlag=!1,this):this},removeFromLayer(t){return void 0===t&&(t=!0),U(this.displayList)?(K.call(this,this.displayList,!1,t),this):this},getParentContainer(){if(this.parentContainer)return this.parentContainer;for(var t=this.getParent();t;){var e=t.parentContainer;if(e)return e;t=t.getParent()}return null},addToParentContainer(t){if(!t.displayList)return this;var e=this.getParentContainer();return e?(t.isRexContainerLite?t.addToContainer(e):e.add(t),this):this},addToPatentLayer(t){if(!t.displayList)return this;var e=this.displayList;return e===t.displayList||U(e)&&(t.isRexContainerLite?t.addToLayer(e):e.add(t)),this}},q={hasLayer(){return!!this.privateRenderLayer},enableLayer(){if(this.hasLayer())return this;var t=this.scene.add.layer();return this.moveDepthBelow(t),this.addToLayer(t),this.privateRenderLayer=t,this},getLayer(){return this.hasLayer()||this.enableLayer(),this.privateRenderLayer},getRenderLayer(){if(this.hasLayer())return this.privateRenderLayer;for(var t=this.getParent();t;){var e=t.privateRenderLayer;if(e)return e;t=t.getParent()}return null},addToRenderLayer(t){if(!t.displayList)return this;var e=this.getRenderLayer();return e?(e===t.displayList||(t.isRexContainerLite?t.addToLayer(e):e.add(t),l(t).layer=e),this):this},removeFromRenderLayer(t){var e=l(t),i=e.layer;return i?(t.isRexContainerLite?t.removeFromLayer(!0):i.remove(t),e.layer=null,this):this}},Q=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Z=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const tt=Phaser.Geom.Rectangle,et=Phaser.Math.Vector2,it=Phaser.Math.RotateAround,st=Phaser.GameObjects.Container;var rt=function(t,e){if(void 0===e?e=new tt:!0===e&&(void 0===at&&(at=new tt),e=at),t.getBounds&&!(t instanceof st))return t.getBounds(e);var i,s,r,a,h,n,o,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();ht(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,nt(t,e),d.transformPoint(e.x,e.y,e),r=e.x,a=e.y,ot(t,e),d.transformPoint(e.x,e.y,e),h=e.x,n=e.y,lt(t,e),d.transformPoint(e.x,e.y,e),o=e.x,l=e.y}else ht(t,e),i=e.x,s=e.y,nt(t,e),r=e.x,a=e.y,ot(t,e),h=e.x,n=e.y,lt(t,e),o=e.x,l=e.y;return e.x=Math.min(i,r,h,o),e.y=Math.min(s,a,n,l),e.width=Math.max(i,r,h,o)-e.x,e.height=Math.max(s,a,n,l)-e.y,e},at=void 0,ht=function(t,e,i){return void 0===e?e=new et:!0===e&&(void 0===dt&&(dt=new et),e=dt),t.getTopLeft?t.getTopLeft(e,i):(e.x=t.x-Q(t)*t.originX,e.y=t.y-Z(t)*t.originY,ut(t,e,i))},nt=function(t,e,i){return void 0===e?e=new et:!0===e&&(void 0===dt&&(dt=new et),e=dt),t.getTopRight?t.getTopRight(e,i):(e.x=t.x-Q(t)*t.originX+Q(t),e.y=t.y-Z(t)*t.originY,ut(t,e,i))},ot=function(t,e,i){return void 0===e?e=new et:!0===e&&(void 0===dt&&(dt=new et),e=dt),t.getBottomLeft?t.getBottomLeft(e,i):(e.x=t.x-Q(t)*t.originX,e.y=t.y-Z(t)*t.originY+Z(t),ut(t,e,i))},lt=function(t,e,i){return void 0===e?e=new et:!0===e&&(void 0===dt&&(dt=new et),e=dt),t.getBottomRight?t.getBottomRight(e,i):(e.x=t.x-Q(t)*t.originX+Q(t),e.y=t.y-Z(t)*t.originY+Z(t),ut(t,e,i))},dt=void 0,ut=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&it(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const ct=Phaser.Geom.Rectangle,pt=Phaser.Geom.Rectangle.Union;var vt,yt=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t};const gt=Phaser.GameObjects.GameObject,ft=Phaser.GameObjects.Layer;var mt=function(t){return t instanceof gt||t instanceof ft},St=Phaser.Utils.Objects.GetValue,Pt=function(t){if(t){var e=t.gameObjects;Array.isArray(e)||(e=[e]);var i,s,r=t.renderTexture,a=t.saveTexture,h=St(t,"x",void 0),n=St(t,"y",void 0),o=St(t,"width",void 0),l=St(t,"height",void 0),d=St(t,"originX",0),u=St(t,"originY",0),c=St(t,"padding",0);if(void 0===o||void 0===l||void 0===h||void 0===n){var p=function(t,e){var i;void 0===e?e=new ct:!0===e&&(void 0===vt&&(vt=new ct),e=vt),e.setTo(0,0,0,0);for(var s=!0,r=0,a=t.length;r<a;r++)if((i=t[r]).getBounds){var h=rt(i,!0);s?(e.setTo(h.x,h.y,h.width,h.height),s=!1):pt(h,e,e)}return e}(e,!0);void 0!==h&&void 0!==n?(o=2*Math.max(h-p.left,p.right-h),l=2*Math.max(n-p.top,p.bottom-n),d=.5,u=.5):(h=p.x,n=p.y,o=p.width,l=p.height,d=0,u=0),i=p.x,s=p.y}else i=h+(0-d)*o,s=n+(0-u)*l;i-=c,s-=c,o+=2*c,l+=2*c;var v=e[0].scene,y=v.sys.textures;return a&&!r&&(r=y.addDynamicTexture(a,o,l)),r||(r=v.add.renderTexture(0,0,o,l)),r.setPosition&&r.setPosition(h,n),r.width===o&&r.height===l||r.setSize(o,l),r.setOrigin&&r.setOrigin(d,u),r.camera.setScroll(i,s),e=Y(function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:yt(e),i){e.length=t.length;for(var s=0,r=t.length;s<r;s++)e[s]=t[s]}else for(var a in t)e[a]=t[a];return e}(e)),r.draw(e).render(),a&&(mt(r)?r.saveTexture(a):r.key!==a&&y.renameTexture(r.key,key)),r}},Ct={snapshot(t){var e=this.scaleX,i=this.scaleY,s=1===e&&1===i;s||this.setScale(1),void 0===t&&(t={}),t.gameObjects=this.getAllVisibleChildren(),t.x=this.x,t.y=this.y,t.originX=this.originX,t.originY=this.originY;var r=Pt(t),a=!!r.scene;return s||(this.setScale(e,i),a&&r.setScale(e,i)),a?r:this}};const bt=Phaser.Utils.Objects.GetValue;var Dt=function(t,e,i,s,r,a,h,n){if(t.getBounds||void 0!==t.width&&void 0!==t.height){var o=ht(t,xt[0],n);o.x-=h,o.y-=h;var l=nt(t,xt[1],n);l.x+=h,l.y-=h;var d=lt(t,xt[2],n);d.x+=h,d.y+=h;var u=ot(t,xt[3],n);u.x-=h,u.y+=h,null!==r&&e.fillStyle(r,a).fillPoints(xt,!0,!0),null!==i&&e.lineStyle(s,i).strokePoints(xt,!0,!0)}},xt=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}];const At=Phaser.Utils.Objects.GetValue,Tt=Phaser.Math.RotateAround;var wt={changeOrigin:function(t,e){this.syncChildrenEnable=!1,function(t,e,i){void 0===i&&(i=e);var s={x:(e-t.originX)*t.displayWidth,y:(i-t.originY)*t.displayHeight};Tt(s,0,0,t.rotation),t.originX=e,t.originY=i,t.x=t.x+s.x,t.y=t.y+s.y}(this,t,e),this.syncChildrenEnable=!0;for(var i=this.getAllChildren(),s=0,r=i.length;s<r;s++)this.resetChildPositionState(i[s]);return this},drawBounds:function(t,e){var i=At(e,"drawContainer",!0),s=At(e,"children");return void 0===s&&(s=this.getAllVisibleChildren([this])),i||(s=s.filter((function(t){return!t.isRexContainerLite}))),function(t,e,i){var s,r,a,h,n,o;if("number"==typeof i?s=i:(s=bt(i,"color"),r=bt(i,"lineWidth"),a=bt(i,"fillColor"),h=bt(i,"fillAlpha"),n=bt(i,"padding"),o=bt(i,"includeParent")),void 0===s&&(s=16777215),void 0===r&&(r=1),void 0===a&&(a=null),void 0===h&&(h=1),void 0===n&&(n=0),void 0===o&&(o=!0),Array.isArray(t))for(var l=0,d=t.length;l<d;l++)Dt(t[l],e,s,r,a,h,n,o);else Dt(t,e,s,r,a,h,n,o)}(s,t,e),this}};Object.assign(wt,d,f,P,C,b,x,T,w,k,_,L,R,M,X,F,z,B,$,q,Ct);class kt extends r{constructor(t,e,i,s,r,a){Array.isArray(s)&&(a=s,s=void 0,r=void 0),super(t,e,i,s,r),this.type="rexContainerLite",this.isRexContainerLite=!0,this.syncChildrenEnable=!0,this._active=!0,this._mask=null,this._scrollFactorX=1,this._scrollFactorY=1,this._cameraFilter=0,this.privateRenderLayer=void 0,a&&this.add(a)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.syncChildrenEnable=!1,super.destroy(t),this.privateRenderLayer&&this.privateRenderLayer.scene&&(this.privateRenderLayer.list.length=0,this.privateRenderLayer.destroy()))}resize(t,e){return this.setSize(t,e),this}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.syncPosition())}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.syncPosition())}get rotation(){return super.rotation}set rotation(t){this.rotation!==t&&(super.rotation=t,this.syncPosition())}get scaleX(){return super.scaleX}set scaleX(t){this.scaleX!==t&&(super.scaleX=t,this.syncPosition())}get scaleY(){return super.scaleY}set scaleY(t){this.scaleY!==t&&(super.scaleY=t,this.syncPosition())}get scale(){return super.scale}set scale(t){this.scale!==t&&(super.scale=t,this.syncPosition())}get visible(){return super.visible}set visible(t){super.visible!==t&&(super.visible=t,this.syncVisible())}get alpha(){return super.alpha}set alpha(t){super.alpha!==t&&(super.alpha=t,this.syncAlpha())}get active(){return this._active}set active(t){this._active!==t&&(this._active=t,this.syncActive())}get mask(){return this._mask}set mask(t){this._mask!==t&&(this._mask=t,this.syncMask())}get scrollFactorX(){return this._scrollFactorX}set scrollFactorX(t){this._scrollFactorX!==t&&(this._scrollFactorX=t,this.syncScrollFactor())}get scrollFactorY(){return this._scrollFactorY}set scrollFactorY(t){this._scrollFactorY!==t&&(this._scrollFactorY=t,this.syncScrollFactor())}get cameraFilter(){return this._cameraFilter}set cameraFilter(t){this._cameraFilter!==t&&(this._cameraFilter=t,this.syncCameraFilter())}get list(){return this.children}static GetParent(t){return h(t)}get parentContainer(){return this._parentContainer}set parentContainer(t){this._parentContainer||t?this.setParentContainerFlag?this._parentContainer=t:this._parentContainer&&!t?(this.removeFromContainer(),this._parentContainer=t):t?(this._parentContainer=t,this.addToContainer(t)):this._parentContainer=t:this._parentContainer=t}get setParentContainerFlag(){if(this._setParentContainerFlag)return!0;var t=h(this);return!!t&&t.setParentContainerFlag}}Object.assign(kt.prototype,wt);const _t=Phaser.Utils.Objects.GetValue;var Lt={setFlipX(t){return this.flipX=t,this},setFlipY(t){return this.flipY=t,this},toggleFlipX(){return this.flipX=!this.flipX,this},toggleFlipY(){return this.flipY=!this.flipY,this},setFlip(t,e){return this.flipX=t,this.flipY=e,this},resetFlip(){return this.flipX=!1,this.flipY=!1,this}},Rt=[Phaser.GameObjects.Image,Phaser.GameObjects.Sprite,Phaser.GameObjects.Mesh,Phaser.GameObjects.Shader,Phaser.GameObjects.Video],Mt=[Phaser.GameObjects.BitmapText],Xt=function(t,e,i){if(t&&(void 0!==e||void 0!==i))if(function(t){if(t.resize)return!0;if(!t.setSize)return!1;for(var e=0,i=Rt.length;e<i;e++){var s=Rt[e];if(s&&t instanceof s)return!1}return!0}(t)){var s,r;s=void 0===e?t.width:e/t.scaleX,r=void 0===i?t.height:i/t.scaleY,t.resize?t.resize(s,r):t.setSize(s,r)}else{var a=function(t){if(void 0===t.displayWidth)return!1;for(var e=0,i=Mt.length;e<i;e++){var s=Mt[e];if(s&&t instanceof s)return!1}return!0}(t);void 0!==e&&(a?t.displayWidth=e:t.scaleX=e/t.width),void 0!==i&&(a?t.displayHeight=i:t.scaleY=i/t.height)}};const Yt={fit:0,FIT:0,envelop:1,ENVELOP:1};var Et={};const Ft=Phaser.Utils.Objects.IsPlainObject;class Ot extends kt{setBackground(t){var e,i,s,r,a,h,n,o,l,d,u,c;return Ft(t)&&(e=this.scene,s=_t(i=t,"x",0),r=_t(i,"y",0),a=_t(i,"width",1),h=_t(i,"height",1),n=_t(i,"color",void 0),o=_t(i,"alpha",1),l=_t(i,"strokeColor",void 0),d=_t(i,"strokeAlpha",1),u=_t(i,"strokeWidth",2),c=e.add.rectangle(s,r,a,h),void 0!==n&&c.setFillStyle(n,o),void 0!==l&&c.setStrokeStyle(u,l,d),t=c,this.scene.add.existing(t)),t&&this.add(t),this.background=t,this}setImage(t){return t?t.setPosition(this.x,this.y).setOrigin(.5):t=this.scene.add.image(this.x,this.y),this.add(t),this.image=t,this.image.setFlipX(this.flipX).setFlipY(this.flipY),void 0!==this._colorTopLeft&&this.image.setTint(this._colorTopLeft,this._colorTopRight,this._colorBottomLeft,this._colorBottomRight),this}get texture(){return this.image.texture}get frame(){return this.image.frame}get flipX(){return this._flipX}set flipX(t){this._flipX!==t&&(this._flipX=t,this.image.setFlipX(t))}get flipY(){return this._flipY}set flipY(t){this._flipY!==t&&(this._flipY=t,this.image.setFlipY(t))}set tint(t){this.image.tint=t}get isTinted(){return this.image.isTinted}setTint(t,e,i,s){return this._colorTopLeft=t,this._colorTopRight=e,this._colorBottomLeft=i,this._colorBottomRight=s,this.image.setTint(t,e,i,s),this}resizeBackground(){var t=this.background;return t?(t.setOrigin(this.originX,this.originY),t.setPosition(this.x,this.y),Xt(t,this.displayWidth,this.displayHeight),this.resetChildScaleState(t),this):this}scaleImage(){var t=this.image;if(!this.scaleUp&&t.width<=this.width&&t.height<=this.height)return this;var e=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Yt[i])}void 0===s?s={}:!0===s&&(s=Et);var a=e.width/t.width,h=e.height/t.height,n=i?Math.max(a,h):Math.min(a,h),o=t.width*n,l=t.height*n;return mt(s)?Xt(s,o,l):(s.width=o,s.height=l),s}(t,this,"FIT",!0);return t.setDisplaySize(e.width*this.scaleX,e.height*this.scaleY),this.resetChildScaleState(t),this}resize(t,e){return super.resize(t,e),this.resizeBackground(),this.scaleImage(),this}setTexture(t,e){var i=this.image;return i.setTexture(t,e),t?(this.setChildVisible(i,!0),this.scaleImage()):this.setChildVisible(i,!1),this}}Object.assign(Ot.prototype,Lt);const Vt=Phaser.GameObjects.GetCalcMatrix,jt=Phaser.Renderer.Canvas.SetTransform;var zt={renderWebGL:function(t,e,i,s){e.updateData();var r=i.camera;r.addToRenderList(e);for(var a,h=Vt(e,r,s,!i.useCanvas).calc,n=e._displayOriginX,o=e._displayOriginY,l=e.alpha,d=e.customRenderNodes.Submitter||e.defaultRenderNodes.Submitter,u=e.geom,c=0,p=u.length;c<p;c++)(a=u[c]).visible&&a.webglRender(i,d,h,e,l,n,o)},renderCanvas:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.currentContext;if(jt(t,r,e,i,s)){for(var a,h=e._displayOriginX,n=e._displayOriginY,o=e.geom,l=0,d=o.length;l<d;l++)(a=o[l]).visible&&a.canvasRender(r,h,n);r.restore()}}};const Gt=Phaser.GameObjects.Shape,It=Phaser.Utils.Array.Remove;class Bt extends Gt{constructor(t,e,i,s,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),super(t,"rexShapes",[]),this._width=-1,this._height=-1,this.dirty=!0,this.isSizeChanged=!0,this.shapes={},this.setPosition(e,i),this.setSize(s,r),this.updateDisplayOrigin()}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setDirty(t){return void 0===t&&(t=!0),this.dirty=t,this}setSize(t,e){this.isSizeChanged=this.isSizeChanged||this._width!==t||this._height!==e,this.dirty=this.dirty||this.isSizeChanged,this._width=t,this._height=e,this.updateDisplayOrigin();var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}get fillColor(){return this._fillColor}set fillColor(t){this.setFillStyle(t,this._fillAlpha)}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this.setFillStyle(this._fillColor,t)}setFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.fillColor!==t||this.fillAlpha!==e,this._fillColor=t,this._fillAlpha=e,this}get lineWidth(){return this._lineWidth}set lineWidth(t){this.setStrokeStyle(t,this._strokeColor,this._strokeAlpha)}get strokeColor(){return this._strokeColor}set strokeColor(t){this.setStrokeStyle(this._lineWidth,t,this._strokeAlpha)}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this.setStrokeStyle(this._lineWidth,this._strokeColor,t)}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.lineWidth!==t||this.strokeColor!==e||this.strokeAlpha!==i,this._lineWidth=t,this._strokeColor=e,this._strokeAlpha=i,this}updateShapes(){}updateData(){if(!this.dirty)return this;this.updateShapes();for(var t=this.geom,e=0,i=t.length;e<i;e++){var s=t[e];s.dirty&&s.updateData()}return this.isSizeChanged=!1,this.dirty=!1,this}clear(){return this.geom.length=0,yt(this.shapes),this.dirty=!0,this}getShape(t){return this.shapes[t]}getShapes(){return this.geom}addShape(t){this.geom.push(t);var e=t.name;return e&&(this.shapes[e]=t),this.dirty=!0,this}deleteShape(t){var e=this.getShape(t);return e&&(delete this.shapes[t],It(this.geom,e)),this}}Object.assign(Bt.prototype,zt);var Nt={setEventEmitter(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const Wt=Phaser.Scene;var Ut=function(t){return t instanceof Wt};const Ht=Phaser.Game;var Jt=function(t){return t instanceof Ht};const Kt=Phaser.Utils.Objects.GetValue;class $t{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(Kt(e,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this))}shutdown(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){var e;return this.parent=t,this.scene=null==(e=t)||"object"!=typeof e?null:Ut(e)?e:e.scene&&Ut(e.scene)?e.scene:e.parent&&e.parent.scene&&Ut(e.parent.scene)?e.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:Jt(t)?t:Jt(t.game)?t.game:Ut(t)?t.sys.game:Ut(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign($t.prototype,Nt);const qt=Phaser.Utils.Objects.GetValue;class Qt extends $t{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(qt(e,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=Zt[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const Zt={no:0,lazy:1,always:2},te=Phaser.Utils.Objects.GetValue;class ee extends Qt{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=te(e,"tickEventName",i),this.isSceneTicker=!ie(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this)}}var ie=function(t){return"step"===t||"poststep"===t};const se=Phaser.Utils.Objects.GetValue,re=Phaser.Math.Clamp;class ae{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=se(t,"state",he),this.timeScale=se(t,"timeScale",1),this.delay=se(t,"delay",0),this.repeat=se(t,"repeat",0),this.repeatCounter=se(t,"repeatCounter",0),this.repeatDelay=se(t,"repeatDelay",0),this.duration=se(t,"duration",0),this.nowTime=se(t,"nowTime",0),this.justRestart=se(t,"justRestart",!1)}toJSON(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?oe:ne,this.repeatCounter=0,this}stop(){return this.state=he,this}update(t,e){this.state!==he&&this.state!==de&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter<this.repeat?(this.repeatCounter++,this.justRestart=!0,this.nowTime-=this.duration,this.repeatDelay>0&&(this.nowTime-=this.repeatDelay,this.state=le)):(this.nowTime=this.duration,this.state=de):this.nowTime>=0&&(this.state=oe))}get t(){var t;switch(this.state){case he:case ne:case le:t=0;break;case oe:t=this.nowTime/this.duration;break;case de:t=1}return re(t,0,1)}set t(t){(t=re(t,-1,1))<0?(this.state=ne,this.nowTime=-this.delay*t):(this.state=oe,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===he}get isDelay(){return this.state===ne}get isCountDown(){return this.state===oe}get isRunning(){return this.state===ne||this.state===oe}get isDone(){return this.state===de}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const he=0,ne=1,oe=2,le=3,de=-1;class ue extends ee{constructor(t,e){super(t,e),this.timer=new ae}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const ce=Phaser.Utils.Objects.GetValue,pe=Phaser.Utils.Objects.GetAdvancedValue,ve=Phaser.Tweens.Builders.GetEaseFunction;class ye extends ue{resetFromJSON(t){return this.timer.resetFromJSON(ce(t,"timer")),this.setEnable(ce(t,"enable",!0)),this.setTarget(ce(t,"target",this.parent)),this.setDelay(pe(t,"delay",0)),this.setDuration(pe(t,"duration",1e3)),this.setEase(ce(t,"ease","Linear")),this.setRepeat(ce(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ve(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const ge=Phaser.Utils.Objects.GetValue,fe=Phaser.Math.Linear;class me extends ye{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ge(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ge(t,"from",i),this.toValue=ge(t,"to",i),this.setEase(ge(t,"ease",this.ease)),this.setDuration(ge(t,"duration",this.duration)),this.setRepeat(ge(t,"repeat",0)),this.setDelay(ge(t,"delay",0)),this.setRepeatDelay(ge(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=fe(this.fromValue,this.toValue,i)}}var Se={start:function(t){return this.easeValueTask||(this.easeValueTask=new me(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const Pe=Phaser.Utils.Objects.GetValue;class Ce extends Bt{constructor(t,e){super(t,Pe(e,"x",0),Pe(e,"y",0),Pe(e,"width",64),Pe(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Pe(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Pe(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Pe(t,"ease",i)),i=e?0:this.delay,this.setDelay(Pe(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Pe(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Pe(t,"color",i)),i=e?0:this.value,this.setValue(Pe(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(Ce.prototype,Se);var be={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},De={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,a=i,h=0;h<s.length;h++){if(e=s[h],!r.hasOwnProperty(e)){a=i;break}r=a=r[e]}return a}(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&yt(this.data),this}};class xe{constructor(){this.name=void 0,this.dirty=!0,this.visible=!0,this.data=void 0,this.isFilled=!1,this.fillColor=void 0,this.fillAlpha=1,this.isStroked=!1,this.lineWidth=1,this.strokeColor=void 0,this.strokeAlpha=1}setName(t){return this.name=t,this}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}reset(){return this.setVisible().fillStyle().lineStyle(),this}webglRender(t,e,i,s,r,a,h){}canvasRender(t,e,i){}updateData(){this.dirty=!1}}Object.assign(xe.prototype,be,De);var Ae=Phaser.Renderer.WebGL.Utils,Te=Phaser.Renderer.WebGL.Utils,we=function(t,e,i,s){var r=i||e.fillColor,a=s||e.fillAlpha,h=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+n+","+o+","+a+")"},ke=function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,h=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+n+","+o+","+a+")",t.lineWidth=e.lineWidth};const _e=Phaser.Geom.Polygon.Earcut;class Le extends xe{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=_e(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r,a,h){this.isFilled&&function(t,e,i,s,r,a,h,n){var o,l,d,u,c,p=Ae.getTintAppendFloatAlpha(r.fillColor,r.fillAlpha*a),v=r.pathData,y=r.pathIndexes,g=v.length,f=Array(2*g),m=Array(g),S=0,P=0;for(o=0;o<g;o+=2)l=v[o]-h,d=v[o+1]-n,u=i.getX(l,d),c=i.getY(l,d),f[S++]=u,f[S++]=c,m[P++]=p;e.batch(t,y,f,m)}(t,e,i,0,this,r,a,h),this.isStroked&&function(t,e,i,s,r,a,h,n){var o=Te.getTintAppendFloatAlpha(r.strokeColor,r.strokeAlpha*a),l=r.pathData,d=l.length-1,u=r.lineWidth,c=!r.closePath,p=s.customRenderNodes.StrokePath||s.defaultRenderNodes.StrokePath,v=[];c&&(d-=2);for(var y=0;y<d;y+=2){var g=l[y]-h,f=l[y+1]-n;y>0&&g===l[y-2]&&f===l[y-1]||v.push({x:g,y:f,width:u})}p.run(t,e,v,u,c,i,o,o,o,o)}(t,e,i,s,this,r,a,h)}canvasRender(t,e,i){var s=this.pathData,r=s.length-1,a=s[0]-e,h=s[1]-i;t.beginPath(),t.moveTo(a,h),this.closePath||(r-=2);for(var n=2;n<r;n+=2){var o=s[n]-e,l=s[n+1]-i;t.lineTo(o,l)}this.closePath&&t.closePath(),this.isFilled&&(we(t,this),t.fill()),this.isStroked&&(ke(t,this),t.stroke())}}var Re=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const Me=Phaser.Math.DegToRad;var Xe=function(t,e,i,s,r,a,h,n,o){h&&a>r?a-=360:!h&&a<r&&(a+=360);var l=Me(a-r)/n;r=Me(r);for(var d=0;d<=n;d++){var u=r+l*d,c=t+i*Math.cos(u),p=e+s*Math.sin(u);Re(c,p,o)}return o};const Ye=Phaser.Math.Interpolation.QuadraticBezier,Ee=Phaser.Math.Interpolation.CubicBezier,Fe=Phaser.Math.Interpolation.CatmullRom;var Oe=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},Ve={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),Re(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,a,h){return void 0===h&&(h=!1),Xe(t,e,i,s,r,a,h,this.iterations,this.pathData),this.lastPointX=this.pathData[this.pathData.length-2],this.lastPointY=this.pathData[this.pathData.length-1],this},arc(t,e,i,s,r,a){return this.ellipticalArc(t,e,i,i,s,r,a),this},quadraticBezierTo(t,e,i,s){return function(t,e,i,s,r,a){for(var h=a.length,n=a[h-2],o=a[h-1],l=1,d=r-1;l<=d;l++){var u=l/d;a.push(Ye(u,n,t,i),Ye(u,o,e,s))}}(t,e,i,s,this.iterations,this.pathData),this.lastPointX=i,this.lastPointY=s,this},cubicBezierTo(t,e,i,s,r,a){return function(t,e,i,s,r,a,h,n){for(var o=n.length,l=n[o-2],d=n[o-1],u=1,c=h-1;u<=c;u++){var p=u/c;n.push(Ee(p,l,t,i,r),Ee(p,d,e,s,a))}}(t,e,i,s,r,a,this.iterations,this.pathData),this.lastPointX=r,this.lastPointY=a,this},catmullRomTo(...t){return function(t,e,i){for(var s=i.length,r=[i[s-2]],a=[i[s-1]],h=0,n=t.length;h<n;h+=2)r.push(t[h]),a.push(t[h+1]);h=1;for(var o=e-1;h<=o;h++){var l=h/o;i.push(Fe(r,l),Fe(a,l))}}(t,this.iterations,this.pathData),this.lastPointX=t[t.length-2],this.lastPointY=t[t.length-1],this},close(){var t=this.pathData[0],e=this.pathData[1];return t===this.lastPointX&&e===this.lastPointY||this.lineTo(t,e),this.closePath=!0,this},end(){return Oe(this.pathData),this}};const je=Phaser.Math.RotateAround,ze=Phaser.Math.DegToRad;Phaser.Math.RotateAround;var Ge={rotateAround(t,e,i){if(0===this.pathData.length)return this;!function(t,e,i,s){for(var r={x:0,y:0},a=0,h=s.length-1;a<h;a+=2)r.x=s[a],r.y=s[a+1],je(r,t,e,i),s[a]=r.x,s[a+1]=r.y}(t,e,i=ze(i),this.pathData);var s=this.pathData.length;return this.lastPointX=this.pathData[s-2],this.lastPointY=this.pathData[s-1],this},scale(t,e,i,s){return 0===this.pathData.length||(function(t,e,i,s,r){for(var a=0,h=r.length-1;a<h;a+=2){var n=r[a]-t,o=r[a+1]-e;n*=i,o*=s,r[a]=n+t,r[a+1]=o+e}}(t,e,i,s,this.pathData),this.lastPointX=this.pathData[pathDataCnt-2],this.lastPointY=this.pathData[pathDataCnt-1]),this},offset(t,e){return function(t,e,i){for(var s=0,r=i.length-1;s<r;s+=2)i[s]+=t,i[s+1]+=e}(t,e,this.pathData),this}},Ie={savePathData(){return this.pathDataSaved||(this.pathDataSave=[...this.pathData],this.pathData.length=0,this.pathDataSaved=!0),this},restorePathData(){return this.pathDataSaved?(function(t,e,i,s){void 0===i&&(i=0),void 0===s&&(s=e.length),t.length=s-i;for(var r=0,a=t.length;r<a;r++)t[r]=e[r+i]}(this.pathData,this.pathDataSave),this.pathDataSave=void 0,this.pathDataSaved=!1,this):this}};const Be=Phaser.Math.Distance.Between,Ne=P