bard-legends-framework 1.6.0 → 1.7.1
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 +290 -191
- package/dist/index.d.ts +290 -191
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +20 -9
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var actionsLib=require('actions-lib');require('reflect-metadata');var helpersLib=require('helpers-lib'),L=require('pixi.js'),scriptEngineLib=require('script-engine-lib'),W=require('p2');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var L__namespace=/*#__PURE__*/_interopNamespace(L);var W__default=/*#__PURE__*/_interopDefault(W);var nr=Object.defineProperty;var h=(o,t)=>nr(o,"name",{value:t,configurable:true});function K(){return class{static{h(this,"GatewayBase");}}}h(K,"Gateway");function bi(o,t){let e=o.prototype,i=Object.getPrototypeOf(t);for(let r of Reflect.ownKeys(i)){if(typeof r!="string"||r==="constructor")continue;let s=t[r];if(typeof s=="function"){if(Object.prototype.hasOwnProperty.call(e,r))throw new Error(`Gateway "${o.name}": method "${r}" is already registered by another controller.`);e[r]=s.bind(t);}}}h(bi,"bindControllerToGateway");var _=class{static{h(this,"BardLegendsHardReset");}static{this.ƀeu=new actionsLib.Action;}static{this.onHardReset=this.ƀeu.notifier;}static hardReset(){actionsLib.ActionLib.hardReset(),this.ƀeu.trigger();}};function d(){return function(o){let t=T.ƀed(o);o.$meta={paramtypes:t,type:"service"};}}h(d,"ServiceDecorator");var T=class{static{h(this,"Service");}static{this.ƀiw=new Map;}static get(t){let e=this.ƀiw.get(t);if(!e){if(!t.$meta)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let i=this.ƀij(t.$meta.paramtypes);e=new t(...i),this.ƀiw.set(t,e);}return e}static ƀed(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e.some(i=>i.name==="Object")&&console.error(`Some injected parameters are failed to resolve. Check if it is imported as value, if not remove the "type" keyword. Class: "${t.name}"`),e}static ƀij(t){return t.map(i=>{if(i&&i.$meta?.type==="service")return this.get(i);throw new Error(`Injected parameter has to be decorated with @ServiceDecorator(), class: "${i.name}"`)})}};_.onHardReset.subscribe(()=>{T.ƀiw=new Map;}).attachToRoot();function Z(o){return function(t){let e=T.ƀed(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=T.ƀij(e);i.some(s=>s===void 0)&&console.error(i,e,t.name);let r=new t(...i);bi(o,r);}t.$meta={type:"controller"};}}h(Z,"ControllerDecorator");var y=class o{static{h(this,"UpdateCycle");}static{this.ƀab=new actionsLib.Action;}static{this.beforeSceneUpdateAction=this.ƀab.notifier;}static{this.ƀio=new actionsLib.Action;}static{this.sceneUpdateAction=this.ƀio.notifier;}static{this.ƀf=new actionsLib.Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀkb=0;}static{this.ƀkj=void 0;}static wait(t){let e=this.ƀkb+t;return actionsLib.SingleEvent.create(i=>{let r=o.beforeSceneUpdateAction.subscribe(s=>{s.time>=e&&i();}).attachToRoot();return ()=>r.destroy()})}static registerUpdateModifier(t){if(!this.ƀkj)this.ƀkj=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀkj=void 0;}static triggerUpdateTick(t){this.ƀkj&&(t=this.ƀkj(this.ƀkb,t)),this.ƀkb+=t,this.ƀfv=t,t>0&&(o.ƀab.trigger({time:this.ƀkb,delta:t}),o.ƀio.trigger({time:this.ƀkb,delta:t}),o.ƀf.trigger({time:this.ƀkb,delta:t}));}static get lastDelta(){return this.ƀfv}static{this.ƀfv=0;}};_.onHardReset.subscribe(()=>{y.ƀab.clear(),y.ƀio.clear(),y.ƀf.clear(),y.ƀkj=void 0,y.ƀkb=0;}).attachToRoot();var A=class o{static{h(this,"EntityStoreHelper");}static{this.ƀau=new Map;}static registerEntityClass(t){this.ƀau.set(t.id,new Map);}static registerEntity(t){let e=this.ƀau.get(t.classID);if(!e)throw new Error(`EntityStoreHelper: No entity class is found. Be sure that entity is decorated with EntityDecorator! Name: "${t.constructor.name}"`);e.set(t.id,t);}static unregisterEntity(t,e){let i=t.id;this.ƀau.get(i)?.delete(e);}static getEntity(t,e){return this.ƀau.get(t.id)?.get(e)}static getSingleton(t){let e=o.getEntities(t);if(e.length>1)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has multiple instances! Name: "${this.name}"`);return e[0]}static getSingletonOrFail(t){let e=this.getSingleton(t);if(!e)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has no instance! Name: "${this.name}"`);return e}static getEntities(t){let e=this.ƀau.get(t.id);return Array.from(e.values())}};_.onHardReset.subscribe(()=>{A.ƀau.clear();}).attachToRoot();function ke(o){return function(t){t.$meta={paramtypes:T.ƀed(t),viewInstances:new Map,entity:o.entity,type:"view"},et.registerView(t,o.entity);}}h(ke,"ViewDecorator");var dt=class extends actionsLib.IDAttachable{static{h(this,"View");}static getInstance(t){return this.$meta.entity.validateID(t)?this.$meta.viewInstances.get(t):void 0}static getInstanceOrFail(t){if(!this.$meta.entity.validateID(t))throw new Error(`View: getInstance is called with entity id: "${t}", that is not belonging to the class: "${this.$meta.entity}"`);let i=this.$meta.viewInstances.get(t);if(!i)throw new Error(`View: getInstanceOrFail is called with entity id: "${t}", that is not found!`);return i}constructor(){super(),this.attachToRoot(),this.ƀcx=et.entityID,this.ƀek().set(this.ƀcx,this);}destroy(){this.destroyed||(super.destroy(),this.ƀek().delete(this.ƀcx));}update(t,e){}ƀek(){return this.constructor.$meta.viewInstances}};var et=class o{static{h(this,"EntityViewsHelper");}static{this.ƀks=new Map;}static registerView(t,e){o.ƀks.has(e)||o.ƀks.set(e,[]);let i=o.ƀks.get(e);i&&i.push(t),A.getEntities(e).forEach(s=>{this.ƀcf(s,t);});}static ƀcf(t,e){try{let i=T.ƀij(e.$meta.paramtypes.slice(1));o.entityID=t.id;let r=new e(t,...i);t.destroyed?r.destroy():t.ƀkr.ƀkt.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀcw=t,this.ƀkt=[];}createViews(){if(!this.ƀcw.destroyed){let t=o.ƀks.get(this.ƀcw.constructor);t&&t.forEach(e=>{o.ƀcf(this.ƀcw,e);});}}updateViews(t,e){for(let i=0;i<this.ƀkt.length;i++){let r=this.ƀkt[i];r.destroyed||r.update(t,e);}}destroyViews(){this.ƀkt.forEach(t=>{t.destroy();});}};_.onHardReset.subscribe(()=>{et.ƀks=new Map;}).attachToRoot();function ft(){return function(o){o.$meta={type:"entity"},A.registerEntityClass(o);}}h(ft,"EntityDecorator");var U=class extends actionsLib.IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return A.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=A.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return A.getEntities(this)}constructor(){super(),this.ƀkr=new et(this),A.registerEntity(this),y.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.update(t.time,t.delta),this.ƀkr.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀkr.destroyViews(),A.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀkr.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀkr.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀkr.createViews(),this}update(t,e){}};var ut=class o extends U{static{h(this,"SingletonEntity");}static{this.ƀcg=new WeakMap;}static ƀdp(t){let e=o.ƀcg.get(t);return e||(e=new actionsLib.SingleAction,o.ƀcg.set(t,e)),e}static ƀkg(t){o.ƀcg.delete(t);}static getInstanceAsync(){let t=A.getSingleton(this);return t&&!t.destroyed?actionsLib.SingleEvent.instant(t):o.ƀdp(this).toSingleEvent()}static continuesSubscription(){let t=h((e,i)=>{this.getInstanceAsync().tap(s=>{e({type:"open",value:s}),s.onDestroy().tap(()=>{e({type:"close",value:s}),t(e,i);}).attach(i);}).attach(i);},"subscribe");return actionsLib.Sequence.create((e,i)=>t(e,i.attachable))}static getInstance(){return A.getSingleton(this)}static getInstanceOrFail(){return A.getSingletonOrFail(this)}constructor(){if(super(),this.constructor.getEntities().length>1)throw this.attachToRoot(),new Error(`SingletonEntity: entity is decorated as singleton but multiple instances are created! "${this}"`);this.onDestroy().tap(()=>o.ƀkg(this.constructor)).attachToRoot(),o.ƀdp(this.constructor).resolve(this);}};function wr(){return function(o){return o.$meta={paramtypes:T.ƀed(o),type:"scene"},o}}h(wr,"SceneDecorator");var ae=class o extends actionsLib.IDAttachable{static{h(this,"Scene");}static{this.ƀfo=new actionsLib.Variable(false);}static{this.isTransitioning=this.ƀfo.notifier;}static{this.ƀb=new actionsLib.Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveSceneOrFail(){if(!o.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return o.ƀb.value}static cancelActiveScene(){return o.ƀb.value?o.ƀb.value.animateAndClose():actionsLib.SingleEvent.instant()}static isActive(){return o.ƀb.value instanceof this}static getInstance(){return o.ƀb.value instanceof this?o.ƀb.value:void 0}static getInstanceOrFail(){if(!o.ƀb.value)throw new Error("Scene: getInstance is called when there is no active scene!");if(!(o.ƀb.value instanceof this))throw new Error(`Scene: getInstance is called while "${this.name}" was not the active scene. Current scene is: "${o.ƀb.value}"!`);return o.ƀb.value}static open(...t){if(o.ƀfo.value)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(o.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=t[0];o.ƀfo.value=true;let i=T.ƀij(this.$meta.paramtypes),r=new this(...i).attachToRoot();return o.ƀb.set(r),r.init(e).map(()=>(o.ƀfo.value=false,r)).chainToRoot()}constructor(){super(),this.ƀgs=new actionsLib.SingleAction,this.onClose=this.ƀgs.notifier,y.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(o.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(o.ƀfo.value)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");o.ƀfo.value=true;let e=t[0];return this.animateAndClose().map(()=>(this.ƀgs.resolve(e),e)).chainToRoot()}animateAndClose(){return this.prepareToClose().tap(()=>{super.destroy(),o.ƀb.set(void 0),o.ƀfo.value=false;}).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};_.onHardReset.subscribe(()=>{ae.ƀb.set(void 0);}).attachToRoot();exports.ContainerEventType=void 0;(function(o){o.Click="click",o.MouseOver="mouseover",o.MouseOut="mouseout",o.PointerDown="pointerdown",o.PointerUp="pointerup",o.PointerUpOutside="pointerupoutside",o.PointerMove="pointermove",o.PointerCancel="pointercancel",o.PointerOver="pointerover",o.PointerOut="pointerout",o.PointerEnter="pointerenter",o.PointerLeave="pointerleave",o.Added="added",o.Removed="removed",o.Update="update",o.Change="change",o.Wheel="wheel";})(exports.ContainerEventType||(exports.ContainerEventType={}));exports.Cursor=void 0;(function(o){o.Default="default",o.Pointer="pointer";})(exports.Cursor||(exports.Cursor={}));var le=class extends actionsLib.IDAttachable{static{h(this,"ContainerAttributes");}constructor(){super(),this.ƀgm=false,this.ƀdc=false,this.ƀim=1,this.ƀv=1,this.ƀhu=new L__namespace.Container;}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new helpersLib.Vector(this.ƀhu.width,this.ƀhu.height)}setSize(t){return this.ƀhu.width=t.x,this.ƀhu.height=t.y,this}setPosition(t,e){if(e?.holdFrom){let i=this.ƀhu.getLocalBounds(),r=new helpersLib.Vector(this.ƀhu.scale.x,this.ƀhu.scale.y),s=new helpersLib.Vector(i.x,i.y).multiply(r),n=new helpersLib.Vector(i.width,i.height).multiply(r),a=s.add(n.multiply(e.holdFrom));t=t.subtract(a);}return e?.round!==false&&(t=t.round({rollHalfsDown:true})),this.position=t,this}get position(){return new helpersLib.Vector(this.ƀhu.x,this.ƀhu.y)}set position(t){this.ƀhu.position=t;}get x(){return this.ƀhu.x}set x(t){this.ƀhu.x=t;}get y(){return this.ƀhu.y}set y(t){this.ƀhu.y=t;}on(t){return actionsLib.Sequence.create(e=>{let i=h(r=>{if(t===exports.ContainerEventType.Wheel){let n=r.deltaY;e({deltaY:n});}else e(void 0);},"handle");return this.ƀhu.on(t,i),()=>this.ƀhu.off(t,i)}).notIdle()}setRotation(t){return this.rotation=t,this}get rotation(){return new helpersLib.Radian(this.ƀhu.rotation)}set rotation(t){this.ƀhu.rotation=t.value;}get rotationValue(){return this.rotation.value}set rotationValue(t){this.rotation=new helpersLib.Radian(t);}setZIndex(t){return this.zIndex=t,this}get zIndex(){return this.ƀhu.zIndex}set zIndex(t){this.ƀhu.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new helpersLib.Radian(this.ƀhu.skew.x)}set skewX(t){this.ƀhu.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new helpersLib.Radian(this.ƀhu.skew.y)}set skewY(t){this.ƀhu.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.ƀhu.sortableChildren}set sortableChildren(t){this.ƀhu.sortableChildren=t;}setAlpha(t){return this.ƀhu.alpha=t,this}get alpha(){return this.ƀhu.alpha}set alpha(t){this.ƀhu.alpha=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.ƀhu.interactive}set interactive(t){t?this.ƀhu.eventMode="dynamic":this.ƀhu.eventMode="none";}setCursor(t){return this.cursor=t,this}get cursor(){return this.ƀhu.cursor}set cursor(t){this.ƀhu.cursor=t;}getMask(){throw new Error("ContainerAttributes: mask is not available!")}setMask(t){return t?(this.ƀhu.addChild(t.ƀhu),this.ƀhu.mask=t.getMask(),this.ƀgf=t):(this.ƀgf&&this.ƀhu.removeChild(this.ƀgf.ƀhu),this.ƀhu.mask=null),this}hitTest(t){if(this.ƀhu.parent)if(this.ƀhu.hitArea){let e=this.ƀhu.toLocal(t);return this.ƀhu.hitArea.contains(e.x,e.y)}else return this.ƀhu.getBounds().contains(t.x,t.y);else return false}get boundingBox(){let t=this.ƀhu.getLocalBounds();return new helpersLib.Rectangle(new helpersLib.Vector(t.x,t.y),new helpersLib.Vector(t.x+t.width,t.y+t.height))}ignoreBounds(t=true){return t?(this.ƀhe||(this.ƀhe=this.ƀhu.calculateBounds),this.ƀhu.calculateBounds=()=>this.ƀhu._bounds.clear()):this.ƀhe&&(this.ƀhu.calculateBounds=this.ƀhe),this}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀgm}set mirror(t){this.ƀgm=t,this.ƀkk();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdc}set flip(t){this.ƀdc=t,this.ƀkk();}setScale(t){return this.scale=t,this}get scale(){return this.ƀim}set scale(t){this.ƀim=t,this.ƀkk();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀv}set aspectRatio(t){this.ƀv=t,this.ƀkk();}ƀkk(){this.ƀhu.scale.set(this.ƀim,this.ƀim),this.ƀv<1?this.ƀhu.scale.x*=this.ƀv:this.ƀv>1&&(this.ƀhu.scale.y/=this.ƀv),this.ƀgm&&(this.ƀhu.scale.x*=-1),this.ƀdc&&(this.ƀhu.scale.y*=-1);}};var O=2;exports.BlendMode=void 0;(function(o){o[o.Normal=0]="Normal",o[o.Add=1]="Add",o[o.Screen=3]="Screen",o[o.Luminosity=16]="Luminosity",o[o.ColorDodge=7]="ColorDodge";})(exports.BlendMode||(exports.BlendMode={}));var ce=class{static{h(this,"GaussianValuesHelper");}static ƀdh(t,e){let i=e*e,r=1/(helpersLib.PI_360*i),s=-(t*t)/(2*i);return r*Math.exp(s)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),r=.005*i,s=helpersLib.NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<r)i-=l*2;else return true}),n=1/i,a=s.map(l=>l*n);return this.ƀbp(a)}static getValuesForLinearSamplingGauss(t){if(t===0)return [{offset:0,multiplier:1}];if(t===1)return [{offset:0,multiplier:.5},{offset:1,multiplier:.25}];{let e=helpersLib.ArrayHelper.createIntegerArray(Math.ceil(t*.75)).map(r=>this.ƀdh(r,t*.4)),i=e.reduce((r,s)=>r+s,0);return i=i*2-e[0],e=e.map(r=>r/i),this.ƀbp(e)}}static ƀbp(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let r=t[i]+t[i+1],s=i+t[i+1]/r;e.push({offset:s,multiplier:r});}if(t.length%2===0){let i=t[t.length-1],r=t.length-1;e.push({offset:r,multiplier:i});}return e}};var Ti=class Je extends L__namespace.Filter{static{h(this,"BlurFilterPass");}static ƀej(){return `
|
|
1
|
+
'use strict';var actionsLib=require('actions-lib');require('reflect-metadata');var helpersLib=require('helpers-lib'),V=require('pixi.js'),scriptEngineLib=require('script-engine-lib'),U=require('p2');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var V__namespace=/*#__PURE__*/_interopNamespace(V);var U__default=/*#__PURE__*/_interopDefault(U);var gr=Object.defineProperty;var h=(o,t)=>gr(o,"name",{value:t,configurable:true});function q(){return class{static{h(this,"GatewayBase");}}}h(q,"Gateway");function Di(o,t){let e=o.prototype,i=Object.getPrototypeOf(t);for(let r of Reflect.ownKeys(i)){if(typeof r!="string"||r==="constructor")continue;let s=t[r];if(typeof s=="function"){if(Object.prototype.hasOwnProperty.call(e,r))throw new Error(`Gateway "${o.name}": method "${r}" is already registered by another controller.`);e[r]=s.bind(t);}}}h(Di,"bindControllerToGateway");var R=class{static{h(this,"BardLegendsHardReset");}static{this.ƀfg=new actionsLib.Action;}static{this.onHardReset=this.ƀfg.notifier;}static hardReset(){actionsLib.ActionLib.hardReset(),this.ƀfg.trigger();}};function d(){return function(o){let t=S.ƀep(o);o.$meta={paramtypes:t,type:"service"};}}h(d,"ServiceDecorator");var S=class{static{h(this,"Service");}static{this.ƀjv=new Map;}static get(t){let e=this.ƀjv.get(t);if(!e){if(!t.$meta)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let i=this.ƀjk(t.$meta.paramtypes);e=new t(...i),this.ƀjv.set(t,e);}return e}static ƀep(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e.some(i=>i.name==="Object")&&console.error(`Some injected parameters are failed to resolve. Check if it is imported as value, if not remove the "type" keyword. Class: "${t.name}"`),e}static ƀjk(t){return t.map(i=>{if(i&&i.$meta?.type==="service")return this.get(i);throw new Error(`Injected parameter has to be decorated with @ServiceDecorator(), class: "${i.name}"`)})}};R.onHardReset.subscribe(()=>{S.ƀjv=new Map;}).attachToRoot();function Q(o){return function(t){let e=S.ƀep(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=S.ƀjk(e);i.some(s=>s===void 0)&&console.error(i,e,t.name);let r=new t(...i);Di(o,r);}t.$meta={type:"controller"};}}h(Q,"ControllerDecorator");var m=class o{static{h(this,"UpdateCycle");}static{this.ƀad=new actionsLib.Action;}static{this.beforeSceneUpdateAction=this.ƀad.notifier;}static{this.ƀjo=new actionsLib.Action;}static{this.sceneUpdateAction=this.ƀjo.notifier;}static{this.ƀf=new actionsLib.Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀll=0;}static{this.ƀlt=void 0;}static wait(t){let e=this.ƀll+t;return actionsLib.SingleEvent.create(i=>{let r=o.beforeSceneUpdateAction.subscribe(s=>{s.time>=e&&i();}).attachToRoot();return ()=>r.destroy()})}static registerUpdateModifier(t){if(!this.ƀlt)this.ƀlt=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀlt=void 0;}static triggerUpdateTick(t){this.ƀlt&&(t=this.ƀlt(this.ƀll,t)),this.ƀll+=t,this.ƀgi=t,t>0&&(o.ƀad.trigger({time:this.ƀll,delta:t}),o.ƀjo.trigger({time:this.ƀll,delta:t}),o.ƀf.trigger({time:this.ƀll,delta:t}));}static get lastDelta(){return this.ƀgi}static{this.ƀgi=0;}};R.onHardReset.subscribe(()=>{m.ƀad.clear(),m.ƀjo.clear(),m.ƀf.clear(),m.ƀlt=void 0,m.ƀll=0;}).attachToRoot();var O=class o{static{h(this,"EntityStoreHelper");}static{this.ƀax=new Map;}static registerEntityClass(t){this.ƀax.set(t.id,new Map);}static registerEntity(t){let e=this.ƀax.get(t.classID);if(!e)throw new Error(`EntityStoreHelper: No entity class is found. Be sure that entity is decorated with EntityDecorator! Name: "${t.constructor.name}"`);e.set(t.id,t);}static unregisterEntity(t,e){let i=t.id;this.ƀax.get(i)?.delete(e);}static getEntity(t,e){return this.ƀax.get(t.id)?.get(e)}static getSingleton(t){let e=o.getEntities(t);if(e.length>1)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has multiple instances! Name: "${this.name}"`);return e[0]}static getSingletonOrFail(t){let e=this.getSingleton(t);if(!e)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has no instance! Name: "${this.name}"`);return e}static getEntities(t){let e=this.ƀax.get(t.id);return Array.from(e.values())}};R.onHardReset.subscribe(()=>{O.ƀax.clear();}).attachToRoot();function Qe(o){return function(t){t.$meta={paramtypes:S.ƀep(t),viewInstances:new Map,entity:o.entity,type:"view"},rt.registerView(t,o.entity);}}h(Qe,"ViewDecorator");var mt=class extends actionsLib.IDAttachable{static{h(this,"View");}static getInstance(t){return this.$meta.entity.validateID(t)?this.$meta.viewInstances.get(t):void 0}static getInstanceOrFail(t){if(!this.$meta.entity.validateID(t))throw new Error(`View: getInstance is called with entity id: "${t}", that is not belonging to the class: "${this.$meta.entity}"`);let i=this.$meta.viewInstances.get(t);if(!i)throw new Error(`View: getInstanceOrFail is called with entity id: "${t}", that is not found!`);return i}constructor(){super(),this.attachToRoot(),this.ƀde=rt.entityID,this.ƀew().set(this.ƀde,this);}destroy(){this.destroyed||(super.destroy(),this.ƀew().delete(this.ƀde));}update(t,e){}ƀew(){return this.constructor.$meta.viewInstances}};var rt=class o{static{h(this,"EntityViewsHelper");}static{this.ƀmd=new Map;}static registerView(t,e){o.ƀmd.has(e)||o.ƀmd.set(e,[]);let i=o.ƀmd.get(e);i&&i.push(t),O.getEntities(e).forEach(s=>{this.ƀck(s,t);});}static ƀck(t,e){try{let i=S.ƀjk(e.$meta.paramtypes.slice(1));o.entityID=t.id;let r=new e(t,...i);t.destroyed?r.destroy():t.ƀmc.ƀme.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀdd=t,this.ƀme=[];}createViews(){if(!this.ƀdd.destroyed){let t=o.ƀmd.get(this.ƀdd.constructor);t&&t.forEach(e=>{o.ƀck(this.ƀdd,e);});}}updateViews(t,e){for(let i=0;i<this.ƀme.length;i++){let r=this.ƀme[i];r.destroyed||r.update(t,e);}}destroyViews(){this.ƀme.forEach(t=>{t.destroy();});}};R.onHardReset.subscribe(()=>{rt.ƀmd=new Map;}).attachToRoot();function yt(){return function(o){o.$meta={type:"entity"},O.registerEntityClass(o);}}h(yt,"EntityDecorator");var W=class extends actionsLib.IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return O.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=O.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return O.getEntities(this)}constructor(){super(),this.ƀmc=new rt(this),O.registerEntity(this),m.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.update(t.time,t.delta),this.ƀmc.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀmc.destroyViews(),O.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀmc.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀmc.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀmc.createViews(),this}update(t,e){}};var gt=class o extends W{static{h(this,"SingletonEntity");}static{this.ƀcl=new WeakMap;}static ƀeb(t){let e=o.ƀcl.get(t);return e||(e=new actionsLib.SingleAction,o.ƀcl.set(t,e)),e}static ƀlq(t){o.ƀcl.delete(t);}static getInstanceAsync(){let t=O.getSingleton(this);return t&&!t.destroyed?actionsLib.SingleEvent.instant(t):o.ƀeb(this).toSingleEvent()}static continuesSubscription(){let t=h((e,i)=>{this.getInstanceAsync().tap(s=>{e({type:"open",value:s}),s.onDestroy().tap(()=>{e({type:"close",value:s}),t(e,i);}).attach(i);}).attach(i);},"subscribe");return actionsLib.Sequence.create((e,i)=>t(e,i.attachable))}static getInstance(){return O.getSingleton(this)}static getInstanceOrFail(){return O.getSingletonOrFail(this)}constructor(){if(super(),this.constructor.getEntities().length>1)throw this.attachToRoot(),new Error(`SingletonEntity: entity is decorated as singleton but multiple instances are created! "${this}"`);this.onDestroy().tap(()=>o.ƀlq(this.constructor)).attachToRoot(),o.ƀeb(this.constructor).resolve(this);}};function Cr(){return function(o){return o.$meta={paramtypes:S.ƀep(o),type:"scene"},o}}h(Cr,"SceneDecorator");var me=class o extends actionsLib.IDAttachable{static{h(this,"Scene");}static{this.ƀgb=new actionsLib.Variable(false);}static{this.isTransitioning=this.ƀgb.notifier;}static{this.ƀb=new actionsLib.Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveSceneOrFail(){if(!o.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return o.ƀb.value}static cancelActiveScene(){return o.ƀb.value?o.ƀb.value.ƀj():actionsLib.SingleEvent.instant()}static isActive(){return o.ƀb.value instanceof this}static getInstance(){return o.ƀb.value instanceof this?o.ƀb.value:void 0}static getInstanceOrFail(){if(!o.ƀb.value)throw new Error("Scene: getInstance is called when there is no active scene!");if(!(o.ƀb.value instanceof this))throw new Error(`Scene: getInstance is called while "${this.name}" was not the active scene. Current scene is: "${o.ƀb.value}"!`);return o.ƀb.value}static open(...t){if(o.ƀgb.value)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(o.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=t[0];o.ƀgb.value=true;let i=S.ƀjk(this.$meta.paramtypes),r=new this(...i).attachToRoot();return o.ƀb.set(r),r.init(e).map(()=>(o.ƀgb.value=false,r)).chainToRoot()}constructor(){super(),this.ƀhl=new actionsLib.SingleAction,this.onClose=this.ƀhl.notifier,m.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(o.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(o.ƀgb.value)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");o.ƀgb.value=true;let e=t[0];return this.ƀj().map(()=>(this.ƀhl.resolve(e),e)).chainToRoot()}ƀj(){return this.prepareToClose().tap(()=>{super.destroy(),o.ƀb.set(void 0),o.ƀgb.value=false;}).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};R.onHardReset.subscribe(()=>{me.ƀb.set(void 0);}).attachToRoot();var N=class{static{h(this,"AnimationInterpolationFunctions");}static boomerangTime(t){return 1-Math.abs(t-.5)*2}static lineer(t){return t}static easeIn(t){return Math.pow(t,2)}static easeOut(t){return 1-Math.pow(1-t,2)}static easeInCubic(t){return Math.pow(t,3)}static easeOutCubic(t){return 1-Math.pow(1-t,3)}static easeInOut(t){return t<.5?2*t*t:(t-=1,1-2*t*t)}static easeInOutCubic(t){let e=2*t-2;return t<.5?4*Math.pow(t,3):(t-1)*Math.pow(e,2)+1}static blink(t){return t>.5?1:0}},Or=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return N.lineer(t)}},Dr=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return N.easeIn(t)}},Mr=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return N.easeOut(t)}},Br=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return N.easeInOut(t)}},Gr=class{static{h(this,"AnimationEaseInCubic");}start(){}multiplierFunction(t){return N.easeInCubic(t)}},_r=class{static{h(this,"AnimationEaseOutCubic");}start(){}multiplierFunction(t){return N.easeOutCubic(t)}},Fr=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return N.easeInOutCubic(t)}},Nr=class{static{h(this,"AnimationBlink");}start(){}multiplierFunction(t){return N.blink(t)}},Bi=class{static{h(this,"AnimationFlicker");}start(){this.ƀlm=new Array(10).fill(0),helpersLib.Random.integerBetween(0,9),this.ƀlm[helpersLib.Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(helpersLib.Random.integerBetween(0,9),this.ƀlm[helpersLib.Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(helpersLib.Random.integerBetween(0,9),this.ƀlm[helpersLib.Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀlm[e]}},x=class{static{h(this,"Animations");}static{this.lineer=new Or;}static{this.easeIn=new Dr;}static{this.easeOut=new Mr;}static{this.easeInOut=new Br;}static{this.easeInCubic=new Gr;}static{this.easeOutCubic=new _r;}static{this.easeInOutCubic=new Fr;}static{this.blink=new Nr;}};exports.ReAnimateHandlingType=void 0;(function(o){o[o.ThrowError=1]="ThrowError",o[o.IgnoreNewAnimation=2]="IgnoreNewAnimation",o[o.CompletePrevious=3]="CompletePrevious";})(exports.ReAnimateHandlingType||(exports.ReAnimateHandlingType={}));exports.AnimationsCompletionHandlingType=void 0;(function(o){o[o.ReturnToOriginal=1]="ReturnToOriginal",o[o.StayInCurrentState=2]="StayInCurrentState",o[o.JumpToEnd=3]="JumpToEnd",o[o.Loop=4]="Loop";})(exports.AnimationsCompletionHandlingType||(exports.AnimationsCompletionHandlingType={}));var I=class o{static{h(this,"Animator");}static{this.ƀl=new WeakMap;}static ƀdu(t){let e=o.ƀl.get(t);return e||(e=new helpersLib.MapToWeakRefs,o.ƀl.set(t,e)),e}get animating(){return this.ƀhv!==void 0}get target(){return this.ƀld}get value(){return this.ƀlw||(this.ƀlw=new actionsLib.Variable(this.ƀld)),this.ƀlw.notifier}get paused(){return this.ƀie!==void 0}set paused(t){this.ƀie=t?true:void 0;}constructor(t,e,i){this.ƀgc=false,this.ƀki=false,this.ƀld=t,this.ƀhx={duration:200,animation:x.lineer,reAnimateHandling:exports.ReAnimateHandlingType.ThrowError,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState,...i},this.ƀm=helpersLib.Comparator.isArray(e)?e:[e],this.ƀgp(t,this.ƀm);}animate(t,e){let i={...this.ƀhx,...e},r=this.ƀhv;if(this.ƀhv)switch(i.reAnimateHandling){case exports.ReAnimateHandlingType.ThrowError:throw new Error("Animator: new animation triggered while another is not complete yet.");case exports.ReAnimateHandlingType.IgnoreNewAnimation:return actionsLib.SingleEvent.instant().notIdle();case exports.ReAnimateHandlingType.CompletePrevious:this.ƀjx(i.completionHandling,this.ƀhv.ƀja,true);break;default:{throw new Error(`Animator: unknown re-animate handling type: "${i.reAnimateHandling}"`)}}return actionsLib.SingleEvent.create(n=>{this.ƀgc&&(this.ƀki=true);let a={};for(let c of this.ƀm)a[c]={ƀkx:this.ƀld[c],ƀlf:t[c]};let l={ƀcy:i.duration,ƀcz:0,ƀja:a,ƀbj:i.completionHandling,ƀn:i.animation,ƀbi:n};if(l.ƀbj!==exports.AnimationsCompletionHandlingType.Loop&&this.ƀfy(l)){this.ƀhv=void 0,n(),r?.ƀbi(),this.ƀay();return}return l.ƀn.start(),this.ƀhv=l,this.ƀdc(),r?.ƀbi(),()=>{this.ƀhv===l&&(this.ƀld instanceof actionsLib.Attachable&&this.ƀld.destroyed||this.ƀjx(l.ƀbj,l.ƀja,true),this.ƀhv=void 0,this.ƀay());}}).notIdle()}set(t){this.ƀmi(e=>t[e]),this.ƀhv?.ƀbi();}completeAnimation(t){if(this.ƀhv){t=t??this.ƀhv.ƀbj,this.ƀjx(t,this.ƀhv.ƀja,true);let e=this.ƀhv.ƀbi;this.ƀhv=void 0,e();}}ƀdc(){this.ƀls||(this.ƀls=m.beforeSceneUpdateAction.subscribe(t=>{if(!this.ƀie){this.ƀgc=true;try{let e=this.ƀhv;if(!e)return;if(e.ƀcz+=t.delta,e.ƀcz>=e.ƀcy)if(e.ƀbj===exports.AnimationsCompletionHandlingType.Loop)e.ƀcz%=e.ƀcy,e.ƀn.start();else {this.ƀjx(e.ƀbj,e.ƀja,!1),this.ƀhv=void 0,e.ƀbi(),this.ƀay();return}let i=e.ƀn.multiplierFunction(e.ƀcz/e.ƀcy);this.ƀmi(r=>{let s=e.ƀja[r];return (s.ƀlf-s.ƀkx)*i+s.ƀkx});}finally{this.ƀgc=false,this.ƀki&&(this.ƀki=false,this.ƀcr(),this.ƀdc());}}}).attachToRoot());}ƀfy(t){return this.ƀm.every(e=>this.ƀld[e]===t.ƀja[e].ƀlf)}ƀjx(t,e,i){switch(t){case exports.AnimationsCompletionHandlingType.ReturnToOriginal:case exports.AnimationsCompletionHandlingType.Loop:this.ƀmi(r=>e[r].ƀkx);break;case exports.AnimationsCompletionHandlingType.JumpToEnd:this.ƀmi(r=>e[r].ƀlf);break;case exports.AnimationsCompletionHandlingType.StayInCurrentState:i||this.ƀmi(r=>e[r].ƀlf);break;default:{throw new Error(`Animator: unknown completion handling type: "${t}"`)}}}ƀmi(t){let e=false;for(let i of this.ƀm){let r=t(i);this.ƀld[i]!==r&&(e=true,this.ƀld[i]=r);}e&&this.ƀlw?.set(this.ƀld);}ƀay(){this.ƀhv||this.ƀcr();}ƀcr(){this.ƀls?.destroy(),this.ƀls=void 0;}ƀgp(t,e){let i=o.ƀdu(t);for(let r of e){if(i.has(r))throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(t,void 0,2)}", Property: "${r}"`);i.set(r,this);}}};exports.ContainerEventType=void 0;(function(o){o.Click="click",o.MouseOver="mouseover",o.MouseOut="mouseout",o.PointerDown="pointerdown",o.PointerUp="pointerup",o.PointerUpOutside="pointerupoutside",o.PointerMove="pointermove",o.PointerCancel="pointercancel",o.PointerOver="pointerover",o.PointerOut="pointerout",o.PointerEnter="pointerenter",o.PointerLeave="pointerleave",o.Added="added",o.Removed="removed",o.Update="update",o.Change="change",o.Wheel="wheel";})(exports.ContainerEventType||(exports.ContainerEventType={}));exports.Cursor=void 0;(function(o){o.Default="default",o.Pointer="pointer";})(exports.Cursor||(exports.Cursor={}));var ge=class extends actionsLib.IDAttachable{static{h(this,"ContainerAttributes");}constructor(){super(),this.ƀhc=false,this.ƀdm=false,this.ƀjm=1,this.ƀw=1,this.ƀis=new V__namespace.Container;}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new helpersLib.Vector(this.ƀis.width,this.ƀis.height)}setSize(t){return this.ƀis.width=t.x,this.ƀis.height=t.y,this}setPosition(t,e){if(e?.holdFrom){let i=this.ƀis.getLocalBounds(),r=new helpersLib.Vector(this.ƀis.scale.x,this.ƀis.scale.y),s=new helpersLib.Vector(i.x,i.y).multiply(r),n=new helpersLib.Vector(i.width,i.height).multiply(r),a=s.add(n.multiply(e.holdFrom));t=t.subtract(a);}return e?.round!==false&&(t=t.round({rollHalfsDown:true})),this.position=t,this}get position(){return new helpersLib.Vector(this.ƀis.x,this.ƀis.y)}set position(t){this.ƀis.position=t;}get x(){return this.ƀis.x}set x(t){this.ƀis.x=t;}get y(){return this.ƀis.y}set y(t){this.ƀis.y=t;}on(t){return actionsLib.Sequence.create(e=>{let i=h(r=>{if(t===exports.ContainerEventType.Wheel){let n=r.deltaY;e({deltaY:n});}else e(void 0);},"handle");return this.ƀis.on(t,i),()=>this.ƀis.off(t,i)}).notIdle()}setRotation(t){return this.rotation=t,this}get rotation(){return new helpersLib.Radian(this.ƀis.rotation)}set rotation(t){this.ƀis.rotation=t.value;}get rotationValue(){return this.rotation.value}set rotationValue(t){this.rotation=new helpersLib.Radian(t);}setZIndex(t){return this.zIndex=t,this}get zIndex(){return this.ƀis.zIndex}set zIndex(t){this.ƀis.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new helpersLib.Radian(this.ƀis.skew.x)}set skewX(t){this.ƀis.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new helpersLib.Radian(this.ƀis.skew.y)}set skewY(t){this.ƀis.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.ƀis.sortableChildren}set sortableChildren(t){this.ƀis.sortableChildren=t;}setAlpha(t){return this.ƀis.alpha=t,this}get alpha(){return this.ƀis.alpha}set alpha(t){this.ƀis.alpha=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.ƀis.interactive}set interactive(t){t?this.ƀis.eventMode="dynamic":this.ƀis.eventMode="none";}setCursor(t){return this.cursor=t,this}get cursor(){return this.ƀis.cursor}set cursor(t){this.ƀis.cursor=t;}getMask(){throw new Error("ContainerAttributes: mask is not available!")}setMask(t){return t?(this.ƀis.addChild(t.ƀis),this.ƀis.mask=t.getMask(),this.ƀgs=t):(this.ƀgs&&this.ƀis.removeChild(this.ƀgs.ƀis),this.ƀis.mask=null),this}hitTest(t){if(this.ƀis.parent)if(this.ƀis.hitArea){let e=this.ƀis.toLocal(t);return this.ƀis.hitArea.contains(e.x,e.y)}else return this.ƀis.getBounds().contains(t.x,t.y);else return false}get boundingBox(){let t=this.ƀis.getLocalBounds();return new helpersLib.Rectangle(new helpersLib.Vector(t.x,t.y),new helpersLib.Vector(t.x+t.width,t.y+t.height))}ignoreBounds(t=true){return t?(this.ƀhy||(this.ƀhy=this.ƀis.calculateBounds),this.ƀis.calculateBounds=()=>this.ƀis._bounds.clear()):this.ƀhy&&(this.ƀis.calculateBounds=this.ƀhy),this}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀhc}set mirror(t){this.ƀhc=t,this.ƀlu();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdm}set flip(t){this.ƀdm=t,this.ƀlu();}setScale(t){return this.scale=t,this}get scale(){return this.ƀjm}set scale(t){this.ƀjm=t,this.ƀlu();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀw}set aspectRatio(t){this.ƀw=t,this.ƀlu();}ƀlu(){this.ƀis.scale.set(this.ƀjm,this.ƀjm),this.ƀw<1?this.ƀis.scale.x*=this.ƀw:this.ƀw>1&&(this.ƀis.scale.y/=this.ƀw),this.ƀhc&&(this.ƀis.scale.x*=-1),this.ƀdm&&(this.ƀis.scale.y*=-1);}};var D=2;exports.BlendMode=void 0;(function(o){o[o.Normal=0]="Normal",o[o.Add=1]="Add",o[o.Screen=3]="Screen",o[o.Luminosity=16]="Luminosity",o[o.ColorDodge=7]="ColorDodge";})(exports.BlendMode||(exports.BlendMode={}));var we=class{static{h(this,"GaussianValuesHelper");}static ƀds(t,e){let i=e*e,r=1/(helpersLib.PI_360*i),s=-(t*t)/(2*i);return r*Math.exp(s)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),r=.005*i,s=helpersLib.NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<r)i-=l*2;else return true}),n=1/i,a=s.map(l=>l*n);return this.ƀbu(a)}static getValuesForLinearSamplingGauss(t){if(t===0)return [{offset:0,multiplier:1}];if(t===1)return [{offset:0,multiplier:.5},{offset:1,multiplier:.25}];{let e=helpersLib.ArrayHelper.createIntegerArray(Math.ceil(t*.75)).map(r=>this.ƀds(r,t*.4)),i=e.reduce((r,s)=>r+s,0);return i=i*2-e[0],e=e.map(r=>r/i),this.ƀbu(e)}}static ƀbu(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let r=t[i]+t[i+1],s=i+t[i+1]/r;e.push({offset:s,multiplier:r});}if(t.length%2===0){let i=t[t.length-1],r=t.length-1;e.push({offset:r,multiplier:i});}return e}};var Fi=class ei extends V__namespace.Filter{static{h(this,"BlurFilterPass");}static ƀev(){return `
|
|
2
2
|
attribute vec2 aVertexPosition;
|
|
3
3
|
attribute vec2 aTextureCoord;
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
11
11
|
vTextureCoord = aTextureCoord;
|
|
12
12
|
}
|
|
13
|
-
`}static
|
|
13
|
+
`}static ƀed(t,e){let i=`
|
|
14
14
|
uniform sampler2D uSampler;
|
|
15
15
|
|
|
16
16
|
varying vec2 vTextureCoord;
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
iterate(${s}, ${helpersLib.NumberHelper.toFloatString(t[r].multiplier)}, gl_FragColor);
|
|
30
30
|
iterate(${s} * -1.0, ${helpersLib.NumberHelper.toFloatString(t[r].multiplier)}, gl_FragColor);`;}return i+=`
|
|
31
31
|
}
|
|
32
|
-
`,i}constructor(t,e){super(Je.ƀej(),Je.ƀdr(ce.getValuesForLinearSamplingGauss(t),e)),this.ƀex=e,this.resolution=O;}apply(t,e,i,r){this.uniforms.pixelSize=this.ƀex?1/(e.width*O):1/(e.height*O),t.applyFilter(this,e,i,r);}},Et=class extends L__namespace.Filter{static{h(this,"BlurFilter");}constructor(t=new helpersLib.Vector(2,2)){if(super(),this.ƀjr=t,this.resolution=O,this.ƀjr=t.multiplyNumber(O).floor(),this.ƀjr.x<0||this.ƀjr.y<0)throw new Error("BlurFilterLinearSampling: Strength * Resolution must be greater than 0");if(this.ƀjr.x>100||this.ƀjr.y>100)throw new Error("BlurFilterLinearSampling: Strength * Resolution cannot be higher than 100");this.ƀez=new Ti(this.ƀjr.x,true),this.ƀkp=new Ti(this.ƀjr.y,false),this.padding=Math.max(this.ƀjr.x,this.ƀjr.y);}apply(t,e,i,r){let s=t.getFilterTexture();this.ƀkp.apply(t,e,s,L__namespace.CLEAR_MODES.CLEAR),this.ƀez.apply(t,s,i,r),t.returnFilterTexture(s);}get blendMode(){return this.ƀez.blendMode}set blendMode(t){this.ƀez.blendMode=t,this.ƀkp.blendMode=t;}};var de=class{static{h(this,"Filters");}get red(){return this.ƀid}set red(t){this.ƀid=t,this.ƀie();}get green(){return this.ƀen}set green(t){this.ƀen=t,this.ƀie();}get blue(){return this.ƀae}set blue(t){this.ƀae=t,this.ƀie();}get brightness(){return this.ƀaj}set brightness(t){this.ƀaj=t,this.ƀie();}get contrast(){return this.ƀbk}set contrast(t){this.ƀbk=t,this.ƀie();}get blur(){return this.ƀaf}set blur(t){let e=helpersLib.Comparator.isNumber(t)?new helpersLib.Vector(t,t):t;(this.ƀaf&&e&&!this.ƀaf.isEqual(e)||this.ƀaf&&!e||!this.ƀaf&&e)&&(this.ƀaf=e,this.ƀag&&(this.ƀag.destroy(),this.ƀag=void 0),e&&(this.ƀag=new Et(e),this.ƀgw()));}constructor(t){this.ƀbg=t,this.ƀid=1,this.ƀen=1,this.ƀae=1,this.ƀaj=1,this.ƀbk=1,this.ƀgw();}removeColorFilter(){this.ƀaz?.destroy(),this.ƀaz=void 0,this.ƀgw();}ƀie(){this.ƀid===1&&this.ƀen===1&&this.ƀae===1&&this.ƀaj===1&&this.ƀbk===1?this.ƀaz&&(this.ƀaz.destroy(),this.ƀaz=void 0,this.ƀgw()):(this.ƀaz||(this.ƀaz=new L__namespace.ColorMatrixFilter,this.ƀaz.resolution=O,this.ƀgw()),this.ƀaz.matrix=[this.ƀid*this.ƀbk,0,0,0,this.ƀaj-1,0,this.ƀen*this.ƀbk,0,0,this.ƀaj-1,0,0,this.ƀae*this.ƀbk,0,this.ƀaj-1,0,0,0,1,0]);}ƀgw(){let t=[];this.ƀag&&t.push(this.ƀag),this.ƀaz&&t.push(this.ƀaz),this.ƀbg.filters=t;}};var f=class o extends le{static{h(this,"Container");}static{this.allContainers=new Map;}constructor(){super(),this.addChildTo=this,this.defaultChildOptions={addUnder:false,cropOverflowingParts:false},o.allContainers.set(this.id,this),this.filters=new de(this.ƀhu);}destroy(){this.destroyed||(super.destroy(),o.allContainers.delete(this.id),!this.ƀhu.destroyed&&this.ƀhu.destroy());}getBoundingMask(){if(this.addChildTo!==this)return this.addChildTo.getBoundingMask();throw new Error(`Container: bounding mask cannot be used without bounding shapes. Display Object: "${this.id}"!`)}displayParent(t,e){let i;if(helpersLib.Comparator.isNumber(t)){if(i=o.allContainers.get(t),!i)throw new Error(`Container: parent not found! id: ${t}`)}else i=t;let r={addUnder:i.defaultChildOptions.addUnder,cropOverflowingParts:i.defaultChildOptions.cropOverflowingParts,...e};if(r.addUnder?i.addChildTo.ƀhu.addChildAt(this.ƀhu,0):i.addChildTo.ƀhu.addChild(this.ƀhu),r.cropOverflowingParts)if(i)this.ƀhu.mask=i.getBoundingMask().pixiSprite;else throw new Error("Container: cropOverflowingParts can only be used with Container parent!");return this}};var D=class{static{h(this,"GameAssets");}static{this.ƀik=new Map;}static{this.ƀp=0;}static getAsset(t){let e=this.ƀik.get(t);if(e)return e;throw new Error(`Game Assets: Resource not found! Key: "${t}"`)}static insertAsset(t,e){return e||(e=`a-${this.ƀp++}`),this.ƀik.set(e,t),e}static destroyAsset(t){let e=this.ƀik.get(t);e&&(e.destroy(true),this.ƀik.delete(t));}static async loadGameAssets(t){let e=new Map,i=[];t.forEach(s=>{if(!helpersLib.Comparator.isString(s.url))throw new Error(`GameAssets: source url should be a string: ${s.url}`);let n=e.get(s.url);n?n.push(s.id):(e.set(s.url,[s.id]),i.push({url:s.url,callback:h(a=>{if(a instanceof L__namespace.Texture&&(a.id=s.id),n=e.get(s.url),n)n.forEach(l=>{this.ƀik.set(l,a);});else throw new Error(`GameAssets: unexpected error, nameGroup is not found! "./"! ${s}`)},"callback")}));});let r=performance.now();return Promise.all(i.map(s=>L__namespace.Assets.load(s.url))).then(s=>{let n=performance.now();console.info("Asset load completed in: ",Math.round(n-r)/1e3," seconds"),s.forEach((a,l)=>{i[l].callback(a);});}).catch(s=>{throw new Error(`GameAssets: during asset loading, an error occured: ${s}`)})}};var Ht=class{static{h(this,"PositionConversionHelper");}static includeScaleInScreenPosition(t,e,i){if(e!==1){let r=helpersLib.Vector.fromTo(i,t).multiplyNumber(1/e);return i.add(r)}else return t}static normalizePolygonByAnchor(t,e,i){let r=new helpersLib.Vector(e.x*i.x,e.y*i.y);return t.map(s=>s.map(n=>r.to(helpersLib.Vector.fromVec2(n))))}},ue=class{static{h(this,"CompositeHitArea");}constructor(t,e,i){this.ƀje=t.map(r=>new L__namespace.Polygon(r.map(s=>new L__namespace.Point(s.x,s.y))));}contains(t,e){return this.ƀje.some(i=>i.contains(t,e))}};var Or=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};exports.CameraGateway=class it extends K(){static{h(this,"CameraGateway");}};exports.CameraGateway=Or([d()],exports.CameraGateway);var Dr=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},gt=class extends K(){static{h(this,"CameraViewGateway");}};gt=Dr([d()],gt);var Ri;(function(o){o.BackgroundScreen="backgroundScreen",o.Background="background",o.Main="main",o.Foreground="foreground",o.ForegroundScreen="foregroundScreen";})(Ri||(Ri={}));exports.FocusingAnimation=void 0;(function(o){o[o.Instant=1]="Instant",o[o.EaseInOut=2]="EaseInOut",o[o.EaseOut=3]="EaseOut";})(exports.FocusingAnimation||(exports.FocusingAnimation={}));var $=class{static{h(this,"AnimationInterpolationFunctions");}static boomerangTime(t){return 1-Math.abs(t-.5)*2}static lineer(t){return t}static easeIn(t){return Math.pow(t,2)}static easeOut(t){return 1-Math.pow(1-t,2)}static easeInOut(t){return t<.5?2*t*t:(t-=1,1-2*t*t)}static easeInOutCubic(t){let e=2*t-2;return t<.5?4*Math.pow(t,3):(t-1)*Math.pow(e,2)+1}static blink(t){return t>.5?1:0}},Mr=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return $.lineer(t)}},Br=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return $.easeIn(t)}},Gr=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return $.easeOut(t)}},_r=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return $.easeInOut(t)}},Fr=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return $.easeInOutCubic(t)}},Vr=class{static{h(this,"AnimationBlink");}start(){}multiplierFunction(t){return $.blink(t)}},Ci=class{static{h(this,"AnimationFlicker");}start(){this.ƀkc=new Array(10).fill(0),helpersLib.Random.integerBetween(0,9),this.ƀkc[helpersLib.Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(helpersLib.Random.integerBetween(0,9),this.ƀkc[helpersLib.Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(helpersLib.Random.integerBetween(0,9),this.ƀkc[helpersLib.Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀkc[e]}},S=class{static{h(this,"Animations");}static{this.lineer=new Mr;}static{this.easeIn=new Br;}static{this.easeOut=new Gr;}static{this.easeInOut=new _r;}static{this.easeInOutCubic=new Fr;}static{this.blink=new Vr;}};exports.ReAnimateHandlingType=void 0;(function(o){o[o.ThrowError=1]="ThrowError",o[o.IgnoreNewAnimation=2]="IgnoreNewAnimation",o[o.CompletePrevious=3]="CompletePrevious";})(exports.ReAnimateHandlingType||(exports.ReAnimateHandlingType={}));exports.AnimationsCompletionHandlingType=void 0;(function(o){o[o.ReturnToOriginal=1]="ReturnToOriginal",o[o.StayInCurrentState=2]="StayInCurrentState",o[o.JumpToEnd=3]="JumpToEnd",o[o.Loop=4]="Loop";})(exports.AnimationsCompletionHandlingType||(exports.AnimationsCompletionHandlingType={}));var M=class o{static{h(this,"Animator");}static{this.ƀk=new WeakMap;}static ƀdj(t){let e=o.ƀk.get(t);return e||(e=new helpersLib.MapToWeakRefs,o.ƀk.set(t,e)),e}get animating(){return this.ƀhb!==void 0}get target(){return this.ƀjt}get value(){return this.ƀkl||(this.ƀkl=new actionsLib.Variable(this.ƀjt)),this.ƀkl.notifier}constructor(t,e,i){this.ƀfp=false,this.ƀjf=false,this.ƀjt=t,this.ƀhd={duration:200,animation:S.lineer,reAnimateHandling:exports.ReAnimateHandlingType.ThrowError,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState,...i},this.ƀl=helpersLib.Comparator.isArray(e)?e:[e],this.ƀgc(t,this.ƀl);}animate(t,e){let i={...this.ƀhd,...e},r=this.ƀhb;if(this.ƀhb)switch(i.reAnimateHandling){case exports.ReAnimateHandlingType.ThrowError:throw new Error("Animator: new animation triggered while another is not complete yet.");case exports.ReAnimateHandlingType.IgnoreNewAnimation:return actionsLib.SingleEvent.instant().notIdle();case exports.ReAnimateHandlingType.CompletePrevious:this.ƀiy(i.completionHandling,this.ƀhb.ƀhz,true);break;default:{throw new Error(`Animator: unknown re-animate handling type: "${i.reAnimateHandling}"`)}}return actionsLib.SingleEvent.create(n=>{this.ƀfp&&(this.ƀjf=true);let a=this.ƀl.reduce((c,p)=>(c[p]={ƀjn:this.ƀjt[p],ƀjv:t[p]},c),{}),l={ƀcr:i.duration,ƀcs:0,ƀhz:a,ƀbe:i.completionHandling,ƀm:i.animation,ƀbd:n};if(l.ƀbe!==exports.AnimationsCompletionHandlingType.Loop&&this.ƀfl(l)){this.ƀhb=void 0,n(),r?.ƀbd(),this.ƀhb||(this.ƀki?.destroy(),this.ƀki=void 0);return}else l.ƀm.start();return this.ƀhb=l,this.ƀcv(),r?.ƀbd(),()=>{this.ƀhb===l&&(this.ƀjt instanceof actionsLib.Attachable&&this.ƀjt.destroyed||this.ƀiy(l.ƀbe,l.ƀhz,true),this.ƀhb=void 0,this.ƀki?.destroy(),this.ƀki=void 0);}}).notIdle()}set(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjt[r]!==t[r]&&(e=true,this.ƀjt[r]=t[r]);}e&&this.ƀkl?.set(this.ƀjt),this.ƀhb?.ƀbd();}completeAnimation(t){if(this.ƀhb){t=t??this.ƀhb.ƀbe,this.ƀiy(t,this.ƀhb.ƀhz,true);let e=this.ƀhb.ƀbd;this.ƀhb=void 0,e();}}ƀcv(){this.ƀki||(this.ƀki=y.beforeSceneUpdateAction.subscribe(t=>{this.ƀfp=true;try{let e=this.ƀhb;if(!e)return;e.ƀcs+=t.delta;let i=e.ƀcs>=e.ƀcr;if(i)if(e.ƀbe===exports.AnimationsCompletionHandlingType.Loop)e.ƀcs%=e.ƀcr,e.ƀm.start(),i=!1;else {this.ƀiy(e.ƀbe,e.ƀhz,!1),this.ƀhb=void 0,e.ƀbd(),this.ƀhb||(this.ƀki?.destroy(),this.ƀki=void 0);return}if(!i){let r=e.ƀm.multiplierFunction(e.ƀcs/e.ƀcr),s=!1;for(let n=0;n<this.ƀl.length;n++){let a=this.ƀl[n],l=e.ƀhz[a],p=(l.ƀjv-l.ƀjn)*r+l.ƀjn;p!==this.ƀjt[a]&&(s=!0,this.ƀjt[a]=p);}s&&this.ƀkl?.set(this.ƀjt);}}finally{this.ƀfp=false,this.ƀjf&&(this.ƀjf=false,this.ƀki?.destroy(),this.ƀki=void 0,this.ƀcv());}}).attachToRoot());}ƀfl(t){for(let e=0;e<this.ƀl.length;e++){let i=this.ƀl[e];if(this.ƀjt[i]!==t.ƀhz[i].ƀjv)return false}return true}ƀiy(t,e,i){switch(t){case exports.AnimationsCompletionHandlingType.ReturnToOriginal:this.ƀil(e);break;case exports.AnimationsCompletionHandlingType.StayInCurrentState:i||this.ƀfs(e);break;case exports.AnimationsCompletionHandlingType.JumpToEnd:this.ƀfs(e);break;case exports.AnimationsCompletionHandlingType.Loop:this.ƀil(e);break;default:{throw new Error(`Animator: unknown completion handling type: "${t}"`)}}}ƀil(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjt[r]!==t[r].ƀjn&&(e=true,this.ƀjt[r]=t[r].ƀjn);}e&&this.ƀkl?.set(this.ƀjt);}ƀfs(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjt[r]!==t[r].ƀjv&&(e=true,this.ƀjt[r]=t[r].ƀjv);}e&&this.ƀkl?.set(this.ƀjt);}ƀgc(t,e){let i=o.ƀdj(t);for(let r of e){if(i.has(r))throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(t,void 0,2)}", Property: "${r}"`);i.set(r,this);}}};var I;(function(o){o[o.Idle=1]="Idle",o[o.Transitioning=2]="Transitioning",o[o.Reverting=3]="Reverting";})(I||(I={}));var ge=class extends actionsLib.Attachable{static{h(this,"StateAnimation");}get currentState(){return {value:this.ƀj.value,state:this.ƀjo,nextState:this.ƀgq,queuedState:this.ƀia,animationState:this.ƀn}}constructor(t){super(),this.ƀj={value:0},this.ƀn=I.Idle,this.ƀgy=new actionsLib.Action,this.ƀha=new actionsLib.Action,this.ƀhd={duration:500,animation:S.lineer,...t},this.ƀo=new M(this.ƀj,"value",{duration:this.ƀhd.duration,animation:this.ƀhd.animation,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀo.value.subscribe(()=>{this.ƀj.value!==1&&this.ƀj.value!==0&&this.ƀha.trigger(this.ƀj.value);}).attach(this);}setState(t,e){if(this.ƀjo===void 0)this.ƀjo=t,this.ƀgy.trigger({state:this.ƀjo,nextState:this.ƀgq}),this.ƀha.trigger(this.ƀj.value);else if(e?.instant)this.ƀo.completeAnimation(),this.ƀn=I.Idle,this.ƀjo=t,this.ƀgq=void 0,this.ƀj.value=0,this.ƀgy.trigger({state:this.ƀjo,nextState:this.ƀgq}),this.ƀha.trigger(this.ƀj.value);else switch(this.ƀn){case I.Idle:t!==this.ƀjo&&(this.ƀn=I.Transitioning,this.ƀgq=t,this.ƀj.value=0,this.ƀgy.trigger({state:this.ƀjo,nextState:this.ƀgq}),this.ƀha.trigger(this.ƀj.value),this.ƀo.animate({value:1}).tap(()=>this.ƀgu()).attach(this));break;case I.Transitioning:t!==this.ƀgq&&(t===this.ƀjo?(this.ƀn=I.Reverting,this.ƀo.animate({value:0},{duration:this.ƀj.value*this.ƀhd.duration}).tap(()=>this.ƀgu()).attach(this)):this.ƀia=t);break;case I.Reverting:t!==this.ƀjo&&(t===this.ƀgq?(this.ƀn=I.Transitioning,this.ƀo.animate({value:1},{duration:(1-this.ƀj.value)*this.ƀhd.duration}).tap(()=>this.ƀgu()).attach(this)):this.ƀia=t);break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}ƀgu(){switch(this.ƀn){case I.Transitioning:this.ƀj.value===1&&(this.ƀj.value=0,this.ƀia!==void 0?(this.ƀn=I.Transitioning,this.ƀjo=this.ƀgq,this.ƀgq=this.ƀia,this.ƀia=void 0,this.ƀgy.trigger({state:this.ƀjo,nextState:this.ƀgq}),this.ƀo.animate({value:1}).tap(()=>this.ƀgu()).attach(this)):(this.ƀn=I.Idle,this.ƀjo=this.ƀgq,this.ƀgq=void 0,this.ƀgy.trigger({state:this.ƀjo,nextState:this.ƀgq})),this.ƀha.trigger(this.ƀj.value));break;case I.Reverting:if(this.ƀjo===void 0)throw new Error("StateAnimation: state must be defined when reverting!");this.ƀj.value===0&&(this.ƀia!==void 0?(this.ƀn=I.Transitioning,this.ƀgq=this.ƀia,this.ƀia=void 0,this.ƀj.value=0,this.ƀgy.trigger({state:this.ƀjo,nextState:this.ƀgq}),this.ƀo.animate({value:1}).tap(()=>this.ƀgu()).attach(this)):(this.ƀn=I.Idle,this.ƀgq=void 0,this.ƀj.value=0,this.ƀgy.trigger({state:this.ƀjo,nextState:this.ƀgq})),this.ƀha.trigger(this.ƀj.value));break;case I.Idle:break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}onStateChange(t){return this.ƀgy.subscribe(e=>t(e.state,e.nextState)).attach(this),this}onValueChange(t){return this.ƀha.subscribe(e=>t(e)).attach(this),this}};var x;(function(o){o[o.Hidden=1]="Hidden",o[o.Visible=2]="Visible",o[o.Appearing=3]="Appearing",o[o.Disappearing=4]="Disappearing",o[o.DisappearToChange=5]="DisappearToChange";})(x||(x={}));var ye=class extends actionsLib.Attachable{static{h(this,"FadeInStateAnimation");}get currentState(){return {value:this.ƀj.value,state:this.ƀjo,queuedState:this.ƀia,animationState:this.ƀn}}constructor(t){super(),this.ƀj={value:0},this.ƀn=x.Hidden,this.ƀgy=new actionsLib.Action,this.ƀha=new actionsLib.Action,this.ƀhd={duration:500,animation:S.lineer,...t},this.ƀj.value=0,this.ƀo=new M(this.ƀj,"value",{duration:this.ƀhd.duration,animation:this.ƀhd.animation,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀo.value.subscribe(()=>{this.ƀj.value!==1&&this.ƀj.value!==0&&this.ƀha.trigger(this.ƀj.value);}).attach(this);}setState(t,e){if(e?.instant){this.ƀo.completeAnimation(),this.ƀn=t!==void 0?x.Visible:x.Hidden,this.ƀia=void 0;let i=t!==void 0?1:0,r=this.ƀjo!==t;r&&(this.ƀjo=t,this.ƀgy.trigger(this.ƀjo)),(r||this.ƀj.value!==i)&&(this.ƀj.value=i,this.ƀha.trigger(this.ƀj.value));}else switch(this.ƀn){case x.Hidden:t!==void 0&&(this.ƀn=x.Appearing,this.ƀia=void 0,this.ƀjo=t,this.ƀgy.trigger(this.ƀjo),this.ƀo.animate({value:1}).tap(()=>this.ƀgu()).attach(this));break;case x.Visible:t===void 0?(this.ƀn=x.Disappearing,this.ƀia=void 0,this.ƀo.animate({value:0}).tap(()=>this.ƀgu()).attach(this)):t!==this.ƀjo&&(this.ƀn=x.DisappearToChange,this.ƀia=t,this.ƀo.animate({value:0}).tap(()=>this.ƀgu()).attach(this));break;case x.Appearing:t===void 0?(this.ƀn=x.Disappearing,this.ƀia=void 0,this.ƀo.animate({value:0},{duration:this.ƀj.value*this.ƀhd.duration}).tap(()=>this.ƀgu()).attach(this)):t!==this.ƀjo&&(this.ƀj.value>0?(this.ƀn=x.DisappearToChange,this.ƀia=t,this.ƀo.animate({value:0},{duration:this.ƀj.value*this.ƀhd.duration}).tap(()=>this.ƀgu()).attach(this)):(this.ƀia=void 0,this.ƀjo=t,this.ƀgy.trigger(this.ƀjo)));break;case x.Disappearing:t===this.ƀjo?(this.ƀn=x.Appearing,this.ƀo.animate({value:1},{duration:(1-this.ƀj.value)*this.ƀhd.duration}).tap(()=>this.ƀgu()).attach(this)):t!==void 0&&(this.ƀn=x.DisappearToChange,this.ƀia=t);break;case x.DisappearToChange:t===void 0?(this.ƀn=x.Disappearing,this.ƀia=void 0):t===this.ƀjo?(this.ƀn=x.Appearing,this.ƀia=void 0,this.ƀo.animate({value:1},{duration:(1-this.ƀj.value)*this.ƀhd.duration}).tap(()=>this.ƀgu()).attach(this)):t!==this.ƀia&&(this.ƀia=t);break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}ƀgu(){switch(this.ƀn){case x.Appearing:this.ƀj.value===1&&(this.ƀn=x.Visible,this.ƀha.trigger(this.ƀj.value));break;case x.Disappearing:if(this.ƀia!==void 0)throw new Error("FadeInStateAnimation: Unexpected state, disappearing should not have a queued value");this.ƀj.value===0&&(this.ƀn=x.Hidden,this.ƀjo=void 0,this.ƀgy.trigger(this.ƀjo),this.ƀha.trigger(this.ƀj.value));break;case x.DisappearToChange:if(this.ƀia===void 0)throw new Error("FadeInStateAnimation: Unexpected state, disappearToChange should always have a queued value");this.ƀj.value===0&&(this.ƀn=x.Appearing,this.ƀjo=this.ƀia,this.ƀia=void 0,this.ƀgy.trigger(this.ƀjo),this.ƀha.trigger(this.ƀj.value),this.ƀo.animate({value:1}).tap(()=>this.ƀgu()).attach(this));break;case x.Hidden:case x.Visible:return;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}onStateChange(t){return this.ƀgy.subscribe(e=>t(e)).attach(this),this}onValueChange(t){return this.ƀha.subscribe(e=>t(e)).attach(this),this}};var Di=class extends f{static{h(this,"FadeInContent");}constructor(t,e){super(),this.ƀbt=t;let i={duration:200,animation:S.easeInOut,...e};this.alpha=0,this.ƀjp=new ye(i).onStateChange(r=>{this.ƀbh?.destroy(),this.ƀbh=void 0,r!==void 0&&(this.ƀbh=new f().displayParent(this).attach(this),this.ƀbt({state:r,container:this.ƀbh}));}).onValueChange(r=>{this.alpha=r;}).attach(this);}setState(t,e){return this.ƀjp.setState(t,e),this}};var xe=class o extends L__namespace.Filter{static{h(this,"ExpandWithColorFilter");}static ƀej(){return `
|
|
32
|
+
`,i}constructor(t,e){super(ei.ƀev(),ei.ƀed(we.getValuesForLinearSamplingGauss(t),e)),this.ƀfk=e,this.resolution=D;}apply(t,e,i,r){this.uniforms.pixelSize=this.ƀfk?1/(e.width*D):1/(e.height*D),t.applyFilter(this,e,i,r);}},Ot=class extends V__namespace.Filter{static{h(this,"BlurFilter");}constructor(t=new helpersLib.Vector(2,2)){if(super(),this.ƀlb=t,this.resolution=D,this.ƀlb=t.multiplyNumber(D).floor(),this.ƀlb.x<0||this.ƀlb.y<0)throw new Error("BlurFilterLinearSampling: Strength * Resolution must be greater than 0");if(this.ƀlb.x>100||this.ƀlb.y>100)throw new Error("BlurFilterLinearSampling: Strength * Resolution cannot be higher than 100");this.ƀfm=new Fi(this.ƀlb.x,true),this.ƀma=new Fi(this.ƀlb.y,false),this.padding=Math.max(this.ƀlb.x,this.ƀlb.y);}apply(t,e,i,r){let s=t.getFilterTexture();this.ƀma.apply(t,e,s,V__namespace.CLEAR_MODES.CLEAR),this.ƀfm.apply(t,s,i,r),t.returnFilterTexture(s);}get blendMode(){return this.ƀfm.blendMode}set blendMode(t){this.ƀfm.blendMode=t,this.ƀma.blendMode=t;}};var ve=class{static{h(this,"Filters");}get red(){return this.ƀje}set red(t){this.ƀje=t,this.ƀjf();}get green(){return this.ƀez}set green(t){this.ƀez=t,this.ƀjf();}get blue(){return this.ƀag}set blue(t){this.ƀag=t,this.ƀjf();}get brightness(){return this.ƀal}set brightness(t){this.ƀal=t,this.ƀjf();}get contrast(){return this.ƀbp}set contrast(t){this.ƀbp=t,this.ƀjf();}get blur(){return this.ƀah}set blur(t){let e=helpersLib.Comparator.isNumber(t)?new helpersLib.Vector(t,t):t;(this.ƀah&&e&&!this.ƀah.isEqual(e)||this.ƀah&&!e||!this.ƀah&&e)&&(this.ƀah=e,this.ƀai&&(this.ƀai.destroy(),this.ƀai=void 0),e&&(this.ƀai=new Ot(e),this.ƀhp()));}constructor(t){this.ƀbl=t,this.ƀje=1,this.ƀez=1,this.ƀag=1,this.ƀal=1,this.ƀbp=1,this.ƀhp();}removeColorFilter(){this.ƀbe?.destroy(),this.ƀbe=void 0,this.ƀhp();}ƀjf(){this.ƀje===1&&this.ƀez===1&&this.ƀag===1&&this.ƀal===1&&this.ƀbp===1?this.ƀbe&&(this.ƀbe.destroy(),this.ƀbe=void 0,this.ƀhp()):(this.ƀbe||(this.ƀbe=new V__namespace.ColorMatrixFilter,this.ƀbe.resolution=D,this.ƀhp()),this.ƀbe.matrix=[this.ƀje*this.ƀbp,0,0,0,this.ƀal-1,0,this.ƀez*this.ƀbp,0,0,this.ƀal-1,0,0,this.ƀag*this.ƀbp,0,this.ƀal-1,0,0,0,1,0]);}ƀhp(){let t=[];this.ƀai&&t.push(this.ƀai),this.ƀbe&&t.push(this.ƀbe),this.ƀbl.filters=t;}};var u=class o extends ge{static{h(this,"Container");}static{this.allContainers=new Map;}constructor(){super(),this.addChildTo=this,this.defaultChildOptions={addUnder:false,cropOverflowingParts:false},o.allContainers.set(this.id,this),this.filters=new ve(this.ƀis);}destroy(){this.destroyed||(super.destroy(),o.allContainers.delete(this.id),!this.ƀis.destroyed&&this.ƀis.destroy());}getBoundingMask(){if(this.addChildTo!==this)return this.addChildTo.getBoundingMask();throw new Error(`Container: bounding mask cannot be used without bounding shapes. Display Object: "${this.id}"!`)}displayParent(t,e){let i;if(helpersLib.Comparator.isNumber(t)){if(i=o.allContainers.get(t),!i)throw new Error(`Container: parent not found! id: ${t}`)}else i=t;let r={addUnder:i.defaultChildOptions.addUnder,cropOverflowingParts:i.defaultChildOptions.cropOverflowingParts,...e};if(r.addUnder?i.addChildTo.ƀis.addChildAt(this.ƀis,0):i.addChildTo.ƀis.addChild(this.ƀis),r.cropOverflowingParts)if(i)this.ƀis.mask=i.getBoundingMask().pixiSprite;else throw new Error("Container: cropOverflowingParts can only be used with Container parent!");return this}};var Dt=class extends actionsLib.Attachable{static{h(this,"StateAnimation");}onStateChange(t){return this.ƀhs.subscribe(e=>t(e.item,e.nextItem)).attach(this),this}onValueChange(t){return this.ƀhu.subscribe(e=>t(e)).attach(this),this}get state(){return {value:this.ƀk.value,item:this.ƀgd,nextItem:this.ƀhj,queuedItem:this.ƀjb,animationState:this.ƀo}}get paused(){return this.ƀp.paused}set paused(t){this.ƀp.paused=t;}constructor(t){super(),this.ƀk={value:0},this.ƀo="idle",this.ƀhs=new actionsLib.Action,this.ƀhu=new actionsLib.Action,this.ƀhx={duration:500,animation:x.lineer,...t},this.ƀp=new I(this.ƀk,"value",{duration:this.ƀhx.duration,animation:this.ƀhx.animation,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀp.value.subscribe(()=>{this.ƀk.value!==1&&this.ƀk.value!==0&&this.ƀhu.trigger(this.ƀk.value);}).attach(this);}setItem(t,e){if(this.ƀgd===void 0)this.ƀgd=t,this.ƀhs.trigger({item:this.ƀgd,nextItem:this.ƀhj}),this.ƀhu.trigger(this.ƀk.value);else if(e?.instant)this.ƀp.completeAnimation(),this.ƀo="idle",this.ƀgd=t,this.ƀhj=void 0,this.ƀjb=void 0,this.ƀk.value=0,this.ƀhs.trigger({item:this.ƀgd,nextItem:this.ƀhj}),this.ƀhu.trigger(this.ƀk.value);else switch(this.ƀo){case "idle":t!==this.ƀgd&&(this.ƀo="transitioning",this.ƀhj=t,this.ƀk.value=0,this.ƀhs.trigger({item:this.ƀgd,nextItem:this.ƀhj}),this.ƀhu.trigger(this.ƀk.value),this.ƀp.animate({value:1}).tap(()=>this.ƀhn()).attach(this));break;case "transitioning":t===this.ƀgd?(this.ƀjb=void 0,this.ƀo="reverting",this.ƀp.animate({value:0},{duration:this.ƀk.value*this.ƀhx.duration}).tap(()=>this.ƀhn()).attach(this)):t===this.ƀhj?this.ƀjb=void 0:this.ƀjb=t;break;case "reverting":t===this.ƀhj?(this.ƀjb=void 0,this.ƀo="transitioning",this.ƀp.animate({value:1},{duration:(1-this.ƀk.value)*this.ƀhx.duration}).tap(()=>this.ƀhn()).attach(this)):t===this.ƀgd?this.ƀjb=void 0:this.ƀjb=t;break;default:{this.ƀo;throw new Error(`Unexpected case! "${this.ƀo}"`)}}}ƀhn(){switch(this.ƀo){case "transitioning":this.ƀk.value===1&&(this.ƀk.value=0,this.ƀjb!==void 0?(this.ƀo="transitioning",this.ƀgd=this.ƀhj,this.ƀhj=this.ƀjb,this.ƀjb=void 0,this.ƀhs.trigger({item:this.ƀgd,nextItem:this.ƀhj}),this.ƀp.animate({value:1}).tap(()=>this.ƀhn()).attach(this)):(this.ƀo="idle",this.ƀgd=this.ƀhj,this.ƀhj=void 0,this.ƀhs.trigger({item:this.ƀgd,nextItem:this.ƀhj})),this.ƀhu.trigger(this.ƀk.value));break;case "reverting":if(this.ƀgd===void 0)throw new Error("StateAnimation: item must be defined when reverting!");this.ƀk.value===0&&(this.ƀjb!==void 0?(this.ƀo="transitioning",this.ƀhj=this.ƀjb,this.ƀjb=void 0,this.ƀk.value=0,this.ƀhs.trigger({item:this.ƀgd,nextItem:this.ƀhj}),this.ƀp.animate({value:1}).tap(()=>this.ƀhn()).attach(this)):(this.ƀo="idle",this.ƀhj=void 0,this.ƀk.value=0,this.ƀhs.trigger({item:this.ƀgd,nextItem:this.ƀhj})),this.ƀhu.trigger(this.ƀk.value));break;case "idle":break;default:{this.ƀo;throw new Error(`Unexpected case! "${this.ƀo}"`)}}}};var H=Symbol("empty"),be=class extends actionsLib.Attachable{static{h(this,"ThroughEmptyStateAnimation");}onStateChange(t){return this.ƀhs.subscribe(e=>t(e)).attach(this),this}onValueChange(t){return this.ƀhu.subscribe(e=>t(e)).attach(this),this}get state(){let t=this.ƀky.state.queuedItem;return {value:this.ƀlw,item:this.ƀgd,nextItem:this.ƀo==="appearing"?this.ƀgd:void 0,queuedItem:t===H?void 0:t,animationState:this.ƀo}}constructor(t){super(),this.ƀlw=0,this.ƀo="hidden",this.ƀhs=new actionsLib.Action,this.ƀhu=new actionsLib.Action,this.ƀky=new Dt(t).onStateChange((e,i)=>this.ƀfb(e,i)).onValueChange(e=>this.ƀff(e)).attach(this),this.ƀky.setItem(H);}setItem(t,e){if(e?.instant){this.ƀo=t!==void 0?"appearing":"disappearing",this.ƀky.setItem(t??H,{instant:true});return}switch(this.ƀo){case "hidden":t!==void 0&&(this.ƀo="appearing",this.ƀky.setItem(t));break;case "visible":t===void 0?(this.ƀo="disappearing",this.ƀky.setItem(H)):t!==this.ƀgd&&(this.ƀo="disappearToChange",this.ƀky.setItem(H),this.ƀky.setItem(t));break;case "appearing":t===void 0?(this.ƀo="disappearing",this.ƀky.setItem(H)):t!==this.ƀgd&&(this.ƀlw>0?(this.ƀo="disappearToChange",this.ƀky.setItem(H),this.ƀky.setItem(t)):(this.ƀky.setItem(H,{instant:true}),this.ƀky.setItem(t)));break;case "disappearing":t!==void 0&&t===this.ƀgd?(this.ƀo="appearing",this.ƀky.setItem(t)):t!==void 0&&(this.ƀo="disappearToChange",this.ƀky.setItem(t));break;case "disappearToChange":t===void 0?(this.ƀo="disappearing",this.ƀky.setItem(H)):t===this.ƀgd?(this.ƀo="appearing",this.ƀky.setItem(t)):this.ƀky.setItem(t);break;default:{this.ƀo;throw new Error(`Unexpected case! "${this.ƀo}"`)}}}ƀfb(t,e){if(e!==void 0){e!==H&&e!==this.ƀgd&&(this.ƀgd=e,this.ƀo="appearing",this.ƀhs.trigger(this.ƀgd),this.ƀlw!==0&&(this.ƀlw=0,this.ƀhu.trigger(0)));return}if(t===H)this.ƀo==="disappearing"&&(this.ƀgd=void 0,this.ƀo="hidden",this.ƀlw=0,this.ƀhs.trigger(void 0),this.ƀhu.trigger(0));else {let i=t!==this.ƀgd;this.ƀgd=t,this.ƀo="visible",i&&this.ƀhs.trigger(this.ƀgd),(i||this.ƀlw!==1)&&(this.ƀlw=1,this.ƀhu.trigger(1));}}ƀff(t){let e=this.ƀky.state.nextItem;if(e===void 0)return;let i=e===H?1-t:t;i!==this.ƀlw&&(this.ƀlw=i,i!==0&&i!==1&&this.ƀhu.trigger(i));}};var Hi=class extends u{static{h(this,"FadeInContent");}constructor(t,e){super(),this.ƀby=t;let i={duration:200,animation:x.easeInOut,...e};this.alpha=0,this.ƀky=new be(i).onStateChange(r=>{this.ƀbm?.destroy(),this.ƀbm=void 0,r!==void 0&&(this.ƀbm=new u().displayParent(this).attach(this),this.ƀby({state:r,container:this.ƀbm}));}).onValueChange(r=>{this.alpha=r;}).attach(this);}setState(t,e){return this.ƀky.setItem(t,e),this}};var M=class{static{h(this,"GameAssets");}static{this.ƀjl=new Map;}static{this.ƀq=0;}static getAsset(t){let e=this.ƀjl.get(t);if(e)return e;throw new Error(`Game Assets: Resource not found! Key: "${t}"`)}static insertAsset(t,e){let i=e||`a-${this.ƀq++}`;return this.ƀjl.set(i,t),i}static destroyAsset(t){let e=this.ƀjl.get(t);e&&(e.destroy(true),this.ƀjl.delete(t));}static async loadGameAssets(t){let e=new Map,i=[];t.forEach(s=>{if(!helpersLib.Comparator.isString(s.url))throw new Error(`GameAssets: source url should be a string: ${s.url}`);let n=e.get(s.url),a=s.id;n?n.push(a):(e.set(s.url,[a]),i.push({url:s.url,callback:h(l=>{if(l instanceof V__namespace.Texture&&(l.id=a),n=e.get(s.url),n)n.forEach(c=>{this.ƀjl.set(c,l);});else throw new Error(`GameAssets: unexpected error, nameGroup is not found! "./"! ${s}`)},"callback")}));});let r=performance.now();return Promise.all(i.map(s=>V__namespace.Assets.load(s.url))).then(s=>{let n=performance.now();console.info("Asset load completed in: ",Math.round(n-r)/1e3," seconds"),s.forEach((a,l)=>{i[l].callback(a);});}).catch(s=>{throw new Error(`GameAssets: during asset loading, an error occured: ${s}`)})}};var Ee=class o extends V__namespace.Filter{static{h(this,"ExpandWithColorFilter");}static ƀev(){return `
|
|
33
33
|
attribute vec2 aVertexPosition;
|
|
34
34
|
attribute vec2 aTextureCoord;
|
|
35
35
|
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
42
42
|
vTextureCoord = aTextureCoord;
|
|
43
43
|
}
|
|
44
|
-
`}static
|
|
44
|
+
`}static ƀed(t){let e=`
|
|
45
45
|
uniform sampler2D uSampler;
|
|
46
46
|
uniform vec2 pixelSize;
|
|
47
47
|
uniform float expandSquared;
|
|
@@ -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.ƀej(),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 ve=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 xe(e.expand,e.color);let i=helpersLib.Comparator.isNumber(e.blurRadius)?new helpersLib.Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀag=new Et(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 Ut=class o{static{h(this,"GlowSpriteGenerator");}static{this.ƀem=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.ƀiz(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.ƀem.has(n))return o.ƀem.get(n);{let a=this.ƀdu(t,e,i,r);return o.ƀem.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 ve({blurRadius:e,expand:i,color:r})];let n=w.instance.renderer.generateTexture(s);return n.id=D.insertAsset(n),s.destroy(),n}static ƀiz(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}};_.onHardReset.subscribe(()=>{Ut.ƀem.clear();}).attachToRoot();var z=class o extends f{static{h(this,"Sprite");}static createByName(t){let e=w.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.ƀhu,i=e.parent;i&&i.removeChild(e);let r=w.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:D.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.ƀka=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀjj=t,this.pixiSprite=new L__namespace.Sprite(D.getAsset(t.id)),this.ƀhu.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.ƀgg?.destroy(),this.ƀai?.destroy(),this.ƀjj.destroyAssetOnDestroy&&(D.destroyAsset(this.ƀjj.id),this.ƀhv&&D.destroyAsset(this.ƀhv.texture.id)),this.ƀhv&&!this.ƀhv.destroyed&&this.ƀhv.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀka}set textureScale(t){this.ƀka=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.ƀjj.boundingShapes&&!this.ƀhu.hitArea&&(this.ƀhu.hitArea=new ue(this.ƀjj.boundingShapes,this.size,helpersLib.Vector.fromVec2(this.ƀjj.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.ƀhv)return this.ƀhv.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀhv)this.ƀhv.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=helpersLib.Vector.fromVec2(this.ƀjj.anchor).to(t);return new helpersLib.Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀhv&&(this.ƀhv.destroy(),this.ƀhv=void 0),t&&(this.ƀhv=Ut.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀjj.destroyAssetOnDestroy),this.ƀhv.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀhv.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀhu.addChild(this.ƀhv)),this}showBoundingShape(t){return t?this.ƀai||(this.ƀai=this.ƀbr().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀai&&(this.ƀai.destroy(),this.ƀai=void 0),this}getBoundingMask(){if(!this.ƀgg){if(!this.ƀjj.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀgg=this.ƀbr(),this.ƀgg.pixiSprite._maskRefCount=Number.POSITIVE_INFINITY,this.ƀgg.pixiSprite.renderable=false,this.ƀgg.displayParent(this);}return this.ƀgg}ƀbr(){if(!this.ƀjj.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return E.createPolygon(this.ƀjj.boundingShapes,helpersLib.ColorHelper.white).toSprite().attach(this)}download(){let t=w.instance.renderer.extract.canvas(this.ƀhu);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 Ke=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},yt=class o extends f{static{h(this,"ScrollMaskUI");}static{this.ƀcq=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 f;r===exports.ScrollDirection.Horizontal?this.ƀbx(e,i,s):this.ƀce(e,i,s),this.ƀgg=z.createSnapshotSprite(s).attach(this),s.destroy(),t.setMask(this.ƀgg);}ƀce(t,e,i){e>0&&this.ƀbu(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.ƀbu(new helpersLib.Vector(t.x,e)).setPosition(new helpersLib.Vector(t.x,t.y),{round:false}).setRotation(helpersLib.Radian.get180).displayParent(i).attach(i);}ƀbx(t,e,i){e>0&&this.ƀbu(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.ƀbu(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(t.x,0),{round:false}).setRotation(helpersLib.Radian.get90).displayParent(i).attach(i);}ƀbu(t){let i={id:this.ƀbv(t.y),scale:1,size:t,anchor:{x:0,y:0}};return new z(i,{textureSize:t,ignoreAnchor:true})}ƀbv(t){let e=JSON.stringify({type:"gradient",length:t}),i=o.ƀcq.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 Ke;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=D.insertAsset(a),o.ƀcq.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 P;(function(o){o[o.Idle=1]="Idle",o[o.TransitionForward=2]="TransitionForward",o[o.TransitionBackward=3]="TransitionBackward",o[o.Reverting=4]="Reverting";})(P||(P={}));var be=class extends actionsLib.Attachable{static{h(this,"SlideStateAnimation");}constructor(t){super(),this.ƀn=P.Idle,this.ƀgy=new actionsLib.Action,this.ƀha=new actionsLib.Action,this.ƀhd={duration:500,animation:S.easeInOutCubic,...t},this.ƀjp=new ge({duration:this.ƀhd.duration,animation:this.ƀhd.animation}).onStateChange((e,i)=>this.ƀes(e,i)).onValueChange(e=>this.ƀet(e)).attach(this);}setIndex(t,e){if(!helpersLib.Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀfh===void 0?(this.ƀfh=t,this.ƀgy.trigger({state:exports.SlideStateAnimationState.Appear,index:t}),this.ƀjp.setState(t,e)):this.ƀfh!==t?this.ƀgp!==t?this.ƀn===P.Idle?(this.ƀn=t>this.ƀfh?P.TransitionForward:P.TransitionBackward,this.ƀgp=t,this.ƀgy.trigger({state:exports.SlideStateAnimationState.Appear,index:this.ƀgp}),this.ƀjp.setState(t,e)):this.ƀjp.setState(t,e):this.ƀn===P.Reverting&&this.ƀgp===t&&(this.ƀn=t>this.ƀfh?P.TransitionForward:P.TransitionBackward,this.ƀjp.setState(t,e)):(this.ƀn===P.TransitionForward||this.ƀn===P.TransitionBackward)&&(this.ƀn=P.Reverting,this.ƀjp.setState(t,e));}ƀes(t,e){switch(this.ƀfh!==void 0&&this.ƀfh!==t&&this.ƀfh!==e&&this.ƀgy.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀfh}),this.ƀgp!==void 0&&this.ƀgp!==t&&this.ƀgp!==e&&this.ƀgy.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀgp}),e!==void 0&&e!==this.ƀfh&&e!==this.ƀgp&&this.ƀgy.trigger({state:exports.SlideStateAnimationState.Appear,index:e}),this.ƀn){case P.Idle:break;case P.TransitionForward:case P.TransitionBackward:e===void 0?(this.ƀn=P.Idle,this.ƀfh=this.ƀgp,this.ƀgp=void 0):this.ƀfh!==t&&this.ƀep(t,e);break;case P.Reverting:e===void 0?(this.ƀn=P.Idle,this.ƀgp=void 0):this.ƀfh!==e&&this.ƀep(t,e);break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}ƀet(t){let e=1;(this.ƀn===P.TransitionBackward||this.ƀn===P.Reverting&&this.ƀfh!==void 0&&this.ƀgp!==void 0&&this.ƀfh>this.ƀgp)&&(e=-1),(this.ƀn===P.Idle||t!==0)&&this.ƀha.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(-e*t),index:this.ƀfh}),this.ƀgp!==void 0&&this.ƀha.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀgp});}ƀep(t,e){this.ƀfh=t,this.ƀgp=e,this.ƀha.trigger({value:0,index:this.ƀfh}),this.ƀn=this.ƀfh<this.ƀgp?P.TransitionForward:P.TransitionBackward;}onStateChange(t){return this.ƀgy.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀha.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 Ze=class extends f{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀbt=t,this.ƀcl="x",this.ƀbj=new Map,this.ƀhd={duration:300,animation:S.easeInOutCubic,size:new helpersLib.Vector(500,500),margin:20,direction:exports.ScrollDirection.Horizontal,...e};let i=this.ƀhd.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(this.ƀhd.size.x+this.ƀhd.margin*2,this.ƀhd.size.y):new helpersLib.Vector(this.ƀhd.size.x,this.ƀhd.size.y+this.ƀhd.margin*2),r=new f().setPosition(this.ƀhd.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(-this.ƀhd.margin,0):new helpersLib.Vector(0,-this.ƀhd.margin),{round:false}).displayParent(this).attach(this);this.ƀby(i,this.ƀhd.margin,this.ƀhd.direction,r),this.ƀcl=this.ƀhd.direction===exports.ScrollDirection.Horizontal?"x":"y",this.ƀjp=new be({duration:this.ƀhd.duration,animation:this.ƀhd.animation}).onStateChange((s,n)=>{if(s===exports.SlideStateAnimationState.Appear){let a=new f().displayParent(this).attach(this);this.ƀbj.set(n,a),this.ƀbt({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.ƀcl]=i[this.ƀcl]*s+this.ƀhd.margin,a.setPosition(helpersLib.Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=r;}setIndex(t,e){return this.ƀjp.setIndex(t,e),this}ƀby(t,e,i,r){new yt(r,new helpersLib.Vector(t.x,t.y),e,i).attach(this);}},Li=class extends Ze{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.ƀkm=new Map;}add(t){let e=this.ƀkm.get(t.x);e||(e=new Set,this.ƀkm.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀkm.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀkm.get(t.x);return e?e.delete(t.y):false}};var Qe=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 kt=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 Ni=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)}},ls=class{static{h(this,"PathfinderGrid");}constructor(t,e){this.ƀeo=t,this.ƀjm=e,this.ƀhc=new helpersLib.BinaryHeap("min"),this.ƀav=[],this.ƀgr=new helpersLib.Grid({size:t.size,defaultValue:void 0});let i=new Ni(this.ƀjm,0,Number.MAX_SAFE_INTEGER);this.ƀhc.add(i.pathLength,i);}get hasOpenNodes(){return this.ƀhc.size>0}getNeighbors(t,e){return this.ƀeo.getNeighborPositions(t.position,e).filter(i=>this.ƀeo.get(i)).map(i=>this.ƀgr.get(i)||this.ƀbz(i))}popLowestPathCostNode(){let t=this.ƀhc.pop();return this.ƀhc.delete(t),t.closed=true,this.ƀav.push(t),t}changeNodeCost(t,e,i,r){this.ƀhc.delete(t),t.distanceFromStart=e,t.distanceToEnd=t.getDistance(i),t.parent=r,this.ƀhc.add(t.pathLength,t);}getBestClosedNode(){return this.ƀav.reduce((t,e)=>t.distanceToEnd<e.distanceToEnd?t:e)}ƀbz(t){let e=new Ni(t,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);return this.ƀgr.set(t,e),this.ƀhc.add(e.pathLength,e),e}},zt=class{static{h(this,"PathFinder");}static findPath(t,e,i,r){let s=new ls(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 Jt=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀju=t,this.ƀw=e,this.ƀev=this.ƀdw(this.ƀw.size),this.ƀku=new helpersLib.Grid({size:this.ƀw.size,defaultValue:this.ƀev}),this.ƀcm=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.ƀku.set(n,0),r.add(n);});r.notEmpty;){let n=r.pop();if(!i.has(n)){i.add(n);let a=this.ƀku.getOrFail(n);this.ƀeb(n,this.ƀw).forEach(l=>{if(!i.has(l.position)){let c=this.ƀku.getOrFail(l.position),p=a+l.distance;this.ƀw.getOrFail(l.position)&&p<c&&(this.ƀku.set(l.position,p),r.add(l.position));}});}}}getDirectionToTarget(t){if(!t.isInsideRectangle(this.ƀju)){if(t=this.ƀku.movePositionInsideGrid(t),this.ƀcm.has(t))return this.ƀcm.get(t);{let e=this.ƀeb(t,this.ƀw),i;return this.ƀku.getOrFail(t)>=this.ƀev?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.ƀcm.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.ƀku.getOrFail(r.position)<this.ƀev).reduce((r,s)=>{let n=this.ƀku.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.ƀev}).bestDirections;return this.ƀeh(i,t)}ƀeh(t,e){if(t.length>0){let i=t.reduce((r,s)=>r.add(s),helpersLib.Vector.zero);if(i.isZero()||!this.ƀfn(e,i))return helpersLib.Random.pickRandomElement(t).radian;if(t.length>=1)return i.radian}}ƀfn(t,e){let i=t.add(this.ƀkn(e));return this.ƀw.isPointWithinBounds(i)&&this.ƀw.getOrFail(i)}ƀeb(t,e){return this.ƀku.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}ƀkn(t){let e=t.normalize().round();return new helpersLib.Vector(e.x,e.y)}ƀdw(t){return (t.x+t.y)*20}};var us=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 ut{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=us([ft()],V);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},gs=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.ƀin=new f().setAlpha(0).displayParent(w.instance.stage).attach(this),this.ƀac=E.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(w.instance.stage).attach(this),this.ƀaa=new f().displayParent(this.ƀin).attach(this),this.ƀao=new f().displayParent(this.ƀin).attach(this),this.ƀdg=new f().setSortableChildren(true).displayParent(this.ƀin).attach(this),this.ƀan=new f().setSortableChildren(true).displayParent(this.ƀao).attach(this),this.ƀdf=new f().setSortableChildren(true).setZIndex(20).displayParent(this.ƀan).attach(this),this.ƀge=new f().setSortableChildren(true).setZIndex(10).displayParent(this.ƀan).attach(this),this.ƀz=new f().setZIndex(0).displayParent(this.ƀan).attach(this),this.ƀh=new M(this.ƀin,"alpha",{duration:500,animation:S.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀad=new M(this.ƀac,"alpha",{duration:500,animation:S.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),w.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),w.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.ƀbo(e);}).attach(this),this.ƀcw.offset.subscribe(e=>{this.ƀao.position=e;}).attach(this),this.appear(true,"alpha");}destroy(){this.destroyed||(super.destroy(),w.instance.resetScreenPositionToStagePositionFunction());}getLayers(){return {backgroundScreen:this.ƀaa.id,background:this.ƀz.id,main:this.ƀge.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".')}}}ƀbo(t){return helpersLib.Vector.fromTo(t,w.instance.screenSizeCenter.value)}};It=ms([ke({entity:V}),gs("design:paramtypes",[V])],It);var xs=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},vs=1500,Pe=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:w.time,duration:t?.duration??vs,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.ƀfq(i,r,t):i.position.value=r);}ƀfq(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=$.easeInOut(s):r.focusingAnimation===exports.FocusingAnimation.EaseOut?n=$.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;}};Pe=xs([d()],Pe);var bs=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)},ei=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()}};ei=bs([Z(exports.CameraGateway),Ss("design:paramtypes",[Pe])],ei);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},ii=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)}};ii=Ps([Z(gt)],ii);var Xt=class{static{h(this,"Camera");}get position(){return this.ƀam.getCameraPosition()}constructor(){this.ƀam=T.get(exports.CameraGateway),this.ƀaq=T.get(gt),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 w=class o{static{h(this,"Game");}static get instance(){return this.ƀfk}static{this.pause=actionsLib.Reducer.createOr();}static get camera(){return this.ƀal}static get time(){return y.ƀkb}static get setupOptions(){return this.ƀjc}constructor(t){if(this.ƀir=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSize=this.ƀir.notifier,this.ƀis=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSizeCenter=this.ƀis.notifier,this.devMode=false,this.resetScreenPositionToStagePositionFunction(),o.ƀfk)throw new Error("There can be only one Game instance!");{this.ƀbf={screenResolution:void 0,maxScreenResolution: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});this.ƀht=new L__namespace.Application(e);}}async setup(t){o.ƀjc=t;let e=document.body.appendChild(this.ƀht.view);this.ƀjb(e),await Promise.all([D.loadGameAssets(t.assetDefinitions)]),o.ƀfk=this,this.stage=new f().attachToRoot(),this.stage.ƀhu=this.ƀht.stage,this.renderer=this.ƀht.renderer,this.stage.sortableChildren=true,globalThis.ƀa=this.ƀht,this.ƀeq(),o.ƀal=new Xt,this.ƀht.start(),this.ƀht.ticker.add(()=>{y.triggerUpdateTick(this.ƀht.ticker.deltaMS);});}setResolution(t){if(this.ƀht.renderer.resolution!==t){this.ƀht.renderer.resolution=t;let e=this.ƀef();this.ƀht.renderer.resize(e.x,e.y);}}screenPositonToStagePosition(t){let e=Ht.includeScaleInScreenPosition(t,o.instance.stage.scale,o.instance.screenSizeCenter.value);return this.ƀiq(e)}setScreenPositionToStagePositionFunction(t){this.ƀiq=t;}resetScreenPositionToStagePositionFunction(){this.ƀiq=t=>t;}destroyAsset(t){D.destroyAsset(t);}ƀeq(){this.ƀcu(),this.ƀja(),window.addEventListener("resize",t=>{this.ƀcu(),this.ƀja();});}ƀcu(){let t=this.ƀef();(t.x!==this.ƀht.screen.width||t.y!==this.ƀht.screen.height)&&this.ƀht.renderer.resize(t.x,t.y);}ƀja(){let t=new helpersLib.Vector(this.ƀht.screen.width,this.ƀht.screen.height);this.ƀir.value=t,this.ƀis.value=t.multiplyNumber(.5).round();}ƀef(){let t=this.ƀbf.screenResolution?.width??window.innerWidth,e=this.ƀbf.screenResolution?.height??window.innerHeight;return this.ƀbf.maxScreenResolution&&(t=Math.min(t,this.ƀbf.maxScreenResolution.width),e=Math.min(e,this.ƀbf.maxScreenResolution.height)),new helpersLib.Vector(t,e)}ƀjb(t){this.ƀbf.maxScreenResolution&&(t.style.maxWidth=`${this.ƀbf.maxScreenResolution?.width}px`,t.style.maxHeight=`${this.ƀbf.maxScreenResolution?.height}px`),t.style.width="100%",t.style.height="100%";}};var Ee=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 R=s.normalize(g/2),bt=s.normalize(i.dashGap);if(a.push({from:l,to:l.add(R)}),l=l.add(R),m>0){let re=s.normalize(i.dashLength);helpersLib.ArrayHelper.createEmptyArray(m).forEach(()=>{l=l.add(bt),a.push({from:l,to:l.add(re)}),l=l.add(re);});}return l=l.add(bt),a.push({from:l,to:l.add(R)}),a}};var E=class o extends f{static{h(this,"Graphics");}static{this.ƀcq=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),Ee.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.ƀhu.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.ƀeg(e.cacheName,e.cache),r={id:i.assetID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},s=new z(r,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),s}ƀeg(t,e){if(e){let i=o.ƀcq.get(t);return i||(i=this.ƀcd(),o.ƀcq.set(t,i)),i}else return this.ƀcd()}ƀcd(){let t=w.instance.renderer.generateTexture(this.pixiGraphics);t.id=D.insertAsset(t);let e=this.pixiGraphics.getBounds();return {assetID:t.id,bounds:new helpersLib.Vector(e.x,e.y)}}};var si=class extends f{static{h(this,"Placeholder");}constructor(t){super(),this.ƀhw=new L__namespace.Graphics,this.ƀhw.beginFill(0,1e-9),this.ƀhw.drawRect(0,0,t.x,t.y),this.ƀhw.endFill(),this.ƀhu.addChild(this.ƀhw);}destroy(){this.destroyed||(super.destroy(),this.ƀhw.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 Ce=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.ƀfg(r,e),n=this.ƀr(s);return this.ƀjh(n)}static ƀfg(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 ƀjh(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.ƀji(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 ƀji(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 Ie=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀch.length===0}get remainingWidth(){return this.ƀkv-this.ƀcj}constructor(t,e){this.ƀkv=t,this.ƀfy=[],this.ƀch=[],this.ƀcj=0,this.ƀfx=new helpersLib.Vector(0,0),this.ƀci=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀey=i.horizontalAlignment,this.ƀko=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀkv||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀck={direction:i.rectangleCutOption.direction,rectangle:this.ƀbn(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀci,t.y),i=this.ƀdx(this.ƀfx.y,this.ƀfx.y+e);return this.ƀcj+t.x<=i}insertWord(t){let e=Math.max(this.ƀci,t.style.height);if(this.ƀch.length===0){let i=this.ƀdy(this.ƀfx.y,this.ƀfx.y+e);this.ƀfx=new helpersLib.Vector(i,this.ƀfx.y),this.ƀcj=this.ƀfx.x;}this.ƀch.push({chunk:t,position:new helpersLib.Vector(this.ƀcj,this.ƀfx.y)}),this.ƀci=e,this.ƀcj+=t.style.width;}newLine(){let t=this.ƀfx.y+this.ƀci,e=this.ƀdy(t,t);this.ƀdd(),this.ƀfx=new helpersLib.Vector(e,t),this.ƀcj=this.ƀfx.x,this.ƀci=0;}print(){return this.ƀdd(),this.ƀfy}ƀdd(){this.ƀch.length>0&&(this.ƀfy.push(this.ƀg(this.ƀch)),this.ƀch=[]);}ƀg(t){return t=this.ƀkq(t),t=this.ƀfa(t),t}ƀfa(t){if(this.ƀey==="left")return t;let e=this.ƀfx.y+this.ƀci,i=this.ƀdy(this.ƀfx.y,e),s=this.ƀdx(this.ƀfx.y,e)-i,n=Math.min(s,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀey==="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))}ƀkq(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.ƀko){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.ƀko;throw new Error(`Unexpected case! "${this.ƀko}"`)}}return r={chunk:r.chunk,position:new helpersLib.Vector(r.position.x,r.position.y+s)},r})}ƀdy(t,e){return this.ƀck&&(this.ƀck.direction==="topLeft"||this.ƀck.direction==="bottomLeft")&&(this.ƀck.rectangle.isPointInside(new helpersLib.Vector(0,t),{includeEdges:false})||this.ƀck.rectangle.isPointInside(new helpersLib.Vector(0,e),{includeEdges:false}))?this.ƀck.rectangle.bottomRight.x:0}ƀdx(t,e){return this.ƀck&&(this.ƀck.direction==="topRight"||this.ƀck.direction==="bottomRight")&&(this.ƀck.rectangle.isPointInside(new helpersLib.Vector(this.ƀkv,t),{includeEdges:false})||this.ƀck.rectangle.isPointInside(new helpersLib.Vector(this.ƀkv,e),{includeEdges:false}))?this.ƀck.rectangle.topLeft.x:this.ƀkv}ƀbn(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 Ae=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.ƀkw(r,e);}else e.insertWord(r);else e.lineIsEmpty?e.insertWord(r):r.whitespace?this.ƀkw(r,e):(e.newLine(),e.insertWord(r));}),e.newLine();}),e.print()}static ƀkw(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 Oe=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀgl(t),t=this.ƀkf(t),this.ƀat(t)}static ƀgl(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 ƀkf(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 Kt=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=Ce.process(t,e),r=helpersLib.JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),s=new Ie(e.default.wordWrapWidth??1/0,r),n=Ae.wrapText(i,s);return Oe.process(n)}};var Ns=1,zi=1/Ns,Zt=class extends f{static{h(this,"Text");}get ƀjy(){if(!this.ƀjz){let t=new L__namespace.TextStyle(this.ƀhy);this.ƀjz=L__namespace.TextMetrics.measureText(this.ƀjx,t);}return this.ƀjz}get ascent(){return this.ƀjy.fontProperties.ascent}constructor(t,e){super(),this.ƀhy=At.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀhx.destroyed&&this.ƀhx.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new helpersLib.Vector(this.ƀhx.anchor.x,this.ƀhx.anchor.y)}set anchor(t){this.ƀi=t,this.ƀhx.anchor.set(t.x,t.y);}setText(t){return this.ƀjx!==t&&(this.ƀjx=t,this.ƀif()),this}setColor(t){let e=helpersLib.ColorHelper.rgbToHex(t);return this.ƀhy.fill!==e&&(this.ƀhy.fill=e,this.ƀif()),this}ƀif(){this.ƀhx?.destroy(),this.ƀjs?.destroy(),this.ƀjs=void 0,this.ƀjz=void 0;let t=new L__namespace.TextStyle(this.ƀhy);this.ƀhx=new L__namespace.Text(this.ƀjx,t),this.ƀii(),this.ƀi&&this.ƀhx.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀhx.scale.set(zi,zi),this.ƀhu.addChild(this.ƀhx),this.ƀhy.lineThrough&&(this.ƀjs=this.ƀe(this.ƀhx,this.ƀhy.fill),this.ƀhu.addChild(this.ƀjs));}ƀii(){let t=L__namespace.TextMetrics.measureText(this.ƀjx,new L__namespace.TextStyle({...this.ƀhy,dropShadow:false,dropShadowAlpha:0,dropShadowBlur:0,dropShadowDistance:0}));this.ƀhx.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 oi=class extends f{static{h(this,"RichText");}constructor(t,e){super(),Kt.process(t,e).forEach(r=>new Zt(r.text,r.style).setPosition(r.position).displayParent(this).attach(this));}};var ni=class extends f{static{h(this,"UpdatableContainer");}},ai=class extends f{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀbt=t,this.ƀcn=new Map,this.ƀhd={trackBy:h((i,r)=>r,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀcn.keys()),i=0;t.forEach((r,s)=>{let n=this.ƀhd.trackBy(r,s),a;this.ƀcn.has(n)?(a=this.ƀcn.get(n),e.delete(n),a.update(r)):(a=this.ƀbt(r).displayParent(this).attach(this),this.ƀcn.set(n,a)),this.ƀhd.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀhd.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀhd.positioning.spacing);}),e.forEach(r=>{this.ƀcn.get(r).destroy(),this.ƀcn.delete(r);});}};var Qt=class o extends f{static{h(this,"MenuUI");}static{this.ƀfm=actionsLib.Reducer.createExistenceChecker();}static{this.isAnyMenuTransitioning=this.ƀfm.notifier;}constructor(t,e){super(),this.ƀgv=new actionsLib.SingleAction,this.onCreate=this.ƀgv.notifier,this.ƀgx=new actionsLib.SingleAction,this.onOpen=this.ƀgx.notifier,this.ƀgs=new actionsLib.SingleAction,this.onClose=this.ƀgs.notifier,this.ƀaw=false;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.setAlpha(0),this.ƀo=new M(this,"alpha",{animation:S.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.ƀgj=z.createByName(t).setPosition(new helpersLib.Vector(0,0)).setInteractive(true).displayParent(this).attach(this),w.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.ƀgv.resolve();let s=o.ƀfm.effect().attach(this);this.ƀo.animate({alpha:1}).chain(this).tap(()=>{this.ƀgx.resolve(),s.destroy(),i.closeOnBackgroundClick&&r.on(exports.ContainerEventType.Click).take(1).tap(()=>this.close()).attach(this);}).attachToRoot();}getBoundingMask(){return this.ƀgj.getBoundingMask()}close(){if(!this.ƀaw){this.ƀaw=true;let t=o.ƀfm.effect().attach(this);this.ƀo.animate({alpha:0}).chain(this).map(()=>{this.ƀgs.resolve(),t.destroy(),this.destroy();}).chainToRoot();}return this.onClose.toSingleEvent()}};var li=class extends ut{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.ƀhd=t,queueMicrotask(()=>{if(!this.ƀgk)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀih(t){this.ƀgk=t,this.ƀgk.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀgk.onCreate.toSingleEvent()}onOpen(){return this.ƀgk.onOpen.toSingleEvent()}onClose(){return this.ƀgk.onClose.toSingleEvent()}close(){return this.ƀgk.close()}};var ci=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.ƀhd.closeOnBackgroundClick}),s=new Qt(e,r).displayParent(w.camera.layers.foregroundScreen).attach(this);t.ƀih(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 Js=.65,Ys=.01,Me=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀit}get contentSize(){return this.ƀbh.size.ceil()}constructor(t,e,i,r){this.ƀbh=t,this.ƀu=e,this.ƀhg=i,this.ƀjg=r,this.ƀfj=false,this.ƀit=e-i*2,this.ƀbh.y=i,this.ƀjt=i;}onWheel(t){this.setTarget(this.ƀjt-t*Js);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀjt=helpersLib.NumberHelper.clamp(t,this.ƀu-this.ƀhg-this.contentSize.y,this.ƀhg);}jumpToTarget(){this.ƀbh.y=this.ƀjt;}update(t){let e=this.contentSize;if(e.y<=this.ƀit){switch(this.ƀjg){case "start":this.ƀjt=this.ƀhg;break;case "center":this.ƀjt=(this.ƀu-e.y)*.5;break;case "end":this.ƀjt=this.ƀu-e.y-this.ƀhg;break;default:{this.ƀjg;throw new Error(`Unexpected case! "${this.ƀjg}"`)}}this.ƀfj||(this.ƀbh.y=this.ƀjt);}this.ƀfj=true;let i=this.ƀjt-this.ƀbh.y;this.ƀbh.y=this.ƀbh.y+i*Ys*t;}};var Ks=15,pi=class extends f{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbi}get contentSize(){return this.ƀiu.contentSize}constructor(t,e={}){super();let i={padding:Ks,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 f().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.ƀhu.addChild(s);let n=new f().displayParent(r).attach(this);this.ƀiu=new Me(n,t.y,i.padding,i.smallContentAlign),this.ƀbi=new helpersLib.Vector(t.x,this.ƀiu.scrollHeight),s.eventMode="dynamic",s.addEventListener("wheel",a=>{this.ƀiu.onWheel(a.deltaY);}),n.setInteractive(true),n.ƀhu.addEventListener("wheel",a=>{this.ƀiu.onWheel(a.deltaY);}),y.afterSceneUpdateAction.subscribe(a=>this.ƀiu.update(a.delta)).attach(this),this.addChildTo=n;}scrollToTop(t){this.ƀiu.scrollToTop(),t?.instant&&this.ƀiu.jumpToTarget();}scrollToBottom(t){this.ƀiu.scrollToBottom(),t?.instant&&this.ƀiu.jumpToTarget();}};var Zs=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 di{static{h(this,"KeyboardService");}constructor(){this.ƀft=new actionsLib.Action,this.keyPressed=this.ƀft.notifier,this.ƀfu=new actionsLib.Action,this.keyReleased=this.ƀfu.notifier,this.ƀga=new Set,this.ƀfz=new Set,window.addEventListener("keydown",t=>{this.ƀga.add(t.code),this.ƀfz.add(t.code),!t.repeat&&this.ƀft.trigger({key:t.key,code:t.code});}),window.addEventListener("keyup",t=>{this.ƀga.delete(t.code),this.ƀfu.trigger({key:t.key,code:t.code});}),window.addEventListener("blur",()=>{this.ƀga.clear();}),y.afterSceneUpdateAction.subscribe(()=>this.ƀfz.clear()).attachToRoot();}isKeyDown(t,e){return (e?.onlyPressedThisFrame?this.ƀfz:this.ƀga).has(t)}};exports.KeyboardService=Zs([d(),Qs("design:paramtypes",[])],exports.KeyboardService);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},to=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.MouseService=class te{static{h(this,"MouseService");}constructor(){this.ƀfi=new actionsLib.Variable(false),this.initialMouseMovementHappened=this.ƀfi.notifier,this.ƀjk=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀjk.notifier,this.ƀip=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀip.notifier,this.ƀgd=new actionsLib.Variable(false),this.mainButtonState=this.ƀgd.notifier,this.ƀiv=new actionsLib.Variable(false),this.secondaryButtonState=this.ƀiv.notifier,this.ƀjl(),window.addEventListener("pointerdown",t=>{t.button===0?this.ƀgd.value=true:t.button===2&&(this.ƀiv.value=true);},{capture:true}),window.addEventListener("pointerup",t=>{t.button===0?this.ƀgd.value=false:t.button===2&&(this.ƀiv.value=false);},{capture:true}),window.addEventListener("blur",()=>{this.ƀgd.value=false,this.ƀiv.value=false;},{capture:true});}ƀjl(){let t=helpersLib.Vector.zero;window.addEventListener("pointermove",e=>{t=new helpersLib.Vector(e.clientX,e.clientY),this.ƀfi.value=true;},{capture:true}),y.beforeSceneUpdateAction.subscribe(()=>{this.ƀip.value=this.clientPositionToScreenPosition(t);}).attachToRoot(),y.afterSceneUpdateAction.subscribe(()=>{let e=w.instance.screenPositonToStagePosition(this.ƀip.value);e.isEqual(this.ƀjk.value)?w.instance.renderer.events.onPointerMove(new PointerEvent("pointermove",{clientX:t.x,clientY:t.y,pointerType:"mouse"})):this.ƀjk.value=e;}).attachToRoot();}clientPositionToScreenPosition(t){let i=w.instance.renderer.view.getBoundingClientRect(),r=i.width,s=i.height;if(r<=0||s<=0)return helpersLib.Vector.zero;let n=w.instance.renderer,a=(t.x-i.left)/r*n.screen.width,l=(t.y-i.top)/s*n.screen.height;return a=helpersLib.NumberHelper.clamp(a,0,n.screen.width),l=helpersLib.NumberHelper.clamp(l,0,n.screen.height),new helpersLib.Vector(a,l)}};exports.MouseService=qs([d(),to("design:paramtypes",[])],exports.MouseService);var eo=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},io=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.MouseTargetFocusService=class fi{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀde}get lastFocusedPosition(){return this.ƀfw}constructor(t){this.ƀgn=t,this.ƀgz=new actionsLib.Action,this.onTargetFocus=this.ƀgz.notifier,this.ƀkd=0,this.ƀke=false,this.ƀde=false,this.ƀfw=void 0,y.beforeSceneUpdateAction.subscribe(e=>this.ƀkh(e.delta)).attachToRoot();}ƀkh(t){if(this.ƀgo){let e=this.ƀee(this.ƀgn.stagePosition.value,this.ƀgo);this.ƀhi===void 0?this.ƀhi=e:this.ƀas(e,t);}this.ƀgo=this.ƀgn.stagePosition.value;}ƀas(t,e){this.ƀhi-t>10?(this.ƀkd=Math.max(250,this.ƀkd),this.ƀke=true):this.ƀkd>1e3&&(this.ƀke=true);let i=this.ƀkd>=300&&this.ƀke;this.ƀfr(i,t,e);}ƀfr(t,e,i){(t||e>this.ƀhi)&&(this.ƀhi=e),t?(this.ƀke=false,this.ƀkd=0,this.ƀde=true,this.ƀfw=this.ƀgn.stagePosition.value,this.ƀgz.trigger(this.ƀfw)):(this.ƀkd+=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=eo([d(),io("design:paramtypes",[exports.MouseService])],exports.MouseTargetFocusService);var ui=10.8,mi=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 u=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 W__default.default.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};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},st=class extends K(){static{h(this,"PhysicsInternalGateway");}};st=ho([d()],st);var b=class o extends U{static{h(this,"PhysicsEntity");}static{this.ƀhf=new Map;}static{this.ƀhm=new Map;}static getFromP2BodyID(t){return o.ƀhf.get(t)}static getFromP2BodyIDOrFail(t){let e=o.ƀhf.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=o.ƀhm.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(o.ƀhm.values())}get area(){return this.ƀt}get mass(){return this.ƀgh}get collisions(){return this.ƀax}constructor(t,e,i){super(),this.ƀgt=new actionsLib.Action,this.onCollision=this.ƀgt.notifier,this.type="dynamic",this.ƀt=0,this.ƀgh=0,this.ƀax=[],this.physicsWorldID=t,this.ƀho=T.get(st);let r=this.ƀho.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀho.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀhn=this.ƀho.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀhp=this.ƀho.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀho.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀt=this.p2Body.getArea(),this.ƀgh=this.p2Body.mass,this.p2Body.position=u.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀho.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.ƀhf.set(this.p2Body.id,this),o.ƀhm.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀho.removeBody(this.physicsWorldID,this.p2Body),o.ƀhf.delete(this.p2Body.id),o.ƀhm.delete(this.id));}canCollideWith(t){return u.arePhysicsGroupsCollidable(this.ƀhn,this.ƀhp,t.ƀhn,t.ƀhp)}ƀix(t){this.ƀax=t,t.length>0&&this.ƀgt.trigger(t);}};var ee=class extends b{static{h(this,"ImmovablePhysicsEntity");}constructor(t,e){super(t,e,"static"),this.position=u.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 gi=class extends U{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.ƀjq(t,e);}).attach(this);}ƀjq(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 yi=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.ƀfb=false,this.ƀfc=false,this.ƀfe=false,this.ƀfd=false,this.ƀhj(),this.ƀgb(),T.get(st).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀjq(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}}ƀjq(t,e){this.ƀfb=true,this.ƀfc=true,this.ƀfe=true,this.ƀfd=true,this.ƀhj();}ƀhj(){this.position.value=u.arrayToVector(this.p2Body.position),this.rotation.value=new helpersLib.Radian(this.p2Body.angle),this.velocity.value=u.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀgb(){this.position.subscribe(t=>{this.ƀfb?this.ƀfb=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfc?this.ƀfc=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfe?this.ƀfe=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfd?this.ƀfd=false:this.p2Body.angularVelocity=t;}).attach(this);}};var ot="border";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};exports.PhysicsGateway=class ie extends K(){static{h(this,"PhysicsGateway");}};exports.PhysicsGateway=fo([d()],exports.PhysicsGateway);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},mo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},v=class extends U{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=uo([ft(),mo("design:paramtypes",[helpersLib.Vector,Boolean,W__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},J=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}};J=xo([d()],J);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)},_e=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀhl=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((r,s)=>{r.forEach((n,a)=>{this.ƀhl.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();}};_e=vo([d(),bo("design:paramtypes",[J])],_e);var So=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},Po=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.ƀhl=t,this.ƀx=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let r=u.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=50){return e.aabbNeedsUpdate=true,e.updateAABB(),kt.findByConvertingGridSpace(this.getAvilabilityGrid(t,r,i),u.aabbToBoundingBox(e.aabb),r)}getAvilabilityGrid(t,e,i){let r=this.ƀx.get(t,e,i);return r||(r=this.ƀbw(t,e,i),this.ƀx.set(t,e,i,r)),r}ƀbw(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.ƀhl.canCollide(t,n.physicsBodyGroup,i)){let a=this.ƀdv(s,e);r.setArea(a,false);}}),r}ƀdv(t,e){let i=u.aabbToBoundingBox(t.aabb);return B.areaToGridArea(i,e)}};nt=So([d(),Po("design:paramtypes",[J,_e])],nt);var Ro=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},Co=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Bt=class{static{h(this,"PathFinderService");}constructor(t){this.ƀhk=t;}findPathAStar(t,e,i,r,s){s||(s={}),s.neighborType===void 0&&(s.neighborType=helpersLib.GridNeighborType.Ortogonal),s.gridCellSize===void 0&&(s.gridCellSize=50);let n=v.getInstanceByIDOrFail(t),a,l;helpersLib.Comparator.isNumber(i)?(l=b.getPhysicsInstanceOrFail(i).p2Body,a=u.arrayToVector(l.position)):a=i;let c=B.positionToGridPosition(e,s.gridCellSize),p=B.positionToGridPosition(a,s.gridCellSize),m=this.ƀhk.getAvilabilityGrid(n,s.gridCellSize,r);if(l){let R=u.aabbToBoundingBox(l.aabb),bt=B.areaToGridArea(R,s.gridCellSize);m.setArea(bt,true);}let g=zt.findPath(m,c,p,s.neighborType);return g.path=g.path.map(R=>B.gridPositionToPosition(R,s.gridCellSize)),g}findPathDirection(t,e,i,r,s=50){let n=v.getInstanceByIDOrFail(t),a;if(helpersLib.Comparator.isNumber(i)){let g=b.getPhysicsInstanceOrFail(i);a=u.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.ƀhk.getAvilabilityGrid(n,s,r);p=new Jt(l,g),n.vectorFieldCache.set(c,p);}let m=B.positionToGridPosition(e,s);return p.getDirectionToTarget(m)}};Bt=Ro([d(),Co("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},Do=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},X=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀy=t,this.ƀhh=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.ƀhh.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 M(m,"alpha",{duration:1e3,animation:S.easeIn}).animate({alpha:0}).tap(()=>m.destroy()).attach(m);}});}createExplosionDebugVisual(t,e,i,r,s,n=300){let a=new f().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 M(a,"alpha",{duration:n,animation:S.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,r,s,n,a=300){let l=new f().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 M(l,"alpha",{duration:a,animation:S.easeIn}).animate({alpha:0}).tap(()=>l.destroy()).attach(l);}createPhysicsEntityShapeVisual(t,e,i){let r=i?.overridePosition??u.arrayToVector(t.position),s=i?.overrideRotation??new helpersLib.Radian(t.angle),n=i?.color??helpersLib.ColorHelper.blue,a=new f().displayParent(e).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀcp(c,n).displayParent(a).attachToRoot();}),new M(a,"alpha",{duration:1e3,animation:S.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcp(t,e){switch(t.type){case W__default.default.Shape.PARTICLE:throw new Error("Not implemented");case W__default.default.Shape.LINE:throw new Error("Not implemented");case W__default.default.Shape.PLANE:throw new Error("Not implemented");case W__default.default.Shape.CIRCLE:throw new Error("Not implemented");case W__default.default.Shape.CAPSULE:throw new Error("Not implemented");case W__default.default.Shape.BOX:throw new Error("Not implemented");case W__default.default.Shape.HEIGHTFIELD:throw new Error("Not implemented");case W__default.default.Shape.CONVEX:return this.ƀco(t,e);default:throw new Error("Not implemented")}}ƀco(t,e){let i=[t.vertices.map(r=>({x:r[0],y:r[1]}))];return E.createPolygon(i,e).toSprite()}};X=Oo([d(),Do("design:paramtypes",[nt,Bt])],X);var Go=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)},Fe=class{static{h(this,"HitTestService");}constructor(t){this.ƀjw=t;}hitTest(t,e){let i=t.world,r=b.getFromP2BodyIDOrFail(t.id),s=u.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=>u.cloneP2Body(l.p2Body)),a=false;if(n.length!==0){let l=new W__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.ƀjw.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀs(t,e){e?.overridePosition&&(t.position=u.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀdi(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};Fe=Go([d(),_o("design:paramtypes",[X])],Fe);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},Ve=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀig(t,i);});});}step(t,e,i){b.getPhysicsEntities().forEach(r=>{r.ƀax=[];}),t.p2World.narrowphase.contactEquations.forEach(r=>{this.ƀig(t,r);}),t.bodiesInContactWith.forEach((r,s)=>{this.ƀer(r.p2Body),r.entity.ƀix(t.collisionReports.get(s)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀer(t){let e=u.arrayToVector(t.velocity);e.length>ui&&(e=e.normalize(ui),t.velocity=u.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-mi),mi);}ƀig(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=u.arrayToVector(i.contactPointA),a=u.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=u.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};Ve=Vo([d()],Ve);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},No=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Le=class extends ee{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};Le=Lo([ft(),No("design:paramtypes",[Number,Object])],Le);var jo=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=1e4,Ne=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbq(t,new helpersLib.Vector(e.x/2,-H/2),new helpersLib.Vector(e.x+H*2,H),i),this.ƀbq(t,new helpersLib.Vector(e.x/2,e.y+H/2),new helpersLib.Vector(e.x+H*2,H),i),this.ƀbq(t,new helpersLib.Vector(-H/2,e.y/2),new helpersLib.Vector(H,e.y+H*2),i),this.ƀbq(t,new helpersLib.Vector(e.x+H/2,e.y/2),new helpersLib.Vector(H,e.y+H*2),i);}ƀbq(t,e,i,r){return new Le(t,{shapeDefinition:{materialName:ot,group:r,shapeType:exports.PhysicsShapeType.Rectangle,shapeData:i},position:e,rotation:helpersLib.Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};Ne=jo([d()],Ne);var Wo=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},rr=new W__default.default.Material,Uo={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 W__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,rr),n.set(ot,Uo),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 W__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 W__default.default.ContactMaterial(n,rr,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};Gt=Wo([d()],Gt);var $o=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},ko=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},_t=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,r,s){this.ƀgi=t,this.ƀah=e,this.ƀy=i,this.ƀay=r,this.ƀhl=s;}createPhysicsWorld(t){let e=new W__default.default.World({gravity:[0,0]}),{materials:i,materialDefinitions:r}=this.ƀgi.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:s,physicsBodyGroupToP2Mask:n}=this.ƀhl.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.ƀjq(a,l,c)):y.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀjq(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);}ƀjq(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);}};_t=$o([d(),ko("design:paramtypes",[Gt,Ne,nt,Ve,J])],_t);var Jo=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 W__default.default.RaycastResult,s=new W__default.default.Ray({mode:W__default.default.Ray.CLOSEST,from:u.vectorToArray(e.from),to:u.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i)});if(t.p2World.raycast(r,s),r.hasHit())return this.ƀbl(r,e)}castAllFirstContacts(t,e,i){let r=new Map,s=new W__default.default.Ray({mode:W__default.default.Ray.ALL,from:u.vectorToArray(e.from),to:u.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.ƀbl(n,e)):n.fraction===a.fraction&&a.isExternal()&&r.set(n.body,this.ƀbl(n,e));},"callback")});return t.p2World.raycast(new W__default.default.RaycastResult,s),Array.from(r.values())}ƀbl(t,e){let i=t.fraction,r=u.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=Jo([d()],Vt);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},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(u.vectorToArray(s),n);}};lt=Yo([d()],lt);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,"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.ƀbm(r,t.length))}ƀbm(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=u.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=Xo([d()],Lt);var Zo=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)},en=15,He=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,r){this.ƀic=t,this.ƀjw=e,this.ƀib=i,this.ƀff=r;}createElipticExplosion(t,e,i,r,s,n,a){let l=v.getInstanceByIDOrFail(t),c=this.ƀcb(e,i,r,s,a?.hitOnlyClosest===true,l),p=this.ƀib.toExplosionHits(c,false);return this.ƀq(p,n),a?.testLayerID&&this.ƀjw.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,r,a.debugRayDuration),p.map(m=>{let{p2Body:g,...R}=m;return R})}ƀcb(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/en),R=i.y/(g*2+1)*2,bt=l.normalize(R),re=i.x,or=Math.pow(i.y,2);return helpersLib.ArrayHelper.createIntegerArray(g).forEach(pt=>{let St=R*(pt+1),vi=bt.multiplyNumber(pt+1),se=c.normalize(this.ƀel(re,or,St)),oe=t.add(vi);a.push(new helpersLib.Line(oe,oe.add(se))),a.push(new helpersLib.Line(oe,oe.add(se.multiplyNumber(-1))));let ne=t.add(vi.multiplyNumber(-1));a.push(new helpersLib.Line(ne,ne.add(se))),a.push(new helpersLib.Line(ne,ne.add(se.multiplyNumber(-1))));}),a.map(pt=>{if(s){let St=this.ƀic.castClosest(n,pt,r);return {line:pt,hits:St?[St]:[]}}else {let St=this.ƀic.castAllFirstContacts(n,pt,r);return {line:pt,hits:St}}})}ƀel(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.ƀff.applyImpulse(r.body,r.hitPosition(),s,n);});});}};He=Zo([d(),Qo("design:paramtypes",[Vt,X,Lt,lt])],He);var rn=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},sn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},We=class{static{h(this,"ExplosionService");}constructor(t,e,i,r){this.ƀic=t,this.ƀjw=e,this.ƀib=i,this.ƀff=r;}createExplosion(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t),l=this.ƀei(i),c=this.ƀcb(e,i,r,l,n?.hitOnlyClosest===true,a),p=this.ƀib.toExplosionHits(c);return this.ƀq(e,i,s,l,p),n?.testLayerID&&this.ƀjw.createExplosionDebugVisual(a,n.testLayerID,c,e,i,n.debugRayDuration),p}ƀcb(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.ƀic.castClosest(n,p,i);return {line:p,hits:m?[m]:[]}}else {let m=this.ƀic.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.ƀff.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=helpersLib.Vector.fromTo(t,u.arrayToVector(n.p2Body.position)),l=a.length/e,c=i*r*l/2;this.ƀff.applyImpulse(n.p2Body,n.getHitPosition(),a,c);}});}ƀei(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};We=rn([d(),sn("design:paramtypes",[Vt,X,Lt,lt])],We);var ln=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=ln([d()],Nt);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},pn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},wi=class{static{h(this,"PhysicsController");}constructor(t,e,i,r,s,n,a,l){this.ƀhs=t,this.ƀhh=e,this.ƀjw=i,this.ƀda=r,this.ƀct=s,this.ƀew=n,this.ƀhr=a,this.ƀff=l;}createPhysicsWorld(t){return this.ƀhs.createPhysicsWorld(t)}getMapSize(t){return this.ƀhr.getMapSize(t)}setPaused(t,e){this.ƀhs.setPaused(t,e);}hitTest(t,e){let i=b.getPhysicsInstanceOrFail(t);return this.ƀew.hitTest(i.p2Body,e)}findPath(t,e,i,r,s){return this.ƀhh.findPathAStar(t,e,i,r,{neighborType:s})}findPathDirection(t,e,i,r){return this.ƀhh.findPathDirection(t,e,i,r)}applyImpulse(t,e,i,r){let s=b.getPhysicsInstanceOrFail(t);this.ƀff.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.ƀct.createElipticExplosion(t,e,i,r,s,n,a)}printPathfindingTestGrid(t,e,i,r,s,n=50){this.ƀjw.printPathfindingTestGrid(t,e,i,r,s,n);}};wi=cn([Z(exports.PhysicsGateway),pn("design:paramtypes",[_t,Bt,X,We,He,Fe,Nt,lt])],wi);var dn=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},Ue=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.ƀbs(n,void 0,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Circle:return this.ƀbs(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Polygon:return this.ƀca(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Rectangle:return this.ƀcc(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);default:{e.shapeDefinition.shapeType;throw new Error(`Unexpected case! "${e.shapeDefinition.shapeType}"`)}}}ƀbs(t,e,i,r,s,n){let a=new W__default.default.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s),radius:e});a.material=i;let l=new W__default.default.Body({type:n==="dynamic"?W__default.default.Body.DYNAMIC:W__default.default.Body.STATIC,mass:r.density,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return l.addShape(a),l}ƀca(t,e,i,r,s,n){let a=t.physicsBodyGroupToP2Group.get(s),l=t.physicsBodyGroupToP2Mask.get(s),c=e.map(g=>new W__default.default.Convex({vertices:g.map(R=>[R.x,R.y]),collisionGroup:a,collisionMask:l})).map(g=>(g.material=i,g)),p=c.reduce((g,R)=>g+R.area,0),m=new W__default.default.Body({type:n==="dynamic"?W__default.default.Body.DYNAMIC:W__default.default.Body.STATIC,mass:p,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.forEach(g=>m.addShape(g)),m.setDensity(r.density),m}ƀcc(t,e,i,r,s,n){let a=new W__default.default.Box({width:e.x,height:e.y,collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s)});a.material=i;let l=e.x*e.y,c=new W__default.default.Body({type:n==="dynamic"?W__default.default.Body.DYNAMIC:W__default.default.Body.STATIC,mass:l,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.addShape(a),c.setDensity(r.density),c}};Ue=dn([d()],Ue);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},un=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},xi=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,r,s){this.ƀhs=t,this.ƀhq=e,this.ƀjd=i,this.ƀhr=r,this.ƀhl=s;}createBody(t,e,i,r,s){return this.ƀjd.createBody(t,e,i,r,s)}getMaterial(t,e){return this.ƀhq.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀhq.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀhl.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀhl.getMaskConstant(t,e)}addBody(t,e,i,r,s){return this.ƀhs.addBody(t,e,i,r,s)}removeBody(t,e){this.ƀhs.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀhr.subscribeToPhysicsStep(t,e)}};xi=fn([Z(st),un("design:paramtypes",[_t,Gt,Ue,Nt,J])],xi);exports.AnimationFlicker=Ci;exports.AnimationInterpolationFunctions=$;exports.Animations=S;exports.Animator=M;exports.BORDER_MATERIAL_NAME=ot;exports.BardLegendsHardReset=_;exports.Camera=Xt;exports.ClosestAvailableSpaceHelper=kt;exports.Container=f;exports.ControllerDecorator=Z;exports.DEFAULT_SHADER_RESOLUTION=O;exports.DeltaTime=Qe;exports.DisplayObjectArray=ai;exports.Entity=U;exports.EntityDecorator=ft;exports.FadeInContent=Di;exports.FadeInStateAnimation=ye;exports.Game=w;exports.Gateway=K;exports.Graphics=E;exports.ImmovablePhysicsEntity=ee;exports.MenuEntity=li;exports.MenuUI=Qt;exports.MenuView=ci;exports.MovableEntity=gi;exports.MovablePhysicsEntity=yi;exports.PathFinder=zt;exports.PhysicsEntity=b;exports.Placeholder=si;exports.PositionConversionHelper=Ht;exports.ROTATIONAL_SPEED_LIMIT=mi;exports.RichText=oi;exports.SPEED_LIMIT=ui;exports.Scene=ae;exports.SceneDecorator=wr;exports.ScrollAreaUI=pi;exports.ScrollMaskUI=yt;exports.Service=T;exports.ServiceDecorator=d;exports.SingletonEntity=ut;exports.SlideInContent=Li;exports.SlideInContentByIndex=Ze;exports.SlideStateAnimation=be;exports.Sprite=z;exports.StateAnimation=ge;exports.Text=Zt;exports.UpdatableContainer=ni;exports.UpdateCycle=y;exports.VectorFieldPathFinder=Jt;exports.VectorSet=xt;exports.View=dt;exports.ViewDecorator=ke;
|
|
67
|
+
}`,e}constructor(t,e){if(super(o.ƀev(),o.ƀed(t*D)),this.ƀdf=t,this.resolution=D,this.ƀdf=t*D,this.ƀdf<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀdf>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");helpersLib.Comparator.isInteger(this.ƀdf)||(this.ƀdf=Math.floor(this.ƀdf));let i=helpersLib.ColorHelper.normalize(e);this.uniforms.color=new Float32Array([i.red,i.green,i.blue]),this.uniforms.expandSquared=this.ƀdf*this.ƀdf,this.padding=this.ƀdf;}apply(t,e,i,r){this.uniforms.pixelSize=new Float32Array([1/(e.width*D),1/(e.height*D)]),t.applyFilter(this,e,i,r);}};var Te=class extends V__namespace.Filter{static{h(this,"GlowFilter");}constructor(t){super(),this.resolution=D;let e={blurRadius:1,expand:0,color:helpersLib.ColorHelper.white,blendMode:exports.BlendMode.Screen,...t};this.ƀdg=new Ee(e.expand,e.color);let i=helpersLib.Comparator.isNumber(e.blurRadius)?new helpersLib.Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀai=new Ot(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀai.blendMode=V__namespace.BLEND_MODES.SCREEN;}apply(t,e,i,r){let s=t.getFilterTexture();this.ƀdg.apply(t,e,s,V__namespace.CLEAR_MODES.CLEAR),this.ƀai.apply(t,s,i,r),t.returnFilterTexture(s);}};var Jt=class o{static{h(this,"GlowSpriteGenerator");}static{this.ƀey=new Map;}static createGlowSpriteFromSprite(t,e,i){let r=this.ƀbh(e),s=helpersLib.Comparator.isNumber(r.blurRadius)?new helpersLib.Vector(r.blurRadius,r.blurRadius):r.blurRadius,n=this.ƀef(t.texture,s,r.expand,r.color,i),a=new V__namespace.Sprite(n);return this.ƀjy(a,helpersLib.Vector.fromVec2(t.anchor),Math.max(s.x,s.y)+r.expand),a.alpha=r.glowAlpha,a.blendMode=r.blendMode,a}static ƀef(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.ƀey.has(n))return o.ƀey.get(n);{let a=this.ƀeg(t,e,i,r);return o.ƀey.set(n,a),a}}else return this.ƀeg(t,e,i,r)}static ƀeg(t,e,i,r){let s=new V__namespace.Sprite(t);this.ƀdi(s,Math.max(e.x,e.y)+i),s.filters=[new Te({blurRadius:e,expand:i,color:r})];let n=g.instance.renderer.generateTexture(s);return n.id=M.insertAsset(n),s.destroy(),n}static ƀjy(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 ƀdi(t,e){if(t.isSprite){let s=new V__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 ƀbh(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:helpersLib.ColorHelper.white,blendMode:exports.BlendMode.Add};return t&&(e={...e,...t}),e}};R.onHardReset.subscribe(()=>{Jt.ƀey.clear();}).attachToRoot();var k=class o extends u{static{h(this,"Sprite");}static createByName(t){let e=g.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new o(e)}static createSnapshotSprite(t){let e=t.ƀis,i=e.parent;i&&i.removeChild(e);let r=g.instance.renderer.generateTexture(e,{resolution:2,scaleMode:V__namespace.SCALE_MODES.LINEAR,multisample:V__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.ƀlk=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀkq=t,this.pixiSprite=new V__namespace.Sprite(M.getAsset(t.id)),this.ƀis.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.ƀgt?.destroy(),this.ƀak?.destroy(),this.ƀkq.destroyAssetOnDestroy&&(M.destroyAsset(this.ƀkq.id),this.ƀit&&M.destroyAsset(this.ƀit.texture.id)),this.ƀit&&!this.ƀit.destroyed&&this.ƀit.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀlk}set textureScale(t){this.ƀlk=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.ƀkq.boundingShapes&&!this.ƀis.hitArea&&(this.ƀis.hitArea=new ls(this.ƀkq.boundingShapes,this.size,helpersLib.Vector.fromVec2(this.ƀkq.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.baseTexture.mipmap===V__namespace.MIPMAP_MODES.ON}set mipmap(t){t?this.pixiSprite.texture.baseTexture.mipmap=V__namespace.MIPMAP_MODES.ON:this.pixiSprite.texture.baseTexture.mipmap=V__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 V__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.ƀit)return this.ƀit.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀit)this.ƀit.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=helpersLib.Vector.fromVec2(this.ƀkq.anchor).to(t);return new helpersLib.Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀit&&(this.ƀit.destroy(),this.ƀit=void 0),t&&(this.ƀit=Jt.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀkq.destroyAssetOnDestroy),this.ƀit.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀit.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀis.addChild(this.ƀit)),this}showBoundingShape(t){return t?this.ƀak||(this.ƀak=this.ƀbw().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀak&&(this.ƀak.destroy(),this.ƀak=void 0),this}getBoundingMask(){if(!this.ƀgt){if(!this.ƀkq.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀgt=this.ƀbw(),this.ƀgt.pixiSprite._maskRefCount=Number.POSITIVE_INFINITY,this.ƀgt.pixiSprite.renderable=false,this.ƀgt.displayParent(this);}return this.ƀgt}ƀbw(){if(!this.ƀkq.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return T.createPolygon(this.ƀkq.boundingShapes,helpersLib.ColorHelper.white).toSprite().attach(this)}download(){let t=g.instance.renderer.extract.canvas(this.ƀis);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}},ls=class{static{h(this,"CompositeHitArea");}constructor(t,e,i){this.ƀkh=t.map(r=>new V__namespace.Polygon(r.map(s=>new V__namespace.Point(s.x,s.y))));}contains(t,e){return this.ƀkh.some(i=>i.contains(t,e))}};var Re=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,y=Math.floor(c/p),w=c-p*y;y>=1&&w<i.dashLength&&(w+=p,y--);let A=s.normalize(w/2),Tt=s.normalize(i.dashGap);if(a.push({from:l,to:l.add(A)}),l=l.add(A),y>0){let pe=s.normalize(i.dashLength);helpersLib.ArrayHelper.createEmptyArray(y).forEach(()=>{l=l.add(Tt),a.push({from:l,to:l.add(pe)}),l=l.add(pe);});}return l=l.add(Tt),a.push({from:l,to:l.add(A)}),a}};var T=class o extends u{static{h(this,"Graphics");}static{this.ƀcx=new Map;}static createArrow(t,e){let i=new V__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 V__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 V__namespace.Graphics;return s.lineStyle(r.width,r.color),Re.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 V__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 V__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 V__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 V__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 V__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 V__namespace.Graphics,r=JSON.stringify({type:"polygon",polygon:t,color:e});return i.beginFill(e),t.forEach(s=>{i.drawPolygon(s.map(n=>new V__namespace.Point(n.x,n.y)));}),i.endFill(),new o(i,r)}static createRegularPolygon(t,e,i){let r=new V__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.ƀis.addChild(t),this.pixiGraphics=t,this.ƀan=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀan,cache:false,...t},i=this.ƀes(e.cacheName,e.cache),r={id:i.textureID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},s=new k(r,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),s}ƀes(t,e){if(e){let i=o.ƀcx.get(t);return i||(i=this.ƀci(),o.ƀcx.set(t,i)),i}else return this.ƀci()}ƀci(){let t=g.instance.renderer.generateTexture(this.pixiGraphics);t.id=M.insertAsset(t);let e=this.pixiGraphics.getBounds();return {textureID:t.id,bounds:new helpersLib.Vector(e.x,e.y)}}};var si=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},xt=class o extends u{static{h(this,"ScrollMaskUI");}static{this.ƀcx=new Map;}constructor(t,e,i,r=exports.ScrollDirection.Vertical){if(super(),i<0)throw new Error("The padding of the scroll mask cannot be lower than '0'");if(e.y<i*2)throw new Error(`The height of the scroll mask cannot be lower than '${i*2}'`);let s=new u;r===exports.ScrollDirection.Horizontal?this.ƀcc(e,i,s):this.ƀcj(e,i,s),this.ƀgt=k.createSnapshotSprite(s).attach(this),s.destroy(),t.setMask(this.ƀgt);}ƀcj(t,e,i){e>0&&this.ƀbz(new helpersLib.Vector(t.x,e)).displayParent(i).attach(i),T.createRectangle(new helpersLib.Vector(t.x,t.y-e*2),helpersLib.ColorHelper.white).toSprite().setPosition(new helpersLib.Vector(0,e),{round:false}).displayParent(i).attach(i),e>0&&this.ƀbz(new helpersLib.Vector(t.x,e)).setPosition(new helpersLib.Vector(t.x,t.y),{round:false}).setRotation(helpersLib.Radian.get180).displayParent(i).attach(i);}ƀcc(t,e,i){e>0&&this.ƀbz(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(0,t.y),{round:false}).setRotation(helpersLib.Radian.get270).displayParent(i).attach(i),T.createRectangle(new helpersLib.Vector(t.x-e*2,t.y),helpersLib.ColorHelper.white).toSprite().setPosition(new helpersLib.Vector(e,0),{round:false}).displayParent(i).attach(i),e>0&&this.ƀbz(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(t.x,0),{round:false}).setRotation(helpersLib.Radian.get90).displayParent(i).attach(i);}ƀbz(t){let i={id:this.ƀca(t.y),scale:1,size:t,anchor:{x:0,y:0}};return new k(i,{textureSize:t,ignoreAnchor:true})}ƀca(t){let e=JSON.stringify({type:"gradient",length:t}),i=o.ƀcx.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 si;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=V__namespace.Texture.from(r);i=M.insertAsset(a),o.ƀcx.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 Ie=class extends actionsLib.Attachable{static{h(this,"SlideStateAnimation");}onStateChange(t){return this.ƀhs.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀhu.subscribe(e=>t(e.value,e.index)).attach(this),this}get state(){return {value:this.ƀky.state.value,item:this.ƀfu,nextItem:this.ƀhi,queuedItem:this.ƀky.state.queuedItem,animationState:this.ƀo}}constructor(t){super(),this.ƀo="idle",this.ƀhs=new actionsLib.Action,this.ƀhu=new actionsLib.Action,this.ƀhx={duration:500,animation:x.easeInOutCubic,...t},this.ƀky=new Dt({duration:this.ƀhx.duration,animation:this.ƀhx.animation}).onStateChange((e,i)=>this.ƀfb(e,i)).onValueChange(e=>this.ƀff(e)).attach(this);}setIndex(t,e){if(!helpersLib.Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀfu===void 0?(this.ƀfu=t,this.ƀhs.trigger({state:exports.SlideStateAnimationState.Appear,index:t}),this.ƀky.setItem(t,e)):this.ƀfu!==t?this.ƀhi!==t?this.ƀo==="idle"?(this.ƀo=t>this.ƀfu?"transitionForward":"transitionBackward",this.ƀhi=t,this.ƀhs.trigger({state:exports.SlideStateAnimationState.Appear,index:this.ƀhi}),this.ƀky.setItem(t,e)):this.ƀky.setItem(t,e):this.ƀo==="reverting"&&this.ƀhi===t&&(this.ƀo=t>this.ƀfu?"transitionForward":"transitionBackward",this.ƀky.setItem(t,e)):(this.ƀo==="transitionForward"||this.ƀo==="transitionBackward")&&(this.ƀo="reverting",this.ƀky.setItem(t,e));}ƀfb(t,e){switch(this.ƀfu!==void 0&&this.ƀfu!==t&&this.ƀfu!==e&&this.ƀhs.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀfu}),this.ƀhi!==void 0&&this.ƀhi!==t&&this.ƀhi!==e&&this.ƀhs.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀhi}),e!==void 0&&e!==this.ƀfu&&e!==this.ƀhi&&this.ƀhs.trigger({state:exports.SlideStateAnimationState.Appear,index:e}),this.ƀo){case "idle":break;case "transitionForward":case "transitionBackward":e===void 0?(this.ƀo="idle",this.ƀfu=this.ƀhi,this.ƀhi=void 0):this.ƀfu!==t&&this.ƀfc(t,e);break;case "reverting":e===void 0?(this.ƀo="idle",this.ƀhi=void 0):this.ƀfu!==e&&this.ƀfc(t,e);break;default:{this.ƀo;throw new Error(`Unexpected case! "${this.ƀo}"`)}}}ƀfc(t,e){this.ƀfu=t,this.ƀhi=e,this.ƀhu.trigger({value:0,index:this.ƀfu}),this.ƀo=this.ƀfu<this.ƀhi?"transitionForward":"transitionBackward";}ƀff(t){let e=1;(this.ƀo==="transitionBackward"||this.ƀo==="reverting"&&this.ƀfu!==void 0&&this.ƀhi!==void 0&&this.ƀfu>this.ƀhi)&&(e=-1),(this.ƀo==="idle"||t!==0)&&this.ƀhu.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(-e*t),index:this.ƀfu}),this.ƀhi!==void 0&&this.ƀhu.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀhi});}};exports.ScrollDirection=void 0;(function(o){o[o.Horizontal=1]="Horizontal",o[o.Vertical=2]="Vertical";})(exports.ScrollDirection||(exports.ScrollDirection={}));var oi=class extends u{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀby=t,this.ƀcs="x",this.ƀbo=new Map,this.ƀhx={duration:300,animation:x.easeInOutCubic,size:new helpersLib.Vector(500,500),margin:20,direction:exports.ScrollDirection.Horizontal,...e};let i=this.ƀhx.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(this.ƀhx.size.x+this.ƀhx.margin*2,this.ƀhx.size.y):new helpersLib.Vector(this.ƀhx.size.x,this.ƀhx.size.y+this.ƀhx.margin*2),r=new u().setPosition(this.ƀhx.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(-this.ƀhx.margin,0):new helpersLib.Vector(0,-this.ƀhx.margin),{round:false}).displayParent(this).attach(this);this.ƀcd(i,this.ƀhx.margin,this.ƀhx.direction,r),this.ƀcs=this.ƀhx.direction===exports.ScrollDirection.Horizontal?"x":"y",this.ƀky=new Ie({duration:this.ƀhx.duration,animation:this.ƀhx.animation}).onStateChange((s,n)=>{if(s===exports.SlideStateAnimationState.Appear){let a=new u().displayParent(this).attach(this);this.ƀbo.set(n,a),this.ƀby({index:n,container:a});}else {let a=this.ƀbo.get(n);a&&(a.destroy(),this.ƀbo.delete(n));}}).onValueChange((s,n)=>{let a=this.ƀbo.get(n);if(a){let l={x:0,y:0};l[this.ƀcs]=i[this.ƀcs]*s+this.ƀhx.margin,a.setPosition(helpersLib.Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=r;}setIndex(t,e){return this.ƀky.setIndex(t,e),this}ƀcd(t,e,i,r){new xt(r,new helpersLib.Vector(t.x,t.y),e,i).attach(this);}},Ji=class extends oi{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 bt=class{static{h(this,"VectorSet");}constructor(){this.ƀlx=new Map;}add(t){let e=this.ƀlx.get(t.x);e||(e=new Set,this.ƀlx.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀlx.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀlx.get(t.x);return e?e.delete(t.y):false}};var ni=class{static{h(this,"DeltaTime");}static adjustMultiplier(t,e){return Math.pow(t,e)}};var G=class{static{h(this,"PositionToGridPositionConverter");}static areaToGridArea(t,e){return new helpersLib.Rectangle(this.positionToGridPosition(t.topLeft,e),this.positionToGridPosition(t.bottomRight,e))}static positionToGridPosition(t,e){return t.divideNumber(e).floor()}static gridPositionToPosition(t,e){return t.add(new helpersLib.Vector(.5,.5)).multiplyNumber(e)}};var Xt=class{static{h(this,"ClosestAvailableSpaceHelper");}static findByConvertingGridSpace(t,e,i){let r=new helpersLib.Vector(Math.ceil(e.size.x/i)-1,Math.ceil(e.size.y/i)-1),s=G.areaToGridArea(e,i);if(this.ƀau(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 bt,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.ƀau(t,a))return helpersLib.Vector.fromTo(e,n);t.getNeighborPositions(n,helpersLib.GridNeighborType.Ortogonal).forEach(l=>{r.has(l)||s.add(l);});}}static ƀau(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 Yi=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)}},Rs=class{static{h(this,"PathfinderGrid");}constructor(t,e){this.ƀfa=t,this.ƀkv=e,this.ƀhw=new helpersLib.BinaryHeap("min"),this.ƀba=[],this.ƀhk=new helpersLib.Grid({size:t.size,defaultValue:void 0});let i=new Yi(this.ƀkv,0,Number.MAX_SAFE_INTEGER);this.ƀhw.add(i.pathLength,i);}get hasOpenNodes(){return this.ƀhw.size>0}getNeighbors(t,e){return this.ƀfa.getNeighborPositions(t.position,e).filter(i=>this.ƀfa.get(i)).map(i=>this.ƀhk.get(i)||this.ƀce(i))}popLowestPathCostNode(){let t=this.ƀhw.pop();return this.ƀhw.delete(t),t.closed=true,this.ƀba.push(t),t}changeNodeCost(t,e,i,r){this.ƀhw.delete(t),t.distanceFromStart=e,t.distanceToEnd=t.getDistance(i),t.parent=r,this.ƀhw.add(t.pathLength,t);}getBestClosedNode(){return this.ƀba.reduce((t,e)=>t.distanceToEnd<e.distanceToEnd?t:e)}ƀce(t){let e=new Yi(t,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);return this.ƀhk.set(t,e),this.ƀhw.add(e.pathLength,e),e}},Kt=class{static{h(this,"PathFinder");}static findPath(t,e,i,r){let s=new Rs(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 Zt=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀle=t,this.ƀy=e,this.ƀfi=this.ƀei(this.ƀy.size),this.ƀmf=new helpersLib.Grid({size:this.ƀy.size,defaultValue:this.ƀfi}),this.ƀct=new helpersLib.Grid({size:this.ƀy.size,defaultValue:void 0});let i=new bt,r=new helpersLib.Queue;for(this.ƀdv(this.ƀy.cropAreaOutsideOfTheGrid(t)).forEach(n=>{this.ƀmf.set(n,0),r.add(n);});r.notEmpty;){let n=r.pop();if(!i.has(n)){i.add(n);let a=this.ƀmf.getOrFail(n);this.ƀen(n,this.ƀy).forEach(l=>{if(!i.has(l.position)){let c=this.ƀmf.getOrFail(l.position),p=a+l.distance;this.ƀy.getOrFail(l.position)&&p<c&&(this.ƀmf.set(l.position,p),r.add(l.position));}});}}}getDirectionToTarget(t){if(!t.isInsideRectangle(this.ƀle)){if(t=this.ƀmf.movePositionInsideGrid(t),this.ƀct.has(t))return this.ƀct.get(t);{let e=this.ƀen(t,this.ƀy),i;return this.ƀmf.getOrFail(t)>=this.ƀfi?e.some(s=>this.ƀy.get(s.position))&&(e.some(n=>!this.ƀy.get(n.position))?i=this.ƀec(e):i=this.ƀdx(t,e)):i=this.ƀdx(t,e),this.ƀct.set(t,i),i}}}ƀec(t){let e=t.filter(i=>this.ƀy.get(i.position)).map(i=>i.direction.radian);return helpersLib.Radian.getAverage(...e)}ƀdx(t,e){let i=e.filter(r=>this.ƀmf.getOrFail(r.position)<this.ƀfi).reduce((r,s)=>{let n=this.ƀmf.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.ƀfi}).bestDirections;return this.ƀet(i,t)}ƀet(t,e){if(t.length>0){let i=t.reduce((r,s)=>r.add(s),helpersLib.Vector.zero);if(i.isZero()||!this.ƀga(e,i))return helpersLib.Random.pickRandomElement(t).radian;if(t.length>=1)return i.radian}}ƀga(t,e){let i=t.add(this.ƀly(e));return this.ƀy.isPointWithinBounds(i)&&this.ƀy.getOrFail(i)}ƀen(t,e){return this.ƀmf.getNeighborDirections(t,helpersLib.GridNeighborType.All).map(i=>({position:t.add(i),direction:i,distance:i.x!==0&&i.y!==0?14:10}))}ƀdv(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}ƀly(t){let e=t.normalize().round();return new helpersLib.Vector(e.x,e.y)}ƀei(t){return (t.x+t.y)*20}};var P=class o{static{h(this,"AudioAssets");}static{this.ƀam=new Map;}static{this.context=new AudioContext;}static async load(t){await Promise.all(t.map(e=>fetch(e.url).then(i=>i.arrayBuffer()).then(i=>this.context.decodeAudioData(i)).then(i=>this.ƀam.set(e.id,i))));}static createSource(t){let e=o.ƀdw(t),i=o.context.createBufferSource();return i.buffer=e,i}static ƀdw(t){let e=this.ƀam.get(t);if(!e)throw new Error(`Audio: Sound with id ${t} was not loaded.`);return e}};R.onHardReset.subscribe(()=>{P.context=new AudioContext,P.ƀam.clear();}).attachToRoot();var Y=800,J=class o{static{h(this,"Audio");}static ƀkb(){return this.ƀfx=new o,this.ƀfx}constructor(){this.ƀgw=P.context.createGain(),this.ƀgv=P.context.createGain(),this.ƀhh=P.context.createGain(),this.ƀkk=P.context.createGain(),this.ƀgw.connect(P.context.destination),this.ƀgv.connect(this.ƀgw),this.ƀhh.connect(this.ƀgv),this.ƀkk.connect(this.ƀgv),this.ƀgx=new I(this.ƀgw.gain,"value",{duration:500*2,animation:x.easeIn,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀgx.set({value:0});}setVolumes(t){this.ƀgv.gain.value=t.master,this.ƀhh.gain.value=t.music,this.ƀkk.gain.value=t.sound;}appear(t,e="ease"){switch(e){case "ease":return this.ƀgx.set({value:t?0:1}),this.ƀgx.animate({value:t?1:0}).chainToRoot();case "instant":return this.ƀgx.set({value:t?1:0}),actionsLib.SingleEvent.instant();default:{throw new Error(`Unexpected case! "${e}"`)}}}};R.onHardReset.subscribe(()=>{J.ƀkb();}).attachToRoot();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};exports.CameraGateway=class st extends q(){static{h(this,"CameraGateway");}};exports.CameraGateway=Ms([d()],exports.CameraGateway);var Bs=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},Pt=class extends q(){static{h(this,"CameraViewGateway");}};Pt=Bs([d()],Pt);var Ki;(function(o){o.BackgroundScreen="backgroundScreen",o.Background="background",o.Main="main",o.Foreground="foreground",o.ForegroundScreen="foregroundScreen";})(Ki||(Ki={}));exports.FocusingAnimation=void 0;(function(o){o[o.Instant=1]="Instant",o[o.EaseInOut=2]="EaseInOut",o[o.EaseOut=3]="EaseOut";})(exports.FocusingAnimation||(exports.FocusingAnimation={}));var hi=class extends u{static{h(this,"Placeholder");}constructor(t){super(),this.ƀiu=new V__namespace.Graphics,this.ƀiu.beginFill(0,1e-9),this.ƀiu.drawRect(0,0,t.x,t.y),this.ƀiu.endFill(),this.ƀis.addChild(this.ƀiu);}destroy(){this.destroyed||(super.destroy(),this.ƀiu.destroy());}};var Bt=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 Ce=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.ƀft(r,e),n=this.ƀs(s);return this.ƀko(n)}static ƀft(t,e){let i=new Map,r=new Map,s=h((a,l)=>{if(r.has(l))return r.get(l);let c=Bt.getPixiTextStyle(a);return r.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀea(a.tags,e,i),p=s(l,c),y=V__namespace.TextMetrics.measureText(" ",new V__namespace.TextStyle(p),false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:y.width}})}static ƀea(t,e,i){let r=t.join("+");if(i.has(r))return {style:i.get(r),cacheKey:r};let s=this.ƀbf(t,e);return i.set(r,s),{style:s,cacheKey:r}}static ƀbf(t,e){let i={...e.default};for(let l of t)e.styles&&e.styles[l]&&(i={...i,...e.styles[l]});let{wordWrapWidth:r,align:s,dropShadow:n,...a}=i;return a}static ƀs(t){let e=[],i=[];return t.forEach((r,s)=>{r.text.split(/\r?\n/).forEach((a,l)=>{l>0&&(e.push(i),i=[]),i.push({text:a,cacheKey:r.cacheKey,style:r.style,pixiStyle:r.pixiStyle,spaceWidth:r.spaceWidth});});}),e.push(i),e}static ƀko(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.ƀkp(s.text).map(a=>{let l=new V__namespace.TextStyle(s.pixiStyle),c=V__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 ƀkp(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 Oe=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀcm.length===0}get remainingWidth(){return this.ƀmg-this.ƀcp}constructor(t,e){this.ƀmg=t,this.ƀgl=[],this.ƀcm=[],this.ƀcp=0,this.ƀgk=new helpersLib.Vector(0,0),this.ƀcn=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀfl=i.horizontalAlignment,this.ƀlz=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀmg||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀcq={direction:i.rectangleCutOption.direction,rectangle:this.ƀbs(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀcn,t.y),i=this.ƀej(this.ƀgk.y,this.ƀgk.y+e);return this.ƀcp+t.x<=i}insertWord(t){let e=Math.max(this.ƀcn,t.style.height);if(this.ƀcm.length===0){let i=this.ƀek(this.ƀgk.y,this.ƀgk.y+e);this.ƀgk=new helpersLib.Vector(i,this.ƀgk.y),this.ƀcp=this.ƀgk.x;}this.ƀcm.push({chunk:t,position:new helpersLib.Vector(this.ƀcp,this.ƀgk.y)}),this.ƀcn=e,this.ƀcp+=t.style.width;}newLine(){let t=this.ƀgk.y+this.ƀcn,e=this.ƀek(t,t);this.ƀdn(),this.ƀgk=new helpersLib.Vector(e,t),this.ƀcp=this.ƀgk.x,this.ƀcn=0;}print(){return this.ƀdn(),this.ƀgl}ƀdn(){this.ƀcm.length>0&&(this.ƀgl.push(this.ƀg(this.ƀcm)),this.ƀcm=[]);}ƀg(t){return t=this.ƀmb(t),t=this.ƀfn(t),t}ƀfn(t){if(this.ƀfl==="left")return t;let e=this.ƀgk.y+this.ƀcn,i=this.ƀek(this.ƀgk.y,e),s=this.ƀej(this.ƀgk.y,e)-i,n=Math.min(s,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀfl==="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))}ƀmb(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.ƀlz){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.ƀlz;throw new Error(`Unexpected case! "${this.ƀlz}"`)}}return r={chunk:r.chunk,position:new helpersLib.Vector(r.position.x,r.position.y+s)},r})}ƀek(t,e){return this.ƀcq&&(this.ƀcq.direction==="topLeft"||this.ƀcq.direction==="bottomLeft")&&(this.ƀcq.rectangle.isPointInside(new helpersLib.Vector(0,t),{includeEdges:false})||this.ƀcq.rectangle.isPointInside(new helpersLib.Vector(0,e),{includeEdges:false}))?this.ƀcq.rectangle.bottomRight.x:0}ƀej(t,e){return this.ƀcq&&(this.ƀcq.direction==="topRight"||this.ƀcq.direction==="bottomRight")&&(this.ƀcq.rectangle.isPointInside(new helpersLib.Vector(this.ƀmg,t),{includeEdges:false})||this.ƀcq.rectangle.isPointInside(new helpersLib.Vector(this.ƀmg,e),{includeEdges:false}))?this.ƀcq.rectangle.topLeft.x:this.ƀmg}ƀbs(t){let e,i;switch(t.direction){case "topRight":e=new helpersLib.Vector(t.position.x,-1/0),i=new helpersLib.Vector(1/0,t.position.y);break;case "topLeft":e=new helpersLib.Vector(-1/0,-1/0),i=t.position;break;case "bottomRight":e=t.position,i=new helpersLib.Vector(1/0,1/0);break;case "bottomLeft":e=new helpersLib.Vector(-1/0,t.position.y),i=new helpersLib.Vector(t.position.x,1/0);break;default:{t.direction;throw new Error(`Unexpected case! "${t.direction}"`)}}return new helpersLib.Rectangle(e,i)}};var De=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.ƀmh(r,e);}else e.insertWord(r);else e.lineIsEmpty?e.insertWord(r):r.whitespace?this.ƀmh(r,e):(e.newLine(),e.insertWord(r));}),e.newLine();}),e.print()}static ƀmh(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.ƀhb(t),t=this.ƀlp(t),this.ƀaw(t)}static ƀhb(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 ƀlp(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 ƀaw(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=Ce.process(t,e),r=helpersLib.JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),s=new Oe(e.default.wordWrapWidth??1/0,r),n=De.wrapText(i,s);return Me.process(n)}};var js=1,Qi=1/js,Qt=class extends u{static{h(this,"Text");}get ƀli(){if(!this.ƀlj){let t=new V__namespace.TextStyle(this.ƀiw);this.ƀlj=V__namespace.TextMetrics.measureText(this.ƀlh,t);}return this.ƀlj}get ascent(){return this.ƀli.fontProperties.ascent}constructor(t,e){super(),this.ƀiw=Bt.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀiv.destroyed&&this.ƀiv.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new helpersLib.Vector(this.ƀiv.anchor.x,this.ƀiv.anchor.y)}set anchor(t){this.ƀi=t,this.ƀiv.anchor.set(t.x,t.y);}setText(t){return this.ƀlh!==t&&(this.ƀlh=t,this.ƀjg()),this}setColor(t){let e=helpersLib.ColorHelper.rgbToHex(t);return this.ƀiw.fill!==e&&(this.ƀiw.fill=e,this.ƀjg()),this}ƀjg(){this.ƀiv?.destroy(),this.ƀlc?.destroy(),this.ƀlc=void 0,this.ƀlj=void 0;let t=new V__namespace.TextStyle(this.ƀiw);this.ƀiv=new V__namespace.Text(this.ƀlh,t),this.ƀjj(),this.ƀi&&this.ƀiv.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀiv.scale.set(Qi,Qi),this.ƀis.addChild(this.ƀiv),this.ƀiw.lineThrough&&(this.ƀlc=this.ƀe(this.ƀiv,this.ƀiw.fill),this.ƀis.addChild(this.ƀlc));}ƀjj(){let t=V__namespace.TextMetrics.measureText(this.ƀlh,new V__namespace.TextStyle({...this.ƀiw,dropShadow:false,dropShadowAlpha:0,dropShadowBlur:0,dropShadowDistance:0}));this.ƀiv.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=V__namespace.TextMetrics.measureText(t.text,t.style),r=Math.max(1,Math.round(i.lineHeight*.07)),s=r%2*.5,n=new V__namespace.Graphics;n.lineStyle(r,e);let a=0;return i.lines.forEach((l,c)=>{let p=V__namespace.TextMetrics.measureText(l,t.style),y=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+s,w=0;t.style.align==="center"?w=0+(t.width-p.width)*.5:t.style.align==="right"&&(w=0+t.width-p.width),w=Math.floor(w),n.moveTo(Math.floor(w),y),n.lineTo(Math.floor(w+p.width),y),a+=p.lineHeight;}),n.endFill(),n}};var li=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 Us=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},F=class extends gt{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);}};F=Us([yt()],F);var Ge=class{static{h(this,"PositionConversionHelper");}static includeScaleInScreenPosition(t,e,i){if(e!==1){let r=helpersLib.Vector.fromTo(i,t).multiplyNumber(1/e);return i.add(r)}else return t}};var $s=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},zs=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Et=class extends mt{static{h(this,"CameraView");}constructor(t){super(),this.ƀdd=t,this.ƀkr=(()=>{let e=new u().attach(this);return e.ƀis=g.instance.ƀir.stage,e})(),this.ƀjn=new u().setAlpha(0).displayParent(this.ƀkr).attach(this),this.ƀae=T.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(this.ƀkr).attach(this),this.ƀac=new u().displayParent(this.ƀjn).attach(this),this.ƀar=new u().displayParent(this.ƀjn).attach(this),this.ƀdq=new u().setSortableChildren(true).displayParent(this.ƀjn).attach(this),this.ƀaq=new u().setSortableChildren(true).displayParent(this.ƀar).attach(this),this.ƀdp=new u().setSortableChildren(true).setZIndex(20).displayParent(this.ƀaq).attach(this),this.ƀgr=new u().setSortableChildren(true).setZIndex(10).displayParent(this.ƀaq).attach(this),this.ƀab=new u().setZIndex(0).displayParent(this.ƀaq).attach(this),this.ƀh=new I(this.ƀjn,"alpha",{duration:500,animation:x.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀaf=new I(this.ƀae,"alpha",{duration:500,animation:x.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),g.instance.screenSize.subscribe(e=>{this.ƀae.aspectRatio=e.x/e.y,this.ƀae.scale=Math.max(e.x,e.y),this.ƀae.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.zero});}).attach(this),this.ƀdd.position.subscribe(e=>{this.ƀaq.position=this.ƀbt(e);}).attach(this),this.ƀdd.offset.subscribe(e=>{this.ƀar.position=e;}).attach(this),this.ƀaf.set({alpha:0}),this.ƀh.set({alpha:0});}screenPositonToStagePosition(t){let e=Ge.includeScaleInScreenPosition(t,this.ƀkr.scale,g.instance.screenSizeCenter.value);return new helpersLib.Vector(e.x-this.ƀaq.position.x-this.ƀar.position.x,e.y-this.ƀaq.position.y-this.ƀar.position.y)}getLayers(){return {backgroundScreen:this.ƀac.id,background:this.ƀab.id,main:this.ƀgr.id,foreground:this.ƀdp.id,foregroundScreen:this.ƀdq.id}}appear(t,e,i){switch(e){case "alpha":return this.ƀaf.set({alpha:0}),this.ƀh.set({alpha:t?0:1}),actionsLib.SingleEvent.instant().asyncTap(()=>i>0&&m.wait(i)).asyncTap(()=>this.ƀh.animate({alpha:t?1:0})).chain(this);case "pureBlack":return this.ƀh.set({alpha:1}),this.ƀaf.set({alpha:t?1:0}),actionsLib.SingleEvent.instant().asyncTap(()=>i>0&&m.wait(i)).asyncTap(()=>this.ƀaf.animate({alpha:t?0:1})).chain(this);case "instant":return this.ƀh.set({alpha:t?1:0}),this.ƀaf.set({alpha:t?0:1}),actionsLib.SingleEvent.instant();default:{throw new Error(`Unexpected case! "${e}"`)}}}ƀbt(t){return helpersLib.Vector.fromTo(t,g.instance.screenSizeCenter.value)}};Et=$s([Qe({entity:F}),zs("design:paramtypes",[F])],Et);var Js=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=1500,_e=class{static{h(this,"CameraService");}createCamera(){return new F().attachToRoot()}getCameraPosition(){let t=F.getInstanceOrFail();return helpersLib.Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=F.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=F.getInstanceOrFail();e.focusingNewTargetInfo.value={time:g.time,duration:t?.duration??Ys,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??exports.FocusingAnimation.Instant};}update(t,e){let i=F.getInstanceOrFail(),r=i.targetPosition.value;r&&(i.focusingNewTargetInfo.value?this.ƀge(i,r,t):i.position.value=r);}ƀge(t,e,i){let r=t.focusingNewTargetInfo.value;if(r.focusingAnimation===exports.FocusingAnimation.Instant)this.ƀbg(t,e);else {let s=(i-r.time)/r.duration;if(s>=1)this.ƀbg(t,e);else {let n;r.focusingAnimation===exports.FocusingAnimation.EaseInOut?n=N.easeInOut(s):r.focusingAnimation===exports.FocusingAnimation.EaseOut?n=N.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;}}}ƀbg(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};_e=Js([d()],_e);var Xs=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},Ks=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},di=class{static{h(this,"CameraController");}constructor(t){this.ƀas=t;}createCamera(){return this.ƀas.createCamera().id}update(t,e){this.ƀas.update(t,e);}setPosition(t){this.ƀas.setPosition(t);}setTransition(t){this.ƀas.setTransition(t);}getCameraPosition(){return this.ƀas.getCameraPosition()}};di=Xs([Q(exports.CameraGateway),Ks("design:paramtypes",[_e])],di);var Zs=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},ui=class{static{h(this,"CameraViewController");}getLayers(){let t=F.getInstanceOrFail().id;return Et.getInstanceOrFail(t).getLayers()}appear(t,e,i){let r=F.getInstanceOrFail().id;return Et.getInstanceOrFail(r).appear(t,e,i)}screenPositonToStagePosition(t){let e=F.getInstanceOrFail().id;return Et.getInstanceOrFail(e).screenPositonToStagePosition(t)}};ui=Zs([Q(Pt)],ui);var ee=class{static{h(this,"Camera");}get position(){return this.ƀap.getCameraPosition()}constructor(){this.ƀap=S.get(exports.CameraGateway),this.ƀat=S.get(Pt),this.ƀap.createCamera(),this.layers=this.ƀat.getLayers();}setPosition(t){this.ƀap.setPosition(t);}setTransition(t){this.ƀap.setTransition(t);}appear(t,e="alpha",i=0){return this.ƀat.appear(t,e,i)}screenPositonToStagePosition(t){return this.ƀat.screenPositonToStagePosition(t)}};var g=class o{static{h(this,"Game");}static get instance(){return this.ƀfx}static{this.pause=actionsLib.Reducer.createOr();}static{this.freeze=actionsLib.Reducer.createOr();}static get camera(){return this.ƀao}static get audio(){return this.ƀx}static appear(t,e){let i=e?.audio??"ease",r=e?.camera??"alpha";return actionsLib.ActionLib.all([this.audio.appear(t,i),this.camera.appear(t,r,i!=="instant"?0:500)]).mapToVoid().chainToRoot()}static get time(){return m.ƀll}static get setupOptions(){return this.ƀke}constructor(t){if(this.ƀjq=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSize=this.ƀjq.notifier,this.ƀjr=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSizeCenter=this.ƀjr.notifier,this.devMode=false,o.ƀfx)throw new Error("There can be only one Game instance!");this.ƀbk={screenResolution:void 0,maxScreenResolution:void 0,devMode:false,backgroundColor:helpersLib.ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbk.devMode||false;let e=helpersLib.JsonHelper.removeUndefinedProperties({backgroundColor:this.ƀbk.backgroundColor,autoStart:false,antialias:this.ƀbk.antialias,resolution:this.ƀbk.resolution,width:this.ƀbk.screenResolution?.width,height:this.ƀbk.screenResolution?.height});this.ƀir=new V__namespace.Application(e);let i=o.pause.effect(false).attachToRoot();o.freeze.subscribe(r=>{i.update(r),r?P.context.suspend():P.context.resume();}).attachToRoot();}async setup(t){o.ƀke=t;let e=document.body.appendChild(this.ƀir.view);this.ƀka(e),await Promise.all([M.loadGameAssets(t.spriteAssetDefinitions),M.loadGameAssets(t.fontAssetDefinitions),P.load(t.soundAssetDefinitions)]),o.ƀfx=this,this.renderer=this.ƀir.renderer,globalThis.ƀa=this.ƀir,this.ƀfd(),o.ƀao=new ee,o.ƀx=J.ƀkb(),this.ƀir.start(),this.ƀir.ticker.add(()=>{o.freeze.value||m.triggerUpdateTick(this.ƀir.ticker.deltaMS);});}setResolution(t){if(this.ƀir.renderer.resolution!==t){this.ƀir.renderer.resolution=t;let e=this.ƀer();this.ƀir.renderer.resize(e.x,e.y);}}ƀfd(){this.ƀdb(),this.ƀjz(),window.addEventListener("resize",t=>{this.ƀdb(),this.ƀjz();});}ƀdb(){let t=this.ƀer();(t.x!==this.ƀir.screen.width||t.y!==this.ƀir.screen.height)&&this.ƀir.renderer.resize(t.x,t.y);}ƀjz(){let t=new helpersLib.Vector(this.ƀir.screen.width,this.ƀir.screen.height);this.ƀjq.value=t,this.ƀjr.value=t.multiplyNumber(.5).round();}ƀer(){let t=this.ƀbk.screenResolution?.width??window.innerWidth,e=this.ƀbk.screenResolution?.height??window.innerHeight;return this.ƀbk.maxScreenResolution&&(t=Math.min(t,this.ƀbk.maxScreenResolution.width),e=Math.min(e,this.ƀbk.maxScreenResolution.height)),new helpersLib.Vector(t,e)}ƀka(t){this.ƀbk.maxScreenResolution&&(t.style.maxWidth=`${this.ƀbk.maxScreenResolution?.width}px`,t.style.maxHeight=`${this.ƀbk.maxScreenResolution?.height}px`),t.style.width="100%",t.style.height="100%";}};var ie=class o extends actionsLib.IDAttachable{static{h(this,"Sound");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`Sound: Could not find sound definition with name ${t}.`);return new o(i,e)}get volume(){return this.ƀdr.gain.value}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀdr.gain.value=t,this}constructor(t,e){super(),this.ƀkl=t,this.ƀdr=P.context.createGain(),this.ƀdr.connect(J.ƀfx.ƀkk),this.ƀfh=this.ƀdr,this.ƀix(e?.offset??0);}destroy(){this.destroyed||(super.destroy(),this.ƀla(),this.ƀdr?.disconnect());}ƀlv(){this.ƀfh.disconnect(),this.ƀfh.connect(J.ƀfx.ƀhh);}ƀix(t){this.ƀla();let e=this.ƀkl.loop;if(this.ƀkt=helpersLib.NumberHelper.clamp(t,0,e?e.to:this.ƀkl.duration),e){let i=e.from,r=e.to;this.ƀiy({soundID:this.ƀkl.id,start:this.ƀkt,end:this.ƀkt<i?i:r,loop:false,onComplete:h(()=>{this.ƀkn.disconnect(),this.ƀiy({soundID:this.ƀkl.id,start:i,end:r,loop:true});},"onComplete")});}else this.ƀiy({soundID:this.ƀkl.id,start:this.ƀkt,end:void 0,loop:false,onComplete:h(()=>this.destroy(),"onComplete")});}ƀla(){this.ƀkn&&(this.ƀkn.onended=null,this.ƀkn.stop(),this.ƀkn.disconnect());}ƀiy(t){this.ƀkn=P.createSource(t.soundID),this.ƀkn.connect(this.ƀdr),t.onComplete&&(this.ƀkn.onended=t.onComplete),t.loop?(this.ƀkn.loop=true,this.ƀkn.loopStart=t.start,this.ƀkn.loopEnd=t.end??this.ƀkn.buffer.duration,this.ƀkn.start(0,t.start)):this.ƀkn.start(0,t.start,t.end?t.end-t.start:void 0);}};var so=800,re=-128,nt=class o extends ie{static{h(this,"AdvancedSound");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new o(i,e)}constructor(t,e){super(t,e),this.ƀll=new actionsLib.Variable(0),this.time=this.ƀll.notifier,this.ƀkw=P.context.currentTime-this.ƀkt,this.ƀll.value=this.ƀkt,m.beforeSceneUpdateAction.subscribe(()=>{this.ƀll.value=P.context.currentTime-this.ƀkw;}).attach(this),this.ƀfh.disconnect(),this.ƀkc(e?.fade?helpersLib.NumberHelper.clamp(e.fade,0,1):0),this.ƀkd(e?.muffle?helpersLib.NumberHelper.clamp(e.muffle,0,1):0),this.ƀfh.connect(J.ƀfx.ƀkk);}ƀkc(t=0){this.ƀdk=P.context.createGain(),this.ƀdk.gain.value=1-t,this.ƀdj=new I(this.ƀdk.gain,"value",{duration:500,animation:x.lineer,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀfh.connect(this.ƀdk),this.ƀfh=this.ƀdk;}ƀkd(t=0){this.ƀhf=P.context.createBiquadFilter(),this.ƀhf.type="highshelf",this.ƀhf.frequency.value=so,this.ƀhf.gain.value=t*re,this.ƀhg=new I(this.ƀhf.gain,"value",{duration:500,animation:x.lineer,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀfh.connect(this.ƀhf),this.ƀfh=this.ƀhf;}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.fade(1,Y).notIdle().chain(this).tap(()=>this.destroy()).chainToRoot())}notifyOnTime(t){return this.time.value>t?actionsLib.SingleEvent.createDestroyed():actionsLib.SingleEvent.create(e=>{let i=this.time.filter(r=>r>=t).tap(()=>e()).attach(this);return ()=>i.destroy()})}setFade(t){t=helpersLib.NumberHelper.clamp(t,0,1),this.ƀdj.set({value:1-t});}fade(t,e=500){t=helpersLib.NumberHelper.clamp(t,0,1);let i=t>1-this.ƀdk.gain.value;return e===0?(this.ƀdj.set({value:1-t}),actionsLib.SingleEvent.instant()):this.ƀdj.animate({value:1-t},{duration:e,animation:i?x.easeOut:x.easeIn}).chain(this)}setMuffle(t){t=helpersLib.NumberHelper.clamp(t,0,1),this.ƀhg.set({value:t*re});}muffle(t,e=500){t=helpersLib.NumberHelper.clamp(t,0,1);let i=t>this.ƀhf.gain.value/re;return e===0?(this.ƀhg.set({value:t*re}),actionsLib.SingleEvent.instant()):this.ƀhg.animate({value:t*re},{duration:e,animation:i?x.easeIn:x.easeOut}).chain(this)}destroy(){this.destroyed||(this.ƀdk.disconnect(),this.ƀhf.disconnect()),super.destroy();}};var se=class o extends actionsLib.IDAttachable{static{h(this,"Music");}static createByName(t,e){let i=g.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new o(i,e)}constructor(t,e){super(),this.ƀkk=new actionsLib.Variable(void 0),this.ƀhx={stopPlayingOnPause:true,...e},this.ƀkm=t.id,g.pause.value||(this.ƀkk.value=new nt(t,this.ƀhx).attach(this),this.ƀkk.value.ƀlv()),this.ƀhx.stopPlayingOnPause&&(this.ƀid=g.pause.subscribe(i=>this.ƀhr(i)).attach(this));}notifyOnTime(t){return actionsLib.SingleEvent.create(e=>{let i=this.ƀkk.asyncMapDropOngoing((r,s)=>r?r.notifyOnTime(t):s.drop()).toSingleEvent().tap(()=>e()).attach(this);return ()=>i.destroy()})}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.ƀid?.destroy(),actionsLib.SingleEvent.instant().asyncTap(()=>actionsLib.ActionLib.all([this.ƀkk.value?.close()??actionsLib.SingleEvent.instant(),this.ƀdl?.onDestroy()??actionsLib.SingleEvent.instant()])).chain(this).tap(()=>this.destroy()).chainToRoot())}ƀhr(t){let e=this.ƀkk.value;if(t)e&&(this.ƀif=e.time.value,this.ƀkk.value=void 0,this.ƀdl=e,actionsLib.ActionLib.all([e.fade(1,Y),e.muffle(1,Y)]).tap(()=>{this.ƀdl=void 0,e.destroy();}).attach(this));else if(!e){let i=nt.createByName(this.ƀkm,{offset:this.ƀif,fade:1,muffle:1}).attach(this);i.ƀlv(),actionsLib.ActionLib.all([i.fade(0,Y),i.muffle(0,Y)]).attach(this),this.ƀkk.value=i;}}};var mi=class extends actionsLib.IDAttachable{static{h(this,"MusicPlayer");}constructor(t){super(),this.ƀhx={stopPlayingOnPause:true,playWhenPaused:void 0,...t},this.ƀhx.playWhenPaused&&this.ƀkf(this.ƀhx.playWhenPaused);}play(t){if(this.ƀbb)throw new Error("Play is called while music player is destroyed.");return this.ƀco=t,actionsLib.SingleEvent.instant().asyncTap(()=>{let e=this.ƀiz;if(e)return this.ƀiz=void 0,e.close()}).map(()=>{if(this.ƀco===t)return this.ƀiz=se.createByName(t,{stopPlayingOnPause:this.ƀhx.stopPlayingOnPause}).attach(this),this.ƀiz}).chain(this)}stop(){return actionsLib.SingleEvent.instant().asyncTap(()=>{let t=this.ƀiz;if(t)return t.close().tap(()=>{t===this.ƀiz&&(this.ƀiz=void 0);})}).chain(this)}close(){return this.ƀbb?this.onDestroy():(this.ƀbb=true,this.ƀid?.destroy(),actionsLib.SingleEvent.instant().asyncTap(()=>actionsLib.ActionLib.all([this.ƀiz?.close()??actionsLib.SingleEvent.instant(),this.ƀic?.close()??actionsLib.SingleEvent.instant()])).chain(this).tap(()=>this.destroy()).chainToRoot())}ƀkf(t){this.ƀid=g.pause.toSequence().asyncMapDropOngoing(e=>e&&m.wait(Y).map(()=>e)).subscribe(e=>{if(e)this.ƀic=nt.createByName(t,{fade:1}).attach(this),this.ƀic.fade(0);else if(this.ƀic){let i=this.ƀic;this.ƀic.fade(1).tap(()=>i.destroy()).attach(this),this.ƀic=void 0;}}).attach(this);}};var yi=class extends u{static{h(this,"UpdatableContainer");}},gi=class extends u{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀby=t,this.ƀcu=new Map,this.ƀhx={trackBy:h((i,r)=>r,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀcu.keys()),i=0;t.forEach((r,s)=>{let n=this.ƀhx.trackBy(r,s),a;this.ƀcu.has(n)?(a=this.ƀcu.get(n),e.delete(n),a.update(r)):(a=this.ƀby(r).displayParent(this).attach(this),this.ƀcu.set(n,a)),this.ƀhx.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀhx.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀhx.positioning.spacing);}),e.forEach(r=>{this.ƀcu.get(r).destroy(),this.ƀcu.delete(r);});}};var ne=class o extends u{static{h(this,"MenuUI");}static{this.ƀfz=actionsLib.Reducer.createExistenceChecker();}static{this.isAnyMenuTransitioning=this.ƀfz.notifier;}constructor(t,e){super(),this.ƀho=new actionsLib.SingleAction,this.onCreate=this.ƀho.notifier,this.ƀhq=new actionsLib.SingleAction,this.onOpen=this.ƀhq.notifier,this.ƀhl=new actionsLib.SingleAction,this.onClose=this.ƀhl.notifier,this.ƀbb=false;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.setAlpha(0),this.ƀp=new I(this,"alpha",{animation:x.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState});let r=T.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(i.backgroundDarkeningRatio).setInteractive(true).displayParent(this).attach(this);this.ƀgz=k.createByName(t).setPosition(new helpersLib.Vector(0,0)).setInteractive(true).displayParent(this).attach(this),g.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.ƀho.resolve();let s=o.ƀfz.effect().attach(this);this.ƀp.animate({alpha:1}).chain(this).tap(()=>{this.ƀhq.resolve(),s.destroy(),i.closeOnBackgroundClick&&r.on(exports.ContainerEventType.Click).take(1).tap(()=>this.close()).attach(this);}).attachToRoot();}getBoundingMask(){return this.ƀgz.getBoundingMask()}close(){if(!this.ƀbb){this.ƀbb=true;let t=o.ƀfz.effect().attach(this);this.ƀp.animate({alpha:0}).chain(this).map(()=>{this.ƀhl.resolve(),t.destroy(),this.destroy();}).chainToRoot();}return this.onClose.toSingleEvent()}};var xi=class extends gt{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.ƀhx=t,queueMicrotask(()=>{if(!this.ƀha)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀji(t){this.ƀha=t,this.ƀha.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀha.onCreate.toSingleEvent()}onOpen(){return this.ƀha.onOpen.toSingleEvent()}onClose(){return this.ƀha.onClose.toSingleEvent()}close(){return this.ƀha.close()}};var vi=class extends mt{static{h(this,"MenuView");}constructor(t,e,i){super();let r=helpersLib.JsonHelper.removeUndefinedProperties({appearAnimationDuration:i.appearAnimationDuration,backgroundDarkeningRatio:i.backgroundDarkeningRatio,closeOnBackgroundClick:t.ƀhx.closeOnBackgroundClick}),s=new ne(e,r).displayParent(g.camera.layers.foregroundScreen).attach(this);t.ƀji(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 go=.65,wo=.01,He=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀjs}get contentSize(){return this.ƀbm.size.ceil()}constructor(t,e,i,r){this.ƀbm=t,this.ƀv=e,this.ƀia=i,this.ƀkj=r,this.ƀfw=false,this.ƀjs=e-i*2,this.ƀbm.y=i,this.ƀld=i;}onWheel(t){this.setTarget(this.ƀld-t*go);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀld=helpersLib.NumberHelper.clamp(t,this.ƀv-this.ƀia-this.contentSize.y,this.ƀia);}jumpToTarget(){this.ƀbm.y=this.ƀld;}update(t){let e=this.contentSize;if(e.y<=this.ƀjs){switch(this.ƀkj){case "start":this.ƀld=this.ƀia;break;case "center":this.ƀld=(this.ƀv-e.y)*.5;break;case "end":this.ƀld=this.ƀv-e.y-this.ƀia;break;default:{this.ƀkj;throw new Error(`Unexpected case! "${this.ƀkj}"`)}}this.ƀfw||(this.ƀbm.y=this.ƀld);}this.ƀfw=true;let i=this.ƀld-this.ƀbm.y;this.ƀbm.y=this.ƀbm.y+i*wo*t;}};var vo=15,bi=class extends u{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbn}get contentSize(){return this.ƀjt.contentSize}constructor(t,e={}){super();let i={padding:vo,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 xt(r,t,i.padding).attach(this);let s=new V__namespace.Graphics;s.beginFill(0,1e-9),s.drawRect(0,0,t.x,t.y),s.endFill(),r.ƀis.addChild(s);let n=new u().displayParent(r).attach(this);this.ƀjt=new He(n,t.y,i.padding,i.smallContentAlign),this.ƀbn=new helpersLib.Vector(t.x,this.ƀjt.scrollHeight),s.eventMode="dynamic",s.addEventListener("wheel",a=>{this.ƀjt.onWheel(a.deltaY);}),n.setInteractive(true),n.ƀis.addEventListener("wheel",a=>{this.ƀjt.onWheel(a.deltaY);}),m.afterSceneUpdateAction.subscribe(a=>this.ƀjt.update(a.delta)).attach(this),this.addChildTo=n;}scrollToTop(t){this.ƀjt.scrollToTop(),t?.instant&&this.ƀjt.jumpToTarget();}scrollToBottom(t){this.ƀjt.scrollToBottom(),t?.instant&&this.ƀjt.jumpToTarget();}};var bo=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)};exports.KeyboardService=class Si{static{h(this,"KeyboardService");}constructor(){this.ƀgg=new actionsLib.Action,this.keyPressed=this.ƀgg.notifier,this.ƀgh=new actionsLib.Action,this.keyReleased=this.ƀgh.notifier,this.ƀgn=new Set,this.ƀgm=new Set,window.addEventListener("keydown",t=>{this.ƀgn.add(t.code),this.ƀgm.add(t.code),!t.repeat&&this.ƀgg.trigger({key:t.key,code:t.code});}),window.addEventListener("keyup",t=>{this.ƀgn.delete(t.code),this.ƀgh.trigger({key:t.key,code:t.code});}),window.addEventListener("blur",()=>{this.ƀgn.clear();}),m.afterSceneUpdateAction.subscribe(()=>this.ƀgm.clear()).attachToRoot();}isKeyDown(t,e){return (e?.onlyPressedThisFrame?this.ƀgm:this.ƀgn).has(t)}};exports.KeyboardService=bo([d(),So("design:paramtypes",[])],exports.KeyboardService);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},Eo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.MouseService=class he{static{h(this,"MouseService");}constructor(){this.ƀfv=new actionsLib.Variable(false),this.initialMouseMovementHappened=this.ƀfv.notifier,this.ƀks=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀks.notifier,this.ƀjp=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀjp.notifier,this.ƀgq=new actionsLib.Variable(false),this.mainButtonState=this.ƀgq.notifier,this.ƀju=new actionsLib.Variable(false),this.secondaryButtonState=this.ƀju.notifier,this.ƀku(),window.addEventListener("pointerdown",t=>{t.button===0?this.ƀgq.value=true:t.button===2&&(this.ƀju.value=true);},{capture:true}),window.addEventListener("pointerup",t=>{t.button===0?this.ƀgq.value=false:t.button===2&&(this.ƀju.value=false);},{capture:true}),window.addEventListener("blur",()=>{this.ƀgq.value=false,this.ƀju.value=false;},{capture:true});}ƀku(){let t=helpersLib.Vector.zero;window.addEventListener("pointermove",e=>{t=new helpersLib.Vector(e.clientX,e.clientY),this.ƀfv.value=true;},{capture:true}),m.beforeSceneUpdateAction.subscribe(()=>{this.ƀjp.value=this.ƀaz(t);}).attachToRoot(),m.afterSceneUpdateAction.subscribe(()=>{let e=g.camera.screenPositonToStagePosition(this.ƀjp.value);e.isEqual(this.ƀks.value)?g.instance.renderer.events.onPointerMove(new PointerEvent("pointermove",{clientX:t.x,clientY:t.y,pointerType:"mouse"})):this.ƀks.value=e;}).attachToRoot();}ƀaz(t){let i=g.instance.renderer.view.getBoundingClientRect(),r=i.width,s=i.height;if(r<=0||s<=0)return helpersLib.Vector.zero;let n=g.instance.renderer,a=(t.x-i.left)/r*n.screen.width,l=(t.y-i.top)/s*n.screen.height;return a=helpersLib.NumberHelper.clamp(a,0,n.screen.width),l=helpersLib.NumberHelper.clamp(l,0,n.screen.height),new helpersLib.Vector(a,l)}};exports.MouseService=Po([d(),Eo("design:paramtypes",[])],exports.MouseService);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},Ro=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.MouseTargetFocusService=class Pi{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀdo}get lastFocusedPosition(){return this.ƀgj}constructor(t){this.ƀhd=t,this.ƀht=new actionsLib.Action,this.onTargetFocus=this.ƀht.notifier,this.ƀln=0,this.ƀlo=false,this.ƀdo=false,this.ƀgj=void 0,m.beforeSceneUpdateAction.subscribe(e=>this.ƀlr(e.delta)).attachToRoot();}ƀlr(t){if(this.ƀhe){let e=this.ƀeq(this.ƀhd.stagePosition.value,this.ƀhe);this.ƀig===void 0?this.ƀig=e:this.ƀav(e,t);}this.ƀhe=this.ƀhd.stagePosition.value;}ƀav(t,e){this.ƀig-t>10?(this.ƀln=Math.max(250,this.ƀln),this.ƀlo=true):this.ƀln>1e3&&(this.ƀlo=true);let i=this.ƀln>=300&&this.ƀlo;this.ƀgf(i,t,e);}ƀgf(t,e,i){(t||e>this.ƀig)&&(this.ƀig=e),t?(this.ƀlo=false,this.ƀln=0,this.ƀdo=true,this.ƀgj=this.ƀhd.stagePosition.value,this.ƀht.trigger(this.ƀgj)):(this.ƀln+=i,this.ƀdo=false);}ƀeq(t,e){let i=helpersLib.Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};exports.MouseTargetFocusService=To([d(),Ro("design:paramtypes",[exports.MouseService])],exports.MouseTargetFocusService);var Ei=10.8,Ti=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 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},at=class extends q(){static{h(this,"PhysicsInternalGateway");}};at=Mo([d()],at);var b=class o extends W{static{h(this,"PhysicsEntity");}static{this.ƀhz=new Map;}static{this.ƀik=new Map;}static getFromP2BodyID(t){return o.ƀhz.get(t)}static getFromP2BodyIDOrFail(t){let e=o.ƀhz.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=o.ƀik.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(o.ƀik.values())}get area(){return this.ƀu}get mass(){return this.ƀgu}get collisions(){return this.ƀbc}constructor(t,e,i){super(),this.ƀhm=new actionsLib.Action,this.onCollision=this.ƀhm.notifier,this.type="dynamic",this.ƀu=0,this.ƀgu=0,this.ƀbc=[],this.physicsWorldID=t,this.ƀim=S.get(at);let r=this.ƀim.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀim.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀil=this.ƀim.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀin=this.ƀim.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀim.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀu=this.p2Body.getArea(),this.ƀgu=this.p2Body.mass,this.p2Body.position=f.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀim.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.ƀhz.set(this.p2Body.id,this),o.ƀik.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀim.removeBody(this.physicsWorldID,this.p2Body),o.ƀhz.delete(this.p2Body.id),o.ƀik.delete(this.id));}canCollideWith(t){return f.arePhysicsGroupsCollidable(this.ƀil,this.ƀin,t.ƀil,t.ƀin)}ƀjw(t){this.ƀbc=t,t.length>0&&this.ƀhm.trigger(t);}};var le=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 Ri=class extends W{static{h(this,"MovableEntity");}constructor(){super(),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.rotation=new actionsLib.Variable(helpersLib.Radian.get0),this.velocity=new actionsLib.Variable(helpersLib.Vector.zero),this.rotationalSpeed=new actionsLib.Variable(0),m.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀkz(t,e);}).attach(this);}ƀkz(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 Ii=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.ƀfo=false,this.ƀfp=false,this.ƀfr=false,this.ƀfq=false,this.ƀih(),this.ƀgo(),S.get(at).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀkz(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}}ƀkz(t,e){this.ƀfo=true,this.ƀfp=true,this.ƀfr=true,this.ƀfq=true,this.ƀih();}ƀih(){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;}ƀgo(){this.position.subscribe(t=>{this.ƀfo?this.ƀfo=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfp?this.ƀfp=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfr?this.ƀfr=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfq?this.ƀfq=false:this.p2Body.angularVelocity=t;}).attach(this);}};var ht="border";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};exports.PhysicsGateway=class ce extends q(){static{h(this,"PhysicsGateway");}};exports.PhysicsGateway=Fo([d()],exports.PhysicsGateway);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},Vo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},v=class extends W{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=No([yt(),Vo("design:paramtypes",[helpersLib.Vector,Boolean,U__default.default.World,Map,Map,Map,Map])],v);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},X=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}};X=Uo([d()],X);var Wo=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)},We=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀij=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((r,s)=>{r.forEach((n,a)=>{this.ƀij.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();}};We=Wo([d(),$o("design:paramtypes",[X])],We);var zo=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},ko=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},lt=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀij=t,this.ƀz=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let r=f.aabbToBoundingBox(e.aabb);this.ƀz.getCollidableGrids(t,i).forEach(s=>{let n=G.areaToGridArea(r,s.cellSize);s.grid.setArea(n,false);});}findClosestAvailableSpace(t,e,i,r=50){return e.aabbNeedsUpdate=true,e.updateAABB(),Xt.findByConvertingGridSpace(this.getAvilabilityGrid(t,r,i),f.aabbToBoundingBox(e.aabb),r)}getAvilabilityGrid(t,e,i){let r=this.ƀz.get(t,e,i);return r||(r=this.ƀcb(t,e,i),this.ƀz.set(t,e,i,r)),r}ƀcb(t,e,i){let r=new helpersLib.Grid({size:new helpersLib.Vector(Math.floor(t.mapSize.x/e),Math.floor(t.mapSize.y/e)),defaultValue:true});return t.p2World.bodies.forEach(s=>{let n=b.getFromP2BodyIDOrFail(s.id);if(n.includeInPathfinding&&this.ƀij.canCollide(t,n.physicsBodyGroup,i)){let a=this.ƀeh(s,e);r.setArea(a,false);}}),r}ƀeh(t,e){let i=f.aabbToBoundingBox(t.aabb);return G.areaToGridArea(i,e)}};lt=zo([d(),ko("design:paramtypes",[X,We])],lt);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},Ko=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Vt=class{static{h(this,"PathFinderService");}constructor(t){this.ƀii=t;}findPathAStar(t,e,i,r,s){s||(s={}),s.neighborType===void 0&&(s.neighborType=helpersLib.GridNeighborType.Ortogonal),s.gridCellSize===void 0&&(s.gridCellSize=50);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=G.positionToGridPosition(e,s.gridCellSize),p=G.positionToGridPosition(a,s.gridCellSize),y=this.ƀii.getAvilabilityGrid(n,s.gridCellSize,r);if(l){let A=f.aabbToBoundingBox(l.aabb),Tt=G.areaToGridArea(A,s.gridCellSize);y.setArea(Tt,true);}let w=Kt.findPath(y,c,p,s.neighborType);return w.path=w.path.map(A=>G.gridPositionToPosition(A,s.gridCellSize)),w}findPathDirection(t,e,i,r,s=50){let n=v.getInstanceByIDOrFail(t),a;if(helpersLib.Comparator.isNumber(i)){let w=b.getPhysicsInstanceOrFail(i);a=f.aabbToBoundingBox(w.p2Body.aabb);}else a=new helpersLib.Rectangle(i,i);let l=G.areaToGridArea(a,s),c=JSON.stringify({targetGridArea:l,collidableWithGroup:r}),p=n.vectorFieldCache.get(c);if(!p){let w=this.ƀii.getAvilabilityGrid(n,s,r);p=new Zt(l,w),n.vectorFieldCache.set(c,p);}let y=G.positionToGridPosition(e,s);return p.getDirectionToTarget(y)}};Vt=Xo([d(),Ko("design:paramtypes",[lt])],Vt);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},tn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Z=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀaa=t,this.ƀib=e;}printPathfindingTestGrid(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t);this.ƀaa.getAvilabilityGrid(a,n,r).map((c,p)=>({position:G.gridPositionToPosition(p,n),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(s)){let p=this.ƀib.findPathDirection(t,c.position,i,r),y;p===void 0?y=T.createRectangleBorders(new helpersLib.Vector(8,8),2,helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):y=T.createArrow(25,c.availability?helpersLib.ColorHelper.green:helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).setRotation(p).attach(a),new I(y,"alpha",{duration:1e3,animation:x.easeIn}).animate({alpha:0}).tap(()=>y.destroy()).attach(y);}});}createExplosionDebugVisual(t,e,i,r,s,n=300){let a=new u().displayParent(e).setAlpha(.5).attach(t);T.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;T.createVector(r,c.line.to,p).toSprite().displayParent(a).attach(t);}),new I(a,"alpha",{duration:n,animation:x.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);T.createElipse(n,helpersLib.ColorHelper.blue).toSprite().displayParent(l).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attach(t),i.forEach(p=>{let y=p.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;T.createVector(p.line.from,p.line.to,y).toSprite().displayParent(l).attach(t);}),new I(l,"alpha",{duration:a,animation:x.easeIn}).animate({alpha:0}).tap(()=>l.destroy()).attach(l);}createPhysicsEntityShapeVisual(t,e,i){let r=i?.overridePosition??f.arrayToVector(t.position),s=i?.overrideRotation??new helpersLib.Radian(t.angle),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.ƀcw(c,n).displayParent(a).attachToRoot();}),new I(a,"alpha",{duration:1e3,animation:x.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcw(t,e){switch(t.type){case 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.ƀcv(t,e);default:throw new Error("Not implemented")}}ƀcv(t,e){let i=[t.vertices.map(r=>({x:r[0],y:r[1]}))];return T.createPolygon(i,e).toSprite()}};Z=Qo([d(),tn("design:paramtypes",[lt,Vt])],Z);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,"HitTestService");}constructor(t){this.ƀlg=t;}hitTest(t,e){let i=t.world,r=b.getFromP2BodyIDOrFail(t.id),s=f.cloneP2Body(t);this.ƀt(s,e);let n=i.broadphase.aabbQuery(i,this.ƀdt(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.ƀlg.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀt(t,e){e?.overridePosition&&(t.position=f.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀdt(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};$e=sn([d(),on("design:paramtypes",[Z])],$e);var an=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},ze=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀjh(t,i);});});}step(t,e,i){b.getPhysicsEntities().forEach(r=>{r.ƀbc=[];}),t.p2World.narrowphase.contactEquations.forEach(r=>{this.ƀjh(t,r);}),t.bodiesInContactWith.forEach((r,s)=>{this.ƀfe(r.p2Body),r.entity.ƀjw(t.collisionReports.get(s)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀfe(t){let e=f.arrayToVector(t.velocity);e.length>Ei&&(e=e.normalize(Ei),t.velocity=f.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-Ti),Ti);}ƀjh(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.ƀdz(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);}ƀdz(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.ƀeo(i);return {collisionDetailsA:this.ƀdy(r,i.bodyA.mass,n,l,t.area),collisionDetailsB:this.ƀdy(s,i.bodyB.mass,a,c,e.area)}}ƀdy(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}}ƀeo(t){let e=f.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};ze=an([d()],ze);var hn=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},ln=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},ke=class extends le{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};ke=hn([yt(),ln("design:paramtypes",[Number,Object])],ke);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},j=1e4,Je=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbv(t,new helpersLib.Vector(e.x/2,-j/2),new helpersLib.Vector(e.x+j*2,j),i),this.ƀbv(t,new helpersLib.Vector(e.x/2,e.y+j/2),new helpersLib.Vector(e.x+j*2,j),i),this.ƀbv(t,new helpersLib.Vector(-j/2,e.y/2),new helpersLib.Vector(j,e.y+j*2),i),this.ƀbv(t,new helpersLib.Vector(e.x+j/2,e.y/2),new helpersLib.Vector(j,e.y+j*2),i);}ƀbv(t,e,i,r){return new ke(t,{shapeDefinition:{materialName:ht,group:r,shapeType:exports.PhysicsShapeType.Rectangle,shapeData:i},position:e,rotation:helpersLib.Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};Je=cn([d()],Je);var dn=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},fr=new U__default.default.Material,un={id:ht,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},Lt=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(ht))throw new Error(`Material with name ${ht} cannot be defined, pick another name for the material.`);return s.set(ht,fr),n.set(ht,un),this.ƀc(t,e,i,r,s),{materials:s,materialDefinitions:n}}getMaterial(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀem(e,i.materials)}getMaterialDefinition(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀel(e,i.materialDefinitions)}ƀem(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀel(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.ƀee(i.map(n=>n.id),r).forEach(n=>{let a=this.ƀem(n.materialA,s),l=this.ƀem(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);}ƀee(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.ƀem(s.id,r);t.addContactMaterial(new U__default.default.ContactMaterial(n,fr,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};Lt=dn([d()],Lt);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)},Ht=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,r,s){this.ƀgy=t,this.ƀaj=e,this.ƀaa=i,this.ƀbd=r,this.ƀij=s;}createPhysicsWorld(t){let e=new U__default.default.World({gravity:[0,0]}),{materials:i,materialDefinitions:r}=this.ƀgy.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:s,physicsBodyGroupToP2Mask:n}=this.ƀij.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&&m.cleanUpdateModifier();}).attachToRoot(),this.ƀaj.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀbd.registerPhysicsWorld(a),t.modifyUpdateCycle?m.registerUpdateModifier((l,c)=>this.ƀkz(a,l,c)):m.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀkz(a,l,c);}).attach(a),a.id}addBody(t,e,i,r,s){let n=v.getInstanceByIDOrFail(t);if(i){let a=this.ƀaa.findClosestAvailableSpace(n,e,r);return a?(e.position[0]+=a.x,e.position[1]+=a.y,n.p2World.addBody(e),s&&this.ƀaa.onBodyAdded(n,e,r),true):false}else return n.p2World.addBody(e),s&&this.ƀaa.onBodyAdded(n,e,r),true}removeBody(t,e){v.getInstanceByID(t)?.p2World.removeBody(e);}ƀkz(t,e,i){if(!t.paused.value){t.availabilityGridCache.clear(),t.vectorFieldCache.clear(),t.p2World.step(i,i,i),t.modifyUpdateCycle&&(i=t.p2World.time-t.lastP2Time.value);let r=e+i;this.ƀbd.step(t,r,i),t.onPhysicsStep.trigger({time:r,delta:i}),t.lastP2Time.value=t.p2World.time;}return i}setPaused(t,e){v.getInstanceByIDOrFail(e).paused.set(t);}};Ht=fn([d(),mn("design:paramtypes",[Lt,Je,lt,ze,X])],Ht);var gn=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},Ut=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.ƀbq(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.ƀbq(n,e)):n.fraction===a.fraction&&a.isExternal()&&r.set(n.body,this.ƀbq(n,e));},"callback")});return t.p2World.raycast(new U__default.default.RaycastResult,s),Array.from(r.values())}ƀbq(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}}};Ut=gn([d()],Ut);var wn=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},dt=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);}};dt=wn([d()],dt);var xn=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},Wt=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.ƀbr(r,t.length))}ƀbr(t,e){let i=t.hitCount/e,r=t.rayCastHits;if(t.isExternal)return {body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:true,normal:t.closestRaycastHit.normal,fraction:t.closestRaycastHit.fraction,ratioOfHits:i,raycastResults:r,getHitPosition:t.closestRaycastHit.hitPosition,getHitDistance:t.closestRaycastHit.hitDistance};{let s=f.arrayToVector(t.closestRaycastHit.body.position);return {body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:false,normal:helpersLib.Vector.fromTo(s,t.explosionCenter).normalize(),fraction:0,ratioOfHits:i,raycastResults:r,getHitPosition:h(()=>t.explosionCenter,"getHitPosition"),getHitDistance:h(()=>0,"getHitDistance")}}}};Wt=xn([d()],Wt);var bn=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},Sn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Tn=15,Xe=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,r){this.ƀjd=t,this.ƀlg=e,this.ƀjc=i,this.ƀfs=r;}createElipticExplosion(t,e,i,r,s,n,a){let l=v.getInstanceByIDOrFail(t),c=this.ƀcg(e,i,r,s,a?.hitOnlyClosest===true,l),p=this.ƀjc.toExplosionHits(c,false);return this.ƀr(p,n),a?.testLayerID&&this.ƀlg.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,r,a.debugRayDuration),p.map(y=>{let{p2Body:w,...A}=y;return A})}ƀcg(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 y=l.normalize(i.y);a.push(new helpersLib.Line(t,t.add(y))),a.push(new helpersLib.Line(t,t.add(y.multiplyNumber(-1))));let w=Math.round(i.y/Tn),A=i.y/(w*2+1)*2,Tt=l.normalize(A),pe=i.x,yr=Math.pow(i.y,2);return helpersLib.ArrayHelper.createIntegerArray(w).forEach(ft=>{let Rt=A*(ft+1),Oi=Tt.multiplyNumber(ft+1),de=c.normalize(this.ƀex(pe,yr,Rt)),ue=t.add(Oi);a.push(new helpersLib.Line(ue,ue.add(de))),a.push(new helpersLib.Line(ue,ue.add(de.multiplyNumber(-1))));let fe=t.add(Oi.multiplyNumber(-1));a.push(new helpersLib.Line(fe,fe.add(de))),a.push(new helpersLib.Line(fe,fe.add(de.multiplyNumber(-1))));}),a.map(ft=>{if(s){let Rt=this.ƀjd.castClosest(n,ft,r);return {line:ft,hits:Rt?[Rt]:[]}}else {let Rt=this.ƀjd.castAllFirstContacts(n,ft,r);return {line:ft,hits:Rt}}})}ƀex(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀr(t,e){t.forEach(i=>{i.raycastResults.forEach(r=>{let s,n;r.isExternal()?(s=r.line.fromTo,n=e*2):(s=r.line.fromTo.multiplyNumber(-1),n=e*(1-r.fraction)*8),this.ƀfs.applyImpulse(r.body,r.hitPosition(),s,n);});});}};Xe=bn([d(),Sn("design:paramtypes",[Ut,Z,Wt,dt])],Xe);var Rn=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},In=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ke=class{static{h(this,"ExplosionService");}constructor(t,e,i,r){this.ƀjd=t,this.ƀlg=e,this.ƀjc=i,this.ƀfs=r;}createExplosion(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t),l=this.ƀeu(i),c=this.ƀcg(e,i,r,l,n?.hitOnlyClosest===true,a),p=this.ƀjc.toExplosionHits(c);return this.ƀr(e,i,s,l,p),n?.testLayerID&&this.ƀlg.createExplosionDebugVisual(a,n.testLayerID,c,e,i,n.debugRayDuration),p}ƀcg(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 y=this.ƀjd.castClosest(n,p,i);return {line:p,hits:y?[y]:[]}}else {let y=this.ƀjd.castAllFirstContacts(n,p,i);return {line:p,hits:y}}})}ƀr(t,e,i,r,s){s.forEach(n=>{if(n.isExternal)n.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀfs.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.ƀfs.applyImpulse(n.p2Body,n.getHitPosition(),a,c);}});}ƀeu(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};Ke=Rn([d(),In("design:paramtypes",[Ut,Z,Wt,dt])],Ke);var Mn=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},$t=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)}};$t=Mn([d()],$t);var Bn=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},Gn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ai=class{static{h(this,"PhysicsController");}constructor(t,e,i,r,s,n,a,l){this.ƀiq=t,this.ƀib=e,this.ƀlg=i,this.ƀdh=r,this.ƀda=s,this.ƀfj=n,this.ƀip=a,this.ƀfs=l;}createPhysicsWorld(t){return this.ƀiq.createPhysicsWorld(t)}getMapSize(t){return this.ƀip.getMapSize(t)}setPaused(t,e){this.ƀiq.setPaused(t,e);}hitTest(t,e){let i=b.getPhysicsInstanceOrFail(t);return this.ƀfj.hitTest(i.p2Body,e)}findPath(t,e,i,r,s){return this.ƀib.findPathAStar(t,e,i,r,{neighborType:s})}findPathDirection(t,e,i,r){return this.ƀib.findPathDirection(t,e,i,r)}applyImpulse(t,e,i,r){let s=b.getPhysicsInstanceOrFail(t);this.ƀfs.applyImpulse(s.p2Body,e,i,r);}createExplosion(t,e,i,r,s,n){return this.ƀdh.createExplosion(t,e,i,r,s,n)}createElipticExplosion(t,e,i,r,s,n,a){return this.ƀda.createElipticExplosion(t,e,i,r,s,n,a)}printPathfindingTestGrid(t,e,i,r,s,n=50){this.ƀlg.printPathfindingTestGrid(t,e,i,r,s,n);}};Ai=Bn([Q(exports.PhysicsGateway),Gn("design:paramtypes",[Ht,Vt,Z,Ke,Xe,$e,$t,dt])],Ai);var _n=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},Ze=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.ƀbx(n,void 0,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Circle:return this.ƀbx(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Polygon:return this.ƀcf(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Rectangle:return this.ƀch(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);default:{e.shapeDefinition.shapeType;throw new Error(`Unexpected case! "${e.shapeDefinition.shapeType}"`)}}}ƀbx(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}ƀcf(t,e,i,r,s,n){let a=t.physicsBodyGroupToP2Group.get(s),l=t.physicsBodyGroupToP2Mask.get(s),c=e.map(w=>new U__default.default.Convex({vertices:w.map(A=>[A.x,A.y]),collisionGroup:a,collisionMask:l})).map(w=>(w.material=i,w)),p=c.reduce((w,A)=>w+A.area,0),y=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(w=>y.addShape(w)),y.setDensity(r.density),y}ƀch(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}};Ze=_n([d()],Ze);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},Nn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ci=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,r,s){this.ƀiq=t,this.ƀio=e,this.ƀkg=i,this.ƀip=r,this.ƀij=s;}createBody(t,e,i,r,s){return this.ƀkg.createBody(t,e,i,r,s)}getMaterial(t,e){return this.ƀio.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀio.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀij.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀij.getMaskConstant(t,e)}addBody(t,e,i,r,s){return this.ƀiq.addBody(t,e,i,r,s)}removeBody(t,e){this.ƀiq.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀip.subscribeToPhysicsStep(t,e)}};Ci=Fn([Q(at),Nn("design:paramtypes",[Ht,Lt,Ze,$t,X])],Ci);exports.AdvancedSound=nt;exports.AnimationFlicker=Bi;exports.AnimationInterpolationFunctions=N;exports.Animations=x;exports.Animator=I;exports.BORDER_MATERIAL_NAME=ht;exports.BardLegendsHardReset=R;exports.Camera=ee;exports.ClosestAvailableSpaceHelper=Xt;exports.Container=u;exports.ControllerDecorator=Q;exports.DEFAULT_SHADER_RESOLUTION=D;exports.DeltaTime=ni;exports.DisplayObjectArray=gi;exports.Entity=W;exports.EntityDecorator=yt;exports.FadeInContent=Hi;exports.Game=g;exports.Gateway=q;exports.Graphics=T;exports.ImmovablePhysicsEntity=le;exports.MenuEntity=xi;exports.MenuUI=ne;exports.MenuView=vi;exports.MovableEntity=Ri;exports.MovablePhysicsEntity=Ii;exports.Music=se;exports.MusicPlayer=mi;exports.PathFinder=Kt;exports.PhysicsEntity=b;exports.Placeholder=hi;exports.ROTATIONAL_SPEED_LIMIT=Ti;exports.RichText=li;exports.SOUND_TRANSITION_DURATION=Y;exports.SPEED_LIMIT=Ei;exports.Scene=me;exports.SceneDecorator=Cr;exports.ScrollAreaUI=bi;exports.ScrollMaskUI=xt;exports.Service=S;exports.ServiceDecorator=d;exports.SingletonEntity=gt;exports.SlideInContent=Ji;exports.SlideInContentByIndex=oi;exports.SlideStateAnimation=Ie;exports.Sound=ie;exports.Sprite=k;exports.StateAnimation=Dt;exports.Text=Qt;exports.ThroughEmptyStateAnimation=be;exports.UpdatableContainer=yi;exports.UpdateCycle=m;exports.VectorFieldPathFinder=Zt;exports.VectorSet=bt;exports.View=mt;exports.ViewDecorator=Qe;
|