bard-legends-framework 1.4.2 → 1.4.3
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.d.mts +0 -5
- package/dist/index.d.ts +0 -5
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -792,19 +792,14 @@ declare class KeyboardService {
|
|
|
792
792
|
}
|
|
793
793
|
|
|
794
794
|
declare class MouseService {
|
|
795
|
-
readonly _initialMouseMovementHappened: Variable<boolean>;
|
|
796
795
|
readonly onInitialMouseMove: actions_lib.Notifier<boolean>;
|
|
797
796
|
get initialMouseMoveHappened(): boolean;
|
|
798
|
-
readonly _stagePosition: Variable<Vector>;
|
|
799
797
|
readonly stagePosition: actions_lib.Notifier<Vector>;
|
|
800
798
|
getStagePosition(): Vector;
|
|
801
|
-
readonly _screenPosition: Variable<Vector>;
|
|
802
799
|
readonly screenPosition: actions_lib.Notifier<Vector>;
|
|
803
800
|
getScreenPosition(): Vector;
|
|
804
|
-
readonly _mainButtonState: Variable<boolean>;
|
|
805
801
|
readonly mainButtonState: actions_lib.Notifier<boolean>;
|
|
806
802
|
getMainButtonState(): boolean;
|
|
807
|
-
readonly _secondaryButtonState: Variable<boolean>;
|
|
808
803
|
readonly secondaryButtonState: actions_lib.Notifier<boolean>;
|
|
809
804
|
getSecondaryButtonState(): boolean;
|
|
810
805
|
constructor();
|
package/dist/index.d.ts
CHANGED
|
@@ -792,19 +792,14 @@ declare class KeyboardService {
|
|
|
792
792
|
}
|
|
793
793
|
|
|
794
794
|
declare class MouseService {
|
|
795
|
-
readonly _initialMouseMovementHappened: Variable<boolean>;
|
|
796
795
|
readonly onInitialMouseMove: actions_lib.Notifier<boolean>;
|
|
797
796
|
get initialMouseMoveHappened(): boolean;
|
|
798
|
-
readonly _stagePosition: Variable<Vector>;
|
|
799
797
|
readonly stagePosition: actions_lib.Notifier<Vector>;
|
|
800
798
|
getStagePosition(): Vector;
|
|
801
|
-
readonly _screenPosition: Variable<Vector>;
|
|
802
799
|
readonly screenPosition: actions_lib.Notifier<Vector>;
|
|
803
800
|
getScreenPosition(): Vector;
|
|
804
|
-
readonly _mainButtonState: Variable<boolean>;
|
|
805
801
|
readonly mainButtonState: actions_lib.Notifier<boolean>;
|
|
806
802
|
getMainButtonState(): boolean;
|
|
807
|
-
readonly _secondaryButtonState: Variable<boolean>;
|
|
808
803
|
readonly secondaryButtonState: actions_lib.Notifier<boolean>;
|
|
809
804
|
getSecondaryButtonState(): boolean;
|
|
810
805
|
constructor();
|
package/dist/index.js
CHANGED
|
@@ -64,4 +64,4 @@
|
|
|
64
64
|
highestAlpha = centerColor.a;`,e+=`
|
|
65
65
|
|
|
66
66
|
gl_FragColor = vec4(color, 1.0) * highestAlpha;
|
|
67
|
-
}`,e}constructor(t,e){if(super(o.ƀei(),o.ƀdr(t*O)),this.ƀcy=t,this.resolution=O,this.ƀcy=t*O,this.ƀcy<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀcy>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");helpersLib.Comparator.isInteger(this.ƀcy)||(this.ƀcy=Math.floor(this.ƀcy));let i=helpersLib.ColorHelper.normalize(e);this.uniforms.color=new Float32Array([i.red,i.green,i.blue]),this.uniforms.expandSquared=this.ƀcy*this.ƀcy,this.padding=this.ƀcy;}apply(t,e,i,r){this.uniforms.pixelSize=new Float32Array([1/(e.width*O),1/(e.height*O)]),t.applyFilter(this,e,i,r);}};var Pe=class extends L__namespace.Filter{static{h(this,"GlowFilter");}constructor(t){super(),this.resolution=O;let e={blurRadius:1,expand:0,color:helpersLib.ColorHelper.white,blendMode:exports.BlendMode.Screen,...t};this.ƀcz=new be(e.expand,e.color);let i=helpersLib.Comparator.isNumber(e.blurRadius)?new helpersLib.Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀag=new Tt(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀag.blendMode=L__namespace.BLEND_MODES.SCREEN;}apply(t,e,i,r){let s=t.getFilterTexture();this.ƀcz.apply(t,e,s,L__namespace.CLEAR_MODES.CLEAR),this.ƀag.apply(t,s,i,r),t.returnFilterTexture(s);}};var kt=class o{static{h(this,"GlowSpriteGenerator");}static{this.ƀel=new Map;}static createGlowSpriteFromSprite(t,e,i){let r=this.ƀbc(e),s=helpersLib.Comparator.isNumber(r.blurRadius)?new helpersLib.Vector(r.blurRadius,r.blurRadius):r.blurRadius,n=this.ƀdt(t.texture,s,r.expand,r.color,i),a=new L__namespace.Sprite(n);return this.ƀiy(a,helpersLib.Vector.fromVec2(t.anchor),Math.max(s.x,s.y)+r.expand),a.alpha=r.glowAlpha,a.blendMode=r.blendMode,a}static ƀdt(t,e,i,r,s){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(s){let n=`${t.id}-${i}-${e.x}-${e.y}-${r.r}-${r.g}-${r.b}`;if(o.ƀel.has(n))return o.ƀel.get(n);{let a=this.ƀdu(t,e,i,r);return o.ƀel.set(n,a),a}}else return this.ƀdu(t,e,i,r)}static ƀdu(t,e,i,r){let s=new L__namespace.Sprite(t);this.ƀdb(s,Math.max(e.x,e.y)+i),s.filters=[new Pe({blurRadius:e,expand:i,color:r})];let n=x.instance.renderer.generateTexture(s);return n.id=M.insertAsset(n),s.destroy(),n}static ƀiy(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 ƀdb(t,e){if(t.isSprite){let s=new L__namespace.Graphics;t.addChild(s);}let i=t.width,r=t.height;t.calculateBounds=function(){this._bounds.clear(),this._bounds.addFrame(this.transform,-e,-e,i+e,r+e);};}static ƀbc(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:helpersLib.ColorHelper.white,blendMode:exports.BlendMode.Add};return t&&(e={...e,...t}),e}};F.onHardReset.subscribe(()=>{kt.ƀel.clear();}).attachToRoot();var Y=class o extends u{static{h(this,"Sprite");}static createByName(t){let e=x.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new o(e)}static createSnapshotSprite(t){let e=t.ƀhs,i=e.parent;i&&i.removeChild(e);let r=x.instance.renderer.generateTexture(e,{resolution:2,scaleMode:L__namespace.SCALE_MODES.LINEAR,multisample:L__namespace.MSAA_QUALITY.HIGH});i&&i.addChild(e);let n={id:M.insertAsset(r),scale:t.scale,size:t.size,anchor:helpersLib.Vector.zero,destroyAssetOnDestroy:true};return new o(n,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀjy=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀjh=t,this.pixiSprite=new L__namespace.Sprite(M.getAsset(t.id)),this.ƀhs.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.ƀge?.destroy(),this.ƀai?.destroy(),this.ƀjh.destroyAssetOnDestroy&&(M.destroyAsset(this.ƀjh.id),this.ƀht&&M.destroyAsset(this.ƀht.texture.id)),this.ƀht&&!this.ƀht.destroyed&&this.ƀht.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀjy}set textureScale(t){this.ƀjy=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.ƀjh.boundingShapes&&!this.ƀhs.hitArea&&(this.ƀhs.hitArea=new me(this.ƀjh.boundingShapes,this.size,helpersLib.Vector.fromVec2(this.ƀjh.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.baseTexture.mipmap===L__namespace.MIPMAP_MODES.ON}set mipmap(t){t?this.pixiSprite.texture.baseTexture.mipmap=L__namespace.MIPMAP_MODES.ON:this.pixiSprite.texture.baseTexture.mipmap=L__namespace.MIPMAP_MODES.OFF;}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 L__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.ƀht)return this.ƀht.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀht)this.ƀht.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=helpersLib.Vector.fromVec2(this.ƀjh.anchor).to(t);return new helpersLib.Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀht&&(this.ƀht.destroy(),this.ƀht=void 0),t&&(this.ƀht=kt.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀjh.destroyAssetOnDestroy),this.ƀht.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀht.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀhs.addChild(this.ƀht)),this}showBoundingShape(t){return t?this.ƀai||(this.ƀai=this.ƀbs().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀai&&(this.ƀai.destroy(),this.ƀai=void 0),this}getBoundingMask(){if(!this.ƀge){if(!this.ƀjh.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀge=this.ƀbs(),this.ƀge.pixiSprite._maskRefCount=Number.POSITIVE_INFINITY,this.ƀge.pixiSprite.renderable=false,this.ƀge.displayParent(this);}return this.ƀge}ƀbs(){if(!this.ƀjh.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return E.createPolygon(this.ƀjh.boundingShapes,helpersLib.ColorHelper.white).toSprite().attach(this)}download(){let t=x.instance.renderer.extract.canvas(this.ƀhs);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}};var Qe=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},yt=class o extends u{static{h(this,"ScrollMaskUI");}static{this.ƀcr=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 u;r===exports.ScrollDirection.Horizontal?this.ƀby(e,i,s):this.ƀcf(e,i,s),this.ƀge=Y.createSnapshotSprite(s).attach(this),s.destroy(),t.setMask(this.ƀge);}ƀcf(t,e,i){e>0&&this.ƀbv(new helpersLib.Vector(t.x,e)).displayParent(i).attach(i),E.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.ƀbv(new helpersLib.Vector(t.x,e)).setPosition(new helpersLib.Vector(t.x,t.y),{round:false}).setRotation(helpersLib.Radian.get180).displayParent(i).attach(i);}ƀby(t,e,i){e>0&&this.ƀbv(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(0,t.y),{round:false}).setRotation(helpersLib.Radian.get270).displayParent(i).attach(i),E.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.ƀbv(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(t.x,0),{round:false}).setRotation(helpersLib.Radian.get90).displayParent(i).attach(i);}ƀbv(t){let i={id:this.ƀbw(t.y),scale:1,size:t,anchor:{x:0,y:0}};return new Y(i,{textureSize:t,ignoreAnchor:true})}ƀbw(t){let e=JSON.stringify({type:"gradient",length:t}),i=o.ƀcr.get(e);if(!i){let r=document.createElement("canvas");r.width=1,r.height=t;let s=r.getContext("2d");if(s){let n=new Qe;helpersLib.ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${n.multiplierFunction(l/t)})`;s.fillStyle=c,s.fillRect(0,l,1,1);});let a=L__namespace.Texture.from(r);i=M.insertAsset(a),o.ƀcr.set(e,i);}else throw new Error("Canvas context is null")}return i}};exports.SlideStateAnimationState=void 0;(function(o){o[o.Appear=1]="Appear",o[o.Disappear=2]="Disappear";})(exports.SlideStateAnimationState||(exports.SlideStateAnimationState={}));var S;(function(o){o[o.Idle=1]="Idle",o[o.TransitionForward=2]="TransitionForward",o[o.TransitionBackward=3]="TransitionBackward",o[o.Reverting=4]="Reverting";})(S||(S={}));var Se=class extends actionsLib.Attachable{static{h(this,"SlideStateAnimation");}constructor(t){super(),this.ƀn=S.Idle,this.ƀgw=new actionsLib.Action,this.ƀgy=new actionsLib.Action,this.ƀhb={duration:500,animation:P.easeInOutCubic,...t},this.ƀjn=new we({duration:this.ƀhb.duration,animation:this.ƀhb.animation}).onStateChange((e,i)=>this.ƀeq(e,i)).onValueChange(e=>this.ƀer(e)).attach(this);}setIndex(t,e){if(!helpersLib.Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀff===void 0?(this.ƀff=t,this.ƀgw.trigger({state:exports.SlideStateAnimationState.Appear,index:t}),this.ƀjn.setState(t,e)):this.ƀff!==t?this.ƀgn!==t?this.ƀn===S.Idle?(this.ƀn=t>this.ƀff?S.TransitionForward:S.TransitionBackward,this.ƀgn=t,this.ƀgw.trigger({state:exports.SlideStateAnimationState.Appear,index:this.ƀgn}),this.ƀjn.setState(t,e)):this.ƀjn.setState(t,e):this.ƀn===S.Reverting&&this.ƀgn===t&&(this.ƀn=t>this.ƀff?S.TransitionForward:S.TransitionBackward,this.ƀjn.setState(t,e)):(this.ƀn===S.TransitionForward||this.ƀn===S.TransitionBackward)&&(this.ƀn=S.Reverting,this.ƀjn.setState(t,e));}ƀeq(t,e){switch(this.ƀff!==void 0&&this.ƀff!==t&&this.ƀff!==e&&this.ƀgw.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀff}),this.ƀgn!==void 0&&this.ƀgn!==t&&this.ƀgn!==e&&this.ƀgw.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀgn}),e!==void 0&&e!==this.ƀff&&e!==this.ƀgn&&this.ƀgw.trigger({state:exports.SlideStateAnimationState.Appear,index:e}),this.ƀn){case S.Idle:break;case S.TransitionForward:case S.TransitionBackward:e===void 0?(this.ƀn=S.Idle,this.ƀff=this.ƀgn,this.ƀgn=void 0):this.ƀff!==t&&this.ƀeo(t,e);break;case S.Reverting:e===void 0?(this.ƀn=S.Idle,this.ƀgn=void 0):this.ƀff!==e&&this.ƀeo(t,e);break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}ƀer(t){let e=1;(this.ƀn===S.TransitionBackward||this.ƀn===S.Reverting&&this.ƀff!==void 0&&this.ƀgn!==void 0&&this.ƀff>this.ƀgn)&&(e=-1),(this.ƀn===S.Idle||t!==0)&&this.ƀgy.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(-e*t),index:this.ƀff}),this.ƀgn!==void 0&&this.ƀgy.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀgn});}ƀeo(t,e){this.ƀff=t,this.ƀgn=e,this.ƀgy.trigger({value:0,index:this.ƀff}),this.ƀn=this.ƀff<this.ƀgn?S.TransitionForward:S.TransitionBackward;}onStateChange(t){return this.ƀgw.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀgy.subscribe(e=>t(e.value,e.index)).attach(this),this}};exports.ScrollDirection=void 0;(function(o){o[o.Horizontal=1]="Horizontal",o[o.Vertical=2]="Vertical";})(exports.ScrollDirection||(exports.ScrollDirection={}));var qe=class extends u{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀbu=t,this.ƀcm="x",this.ƀbj=new Map,this.ƀhb={duration:300,animation:P.easeInOutCubic,size:new helpersLib.Vector(500,500),margin:20,direction:exports.ScrollDirection.Horizontal,...e};let i=this.ƀhb.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(this.ƀhb.size.x+this.ƀhb.margin*2,this.ƀhb.size.y):new helpersLib.Vector(this.ƀhb.size.x,this.ƀhb.size.y+this.ƀhb.margin*2),r=new u().setPosition(this.ƀhb.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(-this.ƀhb.margin,0):new helpersLib.Vector(0,-this.ƀhb.margin),{round:false}).displayParent(this).attach(this);this.ƀbz(i,this.ƀhb.margin,this.ƀhb.direction,r),this.ƀcm=this.ƀhb.direction===exports.ScrollDirection.Horizontal?"x":"y",this.ƀjn=new Se({duration:this.ƀhb.duration,animation:this.ƀhb.animation}).onStateChange((s,n)=>{if(s===exports.SlideStateAnimationState.Appear){let a=new u().displayParent(this).attach(this);this.ƀbj.set(n,a),this.ƀbu({index:n,container:a});}else {let a=this.ƀbj.get(n);a&&(a.destroy(),this.ƀbj.delete(n));}}).onValueChange((s,n)=>{let a=this.ƀbj.get(n);if(a){let l={x:0,y:0};l[this.ƀcm]=i[this.ƀcm]*s+this.ƀhb.margin,a.setPosition(helpersLib.Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=r;}setIndex(t,e){return this.ƀjn.setIndex(t,e),this}ƀbz(t,e,i,r){new yt(r,new helpersLib.Vector(t.x,t.y),e,i).attach(this);}},Hi=class extends qe{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 xt=class{static{h(this,"VectorSet");}constructor(){this.ƀkk=new Map;}add(t){let e=this.ƀkk.get(t.x);e||(e=new Set,this.ƀkk.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀkk.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀkk.get(t.x);return e?e.delete(t.y):false}};var ti=class{static{h(this,"DeltaTime");}static adjustMultiplier(t,e){return Math.pow(t,e)}};var B=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 Jt=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=B.areaToGridArea(e,i);if(this.ƀar(t,s))return helpersLib.Vector.zero;let n=t.movePositionInsideGrid(s.topLeft),a=helpersLib.Vector.fromTo(s.topLeft,n),l=this.find(t,n,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 xt,s=new helpersLib.Queue(e);for(;s.notEmpty;){let n=s.pop();r.add(n);let a=new helpersLib.Rectangle(n,n.add(i));if(this.ƀar(t,a))return helpersLib.Vector.fromTo(e,n);t.getNeighborPositions(n,helpersLib.GridNeighborType.Ortogonal).forEach(l=>{r.has(l)||s.add(l);});}}static ƀar(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 Wi=class{static{h(this,"PathfinderNode");}constructor(t,e,i,r=void 0){this.position=t,this.distanceFromStart=e,this.distanceToEnd=i,this.parent=r,this.closed=false;}get pathLength(){return this.distanceFromStart+this.distanceToEnd}isEqual(t){return helpersLib.Vector.isEqual(this.position,t)}createSolutionPath(t){let e=[this.position],i=this.parent;for(;i!==void 0;)e.push(i.position),i=i.parent;return e.reverse(),{directPathAvailable:t,path:e}}getDistance(t){return this.position.getDistance(t)}},cs=class{static{h(this,"PathfinderGrid");}constructor(t,e){this.ƀen=t,this.ƀjk=e,this.ƀha=new helpersLib.BinaryHeap("min"),this.ƀav=[],this.ƀgp=new helpersLib.Grid({size:t.size,defaultValue:void 0});let i=new Wi(this.ƀjk,0,Number.MAX_SAFE_INTEGER);this.ƀha.add(i.pathLength,i);}get hasOpenNodes(){return this.ƀha.size>0}getNeighbors(t,e){return this.ƀen.getNeighborPositions(t.position,e).filter(i=>this.ƀen.get(i)).map(i=>this.ƀgp.get(i)||this.ƀca(i))}popLowestPathCostNode(){let t=this.ƀha.pop();return this.ƀha.delete(t),t.closed=true,this.ƀav.push(t),t}changeNodeCost(t,e,i,r){this.ƀha.delete(t),t.distanceFromStart=e,t.distanceToEnd=t.getDistance(i),t.parent=r,this.ƀha.add(t.pathLength,t);}getBestClosedNode(){return this.ƀav.reduce((t,e)=>t.distanceToEnd<e.distanceToEnd?t:e)}ƀca(t){let e=new Wi(t,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);return this.ƀgp.set(t,e),this.ƀha.add(e.pathLength,e),e}},Yt=class{static{h(this,"PathFinder");}static findPath(t,e,i,r){let s=new cs(t,e);for(;s.hasOpenNodes;){let n=s.popLowestPathCostNode();if(n.isEqual(i))return n.createSolutionPath(true);let a=s.getNeighbors(n,r);for(let l of a)if(!l.closed){let c=n.distanceFromStart+n.getDistance(l.position);c<l.distanceFromStart&&s.changeNodeCost(l,c,i,n);}}return s.getBestClosedNode().createSolutionPath(false)}};var Xt=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀjs=t,this.ƀw=e,this.ƀet=this.ƀdw(this.ƀw.size),this.ƀks=new helpersLib.Grid({size:this.ƀw.size,defaultValue:this.ƀet}),this.ƀcn=new helpersLib.Grid({size:this.ƀw.size,defaultValue:void 0});let i=new xt,r=new helpersLib.Queue;for(this.ƀdk(this.ƀw.cropAreaOutsideOfTheGrid(t)).forEach(n=>{this.ƀks.set(n,0),r.add(n);});r.notEmpty;){let n=r.pop();if(!i.has(n)){i.add(n);let a=this.ƀks.getOrFail(n);this.ƀeb(n,this.ƀw).forEach(l=>{if(!i.has(l.position)){let c=this.ƀks.getOrFail(l.position),p=a+l.distance;this.ƀw.getOrFail(l.position)&&p<c&&(this.ƀks.set(l.position,p),r.add(l.position));}});}}}getDirectionToTarget(t){if(!t.isInsideRectangle(this.ƀjs)){if(t=this.ƀks.movePositionInsideGrid(t),this.ƀcn.has(t))return this.ƀcn.get(t);{let e=this.ƀeb(t,this.ƀw),i;return this.ƀks.getOrFail(t)>=this.ƀet?e.some(s=>this.ƀw.get(s.position))&&(e.some(n=>!this.ƀw.get(n.position))?i=this.ƀdq(e):i=this.ƀdl(t,e)):i=this.ƀdl(t,e),this.ƀcn.set(t,i),i}}}ƀdq(t){let e=t.filter(i=>this.ƀw.get(i.position)).map(i=>i.direction.radian);return helpersLib.Radian.getAverage(...e)}ƀdl(t,e){let i=e.filter(r=>this.ƀks.getOrFail(r.position)<this.ƀet).reduce((r,s)=>{let n=this.ƀks.getOrFail(s.position)+s.distance;return n<r.bestWeight?(r.bestDirections=[s.direction],r.bestWeight=n):n===r.bestWeight&&r.bestDirections.push(s.direction),r},{bestDirections:[],bestWeight:this.ƀet}).bestDirections;return this.ƀeg(i,t)}ƀeg(t,e){if(t.length>0){let i=t.reduce((r,s)=>r.add(s),helpersLib.Vector.zero);if(i.isZero()||!this.ƀfl(e,i))return helpersLib.Random.pickRandomElement(t).radian;if(t.length>=1)return i.radian}}ƀfl(t,e){let i=t.add(this.ƀkl(e));return this.ƀw.isPointWithinBounds(i)&&this.ƀw.getOrFail(i)}ƀeb(t,e){return this.ƀks.getNeighborDirections(t,helpersLib.GridNeighborType.All).map(i=>({position:t.add(i),direction:i,distance:i.x!==0&&i.y!==0?14:10}))}ƀdk(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}ƀkl(t){let e=t.normalize().round();return new helpersLib.Vector(e.x,e.y)}ƀdw(t){return (t.x+t.y)*20}};var ms=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},V=class extends ft{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);}};V=ms([ut()],V);var gs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ys=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},It=class extends dt{static{h(this,"CameraView");}constructor(t){super(),this.ƀcw=t,this.ƀim=new u().setAlpha(0).displayParent(x.instance.stage).attach(this),this.ƀac=E.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(x.instance.stage).attach(this),this.ƀaa=new u().displayParent(this.ƀim).attach(this),this.ƀao=new u().displayParent(this.ƀim).attach(this),this.ƀdg=new u().setSortableChildren(true).displayParent(this.ƀim).attach(this),this.ƀan=new u().setSortableChildren(true).displayParent(this.ƀao).attach(this),this.ƀdf=new u().setSortableChildren(true).setZIndex(20).displayParent(this.ƀan).attach(this),this.ƀgc=new u().setSortableChildren(true).setZIndex(10).displayParent(this.ƀan).attach(this),this.ƀz=new u().setZIndex(0).displayParent(this.ƀan).attach(this),this.ƀh=new D(this.ƀim,"alpha",{duration:500,animation:P.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀad=new D(this.ƀac,"alpha",{duration:500,animation:P.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),x.instance.screenSize.subscribe(e=>{this.ƀac.aspectRatio=e.x/e.y,this.ƀac.scale=Math.max(e.x,e.y),this.ƀac.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.zero});}).attach(this),x.instance.setScreenPositionToStagePositionFunction(e=>new helpersLib.Vector(e.x-this.ƀan.position.x-this.ƀao.position.x,e.y-this.ƀan.position.y-this.ƀao.position.y)),this.ƀcw.position.subscribe(e=>{this.ƀan.position=this.ƀbp(e);}).attach(this),this.ƀcw.offset.subscribe(e=>{this.ƀao.position=e;}).attach(this),this.appear(true,"alpha");}destroy(){this.destroyed||(super.destroy(),x.instance.resetScreenPositionToStagePositionFunction());}getLayers(){return {backgroundScreen:this.ƀaa.id,background:this.ƀz.id,main:this.ƀgc.id,foreground:this.ƀdf.id,foregroundScreen:this.ƀdg.id}}appear(t,e){switch(e){case "alpha":return this.ƀad.set({alpha:0}),this.ƀh.set({alpha:t?0:1}),this.ƀh.animate({alpha:t?1:0}).chain(this);case "pureBlack":return this.ƀh.set({alpha:1}),this.ƀad.set({alpha:t?1:0}),this.ƀad.animate({alpha:t?0:1}).chain(this);case "instant":return this.ƀh.set({alpha:t?1:0}),this.ƀad.set({alpha:t?0:1}),actionsLib.SingleEvent.instant();default:{throw new Error('Switch ended with value "never".')}}}ƀbp(t){return helpersLib.Vector.fromTo(t,x.instance.getScreenSizeCenter())}};It=gs([Je({entity:V}),ys("design:paramtypes",[V])],It);var vs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},bs=1500,Ee=class{static{h(this,"CameraService");}createCamera(){return new V().attachToRoot()}getCameraPosition(){let t=V.getInstanceOrFail();return helpersLib.Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=V.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=V.getInstanceOrFail();e.focusingNewTargetInfo.value={time:x.time,duration:t?.duration??bs,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??exports.FocusingAnimation.Instant};}update(t,e){let i=V.getInstanceOrFail(),r=i.targetPosition.value;r&&(i.focusingNewTargetInfo.value?this.ƀfo(i,r,t):i.position.value=r);}ƀfo(t,e,i){let r=t.focusingNewTargetInfo.value;if(r.focusingAnimation===exports.FocusingAnimation.Instant)this.ƀbb(t,e);else {let s=(i-r.time)/r.duration;if(s>=1)this.ƀbb(t,e);else {let n;r.focusingAnimation===exports.FocusingAnimation.EaseInOut?n=J.easeInOut(s):r.focusingAnimation===exports.FocusingAnimation.EaseOut?n=J.easeOut(s):n=1;let a=r.position.lerp(e,n);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;}}}ƀbb(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};Ee=vs([d()],Ee);var Ps=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ss=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},ri=class{static{h(this,"CameraController");}constructor(t){this.ƀap=t;}createCamera(){return this.ƀap.createCamera().id}update(t,e){this.ƀap.update(t,e);}setPosition(t){this.ƀap.setPosition(t);}setTransition(t){this.ƀap.setTransition(t);}getCameraPosition(){return this.ƀap.getCameraPosition()}};ri=Ps([q({controllerLink:gt}),Ss("design:paramtypes",[Ee])],ri);var Ts=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},si=class{static{h(this,"CameraViewController");}getLayers(){let t=V.getInstanceOrFail().id;return It.getInstanceOrFail(t).getLayers()}appear(t,e){let i=V.getInstanceOrFail().id;return It.getInstanceOrFail(i).appear(t,e)}};si=Ts([q({controllerLink:ye})],si);var Zt=class{static{h(this,"Camera");}get position(){return this.ƀam.getCameraPosition()}constructor(){this.ƀam=T.get(exports.CameraGateway),this.ƀaq=T.get(Ut),this.ƀam.createCamera(),this.layers=this.ƀaq.getLayers();}setPosition(t){this.ƀam.setPosition(t);}setTransition(t){this.ƀam.setTransition(t);}appear(t,e="alpha"){return this.ƀaq.appear(t,e)}};var x=class o{static{h(this,"Game");}static get instance(){return this.ƀfi}static{this.pause=actionsLib.Reducer.createOr();}static get camera(){return this.ƀal}static get time(){return y.ƀjz}static get setupOptions(){return this.ƀja}getScreenSize(){return this.ƀiq.value}getScreenSizeCenter(){return this.ƀir.value}constructor(t){if(this.ƀiq=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSize=this.ƀiq.notifier,this.ƀir=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSizeCenter=this.ƀir.notifier,this.devMode=false,this.resetScreenPositionToStagePositionFunction(),o.ƀfi)throw new Error("There can be only one Game instance!");{this.ƀbf={screenResolution:void 0,devMode:false,backgroundColor:helpersLib.ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbf.devMode||false;let e=helpersLib.JsonHelper.removeUndefinedProperties({backgroundColor:this.ƀbf.backgroundColor,autoStart:false,antialias:this.ƀbf.antialias,resolution:this.ƀbf.resolution,width:this.ƀbf.screenResolution?.width,height:this.ƀbf.screenResolution?.height,resizeTo:this.ƀbf.screenResolution===void 0?window:void 0});this.ƀhr=new L__namespace.Application(e);}}async setup(t){o.ƀja=t,document.body.appendChild(this.ƀhr.view),await Promise.all([M.loadGameAssets(t.assetDefinitions)]),o.ƀfi=this,this.stage=new u().attachToRoot(),this.stage.ƀhs=this.ƀhr.stage,this.renderer=this.ƀhr.renderer,this.ƀiz(),this.stage.sortableChildren=true,globalThis.ƀa=this.ƀhr,window.addEventListener("resize",e=>{setTimeout(()=>this.ƀiz());}),o.ƀal=new Zt,this.ƀhr.start(),this.ƀhr.ticker.add(()=>{y.triggerUpdateTick(this.ƀhr.ticker.deltaMS);});}setResolution(t){this.ƀhr.renderer.resolution!==t&&(this.ƀhr.renderer.resolution=t,this.ƀhr.renderer.resize(this.ƀhr.screen.width,this.ƀhr.screen.height));}screenPositonToStagePosition(t){let e=Wt.includeScaleInScreenPosition(t,o.instance.stage.scale,o.instance.getScreenSizeCenter());return this.ƀip(e)}setScreenPositionToStagePositionFunction(t){this.ƀip=t;}resetScreenPositionToStagePositionFunction(){this.ƀip=t=>t;}destroyAsset(t){M.destroyAsset(t);}ƀiz(){let t=new helpersLib.Vector(this.ƀhr.screen.width,this.ƀhr.screen.height);this.ƀiq.value=t,this.ƀir.value=t.multiplyNumber(.5).round();}};var Ce=class{static{h(this,"DashedLineHelper");}static getLines(t,e,i){let r=helpersLib.Vector.fromTo(t,e),s=r.normalize(),n=r.length-i.lineStartGap-i.lineEndGap,a=[];if(n<=0)return a;let l=t.add(s.normalize(i.lineStartGap));if(n<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(s.normalize(n))}),a;let c=n-i.dashGap,p=i.dashLength+i.dashGap,m=Math.floor(c/p),g=c-p*m;m>=1&&g<i.dashLength&&(g+=p,m--);let C=s.normalize(g/2),bt=s.normalize(i.dashGap);if(a.push({from:l,to:l.add(C)}),l=l.add(C),m>0){let se=s.normalize(i.dashLength);helpersLib.ArrayHelper.createEmptyArray(m).forEach(()=>{l=l.add(bt),a.push({from:l,to:l.add(se)}),l=l.add(se);});}return l=l.add(bt),a.push({from:l,to:l.add(C)}),a}};var E=class o extends u{static{h(this,"Graphics");}static{this.ƀcr=new Map;}static createArrow(t,e){let i=new L__namespace.Graphics,r=[[{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}]];return i.beginFill(e),r.forEach(s=>{i.drawPolygon(s.map(n=>new L__namespace.Point(n.x,n.y)));}),i.endFill(),new o(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 L__namespace.Graphics;return s.lineStyle(r.width,r.color),Ce.getLines(t,e,r).forEach(a=>{s.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),new o(s,JSON.stringify({type:"dashedLine",from:t,to:e,options:r}))}static createVector(t,e,i){let r=new L__namespace.Graphics;return r.lineStyle(2,i),r.moveTo(t.x,t.y),r.lineTo(e.x,e.y),r.lineStyle(1,i),r.beginFill(helpersLib.ColorHelper.white),r.drawCircle(t.x,t.y,3),r.endFill(),new o(r,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let r=new L__namespace.Graphics;return r.beginFill(i),r.drawRect(0,0,t.x,e),r.drawRect(0,e,e,t.y-e*2),r.drawRect(t.x-e,e,e,t.y-e*2),r.drawRect(0,t.y-e,t.x,e),r.endFill(),new o(r,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=helpersLib.ColorHelper.white){let i=new L__namespace.Graphics;return i.beginFill(e),i.drawRect(0,0,t.x,t.y),i.endFill(),new o(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new L__namespace.Graphics;return i.beginFill(e),i.drawCircle(0,0,t),i.endFill(),new o(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new L__namespace.Graphics;return i.beginFill(e),i.drawEllipse(0,0,t.x,t.y),i.endFill(),new o(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new L__namespace.Graphics,r=JSON.stringify({type:"polygon",polygon:t,color:e});return i.beginFill(e),t.forEach(s=>{i.drawPolygon(s.map(n=>new L__namespace.Point(n.x,n.y)));}),i.endFill(),new o(i,r)}static createRegularPolygon(t,e,i){let r=new L__namespace.Graphics,s=new helpersLib.Radian(helpersLib.PI_360/t);r.beginFill(i),r.moveTo(e,0);for(let n=1;n<=t;n++){let l=s.multiply(n).vector.normalize(e),c=e+l.x,p=e+l.y;r.lineTo(c,p);}return r.endFill(),new o(r,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.ƀhs.addChild(t),this.pixiGraphics=t,this.ƀak=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀak,cache:false,...t},i=this.ƀef(e.cacheName,e.cache),r={id:i.assetID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},s=new Y(r,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),s}ƀef(t,e){if(e){let i=o.ƀcr.get(t);return i||(i=this.ƀce(),o.ƀcr.set(t,i)),i}else return this.ƀce()}ƀce(){let t=x.instance.renderer.generateTexture(this.pixiGraphics);t.id=M.insertAsset(t);let e=this.pixiGraphics.getBounds();return {assetID:t.id,bounds:new helpersLib.Vector(e.x,e.y)}}};var ai=class extends u{static{h(this,"Placeholder");}constructor(t){super(),this.ƀhu=new L__namespace.Graphics,this.ƀhu.beginFill(0,1e-9),this.ƀhu.drawRect(0,0,t.x,t.y),this.ƀhu.endFill(),this.ƀhs.addChild(this.ƀhu);}destroy(){this.destroyed||(super.destroy(),this.ƀhu.destroy());}};var At=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:true,dropShadowBlur:s.blur,dropShadowAngle:s.angle.value,dropShadowDistance:s.distance,dropShadowColor:helpersLib.ColorHelper.rgbToHex(s.color),dropShadowAlpha: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 Ie=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.ƀfe(r,e),n=this.ƀr(s);return this.ƀjf(n)}static ƀfe(t,e){let i=new Map,r=new Map,s=h((a,l)=>{if(r.has(l))return r.get(l);let c=At.getPixiTextStyle(a);return r.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀdo(a.tags,e,i),p=s(l,c),m=L__namespace.TextMetrics.measureText(" ",new L__namespace.TextStyle(p),false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:m.width}})}static ƀdo(t,e,i){let r=t.join("+");if(i.has(r))return {style:i.get(r),cacheKey:r};let s=this.ƀba(t,e);return i.set(r,s),{style:s,cacheKey:r}}static ƀba(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:n,...a}=i;return a}static ƀr(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 ƀjf(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.ƀjg(s.text).map(a=>{let l=new L__namespace.TextStyle(s.pixiStyle),c=L__namespace.TextMetrics.measureText(a,l,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 ƀjg(t){if(t==="")return [""];let e=[],i="",r=t[0]===" ";for(let s=0;s<t.length;s++){let n=t[s],a=n===" ";a===r?i+=n:(e.push(i),i=n,r=a);}return i&&e.push(i),e}};var Ae=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀci.length===0}get remainingWidth(){return this.ƀkt-this.ƀck}constructor(t,e){this.ƀkt=t,this.ƀfw=[],this.ƀci=[],this.ƀck=0,this.ƀfv=new helpersLib.Vector(0,0),this.ƀcj=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀew=i.horizontalAlignment,this.ƀkm=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀkt||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀcl={direction:i.rectangleCutOption.direction,rectangle:this.ƀbo(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀcj,t.y),i=this.ƀdx(this.ƀfv.y,this.ƀfv.y+e);return this.ƀck+t.x<=i}insertWord(t){let e=Math.max(this.ƀcj,t.style.height);if(this.ƀci.length===0){let i=this.ƀdy(this.ƀfv.y,this.ƀfv.y+e);this.ƀfv=new helpersLib.Vector(i,this.ƀfv.y),this.ƀck=this.ƀfv.x;}this.ƀci.push({chunk:t,position:new helpersLib.Vector(this.ƀck,this.ƀfv.y)}),this.ƀcj=e,this.ƀck+=t.style.width;}newLine(){let t=this.ƀfv.y+this.ƀcj,e=this.ƀdy(t,t);this.ƀdd(),this.ƀfv=new helpersLib.Vector(e,t),this.ƀck=this.ƀfv.x,this.ƀcj=0;}print(){return this.ƀdd(),this.ƀfw}ƀdd(){this.ƀci.length>0&&(this.ƀfw.push(this.ƀg(this.ƀci)),this.ƀci=[]);}ƀg(t){return t=this.ƀko(t),t=this.ƀey(t),t}ƀey(t){if(this.ƀew==="left")return t;let e=this.ƀfv.y+this.ƀcj,i=this.ƀdy(this.ƀfv.y,e),s=this.ƀdx(this.ƀfv.y,e)-i,n=Math.min(s,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀew==="center"?a=(s-n)/2:a=s-n,t.map(l=>(l={chunk:l.chunk,position:new helpersLib.Vector(l.position.x+a,l.position.y)},l))}ƀko(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.ƀkm){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.ƀkm;throw new Error(`Unexpected case! "${this.ƀkm}"`)}}return r={chunk:r.chunk,position:new helpersLib.Vector(r.position.x,r.position.y+s)},r})}ƀdy(t,e){return this.ƀcl&&(this.ƀcl.direction==="topLeft"||this.ƀcl.direction==="bottomLeft")&&(this.ƀcl.rectangle.isPointInside(new helpersLib.Vector(0,t),{includeEdges:false})||this.ƀcl.rectangle.isPointInside(new helpersLib.Vector(0,e),{includeEdges:false}))?this.ƀcl.rectangle.bottomRight.x:0}ƀdx(t,e){return this.ƀcl&&(this.ƀcl.direction==="topRight"||this.ƀcl.direction==="bottomRight")&&(this.ƀcl.rectangle.isPointInside(new helpersLib.Vector(this.ƀkt,t),{includeEdges:false})||this.ƀcl.rectangle.isPointInside(new helpersLib.Vector(this.ƀkt,e),{includeEdges:false}))?this.ƀcl.rectangle.topLeft.x:this.ƀkt}ƀbo(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(`Unexpected case! "${t.direction}"`)}}return new helpersLib.Rectangle(e,i)}};var Oe=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 n=i[i.length-1];e.isSpaceAvailable(new helpersLib.Vector(n.style.width+r.style.width,n.style.height))?e.insertWord(r):this.ƀku(r,e);}else e.insertWord(r);else e.lineIsEmpty?e.insertWord(r):r.whitespace?this.ƀku(r,e):(e.newLine(),e.insertWord(r));}),e.newLine();}),e.print()}static ƀku(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 n={text:" ".repeat(r),whitespace:true,style:{...t.style,width:r*t.style.spaceWidth}};e.insertWord(n);}e.newLine();let s=t.text.length-r-1;if(s>0){let n={text:" ".repeat(s),whitespace:true,style:{...t.style,width:s*t.style.spaceWidth}};e.insertWord(n);}}};var Me=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀgj(t),t=this.ƀkd(t),this.ƀat(t)}static ƀgj(t){return t.map(e=>{let i=[],r,s=true;return e.forEach(n=>{if(!r||r.chunk.style.cacheKey!==n.chunk.style.cacheKey)r&&i.push(r),r=n,s=n.chunk.whitespace;else {let a=r.chunk.text+n.chunk.text;s=n.chunk.whitespace&&s,r={chunk:{text:a,whitespace:s,style:{...r.chunk.style,width:r.chunk.style.width+n.chunk.style.width}},position:r.position};}}),r&&i.push(r),i})}static ƀkd(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 ƀat(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 Qt=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=Ie.process(t,e),r=helpersLib.JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),s=new Ae(e.default.wordWrapWidth??1/0,r),n=Oe.wrapText(i,s);return Me.process(n)}};var js=1,Xi=1/js,qt=class extends u{static{h(this,"Text");}get ƀjw(){if(!this.ƀjx){let t=new L__namespace.TextStyle(this.ƀhw);this.ƀjx=L__namespace.TextMetrics.measureText(this.ƀjv,t);}return this.ƀjx}get ascent(){return this.ƀjw.fontProperties.ascent}constructor(t,e){super(),this.ƀhw=At.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀhv.destroyed&&this.ƀhv.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new helpersLib.Vector(this.ƀhv.anchor.x,this.ƀhv.anchor.y)}set anchor(t){this.ƀi=t,this.ƀhv.anchor.set(t.x,t.y);}setText(t){return this.ƀjv!==t&&(this.ƀjv=t,this.ƀid()),this}setColor(t){let e=helpersLib.ColorHelper.rgbToHex(t);return this.ƀhw.fill!==e&&(this.ƀhw.fill=e,this.ƀid()),this}ƀid(){this.ƀhv?.destroy(),this.ƀjq?.destroy(),this.ƀjq=void 0,this.ƀjx=void 0;let t=new L__namespace.TextStyle(this.ƀhw);this.ƀhv=new L__namespace.Text(this.ƀjv,t),this.ƀih(),this.ƀi&&this.ƀhv.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀhv.scale.set(Xi,Xi),this.ƀhs.addChild(this.ƀhv),this.ƀhw.lineThrough&&(this.ƀjq=this.ƀe(this.ƀhv,this.ƀhw.fill),this.ƀhs.addChild(this.ƀjq));}ƀih(){let t=L__namespace.TextMetrics.measureText(this.ƀjv,new L__namespace.TextStyle({...this.ƀhw,dropShadow:false,dropShadowAlpha:0,dropShadowBlur:0,dropShadowDistance:0}));this.ƀhv.calculateBounds=function(){this.updateText(true),this._bounds.clear();let e=-this.anchor.x*t.width,i=-this.anchor.y*t.height;this._bounds.addFrame(this.transform,e,i,e+t.width,i+t.height);};}ƀe(t,e){let i=L__namespace.TextMetrics.measureText(t.text,t.style),r=Math.max(1,Math.round(i.lineHeight*.07)),s=r%2*.5,n=new L__namespace.Graphics;n.lineStyle(r,e);let a=0;return i.lines.forEach((l,c)=>{let p=L__namespace.TextMetrics.measureText(l,t.style),m=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+s,g=0;t.style.align==="center"?g=0+(t.width-p.width)*.5:t.style.align==="right"&&(g=0+t.width-p.width),g=Math.floor(g),n.moveTo(Math.floor(g),m),n.lineTo(Math.floor(g+p.width),m),a+=p.lineHeight;}),n.endFill(),n}};var hi=class extends u{static{h(this,"RichText");}constructor(t,e){super(),Qt.process(t,e).forEach(r=>new qt(r.text,r.style).setPosition(r.position).displayParent(this).attach(this));}};var li=class extends u{static{h(this,"UpdatableContainer");}},ci=class extends u{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀbu=t,this.ƀco=new Map,this.ƀhb={trackBy:h((i,r)=>r,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀco.keys()),i=0;t.forEach((r,s)=>{let n=this.ƀhb.trackBy(r,s),a;this.ƀco.has(n)?(a=this.ƀco.get(n),e.delete(n),a.update(r)):(a=this.ƀbu(r).displayParent(this).attach(this),this.ƀco.set(n,a)),this.ƀhb.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀhb.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀhb.positioning.spacing);}),e.forEach(r=>{this.ƀco.get(r).destroy(),this.ƀco.delete(r);});}};var te=class o extends u{static{h(this,"MenuUI");}static{this.ƀfk=actionsLib.Reducer.createExistenceChecker();}static{this.isAnyMenuTransitioning=this.ƀfk.notifier;}static getIsAnyMenuTransitioning(){return o.ƀfk.value}constructor(t,e){super(),this.ƀgt=new actionsLib.SingleAction,this.onCreate=this.ƀgt.notifier,this.ƀgv=new actionsLib.SingleAction,this.onOpen=this.ƀgv.notifier,this.ƀgq=new actionsLib.SingleAction,this.onClose=this.ƀgq.notifier,this.ƀaw=false;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.setAlpha(0),this.ƀo=new D(this,"alpha",{animation:P.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState});let r=E.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(i.backgroundDarkeningRatio).setInteractive(true).displayParent(this).attach(this);this.ƀgh=Y.createByName(t).setPosition(new helpersLib.Vector(0,0)).setInteractive(true).displayParent(this).attach(this),x.instance.screenSize.subscribe(n=>{r.aspectRatio=n.x/n.y,r.scale=Math.max(n.x,n.y),r.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.half}),this.setPosition(n.multiplyNumber(.5));}).attach(this),this.ƀgt.resolve();let s=o.ƀfk.effect().attach(this);this.ƀo.animate({alpha:1}).chain(this).tap(()=>{this.ƀgv.resolve(),s.destroy(),i.closeOnBackgroundClick&&r.on(exports.ContainerEventType.Click).take(1).tap(()=>this.close()).attach(this);}).attachToRoot();}getBoundingMask(){return this.ƀgh.getBoundingMask()}close(){if(!this.ƀaw){this.ƀaw=true;let t=o.ƀfk.effect().attach(this);this.ƀo.animate({alpha:0}).chain(this).map(()=>{this.ƀgq.resolve(),t.destroy(),this.destroy();}).chainToRoot();}return this.onClose.toSingleEvent().destroyIfNotAttached()}};var di=class extends ft{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.ƀhb=t,queueMicrotask(()=>{if(!this.ƀgi)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀif(t){this.ƀgi=t,this.ƀgi.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀgi.onCreate.toSingleEvent().destroyIfNotAttached()}onOpen(){return this.ƀgi.onOpen.toSingleEvent().destroyIfNotAttached()}onClose(){return this.ƀgi.onClose.toSingleEvent().destroyIfNotAttached()}close(){return this.ƀgi.close()}};var ui=class extends dt{static{h(this,"MenuView");}constructor(t,e,i){super();let r=helpersLib.JsonHelper.removeUndefinedProperties({appearAnimationDuration:i.appearAnimationDuration,backgroundDarkeningRatio:i.backgroundDarkeningRatio,closeOnBackgroundClick:t.ƀhb.closeOnBackgroundClick}),s=new te(e,r).displayParent(x.camera.layers.foregroundScreen).attach(this);t.ƀif(s);let n=new actionsLib.SingleAction;s.onCreate.subscribe(()=>n.resolve(s)).attach(this),this.onCreate=n.notifier,this.onOpen=s.onOpen.notifier,this.onClose=s.onClose.notifier;}};var Ys=.65,Xs=.01,Be=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀis}get contentSize(){return this.ƀbh.size.ceil()}constructor(t,e,i,r){this.ƀbh=t,this.ƀu=e,this.ƀhe=i,this.ƀje=r,this.ƀfh=false,this.ƀis=e-i*2,this.ƀbh.y=i,this.ƀjr=i;}onWheel(t){this.setTarget(this.ƀjr-t*Ys);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀjr=helpersLib.NumberHelper.clamp(t,this.ƀu-this.ƀhe-this.contentSize.y,this.ƀhe);}jumpToTarget(){this.ƀbh.y=this.ƀjr;}update(t){let e=this.contentSize;if(e.y<=this.ƀis){switch(this.ƀje){case "start":this.ƀjr=this.ƀhe;break;case "center":this.ƀjr=(this.ƀu-e.y)*.5;break;case "end":this.ƀjr=this.ƀu-e.y-this.ƀhe;break;default:{this.ƀje;throw new Error(`Unexpected case! "${this.ƀje}"`)}}this.ƀfh||(this.ƀbh.y=this.ƀjr);}this.ƀfh=true;let i=this.ƀjr-this.ƀbh.y;this.ƀbh.y=this.ƀbh.y+i*Xs*t;}};var Zs=15,fi=class extends u{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbi}get contentSize(){return this.ƀit.contentSize}constructor(t,e={}){super();let i={padding:Zs,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 u().displayParent(this).attach(this);new yt(r,t,i.padding).attach(this);let s=new L__namespace.Graphics;s.beginFill(0,1e-9),s.drawRect(0,0,t.x,t.y),s.endFill(),r.ƀhs.addChild(s);let n=new u().displayParent(r).attach(this);this.ƀit=new Be(n,t.y,i.padding,i.smallContentAlign),this.ƀbi=new helpersLib.Vector(t.x,this.ƀit.scrollHeight),s.eventMode="dynamic",s.addEventListener("wheel",a=>{this.ƀit.onWheel(a.deltaY);}),n.setInteractive(true),n.ƀhs.addEventListener("wheel",a=>{this.ƀit.onWheel(a.deltaY);}),y.afterSceneUpdateAction.subscribe(a=>this.ƀit.update(a.delta)).attach(this),this.addChildTo=n;}scrollToTop(t){this.ƀit.scrollToTop(),t?.instant&&this.ƀit.jumpToTarget();}scrollToBottom(t){this.ƀit.scrollToBottom(),t?.instant&&this.ƀit.jumpToTarget();}};var Qs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},qs=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.KeyboardService=class mi{static{h(this,"KeyboardService");}constructor(){this.ƀfr=new actionsLib.Action,this.keyPressed=this.ƀfr.notifier,this.ƀfs=new actionsLib.Action,this.keyReleased=this.ƀfs.notifier,this.ƀfy=new Set,this.ƀfx=new Set,window.addEventListener("keydown",t=>{this.ƀfy.add(t.key),this.ƀfx.add(t.key),!t.repeat&&this.ƀfr.trigger(t.key);}),window.addEventListener("keyup",t=>{this.ƀfy.delete(t.key),this.ƀfs.trigger(t.key);}),window.addEventListener("blur",()=>{this.ƀfy.clear();}),y.afterSceneUpdateAction.subscribe(()=>{this.ƀfx.clear();}).attachToRoot();}isKeyDown(t){return this.ƀfy.has(t)}isKeyJustPressed(t){return this.ƀfx.has(t)}};exports.KeyboardService=Qs([d(),qs("design:paramtypes",[])],exports.KeyboardService);var to=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},eo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.MouseService=class ie{static{h(this,"MouseService");}get initialMouseMoveHappened(){return this.ƀfg.value}getStagePosition(){return this.ƀji.value}getScreenPosition(){return this.ƀio.value}getMainButtonState(){return this.ƀgb.value}getSecondaryButtonState(){return this.ƀiu.value}constructor(){this.ƀfg=new actionsLib.Variable(false),this.onInitialMouseMove=this.ƀfg.notifier,this.ƀji=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀji.notifier,this.ƀio=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀio.notifier,this.ƀgb=new actionsLib.Variable(false),this.mainButtonState=this.ƀgb.notifier,this.ƀiu=new actionsLib.Variable(false),this.secondaryButtonState=this.ƀiu.notifier,this.ƀjj(),window.addEventListener("mousedown",t=>{t.button===0?this.ƀgb.value=true:t.button===2&&(this.ƀiu.value=true);}),window.addEventListener("mouseup",t=>{t.button===0?this.ƀgb.value=false:t.button===2&&(this.ƀiu.value=false);}),window.addEventListener("blur",()=>{this.ƀgb.value=false,this.ƀiu.value=false;});}ƀjj(){let t=helpersLib.Vector.zero;window.addEventListener("mousemove",e=>{t=new helpersLib.Vector(e.clientX,e.clientY),this.ƀfg.value=true;}),y.beforeSceneUpdateAction.subscribe(()=>{this.ƀio.value=t;}).attachToRoot(),y.afterSceneUpdateAction.subscribe(()=>{let e=x.instance.screenPositonToStagePosition(this.ƀio.value);e.isEqual(this.ƀji.value)?x.instance.renderer.events.onPointerMove(new PointerEvent("pointermove",{clientX:this.ƀio.value.x,clientY:this.ƀio.value.y,pointerType:"mouse"})):this.ƀji.value=e;}).attachToRoot();}};exports.MouseService=to([d(),eo("design:paramtypes",[])],exports.MouseService);var io=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ro=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.MouseTargetFocusService=class gi{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀde}get lastFocusedPosition(){return this.ƀfu}constructor(t){this.ƀgl=t,this.ƀgx=new actionsLib.Action,this.onTargetFocus=this.ƀgx.notifier,this.ƀkb=0,this.ƀkc=false,this.ƀde=false,this.ƀfu=void 0,y.beforeSceneUpdateAction.subscribe(e=>this.ƀkf(e.delta)).attachToRoot();}ƀkf(t){if(this.ƀgm){let e=this.ƀee(this.ƀgl.getStagePosition(),this.ƀgm);this.ƀhg===void 0?this.ƀhg=e:this.ƀas(e,t);}this.ƀgm=this.ƀgl.getStagePosition();}ƀas(t,e){this.ƀhg-t>10?(this.ƀkb=Math.max(250,this.ƀkb),this.ƀkc=true):this.ƀkb>1e3&&(this.ƀkc=true);let i=this.ƀkb>=300&&this.ƀkc;this.ƀfp(i,t,e);}ƀfp(t,e,i){(t||e>this.ƀhg)&&(this.ƀhg=e),t?(this.ƀkc=false,this.ƀkb=0,this.ƀde=true,this.ƀfu=this.ƀgl.getStagePosition(),this.ƀgx.trigger(this.ƀfu)):(this.ƀkb+=i,this.ƀde=false);}ƀee(t,e){let i=helpersLib.Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};exports.MouseTargetFocusService=io([d(),ro("design:paramtypes",[exports.MouseService])],exports.MouseTargetFocusService);var yi=10.8,wi=10.01;exports.PhysicsShapeType=void 0;(function(o){o[o.Point=1]="Point",o[o.Circle=2]="Circle",o[o.Polygon=3]="Polygon",o[o.Rectangle=4]="Rectangle";})(exports.PhysicsShapeType||(exports.PhysicsShapeType={}));var f=class o{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=>o.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new U__default.default.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var ot="border";var lo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},X=new $,Mt=class{static{h(this,"PhysicsInternalGateway");}createBody(t,e,i,r,s){return X.trigger("createBody",t,e,i,r,s)}getMaterial(t,e){return X.trigger("getMaterial",t,e)}getMaterialDefinition(t,e){return X.trigger("getMaterialDefinition",t,e)}getGroupConstant(t,e){return X.trigger("getGroupConstant",t,e)}getMaskConstant(t,e){return X.trigger("getMaskConstant",t,e)}addBody(t,e,i,r,s){return X.trigger("addBody",t,e,i,r,s)}removeBody(t,e){return X.trigger("removeBody",t,e)}subscribeToPhysicsStep(t,e){return X.trigger("subscribeToPhysicsStep",t,e)}};Mt=lo([d()],Mt);var b=class o extends k{static{h(this,"PhysicsEntity");}static{this.ƀhd=new Map;}static{this.ƀhk=new Map;}static getFromP2BodyID(t){return o.ƀhd.get(t)}static getFromP2BodyIDOrFail(t){let e=o.ƀhd.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=o.ƀhk.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(o.ƀhk.values())}get area(){return this.ƀt}get mass(){return this.ƀgf}get collisions(){return this.ƀax}constructor(t,e,i){super(),this.ƀgr=new actionsLib.Action,this.onCollision=this.ƀgr.notifier,this.type="dynamic",this.ƀt=0,this.ƀgf=0,this.ƀax=[],this.physicsWorldID=t,this.ƀhm=T.get(Mt);let r=this.ƀhm.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀhm.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀhl=this.ƀhm.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀhn=this.ƀhm.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀhm.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀt=this.p2Body.getArea(),this.ƀgf=this.p2Body.mass,this.p2Body.position=f.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀhm.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!");o.ƀhd.set(this.p2Body.id,this),o.ƀhk.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀhm.removeBody(this.physicsWorldID,this.p2Body),o.ƀhd.delete(this.p2Body.id),o.ƀhk.delete(this.id));}canCollideWith(t){return f.arePhysicsGroupsCollidable(this.ƀhl,this.ƀhn,t.ƀhl,t.ƀhn)}ƀiw(t){this.ƀax=t,t.length>0&&this.ƀgr.trigger(t);}};var re=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 xi=class extends k{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),y.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀjo(t,e);}).attach(this);}ƀjo(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 vi=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.ƀez=false,this.ƀfa=false,this.ƀfc=false,this.ƀfb=false,this.ƀhh(),this.ƀfz(),T.get(Mt).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀjo(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}}ƀjo(t,e){this.ƀez=true,this.ƀfa=true,this.ƀfc=true,this.ƀfb=true,this.ƀhh();}ƀhh(){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;}ƀfz(){this.position.subscribe(t=>{this.ƀez?this.ƀez=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfa?this.ƀfa=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfc?this.ƀfc=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfb?this.ƀfb=false:this.p2Body.angularVelocity=t;}).attach(this);}};var fo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},mo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},v=class extends k{static{h(this,"PhysicsWorldEntity");}constructor(t,e,i,r,s,n,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=n,this.physicsBodyGroupToP2Mask=a;}};v=fo([ut(),mo("design:paramtypes",[helpersLib.Vector,Boolean,U__default.default.World,Map,Map,Map,Map])],v);var xo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},K=class{static{h(this,"PhysicsBodyGroupService");}createBodyGroupsAndMasks(t,e){let i=new Map,r=new Map;return t.map((s,n)=>{if(n>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(s,1<<n),r.set(s,0);}),e.map(([s,n])=>{if(!i.has(s))throw new Error(`Physics body group "${s}" not found`);if(!i.has(n))throw new Error(`Physics body group "${n}" not found`);let a=r.get(s),l=r.get(n),c=i.get(s),p=i.get(n);r.set(s,a|p),r.set(n,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),n=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (s&n)!==0&&(a&r)!==0}};K=xo([d()],K);var vo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},bo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ve=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀhj=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((r,s)=>{r.forEach((n,a)=>{this.ƀhj.canCollide(t,a,e)&&i.push({grid:n,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();}};Ve=vo([d(),bo("design:paramtypes",[K])],Ve);var Po=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},So=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},nt=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀhj=t,this.ƀx=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let r=f.aabbToBoundingBox(e.aabb);this.ƀx.getCollidableGrids(t,i).forEach(s=>{let n=B.areaToGridArea(r,s.cellSize);s.grid.setArea(n,false);});}findClosestAvailableSpace(t,e,i,r=Dt){return e.aabbNeedsUpdate=true,e.updateAABB(),Jt.findByConvertingGridSpace(this.getAvilabilityGrid(t,r,i),f.aabbToBoundingBox(e.aabb),r)}getAvilabilityGrid(t,e,i){let r=this.ƀx.get(t,e,i);return r||(r=this.ƀbx(t,e,i),this.ƀx.set(t,e,i,r)),r}ƀbx(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 n=b.getFromP2BodyIDOrFail(s.id);if(n.includeInPathfinding&&this.ƀhj.canCollide(t,n.physicsBodyGroup,i)){let a=this.ƀdv(s,e);r.setArea(a,false);}}),r}ƀdv(t,e){let i=f.aabbToBoundingBox(t.aabb);return B.areaToGridArea(i,e)}};nt=Po([d(),So("design:paramtypes",[K,Ve])],nt);var Co=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ro=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Dt=50,Bt=class{static{h(this,"PathFinderService");}constructor(t){this.ƀhi=t;}findPathAStar(t,e,i,r,s){s||(s={}),s.neighborType===void 0&&(s.neighborType=helpersLib.GridNeighborType.Ortogonal),s.gridCellSize===void 0&&(s.gridCellSize=Dt);let n=v.getInstanceByIDOrFail(t),a,l;helpersLib.Comparator.isNumber(i)?(l=b.getPhysicsInstanceOrFail(i).p2Body,a=f.arrayToVector(l.position)):a=i;let c=B.positionToGridPosition(e,s.gridCellSize),p=B.positionToGridPosition(a,s.gridCellSize),m=this.ƀhi.getAvilabilityGrid(n,s.gridCellSize,r);if(l){let C=f.aabbToBoundingBox(l.aabb),bt=B.areaToGridArea(C,s.gridCellSize);m.setArea(bt,true);}let g=Yt.findPath(m,c,p,s.neighborType);return g.path=g.path.map(C=>B.gridPositionToPosition(C,s.gridCellSize)),g}findPathDirection(t,e,i,r,s=Dt){let n=v.getInstanceByIDOrFail(t),a;if(helpersLib.Comparator.isNumber(i)){let g=b.getPhysicsInstanceOrFail(i);a=f.aabbToBoundingBox(g.p2Body.aabb);}else a=new helpersLib.Rectangle(i,i);let l=B.areaToGridArea(a,s),c=JSON.stringify({targetGridArea:l,collidableWithGroup:r}),p=n.vectorFieldCache.get(c);if(!p){let g=this.ƀhi.getAvilabilityGrid(n,s,r);p=new Xt(l,g),n.vectorFieldCache.set(c,p);}let m=B.positionToGridPosition(e,s);return p.getDirectionToTarget(m)}};Bt=Co([d(),Ro("design:paramtypes",[nt])],Bt);var Oo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},H=new $;exports.PhysicsGateway=class bi{static{h(this,"PhysicsGateway");}createPhysicsWorld(t){return H.trigger("createPhysicsWorld",t)}getMapSize(t){return H.trigger("getMapSize",t)}setPaused(t,e){return H.trigger("setPaused",t,e)}hitTest(t,e){return H.trigger("hitTest",t,e)}findPath(t,e,i,r,s){return H.trigger("findPath",t,e,i,r,s)}findPathDirection(t,e,i,r){return H.trigger("findPathDirection",t,e,i,r)}applyImpulse(t,e,i,r){return H.trigger("applyImpulse",t,e,i,r)}createExplosion(t,e,i,r,s,n){return H.trigger("createExplosion",t,e,i,r,s,n)}createElipticExplosion(t,e,i,r,s,n,a){return H.trigger("createElipticExplosion",t,e,i,r,s,n,a)}printPathfindingTestGrid(t,e,i,r,s,n=Dt){return H.trigger("printPathfindingTestGrid",t,e,i,r,s,n)}};exports.PhysicsGateway=Oo([d()],exports.PhysicsGateway);var Mo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Do=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Q=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀy=t,this.ƀhf=e;}printPathfindingTestGrid(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t);this.ƀy.getAvilabilityGrid(a,n,r).map((c,p)=>({position:B.gridPositionToPosition(p,n),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(s)){let p=this.ƀhf.findPathDirection(t,c.position,i,r),m;p===void 0?m=E.createRectangleBorders(new helpersLib.Vector(8,8),2,helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):m=E.createArrow(25,c.availability?helpersLib.ColorHelper.green:helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).setRotation(p).attach(a),new D(m,"alpha",{duration:1e3,animation:P.easeIn}).animate({alpha:0}).tap(()=>m.destroy()).attach(m);}});}createExplosionDebugVisual(t,e,i,r,s,n=300){let a=new u().displayParent(e).setAlpha(.5).attach(t);E.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;E.createVector(r,c.line.to,p).toSprite().displayParent(a).attach(t);}),new D(a,"alpha",{duration:n,animation:P.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,r,s,n,a=300){let l=new u().displayParent(e).setAlpha(.5).attach(t);E.createElipse(n,helpersLib.ColorHelper.blue).toSprite().displayParent(l).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attach(t),i.forEach(p=>{let m=p.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;E.createVector(p.line.from,p.line.to,m).toSprite().displayParent(l).attach(t);}),new D(l,"alpha",{duration:a,animation:P.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),n=i?.color??helpersLib.ColorHelper.blue,a=new u().displayParent(e).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀcq(c,n).displayParent(a).attachToRoot();}),new D(a,"alpha",{duration:1e3,animation:P.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcq(t,e){switch(t.type){case U__default.default.Shape.PARTICLE:throw new Error("Not implemented");case U__default.default.Shape.LINE:throw new Error("Not implemented");case U__default.default.Shape.PLANE:throw new Error("Not implemented");case U__default.default.Shape.CIRCLE:throw new Error("Not implemented");case U__default.default.Shape.CAPSULE:throw new Error("Not implemented");case U__default.default.Shape.BOX:throw new Error("Not implemented");case U__default.default.Shape.HEIGHTFIELD:throw new Error("Not implemented");case U__default.default.Shape.CONVEX:return this.ƀcp(t,e);default:throw new Error("Not implemented")}}ƀcp(t,e){let i=[t.vertices.map(r=>({x:r[0],y:r[1]}))];return E.createPolygon(i,e).toSprite()}};Q=Mo([d(),Do("design:paramtypes",[nt,Bt])],Q);var Fo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},_o=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Le=class{static{h(this,"HitTestService");}constructor(t){this.ƀju=t;}hitTest(t,e){let i=t.world,r=b.getFromP2BodyIDOrFail(t.id),s=f.cloneP2Body(t);this.ƀs(s,e);let n=i.broadphase.aabbQuery(i,this.ƀdi(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(n.length!==0){let l=new U__default.default.World;l.addBody(s),n.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.ƀju.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀs(t,e){e?.overridePosition&&(t.position=f.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀdi(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};Le=Fo([d(),_o("design:paramtypes",[Q])],Le);var Lo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ne=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀie(t,i);});});}step(t,e,i){b.getPhysicsEntities().forEach(r=>{r.ƀax=[];}),t.p2World.narrowphase.contactEquations.forEach(r=>{this.ƀie(t,r);}),t.bodiesInContactWith.forEach((r,s)=>{this.ƀep(r.p2Body),r.entity.ƀiw(t.collisionReports.get(s)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀep(t){let e=f.arrayToVector(t.velocity);e.length>yi&&(e=e.normalize(yi),t.velocity=f.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-wi),wi);}ƀie(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)||[],n=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀdn(i,r,e);s.push({self:a,target:l}),n.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,s),t.collisionReports.set(e.bodyB.id,n);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀdn(t,e,i){let r=t.convertToDTO(),s=e.convertToDTO(),n=f.arrayToVector(i.contactPointA),a=f.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀec(i);return {collisionDetailsA:this.ƀdm(r,i.bodyA.mass,n,l,t.area),collisionDetailsB:this.ƀdm(s,i.bodyB.mass,a,c,e.area)}}ƀdm(t,e,i,r,s){let n,a=i.add(t.position);return {body:t,getPositionReletiveToObject:h(()=>(n||(n=i.rotate(t.rotation.multiply(-1).vector)),n),"getPositionReletiveToObject"),getPositionOnWorld:h(()=>(a||(a=i.add(t.position)),a),"getPositionOnWorld"),position:i,mass:e,area:s,normal:r}}ƀec(t){let e=f.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};Ne=Lo([d()],Ne);var No=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},jo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},je=class extends re{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};je=No([ut(),jo("design:paramtypes",[Number,Object])],je);var Ho=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},W=1e4,He=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbr(t,new helpersLib.Vector(e.x/2,-W/2),new helpersLib.Vector(e.x+W*2,W),i),this.ƀbr(t,new helpersLib.Vector(e.x/2,e.y+W/2),new helpersLib.Vector(e.x+W*2,W),i),this.ƀbr(t,new helpersLib.Vector(-W/2,e.y/2),new helpersLib.Vector(W,e.y+W*2),i),this.ƀbr(t,new helpersLib.Vector(e.x+W/2,e.y/2),new helpersLib.Vector(W,e.y+W*2),i);}ƀbr(t,e,i,r){return new je(t,{shapeDefinition:{materialName:ot,group:r,shapeType:exports.PhysicsShapeType.Rectangle,shapeData:i},position:e,rotation:helpersLib.Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};He=Ho([d()],He);var Uo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},or=new U__default.default.Material,$o={id:ot,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},Gt=class{static{h(this,"MaterialsService");}createMaterials(t,e,i,r){let s=new Map,n=new Map;if(i.forEach(a=>{s.set(a.id,new U__default.default.Material),n.set(a.id,a);}),s.has(ot))throw new Error(`Material with name ${ot} cannot be defined, pick another name for the material.`);return s.set(ot,or),n.set(ot,$o),this.ƀc(t,e,i,r,s),{materials:s,materialDefinitions:n}}getMaterial(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀea(e,i.materials)}getMaterialDefinition(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀdz(e,i.materialDefinitions)}ƀea(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀdz(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.ƀds(i.map(n=>n.id),r).forEach(n=>{let a=this.ƀea(n.materialA,s),l=this.ƀea(n.materialB,s);t.addContactMaterial(new U__default.default.ContactMaterial(a,l,{friction:n.friction,restitution:n.bounciness,stiffness:n.stiffness,relaxation:n.relaxation}));}),this.ƀd(t,e,i,s);}ƀds(t,e){let i=new Map;e.forEach(s=>{let n=i.get(s.materialA);n||(n=new Map,i.set(s.materialA,n)),n.set(s.materialB,s);});let r=[];return t.forEach((s,n)=>{for(let a=n;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 n=this.ƀea(s.id,r);t.addContactMaterial(new U__default.default.ContactMaterial(n,or,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};Gt=Uo([d()],Gt);var ko=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},zo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ft=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,r,s){this.ƀgg=t,this.ƀah=e,this.ƀy=i,this.ƀay=r,this.ƀhj=s;}createPhysicsWorld(t){let e=new U__default.default.World({gravity:[0,0]}),{materials:i,materialDefinitions:r}=this.ƀgg.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:s,physicsBodyGroupToP2Mask:n}=this.ƀhj.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new v(t.mapSize,t.modifyUpdateCycle,e,i,r,s,n).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&y.cleanUpdateModifier();}).attachToRoot(),this.ƀah.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀay.registerPhysicsWorld(a),t.modifyUpdateCycle?y.registerUpdateModifier((l,c)=>this.ƀjo(a,l,c)):y.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀjo(a,l,c);}).attach(a),a.id}addBody(t,e,i,r,s){let n=v.getInstanceByIDOrFail(t);if(i){let a=this.ƀy.findClosestAvailableSpace(n,e,r);return a?(e.position[0]+=a.x,e.position[1]+=a.y,n.p2World.addBody(e),s&&this.ƀy.onBodyAdded(n,e,r),true):false}else return n.p2World.addBody(e),s&&this.ƀy.onBodyAdded(n,e,r),true}removeBody(t,e){v.getInstanceByID(t)?.p2World.removeBody(e);}ƀjo(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.ƀay.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);}};Ft=ko([d(),zo("design:paramtypes",[Gt,He,nt,Ne,K])],Ft);var Yo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Vt=class{static{h(this,"RayCastingService");}castClosest(t,e,i){let r=new U__default.default.RaycastResult,s=new U__default.default.Ray({mode:U__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.ƀbm(r,e)}castAllFirstContacts(t,e,i){let r=new Map,s=new U__default.default.Ray({mode:U__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(n=>{let a=r.get(n.body);!r.has(n.body)||n.fraction<a.fraction?r.set(n.body,this.ƀbm(n,e)):n.fraction===a.fraction&&a.isExternal()&&r.set(n.body,this.ƀbm(n,e));},"callback")});return t.p2World.raycast(new U__default.default.RaycastResult,s),Array.from(r.values())}ƀbm(t,e){let i=t.fraction,r=f.arrayToVector(t.normal),s,n,a;return {body:t.body,hitPosition:h(()=>(s===void 0&&(s=e.from.lerp(e.to,i)),s),"hitPosition"),hitDistance:h(()=>(n===void 0&&(n=e.length*i),n),"hitDistance"),isExternal:h(()=>(a===void 0&&(a=e.fromTo.dotProduct(r)<0),a),"isExternal"),normal:r,fraction:i,line:e}}};Vt=Yo([d()],Vt);var Xo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},lt=class{static{h(this,"ImpactService");}applyImpulse(t,e,i,r){let s=i.normalize(r),n=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(f.vectorToArray(s),n);}};lt=Xo([d()],lt);var Ko=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Lt=class{static{h(this,"RayCastHitConverterService");}toExplosionHits(t,e=true){let i=new Map;return t.forEach(r=>{r.hits.forEach(s=>{let n=i.get(s.body);if(n){let a=s.fraction<n.closestRaycastHit.fraction?s:n.closestRaycastHit;n.rayCastHits.push(s),i.set(s.body,{hitCount:n.hitCount+1,closestRaycastHit:a,rayCastHits:n.rayCastHits,isExternal:e?n.isExternal:n.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.ƀbn(r,t.length))}ƀbn(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")}}}};Lt=Ko([d()],Lt);var Qo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},qo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},rn=15,Ue=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,r){this.ƀia=t,this.ƀju=e,this.ƀhz=i,this.ƀfd=r;}createElipticExplosion(t,e,i,r,s,n,a){let l=v.getInstanceByIDOrFail(t),c=this.ƀcc(e,i,r,s,a?.hitOnlyClosest===true,l),p=this.ƀhz.toExplosionHits(c,false);return this.ƀq(p,n),a?.testLayerID&&this.ƀju.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,r,a.debugRayDuration),p.map(m=>{let{p2Body:g,...C}=m;return C})}ƀcc(t,e,i,r,s,n){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 m=l.normalize(i.y);a.push(new helpersLib.Line(t,t.add(m))),a.push(new helpersLib.Line(t,t.add(m.multiplyNumber(-1))));let g=Math.round(i.y/rn),C=i.y/(g*2+1)*2,bt=l.normalize(C),se=i.x,ar=Math.pow(i.y,2);return helpersLib.ArrayHelper.createIntegerArray(g).forEach(pt=>{let Pt=C*(pt+1),Ti=bt.multiplyNumber(pt+1),oe=c.normalize(this.ƀek(se,ar,Pt)),ne=t.add(Ti);a.push(new helpersLib.Line(ne,ne.add(oe))),a.push(new helpersLib.Line(ne,ne.add(oe.multiplyNumber(-1))));let ae=t.add(Ti.multiplyNumber(-1));a.push(new helpersLib.Line(ae,ae.add(oe))),a.push(new helpersLib.Line(ae,ae.add(oe.multiplyNumber(-1))));}),a.map(pt=>{if(s){let Pt=this.ƀia.castClosest(n,pt,r);return {line:pt,hits:Pt?[Pt]:[]}}else {let Pt=this.ƀia.castAllFirstContacts(n,pt,r);return {line:pt,hits:Pt}}})}ƀek(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀq(t,e){t.forEach(i=>{i.raycastResults.forEach(r=>{let s,n;r.isExternal()?(s=r.line.fromTo,n=e*2):(s=r.line.fromTo.multiplyNumber(-1),n=e*(1-r.fraction)*8),this.ƀfd.applyImpulse(r.body,r.hitPosition(),s,n);});});}};Ue=Qo([d(),qo("design:paramtypes",[Vt,Q,Lt,lt])],Ue);var sn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},on=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},$e=class{static{h(this,"ExplosionService");}constructor(t,e,i,r){this.ƀia=t,this.ƀju=e,this.ƀhz=i,this.ƀfd=r;}createExplosion(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t),l=this.ƀeh(i),c=this.ƀcc(e,i,r,l,n?.hitOnlyClosest===true,a),p=this.ƀhz.toExplosionHits(c);return this.ƀq(e,i,s,l,p),n?.testLayerID&&this.ƀju.createExplosionDebugVisual(a,n.testLayerID,c,e,i,n.debugRayDuration),p}ƀcc(t,e,i,r,s,n){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 m=this.ƀia.castClosest(n,p,i);return {line:p,hits:m?[m]:[]}}else {let m=this.ƀia.castAllFirstContacts(n,p,i);return {line:p,hits:m}}})}ƀq(t,e,i,r,s){s.forEach(n=>{if(n.isExternal)n.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀfd.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=helpersLib.Vector.fromTo(t,f.arrayToVector(n.p2Body.position)),l=a.length/e,c=i*r*l/2;this.ƀfd.applyImpulse(n.p2Body,n.getHitPosition(),a,c);}});}ƀeh(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};$e=sn([d(),on("design:paramtypes",[Vt,Q,Lt,lt])],$e);var cn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Nt=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)}};Nt=cn([d()],Nt);var pn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},dn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Pi=class{static{h(this,"PhysicsController");}constructor(t,e,i,r,s,n,a,l){this.ƀhq=t,this.ƀhf=e,this.ƀju=i,this.ƀda=r,this.ƀcu=s,this.ƀeu=n,this.ƀhp=a,this.ƀfd=l;}createPhysicsWorld(t){return this.ƀhq.createPhysicsWorld(t)}getMapSize(t){return this.ƀhp.getMapSize(t)}setPaused(t,e){this.ƀhq.setPaused(t,e);}hitTest(t,e){let i=b.getPhysicsInstanceOrFail(t);return this.ƀeu.hitTest(i.p2Body,e)}findPath(t,e,i,r,s){return this.ƀhf.findPathAStar(t,e,i,r,{neighborType:s})}findPathDirection(t,e,i,r){return this.ƀhf.findPathDirection(t,e,i,r)}applyImpulse(t,e,i,r){let s=b.getPhysicsInstanceOrFail(t);this.ƀfd.applyImpulse(s.p2Body,e,i,r);}createExplosion(t,e,i,r,s,n){return this.ƀda.createExplosion(t,e,i,r,s,n)}createElipticExplosion(t,e,i,r,s,n,a){return this.ƀcu.createElipticExplosion(t,e,i,r,s,n,a)}printPathfindingTestGrid(t,e,i,r,s,n){this.ƀju.printPathfindingTestGrid(t,e,i,r,s,n);}};Pi=pn([q({controllerLink:H}),dn("design:paramtypes",[Ft,Bt,Q,$e,Ue,Le,Nt,lt])],Pi);var un=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ke=class{static{h(this,"ShapeCreationService");}createBody(t,e,i,r,s){let n=v.getInstanceByIDOrFail(t);if(!n.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.ƀbt(n,void 0,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Circle:return this.ƀbt(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Polygon:return this.ƀcb(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Rectangle:return this.ƀcd(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);default:{e.shapeDefinition.shapeType;throw new Error(`Unexpected case! "${e.shapeDefinition.shapeType}"`)}}}ƀbt(t,e,i,r,s,n){let a=new U__default.default.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s),radius:e});a.material=i;let l=new U__default.default.Body({type:n==="dynamic"?U__default.default.Body.DYNAMIC:U__default.default.Body.STATIC,mass:r.density,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return l.addShape(a),l}ƀcb(t,e,i,r,s,n){let a=t.physicsBodyGroupToP2Group.get(s),l=t.physicsBodyGroupToP2Mask.get(s),c=e.map(g=>new U__default.default.Convex({vertices:g.map(C=>[C.x,C.y]),collisionGroup:a,collisionMask:l})).map(g=>(g.material=i,g)),p=c.reduce((g,C)=>g+C.area,0),m=new U__default.default.Body({type:n==="dynamic"?U__default.default.Body.DYNAMIC:U__default.default.Body.STATIC,mass:p,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.forEach(g=>m.addShape(g)),m.setDensity(r.density),m}ƀcd(t,e,i,r,s,n){let a=new U__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 U__default.default.Body({type:n==="dynamic"?U__default.default.Body.DYNAMIC:U__default.default.Body.STATIC,mass:l,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.addShape(a),c.setDensity(r.density),c}};ke=un([d()],ke);var fn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},mn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Si=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,r,s){this.ƀhq=t,this.ƀho=e,this.ƀjb=i,this.ƀhp=r,this.ƀhj=s;}createBody(t,e,i,r,s){return this.ƀjb.createBody(t,e,i,r,s)}getMaterial(t,e){return this.ƀho.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀho.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀhj.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀhj.getMaskConstant(t,e)}addBody(t,e,i,r,s){return this.ƀhq.addBody(t,e,i,r,s)}removeBody(t,e){this.ƀhq.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀhp.subscribeToPhysicsStep(t,e)}};Si=fn([q({controllerLink:X}),mn("design:paramtypes",[Ft,Gt,ke,Nt,K])],Si);exports.AnimationFlicker=Oi;exports.AnimationInterpolationFunctions=J;exports.Animations=P;exports.Animator=D;exports.BORDER_MATERIAL_NAME=ot;exports.BardLegendsHardReset=F;exports.Camera=Zt;exports.ClosestAvailableSpaceHelper=Jt;exports.Container=u;exports.ControllerDecorator=q;exports.ControllerLink=$;exports.DEFAULT_SHADER_RESOLUTION=O;exports.DeltaTime=ti;exports.DisplayObjectArray=ci;exports.Entity=k;exports.EntityDecorator=ut;exports.FadeInContent=Gi;exports.FadeInStateAnimation=xe;exports.Game=x;exports.Graphics=E;exports.ImmovablePhysicsEntity=re;exports.MenuEntity=di;exports.MenuUI=te;exports.MenuView=ui;exports.MovableEntity=xi;exports.MovablePhysicsEntity=vi;exports.PathFinder=Yt;exports.PhysicsEntity=b;exports.Placeholder=ai;exports.PositionConversionHelper=Wt;exports.ROTATIONAL_SPEED_LIMIT=wi;exports.RichText=hi;exports.SPEED_LIMIT=yi;exports.Scene=he;exports.SceneDecorator=vr;exports.ScrollAreaUI=fi;exports.ScrollMaskUI=yt;exports.Service=T;exports.ServiceDecorator=d;exports.SingletonEntity=ft;exports.SlideInContent=Hi;exports.SlideInContentByIndex=qe;exports.SlideStateAnimation=Se;exports.Sprite=Y;exports.StateAnimation=we;exports.Text=qt;exports.UpdatableContainer=li;exports.UpdateCycle=y;exports.VectorFieldPathFinder=Xt;exports.VectorSet=xt;exports.View=dt;exports.ViewDecorator=Je;
|
|
67
|
+
}`,e}constructor(t,e){if(super(o.ƀei(),o.ƀdr(t*O)),this.ƀcy=t,this.resolution=O,this.ƀcy=t*O,this.ƀcy<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀcy>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");helpersLib.Comparator.isInteger(this.ƀcy)||(this.ƀcy=Math.floor(this.ƀcy));let i=helpersLib.ColorHelper.normalize(e);this.uniforms.color=new Float32Array([i.red,i.green,i.blue]),this.uniforms.expandSquared=this.ƀcy*this.ƀcy,this.padding=this.ƀcy;}apply(t,e,i,r){this.uniforms.pixelSize=new Float32Array([1/(e.width*O),1/(e.height*O)]),t.applyFilter(this,e,i,r);}};var Pe=class extends L__namespace.Filter{static{h(this,"GlowFilter");}constructor(t){super(),this.resolution=O;let e={blurRadius:1,expand:0,color:helpersLib.ColorHelper.white,blendMode:exports.BlendMode.Screen,...t};this.ƀcz=new be(e.expand,e.color);let i=helpersLib.Comparator.isNumber(e.blurRadius)?new helpersLib.Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀag=new Tt(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀag.blendMode=L__namespace.BLEND_MODES.SCREEN;}apply(t,e,i,r){let s=t.getFilterTexture();this.ƀcz.apply(t,e,s,L__namespace.CLEAR_MODES.CLEAR),this.ƀag.apply(t,s,i,r),t.returnFilterTexture(s);}};var kt=class o{static{h(this,"GlowSpriteGenerator");}static{this.ƀel=new Map;}static createGlowSpriteFromSprite(t,e,i){let r=this.ƀbc(e),s=helpersLib.Comparator.isNumber(r.blurRadius)?new helpersLib.Vector(r.blurRadius,r.blurRadius):r.blurRadius,n=this.ƀdt(t.texture,s,r.expand,r.color,i),a=new L__namespace.Sprite(n);return this.ƀiy(a,helpersLib.Vector.fromVec2(t.anchor),Math.max(s.x,s.y)+r.expand),a.alpha=r.glowAlpha,a.blendMode=r.blendMode,a}static ƀdt(t,e,i,r,s){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(s){let n=`${t.id}-${i}-${e.x}-${e.y}-${r.r}-${r.g}-${r.b}`;if(o.ƀel.has(n))return o.ƀel.get(n);{let a=this.ƀdu(t,e,i,r);return o.ƀel.set(n,a),a}}else return this.ƀdu(t,e,i,r)}static ƀdu(t,e,i,r){let s=new L__namespace.Sprite(t);this.ƀdb(s,Math.max(e.x,e.y)+i),s.filters=[new Pe({blurRadius:e,expand:i,color:r})];let n=x.instance.renderer.generateTexture(s);return n.id=M.insertAsset(n),s.destroy(),n}static ƀiy(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 ƀdb(t,e){if(t.isSprite){let s=new L__namespace.Graphics;t.addChild(s);}let i=t.width,r=t.height;t.calculateBounds=function(){this._bounds.clear(),this._bounds.addFrame(this.transform,-e,-e,i+e,r+e);};}static ƀbc(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:helpersLib.ColorHelper.white,blendMode:exports.BlendMode.Add};return t&&(e={...e,...t}),e}};F.onHardReset.subscribe(()=>{kt.ƀel.clear();}).attachToRoot();var Y=class o extends u{static{h(this,"Sprite");}static createByName(t){let e=x.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new o(e)}static createSnapshotSprite(t){let e=t.ƀhs,i=e.parent;i&&i.removeChild(e);let r=x.instance.renderer.generateTexture(e,{resolution:2,scaleMode:L__namespace.SCALE_MODES.LINEAR,multisample:L__namespace.MSAA_QUALITY.HIGH});i&&i.addChild(e);let n={id:M.insertAsset(r),scale:t.scale,size:t.size,anchor:helpersLib.Vector.zero,destroyAssetOnDestroy:true};return new o(n,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀjy=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀjh=t,this.pixiSprite=new L__namespace.Sprite(M.getAsset(t.id)),this.ƀhs.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.ƀge?.destroy(),this.ƀai?.destroy(),this.ƀjh.destroyAssetOnDestroy&&(M.destroyAsset(this.ƀjh.id),this.ƀht&&M.destroyAsset(this.ƀht.texture.id)),this.ƀht&&!this.ƀht.destroyed&&this.ƀht.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀjy}set textureScale(t){this.ƀjy=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.ƀjh.boundingShapes&&!this.ƀhs.hitArea&&(this.ƀhs.hitArea=new me(this.ƀjh.boundingShapes,this.size,helpersLib.Vector.fromVec2(this.ƀjh.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.baseTexture.mipmap===L__namespace.MIPMAP_MODES.ON}set mipmap(t){t?this.pixiSprite.texture.baseTexture.mipmap=L__namespace.MIPMAP_MODES.ON:this.pixiSprite.texture.baseTexture.mipmap=L__namespace.MIPMAP_MODES.OFF;}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 L__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.ƀht)return this.ƀht.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀht)this.ƀht.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=helpersLib.Vector.fromVec2(this.ƀjh.anchor).to(t);return new helpersLib.Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀht&&(this.ƀht.destroy(),this.ƀht=void 0),t&&(this.ƀht=kt.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀjh.destroyAssetOnDestroy),this.ƀht.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀht.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀhs.addChild(this.ƀht)),this}showBoundingShape(t){return t?this.ƀai||(this.ƀai=this.ƀbs().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀai&&(this.ƀai.destroy(),this.ƀai=void 0),this}getBoundingMask(){if(!this.ƀge){if(!this.ƀjh.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀge=this.ƀbs(),this.ƀge.pixiSprite._maskRefCount=Number.POSITIVE_INFINITY,this.ƀge.pixiSprite.renderable=false,this.ƀge.displayParent(this);}return this.ƀge}ƀbs(){if(!this.ƀjh.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return E.createPolygon(this.ƀjh.boundingShapes,helpersLib.ColorHelper.white).toSprite().attach(this)}download(){let t=x.instance.renderer.extract.canvas(this.ƀhs);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}};var Qe=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},yt=class o extends u{static{h(this,"ScrollMaskUI");}static{this.ƀcr=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 u;r===exports.ScrollDirection.Horizontal?this.ƀby(e,i,s):this.ƀcf(e,i,s),this.ƀge=Y.createSnapshotSprite(s).attach(this),s.destroy(),t.setMask(this.ƀge);}ƀcf(t,e,i){e>0&&this.ƀbv(new helpersLib.Vector(t.x,e)).displayParent(i).attach(i),E.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.ƀbv(new helpersLib.Vector(t.x,e)).setPosition(new helpersLib.Vector(t.x,t.y),{round:false}).setRotation(helpersLib.Radian.get180).displayParent(i).attach(i);}ƀby(t,e,i){e>0&&this.ƀbv(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(0,t.y),{round:false}).setRotation(helpersLib.Radian.get270).displayParent(i).attach(i),E.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.ƀbv(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(t.x,0),{round:false}).setRotation(helpersLib.Radian.get90).displayParent(i).attach(i);}ƀbv(t){let i={id:this.ƀbw(t.y),scale:1,size:t,anchor:{x:0,y:0}};return new Y(i,{textureSize:t,ignoreAnchor:true})}ƀbw(t){let e=JSON.stringify({type:"gradient",length:t}),i=o.ƀcr.get(e);if(!i){let r=document.createElement("canvas");r.width=1,r.height=t;let s=r.getContext("2d");if(s){let n=new Qe;helpersLib.ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${n.multiplierFunction(l/t)})`;s.fillStyle=c,s.fillRect(0,l,1,1);});let a=L__namespace.Texture.from(r);i=M.insertAsset(a),o.ƀcr.set(e,i);}else throw new Error("Canvas context is null")}return i}};exports.SlideStateAnimationState=void 0;(function(o){o[o.Appear=1]="Appear",o[o.Disappear=2]="Disappear";})(exports.SlideStateAnimationState||(exports.SlideStateAnimationState={}));var S;(function(o){o[o.Idle=1]="Idle",o[o.TransitionForward=2]="TransitionForward",o[o.TransitionBackward=3]="TransitionBackward",o[o.Reverting=4]="Reverting";})(S||(S={}));var Se=class extends actionsLib.Attachable{static{h(this,"SlideStateAnimation");}constructor(t){super(),this.ƀn=S.Idle,this.ƀgw=new actionsLib.Action,this.ƀgy=new actionsLib.Action,this.ƀhb={duration:500,animation:P.easeInOutCubic,...t},this.ƀjn=new we({duration:this.ƀhb.duration,animation:this.ƀhb.animation}).onStateChange((e,i)=>this.ƀeq(e,i)).onValueChange(e=>this.ƀer(e)).attach(this);}setIndex(t,e){if(!helpersLib.Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀff===void 0?(this.ƀff=t,this.ƀgw.trigger({state:exports.SlideStateAnimationState.Appear,index:t}),this.ƀjn.setState(t,e)):this.ƀff!==t?this.ƀgn!==t?this.ƀn===S.Idle?(this.ƀn=t>this.ƀff?S.TransitionForward:S.TransitionBackward,this.ƀgn=t,this.ƀgw.trigger({state:exports.SlideStateAnimationState.Appear,index:this.ƀgn}),this.ƀjn.setState(t,e)):this.ƀjn.setState(t,e):this.ƀn===S.Reverting&&this.ƀgn===t&&(this.ƀn=t>this.ƀff?S.TransitionForward:S.TransitionBackward,this.ƀjn.setState(t,e)):(this.ƀn===S.TransitionForward||this.ƀn===S.TransitionBackward)&&(this.ƀn=S.Reverting,this.ƀjn.setState(t,e));}ƀeq(t,e){switch(this.ƀff!==void 0&&this.ƀff!==t&&this.ƀff!==e&&this.ƀgw.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀff}),this.ƀgn!==void 0&&this.ƀgn!==t&&this.ƀgn!==e&&this.ƀgw.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀgn}),e!==void 0&&e!==this.ƀff&&e!==this.ƀgn&&this.ƀgw.trigger({state:exports.SlideStateAnimationState.Appear,index:e}),this.ƀn){case S.Idle:break;case S.TransitionForward:case S.TransitionBackward:e===void 0?(this.ƀn=S.Idle,this.ƀff=this.ƀgn,this.ƀgn=void 0):this.ƀff!==t&&this.ƀeo(t,e);break;case S.Reverting:e===void 0?(this.ƀn=S.Idle,this.ƀgn=void 0):this.ƀff!==e&&this.ƀeo(t,e);break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}ƀer(t){let e=1;(this.ƀn===S.TransitionBackward||this.ƀn===S.Reverting&&this.ƀff!==void 0&&this.ƀgn!==void 0&&this.ƀff>this.ƀgn)&&(e=-1),(this.ƀn===S.Idle||t!==0)&&this.ƀgy.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(-e*t),index:this.ƀff}),this.ƀgn!==void 0&&this.ƀgy.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀgn});}ƀeo(t,e){this.ƀff=t,this.ƀgn=e,this.ƀgy.trigger({value:0,index:this.ƀff}),this.ƀn=this.ƀff<this.ƀgn?S.TransitionForward:S.TransitionBackward;}onStateChange(t){return this.ƀgw.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀgy.subscribe(e=>t(e.value,e.index)).attach(this),this}};exports.ScrollDirection=void 0;(function(o){o[o.Horizontal=1]="Horizontal",o[o.Vertical=2]="Vertical";})(exports.ScrollDirection||(exports.ScrollDirection={}));var qe=class extends u{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀbu=t,this.ƀcm="x",this.ƀbj=new Map,this.ƀhb={duration:300,animation:P.easeInOutCubic,size:new helpersLib.Vector(500,500),margin:20,direction:exports.ScrollDirection.Horizontal,...e};let i=this.ƀhb.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(this.ƀhb.size.x+this.ƀhb.margin*2,this.ƀhb.size.y):new helpersLib.Vector(this.ƀhb.size.x,this.ƀhb.size.y+this.ƀhb.margin*2),r=new u().setPosition(this.ƀhb.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(-this.ƀhb.margin,0):new helpersLib.Vector(0,-this.ƀhb.margin),{round:false}).displayParent(this).attach(this);this.ƀbz(i,this.ƀhb.margin,this.ƀhb.direction,r),this.ƀcm=this.ƀhb.direction===exports.ScrollDirection.Horizontal?"x":"y",this.ƀjn=new Se({duration:this.ƀhb.duration,animation:this.ƀhb.animation}).onStateChange((s,n)=>{if(s===exports.SlideStateAnimationState.Appear){let a=new u().displayParent(this).attach(this);this.ƀbj.set(n,a),this.ƀbu({index:n,container:a});}else {let a=this.ƀbj.get(n);a&&(a.destroy(),this.ƀbj.delete(n));}}).onValueChange((s,n)=>{let a=this.ƀbj.get(n);if(a){let l={x:0,y:0};l[this.ƀcm]=i[this.ƀcm]*s+this.ƀhb.margin,a.setPosition(helpersLib.Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=r;}setIndex(t,e){return this.ƀjn.setIndex(t,e),this}ƀbz(t,e,i,r){new yt(r,new helpersLib.Vector(t.x,t.y),e,i).attach(this);}},Hi=class extends qe{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 xt=class{static{h(this,"VectorSet");}constructor(){this.ƀkk=new Map;}add(t){let e=this.ƀkk.get(t.x);e||(e=new Set,this.ƀkk.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀkk.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀkk.get(t.x);return e?e.delete(t.y):false}};var ti=class{static{h(this,"DeltaTime");}static adjustMultiplier(t,e){return Math.pow(t,e)}};var B=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 Jt=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=B.areaToGridArea(e,i);if(this.ƀar(t,s))return helpersLib.Vector.zero;let n=t.movePositionInsideGrid(s.topLeft),a=helpersLib.Vector.fromTo(s.topLeft,n),l=this.find(t,n,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 xt,s=new helpersLib.Queue(e);for(;s.notEmpty;){let n=s.pop();r.add(n);let a=new helpersLib.Rectangle(n,n.add(i));if(this.ƀar(t,a))return helpersLib.Vector.fromTo(e,n);t.getNeighborPositions(n,helpersLib.GridNeighborType.Ortogonal).forEach(l=>{r.has(l)||s.add(l);});}}static ƀar(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 Wi=class{static{h(this,"PathfinderNode");}constructor(t,e,i,r=void 0){this.position=t,this.distanceFromStart=e,this.distanceToEnd=i,this.parent=r,this.closed=false;}get pathLength(){return this.distanceFromStart+this.distanceToEnd}isEqual(t){return helpersLib.Vector.isEqual(this.position,t)}createSolutionPath(t){let e=[this.position],i=this.parent;for(;i!==void 0;)e.push(i.position),i=i.parent;return e.reverse(),{directPathAvailable:t,path:e}}getDistance(t){return this.position.getDistance(t)}},cs=class{static{h(this,"PathfinderGrid");}constructor(t,e){this.ƀen=t,this.ƀjk=e,this.ƀha=new helpersLib.BinaryHeap("min"),this.ƀav=[],this.ƀgp=new helpersLib.Grid({size:t.size,defaultValue:void 0});let i=new Wi(this.ƀjk,0,Number.MAX_SAFE_INTEGER);this.ƀha.add(i.pathLength,i);}get hasOpenNodes(){return this.ƀha.size>0}getNeighbors(t,e){return this.ƀen.getNeighborPositions(t.position,e).filter(i=>this.ƀen.get(i)).map(i=>this.ƀgp.get(i)||this.ƀca(i))}popLowestPathCostNode(){let t=this.ƀha.pop();return this.ƀha.delete(t),t.closed=true,this.ƀav.push(t),t}changeNodeCost(t,e,i,r){this.ƀha.delete(t),t.distanceFromStart=e,t.distanceToEnd=t.getDistance(i),t.parent=r,this.ƀha.add(t.pathLength,t);}getBestClosedNode(){return this.ƀav.reduce((t,e)=>t.distanceToEnd<e.distanceToEnd?t:e)}ƀca(t){let e=new Wi(t,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);return this.ƀgp.set(t,e),this.ƀha.add(e.pathLength,e),e}},Yt=class{static{h(this,"PathFinder");}static findPath(t,e,i,r){let s=new cs(t,e);for(;s.hasOpenNodes;){let n=s.popLowestPathCostNode();if(n.isEqual(i))return n.createSolutionPath(true);let a=s.getNeighbors(n,r);for(let l of a)if(!l.closed){let c=n.distanceFromStart+n.getDistance(l.position);c<l.distanceFromStart&&s.changeNodeCost(l,c,i,n);}}return s.getBestClosedNode().createSolutionPath(false)}};var Xt=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀjs=t,this.ƀw=e,this.ƀet=this.ƀdw(this.ƀw.size),this.ƀks=new helpersLib.Grid({size:this.ƀw.size,defaultValue:this.ƀet}),this.ƀcn=new helpersLib.Grid({size:this.ƀw.size,defaultValue:void 0});let i=new xt,r=new helpersLib.Queue;for(this.ƀdk(this.ƀw.cropAreaOutsideOfTheGrid(t)).forEach(n=>{this.ƀks.set(n,0),r.add(n);});r.notEmpty;){let n=r.pop();if(!i.has(n)){i.add(n);let a=this.ƀks.getOrFail(n);this.ƀeb(n,this.ƀw).forEach(l=>{if(!i.has(l.position)){let c=this.ƀks.getOrFail(l.position),p=a+l.distance;this.ƀw.getOrFail(l.position)&&p<c&&(this.ƀks.set(l.position,p),r.add(l.position));}});}}}getDirectionToTarget(t){if(!t.isInsideRectangle(this.ƀjs)){if(t=this.ƀks.movePositionInsideGrid(t),this.ƀcn.has(t))return this.ƀcn.get(t);{let e=this.ƀeb(t,this.ƀw),i;return this.ƀks.getOrFail(t)>=this.ƀet?e.some(s=>this.ƀw.get(s.position))&&(e.some(n=>!this.ƀw.get(n.position))?i=this.ƀdq(e):i=this.ƀdl(t,e)):i=this.ƀdl(t,e),this.ƀcn.set(t,i),i}}}ƀdq(t){let e=t.filter(i=>this.ƀw.get(i.position)).map(i=>i.direction.radian);return helpersLib.Radian.getAverage(...e)}ƀdl(t,e){let i=e.filter(r=>this.ƀks.getOrFail(r.position)<this.ƀet).reduce((r,s)=>{let n=this.ƀks.getOrFail(s.position)+s.distance;return n<r.bestWeight?(r.bestDirections=[s.direction],r.bestWeight=n):n===r.bestWeight&&r.bestDirections.push(s.direction),r},{bestDirections:[],bestWeight:this.ƀet}).bestDirections;return this.ƀeg(i,t)}ƀeg(t,e){if(t.length>0){let i=t.reduce((r,s)=>r.add(s),helpersLib.Vector.zero);if(i.isZero()||!this.ƀfl(e,i))return helpersLib.Random.pickRandomElement(t).radian;if(t.length>=1)return i.radian}}ƀfl(t,e){let i=t.add(this.ƀkl(e));return this.ƀw.isPointWithinBounds(i)&&this.ƀw.getOrFail(i)}ƀeb(t,e){return this.ƀks.getNeighborDirections(t,helpersLib.GridNeighborType.All).map(i=>({position:t.add(i),direction:i,distance:i.x!==0&&i.y!==0?14:10}))}ƀdk(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}ƀkl(t){let e=t.normalize().round();return new helpersLib.Vector(e.x,e.y)}ƀdw(t){return (t.x+t.y)*20}};var ms=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},V=class extends ft{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);}};V=ms([ut()],V);var gs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ys=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},It=class extends dt{static{h(this,"CameraView");}constructor(t){super(),this.ƀcw=t,this.ƀim=new u().setAlpha(0).displayParent(x.instance.stage).attach(this),this.ƀac=E.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(x.instance.stage).attach(this),this.ƀaa=new u().displayParent(this.ƀim).attach(this),this.ƀao=new u().displayParent(this.ƀim).attach(this),this.ƀdg=new u().setSortableChildren(true).displayParent(this.ƀim).attach(this),this.ƀan=new u().setSortableChildren(true).displayParent(this.ƀao).attach(this),this.ƀdf=new u().setSortableChildren(true).setZIndex(20).displayParent(this.ƀan).attach(this),this.ƀgc=new u().setSortableChildren(true).setZIndex(10).displayParent(this.ƀan).attach(this),this.ƀz=new u().setZIndex(0).displayParent(this.ƀan).attach(this),this.ƀh=new D(this.ƀim,"alpha",{duration:500,animation:P.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀad=new D(this.ƀac,"alpha",{duration:500,animation:P.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),x.instance.screenSize.subscribe(e=>{this.ƀac.aspectRatio=e.x/e.y,this.ƀac.scale=Math.max(e.x,e.y),this.ƀac.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.zero});}).attach(this),x.instance.setScreenPositionToStagePositionFunction(e=>new helpersLib.Vector(e.x-this.ƀan.position.x-this.ƀao.position.x,e.y-this.ƀan.position.y-this.ƀao.position.y)),this.ƀcw.position.subscribe(e=>{this.ƀan.position=this.ƀbp(e);}).attach(this),this.ƀcw.offset.subscribe(e=>{this.ƀao.position=e;}).attach(this),this.appear(true,"alpha");}destroy(){this.destroyed||(super.destroy(),x.instance.resetScreenPositionToStagePositionFunction());}getLayers(){return {backgroundScreen:this.ƀaa.id,background:this.ƀz.id,main:this.ƀgc.id,foreground:this.ƀdf.id,foregroundScreen:this.ƀdg.id}}appear(t,e){switch(e){case "alpha":return this.ƀad.set({alpha:0}),this.ƀh.set({alpha:t?0:1}),this.ƀh.animate({alpha:t?1:0}).chain(this);case "pureBlack":return this.ƀh.set({alpha:1}),this.ƀad.set({alpha:t?1:0}),this.ƀad.animate({alpha:t?0:1}).chain(this);case "instant":return this.ƀh.set({alpha:t?1:0}),this.ƀad.set({alpha:t?0:1}),actionsLib.SingleEvent.instant();default:{throw new Error('Switch ended with value "never".')}}}ƀbp(t){return helpersLib.Vector.fromTo(t,x.instance.getScreenSizeCenter())}};It=gs([Je({entity:V}),ys("design:paramtypes",[V])],It);var vs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},bs=1500,Ee=class{static{h(this,"CameraService");}createCamera(){return new V().attachToRoot()}getCameraPosition(){let t=V.getInstanceOrFail();return helpersLib.Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=V.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=V.getInstanceOrFail();e.focusingNewTargetInfo.value={time:x.time,duration:t?.duration??bs,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??exports.FocusingAnimation.Instant};}update(t,e){let i=V.getInstanceOrFail(),r=i.targetPosition.value;r&&(i.focusingNewTargetInfo.value?this.ƀfo(i,r,t):i.position.value=r);}ƀfo(t,e,i){let r=t.focusingNewTargetInfo.value;if(r.focusingAnimation===exports.FocusingAnimation.Instant)this.ƀbb(t,e);else {let s=(i-r.time)/r.duration;if(s>=1)this.ƀbb(t,e);else {let n;r.focusingAnimation===exports.FocusingAnimation.EaseInOut?n=J.easeInOut(s):r.focusingAnimation===exports.FocusingAnimation.EaseOut?n=J.easeOut(s):n=1;let a=r.position.lerp(e,n);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;}}}ƀbb(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};Ee=vs([d()],Ee);var Ps=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ss=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},ri=class{static{h(this,"CameraController");}constructor(t){this.ƀap=t;}createCamera(){return this.ƀap.createCamera().id}update(t,e){this.ƀap.update(t,e);}setPosition(t){this.ƀap.setPosition(t);}setTransition(t){this.ƀap.setTransition(t);}getCameraPosition(){return this.ƀap.getCameraPosition()}};ri=Ps([q({controllerLink:gt}),Ss("design:paramtypes",[Ee])],ri);var Ts=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},si=class{static{h(this,"CameraViewController");}getLayers(){let t=V.getInstanceOrFail().id;return It.getInstanceOrFail(t).getLayers()}appear(t,e){let i=V.getInstanceOrFail().id;return It.getInstanceOrFail(i).appear(t,e)}};si=Ts([q({controllerLink:ye})],si);var Zt=class{static{h(this,"Camera");}get position(){return this.ƀam.getCameraPosition()}constructor(){this.ƀam=T.get(exports.CameraGateway),this.ƀaq=T.get(Ut),this.ƀam.createCamera(),this.layers=this.ƀaq.getLayers();}setPosition(t){this.ƀam.setPosition(t);}setTransition(t){this.ƀam.setTransition(t);}appear(t,e="alpha"){return this.ƀaq.appear(t,e)}};var x=class o{static{h(this,"Game");}static get instance(){return this.ƀfi}static{this.pause=actionsLib.Reducer.createOr();}static get camera(){return this.ƀal}static get time(){return y.ƀjz}static get setupOptions(){return this.ƀja}getScreenSize(){return this.ƀiq.value}getScreenSizeCenter(){return this.ƀir.value}constructor(t){if(this.ƀiq=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSize=this.ƀiq.notifier,this.ƀir=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSizeCenter=this.ƀir.notifier,this.devMode=false,this.resetScreenPositionToStagePositionFunction(),o.ƀfi)throw new Error("There can be only one Game instance!");{this.ƀbf={screenResolution:void 0,devMode:false,backgroundColor:helpersLib.ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbf.devMode||false;let e=helpersLib.JsonHelper.removeUndefinedProperties({backgroundColor:this.ƀbf.backgroundColor,autoStart:false,antialias:this.ƀbf.antialias,resolution:this.ƀbf.resolution,width:this.ƀbf.screenResolution?.width,height:this.ƀbf.screenResolution?.height,resizeTo:this.ƀbf.screenResolution===void 0?window:void 0});this.ƀhr=new L__namespace.Application(e);}}async setup(t){o.ƀja=t,document.body.appendChild(this.ƀhr.view),await Promise.all([M.loadGameAssets(t.assetDefinitions)]),o.ƀfi=this,this.stage=new u().attachToRoot(),this.stage.ƀhs=this.ƀhr.stage,this.renderer=this.ƀhr.renderer,this.ƀiz(),this.stage.sortableChildren=true,globalThis.ƀa=this.ƀhr,window.addEventListener("resize",e=>{setTimeout(()=>this.ƀiz());}),o.ƀal=new Zt,this.ƀhr.start(),this.ƀhr.ticker.add(()=>{y.triggerUpdateTick(this.ƀhr.ticker.deltaMS);});}setResolution(t){this.ƀhr.renderer.resolution!==t&&(this.ƀhr.renderer.resolution=t,this.ƀhr.renderer.resize(this.ƀhr.screen.width,this.ƀhr.screen.height));}screenPositonToStagePosition(t){let e=Wt.includeScaleInScreenPosition(t,o.instance.stage.scale,o.instance.getScreenSizeCenter());return this.ƀip(e)}setScreenPositionToStagePositionFunction(t){this.ƀip=t;}resetScreenPositionToStagePositionFunction(){this.ƀip=t=>t;}destroyAsset(t){M.destroyAsset(t);}ƀiz(){let t=new helpersLib.Vector(this.ƀhr.screen.width,this.ƀhr.screen.height);this.ƀiq.value=t,this.ƀir.value=t.multiplyNumber(.5).round();}};var Ce=class{static{h(this,"DashedLineHelper");}static getLines(t,e,i){let r=helpersLib.Vector.fromTo(t,e),s=r.normalize(),n=r.length-i.lineStartGap-i.lineEndGap,a=[];if(n<=0)return a;let l=t.add(s.normalize(i.lineStartGap));if(n<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(s.normalize(n))}),a;let c=n-i.dashGap,p=i.dashLength+i.dashGap,m=Math.floor(c/p),g=c-p*m;m>=1&&g<i.dashLength&&(g+=p,m--);let C=s.normalize(g/2),bt=s.normalize(i.dashGap);if(a.push({from:l,to:l.add(C)}),l=l.add(C),m>0){let se=s.normalize(i.dashLength);helpersLib.ArrayHelper.createEmptyArray(m).forEach(()=>{l=l.add(bt),a.push({from:l,to:l.add(se)}),l=l.add(se);});}return l=l.add(bt),a.push({from:l,to:l.add(C)}),a}};var E=class o extends u{static{h(this,"Graphics");}static{this.ƀcr=new Map;}static createArrow(t,e){let i=new L__namespace.Graphics,r=[[{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}]];return i.beginFill(e),r.forEach(s=>{i.drawPolygon(s.map(n=>new L__namespace.Point(n.x,n.y)));}),i.endFill(),new o(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 L__namespace.Graphics;return s.lineStyle(r.width,r.color),Ce.getLines(t,e,r).forEach(a=>{s.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),new o(s,JSON.stringify({type:"dashedLine",from:t,to:e,options:r}))}static createVector(t,e,i){let r=new L__namespace.Graphics;return r.lineStyle(2,i),r.moveTo(t.x,t.y),r.lineTo(e.x,e.y),r.lineStyle(1,i),r.beginFill(helpersLib.ColorHelper.white),r.drawCircle(t.x,t.y,3),r.endFill(),new o(r,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let r=new L__namespace.Graphics;return r.beginFill(i),r.drawRect(0,0,t.x,e),r.drawRect(0,e,e,t.y-e*2),r.drawRect(t.x-e,e,e,t.y-e*2),r.drawRect(0,t.y-e,t.x,e),r.endFill(),new o(r,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=helpersLib.ColorHelper.white){let i=new L__namespace.Graphics;return i.beginFill(e),i.drawRect(0,0,t.x,t.y),i.endFill(),new o(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new L__namespace.Graphics;return i.beginFill(e),i.drawCircle(0,0,t),i.endFill(),new o(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new L__namespace.Graphics;return i.beginFill(e),i.drawEllipse(0,0,t.x,t.y),i.endFill(),new o(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new L__namespace.Graphics,r=JSON.stringify({type:"polygon",polygon:t,color:e});return i.beginFill(e),t.forEach(s=>{i.drawPolygon(s.map(n=>new L__namespace.Point(n.x,n.y)));}),i.endFill(),new o(i,r)}static createRegularPolygon(t,e,i){let r=new L__namespace.Graphics,s=new helpersLib.Radian(helpersLib.PI_360/t);r.beginFill(i),r.moveTo(e,0);for(let n=1;n<=t;n++){let l=s.multiply(n).vector.normalize(e),c=e+l.x,p=e+l.y;r.lineTo(c,p);}return r.endFill(),new o(r,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.ƀhs.addChild(t),this.pixiGraphics=t,this.ƀak=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀak,cache:false,...t},i=this.ƀef(e.cacheName,e.cache),r={id:i.assetID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},s=new Y(r,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),s}ƀef(t,e){if(e){let i=o.ƀcr.get(t);return i||(i=this.ƀce(),o.ƀcr.set(t,i)),i}else return this.ƀce()}ƀce(){let t=x.instance.renderer.generateTexture(this.pixiGraphics);t.id=M.insertAsset(t);let e=this.pixiGraphics.getBounds();return {assetID:t.id,bounds:new helpersLib.Vector(e.x,e.y)}}};var ai=class extends u{static{h(this,"Placeholder");}constructor(t){super(),this.ƀhu=new L__namespace.Graphics,this.ƀhu.beginFill(0,1e-9),this.ƀhu.drawRect(0,0,t.x,t.y),this.ƀhu.endFill(),this.ƀhs.addChild(this.ƀhu);}destroy(){this.destroyed||(super.destroy(),this.ƀhu.destroy());}};var At=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:true,dropShadowBlur:s.blur,dropShadowAngle:s.angle.value,dropShadowDistance:s.distance,dropShadowColor:helpersLib.ColorHelper.rgbToHex(s.color),dropShadowAlpha: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 Ie=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.ƀfe(r,e),n=this.ƀr(s);return this.ƀjf(n)}static ƀfe(t,e){let i=new Map,r=new Map,s=h((a,l)=>{if(r.has(l))return r.get(l);let c=At.getPixiTextStyle(a);return r.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀdo(a.tags,e,i),p=s(l,c),m=L__namespace.TextMetrics.measureText(" ",new L__namespace.TextStyle(p),false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:m.width}})}static ƀdo(t,e,i){let r=t.join("+");if(i.has(r))return {style:i.get(r),cacheKey:r};let s=this.ƀba(t,e);return i.set(r,s),{style:s,cacheKey:r}}static ƀba(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:n,...a}=i;return a}static ƀr(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 ƀjf(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.ƀjg(s.text).map(a=>{let l=new L__namespace.TextStyle(s.pixiStyle),c=L__namespace.TextMetrics.measureText(a,l,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 ƀjg(t){if(t==="")return [""];let e=[],i="",r=t[0]===" ";for(let s=0;s<t.length;s++){let n=t[s],a=n===" ";a===r?i+=n:(e.push(i),i=n,r=a);}return i&&e.push(i),e}};var Ae=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀci.length===0}get remainingWidth(){return this.ƀkt-this.ƀck}constructor(t,e){this.ƀkt=t,this.ƀfw=[],this.ƀci=[],this.ƀck=0,this.ƀfv=new helpersLib.Vector(0,0),this.ƀcj=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀew=i.horizontalAlignment,this.ƀkm=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀkt||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀcl={direction:i.rectangleCutOption.direction,rectangle:this.ƀbo(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀcj,t.y),i=this.ƀdx(this.ƀfv.y,this.ƀfv.y+e);return this.ƀck+t.x<=i}insertWord(t){let e=Math.max(this.ƀcj,t.style.height);if(this.ƀci.length===0){let i=this.ƀdy(this.ƀfv.y,this.ƀfv.y+e);this.ƀfv=new helpersLib.Vector(i,this.ƀfv.y),this.ƀck=this.ƀfv.x;}this.ƀci.push({chunk:t,position:new helpersLib.Vector(this.ƀck,this.ƀfv.y)}),this.ƀcj=e,this.ƀck+=t.style.width;}newLine(){let t=this.ƀfv.y+this.ƀcj,e=this.ƀdy(t,t);this.ƀdd(),this.ƀfv=new helpersLib.Vector(e,t),this.ƀck=this.ƀfv.x,this.ƀcj=0;}print(){return this.ƀdd(),this.ƀfw}ƀdd(){this.ƀci.length>0&&(this.ƀfw.push(this.ƀg(this.ƀci)),this.ƀci=[]);}ƀg(t){return t=this.ƀko(t),t=this.ƀey(t),t}ƀey(t){if(this.ƀew==="left")return t;let e=this.ƀfv.y+this.ƀcj,i=this.ƀdy(this.ƀfv.y,e),s=this.ƀdx(this.ƀfv.y,e)-i,n=Math.min(s,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀew==="center"?a=(s-n)/2:a=s-n,t.map(l=>(l={chunk:l.chunk,position:new helpersLib.Vector(l.position.x+a,l.position.y)},l))}ƀko(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.ƀkm){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.ƀkm;throw new Error(`Unexpected case! "${this.ƀkm}"`)}}return r={chunk:r.chunk,position:new helpersLib.Vector(r.position.x,r.position.y+s)},r})}ƀdy(t,e){return this.ƀcl&&(this.ƀcl.direction==="topLeft"||this.ƀcl.direction==="bottomLeft")&&(this.ƀcl.rectangle.isPointInside(new helpersLib.Vector(0,t),{includeEdges:false})||this.ƀcl.rectangle.isPointInside(new helpersLib.Vector(0,e),{includeEdges:false}))?this.ƀcl.rectangle.bottomRight.x:0}ƀdx(t,e){return this.ƀcl&&(this.ƀcl.direction==="topRight"||this.ƀcl.direction==="bottomRight")&&(this.ƀcl.rectangle.isPointInside(new helpersLib.Vector(this.ƀkt,t),{includeEdges:false})||this.ƀcl.rectangle.isPointInside(new helpersLib.Vector(this.ƀkt,e),{includeEdges:false}))?this.ƀcl.rectangle.topLeft.x:this.ƀkt}ƀbo(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(`Unexpected case! "${t.direction}"`)}}return new helpersLib.Rectangle(e,i)}};var Oe=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 n=i[i.length-1];e.isSpaceAvailable(new helpersLib.Vector(n.style.width+r.style.width,n.style.height))?e.insertWord(r):this.ƀku(r,e);}else e.insertWord(r);else e.lineIsEmpty?e.insertWord(r):r.whitespace?this.ƀku(r,e):(e.newLine(),e.insertWord(r));}),e.newLine();}),e.print()}static ƀku(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 n={text:" ".repeat(r),whitespace:true,style:{...t.style,width:r*t.style.spaceWidth}};e.insertWord(n);}e.newLine();let s=t.text.length-r-1;if(s>0){let n={text:" ".repeat(s),whitespace:true,style:{...t.style,width:s*t.style.spaceWidth}};e.insertWord(n);}}};var Me=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀgj(t),t=this.ƀkd(t),this.ƀat(t)}static ƀgj(t){return t.map(e=>{let i=[],r,s=true;return e.forEach(n=>{if(!r||r.chunk.style.cacheKey!==n.chunk.style.cacheKey)r&&i.push(r),r=n,s=n.chunk.whitespace;else {let a=r.chunk.text+n.chunk.text;s=n.chunk.whitespace&&s,r={chunk:{text:a,whitespace:s,style:{...r.chunk.style,width:r.chunk.style.width+n.chunk.style.width}},position:r.position};}}),r&&i.push(r),i})}static ƀkd(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 ƀat(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 Qt=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=Ie.process(t,e),r=helpersLib.JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),s=new Ae(e.default.wordWrapWidth??1/0,r),n=Oe.wrapText(i,s);return Me.process(n)}};var js=1,Xi=1/js,qt=class extends u{static{h(this,"Text");}get ƀjw(){if(!this.ƀjx){let t=new L__namespace.TextStyle(this.ƀhw);this.ƀjx=L__namespace.TextMetrics.measureText(this.ƀjv,t);}return this.ƀjx}get ascent(){return this.ƀjw.fontProperties.ascent}constructor(t,e){super(),this.ƀhw=At.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀhv.destroyed&&this.ƀhv.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new helpersLib.Vector(this.ƀhv.anchor.x,this.ƀhv.anchor.y)}set anchor(t){this.ƀi=t,this.ƀhv.anchor.set(t.x,t.y);}setText(t){return this.ƀjv!==t&&(this.ƀjv=t,this.ƀid()),this}setColor(t){let e=helpersLib.ColorHelper.rgbToHex(t);return this.ƀhw.fill!==e&&(this.ƀhw.fill=e,this.ƀid()),this}ƀid(){this.ƀhv?.destroy(),this.ƀjq?.destroy(),this.ƀjq=void 0,this.ƀjx=void 0;let t=new L__namespace.TextStyle(this.ƀhw);this.ƀhv=new L__namespace.Text(this.ƀjv,t),this.ƀih(),this.ƀi&&this.ƀhv.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀhv.scale.set(Xi,Xi),this.ƀhs.addChild(this.ƀhv),this.ƀhw.lineThrough&&(this.ƀjq=this.ƀe(this.ƀhv,this.ƀhw.fill),this.ƀhs.addChild(this.ƀjq));}ƀih(){let t=L__namespace.TextMetrics.measureText(this.ƀjv,new L__namespace.TextStyle({...this.ƀhw,dropShadow:false,dropShadowAlpha:0,dropShadowBlur:0,dropShadowDistance:0}));this.ƀhv.calculateBounds=function(){this.updateText(true),this._bounds.clear();let e=-this.anchor.x*t.width,i=-this.anchor.y*t.height;this._bounds.addFrame(this.transform,e,i,e+t.width,i+t.height);};}ƀe(t,e){let i=L__namespace.TextMetrics.measureText(t.text,t.style),r=Math.max(1,Math.round(i.lineHeight*.07)),s=r%2*.5,n=new L__namespace.Graphics;n.lineStyle(r,e);let a=0;return i.lines.forEach((l,c)=>{let p=L__namespace.TextMetrics.measureText(l,t.style),m=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+s,g=0;t.style.align==="center"?g=0+(t.width-p.width)*.5:t.style.align==="right"&&(g=0+t.width-p.width),g=Math.floor(g),n.moveTo(Math.floor(g),m),n.lineTo(Math.floor(g+p.width),m),a+=p.lineHeight;}),n.endFill(),n}};var hi=class extends u{static{h(this,"RichText");}constructor(t,e){super(),Qt.process(t,e).forEach(r=>new qt(r.text,r.style).setPosition(r.position).displayParent(this).attach(this));}};var li=class extends u{static{h(this,"UpdatableContainer");}},ci=class extends u{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀbu=t,this.ƀco=new Map,this.ƀhb={trackBy:h((i,r)=>r,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀco.keys()),i=0;t.forEach((r,s)=>{let n=this.ƀhb.trackBy(r,s),a;this.ƀco.has(n)?(a=this.ƀco.get(n),e.delete(n),a.update(r)):(a=this.ƀbu(r).displayParent(this).attach(this),this.ƀco.set(n,a)),this.ƀhb.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀhb.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀhb.positioning.spacing);}),e.forEach(r=>{this.ƀco.get(r).destroy(),this.ƀco.delete(r);});}};var te=class o extends u{static{h(this,"MenuUI");}static{this.ƀfk=actionsLib.Reducer.createExistenceChecker();}static{this.isAnyMenuTransitioning=this.ƀfk.notifier;}static getIsAnyMenuTransitioning(){return o.ƀfk.value}constructor(t,e){super(),this.ƀgt=new actionsLib.SingleAction,this.onCreate=this.ƀgt.notifier,this.ƀgv=new actionsLib.SingleAction,this.onOpen=this.ƀgv.notifier,this.ƀgq=new actionsLib.SingleAction,this.onClose=this.ƀgq.notifier,this.ƀaw=false;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.setAlpha(0),this.ƀo=new D(this,"alpha",{animation:P.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState});let r=E.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(i.backgroundDarkeningRatio).setInteractive(true).displayParent(this).attach(this);this.ƀgh=Y.createByName(t).setPosition(new helpersLib.Vector(0,0)).setInteractive(true).displayParent(this).attach(this),x.instance.screenSize.subscribe(n=>{r.aspectRatio=n.x/n.y,r.scale=Math.max(n.x,n.y),r.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.half}),this.setPosition(n.multiplyNumber(.5));}).attach(this),this.ƀgt.resolve();let s=o.ƀfk.effect().attach(this);this.ƀo.animate({alpha:1}).chain(this).tap(()=>{this.ƀgv.resolve(),s.destroy(),i.closeOnBackgroundClick&&r.on(exports.ContainerEventType.Click).take(1).tap(()=>this.close()).attach(this);}).attachToRoot();}getBoundingMask(){return this.ƀgh.getBoundingMask()}close(){if(!this.ƀaw){this.ƀaw=true;let t=o.ƀfk.effect().attach(this);this.ƀo.animate({alpha:0}).chain(this).map(()=>{this.ƀgq.resolve(),t.destroy(),this.destroy();}).chainToRoot();}return this.onClose.toSingleEvent().destroyIfNotAttached()}};var di=class extends ft{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.ƀhb=t,queueMicrotask(()=>{if(!this.ƀgi)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀif(t){this.ƀgi=t,this.ƀgi.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀgi.onCreate.toSingleEvent().destroyIfNotAttached()}onOpen(){return this.ƀgi.onOpen.toSingleEvent().destroyIfNotAttached()}onClose(){return this.ƀgi.onClose.toSingleEvent().destroyIfNotAttached()}close(){return this.ƀgi.close()}};var ui=class extends dt{static{h(this,"MenuView");}constructor(t,e,i){super();let r=helpersLib.JsonHelper.removeUndefinedProperties({appearAnimationDuration:i.appearAnimationDuration,backgroundDarkeningRatio:i.backgroundDarkeningRatio,closeOnBackgroundClick:t.ƀhb.closeOnBackgroundClick}),s=new te(e,r).displayParent(x.camera.layers.foregroundScreen).attach(this);t.ƀif(s);let n=new actionsLib.SingleAction;s.onCreate.subscribe(()=>n.resolve(s)).attach(this),this.onCreate=n.notifier,this.onOpen=s.onOpen.notifier,this.onClose=s.onClose.notifier;}};var Ys=.65,Xs=.01,Be=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀis}get contentSize(){return this.ƀbh.size.ceil()}constructor(t,e,i,r){this.ƀbh=t,this.ƀu=e,this.ƀhe=i,this.ƀje=r,this.ƀfh=false,this.ƀis=e-i*2,this.ƀbh.y=i,this.ƀjr=i;}onWheel(t){this.setTarget(this.ƀjr-t*Ys);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀjr=helpersLib.NumberHelper.clamp(t,this.ƀu-this.ƀhe-this.contentSize.y,this.ƀhe);}jumpToTarget(){this.ƀbh.y=this.ƀjr;}update(t){let e=this.contentSize;if(e.y<=this.ƀis){switch(this.ƀje){case "start":this.ƀjr=this.ƀhe;break;case "center":this.ƀjr=(this.ƀu-e.y)*.5;break;case "end":this.ƀjr=this.ƀu-e.y-this.ƀhe;break;default:{this.ƀje;throw new Error(`Unexpected case! "${this.ƀje}"`)}}this.ƀfh||(this.ƀbh.y=this.ƀjr);}this.ƀfh=true;let i=this.ƀjr-this.ƀbh.y;this.ƀbh.y=this.ƀbh.y+i*Xs*t;}};var Zs=15,fi=class extends u{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbi}get contentSize(){return this.ƀit.contentSize}constructor(t,e={}){super();let i={padding:Zs,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 u().displayParent(this).attach(this);new yt(r,t,i.padding).attach(this);let s=new L__namespace.Graphics;s.beginFill(0,1e-9),s.drawRect(0,0,t.x,t.y),s.endFill(),r.ƀhs.addChild(s);let n=new u().displayParent(r).attach(this);this.ƀit=new Be(n,t.y,i.padding,i.smallContentAlign),this.ƀbi=new helpersLib.Vector(t.x,this.ƀit.scrollHeight),s.eventMode="dynamic",s.addEventListener("wheel",a=>{this.ƀit.onWheel(a.deltaY);}),n.setInteractive(true),n.ƀhs.addEventListener("wheel",a=>{this.ƀit.onWheel(a.deltaY);}),y.afterSceneUpdateAction.subscribe(a=>this.ƀit.update(a.delta)).attach(this),this.addChildTo=n;}scrollToTop(t){this.ƀit.scrollToTop(),t?.instant&&this.ƀit.jumpToTarget();}scrollToBottom(t){this.ƀit.scrollToBottom(),t?.instant&&this.ƀit.jumpToTarget();}};var Qs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},qs=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.KeyboardService=class mi{static{h(this,"KeyboardService");}constructor(){this.ƀfr=new actionsLib.Action,this.keyPressed=this.ƀfr.notifier,this.ƀfs=new actionsLib.Action,this.keyReleased=this.ƀfs.notifier,this.ƀfy=new Set,this.ƀfx=new Set,window.addEventListener("keydown",t=>{this.ƀfy.add(t.key),this.ƀfx.add(t.key),!t.repeat&&this.ƀfr.trigger(t.key);}),window.addEventListener("keyup",t=>{this.ƀfy.delete(t.key),this.ƀfs.trigger(t.key);}),window.addEventListener("blur",()=>{this.ƀfy.clear();}),y.afterSceneUpdateAction.subscribe(()=>{this.ƀfx.clear();}).attachToRoot();}isKeyDown(t){return this.ƀfy.has(t)}isKeyJustPressed(t){return this.ƀfx.has(t)}};exports.KeyboardService=Qs([d(),qs("design:paramtypes",[])],exports.KeyboardService);var to=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},eo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.MouseService=class ie{static{h(this,"MouseService");}get initialMouseMoveHappened(){return this.ƀfg.value}getStagePosition(){return this.ƀji.value}getScreenPosition(){return this.ƀio.value}getMainButtonState(){return this.ƀgb.value}getSecondaryButtonState(){return this.ƀiu.value}constructor(){this.ƀfg=new actionsLib.Variable(false),this.onInitialMouseMove=this.ƀfg.notifier,this.ƀji=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀji.notifier,this.ƀio=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀio.notifier,this.ƀgb=new actionsLib.Variable(false),this.mainButtonState=this.ƀgb.notifier,this.ƀiu=new actionsLib.Variable(false),this.secondaryButtonState=this.ƀiu.notifier,this.ƀjj(),window.addEventListener("pointerdown",t=>{t.button===0?this.ƀgb.value=true:t.button===2&&(this.ƀiu.value=true);},{capture:true}),window.addEventListener("pointerup",t=>{t.button===0?this.ƀgb.value=false:t.button===2&&(this.ƀiu.value=false);},{capture:true}),window.addEventListener("blur",()=>{this.ƀgb.value=false,this.ƀiu.value=false;},{capture:true});}ƀjj(){let t=helpersLib.Vector.zero;window.addEventListener("pointermove",e=>{t=new helpersLib.Vector(e.clientX,e.clientY),this.ƀfg.value=true;},{capture:true}),y.beforeSceneUpdateAction.subscribe(()=>{this.ƀio.value=t;}).attachToRoot(),y.afterSceneUpdateAction.subscribe(()=>{let e=x.instance.screenPositonToStagePosition(this.ƀio.value);e.isEqual(this.ƀji.value)?x.instance.renderer.events.onPointerMove(new PointerEvent("pointermove",{clientX:this.ƀio.value.x,clientY:this.ƀio.value.y,pointerType:"mouse"})):this.ƀji.value=e;}).attachToRoot();}};exports.MouseService=to([d(),eo("design:paramtypes",[])],exports.MouseService);var io=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ro=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.MouseTargetFocusService=class gi{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀde}get lastFocusedPosition(){return this.ƀfu}constructor(t){this.ƀgl=t,this.ƀgx=new actionsLib.Action,this.onTargetFocus=this.ƀgx.notifier,this.ƀkb=0,this.ƀkc=false,this.ƀde=false,this.ƀfu=void 0,y.beforeSceneUpdateAction.subscribe(e=>this.ƀkf(e.delta)).attachToRoot();}ƀkf(t){if(this.ƀgm){let e=this.ƀee(this.ƀgl.getStagePosition(),this.ƀgm);this.ƀhg===void 0?this.ƀhg=e:this.ƀas(e,t);}this.ƀgm=this.ƀgl.getStagePosition();}ƀas(t,e){this.ƀhg-t>10?(this.ƀkb=Math.max(250,this.ƀkb),this.ƀkc=true):this.ƀkb>1e3&&(this.ƀkc=true);let i=this.ƀkb>=300&&this.ƀkc;this.ƀfp(i,t,e);}ƀfp(t,e,i){(t||e>this.ƀhg)&&(this.ƀhg=e),t?(this.ƀkc=false,this.ƀkb=0,this.ƀde=true,this.ƀfu=this.ƀgl.getStagePosition(),this.ƀgx.trigger(this.ƀfu)):(this.ƀkb+=i,this.ƀde=false);}ƀee(t,e){let i=helpersLib.Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};exports.MouseTargetFocusService=io([d(),ro("design:paramtypes",[exports.MouseService])],exports.MouseTargetFocusService);var yi=10.8,wi=10.01;exports.PhysicsShapeType=void 0;(function(o){o[o.Point=1]="Point",o[o.Circle=2]="Circle",o[o.Polygon=3]="Polygon",o[o.Rectangle=4]="Rectangle";})(exports.PhysicsShapeType||(exports.PhysicsShapeType={}));var f=class o{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=>o.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new U__default.default.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var ot="border";var lo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},X=new $,Mt=class{static{h(this,"PhysicsInternalGateway");}createBody(t,e,i,r,s){return X.trigger("createBody",t,e,i,r,s)}getMaterial(t,e){return X.trigger("getMaterial",t,e)}getMaterialDefinition(t,e){return X.trigger("getMaterialDefinition",t,e)}getGroupConstant(t,e){return X.trigger("getGroupConstant",t,e)}getMaskConstant(t,e){return X.trigger("getMaskConstant",t,e)}addBody(t,e,i,r,s){return X.trigger("addBody",t,e,i,r,s)}removeBody(t,e){return X.trigger("removeBody",t,e)}subscribeToPhysicsStep(t,e){return X.trigger("subscribeToPhysicsStep",t,e)}};Mt=lo([d()],Mt);var b=class o extends k{static{h(this,"PhysicsEntity");}static{this.ƀhd=new Map;}static{this.ƀhk=new Map;}static getFromP2BodyID(t){return o.ƀhd.get(t)}static getFromP2BodyIDOrFail(t){let e=o.ƀhd.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=o.ƀhk.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(o.ƀhk.values())}get area(){return this.ƀt}get mass(){return this.ƀgf}get collisions(){return this.ƀax}constructor(t,e,i){super(),this.ƀgr=new actionsLib.Action,this.onCollision=this.ƀgr.notifier,this.type="dynamic",this.ƀt=0,this.ƀgf=0,this.ƀax=[],this.physicsWorldID=t,this.ƀhm=T.get(Mt);let r=this.ƀhm.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀhm.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀhl=this.ƀhm.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀhn=this.ƀhm.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀhm.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀt=this.p2Body.getArea(),this.ƀgf=this.p2Body.mass,this.p2Body.position=f.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀhm.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!");o.ƀhd.set(this.p2Body.id,this),o.ƀhk.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀhm.removeBody(this.physicsWorldID,this.p2Body),o.ƀhd.delete(this.p2Body.id),o.ƀhk.delete(this.id));}canCollideWith(t){return f.arePhysicsGroupsCollidable(this.ƀhl,this.ƀhn,t.ƀhl,t.ƀhn)}ƀiw(t){this.ƀax=t,t.length>0&&this.ƀgr.trigger(t);}};var re=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 xi=class extends k{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),y.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀjo(t,e);}).attach(this);}ƀjo(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 vi=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.ƀez=false,this.ƀfa=false,this.ƀfc=false,this.ƀfb=false,this.ƀhh(),this.ƀfz(),T.get(Mt).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀjo(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}}ƀjo(t,e){this.ƀez=true,this.ƀfa=true,this.ƀfc=true,this.ƀfb=true,this.ƀhh();}ƀhh(){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;}ƀfz(){this.position.subscribe(t=>{this.ƀez?this.ƀez=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfa?this.ƀfa=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfc?this.ƀfc=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfb?this.ƀfb=false:this.p2Body.angularVelocity=t;}).attach(this);}};var fo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},mo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},v=class extends k{static{h(this,"PhysicsWorldEntity");}constructor(t,e,i,r,s,n,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=n,this.physicsBodyGroupToP2Mask=a;}};v=fo([ut(),mo("design:paramtypes",[helpersLib.Vector,Boolean,U__default.default.World,Map,Map,Map,Map])],v);var xo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},K=class{static{h(this,"PhysicsBodyGroupService");}createBodyGroupsAndMasks(t,e){let i=new Map,r=new Map;return t.map((s,n)=>{if(n>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(s,1<<n),r.set(s,0);}),e.map(([s,n])=>{if(!i.has(s))throw new Error(`Physics body group "${s}" not found`);if(!i.has(n))throw new Error(`Physics body group "${n}" not found`);let a=r.get(s),l=r.get(n),c=i.get(s),p=i.get(n);r.set(s,a|p),r.set(n,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),n=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (s&n)!==0&&(a&r)!==0}};K=xo([d()],K);var vo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},bo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ve=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀhj=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((r,s)=>{r.forEach((n,a)=>{this.ƀhj.canCollide(t,a,e)&&i.push({grid:n,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();}};Ve=vo([d(),bo("design:paramtypes",[K])],Ve);var Po=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},So=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},nt=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀhj=t,this.ƀx=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let r=f.aabbToBoundingBox(e.aabb);this.ƀx.getCollidableGrids(t,i).forEach(s=>{let n=B.areaToGridArea(r,s.cellSize);s.grid.setArea(n,false);});}findClosestAvailableSpace(t,e,i,r=Dt){return e.aabbNeedsUpdate=true,e.updateAABB(),Jt.findByConvertingGridSpace(this.getAvilabilityGrid(t,r,i),f.aabbToBoundingBox(e.aabb),r)}getAvilabilityGrid(t,e,i){let r=this.ƀx.get(t,e,i);return r||(r=this.ƀbx(t,e,i),this.ƀx.set(t,e,i,r)),r}ƀbx(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 n=b.getFromP2BodyIDOrFail(s.id);if(n.includeInPathfinding&&this.ƀhj.canCollide(t,n.physicsBodyGroup,i)){let a=this.ƀdv(s,e);r.setArea(a,false);}}),r}ƀdv(t,e){let i=f.aabbToBoundingBox(t.aabb);return B.areaToGridArea(i,e)}};nt=Po([d(),So("design:paramtypes",[K,Ve])],nt);var Co=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ro=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Dt=50,Bt=class{static{h(this,"PathFinderService");}constructor(t){this.ƀhi=t;}findPathAStar(t,e,i,r,s){s||(s={}),s.neighborType===void 0&&(s.neighborType=helpersLib.GridNeighborType.Ortogonal),s.gridCellSize===void 0&&(s.gridCellSize=Dt);let n=v.getInstanceByIDOrFail(t),a,l;helpersLib.Comparator.isNumber(i)?(l=b.getPhysicsInstanceOrFail(i).p2Body,a=f.arrayToVector(l.position)):a=i;let c=B.positionToGridPosition(e,s.gridCellSize),p=B.positionToGridPosition(a,s.gridCellSize),m=this.ƀhi.getAvilabilityGrid(n,s.gridCellSize,r);if(l){let C=f.aabbToBoundingBox(l.aabb),bt=B.areaToGridArea(C,s.gridCellSize);m.setArea(bt,true);}let g=Yt.findPath(m,c,p,s.neighborType);return g.path=g.path.map(C=>B.gridPositionToPosition(C,s.gridCellSize)),g}findPathDirection(t,e,i,r,s=Dt){let n=v.getInstanceByIDOrFail(t),a;if(helpersLib.Comparator.isNumber(i)){let g=b.getPhysicsInstanceOrFail(i);a=f.aabbToBoundingBox(g.p2Body.aabb);}else a=new helpersLib.Rectangle(i,i);let l=B.areaToGridArea(a,s),c=JSON.stringify({targetGridArea:l,collidableWithGroup:r}),p=n.vectorFieldCache.get(c);if(!p){let g=this.ƀhi.getAvilabilityGrid(n,s,r);p=new Xt(l,g),n.vectorFieldCache.set(c,p);}let m=B.positionToGridPosition(e,s);return p.getDirectionToTarget(m)}};Bt=Co([d(),Ro("design:paramtypes",[nt])],Bt);var Oo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},H=new $;exports.PhysicsGateway=class bi{static{h(this,"PhysicsGateway");}createPhysicsWorld(t){return H.trigger("createPhysicsWorld",t)}getMapSize(t){return H.trigger("getMapSize",t)}setPaused(t,e){return H.trigger("setPaused",t,e)}hitTest(t,e){return H.trigger("hitTest",t,e)}findPath(t,e,i,r,s){return H.trigger("findPath",t,e,i,r,s)}findPathDirection(t,e,i,r){return H.trigger("findPathDirection",t,e,i,r)}applyImpulse(t,e,i,r){return H.trigger("applyImpulse",t,e,i,r)}createExplosion(t,e,i,r,s,n){return H.trigger("createExplosion",t,e,i,r,s,n)}createElipticExplosion(t,e,i,r,s,n,a){return H.trigger("createElipticExplosion",t,e,i,r,s,n,a)}printPathfindingTestGrid(t,e,i,r,s,n=Dt){return H.trigger("printPathfindingTestGrid",t,e,i,r,s,n)}};exports.PhysicsGateway=Oo([d()],exports.PhysicsGateway);var Mo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Do=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Q=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀy=t,this.ƀhf=e;}printPathfindingTestGrid(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t);this.ƀy.getAvilabilityGrid(a,n,r).map((c,p)=>({position:B.gridPositionToPosition(p,n),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(s)){let p=this.ƀhf.findPathDirection(t,c.position,i,r),m;p===void 0?m=E.createRectangleBorders(new helpersLib.Vector(8,8),2,helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):m=E.createArrow(25,c.availability?helpersLib.ColorHelper.green:helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).setRotation(p).attach(a),new D(m,"alpha",{duration:1e3,animation:P.easeIn}).animate({alpha:0}).tap(()=>m.destroy()).attach(m);}});}createExplosionDebugVisual(t,e,i,r,s,n=300){let a=new u().displayParent(e).setAlpha(.5).attach(t);E.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;E.createVector(r,c.line.to,p).toSprite().displayParent(a).attach(t);}),new D(a,"alpha",{duration:n,animation:P.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,r,s,n,a=300){let l=new u().displayParent(e).setAlpha(.5).attach(t);E.createElipse(n,helpersLib.ColorHelper.blue).toSprite().displayParent(l).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attach(t),i.forEach(p=>{let m=p.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;E.createVector(p.line.from,p.line.to,m).toSprite().displayParent(l).attach(t);}),new D(l,"alpha",{duration:a,animation:P.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),n=i?.color??helpersLib.ColorHelper.blue,a=new u().displayParent(e).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀcq(c,n).displayParent(a).attachToRoot();}),new D(a,"alpha",{duration:1e3,animation:P.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcq(t,e){switch(t.type){case U__default.default.Shape.PARTICLE:throw new Error("Not implemented");case U__default.default.Shape.LINE:throw new Error("Not implemented");case U__default.default.Shape.PLANE:throw new Error("Not implemented");case U__default.default.Shape.CIRCLE:throw new Error("Not implemented");case U__default.default.Shape.CAPSULE:throw new Error("Not implemented");case U__default.default.Shape.BOX:throw new Error("Not implemented");case U__default.default.Shape.HEIGHTFIELD:throw new Error("Not implemented");case U__default.default.Shape.CONVEX:return this.ƀcp(t,e);default:throw new Error("Not implemented")}}ƀcp(t,e){let i=[t.vertices.map(r=>({x:r[0],y:r[1]}))];return E.createPolygon(i,e).toSprite()}};Q=Mo([d(),Do("design:paramtypes",[nt,Bt])],Q);var Fo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},_o=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Le=class{static{h(this,"HitTestService");}constructor(t){this.ƀju=t;}hitTest(t,e){let i=t.world,r=b.getFromP2BodyIDOrFail(t.id),s=f.cloneP2Body(t);this.ƀs(s,e);let n=i.broadphase.aabbQuery(i,this.ƀdi(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(n.length!==0){let l=new U__default.default.World;l.addBody(s),n.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.ƀju.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀs(t,e){e?.overridePosition&&(t.position=f.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀdi(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};Le=Fo([d(),_o("design:paramtypes",[Q])],Le);var Lo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ne=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀie(t,i);});});}step(t,e,i){b.getPhysicsEntities().forEach(r=>{r.ƀax=[];}),t.p2World.narrowphase.contactEquations.forEach(r=>{this.ƀie(t,r);}),t.bodiesInContactWith.forEach((r,s)=>{this.ƀep(r.p2Body),r.entity.ƀiw(t.collisionReports.get(s)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀep(t){let e=f.arrayToVector(t.velocity);e.length>yi&&(e=e.normalize(yi),t.velocity=f.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-wi),wi);}ƀie(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)||[],n=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀdn(i,r,e);s.push({self:a,target:l}),n.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,s),t.collisionReports.set(e.bodyB.id,n);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀdn(t,e,i){let r=t.convertToDTO(),s=e.convertToDTO(),n=f.arrayToVector(i.contactPointA),a=f.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀec(i);return {collisionDetailsA:this.ƀdm(r,i.bodyA.mass,n,l,t.area),collisionDetailsB:this.ƀdm(s,i.bodyB.mass,a,c,e.area)}}ƀdm(t,e,i,r,s){let n,a=i.add(t.position);return {body:t,getPositionReletiveToObject:h(()=>(n||(n=i.rotate(t.rotation.multiply(-1).vector)),n),"getPositionReletiveToObject"),getPositionOnWorld:h(()=>(a||(a=i.add(t.position)),a),"getPositionOnWorld"),position:i,mass:e,area:s,normal:r}}ƀec(t){let e=f.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};Ne=Lo([d()],Ne);var No=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},jo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},je=class extends re{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};je=No([ut(),jo("design:paramtypes",[Number,Object])],je);var Ho=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},W=1e4,He=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbr(t,new helpersLib.Vector(e.x/2,-W/2),new helpersLib.Vector(e.x+W*2,W),i),this.ƀbr(t,new helpersLib.Vector(e.x/2,e.y+W/2),new helpersLib.Vector(e.x+W*2,W),i),this.ƀbr(t,new helpersLib.Vector(-W/2,e.y/2),new helpersLib.Vector(W,e.y+W*2),i),this.ƀbr(t,new helpersLib.Vector(e.x+W/2,e.y/2),new helpersLib.Vector(W,e.y+W*2),i);}ƀbr(t,e,i,r){return new je(t,{shapeDefinition:{materialName:ot,group:r,shapeType:exports.PhysicsShapeType.Rectangle,shapeData:i},position:e,rotation:helpersLib.Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};He=Ho([d()],He);var Uo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},or=new U__default.default.Material,$o={id:ot,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},Gt=class{static{h(this,"MaterialsService");}createMaterials(t,e,i,r){let s=new Map,n=new Map;if(i.forEach(a=>{s.set(a.id,new U__default.default.Material),n.set(a.id,a);}),s.has(ot))throw new Error(`Material with name ${ot} cannot be defined, pick another name for the material.`);return s.set(ot,or),n.set(ot,$o),this.ƀc(t,e,i,r,s),{materials:s,materialDefinitions:n}}getMaterial(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀea(e,i.materials)}getMaterialDefinition(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀdz(e,i.materialDefinitions)}ƀea(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀdz(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.ƀds(i.map(n=>n.id),r).forEach(n=>{let a=this.ƀea(n.materialA,s),l=this.ƀea(n.materialB,s);t.addContactMaterial(new U__default.default.ContactMaterial(a,l,{friction:n.friction,restitution:n.bounciness,stiffness:n.stiffness,relaxation:n.relaxation}));}),this.ƀd(t,e,i,s);}ƀds(t,e){let i=new Map;e.forEach(s=>{let n=i.get(s.materialA);n||(n=new Map,i.set(s.materialA,n)),n.set(s.materialB,s);});let r=[];return t.forEach((s,n)=>{for(let a=n;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 n=this.ƀea(s.id,r);t.addContactMaterial(new U__default.default.ContactMaterial(n,or,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};Gt=Uo([d()],Gt);var ko=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},zo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ft=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,r,s){this.ƀgg=t,this.ƀah=e,this.ƀy=i,this.ƀay=r,this.ƀhj=s;}createPhysicsWorld(t){let e=new U__default.default.World({gravity:[0,0]}),{materials:i,materialDefinitions:r}=this.ƀgg.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:s,physicsBodyGroupToP2Mask:n}=this.ƀhj.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new v(t.mapSize,t.modifyUpdateCycle,e,i,r,s,n).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&y.cleanUpdateModifier();}).attachToRoot(),this.ƀah.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀay.registerPhysicsWorld(a),t.modifyUpdateCycle?y.registerUpdateModifier((l,c)=>this.ƀjo(a,l,c)):y.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀjo(a,l,c);}).attach(a),a.id}addBody(t,e,i,r,s){let n=v.getInstanceByIDOrFail(t);if(i){let a=this.ƀy.findClosestAvailableSpace(n,e,r);return a?(e.position[0]+=a.x,e.position[1]+=a.y,n.p2World.addBody(e),s&&this.ƀy.onBodyAdded(n,e,r),true):false}else return n.p2World.addBody(e),s&&this.ƀy.onBodyAdded(n,e,r),true}removeBody(t,e){v.getInstanceByID(t)?.p2World.removeBody(e);}ƀjo(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.ƀay.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);}};Ft=ko([d(),zo("design:paramtypes",[Gt,He,nt,Ne,K])],Ft);var Yo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Vt=class{static{h(this,"RayCastingService");}castClosest(t,e,i){let r=new U__default.default.RaycastResult,s=new U__default.default.Ray({mode:U__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.ƀbm(r,e)}castAllFirstContacts(t,e,i){let r=new Map,s=new U__default.default.Ray({mode:U__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(n=>{let a=r.get(n.body);!r.has(n.body)||n.fraction<a.fraction?r.set(n.body,this.ƀbm(n,e)):n.fraction===a.fraction&&a.isExternal()&&r.set(n.body,this.ƀbm(n,e));},"callback")});return t.p2World.raycast(new U__default.default.RaycastResult,s),Array.from(r.values())}ƀbm(t,e){let i=t.fraction,r=f.arrayToVector(t.normal),s,n,a;return {body:t.body,hitPosition:h(()=>(s===void 0&&(s=e.from.lerp(e.to,i)),s),"hitPosition"),hitDistance:h(()=>(n===void 0&&(n=e.length*i),n),"hitDistance"),isExternal:h(()=>(a===void 0&&(a=e.fromTo.dotProduct(r)<0),a),"isExternal"),normal:r,fraction:i,line:e}}};Vt=Yo([d()],Vt);var Xo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},lt=class{static{h(this,"ImpactService");}applyImpulse(t,e,i,r){let s=i.normalize(r),n=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(f.vectorToArray(s),n);}};lt=Xo([d()],lt);var Ko=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Lt=class{static{h(this,"RayCastHitConverterService");}toExplosionHits(t,e=true){let i=new Map;return t.forEach(r=>{r.hits.forEach(s=>{let n=i.get(s.body);if(n){let a=s.fraction<n.closestRaycastHit.fraction?s:n.closestRaycastHit;n.rayCastHits.push(s),i.set(s.body,{hitCount:n.hitCount+1,closestRaycastHit:a,rayCastHits:n.rayCastHits,isExternal:e?n.isExternal:n.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.ƀbn(r,t.length))}ƀbn(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")}}}};Lt=Ko([d()],Lt);var Qo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},qo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},rn=15,Ue=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,r){this.ƀia=t,this.ƀju=e,this.ƀhz=i,this.ƀfd=r;}createElipticExplosion(t,e,i,r,s,n,a){let l=v.getInstanceByIDOrFail(t),c=this.ƀcc(e,i,r,s,a?.hitOnlyClosest===true,l),p=this.ƀhz.toExplosionHits(c,false);return this.ƀq(p,n),a?.testLayerID&&this.ƀju.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,r,a.debugRayDuration),p.map(m=>{let{p2Body:g,...C}=m;return C})}ƀcc(t,e,i,r,s,n){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 m=l.normalize(i.y);a.push(new helpersLib.Line(t,t.add(m))),a.push(new helpersLib.Line(t,t.add(m.multiplyNumber(-1))));let g=Math.round(i.y/rn),C=i.y/(g*2+1)*2,bt=l.normalize(C),se=i.x,ar=Math.pow(i.y,2);return helpersLib.ArrayHelper.createIntegerArray(g).forEach(pt=>{let Pt=C*(pt+1),Ti=bt.multiplyNumber(pt+1),oe=c.normalize(this.ƀek(se,ar,Pt)),ne=t.add(Ti);a.push(new helpersLib.Line(ne,ne.add(oe))),a.push(new helpersLib.Line(ne,ne.add(oe.multiplyNumber(-1))));let ae=t.add(Ti.multiplyNumber(-1));a.push(new helpersLib.Line(ae,ae.add(oe))),a.push(new helpersLib.Line(ae,ae.add(oe.multiplyNumber(-1))));}),a.map(pt=>{if(s){let Pt=this.ƀia.castClosest(n,pt,r);return {line:pt,hits:Pt?[Pt]:[]}}else {let Pt=this.ƀia.castAllFirstContacts(n,pt,r);return {line:pt,hits:Pt}}})}ƀek(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀq(t,e){t.forEach(i=>{i.raycastResults.forEach(r=>{let s,n;r.isExternal()?(s=r.line.fromTo,n=e*2):(s=r.line.fromTo.multiplyNumber(-1),n=e*(1-r.fraction)*8),this.ƀfd.applyImpulse(r.body,r.hitPosition(),s,n);});});}};Ue=Qo([d(),qo("design:paramtypes",[Vt,Q,Lt,lt])],Ue);var sn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},on=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},$e=class{static{h(this,"ExplosionService");}constructor(t,e,i,r){this.ƀia=t,this.ƀju=e,this.ƀhz=i,this.ƀfd=r;}createExplosion(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t),l=this.ƀeh(i),c=this.ƀcc(e,i,r,l,n?.hitOnlyClosest===true,a),p=this.ƀhz.toExplosionHits(c);return this.ƀq(e,i,s,l,p),n?.testLayerID&&this.ƀju.createExplosionDebugVisual(a,n.testLayerID,c,e,i,n.debugRayDuration),p}ƀcc(t,e,i,r,s,n){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 m=this.ƀia.castClosest(n,p,i);return {line:p,hits:m?[m]:[]}}else {let m=this.ƀia.castAllFirstContacts(n,p,i);return {line:p,hits:m}}})}ƀq(t,e,i,r,s){s.forEach(n=>{if(n.isExternal)n.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀfd.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=helpersLib.Vector.fromTo(t,f.arrayToVector(n.p2Body.position)),l=a.length/e,c=i*r*l/2;this.ƀfd.applyImpulse(n.p2Body,n.getHitPosition(),a,c);}});}ƀeh(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};$e=sn([d(),on("design:paramtypes",[Vt,Q,Lt,lt])],$e);var cn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Nt=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)}};Nt=cn([d()],Nt);var pn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},dn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Pi=class{static{h(this,"PhysicsController");}constructor(t,e,i,r,s,n,a,l){this.ƀhq=t,this.ƀhf=e,this.ƀju=i,this.ƀda=r,this.ƀcu=s,this.ƀeu=n,this.ƀhp=a,this.ƀfd=l;}createPhysicsWorld(t){return this.ƀhq.createPhysicsWorld(t)}getMapSize(t){return this.ƀhp.getMapSize(t)}setPaused(t,e){this.ƀhq.setPaused(t,e);}hitTest(t,e){let i=b.getPhysicsInstanceOrFail(t);return this.ƀeu.hitTest(i.p2Body,e)}findPath(t,e,i,r,s){return this.ƀhf.findPathAStar(t,e,i,r,{neighborType:s})}findPathDirection(t,e,i,r){return this.ƀhf.findPathDirection(t,e,i,r)}applyImpulse(t,e,i,r){let s=b.getPhysicsInstanceOrFail(t);this.ƀfd.applyImpulse(s.p2Body,e,i,r);}createExplosion(t,e,i,r,s,n){return this.ƀda.createExplosion(t,e,i,r,s,n)}createElipticExplosion(t,e,i,r,s,n,a){return this.ƀcu.createElipticExplosion(t,e,i,r,s,n,a)}printPathfindingTestGrid(t,e,i,r,s,n){this.ƀju.printPathfindingTestGrid(t,e,i,r,s,n);}};Pi=pn([q({controllerLink:H}),dn("design:paramtypes",[Ft,Bt,Q,$e,Ue,Le,Nt,lt])],Pi);var un=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ke=class{static{h(this,"ShapeCreationService");}createBody(t,e,i,r,s){let n=v.getInstanceByIDOrFail(t);if(!n.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.ƀbt(n,void 0,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Circle:return this.ƀbt(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Polygon:return this.ƀcb(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Rectangle:return this.ƀcd(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);default:{e.shapeDefinition.shapeType;throw new Error(`Unexpected case! "${e.shapeDefinition.shapeType}"`)}}}ƀbt(t,e,i,r,s,n){let a=new U__default.default.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s),radius:e});a.material=i;let l=new U__default.default.Body({type:n==="dynamic"?U__default.default.Body.DYNAMIC:U__default.default.Body.STATIC,mass:r.density,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return l.addShape(a),l}ƀcb(t,e,i,r,s,n){let a=t.physicsBodyGroupToP2Group.get(s),l=t.physicsBodyGroupToP2Mask.get(s),c=e.map(g=>new U__default.default.Convex({vertices:g.map(C=>[C.x,C.y]),collisionGroup:a,collisionMask:l})).map(g=>(g.material=i,g)),p=c.reduce((g,C)=>g+C.area,0),m=new U__default.default.Body({type:n==="dynamic"?U__default.default.Body.DYNAMIC:U__default.default.Body.STATIC,mass:p,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.forEach(g=>m.addShape(g)),m.setDensity(r.density),m}ƀcd(t,e,i,r,s,n){let a=new U__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 U__default.default.Body({type:n==="dynamic"?U__default.default.Body.DYNAMIC:U__default.default.Body.STATIC,mass:l,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.addShape(a),c.setDensity(r.density),c}};ke=un([d()],ke);var fn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},mn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Si=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,r,s){this.ƀhq=t,this.ƀho=e,this.ƀjb=i,this.ƀhp=r,this.ƀhj=s;}createBody(t,e,i,r,s){return this.ƀjb.createBody(t,e,i,r,s)}getMaterial(t,e){return this.ƀho.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀho.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀhj.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀhj.getMaskConstant(t,e)}addBody(t,e,i,r,s){return this.ƀhq.addBody(t,e,i,r,s)}removeBody(t,e){this.ƀhq.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀhp.subscribeToPhysicsStep(t,e)}};Si=fn([q({controllerLink:X}),mn("design:paramtypes",[Ft,Gt,ke,Nt,K])],Si);exports.AnimationFlicker=Oi;exports.AnimationInterpolationFunctions=J;exports.Animations=P;exports.Animator=D;exports.BORDER_MATERIAL_NAME=ot;exports.BardLegendsHardReset=F;exports.Camera=Zt;exports.ClosestAvailableSpaceHelper=Jt;exports.Container=u;exports.ControllerDecorator=q;exports.ControllerLink=$;exports.DEFAULT_SHADER_RESOLUTION=O;exports.DeltaTime=ti;exports.DisplayObjectArray=ci;exports.Entity=k;exports.EntityDecorator=ut;exports.FadeInContent=Gi;exports.FadeInStateAnimation=xe;exports.Game=x;exports.Graphics=E;exports.ImmovablePhysicsEntity=re;exports.MenuEntity=di;exports.MenuUI=te;exports.MenuView=ui;exports.MovableEntity=xi;exports.MovablePhysicsEntity=vi;exports.PathFinder=Yt;exports.PhysicsEntity=b;exports.Placeholder=ai;exports.PositionConversionHelper=Wt;exports.ROTATIONAL_SPEED_LIMIT=wi;exports.RichText=hi;exports.SPEED_LIMIT=yi;exports.Scene=he;exports.SceneDecorator=vr;exports.ScrollAreaUI=fi;exports.ScrollMaskUI=yt;exports.Service=T;exports.ServiceDecorator=d;exports.SingletonEntity=ft;exports.SlideInContent=Hi;exports.SlideInContentByIndex=qe;exports.SlideStateAnimation=Se;exports.Sprite=Y;exports.StateAnimation=we;exports.Text=qt;exports.UpdatableContainer=li;exports.UpdateCycle=y;exports.VectorFieldPathFinder=Xt;exports.VectorSet=xt;exports.View=dt;exports.ViewDecorator=Je;
|
package/dist/index.mjs
CHANGED
|
@@ -64,4 +64,4 @@ import {Action,ActionLib,SingleEvent,IDAttachable,SingleAction,Sequence,Variable
|
|
|
64
64
|
highestAlpha = centerColor.a;`,e+=`
|
|
65
65
|
|
|
66
66
|
gl_FragColor = vec4(color, 1.0) * highestAlpha;
|
|
67
|
-
}`,e}constructor(t,e){if(super(o.ƀei(),o.ƀdr(t*O)),this.ƀcy=t,this.resolution=O,this.ƀcy=t*O,this.ƀcy<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀcy>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");Comparator.isInteger(this.ƀcy)||(this.ƀcy=Math.floor(this.ƀcy));let i=ColorHelper.normalize(e);this.uniforms.color=new Float32Array([i.red,i.green,i.blue]),this.uniforms.expandSquared=this.ƀcy*this.ƀcy,this.padding=this.ƀcy;}apply(t,e,i,r){this.uniforms.pixelSize=new Float32Array([1/(e.width*O),1/(e.height*O)]),t.applyFilter(this,e,i,r);}};var Pe=class extends L.Filter{static{h(this,"GlowFilter");}constructor(t){super(),this.resolution=O;let e={blurRadius:1,expand:0,color:ColorHelper.white,blendMode:St.Screen,...t};this.ƀcz=new be(e.expand,e.color);let i=Comparator.isNumber(e.blurRadius)?new Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀag=new Tt(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀag.blendMode=L.BLEND_MODES.SCREEN;}apply(t,e,i,r){let s=t.getFilterTexture();this.ƀcz.apply(t,e,s,L.CLEAR_MODES.CLEAR),this.ƀag.apply(t,s,i,r),t.returnFilterTexture(s);}};var kt=class o{static{h(this,"GlowSpriteGenerator");}static{this.ƀel=new Map;}static createGlowSpriteFromSprite(t,e,i){let r=this.ƀbc(e),s=Comparator.isNumber(r.blurRadius)?new Vector(r.blurRadius,r.blurRadius):r.blurRadius,n=this.ƀdt(t.texture,s,r.expand,r.color,i),a=new L.Sprite(n);return this.ƀiy(a,Vector.fromVec2(t.anchor),Math.max(s.x,s.y)+r.expand),a.alpha=r.glowAlpha,a.blendMode=r.blendMode,a}static ƀdt(t,e,i,r,s){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(s){let n=`${t.id}-${i}-${e.x}-${e.y}-${r.r}-${r.g}-${r.b}`;if(o.ƀel.has(n))return o.ƀel.get(n);{let a=this.ƀdu(t,e,i,r);return o.ƀel.set(n,a),a}}else return this.ƀdu(t,e,i,r)}static ƀdu(t,e,i,r){let s=new L.Sprite(t);this.ƀdb(s,Math.max(e.x,e.y)+i),s.filters=[new Pe({blurRadius:e,expand:i,color:r})];let n=x.instance.renderer.generateTexture(s);return n.id=M.insertAsset(n),s.destroy(),n}static ƀiy(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 ƀdb(t,e){if(t.isSprite){let s=new L.Graphics;t.addChild(s);}let i=t.width,r=t.height;t.calculateBounds=function(){this._bounds.clear(),this._bounds.addFrame(this.transform,-e,-e,i+e,r+e);};}static ƀbc(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:ColorHelper.white,blendMode:St.Add};return t&&(e={...e,...t}),e}};F.onHardReset.subscribe(()=>{kt.ƀel.clear();}).attachToRoot();var Y=class o extends u{static{h(this,"Sprite");}static createByName(t){let e=x.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new o(e)}static createSnapshotSprite(t){let e=t.ƀhs,i=e.parent;i&&i.removeChild(e);let r=x.instance.renderer.generateTexture(e,{resolution:2,scaleMode:L.SCALE_MODES.LINEAR,multisample:L.MSAA_QUALITY.HIGH});i&&i.addChild(e);let n={id:M.insertAsset(r),scale:t.scale,size:t.size,anchor:Vector.zero,destroyAssetOnDestroy:true};return new o(n,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀjy=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀjh=t,this.pixiSprite=new L.Sprite(M.getAsset(t.id)),this.ƀhs.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.ƀge?.destroy(),this.ƀai?.destroy(),this.ƀjh.destroyAssetOnDestroy&&(M.destroyAsset(this.ƀjh.id),this.ƀht&&M.destroyAsset(this.ƀht.texture.id)),this.ƀht&&!this.ƀht.destroyed&&this.ƀht.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀjy}set textureScale(t){this.ƀjy=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.ƀjh.boundingShapes&&!this.ƀhs.hitArea&&(this.ƀhs.hitArea=new me(this.ƀjh.boundingShapes,this.size,Vector.fromVec2(this.ƀjh.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.baseTexture.mipmap===L.MIPMAP_MODES.ON}set mipmap(t){t?this.pixiSprite.texture.baseTexture.mipmap=L.MIPMAP_MODES.ON:this.pixiSprite.texture.baseTexture.mipmap=L.MIPMAP_MODES.OFF;}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 L.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.ƀht)return this.ƀht.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀht)this.ƀht.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=Vector.fromVec2(this.ƀjh.anchor).to(t);return new Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀht&&(this.ƀht.destroy(),this.ƀht=void 0),t&&(this.ƀht=kt.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀjh.destroyAssetOnDestroy),this.ƀht.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀht.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀhs.addChild(this.ƀht)),this}showBoundingShape(t){return t?this.ƀai||(this.ƀai=this.ƀbs().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀai&&(this.ƀai.destroy(),this.ƀai=void 0),this}getBoundingMask(){if(!this.ƀge){if(!this.ƀjh.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀge=this.ƀbs(),this.ƀge.pixiSprite._maskRefCount=Number.POSITIVE_INFINITY,this.ƀge.pixiSprite.renderable=false,this.ƀge.displayParent(this);}return this.ƀge}ƀbs(){if(!this.ƀjh.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return E.createPolygon(this.ƀjh.boundingShapes,ColorHelper.white).toSprite().attach(this)}download(){let t=x.instance.renderer.extract.canvas(this.ƀhs);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}};var Qe=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},yt=class o extends u{static{h(this,"ScrollMaskUI");}static{this.ƀcr=new Map;}constructor(t,e,i,r=tt.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 u;r===tt.Horizontal?this.ƀby(e,i,s):this.ƀcf(e,i,s),this.ƀge=Y.createSnapshotSprite(s).attach(this),s.destroy(),t.setMask(this.ƀge);}ƀcf(t,e,i){e>0&&this.ƀbv(new Vector(t.x,e)).displayParent(i).attach(i),E.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.ƀbv(new Vector(t.x,e)).setPosition(new Vector(t.x,t.y),{round:false}).setRotation(Radian.get180).displayParent(i).attach(i);}ƀby(t,e,i){e>0&&this.ƀbv(new Vector(t.y,e)).setPosition(new Vector(0,t.y),{round:false}).setRotation(Radian.get270).displayParent(i).attach(i),E.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.ƀbv(new Vector(t.y,e)).setPosition(new Vector(t.x,0),{round:false}).setRotation(Radian.get90).displayParent(i).attach(i);}ƀbv(t){let i={id:this.ƀbw(t.y),scale:1,size:t,anchor:{x:0,y:0}};return new Y(i,{textureSize:t,ignoreAnchor:true})}ƀbw(t){let e=JSON.stringify({type:"gradient",length:t}),i=o.ƀcr.get(e);if(!i){let r=document.createElement("canvas");r.width=1,r.height=t;let s=r.getContext("2d");if(s){let n=new Qe;ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${n.multiplierFunction(l/t)})`;s.fillStyle=c,s.fillRect(0,l,1,1);});let a=L.Texture.from(r);i=M.insertAsset(a),o.ƀcr.set(e,i);}else throw new Error("Canvas context is null")}return i}};var et;(function(o){o[o.Appear=1]="Appear",o[o.Disappear=2]="Disappear";})(et||(et={}));var S;(function(o){o[o.Idle=1]="Idle",o[o.TransitionForward=2]="TransitionForward",o[o.TransitionBackward=3]="TransitionBackward",o[o.Reverting=4]="Reverting";})(S||(S={}));var Se=class extends Attachable{static{h(this,"SlideStateAnimation");}constructor(t){super(),this.ƀn=S.Idle,this.ƀgw=new Action,this.ƀgy=new Action,this.ƀhb={duration:500,animation:P.easeInOutCubic,...t},this.ƀjn=new we({duration:this.ƀhb.duration,animation:this.ƀhb.animation}).onStateChange((e,i)=>this.ƀeq(e,i)).onValueChange(e=>this.ƀer(e)).attach(this);}setIndex(t,e){if(!Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀff===void 0?(this.ƀff=t,this.ƀgw.trigger({state:et.Appear,index:t}),this.ƀjn.setState(t,e)):this.ƀff!==t?this.ƀgn!==t?this.ƀn===S.Idle?(this.ƀn=t>this.ƀff?S.TransitionForward:S.TransitionBackward,this.ƀgn=t,this.ƀgw.trigger({state:et.Appear,index:this.ƀgn}),this.ƀjn.setState(t,e)):this.ƀjn.setState(t,e):this.ƀn===S.Reverting&&this.ƀgn===t&&(this.ƀn=t>this.ƀff?S.TransitionForward:S.TransitionBackward,this.ƀjn.setState(t,e)):(this.ƀn===S.TransitionForward||this.ƀn===S.TransitionBackward)&&(this.ƀn=S.Reverting,this.ƀjn.setState(t,e));}ƀeq(t,e){switch(this.ƀff!==void 0&&this.ƀff!==t&&this.ƀff!==e&&this.ƀgw.trigger({state:et.Disappear,index:this.ƀff}),this.ƀgn!==void 0&&this.ƀgn!==t&&this.ƀgn!==e&&this.ƀgw.trigger({state:et.Disappear,index:this.ƀgn}),e!==void 0&&e!==this.ƀff&&e!==this.ƀgn&&this.ƀgw.trigger({state:et.Appear,index:e}),this.ƀn){case S.Idle:break;case S.TransitionForward:case S.TransitionBackward:e===void 0?(this.ƀn=S.Idle,this.ƀff=this.ƀgn,this.ƀgn=void 0):this.ƀff!==t&&this.ƀeo(t,e);break;case S.Reverting:e===void 0?(this.ƀn=S.Idle,this.ƀgn=void 0):this.ƀff!==e&&this.ƀeo(t,e);break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}ƀer(t){let e=1;(this.ƀn===S.TransitionBackward||this.ƀn===S.Reverting&&this.ƀff!==void 0&&this.ƀgn!==void 0&&this.ƀff>this.ƀgn)&&(e=-1),(this.ƀn===S.Idle||t!==0)&&this.ƀgy.trigger({value:NumberHelper.ensurePositiveZero(-e*t),index:this.ƀff}),this.ƀgn!==void 0&&this.ƀgy.trigger({value:NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀgn});}ƀeo(t,e){this.ƀff=t,this.ƀgn=e,this.ƀgy.trigger({value:0,index:this.ƀff}),this.ƀn=this.ƀff<this.ƀgn?S.TransitionForward:S.TransitionBackward;}onStateChange(t){return this.ƀgw.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀgy.subscribe(e=>t(e.value,e.index)).attach(this),this}};var tt;(function(o){o[o.Horizontal=1]="Horizontal",o[o.Vertical=2]="Vertical";})(tt||(tt={}));var qe=class extends u{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀbu=t,this.ƀcm="x",this.ƀbj=new Map,this.ƀhb={duration:300,animation:P.easeInOutCubic,size:new Vector(500,500),margin:20,direction:tt.Horizontal,...e};let i=this.ƀhb.direction===tt.Horizontal?new Vector(this.ƀhb.size.x+this.ƀhb.margin*2,this.ƀhb.size.y):new Vector(this.ƀhb.size.x,this.ƀhb.size.y+this.ƀhb.margin*2),r=new u().setPosition(this.ƀhb.direction===tt.Horizontal?new Vector(-this.ƀhb.margin,0):new Vector(0,-this.ƀhb.margin),{round:false}).displayParent(this).attach(this);this.ƀbz(i,this.ƀhb.margin,this.ƀhb.direction,r),this.ƀcm=this.ƀhb.direction===tt.Horizontal?"x":"y",this.ƀjn=new Se({duration:this.ƀhb.duration,animation:this.ƀhb.animation}).onStateChange((s,n)=>{if(s===et.Appear){let a=new u().displayParent(this).attach(this);this.ƀbj.set(n,a),this.ƀbu({index:n,container:a});}else {let a=this.ƀbj.get(n);a&&(a.destroy(),this.ƀbj.delete(n));}}).onValueChange((s,n)=>{let a=this.ƀbj.get(n);if(a){let l={x:0,y:0};l[this.ƀcm]=i[this.ƀcm]*s+this.ƀhb.margin,a.setPosition(Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=r;}setIndex(t,e){return this.ƀjn.setIndex(t,e),this}ƀbz(t,e,i,r){new yt(r,new Vector(t.x,t.y),e,i).attach(this);}},Hi=class extends qe{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 xt=class{static{h(this,"VectorSet");}constructor(){this.ƀkk=new Map;}add(t){let e=this.ƀkk.get(t.x);e||(e=new Set,this.ƀkk.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀkk.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀkk.get(t.x);return e?e.delete(t.y):false}};var ti=class{static{h(this,"DeltaTime");}static adjustMultiplier(t,e){return Math.pow(t,e)}};var B=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 Jt=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=B.areaToGridArea(e,i);if(this.ƀar(t,s))return Vector.zero;let n=t.movePositionInsideGrid(s.topLeft),a=Vector.fromTo(s.topLeft,n),l=this.find(t,n,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 xt,s=new Queue(e);for(;s.notEmpty;){let n=s.pop();r.add(n);let a=new Rectangle(n,n.add(i));if(this.ƀar(t,a))return Vector.fromTo(e,n);t.getNeighborPositions(n,GridNeighborType.Ortogonal).forEach(l=>{r.has(l)||s.add(l);});}}static ƀar(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 Wi=class{static{h(this,"PathfinderNode");}constructor(t,e,i,r=void 0){this.position=t,this.distanceFromStart=e,this.distanceToEnd=i,this.parent=r,this.closed=false;}get pathLength(){return this.distanceFromStart+this.distanceToEnd}isEqual(t){return Vector.isEqual(this.position,t)}createSolutionPath(t){let e=[this.position],i=this.parent;for(;i!==void 0;)e.push(i.position),i=i.parent;return e.reverse(),{directPathAvailable:t,path:e}}getDistance(t){return this.position.getDistance(t)}},cs=class{static{h(this,"PathfinderGrid");}constructor(t,e){this.ƀen=t,this.ƀjk=e,this.ƀha=new BinaryHeap("min"),this.ƀav=[],this.ƀgp=new Grid({size:t.size,defaultValue:void 0});let i=new Wi(this.ƀjk,0,Number.MAX_SAFE_INTEGER);this.ƀha.add(i.pathLength,i);}get hasOpenNodes(){return this.ƀha.size>0}getNeighbors(t,e){return this.ƀen.getNeighborPositions(t.position,e).filter(i=>this.ƀen.get(i)).map(i=>this.ƀgp.get(i)||this.ƀca(i))}popLowestPathCostNode(){let t=this.ƀha.pop();return this.ƀha.delete(t),t.closed=true,this.ƀav.push(t),t}changeNodeCost(t,e,i,r){this.ƀha.delete(t),t.distanceFromStart=e,t.distanceToEnd=t.getDistance(i),t.parent=r,this.ƀha.add(t.pathLength,t);}getBestClosedNode(){return this.ƀav.reduce((t,e)=>t.distanceToEnd<e.distanceToEnd?t:e)}ƀca(t){let e=new Wi(t,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);return this.ƀgp.set(t,e),this.ƀha.add(e.pathLength,e),e}},Yt=class{static{h(this,"PathFinder");}static findPath(t,e,i,r){let s=new cs(t,e);for(;s.hasOpenNodes;){let n=s.popLowestPathCostNode();if(n.isEqual(i))return n.createSolutionPath(true);let a=s.getNeighbors(n,r);for(let l of a)if(!l.closed){let c=n.distanceFromStart+n.getDistance(l.position);c<l.distanceFromStart&&s.changeNodeCost(l,c,i,n);}}return s.getBestClosedNode().createSolutionPath(false)}};var Xt=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀjs=t,this.ƀw=e,this.ƀet=this.ƀdw(this.ƀw.size),this.ƀks=new Grid({size:this.ƀw.size,defaultValue:this.ƀet}),this.ƀcn=new Grid({size:this.ƀw.size,defaultValue:void 0});let i=new xt,r=new Queue;for(this.ƀdk(this.ƀw.cropAreaOutsideOfTheGrid(t)).forEach(n=>{this.ƀks.set(n,0),r.add(n);});r.notEmpty;){let n=r.pop();if(!i.has(n)){i.add(n);let a=this.ƀks.getOrFail(n);this.ƀeb(n,this.ƀw).forEach(l=>{if(!i.has(l.position)){let c=this.ƀks.getOrFail(l.position),p=a+l.distance;this.ƀw.getOrFail(l.position)&&p<c&&(this.ƀks.set(l.position,p),r.add(l.position));}});}}}getDirectionToTarget(t){if(!t.isInsideRectangle(this.ƀjs)){if(t=this.ƀks.movePositionInsideGrid(t),this.ƀcn.has(t))return this.ƀcn.get(t);{let e=this.ƀeb(t,this.ƀw),i;return this.ƀks.getOrFail(t)>=this.ƀet?e.some(s=>this.ƀw.get(s.position))&&(e.some(n=>!this.ƀw.get(n.position))?i=this.ƀdq(e):i=this.ƀdl(t,e)):i=this.ƀdl(t,e),this.ƀcn.set(t,i),i}}}ƀdq(t){let e=t.filter(i=>this.ƀw.get(i.position)).map(i=>i.direction.radian);return Radian.getAverage(...e)}ƀdl(t,e){let i=e.filter(r=>this.ƀks.getOrFail(r.position)<this.ƀet).reduce((r,s)=>{let n=this.ƀks.getOrFail(s.position)+s.distance;return n<r.bestWeight?(r.bestDirections=[s.direction],r.bestWeight=n):n===r.bestWeight&&r.bestDirections.push(s.direction),r},{bestDirections:[],bestWeight:this.ƀet}).bestDirections;return this.ƀeg(i,t)}ƀeg(t,e){if(t.length>0){let i=t.reduce((r,s)=>r.add(s),Vector.zero);if(i.isZero()||!this.ƀfl(e,i))return Random.pickRandomElement(t).radian;if(t.length>=1)return i.radian}}ƀfl(t,e){let i=t.add(this.ƀkl(e));return this.ƀw.isPointWithinBounds(i)&&this.ƀw.getOrFail(i)}ƀeb(t,e){return this.ƀks.getNeighborDirections(t,GridNeighborType.All).map(i=>({position:t.add(i),direction:i,distance:i.x!==0&&i.y!==0?14:10}))}ƀdk(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}ƀkl(t){let e=t.normalize().round();return new Vector(e.x,e.y)}ƀdw(t){return (t.x+t.y)*20}};var ms=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},V=class extends ft{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);}};V=ms([ut()],V);var gs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ys=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},It=class extends dt{static{h(this,"CameraView");}constructor(t){super(),this.ƀcw=t,this.ƀim=new u().setAlpha(0).displayParent(x.instance.stage).attach(this),this.ƀac=E.createRectangle(new Vector(1,1),ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(x.instance.stage).attach(this),this.ƀaa=new u().displayParent(this.ƀim).attach(this),this.ƀao=new u().displayParent(this.ƀim).attach(this),this.ƀdg=new u().setSortableChildren(true).displayParent(this.ƀim).attach(this),this.ƀan=new u().setSortableChildren(true).displayParent(this.ƀao).attach(this),this.ƀdf=new u().setSortableChildren(true).setZIndex(20).displayParent(this.ƀan).attach(this),this.ƀgc=new u().setSortableChildren(true).setZIndex(10).displayParent(this.ƀan).attach(this),this.ƀz=new u().setZIndex(0).displayParent(this.ƀan).attach(this),this.ƀh=new D(this.ƀim,"alpha",{duration:500,animation:P.easeInOutCubic,reAnimateHandling:_.CompletePrevious,completionHandling:R.StayInCurrentState}),this.ƀad=new D(this.ƀac,"alpha",{duration:500,animation:P.easeInOutCubic,reAnimateHandling:_.CompletePrevious,completionHandling:R.StayInCurrentState}),x.instance.screenSize.subscribe(e=>{this.ƀac.aspectRatio=e.x/e.y,this.ƀac.scale=Math.max(e.x,e.y),this.ƀac.setPosition(Vector.zero,{holdFrom:Vector.zero});}).attach(this),x.instance.setScreenPositionToStagePositionFunction(e=>new Vector(e.x-this.ƀan.position.x-this.ƀao.position.x,e.y-this.ƀan.position.y-this.ƀao.position.y)),this.ƀcw.position.subscribe(e=>{this.ƀan.position=this.ƀbp(e);}).attach(this),this.ƀcw.offset.subscribe(e=>{this.ƀao.position=e;}).attach(this),this.appear(true,"alpha");}destroy(){this.destroyed||(super.destroy(),x.instance.resetScreenPositionToStagePositionFunction());}getLayers(){return {backgroundScreen:this.ƀaa.id,background:this.ƀz.id,main:this.ƀgc.id,foreground:this.ƀdf.id,foregroundScreen:this.ƀdg.id}}appear(t,e){switch(e){case "alpha":return this.ƀad.set({alpha:0}),this.ƀh.set({alpha:t?0:1}),this.ƀh.animate({alpha:t?1:0}).chain(this);case "pureBlack":return this.ƀh.set({alpha:1}),this.ƀad.set({alpha:t?1:0}),this.ƀad.animate({alpha:t?0:1}).chain(this);case "instant":return this.ƀh.set({alpha:t?1:0}),this.ƀad.set({alpha:t?0:1}),SingleEvent.instant();default:{throw new Error('Switch ended with value "never".')}}}ƀbp(t){return Vector.fromTo(t,x.instance.getScreenSizeCenter())}};It=gs([Je({entity:V}),ys("design:paramtypes",[V])],It);var vs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},bs=1500,Ee=class{static{h(this,"CameraService");}createCamera(){return new V().attachToRoot()}getCameraPosition(){let t=V.getInstanceOrFail();return Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=V.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=V.getInstanceOrFail();e.focusingNewTargetInfo.value={time:x.time,duration:t?.duration??bs,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??st.Instant};}update(t,e){let i=V.getInstanceOrFail(),r=i.targetPosition.value;r&&(i.focusingNewTargetInfo.value?this.ƀfo(i,r,t):i.position.value=r);}ƀfo(t,e,i){let r=t.focusingNewTargetInfo.value;if(r.focusingAnimation===st.Instant)this.ƀbb(t,e);else {let s=(i-r.time)/r.duration;if(s>=1)this.ƀbb(t,e);else {let n;r.focusingAnimation===st.EaseInOut?n=J.easeInOut(s):r.focusingAnimation===st.EaseOut?n=J.easeOut(s):n=1;let a=r.position.lerp(e,n);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;}}}ƀbb(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};Ee=vs([d()],Ee);var Ps=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ss=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},ri=class{static{h(this,"CameraController");}constructor(t){this.ƀap=t;}createCamera(){return this.ƀap.createCamera().id}update(t,e){this.ƀap.update(t,e);}setPosition(t){this.ƀap.setPosition(t);}setTransition(t){this.ƀap.setTransition(t);}getCameraPosition(){return this.ƀap.getCameraPosition()}};ri=Ps([q({controllerLink:gt}),Ss("design:paramtypes",[Ee])],ri);var Ts=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},si=class{static{h(this,"CameraViewController");}getLayers(){let t=V.getInstanceOrFail().id;return It.getInstanceOrFail(t).getLayers()}appear(t,e){let i=V.getInstanceOrFail().id;return It.getInstanceOrFail(i).appear(t,e)}};si=Ts([q({controllerLink:ye})],si);var Zt=class{static{h(this,"Camera");}get position(){return this.ƀam.getCameraPosition()}constructor(){this.ƀam=T.get(Et),this.ƀaq=T.get(Ut),this.ƀam.createCamera(),this.layers=this.ƀaq.getLayers();}setPosition(t){this.ƀam.setPosition(t);}setTransition(t){this.ƀam.setTransition(t);}appear(t,e="alpha"){return this.ƀaq.appear(t,e)}};var x=class o{static{h(this,"Game");}static get instance(){return this.ƀfi}static{this.pause=Reducer.createOr();}static get camera(){return this.ƀal}static get time(){return y.ƀjz}static get setupOptions(){return this.ƀja}getScreenSize(){return this.ƀiq.value}getScreenSizeCenter(){return this.ƀir.value}constructor(t){if(this.ƀiq=new Variable(Vector.zero),this.screenSize=this.ƀiq.notifier,this.ƀir=new Variable(Vector.zero),this.screenSizeCenter=this.ƀir.notifier,this.devMode=false,this.resetScreenPositionToStagePositionFunction(),o.ƀfi)throw new Error("There can be only one Game instance!");{this.ƀbf={screenResolution:void 0,devMode:false,backgroundColor:ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbf.devMode||false;let e=JsonHelper.removeUndefinedProperties({backgroundColor:this.ƀbf.backgroundColor,autoStart:false,antialias:this.ƀbf.antialias,resolution:this.ƀbf.resolution,width:this.ƀbf.screenResolution?.width,height:this.ƀbf.screenResolution?.height,resizeTo:this.ƀbf.screenResolution===void 0?window:void 0});this.ƀhr=new L.Application(e);}}async setup(t){o.ƀja=t,document.body.appendChild(this.ƀhr.view),await Promise.all([M.loadGameAssets(t.assetDefinitions)]),o.ƀfi=this,this.stage=new u().attachToRoot(),this.stage.ƀhs=this.ƀhr.stage,this.renderer=this.ƀhr.renderer,this.ƀiz(),this.stage.sortableChildren=true,globalThis.ƀa=this.ƀhr,window.addEventListener("resize",e=>{setTimeout(()=>this.ƀiz());}),o.ƀal=new Zt,this.ƀhr.start(),this.ƀhr.ticker.add(()=>{y.triggerUpdateTick(this.ƀhr.ticker.deltaMS);});}setResolution(t){this.ƀhr.renderer.resolution!==t&&(this.ƀhr.renderer.resolution=t,this.ƀhr.renderer.resize(this.ƀhr.screen.width,this.ƀhr.screen.height));}screenPositonToStagePosition(t){let e=Wt.includeScaleInScreenPosition(t,o.instance.stage.scale,o.instance.getScreenSizeCenter());return this.ƀip(e)}setScreenPositionToStagePositionFunction(t){this.ƀip=t;}resetScreenPositionToStagePositionFunction(){this.ƀip=t=>t;}destroyAsset(t){M.destroyAsset(t);}ƀiz(){let t=new Vector(this.ƀhr.screen.width,this.ƀhr.screen.height);this.ƀiq.value=t,this.ƀir.value=t.multiplyNumber(.5).round();}};var Ce=class{static{h(this,"DashedLineHelper");}static getLines(t,e,i){let r=Vector.fromTo(t,e),s=r.normalize(),n=r.length-i.lineStartGap-i.lineEndGap,a=[];if(n<=0)return a;let l=t.add(s.normalize(i.lineStartGap));if(n<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(s.normalize(n))}),a;let c=n-i.dashGap,p=i.dashLength+i.dashGap,m=Math.floor(c/p),g=c-p*m;m>=1&&g<i.dashLength&&(g+=p,m--);let C=s.normalize(g/2),bt=s.normalize(i.dashGap);if(a.push({from:l,to:l.add(C)}),l=l.add(C),m>0){let se=s.normalize(i.dashLength);ArrayHelper.createEmptyArray(m).forEach(()=>{l=l.add(bt),a.push({from:l,to:l.add(se)}),l=l.add(se);});}return l=l.add(bt),a.push({from:l,to:l.add(C)}),a}};var E=class o extends u{static{h(this,"Graphics");}static{this.ƀcr=new Map;}static createArrow(t,e){let i=new L.Graphics,r=[[{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}]];return i.beginFill(e),r.forEach(s=>{i.drawPolygon(s.map(n=>new L.Point(n.x,n.y)));}),i.endFill(),new o(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 L.Graphics;return s.lineStyle(r.width,r.color),Ce.getLines(t,e,r).forEach(a=>{s.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),new o(s,JSON.stringify({type:"dashedLine",from:t,to:e,options:r}))}static createVector(t,e,i){let r=new L.Graphics;return r.lineStyle(2,i),r.moveTo(t.x,t.y),r.lineTo(e.x,e.y),r.lineStyle(1,i),r.beginFill(ColorHelper.white),r.drawCircle(t.x,t.y,3),r.endFill(),new o(r,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let r=new L.Graphics;return r.beginFill(i),r.drawRect(0,0,t.x,e),r.drawRect(0,e,e,t.y-e*2),r.drawRect(t.x-e,e,e,t.y-e*2),r.drawRect(0,t.y-e,t.x,e),r.endFill(),new o(r,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=ColorHelper.white){let i=new L.Graphics;return i.beginFill(e),i.drawRect(0,0,t.x,t.y),i.endFill(),new o(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new L.Graphics;return i.beginFill(e),i.drawCircle(0,0,t),i.endFill(),new o(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new L.Graphics;return i.beginFill(e),i.drawEllipse(0,0,t.x,t.y),i.endFill(),new o(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new L.Graphics,r=JSON.stringify({type:"polygon",polygon:t,color:e});return i.beginFill(e),t.forEach(s=>{i.drawPolygon(s.map(n=>new L.Point(n.x,n.y)));}),i.endFill(),new o(i,r)}static createRegularPolygon(t,e,i){let r=new L.Graphics,s=new Radian(PI_360/t);r.beginFill(i),r.moveTo(e,0);for(let n=1;n<=t;n++){let l=s.multiply(n).vector.normalize(e),c=e+l.x,p=e+l.y;r.lineTo(c,p);}return r.endFill(),new o(r,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.ƀhs.addChild(t),this.pixiGraphics=t,this.ƀak=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀak,cache:false,...t},i=this.ƀef(e.cacheName,e.cache),r={id:i.assetID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},s=new Y(r,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),s}ƀef(t,e){if(e){let i=o.ƀcr.get(t);return i||(i=this.ƀce(),o.ƀcr.set(t,i)),i}else return this.ƀce()}ƀce(){let t=x.instance.renderer.generateTexture(this.pixiGraphics);t.id=M.insertAsset(t);let e=this.pixiGraphics.getBounds();return {assetID:t.id,bounds:new Vector(e.x,e.y)}}};var ai=class extends u{static{h(this,"Placeholder");}constructor(t){super(),this.ƀhu=new L.Graphics,this.ƀhu.beginFill(0,1e-9),this.ƀhu.drawRect(0,0,t.x,t.y),this.ƀhu.endFill(),this.ƀhs.addChild(this.ƀhu);}destroy(){this.destroyed||(super.destroy(),this.ƀhu.destroy());}};var At=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:true,dropShadowBlur:s.blur,dropShadowAngle:s.angle.value,dropShadowDistance:s.distance,dropShadowColor:ColorHelper.rgbToHex(s.color),dropShadowAlpha: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 Ie=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.ƀfe(r,e),n=this.ƀr(s);return this.ƀjf(n)}static ƀfe(t,e){let i=new Map,r=new Map,s=h((a,l)=>{if(r.has(l))return r.get(l);let c=At.getPixiTextStyle(a);return r.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀdo(a.tags,e,i),p=s(l,c),m=L.TextMetrics.measureText(" ",new L.TextStyle(p),false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:m.width}})}static ƀdo(t,e,i){let r=t.join("+");if(i.has(r))return {style:i.get(r),cacheKey:r};let s=this.ƀba(t,e);return i.set(r,s),{style:s,cacheKey:r}}static ƀba(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:n,...a}=i;return a}static ƀr(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 ƀjf(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.ƀjg(s.text).map(a=>{let l=new L.TextStyle(s.pixiStyle),c=L.TextMetrics.measureText(a,l,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 ƀjg(t){if(t==="")return [""];let e=[],i="",r=t[0]===" ";for(let s=0;s<t.length;s++){let n=t[s],a=n===" ";a===r?i+=n:(e.push(i),i=n,r=a);}return i&&e.push(i),e}};var Ae=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀci.length===0}get remainingWidth(){return this.ƀkt-this.ƀck}constructor(t,e){this.ƀkt=t,this.ƀfw=[],this.ƀci=[],this.ƀck=0,this.ƀfv=new Vector(0,0),this.ƀcj=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀew=i.horizontalAlignment,this.ƀkm=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀkt||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀcl={direction:i.rectangleCutOption.direction,rectangle:this.ƀbo(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀcj,t.y),i=this.ƀdx(this.ƀfv.y,this.ƀfv.y+e);return this.ƀck+t.x<=i}insertWord(t){let e=Math.max(this.ƀcj,t.style.height);if(this.ƀci.length===0){let i=this.ƀdy(this.ƀfv.y,this.ƀfv.y+e);this.ƀfv=new Vector(i,this.ƀfv.y),this.ƀck=this.ƀfv.x;}this.ƀci.push({chunk:t,position:new Vector(this.ƀck,this.ƀfv.y)}),this.ƀcj=e,this.ƀck+=t.style.width;}newLine(){let t=this.ƀfv.y+this.ƀcj,e=this.ƀdy(t,t);this.ƀdd(),this.ƀfv=new Vector(e,t),this.ƀck=this.ƀfv.x,this.ƀcj=0;}print(){return this.ƀdd(),this.ƀfw}ƀdd(){this.ƀci.length>0&&(this.ƀfw.push(this.ƀg(this.ƀci)),this.ƀci=[]);}ƀg(t){return t=this.ƀko(t),t=this.ƀey(t),t}ƀey(t){if(this.ƀew==="left")return t;let e=this.ƀfv.y+this.ƀcj,i=this.ƀdy(this.ƀfv.y,e),s=this.ƀdx(this.ƀfv.y,e)-i,n=Math.min(s,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀew==="center"?a=(s-n)/2:a=s-n,t.map(l=>(l={chunk:l.chunk,position:new Vector(l.position.x+a,l.position.y)},l))}ƀko(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.ƀkm){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.ƀkm;throw new Error(`Unexpected case! "${this.ƀkm}"`)}}return r={chunk:r.chunk,position:new Vector(r.position.x,r.position.y+s)},r})}ƀdy(t,e){return this.ƀcl&&(this.ƀcl.direction==="topLeft"||this.ƀcl.direction==="bottomLeft")&&(this.ƀcl.rectangle.isPointInside(new Vector(0,t),{includeEdges:false})||this.ƀcl.rectangle.isPointInside(new Vector(0,e),{includeEdges:false}))?this.ƀcl.rectangle.bottomRight.x:0}ƀdx(t,e){return this.ƀcl&&(this.ƀcl.direction==="topRight"||this.ƀcl.direction==="bottomRight")&&(this.ƀcl.rectangle.isPointInside(new Vector(this.ƀkt,t),{includeEdges:false})||this.ƀcl.rectangle.isPointInside(new Vector(this.ƀkt,e),{includeEdges:false}))?this.ƀcl.rectangle.topLeft.x:this.ƀkt}ƀbo(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(`Unexpected case! "${t.direction}"`)}}return new Rectangle(e,i)}};var Oe=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 n=i[i.length-1];e.isSpaceAvailable(new Vector(n.style.width+r.style.width,n.style.height))?e.insertWord(r):this.ƀku(r,e);}else e.insertWord(r);else e.lineIsEmpty?e.insertWord(r):r.whitespace?this.ƀku(r,e):(e.newLine(),e.insertWord(r));}),e.newLine();}),e.print()}static ƀku(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 n={text:" ".repeat(r),whitespace:true,style:{...t.style,width:r*t.style.spaceWidth}};e.insertWord(n);}e.newLine();let s=t.text.length-r-1;if(s>0){let n={text:" ".repeat(s),whitespace:true,style:{...t.style,width:s*t.style.spaceWidth}};e.insertWord(n);}}};var Me=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀgj(t),t=this.ƀkd(t),this.ƀat(t)}static ƀgj(t){return t.map(e=>{let i=[],r,s=true;return e.forEach(n=>{if(!r||r.chunk.style.cacheKey!==n.chunk.style.cacheKey)r&&i.push(r),r=n,s=n.chunk.whitespace;else {let a=r.chunk.text+n.chunk.text;s=n.chunk.whitespace&&s,r={chunk:{text:a,whitespace:s,style:{...r.chunk.style,width:r.chunk.style.width+n.chunk.style.width}},position:r.position};}}),r&&i.push(r),i})}static ƀkd(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 ƀat(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 Qt=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=Ie.process(t,e),r=JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),s=new Ae(e.default.wordWrapWidth??1/0,r),n=Oe.wrapText(i,s);return Me.process(n)}};var js=1,Xi=1/js,qt=class extends u{static{h(this,"Text");}get ƀjw(){if(!this.ƀjx){let t=new L.TextStyle(this.ƀhw);this.ƀjx=L.TextMetrics.measureText(this.ƀjv,t);}return this.ƀjx}get ascent(){return this.ƀjw.fontProperties.ascent}constructor(t,e){super(),this.ƀhw=At.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀhv.destroyed&&this.ƀhv.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new Vector(this.ƀhv.anchor.x,this.ƀhv.anchor.y)}set anchor(t){this.ƀi=t,this.ƀhv.anchor.set(t.x,t.y);}setText(t){return this.ƀjv!==t&&(this.ƀjv=t,this.ƀid()),this}setColor(t){let e=ColorHelper.rgbToHex(t);return this.ƀhw.fill!==e&&(this.ƀhw.fill=e,this.ƀid()),this}ƀid(){this.ƀhv?.destroy(),this.ƀjq?.destroy(),this.ƀjq=void 0,this.ƀjx=void 0;let t=new L.TextStyle(this.ƀhw);this.ƀhv=new L.Text(this.ƀjv,t),this.ƀih(),this.ƀi&&this.ƀhv.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀhv.scale.set(Xi,Xi),this.ƀhs.addChild(this.ƀhv),this.ƀhw.lineThrough&&(this.ƀjq=this.ƀe(this.ƀhv,this.ƀhw.fill),this.ƀhs.addChild(this.ƀjq));}ƀih(){let t=L.TextMetrics.measureText(this.ƀjv,new L.TextStyle({...this.ƀhw,dropShadow:false,dropShadowAlpha:0,dropShadowBlur:0,dropShadowDistance:0}));this.ƀhv.calculateBounds=function(){this.updateText(true),this._bounds.clear();let e=-this.anchor.x*t.width,i=-this.anchor.y*t.height;this._bounds.addFrame(this.transform,e,i,e+t.width,i+t.height);};}ƀe(t,e){let i=L.TextMetrics.measureText(t.text,t.style),r=Math.max(1,Math.round(i.lineHeight*.07)),s=r%2*.5,n=new L.Graphics;n.lineStyle(r,e);let a=0;return i.lines.forEach((l,c)=>{let p=L.TextMetrics.measureText(l,t.style),m=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+s,g=0;t.style.align==="center"?g=0+(t.width-p.width)*.5:t.style.align==="right"&&(g=0+t.width-p.width),g=Math.floor(g),n.moveTo(Math.floor(g),m),n.lineTo(Math.floor(g+p.width),m),a+=p.lineHeight;}),n.endFill(),n}};var hi=class extends u{static{h(this,"RichText");}constructor(t,e){super(),Qt.process(t,e).forEach(r=>new qt(r.text,r.style).setPosition(r.position).displayParent(this).attach(this));}};var li=class extends u{static{h(this,"UpdatableContainer");}},ci=class extends u{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀbu=t,this.ƀco=new Map,this.ƀhb={trackBy:h((i,r)=>r,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀco.keys()),i=0;t.forEach((r,s)=>{let n=this.ƀhb.trackBy(r,s),a;this.ƀco.has(n)?(a=this.ƀco.get(n),e.delete(n),a.update(r)):(a=this.ƀbu(r).displayParent(this).attach(this),this.ƀco.set(n,a)),this.ƀhb.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀhb.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀhb.positioning.spacing);}),e.forEach(r=>{this.ƀco.get(r).destroy(),this.ƀco.delete(r);});}};var te=class o extends u{static{h(this,"MenuUI");}static{this.ƀfk=Reducer.createExistenceChecker();}static{this.isAnyMenuTransitioning=this.ƀfk.notifier;}static getIsAnyMenuTransitioning(){return o.ƀfk.value}constructor(t,e){super(),this.ƀgt=new SingleAction,this.onCreate=this.ƀgt.notifier,this.ƀgv=new SingleAction,this.onOpen=this.ƀgv.notifier,this.ƀgq=new SingleAction,this.onClose=this.ƀgq.notifier,this.ƀaw=false;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.setAlpha(0),this.ƀo=new D(this,"alpha",{animation:P.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:_.CompletePrevious,completionHandling:R.StayInCurrentState});let r=E.createRectangle(new Vector(1,1),ColorHelper.black).toSprite({cache:true}).setAlpha(i.backgroundDarkeningRatio).setInteractive(true).displayParent(this).attach(this);this.ƀgh=Y.createByName(t).setPosition(new Vector(0,0)).setInteractive(true).displayParent(this).attach(this),x.instance.screenSize.subscribe(n=>{r.aspectRatio=n.x/n.y,r.scale=Math.max(n.x,n.y),r.setPosition(Vector.zero,{holdFrom:Vector.half}),this.setPosition(n.multiplyNumber(.5));}).attach(this),this.ƀgt.resolve();let s=o.ƀfk.effect().attach(this);this.ƀo.animate({alpha:1}).chain(this).tap(()=>{this.ƀgv.resolve(),s.destroy(),i.closeOnBackgroundClick&&r.on(jt.Click).take(1).tap(()=>this.close()).attach(this);}).attachToRoot();}getBoundingMask(){return this.ƀgh.getBoundingMask()}close(){if(!this.ƀaw){this.ƀaw=true;let t=o.ƀfk.effect().attach(this);this.ƀo.animate({alpha:0}).chain(this).map(()=>{this.ƀgq.resolve(),t.destroy(),this.destroy();}).chainToRoot();}return this.onClose.toSingleEvent().destroyIfNotAttached()}};var di=class extends ft{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.ƀhb=t,queueMicrotask(()=>{if(!this.ƀgi)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀif(t){this.ƀgi=t,this.ƀgi.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀgi.onCreate.toSingleEvent().destroyIfNotAttached()}onOpen(){return this.ƀgi.onOpen.toSingleEvent().destroyIfNotAttached()}onClose(){return this.ƀgi.onClose.toSingleEvent().destroyIfNotAttached()}close(){return this.ƀgi.close()}};var ui=class extends dt{static{h(this,"MenuView");}constructor(t,e,i){super();let r=JsonHelper.removeUndefinedProperties({appearAnimationDuration:i.appearAnimationDuration,backgroundDarkeningRatio:i.backgroundDarkeningRatio,closeOnBackgroundClick:t.ƀhb.closeOnBackgroundClick}),s=new te(e,r).displayParent(x.camera.layers.foregroundScreen).attach(this);t.ƀif(s);let n=new SingleAction;s.onCreate.subscribe(()=>n.resolve(s)).attach(this),this.onCreate=n.notifier,this.onOpen=s.onOpen.notifier,this.onClose=s.onClose.notifier;}};var Ys=.65,Xs=.01,Be=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀis}get contentSize(){return this.ƀbh.size.ceil()}constructor(t,e,i,r){this.ƀbh=t,this.ƀu=e,this.ƀhe=i,this.ƀje=r,this.ƀfh=false,this.ƀis=e-i*2,this.ƀbh.y=i,this.ƀjr=i;}onWheel(t){this.setTarget(this.ƀjr-t*Ys);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀjr=NumberHelper.clamp(t,this.ƀu-this.ƀhe-this.contentSize.y,this.ƀhe);}jumpToTarget(){this.ƀbh.y=this.ƀjr;}update(t){let e=this.contentSize;if(e.y<=this.ƀis){switch(this.ƀje){case "start":this.ƀjr=this.ƀhe;break;case "center":this.ƀjr=(this.ƀu-e.y)*.5;break;case "end":this.ƀjr=this.ƀu-e.y-this.ƀhe;break;default:{this.ƀje;throw new Error(`Unexpected case! "${this.ƀje}"`)}}this.ƀfh||(this.ƀbh.y=this.ƀjr);}this.ƀfh=true;let i=this.ƀjr-this.ƀbh.y;this.ƀbh.y=this.ƀbh.y+i*Xs*t;}};var Zs=15,fi=class extends u{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbi}get contentSize(){return this.ƀit.contentSize}constructor(t,e={}){super();let i={padding:Zs,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 u().displayParent(this).attach(this);new yt(r,t,i.padding).attach(this);let s=new L.Graphics;s.beginFill(0,1e-9),s.drawRect(0,0,t.x,t.y),s.endFill(),r.ƀhs.addChild(s);let n=new u().displayParent(r).attach(this);this.ƀit=new Be(n,t.y,i.padding,i.smallContentAlign),this.ƀbi=new Vector(t.x,this.ƀit.scrollHeight),s.eventMode="dynamic",s.addEventListener("wheel",a=>{this.ƀit.onWheel(a.deltaY);}),n.setInteractive(true),n.ƀhs.addEventListener("wheel",a=>{this.ƀit.onWheel(a.deltaY);}),y.afterSceneUpdateAction.subscribe(a=>this.ƀit.update(a.delta)).attach(this),this.addChildTo=n;}scrollToTop(t){this.ƀit.scrollToTop(),t?.instant&&this.ƀit.jumpToTarget();}scrollToBottom(t){this.ƀit.scrollToBottom(),t?.instant&&this.ƀit.jumpToTarget();}};var Qs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},qs=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},mi=class{static{h(this,"KeyboardService");}constructor(){this.ƀfr=new Action,this.keyPressed=this.ƀfr.notifier,this.ƀfs=new Action,this.keyReleased=this.ƀfs.notifier,this.ƀfy=new Set,this.ƀfx=new Set,window.addEventListener("keydown",t=>{this.ƀfy.add(t.key),this.ƀfx.add(t.key),!t.repeat&&this.ƀfr.trigger(t.key);}),window.addEventListener("keyup",t=>{this.ƀfy.delete(t.key),this.ƀfs.trigger(t.key);}),window.addEventListener("blur",()=>{this.ƀfy.clear();}),y.afterSceneUpdateAction.subscribe(()=>{this.ƀfx.clear();}).attachToRoot();}isKeyDown(t){return this.ƀfy.has(t)}isKeyJustPressed(t){return this.ƀfx.has(t)}};mi=Qs([d(),qs("design:paramtypes",[])],mi);var to=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},eo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},ie=class{static{h(this,"MouseService");}get initialMouseMoveHappened(){return this.ƀfg.value}getStagePosition(){return this.ƀji.value}getScreenPosition(){return this.ƀio.value}getMainButtonState(){return this.ƀgb.value}getSecondaryButtonState(){return this.ƀiu.value}constructor(){this.ƀfg=new Variable(false),this.onInitialMouseMove=this.ƀfg.notifier,this.ƀji=new Variable(Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀji.notifier,this.ƀio=new Variable(Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀio.notifier,this.ƀgb=new Variable(false),this.mainButtonState=this.ƀgb.notifier,this.ƀiu=new Variable(false),this.secondaryButtonState=this.ƀiu.notifier,this.ƀjj(),window.addEventListener("mousedown",t=>{t.button===0?this.ƀgb.value=true:t.button===2&&(this.ƀiu.value=true);}),window.addEventListener("mouseup",t=>{t.button===0?this.ƀgb.value=false:t.button===2&&(this.ƀiu.value=false);}),window.addEventListener("blur",()=>{this.ƀgb.value=false,this.ƀiu.value=false;});}ƀjj(){let t=Vector.zero;window.addEventListener("mousemove",e=>{t=new Vector(e.clientX,e.clientY),this.ƀfg.value=true;}),y.beforeSceneUpdateAction.subscribe(()=>{this.ƀio.value=t;}).attachToRoot(),y.afterSceneUpdateAction.subscribe(()=>{let e=x.instance.screenPositonToStagePosition(this.ƀio.value);e.isEqual(this.ƀji.value)?x.instance.renderer.events.onPointerMove(new PointerEvent("pointermove",{clientX:this.ƀio.value.x,clientY:this.ƀio.value.y,pointerType:"mouse"})):this.ƀji.value=e;}).attachToRoot();}};ie=to([d(),eo("design:paramtypes",[])],ie);var io=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ro=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},gi=class{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀde}get lastFocusedPosition(){return this.ƀfu}constructor(t){this.ƀgl=t,this.ƀgx=new Action,this.onTargetFocus=this.ƀgx.notifier,this.ƀkb=0,this.ƀkc=false,this.ƀde=false,this.ƀfu=void 0,y.beforeSceneUpdateAction.subscribe(e=>this.ƀkf(e.delta)).attachToRoot();}ƀkf(t){if(this.ƀgm){let e=this.ƀee(this.ƀgl.getStagePosition(),this.ƀgm);this.ƀhg===void 0?this.ƀhg=e:this.ƀas(e,t);}this.ƀgm=this.ƀgl.getStagePosition();}ƀas(t,e){this.ƀhg-t>10?(this.ƀkb=Math.max(250,this.ƀkb),this.ƀkc=true):this.ƀkb>1e3&&(this.ƀkc=true);let i=this.ƀkb>=300&&this.ƀkc;this.ƀfp(i,t,e);}ƀfp(t,e,i){(t||e>this.ƀhg)&&(this.ƀhg=e),t?(this.ƀkc=false,this.ƀkb=0,this.ƀde=true,this.ƀfu=this.ƀgl.getStagePosition(),this.ƀgx.trigger(this.ƀfu)):(this.ƀkb+=i,this.ƀde=false);}ƀee(t,e){let i=Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};gi=io([d(),ro("design:paramtypes",[ie])],gi);var yi=10.8,wi=10.01,it;(function(o){o[o.Point=1]="Point",o[o.Circle=2]="Circle",o[o.Polygon=3]="Polygon",o[o.Rectangle=4]="Rectangle";})(it||(it={}));var f=class o{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=>o.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new U.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var ot="border";var lo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},X=new $,Mt=class{static{h(this,"PhysicsInternalGateway");}createBody(t,e,i,r,s){return X.trigger("createBody",t,e,i,r,s)}getMaterial(t,e){return X.trigger("getMaterial",t,e)}getMaterialDefinition(t,e){return X.trigger("getMaterialDefinition",t,e)}getGroupConstant(t,e){return X.trigger("getGroupConstant",t,e)}getMaskConstant(t,e){return X.trigger("getMaskConstant",t,e)}addBody(t,e,i,r,s){return X.trigger("addBody",t,e,i,r,s)}removeBody(t,e){return X.trigger("removeBody",t,e)}subscribeToPhysicsStep(t,e){return X.trigger("subscribeToPhysicsStep",t,e)}};Mt=lo([d()],Mt);var b=class o extends k{static{h(this,"PhysicsEntity");}static{this.ƀhd=new Map;}static{this.ƀhk=new Map;}static getFromP2BodyID(t){return o.ƀhd.get(t)}static getFromP2BodyIDOrFail(t){let e=o.ƀhd.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=o.ƀhk.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(o.ƀhk.values())}get area(){return this.ƀt}get mass(){return this.ƀgf}get collisions(){return this.ƀax}constructor(t,e,i){super(),this.ƀgr=new Action,this.onCollision=this.ƀgr.notifier,this.type="dynamic",this.ƀt=0,this.ƀgf=0,this.ƀax=[],this.physicsWorldID=t,this.ƀhm=T.get(Mt);let r=this.ƀhm.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀhm.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀhl=this.ƀhm.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀhn=this.ƀhm.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀhm.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀt=this.p2Body.getArea(),this.ƀgf=this.p2Body.mass,this.p2Body.position=f.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀhm.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!");o.ƀhd.set(this.p2Body.id,this),o.ƀhk.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀhm.removeBody(this.physicsWorldID,this.p2Body),o.ƀhd.delete(this.p2Body.id),o.ƀhk.delete(this.id));}canCollideWith(t){return f.arePhysicsGroupsCollidable(this.ƀhl,this.ƀhn,t.ƀhl,t.ƀhn)}ƀiw(t){this.ƀax=t,t.length>0&&this.ƀgr.trigger(t);}};var re=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 xi=class extends k{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),y.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀjo(t,e);}).attach(this);}ƀjo(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 vi=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.ƀez=false,this.ƀfa=false,this.ƀfc=false,this.ƀfb=false,this.ƀhh(),this.ƀfz(),T.get(Mt).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀjo(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}}ƀjo(t,e){this.ƀez=true,this.ƀfa=true,this.ƀfc=true,this.ƀfb=true,this.ƀhh();}ƀhh(){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;}ƀfz(){this.position.subscribe(t=>{this.ƀez?this.ƀez=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfa?this.ƀfa=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfc?this.ƀfc=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfb?this.ƀfb=false:this.p2Body.angularVelocity=t;}).attach(this);}};var fo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},mo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},v=class extends k{static{h(this,"PhysicsWorldEntity");}constructor(t,e,i,r,s,n,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=n,this.physicsBodyGroupToP2Mask=a;}};v=fo([ut(),mo("design:paramtypes",[Vector,Boolean,U.World,Map,Map,Map,Map])],v);var xo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},K=class{static{h(this,"PhysicsBodyGroupService");}createBodyGroupsAndMasks(t,e){let i=new Map,r=new Map;return t.map((s,n)=>{if(n>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(s,1<<n),r.set(s,0);}),e.map(([s,n])=>{if(!i.has(s))throw new Error(`Physics body group "${s}" not found`);if(!i.has(n))throw new Error(`Physics body group "${n}" not found`);let a=r.get(s),l=r.get(n),c=i.get(s),p=i.get(n);r.set(s,a|p),r.set(n,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),n=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (s&n)!==0&&(a&r)!==0}};K=xo([d()],K);var vo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},bo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ve=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀhj=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((r,s)=>{r.forEach((n,a)=>{this.ƀhj.canCollide(t,a,e)&&i.push({grid:n,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();}};Ve=vo([d(),bo("design:paramtypes",[K])],Ve);var Po=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},So=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},nt=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀhj=t,this.ƀx=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let r=f.aabbToBoundingBox(e.aabb);this.ƀx.getCollidableGrids(t,i).forEach(s=>{let n=B.areaToGridArea(r,s.cellSize);s.grid.setArea(n,false);});}findClosestAvailableSpace(t,e,i,r=Dt){return e.aabbNeedsUpdate=true,e.updateAABB(),Jt.findByConvertingGridSpace(this.getAvilabilityGrid(t,r,i),f.aabbToBoundingBox(e.aabb),r)}getAvilabilityGrid(t,e,i){let r=this.ƀx.get(t,e,i);return r||(r=this.ƀbx(t,e,i),this.ƀx.set(t,e,i,r)),r}ƀbx(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 n=b.getFromP2BodyIDOrFail(s.id);if(n.includeInPathfinding&&this.ƀhj.canCollide(t,n.physicsBodyGroup,i)){let a=this.ƀdv(s,e);r.setArea(a,false);}}),r}ƀdv(t,e){let i=f.aabbToBoundingBox(t.aabb);return B.areaToGridArea(i,e)}};nt=Po([d(),So("design:paramtypes",[K,Ve])],nt);var Co=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ro=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Dt=50,Bt=class{static{h(this,"PathFinderService");}constructor(t){this.ƀhi=t;}findPathAStar(t,e,i,r,s){s||(s={}),s.neighborType===void 0&&(s.neighborType=GridNeighborType.Ortogonal),s.gridCellSize===void 0&&(s.gridCellSize=Dt);let n=v.getInstanceByIDOrFail(t),a,l;Comparator.isNumber(i)?(l=b.getPhysicsInstanceOrFail(i).p2Body,a=f.arrayToVector(l.position)):a=i;let c=B.positionToGridPosition(e,s.gridCellSize),p=B.positionToGridPosition(a,s.gridCellSize),m=this.ƀhi.getAvilabilityGrid(n,s.gridCellSize,r);if(l){let C=f.aabbToBoundingBox(l.aabb),bt=B.areaToGridArea(C,s.gridCellSize);m.setArea(bt,true);}let g=Yt.findPath(m,c,p,s.neighborType);return g.path=g.path.map(C=>B.gridPositionToPosition(C,s.gridCellSize)),g}findPathDirection(t,e,i,r,s=Dt){let n=v.getInstanceByIDOrFail(t),a;if(Comparator.isNumber(i)){let g=b.getPhysicsInstanceOrFail(i);a=f.aabbToBoundingBox(g.p2Body.aabb);}else a=new Rectangle(i,i);let l=B.areaToGridArea(a,s),c=JSON.stringify({targetGridArea:l,collidableWithGroup:r}),p=n.vectorFieldCache.get(c);if(!p){let g=this.ƀhi.getAvilabilityGrid(n,s,r);p=new Xt(l,g),n.vectorFieldCache.set(c,p);}let m=B.positionToGridPosition(e,s);return p.getDirectionToTarget(m)}};Bt=Co([d(),Ro("design:paramtypes",[nt])],Bt);var Oo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},H=new $,bi=class{static{h(this,"PhysicsGateway");}createPhysicsWorld(t){return H.trigger("createPhysicsWorld",t)}getMapSize(t){return H.trigger("getMapSize",t)}setPaused(t,e){return H.trigger("setPaused",t,e)}hitTest(t,e){return H.trigger("hitTest",t,e)}findPath(t,e,i,r,s){return H.trigger("findPath",t,e,i,r,s)}findPathDirection(t,e,i,r){return H.trigger("findPathDirection",t,e,i,r)}applyImpulse(t,e,i,r){return H.trigger("applyImpulse",t,e,i,r)}createExplosion(t,e,i,r,s,n){return H.trigger("createExplosion",t,e,i,r,s,n)}createElipticExplosion(t,e,i,r,s,n,a){return H.trigger("createElipticExplosion",t,e,i,r,s,n,a)}printPathfindingTestGrid(t,e,i,r,s,n=Dt){return H.trigger("printPathfindingTestGrid",t,e,i,r,s,n)}};bi=Oo([d()],bi);var Mo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Do=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Q=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀy=t,this.ƀhf=e;}printPathfindingTestGrid(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t);this.ƀy.getAvilabilityGrid(a,n,r).map((c,p)=>({position:B.gridPositionToPosition(p,n),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(s)){let p=this.ƀhf.findPathDirection(t,c.position,i,r),m;p===void 0?m=E.createRectangleBorders(new Vector(8,8),2,ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):m=E.createArrow(25,c.availability?ColorHelper.green:ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).setRotation(p).attach(a),new D(m,"alpha",{duration:1e3,animation:P.easeIn}).animate({alpha:0}).tap(()=>m.destroy()).attach(m);}});}createExplosionDebugVisual(t,e,i,r,s,n=300){let a=new u().displayParent(e).setAlpha(.5).attach(t);E.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;E.createVector(r,c.line.to,p).toSprite().displayParent(a).attach(t);}),new D(a,"alpha",{duration:n,animation:P.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,r,s,n,a=300){let l=new u().displayParent(e).setAlpha(.5).attach(t);E.createElipse(n,ColorHelper.blue).toSprite().displayParent(l).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attach(t),i.forEach(p=>{let m=p.hits.length>0?ColorHelper.red:ColorHelper.white;E.createVector(p.line.from,p.line.to,m).toSprite().displayParent(l).attach(t);}),new D(l,"alpha",{duration:a,animation:P.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),n=i?.color??ColorHelper.blue,a=new u().displayParent(e).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀcq(c,n).displayParent(a).attachToRoot();}),new D(a,"alpha",{duration:1e3,animation:P.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcq(t,e){switch(t.type){case U.Shape.PARTICLE:throw new Error("Not implemented");case U.Shape.LINE:throw new Error("Not implemented");case U.Shape.PLANE:throw new Error("Not implemented");case U.Shape.CIRCLE:throw new Error("Not implemented");case U.Shape.CAPSULE:throw new Error("Not implemented");case U.Shape.BOX:throw new Error("Not implemented");case U.Shape.HEIGHTFIELD:throw new Error("Not implemented");case U.Shape.CONVEX:return this.ƀcp(t,e);default:throw new Error("Not implemented")}}ƀcp(t,e){let i=[t.vertices.map(r=>({x:r[0],y:r[1]}))];return E.createPolygon(i,e).toSprite()}};Q=Mo([d(),Do("design:paramtypes",[nt,Bt])],Q);var Fo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},_o=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Le=class{static{h(this,"HitTestService");}constructor(t){this.ƀju=t;}hitTest(t,e){let i=t.world,r=b.getFromP2BodyIDOrFail(t.id),s=f.cloneP2Body(t);this.ƀs(s,e);let n=i.broadphase.aabbQuery(i,this.ƀdi(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(n.length!==0){let l=new U.World;l.addBody(s),n.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.ƀju.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀs(t,e){e?.overridePosition&&(t.position=f.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀdi(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};Le=Fo([d(),_o("design:paramtypes",[Q])],Le);var Lo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ne=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀie(t,i);});});}step(t,e,i){b.getPhysicsEntities().forEach(r=>{r.ƀax=[];}),t.p2World.narrowphase.contactEquations.forEach(r=>{this.ƀie(t,r);}),t.bodiesInContactWith.forEach((r,s)=>{this.ƀep(r.p2Body),r.entity.ƀiw(t.collisionReports.get(s)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀep(t){let e=f.arrayToVector(t.velocity);e.length>yi&&(e=e.normalize(yi),t.velocity=f.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-wi),wi);}ƀie(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)||[],n=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀdn(i,r,e);s.push({self:a,target:l}),n.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,s),t.collisionReports.set(e.bodyB.id,n);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀdn(t,e,i){let r=t.convertToDTO(),s=e.convertToDTO(),n=f.arrayToVector(i.contactPointA),a=f.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀec(i);return {collisionDetailsA:this.ƀdm(r,i.bodyA.mass,n,l,t.area),collisionDetailsB:this.ƀdm(s,i.bodyB.mass,a,c,e.area)}}ƀdm(t,e,i,r,s){let n,a=i.add(t.position);return {body:t,getPositionReletiveToObject:h(()=>(n||(n=i.rotate(t.rotation.multiply(-1).vector)),n),"getPositionReletiveToObject"),getPositionOnWorld:h(()=>(a||(a=i.add(t.position)),a),"getPositionOnWorld"),position:i,mass:e,area:s,normal:r}}ƀec(t){let e=f.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};Ne=Lo([d()],Ne);var No=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},jo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},je=class extends re{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};je=No([ut(),jo("design:paramtypes",[Number,Object])],je);var Ho=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},W=1e4,He=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbr(t,new Vector(e.x/2,-W/2),new Vector(e.x+W*2,W),i),this.ƀbr(t,new Vector(e.x/2,e.y+W/2),new Vector(e.x+W*2,W),i),this.ƀbr(t,new Vector(-W/2,e.y/2),new Vector(W,e.y+W*2),i),this.ƀbr(t,new Vector(e.x+W/2,e.y/2),new Vector(W,e.y+W*2),i);}ƀbr(t,e,i,r){return new je(t,{shapeDefinition:{materialName:ot,group:r,shapeType:it.Rectangle,shapeData:i},position:e,rotation:Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};He=Ho([d()],He);var Uo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},or=new U.Material,$o={id:ot,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},Gt=class{static{h(this,"MaterialsService");}createMaterials(t,e,i,r){let s=new Map,n=new Map;if(i.forEach(a=>{s.set(a.id,new U.Material),n.set(a.id,a);}),s.has(ot))throw new Error(`Material with name ${ot} cannot be defined, pick another name for the material.`);return s.set(ot,or),n.set(ot,$o),this.ƀc(t,e,i,r,s),{materials:s,materialDefinitions:n}}getMaterial(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀea(e,i.materials)}getMaterialDefinition(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀdz(e,i.materialDefinitions)}ƀea(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀdz(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.ƀds(i.map(n=>n.id),r).forEach(n=>{let a=this.ƀea(n.materialA,s),l=this.ƀea(n.materialB,s);t.addContactMaterial(new U.ContactMaterial(a,l,{friction:n.friction,restitution:n.bounciness,stiffness:n.stiffness,relaxation:n.relaxation}));}),this.ƀd(t,e,i,s);}ƀds(t,e){let i=new Map;e.forEach(s=>{let n=i.get(s.materialA);n||(n=new Map,i.set(s.materialA,n)),n.set(s.materialB,s);});let r=[];return t.forEach((s,n)=>{for(let a=n;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 n=this.ƀea(s.id,r);t.addContactMaterial(new U.ContactMaterial(n,or,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};Gt=Uo([d()],Gt);var ko=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},zo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ft=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,r,s){this.ƀgg=t,this.ƀah=e,this.ƀy=i,this.ƀay=r,this.ƀhj=s;}createPhysicsWorld(t){let e=new U.World({gravity:[0,0]}),{materials:i,materialDefinitions:r}=this.ƀgg.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:s,physicsBodyGroupToP2Mask:n}=this.ƀhj.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new v(t.mapSize,t.modifyUpdateCycle,e,i,r,s,n).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&y.cleanUpdateModifier();}).attachToRoot(),this.ƀah.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀay.registerPhysicsWorld(a),t.modifyUpdateCycle?y.registerUpdateModifier((l,c)=>this.ƀjo(a,l,c)):y.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀjo(a,l,c);}).attach(a),a.id}addBody(t,e,i,r,s){let n=v.getInstanceByIDOrFail(t);if(i){let a=this.ƀy.findClosestAvailableSpace(n,e,r);return a?(e.position[0]+=a.x,e.position[1]+=a.y,n.p2World.addBody(e),s&&this.ƀy.onBodyAdded(n,e,r),true):false}else return n.p2World.addBody(e),s&&this.ƀy.onBodyAdded(n,e,r),true}removeBody(t,e){v.getInstanceByID(t)?.p2World.removeBody(e);}ƀjo(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.ƀay.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);}};Ft=ko([d(),zo("design:paramtypes",[Gt,He,nt,Ne,K])],Ft);var Yo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Vt=class{static{h(this,"RayCastingService");}castClosest(t,e,i){let r=new U.RaycastResult,s=new U.Ray({mode:U.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.ƀbm(r,e)}castAllFirstContacts(t,e,i){let r=new Map,s=new U.Ray({mode:U.Ray.ALL,from:f.vectorToArray(e.from),to:f.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i),callback:h(n=>{let a=r.get(n.body);!r.has(n.body)||n.fraction<a.fraction?r.set(n.body,this.ƀbm(n,e)):n.fraction===a.fraction&&a.isExternal()&&r.set(n.body,this.ƀbm(n,e));},"callback")});return t.p2World.raycast(new U.RaycastResult,s),Array.from(r.values())}ƀbm(t,e){let i=t.fraction,r=f.arrayToVector(t.normal),s,n,a;return {body:t.body,hitPosition:h(()=>(s===void 0&&(s=e.from.lerp(e.to,i)),s),"hitPosition"),hitDistance:h(()=>(n===void 0&&(n=e.length*i),n),"hitDistance"),isExternal:h(()=>(a===void 0&&(a=e.fromTo.dotProduct(r)<0),a),"isExternal"),normal:r,fraction:i,line:e}}};Vt=Yo([d()],Vt);var Xo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},lt=class{static{h(this,"ImpactService");}applyImpulse(t,e,i,r){let s=i.normalize(r),n=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(f.vectorToArray(s),n);}};lt=Xo([d()],lt);var Ko=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Lt=class{static{h(this,"RayCastHitConverterService");}toExplosionHits(t,e=true){let i=new Map;return t.forEach(r=>{r.hits.forEach(s=>{let n=i.get(s.body);if(n){let a=s.fraction<n.closestRaycastHit.fraction?s:n.closestRaycastHit;n.rayCastHits.push(s),i.set(s.body,{hitCount:n.hitCount+1,closestRaycastHit:a,rayCastHits:n.rayCastHits,isExternal:e?n.isExternal:n.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.ƀbn(r,t.length))}ƀbn(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")}}}};Lt=Ko([d()],Lt);var Qo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},qo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},rn=15,Ue=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,r){this.ƀia=t,this.ƀju=e,this.ƀhz=i,this.ƀfd=r;}createElipticExplosion(t,e,i,r,s,n,a){let l=v.getInstanceByIDOrFail(t),c=this.ƀcc(e,i,r,s,a?.hitOnlyClosest===true,l),p=this.ƀhz.toExplosionHits(c,false);return this.ƀq(p,n),a?.testLayerID&&this.ƀju.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,r,a.debugRayDuration),p.map(m=>{let{p2Body:g,...C}=m;return C})}ƀcc(t,e,i,r,s,n){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 m=l.normalize(i.y);a.push(new Line(t,t.add(m))),a.push(new Line(t,t.add(m.multiplyNumber(-1))));let g=Math.round(i.y/rn),C=i.y/(g*2+1)*2,bt=l.normalize(C),se=i.x,ar=Math.pow(i.y,2);return ArrayHelper.createIntegerArray(g).forEach(pt=>{let Pt=C*(pt+1),Ti=bt.multiplyNumber(pt+1),oe=c.normalize(this.ƀek(se,ar,Pt)),ne=t.add(Ti);a.push(new Line(ne,ne.add(oe))),a.push(new Line(ne,ne.add(oe.multiplyNumber(-1))));let ae=t.add(Ti.multiplyNumber(-1));a.push(new Line(ae,ae.add(oe))),a.push(new Line(ae,ae.add(oe.multiplyNumber(-1))));}),a.map(pt=>{if(s){let Pt=this.ƀia.castClosest(n,pt,r);return {line:pt,hits:Pt?[Pt]:[]}}else {let Pt=this.ƀia.castAllFirstContacts(n,pt,r);return {line:pt,hits:Pt}}})}ƀek(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀq(t,e){t.forEach(i=>{i.raycastResults.forEach(r=>{let s,n;r.isExternal()?(s=r.line.fromTo,n=e*2):(s=r.line.fromTo.multiplyNumber(-1),n=e*(1-r.fraction)*8),this.ƀfd.applyImpulse(r.body,r.hitPosition(),s,n);});});}};Ue=Qo([d(),qo("design:paramtypes",[Vt,Q,Lt,lt])],Ue);var sn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},on=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},$e=class{static{h(this,"ExplosionService");}constructor(t,e,i,r){this.ƀia=t,this.ƀju=e,this.ƀhz=i,this.ƀfd=r;}createExplosion(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t),l=this.ƀeh(i),c=this.ƀcc(e,i,r,l,n?.hitOnlyClosest===true,a),p=this.ƀhz.toExplosionHits(c);return this.ƀq(e,i,s,l,p),n?.testLayerID&&this.ƀju.createExplosionDebugVisual(a,n.testLayerID,c,e,i,n.debugRayDuration),p}ƀcc(t,e,i,r,s,n){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 m=this.ƀia.castClosest(n,p,i);return {line:p,hits:m?[m]:[]}}else {let m=this.ƀia.castAllFirstContacts(n,p,i);return {line:p,hits:m}}})}ƀq(t,e,i,r,s){s.forEach(n=>{if(n.isExternal)n.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀfd.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=Vector.fromTo(t,f.arrayToVector(n.p2Body.position)),l=a.length/e,c=i*r*l/2;this.ƀfd.applyImpulse(n.p2Body,n.getHitPosition(),a,c);}});}ƀeh(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};$e=sn([d(),on("design:paramtypes",[Vt,Q,Lt,lt])],$e);var cn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Nt=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)}};Nt=cn([d()],Nt);var pn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},dn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Pi=class{static{h(this,"PhysicsController");}constructor(t,e,i,r,s,n,a,l){this.ƀhq=t,this.ƀhf=e,this.ƀju=i,this.ƀda=r,this.ƀcu=s,this.ƀeu=n,this.ƀhp=a,this.ƀfd=l;}createPhysicsWorld(t){return this.ƀhq.createPhysicsWorld(t)}getMapSize(t){return this.ƀhp.getMapSize(t)}setPaused(t,e){this.ƀhq.setPaused(t,e);}hitTest(t,e){let i=b.getPhysicsInstanceOrFail(t);return this.ƀeu.hitTest(i.p2Body,e)}findPath(t,e,i,r,s){return this.ƀhf.findPathAStar(t,e,i,r,{neighborType:s})}findPathDirection(t,e,i,r){return this.ƀhf.findPathDirection(t,e,i,r)}applyImpulse(t,e,i,r){let s=b.getPhysicsInstanceOrFail(t);this.ƀfd.applyImpulse(s.p2Body,e,i,r);}createExplosion(t,e,i,r,s,n){return this.ƀda.createExplosion(t,e,i,r,s,n)}createElipticExplosion(t,e,i,r,s,n,a){return this.ƀcu.createElipticExplosion(t,e,i,r,s,n,a)}printPathfindingTestGrid(t,e,i,r,s,n){this.ƀju.printPathfindingTestGrid(t,e,i,r,s,n);}};Pi=pn([q({controllerLink:H}),dn("design:paramtypes",[Ft,Bt,Q,$e,Ue,Le,Nt,lt])],Pi);var un=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ke=class{static{h(this,"ShapeCreationService");}createBody(t,e,i,r,s){let n=v.getInstanceByIDOrFail(t);if(!n.physicsBodyGroupToP2Group.has(e.shapeDefinition.group))throw new Error(`Physics body group "${e.shapeDefinition.group}" not found`);switch(e.shapeDefinition.shapeType){case it.Point:return this.ƀbt(n,void 0,i,r,e.shapeDefinition.group,s);case it.Circle:return this.ƀbt(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case it.Polygon:return this.ƀcb(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case it.Rectangle:return this.ƀcd(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);default:{e.shapeDefinition.shapeType;throw new Error(`Unexpected case! "${e.shapeDefinition.shapeType}"`)}}}ƀbt(t,e,i,r,s,n){let a=new U.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s),radius:e});a.material=i;let l=new U.Body({type:n==="dynamic"?U.Body.DYNAMIC:U.Body.STATIC,mass:r.density,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return l.addShape(a),l}ƀcb(t,e,i,r,s,n){let a=t.physicsBodyGroupToP2Group.get(s),l=t.physicsBodyGroupToP2Mask.get(s),c=e.map(g=>new U.Convex({vertices:g.map(C=>[C.x,C.y]),collisionGroup:a,collisionMask:l})).map(g=>(g.material=i,g)),p=c.reduce((g,C)=>g+C.area,0),m=new U.Body({type:n==="dynamic"?U.Body.DYNAMIC:U.Body.STATIC,mass:p,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.forEach(g=>m.addShape(g)),m.setDensity(r.density),m}ƀcd(t,e,i,r,s,n){let a=new U.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 U.Body({type:n==="dynamic"?U.Body.DYNAMIC:U.Body.STATIC,mass:l,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.addShape(a),c.setDensity(r.density),c}};ke=un([d()],ke);var fn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},mn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Si=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,r,s){this.ƀhq=t,this.ƀho=e,this.ƀjb=i,this.ƀhp=r,this.ƀhj=s;}createBody(t,e,i,r,s){return this.ƀjb.createBody(t,e,i,r,s)}getMaterial(t,e){return this.ƀho.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀho.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀhj.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀhj.getMaskConstant(t,e)}addBody(t,e,i,r,s){return this.ƀhq.addBody(t,e,i,r,s)}removeBody(t,e){this.ƀhq.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀhp.subscribeToPhysicsStep(t,e)}};Si=fn([q({controllerLink:X}),mn("design:paramtypes",[Ft,Gt,ke,Nt,K])],Si);export{Oi as AnimationFlicker,J as AnimationInterpolationFunctions,P as Animations,R as AnimationsCompletionHandlingType,D as Animator,ot as BORDER_MATERIAL_NAME,F as BardLegendsHardReset,St as BlendMode,Zt as Camera,Et as CameraGateway,Jt as ClosestAvailableSpaceHelper,u as Container,jt as ContainerEventType,q as ControllerDecorator,$ as ControllerLink,Ye as Cursor,O as DEFAULT_SHADER_RESOLUTION,ti as DeltaTime,ci as DisplayObjectArray,k as Entity,ut as EntityDecorator,Gi as FadeInContent,xe as FadeInStateAnimation,st as FocusingAnimation,x as Game,E as Graphics,re as ImmovablePhysicsEntity,mi as KeyboardService,di as MenuEntity,te as MenuUI,ui as MenuView,ie as MouseService,gi as MouseTargetFocusService,xi as MovableEntity,vi as MovablePhysicsEntity,Yt as PathFinder,b as PhysicsEntity,bi as PhysicsGateway,it as PhysicsShapeType,ai as Placeholder,Wt as PositionConversionHelper,wi as ROTATIONAL_SPEED_LIMIT,_ as ReAnimateHandlingType,hi as RichText,yi as SPEED_LIMIT,he as Scene,vr as SceneDecorator,fi as ScrollAreaUI,tt as ScrollDirection,yt as ScrollMaskUI,T as Service,d as ServiceDecorator,ft as SingletonEntity,Hi as SlideInContent,qe as SlideInContentByIndex,Se as SlideStateAnimation,et as SlideStateAnimationState,Y as Sprite,we as StateAnimation,qt as Text,li as UpdatableContainer,y as UpdateCycle,Xt as VectorFieldPathFinder,xt as VectorSet,dt as View,Je as ViewDecorator};
|
|
67
|
+
}`,e}constructor(t,e){if(super(o.ƀei(),o.ƀdr(t*O)),this.ƀcy=t,this.resolution=O,this.ƀcy=t*O,this.ƀcy<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀcy>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");Comparator.isInteger(this.ƀcy)||(this.ƀcy=Math.floor(this.ƀcy));let i=ColorHelper.normalize(e);this.uniforms.color=new Float32Array([i.red,i.green,i.blue]),this.uniforms.expandSquared=this.ƀcy*this.ƀcy,this.padding=this.ƀcy;}apply(t,e,i,r){this.uniforms.pixelSize=new Float32Array([1/(e.width*O),1/(e.height*O)]),t.applyFilter(this,e,i,r);}};var Pe=class extends L.Filter{static{h(this,"GlowFilter");}constructor(t){super(),this.resolution=O;let e={blurRadius:1,expand:0,color:ColorHelper.white,blendMode:St.Screen,...t};this.ƀcz=new be(e.expand,e.color);let i=Comparator.isNumber(e.blurRadius)?new Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀag=new Tt(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀag.blendMode=L.BLEND_MODES.SCREEN;}apply(t,e,i,r){let s=t.getFilterTexture();this.ƀcz.apply(t,e,s,L.CLEAR_MODES.CLEAR),this.ƀag.apply(t,s,i,r),t.returnFilterTexture(s);}};var kt=class o{static{h(this,"GlowSpriteGenerator");}static{this.ƀel=new Map;}static createGlowSpriteFromSprite(t,e,i){let r=this.ƀbc(e),s=Comparator.isNumber(r.blurRadius)?new Vector(r.blurRadius,r.blurRadius):r.blurRadius,n=this.ƀdt(t.texture,s,r.expand,r.color,i),a=new L.Sprite(n);return this.ƀiy(a,Vector.fromVec2(t.anchor),Math.max(s.x,s.y)+r.expand),a.alpha=r.glowAlpha,a.blendMode=r.blendMode,a}static ƀdt(t,e,i,r,s){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(s){let n=`${t.id}-${i}-${e.x}-${e.y}-${r.r}-${r.g}-${r.b}`;if(o.ƀel.has(n))return o.ƀel.get(n);{let a=this.ƀdu(t,e,i,r);return o.ƀel.set(n,a),a}}else return this.ƀdu(t,e,i,r)}static ƀdu(t,e,i,r){let s=new L.Sprite(t);this.ƀdb(s,Math.max(e.x,e.y)+i),s.filters=[new Pe({blurRadius:e,expand:i,color:r})];let n=x.instance.renderer.generateTexture(s);return n.id=M.insertAsset(n),s.destroy(),n}static ƀiy(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 ƀdb(t,e){if(t.isSprite){let s=new L.Graphics;t.addChild(s);}let i=t.width,r=t.height;t.calculateBounds=function(){this._bounds.clear(),this._bounds.addFrame(this.transform,-e,-e,i+e,r+e);};}static ƀbc(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:ColorHelper.white,blendMode:St.Add};return t&&(e={...e,...t}),e}};F.onHardReset.subscribe(()=>{kt.ƀel.clear();}).attachToRoot();var Y=class o extends u{static{h(this,"Sprite");}static createByName(t){let e=x.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new o(e)}static createSnapshotSprite(t){let e=t.ƀhs,i=e.parent;i&&i.removeChild(e);let r=x.instance.renderer.generateTexture(e,{resolution:2,scaleMode:L.SCALE_MODES.LINEAR,multisample:L.MSAA_QUALITY.HIGH});i&&i.addChild(e);let n={id:M.insertAsset(r),scale:t.scale,size:t.size,anchor:Vector.zero,destroyAssetOnDestroy:true};return new o(n,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀjy=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀjh=t,this.pixiSprite=new L.Sprite(M.getAsset(t.id)),this.ƀhs.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.ƀge?.destroy(),this.ƀai?.destroy(),this.ƀjh.destroyAssetOnDestroy&&(M.destroyAsset(this.ƀjh.id),this.ƀht&&M.destroyAsset(this.ƀht.texture.id)),this.ƀht&&!this.ƀht.destroyed&&this.ƀht.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀjy}set textureScale(t){this.ƀjy=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.ƀjh.boundingShapes&&!this.ƀhs.hitArea&&(this.ƀhs.hitArea=new me(this.ƀjh.boundingShapes,this.size,Vector.fromVec2(this.ƀjh.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.baseTexture.mipmap===L.MIPMAP_MODES.ON}set mipmap(t){t?this.pixiSprite.texture.baseTexture.mipmap=L.MIPMAP_MODES.ON:this.pixiSprite.texture.baseTexture.mipmap=L.MIPMAP_MODES.OFF;}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 L.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.ƀht)return this.ƀht.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀht)this.ƀht.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=Vector.fromVec2(this.ƀjh.anchor).to(t);return new Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀht&&(this.ƀht.destroy(),this.ƀht=void 0),t&&(this.ƀht=kt.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀjh.destroyAssetOnDestroy),this.ƀht.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀht.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀhs.addChild(this.ƀht)),this}showBoundingShape(t){return t?this.ƀai||(this.ƀai=this.ƀbs().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀai&&(this.ƀai.destroy(),this.ƀai=void 0),this}getBoundingMask(){if(!this.ƀge){if(!this.ƀjh.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀge=this.ƀbs(),this.ƀge.pixiSprite._maskRefCount=Number.POSITIVE_INFINITY,this.ƀge.pixiSprite.renderable=false,this.ƀge.displayParent(this);}return this.ƀge}ƀbs(){if(!this.ƀjh.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return E.createPolygon(this.ƀjh.boundingShapes,ColorHelper.white).toSprite().attach(this)}download(){let t=x.instance.renderer.extract.canvas(this.ƀhs);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}};var Qe=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},yt=class o extends u{static{h(this,"ScrollMaskUI");}static{this.ƀcr=new Map;}constructor(t,e,i,r=tt.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 u;r===tt.Horizontal?this.ƀby(e,i,s):this.ƀcf(e,i,s),this.ƀge=Y.createSnapshotSprite(s).attach(this),s.destroy(),t.setMask(this.ƀge);}ƀcf(t,e,i){e>0&&this.ƀbv(new Vector(t.x,e)).displayParent(i).attach(i),E.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.ƀbv(new Vector(t.x,e)).setPosition(new Vector(t.x,t.y),{round:false}).setRotation(Radian.get180).displayParent(i).attach(i);}ƀby(t,e,i){e>0&&this.ƀbv(new Vector(t.y,e)).setPosition(new Vector(0,t.y),{round:false}).setRotation(Radian.get270).displayParent(i).attach(i),E.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.ƀbv(new Vector(t.y,e)).setPosition(new Vector(t.x,0),{round:false}).setRotation(Radian.get90).displayParent(i).attach(i);}ƀbv(t){let i={id:this.ƀbw(t.y),scale:1,size:t,anchor:{x:0,y:0}};return new Y(i,{textureSize:t,ignoreAnchor:true})}ƀbw(t){let e=JSON.stringify({type:"gradient",length:t}),i=o.ƀcr.get(e);if(!i){let r=document.createElement("canvas");r.width=1,r.height=t;let s=r.getContext("2d");if(s){let n=new Qe;ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${n.multiplierFunction(l/t)})`;s.fillStyle=c,s.fillRect(0,l,1,1);});let a=L.Texture.from(r);i=M.insertAsset(a),o.ƀcr.set(e,i);}else throw new Error("Canvas context is null")}return i}};var et;(function(o){o[o.Appear=1]="Appear",o[o.Disappear=2]="Disappear";})(et||(et={}));var S;(function(o){o[o.Idle=1]="Idle",o[o.TransitionForward=2]="TransitionForward",o[o.TransitionBackward=3]="TransitionBackward",o[o.Reverting=4]="Reverting";})(S||(S={}));var Se=class extends Attachable{static{h(this,"SlideStateAnimation");}constructor(t){super(),this.ƀn=S.Idle,this.ƀgw=new Action,this.ƀgy=new Action,this.ƀhb={duration:500,animation:P.easeInOutCubic,...t},this.ƀjn=new we({duration:this.ƀhb.duration,animation:this.ƀhb.animation}).onStateChange((e,i)=>this.ƀeq(e,i)).onValueChange(e=>this.ƀer(e)).attach(this);}setIndex(t,e){if(!Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀff===void 0?(this.ƀff=t,this.ƀgw.trigger({state:et.Appear,index:t}),this.ƀjn.setState(t,e)):this.ƀff!==t?this.ƀgn!==t?this.ƀn===S.Idle?(this.ƀn=t>this.ƀff?S.TransitionForward:S.TransitionBackward,this.ƀgn=t,this.ƀgw.trigger({state:et.Appear,index:this.ƀgn}),this.ƀjn.setState(t,e)):this.ƀjn.setState(t,e):this.ƀn===S.Reverting&&this.ƀgn===t&&(this.ƀn=t>this.ƀff?S.TransitionForward:S.TransitionBackward,this.ƀjn.setState(t,e)):(this.ƀn===S.TransitionForward||this.ƀn===S.TransitionBackward)&&(this.ƀn=S.Reverting,this.ƀjn.setState(t,e));}ƀeq(t,e){switch(this.ƀff!==void 0&&this.ƀff!==t&&this.ƀff!==e&&this.ƀgw.trigger({state:et.Disappear,index:this.ƀff}),this.ƀgn!==void 0&&this.ƀgn!==t&&this.ƀgn!==e&&this.ƀgw.trigger({state:et.Disappear,index:this.ƀgn}),e!==void 0&&e!==this.ƀff&&e!==this.ƀgn&&this.ƀgw.trigger({state:et.Appear,index:e}),this.ƀn){case S.Idle:break;case S.TransitionForward:case S.TransitionBackward:e===void 0?(this.ƀn=S.Idle,this.ƀff=this.ƀgn,this.ƀgn=void 0):this.ƀff!==t&&this.ƀeo(t,e);break;case S.Reverting:e===void 0?(this.ƀn=S.Idle,this.ƀgn=void 0):this.ƀff!==e&&this.ƀeo(t,e);break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}ƀer(t){let e=1;(this.ƀn===S.TransitionBackward||this.ƀn===S.Reverting&&this.ƀff!==void 0&&this.ƀgn!==void 0&&this.ƀff>this.ƀgn)&&(e=-1),(this.ƀn===S.Idle||t!==0)&&this.ƀgy.trigger({value:NumberHelper.ensurePositiveZero(-e*t),index:this.ƀff}),this.ƀgn!==void 0&&this.ƀgy.trigger({value:NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀgn});}ƀeo(t,e){this.ƀff=t,this.ƀgn=e,this.ƀgy.trigger({value:0,index:this.ƀff}),this.ƀn=this.ƀff<this.ƀgn?S.TransitionForward:S.TransitionBackward;}onStateChange(t){return this.ƀgw.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀgy.subscribe(e=>t(e.value,e.index)).attach(this),this}};var tt;(function(o){o[o.Horizontal=1]="Horizontal",o[o.Vertical=2]="Vertical";})(tt||(tt={}));var qe=class extends u{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀbu=t,this.ƀcm="x",this.ƀbj=new Map,this.ƀhb={duration:300,animation:P.easeInOutCubic,size:new Vector(500,500),margin:20,direction:tt.Horizontal,...e};let i=this.ƀhb.direction===tt.Horizontal?new Vector(this.ƀhb.size.x+this.ƀhb.margin*2,this.ƀhb.size.y):new Vector(this.ƀhb.size.x,this.ƀhb.size.y+this.ƀhb.margin*2),r=new u().setPosition(this.ƀhb.direction===tt.Horizontal?new Vector(-this.ƀhb.margin,0):new Vector(0,-this.ƀhb.margin),{round:false}).displayParent(this).attach(this);this.ƀbz(i,this.ƀhb.margin,this.ƀhb.direction,r),this.ƀcm=this.ƀhb.direction===tt.Horizontal?"x":"y",this.ƀjn=new Se({duration:this.ƀhb.duration,animation:this.ƀhb.animation}).onStateChange((s,n)=>{if(s===et.Appear){let a=new u().displayParent(this).attach(this);this.ƀbj.set(n,a),this.ƀbu({index:n,container:a});}else {let a=this.ƀbj.get(n);a&&(a.destroy(),this.ƀbj.delete(n));}}).onValueChange((s,n)=>{let a=this.ƀbj.get(n);if(a){let l={x:0,y:0};l[this.ƀcm]=i[this.ƀcm]*s+this.ƀhb.margin,a.setPosition(Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=r;}setIndex(t,e){return this.ƀjn.setIndex(t,e),this}ƀbz(t,e,i,r){new yt(r,new Vector(t.x,t.y),e,i).attach(this);}},Hi=class extends qe{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 xt=class{static{h(this,"VectorSet");}constructor(){this.ƀkk=new Map;}add(t){let e=this.ƀkk.get(t.x);e||(e=new Set,this.ƀkk.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀkk.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀkk.get(t.x);return e?e.delete(t.y):false}};var ti=class{static{h(this,"DeltaTime");}static adjustMultiplier(t,e){return Math.pow(t,e)}};var B=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 Jt=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=B.areaToGridArea(e,i);if(this.ƀar(t,s))return Vector.zero;let n=t.movePositionInsideGrid(s.topLeft),a=Vector.fromTo(s.topLeft,n),l=this.find(t,n,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 xt,s=new Queue(e);for(;s.notEmpty;){let n=s.pop();r.add(n);let a=new Rectangle(n,n.add(i));if(this.ƀar(t,a))return Vector.fromTo(e,n);t.getNeighborPositions(n,GridNeighborType.Ortogonal).forEach(l=>{r.has(l)||s.add(l);});}}static ƀar(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 Wi=class{static{h(this,"PathfinderNode");}constructor(t,e,i,r=void 0){this.position=t,this.distanceFromStart=e,this.distanceToEnd=i,this.parent=r,this.closed=false;}get pathLength(){return this.distanceFromStart+this.distanceToEnd}isEqual(t){return Vector.isEqual(this.position,t)}createSolutionPath(t){let e=[this.position],i=this.parent;for(;i!==void 0;)e.push(i.position),i=i.parent;return e.reverse(),{directPathAvailable:t,path:e}}getDistance(t){return this.position.getDistance(t)}},cs=class{static{h(this,"PathfinderGrid");}constructor(t,e){this.ƀen=t,this.ƀjk=e,this.ƀha=new BinaryHeap("min"),this.ƀav=[],this.ƀgp=new Grid({size:t.size,defaultValue:void 0});let i=new Wi(this.ƀjk,0,Number.MAX_SAFE_INTEGER);this.ƀha.add(i.pathLength,i);}get hasOpenNodes(){return this.ƀha.size>0}getNeighbors(t,e){return this.ƀen.getNeighborPositions(t.position,e).filter(i=>this.ƀen.get(i)).map(i=>this.ƀgp.get(i)||this.ƀca(i))}popLowestPathCostNode(){let t=this.ƀha.pop();return this.ƀha.delete(t),t.closed=true,this.ƀav.push(t),t}changeNodeCost(t,e,i,r){this.ƀha.delete(t),t.distanceFromStart=e,t.distanceToEnd=t.getDistance(i),t.parent=r,this.ƀha.add(t.pathLength,t);}getBestClosedNode(){return this.ƀav.reduce((t,e)=>t.distanceToEnd<e.distanceToEnd?t:e)}ƀca(t){let e=new Wi(t,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);return this.ƀgp.set(t,e),this.ƀha.add(e.pathLength,e),e}},Yt=class{static{h(this,"PathFinder");}static findPath(t,e,i,r){let s=new cs(t,e);for(;s.hasOpenNodes;){let n=s.popLowestPathCostNode();if(n.isEqual(i))return n.createSolutionPath(true);let a=s.getNeighbors(n,r);for(let l of a)if(!l.closed){let c=n.distanceFromStart+n.getDistance(l.position);c<l.distanceFromStart&&s.changeNodeCost(l,c,i,n);}}return s.getBestClosedNode().createSolutionPath(false)}};var Xt=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀjs=t,this.ƀw=e,this.ƀet=this.ƀdw(this.ƀw.size),this.ƀks=new Grid({size:this.ƀw.size,defaultValue:this.ƀet}),this.ƀcn=new Grid({size:this.ƀw.size,defaultValue:void 0});let i=new xt,r=new Queue;for(this.ƀdk(this.ƀw.cropAreaOutsideOfTheGrid(t)).forEach(n=>{this.ƀks.set(n,0),r.add(n);});r.notEmpty;){let n=r.pop();if(!i.has(n)){i.add(n);let a=this.ƀks.getOrFail(n);this.ƀeb(n,this.ƀw).forEach(l=>{if(!i.has(l.position)){let c=this.ƀks.getOrFail(l.position),p=a+l.distance;this.ƀw.getOrFail(l.position)&&p<c&&(this.ƀks.set(l.position,p),r.add(l.position));}});}}}getDirectionToTarget(t){if(!t.isInsideRectangle(this.ƀjs)){if(t=this.ƀks.movePositionInsideGrid(t),this.ƀcn.has(t))return this.ƀcn.get(t);{let e=this.ƀeb(t,this.ƀw),i;return this.ƀks.getOrFail(t)>=this.ƀet?e.some(s=>this.ƀw.get(s.position))&&(e.some(n=>!this.ƀw.get(n.position))?i=this.ƀdq(e):i=this.ƀdl(t,e)):i=this.ƀdl(t,e),this.ƀcn.set(t,i),i}}}ƀdq(t){let e=t.filter(i=>this.ƀw.get(i.position)).map(i=>i.direction.radian);return Radian.getAverage(...e)}ƀdl(t,e){let i=e.filter(r=>this.ƀks.getOrFail(r.position)<this.ƀet).reduce((r,s)=>{let n=this.ƀks.getOrFail(s.position)+s.distance;return n<r.bestWeight?(r.bestDirections=[s.direction],r.bestWeight=n):n===r.bestWeight&&r.bestDirections.push(s.direction),r},{bestDirections:[],bestWeight:this.ƀet}).bestDirections;return this.ƀeg(i,t)}ƀeg(t,e){if(t.length>0){let i=t.reduce((r,s)=>r.add(s),Vector.zero);if(i.isZero()||!this.ƀfl(e,i))return Random.pickRandomElement(t).radian;if(t.length>=1)return i.radian}}ƀfl(t,e){let i=t.add(this.ƀkl(e));return this.ƀw.isPointWithinBounds(i)&&this.ƀw.getOrFail(i)}ƀeb(t,e){return this.ƀks.getNeighborDirections(t,GridNeighborType.All).map(i=>({position:t.add(i),direction:i,distance:i.x!==0&&i.y!==0?14:10}))}ƀdk(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}ƀkl(t){let e=t.normalize().round();return new Vector(e.x,e.y)}ƀdw(t){return (t.x+t.y)*20}};var ms=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},V=class extends ft{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);}};V=ms([ut()],V);var gs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ys=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},It=class extends dt{static{h(this,"CameraView");}constructor(t){super(),this.ƀcw=t,this.ƀim=new u().setAlpha(0).displayParent(x.instance.stage).attach(this),this.ƀac=E.createRectangle(new Vector(1,1),ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(x.instance.stage).attach(this),this.ƀaa=new u().displayParent(this.ƀim).attach(this),this.ƀao=new u().displayParent(this.ƀim).attach(this),this.ƀdg=new u().setSortableChildren(true).displayParent(this.ƀim).attach(this),this.ƀan=new u().setSortableChildren(true).displayParent(this.ƀao).attach(this),this.ƀdf=new u().setSortableChildren(true).setZIndex(20).displayParent(this.ƀan).attach(this),this.ƀgc=new u().setSortableChildren(true).setZIndex(10).displayParent(this.ƀan).attach(this),this.ƀz=new u().setZIndex(0).displayParent(this.ƀan).attach(this),this.ƀh=new D(this.ƀim,"alpha",{duration:500,animation:P.easeInOutCubic,reAnimateHandling:_.CompletePrevious,completionHandling:R.StayInCurrentState}),this.ƀad=new D(this.ƀac,"alpha",{duration:500,animation:P.easeInOutCubic,reAnimateHandling:_.CompletePrevious,completionHandling:R.StayInCurrentState}),x.instance.screenSize.subscribe(e=>{this.ƀac.aspectRatio=e.x/e.y,this.ƀac.scale=Math.max(e.x,e.y),this.ƀac.setPosition(Vector.zero,{holdFrom:Vector.zero});}).attach(this),x.instance.setScreenPositionToStagePositionFunction(e=>new Vector(e.x-this.ƀan.position.x-this.ƀao.position.x,e.y-this.ƀan.position.y-this.ƀao.position.y)),this.ƀcw.position.subscribe(e=>{this.ƀan.position=this.ƀbp(e);}).attach(this),this.ƀcw.offset.subscribe(e=>{this.ƀao.position=e;}).attach(this),this.appear(true,"alpha");}destroy(){this.destroyed||(super.destroy(),x.instance.resetScreenPositionToStagePositionFunction());}getLayers(){return {backgroundScreen:this.ƀaa.id,background:this.ƀz.id,main:this.ƀgc.id,foreground:this.ƀdf.id,foregroundScreen:this.ƀdg.id}}appear(t,e){switch(e){case "alpha":return this.ƀad.set({alpha:0}),this.ƀh.set({alpha:t?0:1}),this.ƀh.animate({alpha:t?1:0}).chain(this);case "pureBlack":return this.ƀh.set({alpha:1}),this.ƀad.set({alpha:t?1:0}),this.ƀad.animate({alpha:t?0:1}).chain(this);case "instant":return this.ƀh.set({alpha:t?1:0}),this.ƀad.set({alpha:t?0:1}),SingleEvent.instant();default:{throw new Error('Switch ended with value "never".')}}}ƀbp(t){return Vector.fromTo(t,x.instance.getScreenSizeCenter())}};It=gs([Je({entity:V}),ys("design:paramtypes",[V])],It);var vs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},bs=1500,Ee=class{static{h(this,"CameraService");}createCamera(){return new V().attachToRoot()}getCameraPosition(){let t=V.getInstanceOrFail();return Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=V.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=V.getInstanceOrFail();e.focusingNewTargetInfo.value={time:x.time,duration:t?.duration??bs,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??st.Instant};}update(t,e){let i=V.getInstanceOrFail(),r=i.targetPosition.value;r&&(i.focusingNewTargetInfo.value?this.ƀfo(i,r,t):i.position.value=r);}ƀfo(t,e,i){let r=t.focusingNewTargetInfo.value;if(r.focusingAnimation===st.Instant)this.ƀbb(t,e);else {let s=(i-r.time)/r.duration;if(s>=1)this.ƀbb(t,e);else {let n;r.focusingAnimation===st.EaseInOut?n=J.easeInOut(s):r.focusingAnimation===st.EaseOut?n=J.easeOut(s):n=1;let a=r.position.lerp(e,n);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;}}}ƀbb(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};Ee=vs([d()],Ee);var Ps=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ss=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},ri=class{static{h(this,"CameraController");}constructor(t){this.ƀap=t;}createCamera(){return this.ƀap.createCamera().id}update(t,e){this.ƀap.update(t,e);}setPosition(t){this.ƀap.setPosition(t);}setTransition(t){this.ƀap.setTransition(t);}getCameraPosition(){return this.ƀap.getCameraPosition()}};ri=Ps([q({controllerLink:gt}),Ss("design:paramtypes",[Ee])],ri);var Ts=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},si=class{static{h(this,"CameraViewController");}getLayers(){let t=V.getInstanceOrFail().id;return It.getInstanceOrFail(t).getLayers()}appear(t,e){let i=V.getInstanceOrFail().id;return It.getInstanceOrFail(i).appear(t,e)}};si=Ts([q({controllerLink:ye})],si);var Zt=class{static{h(this,"Camera");}get position(){return this.ƀam.getCameraPosition()}constructor(){this.ƀam=T.get(Et),this.ƀaq=T.get(Ut),this.ƀam.createCamera(),this.layers=this.ƀaq.getLayers();}setPosition(t){this.ƀam.setPosition(t);}setTransition(t){this.ƀam.setTransition(t);}appear(t,e="alpha"){return this.ƀaq.appear(t,e)}};var x=class o{static{h(this,"Game");}static get instance(){return this.ƀfi}static{this.pause=Reducer.createOr();}static get camera(){return this.ƀal}static get time(){return y.ƀjz}static get setupOptions(){return this.ƀja}getScreenSize(){return this.ƀiq.value}getScreenSizeCenter(){return this.ƀir.value}constructor(t){if(this.ƀiq=new Variable(Vector.zero),this.screenSize=this.ƀiq.notifier,this.ƀir=new Variable(Vector.zero),this.screenSizeCenter=this.ƀir.notifier,this.devMode=false,this.resetScreenPositionToStagePositionFunction(),o.ƀfi)throw new Error("There can be only one Game instance!");{this.ƀbf={screenResolution:void 0,devMode:false,backgroundColor:ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbf.devMode||false;let e=JsonHelper.removeUndefinedProperties({backgroundColor:this.ƀbf.backgroundColor,autoStart:false,antialias:this.ƀbf.antialias,resolution:this.ƀbf.resolution,width:this.ƀbf.screenResolution?.width,height:this.ƀbf.screenResolution?.height,resizeTo:this.ƀbf.screenResolution===void 0?window:void 0});this.ƀhr=new L.Application(e);}}async setup(t){o.ƀja=t,document.body.appendChild(this.ƀhr.view),await Promise.all([M.loadGameAssets(t.assetDefinitions)]),o.ƀfi=this,this.stage=new u().attachToRoot(),this.stage.ƀhs=this.ƀhr.stage,this.renderer=this.ƀhr.renderer,this.ƀiz(),this.stage.sortableChildren=true,globalThis.ƀa=this.ƀhr,window.addEventListener("resize",e=>{setTimeout(()=>this.ƀiz());}),o.ƀal=new Zt,this.ƀhr.start(),this.ƀhr.ticker.add(()=>{y.triggerUpdateTick(this.ƀhr.ticker.deltaMS);});}setResolution(t){this.ƀhr.renderer.resolution!==t&&(this.ƀhr.renderer.resolution=t,this.ƀhr.renderer.resize(this.ƀhr.screen.width,this.ƀhr.screen.height));}screenPositonToStagePosition(t){let e=Wt.includeScaleInScreenPosition(t,o.instance.stage.scale,o.instance.getScreenSizeCenter());return this.ƀip(e)}setScreenPositionToStagePositionFunction(t){this.ƀip=t;}resetScreenPositionToStagePositionFunction(){this.ƀip=t=>t;}destroyAsset(t){M.destroyAsset(t);}ƀiz(){let t=new Vector(this.ƀhr.screen.width,this.ƀhr.screen.height);this.ƀiq.value=t,this.ƀir.value=t.multiplyNumber(.5).round();}};var Ce=class{static{h(this,"DashedLineHelper");}static getLines(t,e,i){let r=Vector.fromTo(t,e),s=r.normalize(),n=r.length-i.lineStartGap-i.lineEndGap,a=[];if(n<=0)return a;let l=t.add(s.normalize(i.lineStartGap));if(n<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(s.normalize(n))}),a;let c=n-i.dashGap,p=i.dashLength+i.dashGap,m=Math.floor(c/p),g=c-p*m;m>=1&&g<i.dashLength&&(g+=p,m--);let C=s.normalize(g/2),bt=s.normalize(i.dashGap);if(a.push({from:l,to:l.add(C)}),l=l.add(C),m>0){let se=s.normalize(i.dashLength);ArrayHelper.createEmptyArray(m).forEach(()=>{l=l.add(bt),a.push({from:l,to:l.add(se)}),l=l.add(se);});}return l=l.add(bt),a.push({from:l,to:l.add(C)}),a}};var E=class o extends u{static{h(this,"Graphics");}static{this.ƀcr=new Map;}static createArrow(t,e){let i=new L.Graphics,r=[[{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}]];return i.beginFill(e),r.forEach(s=>{i.drawPolygon(s.map(n=>new L.Point(n.x,n.y)));}),i.endFill(),new o(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 L.Graphics;return s.lineStyle(r.width,r.color),Ce.getLines(t,e,r).forEach(a=>{s.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),new o(s,JSON.stringify({type:"dashedLine",from:t,to:e,options:r}))}static createVector(t,e,i){let r=new L.Graphics;return r.lineStyle(2,i),r.moveTo(t.x,t.y),r.lineTo(e.x,e.y),r.lineStyle(1,i),r.beginFill(ColorHelper.white),r.drawCircle(t.x,t.y,3),r.endFill(),new o(r,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let r=new L.Graphics;return r.beginFill(i),r.drawRect(0,0,t.x,e),r.drawRect(0,e,e,t.y-e*2),r.drawRect(t.x-e,e,e,t.y-e*2),r.drawRect(0,t.y-e,t.x,e),r.endFill(),new o(r,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=ColorHelper.white){let i=new L.Graphics;return i.beginFill(e),i.drawRect(0,0,t.x,t.y),i.endFill(),new o(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new L.Graphics;return i.beginFill(e),i.drawCircle(0,0,t),i.endFill(),new o(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new L.Graphics;return i.beginFill(e),i.drawEllipse(0,0,t.x,t.y),i.endFill(),new o(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new L.Graphics,r=JSON.stringify({type:"polygon",polygon:t,color:e});return i.beginFill(e),t.forEach(s=>{i.drawPolygon(s.map(n=>new L.Point(n.x,n.y)));}),i.endFill(),new o(i,r)}static createRegularPolygon(t,e,i){let r=new L.Graphics,s=new Radian(PI_360/t);r.beginFill(i),r.moveTo(e,0);for(let n=1;n<=t;n++){let l=s.multiply(n).vector.normalize(e),c=e+l.x,p=e+l.y;r.lineTo(c,p);}return r.endFill(),new o(r,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.ƀhs.addChild(t),this.pixiGraphics=t,this.ƀak=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀak,cache:false,...t},i=this.ƀef(e.cacheName,e.cache),r={id:i.assetID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},s=new Y(r,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),s}ƀef(t,e){if(e){let i=o.ƀcr.get(t);return i||(i=this.ƀce(),o.ƀcr.set(t,i)),i}else return this.ƀce()}ƀce(){let t=x.instance.renderer.generateTexture(this.pixiGraphics);t.id=M.insertAsset(t);let e=this.pixiGraphics.getBounds();return {assetID:t.id,bounds:new Vector(e.x,e.y)}}};var ai=class extends u{static{h(this,"Placeholder");}constructor(t){super(),this.ƀhu=new L.Graphics,this.ƀhu.beginFill(0,1e-9),this.ƀhu.drawRect(0,0,t.x,t.y),this.ƀhu.endFill(),this.ƀhs.addChild(this.ƀhu);}destroy(){this.destroyed||(super.destroy(),this.ƀhu.destroy());}};var At=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:true,dropShadowBlur:s.blur,dropShadowAngle:s.angle.value,dropShadowDistance:s.distance,dropShadowColor:ColorHelper.rgbToHex(s.color),dropShadowAlpha: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 Ie=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.ƀfe(r,e),n=this.ƀr(s);return this.ƀjf(n)}static ƀfe(t,e){let i=new Map,r=new Map,s=h((a,l)=>{if(r.has(l))return r.get(l);let c=At.getPixiTextStyle(a);return r.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀdo(a.tags,e,i),p=s(l,c),m=L.TextMetrics.measureText(" ",new L.TextStyle(p),false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:m.width}})}static ƀdo(t,e,i){let r=t.join("+");if(i.has(r))return {style:i.get(r),cacheKey:r};let s=this.ƀba(t,e);return i.set(r,s),{style:s,cacheKey:r}}static ƀba(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:n,...a}=i;return a}static ƀr(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 ƀjf(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.ƀjg(s.text).map(a=>{let l=new L.TextStyle(s.pixiStyle),c=L.TextMetrics.measureText(a,l,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 ƀjg(t){if(t==="")return [""];let e=[],i="",r=t[0]===" ";for(let s=0;s<t.length;s++){let n=t[s],a=n===" ";a===r?i+=n:(e.push(i),i=n,r=a);}return i&&e.push(i),e}};var Ae=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀci.length===0}get remainingWidth(){return this.ƀkt-this.ƀck}constructor(t,e){this.ƀkt=t,this.ƀfw=[],this.ƀci=[],this.ƀck=0,this.ƀfv=new Vector(0,0),this.ƀcj=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀew=i.horizontalAlignment,this.ƀkm=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀkt||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀcl={direction:i.rectangleCutOption.direction,rectangle:this.ƀbo(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀcj,t.y),i=this.ƀdx(this.ƀfv.y,this.ƀfv.y+e);return this.ƀck+t.x<=i}insertWord(t){let e=Math.max(this.ƀcj,t.style.height);if(this.ƀci.length===0){let i=this.ƀdy(this.ƀfv.y,this.ƀfv.y+e);this.ƀfv=new Vector(i,this.ƀfv.y),this.ƀck=this.ƀfv.x;}this.ƀci.push({chunk:t,position:new Vector(this.ƀck,this.ƀfv.y)}),this.ƀcj=e,this.ƀck+=t.style.width;}newLine(){let t=this.ƀfv.y+this.ƀcj,e=this.ƀdy(t,t);this.ƀdd(),this.ƀfv=new Vector(e,t),this.ƀck=this.ƀfv.x,this.ƀcj=0;}print(){return this.ƀdd(),this.ƀfw}ƀdd(){this.ƀci.length>0&&(this.ƀfw.push(this.ƀg(this.ƀci)),this.ƀci=[]);}ƀg(t){return t=this.ƀko(t),t=this.ƀey(t),t}ƀey(t){if(this.ƀew==="left")return t;let e=this.ƀfv.y+this.ƀcj,i=this.ƀdy(this.ƀfv.y,e),s=this.ƀdx(this.ƀfv.y,e)-i,n=Math.min(s,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀew==="center"?a=(s-n)/2:a=s-n,t.map(l=>(l={chunk:l.chunk,position:new Vector(l.position.x+a,l.position.y)},l))}ƀko(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.ƀkm){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.ƀkm;throw new Error(`Unexpected case! "${this.ƀkm}"`)}}return r={chunk:r.chunk,position:new Vector(r.position.x,r.position.y+s)},r})}ƀdy(t,e){return this.ƀcl&&(this.ƀcl.direction==="topLeft"||this.ƀcl.direction==="bottomLeft")&&(this.ƀcl.rectangle.isPointInside(new Vector(0,t),{includeEdges:false})||this.ƀcl.rectangle.isPointInside(new Vector(0,e),{includeEdges:false}))?this.ƀcl.rectangle.bottomRight.x:0}ƀdx(t,e){return this.ƀcl&&(this.ƀcl.direction==="topRight"||this.ƀcl.direction==="bottomRight")&&(this.ƀcl.rectangle.isPointInside(new Vector(this.ƀkt,t),{includeEdges:false})||this.ƀcl.rectangle.isPointInside(new Vector(this.ƀkt,e),{includeEdges:false}))?this.ƀcl.rectangle.topLeft.x:this.ƀkt}ƀbo(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(`Unexpected case! "${t.direction}"`)}}return new Rectangle(e,i)}};var Oe=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 n=i[i.length-1];e.isSpaceAvailable(new Vector(n.style.width+r.style.width,n.style.height))?e.insertWord(r):this.ƀku(r,e);}else e.insertWord(r);else e.lineIsEmpty?e.insertWord(r):r.whitespace?this.ƀku(r,e):(e.newLine(),e.insertWord(r));}),e.newLine();}),e.print()}static ƀku(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 n={text:" ".repeat(r),whitespace:true,style:{...t.style,width:r*t.style.spaceWidth}};e.insertWord(n);}e.newLine();let s=t.text.length-r-1;if(s>0){let n={text:" ".repeat(s),whitespace:true,style:{...t.style,width:s*t.style.spaceWidth}};e.insertWord(n);}}};var Me=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀgj(t),t=this.ƀkd(t),this.ƀat(t)}static ƀgj(t){return t.map(e=>{let i=[],r,s=true;return e.forEach(n=>{if(!r||r.chunk.style.cacheKey!==n.chunk.style.cacheKey)r&&i.push(r),r=n,s=n.chunk.whitespace;else {let a=r.chunk.text+n.chunk.text;s=n.chunk.whitespace&&s,r={chunk:{text:a,whitespace:s,style:{...r.chunk.style,width:r.chunk.style.width+n.chunk.style.width}},position:r.position};}}),r&&i.push(r),i})}static ƀkd(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 ƀat(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 Qt=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=Ie.process(t,e),r=JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),s=new Ae(e.default.wordWrapWidth??1/0,r),n=Oe.wrapText(i,s);return Me.process(n)}};var js=1,Xi=1/js,qt=class extends u{static{h(this,"Text");}get ƀjw(){if(!this.ƀjx){let t=new L.TextStyle(this.ƀhw);this.ƀjx=L.TextMetrics.measureText(this.ƀjv,t);}return this.ƀjx}get ascent(){return this.ƀjw.fontProperties.ascent}constructor(t,e){super(),this.ƀhw=At.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀhv.destroyed&&this.ƀhv.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new Vector(this.ƀhv.anchor.x,this.ƀhv.anchor.y)}set anchor(t){this.ƀi=t,this.ƀhv.anchor.set(t.x,t.y);}setText(t){return this.ƀjv!==t&&(this.ƀjv=t,this.ƀid()),this}setColor(t){let e=ColorHelper.rgbToHex(t);return this.ƀhw.fill!==e&&(this.ƀhw.fill=e,this.ƀid()),this}ƀid(){this.ƀhv?.destroy(),this.ƀjq?.destroy(),this.ƀjq=void 0,this.ƀjx=void 0;let t=new L.TextStyle(this.ƀhw);this.ƀhv=new L.Text(this.ƀjv,t),this.ƀih(),this.ƀi&&this.ƀhv.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀhv.scale.set(Xi,Xi),this.ƀhs.addChild(this.ƀhv),this.ƀhw.lineThrough&&(this.ƀjq=this.ƀe(this.ƀhv,this.ƀhw.fill),this.ƀhs.addChild(this.ƀjq));}ƀih(){let t=L.TextMetrics.measureText(this.ƀjv,new L.TextStyle({...this.ƀhw,dropShadow:false,dropShadowAlpha:0,dropShadowBlur:0,dropShadowDistance:0}));this.ƀhv.calculateBounds=function(){this.updateText(true),this._bounds.clear();let e=-this.anchor.x*t.width,i=-this.anchor.y*t.height;this._bounds.addFrame(this.transform,e,i,e+t.width,i+t.height);};}ƀe(t,e){let i=L.TextMetrics.measureText(t.text,t.style),r=Math.max(1,Math.round(i.lineHeight*.07)),s=r%2*.5,n=new L.Graphics;n.lineStyle(r,e);let a=0;return i.lines.forEach((l,c)=>{let p=L.TextMetrics.measureText(l,t.style),m=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+s,g=0;t.style.align==="center"?g=0+(t.width-p.width)*.5:t.style.align==="right"&&(g=0+t.width-p.width),g=Math.floor(g),n.moveTo(Math.floor(g),m),n.lineTo(Math.floor(g+p.width),m),a+=p.lineHeight;}),n.endFill(),n}};var hi=class extends u{static{h(this,"RichText");}constructor(t,e){super(),Qt.process(t,e).forEach(r=>new qt(r.text,r.style).setPosition(r.position).displayParent(this).attach(this));}};var li=class extends u{static{h(this,"UpdatableContainer");}},ci=class extends u{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀbu=t,this.ƀco=new Map,this.ƀhb={trackBy:h((i,r)=>r,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀco.keys()),i=0;t.forEach((r,s)=>{let n=this.ƀhb.trackBy(r,s),a;this.ƀco.has(n)?(a=this.ƀco.get(n),e.delete(n),a.update(r)):(a=this.ƀbu(r).displayParent(this).attach(this),this.ƀco.set(n,a)),this.ƀhb.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀhb.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀhb.positioning.spacing);}),e.forEach(r=>{this.ƀco.get(r).destroy(),this.ƀco.delete(r);});}};var te=class o extends u{static{h(this,"MenuUI");}static{this.ƀfk=Reducer.createExistenceChecker();}static{this.isAnyMenuTransitioning=this.ƀfk.notifier;}static getIsAnyMenuTransitioning(){return o.ƀfk.value}constructor(t,e){super(),this.ƀgt=new SingleAction,this.onCreate=this.ƀgt.notifier,this.ƀgv=new SingleAction,this.onOpen=this.ƀgv.notifier,this.ƀgq=new SingleAction,this.onClose=this.ƀgq.notifier,this.ƀaw=false;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.setAlpha(0),this.ƀo=new D(this,"alpha",{animation:P.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:_.CompletePrevious,completionHandling:R.StayInCurrentState});let r=E.createRectangle(new Vector(1,1),ColorHelper.black).toSprite({cache:true}).setAlpha(i.backgroundDarkeningRatio).setInteractive(true).displayParent(this).attach(this);this.ƀgh=Y.createByName(t).setPosition(new Vector(0,0)).setInteractive(true).displayParent(this).attach(this),x.instance.screenSize.subscribe(n=>{r.aspectRatio=n.x/n.y,r.scale=Math.max(n.x,n.y),r.setPosition(Vector.zero,{holdFrom:Vector.half}),this.setPosition(n.multiplyNumber(.5));}).attach(this),this.ƀgt.resolve();let s=o.ƀfk.effect().attach(this);this.ƀo.animate({alpha:1}).chain(this).tap(()=>{this.ƀgv.resolve(),s.destroy(),i.closeOnBackgroundClick&&r.on(jt.Click).take(1).tap(()=>this.close()).attach(this);}).attachToRoot();}getBoundingMask(){return this.ƀgh.getBoundingMask()}close(){if(!this.ƀaw){this.ƀaw=true;let t=o.ƀfk.effect().attach(this);this.ƀo.animate({alpha:0}).chain(this).map(()=>{this.ƀgq.resolve(),t.destroy(),this.destroy();}).chainToRoot();}return this.onClose.toSingleEvent().destroyIfNotAttached()}};var di=class extends ft{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.ƀhb=t,queueMicrotask(()=>{if(!this.ƀgi)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀif(t){this.ƀgi=t,this.ƀgi.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀgi.onCreate.toSingleEvent().destroyIfNotAttached()}onOpen(){return this.ƀgi.onOpen.toSingleEvent().destroyIfNotAttached()}onClose(){return this.ƀgi.onClose.toSingleEvent().destroyIfNotAttached()}close(){return this.ƀgi.close()}};var ui=class extends dt{static{h(this,"MenuView");}constructor(t,e,i){super();let r=JsonHelper.removeUndefinedProperties({appearAnimationDuration:i.appearAnimationDuration,backgroundDarkeningRatio:i.backgroundDarkeningRatio,closeOnBackgroundClick:t.ƀhb.closeOnBackgroundClick}),s=new te(e,r).displayParent(x.camera.layers.foregroundScreen).attach(this);t.ƀif(s);let n=new SingleAction;s.onCreate.subscribe(()=>n.resolve(s)).attach(this),this.onCreate=n.notifier,this.onOpen=s.onOpen.notifier,this.onClose=s.onClose.notifier;}};var Ys=.65,Xs=.01,Be=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀis}get contentSize(){return this.ƀbh.size.ceil()}constructor(t,e,i,r){this.ƀbh=t,this.ƀu=e,this.ƀhe=i,this.ƀje=r,this.ƀfh=false,this.ƀis=e-i*2,this.ƀbh.y=i,this.ƀjr=i;}onWheel(t){this.setTarget(this.ƀjr-t*Ys);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀjr=NumberHelper.clamp(t,this.ƀu-this.ƀhe-this.contentSize.y,this.ƀhe);}jumpToTarget(){this.ƀbh.y=this.ƀjr;}update(t){let e=this.contentSize;if(e.y<=this.ƀis){switch(this.ƀje){case "start":this.ƀjr=this.ƀhe;break;case "center":this.ƀjr=(this.ƀu-e.y)*.5;break;case "end":this.ƀjr=this.ƀu-e.y-this.ƀhe;break;default:{this.ƀje;throw new Error(`Unexpected case! "${this.ƀje}"`)}}this.ƀfh||(this.ƀbh.y=this.ƀjr);}this.ƀfh=true;let i=this.ƀjr-this.ƀbh.y;this.ƀbh.y=this.ƀbh.y+i*Xs*t;}};var Zs=15,fi=class extends u{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbi}get contentSize(){return this.ƀit.contentSize}constructor(t,e={}){super();let i={padding:Zs,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 u().displayParent(this).attach(this);new yt(r,t,i.padding).attach(this);let s=new L.Graphics;s.beginFill(0,1e-9),s.drawRect(0,0,t.x,t.y),s.endFill(),r.ƀhs.addChild(s);let n=new u().displayParent(r).attach(this);this.ƀit=new Be(n,t.y,i.padding,i.smallContentAlign),this.ƀbi=new Vector(t.x,this.ƀit.scrollHeight),s.eventMode="dynamic",s.addEventListener("wheel",a=>{this.ƀit.onWheel(a.deltaY);}),n.setInteractive(true),n.ƀhs.addEventListener("wheel",a=>{this.ƀit.onWheel(a.deltaY);}),y.afterSceneUpdateAction.subscribe(a=>this.ƀit.update(a.delta)).attach(this),this.addChildTo=n;}scrollToTop(t){this.ƀit.scrollToTop(),t?.instant&&this.ƀit.jumpToTarget();}scrollToBottom(t){this.ƀit.scrollToBottom(),t?.instant&&this.ƀit.jumpToTarget();}};var Qs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},qs=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},mi=class{static{h(this,"KeyboardService");}constructor(){this.ƀfr=new Action,this.keyPressed=this.ƀfr.notifier,this.ƀfs=new Action,this.keyReleased=this.ƀfs.notifier,this.ƀfy=new Set,this.ƀfx=new Set,window.addEventListener("keydown",t=>{this.ƀfy.add(t.key),this.ƀfx.add(t.key),!t.repeat&&this.ƀfr.trigger(t.key);}),window.addEventListener("keyup",t=>{this.ƀfy.delete(t.key),this.ƀfs.trigger(t.key);}),window.addEventListener("blur",()=>{this.ƀfy.clear();}),y.afterSceneUpdateAction.subscribe(()=>{this.ƀfx.clear();}).attachToRoot();}isKeyDown(t){return this.ƀfy.has(t)}isKeyJustPressed(t){return this.ƀfx.has(t)}};mi=Qs([d(),qs("design:paramtypes",[])],mi);var to=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},eo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},ie=class{static{h(this,"MouseService");}get initialMouseMoveHappened(){return this.ƀfg.value}getStagePosition(){return this.ƀji.value}getScreenPosition(){return this.ƀio.value}getMainButtonState(){return this.ƀgb.value}getSecondaryButtonState(){return this.ƀiu.value}constructor(){this.ƀfg=new Variable(false),this.onInitialMouseMove=this.ƀfg.notifier,this.ƀji=new Variable(Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀji.notifier,this.ƀio=new Variable(Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀio.notifier,this.ƀgb=new Variable(false),this.mainButtonState=this.ƀgb.notifier,this.ƀiu=new Variable(false),this.secondaryButtonState=this.ƀiu.notifier,this.ƀjj(),window.addEventListener("pointerdown",t=>{t.button===0?this.ƀgb.value=true:t.button===2&&(this.ƀiu.value=true);},{capture:true}),window.addEventListener("pointerup",t=>{t.button===0?this.ƀgb.value=false:t.button===2&&(this.ƀiu.value=false);},{capture:true}),window.addEventListener("blur",()=>{this.ƀgb.value=false,this.ƀiu.value=false;},{capture:true});}ƀjj(){let t=Vector.zero;window.addEventListener("pointermove",e=>{t=new Vector(e.clientX,e.clientY),this.ƀfg.value=true;},{capture:true}),y.beforeSceneUpdateAction.subscribe(()=>{this.ƀio.value=t;}).attachToRoot(),y.afterSceneUpdateAction.subscribe(()=>{let e=x.instance.screenPositonToStagePosition(this.ƀio.value);e.isEqual(this.ƀji.value)?x.instance.renderer.events.onPointerMove(new PointerEvent("pointermove",{clientX:this.ƀio.value.x,clientY:this.ƀio.value.y,pointerType:"mouse"})):this.ƀji.value=e;}).attachToRoot();}};ie=to([d(),eo("design:paramtypes",[])],ie);var io=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ro=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},gi=class{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀde}get lastFocusedPosition(){return this.ƀfu}constructor(t){this.ƀgl=t,this.ƀgx=new Action,this.onTargetFocus=this.ƀgx.notifier,this.ƀkb=0,this.ƀkc=false,this.ƀde=false,this.ƀfu=void 0,y.beforeSceneUpdateAction.subscribe(e=>this.ƀkf(e.delta)).attachToRoot();}ƀkf(t){if(this.ƀgm){let e=this.ƀee(this.ƀgl.getStagePosition(),this.ƀgm);this.ƀhg===void 0?this.ƀhg=e:this.ƀas(e,t);}this.ƀgm=this.ƀgl.getStagePosition();}ƀas(t,e){this.ƀhg-t>10?(this.ƀkb=Math.max(250,this.ƀkb),this.ƀkc=true):this.ƀkb>1e3&&(this.ƀkc=true);let i=this.ƀkb>=300&&this.ƀkc;this.ƀfp(i,t,e);}ƀfp(t,e,i){(t||e>this.ƀhg)&&(this.ƀhg=e),t?(this.ƀkc=false,this.ƀkb=0,this.ƀde=true,this.ƀfu=this.ƀgl.getStagePosition(),this.ƀgx.trigger(this.ƀfu)):(this.ƀkb+=i,this.ƀde=false);}ƀee(t,e){let i=Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};gi=io([d(),ro("design:paramtypes",[ie])],gi);var yi=10.8,wi=10.01,it;(function(o){o[o.Point=1]="Point",o[o.Circle=2]="Circle",o[o.Polygon=3]="Polygon",o[o.Rectangle=4]="Rectangle";})(it||(it={}));var f=class o{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=>o.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new U.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var ot="border";var lo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},X=new $,Mt=class{static{h(this,"PhysicsInternalGateway");}createBody(t,e,i,r,s){return X.trigger("createBody",t,e,i,r,s)}getMaterial(t,e){return X.trigger("getMaterial",t,e)}getMaterialDefinition(t,e){return X.trigger("getMaterialDefinition",t,e)}getGroupConstant(t,e){return X.trigger("getGroupConstant",t,e)}getMaskConstant(t,e){return X.trigger("getMaskConstant",t,e)}addBody(t,e,i,r,s){return X.trigger("addBody",t,e,i,r,s)}removeBody(t,e){return X.trigger("removeBody",t,e)}subscribeToPhysicsStep(t,e){return X.trigger("subscribeToPhysicsStep",t,e)}};Mt=lo([d()],Mt);var b=class o extends k{static{h(this,"PhysicsEntity");}static{this.ƀhd=new Map;}static{this.ƀhk=new Map;}static getFromP2BodyID(t){return o.ƀhd.get(t)}static getFromP2BodyIDOrFail(t){let e=o.ƀhd.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=o.ƀhk.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(o.ƀhk.values())}get area(){return this.ƀt}get mass(){return this.ƀgf}get collisions(){return this.ƀax}constructor(t,e,i){super(),this.ƀgr=new Action,this.onCollision=this.ƀgr.notifier,this.type="dynamic",this.ƀt=0,this.ƀgf=0,this.ƀax=[],this.physicsWorldID=t,this.ƀhm=T.get(Mt);let r=this.ƀhm.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀhm.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀhl=this.ƀhm.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀhn=this.ƀhm.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀhm.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀt=this.p2Body.getArea(),this.ƀgf=this.p2Body.mass,this.p2Body.position=f.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀhm.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!");o.ƀhd.set(this.p2Body.id,this),o.ƀhk.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀhm.removeBody(this.physicsWorldID,this.p2Body),o.ƀhd.delete(this.p2Body.id),o.ƀhk.delete(this.id));}canCollideWith(t){return f.arePhysicsGroupsCollidable(this.ƀhl,this.ƀhn,t.ƀhl,t.ƀhn)}ƀiw(t){this.ƀax=t,t.length>0&&this.ƀgr.trigger(t);}};var re=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 xi=class extends k{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),y.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀjo(t,e);}).attach(this);}ƀjo(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 vi=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.ƀez=false,this.ƀfa=false,this.ƀfc=false,this.ƀfb=false,this.ƀhh(),this.ƀfz(),T.get(Mt).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀjo(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}}ƀjo(t,e){this.ƀez=true,this.ƀfa=true,this.ƀfc=true,this.ƀfb=true,this.ƀhh();}ƀhh(){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;}ƀfz(){this.position.subscribe(t=>{this.ƀez?this.ƀez=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfa?this.ƀfa=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfc?this.ƀfc=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfb?this.ƀfb=false:this.p2Body.angularVelocity=t;}).attach(this);}};var fo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},mo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},v=class extends k{static{h(this,"PhysicsWorldEntity");}constructor(t,e,i,r,s,n,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=n,this.physicsBodyGroupToP2Mask=a;}};v=fo([ut(),mo("design:paramtypes",[Vector,Boolean,U.World,Map,Map,Map,Map])],v);var xo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},K=class{static{h(this,"PhysicsBodyGroupService");}createBodyGroupsAndMasks(t,e){let i=new Map,r=new Map;return t.map((s,n)=>{if(n>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(s,1<<n),r.set(s,0);}),e.map(([s,n])=>{if(!i.has(s))throw new Error(`Physics body group "${s}" not found`);if(!i.has(n))throw new Error(`Physics body group "${n}" not found`);let a=r.get(s),l=r.get(n),c=i.get(s),p=i.get(n);r.set(s,a|p),r.set(n,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),n=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (s&n)!==0&&(a&r)!==0}};K=xo([d()],K);var vo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},bo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ve=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀhj=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((r,s)=>{r.forEach((n,a)=>{this.ƀhj.canCollide(t,a,e)&&i.push({grid:n,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();}};Ve=vo([d(),bo("design:paramtypes",[K])],Ve);var Po=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},So=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},nt=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀhj=t,this.ƀx=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let r=f.aabbToBoundingBox(e.aabb);this.ƀx.getCollidableGrids(t,i).forEach(s=>{let n=B.areaToGridArea(r,s.cellSize);s.grid.setArea(n,false);});}findClosestAvailableSpace(t,e,i,r=Dt){return e.aabbNeedsUpdate=true,e.updateAABB(),Jt.findByConvertingGridSpace(this.getAvilabilityGrid(t,r,i),f.aabbToBoundingBox(e.aabb),r)}getAvilabilityGrid(t,e,i){let r=this.ƀx.get(t,e,i);return r||(r=this.ƀbx(t,e,i),this.ƀx.set(t,e,i,r)),r}ƀbx(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 n=b.getFromP2BodyIDOrFail(s.id);if(n.includeInPathfinding&&this.ƀhj.canCollide(t,n.physicsBodyGroup,i)){let a=this.ƀdv(s,e);r.setArea(a,false);}}),r}ƀdv(t,e){let i=f.aabbToBoundingBox(t.aabb);return B.areaToGridArea(i,e)}};nt=Po([d(),So("design:paramtypes",[K,Ve])],nt);var Co=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ro=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Dt=50,Bt=class{static{h(this,"PathFinderService");}constructor(t){this.ƀhi=t;}findPathAStar(t,e,i,r,s){s||(s={}),s.neighborType===void 0&&(s.neighborType=GridNeighborType.Ortogonal),s.gridCellSize===void 0&&(s.gridCellSize=Dt);let n=v.getInstanceByIDOrFail(t),a,l;Comparator.isNumber(i)?(l=b.getPhysicsInstanceOrFail(i).p2Body,a=f.arrayToVector(l.position)):a=i;let c=B.positionToGridPosition(e,s.gridCellSize),p=B.positionToGridPosition(a,s.gridCellSize),m=this.ƀhi.getAvilabilityGrid(n,s.gridCellSize,r);if(l){let C=f.aabbToBoundingBox(l.aabb),bt=B.areaToGridArea(C,s.gridCellSize);m.setArea(bt,true);}let g=Yt.findPath(m,c,p,s.neighborType);return g.path=g.path.map(C=>B.gridPositionToPosition(C,s.gridCellSize)),g}findPathDirection(t,e,i,r,s=Dt){let n=v.getInstanceByIDOrFail(t),a;if(Comparator.isNumber(i)){let g=b.getPhysicsInstanceOrFail(i);a=f.aabbToBoundingBox(g.p2Body.aabb);}else a=new Rectangle(i,i);let l=B.areaToGridArea(a,s),c=JSON.stringify({targetGridArea:l,collidableWithGroup:r}),p=n.vectorFieldCache.get(c);if(!p){let g=this.ƀhi.getAvilabilityGrid(n,s,r);p=new Xt(l,g),n.vectorFieldCache.set(c,p);}let m=B.positionToGridPosition(e,s);return p.getDirectionToTarget(m)}};Bt=Co([d(),Ro("design:paramtypes",[nt])],Bt);var Oo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},H=new $,bi=class{static{h(this,"PhysicsGateway");}createPhysicsWorld(t){return H.trigger("createPhysicsWorld",t)}getMapSize(t){return H.trigger("getMapSize",t)}setPaused(t,e){return H.trigger("setPaused",t,e)}hitTest(t,e){return H.trigger("hitTest",t,e)}findPath(t,e,i,r,s){return H.trigger("findPath",t,e,i,r,s)}findPathDirection(t,e,i,r){return H.trigger("findPathDirection",t,e,i,r)}applyImpulse(t,e,i,r){return H.trigger("applyImpulse",t,e,i,r)}createExplosion(t,e,i,r,s,n){return H.trigger("createExplosion",t,e,i,r,s,n)}createElipticExplosion(t,e,i,r,s,n,a){return H.trigger("createElipticExplosion",t,e,i,r,s,n,a)}printPathfindingTestGrid(t,e,i,r,s,n=Dt){return H.trigger("printPathfindingTestGrid",t,e,i,r,s,n)}};bi=Oo([d()],bi);var Mo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Do=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Q=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀy=t,this.ƀhf=e;}printPathfindingTestGrid(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t);this.ƀy.getAvilabilityGrid(a,n,r).map((c,p)=>({position:B.gridPositionToPosition(p,n),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(s)){let p=this.ƀhf.findPathDirection(t,c.position,i,r),m;p===void 0?m=E.createRectangleBorders(new Vector(8,8),2,ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):m=E.createArrow(25,c.availability?ColorHelper.green:ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).setRotation(p).attach(a),new D(m,"alpha",{duration:1e3,animation:P.easeIn}).animate({alpha:0}).tap(()=>m.destroy()).attach(m);}});}createExplosionDebugVisual(t,e,i,r,s,n=300){let a=new u().displayParent(e).setAlpha(.5).attach(t);E.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;E.createVector(r,c.line.to,p).toSprite().displayParent(a).attach(t);}),new D(a,"alpha",{duration:n,animation:P.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,r,s,n,a=300){let l=new u().displayParent(e).setAlpha(.5).attach(t);E.createElipse(n,ColorHelper.blue).toSprite().displayParent(l).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attach(t),i.forEach(p=>{let m=p.hits.length>0?ColorHelper.red:ColorHelper.white;E.createVector(p.line.from,p.line.to,m).toSprite().displayParent(l).attach(t);}),new D(l,"alpha",{duration:a,animation:P.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),n=i?.color??ColorHelper.blue,a=new u().displayParent(e).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀcq(c,n).displayParent(a).attachToRoot();}),new D(a,"alpha",{duration:1e3,animation:P.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcq(t,e){switch(t.type){case U.Shape.PARTICLE:throw new Error("Not implemented");case U.Shape.LINE:throw new Error("Not implemented");case U.Shape.PLANE:throw new Error("Not implemented");case U.Shape.CIRCLE:throw new Error("Not implemented");case U.Shape.CAPSULE:throw new Error("Not implemented");case U.Shape.BOX:throw new Error("Not implemented");case U.Shape.HEIGHTFIELD:throw new Error("Not implemented");case U.Shape.CONVEX:return this.ƀcp(t,e);default:throw new Error("Not implemented")}}ƀcp(t,e){let i=[t.vertices.map(r=>({x:r[0],y:r[1]}))];return E.createPolygon(i,e).toSprite()}};Q=Mo([d(),Do("design:paramtypes",[nt,Bt])],Q);var Fo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},_o=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Le=class{static{h(this,"HitTestService");}constructor(t){this.ƀju=t;}hitTest(t,e){let i=t.world,r=b.getFromP2BodyIDOrFail(t.id),s=f.cloneP2Body(t);this.ƀs(s,e);let n=i.broadphase.aabbQuery(i,this.ƀdi(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(n.length!==0){let l=new U.World;l.addBody(s),n.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.ƀju.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀs(t,e){e?.overridePosition&&(t.position=f.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀdi(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};Le=Fo([d(),_o("design:paramtypes",[Q])],Le);var Lo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ne=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀie(t,i);});});}step(t,e,i){b.getPhysicsEntities().forEach(r=>{r.ƀax=[];}),t.p2World.narrowphase.contactEquations.forEach(r=>{this.ƀie(t,r);}),t.bodiesInContactWith.forEach((r,s)=>{this.ƀep(r.p2Body),r.entity.ƀiw(t.collisionReports.get(s)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀep(t){let e=f.arrayToVector(t.velocity);e.length>yi&&(e=e.normalize(yi),t.velocity=f.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-wi),wi);}ƀie(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)||[],n=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀdn(i,r,e);s.push({self:a,target:l}),n.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,s),t.collisionReports.set(e.bodyB.id,n);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀdn(t,e,i){let r=t.convertToDTO(),s=e.convertToDTO(),n=f.arrayToVector(i.contactPointA),a=f.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀec(i);return {collisionDetailsA:this.ƀdm(r,i.bodyA.mass,n,l,t.area),collisionDetailsB:this.ƀdm(s,i.bodyB.mass,a,c,e.area)}}ƀdm(t,e,i,r,s){let n,a=i.add(t.position);return {body:t,getPositionReletiveToObject:h(()=>(n||(n=i.rotate(t.rotation.multiply(-1).vector)),n),"getPositionReletiveToObject"),getPositionOnWorld:h(()=>(a||(a=i.add(t.position)),a),"getPositionOnWorld"),position:i,mass:e,area:s,normal:r}}ƀec(t){let e=f.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};Ne=Lo([d()],Ne);var No=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},jo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},je=class extends re{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};je=No([ut(),jo("design:paramtypes",[Number,Object])],je);var Ho=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},W=1e4,He=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbr(t,new Vector(e.x/2,-W/2),new Vector(e.x+W*2,W),i),this.ƀbr(t,new Vector(e.x/2,e.y+W/2),new Vector(e.x+W*2,W),i),this.ƀbr(t,new Vector(-W/2,e.y/2),new Vector(W,e.y+W*2),i),this.ƀbr(t,new Vector(e.x+W/2,e.y/2),new Vector(W,e.y+W*2),i);}ƀbr(t,e,i,r){return new je(t,{shapeDefinition:{materialName:ot,group:r,shapeType:it.Rectangle,shapeData:i},position:e,rotation:Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};He=Ho([d()],He);var Uo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},or=new U.Material,$o={id:ot,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},Gt=class{static{h(this,"MaterialsService");}createMaterials(t,e,i,r){let s=new Map,n=new Map;if(i.forEach(a=>{s.set(a.id,new U.Material),n.set(a.id,a);}),s.has(ot))throw new Error(`Material with name ${ot} cannot be defined, pick another name for the material.`);return s.set(ot,or),n.set(ot,$o),this.ƀc(t,e,i,r,s),{materials:s,materialDefinitions:n}}getMaterial(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀea(e,i.materials)}getMaterialDefinition(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀdz(e,i.materialDefinitions)}ƀea(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀdz(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.ƀds(i.map(n=>n.id),r).forEach(n=>{let a=this.ƀea(n.materialA,s),l=this.ƀea(n.materialB,s);t.addContactMaterial(new U.ContactMaterial(a,l,{friction:n.friction,restitution:n.bounciness,stiffness:n.stiffness,relaxation:n.relaxation}));}),this.ƀd(t,e,i,s);}ƀds(t,e){let i=new Map;e.forEach(s=>{let n=i.get(s.materialA);n||(n=new Map,i.set(s.materialA,n)),n.set(s.materialB,s);});let r=[];return t.forEach((s,n)=>{for(let a=n;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 n=this.ƀea(s.id,r);t.addContactMaterial(new U.ContactMaterial(n,or,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};Gt=Uo([d()],Gt);var ko=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},zo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ft=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,r,s){this.ƀgg=t,this.ƀah=e,this.ƀy=i,this.ƀay=r,this.ƀhj=s;}createPhysicsWorld(t){let e=new U.World({gravity:[0,0]}),{materials:i,materialDefinitions:r}=this.ƀgg.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:s,physicsBodyGroupToP2Mask:n}=this.ƀhj.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new v(t.mapSize,t.modifyUpdateCycle,e,i,r,s,n).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&y.cleanUpdateModifier();}).attachToRoot(),this.ƀah.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀay.registerPhysicsWorld(a),t.modifyUpdateCycle?y.registerUpdateModifier((l,c)=>this.ƀjo(a,l,c)):y.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀjo(a,l,c);}).attach(a),a.id}addBody(t,e,i,r,s){let n=v.getInstanceByIDOrFail(t);if(i){let a=this.ƀy.findClosestAvailableSpace(n,e,r);return a?(e.position[0]+=a.x,e.position[1]+=a.y,n.p2World.addBody(e),s&&this.ƀy.onBodyAdded(n,e,r),true):false}else return n.p2World.addBody(e),s&&this.ƀy.onBodyAdded(n,e,r),true}removeBody(t,e){v.getInstanceByID(t)?.p2World.removeBody(e);}ƀjo(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.ƀay.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);}};Ft=ko([d(),zo("design:paramtypes",[Gt,He,nt,Ne,K])],Ft);var Yo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Vt=class{static{h(this,"RayCastingService");}castClosest(t,e,i){let r=new U.RaycastResult,s=new U.Ray({mode:U.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.ƀbm(r,e)}castAllFirstContacts(t,e,i){let r=new Map,s=new U.Ray({mode:U.Ray.ALL,from:f.vectorToArray(e.from),to:f.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i),callback:h(n=>{let a=r.get(n.body);!r.has(n.body)||n.fraction<a.fraction?r.set(n.body,this.ƀbm(n,e)):n.fraction===a.fraction&&a.isExternal()&&r.set(n.body,this.ƀbm(n,e));},"callback")});return t.p2World.raycast(new U.RaycastResult,s),Array.from(r.values())}ƀbm(t,e){let i=t.fraction,r=f.arrayToVector(t.normal),s,n,a;return {body:t.body,hitPosition:h(()=>(s===void 0&&(s=e.from.lerp(e.to,i)),s),"hitPosition"),hitDistance:h(()=>(n===void 0&&(n=e.length*i),n),"hitDistance"),isExternal:h(()=>(a===void 0&&(a=e.fromTo.dotProduct(r)<0),a),"isExternal"),normal:r,fraction:i,line:e}}};Vt=Yo([d()],Vt);var Xo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},lt=class{static{h(this,"ImpactService");}applyImpulse(t,e,i,r){let s=i.normalize(r),n=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(f.vectorToArray(s),n);}};lt=Xo([d()],lt);var Ko=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Lt=class{static{h(this,"RayCastHitConverterService");}toExplosionHits(t,e=true){let i=new Map;return t.forEach(r=>{r.hits.forEach(s=>{let n=i.get(s.body);if(n){let a=s.fraction<n.closestRaycastHit.fraction?s:n.closestRaycastHit;n.rayCastHits.push(s),i.set(s.body,{hitCount:n.hitCount+1,closestRaycastHit:a,rayCastHits:n.rayCastHits,isExternal:e?n.isExternal:n.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.ƀbn(r,t.length))}ƀbn(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")}}}};Lt=Ko([d()],Lt);var Qo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},qo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},rn=15,Ue=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,r){this.ƀia=t,this.ƀju=e,this.ƀhz=i,this.ƀfd=r;}createElipticExplosion(t,e,i,r,s,n,a){let l=v.getInstanceByIDOrFail(t),c=this.ƀcc(e,i,r,s,a?.hitOnlyClosest===true,l),p=this.ƀhz.toExplosionHits(c,false);return this.ƀq(p,n),a?.testLayerID&&this.ƀju.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,r,a.debugRayDuration),p.map(m=>{let{p2Body:g,...C}=m;return C})}ƀcc(t,e,i,r,s,n){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 m=l.normalize(i.y);a.push(new Line(t,t.add(m))),a.push(new Line(t,t.add(m.multiplyNumber(-1))));let g=Math.round(i.y/rn),C=i.y/(g*2+1)*2,bt=l.normalize(C),se=i.x,ar=Math.pow(i.y,2);return ArrayHelper.createIntegerArray(g).forEach(pt=>{let Pt=C*(pt+1),Ti=bt.multiplyNumber(pt+1),oe=c.normalize(this.ƀek(se,ar,Pt)),ne=t.add(Ti);a.push(new Line(ne,ne.add(oe))),a.push(new Line(ne,ne.add(oe.multiplyNumber(-1))));let ae=t.add(Ti.multiplyNumber(-1));a.push(new Line(ae,ae.add(oe))),a.push(new Line(ae,ae.add(oe.multiplyNumber(-1))));}),a.map(pt=>{if(s){let Pt=this.ƀia.castClosest(n,pt,r);return {line:pt,hits:Pt?[Pt]:[]}}else {let Pt=this.ƀia.castAllFirstContacts(n,pt,r);return {line:pt,hits:Pt}}})}ƀek(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀq(t,e){t.forEach(i=>{i.raycastResults.forEach(r=>{let s,n;r.isExternal()?(s=r.line.fromTo,n=e*2):(s=r.line.fromTo.multiplyNumber(-1),n=e*(1-r.fraction)*8),this.ƀfd.applyImpulse(r.body,r.hitPosition(),s,n);});});}};Ue=Qo([d(),qo("design:paramtypes",[Vt,Q,Lt,lt])],Ue);var sn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},on=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},$e=class{static{h(this,"ExplosionService");}constructor(t,e,i,r){this.ƀia=t,this.ƀju=e,this.ƀhz=i,this.ƀfd=r;}createExplosion(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t),l=this.ƀeh(i),c=this.ƀcc(e,i,r,l,n?.hitOnlyClosest===true,a),p=this.ƀhz.toExplosionHits(c);return this.ƀq(e,i,s,l,p),n?.testLayerID&&this.ƀju.createExplosionDebugVisual(a,n.testLayerID,c,e,i,n.debugRayDuration),p}ƀcc(t,e,i,r,s,n){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 m=this.ƀia.castClosest(n,p,i);return {line:p,hits:m?[m]:[]}}else {let m=this.ƀia.castAllFirstContacts(n,p,i);return {line:p,hits:m}}})}ƀq(t,e,i,r,s){s.forEach(n=>{if(n.isExternal)n.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀfd.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=Vector.fromTo(t,f.arrayToVector(n.p2Body.position)),l=a.length/e,c=i*r*l/2;this.ƀfd.applyImpulse(n.p2Body,n.getHitPosition(),a,c);}});}ƀeh(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};$e=sn([d(),on("design:paramtypes",[Vt,Q,Lt,lt])],$e);var cn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Nt=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)}};Nt=cn([d()],Nt);var pn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},dn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Pi=class{static{h(this,"PhysicsController");}constructor(t,e,i,r,s,n,a,l){this.ƀhq=t,this.ƀhf=e,this.ƀju=i,this.ƀda=r,this.ƀcu=s,this.ƀeu=n,this.ƀhp=a,this.ƀfd=l;}createPhysicsWorld(t){return this.ƀhq.createPhysicsWorld(t)}getMapSize(t){return this.ƀhp.getMapSize(t)}setPaused(t,e){this.ƀhq.setPaused(t,e);}hitTest(t,e){let i=b.getPhysicsInstanceOrFail(t);return this.ƀeu.hitTest(i.p2Body,e)}findPath(t,e,i,r,s){return this.ƀhf.findPathAStar(t,e,i,r,{neighborType:s})}findPathDirection(t,e,i,r){return this.ƀhf.findPathDirection(t,e,i,r)}applyImpulse(t,e,i,r){let s=b.getPhysicsInstanceOrFail(t);this.ƀfd.applyImpulse(s.p2Body,e,i,r);}createExplosion(t,e,i,r,s,n){return this.ƀda.createExplosion(t,e,i,r,s,n)}createElipticExplosion(t,e,i,r,s,n,a){return this.ƀcu.createElipticExplosion(t,e,i,r,s,n,a)}printPathfindingTestGrid(t,e,i,r,s,n){this.ƀju.printPathfindingTestGrid(t,e,i,r,s,n);}};Pi=pn([q({controllerLink:H}),dn("design:paramtypes",[Ft,Bt,Q,$e,Ue,Le,Nt,lt])],Pi);var un=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ke=class{static{h(this,"ShapeCreationService");}createBody(t,e,i,r,s){let n=v.getInstanceByIDOrFail(t);if(!n.physicsBodyGroupToP2Group.has(e.shapeDefinition.group))throw new Error(`Physics body group "${e.shapeDefinition.group}" not found`);switch(e.shapeDefinition.shapeType){case it.Point:return this.ƀbt(n,void 0,i,r,e.shapeDefinition.group,s);case it.Circle:return this.ƀbt(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case it.Polygon:return this.ƀcb(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case it.Rectangle:return this.ƀcd(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);default:{e.shapeDefinition.shapeType;throw new Error(`Unexpected case! "${e.shapeDefinition.shapeType}"`)}}}ƀbt(t,e,i,r,s,n){let a=new U.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s),radius:e});a.material=i;let l=new U.Body({type:n==="dynamic"?U.Body.DYNAMIC:U.Body.STATIC,mass:r.density,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return l.addShape(a),l}ƀcb(t,e,i,r,s,n){let a=t.physicsBodyGroupToP2Group.get(s),l=t.physicsBodyGroupToP2Mask.get(s),c=e.map(g=>new U.Convex({vertices:g.map(C=>[C.x,C.y]),collisionGroup:a,collisionMask:l})).map(g=>(g.material=i,g)),p=c.reduce((g,C)=>g+C.area,0),m=new U.Body({type:n==="dynamic"?U.Body.DYNAMIC:U.Body.STATIC,mass:p,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.forEach(g=>m.addShape(g)),m.setDensity(r.density),m}ƀcd(t,e,i,r,s,n){let a=new U.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 U.Body({type:n==="dynamic"?U.Body.DYNAMIC:U.Body.STATIC,mass:l,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.addShape(a),c.setDensity(r.density),c}};ke=un([d()],ke);var fn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},mn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Si=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,r,s){this.ƀhq=t,this.ƀho=e,this.ƀjb=i,this.ƀhp=r,this.ƀhj=s;}createBody(t,e,i,r,s){return this.ƀjb.createBody(t,e,i,r,s)}getMaterial(t,e){return this.ƀho.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀho.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀhj.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀhj.getMaskConstant(t,e)}addBody(t,e,i,r,s){return this.ƀhq.addBody(t,e,i,r,s)}removeBody(t,e){this.ƀhq.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀhp.subscribeToPhysicsStep(t,e)}};Si=fn([q({controllerLink:X}),mn("design:paramtypes",[Ft,Gt,ke,Nt,K])],Si);export{Oi as AnimationFlicker,J as AnimationInterpolationFunctions,P as Animations,R as AnimationsCompletionHandlingType,D as Animator,ot as BORDER_MATERIAL_NAME,F as BardLegendsHardReset,St as BlendMode,Zt as Camera,Et as CameraGateway,Jt as ClosestAvailableSpaceHelper,u as Container,jt as ContainerEventType,q as ControllerDecorator,$ as ControllerLink,Ye as Cursor,O as DEFAULT_SHADER_RESOLUTION,ti as DeltaTime,ci as DisplayObjectArray,k as Entity,ut as EntityDecorator,Gi as FadeInContent,xe as FadeInStateAnimation,st as FocusingAnimation,x as Game,E as Graphics,re as ImmovablePhysicsEntity,mi as KeyboardService,di as MenuEntity,te as MenuUI,ui as MenuView,ie as MouseService,gi as MouseTargetFocusService,xi as MovableEntity,vi as MovablePhysicsEntity,Yt as PathFinder,b as PhysicsEntity,bi as PhysicsGateway,it as PhysicsShapeType,ai as Placeholder,Wt as PositionConversionHelper,wi as ROTATIONAL_SPEED_LIMIT,_ as ReAnimateHandlingType,hi as RichText,yi as SPEED_LIMIT,he as Scene,vr as SceneDecorator,fi as ScrollAreaUI,tt as ScrollDirection,yt as ScrollMaskUI,T as Service,d as ServiceDecorator,ft as SingletonEntity,Hi as SlideInContent,qe as SlideInContentByIndex,Se as SlideStateAnimation,et as SlideStateAnimationState,Y as Sprite,we as StateAnimation,qt as Text,li as UpdatableContainer,y as UpdateCycle,Xt as VectorFieldPathFinder,xt as VectorSet,dt as View,Je as ViewDecorator};
|