bard-legends-framework 1.11.1 → 1.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -42,4 +42,4 @@
42
42
  highestAlpha = centerColor.a;`,e+=`
43
43
 
44
44
  finalColor = vec4(uColor, 1.0) * highestAlpha;
45
- }`,e}constructor(t,e){if(super({glProgram:F__namespace.GlProgram.from({vertex:F__namespace.defaultFilterVert,fragment:n.ƀec(t*N)}),resources:{expandUniforms:{uColor:{value:new Float32Array(3),type:"vec3<f32>"},uExpandSquared:{value:0,type:"f32"}}},resolution:N}),this.ƀdf=t,this.ƀdf=t*N,this.ƀdf<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀdf>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");helpersLib.Comparator.isInteger(this.ƀdf)||(this.ƀdf=Math.floor(this.ƀdf));let i=helpersLib.ColorHelper.normalize(e);this.resources.expandUniforms.uniforms.uColor=new Float32Array([i.red,i.green,i.blue]),this.resources.expandUniforms.uniforms.uExpandSquared=this.ƀdf*this.ƀdf,this.padding=this.ƀdf;}};var Ee=class extends F__namespace.Filter{static{h(this,"GlowFilter");}constructor(t){super({resolution:N,compatibleRenderers:F__namespace.RendererType.WEBGL});let e={blurRadius:1,expand:0,color:helpersLib.ColorHelper.white,...t};this.ƀdg=new Se(e.expand,e.color);let i=helpersLib.Comparator.isNumber(e.blurRadius)?new helpersLib.Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀaj=new Bt(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀaj.blendMode="screen";}apply(t,e,i,r){let s=F__namespace.TexturePool.getSameSizeTexture(e);this.ƀdg.apply(t,e,s,true),this.ƀaj.apply(t,s,i,r),F__namespace.TexturePool.returnTexture(s);}};var Yt=class n{static{h(this,"GlowSpriteGenerator");}static{this.ƀew=new Map;}static createGlowSpriteFromSprite(t,e,i){let r=this.ƀbh(e),s=helpersLib.Comparator.isNumber(r.blurRadius)?new helpersLib.Vector(r.blurRadius,r.blurRadius):r.blurRadius,o=this.ƀee(t.texture,s,r.expand,r.color,i),a=new F__namespace.Sprite(o);return this.ƀjv(a,helpersLib.Vector.fromVec2(t.anchor),Math.max(s.x,s.y)+r.expand),a.alpha=r.glowAlpha,a.blendMode=r.blendMode,a}static ƀee(t,e,i,r,s){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(s){let o=`${t.id}-${i}-${e.x}-${e.y}-${r.r}-${r.g}-${r.b}`;if(n.ƀew.has(o))return n.ƀew.get(o);{let a=this.ƀef(t,e,i,r);return n.ƀew.set(o,a),a}}else return this.ƀef(t,e,i,r)}static ƀef(t,e,i,r){let s=new F__namespace.Sprite(t);s.filters=[new Ee({blurRadius:e,expand:i,color:r})];let o=new F__namespace.Container;o.addChild(s);let a=Math.max(e.x,e.y)+i,l=g.instance.renderer.generateTexture({target:o,frame:new F__namespace.Rectangle(-a,-a,s.width+a*2,s.height+a*2)});return l.id=M.insertAsset(l),o.destroy({children:true}),l}static ƀjv(t,e,i){let r=(i+(t.width-i*2)*e.x)/t.width,s=(i+(t.height-i*2)*e.y)/t.height;t.anchor.set(r,s);}static ƀbh(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:helpersLib.ColorHelper.white,blendMode:"add"};return t&&(e={...e,...t}),e}};E.onHardReset.subscribe(()=>{Yt.ƀew.clear();}).attachToRoot();var J=class n extends d{static{h(this,"Sprite");}static createByName(t){let e=g.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new n(e)}static createSnapshotSprite(t){let e=t.ƀip,i=e.parent;i&&i.removeChild(e);let r=g.instance.renderer.generateTexture({target:e,resolution:2,antialias:true,textureSourceOptions:{scaleMode:"linear"}});i&&i.addChild(e);let o={id:M.insertAsset(r),scale:t.scale,size:t.size,anchor:helpersLib.Vector.zero,destroyAssetOnDestroy:true};return new n(o,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀli=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀko=t,this.pixiSprite=new F__namespace.Sprite(M.getAsset(t.id)),this.ƀip.addChild(this.pixiSprite),this.setTextureScale(t.scale),e.textureSize&&(this.pixiSprite.width=e.textureSize.x,this.pixiSprite.height=e.textureSize.y),e.texturePosition&&this.pixiSprite.position.set(e.texturePosition.x,e.texturePosition.y),e.ignoreAnchor||this.pixiSprite.anchor.set(t.anchor.x,t.anchor.y);}destroy(){this.destroyed||(super.destroy(),this.ƀko.destroyAssetOnDestroy&&(M.destroyAsset(this.ƀko.id),this.ƀiq&&M.destroyAsset(this.ƀiq.texture.id)),this.ƀgr?.destroy(),this.ƀal?.destroy(),this.ƀiq&&!this.ƀiq.destroyed&&this.ƀiq.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀli}set textureScale(t){this.ƀli=t,this.pixiSprite.scale.set(t);}get size(){return new helpersLib.Vector(this.pixiSprite.width,this.pixiSprite.height)}getMask(){return this.pixiSprite}set interactive(t){super.interactive=t,t&&this.ƀko.boundingShapes&&!this.ƀip.hitArea&&(this.ƀip.hitArea=new hs(this.ƀko.boundingShapes,this.size,helpersLib.Vector.fromVec2(this.ƀko.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.source.autoGenerateMipmaps}set mipmap(t){this.pixiSprite.texture.source.autoGenerateMipmaps=t;}setBlendMode(t){return this.blendMode=t,this}get blendMode(){return this.pixiSprite.blendMode}set blendMode(t){this.pixiSprite.blendMode=t;}setTint(t){return this.tint=t,this}get tint(){return new F__namespace.Color(this.pixiSprite.tint).toRgb()}set tint(t){this.pixiSprite.tint=t;}setShapeAlpha(t){return this.pixiSprite.alpha=t,this}get shapeAlpha(){return this.pixiSprite.alpha}set shapeAlpha(t){this.pixiSprite.alpha=t;}setGlowAlpha(t){return this.glowAlpha=t,this}get glowAlpha(){if(this.ƀiq)return this.ƀiq.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀiq)this.ƀiq.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=helpersLib.Vector.fromVec2(this.ƀko.anchor).to(t);return new helpersLib.Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀiq&&(this.ƀiq.destroy(),this.ƀiq=void 0),t&&(this.ƀiq=Yt.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀko.destroyAssetOnDestroy),this.ƀiq.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀiq.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀip.addChild(this.ƀiq)),this}showBoundingShape(t){return t?this.ƀal||(this.ƀal=this.ƀbw().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀal&&(this.ƀal.destroy(),this.ƀal=void 0),this}getBoundingMask(){if(!this.ƀgr){if(!this.ƀko.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀgr=this.ƀbw(),this.ƀgr.displayParent(this);}return this.ƀgr}ƀbw(){if(!this.ƀko.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return R.createPolygon(this.ƀko.boundingShapes,helpersLib.ColorHelper.white).toSprite().attach(this)}download(){let t=g.instance.renderer.extract.canvas(this.ƀip);if(!t.toBlob)throw new Error("Sprite: canvas.toBlob is undefined!");return t.toBlob(e=>{if(!e)throw new Error("Sprite: blob is undefined!");let i=document.createElement("a");document.body.append(i),i.download="sprite.png",i.href=URL.createObjectURL(e),i.click(),i.remove();},"image/png"),this}},hs=class{static{h(this,"CompositeHitArea");}constructor(t,e,i){this.ƀke=t.map(r=>new F__namespace.Polygon(r.map(s=>new F__namespace.Point(s.x,s.y))));}contains(t,e){return this.ƀke.some(i=>i.contains(t,e))}};var Te=class{static{h(this,"DashedLineHelper");}static getLines(t,e,i){let r=helpersLib.Vector.fromTo(t,e),s=r.normalize(),o=r.length-i.lineStartGap-i.lineEndGap,a=[];if(o<=0)return a;let l=t.add(s.normalize(i.lineStartGap));if(o<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(s.normalize(o))}),a;let c=o-i.dashGap,p=i.dashLength+i.dashGap,y=Math.floor(c/p),w=c-p*y;y>=1&&w<i.dashLength&&(w+=p,y--);let C=s.normalize(w/2),Ct=s.normalize(i.dashGap);if(a.push({from:l,to:l.add(C)}),l=l.add(C),y>0){let pe=s.normalize(i.dashLength);helpersLib.ArrayHelper.createEmptyArray(y).forEach(()=>{l=l.add(Ct),a.push({from:l,to:l.add(pe)}),l=l.add(pe);});}return l=l.add(Ct),a.push({from:l,to:l.add(C)}),a}};var R=class n extends d{static{h(this,"Graphics");}static{this.ƀcx=new Map;}static createArrow(t,e){let i=new F__namespace.Graphics;return [[{x:0,y:-t/2},{x:t*3/8,y:-t/8},{x:t/4,y:0},{x:0,y:-t/4},{x:-t/4,y:0},{x:-t*3/8,y:-t/8}],[{x:0,y:-t/4},{x:t/8-t/30,y:-t/8-t/30},{x:t/8-t/30,y:t*7/16},{x:-t/8+t/30,y:t*7/16},{x:-t/8+t/30,y:-t/8-t/30}]].forEach(s=>{i.poly(s.map(o=>new F__namespace.Point(o.x,o.y))).fill(e);}),new n(i,JSON.stringify({type:"arrow",size:t,color:e}))}static createDashedLine(t,e,i){let r={width:2,dashLength:10,dashGap:4,lineStartGap:0,lineEndGap:0,color:helpersLib.ColorHelper.white,...i},s=new F__namespace.Graphics;return Te.getLines(t,e,r).forEach(a=>{s.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),s.stroke({width:r.width,color:r.color}),new n(s,JSON.stringify({type:"dashedLine",from:t,to:e,options:r}))}static createVector(t,e,i){let r=new F__namespace.Graphics;return r.moveTo(t.x,t.y),r.lineTo(e.x,e.y),r.stroke({width:2,color:i}),r.circle(t.x,t.y,3),r.fill(helpersLib.ColorHelper.white),r.stroke({width:1,color:i}),new n(r,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let r=new F__namespace.Graphics;return r.rect(0,0,t.x,e),r.rect(0,e,e,t.y-e*2),r.rect(t.x-e,e,e,t.y-e*2),r.rect(0,t.y-e,t.x,e),r.fill(i),new n(r,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=helpersLib.ColorHelper.white){let i=new F__namespace.Graphics;return i.rect(0,0,t.x,t.y).fill(e),new n(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new F__namespace.Graphics;return i.circle(0,0,t).fill(e),new n(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new F__namespace.Graphics;return i.ellipse(0,0,t.x,t.y).fill(e),new n(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new F__namespace.Graphics,r=JSON.stringify({type:"polygon",polygon:t,color:e});return t.forEach(s=>{i.poly(s.map(o=>new F__namespace.Point(o.x,o.y))).fill(e);}),new n(i,r)}static createRegularPolygon(t,e,i){let r=new F__namespace.Graphics,s=new helpersLib.Radian(helpersLib.PI_360/t);r.moveTo(e,0);for(let o=1;o<=t;o++){let l=s.multiply(o).vector.normalize(e),c=e+l.x,p=e+l.y;r.lineTo(c,p);}return r.fill(i),new n(r,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.ƀip.addChild(t),this.pixiGraphics=t,this.ƀao=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀao,cache:false,...t},i=this.ƀer(e.cacheName,e.cache),r={id:i.textureID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},s=new J(r,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),s}ƀer(t,e){if(e){let i=n.ƀcx.get(t);return i||(i=this.ƀci(),n.ƀcx.set(t,i)),i}else return this.ƀci()}ƀci(){let t=g.instance.renderer.generateTexture(this.pixiGraphics);t.id=M.insertAsset(t);let e=this.pixiGraphics.getBounds();return {textureID:t.id,bounds:new helpersLib.Vector(e.x,e.y)}}};var ri=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},Pt=class n extends d{static{h(this,"ScrollMaskUI");}static{this.ƀcx=new Map;}constructor(t,e,i,r=exports.ScrollDirection.Vertical){if(super(),i<0)throw new Error("The padding of the scroll mask cannot be lower than '0'");if(e.y<i*2)throw new Error(`The height of the scroll mask cannot be lower than '${i*2}'`);let s=new d;r===exports.ScrollDirection.Horizontal?this.ƀcc(e,i,s):this.ƀcj(e,i,s),this.ƀgr=J.createSnapshotSprite(s).attach(this),s.destroy(),t.setMask(this.ƀgr);}ƀcj(t,e,i){e>0&&this.ƀbz(new helpersLib.Vector(t.x,e)).displayParent(i).attach(i),R.createRectangle(new helpersLib.Vector(t.x,t.y-e*2),helpersLib.ColorHelper.white).toSprite().setPosition(new helpersLib.Vector(0,e),{round:false}).displayParent(i).attach(i),e>0&&this.ƀbz(new helpersLib.Vector(t.x,e)).setPosition(new helpersLib.Vector(t.x,t.y),{round:false}).setRotation(helpersLib.Radian.get180).displayParent(i).attach(i);}ƀcc(t,e,i){e>0&&this.ƀbz(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(0,t.y),{round:false}).setRotation(helpersLib.Radian.get270).displayParent(i).attach(i),R.createRectangle(new helpersLib.Vector(t.x-e*2,t.y),helpersLib.ColorHelper.white).toSprite().setPosition(new helpersLib.Vector(e,0),{round:false}).displayParent(i).attach(i),e>0&&this.ƀbz(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(t.x,0),{round:false}).setRotation(helpersLib.Radian.get90).displayParent(i).attach(i);}ƀbz(t){let i={id:this.ƀca(t.y),scale:1,size:t,anchor:{x:0,y:0}};return new J(i,{textureSize:t,ignoreAnchor:true})}ƀca(t){let e=JSON.stringify({type:"gradient",length:t}),i=n.ƀcx.get(e);if(!i){let r=document.createElement("canvas");r.width=1,r.height=t;let s=r.getContext("2d");if(s){let o=new ri;helpersLib.ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${o.multiplierFunction(l/t)})`;s.fillStyle=c,s.fillRect(0,l,1,1);});let a=F__namespace.Texture.from(r);i=M.insertAsset(a),n.ƀcx.set(e,i);}else throw new Error("Canvas context is null")}return i}};exports.SlideStateAnimationState=void 0;(function(n){n[n.Appear=1]="Appear",n[n.Disappear=2]="Disappear";})(exports.SlideStateAnimationState||(exports.SlideStateAnimationState={}));var Re=class extends actionsLib.Attachable{static{h(this,"SlideStateAnimation");}onStateChange(t){return this.ƀhr.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀht.subscribe(e=>t(e.value,e.index)).attach(this),this}get state(){return {value:this.ƀkv.state.value,item:this.ƀfs,nextItem:this.ƀhi,queuedItem:this.ƀkv.state.queuedItem,animationState:this.ƀo}}constructor(t){super(),this.ƀo="idle",this.ƀhr=new actionsLib.Action,this.ƀht=new actionsLib.Action,this.ƀhw={duration:500,animation:x.easeInOutCubic,...t},this.ƀkv=new Gt({duration:this.ƀhw.duration,animation:this.ƀhw.animation}).onStateChange((e,i)=>this.ƀez(e,i)).onValueChange(e=>this.ƀfe(e)).attach(this);}setIndex(t,e){if(!helpersLib.Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀfs===void 0?(this.ƀfs=t,this.ƀhr.trigger({state:exports.SlideStateAnimationState.Appear,index:t}),this.ƀkv.setItem(t,e)):this.ƀfs!==t?this.ƀhi!==t?this.ƀo==="idle"?(this.ƀo=t>this.ƀfs?"transitionForward":"transitionBackward",this.ƀhi=t,this.ƀhr.trigger({state:exports.SlideStateAnimationState.Appear,index:this.ƀhi}),this.ƀkv.setItem(t,e)):this.ƀkv.setItem(t,e):this.ƀo==="reverting"&&this.ƀhi===t&&(this.ƀo=t>this.ƀfs?"transitionForward":"transitionBackward",this.ƀkv.setItem(t,e)):(this.ƀo==="transitionForward"||this.ƀo==="transitionBackward")&&(this.ƀo="reverting",this.ƀkv.setItem(t,e));}ƀez(t,e){switch(this.ƀfs!==void 0&&this.ƀfs!==t&&this.ƀfs!==e&&this.ƀhr.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀfs}),this.ƀhi!==void 0&&this.ƀhi!==t&&this.ƀhi!==e&&this.ƀhr.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀhi}),e!==void 0&&e!==this.ƀfs&&e!==this.ƀhi&&this.ƀhr.trigger({state:exports.SlideStateAnimationState.Appear,index:e}),this.ƀo){case "idle":break;case "transitionForward":case "transitionBackward":e===void 0?(this.ƀo="idle",this.ƀfs=this.ƀhi,this.ƀhi=void 0):this.ƀfs!==t&&this.ƀfa(t,e);break;case "reverting":e===void 0?(this.ƀo="idle",this.ƀhi=void 0):this.ƀfs!==e&&this.ƀfa(t,e);break;default:{this.ƀo;throw new Error}}}ƀfa(t,e){this.ƀfs=t,this.ƀhi=e,this.ƀht.trigger({value:0,index:this.ƀfs}),this.ƀo=this.ƀfs<this.ƀhi?"transitionForward":"transitionBackward";}ƀfe(t){let e=1;(this.ƀo==="transitionBackward"||this.ƀo==="reverting"&&this.ƀfs!==void 0&&this.ƀhi!==void 0&&this.ƀfs>this.ƀhi)&&(e=-1),(this.ƀo==="idle"||t!==0)&&this.ƀht.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(-e*t),index:this.ƀfs}),this.ƀhi!==void 0&&this.ƀht.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀhi});}};exports.ScrollDirection=void 0;(function(n){n[n.Horizontal=1]="Horizontal",n[n.Vertical=2]="Vertical";})(exports.ScrollDirection||(exports.ScrollDirection={}));var si=class extends d{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀby=t,this.ƀcs="x",this.ƀbo=new Map,this.ƀhw={duration:300,animation:x.easeInOutCubic,size:new helpersLib.Vector(500,500),margin:20,direction:exports.ScrollDirection.Horizontal,...e};let i=this.ƀhw.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(this.ƀhw.size.x+this.ƀhw.margin*2,this.ƀhw.size.y):new helpersLib.Vector(this.ƀhw.size.x,this.ƀhw.size.y+this.ƀhw.margin*2),r=new d().setPosition(this.ƀhw.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(-this.ƀhw.margin,0):new helpersLib.Vector(0,-this.ƀhw.margin),{round:false}).displayParent(this).attach(this);this.ƀcd(i,this.ƀhw.margin,this.ƀhw.direction,r),this.ƀcs=this.ƀhw.direction===exports.ScrollDirection.Horizontal?"x":"y",this.ƀkv=new Re({duration:this.ƀhw.duration,animation:this.ƀhw.animation}).onStateChange((s,o)=>{if(s===exports.SlideStateAnimationState.Appear){let a=new d().displayParent(this).attach(this);this.ƀbo.set(o,a),this.ƀby({index:o,container:a});}else {let a=this.ƀbo.get(o);a&&(a.destroy(),this.ƀbo.delete(o));}}).onValueChange((s,o)=>{let a=this.ƀbo.get(o);if(a){let l={x:0,y:0};l[this.ƀcs]=i[this.ƀcs]*s+this.ƀhw.margin,a.setPosition(helpersLib.Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=r;}setIndex(t,e){return this.ƀkv.setIndex(t,e),this}ƀcd(t,e,i,r){new Pt(r,new helpersLib.Vector(t.x,t.y),e,i).attach(this);}},zi=class extends si{static{h(this,"SlideInContent");}constructor(t,e,i){super(r=>{let s=this.indexToItem.get(r.index);if(s)e({index:r.index,item:s,container:r.container});else throw new Error(`SlideInContent: The item with index '${r.index}' is not part of the items list`)},i),this.itemToIndex=new Map,this.indexToItem=new Map,t.forEach((r,s)=>{this.itemToIndex.set(r,s),this.indexToItem.set(s,r);});}setItem(t,e){let i=this.itemToIndex.get(t);if(i!==void 0)this.setIndex(i,e);else throw new Error(`SlideInContent: The item '${t}' is not part of the items list`);return this}};var Et=class{static{h(this,"VectorSet");}constructor(){this.ƀlv=new Map;}add(t){let e=this.ƀlv.get(t.x);e||(e=new Set,this.ƀlv.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀlv.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀlv.get(t.x);return e?e.delete(t.y):false}};var oi=class{static{h(this,"DeltaTime");}static adjustMultiplier(t,e){return Math.pow(t,e)}};var D=class{static{h(this,"PositionToGridPositionConverter");}static areaToGridArea(t,e){return new helpersLib.Rectangle(this.positionToGridPosition(t.topLeft,e),this.positionToGridPosition(t.bottomRight,e))}static positionToGridPosition(t,e){return t.divideNumber(e).floor()}static gridPositionToPosition(t,e){return t.add(new helpersLib.Vector(.5,.5)).multiplyNumber(e)}};var Xt=class{static{h(this,"ClosestAvailableSpaceHelper");}static findByConvertingGridSpace(t,e,i){let r=new helpersLib.Vector(Math.ceil(e.size.x/i)-1,Math.ceil(e.size.y/i)-1),s=D.areaToGridArea(e,i);if(this.ƀav(t,s))return helpersLib.Vector.zero;let o=t.movePositionInsideGrid(s.topLeft),a=helpersLib.Vector.fromTo(s.topLeft,o),l=this.find(t,o,r);if(l){let c=l.add(a),p=helpersLib.Vector.fromTo(s.topLeft.multiplyNumber(i),e.topLeft);return new helpersLib.Vector(c.x*i+((r.x+1)*i-e.size.x)/2-p.x,c.y*i+((r.y+1)*i-e.size.y)/2-p.y)}}static find(t,e,i){let r=new Et,s=new helpersLib.Queue(e);for(;s.notEmpty;){let o=s.pop();r.add(o);let a=new helpersLib.Rectangle(o,o.add(i));if(this.ƀav(t,a))return helpersLib.Vector.fromTo(e,o);t.getNeighborPositions(o,"orthogonal").forEach(l=>{r.has(l)||s.add(l);});}}static ƀav(t,e){if(!t.isAreaWithinBounds(e))return false;for(let i=e.topLeft.y;i<=e.bottomRight.y;i++)for(let r=e.topLeft.x;r<=e.bottomRight.x;r++)if(!t.get(new helpersLib.Vector(r,i)))return false;return true}};var Ji=Math.SQRT2-1,Ss=class{static{h(this,"PathfinderNode");}constructor(t,e){this.position=t,this.distanceToEnd=e,this.closed=false,this.distanceFromStart=Number.MAX_SAFE_INTEGER,this.parent=void 0;}get pathLength(){return this.distanceFromStart+this.distanceToEnd}getStepCost(t){return this.position.x!==t.position.x&&this.position.y!==t.position.y?Math.SQRT2:1}createSolutionPath(t){let e=[],i=this;for(;i!==void 0;)e.push(i.position),i=i.parent;return e.reverse(),{directPathAvailable:t,path:e}}},Es=class{static{h(this,"PathfinderGrid");}constructor(t,e,i,r){this.ƀey=t,this.ƀlc=i,this.ƀhh=r,this.ƀhv=new helpersLib.BinaryHeap("min"),this.ƀhk=new helpersLib.Grid({size:t.size,defaultValue:void 0});let s=this.ƀce(e);s.distanceFromStart=0,this.ƀhv.add(s.pathLength,s),this.ƀae=s;}get hasOpenNodes(){return this.ƀhv.size>0}getNeighbors(t){let e=[];for(let i of this.ƀey.getNeighborPositions(t.position,this.ƀhh))if(this.ƀey.get(i)){let r=this.ƀhk.get(i)??this.ƀce(i);r.closed||e.push(r);}return e}popLowestPathCostNode(){let t=this.ƀhv.pop();return t.closed=true,t.distanceToEnd<this.ƀae.distanceToEnd&&(this.ƀae=t),t}changeNodeCost(t,e,i){t.distanceFromStart=e,t.parent=i,this.ƀhv.updatePriority(t,t.pathLength)||this.ƀhv.add(t.pathLength,t);}getBestClosedNode(){return this.ƀae}ƀce(t){let e=Math.abs(t.x-this.ƀlc.x),i=Math.abs(t.y-this.ƀlc.y),r=this.ƀhh==="orthogonal"?e+i:e>i?e+Ji*i:i+Ji*e,s=new Ss(t,r);return this.ƀhk.isPointWithinBounds(t)&&this.ƀhk.set(t,s),s}},Zt=class{static{h(this,"PathFinder");}static findPath(t,e,i,r){let s=new Es(t,e,i,r);for(;s.hasOpenNodes;){let o=s.popLowestPathCostNode();if(o.position.isEqual(i))return o.createSolutionPath(true);for(let a of s.getNeighbors(o)){let l=o.distanceFromStart+o.getStepCost(a);l<a.distanceFromStart&&s.changeNodeCost(a,l,o);}}return s.getBestClosedNode().createSolutionPath(false)}};var Qt=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀlb=t,this.ƀy=e,this.ƀfh=this.ƀeh(this.ƀy.size),this.ƀme=new helpersLib.Grid({size:this.ƀy.size,defaultValue:this.ƀfh}),this.ƀct=new helpersLib.Grid({size:this.ƀy.size,defaultValue:void 0});let i=new Et,r=new helpersLib.Queue;for(this.ƀdu(this.ƀy.cropAreaOutsideOfTheGrid(t)).forEach(o=>{this.ƀme.set(o,0),r.add(o);});r.notEmpty;){let o=r.pop();if(!i.has(o)){i.add(o);let a=this.ƀme.getOrFail(o);this.ƀem(o,this.ƀy).forEach(l=>{if(!i.has(l.position)){let c=this.ƀme.getOrFail(l.position),p=a+l.distance;this.ƀy.getOrFail(l.position)&&p<c&&(this.ƀme.set(l.position,p),r.add(l.position));}});}}}getDirectionToTarget(t){if(!t.isInsideRectangle(this.ƀlb)){if(t=this.ƀme.movePositionInsideGrid(t),this.ƀct.has(t))return this.ƀct.get(t);{let e=this.ƀem(t,this.ƀy),i;return this.ƀme.getOrFail(t)>=this.ƀfh?e.some(s=>this.ƀy.get(s.position))&&(e.some(o=>!this.ƀy.get(o.position))?i=this.ƀeb(e):i=this.ƀdw(t,e)):i=this.ƀdw(t,e),this.ƀct.set(t,i),i}}}ƀeb(t){let e=t.filter(i=>this.ƀy.get(i.position)).map(i=>i.direction.radian);return helpersLib.Radian.getAverage(...e)}ƀdw(t,e){let i=e.filter(r=>this.ƀme.getOrFail(r.position)<this.ƀfh).reduce((r,s)=>{let o=this.ƀme.getOrFail(s.position)+s.distance;return o<r.bestWeight?(r.bestDirections=[s.direction],r.bestWeight=o):o===r.bestWeight&&r.bestDirections.push(s.direction),r},{bestDirections:[],bestWeight:this.ƀfh}).bestDirections;return this.ƀes(i,t)}ƀes(t,e){if(t.length>0){let i=t.reduce((r,s)=>r.add(s),helpersLib.Vector.zero);if(i.isZero()||!this.ƀfy(e,i))return helpersLib.Random.pickRandomElement(t).radian;if(t.length>=1)return i.radian}}ƀfy(t,e){let i=t.add(this.ƀlw(e));return this.ƀy.isPointWithinBounds(i)&&this.ƀy.getOrFail(i)}ƀem(t,e){return this.ƀme.getNeighborDirections(t,"all").map(i=>({position:t.add(i),direction:i,distance:i.x!==0&&i.y!==0?14:10}))}ƀdu(t){let e=[];for(let i=t.topLeft.y;i<=t.bottomRight.y;i++)for(let r=t.topLeft.x;r<=t.bottomRight.x;r++)e.push(new helpersLib.Vector(r,i));return e}ƀlw(t){let e=t.normalize().round();return new helpersLib.Vector(e.x,e.y)}ƀeh(t){return (t.x+t.y)*20}};var S=class n{static{h(this,"AudioAssets");}static{this.ƀan=new Map;}static{this.context=new AudioContext;}static async load(t){await Promise.all(t.map(e=>fetch(e.url).then(i=>i.arrayBuffer()).then(i=>this.context.decodeAudioData(i)).then(i=>this.ƀan.set(e.id,i))));}static createSource(t){let e=n.ƀdv(t),i=n.context.createBufferSource();return i.buffer=e,i}static ƀdv(t){let e=this.ƀan.get(t);if(!e)throw new Error(`Audio: Sound with id ${t} was not loaded.`);return e}};E.onHardReset.subscribe(()=>{S.context=new AudioContext,S.ƀan.clear();}).attachToRoot();var K=1e3,Y=class n{static{h(this,"Audio");}static ƀjy(){return this.ƀfv=new n,this.ƀfv}constructor(){this.ƀgu=S.context.createGain(),this.ƀgt=S.context.createGain(),this.ƀhg=S.context.createGain(),this.ƀkh=S.context.createGain(),this.ƀgu.connect(S.context.destination),this.ƀgt.connect(this.ƀgu),this.ƀhg.connect(this.ƀgt),this.ƀkh.connect(this.ƀgt),this.ƀgv=new I(this.ƀgu.gain,"value",{duration:500*2,animation:x.easeIn,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀgv.set({value:0});}setVolumes(t){this.ƀgt.gain.value=t.master,this.ƀhg.gain.value=t.music,this.ƀkh.gain.value=t.sound;}appear(t,e="ease"){switch(e){case "ease":return this.ƀgv.set({value:t?0:1}),this.ƀgv.animate({value:t?1:0}).chainToRoot();case "instant":return this.ƀgv.set({value:t?1:0}),actionsLib.SingleEvent.instant();default:{throw new Error}}}};E.onHardReset.subscribe(()=>{Y.ƀjy();}).attachToRoot();var As=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s};exports.CameraGateway=class nt extends q(){static{h(this,"CameraGateway");}};exports.CameraGateway=As([u()],exports.CameraGateway);var Os=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Rt=class extends q(){static{h(this,"CameraViewGateway");}};Rt=Os([u()],Rt);var Ki;(function(n){n.BackgroundScreen="backgroundScreen",n.Background="background",n.Main="main",n.Foreground="foreground",n.ForegroundScreen="foregroundScreen";})(Ki||(Ki={}));exports.FocusingAnimation=void 0;(function(n){n[n.Instant=1]="Instant",n[n.EaseInOut=2]="EaseInOut",n[n.EaseOut=3]="EaseOut";})(exports.FocusingAnimation||(exports.FocusingAnimation={}));var qt=class{static{h(this,"Camera");}get position(){return this.ƀaq.getCameraPosition()}constructor(){this.ƀaq=P.get(exports.CameraGateway),this.ƀau=P.get(Rt),this.ƀaq.createCamera(),this.layers=this.ƀau.getLayers();}setPosition(t){this.ƀaq.setPosition(t);}setTransition(t){this.ƀaq.setTransition(t);}appear(t,e="alpha",i=0){return this.ƀau.appear(t,e,i)}screenPositonToStagePosition(t){return this.ƀau.screenPositonToStagePosition(t)}};var g=class n{static{h(this,"Game");}static get instance(){return this.ƀfv}static{this.pause=actionsLib.Reducer.createOr();}static{this.freeze=actionsLib.Reducer.createOr();}static get camera(){return this.ƀap}static get audio(){return this.ƀx}static appear(t,e){let i=e?.audio??"ease",r=e?.camera??"alpha";return actionsLib.ActionLib.all([this.audio.appear(t,i),this.camera.appear(t,r,i!=="instant"?0:500)]).mapToVoid().chainToRoot()}static get time(){return m.ƀlj}static get setupOptions(){return this.ƀkb}constructor(t){if(this.ƀjn=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSize=this.ƀjn.notifier,this.ƀjo=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSizeCenter=this.ƀjo.notifier,this.devMode=false,n.ƀfv)throw new Error("There can be only one Game instance!");this.ƀbk={screenResolution:void 0,maxScreenResolution:void 0,devMode:false,backgroundColor:helpersLib.ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbk.devMode||false,this.ƀio=new F__namespace.Application;let e=n.pause.effect(false).attachToRoot();n.freeze.subscribe(i=>{e.update(i),i?S.context.suspend():S.context.resume();}).attachToRoot();}async setup(t){n.ƀkb=t;let e=helpersLib.JsonHelper.removeUndefinedProperties({backgroundColor:this.ƀbk.backgroundColor,autoStart:false,antialias:this.ƀbk.antialias,resolution:this.ƀbk.resolution,width:this.ƀbk.screenResolution?.width,height:this.ƀbk.screenResolution?.height,useBackBuffer:true,powerPreference:"high-performance",eventFeatures:{globalMove:false}});await this.ƀio.init(e);let i=document.body.appendChild(this.ƀio.canvas);this.ƀjx(i),await Promise.all([M.loadGameAssets(t.spriteAssetDefinitions),M.loadGameAssets(t.fontAssetDefinitions),S.load(t.soundAssetDefinitions)]),n.ƀfv=this,this.renderer=this.ƀio.renderer,globalThis.ƀa=this.ƀio,this.ƀfc(),n.ƀap=new qt,n.ƀx=Y.ƀjy(),this.ƀio.start(),this.ƀio.ticker.add(()=>{n.freeze.value||m.triggerUpdateTick(this.ƀio.ticker.deltaMS);});}setResolution(t){if(this.ƀio.renderer.resolution!==t){this.ƀio.renderer.resolution=t;let e=this.ƀeq();this.ƀio.renderer.resize(e.x,e.y);}}ƀfc(){this.ƀdb(),this.ƀjw(),window.addEventListener("resize",t=>{this.ƀdb(),this.ƀjw();});}ƀdb(){let t=this.ƀeq();(t.x!==this.ƀio.screen.width||t.y!==this.ƀio.screen.height)&&this.ƀio.renderer.resize(t.x,t.y);}ƀjw(){let t=new helpersLib.Vector(this.ƀio.screen.width,this.ƀio.screen.height);this.ƀjn.value=t,this.ƀjo.value=t.multiplyNumber(.5).round();}ƀeq(){let t=this.ƀbk.screenResolution?.width??window.innerWidth,e=this.ƀbk.screenResolution?.height??window.innerHeight;return this.ƀbk.maxScreenResolution&&(t=Math.min(t,this.ƀbk.maxScreenResolution.width),e=Math.min(e,this.ƀbk.maxScreenResolution.height)),new helpersLib.Vector(t,e)}ƀjx(t){this.ƀbk.maxScreenResolution&&(t.style.maxWidth=`${this.ƀbk.maxScreenResolution?.width}px`,t.style.maxHeight=`${this.ƀbk.maxScreenResolution?.height}px`),t.style.width="100%",t.style.height="100%";}};var te=class n extends actionsLib.IDAttachable{static{h(this,"Sound");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`Sound: Could not find sound definition with name ${t}.`);return new n(i,e)}get volume(){return this.ƀdq.gain.value}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀdq.gain.value=t,this}constructor(t,e){super(),this.ƀki=t,this.ƀdq=S.context.createGain(),this.ƀdq.connect(Y.ƀfv.ƀkh),this.ƀfg=this.ƀdq,e?.volume!==void 0&&(this.volume=e.volume),this.ƀiu(e?.time??0);}destroy(){this.destroyed||(super.destroy(),this.ƀkx(),this.ƀdq?.disconnect());}ƀlt(){this.ƀfg.disconnect(),this.ƀfg.connect(Y.ƀfv.ƀhg);}ƀiu(t){this.ƀkx();let e=this.ƀki.loop;if(this.ƀkr=helpersLib.NumberHelper.clamp(t,0,e?e.to:this.ƀki.duration),e){let i=e.from,r=e.to;this.ƀiv({soundID:this.ƀki.id,start:this.ƀkr,end:this.ƀkr<i?i:r,loop:false,onComplete:h(()=>{this.ƀkl.disconnect(),this.ƀiv({soundID:this.ƀki.id,start:i,end:r,loop:true});},"onComplete")});}else this.ƀiv({soundID:this.ƀki.id,start:this.ƀkr,end:void 0,loop:false,onComplete:h(()=>this.destroy(),"onComplete")});}ƀkx(){this.ƀkl&&(this.ƀkl.onended=null,this.ƀkl.stop(),this.ƀkl.disconnect());}ƀiv(t){this.ƀkl=S.createSource(t.soundID),this.ƀkl.connect(this.ƀdq),t.onComplete&&(this.ƀkl.onended=t.onComplete),t.loop?(this.ƀkl.loop=true,this.ƀkl.loopStart=t.start,this.ƀkl.loopEnd=t.end??this.ƀkl.buffer.duration,this.ƀkl.start(0,t.start)):this.ƀkl.start(0,t.start,t.end?t.end-t.start:void 0);}};var Fs=800,Ae=-128,ht=class n extends te{static{h(this,"AdvancedSound");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new n(i,e)}constructor(t,e){super(t,e),this.ƀlj=new actionsLib.Variable(0),this.time=this.ƀlj.notifier,this.ƀkt=S.context.currentTime-this.ƀkr,this.ƀlj.value=this.ƀkr,m.beforeSceneUpdateAction.subscribe(()=>{this.ƀlj.value=S.context.currentTime-this.ƀkt;}).attach(this),this.ƀfg.disconnect(),this.ƀjz(e?.fade?helpersLib.NumberHelper.clamp(e.fade,0,1):0),this.ƀka(e?.muffle?helpersLib.NumberHelper.clamp(e.muffle,0,1):0),this.ƀfg.connect(Y.ƀfv.ƀkh);}ƀjz(t=0){this.ƀdj=S.context.createGain(),this.ƀdj.gain.value=1-t,this.ƀdi=new I(this.ƀdj.gain,"value",{duration:500,animation:x.lineer,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀfg.connect(this.ƀdj),this.ƀfg=this.ƀdj;}ƀka(t=0){this.ƀhe=S.context.createBiquadFilter(),this.ƀhe.type="highshelf",this.ƀhe.frequency.value=Fs,this.ƀhe.gain.value=t*Ae,this.ƀhf=new I(this.ƀhe.gain,"value",{duration:500,animation:x.lineer,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀfg.connect(this.ƀhe),this.ƀfg=this.ƀhe;}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.fade(1,K).notIdle().chain(this).tap(()=>this.destroy()).chainToRoot())}notifyOnTime(t){return this.time.value>t?actionsLib.SingleEvent.createDestroyed():actionsLib.SingleEvent.create(e=>{let i=this.time.filter(r=>r>=t).tap(()=>e()).attach(this);return ()=>i.destroy()})}setFade(t){t=helpersLib.NumberHelper.clamp(t,0,1),this.ƀdi.set({value:1-t});}fade(t,e=500){t=helpersLib.NumberHelper.clamp(t,0,1);let i=t>1-this.ƀdj.gain.value;return e===0?(this.ƀdi.set({value:1-t}),actionsLib.SingleEvent.instant()):this.ƀdi.animate({value:1-t},{duration:e,animation:i?x.easeOut:x.easeIn}).chain(this)}setMuffle(t){t=helpersLib.NumberHelper.clamp(t,0,1),this.ƀhf.set({value:t*Ae});}muffle(t,e=500){return t=helpersLib.NumberHelper.clamp(t,0,1),e===0?(this.ƀhf.set({value:t*Ae}),actionsLib.SingleEvent.instant()):this.ƀhf.animate({value:t*Ae},{duration:e}).chain(this)}destroy(){this.destroyed||(this.ƀdj.disconnect(),this.ƀhe.disconnect()),super.destroy();}};var ee=class n extends actionsLib.IDAttachable{static{h(this,"Music");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new n(i,e)}get time(){switch(this.ƀkk.value.type){case "paused":return this.ƀkk.value.value.time;case "playing":return this.ƀkk.value.value.time.value;default:{this.ƀkk.value;throw new Error}}}get volume(){return this.ƀkk.value.value.volume}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀkk.value.value.volume=t,this}constructor(t,e){super(),this.ƀhw={stopPlayingOnPause:true,...e},this.ƀkj=t.id;let i;if(this.ƀhw.stopPlayingOnPause&&g.pause.value)i={type:"paused",value:{time:0,volume:1}};else {let r=new ht(t,this.ƀhw).attach(this);r.ƀlt(),i={type:"playing",value:r};}this.ƀkk=new actionsLib.Variable(i),this.ƀhw.stopPlayingOnPause&&(this.ƀib=g.pause.subscribe(r=>this.ƀfb(r)).attach(this));}notifyOnTime(t){return actionsLib.SingleEvent.create(e=>{let i=this.ƀkk.asyncDropOngoing((r,s)=>{switch(r.type){case "paused":s.drop();break;case "playing":return r.value.notifyOnTime(t);default:{throw new Error}}}).toSingleEvent().tap(()=>e()).attach(this);return ()=>i.destroy()})}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.ƀib?.destroy(),actionsLib.SingleEvent.instant().async(()=>actionsLib.ActionLib.all([this.ƀkk.value.type==="playing"?this.ƀkk.value.value.close():actionsLib.SingleEvent.instant(),this.ƀdk?.onDestroy()??actionsLib.SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀfb(t){if(t){if(this.ƀkk.value.type==="playing"){let e=this.ƀkk.value.value;this.ƀkk.value={type:"paused",value:{time:e.time.value,volume:e.volume}},this.ƀdk=e,actionsLib.ActionLib.all([e.fade(1,K),e.muffle(1,K)]).tap(()=>{this.ƀdk=void 0,e.destroy();}).attach(this);}}else if(this.ƀkk.value.type==="paused"){let{volume:e,time:i}=this.ƀkk.value.value,r=ht.createByName(this.ƀkj,{volume:e,time:i,fade:1,muffle:1}).attach(this);r.ƀlt(),actionsLib.ActionLib.all([r.fade(0,K),r.muffle(0,K)]).attach(this),this.ƀkk.value={type:"playing",value:r};}}};var hi=class extends actionsLib.IDAttachable{static{h(this,"MusicPlayer");}get time(){return this.ƀiw?this.ƀiw.time:0}get volume(){return this.ƀmd}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀmd=t,this.ƀiw&&(this.ƀiw.volume=t),this.ƀia&&(this.ƀia.volume=t),this}constructor(t){super(),this.ƀmd=1,this.ƀhw={stopPlayingOnPause:true,playWhenPaused:void 0,volume:1,...t},this.ƀmd=this.ƀhw.volume,this.ƀhw.playWhenPaused&&this.ƀkc(this.ƀhw.playWhenPaused);}play(t){if(this.ƀbb)throw new Error("Play is called while music player is destroyed.");return this.ƀco=t,actionsLib.SingleEvent.instant().async(()=>{let e=this.ƀiw;if(e)return this.ƀiw=void 0,e.close()}).map(()=>{if(this.ƀco===t)return this.ƀiw=ee.createByName(t,{stopPlayingOnPause:this.ƀhw.stopPlayingOnPause,volume:this.ƀmd}).attach(this),this.ƀiw}).chain(this)}stop(){return actionsLib.SingleEvent.instant().async(()=>{let t=this.ƀiw;if(t)return t.close().tap(()=>{t===this.ƀiw&&(this.ƀiw=void 0);})}).chain(this)}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.ƀib?.destroy(),actionsLib.SingleEvent.instant().async(()=>actionsLib.ActionLib.all([this.ƀiw?.close()??actionsLib.SingleEvent.instant(),this.ƀia?.close()??actionsLib.SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀkc(t){this.ƀib=g.pause.toSequence().asyncDropOngoing(e=>e&&m.wait(K).map(()=>e)).tap(e=>{if(e)this.ƀia=ht.createByName(t,{fade:1,volume:this.ƀmd}).attach(this),this.ƀia.fade(0);else if(this.ƀia){let i=this.ƀia;this.ƀia.fade(1).tap(()=>i.destroy()).attach(this),this.ƀia=void 0;}}).attach(this);}};var li=class extends d{static{h(this,"Placeholder");}constructor(t){super(),this.ƀir=new F__namespace.Graphics,this.ƀir.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),this.ƀip.addChild(this.ƀir);}destroy(){this.destroyed||(super.destroy(),this.ƀir.destroy());}};var Ft=class{static{h(this,"TextStyleConverter");}static getPixiTextStyle(t){let e={color:helpersLib.ColorHelper.white,align:"center",fontFamily:"Arial",fontStyle:"normal",fontSize:18,lineHeight:void 0,wordWrapWidth:void 0,lineThrough:false,...t},i=t?.dropShadow===true?{}:t?.dropShadow,r={};if(i){let s={blur:4,angle:helpersLib.Radian.get60,distance:10,color:helpersLib.ColorHelper.black,alpha:.5,...i};r={dropShadow:{blur:s.blur,angle:s.angle.value,distance:s.distance,color:helpersLib.ColorHelper.rgbToHex(s.color),alpha:s.alpha}};}return helpersLib.JsonHelper.removeUndefinedProperties({fontFamily:e.fontFamily,fill:helpersLib.ColorHelper.rgbToHex(e.color),align:e.align,fontSize:e.fontSize,fontStyle:e.fontStyle,lineHeight:e.lineHeight,wordWrapWidth:e.wordWrapWidth,wordWrap:e.wordWrapWidth!==void 0,lineThrough:e.lineThrough,...r})}};var De=class{static{h(this,"RichTextDataInConverter");}static process(t,e){let i=new Set(e.styles?Object.keys(e.styles):[]),r=scriptEngineLib.RichTextSeparator.process(t,i),s=this.ƀfr(r,e),o=this.ƀs(s);return this.ƀkm(o)}static ƀfr(t,e){let i=new Map,r=new Map,s=h((a,l)=>{if(r.has(l))return r.get(l);let c=Ft.getPixiTextStyle(a);return r.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀdz(a.tags,e,i),p=s(l,c),y=F__namespace.CanvasTextMetrics.measureText(" ",new F__namespace.TextStyle(p),void 0,false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:y.width}})}static ƀdz(t,e,i){let r=t.join("+");if(i.has(r))return {style:i.get(r),cacheKey:r};let s=this.ƀbf(t,e);return i.set(r,s),{style:s,cacheKey:r}}static ƀbf(t,e){let i={...e.default};for(let l of t)e.styles&&e.styles[l]&&(i={...i,...e.styles[l]});let{wordWrapWidth:r,align:s,dropShadow:o,...a}=i;return a}static ƀs(t){let e=[],i=[];return t.forEach((r,s)=>{r.text.split(/\r?\n/).forEach((a,l)=>{l>0&&(e.push(i),i=[]),i.push({text:a,cacheKey:r.cacheKey,style:r.style,pixiStyle:r.pixiStyle,spaceWidth:r.spaceWidth});});}),e.push(i),e}static ƀkm(t){let e=[];return t.forEach(i=>{if(i.length===0)throw new Error("Internal Error: Line is unexpectedly empty");let r=i.flatMap(s=>this.ƀkn(s.text).map(a=>{let l=new F__namespace.TextStyle(s.pixiStyle),c=F__namespace.CanvasTextMetrics.measureText(a,l,void 0,false);return {text:a,whitespace:a.trim()==="",style:{cacheKey:s.cacheKey,style:s.style,pixiStyle:l,height:c.height,ascent:c.fontProperties.ascent,descent:c.fontProperties.descent,width:c.width,spaceWidth:s.spaceWidth}}}));e.push(r);}),e}static ƀkn(t){if(t==="")return [""];let e=[],i="",r=t[0]===" ";for(let s=0;s<t.length;s++){let o=t[s],a=o===" ";a===r?i+=o:(e.push(i),i=o,r=a);}return i&&e.push(i),e}};var Be=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀcm.length===0}get remainingWidth(){return this.ƀmf-this.ƀcp}constructor(t,e){this.ƀmf=t,this.ƀgj=[],this.ƀcm=[],this.ƀcp=0,this.ƀgi=new helpersLib.Vector(0,0),this.ƀcn=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀfj=i.horizontalAlignment,this.ƀlx=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀmf||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀcq={direction:i.rectangleCutOption.direction,rectangle:this.ƀbs(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀcn,t.y),i=this.ƀei(this.ƀgi.y,this.ƀgi.y+e);return this.ƀcp+t.x<=i}insertWord(t){let e=Math.max(this.ƀcn,t.style.height);if(this.ƀcm.length===0){let i=this.ƀej(this.ƀgi.y,this.ƀgi.y+e);this.ƀgi=new helpersLib.Vector(i,this.ƀgi.y),this.ƀcp=this.ƀgi.x;}this.ƀcm.push({chunk:t,position:new helpersLib.Vector(this.ƀcp,this.ƀgi.y)}),this.ƀcn=e,this.ƀcp+=t.style.width;}newLine(){let t=this.ƀgi.y+this.ƀcn,e=this.ƀej(t,t);this.ƀdm(),this.ƀgi=new helpersLib.Vector(e,t),this.ƀcp=this.ƀgi.x,this.ƀcn=0;}print(){return this.ƀdm(),this.ƀgj}ƀdm(){this.ƀcm.length>0&&(this.ƀgj.push(this.ƀg(this.ƀcm)),this.ƀcm=[]);}ƀg(t){return t=this.ƀlz(t),t=this.ƀfl(t),t}ƀfl(t){if(this.ƀfj==="left")return t;let e=this.ƀgi.y+this.ƀcn,i=this.ƀej(this.ƀgi.y,e),s=this.ƀei(this.ƀgi.y,e)-i,o=Math.min(s,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀfj==="center"?a=(s-o)/2:a=s-o,t.map(l=>(l={chunk:l.chunk,position:new helpersLib.Vector(l.position.x+a,l.position.y)},l))}ƀlz(t){let e=Math.max(...t.map(r=>r.chunk.style.ascent)),i=Math.max(...t.map(r=>r.chunk.style.descent));return t.map(r=>{let s;switch(this.ƀlx){case "top":s=i-r.chunk.style.descent;break;case "center":s=(i-r.chunk.style.descent+e-r.chunk.style.ascent)*.5;break;case "bottom":s=e-r.chunk.style.ascent;break;default:{this.ƀlx;throw new Error}}return r={chunk:r.chunk,position:new helpersLib.Vector(r.position.x,r.position.y+s)},r})}ƀej(t,e){return this.ƀcq&&(this.ƀcq.direction==="topLeft"||this.ƀcq.direction==="bottomLeft")&&(this.ƀcq.rectangle.isPointInside(new helpersLib.Vector(0,t),{includeEdges:false})||this.ƀcq.rectangle.isPointInside(new helpersLib.Vector(0,e),{includeEdges:false}))?this.ƀcq.rectangle.bottomRight.x:0}ƀei(t,e){return this.ƀcq&&(this.ƀcq.direction==="topRight"||this.ƀcq.direction==="bottomRight")&&(this.ƀcq.rectangle.isPointInside(new helpersLib.Vector(this.ƀmf,t),{includeEdges:false})||this.ƀcq.rectangle.isPointInside(new helpersLib.Vector(this.ƀmf,e),{includeEdges:false}))?this.ƀcq.rectangle.topLeft.x:this.ƀmf}ƀbs(t){let e,i;switch(t.direction){case "topRight":e=new helpersLib.Vector(t.position.x,-1/0),i=new helpersLib.Vector(1/0,t.position.y);break;case "topLeft":e=new helpersLib.Vector(-1/0,-1/0),i=t.position;break;case "bottomRight":e=t.position,i=new helpersLib.Vector(1/0,1/0);break;case "bottomLeft":e=new helpersLib.Vector(-1/0,t.position.y),i=new helpersLib.Vector(t.position.x,1/0);break;default:{t.direction;throw new Error}}return new helpersLib.Rectangle(e,i)}};var Ge=class{static{h(this,"ConsistentSpaceTextWrapper");}static wrapText(t,e){return t.forEach(i=>{i.forEach((r,s)=>{if(e.isSpaceAvailable(new helpersLib.Vector(r.style.width,r.style.height)))if(r.whitespace&&s===i.length-2){let o=i[i.length-1];e.isSpaceAvailable(new helpersLib.Vector(o.style.width+r.style.width,o.style.height))?e.insertWord(r):this.ƀmg(r,e);}else e.insertWord(r);else e.lineIsEmpty?e.insertWord(r):r.whitespace?this.ƀmg(r,e):(e.newLine(),e.insertWord(r));}),e.newLine();}),e.print()}static ƀmg(t,e){let i=Math.max(0,Math.floor(e.remainingWidth/t.style.spaceWidth)),r=Math.max(0,Math.min(i,t.text.length-1));if(r>0){let o={text:" ".repeat(r),whitespace:true,style:{...t.style,width:r*t.style.spaceWidth}};e.insertWord(o);}e.newLine();let s=t.text.length-r-1;if(s>0){let o={text:" ".repeat(s),whitespace:true,style:{...t.style,width:s*t.style.spaceWidth}};e.insertWord(o);}}};var _e=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀgz(t),t=this.ƀln(t),this.ƀax(t)}static ƀgz(t){return t.map(e=>{let i=[],r,s=true;return e.forEach(o=>{if(!r||r.chunk.style.cacheKey!==o.chunk.style.cacheKey)r&&i.push(r),r=o,s=o.chunk.whitespace;else {let a=r.chunk.text+o.chunk.text;s=o.chunk.whitespace&&s,r={chunk:{text:a,whitespace:s,style:{...r.chunk.style,width:r.chunk.style.width+o.chunk.style.width}},position:r.position};}}),r&&i.push(r),i})}static ƀln(t){return t.map(e=>{if(e.length===0)return [];let i=e.pop();if(!i.chunk.whitespace||i.chunk.text===""){let r=i.chunk.text.length,s=i.chunk.text.trimEnd();r!==s.length?e.push({chunk:{text:s,whitespace:false,style:{...i.chunk.style,width:i.chunk.style.width-(r-s.length)*i.chunk.style.spaceWidth}},position:i.position}):e.push(i);}return e})}static ƀax(t){return t.flatMap(e=>e.map(i=>({text:i.chunk.text,style:i.chunk.style.style,position:i.position}))).filter(e=>e.text.trim()!=="")}};var re=class{static{h(this,"RichTextToPlaneText");}static process(t,e){if(e.default.wordWrapWidth===void 0){if(e.default.align==="right"||e.default.align==="center")throw new Error("wordWrapWidth is required for right or center alignment");if(e.rectangleCut&&(e.rectangleCut.direction==="topRight"||e.rectangleCut.direction==="bottomRight"))throw new Error("wordWrapWidth is required for topRight or bottomRight rectangle cut")}let i=De.process(t,e),r=helpersLib.JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),s=new Be(e.default.wordWrapWidth??1/0,r),o=Ge.wrapText(i,s);return _e.process(o)}};var Ks=1,er=1/Ks,se=class extends d{static{h(this,"Text");}get ƀlg(){if(!this.ƀlh){let t=new F__namespace.TextStyle(this.ƀit);this.ƀlh=F__namespace.CanvasTextMetrics.measureText(this.ƀlf,t);}return this.ƀlh}get ascent(){return this.ƀlg.fontProperties.ascent}constructor(t,e){super(),this.ƀit=Ft.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀis.destroyed&&this.ƀis.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new helpersLib.Vector(this.ƀis.anchor.x,this.ƀis.anchor.y)}set anchor(t){this.ƀi=t,this.ƀis.anchor.set(t.x,t.y),this.ƀjg();}setText(t){return this.ƀlf!==t&&(this.ƀlf=t,this.ƀjd()),this}setColor(t){let e=helpersLib.ColorHelper.rgbToHex(t);return this.ƀit.fill!==e&&(this.ƀit.fill=e,this.ƀjd()),this}ƀjd(){this.ƀis?.destroy(),this.ƀkz?.destroy(),this.ƀkz=void 0,this.ƀlh=void 0;let t=new F__namespace.TextStyle(this.ƀit);this.ƀis=new F__namespace.Text({text:this.ƀlf,style:t}),this.ƀi&&this.ƀis.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀjg(),this.ƀis.scale.set(er,er),this.ƀip.addChild(this.ƀis),this.ƀit.lineThrough&&(this.ƀkz=this.ƀe(this.ƀis,this.ƀit.fill),this.ƀip.addChild(this.ƀkz));}ƀjg(){let t=F__namespace.CanvasTextMetrics.measureText(this.ƀlf,new F__namespace.TextStyle({...this.ƀit,dropShadow:false})),e=-this.ƀis.anchor.x*t.width,i=-this.ƀis.anchor.y*t.height;this.ƀis.boundsArea=new F__namespace.Rectangle(e,i,t.width,t.height);}ƀe(t,e){let i=F__namespace.CanvasTextMetrics.measureText(t.text,t.style),r=Math.max(1,Math.round(i.lineHeight*.07)),s=r%2*.5,o=new F__namespace.Graphics,a=0;return i.lines.forEach((l,c)=>{let p=F__namespace.CanvasTextMetrics.measureText(l,t.style),y=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+s,w=0;t.style.align==="center"?w=0+(t.width-p.width)*.5:t.style.align==="right"&&(w=0+t.width-p.width),w=Math.floor(w),o.moveTo(Math.floor(w),y),o.lineTo(Math.floor(w+p.width),y),a+=p.lineHeight;}),o.stroke({width:r,color:e}),o}};var ci=class extends d{static{h(this,"RichText");}constructor(t,e){super(),re.process(t,e).forEach(r=>new se(r.text,r.style).setPosition(r.position).displayParent(this).attach(this));}};var pi=class extends d{static{h(this,"UpdatableContainer");}},ui=class extends d{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀby=t,this.ƀcu=new Map,this.ƀhw={trackBy:h((i,r)=>r,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀcu.keys()),i=0;t.forEach((r,s)=>{let o=this.ƀhw.trackBy(r,s),a;this.ƀcu.has(o)?(a=this.ƀcu.get(o),e.delete(o),a.update(r)):(a=this.ƀby(r).displayParent(this).attach(this),this.ƀcu.set(o,a)),this.ƀhw.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀhw.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀhw.positioning.spacing);}),e.forEach(r=>{this.ƀcu.get(r).destroy(),this.ƀcu.delete(r);});}};var oe=class n extends d{static{h(this,"MenuUI");}static{this.ƀfx=actionsLib.Reducer.createExistenceChecker();}static{this.isAnyMenuTransitioning=this.ƀfx.notifier;}constructor(t,e){super(),this.ƀho=new actionsLib.SingleAction,this.onCreate=this.ƀho.notifier,this.ƀhq=new actionsLib.SingleAction,this.onOpen=this.ƀhq.notifier,this.ƀhl=new actionsLib.SingleAction,this.onClose=this.ƀhl.notifier,this.ƀbb=false;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.setAlpha(0),this.ƀp=new I(this,"alpha",{animation:x.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState});let r=R.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(i.backgroundDarkeningRatio).setInteractive(true).displayParent(this).attach(this);this.ƀgx=J.createByName(t).setPosition(new helpersLib.Vector(0,0)).setInteractive(true).displayParent(this).attach(this),g.instance.screenSize.subscribe(o=>{r.aspectRatio=o.x/o.y,r.scale=Math.max(o.x,o.y),r.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.half}),this.setPosition(o.multiplyNumber(.5));}).attach(this),this.ƀho.resolve();let s=n.ƀfx.effect().attach(this);this.ƀp.animate({alpha:1}).chain(this).tap(()=>{this.ƀhq.resolve(),s.destroy(),i.closeOnBackgroundClick&&r.on(exports.ContainerEventType.Click).take(1).tap(()=>this.close()).attach(this);}).attachToRoot();}getBoundingMask(){return this.ƀgx.getBoundingMask()}close(){if(!this.ƀbb){this.ƀbb=true;let t=n.ƀfx.effect().attach(this);this.ƀp.animate({alpha:0}).chain(this).map(()=>{this.ƀhl.resolve(),t.destroy(),this.destroy();}).chainToRoot();}return this.onClose.toSingleEvent()}};var fi=class extends wt{static{h(this,"MenuEntity");}static subscribeIsOpen(){return actionsLib.ActionLib.merge(this.continuesSubscription().map(t=>t.type==="open"),actionsLib.SingleEvent.instant(this.getInstance()!==void 0))}constructor(t){super(),this.ƀhw=t,queueMicrotask(()=>{if(!this.ƀgy)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀjf(t){this.ƀgy=t,this.ƀgy.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀgy.onCreate.toSingleEvent()}onOpen(){return this.ƀgy.onOpen.toSingleEvent()}onClose(){return this.ƀgy.onClose.toSingleEvent()}close(){return this.ƀgy.close()}};var mi=class extends U{static{h(this,"MenuView");}constructor(t,e,i){super();let r=helpersLib.JsonHelper.removeUndefinedProperties({appearAnimationDuration:i.appearAnimationDuration,backgroundDarkeningRatio:i.backgroundDarkeningRatio,closeOnBackgroundClick:t.ƀhw.closeOnBackgroundClick}),s=new oe(e,r).displayParent(g.camera.layers.foregroundScreen).attach(this);t.ƀjf(s);let o=new actionsLib.SingleAction;s.onCreate.subscribe(()=>o.resolve(s)).attach(this),this.onCreate=o.notifier,this.onOpen=s.onOpen.notifier,this.onClose=s.onClose.notifier;}};var ro=.65,so=.01,Fe=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀjp}get contentSize(){return this.ƀbm.size.ceil()}constructor(t,e,i,r){this.ƀbm=t,this.ƀv=e,this.ƀhy=i,this.ƀkg=r,this.ƀfu=false,this.ƀjp=e-i*2,this.ƀbm.y=i,this.ƀla=i;}onWheel(t){this.setTarget(this.ƀla-t*ro);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀla=helpersLib.NumberHelper.clamp(t,this.ƀv-this.ƀhy-this.contentSize.y,this.ƀhy);}jumpToTarget(){this.ƀbm.y=this.ƀla;}update(t){let e=this.contentSize;if(e.y<=this.ƀjp){switch(this.ƀkg){case "start":this.ƀla=this.ƀhy;break;case "center":this.ƀla=(this.ƀv-e.y)*.5;break;case "end":this.ƀla=this.ƀv-e.y-this.ƀhy;break;default:{this.ƀkg;throw new Error}}this.ƀfu||(this.ƀbm.y=this.ƀla);}this.ƀfu=true;let i=this.ƀla-this.ƀbm.y;this.ƀbm.y=this.ƀbm.y+i*so*t;}};var no=15,yi=class extends d{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbn}get contentSize(){return this.ƀjq.contentSize}constructor(t,e={}){super();let i={padding:no,smallContentAlign:"start",...e};if(i.padding<0)throw new Error("The padding of the scroll mask cannot be lower than '0'");if(i.padding>t.y*.5)throw new Error("The padding of the scroll mask cannot be higher than half of the size of the area");let r=new d().displayParent(this).attach(this);new Pt(r,t,i.padding).attach(this);let s=new F__namespace.Graphics;s.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),r.ƀip.addChild(s);let o=new d().displayParent(r).attach(this);this.ƀjq=new Fe(o,t.y,i.padding,i.smallContentAlign),this.ƀbn=new helpersLib.Vector(t.x,this.ƀjq.scrollHeight),s.eventMode="dynamic",s.addEventListener("wheel",a=>{this.ƀjq.onWheel(a.deltaY);}),o.setInteractive(true),o.ƀip.addEventListener("wheel",a=>{this.ƀjq.onWheel(a.deltaY);}),m.afterSceneUpdateAction.subscribe(a=>this.ƀjq.update(a.delta)).attach(this),this.addChildTo=o;}scrollToTop(t){this.ƀjq.scrollToTop(),t?.instant&&this.ƀjq.jumpToTarget();}scrollToBottom(t){this.ƀjq.scrollToBottom(),t?.instant&&this.ƀjq.jumpToTarget();}};var ao=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},_=class extends wt{static{h(this,"CameraEntity");}constructor(){super(...arguments),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.offset=new actionsLib.Variable(helpersLib.Vector.zero),this.targetPosition=new actionsLib.Variable(void 0),this.focusingNewTargetInfo=new actionsLib.Variable(void 0);}};_=ao([gt()],_);var ho=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},lo=1500,Le=class{static{h(this,"CameraService");}createCamera(){return new _().attachToRoot()}getCameraPosition(){let t=_.getInstanceOrFail();return helpersLib.Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=_.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=_.getInstanceOrFail();e.focusingNewTargetInfo.value={time:g.time,duration:t?.duration??lo,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??exports.FocusingAnimation.Instant};}update(t,e){let i=_.getInstanceOrFail(),r=i.targetPosition.value;r&&(i.focusingNewTargetInfo.value?this.ƀgc(i,r,t):i.position.value=r);}ƀgc(t,e,i){let r=t.focusingNewTargetInfo.value;if(r.focusingAnimation===exports.FocusingAnimation.Instant)this.ƀbg(t,e);else {let s=(i-r.time)/r.duration;if(s>=1)this.ƀbg(t,e);else {let o;r.focusingAnimation===exports.FocusingAnimation.EaseInOut?o=V.easeInOut(s):r.focusingAnimation===exports.FocusingAnimation.EaseOut?o=V.easeOut(s):o=1;let a=r.position.lerp(e,o);r.roundPosition&&(Math.abs(a.x-r.position.x)>=r.roundPositionThreshold&&(a=new helpersLib.Vector(Math.round(a.x),a.y)),Math.abs(a.y-r.position.y)>=r.roundPositionThreshold&&(a=new helpersLib.Vector(a.x,Math.round(a.y)))),t.position.value=a;}}}ƀbg(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};Le=ho([u()],Le);var co=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},po=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},wi=class{static{h(this,"CameraController");}constructor(t){this.ƀat=t;}createCamera(){return this.ƀat.createCamera().id}update(t,e){this.ƀat.update(t,e);}setPosition(t){this.ƀat.setPosition(t);}setTransition(t){this.ƀat.setTransition(t);}getCameraPosition(){return this.ƀat.getCameraPosition()}};wi=co([tt(exports.CameraGateway),po("design:paramtypes",[Le])],wi);var He=class{static{h(this,"PositionConversionHelper");}static includeScaleInScreenPosition(t,e,i){if(e!==1){let r=helpersLib.Vector.fromTo(i,t).multiplyNumber(1/e);return i.add(r)}else return t}};var fo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},mo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},It=class extends U{static{h(this,"CameraView");}constructor(t){super(),this.ƀdd=t,this.ƀkp=(()=>{let e=new d().attach(this);return e.ƀip=g.instance.ƀio.stage,e})(),this.ƀjk=new d().setAlpha(0).displayParent(this.ƀkp).attach(this),this.ƀaf=R.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(this.ƀkp).attach(this),this.ƀac=new d().displayParent(this.ƀjk).attach(this),this.ƀas=new d().displayParent(this.ƀjk).attach(this),this.ƀdp=new d().setSortableChildren(true).displayParent(this.ƀjk).attach(this),this.ƀar=new d().setSortableChildren(true).displayParent(this.ƀas).attach(this),this.ƀdo=new d().setSortableChildren(true).setRenderGroup().setZIndex(20).displayParent(this.ƀar).attach(this),this.ƀgp=new d().setSortableChildren(true).setRenderGroup().setZIndex(10).displayParent(this.ƀar).attach(this),this.ƀab=new d().setRenderGroup().setZIndex(0).displayParent(this.ƀar).attach(this),this.ƀh=new I(this.ƀjk,"alpha",{duration:500,animation:x.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀag=new I(this.ƀaf,"alpha",{duration:500,animation:x.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),g.instance.screenSize.subscribe(e=>{this.ƀaf.aspectRatio=e.x/e.y,this.ƀaf.scale=Math.max(e.x,e.y),this.ƀaf.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.zero});}).attach(this),this.ƀdd.position.subscribe(e=>{this.ƀar.position=this.ƀbt(e);}).attach(this),this.ƀdd.offset.subscribe(e=>{this.ƀas.position=e;}).attach(this),this.ƀag.set({alpha:0}),this.ƀh.set({alpha:0});}screenPositonToStagePosition(t){let e=He.includeScaleInScreenPosition(t,this.ƀkp.scale,g.instance.screenSizeCenter.value);return new helpersLib.Vector(e.x-this.ƀar.position.x-this.ƀas.position.x,e.y-this.ƀar.position.y-this.ƀas.position.y)}getLayers(){return {backgroundScreen:this.ƀac.id,background:this.ƀab.id,main:this.ƀgp.id,foreground:this.ƀdo.id,foregroundScreen:this.ƀdp.id}}appear(t,e,i){switch(e){case "alpha":return this.ƀag.set({alpha:0}),this.ƀh.set({alpha:t?0:1}),actionsLib.SingleEvent.instant().async(()=>i>0&&m.wait(i),"tap").async(()=>this.ƀh.animate({alpha:t?1:0})).chain(this);case "pureBlack":return this.ƀh.set({alpha:1}),this.ƀag.set({alpha:t?1:0}),actionsLib.SingleEvent.instant().async(()=>i>0&&m.wait(i),"tap").async(()=>this.ƀag.animate({alpha:t?0:1})).chain(this);case "instant":return this.ƀh.set({alpha:t?1:0}),this.ƀag.set({alpha:t?0:1}),actionsLib.SingleEvent.instant();default:{throw new Error}}}ƀbt(t){return helpersLib.Vector.fromTo(t,g.instance.screenSizeCenter.value)}};It=fo([qe({entity:_}),mo("design:paramtypes",[_])],It);var go=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},vi=class{static{h(this,"CameraViewController");}getLayers(){let t=_.getInstanceOrFail().id;return It.getInstanceOrFail(t).getLayers()}appear(t,e,i){let r=_.getInstanceOrFail().id;return It.getInstanceOrFail(r).appear(t,e,i)}screenPositonToStagePosition(t){let e=_.getInstanceOrFail().id;return It.getInstanceOrFail(e).screenPositonToStagePosition(t)}};vi=go([tt(Rt)],vi);var wo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},xo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.KeyboardService=class bi{static{h(this,"KeyboardService");}constructor(){this.ƀge=new actionsLib.Action,this.keyPressed=this.ƀge.notifier,this.ƀgf=new actionsLib.Action,this.keyReleased=this.ƀgf.notifier,this.ƀgl=new Set,this.ƀgk=new Set,window.addEventListener("keydown",t=>{this.ƀgl.add(t.code),this.ƀgk.add(t.code),!t.repeat&&this.ƀge.trigger({key:t.key,code:t.code});}),window.addEventListener("keyup",t=>{this.ƀgl.delete(t.code),this.ƀgf.trigger({key:t.key,code:t.code});}),window.addEventListener("blur",()=>{this.ƀgl.clear();}),m.afterSceneUpdateAction.subscribe(()=>this.ƀgk.clear()).attachToRoot();}isKeyDown(t,e){return (e?.onlyPressedThisFrame?this.ƀgk:this.ƀgl).has(t)}};exports.KeyboardService=wo([u(),xo("design:paramtypes",[])],exports.KeyboardService);var vo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},bo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.MouseService=class he{static{h(this,"MouseService");}constructor(){this.ƀft=new actionsLib.Variable(false),this.initialMouseMovementHappened=this.ƀft.notifier,this.ƀkq=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀkq.notifier,this.ƀjm=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀjm.notifier,this.ƀgo=new actionsLib.Variable(false),this.mainButtonState=this.ƀgo.notifier,this.ƀjr=new actionsLib.Variable(false),this.secondaryButtonState=this.ƀjr.notifier,this.ƀks(),window.addEventListener("pointerdown",t=>{t.button===0?this.ƀgo.value=true:t.button===2&&(this.ƀjr.value=true);},{capture:true}),window.addEventListener("pointerup",t=>{t.button===0?this.ƀgo.value=false:t.button===2&&(this.ƀjr.value=false);},{capture:true}),window.addEventListener("blur",()=>{this.ƀgo.value=false,this.ƀjr.value=false;},{capture:true});}ƀks(){let t=helpersLib.Vector.zero;window.addEventListener("pointermove",e=>{t=new helpersLib.Vector(e.clientX,e.clientY),this.ƀft.value=true;},{capture:true}),m.beforeSceneUpdateAction.subscribe(()=>{this.ƀjm.value=this.ƀba(t);}).attachToRoot(),m.afterSceneUpdateAction.subscribe(()=>{this.ƀkq.value=g.camera.screenPositonToStagePosition(this.ƀjm.value);}).attachToRoot();}ƀba(t){let i=g.instance.renderer.canvas.getBoundingClientRect(),r=i.width,s=i.height;if(r<=0||s<=0)return helpersLib.Vector.zero;let o=g.instance.renderer.screen,a=(t.x-i.left)/r*o.width,l=(t.y-i.top)/s*o.height;return a=helpersLib.NumberHelper.clamp(a,0,o.width),l=helpersLib.NumberHelper.clamp(l,0,o.height),new helpersLib.Vector(a,l)}};exports.MouseService=vo([u(),bo("design:paramtypes",[])],exports.MouseService);var Po=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},So=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.MouseTargetFocusService=class Pi{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀdn}get lastFocusedPosition(){return this.ƀgh}constructor(t){this.ƀhc=t,this.ƀhs=new actionsLib.Action,this.onTargetFocus=this.ƀhs.notifier,this.ƀll=0,this.ƀlm=false,this.ƀdn=false,this.ƀgh=void 0,m.beforeSceneUpdateAction.subscribe(e=>this.ƀlp(e.delta)).attachToRoot();}ƀlp(t){if(this.ƀhd){let e=this.ƀep(this.ƀhc.stagePosition.value,this.ƀhd);this.ƀid===void 0?this.ƀid=e:this.ƀaw(e,t);}this.ƀhd=this.ƀhc.stagePosition.value;}ƀaw(t,e){this.ƀid-t>10?(this.ƀll=Math.max(250,this.ƀll),this.ƀlm=true):this.ƀll>1e3&&(this.ƀlm=true);let i=this.ƀll>=300&&this.ƀlm;this.ƀgd(i,t,e);}ƀgd(t,e,i){(t||e>this.ƀid)&&(this.ƀid=e),t?(this.ƀlm=false,this.ƀll=0,this.ƀdn=true,this.ƀgh=this.ƀhc.stagePosition.value,this.ƀhs.trigger(this.ƀgh)):(this.ƀll+=i,this.ƀdn=false);}ƀep(t,e){let i=helpersLib.Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};exports.MouseTargetFocusService=Po([u(),So("design:paramtypes",[exports.MouseService])],exports.MouseTargetFocusService);var Si=10.8,Ei=10.01;exports.PhysicsShapeType=void 0;(function(n){n[n.Point=1]="Point",n[n.Circle=2]="Circle",n[n.Polygon=3]="Polygon",n[n.Rectangle=4]="Rectangle";})(exports.PhysicsShapeType||(exports.PhysicsShapeType={}));var f=class n{static{h(this,"P2JSHelper");}static aabbToBoundingBox(t){return helpersLib.Rectangle.fromRect({topLeft:{x:t.lowerBound[0],y:t.lowerBound[1]},bottomRight:{x:t.upperBound[0],y:t.upperBound[1]}})}static arrayToVector(t){return new helpersLib.Vector(t[0],t[1])}static vectorToArray(t){return [t.x,t.y]}static arePhysicsGroupsCollidable(t,e,i,r){return (t&r)!==0&&(i&e)!==0}static canCollideWith(t,e){return t.shapes.some(i=>e.shapes.some(r=>n.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new W__default.default.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var lt="border";var Ao=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s};exports.PhysicsGateway=class le extends q(){static{h(this,"PhysicsGateway");}};exports.PhysicsGateway=Ao([u()],exports.PhysicsGateway);var Oo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ct=class extends q(){static{h(this,"PhysicsInternalGateway");}};ct=Oo([u()],ct);var b=class n extends ${static{h(this,"PhysicsEntity");}static{this.ƀhx=new Map;}static{this.ƀih=new Map;}static getFromP2BodyID(t){return n.ƀhx.get(t)}static getFromP2BodyIDOrFail(t){let e=n.ƀhx.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=n.ƀih.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(n.ƀih.values())}get area(){return this.ƀu}get mass(){return this.ƀgs}get collisions(){return this.ƀbc}constructor(t,e,i){super(),this.ƀhm=new actionsLib.Action,this.onCollision=this.ƀhm.notifier,this.type="dynamic",this.ƀu=0,this.ƀgs=0,this.ƀbc=[],this.physicsWorldID=t,this.ƀij=P.get(ct);let r=this.ƀij.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀij.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀii=this.ƀij.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀik=this.ƀij.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀij.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀu=this.p2Body.getArea(),this.ƀgs=this.p2Body.mass,this.p2Body.position=f.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀij.addBody(this.physicsWorldID,this.p2Body,e.addInEmptySpace,e.shapeDefinition.group,e.includeOnPathfinding))throw new Error("PhysicsEntity was not able to be added to the world!");n.ƀhx.set(this.p2Body.id,this),n.ƀih.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀij.removeBody(this.physicsWorldID,this.p2Body),n.ƀhx.delete(this.p2Body.id),n.ƀih.delete(this.id));}canCollideWith(t){return f.arePhysicsGroupsCollidable(this.ƀii,this.ƀik,t.ƀii,t.ƀik)}ƀjt(t){this.ƀbc=t,t.length>0&&this.ƀhm.trigger(t);}};var ce=class extends b{static{h(this,"ImmovablePhysicsEntity");}constructor(t,e){super(t,e,"static"),this.position=f.arrayToVector(this.p2Body.position),this.rotation=new helpersLib.Radian(this.p2Body.angle);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position,rotation:this.rotation,velocity:helpersLib.Vector.zero,rotationalSpeed:0}}};var Ti=class extends ${static{h(this,"MovableEntity");}constructor(){super(),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.rotation=new actionsLib.Variable(helpersLib.Radian.get0),this.velocity=new actionsLib.Variable(helpersLib.Vector.zero),this.rotationalSpeed=new actionsLib.Variable(0),m.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀkw(t,e);}).attach(this);}ƀkw(t,e){this.position.value=this.position.value.add(this.velocity.value.multiplyNumber(e)),this.rotation.value=new helpersLib.Radian(this.rotation.value.value+this.rotationalSpeed.value*e);}};var Ri=class extends b{static{h(this,"MovablePhysicsEntity");}constructor(t,e){super(t,e,"dynamic"),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.rotation=new actionsLib.Variable(helpersLib.Radian.get0),this.velocity=new actionsLib.Variable(helpersLib.Vector.zero),this.rotationalSpeed=new actionsLib.Variable(0),this.ƀfm=false,this.ƀfn=false,this.ƀfp=false,this.ƀfo=false,this.ƀie(),this.ƀgm(),P.get(ct).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀkw(i,r)).attach(this);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position.value,rotation:this.rotation.value,velocity:this.velocity.value,rotationalSpeed:this.rotationalSpeed.value}}ƀkw(t,e){this.ƀfm=true,this.ƀfn=true,this.ƀfp=true,this.ƀfo=true,this.ƀie();}ƀie(){this.position.value=f.arrayToVector(this.p2Body.position),this.rotation.value=new helpersLib.Radian(this.p2Body.angle),this.velocity.value=f.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀgm(){this.position.subscribe(t=>{this.ƀfm?this.ƀfm=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfn?this.ƀfn=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfp?this.ƀfp=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfo?this.ƀfo=false:this.p2Body.angularVelocity=t;}).attach(this);}};var Go=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},_o=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},v=class extends ${static{h(this,"PhysicsWorldEntity");}constructor(t,e,i,r,s,o,a){super(),this.materialDefinitions=new Map,this.physicsBodyGroupToP2Group=new Map,this.physicsBodyGroupToP2Mask=new Map,this.availabilityGridCache=new Map,this.vectorFieldCache=new Map,this.bodiesInContactWith=new Map,this.collisionReports=new Map,this.paused=new actionsLib.Variable(false),this.lastP2Time=new actionsLib.Variable(0),this.onPhysicsStep=new actionsLib.Action,this.mapSize=t,this.mapSizeCenter=this.mapSize.multiplyNumber(.5),this.modifyUpdateCycle=e,this.p2World=i,this.materials=r,this.materialDefinitions=s,this.physicsBodyGroupToP2Group=o,this.physicsBodyGroupToP2Mask=a;}};v=Go([gt(),_o("design:paramtypes",[helpersLib.Vector,Boolean,W__default.default.World,Map,Map,Map,Map])],v);var Lo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},X=class{static{h(this,"PhysicsBodyGroupService");}createBodyGroupsAndMasks(t,e){let i=new Map,r=new Map;return t.map((s,o)=>{if(o>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(s,1<<o),r.set(s,0);}),e.map(([s,o])=>{if(!i.has(s))throw new Error(`Physics body group "${s}" not found`);if(!i.has(o))throw new Error(`Physics body group "${o}" not found`);let a=r.get(s),l=r.get(o),c=i.get(s),p=i.get(o);r.set(s,a|p),r.set(o,l|c);}),{physicsBodyGroupToP2Group:i,physicsBodyGroupToP2Mask:r}}getGroupConstant(t,e){return v.getInstanceByIDOrFail(t).physicsBodyGroupToP2Group.get(e)}getMaskConstant(t,e){return v.getInstanceByIDOrFail(t).physicsBodyGroupToP2Mask.get(e)}canCollide(t,e,i){let r=t.physicsBodyGroupToP2Group.get(e),s=t.physicsBodyGroupToP2Mask.get(e),o=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (s&o)!==0&&(a&r)!==0}};X=Lo([u()],X);var Ho=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},jo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ue=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀig=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((r,s)=>{r.forEach((o,a)=>{this.ƀig.canCollide(t,a,e)&&i.push({grid:o,cellSize:s});});}),i}get(t,e,i){return t.availabilityGridCache.get(e)?.get(i)}set(t,e,i,r){let s=t.availabilityGridCache.get(e);s||(s=new Map,t.availabilityGridCache.set(e,s)),s.set(i,r);}clear(t){t.availabilityGridCache.clear();}};Ue=Ho([u(),jo("design:paramtypes",[X])],Ue);var Wo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Uo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},pt=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀig=t,this.ƀz=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let r=f.aabbToBoundingBox(e.aabb);this.ƀz.getCollidableGrids(t,i).forEach(s=>{let o=D.areaToGridArea(r,s.cellSize);s.grid.setArea(o,false);});}findClosestAvailableSpace(t,e,i,r=50){return e.aabbNeedsUpdate=true,e.updateAABB(),Xt.findByConvertingGridSpace(this.getAvilabilityGrid(t,r,i),f.aabbToBoundingBox(e.aabb),r)}getAvilabilityGrid(t,e,i){let r=this.ƀz.get(t,e,i);return r||(r=this.ƀcb(t,e,i),this.ƀz.set(t,e,i,r)),r}ƀcb(t,e,i){let r=new helpersLib.Grid({size:new helpersLib.Vector(Math.floor(t.mapSize.x/e),Math.floor(t.mapSize.y/e)),defaultValue:true});return t.p2World.bodies.forEach(s=>{let o=b.getFromP2BodyIDOrFail(s.id);if(o.includeInPathfinding&&this.ƀig.canCollide(t,o.physicsBodyGroup,i)){let a=this.ƀeg(s,e);r.setArea(a,false);}}),r}ƀeg(t,e){let i=f.aabbToBoundingBox(t.aabb);return D.areaToGridArea(i,e)}};pt=Wo([u(),Uo("design:paramtypes",[X,Ue])],pt);var zo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Jo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},jt=class{static{h(this,"PathFinderService");}constructor(t){this.ƀif=t;}findPathAStar(t,e,i,r,s){s||(s={}),s.neighborType===void 0&&(s.neighborType="orthogonal"),s.gridCellSize===void 0&&(s.gridCellSize=50);let o=v.getInstanceByIDOrFail(t),a,l;helpersLib.Comparator.isNumber(i)?(l=b.getPhysicsInstanceOrFail(i).p2Body,a=f.arrayToVector(l.position)):a=i;let c=D.positionToGridPosition(e,s.gridCellSize),p=D.positionToGridPosition(a,s.gridCellSize),y=this.ƀif.getAvilabilityGrid(o,s.gridCellSize,r);if(l){let C=f.aabbToBoundingBox(l.aabb),Ct=D.areaToGridArea(C,s.gridCellSize);y.setArea(Ct,true);}let w=Zt.findPath(y,c,p,s.neighborType);return w.path=w.path.map(C=>D.gridPositionToPosition(C,s.gridCellSize)),w}findPathDirection(t,e,i,r,s=50){let o=v.getInstanceByIDOrFail(t),a;if(helpersLib.Comparator.isNumber(i)){let w=b.getPhysicsInstanceOrFail(i);a=f.aabbToBoundingBox(w.p2Body.aabb);}else a=new helpersLib.Rectangle(i,i);let l=D.areaToGridArea(a,s),c=JSON.stringify({targetGridArea:l,collidableWithGroup:r}),p=o.vectorFieldCache.get(c);if(!p){let w=this.ƀif.getAvilabilityGrid(o,s,r);p=new Qt(l,w),o.vectorFieldCache.set(c,p);}let y=D.positionToGridPosition(e,s);return p.getDirectionToTarget(y)}};jt=zo([u(),Jo("design:paramtypes",[pt])],jt);var Ko=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Xo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Q=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀaa=t,this.ƀhz=e;}printPathfindingTestGrid(t,e,i,r,s,o){let a=v.getInstanceByIDOrFail(t);this.ƀaa.getAvilabilityGrid(a,o,r).map((c,p)=>({position:D.gridPositionToPosition(p,o),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(s)){let p=this.ƀhz.findPathDirection(t,c.position,i,r),y;p===void 0?y=R.createRectangleBorders(new helpersLib.Vector(8,8),2,helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):y=R.createArrow(25,c.availability?helpersLib.ColorHelper.green:helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).setRotation(p).attach(a),new I(y,"alpha",{duration:1e3,animation:x.easeIn}).animate({alpha:0}).tap(()=>y.destroy()).attach(y);}});}createExplosionDebugVisual(t,e,i,r,s,o=300){let a=new d().displayParent(e).setAlpha(.5).attach(t);R.createCircle(s,helpersLib.ColorHelper.blue).toSprite().displayParent(a).setPosition(r,{round:false}).setAlpha(.5).attach(t),i.forEach(c=>{let p=c.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;R.createVector(r,c.line.to,p).toSprite().displayParent(a).attach(t);}),new I(a,"alpha",{duration:o,animation:x.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,r,s,o,a=300){let l=new d().displayParent(e).setAlpha(.5).attach(t);R.createElipse(o,helpersLib.ColorHelper.blue).toSprite().displayParent(l).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attach(t),i.forEach(p=>{let y=p.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;R.createVector(p.line.from,p.line.to,y).toSprite().displayParent(l).attach(t);}),new I(l,"alpha",{duration:a,animation:x.easeIn}).animate({alpha:0}).tap(()=>l.destroy()).attach(l);}createPhysicsEntityShapeVisual(t,e,i){let r=i?.overridePosition??f.arrayToVector(t.position),s=i?.overrideRotation??new helpersLib.Radian(t.angle),o=i?.color??helpersLib.ColorHelper.blue,a=new d().displayParent(e).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀcw(c,o).displayParent(a).attachToRoot();}),new I(a,"alpha",{duration:1e3,animation:x.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcw(t,e){switch(t.type){case W__default.default.Shape.PARTICLE:throw new Error("Not implemented");case W__default.default.Shape.LINE:throw new Error("Not implemented");case W__default.default.Shape.PLANE:throw new Error("Not implemented");case W__default.default.Shape.CIRCLE:throw new Error("Not implemented");case W__default.default.Shape.CAPSULE:throw new Error("Not implemented");case W__default.default.Shape.BOX:throw new Error("Not implemented");case W__default.default.Shape.HEIGHTFIELD:throw new Error("Not implemented");case W__default.default.Shape.CONVEX:return this.ƀcv(t,e);default:{t.type;throw new Error}}}ƀcv(t,e){let i=[t.vertices.map(r=>({x:r[0],y:r[1]}))];return R.createPolygon(i,e).toSprite()}};Q=Ko([u(),Xo("design:paramtypes",[pt,jt])],Q);var qo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},tn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},$e=class{static{h(this,"HitTestService");}constructor(t){this.ƀle=t;}hitTest(t,e){let i=t.world,r=b.getFromP2BodyIDOrFail(t.id),s=f.cloneP2Body(t);this.ƀt(s,e);let o=i.broadphase.aabbQuery(i,this.ƀds(s)).map(l=>b.getFromP2BodyIDOrFail(l.id)).filter(l=>l.includeInPathfinding).filter(l=>r.canCollideWith(l)).map(l=>f.cloneP2Body(l.p2Body)),a=false;if(o.length!==0){let l=new W__default.default.World;l.addBody(s),o.forEach(c=>l.addBody(c)),l.step(1,1,1),a=l.narrowphase.contactEquations.some(c=>c.bodyA===s||c.bodyB===s),l.clear();}if(e?.testLayerID){let l=a?helpersLib.ColorHelper.red:helpersLib.ColorHelper.green;this.ƀle.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀt(t,e){e?.overridePosition&&(t.position=f.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀds(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};$e=qo([u(),tn("design:paramtypes",[Q])],$e);var rn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ke=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀje(t,i);});});}step(t,e,i){b.getPhysicsEntities().forEach(r=>{r.ƀbc=[];}),t.p2World.narrowphase.contactEquations.forEach(r=>{this.ƀje(t,r);}),t.bodiesInContactWith.forEach((r,s)=>{this.ƀfd(r.p2Body),r.entity.ƀjt(t.collisionReports.get(s)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀfd(t){let e=f.arrayToVector(t.velocity);e.length>Si&&(e=e.normalize(Si),t.velocity=f.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-Ei),Ei);}ƀje(t,e){let i=b.getFromP2BodyID(e.bodyA.id),r=b.getFromP2BodyID(e.bodyB.id);if(i&&r){t.bodiesInContactWith.set(e.bodyA.id,{p2Body:e.bodyA,entity:i}),t.bodiesInContactWith.set(e.bodyB.id,{p2Body:e.bodyB,entity:r});let s=t.collisionReports.get(e.bodyA.id)||[],o=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀdy(i,r,e);s.push({self:a,target:l}),o.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,s),t.collisionReports.set(e.bodyB.id,o);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀdy(t,e,i){let r=t.convertToDTO(),s=e.convertToDTO(),o=f.arrayToVector(i.contactPointA),a=f.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀen(i);return {collisionDetailsA:this.ƀdx(r,i.bodyA.mass,o,l,t.area),collisionDetailsB:this.ƀdx(s,i.bodyB.mass,a,c,e.area)}}ƀdx(t,e,i,r,s){let o,a=i.add(t.position);return {body:t,getPositionReletiveToObject:h(()=>(o||(o=i.rotate(t.rotation.multiply(-1).vector)),o),"getPositionReletiveToObject"),getPositionOnWorld:h(()=>(a||(a=i.add(t.position)),a),"getPositionOnWorld"),position:i,mass:e,area:s,normal:r}}ƀen(t){let e=f.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};ke=rn([u()],ke);var sn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},on=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},ze=class extends ce{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};ze=sn([gt(),on("design:paramtypes",[Number,Object])],ze);var nn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},j=1e4,Je=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbv(t,new helpersLib.Vector(e.x/2,-j/2),new helpersLib.Vector(e.x+j*2,j),i),this.ƀbv(t,new helpersLib.Vector(e.x/2,e.y+j/2),new helpersLib.Vector(e.x+j*2,j),i),this.ƀbv(t,new helpersLib.Vector(-j/2,e.y/2),new helpersLib.Vector(j,e.y+j*2),i),this.ƀbv(t,new helpersLib.Vector(e.x+j/2,e.y/2),new helpersLib.Vector(j,e.y+j*2),i);}ƀbv(t,e,i,r){return new ze(t,{shapeDefinition:{materialName:lt,group:r,shapeType:exports.PhysicsShapeType.Rectangle,shapeData:i},position:e,rotation:helpersLib.Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};Je=nn([u()],Je);var hn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},dr=new W__default.default.Material,ln={id:lt,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},Wt=class{static{h(this,"MaterialsService");}createMaterials(t,e,i,r){let s=new Map,o=new Map;if(i.forEach(a=>{s.set(a.id,new W__default.default.Material),o.set(a.id,a);}),s.has(lt))throw new Error(`Material with name ${lt} cannot be defined, pick another name for the material.`);return s.set(lt,dr),o.set(lt,ln),this.ƀc(t,e,i,r,s),{materials:s,materialDefinitions:o}}getMaterial(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀel(e,i.materials)}getMaterialDefinition(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀek(e,i.materialDefinitions)}ƀel(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀek(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material definition with name ${t}.`);return i}ƀc(t,e,i,r,s){this.ƀed(i.map(o=>o.id),r).forEach(o=>{let a=this.ƀel(o.materialA,s),l=this.ƀel(o.materialB,s);t.addContactMaterial(new W__default.default.ContactMaterial(a,l,{friction:o.friction,restitution:o.bounciness,stiffness:o.stiffness,relaxation:o.relaxation}));}),this.ƀd(t,e,i,s);}ƀed(t,e){let i=new Map;e.forEach(s=>{let o=i.get(s.materialA);o||(o=new Map,i.set(s.materialA,o)),o.set(s.materialB,s);});let r=[];return t.forEach((s,o)=>{for(let a=o;a<t.length;a++){let l=t[a],c=i.get(s)?.get(l);c?r.push(c):r.push({materialA:s,materialB:l,friction:0,bounciness:0,relaxation:4,stiffness:1e6});}}),r}ƀd(t,e,i,r){i.forEach(s=>{let o=this.ƀel(s.id,r);t.addContactMaterial(new W__default.default.ContactMaterial(o,dr,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};Wt=hn([u()],Wt);var cn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},pn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ut=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,r,s){this.ƀgw=t,this.ƀak=e,this.ƀaa=i,this.ƀbd=r,this.ƀig=s;}createPhysicsWorld(t){let e=new W__default.default.World({gravity:[0,0]}),{materials:i,materialDefinitions:r}=this.ƀgw.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:s,physicsBodyGroupToP2Mask:o}=this.ƀig.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new v(t.mapSize,t.modifyUpdateCycle,e,i,r,s,o).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&m.cleanUpdateModifier();}).attachToRoot(),this.ƀak.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀbd.registerPhysicsWorld(a),t.modifyUpdateCycle?m.registerUpdateModifier((l,c)=>this.ƀkw(a,l,c)):m.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀkw(a,l,c);}).attach(a),a.id}addBody(t,e,i,r,s){let o=v.getInstanceByIDOrFail(t);if(i){let a=this.ƀaa.findClosestAvailableSpace(o,e,r);return a?(e.position[0]+=a.x,e.position[1]+=a.y,o.p2World.addBody(e),s&&this.ƀaa.onBodyAdded(o,e,r),true):false}else return o.p2World.addBody(e),s&&this.ƀaa.onBodyAdded(o,e,r),true}removeBody(t,e){v.getInstanceByID(t)?.p2World.removeBody(e);}ƀkw(t,e,i){if(!t.paused.value){t.availabilityGridCache.clear(),t.vectorFieldCache.clear(),t.p2World.step(i,i,i),t.modifyUpdateCycle&&(i=t.p2World.time-t.lastP2Time.value);let r=e+i;this.ƀbd.step(t,r,i),t.onPhysicsStep.trigger({time:r,delta:i}),t.lastP2Time.value=t.p2World.time;}return i}setPaused(t,e){v.getInstanceByIDOrFail(e).paused.set(t);}};Ut=cn([u(),pn("design:paramtypes",[Wt,Je,pt,ke,X])],Ut);var dn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},kt=class{static{h(this,"RayCastingService");}castClosest(t,e,i){let r=new W__default.default.RaycastResult,s=new W__default.default.Ray({mode:W__default.default.Ray.CLOSEST,from:f.vectorToArray(e.from),to:f.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i)});if(t.p2World.raycast(r,s),r.hasHit())return this.ƀbq(r,e)}castAllFirstContacts(t,e,i){let r=new Map,s=new W__default.default.Ray({mode:W__default.default.Ray.ALL,from:f.vectorToArray(e.from),to:f.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i),callback:h(o=>{let a=r.get(o.body);!r.has(o.body)||o.fraction<a.fraction?r.set(o.body,this.ƀbq(o,e)):o.fraction===a.fraction&&a.isExternal()&&r.set(o.body,this.ƀbq(o,e));},"callback")});return t.p2World.raycast(new W__default.default.RaycastResult,s),Array.from(r.values())}ƀbq(t,e){let i=t.fraction,r=f.arrayToVector(t.normal),s,o,a;return {body:t.body,hitPosition:h(()=>(s===void 0&&(s=e.from.lerp(e.to,i)),s),"hitPosition"),hitDistance:h(()=>(o===void 0&&(o=e.length*i),o),"hitDistance"),isExternal:h(()=>(a===void 0&&(a=e.fromTo.dotProduct(r)<0),a),"isExternal"),normal:r,fraction:i,line:e}}};kt=dn([u()],kt);var fn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ft=class{static{h(this,"ImpactService");}applyImpulse(t,e,i,r){let s=i.normalize(r),o=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(f.vectorToArray(s),o);}};ft=fn([u()],ft);var mn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},zt=class{static{h(this,"RayCastHitConverterService");}toExplosionHits(t,e=true){let i=new Map;return t.forEach(r=>{r.hits.forEach(s=>{let o=i.get(s.body);if(o){let a=s.fraction<o.closestRaycastHit.fraction?s:o.closestRaycastHit;o.rayCastHits.push(s),i.set(s.body,{hitCount:o.hitCount+1,closestRaycastHit:a,rayCastHits:o.rayCastHits,isExternal:e?o.isExternal:o.isExternal&&s.isExternal(),explosionCenter:s.line.from});}else {let a=s.isExternal();i.set(s.body,{hitCount:1,closestRaycastHit:s,rayCastHits:[s],isExternal:a,explosionCenter:s.line.from});}});}),[...i.values()].map(r=>this.ƀbr(r,t.length))}ƀbr(t,e){let i=t.hitCount/e,r=t.rayCastHits;if(t.isExternal)return {body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:true,normal:t.closestRaycastHit.normal,fraction:t.closestRaycastHit.fraction,ratioOfHits:i,raycastResults:r,getHitPosition:t.closestRaycastHit.hitPosition,getHitDistance:t.closestRaycastHit.hitDistance};{let s=f.arrayToVector(t.closestRaycastHit.body.position);return {body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:false,normal:helpersLib.Vector.fromTo(s,t.explosionCenter).normalize(),fraction:0,ratioOfHits:i,raycastResults:r,getHitPosition:h(()=>t.explosionCenter,"getHitPosition"),getHitDistance:h(()=>0,"getHitDistance")}}}};zt=mn([u()],zt);var gn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},wn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},bn=15,Ke=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,r){this.ƀja=t,this.ƀle=e,this.ƀiz=i,this.ƀfq=r;}createElipticExplosion(t,e,i,r,s,o,a){let l=v.getInstanceByIDOrFail(t),c=this.ƀcg(e,i,r,s,a?.hitOnlyClosest===true,l),p=this.ƀiz.toExplosionHits(c,false);return this.ƀr(p,o),a?.testLayerID&&this.ƀle.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,r,a.debugRayDuration),p.map(y=>{let{p2Body:w,...C}=y;return C})}ƀcg(t,e,i,r,s,o){let a=[],l=e.vector,c=e.add(helpersLib.Radian.get90).vector,p=c.normalize(i.x);a.push(new helpersLib.Line(t,t.add(p))),a.push(new helpersLib.Line(t,t.add(p.multiplyNumber(-1))));let y=l.normalize(i.y);a.push(new helpersLib.Line(t,t.add(y))),a.push(new helpersLib.Line(t,t.add(y.multiplyNumber(-1))));let w=Math.round(i.y/bn),C=i.y/(w*2+1)*2,Ct=l.normalize(C),pe=i.x,mr=Math.pow(i.y,2);return helpersLib.ArrayHelper.createIntegerArray(w).forEach(yt=>{let At=C*(yt+1),Ai=Ct.multiplyNumber(yt+1),ue=c.normalize(this.ƀev(pe,mr,At)),de=t.add(Ai);a.push(new helpersLib.Line(de,de.add(ue))),a.push(new helpersLib.Line(de,de.add(ue.multiplyNumber(-1))));let fe=t.add(Ai.multiplyNumber(-1));a.push(new helpersLib.Line(fe,fe.add(ue))),a.push(new helpersLib.Line(fe,fe.add(ue.multiplyNumber(-1))));}),a.map(yt=>{if(s){let At=this.ƀja.castClosest(o,yt,r);return {line:yt,hits:At?[At]:[]}}else {let At=this.ƀja.castAllFirstContacts(o,yt,r);return {line:yt,hits:At}}})}ƀev(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀr(t,e){t.forEach(i=>{i.raycastResults.forEach(r=>{let s,o;r.isExternal()?(s=r.line.fromTo,o=e*2):(s=r.line.fromTo.multiplyNumber(-1),o=e*(1-r.fraction)*8),this.ƀfq.applyImpulse(r.body,r.hitPosition(),s,o);});});}};Ke=gn([u(),wn("design:paramtypes",[kt,Q,zt,ft])],Ke);var Pn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Sn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Xe=class{static{h(this,"ExplosionService");}constructor(t,e,i,r){this.ƀja=t,this.ƀle=e,this.ƀiz=i,this.ƀfq=r;}createExplosion(t,e,i,r,s,o){let a=v.getInstanceByIDOrFail(t),l=this.ƀet(i),c=this.ƀcg(e,i,r,l,o?.hitOnlyClosest===true,a),p=this.ƀiz.toExplosionHits(c);return this.ƀr(e,i,s,l,p),o?.testLayerID&&this.ƀle.createExplosionDebugVisual(a,o.testLayerID,c,e,i,o.debugRayDuration),p}ƀcg(t,e,i,r,s,o){let a=new helpersLib.Radian(helpersLib.PI_360/r),l=new helpersLib.Vector(0,-e),c=a.vector;return helpersLib.ArrayHelper.createEmptyArray(r).map(()=>{let p=t.add(l);return l=l.rotate(c),new helpersLib.Line(t,p)}).map(p=>{if(s){let y=this.ƀja.castClosest(o,p,i);return {line:p,hits:y?[y]:[]}}else {let y=this.ƀja.castAllFirstContacts(o,p,i);return {line:p,hits:y}}})}ƀr(t,e,i,r,s){s.forEach(o=>{if(o.isExternal)o.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀfq.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=helpersLib.Vector.fromTo(t,f.arrayToVector(o.p2Body.position)),l=a.length/e,c=i*r*l/2;this.ƀfq.applyImpulse(o.p2Body,o.getHitPosition(),a,c);}});}ƀet(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};Xe=Pn([u(),Sn("design:paramtypes",[kt,Q,zt,ft])],Xe);var Cn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Jt=class{static{h(this,"PhysicsQueryService");}getMapSize(t){let e=v.getInstanceByIDOrFail(t);return {dimentions:e.mapSize,center:e.mapSizeCenter}}subscribeToPhysicsStep(t,e){return v.getInstanceByIDOrFail(t).onPhysicsStep.subscribe(e)}};Jt=Cn([u()],Jt);var An=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},On=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ii=class{static{h(this,"PhysicsController");}constructor(t,e,i,r,s,o,a,l){this.ƀin=t,this.ƀhz=e,this.ƀle=i,this.ƀdh=r,this.ƀda=s,this.ƀfi=o,this.ƀim=a,this.ƀfq=l;}createPhysicsWorld(t){return this.ƀin.createPhysicsWorld(t)}getMapSize(t){return this.ƀim.getMapSize(t)}setPaused(t,e){this.ƀin.setPaused(t,e);}hitTest(t,e){let i=b.getPhysicsInstanceOrFail(t);return this.ƀfi.hitTest(i.p2Body,e)}findPath(t,e,i,r,s){return this.ƀhz.findPathAStar(t,e,i,r,{neighborType:s})}findPathDirection(t,e,i,r){return this.ƀhz.findPathDirection(t,e,i,r)}applyImpulse(t,e,i,r){let s=b.getPhysicsInstanceOrFail(t);this.ƀfq.applyImpulse(s.p2Body,e,i,r);}createExplosion(t,e,i,r,s,o){return this.ƀdh.createExplosion(t,e,i,r,s,o)}createElipticExplosion(t,e,i,r,s,o,a){return this.ƀda.createElipticExplosion(t,e,i,r,s,o,a)}printPathfindingTestGrid(t,e,i,r,s,o=50){this.ƀle.printPathfindingTestGrid(t,e,i,r,s,o);}};Ii=An([tt(exports.PhysicsGateway),On("design:paramtypes",[Ut,jt,Q,Xe,Ke,$e,Jt,ft])],Ii);var Mn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ze=class{static{h(this,"ShapeCreationService");}createBody(t,e,i,r,s){let o=v.getInstanceByIDOrFail(t);if(!o.physicsBodyGroupToP2Group.has(e.shapeDefinition.group))throw new Error(`Physics body group "${e.shapeDefinition.group}" not found`);switch(e.shapeDefinition.shapeType){case exports.PhysicsShapeType.Point:return this.ƀbx(o,void 0,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Circle:return this.ƀbx(o,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Polygon:return this.ƀcf(o,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Rectangle:return this.ƀch(o,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);default:{e.shapeDefinition.shapeType;throw new Error}}}ƀbx(t,e,i,r,s,o){let a=new W__default.default.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s),radius:e});a.material=i;let l=new W__default.default.Body({type:o==="dynamic"?W__default.default.Body.DYNAMIC:W__default.default.Body.STATIC,mass:r.density,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return l.addShape(a),l}ƀcf(t,e,i,r,s,o){let a=t.physicsBodyGroupToP2Group.get(s),l=t.physicsBodyGroupToP2Mask.get(s),c=e.map(w=>new W__default.default.Convex({vertices:w.map(C=>[C.x,C.y]),collisionGroup:a,collisionMask:l})).map(w=>(w.material=i,w)),p=c.reduce((w,C)=>w+C.area,0),y=new W__default.default.Body({type:o==="dynamic"?W__default.default.Body.DYNAMIC:W__default.default.Body.STATIC,mass:p,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.forEach(w=>y.addShape(w)),y.setDensity(r.density),y}ƀch(t,e,i,r,s,o){let a=new W__default.default.Box({width:e.x,height:e.y,collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s)});a.material=i;let l=e.x*e.y,c=new W__default.default.Body({type:o==="dynamic"?W__default.default.Body.DYNAMIC:W__default.default.Body.STATIC,mass:l,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.addShape(a),c.setDensity(r.density),c}};Ze=Mn([u()],Ze);var Dn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Bn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ci=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,r,s){this.ƀin=t,this.ƀil=e,this.ƀkd=i,this.ƀim=r,this.ƀig=s;}createBody(t,e,i,r,s){return this.ƀkd.createBody(t,e,i,r,s)}getMaterial(t,e){return this.ƀil.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀil.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀig.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀig.getMaskConstant(t,e)}addBody(t,e,i,r,s){return this.ƀin.addBody(t,e,i,r,s)}removeBody(t,e){this.ƀin.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀim.subscribeToPhysicsStep(t,e)}};Ci=Dn([tt(ct),Bn("design:paramtypes",[Ut,Wt,Ze,Jt,X])],Ci);exports.AdvancedSound=ht;exports.AnimationFlicker=Di;exports.AnimationInterpolationFunctions=V;exports.Animations=x;exports.Animator=I;exports.BORDER_MATERIAL_NAME=lt;exports.BardLegendsHardReset=E;exports.Camera=qt;exports.ClosestAvailableSpaceHelper=Xt;exports.Container=d;exports.ControllerDecorator=tt;exports.DEFAULT_SHADER_RESOLUTION=N;exports.DeltaTime=oi;exports.DisplayObjectArray=ui;exports.Entity=$;exports.EntityDecorator=gt;exports.FadeInContent=Hi;exports.Game=g;exports.Gateway=q;exports.Graphics=R;exports.ImmovablePhysicsEntity=ce;exports.MenuEntity=fi;exports.MenuUI=oe;exports.MenuView=mi;exports.MovableEntity=Ti;exports.MovablePhysicsEntity=Ri;exports.Music=ee;exports.MusicPlayer=hi;exports.PathFinder=Zt;exports.PhysicsEntity=b;exports.Placeholder=li;exports.ROTATIONAL_SPEED_LIMIT=Ei;exports.RichText=ci;exports.SOUND_TRANSITION_DURATION=K;exports.SPEED_LIMIT=Si;exports.Scene=Ot;exports.SceneDecorator=Cr;exports.ScrollAreaUI=yi;exports.ScrollMaskUI=Pt;exports.Service=P;exports.ServiceDecorator=u;exports.SingletonEntity=wt;exports.SlideInContent=zi;exports.SlideInContentByIndex=si;exports.SlideStateAnimation=Re;exports.Sound=te;exports.Sprite=J;exports.StateAnimation=Gt;exports.Text=se;exports.ThroughEmptyStateAnimation=ve;exports.UpdatableContainer=pi;exports.UpdateCycle=m;exports.VectorFieldPathFinder=Qt;exports.VectorSet=Et;exports.View=U;exports.ViewDecorator=qe;
45
+ }`,e}constructor(t,e){if(super({glProgram:F__namespace.GlProgram.from({vertex:F__namespace.defaultFilterVert,fragment:n.ƀec(t*N)}),resources:{expandUniforms:{uColor:{value:new Float32Array(3),type:"vec3<f32>"},uExpandSquared:{value:0,type:"f32"}}},resolution:N}),this.ƀdf=t,this.ƀdf=t*N,this.ƀdf<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀdf>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");helpersLib.Comparator.isInteger(this.ƀdf)||(this.ƀdf=Math.floor(this.ƀdf));let i=helpersLib.ColorHelper.normalize(e);this.resources.expandUniforms.uniforms.uColor=new Float32Array([i.red,i.green,i.blue]),this.resources.expandUniforms.uniforms.uExpandSquared=this.ƀdf*this.ƀdf,this.padding=this.ƀdf;}};var Ee=class extends F__namespace.Filter{static{h(this,"GlowFilter");}constructor(t){super({resolution:N,compatibleRenderers:F__namespace.RendererType.WEBGL});let e={blurRadius:1,expand:0,color:helpersLib.ColorHelper.white,...t};this.ƀdg=new Se(e.expand,e.color);let i=helpersLib.Comparator.isNumber(e.blurRadius)?new helpersLib.Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀaj=new Bt(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀaj.blendMode="screen";}apply(t,e,i,r){let s=F__namespace.TexturePool.getSameSizeTexture(e);this.ƀdg.apply(t,e,s,true),this.ƀaj.apply(t,s,i,r),F__namespace.TexturePool.returnTexture(s);}};var Yt=class n{static{h(this,"GlowSpriteGenerator");}static{this.ƀew=new Map;}static createGlowSpriteFromSprite(t,e,i){let r=this.ƀbh(e),s=helpersLib.Comparator.isNumber(r.blurRadius)?new helpersLib.Vector(r.blurRadius,r.blurRadius):r.blurRadius,o=this.ƀee(t.texture,s,r.expand,r.color,i),a=new F__namespace.Sprite(o);return this.ƀjv(a,helpersLib.Vector.fromVec2(t.anchor),Math.max(s.x,s.y)+r.expand),a.alpha=r.glowAlpha,a.blendMode=r.blendMode,a}static ƀee(t,e,i,r,s){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(s){let o=`${t.id}-${i}-${e.x}-${e.y}-${r.r}-${r.g}-${r.b}`;if(n.ƀew.has(o))return n.ƀew.get(o);{let a=this.ƀef(t,e,i,r);return n.ƀew.set(o,a),a}}else return this.ƀef(t,e,i,r)}static ƀef(t,e,i,r){let s=new F__namespace.Sprite(t);s.filters=[new Ee({blurRadius:e,expand:i,color:r})];let o=new F__namespace.Container;o.addChild(s);let a=Math.max(e.x,e.y)+i,l=g.instance.renderer.generateTexture({target:o,frame:new F__namespace.Rectangle(-a,-a,s.width+a*2,s.height+a*2)});return l.id=M.insertAsset(l),o.destroy({children:true}),l}static ƀjv(t,e,i){let r=(i+(t.width-i*2)*e.x)/t.width,s=(i+(t.height-i*2)*e.y)/t.height;t.anchor.set(r,s);}static ƀbh(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:helpersLib.ColorHelper.white,blendMode:"add"};return t&&(e={...e,...t}),e}};E.onHardReset.subscribe(()=>{Yt.ƀew.clear();}).attachToRoot();var J=class n extends d{static{h(this,"Sprite");}static createByName(t){let e=g.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new n(e)}static createSnapshotSprite(t){let e=t.ƀip,i=e.parent;i&&i.removeChild(e);let r=g.instance.renderer.generateTexture({target:e,resolution:2,antialias:true,textureSourceOptions:{scaleMode:"linear"}});i&&i.addChild(e);let o={id:M.insertAsset(r),scale:t.scale,size:t.size,anchor:helpersLib.Vector.zero,destroyAssetOnDestroy:true};return new n(o,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀli=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀko=t,this.pixiSprite=new F__namespace.Sprite(M.getAsset(t.id)),this.ƀip.addChild(this.pixiSprite),this.setTextureScale(t.scale),e.textureSize&&(this.pixiSprite.width=e.textureSize.x,this.pixiSprite.height=e.textureSize.y),e.texturePosition&&this.pixiSprite.position.set(e.texturePosition.x,e.texturePosition.y),e.ignoreAnchor||this.pixiSprite.anchor.set(t.anchor.x,t.anchor.y);}destroy(){this.destroyed||(super.destroy(),this.ƀko.destroyAssetOnDestroy&&(M.destroyAsset(this.ƀko.id),this.ƀiq&&M.destroyAsset(this.ƀiq.texture.id)),this.ƀgr?.destroy(),this.ƀal?.destroy(),this.ƀiq&&!this.ƀiq.destroyed&&this.ƀiq.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀli}set textureScale(t){this.ƀli=t,this.pixiSprite.scale.set(t);}get size(){return new helpersLib.Vector(this.pixiSprite.width,this.pixiSprite.height)}getMask(){return this.pixiSprite}set interactive(t){super.interactive=t,t&&this.ƀko.boundingShapes&&!this.ƀip.hitArea&&(this.ƀip.hitArea=new hs(this.ƀko.boundingShapes,this.size,helpersLib.Vector.fromVec2(this.ƀko.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.source.autoGenerateMipmaps}set mipmap(t){this.pixiSprite.texture.source.autoGenerateMipmaps=t;}setBlendMode(t){return this.blendMode=t,this}get blendMode(){return this.pixiSprite.blendMode}set blendMode(t){this.pixiSprite.blendMode=t;}setTint(t){return this.tint=t,this}get tint(){return new F__namespace.Color(this.pixiSprite.tint).toRgb()}set tint(t){this.pixiSprite.tint=t;}setShapeAlpha(t){return this.pixiSprite.alpha=t,this}get shapeAlpha(){return this.pixiSprite.alpha}set shapeAlpha(t){this.pixiSprite.alpha=t;}setGlowAlpha(t){return this.glowAlpha=t,this}get glowAlpha(){if(this.ƀiq)return this.ƀiq.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀiq)this.ƀiq.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=helpersLib.Vector.fromVec2(this.ƀko.anchor).to(t);return new helpersLib.Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀiq&&(this.ƀiq.destroy(),this.ƀiq=void 0),t&&(this.ƀiq=Yt.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀko.destroyAssetOnDestroy),this.ƀiq.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀiq.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀip.addChild(this.ƀiq)),this}showBoundingShape(t){return t?this.ƀal||(this.ƀal=this.ƀbw().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀal&&(this.ƀal.destroy(),this.ƀal=void 0),this}getBoundingMask(){if(!this.ƀgr){if(!this.ƀko.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀgr=this.ƀbw(),this.ƀgr.displayParent(this);}return this.ƀgr}ƀbw(){if(!this.ƀko.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return R.createPolygon(this.ƀko.boundingShapes,helpersLib.ColorHelper.white).toSprite().attach(this)}download(){let t=g.instance.renderer.extract.canvas(this.ƀip);if(!t.toBlob)throw new Error("Sprite: canvas.toBlob is undefined!");return t.toBlob(e=>{if(!e)throw new Error("Sprite: blob is undefined!");let i=document.createElement("a");document.body.append(i),i.download="sprite.png",i.href=URL.createObjectURL(e),i.click(),i.remove();},"image/png"),this}},hs=class{static{h(this,"CompositeHitArea");}constructor(t,e,i){this.ƀke=t.map(r=>new F__namespace.Polygon(r.map(s=>new F__namespace.Point(s.x,s.y))));}contains(t,e){return this.ƀke.some(i=>i.contains(t,e))}};var Te=class{static{h(this,"DashedLineHelper");}static getLines(t,e,i){let r=helpersLib.Vector.fromTo(t,e),s=r.normalize(),o=r.length-i.lineStartGap-i.lineEndGap,a=[];if(o<=0)return a;let l=t.add(s.normalize(i.lineStartGap));if(o<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(s.normalize(o))}),a;let c=o-i.dashGap,p=i.dashLength+i.dashGap,y=Math.floor(c/p),w=c-p*y;y>=1&&w<i.dashLength&&(w+=p,y--);let C=s.normalize(w/2),Ct=s.normalize(i.dashGap);if(a.push({from:l,to:l.add(C)}),l=l.add(C),y>0){let pe=s.normalize(i.dashLength);helpersLib.ArrayHelper.createEmptyArray(y).forEach(()=>{l=l.add(Ct),a.push({from:l,to:l.add(pe)}),l=l.add(pe);});}return l=l.add(Ct),a.push({from:l,to:l.add(C)}),a}};var R=class n extends d{static{h(this,"Graphics");}static{this.ƀcx=new Map;}static createArrow(t,e){let i=new F__namespace.Graphics;return [[{x:0,y:-t/2},{x:t*3/8,y:-t/8},{x:t/4,y:0},{x:0,y:-t/4},{x:-t/4,y:0},{x:-t*3/8,y:-t/8}],[{x:0,y:-t/4},{x:t/8-t/30,y:-t/8-t/30},{x:t/8-t/30,y:t*7/16},{x:-t/8+t/30,y:t*7/16},{x:-t/8+t/30,y:-t/8-t/30}]].forEach(s=>{i.poly(s.map(o=>new F__namespace.Point(o.x,o.y))).fill(e);}),new n(i,JSON.stringify({type:"arrow",size:t,color:e}))}static createDashedLine(t,e,i){let r={width:2,dashLength:10,dashGap:4,lineStartGap:0,lineEndGap:0,color:helpersLib.ColorHelper.white,...i},s=new F__namespace.Graphics;return Te.getLines(t,e,r).forEach(a=>{s.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),s.stroke({width:r.width,color:r.color}),new n(s,JSON.stringify({type:"dashedLine",from:t,to:e,options:r}))}static createVector(t,e,i){let r=new F__namespace.Graphics;return r.moveTo(t.x,t.y),r.lineTo(e.x,e.y),r.stroke({width:2,color:i}),r.circle(t.x,t.y,3),r.fill(helpersLib.ColorHelper.white),r.stroke({width:1,color:i}),new n(r,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let r=new F__namespace.Graphics;return r.rect(0,0,t.x,e),r.rect(0,e,e,t.y-e*2),r.rect(t.x-e,e,e,t.y-e*2),r.rect(0,t.y-e,t.x,e),r.fill(i),new n(r,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=helpersLib.ColorHelper.white){let i=new F__namespace.Graphics;return i.rect(0,0,t.x,t.y).fill(e),new n(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new F__namespace.Graphics;return i.circle(0,0,t).fill(e),new n(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new F__namespace.Graphics;return i.ellipse(0,0,t.x,t.y).fill(e),new n(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new F__namespace.Graphics,r=JSON.stringify({type:"polygon",polygon:t,color:e});return t.forEach(s=>{i.poly(s.map(o=>new F__namespace.Point(o.x,o.y))).fill(e);}),new n(i,r)}static createRegularPolygon(t,e,i){let r=new F__namespace.Graphics,s=new helpersLib.Radian(helpersLib.PI_360/t);r.moveTo(e,0);for(let o=1;o<=t;o++){let l=s.multiply(o).vector.normalize(e),c=e+l.x,p=e+l.y;r.lineTo(c,p);}return r.fill(i),new n(r,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.ƀip.addChild(t),this.pixiGraphics=t,this.ƀao=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀao,cache:false,...t},i=this.ƀer(e.cacheName,e.cache),r={id:i.textureID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},s=new J(r,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),s}ƀer(t,e){if(e){let i=n.ƀcx.get(t);return i||(i=this.ƀci(),n.ƀcx.set(t,i)),i}else return this.ƀci()}ƀci(){let t=g.instance.renderer.generateTexture(this.pixiGraphics);t.id=M.insertAsset(t);let e=this.pixiGraphics.getBounds();return {textureID:t.id,bounds:new helpersLib.Vector(e.x,e.y)}}};var ri=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},Pt=class n extends d{static{h(this,"ScrollMaskUI");}static{this.ƀcx=new Map;}constructor(t,e,i,r=exports.ScrollDirection.Vertical){if(super(),i<0)throw new Error("The padding of the scroll mask cannot be lower than '0'");if(e.y<i*2)throw new Error(`The height of the scroll mask cannot be lower than '${i*2}'`);let s=new d;r===exports.ScrollDirection.Horizontal?this.ƀcc(e,i,s):this.ƀcj(e,i,s),this.ƀgr=J.createSnapshotSprite(s).attach(this),s.destroy(),t.setMask(this.ƀgr);}ƀcj(t,e,i){e>0&&this.ƀbz(new helpersLib.Vector(t.x,e)).displayParent(i).attach(i),R.createRectangle(new helpersLib.Vector(t.x,t.y-e*2),helpersLib.ColorHelper.white).toSprite().setPosition(new helpersLib.Vector(0,e),{round:false}).displayParent(i).attach(i),e>0&&this.ƀbz(new helpersLib.Vector(t.x,e)).setPosition(new helpersLib.Vector(t.x,t.y),{round:false}).setRotation(helpersLib.Radian.get180).displayParent(i).attach(i);}ƀcc(t,e,i){e>0&&this.ƀbz(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(0,t.y),{round:false}).setRotation(helpersLib.Radian.get270).displayParent(i).attach(i),R.createRectangle(new helpersLib.Vector(t.x-e*2,t.y),helpersLib.ColorHelper.white).toSprite().setPosition(new helpersLib.Vector(e,0),{round:false}).displayParent(i).attach(i),e>0&&this.ƀbz(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(t.x,0),{round:false}).setRotation(helpersLib.Radian.get90).displayParent(i).attach(i);}ƀbz(t){let i={id:this.ƀca(t.y),scale:1,size:t,anchor:{x:0,y:0}};return new J(i,{textureSize:t,ignoreAnchor:true})}ƀca(t){let e=JSON.stringify({type:"gradient",length:t}),i=n.ƀcx.get(e);if(!i){let r=document.createElement("canvas");r.width=1,r.height=t;let s=r.getContext("2d");if(s){let o=new ri;helpersLib.ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${o.multiplierFunction(l/t)})`;s.fillStyle=c,s.fillRect(0,l,1,1);});let a=F__namespace.Texture.from(r);i=M.insertAsset(a),n.ƀcx.set(e,i);}else throw new Error("Canvas context is null")}return i}};exports.SlideStateAnimationState=void 0;(function(n){n[n.Appear=1]="Appear",n[n.Disappear=2]="Disappear";})(exports.SlideStateAnimationState||(exports.SlideStateAnimationState={}));var Re=class extends actionsLib.Attachable{static{h(this,"SlideStateAnimation");}onStateChange(t){return this.ƀhr.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀht.subscribe(e=>t(e.value,e.index)).attach(this),this}get state(){return {value:this.ƀkv.state.value,item:this.ƀfs,nextItem:this.ƀhi,queuedItem:this.ƀkv.state.queuedItem,animationState:this.ƀo}}constructor(t){super(),this.ƀo="idle",this.ƀhr=new actionsLib.Action,this.ƀht=new actionsLib.Action,this.ƀhw={duration:500,animation:x.easeInOutCubic,...t},this.ƀkv=new Gt({duration:this.ƀhw.duration,animation:this.ƀhw.animation}).onStateChange((e,i)=>this.ƀez(e,i)).onValueChange(e=>this.ƀfe(e)).attach(this);}setIndex(t,e){if(!helpersLib.Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀfs===void 0?(this.ƀfs=t,this.ƀhr.trigger({state:exports.SlideStateAnimationState.Appear,index:t}),this.ƀkv.setItem(t,e)):this.ƀfs!==t?this.ƀhi!==t?this.ƀo==="idle"?(this.ƀo=t>this.ƀfs?"transitionForward":"transitionBackward",this.ƀhi=t,this.ƀhr.trigger({state:exports.SlideStateAnimationState.Appear,index:this.ƀhi}),this.ƀkv.setItem(t,e)):this.ƀkv.setItem(t,e):this.ƀo==="reverting"&&this.ƀhi===t&&(this.ƀo=t>this.ƀfs?"transitionForward":"transitionBackward",this.ƀkv.setItem(t,e)):(this.ƀo==="transitionForward"||this.ƀo==="transitionBackward")&&(this.ƀo="reverting",this.ƀkv.setItem(t,e));}ƀez(t,e){switch(this.ƀfs!==void 0&&this.ƀfs!==t&&this.ƀfs!==e&&this.ƀhr.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀfs}),this.ƀhi!==void 0&&this.ƀhi!==t&&this.ƀhi!==e&&this.ƀhr.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀhi}),e!==void 0&&e!==this.ƀfs&&e!==this.ƀhi&&this.ƀhr.trigger({state:exports.SlideStateAnimationState.Appear,index:e}),this.ƀo){case "idle":break;case "transitionForward":case "transitionBackward":e===void 0?(this.ƀo="idle",this.ƀfs=this.ƀhi,this.ƀhi=void 0):this.ƀfs!==t&&this.ƀfa(t,e);break;case "reverting":e===void 0?(this.ƀo="idle",this.ƀhi=void 0):this.ƀfs!==e&&this.ƀfa(t,e);break;default:{this.ƀo;throw new Error}}}ƀfa(t,e){this.ƀfs=t,this.ƀhi=e,this.ƀht.trigger({value:0,index:this.ƀfs}),this.ƀo=this.ƀfs<this.ƀhi?"transitionForward":"transitionBackward";}ƀfe(t){let e=1;(this.ƀo==="transitionBackward"||this.ƀo==="reverting"&&this.ƀfs!==void 0&&this.ƀhi!==void 0&&this.ƀfs>this.ƀhi)&&(e=-1),(this.ƀo==="idle"||t!==0)&&this.ƀht.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(-e*t),index:this.ƀfs}),this.ƀhi!==void 0&&this.ƀht.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀhi});}};exports.ScrollDirection=void 0;(function(n){n[n.Horizontal=1]="Horizontal",n[n.Vertical=2]="Vertical";})(exports.ScrollDirection||(exports.ScrollDirection={}));var si=class extends d{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀby=t,this.ƀcs="x",this.ƀbo=new Map,this.ƀhw={duration:300,animation:x.easeInOutCubic,size:new helpersLib.Vector(500,500),margin:20,direction:exports.ScrollDirection.Horizontal,...e};let i=this.ƀhw.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(this.ƀhw.size.x+this.ƀhw.margin*2,this.ƀhw.size.y):new helpersLib.Vector(this.ƀhw.size.x,this.ƀhw.size.y+this.ƀhw.margin*2),r=new d().setPosition(this.ƀhw.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(-this.ƀhw.margin,0):new helpersLib.Vector(0,-this.ƀhw.margin),{round:false}).displayParent(this).attach(this);this.ƀcd(i,this.ƀhw.margin,this.ƀhw.direction,r),this.ƀcs=this.ƀhw.direction===exports.ScrollDirection.Horizontal?"x":"y",this.ƀkv=new Re({duration:this.ƀhw.duration,animation:this.ƀhw.animation}).onStateChange((s,o)=>{if(s===exports.SlideStateAnimationState.Appear){let a=new d().displayParent(this).attach(this);this.ƀbo.set(o,a),this.ƀby({index:o,container:a});}else {let a=this.ƀbo.get(o);a&&(a.destroy(),this.ƀbo.delete(o));}}).onValueChange((s,o)=>{let a=this.ƀbo.get(o);if(a){let l={x:0,y:0};l[this.ƀcs]=i[this.ƀcs]*s+this.ƀhw.margin,a.setPosition(helpersLib.Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=r;}setIndex(t,e){return this.ƀkv.setIndex(t,e),this}ƀcd(t,e,i,r){new Pt(r,new helpersLib.Vector(t.x,t.y),e,i).attach(this);}},zi=class extends si{static{h(this,"SlideInContent");}constructor(t,e,i){super(r=>{let s=this.indexToItem.get(r.index);if(s)e({index:r.index,item:s,container:r.container});else throw new Error(`SlideInContent: The item with index '${r.index}' is not part of the items list`)},i),this.itemToIndex=new Map,this.indexToItem=new Map,t.forEach((r,s)=>{this.itemToIndex.set(r,s),this.indexToItem.set(s,r);});}setItem(t,e){let i=this.itemToIndex.get(t);if(i!==void 0)this.setIndex(i,e);else throw new Error(`SlideInContent: The item '${t}' is not part of the items list`);return this}};var Et=class{static{h(this,"VectorSet");}constructor(){this.ƀlv=new Map;}add(t){let e=this.ƀlv.get(t.x);e||(e=new Set,this.ƀlv.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀlv.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀlv.get(t.x);return e?e.delete(t.y):false}};var oi=class{static{h(this,"DeltaTime");}static adjustMultiplier(t,e){return Math.pow(t,e)}};var D=class{static{h(this,"PositionToGridPositionConverter");}static areaToGridArea(t,e){return new helpersLib.Rectangle(this.positionToGridPosition(t.topLeft,e),this.positionToGridPosition(t.bottomRight,e))}static positionToGridPosition(t,e){return t.divideNumber(e).floor()}static gridPositionToPosition(t,e){return t.add(new helpersLib.Vector(.5,.5)).multiplyNumber(e)}};var Xt=class{static{h(this,"ClosestAvailableSpaceHelper");}static findByConvertingGridSpace(t,e,i){let r=new helpersLib.Vector(Math.ceil(e.size.x/i)-1,Math.ceil(e.size.y/i)-1),s=D.areaToGridArea(e,i);if(this.ƀav(t,s))return helpersLib.Vector.zero;let o=t.movePositionInsideGrid(s.topLeft),a=helpersLib.Vector.fromTo(s.topLeft,o),l=this.find(t,o,r);if(l){let c=l.add(a),p=helpersLib.Vector.fromTo(s.topLeft.multiplyNumber(i),e.topLeft);return new helpersLib.Vector(c.x*i+((r.x+1)*i-e.size.x)/2-p.x,c.y*i+((r.y+1)*i-e.size.y)/2-p.y)}}static find(t,e,i){let r=new Et,s=new helpersLib.Queue(e);for(;s.notEmpty;){let o=s.pop();r.add(o);let a=new helpersLib.Rectangle(o,o.add(i));if(this.ƀav(t,a))return helpersLib.Vector.fromTo(e,o);t.getNeighborPositions(o,"orthogonal").forEach(l=>{r.has(l)||s.add(l);});}}static ƀav(t,e){if(!t.isAreaWithinBounds(e))return false;for(let i=e.topLeft.y;i<=e.bottomRight.y;i++)for(let r=e.topLeft.x;r<=e.bottomRight.x;r++)if(!t.get(new helpersLib.Vector(r,i)))return false;return true}};var Ji=Math.SQRT2-1,Ss=class{static{h(this,"PathfinderNode");}constructor(t,e){this.position=t,this.distanceToEnd=e,this.closed=false,this.distanceFromStart=Number.MAX_SAFE_INTEGER,this.parent=void 0;}get pathLength(){return this.distanceFromStart+this.distanceToEnd}getStepCost(t){return this.position.x!==t.position.x&&this.position.y!==t.position.y?Math.SQRT2:1}createSolutionPath(t){let e=[],i=this;for(;i!==void 0;)e.push(i.position),i=i.parent;return e.reverse(),{directPathAvailable:t,path:e}}},Es=class{static{h(this,"PathfinderGrid");}constructor(t,e,i,r){this.ƀey=t,this.ƀlc=i,this.ƀhh=r,this.ƀhv=new helpersLib.BinaryHeap("min"),this.ƀhk=new helpersLib.Grid({size:t.size,defaultValue:void 0});let s=this.ƀce(e);s.distanceFromStart=0,this.ƀhv.add(s.pathLength,s),this.ƀae=s;}get hasOpenNodes(){return this.ƀhv.size>0}getNeighbors(t){let e=[];for(let i of this.ƀey.getNeighborPositions(t.position,this.ƀhh))if(this.ƀey.get(i)){let r=this.ƀhk.get(i)??this.ƀce(i);r.closed||e.push(r);}return e}popLowestPathCostNode(){let t=this.ƀhv.pop();return t.closed=true,t.distanceToEnd<this.ƀae.distanceToEnd&&(this.ƀae=t),t}changeNodeCost(t,e,i){t.distanceFromStart=e,t.parent=i,this.ƀhv.updatePriority(t,t.pathLength)||this.ƀhv.add(t.pathLength,t);}getBestClosedNode(){return this.ƀae}ƀce(t){let e=Math.abs(t.x-this.ƀlc.x),i=Math.abs(t.y-this.ƀlc.y),r=this.ƀhh==="orthogonal"?e+i:e>i?e+Ji*i:i+Ji*e,s=new Ss(t,r);return this.ƀhk.isPointWithinBounds(t)&&this.ƀhk.set(t,s),s}},Zt=class{static{h(this,"PathFinder");}static findPath(t,e,i,r){let s=new Es(t,e,i,r);for(;s.hasOpenNodes;){let o=s.popLowestPathCostNode();if(o.position.isEqual(i))return o.createSolutionPath(true);for(let a of s.getNeighbors(o)){let l=o.distanceFromStart+o.getStepCost(a);l<a.distanceFromStart&&s.changeNodeCost(a,l,o);}}return s.getBestClosedNode().createSolutionPath(false)}};var Qt=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀlb=t,this.ƀy=e,this.ƀfh=this.ƀeh(this.ƀy.size),this.ƀme=new helpersLib.Grid({size:this.ƀy.size,defaultValue:this.ƀfh}),this.ƀct=new helpersLib.Grid({size:this.ƀy.size,defaultValue:void 0});let i=new Et,r=new helpersLib.Queue;for(this.ƀdu(this.ƀy.cropAreaOutsideOfTheGrid(t)).forEach(o=>{this.ƀme.set(o,0),r.add(o);});r.notEmpty;){let o=r.pop();if(!i.has(o)){i.add(o);let a=this.ƀme.getOrFail(o);this.ƀem(o,this.ƀy).forEach(l=>{if(!i.has(l.position)){let c=this.ƀme.getOrFail(l.position),p=a+l.distance;this.ƀy.getOrFail(l.position)&&p<c&&(this.ƀme.set(l.position,p),r.add(l.position));}});}}}getDirectionToTarget(t){if(!t.isInsideRectangle(this.ƀlb)){if(t=this.ƀme.movePositionInsideGrid(t),this.ƀct.has(t))return this.ƀct.get(t);{let e=this.ƀem(t,this.ƀy),i;return this.ƀme.getOrFail(t)>=this.ƀfh?e.some(s=>this.ƀy.get(s.position))&&(e.some(o=>!this.ƀy.get(o.position))?i=this.ƀeb(e):i=this.ƀdw(t,e)):i=this.ƀdw(t,e),this.ƀct.set(t,i),i}}}ƀeb(t){let e=t.filter(i=>this.ƀy.get(i.position)).map(i=>i.direction.radian);return helpersLib.Radian.getAverage(...e)}ƀdw(t,e){let i=e.filter(r=>this.ƀme.getOrFail(r.position)<this.ƀfh).reduce((r,s)=>{let o=this.ƀme.getOrFail(s.position)+s.distance;return o<r.bestWeight?(r.bestDirections=[s.direction],r.bestWeight=o):o===r.bestWeight&&r.bestDirections.push(s.direction),r},{bestDirections:[],bestWeight:this.ƀfh}).bestDirections;return this.ƀes(i,t)}ƀes(t,e){if(t.length>0){let i=t.reduce((r,s)=>r.add(s),helpersLib.Vector.zero);if(i.isZero()||!this.ƀfy(e,i))return helpersLib.Random.pickRandomElement(t).radian;if(t.length>=1)return i.radian}}ƀfy(t,e){let i=t.add(this.ƀlw(e));return this.ƀy.isPointWithinBounds(i)&&this.ƀy.getOrFail(i)}ƀem(t,e){return this.ƀme.getNeighborDirections(t,"all").map(i=>({position:t.add(i),direction:i,distance:i.x!==0&&i.y!==0?14:10}))}ƀdu(t){let e=[];for(let i=t.topLeft.y;i<=t.bottomRight.y;i++)for(let r=t.topLeft.x;r<=t.bottomRight.x;r++)e.push(new helpersLib.Vector(r,i));return e}ƀlw(t){let e=t.normalize().round();return new helpersLib.Vector(e.x,e.y)}ƀeh(t){return (t.x+t.y)*20}};var S=class n{static{h(this,"AudioAssets");}static{this.ƀan=new Map;}static{this.context=new AudioContext;}static async load(t){await Promise.all(t.map(e=>fetch(e.url).then(i=>i.arrayBuffer()).then(i=>this.context.decodeAudioData(i)).then(i=>this.ƀan.set(e.id,i))));}static createSource(t){let e=n.ƀdv(t),i=n.context.createBufferSource();return i.buffer=e,i}static ƀdv(t){let e=this.ƀan.get(t);if(!e)throw new Error(`Audio: Sound with id ${t} was not loaded.`);return e}};E.onHardReset.subscribe(()=>{S.context=new AudioContext,S.ƀan.clear();}).attachToRoot();var K=1e3,Y=class n{static{h(this,"Audio");}static ƀjy(){return this.ƀfv=new n,this.ƀfv}constructor(){this.ƀgu=S.context.createGain(),this.ƀgt=S.context.createGain(),this.ƀhg=S.context.createGain(),this.ƀkh=S.context.createGain(),this.ƀgu.connect(S.context.destination),this.ƀgt.connect(this.ƀgu),this.ƀhg.connect(this.ƀgt),this.ƀkh.connect(this.ƀgt),this.ƀgv=new I(this.ƀgu.gain,"value",{duration:500*2,animation:x.easeIn,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀgv.set({value:0});}setVolumes(t){this.ƀgt.gain.value=t.master,this.ƀhg.gain.value=t.music,this.ƀkh.gain.value=t.sound;}appear(t,e="ease"){switch(e){case "ease":return this.ƀgv.set({value:t?0:1}),this.ƀgv.animate({value:t?1:0}).chainToRoot();case "instant":return this.ƀgv.set({value:t?1:0}),actionsLib.SingleEvent.instant();default:{throw new Error}}}};E.onHardReset.subscribe(()=>{Y.ƀjy();}).attachToRoot();var As=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s};exports.CameraGateway=class nt extends q(){static{h(this,"CameraGateway");}};exports.CameraGateway=As([u()],exports.CameraGateway);var Os=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Rt=class extends q(){static{h(this,"CameraViewGateway");}};Rt=Os([u()],Rt);var Ki;(function(n){n.BackgroundScreen="backgroundScreen",n.Background="background",n.Main="main",n.Foreground="foreground",n.ForegroundScreen="foregroundScreen";})(Ki||(Ki={}));exports.FocusingAnimation=void 0;(function(n){n[n.Instant=1]="Instant",n[n.EaseInOut=2]="EaseInOut",n[n.EaseOut=3]="EaseOut";})(exports.FocusingAnimation||(exports.FocusingAnimation={}));var qt=class{static{h(this,"Camera");}get position(){return this.ƀaq.getCameraPosition()}constructor(){this.ƀaq=P.get(exports.CameraGateway),this.ƀau=P.get(Rt),this.ƀaq.createCamera(),this.layers=this.ƀau.getLayers();}setPosition(t){this.ƀaq.setPosition(t);}setTransition(t){this.ƀaq.setTransition(t);}appear(t,e="alpha",i=0){return this.ƀau.appear(t,e,i)}screenPositonToStagePosition(t){return this.ƀau.screenPositonToStagePosition(t)}};var g=class n{static{h(this,"Game");}static get instance(){return this.ƀfv}static{this.pause=actionsLib.Reducer.createOr();}static{this.freeze=actionsLib.Reducer.createOr();}static get camera(){return this.ƀap}static get audio(){return this.ƀx}static appear(t,e){let i=e?.audio??"ease",r=e?.camera??"alpha";return actionsLib.ActionLib.all([this.audio.appear(t,i),this.camera.appear(t,r,i!=="instant"?0:500)]).mapToVoid().chainToRoot()}static get time(){return m.ƀlj}static get setupOptions(){return this.ƀkb}constructor(t){if(this.ƀjn=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSize=this.ƀjn.notifier,this.ƀjo=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSizeCenter=this.ƀjo.notifier,this.devMode=false,n.ƀfv)throw new Error("There can be only one Game instance!");this.ƀbk={screenResolution:void 0,maxScreenResolution:void 0,devMode:false,backgroundColor:helpersLib.ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbk.devMode||false,this.ƀio=new F__namespace.Application;let e=n.pause.effect(false).attachToRoot();n.freeze.subscribe(i=>{e.update(i),i?S.context.suspend():S.context.resume();}).attachToRoot();}async setup(t){n.ƀkb=t;let e=helpersLib.JsonHelper.removeUndefinedProperties({backgroundColor:this.ƀbk.backgroundColor,autoStart:false,antialias:this.ƀbk.antialias,resolution:this.ƀbk.resolution,width:this.ƀbk.screenResolution?.width,height:this.ƀbk.screenResolution?.height,useBackBuffer:true,powerPreference:"high-performance",eventFeatures:{globalMove:false}});await this.ƀio.init(e);let i=document.body.appendChild(this.ƀio.canvas);this.ƀjx(i),await Promise.all([M.loadGameAssets(t.spriteAssetDefinitions),M.loadGameAssets(t.fontAssetDefinitions),S.load(t.soundAssetDefinitions)]),n.ƀfv=this,this.renderer=this.ƀio.renderer,globalThis.ƀa=this.ƀio,this.ƀfc(),n.ƀap=new qt,n.ƀx=Y.ƀjy(),this.ƀio.start(),this.ƀio.ticker.add(()=>{n.freeze.value||m.triggerUpdateTick(this.ƀio.ticker.deltaMS);});}setResolution(t){if(this.ƀio.renderer.resolution!==t){this.ƀio.renderer.resolution=t;let e=this.ƀeq();this.ƀio.renderer.resize(e.x,e.y);}}ƀfc(){this.ƀdb(),this.ƀjw(),window.addEventListener("resize",t=>{this.ƀdb(),this.ƀjw();});}ƀdb(){let t=this.ƀeq();(t.x!==this.ƀio.screen.width||t.y!==this.ƀio.screen.height)&&this.ƀio.renderer.resize(t.x,t.y);}ƀjw(){let t=new helpersLib.Vector(this.ƀio.screen.width,this.ƀio.screen.height);this.ƀjn.value=t,this.ƀjo.value=t.multiplyNumber(.5).round();}ƀeq(){let t=this.ƀbk.screenResolution?.width??window.innerWidth,e=this.ƀbk.screenResolution?.height??window.innerHeight;return this.ƀbk.maxScreenResolution&&(t=Math.min(t,this.ƀbk.maxScreenResolution.width),e=Math.min(e,this.ƀbk.maxScreenResolution.height)),new helpersLib.Vector(t,e)}ƀjx(t){this.ƀbk.maxScreenResolution&&(t.style.maxWidth=`${this.ƀbk.maxScreenResolution?.width}px`,t.style.maxHeight=`${this.ƀbk.maxScreenResolution?.height}px`),t.style.width="100%",t.style.height="100%";}};var te=class n extends actionsLib.IDAttachable{static{h(this,"Sound");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`Sound: Could not find sound definition with name ${t}.`);return new n(i,e)}get volume(){return this.ƀdq.gain.value}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀdq.gain.value=t,this}constructor(t,e){super(),this.ƀki=t,this.ƀdq=S.context.createGain(),this.ƀdq.connect(Y.ƀfv.ƀkh),this.ƀfg=this.ƀdq,e?.volume!==void 0&&(this.volume=e.volume),this.ƀiu(e?.time??0);}destroy(){this.destroyed||(super.destroy(),this.ƀkx(),this.ƀdq?.disconnect());}ƀlt(){this.ƀfg.disconnect(),this.ƀfg.connect(Y.ƀfv.ƀhg);}ƀiu(t){this.ƀkx();let e=this.ƀki.loop;if(this.ƀkr=helpersLib.NumberHelper.clamp(t,0,e?e.to:this.ƀki.duration),e){let i=e.from,r=e.to;this.ƀiv({soundID:this.ƀki.id,start:this.ƀkr,end:this.ƀkr<i?i:r,loop:false,onComplete:h(()=>{this.ƀkl.disconnect(),this.ƀiv({soundID:this.ƀki.id,start:i,end:r,loop:true});},"onComplete")});}else this.ƀiv({soundID:this.ƀki.id,start:this.ƀkr,end:void 0,loop:false,onComplete:h(()=>this.destroy(),"onComplete")});}ƀkx(){this.ƀkl&&(this.ƀkl.onended=null,this.ƀkl.stop(),this.ƀkl.disconnect());}ƀiv(t){this.ƀkl=S.createSource(t.soundID),this.ƀkl.connect(this.ƀdq),t.onComplete&&(this.ƀkl.onended=t.onComplete),t.loop?(this.ƀkl.loop=true,this.ƀkl.loopStart=t.start,this.ƀkl.loopEnd=t.end??this.ƀkl.buffer.duration,this.ƀkl.start(0,t.start)):this.ƀkl.start(0,t.start,t.end?t.end-t.start:void 0);}};var Fs=800,Ae=-128,ht=class n extends te{static{h(this,"AdvancedSound");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new n(i,e)}constructor(t,e){super(t,e),this.ƀlj=new actionsLib.Variable(0),this.time=this.ƀlj.notifier,this.ƀkt=S.context.currentTime-this.ƀkr,this.ƀlj.value=this.ƀkr,m.beforeSceneUpdateAction.subscribe(()=>{this.ƀlj.value=S.context.currentTime-this.ƀkt;}).attach(this),this.ƀfg.disconnect(),this.ƀjz(e?.fade?helpersLib.NumberHelper.clamp(e.fade,0,1):0),this.ƀka(e?.muffle?helpersLib.NumberHelper.clamp(e.muffle,0,1):0),this.ƀfg.connect(Y.ƀfv.ƀkh);}ƀjz(t=0){this.ƀdj=S.context.createGain(),this.ƀdj.gain.value=1-t,this.ƀdi=new I(this.ƀdj.gain,"value",{duration:500,animation:x.lineer,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀfg.connect(this.ƀdj),this.ƀfg=this.ƀdj;}ƀka(t=0){this.ƀhe=S.context.createBiquadFilter(),this.ƀhe.type="highshelf",this.ƀhe.frequency.value=Fs,this.ƀhe.gain.value=t*Ae,this.ƀhf=new I(this.ƀhe.gain,"value",{duration:500,animation:x.lineer,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀfg.connect(this.ƀhe),this.ƀfg=this.ƀhe;}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.fade(1,K).notIdle().chain(this).tap(()=>this.destroy()).chainToRoot())}notifyOnTime(t){return this.time.value>t?actionsLib.SingleEvent.createDestroyed():actionsLib.SingleEvent.create(e=>{let i=this.time.filter(r=>r>=t).tap(()=>e()).attach(this);return ()=>i.destroy()})}setFade(t){t=helpersLib.NumberHelper.clamp(t,0,1),this.ƀdi.set({value:1-t});}fade(t,e=500){t=helpersLib.NumberHelper.clamp(t,0,1);let i=t>1-this.ƀdj.gain.value;return e===0?(this.ƀdi.set({value:1-t}),actionsLib.SingleEvent.instant()):this.ƀdi.animate({value:1-t},{duration:e,animation:i?x.easeOut:x.easeIn}).chain(this)}setMuffle(t){t=helpersLib.NumberHelper.clamp(t,0,1),this.ƀhf.set({value:t*Ae});}muffle(t,e=500){return t=helpersLib.NumberHelper.clamp(t,0,1),e===0?(this.ƀhf.set({value:t*Ae}),actionsLib.SingleEvent.instant()):this.ƀhf.animate({value:t*Ae},{duration:e}).chain(this)}destroy(){this.destroyed||(this.ƀdj.disconnect(),this.ƀhe.disconnect()),super.destroy();}};var ee=class n extends actionsLib.IDAttachable{static{h(this,"Music");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new n(i,e)}get time(){switch(this.ƀkk.value.type){case "paused":return this.ƀkk.value.value.time;case "playing":return this.ƀkk.value.value.time.value;default:{this.ƀkk.value;throw new Error}}}get volume(){return this.ƀkk.value.value.volume}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀkk.value.value.volume=t,this}constructor(t,e){super(),this.ƀhw={stopPlayingOnPause:true,...e},this.ƀkj=t.id;let i;if(this.ƀhw.stopPlayingOnPause&&g.pause.value)i={type:"paused",value:{time:0,volume:1}};else {let r=new ht(t,this.ƀhw).attach(this);r.ƀlt(),i={type:"playing",value:r};}this.ƀkk=new actionsLib.Variable(i),this.ƀhw.stopPlayingOnPause&&(this.ƀib=g.pause.subscribe(r=>this.ƀfb(r)).attach(this));}notifyOnTime(t){return actionsLib.SingleEvent.create(e=>{let i=this.ƀkk.asyncDropOngoing((r,s)=>{switch(r.type){case "paused":s.drop();break;case "playing":return r.value.notifyOnTime(t);default:{throw new Error}}}).toSingleEvent().tap(()=>e()).attach(this);return ()=>i.destroy()})}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.ƀib?.destroy(),actionsLib.SingleEvent.instant().async(()=>actionsLib.ActionLib.all([this.ƀkk.value.type==="playing"?this.ƀkk.value.value.close():actionsLib.SingleEvent.instant(),this.ƀdk?.onDestroy()??actionsLib.SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀfb(t){if(t){if(this.ƀkk.value.type==="playing"){let e=this.ƀkk.value.value;this.ƀkk.value={type:"paused",value:{time:e.time.value,volume:e.volume}},this.ƀdk=e,actionsLib.ActionLib.all([e.fade(1,K),e.muffle(1,K)]).tap(()=>{this.ƀdk=void 0,e.destroy();}).attach(this);}}else if(this.ƀkk.value.type==="paused"){let{volume:e,time:i}=this.ƀkk.value.value,r=ht.createByName(this.ƀkj,{volume:e,time:i,fade:1,muffle:1}).attach(this);r.ƀlt(),actionsLib.ActionLib.all([r.fade(0,K),r.muffle(0,K)]).attach(this),this.ƀkk.value={type:"playing",value:r};}}};var hi=class extends actionsLib.IDAttachable{static{h(this,"MusicPlayer");}get time(){return this.ƀiw?this.ƀiw.time:0}get volume(){return this.ƀmd}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀmd=t,this.ƀiw&&(this.ƀiw.volume=t),this.ƀia&&(this.ƀia.volume=t),this}constructor(t){super(),this.ƀmd=1,this.ƀhw={stopPlayingOnPause:true,playWhenPaused:void 0,volume:1,...t},this.ƀmd=this.ƀhw.volume,this.ƀhw.playWhenPaused&&this.ƀkc(this.ƀhw.playWhenPaused);}play(t){if(this.ƀbb)throw new Error("Play is called while music player is destroyed.");return this.ƀco=t,actionsLib.SingleEvent.instant().async(()=>{let e=this.ƀiw;if(e)return this.ƀiw=void 0,e.close()}).map(()=>{if(this.ƀco===t)return this.ƀiw=ee.createByName(t,{stopPlayingOnPause:this.ƀhw.stopPlayingOnPause,volume:this.ƀmd}).attach(this),this.ƀiw}).chain(this)}stop(){return actionsLib.SingleEvent.instant().async(()=>{let t=this.ƀiw;if(t)return t.close().tap(()=>{t===this.ƀiw&&(this.ƀiw=void 0);})}).chain(this)}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.ƀib?.destroy(),actionsLib.SingleEvent.instant().async(()=>actionsLib.ActionLib.all([this.ƀiw?.close()??actionsLib.SingleEvent.instant(),this.ƀia?.close()??actionsLib.SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀkc(t){this.ƀib=g.pause.toSequence().asyncDropOngoing(e=>e&&m.wait(K).map(()=>e)).tap(e=>{if(e)this.ƀia=ht.createByName(t,{fade:1,volume:this.ƀmd}).attach(this),this.ƀia.ƀlt(),this.ƀia.fade(0);else if(this.ƀia){let i=this.ƀia;this.ƀia.fade(1).tap(()=>i.destroy()).attach(this),this.ƀia=void 0;}}).attach(this);}};var li=class extends d{static{h(this,"Placeholder");}constructor(t){super(),this.ƀir=new F__namespace.Graphics,this.ƀir.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),this.ƀip.addChild(this.ƀir);}destroy(){this.destroyed||(super.destroy(),this.ƀir.destroy());}};var Ft=class{static{h(this,"TextStyleConverter");}static getPixiTextStyle(t){let e={color:helpersLib.ColorHelper.white,align:"center",fontFamily:"Arial",fontStyle:"normal",fontSize:18,lineHeight:void 0,wordWrapWidth:void 0,lineThrough:false,...t},i=t?.dropShadow===true?{}:t?.dropShadow,r={};if(i){let s={blur:4,angle:helpersLib.Radian.get60,distance:10,color:helpersLib.ColorHelper.black,alpha:.5,...i};r={dropShadow:{blur:s.blur,angle:s.angle.value,distance:s.distance,color:helpersLib.ColorHelper.rgbToHex(s.color),alpha:s.alpha}};}return helpersLib.JsonHelper.removeUndefinedProperties({fontFamily:e.fontFamily,fill:helpersLib.ColorHelper.rgbToHex(e.color),align:e.align,fontSize:e.fontSize,fontStyle:e.fontStyle,lineHeight:e.lineHeight,wordWrapWidth:e.wordWrapWidth,wordWrap:e.wordWrapWidth!==void 0,lineThrough:e.lineThrough,...r})}};var De=class{static{h(this,"RichTextDataInConverter");}static process(t,e){let i=new Set(e.styles?Object.keys(e.styles):[]),r=scriptEngineLib.RichTextSeparator.process(t,i),s=this.ƀfr(r,e),o=this.ƀs(s);return this.ƀkm(o)}static ƀfr(t,e){let i=new Map,r=new Map,s=h((a,l)=>{if(r.has(l))return r.get(l);let c=Ft.getPixiTextStyle(a);return r.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀdz(a.tags,e,i),p=s(l,c),y=F__namespace.CanvasTextMetrics.measureText(" ",new F__namespace.TextStyle(p),void 0,false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:y.width}})}static ƀdz(t,e,i){let r=t.join("+");if(i.has(r))return {style:i.get(r),cacheKey:r};let s=this.ƀbf(t,e);return i.set(r,s),{style:s,cacheKey:r}}static ƀbf(t,e){let i={...e.default};for(let l of t)e.styles&&e.styles[l]&&(i={...i,...e.styles[l]});let{wordWrapWidth:r,align:s,dropShadow:o,...a}=i;return a}static ƀs(t){let e=[],i=[];return t.forEach((r,s)=>{r.text.split(/\r?\n/).forEach((a,l)=>{l>0&&(e.push(i),i=[]),i.push({text:a,cacheKey:r.cacheKey,style:r.style,pixiStyle:r.pixiStyle,spaceWidth:r.spaceWidth});});}),e.push(i),e}static ƀkm(t){let e=[];return t.forEach(i=>{if(i.length===0)throw new Error("Internal Error: Line is unexpectedly empty");let r=i.flatMap(s=>this.ƀkn(s.text).map(a=>{let l=new F__namespace.TextStyle(s.pixiStyle),c=F__namespace.CanvasTextMetrics.measureText(a,l,void 0,false);return {text:a,whitespace:a.trim()==="",style:{cacheKey:s.cacheKey,style:s.style,pixiStyle:l,height:c.height,ascent:c.fontProperties.ascent,descent:c.fontProperties.descent,width:c.width,spaceWidth:s.spaceWidth}}}));e.push(r);}),e}static ƀkn(t){if(t==="")return [""];let e=[],i="",r=t[0]===" ";for(let s=0;s<t.length;s++){let o=t[s],a=o===" ";a===r?i+=o:(e.push(i),i=o,r=a);}return i&&e.push(i),e}};var Be=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀcm.length===0}get remainingWidth(){return this.ƀmf-this.ƀcp}constructor(t,e){this.ƀmf=t,this.ƀgj=[],this.ƀcm=[],this.ƀcp=0,this.ƀgi=new helpersLib.Vector(0,0),this.ƀcn=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀfj=i.horizontalAlignment,this.ƀlx=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀmf||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀcq={direction:i.rectangleCutOption.direction,rectangle:this.ƀbs(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀcn,t.y),i=this.ƀei(this.ƀgi.y,this.ƀgi.y+e);return this.ƀcp+t.x<=i}insertWord(t){let e=Math.max(this.ƀcn,t.style.height);if(this.ƀcm.length===0){let i=this.ƀej(this.ƀgi.y,this.ƀgi.y+e);this.ƀgi=new helpersLib.Vector(i,this.ƀgi.y),this.ƀcp=this.ƀgi.x;}this.ƀcm.push({chunk:t,position:new helpersLib.Vector(this.ƀcp,this.ƀgi.y)}),this.ƀcn=e,this.ƀcp+=t.style.width;}newLine(){let t=this.ƀgi.y+this.ƀcn,e=this.ƀej(t,t);this.ƀdm(),this.ƀgi=new helpersLib.Vector(e,t),this.ƀcp=this.ƀgi.x,this.ƀcn=0;}print(){return this.ƀdm(),this.ƀgj}ƀdm(){this.ƀcm.length>0&&(this.ƀgj.push(this.ƀg(this.ƀcm)),this.ƀcm=[]);}ƀg(t){return t=this.ƀlz(t),t=this.ƀfl(t),t}ƀfl(t){if(this.ƀfj==="left")return t;let e=this.ƀgi.y+this.ƀcn,i=this.ƀej(this.ƀgi.y,e),s=this.ƀei(this.ƀgi.y,e)-i,o=Math.min(s,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀfj==="center"?a=(s-o)/2:a=s-o,t.map(l=>(l={chunk:l.chunk,position:new helpersLib.Vector(l.position.x+a,l.position.y)},l))}ƀlz(t){let e=Math.max(...t.map(r=>r.chunk.style.ascent)),i=Math.max(...t.map(r=>r.chunk.style.descent));return t.map(r=>{let s;switch(this.ƀlx){case "top":s=i-r.chunk.style.descent;break;case "center":s=(i-r.chunk.style.descent+e-r.chunk.style.ascent)*.5;break;case "bottom":s=e-r.chunk.style.ascent;break;default:{this.ƀlx;throw new Error}}return r={chunk:r.chunk,position:new helpersLib.Vector(r.position.x,r.position.y+s)},r})}ƀej(t,e){return this.ƀcq&&(this.ƀcq.direction==="topLeft"||this.ƀcq.direction==="bottomLeft")&&(this.ƀcq.rectangle.isPointInside(new helpersLib.Vector(0,t),{includeEdges:false})||this.ƀcq.rectangle.isPointInside(new helpersLib.Vector(0,e),{includeEdges:false}))?this.ƀcq.rectangle.bottomRight.x:0}ƀei(t,e){return this.ƀcq&&(this.ƀcq.direction==="topRight"||this.ƀcq.direction==="bottomRight")&&(this.ƀcq.rectangle.isPointInside(new helpersLib.Vector(this.ƀmf,t),{includeEdges:false})||this.ƀcq.rectangle.isPointInside(new helpersLib.Vector(this.ƀmf,e),{includeEdges:false}))?this.ƀcq.rectangle.topLeft.x:this.ƀmf}ƀbs(t){let e,i;switch(t.direction){case "topRight":e=new helpersLib.Vector(t.position.x,-1/0),i=new helpersLib.Vector(1/0,t.position.y);break;case "topLeft":e=new helpersLib.Vector(-1/0,-1/0),i=t.position;break;case "bottomRight":e=t.position,i=new helpersLib.Vector(1/0,1/0);break;case "bottomLeft":e=new helpersLib.Vector(-1/0,t.position.y),i=new helpersLib.Vector(t.position.x,1/0);break;default:{t.direction;throw new Error}}return new helpersLib.Rectangle(e,i)}};var Ge=class{static{h(this,"ConsistentSpaceTextWrapper");}static wrapText(t,e){return t.forEach(i=>{i.forEach((r,s)=>{if(e.isSpaceAvailable(new helpersLib.Vector(r.style.width,r.style.height)))if(r.whitespace&&s===i.length-2){let o=i[i.length-1];e.isSpaceAvailable(new helpersLib.Vector(o.style.width+r.style.width,o.style.height))?e.insertWord(r):this.ƀmg(r,e);}else e.insertWord(r);else e.lineIsEmpty?e.insertWord(r):r.whitespace?this.ƀmg(r,e):(e.newLine(),e.insertWord(r));}),e.newLine();}),e.print()}static ƀmg(t,e){let i=Math.max(0,Math.floor(e.remainingWidth/t.style.spaceWidth)),r=Math.max(0,Math.min(i,t.text.length-1));if(r>0){let o={text:" ".repeat(r),whitespace:true,style:{...t.style,width:r*t.style.spaceWidth}};e.insertWord(o);}e.newLine();let s=t.text.length-r-1;if(s>0){let o={text:" ".repeat(s),whitespace:true,style:{...t.style,width:s*t.style.spaceWidth}};e.insertWord(o);}}};var _e=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀgz(t),t=this.ƀln(t),this.ƀax(t)}static ƀgz(t){return t.map(e=>{let i=[],r,s=true;return e.forEach(o=>{if(!r||r.chunk.style.cacheKey!==o.chunk.style.cacheKey)r&&i.push(r),r=o,s=o.chunk.whitespace;else {let a=r.chunk.text+o.chunk.text;s=o.chunk.whitespace&&s,r={chunk:{text:a,whitespace:s,style:{...r.chunk.style,width:r.chunk.style.width+o.chunk.style.width}},position:r.position};}}),r&&i.push(r),i})}static ƀln(t){return t.map(e=>{if(e.length===0)return [];let i=e.pop();if(!i.chunk.whitespace||i.chunk.text===""){let r=i.chunk.text.length,s=i.chunk.text.trimEnd();r!==s.length?e.push({chunk:{text:s,whitespace:false,style:{...i.chunk.style,width:i.chunk.style.width-(r-s.length)*i.chunk.style.spaceWidth}},position:i.position}):e.push(i);}return e})}static ƀax(t){return t.flatMap(e=>e.map(i=>({text:i.chunk.text,style:i.chunk.style.style,position:i.position}))).filter(e=>e.text.trim()!=="")}};var re=class{static{h(this,"RichTextToPlaneText");}static process(t,e){if(e.default.wordWrapWidth===void 0){if(e.default.align==="right"||e.default.align==="center")throw new Error("wordWrapWidth is required for right or center alignment");if(e.rectangleCut&&(e.rectangleCut.direction==="topRight"||e.rectangleCut.direction==="bottomRight"))throw new Error("wordWrapWidth is required for topRight or bottomRight rectangle cut")}let i=De.process(t,e),r=helpersLib.JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),s=new Be(e.default.wordWrapWidth??1/0,r),o=Ge.wrapText(i,s);return _e.process(o)}};var Ks=1,er=1/Ks,se=class extends d{static{h(this,"Text");}get ƀlg(){if(!this.ƀlh){let t=new F__namespace.TextStyle(this.ƀit);this.ƀlh=F__namespace.CanvasTextMetrics.measureText(this.ƀlf,t);}return this.ƀlh}get ascent(){return this.ƀlg.fontProperties.ascent}constructor(t,e){super(),this.ƀit=Ft.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀis.destroyed&&this.ƀis.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new helpersLib.Vector(this.ƀis.anchor.x,this.ƀis.anchor.y)}set anchor(t){this.ƀi=t,this.ƀis.anchor.set(t.x,t.y),this.ƀjg();}setText(t){return this.ƀlf!==t&&(this.ƀlf=t,this.ƀjd()),this}setColor(t){let e=helpersLib.ColorHelper.rgbToHex(t);return this.ƀit.fill!==e&&(this.ƀit.fill=e,this.ƀjd()),this}ƀjd(){this.ƀis?.destroy(),this.ƀkz?.destroy(),this.ƀkz=void 0,this.ƀlh=void 0;let t=new F__namespace.TextStyle(this.ƀit);this.ƀis=new F__namespace.Text({text:this.ƀlf,style:t}),this.ƀi&&this.ƀis.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀjg(),this.ƀis.scale.set(er,er),this.ƀip.addChild(this.ƀis),this.ƀit.lineThrough&&(this.ƀkz=this.ƀe(this.ƀis,this.ƀit.fill),this.ƀip.addChild(this.ƀkz));}ƀjg(){let t=F__namespace.CanvasTextMetrics.measureText(this.ƀlf,new F__namespace.TextStyle({...this.ƀit,dropShadow:false})),e=-this.ƀis.anchor.x*t.width,i=-this.ƀis.anchor.y*t.height;this.ƀis.boundsArea=new F__namespace.Rectangle(e,i,t.width,t.height);}ƀe(t,e){let i=F__namespace.CanvasTextMetrics.measureText(t.text,t.style),r=Math.max(1,Math.round(i.lineHeight*.07)),s=r%2*.5,o=new F__namespace.Graphics,a=0;return i.lines.forEach((l,c)=>{let p=F__namespace.CanvasTextMetrics.measureText(l,t.style),y=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+s,w=0;t.style.align==="center"?w=0+(t.width-p.width)*.5:t.style.align==="right"&&(w=0+t.width-p.width),w=Math.floor(w),o.moveTo(Math.floor(w),y),o.lineTo(Math.floor(w+p.width),y),a+=p.lineHeight;}),o.stroke({width:r,color:e}),o}};var ci=class extends d{static{h(this,"RichText");}constructor(t,e){super(),re.process(t,e).forEach(r=>new se(r.text,r.style).setPosition(r.position).displayParent(this).attach(this));}};var pi=class extends d{static{h(this,"UpdatableContainer");}},ui=class extends d{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀby=t,this.ƀcu=new Map,this.ƀhw={trackBy:h((i,r)=>r,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀcu.keys()),i=0;t.forEach((r,s)=>{let o=this.ƀhw.trackBy(r,s),a;this.ƀcu.has(o)?(a=this.ƀcu.get(o),e.delete(o),a.update(r)):(a=this.ƀby(r).displayParent(this).attach(this),this.ƀcu.set(o,a)),this.ƀhw.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀhw.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀhw.positioning.spacing);}),e.forEach(r=>{this.ƀcu.get(r).destroy(),this.ƀcu.delete(r);});}};var oe=class n extends d{static{h(this,"MenuUI");}static{this.ƀfx=actionsLib.Reducer.createExistenceChecker();}static{this.isAnyMenuTransitioning=this.ƀfx.notifier;}constructor(t,e){super(),this.ƀho=new actionsLib.SingleAction,this.onCreate=this.ƀho.notifier,this.ƀhq=new actionsLib.SingleAction,this.onOpen=this.ƀhq.notifier,this.ƀhl=new actionsLib.SingleAction,this.onClose=this.ƀhl.notifier,this.ƀbb=false;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.setAlpha(0),this.ƀp=new I(this,"alpha",{animation:x.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState});let r=R.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(i.backgroundDarkeningRatio).setInteractive(true).displayParent(this).attach(this);this.ƀgx=J.createByName(t).setPosition(new helpersLib.Vector(0,0)).setInteractive(true).displayParent(this).attach(this),g.instance.screenSize.subscribe(o=>{r.aspectRatio=o.x/o.y,r.scale=Math.max(o.x,o.y),r.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.half}),this.setPosition(o.multiplyNumber(.5));}).attach(this),this.ƀho.resolve();let s=n.ƀfx.effect().attach(this);this.ƀp.animate({alpha:1}).chain(this).tap(()=>{this.ƀhq.resolve(),s.destroy(),i.closeOnBackgroundClick&&r.on(exports.ContainerEventType.Click).take(1).tap(()=>this.close()).attach(this);}).attachToRoot();}getBoundingMask(){return this.ƀgx.getBoundingMask()}close(){if(!this.ƀbb){this.ƀbb=true;let t=n.ƀfx.effect().attach(this);this.ƀp.animate({alpha:0}).chain(this).map(()=>{this.ƀhl.resolve(),t.destroy(),this.destroy();}).chainToRoot();}return this.onClose.toSingleEvent()}};var fi=class extends wt{static{h(this,"MenuEntity");}static subscribeIsOpen(){return actionsLib.ActionLib.merge(this.continuesSubscription().map(t=>t.type==="open"),actionsLib.SingleEvent.instant(this.getInstance()!==void 0))}constructor(t){super(),this.ƀhw=t,queueMicrotask(()=>{if(!this.ƀgy)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀjf(t){this.ƀgy=t,this.ƀgy.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀgy.onCreate.toSingleEvent()}onOpen(){return this.ƀgy.onOpen.toSingleEvent()}onClose(){return this.ƀgy.onClose.toSingleEvent()}close(){return this.ƀgy.close()}};var mi=class extends U{static{h(this,"MenuView");}constructor(t,e,i){super();let r=helpersLib.JsonHelper.removeUndefinedProperties({appearAnimationDuration:i.appearAnimationDuration,backgroundDarkeningRatio:i.backgroundDarkeningRatio,closeOnBackgroundClick:t.ƀhw.closeOnBackgroundClick}),s=new oe(e,r).displayParent(g.camera.layers.foregroundScreen).attach(this);t.ƀjf(s);let o=new actionsLib.SingleAction;s.onCreate.subscribe(()=>o.resolve(s)).attach(this),this.onCreate=o.notifier,this.onOpen=s.onOpen.notifier,this.onClose=s.onClose.notifier;}};var ro=.65,so=.01,Fe=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀjp}get contentSize(){return this.ƀbm.size.ceil()}constructor(t,e,i,r){this.ƀbm=t,this.ƀv=e,this.ƀhy=i,this.ƀkg=r,this.ƀfu=false,this.ƀjp=e-i*2,this.ƀbm.y=i,this.ƀla=i;}onWheel(t){this.setTarget(this.ƀla-t*ro);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀla=helpersLib.NumberHelper.clamp(t,this.ƀv-this.ƀhy-this.contentSize.y,this.ƀhy);}jumpToTarget(){this.ƀbm.y=this.ƀla;}update(t){let e=this.contentSize;if(e.y<=this.ƀjp){switch(this.ƀkg){case "start":this.ƀla=this.ƀhy;break;case "center":this.ƀla=(this.ƀv-e.y)*.5;break;case "end":this.ƀla=this.ƀv-e.y-this.ƀhy;break;default:{this.ƀkg;throw new Error}}this.ƀfu||(this.ƀbm.y=this.ƀla);}this.ƀfu=true;let i=this.ƀla-this.ƀbm.y;this.ƀbm.y=this.ƀbm.y+i*so*t;}};var no=15,yi=class extends d{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbn}get contentSize(){return this.ƀjq.contentSize}constructor(t,e={}){super();let i={padding:no,smallContentAlign:"start",...e};if(i.padding<0)throw new Error("The padding of the scroll mask cannot be lower than '0'");if(i.padding>t.y*.5)throw new Error("The padding of the scroll mask cannot be higher than half of the size of the area");let r=new d().displayParent(this).attach(this);new Pt(r,t,i.padding).attach(this);let s=new F__namespace.Graphics;s.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),r.ƀip.addChild(s);let o=new d().displayParent(r).attach(this);this.ƀjq=new Fe(o,t.y,i.padding,i.smallContentAlign),this.ƀbn=new helpersLib.Vector(t.x,this.ƀjq.scrollHeight),s.eventMode="dynamic",s.addEventListener("wheel",a=>{this.ƀjq.onWheel(a.deltaY);}),o.setInteractive(true),o.ƀip.addEventListener("wheel",a=>{this.ƀjq.onWheel(a.deltaY);}),m.afterSceneUpdateAction.subscribe(a=>this.ƀjq.update(a.delta)).attach(this),this.addChildTo=o;}scrollToTop(t){this.ƀjq.scrollToTop(),t?.instant&&this.ƀjq.jumpToTarget();}scrollToBottom(t){this.ƀjq.scrollToBottom(),t?.instant&&this.ƀjq.jumpToTarget();}};var ao=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},_=class extends wt{static{h(this,"CameraEntity");}constructor(){super(...arguments),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.offset=new actionsLib.Variable(helpersLib.Vector.zero),this.targetPosition=new actionsLib.Variable(void 0),this.focusingNewTargetInfo=new actionsLib.Variable(void 0);}};_=ao([gt()],_);var ho=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},lo=1500,Le=class{static{h(this,"CameraService");}createCamera(){return new _().attachToRoot()}getCameraPosition(){let t=_.getInstanceOrFail();return helpersLib.Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=_.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=_.getInstanceOrFail();e.focusingNewTargetInfo.value={time:g.time,duration:t?.duration??lo,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??exports.FocusingAnimation.Instant};}update(t,e){let i=_.getInstanceOrFail(),r=i.targetPosition.value;r&&(i.focusingNewTargetInfo.value?this.ƀgc(i,r,t):i.position.value=r);}ƀgc(t,e,i){let r=t.focusingNewTargetInfo.value;if(r.focusingAnimation===exports.FocusingAnimation.Instant)this.ƀbg(t,e);else {let s=(i-r.time)/r.duration;if(s>=1)this.ƀbg(t,e);else {let o;r.focusingAnimation===exports.FocusingAnimation.EaseInOut?o=V.easeInOut(s):r.focusingAnimation===exports.FocusingAnimation.EaseOut?o=V.easeOut(s):o=1;let a=r.position.lerp(e,o);r.roundPosition&&(Math.abs(a.x-r.position.x)>=r.roundPositionThreshold&&(a=new helpersLib.Vector(Math.round(a.x),a.y)),Math.abs(a.y-r.position.y)>=r.roundPositionThreshold&&(a=new helpersLib.Vector(a.x,Math.round(a.y)))),t.position.value=a;}}}ƀbg(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};Le=ho([u()],Le);var co=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},po=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},wi=class{static{h(this,"CameraController");}constructor(t){this.ƀat=t;}createCamera(){return this.ƀat.createCamera().id}update(t,e){this.ƀat.update(t,e);}setPosition(t){this.ƀat.setPosition(t);}setTransition(t){this.ƀat.setTransition(t);}getCameraPosition(){return this.ƀat.getCameraPosition()}};wi=co([tt(exports.CameraGateway),po("design:paramtypes",[Le])],wi);var He=class{static{h(this,"PositionConversionHelper");}static includeScaleInScreenPosition(t,e,i){if(e!==1){let r=helpersLib.Vector.fromTo(i,t).multiplyNumber(1/e);return i.add(r)}else return t}};var fo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},mo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},It=class extends U{static{h(this,"CameraView");}constructor(t){super(),this.ƀdd=t,this.ƀkp=(()=>{let e=new d().attach(this);return e.ƀip=g.instance.ƀio.stage,e})(),this.ƀjk=new d().setAlpha(0).displayParent(this.ƀkp).attach(this),this.ƀaf=R.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(this.ƀkp).attach(this),this.ƀac=new d().displayParent(this.ƀjk).attach(this),this.ƀas=new d().displayParent(this.ƀjk).attach(this),this.ƀdp=new d().setSortableChildren(true).displayParent(this.ƀjk).attach(this),this.ƀar=new d().setSortableChildren(true).displayParent(this.ƀas).attach(this),this.ƀdo=new d().setSortableChildren(true).setRenderGroup().setZIndex(20).displayParent(this.ƀar).attach(this),this.ƀgp=new d().setSortableChildren(true).setRenderGroup().setZIndex(10).displayParent(this.ƀar).attach(this),this.ƀab=new d().setRenderGroup().setZIndex(0).displayParent(this.ƀar).attach(this),this.ƀh=new I(this.ƀjk,"alpha",{duration:500,animation:x.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀag=new I(this.ƀaf,"alpha",{duration:500,animation:x.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),g.instance.screenSize.subscribe(e=>{this.ƀaf.aspectRatio=e.x/e.y,this.ƀaf.scale=Math.max(e.x,e.y),this.ƀaf.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.zero});}).attach(this),this.ƀdd.position.subscribe(e=>{this.ƀar.position=this.ƀbt(e);}).attach(this),this.ƀdd.offset.subscribe(e=>{this.ƀas.position=e;}).attach(this),this.ƀag.set({alpha:0}),this.ƀh.set({alpha:0});}screenPositonToStagePosition(t){let e=He.includeScaleInScreenPosition(t,this.ƀkp.scale,g.instance.screenSizeCenter.value);return new helpersLib.Vector(e.x-this.ƀar.position.x-this.ƀas.position.x,e.y-this.ƀar.position.y-this.ƀas.position.y)}getLayers(){return {backgroundScreen:this.ƀac.id,background:this.ƀab.id,main:this.ƀgp.id,foreground:this.ƀdo.id,foregroundScreen:this.ƀdp.id}}appear(t,e,i){switch(e){case "alpha":return this.ƀag.set({alpha:0}),this.ƀh.set({alpha:t?0:1}),actionsLib.SingleEvent.instant().async(()=>i>0&&m.wait(i),"tap").async(()=>this.ƀh.animate({alpha:t?1:0})).chain(this);case "pureBlack":return this.ƀh.set({alpha:1}),this.ƀag.set({alpha:t?1:0}),actionsLib.SingleEvent.instant().async(()=>i>0&&m.wait(i),"tap").async(()=>this.ƀag.animate({alpha:t?0:1})).chain(this);case "instant":return this.ƀh.set({alpha:t?1:0}),this.ƀag.set({alpha:t?0:1}),actionsLib.SingleEvent.instant();default:{throw new Error}}}ƀbt(t){return helpersLib.Vector.fromTo(t,g.instance.screenSizeCenter.value)}};It=fo([qe({entity:_}),mo("design:paramtypes",[_])],It);var go=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},vi=class{static{h(this,"CameraViewController");}getLayers(){let t=_.getInstanceOrFail().id;return It.getInstanceOrFail(t).getLayers()}appear(t,e,i){let r=_.getInstanceOrFail().id;return It.getInstanceOrFail(r).appear(t,e,i)}screenPositonToStagePosition(t){let e=_.getInstanceOrFail().id;return It.getInstanceOrFail(e).screenPositonToStagePosition(t)}};vi=go([tt(Rt)],vi);var wo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},xo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.KeyboardService=class bi{static{h(this,"KeyboardService");}constructor(){this.ƀge=new actionsLib.Action,this.keyPressed=this.ƀge.notifier,this.ƀgf=new actionsLib.Action,this.keyReleased=this.ƀgf.notifier,this.ƀgl=new Set,this.ƀgk=new Set,window.addEventListener("keydown",t=>{this.ƀgl.add(t.code),this.ƀgk.add(t.code),!t.repeat&&this.ƀge.trigger({key:t.key,code:t.code});}),window.addEventListener("keyup",t=>{this.ƀgl.delete(t.code),this.ƀgf.trigger({key:t.key,code:t.code});}),window.addEventListener("blur",()=>{this.ƀgl.clear();}),m.afterSceneUpdateAction.subscribe(()=>this.ƀgk.clear()).attachToRoot();}isKeyDown(t,e){return (e?.onlyPressedThisFrame?this.ƀgk:this.ƀgl).has(t)}};exports.KeyboardService=wo([u(),xo("design:paramtypes",[])],exports.KeyboardService);var vo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},bo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.MouseService=class he{static{h(this,"MouseService");}constructor(){this.ƀft=new actionsLib.Variable(false),this.initialMouseMovementHappened=this.ƀft.notifier,this.ƀkq=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀkq.notifier,this.ƀjm=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀjm.notifier,this.ƀgo=new actionsLib.Variable(false),this.mainButtonState=this.ƀgo.notifier,this.ƀjr=new actionsLib.Variable(false),this.secondaryButtonState=this.ƀjr.notifier,this.ƀks(),window.addEventListener("pointerdown",t=>{t.button===0?this.ƀgo.value=true:t.button===2&&(this.ƀjr.value=true);},{capture:true}),window.addEventListener("pointerup",t=>{t.button===0?this.ƀgo.value=false:t.button===2&&(this.ƀjr.value=false);},{capture:true}),window.addEventListener("blur",()=>{this.ƀgo.value=false,this.ƀjr.value=false;},{capture:true});}ƀks(){let t=helpersLib.Vector.zero;window.addEventListener("pointermove",e=>{t=new helpersLib.Vector(e.clientX,e.clientY),this.ƀft.value=true;},{capture:true}),m.beforeSceneUpdateAction.subscribe(()=>{this.ƀjm.value=this.ƀba(t);}).attachToRoot(),m.afterSceneUpdateAction.subscribe(()=>{this.ƀkq.value=g.camera.screenPositonToStagePosition(this.ƀjm.value);}).attachToRoot();}ƀba(t){let i=g.instance.renderer.canvas.getBoundingClientRect(),r=i.width,s=i.height;if(r<=0||s<=0)return helpersLib.Vector.zero;let o=g.instance.renderer.screen,a=(t.x-i.left)/r*o.width,l=(t.y-i.top)/s*o.height;return a=helpersLib.NumberHelper.clamp(a,0,o.width),l=helpersLib.NumberHelper.clamp(l,0,o.height),new helpersLib.Vector(a,l)}};exports.MouseService=vo([u(),bo("design:paramtypes",[])],exports.MouseService);var Po=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},So=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.MouseTargetFocusService=class Pi{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀdn}get lastFocusedPosition(){return this.ƀgh}constructor(t){this.ƀhc=t,this.ƀhs=new actionsLib.Action,this.onTargetFocus=this.ƀhs.notifier,this.ƀll=0,this.ƀlm=false,this.ƀdn=false,this.ƀgh=void 0,m.beforeSceneUpdateAction.subscribe(e=>this.ƀlp(e.delta)).attachToRoot();}ƀlp(t){if(this.ƀhd){let e=this.ƀep(this.ƀhc.stagePosition.value,this.ƀhd);this.ƀid===void 0?this.ƀid=e:this.ƀaw(e,t);}this.ƀhd=this.ƀhc.stagePosition.value;}ƀaw(t,e){this.ƀid-t>10?(this.ƀll=Math.max(250,this.ƀll),this.ƀlm=true):this.ƀll>1e3&&(this.ƀlm=true);let i=this.ƀll>=300&&this.ƀlm;this.ƀgd(i,t,e);}ƀgd(t,e,i){(t||e>this.ƀid)&&(this.ƀid=e),t?(this.ƀlm=false,this.ƀll=0,this.ƀdn=true,this.ƀgh=this.ƀhc.stagePosition.value,this.ƀhs.trigger(this.ƀgh)):(this.ƀll+=i,this.ƀdn=false);}ƀep(t,e){let i=helpersLib.Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};exports.MouseTargetFocusService=Po([u(),So("design:paramtypes",[exports.MouseService])],exports.MouseTargetFocusService);var Si=10.8,Ei=10.01;exports.PhysicsShapeType=void 0;(function(n){n[n.Point=1]="Point",n[n.Circle=2]="Circle",n[n.Polygon=3]="Polygon",n[n.Rectangle=4]="Rectangle";})(exports.PhysicsShapeType||(exports.PhysicsShapeType={}));var f=class n{static{h(this,"P2JSHelper");}static aabbToBoundingBox(t){return helpersLib.Rectangle.fromRect({topLeft:{x:t.lowerBound[0],y:t.lowerBound[1]},bottomRight:{x:t.upperBound[0],y:t.upperBound[1]}})}static arrayToVector(t){return new helpersLib.Vector(t[0],t[1])}static vectorToArray(t){return [t.x,t.y]}static arePhysicsGroupsCollidable(t,e,i,r){return (t&r)!==0&&(i&e)!==0}static canCollideWith(t,e){return t.shapes.some(i=>e.shapes.some(r=>n.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new W__default.default.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var lt="border";var Ao=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s};exports.PhysicsGateway=class le extends q(){static{h(this,"PhysicsGateway");}};exports.PhysicsGateway=Ao([u()],exports.PhysicsGateway);var Oo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ct=class extends q(){static{h(this,"PhysicsInternalGateway");}};ct=Oo([u()],ct);var b=class n extends ${static{h(this,"PhysicsEntity");}static{this.ƀhx=new Map;}static{this.ƀih=new Map;}static getFromP2BodyID(t){return n.ƀhx.get(t)}static getFromP2BodyIDOrFail(t){let e=n.ƀhx.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=n.ƀih.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(n.ƀih.values())}get area(){return this.ƀu}get mass(){return this.ƀgs}get collisions(){return this.ƀbc}constructor(t,e,i){super(),this.ƀhm=new actionsLib.Action,this.onCollision=this.ƀhm.notifier,this.type="dynamic",this.ƀu=0,this.ƀgs=0,this.ƀbc=[],this.physicsWorldID=t,this.ƀij=P.get(ct);let r=this.ƀij.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀij.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀii=this.ƀij.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀik=this.ƀij.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀij.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀu=this.p2Body.getArea(),this.ƀgs=this.p2Body.mass,this.p2Body.position=f.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀij.addBody(this.physicsWorldID,this.p2Body,e.addInEmptySpace,e.shapeDefinition.group,e.includeOnPathfinding))throw new Error("PhysicsEntity was not able to be added to the world!");n.ƀhx.set(this.p2Body.id,this),n.ƀih.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀij.removeBody(this.physicsWorldID,this.p2Body),n.ƀhx.delete(this.p2Body.id),n.ƀih.delete(this.id));}canCollideWith(t){return f.arePhysicsGroupsCollidable(this.ƀii,this.ƀik,t.ƀii,t.ƀik)}ƀjt(t){this.ƀbc=t,t.length>0&&this.ƀhm.trigger(t);}};var ce=class extends b{static{h(this,"ImmovablePhysicsEntity");}constructor(t,e){super(t,e,"static"),this.position=f.arrayToVector(this.p2Body.position),this.rotation=new helpersLib.Radian(this.p2Body.angle);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position,rotation:this.rotation,velocity:helpersLib.Vector.zero,rotationalSpeed:0}}};var Ti=class extends ${static{h(this,"MovableEntity");}constructor(){super(),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.rotation=new actionsLib.Variable(helpersLib.Radian.get0),this.velocity=new actionsLib.Variable(helpersLib.Vector.zero),this.rotationalSpeed=new actionsLib.Variable(0),m.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀkw(t,e);}).attach(this);}ƀkw(t,e){this.position.value=this.position.value.add(this.velocity.value.multiplyNumber(e)),this.rotation.value=new helpersLib.Radian(this.rotation.value.value+this.rotationalSpeed.value*e);}};var Ri=class extends b{static{h(this,"MovablePhysicsEntity");}constructor(t,e){super(t,e,"dynamic"),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.rotation=new actionsLib.Variable(helpersLib.Radian.get0),this.velocity=new actionsLib.Variable(helpersLib.Vector.zero),this.rotationalSpeed=new actionsLib.Variable(0),this.ƀfm=false,this.ƀfn=false,this.ƀfp=false,this.ƀfo=false,this.ƀie(),this.ƀgm(),P.get(ct).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀkw(i,r)).attach(this);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position.value,rotation:this.rotation.value,velocity:this.velocity.value,rotationalSpeed:this.rotationalSpeed.value}}ƀkw(t,e){this.ƀfm=true,this.ƀfn=true,this.ƀfp=true,this.ƀfo=true,this.ƀie();}ƀie(){this.position.value=f.arrayToVector(this.p2Body.position),this.rotation.value=new helpersLib.Radian(this.p2Body.angle),this.velocity.value=f.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀgm(){this.position.subscribe(t=>{this.ƀfm?this.ƀfm=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfn?this.ƀfn=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfp?this.ƀfp=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfo?this.ƀfo=false:this.p2Body.angularVelocity=t;}).attach(this);}};var Go=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},_o=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},v=class extends ${static{h(this,"PhysicsWorldEntity");}constructor(t,e,i,r,s,o,a){super(),this.materialDefinitions=new Map,this.physicsBodyGroupToP2Group=new Map,this.physicsBodyGroupToP2Mask=new Map,this.availabilityGridCache=new Map,this.vectorFieldCache=new Map,this.bodiesInContactWith=new Map,this.collisionReports=new Map,this.paused=new actionsLib.Variable(false),this.lastP2Time=new actionsLib.Variable(0),this.onPhysicsStep=new actionsLib.Action,this.mapSize=t,this.mapSizeCenter=this.mapSize.multiplyNumber(.5),this.modifyUpdateCycle=e,this.p2World=i,this.materials=r,this.materialDefinitions=s,this.physicsBodyGroupToP2Group=o,this.physicsBodyGroupToP2Mask=a;}};v=Go([gt(),_o("design:paramtypes",[helpersLib.Vector,Boolean,W__default.default.World,Map,Map,Map,Map])],v);var Lo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},X=class{static{h(this,"PhysicsBodyGroupService");}createBodyGroupsAndMasks(t,e){let i=new Map,r=new Map;return t.map((s,o)=>{if(o>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(s,1<<o),r.set(s,0);}),e.map(([s,o])=>{if(!i.has(s))throw new Error(`Physics body group "${s}" not found`);if(!i.has(o))throw new Error(`Physics body group "${o}" not found`);let a=r.get(s),l=r.get(o),c=i.get(s),p=i.get(o);r.set(s,a|p),r.set(o,l|c);}),{physicsBodyGroupToP2Group:i,physicsBodyGroupToP2Mask:r}}getGroupConstant(t,e){return v.getInstanceByIDOrFail(t).physicsBodyGroupToP2Group.get(e)}getMaskConstant(t,e){return v.getInstanceByIDOrFail(t).physicsBodyGroupToP2Mask.get(e)}canCollide(t,e,i){let r=t.physicsBodyGroupToP2Group.get(e),s=t.physicsBodyGroupToP2Mask.get(e),o=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (s&o)!==0&&(a&r)!==0}};X=Lo([u()],X);var Ho=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},jo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ue=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀig=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((r,s)=>{r.forEach((o,a)=>{this.ƀig.canCollide(t,a,e)&&i.push({grid:o,cellSize:s});});}),i}get(t,e,i){return t.availabilityGridCache.get(e)?.get(i)}set(t,e,i,r){let s=t.availabilityGridCache.get(e);s||(s=new Map,t.availabilityGridCache.set(e,s)),s.set(i,r);}clear(t){t.availabilityGridCache.clear();}};Ue=Ho([u(),jo("design:paramtypes",[X])],Ue);var Wo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Uo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},pt=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀig=t,this.ƀz=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let r=f.aabbToBoundingBox(e.aabb);this.ƀz.getCollidableGrids(t,i).forEach(s=>{let o=D.areaToGridArea(r,s.cellSize);s.grid.setArea(o,false);});}findClosestAvailableSpace(t,e,i,r=50){return e.aabbNeedsUpdate=true,e.updateAABB(),Xt.findByConvertingGridSpace(this.getAvilabilityGrid(t,r,i),f.aabbToBoundingBox(e.aabb),r)}getAvilabilityGrid(t,e,i){let r=this.ƀz.get(t,e,i);return r||(r=this.ƀcb(t,e,i),this.ƀz.set(t,e,i,r)),r}ƀcb(t,e,i){let r=new helpersLib.Grid({size:new helpersLib.Vector(Math.floor(t.mapSize.x/e),Math.floor(t.mapSize.y/e)),defaultValue:true});return t.p2World.bodies.forEach(s=>{let o=b.getFromP2BodyIDOrFail(s.id);if(o.includeInPathfinding&&this.ƀig.canCollide(t,o.physicsBodyGroup,i)){let a=this.ƀeg(s,e);r.setArea(a,false);}}),r}ƀeg(t,e){let i=f.aabbToBoundingBox(t.aabb);return D.areaToGridArea(i,e)}};pt=Wo([u(),Uo("design:paramtypes",[X,Ue])],pt);var zo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Jo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},jt=class{static{h(this,"PathFinderService");}constructor(t){this.ƀif=t;}findPathAStar(t,e,i,r,s){s||(s={}),s.neighborType===void 0&&(s.neighborType="orthogonal"),s.gridCellSize===void 0&&(s.gridCellSize=50);let o=v.getInstanceByIDOrFail(t),a,l;helpersLib.Comparator.isNumber(i)?(l=b.getPhysicsInstanceOrFail(i).p2Body,a=f.arrayToVector(l.position)):a=i;let c=D.positionToGridPosition(e,s.gridCellSize),p=D.positionToGridPosition(a,s.gridCellSize),y=this.ƀif.getAvilabilityGrid(o,s.gridCellSize,r);if(l){let C=f.aabbToBoundingBox(l.aabb),Ct=D.areaToGridArea(C,s.gridCellSize);y.setArea(Ct,true);}let w=Zt.findPath(y,c,p,s.neighborType);return w.path=w.path.map(C=>D.gridPositionToPosition(C,s.gridCellSize)),w}findPathDirection(t,e,i,r,s=50){let o=v.getInstanceByIDOrFail(t),a;if(helpersLib.Comparator.isNumber(i)){let w=b.getPhysicsInstanceOrFail(i);a=f.aabbToBoundingBox(w.p2Body.aabb);}else a=new helpersLib.Rectangle(i,i);let l=D.areaToGridArea(a,s),c=JSON.stringify({targetGridArea:l,collidableWithGroup:r}),p=o.vectorFieldCache.get(c);if(!p){let w=this.ƀif.getAvilabilityGrid(o,s,r);p=new Qt(l,w),o.vectorFieldCache.set(c,p);}let y=D.positionToGridPosition(e,s);return p.getDirectionToTarget(y)}};jt=zo([u(),Jo("design:paramtypes",[pt])],jt);var Ko=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Xo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Q=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀaa=t,this.ƀhz=e;}printPathfindingTestGrid(t,e,i,r,s,o){let a=v.getInstanceByIDOrFail(t);this.ƀaa.getAvilabilityGrid(a,o,r).map((c,p)=>({position:D.gridPositionToPosition(p,o),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(s)){let p=this.ƀhz.findPathDirection(t,c.position,i,r),y;p===void 0?y=R.createRectangleBorders(new helpersLib.Vector(8,8),2,helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):y=R.createArrow(25,c.availability?helpersLib.ColorHelper.green:helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).setRotation(p).attach(a),new I(y,"alpha",{duration:1e3,animation:x.easeIn}).animate({alpha:0}).tap(()=>y.destroy()).attach(y);}});}createExplosionDebugVisual(t,e,i,r,s,o=300){let a=new d().displayParent(e).setAlpha(.5).attach(t);R.createCircle(s,helpersLib.ColorHelper.blue).toSprite().displayParent(a).setPosition(r,{round:false}).setAlpha(.5).attach(t),i.forEach(c=>{let p=c.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;R.createVector(r,c.line.to,p).toSprite().displayParent(a).attach(t);}),new I(a,"alpha",{duration:o,animation:x.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,r,s,o,a=300){let l=new d().displayParent(e).setAlpha(.5).attach(t);R.createElipse(o,helpersLib.ColorHelper.blue).toSprite().displayParent(l).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attach(t),i.forEach(p=>{let y=p.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;R.createVector(p.line.from,p.line.to,y).toSprite().displayParent(l).attach(t);}),new I(l,"alpha",{duration:a,animation:x.easeIn}).animate({alpha:0}).tap(()=>l.destroy()).attach(l);}createPhysicsEntityShapeVisual(t,e,i){let r=i?.overridePosition??f.arrayToVector(t.position),s=i?.overrideRotation??new helpersLib.Radian(t.angle),o=i?.color??helpersLib.ColorHelper.blue,a=new d().displayParent(e).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀcw(c,o).displayParent(a).attachToRoot();}),new I(a,"alpha",{duration:1e3,animation:x.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcw(t,e){switch(t.type){case W__default.default.Shape.PARTICLE:throw new Error("Not implemented");case W__default.default.Shape.LINE:throw new Error("Not implemented");case W__default.default.Shape.PLANE:throw new Error("Not implemented");case W__default.default.Shape.CIRCLE:throw new Error("Not implemented");case W__default.default.Shape.CAPSULE:throw new Error("Not implemented");case W__default.default.Shape.BOX:throw new Error("Not implemented");case W__default.default.Shape.HEIGHTFIELD:throw new Error("Not implemented");case W__default.default.Shape.CONVEX:return this.ƀcv(t,e);default:{t.type;throw new Error}}}ƀcv(t,e){let i=[t.vertices.map(r=>({x:r[0],y:r[1]}))];return R.createPolygon(i,e).toSprite()}};Q=Ko([u(),Xo("design:paramtypes",[pt,jt])],Q);var qo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},tn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},$e=class{static{h(this,"HitTestService");}constructor(t){this.ƀle=t;}hitTest(t,e){let i=t.world,r=b.getFromP2BodyIDOrFail(t.id),s=f.cloneP2Body(t);this.ƀt(s,e);let o=i.broadphase.aabbQuery(i,this.ƀds(s)).map(l=>b.getFromP2BodyIDOrFail(l.id)).filter(l=>l.includeInPathfinding).filter(l=>r.canCollideWith(l)).map(l=>f.cloneP2Body(l.p2Body)),a=false;if(o.length!==0){let l=new W__default.default.World;l.addBody(s),o.forEach(c=>l.addBody(c)),l.step(1,1,1),a=l.narrowphase.contactEquations.some(c=>c.bodyA===s||c.bodyB===s),l.clear();}if(e?.testLayerID){let l=a?helpersLib.ColorHelper.red:helpersLib.ColorHelper.green;this.ƀle.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀt(t,e){e?.overridePosition&&(t.position=f.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀds(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};$e=qo([u(),tn("design:paramtypes",[Q])],$e);var rn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ke=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀje(t,i);});});}step(t,e,i){b.getPhysicsEntities().forEach(r=>{r.ƀbc=[];}),t.p2World.narrowphase.contactEquations.forEach(r=>{this.ƀje(t,r);}),t.bodiesInContactWith.forEach((r,s)=>{this.ƀfd(r.p2Body),r.entity.ƀjt(t.collisionReports.get(s)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀfd(t){let e=f.arrayToVector(t.velocity);e.length>Si&&(e=e.normalize(Si),t.velocity=f.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-Ei),Ei);}ƀje(t,e){let i=b.getFromP2BodyID(e.bodyA.id),r=b.getFromP2BodyID(e.bodyB.id);if(i&&r){t.bodiesInContactWith.set(e.bodyA.id,{p2Body:e.bodyA,entity:i}),t.bodiesInContactWith.set(e.bodyB.id,{p2Body:e.bodyB,entity:r});let s=t.collisionReports.get(e.bodyA.id)||[],o=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀdy(i,r,e);s.push({self:a,target:l}),o.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,s),t.collisionReports.set(e.bodyB.id,o);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀdy(t,e,i){let r=t.convertToDTO(),s=e.convertToDTO(),o=f.arrayToVector(i.contactPointA),a=f.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀen(i);return {collisionDetailsA:this.ƀdx(r,i.bodyA.mass,o,l,t.area),collisionDetailsB:this.ƀdx(s,i.bodyB.mass,a,c,e.area)}}ƀdx(t,e,i,r,s){let o,a=i.add(t.position);return {body:t,getPositionReletiveToObject:h(()=>(o||(o=i.rotate(t.rotation.multiply(-1).vector)),o),"getPositionReletiveToObject"),getPositionOnWorld:h(()=>(a||(a=i.add(t.position)),a),"getPositionOnWorld"),position:i,mass:e,area:s,normal:r}}ƀen(t){let e=f.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};ke=rn([u()],ke);var sn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},on=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},ze=class extends ce{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};ze=sn([gt(),on("design:paramtypes",[Number,Object])],ze);var nn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},j=1e4,Je=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbv(t,new helpersLib.Vector(e.x/2,-j/2),new helpersLib.Vector(e.x+j*2,j),i),this.ƀbv(t,new helpersLib.Vector(e.x/2,e.y+j/2),new helpersLib.Vector(e.x+j*2,j),i),this.ƀbv(t,new helpersLib.Vector(-j/2,e.y/2),new helpersLib.Vector(j,e.y+j*2),i),this.ƀbv(t,new helpersLib.Vector(e.x+j/2,e.y/2),new helpersLib.Vector(j,e.y+j*2),i);}ƀbv(t,e,i,r){return new ze(t,{shapeDefinition:{materialName:lt,group:r,shapeType:exports.PhysicsShapeType.Rectangle,shapeData:i},position:e,rotation:helpersLib.Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};Je=nn([u()],Je);var hn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},dr=new W__default.default.Material,ln={id:lt,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},Wt=class{static{h(this,"MaterialsService");}createMaterials(t,e,i,r){let s=new Map,o=new Map;if(i.forEach(a=>{s.set(a.id,new W__default.default.Material),o.set(a.id,a);}),s.has(lt))throw new Error(`Material with name ${lt} cannot be defined, pick another name for the material.`);return s.set(lt,dr),o.set(lt,ln),this.ƀc(t,e,i,r,s),{materials:s,materialDefinitions:o}}getMaterial(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀel(e,i.materials)}getMaterialDefinition(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀek(e,i.materialDefinitions)}ƀel(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀek(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material definition with name ${t}.`);return i}ƀc(t,e,i,r,s){this.ƀed(i.map(o=>o.id),r).forEach(o=>{let a=this.ƀel(o.materialA,s),l=this.ƀel(o.materialB,s);t.addContactMaterial(new W__default.default.ContactMaterial(a,l,{friction:o.friction,restitution:o.bounciness,stiffness:o.stiffness,relaxation:o.relaxation}));}),this.ƀd(t,e,i,s);}ƀed(t,e){let i=new Map;e.forEach(s=>{let o=i.get(s.materialA);o||(o=new Map,i.set(s.materialA,o)),o.set(s.materialB,s);});let r=[];return t.forEach((s,o)=>{for(let a=o;a<t.length;a++){let l=t[a],c=i.get(s)?.get(l);c?r.push(c):r.push({materialA:s,materialB:l,friction:0,bounciness:0,relaxation:4,stiffness:1e6});}}),r}ƀd(t,e,i,r){i.forEach(s=>{let o=this.ƀel(s.id,r);t.addContactMaterial(new W__default.default.ContactMaterial(o,dr,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};Wt=hn([u()],Wt);var cn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},pn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ut=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,r,s){this.ƀgw=t,this.ƀak=e,this.ƀaa=i,this.ƀbd=r,this.ƀig=s;}createPhysicsWorld(t){let e=new W__default.default.World({gravity:[0,0]}),{materials:i,materialDefinitions:r}=this.ƀgw.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:s,physicsBodyGroupToP2Mask:o}=this.ƀig.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new v(t.mapSize,t.modifyUpdateCycle,e,i,r,s,o).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&m.cleanUpdateModifier();}).attachToRoot(),this.ƀak.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀbd.registerPhysicsWorld(a),t.modifyUpdateCycle?m.registerUpdateModifier((l,c)=>this.ƀkw(a,l,c)):m.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀkw(a,l,c);}).attach(a),a.id}addBody(t,e,i,r,s){let o=v.getInstanceByIDOrFail(t);if(i){let a=this.ƀaa.findClosestAvailableSpace(o,e,r);return a?(e.position[0]+=a.x,e.position[1]+=a.y,o.p2World.addBody(e),s&&this.ƀaa.onBodyAdded(o,e,r),true):false}else return o.p2World.addBody(e),s&&this.ƀaa.onBodyAdded(o,e,r),true}removeBody(t,e){v.getInstanceByID(t)?.p2World.removeBody(e);}ƀkw(t,e,i){if(!t.paused.value){t.availabilityGridCache.clear(),t.vectorFieldCache.clear(),t.p2World.step(i,i,i),t.modifyUpdateCycle&&(i=t.p2World.time-t.lastP2Time.value);let r=e+i;this.ƀbd.step(t,r,i),t.onPhysicsStep.trigger({time:r,delta:i}),t.lastP2Time.value=t.p2World.time;}return i}setPaused(t,e){v.getInstanceByIDOrFail(e).paused.set(t);}};Ut=cn([u(),pn("design:paramtypes",[Wt,Je,pt,ke,X])],Ut);var dn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},kt=class{static{h(this,"RayCastingService");}castClosest(t,e,i){let r=new W__default.default.RaycastResult,s=new W__default.default.Ray({mode:W__default.default.Ray.CLOSEST,from:f.vectorToArray(e.from),to:f.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i)});if(t.p2World.raycast(r,s),r.hasHit())return this.ƀbq(r,e)}castAllFirstContacts(t,e,i){let r=new Map,s=new W__default.default.Ray({mode:W__default.default.Ray.ALL,from:f.vectorToArray(e.from),to:f.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i),callback:h(o=>{let a=r.get(o.body);!r.has(o.body)||o.fraction<a.fraction?r.set(o.body,this.ƀbq(o,e)):o.fraction===a.fraction&&a.isExternal()&&r.set(o.body,this.ƀbq(o,e));},"callback")});return t.p2World.raycast(new W__default.default.RaycastResult,s),Array.from(r.values())}ƀbq(t,e){let i=t.fraction,r=f.arrayToVector(t.normal),s,o,a;return {body:t.body,hitPosition:h(()=>(s===void 0&&(s=e.from.lerp(e.to,i)),s),"hitPosition"),hitDistance:h(()=>(o===void 0&&(o=e.length*i),o),"hitDistance"),isExternal:h(()=>(a===void 0&&(a=e.fromTo.dotProduct(r)<0),a),"isExternal"),normal:r,fraction:i,line:e}}};kt=dn([u()],kt);var fn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ft=class{static{h(this,"ImpactService");}applyImpulse(t,e,i,r){let s=i.normalize(r),o=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(f.vectorToArray(s),o);}};ft=fn([u()],ft);var mn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},zt=class{static{h(this,"RayCastHitConverterService");}toExplosionHits(t,e=true){let i=new Map;return t.forEach(r=>{r.hits.forEach(s=>{let o=i.get(s.body);if(o){let a=s.fraction<o.closestRaycastHit.fraction?s:o.closestRaycastHit;o.rayCastHits.push(s),i.set(s.body,{hitCount:o.hitCount+1,closestRaycastHit:a,rayCastHits:o.rayCastHits,isExternal:e?o.isExternal:o.isExternal&&s.isExternal(),explosionCenter:s.line.from});}else {let a=s.isExternal();i.set(s.body,{hitCount:1,closestRaycastHit:s,rayCastHits:[s],isExternal:a,explosionCenter:s.line.from});}});}),[...i.values()].map(r=>this.ƀbr(r,t.length))}ƀbr(t,e){let i=t.hitCount/e,r=t.rayCastHits;if(t.isExternal)return {body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:true,normal:t.closestRaycastHit.normal,fraction:t.closestRaycastHit.fraction,ratioOfHits:i,raycastResults:r,getHitPosition:t.closestRaycastHit.hitPosition,getHitDistance:t.closestRaycastHit.hitDistance};{let s=f.arrayToVector(t.closestRaycastHit.body.position);return {body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:false,normal:helpersLib.Vector.fromTo(s,t.explosionCenter).normalize(),fraction:0,ratioOfHits:i,raycastResults:r,getHitPosition:h(()=>t.explosionCenter,"getHitPosition"),getHitDistance:h(()=>0,"getHitDistance")}}}};zt=mn([u()],zt);var gn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},wn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},bn=15,Ke=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,r){this.ƀja=t,this.ƀle=e,this.ƀiz=i,this.ƀfq=r;}createElipticExplosion(t,e,i,r,s,o,a){let l=v.getInstanceByIDOrFail(t),c=this.ƀcg(e,i,r,s,a?.hitOnlyClosest===true,l),p=this.ƀiz.toExplosionHits(c,false);return this.ƀr(p,o),a?.testLayerID&&this.ƀle.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,r,a.debugRayDuration),p.map(y=>{let{p2Body:w,...C}=y;return C})}ƀcg(t,e,i,r,s,o){let a=[],l=e.vector,c=e.add(helpersLib.Radian.get90).vector,p=c.normalize(i.x);a.push(new helpersLib.Line(t,t.add(p))),a.push(new helpersLib.Line(t,t.add(p.multiplyNumber(-1))));let y=l.normalize(i.y);a.push(new helpersLib.Line(t,t.add(y))),a.push(new helpersLib.Line(t,t.add(y.multiplyNumber(-1))));let w=Math.round(i.y/bn),C=i.y/(w*2+1)*2,Ct=l.normalize(C),pe=i.x,mr=Math.pow(i.y,2);return helpersLib.ArrayHelper.createIntegerArray(w).forEach(yt=>{let At=C*(yt+1),Ai=Ct.multiplyNumber(yt+1),ue=c.normalize(this.ƀev(pe,mr,At)),de=t.add(Ai);a.push(new helpersLib.Line(de,de.add(ue))),a.push(new helpersLib.Line(de,de.add(ue.multiplyNumber(-1))));let fe=t.add(Ai.multiplyNumber(-1));a.push(new helpersLib.Line(fe,fe.add(ue))),a.push(new helpersLib.Line(fe,fe.add(ue.multiplyNumber(-1))));}),a.map(yt=>{if(s){let At=this.ƀja.castClosest(o,yt,r);return {line:yt,hits:At?[At]:[]}}else {let At=this.ƀja.castAllFirstContacts(o,yt,r);return {line:yt,hits:At}}})}ƀev(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀr(t,e){t.forEach(i=>{i.raycastResults.forEach(r=>{let s,o;r.isExternal()?(s=r.line.fromTo,o=e*2):(s=r.line.fromTo.multiplyNumber(-1),o=e*(1-r.fraction)*8),this.ƀfq.applyImpulse(r.body,r.hitPosition(),s,o);});});}};Ke=gn([u(),wn("design:paramtypes",[kt,Q,zt,ft])],Ke);var Pn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Sn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Xe=class{static{h(this,"ExplosionService");}constructor(t,e,i,r){this.ƀja=t,this.ƀle=e,this.ƀiz=i,this.ƀfq=r;}createExplosion(t,e,i,r,s,o){let a=v.getInstanceByIDOrFail(t),l=this.ƀet(i),c=this.ƀcg(e,i,r,l,o?.hitOnlyClosest===true,a),p=this.ƀiz.toExplosionHits(c);return this.ƀr(e,i,s,l,p),o?.testLayerID&&this.ƀle.createExplosionDebugVisual(a,o.testLayerID,c,e,i,o.debugRayDuration),p}ƀcg(t,e,i,r,s,o){let a=new helpersLib.Radian(helpersLib.PI_360/r),l=new helpersLib.Vector(0,-e),c=a.vector;return helpersLib.ArrayHelper.createEmptyArray(r).map(()=>{let p=t.add(l);return l=l.rotate(c),new helpersLib.Line(t,p)}).map(p=>{if(s){let y=this.ƀja.castClosest(o,p,i);return {line:p,hits:y?[y]:[]}}else {let y=this.ƀja.castAllFirstContacts(o,p,i);return {line:p,hits:y}}})}ƀr(t,e,i,r,s){s.forEach(o=>{if(o.isExternal)o.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀfq.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=helpersLib.Vector.fromTo(t,f.arrayToVector(o.p2Body.position)),l=a.length/e,c=i*r*l/2;this.ƀfq.applyImpulse(o.p2Body,o.getHitPosition(),a,c);}});}ƀet(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};Xe=Pn([u(),Sn("design:paramtypes",[kt,Q,zt,ft])],Xe);var Cn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Jt=class{static{h(this,"PhysicsQueryService");}getMapSize(t){let e=v.getInstanceByIDOrFail(t);return {dimentions:e.mapSize,center:e.mapSizeCenter}}subscribeToPhysicsStep(t,e){return v.getInstanceByIDOrFail(t).onPhysicsStep.subscribe(e)}};Jt=Cn([u()],Jt);var An=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},On=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ii=class{static{h(this,"PhysicsController");}constructor(t,e,i,r,s,o,a,l){this.ƀin=t,this.ƀhz=e,this.ƀle=i,this.ƀdh=r,this.ƀda=s,this.ƀfi=o,this.ƀim=a,this.ƀfq=l;}createPhysicsWorld(t){return this.ƀin.createPhysicsWorld(t)}getMapSize(t){return this.ƀim.getMapSize(t)}setPaused(t,e){this.ƀin.setPaused(t,e);}hitTest(t,e){let i=b.getPhysicsInstanceOrFail(t);return this.ƀfi.hitTest(i.p2Body,e)}findPath(t,e,i,r,s){return this.ƀhz.findPathAStar(t,e,i,r,{neighborType:s})}findPathDirection(t,e,i,r){return this.ƀhz.findPathDirection(t,e,i,r)}applyImpulse(t,e,i,r){let s=b.getPhysicsInstanceOrFail(t);this.ƀfq.applyImpulse(s.p2Body,e,i,r);}createExplosion(t,e,i,r,s,o){return this.ƀdh.createExplosion(t,e,i,r,s,o)}createElipticExplosion(t,e,i,r,s,o,a){return this.ƀda.createElipticExplosion(t,e,i,r,s,o,a)}printPathfindingTestGrid(t,e,i,r,s,o=50){this.ƀle.printPathfindingTestGrid(t,e,i,r,s,o);}};Ii=An([tt(exports.PhysicsGateway),On("design:paramtypes",[Ut,jt,Q,Xe,Ke,$e,Jt,ft])],Ii);var Mn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ze=class{static{h(this,"ShapeCreationService");}createBody(t,e,i,r,s){let o=v.getInstanceByIDOrFail(t);if(!o.physicsBodyGroupToP2Group.has(e.shapeDefinition.group))throw new Error(`Physics body group "${e.shapeDefinition.group}" not found`);switch(e.shapeDefinition.shapeType){case exports.PhysicsShapeType.Point:return this.ƀbx(o,void 0,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Circle:return this.ƀbx(o,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Polygon:return this.ƀcf(o,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Rectangle:return this.ƀch(o,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);default:{e.shapeDefinition.shapeType;throw new Error}}}ƀbx(t,e,i,r,s,o){let a=new W__default.default.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s),radius:e});a.material=i;let l=new W__default.default.Body({type:o==="dynamic"?W__default.default.Body.DYNAMIC:W__default.default.Body.STATIC,mass:r.density,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return l.addShape(a),l}ƀcf(t,e,i,r,s,o){let a=t.physicsBodyGroupToP2Group.get(s),l=t.physicsBodyGroupToP2Mask.get(s),c=e.map(w=>new W__default.default.Convex({vertices:w.map(C=>[C.x,C.y]),collisionGroup:a,collisionMask:l})).map(w=>(w.material=i,w)),p=c.reduce((w,C)=>w+C.area,0),y=new W__default.default.Body({type:o==="dynamic"?W__default.default.Body.DYNAMIC:W__default.default.Body.STATIC,mass:p,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.forEach(w=>y.addShape(w)),y.setDensity(r.density),y}ƀch(t,e,i,r,s,o){let a=new W__default.default.Box({width:e.x,height:e.y,collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s)});a.material=i;let l=e.x*e.y,c=new W__default.default.Body({type:o==="dynamic"?W__default.default.Body.DYNAMIC:W__default.default.Body.STATIC,mass:l,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.addShape(a),c.setDensity(r.density),c}};Ze=Mn([u()],Ze);var Dn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Bn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ci=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,r,s){this.ƀin=t,this.ƀil=e,this.ƀkd=i,this.ƀim=r,this.ƀig=s;}createBody(t,e,i,r,s){return this.ƀkd.createBody(t,e,i,r,s)}getMaterial(t,e){return this.ƀil.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀil.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀig.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀig.getMaskConstant(t,e)}addBody(t,e,i,r,s){return this.ƀin.addBody(t,e,i,r,s)}removeBody(t,e){this.ƀin.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀim.subscribeToPhysicsStep(t,e)}};Ci=Dn([tt(ct),Bn("design:paramtypes",[Ut,Wt,Ze,Jt,X])],Ci);exports.AdvancedSound=ht;exports.AnimationFlicker=Di;exports.AnimationInterpolationFunctions=V;exports.Animations=x;exports.Animator=I;exports.BORDER_MATERIAL_NAME=lt;exports.BardLegendsHardReset=E;exports.Camera=qt;exports.ClosestAvailableSpaceHelper=Xt;exports.Container=d;exports.ControllerDecorator=tt;exports.DEFAULT_SHADER_RESOLUTION=N;exports.DeltaTime=oi;exports.DisplayObjectArray=ui;exports.Entity=$;exports.EntityDecorator=gt;exports.FadeInContent=Hi;exports.Game=g;exports.Gateway=q;exports.Graphics=R;exports.ImmovablePhysicsEntity=ce;exports.MenuEntity=fi;exports.MenuUI=oe;exports.MenuView=mi;exports.MovableEntity=Ti;exports.MovablePhysicsEntity=Ri;exports.Music=ee;exports.MusicPlayer=hi;exports.PathFinder=Zt;exports.PhysicsEntity=b;exports.Placeholder=li;exports.ROTATIONAL_SPEED_LIMIT=Ei;exports.RichText=ci;exports.SOUND_TRANSITION_DURATION=K;exports.SPEED_LIMIT=Si;exports.Scene=Ot;exports.SceneDecorator=Cr;exports.ScrollAreaUI=yi;exports.ScrollMaskUI=Pt;exports.Service=P;exports.ServiceDecorator=u;exports.SingletonEntity=wt;exports.SlideInContent=zi;exports.SlideInContentByIndex=si;exports.SlideStateAnimation=Re;exports.Sound=te;exports.Sprite=J;exports.StateAnimation=Gt;exports.Text=se;exports.ThroughEmptyStateAnimation=ve;exports.UpdatableContainer=pi;exports.UpdateCycle=m;exports.VectorFieldPathFinder=Qt;exports.VectorSet=Et;exports.View=U;exports.ViewDecorator=qe;
package/dist/index.mjs CHANGED
@@ -42,4 +42,4 @@ import {Action,ActionLib,SingleEvent,IDAttachable,SingleAction,Sequence,Variable
42
42
  highestAlpha = centerColor.a;`,e+=`
43
43
 
44
44
  finalColor = vec4(uColor, 1.0) * highestAlpha;
45
- }`,e}constructor(t,e){if(super({glProgram:F.GlProgram.from({vertex:F.defaultFilterVert,fragment:n.ƀec(t*N)}),resources:{expandUniforms:{uColor:{value:new Float32Array(3),type:"vec3<f32>"},uExpandSquared:{value:0,type:"f32"}}},resolution:N}),this.ƀdf=t,this.ƀdf=t*N,this.ƀdf<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀdf>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");Comparator.isInteger(this.ƀdf)||(this.ƀdf=Math.floor(this.ƀdf));let i=ColorHelper.normalize(e);this.resources.expandUniforms.uniforms.uColor=new Float32Array([i.red,i.green,i.blue]),this.resources.expandUniforms.uniforms.uExpandSquared=this.ƀdf*this.ƀdf,this.padding=this.ƀdf;}};var Ee=class extends F.Filter{static{h(this,"GlowFilter");}constructor(t){super({resolution:N,compatibleRenderers:F.RendererType.WEBGL});let e={blurRadius:1,expand:0,color:ColorHelper.white,...t};this.ƀdg=new Se(e.expand,e.color);let i=Comparator.isNumber(e.blurRadius)?new Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀaj=new Bt(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀaj.blendMode="screen";}apply(t,e,i,r){let s=F.TexturePool.getSameSizeTexture(e);this.ƀdg.apply(t,e,s,true),this.ƀaj.apply(t,s,i,r),F.TexturePool.returnTexture(s);}};var Yt=class n{static{h(this,"GlowSpriteGenerator");}static{this.ƀew=new Map;}static createGlowSpriteFromSprite(t,e,i){let r=this.ƀbh(e),s=Comparator.isNumber(r.blurRadius)?new Vector(r.blurRadius,r.blurRadius):r.blurRadius,o=this.ƀee(t.texture,s,r.expand,r.color,i),a=new F.Sprite(o);return this.ƀjv(a,Vector.fromVec2(t.anchor),Math.max(s.x,s.y)+r.expand),a.alpha=r.glowAlpha,a.blendMode=r.blendMode,a}static ƀee(t,e,i,r,s){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(s){let o=`${t.id}-${i}-${e.x}-${e.y}-${r.r}-${r.g}-${r.b}`;if(n.ƀew.has(o))return n.ƀew.get(o);{let a=this.ƀef(t,e,i,r);return n.ƀew.set(o,a),a}}else return this.ƀef(t,e,i,r)}static ƀef(t,e,i,r){let s=new F.Sprite(t);s.filters=[new Ee({blurRadius:e,expand:i,color:r})];let o=new F.Container;o.addChild(s);let a=Math.max(e.x,e.y)+i,l=g.instance.renderer.generateTexture({target:o,frame:new F.Rectangle(-a,-a,s.width+a*2,s.height+a*2)});return l.id=M.insertAsset(l),o.destroy({children:true}),l}static ƀjv(t,e,i){let r=(i+(t.width-i*2)*e.x)/t.width,s=(i+(t.height-i*2)*e.y)/t.height;t.anchor.set(r,s);}static ƀbh(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:ColorHelper.white,blendMode:"add"};return t&&(e={...e,...t}),e}};E.onHardReset.subscribe(()=>{Yt.ƀew.clear();}).attachToRoot();var J=class n extends d{static{h(this,"Sprite");}static createByName(t){let e=g.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new n(e)}static createSnapshotSprite(t){let e=t.ƀip,i=e.parent;i&&i.removeChild(e);let r=g.instance.renderer.generateTexture({target:e,resolution:2,antialias:true,textureSourceOptions:{scaleMode:"linear"}});i&&i.addChild(e);let o={id:M.insertAsset(r),scale:t.scale,size:t.size,anchor:Vector.zero,destroyAssetOnDestroy:true};return new n(o,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀli=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀko=t,this.pixiSprite=new F.Sprite(M.getAsset(t.id)),this.ƀip.addChild(this.pixiSprite),this.setTextureScale(t.scale),e.textureSize&&(this.pixiSprite.width=e.textureSize.x,this.pixiSprite.height=e.textureSize.y),e.texturePosition&&this.pixiSprite.position.set(e.texturePosition.x,e.texturePosition.y),e.ignoreAnchor||this.pixiSprite.anchor.set(t.anchor.x,t.anchor.y);}destroy(){this.destroyed||(super.destroy(),this.ƀko.destroyAssetOnDestroy&&(M.destroyAsset(this.ƀko.id),this.ƀiq&&M.destroyAsset(this.ƀiq.texture.id)),this.ƀgr?.destroy(),this.ƀal?.destroy(),this.ƀiq&&!this.ƀiq.destroyed&&this.ƀiq.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀli}set textureScale(t){this.ƀli=t,this.pixiSprite.scale.set(t);}get size(){return new Vector(this.pixiSprite.width,this.pixiSprite.height)}getMask(){return this.pixiSprite}set interactive(t){super.interactive=t,t&&this.ƀko.boundingShapes&&!this.ƀip.hitArea&&(this.ƀip.hitArea=new hs(this.ƀko.boundingShapes,this.size,Vector.fromVec2(this.ƀko.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.source.autoGenerateMipmaps}set mipmap(t){this.pixiSprite.texture.source.autoGenerateMipmaps=t;}setBlendMode(t){return this.blendMode=t,this}get blendMode(){return this.pixiSprite.blendMode}set blendMode(t){this.pixiSprite.blendMode=t;}setTint(t){return this.tint=t,this}get tint(){return new F.Color(this.pixiSprite.tint).toRgb()}set tint(t){this.pixiSprite.tint=t;}setShapeAlpha(t){return this.pixiSprite.alpha=t,this}get shapeAlpha(){return this.pixiSprite.alpha}set shapeAlpha(t){this.pixiSprite.alpha=t;}setGlowAlpha(t){return this.glowAlpha=t,this}get glowAlpha(){if(this.ƀiq)return this.ƀiq.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀiq)this.ƀiq.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=Vector.fromVec2(this.ƀko.anchor).to(t);return new Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀiq&&(this.ƀiq.destroy(),this.ƀiq=void 0),t&&(this.ƀiq=Yt.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀko.destroyAssetOnDestroy),this.ƀiq.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀiq.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀip.addChild(this.ƀiq)),this}showBoundingShape(t){return t?this.ƀal||(this.ƀal=this.ƀbw().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀal&&(this.ƀal.destroy(),this.ƀal=void 0),this}getBoundingMask(){if(!this.ƀgr){if(!this.ƀko.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀgr=this.ƀbw(),this.ƀgr.displayParent(this);}return this.ƀgr}ƀbw(){if(!this.ƀko.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return R.createPolygon(this.ƀko.boundingShapes,ColorHelper.white).toSprite().attach(this)}download(){let t=g.instance.renderer.extract.canvas(this.ƀip);if(!t.toBlob)throw new Error("Sprite: canvas.toBlob is undefined!");return t.toBlob(e=>{if(!e)throw new Error("Sprite: blob is undefined!");let i=document.createElement("a");document.body.append(i),i.download="sprite.png",i.href=URL.createObjectURL(e),i.click(),i.remove();},"image/png"),this}},hs=class{static{h(this,"CompositeHitArea");}constructor(t,e,i){this.ƀke=t.map(r=>new F.Polygon(r.map(s=>new F.Point(s.x,s.y))));}contains(t,e){return this.ƀke.some(i=>i.contains(t,e))}};var Te=class{static{h(this,"DashedLineHelper");}static getLines(t,e,i){let r=Vector.fromTo(t,e),s=r.normalize(),o=r.length-i.lineStartGap-i.lineEndGap,a=[];if(o<=0)return a;let l=t.add(s.normalize(i.lineStartGap));if(o<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(s.normalize(o))}),a;let c=o-i.dashGap,p=i.dashLength+i.dashGap,y=Math.floor(c/p),w=c-p*y;y>=1&&w<i.dashLength&&(w+=p,y--);let C=s.normalize(w/2),Ct=s.normalize(i.dashGap);if(a.push({from:l,to:l.add(C)}),l=l.add(C),y>0){let pe=s.normalize(i.dashLength);ArrayHelper.createEmptyArray(y).forEach(()=>{l=l.add(Ct),a.push({from:l,to:l.add(pe)}),l=l.add(pe);});}return l=l.add(Ct),a.push({from:l,to:l.add(C)}),a}};var R=class n extends d{static{h(this,"Graphics");}static{this.ƀcx=new Map;}static createArrow(t,e){let i=new F.Graphics;return [[{x:0,y:-t/2},{x:t*3/8,y:-t/8},{x:t/4,y:0},{x:0,y:-t/4},{x:-t/4,y:0},{x:-t*3/8,y:-t/8}],[{x:0,y:-t/4},{x:t/8-t/30,y:-t/8-t/30},{x:t/8-t/30,y:t*7/16},{x:-t/8+t/30,y:t*7/16},{x:-t/8+t/30,y:-t/8-t/30}]].forEach(s=>{i.poly(s.map(o=>new F.Point(o.x,o.y))).fill(e);}),new n(i,JSON.stringify({type:"arrow",size:t,color:e}))}static createDashedLine(t,e,i){let r={width:2,dashLength:10,dashGap:4,lineStartGap:0,lineEndGap:0,color:ColorHelper.white,...i},s=new F.Graphics;return Te.getLines(t,e,r).forEach(a=>{s.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),s.stroke({width:r.width,color:r.color}),new n(s,JSON.stringify({type:"dashedLine",from:t,to:e,options:r}))}static createVector(t,e,i){let r=new F.Graphics;return r.moveTo(t.x,t.y),r.lineTo(e.x,e.y),r.stroke({width:2,color:i}),r.circle(t.x,t.y,3),r.fill(ColorHelper.white),r.stroke({width:1,color:i}),new n(r,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let r=new F.Graphics;return r.rect(0,0,t.x,e),r.rect(0,e,e,t.y-e*2),r.rect(t.x-e,e,e,t.y-e*2),r.rect(0,t.y-e,t.x,e),r.fill(i),new n(r,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=ColorHelper.white){let i=new F.Graphics;return i.rect(0,0,t.x,t.y).fill(e),new n(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new F.Graphics;return i.circle(0,0,t).fill(e),new n(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new F.Graphics;return i.ellipse(0,0,t.x,t.y).fill(e),new n(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new F.Graphics,r=JSON.stringify({type:"polygon",polygon:t,color:e});return t.forEach(s=>{i.poly(s.map(o=>new F.Point(o.x,o.y))).fill(e);}),new n(i,r)}static createRegularPolygon(t,e,i){let r=new F.Graphics,s=new Radian(PI_360/t);r.moveTo(e,0);for(let o=1;o<=t;o++){let l=s.multiply(o).vector.normalize(e),c=e+l.x,p=e+l.y;r.lineTo(c,p);}return r.fill(i),new n(r,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.ƀip.addChild(t),this.pixiGraphics=t,this.ƀao=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀao,cache:false,...t},i=this.ƀer(e.cacheName,e.cache),r={id:i.textureID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},s=new J(r,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),s}ƀer(t,e){if(e){let i=n.ƀcx.get(t);return i||(i=this.ƀci(),n.ƀcx.set(t,i)),i}else return this.ƀci()}ƀci(){let t=g.instance.renderer.generateTexture(this.pixiGraphics);t.id=M.insertAsset(t);let e=this.pixiGraphics.getBounds();return {textureID:t.id,bounds:new Vector(e.x,e.y)}}};var ri=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},Pt=class n extends d{static{h(this,"ScrollMaskUI");}static{this.ƀcx=new Map;}constructor(t,e,i,r=et.Vertical){if(super(),i<0)throw new Error("The padding of the scroll mask cannot be lower than '0'");if(e.y<i*2)throw new Error(`The height of the scroll mask cannot be lower than '${i*2}'`);let s=new d;r===et.Horizontal?this.ƀcc(e,i,s):this.ƀcj(e,i,s),this.ƀgr=J.createSnapshotSprite(s).attach(this),s.destroy(),t.setMask(this.ƀgr);}ƀcj(t,e,i){e>0&&this.ƀbz(new Vector(t.x,e)).displayParent(i).attach(i),R.createRectangle(new Vector(t.x,t.y-e*2),ColorHelper.white).toSprite().setPosition(new Vector(0,e),{round:false}).displayParent(i).attach(i),e>0&&this.ƀbz(new Vector(t.x,e)).setPosition(new Vector(t.x,t.y),{round:false}).setRotation(Radian.get180).displayParent(i).attach(i);}ƀcc(t,e,i){e>0&&this.ƀbz(new Vector(t.y,e)).setPosition(new Vector(0,t.y),{round:false}).setRotation(Radian.get270).displayParent(i).attach(i),R.createRectangle(new Vector(t.x-e*2,t.y),ColorHelper.white).toSprite().setPosition(new Vector(e,0),{round:false}).displayParent(i).attach(i),e>0&&this.ƀbz(new Vector(t.y,e)).setPosition(new Vector(t.x,0),{round:false}).setRotation(Radian.get90).displayParent(i).attach(i);}ƀbz(t){let i={id:this.ƀca(t.y),scale:1,size:t,anchor:{x:0,y:0}};return new J(i,{textureSize:t,ignoreAnchor:true})}ƀca(t){let e=JSON.stringify({type:"gradient",length:t}),i=n.ƀcx.get(e);if(!i){let r=document.createElement("canvas");r.width=1,r.height=t;let s=r.getContext("2d");if(s){let o=new ri;ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${o.multiplierFunction(l/t)})`;s.fillStyle=c,s.fillRect(0,l,1,1);});let a=F.Texture.from(r);i=M.insertAsset(a),n.ƀcx.set(e,i);}else throw new Error("Canvas context is null")}return i}};var it;(function(n){n[n.Appear=1]="Appear",n[n.Disappear=2]="Disappear";})(it||(it={}));var Re=class extends Attachable{static{h(this,"SlideStateAnimation");}onStateChange(t){return this.ƀhr.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀht.subscribe(e=>t(e.value,e.index)).attach(this),this}get state(){return {value:this.ƀkv.state.value,item:this.ƀfs,nextItem:this.ƀhi,queuedItem:this.ƀkv.state.queuedItem,animationState:this.ƀo}}constructor(t){super(),this.ƀo="idle",this.ƀhr=new Action,this.ƀht=new Action,this.ƀhw={duration:500,animation:x.easeInOutCubic,...t},this.ƀkv=new Gt({duration:this.ƀhw.duration,animation:this.ƀhw.animation}).onStateChange((e,i)=>this.ƀez(e,i)).onValueChange(e=>this.ƀfe(e)).attach(this);}setIndex(t,e){if(!Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀfs===void 0?(this.ƀfs=t,this.ƀhr.trigger({state:it.Appear,index:t}),this.ƀkv.setItem(t,e)):this.ƀfs!==t?this.ƀhi!==t?this.ƀo==="idle"?(this.ƀo=t>this.ƀfs?"transitionForward":"transitionBackward",this.ƀhi=t,this.ƀhr.trigger({state:it.Appear,index:this.ƀhi}),this.ƀkv.setItem(t,e)):this.ƀkv.setItem(t,e):this.ƀo==="reverting"&&this.ƀhi===t&&(this.ƀo=t>this.ƀfs?"transitionForward":"transitionBackward",this.ƀkv.setItem(t,e)):(this.ƀo==="transitionForward"||this.ƀo==="transitionBackward")&&(this.ƀo="reverting",this.ƀkv.setItem(t,e));}ƀez(t,e){switch(this.ƀfs!==void 0&&this.ƀfs!==t&&this.ƀfs!==e&&this.ƀhr.trigger({state:it.Disappear,index:this.ƀfs}),this.ƀhi!==void 0&&this.ƀhi!==t&&this.ƀhi!==e&&this.ƀhr.trigger({state:it.Disappear,index:this.ƀhi}),e!==void 0&&e!==this.ƀfs&&e!==this.ƀhi&&this.ƀhr.trigger({state:it.Appear,index:e}),this.ƀo){case "idle":break;case "transitionForward":case "transitionBackward":e===void 0?(this.ƀo="idle",this.ƀfs=this.ƀhi,this.ƀhi=void 0):this.ƀfs!==t&&this.ƀfa(t,e);break;case "reverting":e===void 0?(this.ƀo="idle",this.ƀhi=void 0):this.ƀfs!==e&&this.ƀfa(t,e);break;default:{this.ƀo;throw new Error}}}ƀfa(t,e){this.ƀfs=t,this.ƀhi=e,this.ƀht.trigger({value:0,index:this.ƀfs}),this.ƀo=this.ƀfs<this.ƀhi?"transitionForward":"transitionBackward";}ƀfe(t){let e=1;(this.ƀo==="transitionBackward"||this.ƀo==="reverting"&&this.ƀfs!==void 0&&this.ƀhi!==void 0&&this.ƀfs>this.ƀhi)&&(e=-1),(this.ƀo==="idle"||t!==0)&&this.ƀht.trigger({value:NumberHelper.ensurePositiveZero(-e*t),index:this.ƀfs}),this.ƀhi!==void 0&&this.ƀht.trigger({value:NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀhi});}};var et;(function(n){n[n.Horizontal=1]="Horizontal",n[n.Vertical=2]="Vertical";})(et||(et={}));var si=class extends d{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀby=t,this.ƀcs="x",this.ƀbo=new Map,this.ƀhw={duration:300,animation:x.easeInOutCubic,size:new Vector(500,500),margin:20,direction:et.Horizontal,...e};let i=this.ƀhw.direction===et.Horizontal?new Vector(this.ƀhw.size.x+this.ƀhw.margin*2,this.ƀhw.size.y):new Vector(this.ƀhw.size.x,this.ƀhw.size.y+this.ƀhw.margin*2),r=new d().setPosition(this.ƀhw.direction===et.Horizontal?new Vector(-this.ƀhw.margin,0):new Vector(0,-this.ƀhw.margin),{round:false}).displayParent(this).attach(this);this.ƀcd(i,this.ƀhw.margin,this.ƀhw.direction,r),this.ƀcs=this.ƀhw.direction===et.Horizontal?"x":"y",this.ƀkv=new Re({duration:this.ƀhw.duration,animation:this.ƀhw.animation}).onStateChange((s,o)=>{if(s===it.Appear){let a=new d().displayParent(this).attach(this);this.ƀbo.set(o,a),this.ƀby({index:o,container:a});}else {let a=this.ƀbo.get(o);a&&(a.destroy(),this.ƀbo.delete(o));}}).onValueChange((s,o)=>{let a=this.ƀbo.get(o);if(a){let l={x:0,y:0};l[this.ƀcs]=i[this.ƀcs]*s+this.ƀhw.margin,a.setPosition(Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=r;}setIndex(t,e){return this.ƀkv.setIndex(t,e),this}ƀcd(t,e,i,r){new Pt(r,new Vector(t.x,t.y),e,i).attach(this);}},zi=class extends si{static{h(this,"SlideInContent");}constructor(t,e,i){super(r=>{let s=this.indexToItem.get(r.index);if(s)e({index:r.index,item:s,container:r.container});else throw new Error(`SlideInContent: The item with index '${r.index}' is not part of the items list`)},i),this.itemToIndex=new Map,this.indexToItem=new Map,t.forEach((r,s)=>{this.itemToIndex.set(r,s),this.indexToItem.set(s,r);});}setItem(t,e){let i=this.itemToIndex.get(t);if(i!==void 0)this.setIndex(i,e);else throw new Error(`SlideInContent: The item '${t}' is not part of the items list`);return this}};var Et=class{static{h(this,"VectorSet");}constructor(){this.ƀlv=new Map;}add(t){let e=this.ƀlv.get(t.x);e||(e=new Set,this.ƀlv.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀlv.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀlv.get(t.x);return e?e.delete(t.y):false}};var oi=class{static{h(this,"DeltaTime");}static adjustMultiplier(t,e){return Math.pow(t,e)}};var D=class{static{h(this,"PositionToGridPositionConverter");}static areaToGridArea(t,e){return new Rectangle(this.positionToGridPosition(t.topLeft,e),this.positionToGridPosition(t.bottomRight,e))}static positionToGridPosition(t,e){return t.divideNumber(e).floor()}static gridPositionToPosition(t,e){return t.add(new Vector(.5,.5)).multiplyNumber(e)}};var Xt=class{static{h(this,"ClosestAvailableSpaceHelper");}static findByConvertingGridSpace(t,e,i){let r=new Vector(Math.ceil(e.size.x/i)-1,Math.ceil(e.size.y/i)-1),s=D.areaToGridArea(e,i);if(this.ƀav(t,s))return Vector.zero;let o=t.movePositionInsideGrid(s.topLeft),a=Vector.fromTo(s.topLeft,o),l=this.find(t,o,r);if(l){let c=l.add(a),p=Vector.fromTo(s.topLeft.multiplyNumber(i),e.topLeft);return new Vector(c.x*i+((r.x+1)*i-e.size.x)/2-p.x,c.y*i+((r.y+1)*i-e.size.y)/2-p.y)}}static find(t,e,i){let r=new Et,s=new Queue(e);for(;s.notEmpty;){let o=s.pop();r.add(o);let a=new Rectangle(o,o.add(i));if(this.ƀav(t,a))return Vector.fromTo(e,o);t.getNeighborPositions(o,"orthogonal").forEach(l=>{r.has(l)||s.add(l);});}}static ƀav(t,e){if(!t.isAreaWithinBounds(e))return false;for(let i=e.topLeft.y;i<=e.bottomRight.y;i++)for(let r=e.topLeft.x;r<=e.bottomRight.x;r++)if(!t.get(new Vector(r,i)))return false;return true}};var Ji=Math.SQRT2-1,Ss=class{static{h(this,"PathfinderNode");}constructor(t,e){this.position=t,this.distanceToEnd=e,this.closed=false,this.distanceFromStart=Number.MAX_SAFE_INTEGER,this.parent=void 0;}get pathLength(){return this.distanceFromStart+this.distanceToEnd}getStepCost(t){return this.position.x!==t.position.x&&this.position.y!==t.position.y?Math.SQRT2:1}createSolutionPath(t){let e=[],i=this;for(;i!==void 0;)e.push(i.position),i=i.parent;return e.reverse(),{directPathAvailable:t,path:e}}},Es=class{static{h(this,"PathfinderGrid");}constructor(t,e,i,r){this.ƀey=t,this.ƀlc=i,this.ƀhh=r,this.ƀhv=new BinaryHeap("min"),this.ƀhk=new Grid({size:t.size,defaultValue:void 0});let s=this.ƀce(e);s.distanceFromStart=0,this.ƀhv.add(s.pathLength,s),this.ƀae=s;}get hasOpenNodes(){return this.ƀhv.size>0}getNeighbors(t){let e=[];for(let i of this.ƀey.getNeighborPositions(t.position,this.ƀhh))if(this.ƀey.get(i)){let r=this.ƀhk.get(i)??this.ƀce(i);r.closed||e.push(r);}return e}popLowestPathCostNode(){let t=this.ƀhv.pop();return t.closed=true,t.distanceToEnd<this.ƀae.distanceToEnd&&(this.ƀae=t),t}changeNodeCost(t,e,i){t.distanceFromStart=e,t.parent=i,this.ƀhv.updatePriority(t,t.pathLength)||this.ƀhv.add(t.pathLength,t);}getBestClosedNode(){return this.ƀae}ƀce(t){let e=Math.abs(t.x-this.ƀlc.x),i=Math.abs(t.y-this.ƀlc.y),r=this.ƀhh==="orthogonal"?e+i:e>i?e+Ji*i:i+Ji*e,s=new Ss(t,r);return this.ƀhk.isPointWithinBounds(t)&&this.ƀhk.set(t,s),s}},Zt=class{static{h(this,"PathFinder");}static findPath(t,e,i,r){let s=new Es(t,e,i,r);for(;s.hasOpenNodes;){let o=s.popLowestPathCostNode();if(o.position.isEqual(i))return o.createSolutionPath(true);for(let a of s.getNeighbors(o)){let l=o.distanceFromStart+o.getStepCost(a);l<a.distanceFromStart&&s.changeNodeCost(a,l,o);}}return s.getBestClosedNode().createSolutionPath(false)}};var Qt=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀlb=t,this.ƀy=e,this.ƀfh=this.ƀeh(this.ƀy.size),this.ƀme=new Grid({size:this.ƀy.size,defaultValue:this.ƀfh}),this.ƀct=new Grid({size:this.ƀy.size,defaultValue:void 0});let i=new Et,r=new Queue;for(this.ƀdu(this.ƀy.cropAreaOutsideOfTheGrid(t)).forEach(o=>{this.ƀme.set(o,0),r.add(o);});r.notEmpty;){let o=r.pop();if(!i.has(o)){i.add(o);let a=this.ƀme.getOrFail(o);this.ƀem(o,this.ƀy).forEach(l=>{if(!i.has(l.position)){let c=this.ƀme.getOrFail(l.position),p=a+l.distance;this.ƀy.getOrFail(l.position)&&p<c&&(this.ƀme.set(l.position,p),r.add(l.position));}});}}}getDirectionToTarget(t){if(!t.isInsideRectangle(this.ƀlb)){if(t=this.ƀme.movePositionInsideGrid(t),this.ƀct.has(t))return this.ƀct.get(t);{let e=this.ƀem(t,this.ƀy),i;return this.ƀme.getOrFail(t)>=this.ƀfh?e.some(s=>this.ƀy.get(s.position))&&(e.some(o=>!this.ƀy.get(o.position))?i=this.ƀeb(e):i=this.ƀdw(t,e)):i=this.ƀdw(t,e),this.ƀct.set(t,i),i}}}ƀeb(t){let e=t.filter(i=>this.ƀy.get(i.position)).map(i=>i.direction.radian);return Radian.getAverage(...e)}ƀdw(t,e){let i=e.filter(r=>this.ƀme.getOrFail(r.position)<this.ƀfh).reduce((r,s)=>{let o=this.ƀme.getOrFail(s.position)+s.distance;return o<r.bestWeight?(r.bestDirections=[s.direction],r.bestWeight=o):o===r.bestWeight&&r.bestDirections.push(s.direction),r},{bestDirections:[],bestWeight:this.ƀfh}).bestDirections;return this.ƀes(i,t)}ƀes(t,e){if(t.length>0){let i=t.reduce((r,s)=>r.add(s),Vector.zero);if(i.isZero()||!this.ƀfy(e,i))return Random.pickRandomElement(t).radian;if(t.length>=1)return i.radian}}ƀfy(t,e){let i=t.add(this.ƀlw(e));return this.ƀy.isPointWithinBounds(i)&&this.ƀy.getOrFail(i)}ƀem(t,e){return this.ƀme.getNeighborDirections(t,"all").map(i=>({position:t.add(i),direction:i,distance:i.x!==0&&i.y!==0?14:10}))}ƀdu(t){let e=[];for(let i=t.topLeft.y;i<=t.bottomRight.y;i++)for(let r=t.topLeft.x;r<=t.bottomRight.x;r++)e.push(new Vector(r,i));return e}ƀlw(t){let e=t.normalize().round();return new Vector(e.x,e.y)}ƀeh(t){return (t.x+t.y)*20}};var S=class n{static{h(this,"AudioAssets");}static{this.ƀan=new Map;}static{this.context=new AudioContext;}static async load(t){await Promise.all(t.map(e=>fetch(e.url).then(i=>i.arrayBuffer()).then(i=>this.context.decodeAudioData(i)).then(i=>this.ƀan.set(e.id,i))));}static createSource(t){let e=n.ƀdv(t),i=n.context.createBufferSource();return i.buffer=e,i}static ƀdv(t){let e=this.ƀan.get(t);if(!e)throw new Error(`Audio: Sound with id ${t} was not loaded.`);return e}};E.onHardReset.subscribe(()=>{S.context=new AudioContext,S.ƀan.clear();}).attachToRoot();var K=1e3,Y=class n{static{h(this,"Audio");}static ƀjy(){return this.ƀfv=new n,this.ƀfv}constructor(){this.ƀgu=S.context.createGain(),this.ƀgt=S.context.createGain(),this.ƀhg=S.context.createGain(),this.ƀkh=S.context.createGain(),this.ƀgu.connect(S.context.destination),this.ƀgt.connect(this.ƀgu),this.ƀhg.connect(this.ƀgt),this.ƀkh.connect(this.ƀgt),this.ƀgv=new I(this.ƀgu.gain,"value",{duration:500*2,animation:x.easeIn,reAnimateHandling:A.CompletePrevious,completionHandling:T.StayInCurrentState}),this.ƀgv.set({value:0});}setVolumes(t){this.ƀgt.gain.value=t.master,this.ƀhg.gain.value=t.music,this.ƀkh.gain.value=t.sound;}appear(t,e="ease"){switch(e){case "ease":return this.ƀgv.set({value:t?0:1}),this.ƀgv.animate({value:t?1:0}).chainToRoot();case "instant":return this.ƀgv.set({value:t?1:0}),SingleEvent.instant();default:{throw new Error}}}};E.onHardReset.subscribe(()=>{Y.ƀjy();}).attachToRoot();var As=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},nt=class extends q(){static{h(this,"CameraGateway");}};nt=As([u()],nt);var Os=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Rt=class extends q(){static{h(this,"CameraViewGateway");}};Rt=Os([u()],Rt);var Ki;(function(n){n.BackgroundScreen="backgroundScreen",n.Background="background",n.Main="main",n.Foreground="foreground",n.ForegroundScreen="foregroundScreen";})(Ki||(Ki={}));var at;(function(n){n[n.Instant=1]="Instant",n[n.EaseInOut=2]="EaseInOut",n[n.EaseOut=3]="EaseOut";})(at||(at={}));var qt=class{static{h(this,"Camera");}get position(){return this.ƀaq.getCameraPosition()}constructor(){this.ƀaq=P.get(nt),this.ƀau=P.get(Rt),this.ƀaq.createCamera(),this.layers=this.ƀau.getLayers();}setPosition(t){this.ƀaq.setPosition(t);}setTransition(t){this.ƀaq.setTransition(t);}appear(t,e="alpha",i=0){return this.ƀau.appear(t,e,i)}screenPositonToStagePosition(t){return this.ƀau.screenPositonToStagePosition(t)}};var g=class n{static{h(this,"Game");}static get instance(){return this.ƀfv}static{this.pause=Reducer.createOr();}static{this.freeze=Reducer.createOr();}static get camera(){return this.ƀap}static get audio(){return this.ƀx}static appear(t,e){let i=e?.audio??"ease",r=e?.camera??"alpha";return ActionLib.all([this.audio.appear(t,i),this.camera.appear(t,r,i!=="instant"?0:500)]).mapToVoid().chainToRoot()}static get time(){return m.ƀlj}static get setupOptions(){return this.ƀkb}constructor(t){if(this.ƀjn=new Variable(Vector.zero),this.screenSize=this.ƀjn.notifier,this.ƀjo=new Variable(Vector.zero),this.screenSizeCenter=this.ƀjo.notifier,this.devMode=false,n.ƀfv)throw new Error("There can be only one Game instance!");this.ƀbk={screenResolution:void 0,maxScreenResolution:void 0,devMode:false,backgroundColor:ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbk.devMode||false,this.ƀio=new F.Application;let e=n.pause.effect(false).attachToRoot();n.freeze.subscribe(i=>{e.update(i),i?S.context.suspend():S.context.resume();}).attachToRoot();}async setup(t){n.ƀkb=t;let e=JsonHelper.removeUndefinedProperties({backgroundColor:this.ƀbk.backgroundColor,autoStart:false,antialias:this.ƀbk.antialias,resolution:this.ƀbk.resolution,width:this.ƀbk.screenResolution?.width,height:this.ƀbk.screenResolution?.height,useBackBuffer:true,powerPreference:"high-performance",eventFeatures:{globalMove:false}});await this.ƀio.init(e);let i=document.body.appendChild(this.ƀio.canvas);this.ƀjx(i),await Promise.all([M.loadGameAssets(t.spriteAssetDefinitions),M.loadGameAssets(t.fontAssetDefinitions),S.load(t.soundAssetDefinitions)]),n.ƀfv=this,this.renderer=this.ƀio.renderer,globalThis.ƀa=this.ƀio,this.ƀfc(),n.ƀap=new qt,n.ƀx=Y.ƀjy(),this.ƀio.start(),this.ƀio.ticker.add(()=>{n.freeze.value||m.triggerUpdateTick(this.ƀio.ticker.deltaMS);});}setResolution(t){if(this.ƀio.renderer.resolution!==t){this.ƀio.renderer.resolution=t;let e=this.ƀeq();this.ƀio.renderer.resize(e.x,e.y);}}ƀfc(){this.ƀdb(),this.ƀjw(),window.addEventListener("resize",t=>{this.ƀdb(),this.ƀjw();});}ƀdb(){let t=this.ƀeq();(t.x!==this.ƀio.screen.width||t.y!==this.ƀio.screen.height)&&this.ƀio.renderer.resize(t.x,t.y);}ƀjw(){let t=new Vector(this.ƀio.screen.width,this.ƀio.screen.height);this.ƀjn.value=t,this.ƀjo.value=t.multiplyNumber(.5).round();}ƀeq(){let t=this.ƀbk.screenResolution?.width??window.innerWidth,e=this.ƀbk.screenResolution?.height??window.innerHeight;return this.ƀbk.maxScreenResolution&&(t=Math.min(t,this.ƀbk.maxScreenResolution.width),e=Math.min(e,this.ƀbk.maxScreenResolution.height)),new Vector(t,e)}ƀjx(t){this.ƀbk.maxScreenResolution&&(t.style.maxWidth=`${this.ƀbk.maxScreenResolution?.width}px`,t.style.maxHeight=`${this.ƀbk.maxScreenResolution?.height}px`),t.style.width="100%",t.style.height="100%";}};var te=class n extends IDAttachable{static{h(this,"Sound");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`Sound: Could not find sound definition with name ${t}.`);return new n(i,e)}get volume(){return this.ƀdq.gain.value}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀdq.gain.value=t,this}constructor(t,e){super(),this.ƀki=t,this.ƀdq=S.context.createGain(),this.ƀdq.connect(Y.ƀfv.ƀkh),this.ƀfg=this.ƀdq,e?.volume!==void 0&&(this.volume=e.volume),this.ƀiu(e?.time??0);}destroy(){this.destroyed||(super.destroy(),this.ƀkx(),this.ƀdq?.disconnect());}ƀlt(){this.ƀfg.disconnect(),this.ƀfg.connect(Y.ƀfv.ƀhg);}ƀiu(t){this.ƀkx();let e=this.ƀki.loop;if(this.ƀkr=NumberHelper.clamp(t,0,e?e.to:this.ƀki.duration),e){let i=e.from,r=e.to;this.ƀiv({soundID:this.ƀki.id,start:this.ƀkr,end:this.ƀkr<i?i:r,loop:false,onComplete:h(()=>{this.ƀkl.disconnect(),this.ƀiv({soundID:this.ƀki.id,start:i,end:r,loop:true});},"onComplete")});}else this.ƀiv({soundID:this.ƀki.id,start:this.ƀkr,end:void 0,loop:false,onComplete:h(()=>this.destroy(),"onComplete")});}ƀkx(){this.ƀkl&&(this.ƀkl.onended=null,this.ƀkl.stop(),this.ƀkl.disconnect());}ƀiv(t){this.ƀkl=S.createSource(t.soundID),this.ƀkl.connect(this.ƀdq),t.onComplete&&(this.ƀkl.onended=t.onComplete),t.loop?(this.ƀkl.loop=true,this.ƀkl.loopStart=t.start,this.ƀkl.loopEnd=t.end??this.ƀkl.buffer.duration,this.ƀkl.start(0,t.start)):this.ƀkl.start(0,t.start,t.end?t.end-t.start:void 0);}};var Fs=800,Ae=-128,ht=class n extends te{static{h(this,"AdvancedSound");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new n(i,e)}constructor(t,e){super(t,e),this.ƀlj=new Variable(0),this.time=this.ƀlj.notifier,this.ƀkt=S.context.currentTime-this.ƀkr,this.ƀlj.value=this.ƀkr,m.beforeSceneUpdateAction.subscribe(()=>{this.ƀlj.value=S.context.currentTime-this.ƀkt;}).attach(this),this.ƀfg.disconnect(),this.ƀjz(e?.fade?NumberHelper.clamp(e.fade,0,1):0),this.ƀka(e?.muffle?NumberHelper.clamp(e.muffle,0,1):0),this.ƀfg.connect(Y.ƀfv.ƀkh);}ƀjz(t=0){this.ƀdj=S.context.createGain(),this.ƀdj.gain.value=1-t,this.ƀdi=new I(this.ƀdj.gain,"value",{duration:500,animation:x.lineer,reAnimateHandling:A.CompletePrevious,completionHandling:T.StayInCurrentState}),this.ƀfg.connect(this.ƀdj),this.ƀfg=this.ƀdj;}ƀka(t=0){this.ƀhe=S.context.createBiquadFilter(),this.ƀhe.type="highshelf",this.ƀhe.frequency.value=Fs,this.ƀhe.gain.value=t*Ae,this.ƀhf=new I(this.ƀhe.gain,"value",{duration:500,animation:x.lineer,reAnimateHandling:A.CompletePrevious,completionHandling:T.StayInCurrentState}),this.ƀfg.connect(this.ƀhe),this.ƀfg=this.ƀhe;}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.fade(1,K).notIdle().chain(this).tap(()=>this.destroy()).chainToRoot())}notifyOnTime(t){return this.time.value>t?SingleEvent.createDestroyed():SingleEvent.create(e=>{let i=this.time.filter(r=>r>=t).tap(()=>e()).attach(this);return ()=>i.destroy()})}setFade(t){t=NumberHelper.clamp(t,0,1),this.ƀdi.set({value:1-t});}fade(t,e=500){t=NumberHelper.clamp(t,0,1);let i=t>1-this.ƀdj.gain.value;return e===0?(this.ƀdi.set({value:1-t}),SingleEvent.instant()):this.ƀdi.animate({value:1-t},{duration:e,animation:i?x.easeOut:x.easeIn}).chain(this)}setMuffle(t){t=NumberHelper.clamp(t,0,1),this.ƀhf.set({value:t*Ae});}muffle(t,e=500){return t=NumberHelper.clamp(t,0,1),e===0?(this.ƀhf.set({value:t*Ae}),SingleEvent.instant()):this.ƀhf.animate({value:t*Ae},{duration:e}).chain(this)}destroy(){this.destroyed||(this.ƀdj.disconnect(),this.ƀhe.disconnect()),super.destroy();}};var ee=class n extends IDAttachable{static{h(this,"Music");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new n(i,e)}get time(){switch(this.ƀkk.value.type){case "paused":return this.ƀkk.value.value.time;case "playing":return this.ƀkk.value.value.time.value;default:{this.ƀkk.value;throw new Error}}}get volume(){return this.ƀkk.value.value.volume}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀkk.value.value.volume=t,this}constructor(t,e){super(),this.ƀhw={stopPlayingOnPause:true,...e},this.ƀkj=t.id;let i;if(this.ƀhw.stopPlayingOnPause&&g.pause.value)i={type:"paused",value:{time:0,volume:1}};else {let r=new ht(t,this.ƀhw).attach(this);r.ƀlt(),i={type:"playing",value:r};}this.ƀkk=new Variable(i),this.ƀhw.stopPlayingOnPause&&(this.ƀib=g.pause.subscribe(r=>this.ƀfb(r)).attach(this));}notifyOnTime(t){return SingleEvent.create(e=>{let i=this.ƀkk.asyncDropOngoing((r,s)=>{switch(r.type){case "paused":s.drop();break;case "playing":return r.value.notifyOnTime(t);default:{throw new Error}}}).toSingleEvent().tap(()=>e()).attach(this);return ()=>i.destroy()})}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.ƀib?.destroy(),SingleEvent.instant().async(()=>ActionLib.all([this.ƀkk.value.type==="playing"?this.ƀkk.value.value.close():SingleEvent.instant(),this.ƀdk?.onDestroy()??SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀfb(t){if(t){if(this.ƀkk.value.type==="playing"){let e=this.ƀkk.value.value;this.ƀkk.value={type:"paused",value:{time:e.time.value,volume:e.volume}},this.ƀdk=e,ActionLib.all([e.fade(1,K),e.muffle(1,K)]).tap(()=>{this.ƀdk=void 0,e.destroy();}).attach(this);}}else if(this.ƀkk.value.type==="paused"){let{volume:e,time:i}=this.ƀkk.value.value,r=ht.createByName(this.ƀkj,{volume:e,time:i,fade:1,muffle:1}).attach(this);r.ƀlt(),ActionLib.all([r.fade(0,K),r.muffle(0,K)]).attach(this),this.ƀkk.value={type:"playing",value:r};}}};var hi=class extends IDAttachable{static{h(this,"MusicPlayer");}get time(){return this.ƀiw?this.ƀiw.time:0}get volume(){return this.ƀmd}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀmd=t,this.ƀiw&&(this.ƀiw.volume=t),this.ƀia&&(this.ƀia.volume=t),this}constructor(t){super(),this.ƀmd=1,this.ƀhw={stopPlayingOnPause:true,playWhenPaused:void 0,volume:1,...t},this.ƀmd=this.ƀhw.volume,this.ƀhw.playWhenPaused&&this.ƀkc(this.ƀhw.playWhenPaused);}play(t){if(this.ƀbb)throw new Error("Play is called while music player is destroyed.");return this.ƀco=t,SingleEvent.instant().async(()=>{let e=this.ƀiw;if(e)return this.ƀiw=void 0,e.close()}).map(()=>{if(this.ƀco===t)return this.ƀiw=ee.createByName(t,{stopPlayingOnPause:this.ƀhw.stopPlayingOnPause,volume:this.ƀmd}).attach(this),this.ƀiw}).chain(this)}stop(){return SingleEvent.instant().async(()=>{let t=this.ƀiw;if(t)return t.close().tap(()=>{t===this.ƀiw&&(this.ƀiw=void 0);})}).chain(this)}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.ƀib?.destroy(),SingleEvent.instant().async(()=>ActionLib.all([this.ƀiw?.close()??SingleEvent.instant(),this.ƀia?.close()??SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀkc(t){this.ƀib=g.pause.toSequence().asyncDropOngoing(e=>e&&m.wait(K).map(()=>e)).tap(e=>{if(e)this.ƀia=ht.createByName(t,{fade:1,volume:this.ƀmd}).attach(this),this.ƀia.fade(0);else if(this.ƀia){let i=this.ƀia;this.ƀia.fade(1).tap(()=>i.destroy()).attach(this),this.ƀia=void 0;}}).attach(this);}};var li=class extends d{static{h(this,"Placeholder");}constructor(t){super(),this.ƀir=new F.Graphics,this.ƀir.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),this.ƀip.addChild(this.ƀir);}destroy(){this.destroyed||(super.destroy(),this.ƀir.destroy());}};var Ft=class{static{h(this,"TextStyleConverter");}static getPixiTextStyle(t){let e={color:ColorHelper.white,align:"center",fontFamily:"Arial",fontStyle:"normal",fontSize:18,lineHeight:void 0,wordWrapWidth:void 0,lineThrough:false,...t},i=t?.dropShadow===true?{}:t?.dropShadow,r={};if(i){let s={blur:4,angle:Radian.get60,distance:10,color:ColorHelper.black,alpha:.5,...i};r={dropShadow:{blur:s.blur,angle:s.angle.value,distance:s.distance,color:ColorHelper.rgbToHex(s.color),alpha:s.alpha}};}return JsonHelper.removeUndefinedProperties({fontFamily:e.fontFamily,fill:ColorHelper.rgbToHex(e.color),align:e.align,fontSize:e.fontSize,fontStyle:e.fontStyle,lineHeight:e.lineHeight,wordWrapWidth:e.wordWrapWidth,wordWrap:e.wordWrapWidth!==void 0,lineThrough:e.lineThrough,...r})}};var De=class{static{h(this,"RichTextDataInConverter");}static process(t,e){let i=new Set(e.styles?Object.keys(e.styles):[]),r=RichTextSeparator.process(t,i),s=this.ƀfr(r,e),o=this.ƀs(s);return this.ƀkm(o)}static ƀfr(t,e){let i=new Map,r=new Map,s=h((a,l)=>{if(r.has(l))return r.get(l);let c=Ft.getPixiTextStyle(a);return r.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀdz(a.tags,e,i),p=s(l,c),y=F.CanvasTextMetrics.measureText(" ",new F.TextStyle(p),void 0,false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:y.width}})}static ƀdz(t,e,i){let r=t.join("+");if(i.has(r))return {style:i.get(r),cacheKey:r};let s=this.ƀbf(t,e);return i.set(r,s),{style:s,cacheKey:r}}static ƀbf(t,e){let i={...e.default};for(let l of t)e.styles&&e.styles[l]&&(i={...i,...e.styles[l]});let{wordWrapWidth:r,align:s,dropShadow:o,...a}=i;return a}static ƀs(t){let e=[],i=[];return t.forEach((r,s)=>{r.text.split(/\r?\n/).forEach((a,l)=>{l>0&&(e.push(i),i=[]),i.push({text:a,cacheKey:r.cacheKey,style:r.style,pixiStyle:r.pixiStyle,spaceWidth:r.spaceWidth});});}),e.push(i),e}static ƀkm(t){let e=[];return t.forEach(i=>{if(i.length===0)throw new Error("Internal Error: Line is unexpectedly empty");let r=i.flatMap(s=>this.ƀkn(s.text).map(a=>{let l=new F.TextStyle(s.pixiStyle),c=F.CanvasTextMetrics.measureText(a,l,void 0,false);return {text:a,whitespace:a.trim()==="",style:{cacheKey:s.cacheKey,style:s.style,pixiStyle:l,height:c.height,ascent:c.fontProperties.ascent,descent:c.fontProperties.descent,width:c.width,spaceWidth:s.spaceWidth}}}));e.push(r);}),e}static ƀkn(t){if(t==="")return [""];let e=[],i="",r=t[0]===" ";for(let s=0;s<t.length;s++){let o=t[s],a=o===" ";a===r?i+=o:(e.push(i),i=o,r=a);}return i&&e.push(i),e}};var Be=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀcm.length===0}get remainingWidth(){return this.ƀmf-this.ƀcp}constructor(t,e){this.ƀmf=t,this.ƀgj=[],this.ƀcm=[],this.ƀcp=0,this.ƀgi=new Vector(0,0),this.ƀcn=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀfj=i.horizontalAlignment,this.ƀlx=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀmf||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀcq={direction:i.rectangleCutOption.direction,rectangle:this.ƀbs(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀcn,t.y),i=this.ƀei(this.ƀgi.y,this.ƀgi.y+e);return this.ƀcp+t.x<=i}insertWord(t){let e=Math.max(this.ƀcn,t.style.height);if(this.ƀcm.length===0){let i=this.ƀej(this.ƀgi.y,this.ƀgi.y+e);this.ƀgi=new Vector(i,this.ƀgi.y),this.ƀcp=this.ƀgi.x;}this.ƀcm.push({chunk:t,position:new Vector(this.ƀcp,this.ƀgi.y)}),this.ƀcn=e,this.ƀcp+=t.style.width;}newLine(){let t=this.ƀgi.y+this.ƀcn,e=this.ƀej(t,t);this.ƀdm(),this.ƀgi=new Vector(e,t),this.ƀcp=this.ƀgi.x,this.ƀcn=0;}print(){return this.ƀdm(),this.ƀgj}ƀdm(){this.ƀcm.length>0&&(this.ƀgj.push(this.ƀg(this.ƀcm)),this.ƀcm=[]);}ƀg(t){return t=this.ƀlz(t),t=this.ƀfl(t),t}ƀfl(t){if(this.ƀfj==="left")return t;let e=this.ƀgi.y+this.ƀcn,i=this.ƀej(this.ƀgi.y,e),s=this.ƀei(this.ƀgi.y,e)-i,o=Math.min(s,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀfj==="center"?a=(s-o)/2:a=s-o,t.map(l=>(l={chunk:l.chunk,position:new Vector(l.position.x+a,l.position.y)},l))}ƀlz(t){let e=Math.max(...t.map(r=>r.chunk.style.ascent)),i=Math.max(...t.map(r=>r.chunk.style.descent));return t.map(r=>{let s;switch(this.ƀlx){case "top":s=i-r.chunk.style.descent;break;case "center":s=(i-r.chunk.style.descent+e-r.chunk.style.ascent)*.5;break;case "bottom":s=e-r.chunk.style.ascent;break;default:{this.ƀlx;throw new Error}}return r={chunk:r.chunk,position:new Vector(r.position.x,r.position.y+s)},r})}ƀej(t,e){return this.ƀcq&&(this.ƀcq.direction==="topLeft"||this.ƀcq.direction==="bottomLeft")&&(this.ƀcq.rectangle.isPointInside(new Vector(0,t),{includeEdges:false})||this.ƀcq.rectangle.isPointInside(new Vector(0,e),{includeEdges:false}))?this.ƀcq.rectangle.bottomRight.x:0}ƀei(t,e){return this.ƀcq&&(this.ƀcq.direction==="topRight"||this.ƀcq.direction==="bottomRight")&&(this.ƀcq.rectangle.isPointInside(new Vector(this.ƀmf,t),{includeEdges:false})||this.ƀcq.rectangle.isPointInside(new Vector(this.ƀmf,e),{includeEdges:false}))?this.ƀcq.rectangle.topLeft.x:this.ƀmf}ƀbs(t){let e,i;switch(t.direction){case "topRight":e=new Vector(t.position.x,-1/0),i=new Vector(1/0,t.position.y);break;case "topLeft":e=new Vector(-1/0,-1/0),i=t.position;break;case "bottomRight":e=t.position,i=new Vector(1/0,1/0);break;case "bottomLeft":e=new Vector(-1/0,t.position.y),i=new Vector(t.position.x,1/0);break;default:{t.direction;throw new Error}}return new Rectangle(e,i)}};var Ge=class{static{h(this,"ConsistentSpaceTextWrapper");}static wrapText(t,e){return t.forEach(i=>{i.forEach((r,s)=>{if(e.isSpaceAvailable(new Vector(r.style.width,r.style.height)))if(r.whitespace&&s===i.length-2){let o=i[i.length-1];e.isSpaceAvailable(new Vector(o.style.width+r.style.width,o.style.height))?e.insertWord(r):this.ƀmg(r,e);}else e.insertWord(r);else e.lineIsEmpty?e.insertWord(r):r.whitespace?this.ƀmg(r,e):(e.newLine(),e.insertWord(r));}),e.newLine();}),e.print()}static ƀmg(t,e){let i=Math.max(0,Math.floor(e.remainingWidth/t.style.spaceWidth)),r=Math.max(0,Math.min(i,t.text.length-1));if(r>0){let o={text:" ".repeat(r),whitespace:true,style:{...t.style,width:r*t.style.spaceWidth}};e.insertWord(o);}e.newLine();let s=t.text.length-r-1;if(s>0){let o={text:" ".repeat(s),whitespace:true,style:{...t.style,width:s*t.style.spaceWidth}};e.insertWord(o);}}};var _e=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀgz(t),t=this.ƀln(t),this.ƀax(t)}static ƀgz(t){return t.map(e=>{let i=[],r,s=true;return e.forEach(o=>{if(!r||r.chunk.style.cacheKey!==o.chunk.style.cacheKey)r&&i.push(r),r=o,s=o.chunk.whitespace;else {let a=r.chunk.text+o.chunk.text;s=o.chunk.whitespace&&s,r={chunk:{text:a,whitespace:s,style:{...r.chunk.style,width:r.chunk.style.width+o.chunk.style.width}},position:r.position};}}),r&&i.push(r),i})}static ƀln(t){return t.map(e=>{if(e.length===0)return [];let i=e.pop();if(!i.chunk.whitespace||i.chunk.text===""){let r=i.chunk.text.length,s=i.chunk.text.trimEnd();r!==s.length?e.push({chunk:{text:s,whitespace:false,style:{...i.chunk.style,width:i.chunk.style.width-(r-s.length)*i.chunk.style.spaceWidth}},position:i.position}):e.push(i);}return e})}static ƀax(t){return t.flatMap(e=>e.map(i=>({text:i.chunk.text,style:i.chunk.style.style,position:i.position}))).filter(e=>e.text.trim()!=="")}};var re=class{static{h(this,"RichTextToPlaneText");}static process(t,e){if(e.default.wordWrapWidth===void 0){if(e.default.align==="right"||e.default.align==="center")throw new Error("wordWrapWidth is required for right or center alignment");if(e.rectangleCut&&(e.rectangleCut.direction==="topRight"||e.rectangleCut.direction==="bottomRight"))throw new Error("wordWrapWidth is required for topRight or bottomRight rectangle cut")}let i=De.process(t,e),r=JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),s=new Be(e.default.wordWrapWidth??1/0,r),o=Ge.wrapText(i,s);return _e.process(o)}};var Ks=1,er=1/Ks,se=class extends d{static{h(this,"Text");}get ƀlg(){if(!this.ƀlh){let t=new F.TextStyle(this.ƀit);this.ƀlh=F.CanvasTextMetrics.measureText(this.ƀlf,t);}return this.ƀlh}get ascent(){return this.ƀlg.fontProperties.ascent}constructor(t,e){super(),this.ƀit=Ft.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀis.destroyed&&this.ƀis.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new Vector(this.ƀis.anchor.x,this.ƀis.anchor.y)}set anchor(t){this.ƀi=t,this.ƀis.anchor.set(t.x,t.y),this.ƀjg();}setText(t){return this.ƀlf!==t&&(this.ƀlf=t,this.ƀjd()),this}setColor(t){let e=ColorHelper.rgbToHex(t);return this.ƀit.fill!==e&&(this.ƀit.fill=e,this.ƀjd()),this}ƀjd(){this.ƀis?.destroy(),this.ƀkz?.destroy(),this.ƀkz=void 0,this.ƀlh=void 0;let t=new F.TextStyle(this.ƀit);this.ƀis=new F.Text({text:this.ƀlf,style:t}),this.ƀi&&this.ƀis.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀjg(),this.ƀis.scale.set(er,er),this.ƀip.addChild(this.ƀis),this.ƀit.lineThrough&&(this.ƀkz=this.ƀe(this.ƀis,this.ƀit.fill),this.ƀip.addChild(this.ƀkz));}ƀjg(){let t=F.CanvasTextMetrics.measureText(this.ƀlf,new F.TextStyle({...this.ƀit,dropShadow:false})),e=-this.ƀis.anchor.x*t.width,i=-this.ƀis.anchor.y*t.height;this.ƀis.boundsArea=new F.Rectangle(e,i,t.width,t.height);}ƀe(t,e){let i=F.CanvasTextMetrics.measureText(t.text,t.style),r=Math.max(1,Math.round(i.lineHeight*.07)),s=r%2*.5,o=new F.Graphics,a=0;return i.lines.forEach((l,c)=>{let p=F.CanvasTextMetrics.measureText(l,t.style),y=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+s,w=0;t.style.align==="center"?w=0+(t.width-p.width)*.5:t.style.align==="right"&&(w=0+t.width-p.width),w=Math.floor(w),o.moveTo(Math.floor(w),y),o.lineTo(Math.floor(w+p.width),y),a+=p.lineHeight;}),o.stroke({width:r,color:e}),o}};var ci=class extends d{static{h(this,"RichText");}constructor(t,e){super(),re.process(t,e).forEach(r=>new se(r.text,r.style).setPosition(r.position).displayParent(this).attach(this));}};var pi=class extends d{static{h(this,"UpdatableContainer");}},ui=class extends d{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀby=t,this.ƀcu=new Map,this.ƀhw={trackBy:h((i,r)=>r,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀcu.keys()),i=0;t.forEach((r,s)=>{let o=this.ƀhw.trackBy(r,s),a;this.ƀcu.has(o)?(a=this.ƀcu.get(o),e.delete(o),a.update(r)):(a=this.ƀby(r).displayParent(this).attach(this),this.ƀcu.set(o,a)),this.ƀhw.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀhw.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀhw.positioning.spacing);}),e.forEach(r=>{this.ƀcu.get(r).destroy(),this.ƀcu.delete(r);});}};var oe=class n extends d{static{h(this,"MenuUI");}static{this.ƀfx=Reducer.createExistenceChecker();}static{this.isAnyMenuTransitioning=this.ƀfx.notifier;}constructor(t,e){super(),this.ƀho=new SingleAction,this.onCreate=this.ƀho.notifier,this.ƀhq=new SingleAction,this.onOpen=this.ƀhq.notifier,this.ƀhl=new SingleAction,this.onClose=this.ƀhl.notifier,this.ƀbb=false;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.setAlpha(0),this.ƀp=new I(this,"alpha",{animation:x.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:A.CompletePrevious,completionHandling:T.StayInCurrentState});let r=R.createRectangle(new Vector(1,1),ColorHelper.black).toSprite({cache:true}).setAlpha(i.backgroundDarkeningRatio).setInteractive(true).displayParent(this).attach(this);this.ƀgx=J.createByName(t).setPosition(new Vector(0,0)).setInteractive(true).displayParent(this).attach(this),g.instance.screenSize.subscribe(o=>{r.aspectRatio=o.x/o.y,r.scale=Math.max(o.x,o.y),r.setPosition(Vector.zero,{holdFrom:Vector.half}),this.setPosition(o.multiplyNumber(.5));}).attach(this),this.ƀho.resolve();let s=n.ƀfx.effect().attach(this);this.ƀp.animate({alpha:1}).chain(this).tap(()=>{this.ƀhq.resolve(),s.destroy(),i.closeOnBackgroundClick&&r.on(Dt.Click).take(1).tap(()=>this.close()).attach(this);}).attachToRoot();}getBoundingMask(){return this.ƀgx.getBoundingMask()}close(){if(!this.ƀbb){this.ƀbb=true;let t=n.ƀfx.effect().attach(this);this.ƀp.animate({alpha:0}).chain(this).map(()=>{this.ƀhl.resolve(),t.destroy(),this.destroy();}).chainToRoot();}return this.onClose.toSingleEvent()}};var fi=class extends wt{static{h(this,"MenuEntity");}static subscribeIsOpen(){return ActionLib.merge(this.continuesSubscription().map(t=>t.type==="open"),SingleEvent.instant(this.getInstance()!==void 0))}constructor(t){super(),this.ƀhw=t,queueMicrotask(()=>{if(!this.ƀgy)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀjf(t){this.ƀgy=t,this.ƀgy.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀgy.onCreate.toSingleEvent()}onOpen(){return this.ƀgy.onOpen.toSingleEvent()}onClose(){return this.ƀgy.onClose.toSingleEvent()}close(){return this.ƀgy.close()}};var mi=class extends U{static{h(this,"MenuView");}constructor(t,e,i){super();let r=JsonHelper.removeUndefinedProperties({appearAnimationDuration:i.appearAnimationDuration,backgroundDarkeningRatio:i.backgroundDarkeningRatio,closeOnBackgroundClick:t.ƀhw.closeOnBackgroundClick}),s=new oe(e,r).displayParent(g.camera.layers.foregroundScreen).attach(this);t.ƀjf(s);let o=new SingleAction;s.onCreate.subscribe(()=>o.resolve(s)).attach(this),this.onCreate=o.notifier,this.onOpen=s.onOpen.notifier,this.onClose=s.onClose.notifier;}};var ro=.65,so=.01,Fe=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀjp}get contentSize(){return this.ƀbm.size.ceil()}constructor(t,e,i,r){this.ƀbm=t,this.ƀv=e,this.ƀhy=i,this.ƀkg=r,this.ƀfu=false,this.ƀjp=e-i*2,this.ƀbm.y=i,this.ƀla=i;}onWheel(t){this.setTarget(this.ƀla-t*ro);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀla=NumberHelper.clamp(t,this.ƀv-this.ƀhy-this.contentSize.y,this.ƀhy);}jumpToTarget(){this.ƀbm.y=this.ƀla;}update(t){let e=this.contentSize;if(e.y<=this.ƀjp){switch(this.ƀkg){case "start":this.ƀla=this.ƀhy;break;case "center":this.ƀla=(this.ƀv-e.y)*.5;break;case "end":this.ƀla=this.ƀv-e.y-this.ƀhy;break;default:{this.ƀkg;throw new Error}}this.ƀfu||(this.ƀbm.y=this.ƀla);}this.ƀfu=true;let i=this.ƀla-this.ƀbm.y;this.ƀbm.y=this.ƀbm.y+i*so*t;}};var no=15,yi=class extends d{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbn}get contentSize(){return this.ƀjq.contentSize}constructor(t,e={}){super();let i={padding:no,smallContentAlign:"start",...e};if(i.padding<0)throw new Error("The padding of the scroll mask cannot be lower than '0'");if(i.padding>t.y*.5)throw new Error("The padding of the scroll mask cannot be higher than half of the size of the area");let r=new d().displayParent(this).attach(this);new Pt(r,t,i.padding).attach(this);let s=new F.Graphics;s.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),r.ƀip.addChild(s);let o=new d().displayParent(r).attach(this);this.ƀjq=new Fe(o,t.y,i.padding,i.smallContentAlign),this.ƀbn=new Vector(t.x,this.ƀjq.scrollHeight),s.eventMode="dynamic",s.addEventListener("wheel",a=>{this.ƀjq.onWheel(a.deltaY);}),o.setInteractive(true),o.ƀip.addEventListener("wheel",a=>{this.ƀjq.onWheel(a.deltaY);}),m.afterSceneUpdateAction.subscribe(a=>this.ƀjq.update(a.delta)).attach(this),this.addChildTo=o;}scrollToTop(t){this.ƀjq.scrollToTop(),t?.instant&&this.ƀjq.jumpToTarget();}scrollToBottom(t){this.ƀjq.scrollToBottom(),t?.instant&&this.ƀjq.jumpToTarget();}};var ao=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},_=class extends wt{static{h(this,"CameraEntity");}constructor(){super(...arguments),this.position=new Variable(Vector.zero),this.offset=new Variable(Vector.zero),this.targetPosition=new Variable(void 0),this.focusingNewTargetInfo=new Variable(void 0);}};_=ao([gt()],_);var ho=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},lo=1500,Le=class{static{h(this,"CameraService");}createCamera(){return new _().attachToRoot()}getCameraPosition(){let t=_.getInstanceOrFail();return Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=_.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=_.getInstanceOrFail();e.focusingNewTargetInfo.value={time:g.time,duration:t?.duration??lo,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??at.Instant};}update(t,e){let i=_.getInstanceOrFail(),r=i.targetPosition.value;r&&(i.focusingNewTargetInfo.value?this.ƀgc(i,r,t):i.position.value=r);}ƀgc(t,e,i){let r=t.focusingNewTargetInfo.value;if(r.focusingAnimation===at.Instant)this.ƀbg(t,e);else {let s=(i-r.time)/r.duration;if(s>=1)this.ƀbg(t,e);else {let o;r.focusingAnimation===at.EaseInOut?o=V.easeInOut(s):r.focusingAnimation===at.EaseOut?o=V.easeOut(s):o=1;let a=r.position.lerp(e,o);r.roundPosition&&(Math.abs(a.x-r.position.x)>=r.roundPositionThreshold&&(a=new Vector(Math.round(a.x),a.y)),Math.abs(a.y-r.position.y)>=r.roundPositionThreshold&&(a=new Vector(a.x,Math.round(a.y)))),t.position.value=a;}}}ƀbg(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};Le=ho([u()],Le);var co=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},po=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},wi=class{static{h(this,"CameraController");}constructor(t){this.ƀat=t;}createCamera(){return this.ƀat.createCamera().id}update(t,e){this.ƀat.update(t,e);}setPosition(t){this.ƀat.setPosition(t);}setTransition(t){this.ƀat.setTransition(t);}getCameraPosition(){return this.ƀat.getCameraPosition()}};wi=co([tt(nt),po("design:paramtypes",[Le])],wi);var He=class{static{h(this,"PositionConversionHelper");}static includeScaleInScreenPosition(t,e,i){if(e!==1){let r=Vector.fromTo(i,t).multiplyNumber(1/e);return i.add(r)}else return t}};var fo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},mo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},It=class extends U{static{h(this,"CameraView");}constructor(t){super(),this.ƀdd=t,this.ƀkp=(()=>{let e=new d().attach(this);return e.ƀip=g.instance.ƀio.stage,e})(),this.ƀjk=new d().setAlpha(0).displayParent(this.ƀkp).attach(this),this.ƀaf=R.createRectangle(new Vector(1,1),ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(this.ƀkp).attach(this),this.ƀac=new d().displayParent(this.ƀjk).attach(this),this.ƀas=new d().displayParent(this.ƀjk).attach(this),this.ƀdp=new d().setSortableChildren(true).displayParent(this.ƀjk).attach(this),this.ƀar=new d().setSortableChildren(true).displayParent(this.ƀas).attach(this),this.ƀdo=new d().setSortableChildren(true).setRenderGroup().setZIndex(20).displayParent(this.ƀar).attach(this),this.ƀgp=new d().setSortableChildren(true).setRenderGroup().setZIndex(10).displayParent(this.ƀar).attach(this),this.ƀab=new d().setRenderGroup().setZIndex(0).displayParent(this.ƀar).attach(this),this.ƀh=new I(this.ƀjk,"alpha",{duration:500,animation:x.easeInOutCubic,reAnimateHandling:A.CompletePrevious,completionHandling:T.StayInCurrentState}),this.ƀag=new I(this.ƀaf,"alpha",{duration:500,animation:x.easeInOutCubic,reAnimateHandling:A.CompletePrevious,completionHandling:T.StayInCurrentState}),g.instance.screenSize.subscribe(e=>{this.ƀaf.aspectRatio=e.x/e.y,this.ƀaf.scale=Math.max(e.x,e.y),this.ƀaf.setPosition(Vector.zero,{holdFrom:Vector.zero});}).attach(this),this.ƀdd.position.subscribe(e=>{this.ƀar.position=this.ƀbt(e);}).attach(this),this.ƀdd.offset.subscribe(e=>{this.ƀas.position=e;}).attach(this),this.ƀag.set({alpha:0}),this.ƀh.set({alpha:0});}screenPositonToStagePosition(t){let e=He.includeScaleInScreenPosition(t,this.ƀkp.scale,g.instance.screenSizeCenter.value);return new Vector(e.x-this.ƀar.position.x-this.ƀas.position.x,e.y-this.ƀar.position.y-this.ƀas.position.y)}getLayers(){return {backgroundScreen:this.ƀac.id,background:this.ƀab.id,main:this.ƀgp.id,foreground:this.ƀdo.id,foregroundScreen:this.ƀdp.id}}appear(t,e,i){switch(e){case "alpha":return this.ƀag.set({alpha:0}),this.ƀh.set({alpha:t?0:1}),SingleEvent.instant().async(()=>i>0&&m.wait(i),"tap").async(()=>this.ƀh.animate({alpha:t?1:0})).chain(this);case "pureBlack":return this.ƀh.set({alpha:1}),this.ƀag.set({alpha:t?1:0}),SingleEvent.instant().async(()=>i>0&&m.wait(i),"tap").async(()=>this.ƀag.animate({alpha:t?0:1})).chain(this);case "instant":return this.ƀh.set({alpha:t?1:0}),this.ƀag.set({alpha:t?0:1}),SingleEvent.instant();default:{throw new Error}}}ƀbt(t){return Vector.fromTo(t,g.instance.screenSizeCenter.value)}};It=fo([qe({entity:_}),mo("design:paramtypes",[_])],It);var go=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},vi=class{static{h(this,"CameraViewController");}getLayers(){let t=_.getInstanceOrFail().id;return It.getInstanceOrFail(t).getLayers()}appear(t,e,i){let r=_.getInstanceOrFail().id;return It.getInstanceOrFail(r).appear(t,e,i)}screenPositonToStagePosition(t){let e=_.getInstanceOrFail().id;return It.getInstanceOrFail(e).screenPositonToStagePosition(t)}};vi=go([tt(Rt)],vi);var wo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},xo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},bi=class{static{h(this,"KeyboardService");}constructor(){this.ƀge=new Action,this.keyPressed=this.ƀge.notifier,this.ƀgf=new Action,this.keyReleased=this.ƀgf.notifier,this.ƀgl=new Set,this.ƀgk=new Set,window.addEventListener("keydown",t=>{this.ƀgl.add(t.code),this.ƀgk.add(t.code),!t.repeat&&this.ƀge.trigger({key:t.key,code:t.code});}),window.addEventListener("keyup",t=>{this.ƀgl.delete(t.code),this.ƀgf.trigger({key:t.key,code:t.code});}),window.addEventListener("blur",()=>{this.ƀgl.clear();}),m.afterSceneUpdateAction.subscribe(()=>this.ƀgk.clear()).attachToRoot();}isKeyDown(t,e){return (e?.onlyPressedThisFrame?this.ƀgk:this.ƀgl).has(t)}};bi=wo([u(),xo("design:paramtypes",[])],bi);var vo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},bo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},he=class{static{h(this,"MouseService");}constructor(){this.ƀft=new Variable(false),this.initialMouseMovementHappened=this.ƀft.notifier,this.ƀkq=new Variable(Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀkq.notifier,this.ƀjm=new Variable(Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀjm.notifier,this.ƀgo=new Variable(false),this.mainButtonState=this.ƀgo.notifier,this.ƀjr=new Variable(false),this.secondaryButtonState=this.ƀjr.notifier,this.ƀks(),window.addEventListener("pointerdown",t=>{t.button===0?this.ƀgo.value=true:t.button===2&&(this.ƀjr.value=true);},{capture:true}),window.addEventListener("pointerup",t=>{t.button===0?this.ƀgo.value=false:t.button===2&&(this.ƀjr.value=false);},{capture:true}),window.addEventListener("blur",()=>{this.ƀgo.value=false,this.ƀjr.value=false;},{capture:true});}ƀks(){let t=Vector.zero;window.addEventListener("pointermove",e=>{t=new Vector(e.clientX,e.clientY),this.ƀft.value=true;},{capture:true}),m.beforeSceneUpdateAction.subscribe(()=>{this.ƀjm.value=this.ƀba(t);}).attachToRoot(),m.afterSceneUpdateAction.subscribe(()=>{this.ƀkq.value=g.camera.screenPositonToStagePosition(this.ƀjm.value);}).attachToRoot();}ƀba(t){let i=g.instance.renderer.canvas.getBoundingClientRect(),r=i.width,s=i.height;if(r<=0||s<=0)return Vector.zero;let o=g.instance.renderer.screen,a=(t.x-i.left)/r*o.width,l=(t.y-i.top)/s*o.height;return a=NumberHelper.clamp(a,0,o.width),l=NumberHelper.clamp(l,0,o.height),new Vector(a,l)}};he=vo([u(),bo("design:paramtypes",[])],he);var Po=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},So=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Pi=class{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀdn}get lastFocusedPosition(){return this.ƀgh}constructor(t){this.ƀhc=t,this.ƀhs=new Action,this.onTargetFocus=this.ƀhs.notifier,this.ƀll=0,this.ƀlm=false,this.ƀdn=false,this.ƀgh=void 0,m.beforeSceneUpdateAction.subscribe(e=>this.ƀlp(e.delta)).attachToRoot();}ƀlp(t){if(this.ƀhd){let e=this.ƀep(this.ƀhc.stagePosition.value,this.ƀhd);this.ƀid===void 0?this.ƀid=e:this.ƀaw(e,t);}this.ƀhd=this.ƀhc.stagePosition.value;}ƀaw(t,e){this.ƀid-t>10?(this.ƀll=Math.max(250,this.ƀll),this.ƀlm=true):this.ƀll>1e3&&(this.ƀlm=true);let i=this.ƀll>=300&&this.ƀlm;this.ƀgd(i,t,e);}ƀgd(t,e,i){(t||e>this.ƀid)&&(this.ƀid=e),t?(this.ƀlm=false,this.ƀll=0,this.ƀdn=true,this.ƀgh=this.ƀhc.stagePosition.value,this.ƀhs.trigger(this.ƀgh)):(this.ƀll+=i,this.ƀdn=false);}ƀep(t,e){let i=Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};Pi=Po([u(),So("design:paramtypes",[he])],Pi);var Si=10.8,Ei=10.01,rt;(function(n){n[n.Point=1]="Point",n[n.Circle=2]="Circle",n[n.Polygon=3]="Polygon",n[n.Rectangle=4]="Rectangle";})(rt||(rt={}));var f=class n{static{h(this,"P2JSHelper");}static aabbToBoundingBox(t){return Rectangle.fromRect({topLeft:{x:t.lowerBound[0],y:t.lowerBound[1]},bottomRight:{x:t.upperBound[0],y:t.upperBound[1]}})}static arrayToVector(t){return new Vector(t[0],t[1])}static vectorToArray(t){return [t.x,t.y]}static arePhysicsGroupsCollidable(t,e,i,r){return (t&r)!==0&&(i&e)!==0}static canCollideWith(t,e){return t.shapes.some(i=>e.shapes.some(r=>n.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new W.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var lt="border";var Ao=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},le=class extends q(){static{h(this,"PhysicsGateway");}};le=Ao([u()],le);var Oo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ct=class extends q(){static{h(this,"PhysicsInternalGateway");}};ct=Oo([u()],ct);var b=class n extends ${static{h(this,"PhysicsEntity");}static{this.ƀhx=new Map;}static{this.ƀih=new Map;}static getFromP2BodyID(t){return n.ƀhx.get(t)}static getFromP2BodyIDOrFail(t){let e=n.ƀhx.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=n.ƀih.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(n.ƀih.values())}get area(){return this.ƀu}get mass(){return this.ƀgs}get collisions(){return this.ƀbc}constructor(t,e,i){super(),this.ƀhm=new Action,this.onCollision=this.ƀhm.notifier,this.type="dynamic",this.ƀu=0,this.ƀgs=0,this.ƀbc=[],this.physicsWorldID=t,this.ƀij=P.get(ct);let r=this.ƀij.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀij.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀii=this.ƀij.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀik=this.ƀij.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀij.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀu=this.p2Body.getArea(),this.ƀgs=this.p2Body.mass,this.p2Body.position=f.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀij.addBody(this.physicsWorldID,this.p2Body,e.addInEmptySpace,e.shapeDefinition.group,e.includeOnPathfinding))throw new Error("PhysicsEntity was not able to be added to the world!");n.ƀhx.set(this.p2Body.id,this),n.ƀih.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀij.removeBody(this.physicsWorldID,this.p2Body),n.ƀhx.delete(this.p2Body.id),n.ƀih.delete(this.id));}canCollideWith(t){return f.arePhysicsGroupsCollidable(this.ƀii,this.ƀik,t.ƀii,t.ƀik)}ƀjt(t){this.ƀbc=t,t.length>0&&this.ƀhm.trigger(t);}};var ce=class extends b{static{h(this,"ImmovablePhysicsEntity");}constructor(t,e){super(t,e,"static"),this.position=f.arrayToVector(this.p2Body.position),this.rotation=new Radian(this.p2Body.angle);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position,rotation:this.rotation,velocity:Vector.zero,rotationalSpeed:0}}};var Ti=class extends ${static{h(this,"MovableEntity");}constructor(){super(),this.position=new Variable(Vector.zero),this.rotation=new Variable(Radian.get0),this.velocity=new Variable(Vector.zero),this.rotationalSpeed=new Variable(0),m.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀkw(t,e);}).attach(this);}ƀkw(t,e){this.position.value=this.position.value.add(this.velocity.value.multiplyNumber(e)),this.rotation.value=new Radian(this.rotation.value.value+this.rotationalSpeed.value*e);}};var Ri=class extends b{static{h(this,"MovablePhysicsEntity");}constructor(t,e){super(t,e,"dynamic"),this.position=new Variable(Vector.zero),this.rotation=new Variable(Radian.get0),this.velocity=new Variable(Vector.zero),this.rotationalSpeed=new Variable(0),this.ƀfm=false,this.ƀfn=false,this.ƀfp=false,this.ƀfo=false,this.ƀie(),this.ƀgm(),P.get(ct).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀkw(i,r)).attach(this);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position.value,rotation:this.rotation.value,velocity:this.velocity.value,rotationalSpeed:this.rotationalSpeed.value}}ƀkw(t,e){this.ƀfm=true,this.ƀfn=true,this.ƀfp=true,this.ƀfo=true,this.ƀie();}ƀie(){this.position.value=f.arrayToVector(this.p2Body.position),this.rotation.value=new Radian(this.p2Body.angle),this.velocity.value=f.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀgm(){this.position.subscribe(t=>{this.ƀfm?this.ƀfm=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfn?this.ƀfn=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfp?this.ƀfp=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfo?this.ƀfo=false:this.p2Body.angularVelocity=t;}).attach(this);}};var Go=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},_o=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},v=class extends ${static{h(this,"PhysicsWorldEntity");}constructor(t,e,i,r,s,o,a){super(),this.materialDefinitions=new Map,this.physicsBodyGroupToP2Group=new Map,this.physicsBodyGroupToP2Mask=new Map,this.availabilityGridCache=new Map,this.vectorFieldCache=new Map,this.bodiesInContactWith=new Map,this.collisionReports=new Map,this.paused=new Variable(false),this.lastP2Time=new Variable(0),this.onPhysicsStep=new Action,this.mapSize=t,this.mapSizeCenter=this.mapSize.multiplyNumber(.5),this.modifyUpdateCycle=e,this.p2World=i,this.materials=r,this.materialDefinitions=s,this.physicsBodyGroupToP2Group=o,this.physicsBodyGroupToP2Mask=a;}};v=Go([gt(),_o("design:paramtypes",[Vector,Boolean,W.World,Map,Map,Map,Map])],v);var Lo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},X=class{static{h(this,"PhysicsBodyGroupService");}createBodyGroupsAndMasks(t,e){let i=new Map,r=new Map;return t.map((s,o)=>{if(o>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(s,1<<o),r.set(s,0);}),e.map(([s,o])=>{if(!i.has(s))throw new Error(`Physics body group "${s}" not found`);if(!i.has(o))throw new Error(`Physics body group "${o}" not found`);let a=r.get(s),l=r.get(o),c=i.get(s),p=i.get(o);r.set(s,a|p),r.set(o,l|c);}),{physicsBodyGroupToP2Group:i,physicsBodyGroupToP2Mask:r}}getGroupConstant(t,e){return v.getInstanceByIDOrFail(t).physicsBodyGroupToP2Group.get(e)}getMaskConstant(t,e){return v.getInstanceByIDOrFail(t).physicsBodyGroupToP2Mask.get(e)}canCollide(t,e,i){let r=t.physicsBodyGroupToP2Group.get(e),s=t.physicsBodyGroupToP2Mask.get(e),o=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (s&o)!==0&&(a&r)!==0}};X=Lo([u()],X);var Ho=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},jo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ue=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀig=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((r,s)=>{r.forEach((o,a)=>{this.ƀig.canCollide(t,a,e)&&i.push({grid:o,cellSize:s});});}),i}get(t,e,i){return t.availabilityGridCache.get(e)?.get(i)}set(t,e,i,r){let s=t.availabilityGridCache.get(e);s||(s=new Map,t.availabilityGridCache.set(e,s)),s.set(i,r);}clear(t){t.availabilityGridCache.clear();}};Ue=Ho([u(),jo("design:paramtypes",[X])],Ue);var Wo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Uo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},pt=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀig=t,this.ƀz=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let r=f.aabbToBoundingBox(e.aabb);this.ƀz.getCollidableGrids(t,i).forEach(s=>{let o=D.areaToGridArea(r,s.cellSize);s.grid.setArea(o,false);});}findClosestAvailableSpace(t,e,i,r=50){return e.aabbNeedsUpdate=true,e.updateAABB(),Xt.findByConvertingGridSpace(this.getAvilabilityGrid(t,r,i),f.aabbToBoundingBox(e.aabb),r)}getAvilabilityGrid(t,e,i){let r=this.ƀz.get(t,e,i);return r||(r=this.ƀcb(t,e,i),this.ƀz.set(t,e,i,r)),r}ƀcb(t,e,i){let r=new Grid({size:new Vector(Math.floor(t.mapSize.x/e),Math.floor(t.mapSize.y/e)),defaultValue:true});return t.p2World.bodies.forEach(s=>{let o=b.getFromP2BodyIDOrFail(s.id);if(o.includeInPathfinding&&this.ƀig.canCollide(t,o.physicsBodyGroup,i)){let a=this.ƀeg(s,e);r.setArea(a,false);}}),r}ƀeg(t,e){let i=f.aabbToBoundingBox(t.aabb);return D.areaToGridArea(i,e)}};pt=Wo([u(),Uo("design:paramtypes",[X,Ue])],pt);var zo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Jo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},jt=class{static{h(this,"PathFinderService");}constructor(t){this.ƀif=t;}findPathAStar(t,e,i,r,s){s||(s={}),s.neighborType===void 0&&(s.neighborType="orthogonal"),s.gridCellSize===void 0&&(s.gridCellSize=50);let o=v.getInstanceByIDOrFail(t),a,l;Comparator.isNumber(i)?(l=b.getPhysicsInstanceOrFail(i).p2Body,a=f.arrayToVector(l.position)):a=i;let c=D.positionToGridPosition(e,s.gridCellSize),p=D.positionToGridPosition(a,s.gridCellSize),y=this.ƀif.getAvilabilityGrid(o,s.gridCellSize,r);if(l){let C=f.aabbToBoundingBox(l.aabb),Ct=D.areaToGridArea(C,s.gridCellSize);y.setArea(Ct,true);}let w=Zt.findPath(y,c,p,s.neighborType);return w.path=w.path.map(C=>D.gridPositionToPosition(C,s.gridCellSize)),w}findPathDirection(t,e,i,r,s=50){let o=v.getInstanceByIDOrFail(t),a;if(Comparator.isNumber(i)){let w=b.getPhysicsInstanceOrFail(i);a=f.aabbToBoundingBox(w.p2Body.aabb);}else a=new Rectangle(i,i);let l=D.areaToGridArea(a,s),c=JSON.stringify({targetGridArea:l,collidableWithGroup:r}),p=o.vectorFieldCache.get(c);if(!p){let w=this.ƀif.getAvilabilityGrid(o,s,r);p=new Qt(l,w),o.vectorFieldCache.set(c,p);}let y=D.positionToGridPosition(e,s);return p.getDirectionToTarget(y)}};jt=zo([u(),Jo("design:paramtypes",[pt])],jt);var Ko=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Xo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Q=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀaa=t,this.ƀhz=e;}printPathfindingTestGrid(t,e,i,r,s,o){let a=v.getInstanceByIDOrFail(t);this.ƀaa.getAvilabilityGrid(a,o,r).map((c,p)=>({position:D.gridPositionToPosition(p,o),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(s)){let p=this.ƀhz.findPathDirection(t,c.position,i,r),y;p===void 0?y=R.createRectangleBorders(new Vector(8,8),2,ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):y=R.createArrow(25,c.availability?ColorHelper.green:ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).setRotation(p).attach(a),new I(y,"alpha",{duration:1e3,animation:x.easeIn}).animate({alpha:0}).tap(()=>y.destroy()).attach(y);}});}createExplosionDebugVisual(t,e,i,r,s,o=300){let a=new d().displayParent(e).setAlpha(.5).attach(t);R.createCircle(s,ColorHelper.blue).toSprite().displayParent(a).setPosition(r,{round:false}).setAlpha(.5).attach(t),i.forEach(c=>{let p=c.hits.length>0?ColorHelper.red:ColorHelper.white;R.createVector(r,c.line.to,p).toSprite().displayParent(a).attach(t);}),new I(a,"alpha",{duration:o,animation:x.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,r,s,o,a=300){let l=new d().displayParent(e).setAlpha(.5).attach(t);R.createElipse(o,ColorHelper.blue).toSprite().displayParent(l).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attach(t),i.forEach(p=>{let y=p.hits.length>0?ColorHelper.red:ColorHelper.white;R.createVector(p.line.from,p.line.to,y).toSprite().displayParent(l).attach(t);}),new I(l,"alpha",{duration:a,animation:x.easeIn}).animate({alpha:0}).tap(()=>l.destroy()).attach(l);}createPhysicsEntityShapeVisual(t,e,i){let r=i?.overridePosition??f.arrayToVector(t.position),s=i?.overrideRotation??new Radian(t.angle),o=i?.color??ColorHelper.blue,a=new d().displayParent(e).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀcw(c,o).displayParent(a).attachToRoot();}),new I(a,"alpha",{duration:1e3,animation:x.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcw(t,e){switch(t.type){case W.Shape.PARTICLE:throw new Error("Not implemented");case W.Shape.LINE:throw new Error("Not implemented");case W.Shape.PLANE:throw new Error("Not implemented");case W.Shape.CIRCLE:throw new Error("Not implemented");case W.Shape.CAPSULE:throw new Error("Not implemented");case W.Shape.BOX:throw new Error("Not implemented");case W.Shape.HEIGHTFIELD:throw new Error("Not implemented");case W.Shape.CONVEX:return this.ƀcv(t,e);default:{t.type;throw new Error}}}ƀcv(t,e){let i=[t.vertices.map(r=>({x:r[0],y:r[1]}))];return R.createPolygon(i,e).toSprite()}};Q=Ko([u(),Xo("design:paramtypes",[pt,jt])],Q);var qo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},tn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},$e=class{static{h(this,"HitTestService");}constructor(t){this.ƀle=t;}hitTest(t,e){let i=t.world,r=b.getFromP2BodyIDOrFail(t.id),s=f.cloneP2Body(t);this.ƀt(s,e);let o=i.broadphase.aabbQuery(i,this.ƀds(s)).map(l=>b.getFromP2BodyIDOrFail(l.id)).filter(l=>l.includeInPathfinding).filter(l=>r.canCollideWith(l)).map(l=>f.cloneP2Body(l.p2Body)),a=false;if(o.length!==0){let l=new W.World;l.addBody(s),o.forEach(c=>l.addBody(c)),l.step(1,1,1),a=l.narrowphase.contactEquations.some(c=>c.bodyA===s||c.bodyB===s),l.clear();}if(e?.testLayerID){let l=a?ColorHelper.red:ColorHelper.green;this.ƀle.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀt(t,e){e?.overridePosition&&(t.position=f.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀds(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};$e=qo([u(),tn("design:paramtypes",[Q])],$e);var rn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ke=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀje(t,i);});});}step(t,e,i){b.getPhysicsEntities().forEach(r=>{r.ƀbc=[];}),t.p2World.narrowphase.contactEquations.forEach(r=>{this.ƀje(t,r);}),t.bodiesInContactWith.forEach((r,s)=>{this.ƀfd(r.p2Body),r.entity.ƀjt(t.collisionReports.get(s)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀfd(t){let e=f.arrayToVector(t.velocity);e.length>Si&&(e=e.normalize(Si),t.velocity=f.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-Ei),Ei);}ƀje(t,e){let i=b.getFromP2BodyID(e.bodyA.id),r=b.getFromP2BodyID(e.bodyB.id);if(i&&r){t.bodiesInContactWith.set(e.bodyA.id,{p2Body:e.bodyA,entity:i}),t.bodiesInContactWith.set(e.bodyB.id,{p2Body:e.bodyB,entity:r});let s=t.collisionReports.get(e.bodyA.id)||[],o=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀdy(i,r,e);s.push({self:a,target:l}),o.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,s),t.collisionReports.set(e.bodyB.id,o);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀdy(t,e,i){let r=t.convertToDTO(),s=e.convertToDTO(),o=f.arrayToVector(i.contactPointA),a=f.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀen(i);return {collisionDetailsA:this.ƀdx(r,i.bodyA.mass,o,l,t.area),collisionDetailsB:this.ƀdx(s,i.bodyB.mass,a,c,e.area)}}ƀdx(t,e,i,r,s){let o,a=i.add(t.position);return {body:t,getPositionReletiveToObject:h(()=>(o||(o=i.rotate(t.rotation.multiply(-1).vector)),o),"getPositionReletiveToObject"),getPositionOnWorld:h(()=>(a||(a=i.add(t.position)),a),"getPositionOnWorld"),position:i,mass:e,area:s,normal:r}}ƀen(t){let e=f.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};ke=rn([u()],ke);var sn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},on=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},ze=class extends ce{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};ze=sn([gt(),on("design:paramtypes",[Number,Object])],ze);var nn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},j=1e4,Je=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbv(t,new Vector(e.x/2,-j/2),new Vector(e.x+j*2,j),i),this.ƀbv(t,new Vector(e.x/2,e.y+j/2),new Vector(e.x+j*2,j),i),this.ƀbv(t,new Vector(-j/2,e.y/2),new Vector(j,e.y+j*2),i),this.ƀbv(t,new Vector(e.x+j/2,e.y/2),new Vector(j,e.y+j*2),i);}ƀbv(t,e,i,r){return new ze(t,{shapeDefinition:{materialName:lt,group:r,shapeType:rt.Rectangle,shapeData:i},position:e,rotation:Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};Je=nn([u()],Je);var hn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},dr=new W.Material,ln={id:lt,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},Wt=class{static{h(this,"MaterialsService");}createMaterials(t,e,i,r){let s=new Map,o=new Map;if(i.forEach(a=>{s.set(a.id,new W.Material),o.set(a.id,a);}),s.has(lt))throw new Error(`Material with name ${lt} cannot be defined, pick another name for the material.`);return s.set(lt,dr),o.set(lt,ln),this.ƀc(t,e,i,r,s),{materials:s,materialDefinitions:o}}getMaterial(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀel(e,i.materials)}getMaterialDefinition(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀek(e,i.materialDefinitions)}ƀel(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀek(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material definition with name ${t}.`);return i}ƀc(t,e,i,r,s){this.ƀed(i.map(o=>o.id),r).forEach(o=>{let a=this.ƀel(o.materialA,s),l=this.ƀel(o.materialB,s);t.addContactMaterial(new W.ContactMaterial(a,l,{friction:o.friction,restitution:o.bounciness,stiffness:o.stiffness,relaxation:o.relaxation}));}),this.ƀd(t,e,i,s);}ƀed(t,e){let i=new Map;e.forEach(s=>{let o=i.get(s.materialA);o||(o=new Map,i.set(s.materialA,o)),o.set(s.materialB,s);});let r=[];return t.forEach((s,o)=>{for(let a=o;a<t.length;a++){let l=t[a],c=i.get(s)?.get(l);c?r.push(c):r.push({materialA:s,materialB:l,friction:0,bounciness:0,relaxation:4,stiffness:1e6});}}),r}ƀd(t,e,i,r){i.forEach(s=>{let o=this.ƀel(s.id,r);t.addContactMaterial(new W.ContactMaterial(o,dr,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};Wt=hn([u()],Wt);var cn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},pn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ut=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,r,s){this.ƀgw=t,this.ƀak=e,this.ƀaa=i,this.ƀbd=r,this.ƀig=s;}createPhysicsWorld(t){let e=new W.World({gravity:[0,0]}),{materials:i,materialDefinitions:r}=this.ƀgw.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:s,physicsBodyGroupToP2Mask:o}=this.ƀig.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new v(t.mapSize,t.modifyUpdateCycle,e,i,r,s,o).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&m.cleanUpdateModifier();}).attachToRoot(),this.ƀak.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀbd.registerPhysicsWorld(a),t.modifyUpdateCycle?m.registerUpdateModifier((l,c)=>this.ƀkw(a,l,c)):m.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀkw(a,l,c);}).attach(a),a.id}addBody(t,e,i,r,s){let o=v.getInstanceByIDOrFail(t);if(i){let a=this.ƀaa.findClosestAvailableSpace(o,e,r);return a?(e.position[0]+=a.x,e.position[1]+=a.y,o.p2World.addBody(e),s&&this.ƀaa.onBodyAdded(o,e,r),true):false}else return o.p2World.addBody(e),s&&this.ƀaa.onBodyAdded(o,e,r),true}removeBody(t,e){v.getInstanceByID(t)?.p2World.removeBody(e);}ƀkw(t,e,i){if(!t.paused.value){t.availabilityGridCache.clear(),t.vectorFieldCache.clear(),t.p2World.step(i,i,i),t.modifyUpdateCycle&&(i=t.p2World.time-t.lastP2Time.value);let r=e+i;this.ƀbd.step(t,r,i),t.onPhysicsStep.trigger({time:r,delta:i}),t.lastP2Time.value=t.p2World.time;}return i}setPaused(t,e){v.getInstanceByIDOrFail(e).paused.set(t);}};Ut=cn([u(),pn("design:paramtypes",[Wt,Je,pt,ke,X])],Ut);var dn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},kt=class{static{h(this,"RayCastingService");}castClosest(t,e,i){let r=new W.RaycastResult,s=new W.Ray({mode:W.Ray.CLOSEST,from:f.vectorToArray(e.from),to:f.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i)});if(t.p2World.raycast(r,s),r.hasHit())return this.ƀbq(r,e)}castAllFirstContacts(t,e,i){let r=new Map,s=new W.Ray({mode:W.Ray.ALL,from:f.vectorToArray(e.from),to:f.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i),callback:h(o=>{let a=r.get(o.body);!r.has(o.body)||o.fraction<a.fraction?r.set(o.body,this.ƀbq(o,e)):o.fraction===a.fraction&&a.isExternal()&&r.set(o.body,this.ƀbq(o,e));},"callback")});return t.p2World.raycast(new W.RaycastResult,s),Array.from(r.values())}ƀbq(t,e){let i=t.fraction,r=f.arrayToVector(t.normal),s,o,a;return {body:t.body,hitPosition:h(()=>(s===void 0&&(s=e.from.lerp(e.to,i)),s),"hitPosition"),hitDistance:h(()=>(o===void 0&&(o=e.length*i),o),"hitDistance"),isExternal:h(()=>(a===void 0&&(a=e.fromTo.dotProduct(r)<0),a),"isExternal"),normal:r,fraction:i,line:e}}};kt=dn([u()],kt);var fn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ft=class{static{h(this,"ImpactService");}applyImpulse(t,e,i,r){let s=i.normalize(r),o=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(f.vectorToArray(s),o);}};ft=fn([u()],ft);var mn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},zt=class{static{h(this,"RayCastHitConverterService");}toExplosionHits(t,e=true){let i=new Map;return t.forEach(r=>{r.hits.forEach(s=>{let o=i.get(s.body);if(o){let a=s.fraction<o.closestRaycastHit.fraction?s:o.closestRaycastHit;o.rayCastHits.push(s),i.set(s.body,{hitCount:o.hitCount+1,closestRaycastHit:a,rayCastHits:o.rayCastHits,isExternal:e?o.isExternal:o.isExternal&&s.isExternal(),explosionCenter:s.line.from});}else {let a=s.isExternal();i.set(s.body,{hitCount:1,closestRaycastHit:s,rayCastHits:[s],isExternal:a,explosionCenter:s.line.from});}});}),[...i.values()].map(r=>this.ƀbr(r,t.length))}ƀbr(t,e){let i=t.hitCount/e,r=t.rayCastHits;if(t.isExternal)return {body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:true,normal:t.closestRaycastHit.normal,fraction:t.closestRaycastHit.fraction,ratioOfHits:i,raycastResults:r,getHitPosition:t.closestRaycastHit.hitPosition,getHitDistance:t.closestRaycastHit.hitDistance};{let s=f.arrayToVector(t.closestRaycastHit.body.position);return {body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:false,normal:Vector.fromTo(s,t.explosionCenter).normalize(),fraction:0,ratioOfHits:i,raycastResults:r,getHitPosition:h(()=>t.explosionCenter,"getHitPosition"),getHitDistance:h(()=>0,"getHitDistance")}}}};zt=mn([u()],zt);var gn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},wn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},bn=15,Ke=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,r){this.ƀja=t,this.ƀle=e,this.ƀiz=i,this.ƀfq=r;}createElipticExplosion(t,e,i,r,s,o,a){let l=v.getInstanceByIDOrFail(t),c=this.ƀcg(e,i,r,s,a?.hitOnlyClosest===true,l),p=this.ƀiz.toExplosionHits(c,false);return this.ƀr(p,o),a?.testLayerID&&this.ƀle.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,r,a.debugRayDuration),p.map(y=>{let{p2Body:w,...C}=y;return C})}ƀcg(t,e,i,r,s,o){let a=[],l=e.vector,c=e.add(Radian.get90).vector,p=c.normalize(i.x);a.push(new Line(t,t.add(p))),a.push(new Line(t,t.add(p.multiplyNumber(-1))));let y=l.normalize(i.y);a.push(new Line(t,t.add(y))),a.push(new Line(t,t.add(y.multiplyNumber(-1))));let w=Math.round(i.y/bn),C=i.y/(w*2+1)*2,Ct=l.normalize(C),pe=i.x,mr=Math.pow(i.y,2);return ArrayHelper.createIntegerArray(w).forEach(yt=>{let At=C*(yt+1),Ai=Ct.multiplyNumber(yt+1),ue=c.normalize(this.ƀev(pe,mr,At)),de=t.add(Ai);a.push(new Line(de,de.add(ue))),a.push(new Line(de,de.add(ue.multiplyNumber(-1))));let fe=t.add(Ai.multiplyNumber(-1));a.push(new Line(fe,fe.add(ue))),a.push(new Line(fe,fe.add(ue.multiplyNumber(-1))));}),a.map(yt=>{if(s){let At=this.ƀja.castClosest(o,yt,r);return {line:yt,hits:At?[At]:[]}}else {let At=this.ƀja.castAllFirstContacts(o,yt,r);return {line:yt,hits:At}}})}ƀev(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀr(t,e){t.forEach(i=>{i.raycastResults.forEach(r=>{let s,o;r.isExternal()?(s=r.line.fromTo,o=e*2):(s=r.line.fromTo.multiplyNumber(-1),o=e*(1-r.fraction)*8),this.ƀfq.applyImpulse(r.body,r.hitPosition(),s,o);});});}};Ke=gn([u(),wn("design:paramtypes",[kt,Q,zt,ft])],Ke);var Pn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Sn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Xe=class{static{h(this,"ExplosionService");}constructor(t,e,i,r){this.ƀja=t,this.ƀle=e,this.ƀiz=i,this.ƀfq=r;}createExplosion(t,e,i,r,s,o){let a=v.getInstanceByIDOrFail(t),l=this.ƀet(i),c=this.ƀcg(e,i,r,l,o?.hitOnlyClosest===true,a),p=this.ƀiz.toExplosionHits(c);return this.ƀr(e,i,s,l,p),o?.testLayerID&&this.ƀle.createExplosionDebugVisual(a,o.testLayerID,c,e,i,o.debugRayDuration),p}ƀcg(t,e,i,r,s,o){let a=new Radian(PI_360/r),l=new Vector(0,-e),c=a.vector;return ArrayHelper.createEmptyArray(r).map(()=>{let p=t.add(l);return l=l.rotate(c),new Line(t,p)}).map(p=>{if(s){let y=this.ƀja.castClosest(o,p,i);return {line:p,hits:y?[y]:[]}}else {let y=this.ƀja.castAllFirstContacts(o,p,i);return {line:p,hits:y}}})}ƀr(t,e,i,r,s){s.forEach(o=>{if(o.isExternal)o.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀfq.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=Vector.fromTo(t,f.arrayToVector(o.p2Body.position)),l=a.length/e,c=i*r*l/2;this.ƀfq.applyImpulse(o.p2Body,o.getHitPosition(),a,c);}});}ƀet(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};Xe=Pn([u(),Sn("design:paramtypes",[kt,Q,zt,ft])],Xe);var Cn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Jt=class{static{h(this,"PhysicsQueryService");}getMapSize(t){let e=v.getInstanceByIDOrFail(t);return {dimentions:e.mapSize,center:e.mapSizeCenter}}subscribeToPhysicsStep(t,e){return v.getInstanceByIDOrFail(t).onPhysicsStep.subscribe(e)}};Jt=Cn([u()],Jt);var An=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},On=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ii=class{static{h(this,"PhysicsController");}constructor(t,e,i,r,s,o,a,l){this.ƀin=t,this.ƀhz=e,this.ƀle=i,this.ƀdh=r,this.ƀda=s,this.ƀfi=o,this.ƀim=a,this.ƀfq=l;}createPhysicsWorld(t){return this.ƀin.createPhysicsWorld(t)}getMapSize(t){return this.ƀim.getMapSize(t)}setPaused(t,e){this.ƀin.setPaused(t,e);}hitTest(t,e){let i=b.getPhysicsInstanceOrFail(t);return this.ƀfi.hitTest(i.p2Body,e)}findPath(t,e,i,r,s){return this.ƀhz.findPathAStar(t,e,i,r,{neighborType:s})}findPathDirection(t,e,i,r){return this.ƀhz.findPathDirection(t,e,i,r)}applyImpulse(t,e,i,r){let s=b.getPhysicsInstanceOrFail(t);this.ƀfq.applyImpulse(s.p2Body,e,i,r);}createExplosion(t,e,i,r,s,o){return this.ƀdh.createExplosion(t,e,i,r,s,o)}createElipticExplosion(t,e,i,r,s,o,a){return this.ƀda.createElipticExplosion(t,e,i,r,s,o,a)}printPathfindingTestGrid(t,e,i,r,s,o=50){this.ƀle.printPathfindingTestGrid(t,e,i,r,s,o);}};Ii=An([tt(le),On("design:paramtypes",[Ut,jt,Q,Xe,Ke,$e,Jt,ft])],Ii);var Mn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ze=class{static{h(this,"ShapeCreationService");}createBody(t,e,i,r,s){let o=v.getInstanceByIDOrFail(t);if(!o.physicsBodyGroupToP2Group.has(e.shapeDefinition.group))throw new Error(`Physics body group "${e.shapeDefinition.group}" not found`);switch(e.shapeDefinition.shapeType){case rt.Point:return this.ƀbx(o,void 0,i,r,e.shapeDefinition.group,s);case rt.Circle:return this.ƀbx(o,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case rt.Polygon:return this.ƀcf(o,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case rt.Rectangle:return this.ƀch(o,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);default:{e.shapeDefinition.shapeType;throw new Error}}}ƀbx(t,e,i,r,s,o){let a=new W.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s),radius:e});a.material=i;let l=new W.Body({type:o==="dynamic"?W.Body.DYNAMIC:W.Body.STATIC,mass:r.density,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return l.addShape(a),l}ƀcf(t,e,i,r,s,o){let a=t.physicsBodyGroupToP2Group.get(s),l=t.physicsBodyGroupToP2Mask.get(s),c=e.map(w=>new W.Convex({vertices:w.map(C=>[C.x,C.y]),collisionGroup:a,collisionMask:l})).map(w=>(w.material=i,w)),p=c.reduce((w,C)=>w+C.area,0),y=new W.Body({type:o==="dynamic"?W.Body.DYNAMIC:W.Body.STATIC,mass:p,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.forEach(w=>y.addShape(w)),y.setDensity(r.density),y}ƀch(t,e,i,r,s,o){let a=new W.Box({width:e.x,height:e.y,collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s)});a.material=i;let l=e.x*e.y,c=new W.Body({type:o==="dynamic"?W.Body.DYNAMIC:W.Body.STATIC,mass:l,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.addShape(a),c.setDensity(r.density),c}};Ze=Mn([u()],Ze);var Dn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Bn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ci=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,r,s){this.ƀin=t,this.ƀil=e,this.ƀkd=i,this.ƀim=r,this.ƀig=s;}createBody(t,e,i,r,s){return this.ƀkd.createBody(t,e,i,r,s)}getMaterial(t,e){return this.ƀil.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀil.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀig.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀig.getMaskConstant(t,e)}addBody(t,e,i,r,s){return this.ƀin.addBody(t,e,i,r,s)}removeBody(t,e){this.ƀin.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀim.subscribeToPhysicsStep(t,e)}};Ci=Dn([tt(ct),Bn("design:paramtypes",[Ut,Wt,Ze,Jt,X])],Ci);export{ht as AdvancedSound,Di as AnimationFlicker,V as AnimationInterpolationFunctions,x as Animations,T as AnimationsCompletionHandlingType,I as Animator,lt as BORDER_MATERIAL_NAME,E as BardLegendsHardReset,qt as Camera,nt as CameraGateway,Xt as ClosestAvailableSpaceHelper,d as Container,Dt as ContainerEventType,tt as ControllerDecorator,ti as Cursor,N as DEFAULT_SHADER_RESOLUTION,oi as DeltaTime,ui as DisplayObjectArray,$ as Entity,gt as EntityDecorator,Hi as FadeInContent,at as FocusingAnimation,g as Game,q as Gateway,R as Graphics,ce as ImmovablePhysicsEntity,bi as KeyboardService,fi as MenuEntity,oe as MenuUI,mi as MenuView,he as MouseService,Pi as MouseTargetFocusService,Ti as MovableEntity,Ri as MovablePhysicsEntity,ee as Music,hi as MusicPlayer,Zt as PathFinder,b as PhysicsEntity,le as PhysicsGateway,rt as PhysicsShapeType,li as Placeholder,Ei as ROTATIONAL_SPEED_LIMIT,A as ReAnimateHandlingType,ci as RichText,K as SOUND_TRANSITION_DURATION,Si as SPEED_LIMIT,Ot as Scene,Cr as SceneDecorator,yi as ScrollAreaUI,et as ScrollDirection,Pt as ScrollMaskUI,P as Service,u as ServiceDecorator,wt as SingletonEntity,zi as SlideInContent,si as SlideInContentByIndex,Re as SlideStateAnimation,it as SlideStateAnimationState,te as Sound,J as Sprite,Gt as StateAnimation,se as Text,ve as ThroughEmptyStateAnimation,pi as UpdatableContainer,m as UpdateCycle,Qt as VectorFieldPathFinder,Et as VectorSet,U as View,qe as ViewDecorator};
45
+ }`,e}constructor(t,e){if(super({glProgram:F.GlProgram.from({vertex:F.defaultFilterVert,fragment:n.ƀec(t*N)}),resources:{expandUniforms:{uColor:{value:new Float32Array(3),type:"vec3<f32>"},uExpandSquared:{value:0,type:"f32"}}},resolution:N}),this.ƀdf=t,this.ƀdf=t*N,this.ƀdf<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀdf>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");Comparator.isInteger(this.ƀdf)||(this.ƀdf=Math.floor(this.ƀdf));let i=ColorHelper.normalize(e);this.resources.expandUniforms.uniforms.uColor=new Float32Array([i.red,i.green,i.blue]),this.resources.expandUniforms.uniforms.uExpandSquared=this.ƀdf*this.ƀdf,this.padding=this.ƀdf;}};var Ee=class extends F.Filter{static{h(this,"GlowFilter");}constructor(t){super({resolution:N,compatibleRenderers:F.RendererType.WEBGL});let e={blurRadius:1,expand:0,color:ColorHelper.white,...t};this.ƀdg=new Se(e.expand,e.color);let i=Comparator.isNumber(e.blurRadius)?new Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀaj=new Bt(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀaj.blendMode="screen";}apply(t,e,i,r){let s=F.TexturePool.getSameSizeTexture(e);this.ƀdg.apply(t,e,s,true),this.ƀaj.apply(t,s,i,r),F.TexturePool.returnTexture(s);}};var Yt=class n{static{h(this,"GlowSpriteGenerator");}static{this.ƀew=new Map;}static createGlowSpriteFromSprite(t,e,i){let r=this.ƀbh(e),s=Comparator.isNumber(r.blurRadius)?new Vector(r.blurRadius,r.blurRadius):r.blurRadius,o=this.ƀee(t.texture,s,r.expand,r.color,i),a=new F.Sprite(o);return this.ƀjv(a,Vector.fromVec2(t.anchor),Math.max(s.x,s.y)+r.expand),a.alpha=r.glowAlpha,a.blendMode=r.blendMode,a}static ƀee(t,e,i,r,s){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(s){let o=`${t.id}-${i}-${e.x}-${e.y}-${r.r}-${r.g}-${r.b}`;if(n.ƀew.has(o))return n.ƀew.get(o);{let a=this.ƀef(t,e,i,r);return n.ƀew.set(o,a),a}}else return this.ƀef(t,e,i,r)}static ƀef(t,e,i,r){let s=new F.Sprite(t);s.filters=[new Ee({blurRadius:e,expand:i,color:r})];let o=new F.Container;o.addChild(s);let a=Math.max(e.x,e.y)+i,l=g.instance.renderer.generateTexture({target:o,frame:new F.Rectangle(-a,-a,s.width+a*2,s.height+a*2)});return l.id=M.insertAsset(l),o.destroy({children:true}),l}static ƀjv(t,e,i){let r=(i+(t.width-i*2)*e.x)/t.width,s=(i+(t.height-i*2)*e.y)/t.height;t.anchor.set(r,s);}static ƀbh(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:ColorHelper.white,blendMode:"add"};return t&&(e={...e,...t}),e}};E.onHardReset.subscribe(()=>{Yt.ƀew.clear();}).attachToRoot();var J=class n extends d{static{h(this,"Sprite");}static createByName(t){let e=g.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new n(e)}static createSnapshotSprite(t){let e=t.ƀip,i=e.parent;i&&i.removeChild(e);let r=g.instance.renderer.generateTexture({target:e,resolution:2,antialias:true,textureSourceOptions:{scaleMode:"linear"}});i&&i.addChild(e);let o={id:M.insertAsset(r),scale:t.scale,size:t.size,anchor:Vector.zero,destroyAssetOnDestroy:true};return new n(o,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀli=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀko=t,this.pixiSprite=new F.Sprite(M.getAsset(t.id)),this.ƀip.addChild(this.pixiSprite),this.setTextureScale(t.scale),e.textureSize&&(this.pixiSprite.width=e.textureSize.x,this.pixiSprite.height=e.textureSize.y),e.texturePosition&&this.pixiSprite.position.set(e.texturePosition.x,e.texturePosition.y),e.ignoreAnchor||this.pixiSprite.anchor.set(t.anchor.x,t.anchor.y);}destroy(){this.destroyed||(super.destroy(),this.ƀko.destroyAssetOnDestroy&&(M.destroyAsset(this.ƀko.id),this.ƀiq&&M.destroyAsset(this.ƀiq.texture.id)),this.ƀgr?.destroy(),this.ƀal?.destroy(),this.ƀiq&&!this.ƀiq.destroyed&&this.ƀiq.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀli}set textureScale(t){this.ƀli=t,this.pixiSprite.scale.set(t);}get size(){return new Vector(this.pixiSprite.width,this.pixiSprite.height)}getMask(){return this.pixiSprite}set interactive(t){super.interactive=t,t&&this.ƀko.boundingShapes&&!this.ƀip.hitArea&&(this.ƀip.hitArea=new hs(this.ƀko.boundingShapes,this.size,Vector.fromVec2(this.ƀko.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.source.autoGenerateMipmaps}set mipmap(t){this.pixiSprite.texture.source.autoGenerateMipmaps=t;}setBlendMode(t){return this.blendMode=t,this}get blendMode(){return this.pixiSprite.blendMode}set blendMode(t){this.pixiSprite.blendMode=t;}setTint(t){return this.tint=t,this}get tint(){return new F.Color(this.pixiSprite.tint).toRgb()}set tint(t){this.pixiSprite.tint=t;}setShapeAlpha(t){return this.pixiSprite.alpha=t,this}get shapeAlpha(){return this.pixiSprite.alpha}set shapeAlpha(t){this.pixiSprite.alpha=t;}setGlowAlpha(t){return this.glowAlpha=t,this}get glowAlpha(){if(this.ƀiq)return this.ƀiq.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀiq)this.ƀiq.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=Vector.fromVec2(this.ƀko.anchor).to(t);return new Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀiq&&(this.ƀiq.destroy(),this.ƀiq=void 0),t&&(this.ƀiq=Yt.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀko.destroyAssetOnDestroy),this.ƀiq.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀiq.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀip.addChild(this.ƀiq)),this}showBoundingShape(t){return t?this.ƀal||(this.ƀal=this.ƀbw().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀal&&(this.ƀal.destroy(),this.ƀal=void 0),this}getBoundingMask(){if(!this.ƀgr){if(!this.ƀko.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀgr=this.ƀbw(),this.ƀgr.displayParent(this);}return this.ƀgr}ƀbw(){if(!this.ƀko.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return R.createPolygon(this.ƀko.boundingShapes,ColorHelper.white).toSprite().attach(this)}download(){let t=g.instance.renderer.extract.canvas(this.ƀip);if(!t.toBlob)throw new Error("Sprite: canvas.toBlob is undefined!");return t.toBlob(e=>{if(!e)throw new Error("Sprite: blob is undefined!");let i=document.createElement("a");document.body.append(i),i.download="sprite.png",i.href=URL.createObjectURL(e),i.click(),i.remove();},"image/png"),this}},hs=class{static{h(this,"CompositeHitArea");}constructor(t,e,i){this.ƀke=t.map(r=>new F.Polygon(r.map(s=>new F.Point(s.x,s.y))));}contains(t,e){return this.ƀke.some(i=>i.contains(t,e))}};var Te=class{static{h(this,"DashedLineHelper");}static getLines(t,e,i){let r=Vector.fromTo(t,e),s=r.normalize(),o=r.length-i.lineStartGap-i.lineEndGap,a=[];if(o<=0)return a;let l=t.add(s.normalize(i.lineStartGap));if(o<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(s.normalize(o))}),a;let c=o-i.dashGap,p=i.dashLength+i.dashGap,y=Math.floor(c/p),w=c-p*y;y>=1&&w<i.dashLength&&(w+=p,y--);let C=s.normalize(w/2),Ct=s.normalize(i.dashGap);if(a.push({from:l,to:l.add(C)}),l=l.add(C),y>0){let pe=s.normalize(i.dashLength);ArrayHelper.createEmptyArray(y).forEach(()=>{l=l.add(Ct),a.push({from:l,to:l.add(pe)}),l=l.add(pe);});}return l=l.add(Ct),a.push({from:l,to:l.add(C)}),a}};var R=class n extends d{static{h(this,"Graphics");}static{this.ƀcx=new Map;}static createArrow(t,e){let i=new F.Graphics;return [[{x:0,y:-t/2},{x:t*3/8,y:-t/8},{x:t/4,y:0},{x:0,y:-t/4},{x:-t/4,y:0},{x:-t*3/8,y:-t/8}],[{x:0,y:-t/4},{x:t/8-t/30,y:-t/8-t/30},{x:t/8-t/30,y:t*7/16},{x:-t/8+t/30,y:t*7/16},{x:-t/8+t/30,y:-t/8-t/30}]].forEach(s=>{i.poly(s.map(o=>new F.Point(o.x,o.y))).fill(e);}),new n(i,JSON.stringify({type:"arrow",size:t,color:e}))}static createDashedLine(t,e,i){let r={width:2,dashLength:10,dashGap:4,lineStartGap:0,lineEndGap:0,color:ColorHelper.white,...i},s=new F.Graphics;return Te.getLines(t,e,r).forEach(a=>{s.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),s.stroke({width:r.width,color:r.color}),new n(s,JSON.stringify({type:"dashedLine",from:t,to:e,options:r}))}static createVector(t,e,i){let r=new F.Graphics;return r.moveTo(t.x,t.y),r.lineTo(e.x,e.y),r.stroke({width:2,color:i}),r.circle(t.x,t.y,3),r.fill(ColorHelper.white),r.stroke({width:1,color:i}),new n(r,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let r=new F.Graphics;return r.rect(0,0,t.x,e),r.rect(0,e,e,t.y-e*2),r.rect(t.x-e,e,e,t.y-e*2),r.rect(0,t.y-e,t.x,e),r.fill(i),new n(r,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=ColorHelper.white){let i=new F.Graphics;return i.rect(0,0,t.x,t.y).fill(e),new n(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new F.Graphics;return i.circle(0,0,t).fill(e),new n(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new F.Graphics;return i.ellipse(0,0,t.x,t.y).fill(e),new n(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new F.Graphics,r=JSON.stringify({type:"polygon",polygon:t,color:e});return t.forEach(s=>{i.poly(s.map(o=>new F.Point(o.x,o.y))).fill(e);}),new n(i,r)}static createRegularPolygon(t,e,i){let r=new F.Graphics,s=new Radian(PI_360/t);r.moveTo(e,0);for(let o=1;o<=t;o++){let l=s.multiply(o).vector.normalize(e),c=e+l.x,p=e+l.y;r.lineTo(c,p);}return r.fill(i),new n(r,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.ƀip.addChild(t),this.pixiGraphics=t,this.ƀao=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀao,cache:false,...t},i=this.ƀer(e.cacheName,e.cache),r={id:i.textureID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},s=new J(r,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),s}ƀer(t,e){if(e){let i=n.ƀcx.get(t);return i||(i=this.ƀci(),n.ƀcx.set(t,i)),i}else return this.ƀci()}ƀci(){let t=g.instance.renderer.generateTexture(this.pixiGraphics);t.id=M.insertAsset(t);let e=this.pixiGraphics.getBounds();return {textureID:t.id,bounds:new Vector(e.x,e.y)}}};var ri=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},Pt=class n extends d{static{h(this,"ScrollMaskUI");}static{this.ƀcx=new Map;}constructor(t,e,i,r=et.Vertical){if(super(),i<0)throw new Error("The padding of the scroll mask cannot be lower than '0'");if(e.y<i*2)throw new Error(`The height of the scroll mask cannot be lower than '${i*2}'`);let s=new d;r===et.Horizontal?this.ƀcc(e,i,s):this.ƀcj(e,i,s),this.ƀgr=J.createSnapshotSprite(s).attach(this),s.destroy(),t.setMask(this.ƀgr);}ƀcj(t,e,i){e>0&&this.ƀbz(new Vector(t.x,e)).displayParent(i).attach(i),R.createRectangle(new Vector(t.x,t.y-e*2),ColorHelper.white).toSprite().setPosition(new Vector(0,e),{round:false}).displayParent(i).attach(i),e>0&&this.ƀbz(new Vector(t.x,e)).setPosition(new Vector(t.x,t.y),{round:false}).setRotation(Radian.get180).displayParent(i).attach(i);}ƀcc(t,e,i){e>0&&this.ƀbz(new Vector(t.y,e)).setPosition(new Vector(0,t.y),{round:false}).setRotation(Radian.get270).displayParent(i).attach(i),R.createRectangle(new Vector(t.x-e*2,t.y),ColorHelper.white).toSprite().setPosition(new Vector(e,0),{round:false}).displayParent(i).attach(i),e>0&&this.ƀbz(new Vector(t.y,e)).setPosition(new Vector(t.x,0),{round:false}).setRotation(Radian.get90).displayParent(i).attach(i);}ƀbz(t){let i={id:this.ƀca(t.y),scale:1,size:t,anchor:{x:0,y:0}};return new J(i,{textureSize:t,ignoreAnchor:true})}ƀca(t){let e=JSON.stringify({type:"gradient",length:t}),i=n.ƀcx.get(e);if(!i){let r=document.createElement("canvas");r.width=1,r.height=t;let s=r.getContext("2d");if(s){let o=new ri;ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${o.multiplierFunction(l/t)})`;s.fillStyle=c,s.fillRect(0,l,1,1);});let a=F.Texture.from(r);i=M.insertAsset(a),n.ƀcx.set(e,i);}else throw new Error("Canvas context is null")}return i}};var it;(function(n){n[n.Appear=1]="Appear",n[n.Disappear=2]="Disappear";})(it||(it={}));var Re=class extends Attachable{static{h(this,"SlideStateAnimation");}onStateChange(t){return this.ƀhr.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀht.subscribe(e=>t(e.value,e.index)).attach(this),this}get state(){return {value:this.ƀkv.state.value,item:this.ƀfs,nextItem:this.ƀhi,queuedItem:this.ƀkv.state.queuedItem,animationState:this.ƀo}}constructor(t){super(),this.ƀo="idle",this.ƀhr=new Action,this.ƀht=new Action,this.ƀhw={duration:500,animation:x.easeInOutCubic,...t},this.ƀkv=new Gt({duration:this.ƀhw.duration,animation:this.ƀhw.animation}).onStateChange((e,i)=>this.ƀez(e,i)).onValueChange(e=>this.ƀfe(e)).attach(this);}setIndex(t,e){if(!Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀfs===void 0?(this.ƀfs=t,this.ƀhr.trigger({state:it.Appear,index:t}),this.ƀkv.setItem(t,e)):this.ƀfs!==t?this.ƀhi!==t?this.ƀo==="idle"?(this.ƀo=t>this.ƀfs?"transitionForward":"transitionBackward",this.ƀhi=t,this.ƀhr.trigger({state:it.Appear,index:this.ƀhi}),this.ƀkv.setItem(t,e)):this.ƀkv.setItem(t,e):this.ƀo==="reverting"&&this.ƀhi===t&&(this.ƀo=t>this.ƀfs?"transitionForward":"transitionBackward",this.ƀkv.setItem(t,e)):(this.ƀo==="transitionForward"||this.ƀo==="transitionBackward")&&(this.ƀo="reverting",this.ƀkv.setItem(t,e));}ƀez(t,e){switch(this.ƀfs!==void 0&&this.ƀfs!==t&&this.ƀfs!==e&&this.ƀhr.trigger({state:it.Disappear,index:this.ƀfs}),this.ƀhi!==void 0&&this.ƀhi!==t&&this.ƀhi!==e&&this.ƀhr.trigger({state:it.Disappear,index:this.ƀhi}),e!==void 0&&e!==this.ƀfs&&e!==this.ƀhi&&this.ƀhr.trigger({state:it.Appear,index:e}),this.ƀo){case "idle":break;case "transitionForward":case "transitionBackward":e===void 0?(this.ƀo="idle",this.ƀfs=this.ƀhi,this.ƀhi=void 0):this.ƀfs!==t&&this.ƀfa(t,e);break;case "reverting":e===void 0?(this.ƀo="idle",this.ƀhi=void 0):this.ƀfs!==e&&this.ƀfa(t,e);break;default:{this.ƀo;throw new Error}}}ƀfa(t,e){this.ƀfs=t,this.ƀhi=e,this.ƀht.trigger({value:0,index:this.ƀfs}),this.ƀo=this.ƀfs<this.ƀhi?"transitionForward":"transitionBackward";}ƀfe(t){let e=1;(this.ƀo==="transitionBackward"||this.ƀo==="reverting"&&this.ƀfs!==void 0&&this.ƀhi!==void 0&&this.ƀfs>this.ƀhi)&&(e=-1),(this.ƀo==="idle"||t!==0)&&this.ƀht.trigger({value:NumberHelper.ensurePositiveZero(-e*t),index:this.ƀfs}),this.ƀhi!==void 0&&this.ƀht.trigger({value:NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀhi});}};var et;(function(n){n[n.Horizontal=1]="Horizontal",n[n.Vertical=2]="Vertical";})(et||(et={}));var si=class extends d{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀby=t,this.ƀcs="x",this.ƀbo=new Map,this.ƀhw={duration:300,animation:x.easeInOutCubic,size:new Vector(500,500),margin:20,direction:et.Horizontal,...e};let i=this.ƀhw.direction===et.Horizontal?new Vector(this.ƀhw.size.x+this.ƀhw.margin*2,this.ƀhw.size.y):new Vector(this.ƀhw.size.x,this.ƀhw.size.y+this.ƀhw.margin*2),r=new d().setPosition(this.ƀhw.direction===et.Horizontal?new Vector(-this.ƀhw.margin,0):new Vector(0,-this.ƀhw.margin),{round:false}).displayParent(this).attach(this);this.ƀcd(i,this.ƀhw.margin,this.ƀhw.direction,r),this.ƀcs=this.ƀhw.direction===et.Horizontal?"x":"y",this.ƀkv=new Re({duration:this.ƀhw.duration,animation:this.ƀhw.animation}).onStateChange((s,o)=>{if(s===it.Appear){let a=new d().displayParent(this).attach(this);this.ƀbo.set(o,a),this.ƀby({index:o,container:a});}else {let a=this.ƀbo.get(o);a&&(a.destroy(),this.ƀbo.delete(o));}}).onValueChange((s,o)=>{let a=this.ƀbo.get(o);if(a){let l={x:0,y:0};l[this.ƀcs]=i[this.ƀcs]*s+this.ƀhw.margin,a.setPosition(Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=r;}setIndex(t,e){return this.ƀkv.setIndex(t,e),this}ƀcd(t,e,i,r){new Pt(r,new Vector(t.x,t.y),e,i).attach(this);}},zi=class extends si{static{h(this,"SlideInContent");}constructor(t,e,i){super(r=>{let s=this.indexToItem.get(r.index);if(s)e({index:r.index,item:s,container:r.container});else throw new Error(`SlideInContent: The item with index '${r.index}' is not part of the items list`)},i),this.itemToIndex=new Map,this.indexToItem=new Map,t.forEach((r,s)=>{this.itemToIndex.set(r,s),this.indexToItem.set(s,r);});}setItem(t,e){let i=this.itemToIndex.get(t);if(i!==void 0)this.setIndex(i,e);else throw new Error(`SlideInContent: The item '${t}' is not part of the items list`);return this}};var Et=class{static{h(this,"VectorSet");}constructor(){this.ƀlv=new Map;}add(t){let e=this.ƀlv.get(t.x);e||(e=new Set,this.ƀlv.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀlv.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀlv.get(t.x);return e?e.delete(t.y):false}};var oi=class{static{h(this,"DeltaTime");}static adjustMultiplier(t,e){return Math.pow(t,e)}};var D=class{static{h(this,"PositionToGridPositionConverter");}static areaToGridArea(t,e){return new Rectangle(this.positionToGridPosition(t.topLeft,e),this.positionToGridPosition(t.bottomRight,e))}static positionToGridPosition(t,e){return t.divideNumber(e).floor()}static gridPositionToPosition(t,e){return t.add(new Vector(.5,.5)).multiplyNumber(e)}};var Xt=class{static{h(this,"ClosestAvailableSpaceHelper");}static findByConvertingGridSpace(t,e,i){let r=new Vector(Math.ceil(e.size.x/i)-1,Math.ceil(e.size.y/i)-1),s=D.areaToGridArea(e,i);if(this.ƀav(t,s))return Vector.zero;let o=t.movePositionInsideGrid(s.topLeft),a=Vector.fromTo(s.topLeft,o),l=this.find(t,o,r);if(l){let c=l.add(a),p=Vector.fromTo(s.topLeft.multiplyNumber(i),e.topLeft);return new Vector(c.x*i+((r.x+1)*i-e.size.x)/2-p.x,c.y*i+((r.y+1)*i-e.size.y)/2-p.y)}}static find(t,e,i){let r=new Et,s=new Queue(e);for(;s.notEmpty;){let o=s.pop();r.add(o);let a=new Rectangle(o,o.add(i));if(this.ƀav(t,a))return Vector.fromTo(e,o);t.getNeighborPositions(o,"orthogonal").forEach(l=>{r.has(l)||s.add(l);});}}static ƀav(t,e){if(!t.isAreaWithinBounds(e))return false;for(let i=e.topLeft.y;i<=e.bottomRight.y;i++)for(let r=e.topLeft.x;r<=e.bottomRight.x;r++)if(!t.get(new Vector(r,i)))return false;return true}};var Ji=Math.SQRT2-1,Ss=class{static{h(this,"PathfinderNode");}constructor(t,e){this.position=t,this.distanceToEnd=e,this.closed=false,this.distanceFromStart=Number.MAX_SAFE_INTEGER,this.parent=void 0;}get pathLength(){return this.distanceFromStart+this.distanceToEnd}getStepCost(t){return this.position.x!==t.position.x&&this.position.y!==t.position.y?Math.SQRT2:1}createSolutionPath(t){let e=[],i=this;for(;i!==void 0;)e.push(i.position),i=i.parent;return e.reverse(),{directPathAvailable:t,path:e}}},Es=class{static{h(this,"PathfinderGrid");}constructor(t,e,i,r){this.ƀey=t,this.ƀlc=i,this.ƀhh=r,this.ƀhv=new BinaryHeap("min"),this.ƀhk=new Grid({size:t.size,defaultValue:void 0});let s=this.ƀce(e);s.distanceFromStart=0,this.ƀhv.add(s.pathLength,s),this.ƀae=s;}get hasOpenNodes(){return this.ƀhv.size>0}getNeighbors(t){let e=[];for(let i of this.ƀey.getNeighborPositions(t.position,this.ƀhh))if(this.ƀey.get(i)){let r=this.ƀhk.get(i)??this.ƀce(i);r.closed||e.push(r);}return e}popLowestPathCostNode(){let t=this.ƀhv.pop();return t.closed=true,t.distanceToEnd<this.ƀae.distanceToEnd&&(this.ƀae=t),t}changeNodeCost(t,e,i){t.distanceFromStart=e,t.parent=i,this.ƀhv.updatePriority(t,t.pathLength)||this.ƀhv.add(t.pathLength,t);}getBestClosedNode(){return this.ƀae}ƀce(t){let e=Math.abs(t.x-this.ƀlc.x),i=Math.abs(t.y-this.ƀlc.y),r=this.ƀhh==="orthogonal"?e+i:e>i?e+Ji*i:i+Ji*e,s=new Ss(t,r);return this.ƀhk.isPointWithinBounds(t)&&this.ƀhk.set(t,s),s}},Zt=class{static{h(this,"PathFinder");}static findPath(t,e,i,r){let s=new Es(t,e,i,r);for(;s.hasOpenNodes;){let o=s.popLowestPathCostNode();if(o.position.isEqual(i))return o.createSolutionPath(true);for(let a of s.getNeighbors(o)){let l=o.distanceFromStart+o.getStepCost(a);l<a.distanceFromStart&&s.changeNodeCost(a,l,o);}}return s.getBestClosedNode().createSolutionPath(false)}};var Qt=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀlb=t,this.ƀy=e,this.ƀfh=this.ƀeh(this.ƀy.size),this.ƀme=new Grid({size:this.ƀy.size,defaultValue:this.ƀfh}),this.ƀct=new Grid({size:this.ƀy.size,defaultValue:void 0});let i=new Et,r=new Queue;for(this.ƀdu(this.ƀy.cropAreaOutsideOfTheGrid(t)).forEach(o=>{this.ƀme.set(o,0),r.add(o);});r.notEmpty;){let o=r.pop();if(!i.has(o)){i.add(o);let a=this.ƀme.getOrFail(o);this.ƀem(o,this.ƀy).forEach(l=>{if(!i.has(l.position)){let c=this.ƀme.getOrFail(l.position),p=a+l.distance;this.ƀy.getOrFail(l.position)&&p<c&&(this.ƀme.set(l.position,p),r.add(l.position));}});}}}getDirectionToTarget(t){if(!t.isInsideRectangle(this.ƀlb)){if(t=this.ƀme.movePositionInsideGrid(t),this.ƀct.has(t))return this.ƀct.get(t);{let e=this.ƀem(t,this.ƀy),i;return this.ƀme.getOrFail(t)>=this.ƀfh?e.some(s=>this.ƀy.get(s.position))&&(e.some(o=>!this.ƀy.get(o.position))?i=this.ƀeb(e):i=this.ƀdw(t,e)):i=this.ƀdw(t,e),this.ƀct.set(t,i),i}}}ƀeb(t){let e=t.filter(i=>this.ƀy.get(i.position)).map(i=>i.direction.radian);return Radian.getAverage(...e)}ƀdw(t,e){let i=e.filter(r=>this.ƀme.getOrFail(r.position)<this.ƀfh).reduce((r,s)=>{let o=this.ƀme.getOrFail(s.position)+s.distance;return o<r.bestWeight?(r.bestDirections=[s.direction],r.bestWeight=o):o===r.bestWeight&&r.bestDirections.push(s.direction),r},{bestDirections:[],bestWeight:this.ƀfh}).bestDirections;return this.ƀes(i,t)}ƀes(t,e){if(t.length>0){let i=t.reduce((r,s)=>r.add(s),Vector.zero);if(i.isZero()||!this.ƀfy(e,i))return Random.pickRandomElement(t).radian;if(t.length>=1)return i.radian}}ƀfy(t,e){let i=t.add(this.ƀlw(e));return this.ƀy.isPointWithinBounds(i)&&this.ƀy.getOrFail(i)}ƀem(t,e){return this.ƀme.getNeighborDirections(t,"all").map(i=>({position:t.add(i),direction:i,distance:i.x!==0&&i.y!==0?14:10}))}ƀdu(t){let e=[];for(let i=t.topLeft.y;i<=t.bottomRight.y;i++)for(let r=t.topLeft.x;r<=t.bottomRight.x;r++)e.push(new Vector(r,i));return e}ƀlw(t){let e=t.normalize().round();return new Vector(e.x,e.y)}ƀeh(t){return (t.x+t.y)*20}};var S=class n{static{h(this,"AudioAssets");}static{this.ƀan=new Map;}static{this.context=new AudioContext;}static async load(t){await Promise.all(t.map(e=>fetch(e.url).then(i=>i.arrayBuffer()).then(i=>this.context.decodeAudioData(i)).then(i=>this.ƀan.set(e.id,i))));}static createSource(t){let e=n.ƀdv(t),i=n.context.createBufferSource();return i.buffer=e,i}static ƀdv(t){let e=this.ƀan.get(t);if(!e)throw new Error(`Audio: Sound with id ${t} was not loaded.`);return e}};E.onHardReset.subscribe(()=>{S.context=new AudioContext,S.ƀan.clear();}).attachToRoot();var K=1e3,Y=class n{static{h(this,"Audio");}static ƀjy(){return this.ƀfv=new n,this.ƀfv}constructor(){this.ƀgu=S.context.createGain(),this.ƀgt=S.context.createGain(),this.ƀhg=S.context.createGain(),this.ƀkh=S.context.createGain(),this.ƀgu.connect(S.context.destination),this.ƀgt.connect(this.ƀgu),this.ƀhg.connect(this.ƀgt),this.ƀkh.connect(this.ƀgt),this.ƀgv=new I(this.ƀgu.gain,"value",{duration:500*2,animation:x.easeIn,reAnimateHandling:A.CompletePrevious,completionHandling:T.StayInCurrentState}),this.ƀgv.set({value:0});}setVolumes(t){this.ƀgt.gain.value=t.master,this.ƀhg.gain.value=t.music,this.ƀkh.gain.value=t.sound;}appear(t,e="ease"){switch(e){case "ease":return this.ƀgv.set({value:t?0:1}),this.ƀgv.animate({value:t?1:0}).chainToRoot();case "instant":return this.ƀgv.set({value:t?1:0}),SingleEvent.instant();default:{throw new Error}}}};E.onHardReset.subscribe(()=>{Y.ƀjy();}).attachToRoot();var As=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},nt=class extends q(){static{h(this,"CameraGateway");}};nt=As([u()],nt);var Os=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Rt=class extends q(){static{h(this,"CameraViewGateway");}};Rt=Os([u()],Rt);var Ki;(function(n){n.BackgroundScreen="backgroundScreen",n.Background="background",n.Main="main",n.Foreground="foreground",n.ForegroundScreen="foregroundScreen";})(Ki||(Ki={}));var at;(function(n){n[n.Instant=1]="Instant",n[n.EaseInOut=2]="EaseInOut",n[n.EaseOut=3]="EaseOut";})(at||(at={}));var qt=class{static{h(this,"Camera");}get position(){return this.ƀaq.getCameraPosition()}constructor(){this.ƀaq=P.get(nt),this.ƀau=P.get(Rt),this.ƀaq.createCamera(),this.layers=this.ƀau.getLayers();}setPosition(t){this.ƀaq.setPosition(t);}setTransition(t){this.ƀaq.setTransition(t);}appear(t,e="alpha",i=0){return this.ƀau.appear(t,e,i)}screenPositonToStagePosition(t){return this.ƀau.screenPositonToStagePosition(t)}};var g=class n{static{h(this,"Game");}static get instance(){return this.ƀfv}static{this.pause=Reducer.createOr();}static{this.freeze=Reducer.createOr();}static get camera(){return this.ƀap}static get audio(){return this.ƀx}static appear(t,e){let i=e?.audio??"ease",r=e?.camera??"alpha";return ActionLib.all([this.audio.appear(t,i),this.camera.appear(t,r,i!=="instant"?0:500)]).mapToVoid().chainToRoot()}static get time(){return m.ƀlj}static get setupOptions(){return this.ƀkb}constructor(t){if(this.ƀjn=new Variable(Vector.zero),this.screenSize=this.ƀjn.notifier,this.ƀjo=new Variable(Vector.zero),this.screenSizeCenter=this.ƀjo.notifier,this.devMode=false,n.ƀfv)throw new Error("There can be only one Game instance!");this.ƀbk={screenResolution:void 0,maxScreenResolution:void 0,devMode:false,backgroundColor:ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbk.devMode||false,this.ƀio=new F.Application;let e=n.pause.effect(false).attachToRoot();n.freeze.subscribe(i=>{e.update(i),i?S.context.suspend():S.context.resume();}).attachToRoot();}async setup(t){n.ƀkb=t;let e=JsonHelper.removeUndefinedProperties({backgroundColor:this.ƀbk.backgroundColor,autoStart:false,antialias:this.ƀbk.antialias,resolution:this.ƀbk.resolution,width:this.ƀbk.screenResolution?.width,height:this.ƀbk.screenResolution?.height,useBackBuffer:true,powerPreference:"high-performance",eventFeatures:{globalMove:false}});await this.ƀio.init(e);let i=document.body.appendChild(this.ƀio.canvas);this.ƀjx(i),await Promise.all([M.loadGameAssets(t.spriteAssetDefinitions),M.loadGameAssets(t.fontAssetDefinitions),S.load(t.soundAssetDefinitions)]),n.ƀfv=this,this.renderer=this.ƀio.renderer,globalThis.ƀa=this.ƀio,this.ƀfc(),n.ƀap=new qt,n.ƀx=Y.ƀjy(),this.ƀio.start(),this.ƀio.ticker.add(()=>{n.freeze.value||m.triggerUpdateTick(this.ƀio.ticker.deltaMS);});}setResolution(t){if(this.ƀio.renderer.resolution!==t){this.ƀio.renderer.resolution=t;let e=this.ƀeq();this.ƀio.renderer.resize(e.x,e.y);}}ƀfc(){this.ƀdb(),this.ƀjw(),window.addEventListener("resize",t=>{this.ƀdb(),this.ƀjw();});}ƀdb(){let t=this.ƀeq();(t.x!==this.ƀio.screen.width||t.y!==this.ƀio.screen.height)&&this.ƀio.renderer.resize(t.x,t.y);}ƀjw(){let t=new Vector(this.ƀio.screen.width,this.ƀio.screen.height);this.ƀjn.value=t,this.ƀjo.value=t.multiplyNumber(.5).round();}ƀeq(){let t=this.ƀbk.screenResolution?.width??window.innerWidth,e=this.ƀbk.screenResolution?.height??window.innerHeight;return this.ƀbk.maxScreenResolution&&(t=Math.min(t,this.ƀbk.maxScreenResolution.width),e=Math.min(e,this.ƀbk.maxScreenResolution.height)),new Vector(t,e)}ƀjx(t){this.ƀbk.maxScreenResolution&&(t.style.maxWidth=`${this.ƀbk.maxScreenResolution?.width}px`,t.style.maxHeight=`${this.ƀbk.maxScreenResolution?.height}px`),t.style.width="100%",t.style.height="100%";}};var te=class n extends IDAttachable{static{h(this,"Sound");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`Sound: Could not find sound definition with name ${t}.`);return new n(i,e)}get volume(){return this.ƀdq.gain.value}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀdq.gain.value=t,this}constructor(t,e){super(),this.ƀki=t,this.ƀdq=S.context.createGain(),this.ƀdq.connect(Y.ƀfv.ƀkh),this.ƀfg=this.ƀdq,e?.volume!==void 0&&(this.volume=e.volume),this.ƀiu(e?.time??0);}destroy(){this.destroyed||(super.destroy(),this.ƀkx(),this.ƀdq?.disconnect());}ƀlt(){this.ƀfg.disconnect(),this.ƀfg.connect(Y.ƀfv.ƀhg);}ƀiu(t){this.ƀkx();let e=this.ƀki.loop;if(this.ƀkr=NumberHelper.clamp(t,0,e?e.to:this.ƀki.duration),e){let i=e.from,r=e.to;this.ƀiv({soundID:this.ƀki.id,start:this.ƀkr,end:this.ƀkr<i?i:r,loop:false,onComplete:h(()=>{this.ƀkl.disconnect(),this.ƀiv({soundID:this.ƀki.id,start:i,end:r,loop:true});},"onComplete")});}else this.ƀiv({soundID:this.ƀki.id,start:this.ƀkr,end:void 0,loop:false,onComplete:h(()=>this.destroy(),"onComplete")});}ƀkx(){this.ƀkl&&(this.ƀkl.onended=null,this.ƀkl.stop(),this.ƀkl.disconnect());}ƀiv(t){this.ƀkl=S.createSource(t.soundID),this.ƀkl.connect(this.ƀdq),t.onComplete&&(this.ƀkl.onended=t.onComplete),t.loop?(this.ƀkl.loop=true,this.ƀkl.loopStart=t.start,this.ƀkl.loopEnd=t.end??this.ƀkl.buffer.duration,this.ƀkl.start(0,t.start)):this.ƀkl.start(0,t.start,t.end?t.end-t.start:void 0);}};var Fs=800,Ae=-128,ht=class n extends te{static{h(this,"AdvancedSound");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new n(i,e)}constructor(t,e){super(t,e),this.ƀlj=new Variable(0),this.time=this.ƀlj.notifier,this.ƀkt=S.context.currentTime-this.ƀkr,this.ƀlj.value=this.ƀkr,m.beforeSceneUpdateAction.subscribe(()=>{this.ƀlj.value=S.context.currentTime-this.ƀkt;}).attach(this),this.ƀfg.disconnect(),this.ƀjz(e?.fade?NumberHelper.clamp(e.fade,0,1):0),this.ƀka(e?.muffle?NumberHelper.clamp(e.muffle,0,1):0),this.ƀfg.connect(Y.ƀfv.ƀkh);}ƀjz(t=0){this.ƀdj=S.context.createGain(),this.ƀdj.gain.value=1-t,this.ƀdi=new I(this.ƀdj.gain,"value",{duration:500,animation:x.lineer,reAnimateHandling:A.CompletePrevious,completionHandling:T.StayInCurrentState}),this.ƀfg.connect(this.ƀdj),this.ƀfg=this.ƀdj;}ƀka(t=0){this.ƀhe=S.context.createBiquadFilter(),this.ƀhe.type="highshelf",this.ƀhe.frequency.value=Fs,this.ƀhe.gain.value=t*Ae,this.ƀhf=new I(this.ƀhe.gain,"value",{duration:500,animation:x.lineer,reAnimateHandling:A.CompletePrevious,completionHandling:T.StayInCurrentState}),this.ƀfg.connect(this.ƀhe),this.ƀfg=this.ƀhe;}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.fade(1,K).notIdle().chain(this).tap(()=>this.destroy()).chainToRoot())}notifyOnTime(t){return this.time.value>t?SingleEvent.createDestroyed():SingleEvent.create(e=>{let i=this.time.filter(r=>r>=t).tap(()=>e()).attach(this);return ()=>i.destroy()})}setFade(t){t=NumberHelper.clamp(t,0,1),this.ƀdi.set({value:1-t});}fade(t,e=500){t=NumberHelper.clamp(t,0,1);let i=t>1-this.ƀdj.gain.value;return e===0?(this.ƀdi.set({value:1-t}),SingleEvent.instant()):this.ƀdi.animate({value:1-t},{duration:e,animation:i?x.easeOut:x.easeIn}).chain(this)}setMuffle(t){t=NumberHelper.clamp(t,0,1),this.ƀhf.set({value:t*Ae});}muffle(t,e=500){return t=NumberHelper.clamp(t,0,1),e===0?(this.ƀhf.set({value:t*Ae}),SingleEvent.instant()):this.ƀhf.animate({value:t*Ae},{duration:e}).chain(this)}destroy(){this.destroyed||(this.ƀdj.disconnect(),this.ƀhe.disconnect()),super.destroy();}};var ee=class n extends IDAttachable{static{h(this,"Music");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new n(i,e)}get time(){switch(this.ƀkk.value.type){case "paused":return this.ƀkk.value.value.time;case "playing":return this.ƀkk.value.value.time.value;default:{this.ƀkk.value;throw new Error}}}get volume(){return this.ƀkk.value.value.volume}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀkk.value.value.volume=t,this}constructor(t,e){super(),this.ƀhw={stopPlayingOnPause:true,...e},this.ƀkj=t.id;let i;if(this.ƀhw.stopPlayingOnPause&&g.pause.value)i={type:"paused",value:{time:0,volume:1}};else {let r=new ht(t,this.ƀhw).attach(this);r.ƀlt(),i={type:"playing",value:r};}this.ƀkk=new Variable(i),this.ƀhw.stopPlayingOnPause&&(this.ƀib=g.pause.subscribe(r=>this.ƀfb(r)).attach(this));}notifyOnTime(t){return SingleEvent.create(e=>{let i=this.ƀkk.asyncDropOngoing((r,s)=>{switch(r.type){case "paused":s.drop();break;case "playing":return r.value.notifyOnTime(t);default:{throw new Error}}}).toSingleEvent().tap(()=>e()).attach(this);return ()=>i.destroy()})}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.ƀib?.destroy(),SingleEvent.instant().async(()=>ActionLib.all([this.ƀkk.value.type==="playing"?this.ƀkk.value.value.close():SingleEvent.instant(),this.ƀdk?.onDestroy()??SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀfb(t){if(t){if(this.ƀkk.value.type==="playing"){let e=this.ƀkk.value.value;this.ƀkk.value={type:"paused",value:{time:e.time.value,volume:e.volume}},this.ƀdk=e,ActionLib.all([e.fade(1,K),e.muffle(1,K)]).tap(()=>{this.ƀdk=void 0,e.destroy();}).attach(this);}}else if(this.ƀkk.value.type==="paused"){let{volume:e,time:i}=this.ƀkk.value.value,r=ht.createByName(this.ƀkj,{volume:e,time:i,fade:1,muffle:1}).attach(this);r.ƀlt(),ActionLib.all([r.fade(0,K),r.muffle(0,K)]).attach(this),this.ƀkk.value={type:"playing",value:r};}}};var hi=class extends IDAttachable{static{h(this,"MusicPlayer");}get time(){return this.ƀiw?this.ƀiw.time:0}get volume(){return this.ƀmd}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀmd=t,this.ƀiw&&(this.ƀiw.volume=t),this.ƀia&&(this.ƀia.volume=t),this}constructor(t){super(),this.ƀmd=1,this.ƀhw={stopPlayingOnPause:true,playWhenPaused:void 0,volume:1,...t},this.ƀmd=this.ƀhw.volume,this.ƀhw.playWhenPaused&&this.ƀkc(this.ƀhw.playWhenPaused);}play(t){if(this.ƀbb)throw new Error("Play is called while music player is destroyed.");return this.ƀco=t,SingleEvent.instant().async(()=>{let e=this.ƀiw;if(e)return this.ƀiw=void 0,e.close()}).map(()=>{if(this.ƀco===t)return this.ƀiw=ee.createByName(t,{stopPlayingOnPause:this.ƀhw.stopPlayingOnPause,volume:this.ƀmd}).attach(this),this.ƀiw}).chain(this)}stop(){return SingleEvent.instant().async(()=>{let t=this.ƀiw;if(t)return t.close().tap(()=>{t===this.ƀiw&&(this.ƀiw=void 0);})}).chain(this)}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.ƀib?.destroy(),SingleEvent.instant().async(()=>ActionLib.all([this.ƀiw?.close()??SingleEvent.instant(),this.ƀia?.close()??SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀkc(t){this.ƀib=g.pause.toSequence().asyncDropOngoing(e=>e&&m.wait(K).map(()=>e)).tap(e=>{if(e)this.ƀia=ht.createByName(t,{fade:1,volume:this.ƀmd}).attach(this),this.ƀia.ƀlt(),this.ƀia.fade(0);else if(this.ƀia){let i=this.ƀia;this.ƀia.fade(1).tap(()=>i.destroy()).attach(this),this.ƀia=void 0;}}).attach(this);}};var li=class extends d{static{h(this,"Placeholder");}constructor(t){super(),this.ƀir=new F.Graphics,this.ƀir.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),this.ƀip.addChild(this.ƀir);}destroy(){this.destroyed||(super.destroy(),this.ƀir.destroy());}};var Ft=class{static{h(this,"TextStyleConverter");}static getPixiTextStyle(t){let e={color:ColorHelper.white,align:"center",fontFamily:"Arial",fontStyle:"normal",fontSize:18,lineHeight:void 0,wordWrapWidth:void 0,lineThrough:false,...t},i=t?.dropShadow===true?{}:t?.dropShadow,r={};if(i){let s={blur:4,angle:Radian.get60,distance:10,color:ColorHelper.black,alpha:.5,...i};r={dropShadow:{blur:s.blur,angle:s.angle.value,distance:s.distance,color:ColorHelper.rgbToHex(s.color),alpha:s.alpha}};}return JsonHelper.removeUndefinedProperties({fontFamily:e.fontFamily,fill:ColorHelper.rgbToHex(e.color),align:e.align,fontSize:e.fontSize,fontStyle:e.fontStyle,lineHeight:e.lineHeight,wordWrapWidth:e.wordWrapWidth,wordWrap:e.wordWrapWidth!==void 0,lineThrough:e.lineThrough,...r})}};var De=class{static{h(this,"RichTextDataInConverter");}static process(t,e){let i=new Set(e.styles?Object.keys(e.styles):[]),r=RichTextSeparator.process(t,i),s=this.ƀfr(r,e),o=this.ƀs(s);return this.ƀkm(o)}static ƀfr(t,e){let i=new Map,r=new Map,s=h((a,l)=>{if(r.has(l))return r.get(l);let c=Ft.getPixiTextStyle(a);return r.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀdz(a.tags,e,i),p=s(l,c),y=F.CanvasTextMetrics.measureText(" ",new F.TextStyle(p),void 0,false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:y.width}})}static ƀdz(t,e,i){let r=t.join("+");if(i.has(r))return {style:i.get(r),cacheKey:r};let s=this.ƀbf(t,e);return i.set(r,s),{style:s,cacheKey:r}}static ƀbf(t,e){let i={...e.default};for(let l of t)e.styles&&e.styles[l]&&(i={...i,...e.styles[l]});let{wordWrapWidth:r,align:s,dropShadow:o,...a}=i;return a}static ƀs(t){let e=[],i=[];return t.forEach((r,s)=>{r.text.split(/\r?\n/).forEach((a,l)=>{l>0&&(e.push(i),i=[]),i.push({text:a,cacheKey:r.cacheKey,style:r.style,pixiStyle:r.pixiStyle,spaceWidth:r.spaceWidth});});}),e.push(i),e}static ƀkm(t){let e=[];return t.forEach(i=>{if(i.length===0)throw new Error("Internal Error: Line is unexpectedly empty");let r=i.flatMap(s=>this.ƀkn(s.text).map(a=>{let l=new F.TextStyle(s.pixiStyle),c=F.CanvasTextMetrics.measureText(a,l,void 0,false);return {text:a,whitespace:a.trim()==="",style:{cacheKey:s.cacheKey,style:s.style,pixiStyle:l,height:c.height,ascent:c.fontProperties.ascent,descent:c.fontProperties.descent,width:c.width,spaceWidth:s.spaceWidth}}}));e.push(r);}),e}static ƀkn(t){if(t==="")return [""];let e=[],i="",r=t[0]===" ";for(let s=0;s<t.length;s++){let o=t[s],a=o===" ";a===r?i+=o:(e.push(i),i=o,r=a);}return i&&e.push(i),e}};var Be=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀcm.length===0}get remainingWidth(){return this.ƀmf-this.ƀcp}constructor(t,e){this.ƀmf=t,this.ƀgj=[],this.ƀcm=[],this.ƀcp=0,this.ƀgi=new Vector(0,0),this.ƀcn=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀfj=i.horizontalAlignment,this.ƀlx=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀmf||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀcq={direction:i.rectangleCutOption.direction,rectangle:this.ƀbs(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀcn,t.y),i=this.ƀei(this.ƀgi.y,this.ƀgi.y+e);return this.ƀcp+t.x<=i}insertWord(t){let e=Math.max(this.ƀcn,t.style.height);if(this.ƀcm.length===0){let i=this.ƀej(this.ƀgi.y,this.ƀgi.y+e);this.ƀgi=new Vector(i,this.ƀgi.y),this.ƀcp=this.ƀgi.x;}this.ƀcm.push({chunk:t,position:new Vector(this.ƀcp,this.ƀgi.y)}),this.ƀcn=e,this.ƀcp+=t.style.width;}newLine(){let t=this.ƀgi.y+this.ƀcn,e=this.ƀej(t,t);this.ƀdm(),this.ƀgi=new Vector(e,t),this.ƀcp=this.ƀgi.x,this.ƀcn=0;}print(){return this.ƀdm(),this.ƀgj}ƀdm(){this.ƀcm.length>0&&(this.ƀgj.push(this.ƀg(this.ƀcm)),this.ƀcm=[]);}ƀg(t){return t=this.ƀlz(t),t=this.ƀfl(t),t}ƀfl(t){if(this.ƀfj==="left")return t;let e=this.ƀgi.y+this.ƀcn,i=this.ƀej(this.ƀgi.y,e),s=this.ƀei(this.ƀgi.y,e)-i,o=Math.min(s,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀfj==="center"?a=(s-o)/2:a=s-o,t.map(l=>(l={chunk:l.chunk,position:new Vector(l.position.x+a,l.position.y)},l))}ƀlz(t){let e=Math.max(...t.map(r=>r.chunk.style.ascent)),i=Math.max(...t.map(r=>r.chunk.style.descent));return t.map(r=>{let s;switch(this.ƀlx){case "top":s=i-r.chunk.style.descent;break;case "center":s=(i-r.chunk.style.descent+e-r.chunk.style.ascent)*.5;break;case "bottom":s=e-r.chunk.style.ascent;break;default:{this.ƀlx;throw new Error}}return r={chunk:r.chunk,position:new Vector(r.position.x,r.position.y+s)},r})}ƀej(t,e){return this.ƀcq&&(this.ƀcq.direction==="topLeft"||this.ƀcq.direction==="bottomLeft")&&(this.ƀcq.rectangle.isPointInside(new Vector(0,t),{includeEdges:false})||this.ƀcq.rectangle.isPointInside(new Vector(0,e),{includeEdges:false}))?this.ƀcq.rectangle.bottomRight.x:0}ƀei(t,e){return this.ƀcq&&(this.ƀcq.direction==="topRight"||this.ƀcq.direction==="bottomRight")&&(this.ƀcq.rectangle.isPointInside(new Vector(this.ƀmf,t),{includeEdges:false})||this.ƀcq.rectangle.isPointInside(new Vector(this.ƀmf,e),{includeEdges:false}))?this.ƀcq.rectangle.topLeft.x:this.ƀmf}ƀbs(t){let e,i;switch(t.direction){case "topRight":e=new Vector(t.position.x,-1/0),i=new Vector(1/0,t.position.y);break;case "topLeft":e=new Vector(-1/0,-1/0),i=t.position;break;case "bottomRight":e=t.position,i=new Vector(1/0,1/0);break;case "bottomLeft":e=new Vector(-1/0,t.position.y),i=new Vector(t.position.x,1/0);break;default:{t.direction;throw new Error}}return new Rectangle(e,i)}};var Ge=class{static{h(this,"ConsistentSpaceTextWrapper");}static wrapText(t,e){return t.forEach(i=>{i.forEach((r,s)=>{if(e.isSpaceAvailable(new Vector(r.style.width,r.style.height)))if(r.whitespace&&s===i.length-2){let o=i[i.length-1];e.isSpaceAvailable(new Vector(o.style.width+r.style.width,o.style.height))?e.insertWord(r):this.ƀmg(r,e);}else e.insertWord(r);else e.lineIsEmpty?e.insertWord(r):r.whitespace?this.ƀmg(r,e):(e.newLine(),e.insertWord(r));}),e.newLine();}),e.print()}static ƀmg(t,e){let i=Math.max(0,Math.floor(e.remainingWidth/t.style.spaceWidth)),r=Math.max(0,Math.min(i,t.text.length-1));if(r>0){let o={text:" ".repeat(r),whitespace:true,style:{...t.style,width:r*t.style.spaceWidth}};e.insertWord(o);}e.newLine();let s=t.text.length-r-1;if(s>0){let o={text:" ".repeat(s),whitespace:true,style:{...t.style,width:s*t.style.spaceWidth}};e.insertWord(o);}}};var _e=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀgz(t),t=this.ƀln(t),this.ƀax(t)}static ƀgz(t){return t.map(e=>{let i=[],r,s=true;return e.forEach(o=>{if(!r||r.chunk.style.cacheKey!==o.chunk.style.cacheKey)r&&i.push(r),r=o,s=o.chunk.whitespace;else {let a=r.chunk.text+o.chunk.text;s=o.chunk.whitespace&&s,r={chunk:{text:a,whitespace:s,style:{...r.chunk.style,width:r.chunk.style.width+o.chunk.style.width}},position:r.position};}}),r&&i.push(r),i})}static ƀln(t){return t.map(e=>{if(e.length===0)return [];let i=e.pop();if(!i.chunk.whitespace||i.chunk.text===""){let r=i.chunk.text.length,s=i.chunk.text.trimEnd();r!==s.length?e.push({chunk:{text:s,whitespace:false,style:{...i.chunk.style,width:i.chunk.style.width-(r-s.length)*i.chunk.style.spaceWidth}},position:i.position}):e.push(i);}return e})}static ƀax(t){return t.flatMap(e=>e.map(i=>({text:i.chunk.text,style:i.chunk.style.style,position:i.position}))).filter(e=>e.text.trim()!=="")}};var re=class{static{h(this,"RichTextToPlaneText");}static process(t,e){if(e.default.wordWrapWidth===void 0){if(e.default.align==="right"||e.default.align==="center")throw new Error("wordWrapWidth is required for right or center alignment");if(e.rectangleCut&&(e.rectangleCut.direction==="topRight"||e.rectangleCut.direction==="bottomRight"))throw new Error("wordWrapWidth is required for topRight or bottomRight rectangle cut")}let i=De.process(t,e),r=JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),s=new Be(e.default.wordWrapWidth??1/0,r),o=Ge.wrapText(i,s);return _e.process(o)}};var Ks=1,er=1/Ks,se=class extends d{static{h(this,"Text");}get ƀlg(){if(!this.ƀlh){let t=new F.TextStyle(this.ƀit);this.ƀlh=F.CanvasTextMetrics.measureText(this.ƀlf,t);}return this.ƀlh}get ascent(){return this.ƀlg.fontProperties.ascent}constructor(t,e){super(),this.ƀit=Ft.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀis.destroyed&&this.ƀis.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new Vector(this.ƀis.anchor.x,this.ƀis.anchor.y)}set anchor(t){this.ƀi=t,this.ƀis.anchor.set(t.x,t.y),this.ƀjg();}setText(t){return this.ƀlf!==t&&(this.ƀlf=t,this.ƀjd()),this}setColor(t){let e=ColorHelper.rgbToHex(t);return this.ƀit.fill!==e&&(this.ƀit.fill=e,this.ƀjd()),this}ƀjd(){this.ƀis?.destroy(),this.ƀkz?.destroy(),this.ƀkz=void 0,this.ƀlh=void 0;let t=new F.TextStyle(this.ƀit);this.ƀis=new F.Text({text:this.ƀlf,style:t}),this.ƀi&&this.ƀis.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀjg(),this.ƀis.scale.set(er,er),this.ƀip.addChild(this.ƀis),this.ƀit.lineThrough&&(this.ƀkz=this.ƀe(this.ƀis,this.ƀit.fill),this.ƀip.addChild(this.ƀkz));}ƀjg(){let t=F.CanvasTextMetrics.measureText(this.ƀlf,new F.TextStyle({...this.ƀit,dropShadow:false})),e=-this.ƀis.anchor.x*t.width,i=-this.ƀis.anchor.y*t.height;this.ƀis.boundsArea=new F.Rectangle(e,i,t.width,t.height);}ƀe(t,e){let i=F.CanvasTextMetrics.measureText(t.text,t.style),r=Math.max(1,Math.round(i.lineHeight*.07)),s=r%2*.5,o=new F.Graphics,a=0;return i.lines.forEach((l,c)=>{let p=F.CanvasTextMetrics.measureText(l,t.style),y=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+s,w=0;t.style.align==="center"?w=0+(t.width-p.width)*.5:t.style.align==="right"&&(w=0+t.width-p.width),w=Math.floor(w),o.moveTo(Math.floor(w),y),o.lineTo(Math.floor(w+p.width),y),a+=p.lineHeight;}),o.stroke({width:r,color:e}),o}};var ci=class extends d{static{h(this,"RichText");}constructor(t,e){super(),re.process(t,e).forEach(r=>new se(r.text,r.style).setPosition(r.position).displayParent(this).attach(this));}};var pi=class extends d{static{h(this,"UpdatableContainer");}},ui=class extends d{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀby=t,this.ƀcu=new Map,this.ƀhw={trackBy:h((i,r)=>r,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀcu.keys()),i=0;t.forEach((r,s)=>{let o=this.ƀhw.trackBy(r,s),a;this.ƀcu.has(o)?(a=this.ƀcu.get(o),e.delete(o),a.update(r)):(a=this.ƀby(r).displayParent(this).attach(this),this.ƀcu.set(o,a)),this.ƀhw.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀhw.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀhw.positioning.spacing);}),e.forEach(r=>{this.ƀcu.get(r).destroy(),this.ƀcu.delete(r);});}};var oe=class n extends d{static{h(this,"MenuUI");}static{this.ƀfx=Reducer.createExistenceChecker();}static{this.isAnyMenuTransitioning=this.ƀfx.notifier;}constructor(t,e){super(),this.ƀho=new SingleAction,this.onCreate=this.ƀho.notifier,this.ƀhq=new SingleAction,this.onOpen=this.ƀhq.notifier,this.ƀhl=new SingleAction,this.onClose=this.ƀhl.notifier,this.ƀbb=false;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.setAlpha(0),this.ƀp=new I(this,"alpha",{animation:x.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:A.CompletePrevious,completionHandling:T.StayInCurrentState});let r=R.createRectangle(new Vector(1,1),ColorHelper.black).toSprite({cache:true}).setAlpha(i.backgroundDarkeningRatio).setInteractive(true).displayParent(this).attach(this);this.ƀgx=J.createByName(t).setPosition(new Vector(0,0)).setInteractive(true).displayParent(this).attach(this),g.instance.screenSize.subscribe(o=>{r.aspectRatio=o.x/o.y,r.scale=Math.max(o.x,o.y),r.setPosition(Vector.zero,{holdFrom:Vector.half}),this.setPosition(o.multiplyNumber(.5));}).attach(this),this.ƀho.resolve();let s=n.ƀfx.effect().attach(this);this.ƀp.animate({alpha:1}).chain(this).tap(()=>{this.ƀhq.resolve(),s.destroy(),i.closeOnBackgroundClick&&r.on(Dt.Click).take(1).tap(()=>this.close()).attach(this);}).attachToRoot();}getBoundingMask(){return this.ƀgx.getBoundingMask()}close(){if(!this.ƀbb){this.ƀbb=true;let t=n.ƀfx.effect().attach(this);this.ƀp.animate({alpha:0}).chain(this).map(()=>{this.ƀhl.resolve(),t.destroy(),this.destroy();}).chainToRoot();}return this.onClose.toSingleEvent()}};var fi=class extends wt{static{h(this,"MenuEntity");}static subscribeIsOpen(){return ActionLib.merge(this.continuesSubscription().map(t=>t.type==="open"),SingleEvent.instant(this.getInstance()!==void 0))}constructor(t){super(),this.ƀhw=t,queueMicrotask(()=>{if(!this.ƀgy)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀjf(t){this.ƀgy=t,this.ƀgy.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀgy.onCreate.toSingleEvent()}onOpen(){return this.ƀgy.onOpen.toSingleEvent()}onClose(){return this.ƀgy.onClose.toSingleEvent()}close(){return this.ƀgy.close()}};var mi=class extends U{static{h(this,"MenuView");}constructor(t,e,i){super();let r=JsonHelper.removeUndefinedProperties({appearAnimationDuration:i.appearAnimationDuration,backgroundDarkeningRatio:i.backgroundDarkeningRatio,closeOnBackgroundClick:t.ƀhw.closeOnBackgroundClick}),s=new oe(e,r).displayParent(g.camera.layers.foregroundScreen).attach(this);t.ƀjf(s);let o=new SingleAction;s.onCreate.subscribe(()=>o.resolve(s)).attach(this),this.onCreate=o.notifier,this.onOpen=s.onOpen.notifier,this.onClose=s.onClose.notifier;}};var ro=.65,so=.01,Fe=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀjp}get contentSize(){return this.ƀbm.size.ceil()}constructor(t,e,i,r){this.ƀbm=t,this.ƀv=e,this.ƀhy=i,this.ƀkg=r,this.ƀfu=false,this.ƀjp=e-i*2,this.ƀbm.y=i,this.ƀla=i;}onWheel(t){this.setTarget(this.ƀla-t*ro);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀla=NumberHelper.clamp(t,this.ƀv-this.ƀhy-this.contentSize.y,this.ƀhy);}jumpToTarget(){this.ƀbm.y=this.ƀla;}update(t){let e=this.contentSize;if(e.y<=this.ƀjp){switch(this.ƀkg){case "start":this.ƀla=this.ƀhy;break;case "center":this.ƀla=(this.ƀv-e.y)*.5;break;case "end":this.ƀla=this.ƀv-e.y-this.ƀhy;break;default:{this.ƀkg;throw new Error}}this.ƀfu||(this.ƀbm.y=this.ƀla);}this.ƀfu=true;let i=this.ƀla-this.ƀbm.y;this.ƀbm.y=this.ƀbm.y+i*so*t;}};var no=15,yi=class extends d{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbn}get contentSize(){return this.ƀjq.contentSize}constructor(t,e={}){super();let i={padding:no,smallContentAlign:"start",...e};if(i.padding<0)throw new Error("The padding of the scroll mask cannot be lower than '0'");if(i.padding>t.y*.5)throw new Error("The padding of the scroll mask cannot be higher than half of the size of the area");let r=new d().displayParent(this).attach(this);new Pt(r,t,i.padding).attach(this);let s=new F.Graphics;s.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),r.ƀip.addChild(s);let o=new d().displayParent(r).attach(this);this.ƀjq=new Fe(o,t.y,i.padding,i.smallContentAlign),this.ƀbn=new Vector(t.x,this.ƀjq.scrollHeight),s.eventMode="dynamic",s.addEventListener("wheel",a=>{this.ƀjq.onWheel(a.deltaY);}),o.setInteractive(true),o.ƀip.addEventListener("wheel",a=>{this.ƀjq.onWheel(a.deltaY);}),m.afterSceneUpdateAction.subscribe(a=>this.ƀjq.update(a.delta)).attach(this),this.addChildTo=o;}scrollToTop(t){this.ƀjq.scrollToTop(),t?.instant&&this.ƀjq.jumpToTarget();}scrollToBottom(t){this.ƀjq.scrollToBottom(),t?.instant&&this.ƀjq.jumpToTarget();}};var ao=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},_=class extends wt{static{h(this,"CameraEntity");}constructor(){super(...arguments),this.position=new Variable(Vector.zero),this.offset=new Variable(Vector.zero),this.targetPosition=new Variable(void 0),this.focusingNewTargetInfo=new Variable(void 0);}};_=ao([gt()],_);var ho=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},lo=1500,Le=class{static{h(this,"CameraService");}createCamera(){return new _().attachToRoot()}getCameraPosition(){let t=_.getInstanceOrFail();return Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=_.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=_.getInstanceOrFail();e.focusingNewTargetInfo.value={time:g.time,duration:t?.duration??lo,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??at.Instant};}update(t,e){let i=_.getInstanceOrFail(),r=i.targetPosition.value;r&&(i.focusingNewTargetInfo.value?this.ƀgc(i,r,t):i.position.value=r);}ƀgc(t,e,i){let r=t.focusingNewTargetInfo.value;if(r.focusingAnimation===at.Instant)this.ƀbg(t,e);else {let s=(i-r.time)/r.duration;if(s>=1)this.ƀbg(t,e);else {let o;r.focusingAnimation===at.EaseInOut?o=V.easeInOut(s):r.focusingAnimation===at.EaseOut?o=V.easeOut(s):o=1;let a=r.position.lerp(e,o);r.roundPosition&&(Math.abs(a.x-r.position.x)>=r.roundPositionThreshold&&(a=new Vector(Math.round(a.x),a.y)),Math.abs(a.y-r.position.y)>=r.roundPositionThreshold&&(a=new Vector(a.x,Math.round(a.y)))),t.position.value=a;}}}ƀbg(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};Le=ho([u()],Le);var co=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},po=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},wi=class{static{h(this,"CameraController");}constructor(t){this.ƀat=t;}createCamera(){return this.ƀat.createCamera().id}update(t,e){this.ƀat.update(t,e);}setPosition(t){this.ƀat.setPosition(t);}setTransition(t){this.ƀat.setTransition(t);}getCameraPosition(){return this.ƀat.getCameraPosition()}};wi=co([tt(nt),po("design:paramtypes",[Le])],wi);var He=class{static{h(this,"PositionConversionHelper");}static includeScaleInScreenPosition(t,e,i){if(e!==1){let r=Vector.fromTo(i,t).multiplyNumber(1/e);return i.add(r)}else return t}};var fo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},mo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},It=class extends U{static{h(this,"CameraView");}constructor(t){super(),this.ƀdd=t,this.ƀkp=(()=>{let e=new d().attach(this);return e.ƀip=g.instance.ƀio.stage,e})(),this.ƀjk=new d().setAlpha(0).displayParent(this.ƀkp).attach(this),this.ƀaf=R.createRectangle(new Vector(1,1),ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(this.ƀkp).attach(this),this.ƀac=new d().displayParent(this.ƀjk).attach(this),this.ƀas=new d().displayParent(this.ƀjk).attach(this),this.ƀdp=new d().setSortableChildren(true).displayParent(this.ƀjk).attach(this),this.ƀar=new d().setSortableChildren(true).displayParent(this.ƀas).attach(this),this.ƀdo=new d().setSortableChildren(true).setRenderGroup().setZIndex(20).displayParent(this.ƀar).attach(this),this.ƀgp=new d().setSortableChildren(true).setRenderGroup().setZIndex(10).displayParent(this.ƀar).attach(this),this.ƀab=new d().setRenderGroup().setZIndex(0).displayParent(this.ƀar).attach(this),this.ƀh=new I(this.ƀjk,"alpha",{duration:500,animation:x.easeInOutCubic,reAnimateHandling:A.CompletePrevious,completionHandling:T.StayInCurrentState}),this.ƀag=new I(this.ƀaf,"alpha",{duration:500,animation:x.easeInOutCubic,reAnimateHandling:A.CompletePrevious,completionHandling:T.StayInCurrentState}),g.instance.screenSize.subscribe(e=>{this.ƀaf.aspectRatio=e.x/e.y,this.ƀaf.scale=Math.max(e.x,e.y),this.ƀaf.setPosition(Vector.zero,{holdFrom:Vector.zero});}).attach(this),this.ƀdd.position.subscribe(e=>{this.ƀar.position=this.ƀbt(e);}).attach(this),this.ƀdd.offset.subscribe(e=>{this.ƀas.position=e;}).attach(this),this.ƀag.set({alpha:0}),this.ƀh.set({alpha:0});}screenPositonToStagePosition(t){let e=He.includeScaleInScreenPosition(t,this.ƀkp.scale,g.instance.screenSizeCenter.value);return new Vector(e.x-this.ƀar.position.x-this.ƀas.position.x,e.y-this.ƀar.position.y-this.ƀas.position.y)}getLayers(){return {backgroundScreen:this.ƀac.id,background:this.ƀab.id,main:this.ƀgp.id,foreground:this.ƀdo.id,foregroundScreen:this.ƀdp.id}}appear(t,e,i){switch(e){case "alpha":return this.ƀag.set({alpha:0}),this.ƀh.set({alpha:t?0:1}),SingleEvent.instant().async(()=>i>0&&m.wait(i),"tap").async(()=>this.ƀh.animate({alpha:t?1:0})).chain(this);case "pureBlack":return this.ƀh.set({alpha:1}),this.ƀag.set({alpha:t?1:0}),SingleEvent.instant().async(()=>i>0&&m.wait(i),"tap").async(()=>this.ƀag.animate({alpha:t?0:1})).chain(this);case "instant":return this.ƀh.set({alpha:t?1:0}),this.ƀag.set({alpha:t?0:1}),SingleEvent.instant();default:{throw new Error}}}ƀbt(t){return Vector.fromTo(t,g.instance.screenSizeCenter.value)}};It=fo([qe({entity:_}),mo("design:paramtypes",[_])],It);var go=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},vi=class{static{h(this,"CameraViewController");}getLayers(){let t=_.getInstanceOrFail().id;return It.getInstanceOrFail(t).getLayers()}appear(t,e,i){let r=_.getInstanceOrFail().id;return It.getInstanceOrFail(r).appear(t,e,i)}screenPositonToStagePosition(t){let e=_.getInstanceOrFail().id;return It.getInstanceOrFail(e).screenPositonToStagePosition(t)}};vi=go([tt(Rt)],vi);var wo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},xo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},bi=class{static{h(this,"KeyboardService");}constructor(){this.ƀge=new Action,this.keyPressed=this.ƀge.notifier,this.ƀgf=new Action,this.keyReleased=this.ƀgf.notifier,this.ƀgl=new Set,this.ƀgk=new Set,window.addEventListener("keydown",t=>{this.ƀgl.add(t.code),this.ƀgk.add(t.code),!t.repeat&&this.ƀge.trigger({key:t.key,code:t.code});}),window.addEventListener("keyup",t=>{this.ƀgl.delete(t.code),this.ƀgf.trigger({key:t.key,code:t.code});}),window.addEventListener("blur",()=>{this.ƀgl.clear();}),m.afterSceneUpdateAction.subscribe(()=>this.ƀgk.clear()).attachToRoot();}isKeyDown(t,e){return (e?.onlyPressedThisFrame?this.ƀgk:this.ƀgl).has(t)}};bi=wo([u(),xo("design:paramtypes",[])],bi);var vo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},bo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},he=class{static{h(this,"MouseService");}constructor(){this.ƀft=new Variable(false),this.initialMouseMovementHappened=this.ƀft.notifier,this.ƀkq=new Variable(Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀkq.notifier,this.ƀjm=new Variable(Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀjm.notifier,this.ƀgo=new Variable(false),this.mainButtonState=this.ƀgo.notifier,this.ƀjr=new Variable(false),this.secondaryButtonState=this.ƀjr.notifier,this.ƀks(),window.addEventListener("pointerdown",t=>{t.button===0?this.ƀgo.value=true:t.button===2&&(this.ƀjr.value=true);},{capture:true}),window.addEventListener("pointerup",t=>{t.button===0?this.ƀgo.value=false:t.button===2&&(this.ƀjr.value=false);},{capture:true}),window.addEventListener("blur",()=>{this.ƀgo.value=false,this.ƀjr.value=false;},{capture:true});}ƀks(){let t=Vector.zero;window.addEventListener("pointermove",e=>{t=new Vector(e.clientX,e.clientY),this.ƀft.value=true;},{capture:true}),m.beforeSceneUpdateAction.subscribe(()=>{this.ƀjm.value=this.ƀba(t);}).attachToRoot(),m.afterSceneUpdateAction.subscribe(()=>{this.ƀkq.value=g.camera.screenPositonToStagePosition(this.ƀjm.value);}).attachToRoot();}ƀba(t){let i=g.instance.renderer.canvas.getBoundingClientRect(),r=i.width,s=i.height;if(r<=0||s<=0)return Vector.zero;let o=g.instance.renderer.screen,a=(t.x-i.left)/r*o.width,l=(t.y-i.top)/s*o.height;return a=NumberHelper.clamp(a,0,o.width),l=NumberHelper.clamp(l,0,o.height),new Vector(a,l)}};he=vo([u(),bo("design:paramtypes",[])],he);var Po=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},So=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Pi=class{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀdn}get lastFocusedPosition(){return this.ƀgh}constructor(t){this.ƀhc=t,this.ƀhs=new Action,this.onTargetFocus=this.ƀhs.notifier,this.ƀll=0,this.ƀlm=false,this.ƀdn=false,this.ƀgh=void 0,m.beforeSceneUpdateAction.subscribe(e=>this.ƀlp(e.delta)).attachToRoot();}ƀlp(t){if(this.ƀhd){let e=this.ƀep(this.ƀhc.stagePosition.value,this.ƀhd);this.ƀid===void 0?this.ƀid=e:this.ƀaw(e,t);}this.ƀhd=this.ƀhc.stagePosition.value;}ƀaw(t,e){this.ƀid-t>10?(this.ƀll=Math.max(250,this.ƀll),this.ƀlm=true):this.ƀll>1e3&&(this.ƀlm=true);let i=this.ƀll>=300&&this.ƀlm;this.ƀgd(i,t,e);}ƀgd(t,e,i){(t||e>this.ƀid)&&(this.ƀid=e),t?(this.ƀlm=false,this.ƀll=0,this.ƀdn=true,this.ƀgh=this.ƀhc.stagePosition.value,this.ƀhs.trigger(this.ƀgh)):(this.ƀll+=i,this.ƀdn=false);}ƀep(t,e){let i=Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};Pi=Po([u(),So("design:paramtypes",[he])],Pi);var Si=10.8,Ei=10.01,rt;(function(n){n[n.Point=1]="Point",n[n.Circle=2]="Circle",n[n.Polygon=3]="Polygon",n[n.Rectangle=4]="Rectangle";})(rt||(rt={}));var f=class n{static{h(this,"P2JSHelper");}static aabbToBoundingBox(t){return Rectangle.fromRect({topLeft:{x:t.lowerBound[0],y:t.lowerBound[1]},bottomRight:{x:t.upperBound[0],y:t.upperBound[1]}})}static arrayToVector(t){return new Vector(t[0],t[1])}static vectorToArray(t){return [t.x,t.y]}static arePhysicsGroupsCollidable(t,e,i,r){return (t&r)!==0&&(i&e)!==0}static canCollideWith(t,e){return t.shapes.some(i=>e.shapes.some(r=>n.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new W.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var lt="border";var Ao=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},le=class extends q(){static{h(this,"PhysicsGateway");}};le=Ao([u()],le);var Oo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ct=class extends q(){static{h(this,"PhysicsInternalGateway");}};ct=Oo([u()],ct);var b=class n extends ${static{h(this,"PhysicsEntity");}static{this.ƀhx=new Map;}static{this.ƀih=new Map;}static getFromP2BodyID(t){return n.ƀhx.get(t)}static getFromP2BodyIDOrFail(t){let e=n.ƀhx.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=n.ƀih.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(n.ƀih.values())}get area(){return this.ƀu}get mass(){return this.ƀgs}get collisions(){return this.ƀbc}constructor(t,e,i){super(),this.ƀhm=new Action,this.onCollision=this.ƀhm.notifier,this.type="dynamic",this.ƀu=0,this.ƀgs=0,this.ƀbc=[],this.physicsWorldID=t,this.ƀij=P.get(ct);let r=this.ƀij.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀij.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀii=this.ƀij.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀik=this.ƀij.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀij.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀu=this.p2Body.getArea(),this.ƀgs=this.p2Body.mass,this.p2Body.position=f.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀij.addBody(this.physicsWorldID,this.p2Body,e.addInEmptySpace,e.shapeDefinition.group,e.includeOnPathfinding))throw new Error("PhysicsEntity was not able to be added to the world!");n.ƀhx.set(this.p2Body.id,this),n.ƀih.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀij.removeBody(this.physicsWorldID,this.p2Body),n.ƀhx.delete(this.p2Body.id),n.ƀih.delete(this.id));}canCollideWith(t){return f.arePhysicsGroupsCollidable(this.ƀii,this.ƀik,t.ƀii,t.ƀik)}ƀjt(t){this.ƀbc=t,t.length>0&&this.ƀhm.trigger(t);}};var ce=class extends b{static{h(this,"ImmovablePhysicsEntity");}constructor(t,e){super(t,e,"static"),this.position=f.arrayToVector(this.p2Body.position),this.rotation=new Radian(this.p2Body.angle);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position,rotation:this.rotation,velocity:Vector.zero,rotationalSpeed:0}}};var Ti=class extends ${static{h(this,"MovableEntity");}constructor(){super(),this.position=new Variable(Vector.zero),this.rotation=new Variable(Radian.get0),this.velocity=new Variable(Vector.zero),this.rotationalSpeed=new Variable(0),m.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀkw(t,e);}).attach(this);}ƀkw(t,e){this.position.value=this.position.value.add(this.velocity.value.multiplyNumber(e)),this.rotation.value=new Radian(this.rotation.value.value+this.rotationalSpeed.value*e);}};var Ri=class extends b{static{h(this,"MovablePhysicsEntity");}constructor(t,e){super(t,e,"dynamic"),this.position=new Variable(Vector.zero),this.rotation=new Variable(Radian.get0),this.velocity=new Variable(Vector.zero),this.rotationalSpeed=new Variable(0),this.ƀfm=false,this.ƀfn=false,this.ƀfp=false,this.ƀfo=false,this.ƀie(),this.ƀgm(),P.get(ct).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀkw(i,r)).attach(this);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position.value,rotation:this.rotation.value,velocity:this.velocity.value,rotationalSpeed:this.rotationalSpeed.value}}ƀkw(t,e){this.ƀfm=true,this.ƀfn=true,this.ƀfp=true,this.ƀfo=true,this.ƀie();}ƀie(){this.position.value=f.arrayToVector(this.p2Body.position),this.rotation.value=new Radian(this.p2Body.angle),this.velocity.value=f.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀgm(){this.position.subscribe(t=>{this.ƀfm?this.ƀfm=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfn?this.ƀfn=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfp?this.ƀfp=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfo?this.ƀfo=false:this.p2Body.angularVelocity=t;}).attach(this);}};var Go=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},_o=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},v=class extends ${static{h(this,"PhysicsWorldEntity");}constructor(t,e,i,r,s,o,a){super(),this.materialDefinitions=new Map,this.physicsBodyGroupToP2Group=new Map,this.physicsBodyGroupToP2Mask=new Map,this.availabilityGridCache=new Map,this.vectorFieldCache=new Map,this.bodiesInContactWith=new Map,this.collisionReports=new Map,this.paused=new Variable(false),this.lastP2Time=new Variable(0),this.onPhysicsStep=new Action,this.mapSize=t,this.mapSizeCenter=this.mapSize.multiplyNumber(.5),this.modifyUpdateCycle=e,this.p2World=i,this.materials=r,this.materialDefinitions=s,this.physicsBodyGroupToP2Group=o,this.physicsBodyGroupToP2Mask=a;}};v=Go([gt(),_o("design:paramtypes",[Vector,Boolean,W.World,Map,Map,Map,Map])],v);var Lo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},X=class{static{h(this,"PhysicsBodyGroupService");}createBodyGroupsAndMasks(t,e){let i=new Map,r=new Map;return t.map((s,o)=>{if(o>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(s,1<<o),r.set(s,0);}),e.map(([s,o])=>{if(!i.has(s))throw new Error(`Physics body group "${s}" not found`);if(!i.has(o))throw new Error(`Physics body group "${o}" not found`);let a=r.get(s),l=r.get(o),c=i.get(s),p=i.get(o);r.set(s,a|p),r.set(o,l|c);}),{physicsBodyGroupToP2Group:i,physicsBodyGroupToP2Mask:r}}getGroupConstant(t,e){return v.getInstanceByIDOrFail(t).physicsBodyGroupToP2Group.get(e)}getMaskConstant(t,e){return v.getInstanceByIDOrFail(t).physicsBodyGroupToP2Mask.get(e)}canCollide(t,e,i){let r=t.physicsBodyGroupToP2Group.get(e),s=t.physicsBodyGroupToP2Mask.get(e),o=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (s&o)!==0&&(a&r)!==0}};X=Lo([u()],X);var Ho=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},jo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ue=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀig=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((r,s)=>{r.forEach((o,a)=>{this.ƀig.canCollide(t,a,e)&&i.push({grid:o,cellSize:s});});}),i}get(t,e,i){return t.availabilityGridCache.get(e)?.get(i)}set(t,e,i,r){let s=t.availabilityGridCache.get(e);s||(s=new Map,t.availabilityGridCache.set(e,s)),s.set(i,r);}clear(t){t.availabilityGridCache.clear();}};Ue=Ho([u(),jo("design:paramtypes",[X])],Ue);var Wo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Uo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},pt=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀig=t,this.ƀz=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let r=f.aabbToBoundingBox(e.aabb);this.ƀz.getCollidableGrids(t,i).forEach(s=>{let o=D.areaToGridArea(r,s.cellSize);s.grid.setArea(o,false);});}findClosestAvailableSpace(t,e,i,r=50){return e.aabbNeedsUpdate=true,e.updateAABB(),Xt.findByConvertingGridSpace(this.getAvilabilityGrid(t,r,i),f.aabbToBoundingBox(e.aabb),r)}getAvilabilityGrid(t,e,i){let r=this.ƀz.get(t,e,i);return r||(r=this.ƀcb(t,e,i),this.ƀz.set(t,e,i,r)),r}ƀcb(t,e,i){let r=new Grid({size:new Vector(Math.floor(t.mapSize.x/e),Math.floor(t.mapSize.y/e)),defaultValue:true});return t.p2World.bodies.forEach(s=>{let o=b.getFromP2BodyIDOrFail(s.id);if(o.includeInPathfinding&&this.ƀig.canCollide(t,o.physicsBodyGroup,i)){let a=this.ƀeg(s,e);r.setArea(a,false);}}),r}ƀeg(t,e){let i=f.aabbToBoundingBox(t.aabb);return D.areaToGridArea(i,e)}};pt=Wo([u(),Uo("design:paramtypes",[X,Ue])],pt);var zo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Jo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},jt=class{static{h(this,"PathFinderService");}constructor(t){this.ƀif=t;}findPathAStar(t,e,i,r,s){s||(s={}),s.neighborType===void 0&&(s.neighborType="orthogonal"),s.gridCellSize===void 0&&(s.gridCellSize=50);let o=v.getInstanceByIDOrFail(t),a,l;Comparator.isNumber(i)?(l=b.getPhysicsInstanceOrFail(i).p2Body,a=f.arrayToVector(l.position)):a=i;let c=D.positionToGridPosition(e,s.gridCellSize),p=D.positionToGridPosition(a,s.gridCellSize),y=this.ƀif.getAvilabilityGrid(o,s.gridCellSize,r);if(l){let C=f.aabbToBoundingBox(l.aabb),Ct=D.areaToGridArea(C,s.gridCellSize);y.setArea(Ct,true);}let w=Zt.findPath(y,c,p,s.neighborType);return w.path=w.path.map(C=>D.gridPositionToPosition(C,s.gridCellSize)),w}findPathDirection(t,e,i,r,s=50){let o=v.getInstanceByIDOrFail(t),a;if(Comparator.isNumber(i)){let w=b.getPhysicsInstanceOrFail(i);a=f.aabbToBoundingBox(w.p2Body.aabb);}else a=new Rectangle(i,i);let l=D.areaToGridArea(a,s),c=JSON.stringify({targetGridArea:l,collidableWithGroup:r}),p=o.vectorFieldCache.get(c);if(!p){let w=this.ƀif.getAvilabilityGrid(o,s,r);p=new Qt(l,w),o.vectorFieldCache.set(c,p);}let y=D.positionToGridPosition(e,s);return p.getDirectionToTarget(y)}};jt=zo([u(),Jo("design:paramtypes",[pt])],jt);var Ko=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Xo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Q=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀaa=t,this.ƀhz=e;}printPathfindingTestGrid(t,e,i,r,s,o){let a=v.getInstanceByIDOrFail(t);this.ƀaa.getAvilabilityGrid(a,o,r).map((c,p)=>({position:D.gridPositionToPosition(p,o),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(s)){let p=this.ƀhz.findPathDirection(t,c.position,i,r),y;p===void 0?y=R.createRectangleBorders(new Vector(8,8),2,ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):y=R.createArrow(25,c.availability?ColorHelper.green:ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).setRotation(p).attach(a),new I(y,"alpha",{duration:1e3,animation:x.easeIn}).animate({alpha:0}).tap(()=>y.destroy()).attach(y);}});}createExplosionDebugVisual(t,e,i,r,s,o=300){let a=new d().displayParent(e).setAlpha(.5).attach(t);R.createCircle(s,ColorHelper.blue).toSprite().displayParent(a).setPosition(r,{round:false}).setAlpha(.5).attach(t),i.forEach(c=>{let p=c.hits.length>0?ColorHelper.red:ColorHelper.white;R.createVector(r,c.line.to,p).toSprite().displayParent(a).attach(t);}),new I(a,"alpha",{duration:o,animation:x.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,r,s,o,a=300){let l=new d().displayParent(e).setAlpha(.5).attach(t);R.createElipse(o,ColorHelper.blue).toSprite().displayParent(l).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attach(t),i.forEach(p=>{let y=p.hits.length>0?ColorHelper.red:ColorHelper.white;R.createVector(p.line.from,p.line.to,y).toSprite().displayParent(l).attach(t);}),new I(l,"alpha",{duration:a,animation:x.easeIn}).animate({alpha:0}).tap(()=>l.destroy()).attach(l);}createPhysicsEntityShapeVisual(t,e,i){let r=i?.overridePosition??f.arrayToVector(t.position),s=i?.overrideRotation??new Radian(t.angle),o=i?.color??ColorHelper.blue,a=new d().displayParent(e).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀcw(c,o).displayParent(a).attachToRoot();}),new I(a,"alpha",{duration:1e3,animation:x.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcw(t,e){switch(t.type){case W.Shape.PARTICLE:throw new Error("Not implemented");case W.Shape.LINE:throw new Error("Not implemented");case W.Shape.PLANE:throw new Error("Not implemented");case W.Shape.CIRCLE:throw new Error("Not implemented");case W.Shape.CAPSULE:throw new Error("Not implemented");case W.Shape.BOX:throw new Error("Not implemented");case W.Shape.HEIGHTFIELD:throw new Error("Not implemented");case W.Shape.CONVEX:return this.ƀcv(t,e);default:{t.type;throw new Error}}}ƀcv(t,e){let i=[t.vertices.map(r=>({x:r[0],y:r[1]}))];return R.createPolygon(i,e).toSprite()}};Q=Ko([u(),Xo("design:paramtypes",[pt,jt])],Q);var qo=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},tn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},$e=class{static{h(this,"HitTestService");}constructor(t){this.ƀle=t;}hitTest(t,e){let i=t.world,r=b.getFromP2BodyIDOrFail(t.id),s=f.cloneP2Body(t);this.ƀt(s,e);let o=i.broadphase.aabbQuery(i,this.ƀds(s)).map(l=>b.getFromP2BodyIDOrFail(l.id)).filter(l=>l.includeInPathfinding).filter(l=>r.canCollideWith(l)).map(l=>f.cloneP2Body(l.p2Body)),a=false;if(o.length!==0){let l=new W.World;l.addBody(s),o.forEach(c=>l.addBody(c)),l.step(1,1,1),a=l.narrowphase.contactEquations.some(c=>c.bodyA===s||c.bodyB===s),l.clear();}if(e?.testLayerID){let l=a?ColorHelper.red:ColorHelper.green;this.ƀle.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀt(t,e){e?.overridePosition&&(t.position=f.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀds(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};$e=qo([u(),tn("design:paramtypes",[Q])],$e);var rn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ke=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀje(t,i);});});}step(t,e,i){b.getPhysicsEntities().forEach(r=>{r.ƀbc=[];}),t.p2World.narrowphase.contactEquations.forEach(r=>{this.ƀje(t,r);}),t.bodiesInContactWith.forEach((r,s)=>{this.ƀfd(r.p2Body),r.entity.ƀjt(t.collisionReports.get(s)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀfd(t){let e=f.arrayToVector(t.velocity);e.length>Si&&(e=e.normalize(Si),t.velocity=f.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-Ei),Ei);}ƀje(t,e){let i=b.getFromP2BodyID(e.bodyA.id),r=b.getFromP2BodyID(e.bodyB.id);if(i&&r){t.bodiesInContactWith.set(e.bodyA.id,{p2Body:e.bodyA,entity:i}),t.bodiesInContactWith.set(e.bodyB.id,{p2Body:e.bodyB,entity:r});let s=t.collisionReports.get(e.bodyA.id)||[],o=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀdy(i,r,e);s.push({self:a,target:l}),o.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,s),t.collisionReports.set(e.bodyB.id,o);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀdy(t,e,i){let r=t.convertToDTO(),s=e.convertToDTO(),o=f.arrayToVector(i.contactPointA),a=f.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀen(i);return {collisionDetailsA:this.ƀdx(r,i.bodyA.mass,o,l,t.area),collisionDetailsB:this.ƀdx(s,i.bodyB.mass,a,c,e.area)}}ƀdx(t,e,i,r,s){let o,a=i.add(t.position);return {body:t,getPositionReletiveToObject:h(()=>(o||(o=i.rotate(t.rotation.multiply(-1).vector)),o),"getPositionReletiveToObject"),getPositionOnWorld:h(()=>(a||(a=i.add(t.position)),a),"getPositionOnWorld"),position:i,mass:e,area:s,normal:r}}ƀen(t){let e=f.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};ke=rn([u()],ke);var sn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},on=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},ze=class extends ce{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};ze=sn([gt(),on("design:paramtypes",[Number,Object])],ze);var nn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},j=1e4,Je=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbv(t,new Vector(e.x/2,-j/2),new Vector(e.x+j*2,j),i),this.ƀbv(t,new Vector(e.x/2,e.y+j/2),new Vector(e.x+j*2,j),i),this.ƀbv(t,new Vector(-j/2,e.y/2),new Vector(j,e.y+j*2),i),this.ƀbv(t,new Vector(e.x+j/2,e.y/2),new Vector(j,e.y+j*2),i);}ƀbv(t,e,i,r){return new ze(t,{shapeDefinition:{materialName:lt,group:r,shapeType:rt.Rectangle,shapeData:i},position:e,rotation:Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};Je=nn([u()],Je);var hn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},dr=new W.Material,ln={id:lt,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},Wt=class{static{h(this,"MaterialsService");}createMaterials(t,e,i,r){let s=new Map,o=new Map;if(i.forEach(a=>{s.set(a.id,new W.Material),o.set(a.id,a);}),s.has(lt))throw new Error(`Material with name ${lt} cannot be defined, pick another name for the material.`);return s.set(lt,dr),o.set(lt,ln),this.ƀc(t,e,i,r,s),{materials:s,materialDefinitions:o}}getMaterial(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀel(e,i.materials)}getMaterialDefinition(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀek(e,i.materialDefinitions)}ƀel(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀek(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material definition with name ${t}.`);return i}ƀc(t,e,i,r,s){this.ƀed(i.map(o=>o.id),r).forEach(o=>{let a=this.ƀel(o.materialA,s),l=this.ƀel(o.materialB,s);t.addContactMaterial(new W.ContactMaterial(a,l,{friction:o.friction,restitution:o.bounciness,stiffness:o.stiffness,relaxation:o.relaxation}));}),this.ƀd(t,e,i,s);}ƀed(t,e){let i=new Map;e.forEach(s=>{let o=i.get(s.materialA);o||(o=new Map,i.set(s.materialA,o)),o.set(s.materialB,s);});let r=[];return t.forEach((s,o)=>{for(let a=o;a<t.length;a++){let l=t[a],c=i.get(s)?.get(l);c?r.push(c):r.push({materialA:s,materialB:l,friction:0,bounciness:0,relaxation:4,stiffness:1e6});}}),r}ƀd(t,e,i,r){i.forEach(s=>{let o=this.ƀel(s.id,r);t.addContactMaterial(new W.ContactMaterial(o,dr,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};Wt=hn([u()],Wt);var cn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},pn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ut=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,r,s){this.ƀgw=t,this.ƀak=e,this.ƀaa=i,this.ƀbd=r,this.ƀig=s;}createPhysicsWorld(t){let e=new W.World({gravity:[0,0]}),{materials:i,materialDefinitions:r}=this.ƀgw.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:s,physicsBodyGroupToP2Mask:o}=this.ƀig.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new v(t.mapSize,t.modifyUpdateCycle,e,i,r,s,o).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&m.cleanUpdateModifier();}).attachToRoot(),this.ƀak.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀbd.registerPhysicsWorld(a),t.modifyUpdateCycle?m.registerUpdateModifier((l,c)=>this.ƀkw(a,l,c)):m.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀkw(a,l,c);}).attach(a),a.id}addBody(t,e,i,r,s){let o=v.getInstanceByIDOrFail(t);if(i){let a=this.ƀaa.findClosestAvailableSpace(o,e,r);return a?(e.position[0]+=a.x,e.position[1]+=a.y,o.p2World.addBody(e),s&&this.ƀaa.onBodyAdded(o,e,r),true):false}else return o.p2World.addBody(e),s&&this.ƀaa.onBodyAdded(o,e,r),true}removeBody(t,e){v.getInstanceByID(t)?.p2World.removeBody(e);}ƀkw(t,e,i){if(!t.paused.value){t.availabilityGridCache.clear(),t.vectorFieldCache.clear(),t.p2World.step(i,i,i),t.modifyUpdateCycle&&(i=t.p2World.time-t.lastP2Time.value);let r=e+i;this.ƀbd.step(t,r,i),t.onPhysicsStep.trigger({time:r,delta:i}),t.lastP2Time.value=t.p2World.time;}return i}setPaused(t,e){v.getInstanceByIDOrFail(e).paused.set(t);}};Ut=cn([u(),pn("design:paramtypes",[Wt,Je,pt,ke,X])],Ut);var dn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},kt=class{static{h(this,"RayCastingService");}castClosest(t,e,i){let r=new W.RaycastResult,s=new W.Ray({mode:W.Ray.CLOSEST,from:f.vectorToArray(e.from),to:f.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i)});if(t.p2World.raycast(r,s),r.hasHit())return this.ƀbq(r,e)}castAllFirstContacts(t,e,i){let r=new Map,s=new W.Ray({mode:W.Ray.ALL,from:f.vectorToArray(e.from),to:f.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i),callback:h(o=>{let a=r.get(o.body);!r.has(o.body)||o.fraction<a.fraction?r.set(o.body,this.ƀbq(o,e)):o.fraction===a.fraction&&a.isExternal()&&r.set(o.body,this.ƀbq(o,e));},"callback")});return t.p2World.raycast(new W.RaycastResult,s),Array.from(r.values())}ƀbq(t,e){let i=t.fraction,r=f.arrayToVector(t.normal),s,o,a;return {body:t.body,hitPosition:h(()=>(s===void 0&&(s=e.from.lerp(e.to,i)),s),"hitPosition"),hitDistance:h(()=>(o===void 0&&(o=e.length*i),o),"hitDistance"),isExternal:h(()=>(a===void 0&&(a=e.fromTo.dotProduct(r)<0),a),"isExternal"),normal:r,fraction:i,line:e}}};kt=dn([u()],kt);var fn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ft=class{static{h(this,"ImpactService");}applyImpulse(t,e,i,r){let s=i.normalize(r),o=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(f.vectorToArray(s),o);}};ft=fn([u()],ft);var mn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},zt=class{static{h(this,"RayCastHitConverterService");}toExplosionHits(t,e=true){let i=new Map;return t.forEach(r=>{r.hits.forEach(s=>{let o=i.get(s.body);if(o){let a=s.fraction<o.closestRaycastHit.fraction?s:o.closestRaycastHit;o.rayCastHits.push(s),i.set(s.body,{hitCount:o.hitCount+1,closestRaycastHit:a,rayCastHits:o.rayCastHits,isExternal:e?o.isExternal:o.isExternal&&s.isExternal(),explosionCenter:s.line.from});}else {let a=s.isExternal();i.set(s.body,{hitCount:1,closestRaycastHit:s,rayCastHits:[s],isExternal:a,explosionCenter:s.line.from});}});}),[...i.values()].map(r=>this.ƀbr(r,t.length))}ƀbr(t,e){let i=t.hitCount/e,r=t.rayCastHits;if(t.isExternal)return {body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:true,normal:t.closestRaycastHit.normal,fraction:t.closestRaycastHit.fraction,ratioOfHits:i,raycastResults:r,getHitPosition:t.closestRaycastHit.hitPosition,getHitDistance:t.closestRaycastHit.hitDistance};{let s=f.arrayToVector(t.closestRaycastHit.body.position);return {body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:false,normal:Vector.fromTo(s,t.explosionCenter).normalize(),fraction:0,ratioOfHits:i,raycastResults:r,getHitPosition:h(()=>t.explosionCenter,"getHitPosition"),getHitDistance:h(()=>0,"getHitDistance")}}}};zt=mn([u()],zt);var gn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},wn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},bn=15,Ke=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,r){this.ƀja=t,this.ƀle=e,this.ƀiz=i,this.ƀfq=r;}createElipticExplosion(t,e,i,r,s,o,a){let l=v.getInstanceByIDOrFail(t),c=this.ƀcg(e,i,r,s,a?.hitOnlyClosest===true,l),p=this.ƀiz.toExplosionHits(c,false);return this.ƀr(p,o),a?.testLayerID&&this.ƀle.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,r,a.debugRayDuration),p.map(y=>{let{p2Body:w,...C}=y;return C})}ƀcg(t,e,i,r,s,o){let a=[],l=e.vector,c=e.add(Radian.get90).vector,p=c.normalize(i.x);a.push(new Line(t,t.add(p))),a.push(new Line(t,t.add(p.multiplyNumber(-1))));let y=l.normalize(i.y);a.push(new Line(t,t.add(y))),a.push(new Line(t,t.add(y.multiplyNumber(-1))));let w=Math.round(i.y/bn),C=i.y/(w*2+1)*2,Ct=l.normalize(C),pe=i.x,mr=Math.pow(i.y,2);return ArrayHelper.createIntegerArray(w).forEach(yt=>{let At=C*(yt+1),Ai=Ct.multiplyNumber(yt+1),ue=c.normalize(this.ƀev(pe,mr,At)),de=t.add(Ai);a.push(new Line(de,de.add(ue))),a.push(new Line(de,de.add(ue.multiplyNumber(-1))));let fe=t.add(Ai.multiplyNumber(-1));a.push(new Line(fe,fe.add(ue))),a.push(new Line(fe,fe.add(ue.multiplyNumber(-1))));}),a.map(yt=>{if(s){let At=this.ƀja.castClosest(o,yt,r);return {line:yt,hits:At?[At]:[]}}else {let At=this.ƀja.castAllFirstContacts(o,yt,r);return {line:yt,hits:At}}})}ƀev(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀr(t,e){t.forEach(i=>{i.raycastResults.forEach(r=>{let s,o;r.isExternal()?(s=r.line.fromTo,o=e*2):(s=r.line.fromTo.multiplyNumber(-1),o=e*(1-r.fraction)*8),this.ƀfq.applyImpulse(r.body,r.hitPosition(),s,o);});});}};Ke=gn([u(),wn("design:paramtypes",[kt,Q,zt,ft])],Ke);var Pn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Sn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Xe=class{static{h(this,"ExplosionService");}constructor(t,e,i,r){this.ƀja=t,this.ƀle=e,this.ƀiz=i,this.ƀfq=r;}createExplosion(t,e,i,r,s,o){let a=v.getInstanceByIDOrFail(t),l=this.ƀet(i),c=this.ƀcg(e,i,r,l,o?.hitOnlyClosest===true,a),p=this.ƀiz.toExplosionHits(c);return this.ƀr(e,i,s,l,p),o?.testLayerID&&this.ƀle.createExplosionDebugVisual(a,o.testLayerID,c,e,i,o.debugRayDuration),p}ƀcg(t,e,i,r,s,o){let a=new Radian(PI_360/r),l=new Vector(0,-e),c=a.vector;return ArrayHelper.createEmptyArray(r).map(()=>{let p=t.add(l);return l=l.rotate(c),new Line(t,p)}).map(p=>{if(s){let y=this.ƀja.castClosest(o,p,i);return {line:p,hits:y?[y]:[]}}else {let y=this.ƀja.castAllFirstContacts(o,p,i);return {line:p,hits:y}}})}ƀr(t,e,i,r,s){s.forEach(o=>{if(o.isExternal)o.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀfq.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=Vector.fromTo(t,f.arrayToVector(o.p2Body.position)),l=a.length/e,c=i*r*l/2;this.ƀfq.applyImpulse(o.p2Body,o.getHitPosition(),a,c);}});}ƀet(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};Xe=Pn([u(),Sn("design:paramtypes",[kt,Q,zt,ft])],Xe);var Cn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Jt=class{static{h(this,"PhysicsQueryService");}getMapSize(t){let e=v.getInstanceByIDOrFail(t);return {dimentions:e.mapSize,center:e.mapSizeCenter}}subscribeToPhysicsStep(t,e){return v.getInstanceByIDOrFail(t).onPhysicsStep.subscribe(e)}};Jt=Cn([u()],Jt);var An=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},On=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ii=class{static{h(this,"PhysicsController");}constructor(t,e,i,r,s,o,a,l){this.ƀin=t,this.ƀhz=e,this.ƀle=i,this.ƀdh=r,this.ƀda=s,this.ƀfi=o,this.ƀim=a,this.ƀfq=l;}createPhysicsWorld(t){return this.ƀin.createPhysicsWorld(t)}getMapSize(t){return this.ƀim.getMapSize(t)}setPaused(t,e){this.ƀin.setPaused(t,e);}hitTest(t,e){let i=b.getPhysicsInstanceOrFail(t);return this.ƀfi.hitTest(i.p2Body,e)}findPath(t,e,i,r,s){return this.ƀhz.findPathAStar(t,e,i,r,{neighborType:s})}findPathDirection(t,e,i,r){return this.ƀhz.findPathDirection(t,e,i,r)}applyImpulse(t,e,i,r){let s=b.getPhysicsInstanceOrFail(t);this.ƀfq.applyImpulse(s.p2Body,e,i,r);}createExplosion(t,e,i,r,s,o){return this.ƀdh.createExplosion(t,e,i,r,s,o)}createElipticExplosion(t,e,i,r,s,o,a){return this.ƀda.createElipticExplosion(t,e,i,r,s,o,a)}printPathfindingTestGrid(t,e,i,r,s,o=50){this.ƀle.printPathfindingTestGrid(t,e,i,r,s,o);}};Ii=An([tt(le),On("design:paramtypes",[Ut,jt,Q,Xe,Ke,$e,Jt,ft])],Ii);var Mn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ze=class{static{h(this,"ShapeCreationService");}createBody(t,e,i,r,s){let o=v.getInstanceByIDOrFail(t);if(!o.physicsBodyGroupToP2Group.has(e.shapeDefinition.group))throw new Error(`Physics body group "${e.shapeDefinition.group}" not found`);switch(e.shapeDefinition.shapeType){case rt.Point:return this.ƀbx(o,void 0,i,r,e.shapeDefinition.group,s);case rt.Circle:return this.ƀbx(o,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case rt.Polygon:return this.ƀcf(o,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case rt.Rectangle:return this.ƀch(o,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);default:{e.shapeDefinition.shapeType;throw new Error}}}ƀbx(t,e,i,r,s,o){let a=new W.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s),radius:e});a.material=i;let l=new W.Body({type:o==="dynamic"?W.Body.DYNAMIC:W.Body.STATIC,mass:r.density,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return l.addShape(a),l}ƀcf(t,e,i,r,s,o){let a=t.physicsBodyGroupToP2Group.get(s),l=t.physicsBodyGroupToP2Mask.get(s),c=e.map(w=>new W.Convex({vertices:w.map(C=>[C.x,C.y]),collisionGroup:a,collisionMask:l})).map(w=>(w.material=i,w)),p=c.reduce((w,C)=>w+C.area,0),y=new W.Body({type:o==="dynamic"?W.Body.DYNAMIC:W.Body.STATIC,mass:p,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.forEach(w=>y.addShape(w)),y.setDensity(r.density),y}ƀch(t,e,i,r,s,o){let a=new W.Box({width:e.x,height:e.y,collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s)});a.material=i;let l=e.x*e.y,c=new W.Body({type:o==="dynamic"?W.Body.DYNAMIC:W.Body.STATIC,mass:l,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.addShape(a),c.setDensity(r.density),c}};Ze=Mn([u()],Ze);var Dn=function(n,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Bn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ci=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,r,s){this.ƀin=t,this.ƀil=e,this.ƀkd=i,this.ƀim=r,this.ƀig=s;}createBody(t,e,i,r,s){return this.ƀkd.createBody(t,e,i,r,s)}getMaterial(t,e){return this.ƀil.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀil.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀig.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀig.getMaskConstant(t,e)}addBody(t,e,i,r,s){return this.ƀin.addBody(t,e,i,r,s)}removeBody(t,e){this.ƀin.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀim.subscribeToPhysicsStep(t,e)}};Ci=Dn([tt(ct),Bn("design:paramtypes",[Ut,Wt,Ze,Jt,X])],Ci);export{ht as AdvancedSound,Di as AnimationFlicker,V as AnimationInterpolationFunctions,x as Animations,T as AnimationsCompletionHandlingType,I as Animator,lt as BORDER_MATERIAL_NAME,E as BardLegendsHardReset,qt as Camera,nt as CameraGateway,Xt as ClosestAvailableSpaceHelper,d as Container,Dt as ContainerEventType,tt as ControllerDecorator,ti as Cursor,N as DEFAULT_SHADER_RESOLUTION,oi as DeltaTime,ui as DisplayObjectArray,$ as Entity,gt as EntityDecorator,Hi as FadeInContent,at as FocusingAnimation,g as Game,q as Gateway,R as Graphics,ce as ImmovablePhysicsEntity,bi as KeyboardService,fi as MenuEntity,oe as MenuUI,mi as MenuView,he as MouseService,Pi as MouseTargetFocusService,Ti as MovableEntity,Ri as MovablePhysicsEntity,ee as Music,hi as MusicPlayer,Zt as PathFinder,b as PhysicsEntity,le as PhysicsGateway,rt as PhysicsShapeType,li as Placeholder,Ei as ROTATIONAL_SPEED_LIMIT,A as ReAnimateHandlingType,ci as RichText,K as SOUND_TRANSITION_DURATION,Si as SPEED_LIMIT,Ot as Scene,Cr as SceneDecorator,yi as ScrollAreaUI,et as ScrollDirection,Pt as ScrollMaskUI,P as Service,u as ServiceDecorator,wt as SingletonEntity,zi as SlideInContent,si as SlideInContentByIndex,Re as SlideStateAnimation,it as SlideStateAnimationState,te as Sound,J as Sprite,Gt as StateAnimation,se as Text,ve as ThroughEmptyStateAnimation,pi as UpdatableContainer,m as UpdateCycle,Qt as VectorFieldPathFinder,Et as VectorSet,U as View,qe as ViewDecorator};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bard-legends-framework",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
4
4
  "description": "Bard Legends Framework",
5
5
  "main": "dist/index.js",
6
6
  "publishConfig": {