@petkoneo/phaser3-rex-plugins
Version:
1 lines • 52.8 kB
JavaScript
var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.Mesh;class e extends t{get tint(){return 0===this.vertices.length?16777215:this.vertices[0].color}forceUpdate(){return this.dirtyCache[10]=1,this}}const i=Phaser.Math.Vector3,s=Phaser.Math.Matrix4;var r=new i,n=new i,a=new s;const h=Phaser.Utils.Objects.IsPlainObject,o=Phaser.Utils.Objects.GetValue,l=Phaser.Geom.Mesh.GenerateGridVerts,c=Phaser.Math.RadToDeg,u=Phaser.Math.DegToRad,d=1+1/Math.sin(u(45));class p extends e{constructor(t,e,i,s,r,n){h(e)&&(e=o(n=e,"x",0),i=o(n,"y",0),s=o(n,"key",null),r=o(n,"frame",null)),super(t,e,i,s,r),this.type="rexPerspectiveImage",this.setSizeToFrame(),this.resetPerspective(),this.panZ(d),this.hideCCW=o(n,"hideCCW",!0);var a=o(n,"gridWidth",0),l=o(n,"gridHeight",a);this.resetVerts(a,l),this.prevFrame=this.frame}preUpdate(t,e){this.prevFrame!==this.frame&&(this.prevFrame=this.frame,this.syncSize()),super.preUpdate(t,e)}get originX(){return.5}get originY(){return.5}resetPerspective(){return this.setPerspective(this.width,this.height,45),this}resetVerts(t,e){if(void 0!==t&&(this.gridWidth=t),void 0!==e&&(this.gridHeight=e),this.clear(),this.dirtyCache[9]=-1,0===this.width||0===this.height)return this;var i=this.frame.cutWidth,s=this.frame.cutHeight;0===this.gridWidth?t=Math.max(i/8,32):e=this.gridWidth,e=0===this.gridHeight?Math.max(s/8,32):this.gridHeight,l({mesh:this,width:i/this.height,height:s/this.height,widthSegments:Math.ceil(i/t),heightSegments:Math.ceil(s/e)});var r=this.transformInfo;return r&&this.transformVerts(r.x,r.y,r.z,r.rotateX,r.rotateY,r.rotateZ),this}syncSize(){return this.setSizeToFrame(),this.resetPerspective(),this.resetVerts(),this}get rotationX(){return this.modelRotation.x}set rotationX(t){this.modelRotation.x=t}get angleX(){return c(this.rotationX)}set angleX(t){this.rotationX=u(t)}get rotationY(){return this.modelRotation.y}set rotationY(t){this.modelRotation.y=t}get angleY(){return c(this.rotationY)}set angleY(t){this.rotationY=u(t)}get rotationZ(){return this.modelRotation.z}set rotationZ(t){this.modelRotation.z=t}get angleZ(){return c(this.rotationZ)}set angleZ(t){this.rotationZ=u(t)}transformVerts(t,e,i,s,h,o){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===h&&(h=0),void 0===o&&(o=0),this.transformInfo||(this.transformInfo={}),this.transformInfo.x=t,this.transformInfo.y=e,this.transformInfo.rotateX=s,this.transformInfo.rotateY=h,this.transformInfo.rotateZ=o,function(t,e,i,s,h,o,l){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===h&&(h=0),void 0===o&&(o=0),void 0===l&&(l=0),r.set(e,i,s),n.set(h,o,l),a.fromRotationXYTranslation(n,r,!0);for(var c=0,u=t.vertices.length;c<u;c++)t.vertices[c].transformMat4(a)}(this,t,e,i,s,h,o),this}}function v(t,e,i,s,r){var n=new p(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n}const g=Phaser.Utils.Objects.GetAdvancedValue,y=Phaser.GameObjects.BuildGameObject;function f(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=g(t,"key",null),s=g(t,"frame",null),r=new p(this.scene,0,0,i,s,t);return y(this.scene,r,t),r}const m=Phaser.Textures.DynamicTexture;var C=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},x=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const P=Phaser.Geom.Rectangle,b=Phaser.Math.Vector2,R=Phaser.Math.RotateAround,w=Phaser.GameObjects.Container;var S=function(t,e){if(void 0===e?e=new P:!0===e&&(void 0===F&&(F=new P),e=F),t.getBounds&&!(t instanceof w))return t.getBounds(e);var i,s,r,n,a,h,o,l;if(t.parentContainer){var c=t.parentContainer.getBoundsTransformMatrix();A(t,e),c.transformPoint(e.x,e.y,e),i=e.x,s=e.y,L(t,e),c.transformPoint(e.x,e.y,e),r=e.x,n=e.y,T(t,e),c.transformPoint(e.x,e.y,e),a=e.x,h=e.y,O(t,e),c.transformPoint(e.x,e.y,e),o=e.x,l=e.y}else A(t,e),i=e.x,s=e.y,L(t,e),r=e.x,n=e.y,T(t,e),a=e.x,h=e.y,O(t,e),o=e.x,l=e.y;return e.x=Math.min(i,r,a,o),e.y=Math.min(s,n,h,l),e.width=Math.max(i,r,a,o)-e.x,e.height=Math.max(s,n,h,l)-e.y,e},F=void 0,A=function(t,e,i){return void 0===e?e=new b:!0===e&&(void 0===k&&(k=new b),e=k),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-C(t)*t.originX,e.y=t.y-x(t)*t.originY,E(t,e,i))},L=function(t,e,i){return void 0===e?e=new b:!0===e&&(void 0===k&&(k=new b),e=k),t.getTopRight?t.getTopRight(e):(e.x=t.x-C(t)*t.originX+C(t),e.y=t.y-x(t)*t.originY,E(t,e,i))},T=function(t,e,i){return void 0===e?e=new b:!0===e&&(void 0===k&&(k=new b),e=k),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-C(t)*t.originX,e.y=t.y-x(t)*t.originY+x(t),E(t,e,i))},O=function(t,e,i){return void 0===e?e=new b:!0===e&&(void 0===k&&(k=new b),e=k),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-C(t)*t.originX+C(t),e.y=t.y-x(t)*t.originY+x(t),E(t,e,i))},k=void 0,E=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&R(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const Y=Phaser.Geom.Rectangle,D=Phaser.Geom.Rectangle.Union;var j,M=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}: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]}(e),i){e.length=t.length;for(var s=0,r=t.length;s<r;s++)e[s]=t[s]}else for(var n in t)e[n]=t[n];return e},_=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 n=t[s];if(n.displayList?i=n.displayList:n.parentContainer&&(i=n.parentContainer.list),i)break}return i||(i=n.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};const X=Phaser.GameObjects.GameObject,V=Phaser.GameObjects.Layer;var G=Phaser.Utils.Objects.GetValue,I=function(t){if(t){var e,i,s=t.gameObjects,r=t.renderTexture,n=t.saveTexture,a=G(t,"x",void 0),h=G(t,"y",void 0),o=G(t,"width",void 0),l=G(t,"height",void 0),c=G(t,"originX",0),u=G(t,"originY",0),d=G(t,"padding",0);if(void 0===o||void 0===l||void 0===a||void 0===h){var p=function(t,e){var i;void 0===e?e=new Y:!0===e&&(void 0===j&&(j=new Y),e=j),e.setTo(0,0,0,0);for(var s=!0,r=0,n=t.length;r<n;r++)if((i=t[r]).getBounds){var a=S(i,!0);s?(e.setTo(a.x,a.y,a.width,a.height),s=!1):D(a,e,e)}return e}(s,!0);void 0!==a&&void 0!==h?(o=2*Math.max(a-p.left,p.right-a),l=2*Math.max(h-p.top,p.bottom-h),c=.5,u=.5):(a=p.x,h=p.y,o=p.width,l=p.height,c=0,u=0),e=p.x,i=p.y}else e=a+(0-c)*o,i=h+(0-u)*l;e-=d,i-=d,o+=2*d,l+=2*d;var v,g=s[0].scene,y=g.sys.textures;return n&&!r&&(r=y.addDynamicTexture(n,o,l)),r||(r=g.add.renderTexture(0,0,o,l)),r.setPosition&&r.setPosition(a,h),r.width===o&&r.height===l||r.setSize(o,l),r.setOrigin&&r.setOrigin(c,u),r.camera.setScroll(e,i),s=_(M(s)),r.draw(s),n&&((v=r)instanceof X||v instanceof V?r.saveTexture(n):r.key!==n&&y.renameTexture(r.key,key)),r}};const B=Phaser.Utils.Objects.IsPlainObject,U=Phaser.Utils.Objects.GetValue;let Z=class extends p{constructor(t,e,i,s,r,n){B(e)&&(e=U(n=e,"x",0),i=U(n,"y",0),s=U(n,"width",32),r=U(n,"height",32));var a=function(t,e,i){return void 0===e&&(e=2),void 0===i&&(i=2),new m(t.sys.textures,null,e,i)}(t,s,r);super(t,e,i,a,null,n),this.type="rexPerspectiveRenderTexture",this.rt=this.texture}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.rt.destroy(),this.rt=null)}snapshot(t,e){return void 0===e&&(e={}),e.gameObjects=t,e.renderTexture=this.rt,I(e),this.width===this.frame.realWidth&&this.height===this.frame.realHeight||this.syncSize(),this}};function N(t,e,i,s,r){var n=new Z(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n}const W=Phaser.Utils.Objects.GetAdvancedValue,z=Phaser.GameObjects.BuildGameObject;function H(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=W(t,"width",32),s=W(t,"height",32),r=new Z(this.scene,0,0,i,s,t);return z(this.scene,r,t),r}const J=Phaser.Animations.AnimationState,$=Phaser.Utils.Objects.IsPlainObject,q=Phaser.Utils.Objects.GetValue;class K extends p{constructor(t,e,i,s,r,n){$(e)&&(e=q(n=e,"x",0),i=q(n,"y",0),s=q(n,"key",null),r=q(n,"frame",null)),super(t,e,i,s,r,n),this.type="rexPerspectiveSprite",this.anims=new J(this)}preDestroy(){super.preDestroy(),this.anims.destroy(),this.anims=void 0}preUpdate(t,e){this.anims.update(t,e),super.preUpdate(t,e)}play(t,e,i){return this.anims.play(t,e,i)}playReverse(t,e){return this.anims.playReverse(t,e)}playAfterDelay(t,e){return this.anims.playAfterDelay(t,e)}playAfterRepeat(t,e){return this.anims.playAfterRepeat(t,e)}chain(t){return this.anims.chain(t)}stop(){return this.anims.stop()}stopAfterDelay(t){return this.anims.stopAfterDelay(t)}stopAfterRepeat(t){return this.anims.stopAfterRepeat(t)}stopOnFrame(t){return this.anims.stopOnFrame(t)}}function Q(t,e,i,s,r){var n=new K(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n}const tt=Phaser.Utils.Objects.GetAdvancedValue,et=Phaser.GameObjects.BuildGameObject;function it(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=tt(t,"key",null),s=tt(t,"frame",null),r=new K(this.scene,0,0,i,s,t);return et(this.scene,r,t),r}var st=!1;!function(t){if(!st){void 0===t&&(t=60);var e=Phaser.VERSION.split("."),i=parseInt(e[0]);if(3===i){var s=parseInt(e[1]);s<t&&console.error(`Minimum supported version : ${i}.${s}`)}else console.error(`Can't supported version : ${i}`);st=!0}}();const rt=Phaser.GameObjects.Zone,nt=Phaser.Utils.Array.Add,at=Phaser.Utils.Array.Remove;class ht extends rt{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 nt(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return at(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 ot=Phaser.GameObjects.Components;Phaser.Class.mixin(ht,[ot.Alpha,ot.Flip]);var lt=function(t,e){var i;if(void 0===e)t.hasOwnProperty("rexContainer")&&(i=t.rexContainer.parent);else for(i=lt(t);i&&i.name!==e;)i=lt(i);return i};const ct=Phaser.Math.DegToRad,ut=Phaser.Math.RadToDeg;var dt=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 ut(this.rotation)},set:function(t){this.rotation=ct(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},pt={setParent(t,e){void 0===e&&(e=this);var i=dt(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),lt(t,e)},getTopmostParent(t){return void 0===t&&(t=this),function(t){for(var e=lt(t);e;)t=e,e=lt(e);return t}(t)}};const vt=Phaser.Utils.Objects.GetValue,gt=ht.prototype.add;var yt=function(t,e){this.setParent(t);var i=dt(t);return mt(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t).updateCameraFilter(t),gt.call(this,t),Ct.call(this,t,i),this},ft=function(t,e){this.setParent(t);var i=dt(t);return mt(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),gt.call(this,t),Ct.call(this,t,i),this},mt=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=vt(e,"syncPosition",!0),t.syncRotation=vt(e,"syncRotation",!0),t.syncScale=vt(e,"syncScale",!0),t.syncAlpha=vt(e,"syncAlpha",!0),t.syncScrollFactor=vt(e,"syncScrollFactor",!0),t.syncCameraFilter=vt(e,"syncCameraFilter",!0),t.syncDisplayList=vt(e,"syncDisplayList",!0))},Ct=function(t,e){this.addToParentContainer(t),e.syncDisplayList&&this.addToPatentLayer(t),this.addToRenderLayer(t)},xt={add(t){return Array.isArray(t)?this.addMultiple(t):yt.call(this,t),this},pin(t,e){return Array.isArray(t)?this.addMultiple(t,e):yt.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):ft.call(this,t),this},pinLocal(t,e){return Array.isArray(t)?this.addMultiple(t,e):ft.call(this,t,e),this},addLocalMultiple(t){for(var e=0,i=t.length;e<i;e++)ft.call(this,t[e]);return this}};const Pt=ht.prototype.remove,bt=ht.prototype.clear;var Rt={remove(t,e){return lt(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),Pt.call(this,t,e)),this},unpin(t,e){return lt(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),Pt.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 bt.call(this,t),this}},wt={getLocalState:t=>dt(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}},St={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}},Ft=function(t,e){return t===e?1:t/e},At={updateChildPosition(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=dt(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=dt(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=Ft(t.scaleX,i.scaleX),e.scaleY=Ft(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=dt(t);return s.x=e,s.y=i,this.updateChildPosition(t),this},resetLocalPositionState(){var t=dt(this).parent;return t&&t.resetChildPositionState(this),this},getChildLocalX:t=>dt(t).x,getChildLocalY:t=>dt(t).y};const Lt=Phaser.Math.DegToRad;var Tt={updateChildRotation(t){var e=dt(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=dt(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 dt(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return dt(t).rotation=Lt(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=dt(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>dt(t).rotation},Ot={updateChildScale(t){var e=dt(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=dt(t),i=e.parent;return e.scaleX=Ft(t.scaleX,i.scaleX),e.scaleY=Ft(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=dt(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=dt(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>dt(t).scaleX,getChildLocalScaleY:t=>dt(t).scaleY},kt={updateChildVisible(t){var e=dt(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=dt(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),dt(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),dt(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=dt(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>dt(t).visible},Et={updateChildAlpha(t){var e=dt(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=dt(t),i=e.parent;return e.alpha=Ft(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return dt(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=dt(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>dt(t).alpha},Yt={updateChildActive(t){var e=dt(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 dt(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),dt(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=dt(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>dt(t).active},Dt={updateChildScrollFactor(t){var e=dt(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}},jt={updateCameraFilter(t){var e=dt(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Mt={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}},_t=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},Xt={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]);_(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]);_(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]);_(i,!1);for(var s=0,r=i.length;s<r;s++){var n=i[s];if(e.exists(n)){e.moveBelow(t,n);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]);_(i,!0);for(var s=0,r=i.length;s<r;s++){var n=i[s];if(e.exists(n)){e.moveAbove(t,n);break}}return this},moveMyDepthAbove(t){return this.moveDepthAbove(t)},bringChildToTop(t){var e;t!==this&&t.isRexContainerLite?(e=t.getAllChildren([t]),e=_t(e),e=_(e,!1)):e=[t];var i=this.getAllChildren([this]);i=_t(i);for(var s=(i=_(i,!1))[i.length-1],r=0,n=e.length;r<n;r++){var a=e[r];s!==a&&(a!==this&&s.displayList!==a.displayList||(s.displayList.moveAbove(a,s),s=a))}return this},sendChildToBack(t){var e;t!==this&&t.isRexContainerLite?(e=t.getAllChildren([t]),e=_t(e),e=_(e,!1)):e=[t];var i=this.getAllChildren([this]);i=_t(i);for(var s=(i=_(i,!1))[0],r=e.length-1;r>=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Vt=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s<r;s++)Vt(i[s],e)},Gt=function(t,e){for(var i=[t];i.length>0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const It=Phaser.Utils.Array;var Bt={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 Gt(e,(function(i){i!==e&&t.push(i)})),t},getAllVisibleChildren(t){void 0===t&&(t=[]);var e=this;return Gt(e,(function(i){if(i!==e)return!i.visible||void t.push(i)})),t},bfs(t,e){return void 0===e&&(e=this),Gt(e,t),this},dfs(t,e){return void 0===e&&(e=this),Vt(e,t),this},contains(t){var e=lt(t);return!!e&&(e===this||this.contains(e))},getByName(t,e){if(e){for(var i,s,r=[this];r.length;)for(var n=0,a=(i=r.shift()).children.length;n<a;n++){if((s=i.children[n]).name===t)return s;s.isRexContainerLite&&r.push(s)}return null}return It.GetFirst(this.children,"name",t)},getRandom(t,e){return It.GetRandom(this.children,t,e)},getFirst(t,e,i,s){return It.GetFirstElement(this.children,t,e,i,s)},getAll(t,e,i,s){return It.GetAll(this.children,t,e,i,s)},count(t,e,i,s){return It.CountAllMatching(this.children,t,e,i,s)},swap(t,e){return It.Swap(this.children,t,e),this},setAll(t,e,i,s){return It.SetAll(this.children,t,e,i,s),this}},Ut=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},Zt=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()},Nt={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=Ut(e);var s=i.tweens.add(t);return s.on("update",Zt),s}},tweenSelf(t){return t.targets=[this],this.tweenChild(t)},createTweenChildConfig(t){var e=t.targets;e&&(Array.isArray(e)||(e=[e]),t.targets=Ut(e));var i=t.onUpdate;return t.onUpdate=function(t,e){i&&i(t,e),Zt(t,void 0,e)},t},tween(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}};const Wt=Phaser.GameObjects.Container,zt=Phaser.GameObjects.Layer;var Ht=function(t){return t instanceof zt},Jt=function(t){var e=t.getAllChildren([t]);return e=e.filter((function(t){return!!t.displayList||!!t.parentContainer}))},$t=function(t){var e=Jt(this);-1===e.indexOf(this)&&e.push(this),_(e),t.add(e)},qt=function(t,e,i){if(this.scene){var s=Jt(this);_(s,e),t.remove(s),i&&s.forEach((function(t){t.addToDisplayList()}))}},Kt={addToContainer(t){return t instanceof Wt?(this._setParentContainerFlag=!0,$t.call(this,t),this._setParentContainerFlag=!1,this):this},addToLayer(t){return Ht(t)?($t.call(this,t),this):this},removeFromContainer(){return this.parentContainer?(this._setParentContainerFlag=!0,qt.call(this,this.parentContainer,!0,!1),this._setParentContainerFlag=!1,this):this},removeFromLayer(t){return void 0===t&&(t=!0),Ht(this.displayList)?(qt.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||Ht(e)&&(t.isRexContainerLite?t.addToLayer(e):e.add(t)),this}},Qt={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),dt(t).layer=e),this):this},removeFromRenderLayer(t){var e=dt(t),i=e.layer;return i?(t.isRexContainerLite?t.removeFromLayer(!0):i.remove(t),e.layer=null,this):this}},te={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=I(t),n=!!r.scene;return s||(this.setScale(e,i),n&&r.setScale(e,i)),n?r:this}};const ee=Phaser.Utils.Objects.GetValue;var ie=function(t,e,i,s,r,n,a){if(t.getBounds||void 0!==t.width&&void 0!==t.height){void 0===i&&(i=16777215),void 0===s&&(s=1),void 0===r&&(r=null),void 0===n&&(n=1),void 0===a&&(a=0);var h=A(t,se[0]);h.x-=a,h.y-=a;var o=L(t,se[1]);o.x+=a,o.y-=a;var l=O(t,se[2]);l.x+=a,l.y+=a;var c=T(t,se[3]);c.x-=a,c.y+=a,null!==r&&e.fillStyle(r,n).fillPoints(se,!0,!0),null!==i&&e.lineStyle(s,i).strokePoints(se,!0,!0)}},se=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}];const re=Phaser.Utils.Objects.GetValue,ne=Phaser.Math.RotateAround;var ae={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};ne(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=re(e,"drawContainer",!0),s=re(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,n,a,h;if("number"==typeof i?s=i:(s=ee(i,"color"),r=ee(i,"lineWidth"),n=ee(i,"fillColor"),a=ee(i,"fillAlpha",1),h=ee(i,"padding",0)),Array.isArray(t))for(var o=0,l=t.length;o<l;o++)ie(t[o],e,s,r,n,a,h);else ie(t,e,s,r,n,a,h)}(s,t,e),this}};Object.assign(ae,pt,xt,Rt,wt,St,At,Tt,Ot,kt,Et,Yt,Dt,jt,Mt,Xt,Bt,Nt,Kt,Qt,te);class he extends ht{constructor(t,e,i,s,r,n){Array.isArray(s)&&(n=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,n&&this.add(n)}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 lt(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=lt(this);return!!t&&t.setParentContainerFlag}}Object.assign(he.prototype,ae);var oe=function(t,e,i,s){if(Array.isArray(t))for(var r=0,n=t.length;r<n;r++){var a=t[r];if((!s||a)&&(i?e.call(i,a,r,t):e(a,r,t)))return}else for(var h in t)if(a=t[h],(!s||a)&&(i?e.call(i,a,h,t):e(a,h,t)))return};const le=Phaser.Math.RadToDeg,ce=Phaser.Math.DegToRad;class ue extends he{constructor(t,e,i,s,r,n){super(t,e,i,s,r),this.faces=n,oe(n,(function(t){t.setPosition(e,i),this.add(t)}),this,!0)}get rotationX(){return 0}set rotationX(t){}get angleX(){return le(this.rotationX)}set angleX(t){this.rotationX=ce(t)}get rotateX(){return le(this.rotationX)}set rotateX(t){this.rotationX=ce(t)}get rotationY(){return 0}set rotationY(t){}get angleY(){return le(this.rotationY)}set angleY(t){this.rotationY=ce(t)}get rotateY(){return le(this.rotationY)}set rotateY(t){this.rotationY=ce(t)}get rotationZ(){return 0}set rotationZ(t){}get angleZ(){return le(this.rotationZ)}set angleZ(t){this.rotationZ=ce(t)}get rotateZ(){return le(this.rotationZ)}set rotateZ(t){this.rotationZ=ce(t)}setDebug(t,e){return oe(this.faces,(function(i){i.setDebug(t,e)}),null,!0),this}panX(t){return oe(this.faces,(function(e){e.panX(t)}),null,!0),this}panY(t){return oe(this.faces,(function(e){e.panY(t)}),null,!0),this}panZ(t){return oe(this.faces,(function(e){e.panZ(t)}),null,!0),this}transformVerts(t,e,i,s,r,n){return oe(this.faces,(function(a){a.transformVerts(t,e,i,s,r,n)}),null,!0),this}forEachFace(t,e,i){return oe(this.faces,t,e,i),this}}const de=Phaser.Utils.Objects.IsPlainObject,pe={key:"__WHITE"},ve={image:p,rendertexture:Z};var ge=function(t,e){var i;return void 0===e&&(e=pe),de(e)?(e.hasOwnProperty("type")||(e.hasOwnProperty("key")?e.type="image":e.hasOwnProperty("width")&&(e.type="rendertexture")),i=new ve[e.type](t,e),t.add.existing(i)):i=e,i},ye=function(t,e,i){var s;if(void 0===i){var r;s=[];for(var n=0,a=e.length;n<a;n++)h=(r=e[n])?ge(t,r):null,s.push(h)}else{var h,o;for(s={},n=0,a=i.length;n<a;n++)o=i[n],h=e.hasOwnProperty(o)?ge(t,e[o]):null,s[o]=h}return s};const fe=(0,Phaser.Math.DegToRad)(180);var me={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 Ce=Phaser.Scene;var xe=function(t){return t instanceof Ce};const Pe=Phaser.Game;var be=function(t){return t instanceof Pe};const Re=Phaser.Utils.Objects.GetValue;class we{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(Re(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:xe(e)?e:e.scene&&xe(e.scene)?e.scene:e.parent&&e.parent.scene&&xe(e.parent.scene)?e.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:be(t)?t:be(t.game)?t.game:xe(t)?t.sys.game:xe(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign(we.prototype,me);const Se=Phaser.Utils.Objects.GetValue;class Fe extends we{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(Se(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=Ae[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 Ae={no:0,lazy:1,always:2},Le=Phaser.Utils.Objects.GetValue;class Te extends Fe{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=Le(e,"tickEventName",i),this.isSceneTicker=!Oe(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 Oe=function(t){return"step"===t||"poststep"===t};const ke=Phaser.Utils.Objects.GetValue,Ee=Phaser.Math.Clamp;class Ye{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=ke(t,"state",De),this.timeScale=ke(t,"timeScale",1),this.delay=ke(t,"delay",0),this.repeat=ke(t,"repeat",0),this.repeatCounter=ke(t,"repeatCounter",0),this.repeatDelay=ke(t,"repeatDelay",0),this.duration=ke(t,"duration",0),this.nowTime=ke(t,"nowTime",0),this.justRestart=ke(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?Me:je,this.repeatCounter=0,this}stop(){return this.state=De,this}update(t,e){this.state!==De&&this.state!==Xe&&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=_e)):(this.nowTime=this.duration,this.state=Xe):this.nowTime>=0&&(this.state=Me))}get t(){var t;switch(this.state){case De:case je:case _e:t=0;break;case Me:t=this.nowTime/this.duration;break;case Xe:t=1}return Ee(t,0,1)}set t(t){(t=Ee(t,-1,1))<0?(this.state=je,this.nowTime=-this.delay*t):(this.state=Me,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===De}get isDelay(){return this.state===je}get isCountDown(){return this.state===Me}get isRunning(){return this.state===je||this.state===Me}get isDone(){return this.state===Xe}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const De=0,je=1,Me=2,_e=3,Xe=-1;class Ve extends Te{constructor(t,e){super(t,e),this.timer=new Ye}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 Ge=Phaser.Utils.Objects.GetValue,Ie=Phaser.Utils.Objects.GetAdvancedValue,Be=Phaser.Tweens.Builders.GetEaseFunction;class Ue extends Ve{resetFromJSON(t){return this.timer.resetFromJSON(Ge(t,"timer")),this.setEnable(Ge(t,"enable",!0)),this.setTarget(Ge(t,"target",this.parent)),this.setDelay(Ie(t,"delay",0)),this.setDuration(Ie(t,"duration",1e3)),this.setEase(Ge(t,"ease","Linear")),this.setRepeat(Ge(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=Be(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 Ze=Phaser.Utils.Objects.GetValue,Ne=Phaser.Math.Linear;class We extends Ue{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setEase(Ze(t,"ease","Cubic")),this.setFrontToBackDirection(Ze(t,"frontToBack",0)),this.setBackToFrontDirection(Ze(t,"backToFront",1)),this}setFrontToBackDirection(t){return"string"==typeof t&&(t=ze[t]),this.endAngleFB=0===t?180:-180,this}setBackToFrontDirection(t){return"string"==typeof t&&(t=ze[t]),this.endAngleBF=0===t?-180:180,this}start(t,e){if(this.timer.isRunning)return this;this.timer.setDelay(this.delay).setDuration(t);var i=e+1;return 0===this.parent.face?(this.startAngle=0,this.endAngle=this.endAngleFB*i):(this.startAngle=this.endAngleBF,this.endAngle=this.startAngle-this.endAngleBF*i),super.start(),this}flip(t,e){return this.isRunning||(void 0===t&&(t=this.duration),void 0===e&&(e=0),this.start(t,e),this.emit("start",this.parent,this),this.parent.currentFaceIndex=(this.parent.currentFaceIndex+e+1)%2),this}flipRight(t,e){return 0===this.parent.currentFaceIndex?this.setFrontToBackDirection(0):this.setBackToFrontDirection(0),this.flip(t,e),this}flipLeft(t,e){return 0===this.parent.currentFaceIndex?this.setFrontToBackDirection(1):this.setBackToFrontDirection(1),this.flip(t,e),this}updateTarget(t,e){var i=this.easeFn(e.t),s=Ne(this.startAngle,this.endAngle,i);0===t.orientation?t.angleY=s:t.angleX=s}}const ze={right:0,"left-to-right":0,left:1,"right-to-left":1},He=Phaser.Utils.Objects.IsPlainObject,Je=Phaser.Utils.Objects.GetValue,$e=["back","front"];class qe extends ue{constructor(t,e,i,s){He(e)&&(e=Je(s=e,"x",0),i=Je(s,"y",0));var r=ye(t,s,$e),n=r.back,a=r.front,h=Je(s,"width"),o=Je(s,"height");if(void 0===h||void 0===o){if(void 0===h){var l=a?a.width:0,c=n?n.width:0;h=Math.max(l,c)}if(void 0===o){var u=a?a.height:0,d=n?n.height:0;o=Math.max(u,d)}}super(t,e,i,h,o,r),this.type="rexPerspectiveCard",this.frontFaceRotationX=0,this.frontFaceRotationY=0,this.frontFaceRotationZ=0,oe(r,(function(t,e){this[`${e}Face`]=t}),this);var p=Je(s,"flip",void 0);!1!==p&&(this.flip=new We(this,p)),this.setOrientation(Je(s,"orientation",0)),function(t,e){var i=e.back;i&&(0===t.orientation?i.transformVerts(0,0,0,0,fe,0):i.transformVerts(0,0,0,fe,0,0))}(this,r),this.setFace(Je(s,"face",0))}get rotationX(){return this.frontFaceRotationX}set rotationX(t){this.frontFaceRotationX!==t&&(this.frontFaceRotationX=t,oe(this.faces,(function(e){e.rotationX=t}),null,!0))}get rotationY(){return this.frontFaceRotationY}set rotationY(t){this.frontFaceRotationY!==t&&(this.frontFaceRotationY=t,oe(this.faces,(function(e){e.rotationY=t}),null,!0))}get rotationZ(){return this.frontFaceRotationZ}set rotationZ(t){this.frontFaceRotationZ!==t&&(this.frontFaceRotationZ=t,oe(this.faces,(function(e){e.rotationZ=t}),null,!0))}setOrientation(t){return"string"==typeof t&&(t=Ke[t]),this.orientation=t,this}get face(){return this.currentFaceIndex}set face(t){"string"==typeof t&&(t=Qe[t]),this.currentFaceIndex=t;var e=1===t?180:0;0===this.orientation?this.angleY=e:this.angleX=e}setFace(t){return this.face=t,this}toggleFace(){var t=0===this.face?1:0;return this.setFace(t),this}}const Ke={x:0,horizontal:0,h:0,y:1,vertical:1,v:1},Qe={front:0,back:1};function ti(t,e,i){var s=new qe(this.scene,t,e,i);return this.scene.add.existing(s),s}const ei=Phaser.GameObjects.BuildGameObject;function ii(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new qe(this.scene,0,0,t);return ei(this.scene,i,t),i}var si=function(t,e){for(var i=0,s=t.length;i<s;i++)if(face&&face.name===e)return i;return-1};const ri=Phaser.Utils.Objects.GetValue,ni=Phaser.Math.RadToDeg,ai=Phaser.Math.DegToRad,hi=Phaser.Math.Angle.WrapDegrees,oi=Phaser.Math.Angle.ShortestBetween,li=Phaser.Math.Wrap,ci=Phaser.Math.Linear;let ui=class extends Ue{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setEase(ri(t,"ease","Cubic")),this}start(t){if(this.timer.isRunning)return this;this.timer.setDelay(this.delay).setDuration(this.duration);var e=this.parent;return this.startRotationY=e.rotationY,this.endRotationY=this.startRotationY+t,super.start(),this}to(t,e){if(this.isRunning)return this;var i=this.parent;"string"==typeof t&&-1===(t=si(i.faces,t))&&(t=0),t=li(t,0,i.faces.length),void 0!==e&&this.setDuration(e);var s=hi(ni(i.rotationY)),r=hi(ni((i.rtl?1:-1)*i.faceAngle*t)),n=oi(s,r);return this.start(ai(n)),i.currentFaceIndex=t,this}toNext(t){var e=this.parent.currentFaceIndex+1;return this.to(e,t),this}toPrevious(t){var e=this.parent.currentFaceIndex-1;return this.to(e,t),this}toRight(t){return this.parent.rtl?this.toPrevious(t):this.toNext(t),this}toLeft(t){return this.parent.rtl?this.toNext(t):this.toPrevious(t),this}updateTarget(t,e){var i=this.easeFn(e.t);t.rotationY=ci(this.startRotationY,this.endRotationY,i)}};const di=Phaser.Utils.Objects.IsPlainObject,pi=Phaser.Utils.Objects.GetValue,vi=Phaser.Math.DegToRad,gi=Phaser.Math.RadToDeg,yi=Phaser.Math.Angle.WrapDegrees,fi=Phaser.Math.Linear,mi=Phaser.Math.Wrap;class Ci extends ue{constructor(t,e,i,s){di(e)&&(e=pi(s=e,"x",0),i=pi(s,"y",0));var r=pi(s,"faces",void 0);r||(r=[]);var n=ye(t,r),a=function(t){for(var e,i=0,s=t.length;i<s&&!(e=t[i]);i++);return e}(n),h=pi(s,"width"),o=pi(s,"height");void 0===h&&(h=a?a.width:0),void 0===o&&(o=a?a.height:0),super(t,e,i,h,o,n),this.type="rexPerspectiveCarousel",this.face0RotationY=void 0;var l=n.length;this.faceAngle=l>0?vi(360/n.length):0;var c=pi(s,"faceWidth",void 0);if(void 0===c){var u=pi(s,"faceSpace",0);c=a?a.width+u:0}this.faceWidth=c,this.faceRadius=l>2?c/2/Math.tan(this.faceAngle/2):c/2,function(t,e){if(0!==t.faceWidth){var i=t.faceRadius;oe(e,(function(t){var e=i/t.height;t.transformVerts(0,0,e).panZ(e)}),null,!0)}}(this,n);var d=pi(s,"roll",void 0);if(!1!==d){var p=pi(s,"rollClass",ui);this.roll=new p(this,d)}this.rtl=pi(s,"rtl",!1),this.zStart=pi(s,"z",1),this.zEnd=pi(s,"zEnd",this.zStart-1),this.setFace(pi(s,"face",0))}get rotationY(){return this.face0RotationY}set rotationY(t){if(this.face0RotationY!==t){this.face0RotationY=t;var e=this.faceAngle,i=this.zStart,s=this.zEnd,r=this.rtl?-1:1;oe(this.faces,(function(n,a){var h=t+r*e*a;n.rotationY=h;var o=Math.abs(yi(gi(h))),l=fi(i,s,o/180);n.setDepth(l)}),null,!0)}}get face(){return this.currentFaceIndex}set face(t){"string"==typeof t&&-1===(t=si(this.faces,t))&&(t=0),t=mi(t,0,this.faces.length),this.currentFaceIndex=t,this.rotationY=(this.rtl?1:-1)*this.faceAngle*t}setFace(t){return this.face=t,this}}function xi(t,e,i){var s=new Ci(this.scene,t,e,i);return this.scene.add.existing(s),s}const Pi=Phaser.GameObjects.BuildGameObject;function bi(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new Ci(this.scene,0,0,t);return Pi(this.scene,i,t),i}class Ri extends ui{toNext(t){var e=this.parent;return!e.repeat&&e.isLastImage||this.isRunning||(e.setImageIndex(e.currentImageIndex+1),super.toNext(t).once("complete",e.updateTexture,e)),this}toPrevious(t){var e=this.parent;return!e.repeat&&e.isFirstImage||this.isRunning||(e.setImageIndex(e.currentImageIndex-1),super.toPrevious(t).once("complete",e.updateTexture,e)),this}}var wi={};const Si=Phaser.Utils.Objects.IsPlainObject,Fi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Math.Wrap;class Li extends Ci{constructor(t,e,i,s){var r,n;Si(e)&&(e=Fi(s=e,"x",0),i=Fi(s,"y",0)),void 0===s&&(s={});var a=Fi(s,"images"),h=function(t,e){if(!e)return null;if(Array.isArray(e)){var i=e[0],s=t.sys.textures.getFrame(i.key,i.frame);wi.width=s.cutWidth,wi.height=s.cutHeight}else wi.width=e.width,wi.height=e.height;return wi}(t,a);h?(r=h.width,n=h.height):(r=Fi(s,"width"),n=Fi(s,"height"));for(var o,l=Fi(s,"faceCount",4),c=[],u=0;u<l;u++)o=new Z(t,0,0,r,n,s),t.add.existing(o),c.push(o);s.faces=c,s.rollClass=Ri,super(t,e,i,s),this.type="rexPerspectiveImageCarousel",this.images=a,this.indexOffsetMap=function(t){for(var e=[0],i=1,s=Math.floor((t-1)/2);i<=s;i++)e.push(i),e.push(-i);return e}(l),this.repeat=Fi(s,"repeat",!0),this.setImageIndex(Fi(s,"index",0)).updateTexture()}setImageIndex(t){return this.currentImageIndex=Ai(t,0,this.images.length),this}get isFirstImage(){return 0===this.images.length||0===this.currentImageIndex}get isLastImage(){return 0===this.images.length||this.currentImageIndex===this.images.length-1}updateTexture(){var t=this.images.length,e=this.faces.length;return this.indexOffsetMap.forEach((function(i){var s=Ai(this.currentImageIndex+i,0,t),r=Ai(this.currentFaceIndex+i,0,e),n=this.images[s];this.faces[r].rt.drawFrame(n.key,n.frame)}),this),this}}function Ti(t,e,i){var s=new Li(this.scene,t,e,i);return this.scene.add.existing(s),s}const Oi=Phaser.GameObjects.BuildGameObject;function ki(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var