bard-legends-framework 1.12.1 → 1.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var actionsLib=require('actions-lib'),helpersLib=require('helpers-lib'),W=require('pixi.js');require('pixi.js/advanced-blend-modes'),require('reflect-metadata'),require('@pixi/layout');var scriptEngineLib=require('script-engine-lib'),components=require('@pixi/layout/components'),X=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 W__namespace=/*#__PURE__*/_interopNamespace(W);var X__default=/*#__PURE__*/_interopDefault(X);var Rr=Object.defineProperty;var h=(n,t)=>Rr(n,"name",{value:t,configurable:true});function ht(){return class{static{h(this,"GatewayBase");}}}h(ht,"Gateway");function be(n,t){let e=n.prototype,i=Object.getPrototypeOf(t),s=[];for(let r of Reflect.ownKeys(i)){if(typeof r!="string"||r==="constructor")continue;let o=t[r];if(typeof o=="function"){if(Object.prototype.hasOwnProperty.call(e,r))throw new Error(`Gateway "${n.name}": method "${r}" is already registered by another controller.`);e[r]=o.bind(t),s.push(r);}}return s}h(be,"bindControllerToGateway");var T=class{static{h(this,"BardLegendsTestingHelper");}static{this.ƀfk=new actionsLib.Action;}static{this.onHardReset=this.ƀfk.notifier;}static{this.ƀhh=[];}static hardReset(){actionsLib.ActionLib.hardReset();for(let t of this.ƀhh)for(let e of t.keys)delete t.gatewayPrototype[e];this.ƀhh=[],this.ƀfk.trigger();}static bindMockControllerToGateway(t,e){let i=be(t,e);this.ƀhh.push({gatewayPrototype:t.prototype,keys:i});}};var w=class n{static{h(this,"UpdateCycle");}static{this.ƀae=new actionsLib.Action;}static{this.beforeSceneUpdateAction=this.ƀae.notifier;}static{this.ƀjx=new actionsLib.Action;}static{this.sceneUpdateAction=this.ƀjx.notifier;}static{this.ƀf=new actionsLib.Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀly=0;}static{this.ƀmg=void 0;}static wait(t){let e=this.ƀly+t;return actionsLib.SingleEvent.create(i=>{let s=n.beforeSceneUpdateAction.subscribe(r=>{r.time>=e&&i();}).attachToRoot();return ()=>s.destroy()})}static registerUpdateModifier(t){if(!this.ƀmg)this.ƀmg=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀmg=void 0;}static triggerUpdateTick(t){this.ƀmg&&(t=this.ƀmg(this.ƀly,t)),this.ƀly+=t,this.ƀgl=t,t>0&&(n.ƀae.trigger({time:this.ƀly,delta:t}),n.ƀjx.trigger({time:this.ƀly,delta:t}),n.ƀf.trigger({time:this.ƀly,delta:t}));}static get lastDelta(){return this.ƀgl}static{this.ƀgl=0;}};T.onHardReset.subscribe(()=>{w.ƀae.clear(),w.ƀjx.clear(),w.ƀf.clear(),w.ƀmg=void 0,w.ƀly=0;}).attachToRoot();function u(){return function(n){E.ƀhf.set(n,{paramtypes:E.ƀet(n)});}}h(u,"ServiceDecorator");var E=class n{static{h(this,"Service");}static{this.ƀhf=new WeakMap;}static{this.ƀke=new Map;}static get(t){let e=this.ƀke.get(t);if(!e){let i=n.ƀhf.get(t);if(!i)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let s=this.ƀjr(i.paramtypes);e=new t(...s),this.ƀke.set(t,e);}return e}static ƀet(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 ƀjr(t){return t.map(i=>{if(i&&n.ƀhf.has(i))return this.get(i);throw new Error(`Injected parameter has to be decorated with @ServiceDecorator(), class: "${i.name}"`)})}};T.onHardReset.subscribe(()=>{E.ƀke=new Map;}).attachToRoot();function lt(n){return function(t){let e=E.ƀet(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=E.ƀjr(e);i.some(r=>r===void 0)&&console.error(i,e,t.name);let s=new t(...i);be(n,s);}}}h(lt,"ControllerDecorator");var D=class n{static{h(this,"EntityStoreHelper");}static{this.ƀba=new Map;}static{this.ƀjp=new Set;}static registerEntityClass(t){this.ƀjp.add(t),this.ƀba.set(t.id,new Map);}static registerEntity(t){let e=this.ƀba.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.ƀba.get(i)?.delete(e);}static getEntity(t,e){return this.ƀba.get(t.id)?.get(e)}static getSingleton(t){let e=n.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.ƀba.get(t.id);return Array.from(e.values())}};T.onHardReset.subscribe(()=>{D.ƀba.clear();for(let n of D.ƀjp)D.ƀba.set(n.id,new Map);}).attachToRoot();function oi(n){return function(t){Z.ƀhf.set(t,{paramtypes:E.ƀet(t),viewInstances:new Map,entity:n.entity}),ft.registerView(t,n.entity);}}h(oi,"ViewDecorator");var Z=class n extends actionsLib.IDAttachable{static{h(this,"View");}static{this.ƀhf=new WeakMap;}static getInstance(t){let e=n.ƀhf.get(this);if(!(!e||!e.entity.validateID(t)))return e.viewInstances.get(t)}static getInstanceOrFail(t){let e=n.ƀhf.get(this);if(!e||!e.entity.validateID(t))throw new Error(`View: getInstance is called with entity id: "${t}", that is not belonging to the class: "${e?.entity}"`);let i=e.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.update=()=>{},this.attachToRoot(),this.ƀdj=ft.entityID,this.ƀez().set(this.ƀdj,this);}destroy(){this.destroyed||(super.destroy(),this.ƀez().delete(this.ƀdj));}ƀez(){let t=n.ƀhf.get(this.constructor);if(!t)throw new Error(`View: view class is not decorated by @ViewDecorator(), class: "${this.constructor.name}"`);return t.viewInstances}};T.onHardReset.subscribe(()=>{Z.ƀhf=new WeakMap;}).attachToRoot();var ft=class n{static{h(this,"EntityViewsHelper");}static{this.ƀmp=new Map;}static registerView(t,e){n.ƀmp.has(e)||n.ƀmp.set(e,[]);let i=n.ƀmp.get(e);i&&i.push(t),D.getEntities(e).forEach(r=>{this.ƀcm(r,t);});}static ƀcm(t,e){try{let i=Z.ƀhf.get(e);if(!i)throw new Error(`View: view class is not decorated by @ViewDecorator(), class: "${e.name}"`);let s=E.ƀjr(i.paramtypes.slice(1));n.entityID=t.id;let r=new e(t,...s);t.destroyed?r.destroy():t.ƀmo.ƀmq.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀdi=t,this.ƀmq=[];}createViews(){if(!this.ƀdi.destroyed){let t=n.ƀmp.get(this.ƀdi.constructor);t&&t.forEach(e=>{n.ƀcm(this.ƀdi,e);});}}updateViews(t,e){for(let i=0;i<this.ƀmq.length;i++){let s=this.ƀmq[i];s.destroyed||s.update(t,e);}}destroyViews(){this.ƀmq.forEach(t=>{t.destroy();});}};T.onHardReset.subscribe(()=>{ft.ƀmp=new Map;}).attachToRoot();function It(){return function(n){D.registerEntityClass(n);}}h(It,"EntityDecorator");var Q=class extends actionsLib.IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return D.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=D.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return D.getEntities(this)}constructor(){super(),this.ƀmo=new ft(this),D.registerEntity(this),w.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.ƀme(t.time,t.delta),this.ƀmo.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀmo.destroyViews(),D.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀmo.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀmo.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀmo.createViews(),this}ƀme(t,e){}};var dt=class n extends Q{static{h(this,"SingletonEntity");}static{this.ƀcn=new WeakMap;}static ƀef(t){let e=n.ƀcn.get(t);return e||(e=new actionsLib.SingleAction,n.ƀcn.set(t,e)),e}static ƀmd(t){n.ƀcn.delete(t);}static getInstanceAsync(){let t=D.getSingleton(this);return t&&!t.destroyed?actionsLib.SingleEvent.instant(t):n.ƀef(this).toSingleEvent()}static continuesSubscription(){let t=h((e,i)=>{this.getInstanceAsync().tap(r=>{e({type:"open",value:r}),r.onDestroy().tap(()=>{e({type:"close",value:r}),t(e,i);}).attach(i);}).attach(i);},"subscribe");return actionsLib.Sequence.create((e,i)=>t(e,i.attachable))}static getInstance(){return D.getSingleton(this)}static getInstanceOrFail(){return D.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(()=>n.ƀmd(this.constructor)).attachToRoot(),n.ƀef(this.constructor).resolve(this);}};T.onHardReset.subscribe(()=>{dt.ƀcn=new WeakMap;}).attachToRoot();function Nr(){return function(n){return Vt.ƀhf.set(n,{paramtypes:E.ƀet(n)}),n}}h(Nr,"SceneDecorator");var Vt=class n extends actionsLib.IDAttachable{static{h(this,"Scene");}static{this.ƀhf=new WeakMap;}static{this.ƀge=new actionsLib.Variable(false);}static{this.isTransitioning=this.ƀge.notifier;}static{this.ƀb=new actionsLib.Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveSceneOrFail(){if(!n.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return n.ƀb.value}static cancelActiveScene(){return n.ƀb.value?n.ƀb.value.ƀj("cancel"):actionsLib.SingleEvent.instant()}static isActive(){return n.ƀb.value instanceof this}static getInstance(){return n.ƀb.value instanceof this?n.ƀb.value:void 0}static getInstanceOrFail(){if(!n.ƀb.value)throw new Error("Scene: getInstance is called when there is no active scene!");if(!(n.ƀb.value instanceof this))throw new Error(`Scene: getInstance is called while "${this.name}" was not the active scene. Current scene is: "${n.ƀb.value}"!`);return n.ƀb.value}static open(...t){if(n.ƀge.value)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(n.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=n.ƀhf.get(this);if(!e)throw new Error(`Scene: scene class is not decorated by @SceneDecorator(), class: "${this.name}"`);let i=t[0];n.ƀge.value=true;let s=E.ƀjr(e.paramtypes),r=new this(...s).attachToRoot();return n.ƀb.set(r),r.init(i).map(()=>(n.ƀge.value=false,r)).chainToRoot()}constructor(){super(),this.ƀhr=new actionsLib.SingleAction,this.onClose=this.ƀhr.notifier,w.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(n.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(n.ƀge.value)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");n.ƀge.value=true;let e=t[0];return this.ƀj(e).map(()=>(this.ƀhr.resolve(e),e)).chainToRoot()}ƀj(t){return this.prepareToClose(t).tap(()=>{super.destroy(),n.ƀb.set(void 0),n.ƀge.value=false;}).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};T.onHardReset.subscribe(()=>{Vt.ƀhf=new WeakMap,Vt.ƀb.set(void 0);}).attachToRoot();var U=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}},Lr=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return U.lineer(t)}},Hr=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return U.easeIn(t)}},jr=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return U.easeOut(t)}},Ur=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return U.easeInOut(t)}},Wr=class{static{h(this,"AnimationEaseInCubic");}start(){}multiplierFunction(t){return U.easeInCubic(t)}},$r=class{static{h(this,"AnimationEaseOutCubic");}start(){}multiplierFunction(t){return U.easeOutCubic(t)}},kr=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return U.easeInOutCubic(t)}},zr=class{static{h(this,"AnimationBlink");}start(){}multiplierFunction(t){return U.blink(t)}},Li=class{static{h(this,"AnimationFlicker");}start(){this.ƀlz=new Array(10).fill(0),helpersLib.Random.integerBetween(0,9),this.ƀlz[helpersLib.Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(helpersLib.Random.integerBetween(0,9),this.ƀlz[helpersLib.Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(helpersLib.Random.integerBetween(0,9),this.ƀlz[helpersLib.Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀlz[e]}},b=class{static{h(this,"Animations");}static{this.lineer=new Lr;}static{this.easeIn=new Hr;}static{this.easeOut=new jr;}static{this.easeInOut=new Ur;}static{this.easeInCubic=new Wr;}static{this.easeOutCubic=new $r;}static{this.easeInOutCubic=new kr;}static{this.blink=new zr;}};exports.ReAnimateHandlingType=void 0;(function(n){n[n.ThrowError=1]="ThrowError",n[n.IgnoreNewAnimation=2]="IgnoreNewAnimation",n[n.CompletePrevious=3]="CompletePrevious";})(exports.ReAnimateHandlingType||(exports.ReAnimateHandlingType={}));exports.AnimationsCompletionHandlingType=void 0;(function(n){n[n.ReturnToOriginal=1]="ReturnToOriginal",n[n.StayInCurrentState=2]="StayInCurrentState",n[n.JumpToEnd=3]="JumpToEnd",n[n.Loop=4]="Loop";})(exports.AnimationsCompletionHandlingType||(exports.AnimationsCompletionHandlingType={}));var O=class n{static{h(this,"Animator");}static{this.ƀl=new WeakMap;}static ƀdz(t){let e=n.ƀl.get(t);return e||(e=new helpersLib.MapToWeakRefs,n.ƀl.set(t,e)),e}get animating(){return this.ƀia!==void 0}get target(){return this.ƀlp}get value(){return this.ƀmj||(this.ƀmj=new actionsLib.Variable(this.ƀlp)),this.ƀmj.notifier}get paused(){return this.ƀii!==void 0}set paused(t){this.ƀii=t?true:void 0;}constructor(t,e,i){this.ƀgf=false,this.ƀks=false,this.ƀlp=t,this.ƀic={duration:200,animation:b.lineer,reAnimateHandling:exports.ReAnimateHandlingType.ThrowError,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState,...i},this.ƀm=helpersLib.Comparator.isArray(e)?e:[e],this.ƀgs(t,this.ƀm);}animate(t,e){let i={...this.ƀic,...e},s=this.ƀia;if(this.ƀia)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.ƀkg(i.completionHandling,this.ƀia.ƀje,true);break;default:{throw new Error}}return actionsLib.SingleEvent.create(o=>{this.ƀgf&&(this.ƀks=true);let a={};for(let c of this.ƀm)a[c]={ƀli:this.ƀlp[c],ƀls:t[c]};let l={ƀdc:i.duration,ƀdd:0,ƀje:a,ƀbl:i.completionHandling,ƀn:i.animation,ƀbk:o};if(l.ƀbl!==exports.AnimationsCompletionHandlingType.Loop&&this.ƀgc(l)){this.ƀia=void 0,o(),s?.ƀbk(),this.ƀbb();return}return l.ƀn.start(),this.ƀia=l,this.ƀdh(),s?.ƀbk(),()=>{this.ƀia===l&&(this.ƀlp instanceof actionsLib.Attachable&&this.ƀlp.destroyed||this.ƀkg(l.ƀbl,l.ƀje,true),this.ƀia=void 0,this.ƀbb());}}).notIdle()}set(t){this.ƀmw(e=>t[e]),this.ƀia?.ƀbk();}completeAnimation(t){if(this.ƀia){t=t??this.ƀia.ƀbl,this.ƀkg(t,this.ƀia.ƀje,true);let e=this.ƀia.ƀbk;this.ƀia=void 0,e();}}ƀdh(){this.ƀmf||(this.ƀmf=w.beforeSceneUpdateAction.subscribe(t=>{if(!this.ƀii){this.ƀgf=true;try{let e=this.ƀia;if(!e)return;if(e.ƀdd+=t.delta,e.ƀdd>=e.ƀdc)if(e.ƀbl===exports.AnimationsCompletionHandlingType.Loop)e.ƀdd%=e.ƀdc,e.ƀn.start();else {this.ƀkg(e.ƀbl,e.ƀje,!1),this.ƀia=void 0,e.ƀbk(),this.ƀbb();return}let i=e.ƀn.multiplierFunction(e.ƀdd/e.ƀdc);this.ƀmw(s=>{let r=e.ƀje[s];return (r.ƀls-r.ƀli)*i+r.ƀli});}finally{this.ƀgf=false,this.ƀks&&(this.ƀks=false,this.ƀcu(),this.ƀdh());}}}).attachToRoot());}ƀgc(t){return this.ƀm.every(e=>this.ƀlp[e]===t.ƀje[e].ƀls)}ƀkg(t,e,i){switch(t){case exports.AnimationsCompletionHandlingType.ReturnToOriginal:case exports.AnimationsCompletionHandlingType.Loop:this.ƀmw(s=>e[s].ƀli);break;case exports.AnimationsCompletionHandlingType.JumpToEnd:this.ƀmw(s=>e[s].ƀls);break;case exports.AnimationsCompletionHandlingType.StayInCurrentState:i||this.ƀmw(s=>e[s].ƀls);break;default:{throw new Error}}}ƀmw(t){let e=false;for(let i of this.ƀm){let s=t(i);this.ƀlp[i]!==s&&(e=true,this.ƀlp[i]=s);}e&&this.ƀmj?.set(this.ƀlp);}ƀbb(){this.ƀia||this.ƀcu();}ƀcu(){this.ƀmf?.destroy(),this.ƀmf=void 0;}ƀgs(t,e){let i=n.ƀdz(t);for(let s of e){if(i.has(s))throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(t,void 0,2)}", Property: "${s}"`);i.set(s,this);}}};var Pe=class extends actionsLib.IDAttachable{static{h(this,"DisplayObjectAttributes");}constructor(t){super(),this.ƀiw=t,this.ƀhg=false,this.ƀdr=false,this.ƀjv=1,this.ƀx=1;}setPosition(t,e){return e?.holdFrom&&(t=t.subtract(this.ƀem(e.holdFrom))),e?.round!==false&&(t=t.round({rollHalfsDown:true})),this.position=t,this}get position(){return new helpersLib.Vector(this.ƀiw.x,this.ƀiw.y)}set position(t){this.ƀiw.x=t.x,this.ƀiw.y=t.y;}get x(){return this.ƀiw.x}set x(t){this.ƀiw.x=t;}get y(){return this.ƀiw.y}set y(t){this.ƀiw.y=t;}setRotation(t){return this.rotation=t,this}get rotation(){return new helpersLib.Radian(this.ƀiw.rotation)}set rotation(t){this.ƀiw.rotation=t.value;}get rotationValue(){return this.ƀiw.rotation}set rotationValue(t){this.ƀiw.rotation=t;}setAlpha(t){return this.alpha=t,this}get alpha(){return this.ƀiw.alpha}set alpha(t){this.ƀiw.alpha=t;}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀhg}set mirror(t){this.ƀhg=t,this.ƀmh();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdr}set flip(t){this.ƀdr=t,this.ƀmh();}setScale(t){return this.scale=t,this}get scale(){return this.ƀjv}set scale(t){this.ƀjv=t,this.ƀmh();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀx}set aspectRatio(t){this.ƀx=t,this.ƀmh();}ƀmh(){let t=this.ƀjv,e=this.ƀjv;this.ƀx<1?t*=this.ƀx:this.ƀx>1&&(e/=this.ƀx),this.ƀhg&&(t*=-1),this.ƀdr&&(e*=-1),this.ƀu(t,e);}};var k=2;var Se=class{static{h(this,"GaussianValuesHelper");}static ƀdx(t,e){let i=e*e,s=1/(helpersLib.PI_360*i),r=-(t*t)/(2*i);return s*Math.exp(r)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),s=.005*i,r=helpersLib.NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<s)i-=l*2;else return true}),o=1/i,a=r.map(l=>l*o);return this.ƀbw(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(s=>this.ƀdx(s,t*.4)),i=e.reduce((s,r)=>s+r,0);return i=i*2-e[0],e=e.map(s=>s/i),this.ƀbw(e)}}static ƀbw(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let s=t[i]+t[i+1],r=i+t[i+1]/s;e.push({offset:r,multiplier:s});}if(t.length%2===0){let i=t[t.length-1],s=t.length-1;e.push({offset:s,multiplier:i});}return e}};var ji=class Ui extends W__namespace.Filter{static{h(this,"BlurFilterPass");}static ƀeg(t,e){let i=e?"uInputPixel.z":"uInputPixel.w",s=`
1
+ 'use strict';var actionsLib=require('actions-lib'),helpersLib=require('helpers-lib'),W=require('pixi.js');require('pixi.js/advanced-blend-modes'),require('reflect-metadata'),require('@pixi/layout');var scriptEngineLib=require('script-engine-lib'),components=require('@pixi/layout/components'),K=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 W__namespace=/*#__PURE__*/_interopNamespace(W);var K__default=/*#__PURE__*/_interopDefault(K);var Nr=Object.defineProperty;var h=(o,t)=>Nr(o,"name",{value:t,configurable:true});function lt(){return class{static{h(this,"GatewayBase");}}}h(lt,"Gateway");function Ee(o,t){let e=o.prototype,i=Object.getPrototypeOf(t),s=[];for(let r of Reflect.ownKeys(i)){if(typeof r!="string"||r==="constructor")continue;let n=t[r];if(typeof n=="function"){if(Object.prototype.hasOwnProperty.call(e,r))throw new Error(`Gateway "${o.name}": method "${r}" is already registered by another controller.`);e[r]=n.bind(t),s.push(r);}}return s}h(Ee,"bindControllerToGateway");var P=class{static{h(this,"BardLegendsTestingHelper");}static{this.ƀfo=new actionsLib.Action;}static{this.onHardReset=this.ƀfo.notifier;}static{this.ƀhq=[];}static hardReset(){actionsLib.ActionLib.hardReset();for(let t of this.ƀhq)for(let e of t.keys)delete t.gatewayPrototype[e];this.ƀhq=[],this.ƀfo.trigger();}static bindMockControllerToGateway(t,e){let i=Ee(t,e);this.ƀhq.push({gatewayPrototype:t.prototype,keys:i});}};var w=class o{static{h(this,"UpdateCycle");}static{this.ƀah=new actionsLib.Action;}static{this.beforeSceneUpdateAction=this.ƀah.notifier;}static{this.ƀkm=new actionsLib.Action;}static{this.sceneUpdateAction=this.ƀkm.notifier;}static{this.ƀg=new actionsLib.Action;}static{this.afterSceneUpdateAction=this.ƀg.notifier;}static{this.ƀmt=0;}static{this.ƀnd=void 0;}static wait(t){let e=this.ƀmt+t;return actionsLib.SingleEvent.create(i=>{let s=o.beforeSceneUpdateAction.subscribe(r=>{r.time>=e&&i();}).attachToRoot();return ()=>s.destroy()})}static registerUpdateModifier(t){if(!this.ƀnd)this.ƀnd=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀnd=void 0;}static triggerUpdateTick(t){this.ƀnd&&(t=this.ƀnd(this.ƀmt,t)),this.ƀmt+=t,this.ƀgs=t,t>0&&(o.ƀah.trigger({time:this.ƀmt,delta:t}),o.ƀkm.trigger({time:this.ƀmt,delta:t}),o.ƀg.trigger({time:this.ƀmt,delta:t}));}static get lastDelta(){return this.ƀgs}static{this.ƀgs=0;}};P.onHardReset.subscribe(()=>{w.ƀah.clear(),w.ƀkm.clear(),w.ƀg.clear(),w.ƀnd=void 0,w.ƀmt=0;}).attachToRoot();function u(){return function(o){R.ƀho.set(o,{paramtypes:R.ƀex(o)});}}h(u,"ServiceDecorator");var R=class o{static{h(this,"Service");}static{this.ƀho=new WeakMap;}static{this.ƀkt=new Map;}static get(t){let e=this.ƀkt.get(t);if(!e){let i=o.ƀho.get(t);if(!i)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let s=this.ƀkg(i.paramtypes);e=new t(...s),this.ƀkt.set(t,e);}return e}static ƀex(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 ƀkg(t){return t.map(i=>{if(i&&o.ƀho.has(i))return this.get(i);throw new Error(`Injected parameter has to be decorated with @ServiceDecorator(), class: "${i.name}"`)})}};P.onHardReset.subscribe(()=>{R.ƀkt=new Map;}).attachToRoot();function ct(o){return function(t){let e=R.ƀex(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=R.ƀkg(e);i.some(r=>r===void 0)&&console.error(i,e,t.name);let s=new t(...i);Ee(o,s);}}}h(ct,"ControllerDecorator");var D=class o{static{h(this,"EntityStoreHelper");}static{this.ƀbd=new Map;}static{this.ƀkd=new Set;}static registerEntityClass(t){this.ƀkd.add(t),this.ƀbd.set(t.id,new Map);}static registerEntity(t){let e=this.ƀbd.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.ƀbd.get(i)?.delete(e);}static getEntity(t,e){return this.ƀbd.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.ƀbd.get(t.id);return Array.from(e.values())}};P.onHardReset.subscribe(()=>{D.ƀbd.clear();for(let o of D.ƀkd)D.ƀbd.set(o.id,new Map);}).attachToRoot();function pi(o){return function(t){Q.ƀho.set(t,{paramtypes:R.ƀex(t),viewInstances:new Map,entity:o.entity}),dt.registerView(t,o.entity);}}h(pi,"ViewDecorator");var Q=class o extends actionsLib.IDAttachable{static{h(this,"View");}static{this.ƀho=new WeakMap;}static getInstance(t){let e=o.ƀho.get(this);if(!(!e||!e.entity.validateID(t)))return e.viewInstances.get(t)}static getInstanceOrFail(t){let e=o.ƀho.get(this);if(!e||!e.entity.validateID(t))throw new Error(`View: getInstance is called with entity id: "${t}", that is not belonging to the class: "${e?.entity}"`);let i=e.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.update=()=>{},this.attachToRoot(),this.ƀdn=dt.entityID,this.ƀfd().set(this.ƀdn,this);}destroy(){this.destroyed||(super.destroy(),this.ƀfd().delete(this.ƀdn));}ƀfd(){let t=o.ƀho.get(this.constructor);if(!t)throw new Error(`View: view class is not decorated by @ViewDecorator(), class: "${this.constructor.name}"`);return t.viewInstances}};P.onHardReset.subscribe(()=>{Q.ƀho=new WeakMap;}).attachToRoot();var dt=class o{static{h(this,"EntityViewsHelper");}static{this.ƀnn=new Map;}static registerView(t,e){o.ƀnn.has(e)||o.ƀnn.set(e,[]);let i=o.ƀnn.get(e);i&&i.push(t),D.getEntities(e).forEach(r=>{this.ƀcq(r,t);});}static ƀcq(t,e){try{let i=Q.ƀho.get(e);if(!i)throw new Error(`View: view class is not decorated by @ViewDecorator(), class: "${e.name}"`);let s=R.ƀkg(i.paramtypes.slice(1));o.entityID=t.id;let r=new e(t,...s);t.destroyed?r.destroy():t.ƀnm.ƀno.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀdm=t,this.ƀno=[];}createViews(){if(!this.ƀdm.destroyed){let t=o.ƀnn.get(this.ƀdm.constructor);t&&t.forEach(e=>{o.ƀcq(this.ƀdm,e);});}}updateViews(t,e){for(let i=0;i<this.ƀno.length;i++){let s=this.ƀno[i];s.destroyed||s.update(t,e);}}destroyViews(){this.ƀno.forEach(t=>{t.destroy();});}};P.onHardReset.subscribe(()=>{dt.ƀnn=new Map;}).attachToRoot();function Ot(){return function(o){D.registerEntityClass(o);}}h(Ot,"EntityDecorator");var q=class o extends actionsLib.IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return D.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=D.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return D.getEntities(this)}static{this.ƀgg=new Set;}static{this.ƀiv=[];}static{this.ƀgo=false;}static{this.ƀnf=false;}static{P.onHardReset.subscribe(()=>{o.ƀgg=new Set,o.ƀiv=[],o.ƀgo=false,o.ƀnf=false;}).attachToRoot();}static ƀnb(t,e){o.ƀgo=true;for(let i of o.ƀgg)try{i.ƀna(t,e),i.ƀnm.updateViews(t,e);}catch(s){console.error("Entity update error: ",s);}if(o.ƀgo=false,o.ƀiv.length>0){for(let i of o.ƀiv)i.destroyed||o.ƀgg.add(i);o.ƀiv.length=0;}}constructor(){super(),this.ƀnm=new dt(this),D.registerEntity(this),o.ƀgo?o.ƀiv.push(this):o.ƀgg.add(this),o.ƀnf||(o.ƀnf=true,w.sceneUpdateAction.subscribe(t=>o.ƀnb(t.time,t.delta)).attachToRoot());}destroy(){this.destroyed||(this.ƀnm.destroyViews(),D.unregisterEntity(this.constructor,this.id),o.ƀgg.delete(this),super.destroy());}attach(t){return super.attach(t),this.ƀnm.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀnm.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀnm.createViews(),this}ƀna(t,e){}};var mt=class o extends q{static{h(this,"SingletonEntity");}static{this.ƀcr=new WeakMap;}static ƀel(t){let e=o.ƀcr.get(t);return e||(e=new actionsLib.SingleAction,o.ƀcr.set(t,e)),e}static ƀmz(t){o.ƀcr.delete(t);}static getInstanceAsync(){let t=D.getSingleton(this);return t&&!t.destroyed?actionsLib.SingleEvent.instant(t):o.ƀel(this).toSingleEvent()}static continuesSubscription(){let t=h((e,i)=>{this.getInstanceAsync().tap(r=>{e({type:"open",value:r}),r.onDestroy().tap(()=>{e({type:"close",value:r}),t(e,i);}).attach(i);}).attach(i);},"subscribe");return actionsLib.Sequence.create((e,i)=>t(e,i.attachable))}static getInstance(){return D.getSingleton(this)}static getInstanceOrFail(){return D.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.ƀmz(this.constructor)).attachToRoot(),o.ƀel(this.constructor).resolve(this);}};P.onHardReset.subscribe(()=>{mt.ƀcr=new WeakMap;}).attachToRoot();function Yr(){return function(o){return _t.ƀho.set(o,{paramtypes:R.ƀex(o)}),o}}h(Yr,"SceneDecorator");var _t=class o extends actionsLib.IDAttachable{static{h(this,"Scene");}static{this.ƀho=new WeakMap;}static{this.ƀgj=new actionsLib.Variable(false);}static{this.isTransitioning=this.ƀgj.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.ƀm("cancel"):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.ƀgj.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=o.ƀho.get(this);if(!e)throw new Error(`Scene: scene class is not decorated by @SceneDecorator(), class: "${this.name}"`);let i=t[0];o.ƀgj.value=true;let s=R.ƀkg(e.paramtypes),r=new this(...s).attachToRoot();return o.ƀb.set(r),r.init(i).map(()=>(o.ƀgj.value=false,r)).chainToRoot()}constructor(){super(),this.ƀia=new actionsLib.SingleAction,this.onClose=this.ƀia.notifier,w.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.ƀgj.value)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");o.ƀgj.value=true;let e=t[0];return this.ƀm(e).map(()=>(this.ƀia.resolve(e),e)).chainToRoot()}ƀm(t){return this.prepareToClose(t).tap(()=>{super.destroy(),o.ƀb.set(void 0),o.ƀgj.value=false;}).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};P.onHardReset.subscribe(()=>{_t.ƀho=new WeakMap,_t.ƀb.set(void 0);}).attachToRoot();var U=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}},Xr=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return U.lineer(t)}},Kr=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return U.easeIn(t)}},Zr=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return U.easeOut(t)}},Qr=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return U.easeInOut(t)}},qr=class{static{h(this,"AnimationEaseInCubic");}start(){}multiplierFunction(t){return U.easeInCubic(t)}},ts=class{static{h(this,"AnimationEaseOutCubic");}start(){}multiplierFunction(t){return U.easeOutCubic(t)}},es=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return U.easeInOutCubic(t)}},is=class{static{h(this,"AnimationBlink");}start(){}multiplierFunction(t){return U.blink(t)}},Ki=class{static{h(this,"AnimationFlicker");}start(){this.ƀmu=new Array(10).fill(0),helpersLib.Random.integerBetween(0,9),this.ƀmu[helpersLib.Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(helpersLib.Random.integerBetween(0,9),this.ƀmu[helpersLib.Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(helpersLib.Random.integerBetween(0,9),this.ƀmu[helpersLib.Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀmu[e]}},b=class{static{h(this,"Animations");}static{this.lineer=new Xr;}static{this.easeIn=new Kr;}static{this.easeOut=new Zr;}static{this.easeInOut=new Qr;}static{this.easeInCubic=new qr;}static{this.easeOutCubic=new ts;}static{this.easeInOutCubic=new es;}static{this.blink=new is;}};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 O=class o{static{h(this,"Animator");}static{this.ƀo=new WeakMap;}static ƀee(t){let e=o.ƀo.get(t);return e||(e=new helpersLib.MapToWeakRefs,o.ƀo.set(t,e)),e}get animating(){return this.ƀij!==void 0}get target(){return this.ƀmj}get value(){return this.ƀnh||(this.ƀnh=new actionsLib.Variable(this.ƀmj)),this.ƀnh.notifier}get paused(){return this.ƀit!==void 0}set paused(t){this.ƀit=t?true:void 0;}constructor(t,e,i){this.ƀgk=false,this.ƀlh=false,this.ƀmj=t,this.ƀil={duration:200,animation:b.lineer,reAnimateHandling:exports.ReAnimateHandlingType.ThrowError,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState,...i},this.ƀp=helpersLib.Comparator.isArray(e)?e:[e],this.ƀhb(t,this.ƀp);}animate(t,e){let i={...this.ƀil,...e},s=this.ƀij;if(this.ƀij)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.ƀkv(i.completionHandling,this.ƀij.ƀjr,true);break;default:{throw new Error}}return actionsLib.SingleEvent.create(n=>{this.ƀgk&&(this.ƀlh=true);let a={};for(let c of this.ƀp)a[c]={ƀlx:this.ƀmj[c],ƀmm:t[c]};let l={ƀdg:i.duration,ƀdh:0,ƀjr:a,ƀbo:i.completionHandling,ƀq:i.animation,ƀbn:n};if(l.ƀbo!==exports.AnimationsCompletionHandlingType.Loop&&this.ƀgh(l)){this.ƀij=void 0,n(),s?.ƀbn(),this.ƀbe();return}return l.ƀq.start(),this.ƀij=l,this.ƀdl(),s?.ƀbn(),()=>{this.ƀij===l&&(this.ƀmj instanceof actionsLib.Attachable&&this.ƀmj.destroyed||this.ƀkv(l.ƀbo,l.ƀjr,true),this.ƀij=void 0,this.ƀbe());}}).notIdle()}set(t){this.ƀnu(e=>t[e]),this.ƀij?.ƀbn();}completeAnimation(t){if(this.ƀij){t=t??this.ƀij.ƀbo,this.ƀkv(t,this.ƀij.ƀjr,true);let e=this.ƀij.ƀbn;this.ƀij=void 0,e();}}ƀdl(){this.ƀnc||(this.ƀnc=w.beforeSceneUpdateAction.subscribe(t=>{if(!this.ƀit){this.ƀgk=true;try{let e=this.ƀij;if(!e)return;if(e.ƀdh+=t.delta,e.ƀdh>=e.ƀdg)if(e.ƀbo===exports.AnimationsCompletionHandlingType.Loop)e.ƀdh%=e.ƀdg,e.ƀq.start();else {this.ƀkv(e.ƀbo,e.ƀjr,!1),this.ƀij=void 0,e.ƀbn(),this.ƀbe();return}let i=e.ƀq.multiplierFunction(e.ƀdh/e.ƀdg);this.ƀnv(e.ƀjr,i);}finally{this.ƀgk=false,this.ƀlh&&(this.ƀlh=false,this.ƀcy(),this.ƀdl());}}}).attachToRoot());}ƀgh(t){return this.ƀp.every(e=>this.ƀmj[e]===t.ƀjr[e].ƀmm)}ƀkv(t,e,i){switch(t){case exports.AnimationsCompletionHandlingType.ReturnToOriginal:case exports.AnimationsCompletionHandlingType.Loop:this.ƀnu(s=>e[s].ƀlx);break;case exports.AnimationsCompletionHandlingType.JumpToEnd:this.ƀnu(s=>e[s].ƀmm);break;case exports.AnimationsCompletionHandlingType.StayInCurrentState:i||this.ƀnu(s=>e[s].ƀmm);break;default:{throw new Error}}}ƀnu(t){let e=false;for(let i of this.ƀp){let s=t(i);this.ƀmj[i]!==s&&(e=true,this.ƀmj[i]=s);}e&&this.ƀnh?.set(this.ƀmj);}ƀnv(t,e){let i=false;for(let s=0;s<this.ƀp.length;s++){let r=this.ƀp[s],n=t[r],a=(n.ƀmm-n.ƀlx)*e+n.ƀlx;this.ƀmj[r]!==a&&(i=true,this.ƀmj[r]=a);}i&&this.ƀnh?.set(this.ƀmj);}ƀbe(){this.ƀij||this.ƀcy();}ƀcy(){this.ƀnc?.destroy(),this.ƀnc=void 0;}ƀhb(t,e){let i=o.ƀee(t);for(let s of e){if(i.has(s))throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(t,void 0,2)}", Property: "${s}"`);i.set(s,this);}}};var yt=class extends actionsLib.IDAttachable{static{h(this,"DisplayObjectAttributes");}constructor(t){super(),this.ƀji=t,this.ƀhp=false,this.ƀdv=false,this.ƀkk=1,this.ƀaa=1;}setPosition(t,e){return e?.holdFrom&&(t=t.subtract(this.ƀeq(e.holdFrom))),e?.round!==false&&(t=t.round({rollHalfsDown:true})),this.position=t,this}get position(){return new helpersLib.Vector(this.ƀji.x,this.ƀji.y)}set position(t){this.ƀji.x=t.x,this.ƀji.y=t.y;}get x(){return this.ƀji.x}set x(t){this.ƀji.x=t;}get y(){return this.ƀji.y}set y(t){this.ƀji.y=t;}setRotation(t){return this.rotation=t,this}get rotation(){return new helpersLib.Radian(this.ƀji.rotation)}set rotation(t){this.ƀji.rotation=t.value;}get rotationValue(){return this.ƀji.rotation}set rotationValue(t){this.ƀji.rotation=t;}setAlpha(t){return this.alpha=t,this}get alpha(){return this.ƀji.alpha}set alpha(t){this.ƀji.alpha=t;}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀhp}set mirror(t){this.ƀhp=t,this.ƀne();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdv}set flip(t){this.ƀdv=t,this.ƀne();}setScale(t){return this.scale=t,this}get scale(){return this.ƀkk}set scale(t){this.ƀkk=t,this.ƀne();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀaa}set aspectRatio(t){this.ƀaa=t,this.ƀne();}ƀne(){let t=this.ƀkk,e=this.ƀkk;this.ƀaa<1?t*=this.ƀaa:this.ƀaa>1&&(e/=this.ƀaa),this.ƀhp&&(t*=-1),this.ƀdv&&(e*=-1),this.ƀx(t,e);}};var k=2;var Ce=class{static{h(this,"GaussianValuesHelper");}static ƀeb(t,e){let i=e*e,s=1/(helpersLib.PI_360*i),r=-(t*t)/(2*i);return s*Math.exp(r)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),s=.005*i,r=helpersLib.NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<s)i-=l*2;else return true}),n=1/i,a=r.map(l=>l*n);return this.ƀbz(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(s=>this.ƀeb(s,t*.4)),i=e.reduce((s,r)=>s+r,0);return i=i*2-e[0],e=e.map(s=>s/i),this.ƀbz(e)}}static ƀbz(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let s=t[i]+t[i+1],r=i+t[i+1]/s;e.push({offset:r,multiplier:s});}if(t.length%2===0){let i=t[t.length-1],s=t.length-1;e.push({offset:s,multiplier:i});}return e}};var Qi=class qi extends W__namespace.Filter{static{h(this,"BlurFilterPass");}static ƀem(t,e){let i=e?"uInputPixel.z":"uInputPixel.w",s=`
2
2
  in vec2 vTextureCoord;
3
3
  out vec4 finalColor;
4
4
 
@@ -12,13 +12,13 @@
12
12
 
13
13
  void main() {
14
14
  finalColor = texture(uTexture, vTextureCoord) * ${helpersLib.NumberHelper.toFloatString(t[0].multiplier)};
15
- float offset;`;for(let r=1;r<t.length;r++){let o=`vec2(${e?"offset, 0.0":"0.0, offset"})`;s+=`
15
+ float offset;`;for(let r=1;r<t.length;r++){let n=`vec2(${e?"offset, 0.0":"0.0, offset"})`;s+=`
16
16
 
17
17
  offset = ${helpersLib.NumberHelper.toFloatString(t[r].offset)} * ${i};
18
- iterate(${o}, ${helpersLib.NumberHelper.toFloatString(t[r].multiplier)}, finalColor);
19
- iterate(${o} * -1.0, ${helpersLib.NumberHelper.toFloatString(t[r].multiplier)}, finalColor);`;}return s+=`
18
+ iterate(${n}, ${helpersLib.NumberHelper.toFloatString(t[r].multiplier)}, finalColor);
19
+ iterate(${n} * -1.0, ${helpersLib.NumberHelper.toFloatString(t[r].multiplier)}, finalColor);`;}return s+=`
20
20
  }
21
- `,s}constructor(t,e){super({glProgram:W__namespace.GlProgram.from({vertex:W__namespace.defaultFilterVert,fragment:Ui.ƀeg(Se.getValuesForLinearSamplingGauss(t),e)}),resolution:k});}},Nt=class extends W__namespace.Filter{static{h(this,"BlurFilter");}constructor(t=new helpersLib.Vector(2,2)){if(super({resolution:k,compatibleRenderers:W__namespace.RendererType.WEBGL}),this.ƀln=t,this.ƀln=t.multiplyNumber(k).floor(),this.ƀln.x<0||this.ƀln.y<0)throw new Error("BlurFilterLinearSampling: Strength * Resolution must be greater than 0");if(this.ƀln.x>100||this.ƀln.y>100)throw new Error("BlurFilterLinearSampling: Strength * Resolution cannot be higher than 100");this.ƀfq=new ji(this.ƀln.x,true),this.ƀmm=new ji(this.ƀln.y,false),this.padding=Math.max(this.ƀln.x,this.ƀln.y);}apply(t,e,i,s){let r=W__namespace.TexturePool.getSameSizeTexture(e);this.ƀmm.apply(t,e,r,true),this.ƀfq.apply(t,r,i,s),W__namespace.TexturePool.returnTexture(r);}get blendMode(){return this.ƀfq.blendMode}set blendMode(t){this.ƀfq&&(this.ƀfq.blendMode=t,this.ƀmm.blendMode=t);}};var Ee=class{static{h(this,"Filters");}get red(){return this.ƀjk}set red(t){this.ƀjk=t,this.ƀjl();}get green(){return this.ƀfc}set green(t){this.ƀfc=t,this.ƀjl();}get blue(){return this.ƀai}set blue(t){this.ƀai=t,this.ƀjl();}get brightness(){return this.ƀan}set brightness(t){this.ƀan=t,this.ƀjl();}get contrast(){return this.ƀbr}set contrast(t){this.ƀbr=t,this.ƀjl();}get blur(){return this.ƀaj}set blur(t){let e=helpersLib.Comparator.isNumber(t)?new helpersLib.Vector(t,t):t;(this.ƀaj&&e&&!this.ƀaj.isEqual(e)||this.ƀaj&&!e||!this.ƀaj&&e)&&(this.ƀaj=e,this.ƀak&&(this.ƀak.destroy(),this.ƀak=void 0),e&&(this.ƀak=new Nt(e),this.ƀhv()));}constructor(t){this.ƀbn=t,this.ƀjk=1,this.ƀfc=1,this.ƀai=1,this.ƀan=1,this.ƀbr=1,this.ƀhv();}removeColorFilter(){this.ƀbg?.destroy(),this.ƀbg=void 0,this.ƀhv();}ƀjl(){this.ƀjk===1&&this.ƀfc===1&&this.ƀai===1&&this.ƀan===1&&this.ƀbr===1?this.ƀbg&&(this.ƀbg.destroy(),this.ƀbg=void 0,this.ƀhv()):(this.ƀbg||(this.ƀbg=new W__namespace.ColorMatrixFilter,this.ƀbg.resolution=k,this.ƀhv()),this.ƀbg.matrix=[this.ƀjk*this.ƀbr,0,0,0,this.ƀan-1,0,this.ƀfc*this.ƀbr,0,0,this.ƀan-1,0,0,this.ƀai*this.ƀbr,0,this.ƀan-1,0,0,0,1,0]);}ƀhv(){let t=[];this.ƀak&&t.push(this.ƀak),this.ƀbg&&t.push(this.ƀbg),this.ƀbn.filters=t;}};exports.ContainerEventType=void 0;(function(n){n.Click="click",n.MouseOver="mouseover",n.MouseOut="mouseout",n.PointerDown="pointerdown",n.PointerUp="pointerup",n.PointerUpOutside="pointerupoutside",n.PointerMove="pointermove",n.PointerCancel="pointercancel",n.PointerOver="pointerover",n.PointerOut="pointerout",n.PointerEnter="pointerenter",n.PointerLeave="pointerleave",n.Added="added",n.Removed="removed",n.Update="update",n.Change="change",n.Wheel="wheel";})(exports.ContainerEventType||(exports.ContainerEventType={}));exports.Cursor=void 0;(function(n){n.Default="default",n.Pointer="pointer";})(exports.Cursor||(exports.Cursor={}));var d=class n extends Pe{static{h(this,"Container");}static{this.allContainers=new Map;}constructor(t=new W__namespace.Container){super(t),this.addChildTo=this,this.defaultChildOptions={addUnder:false,cropOverflowingParts:false},this.ƀiv=t,n.allContainers.set(this.id,this),this.filters=new Ee(this.ƀiv);}destroy(){this.destroyed||(super.destroy(),n.allContainers.delete(this.id),!this.ƀiv.destroyed&&this.ƀiv.destroy());}ƀu(t,e){this.ƀiv.scale.set(t,e);}ƀem(t){let e=this.ƀiv.getLocalBounds(),i=new helpersLib.Vector(this.ƀiv.scale.x,this.ƀiv.scale.y),s=new helpersLib.Vector(e.x,e.y).multiply(i),r=new helpersLib.Vector(e.width,e.height).multiply(i);return s.add(r.multiply(t))}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new helpersLib.Vector(this.ƀiv.width,this.ƀiv.height)}setSize(t){return this.ƀiv.width=t.x,this.ƀiv.height=t.y,this}setLayout(t={}){return this.ƀiv.layout={isLeaf:true,width:"intrinsic",height:"intrinsic",...t},this}on(t){return actionsLib.Sequence.create(e=>{let i=h(s=>{if(t===exports.ContainerEventType.Wheel){let o=s.deltaY;e({deltaY:o});}else e(void 0);},"handle");return this.ƀiv.on(t,i),()=>this.ƀiv.off(t,i)}).notIdle()}setZIndex(t){return this.zIndex=t,this}get zIndex(){return this.ƀiv.zIndex}set zIndex(t){this.ƀiv.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new helpersLib.Radian(this.ƀiv.skew.x)}set skewX(t){this.ƀiv.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new helpersLib.Radian(this.ƀiv.skew.y)}set skewY(t){this.ƀiv.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.ƀiv.sortableChildren}set sortableChildren(t){this.ƀiv.sortableChildren=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.ƀiv.eventMode==="dynamic"}set interactive(t){t?this.ƀiv.eventMode="dynamic":this.ƀiv.eventMode="none";}setRenderGroup(t=true){return this.ƀiv.isRenderGroup=t,this}setCursor(t){return this.cursor=t,this}get cursor(){return this.ƀiv.cursor}set cursor(t){this.ƀiv.cursor=t;}getMask(){throw new Error("Container: mask is not available!")}setMask(t){return t?(this.ƀiv.addChild(t.ƀiv),this.ƀiv.mask=t.getMask(),this.ƀgv=t):(this.ƀgv&&this.ƀiv.removeChild(this.ƀgv.ƀiv),this.ƀiv.mask=null),this}hitTest(t){if(this.ƀiv.parent)if(this.ƀiv.hitArea){let e=this.ƀiv.toLocal(t);return this.ƀiv.hitArea.contains(e.x,e.y)}else return this.ƀiv.getBounds().containsPoint(t.x,t.y);else return false}get boundingBox(){let t=this.ƀiv.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 this.ƀiv.measurable=!t,this}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=n.allContainers.get(t),!i)throw new Error(`Container: parent not found! id: ${t}`)}else i=t;let s={addUnder:i.defaultChildOptions.addUnder,cropOverflowingParts:i.defaultChildOptions.cropOverflowingParts,...e};if(s.addUnder?i.addChildTo.ƀiv.addChildAt(this.ƀiv,0):i.addChildTo.ƀiv.addChild(this.ƀiv),s.cropOverflowingParts)if(i)this.ƀiv.mask=i.getBoundingMask().pixiSprite;else throw new Error("Container: cropOverflowingParts can only be used with Container parent!");return this}};var jt=class extends actionsLib.Attachable{static{h(this,"StateAnimation");}onStateChange(t){return this.ƀhx.subscribe(e=>t(e.item,e.nextItem)).attach(this),this}onValueChange(t){return this.ƀhz.subscribe(e=>t(e)).attach(this),this}get state(){return {value:this.ƀk.value,item:this.ƀgg,nextItem:this.ƀhp,queuedItem:this.ƀjg,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.ƀhx=new actionsLib.Action,this.ƀhz=new actionsLib.Action,this.ƀic={duration:500,animation:b.lineer,...t},this.ƀp=new O(this.ƀk,"value",{duration:this.ƀic.duration,animation:this.ƀic.animation,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀp.value.subscribe(()=>{this.ƀk.value!==1&&this.ƀk.value!==0&&this.ƀhz.trigger(this.ƀk.value);}).attach(this);}setItem(t,e){if(this.ƀgg===void 0)this.ƀgg=t,this.ƀhx.trigger({item:this.ƀgg,nextItem:this.ƀhp}),this.ƀhz.trigger(this.ƀk.value);else if(e?.instant)this.ƀp.completeAnimation(),this.ƀo="idle",this.ƀgg=t,this.ƀhp=void 0,this.ƀjg=void 0,this.ƀk.value=0,this.ƀhx.trigger({item:this.ƀgg,nextItem:this.ƀhp}),this.ƀhz.trigger(this.ƀk.value);else switch(this.ƀo){case "idle":t!==this.ƀgg&&(this.ƀo="transitioning",this.ƀhp=t,this.ƀk.value=0,this.ƀhx.trigger({item:this.ƀgg,nextItem:this.ƀhp}),this.ƀhz.trigger(this.ƀk.value),this.ƀp.animate({value:1}).tap(()=>this.ƀht()).attach(this));break;case "transitioning":t===this.ƀgg?(this.ƀjg=void 0,this.ƀo="reverting",this.ƀp.animate({value:0},{duration:this.ƀk.value*this.ƀic.duration}).tap(()=>this.ƀht()).attach(this)):t===this.ƀhp?this.ƀjg=void 0:this.ƀjg=t;break;case "reverting":t===this.ƀhp?(this.ƀjg=void 0,this.ƀo="transitioning",this.ƀp.animate({value:1},{duration:(1-this.ƀk.value)*this.ƀic.duration}).tap(()=>this.ƀht()).attach(this)):t===this.ƀgg?this.ƀjg=void 0:this.ƀjg=t;break;default:{this.ƀo;throw new Error}}}ƀht(){switch(this.ƀo){case "transitioning":this.ƀk.value===1&&(this.ƀk.value=0,this.ƀjg!==void 0?(this.ƀo="transitioning",this.ƀgg=this.ƀhp,this.ƀhp=this.ƀjg,this.ƀjg=void 0,this.ƀhx.trigger({item:this.ƀgg,nextItem:this.ƀhp}),this.ƀp.animate({value:1}).tap(()=>this.ƀht()).attach(this)):(this.ƀo="idle",this.ƀgg=this.ƀhp,this.ƀhp=void 0,this.ƀhx.trigger({item:this.ƀgg,nextItem:this.ƀhp})),this.ƀhz.trigger(this.ƀk.value));break;case "reverting":if(this.ƀgg===void 0)throw new Error("StateAnimation: item must be defined when reverting!");this.ƀk.value===0&&(this.ƀjg!==void 0?(this.ƀo="transitioning",this.ƀhp=this.ƀjg,this.ƀjg=void 0,this.ƀk.value=0,this.ƀhx.trigger({item:this.ƀgg,nextItem:this.ƀhp}),this.ƀp.animate({value:1}).tap(()=>this.ƀht()).attach(this)):(this.ƀo="idle",this.ƀhp=void 0,this.ƀk.value=0,this.ƀhx.trigger({item:this.ƀgg,nextItem:this.ƀhp})),this.ƀhz.trigger(this.ƀk.value));break;case "idle":break;default:{this.ƀo;throw new Error}}}};var J=Symbol("empty"),Re=class extends actionsLib.Attachable{static{h(this,"ThroughEmptyStateAnimation");}onStateChange(t){return this.ƀhx.subscribe(e=>t(e)).attach(this),this}onValueChange(t){return this.ƀhz.subscribe(e=>t(e)).attach(this),this}get state(){let t=this.ƀlj.state.queuedItem;return {value:this.ƀmj,item:this.ƀgg,nextItem:this.ƀo==="appearing"?this.ƀgg:void 0,queuedItem:t===J?void 0:t,animationState:this.ƀo}}constructor(t){super(),this.ƀmj=0,this.ƀo="hidden",this.ƀhx=new actionsLib.Action,this.ƀhz=new actionsLib.Action,this.ƀlj=new jt(t).onStateChange((e,i)=>this.ƀfe(e,i)).onValueChange(e=>this.ƀfj(e)).attach(this),this.ƀlj.setItem(J);}setItem(t,e){if(e?.instant){this.ƀo=t!==void 0?"appearing":"disappearing",this.ƀlj.setItem(t??J,{instant:true});return}switch(this.ƀo){case "hidden":t!==void 0&&(this.ƀo="appearing",this.ƀlj.setItem(t));break;case "visible":t===void 0?(this.ƀo="disappearing",this.ƀlj.setItem(J)):t!==this.ƀgg&&(this.ƀo="disappearToChange",this.ƀlj.setItem(J),this.ƀlj.setItem(t));break;case "appearing":t===void 0?(this.ƀo="disappearing",this.ƀlj.setItem(J)):t!==this.ƀgg&&(this.ƀmj>0?(this.ƀo="disappearToChange",this.ƀlj.setItem(J),this.ƀlj.setItem(t)):(this.ƀlj.setItem(J,{instant:true}),this.ƀlj.setItem(t)));break;case "disappearing":t!==void 0&&t===this.ƀgg?(this.ƀo="appearing",this.ƀlj.setItem(t)):t!==void 0&&(this.ƀo="disappearToChange",this.ƀlj.setItem(t));break;case "disappearToChange":t===void 0?(this.ƀo="disappearing",this.ƀlj.setItem(J)):t===this.ƀgg?(this.ƀo="appearing",this.ƀlj.setItem(t)):this.ƀlj.setItem(t);break;default:{this.ƀo;throw new Error}}}ƀfe(t,e){if(e!==void 0){e!==J&&e!==this.ƀgg&&(this.ƀgg=e,this.ƀo="appearing",this.ƀhx.trigger(this.ƀgg),this.ƀmj!==0&&(this.ƀmj=0,this.ƀhz.trigger(0)));return}if(t===J)this.ƀo==="disappearing"&&(this.ƀgg=void 0,this.ƀo="hidden",this.ƀmj=0,this.ƀhx.trigger(void 0),this.ƀhz.trigger(0));else {let i=t!==this.ƀgg;this.ƀgg=t,this.ƀo="visible",i&&this.ƀhx.trigger(this.ƀgg),(i||this.ƀmj!==1)&&(this.ƀmj=1,this.ƀhz.trigger(1));}}ƀfj(t){let e=this.ƀlj.state.nextItem;if(e===void 0)return;let i=e===J?1-t:t;i!==this.ƀmj&&(this.ƀmj=i,i!==0&&i!==1&&this.ƀhz.trigger(i));}};var Yi=class extends d{static{h(this,"FadeInContent");}constructor(t,e){super(),this.ƀca=t;let i={duration:200,animation:b.easeInOut,...e};this.alpha=0,this.ƀlj=new Re(i).onStateChange(s=>{this.ƀbo?.destroy(),this.ƀbo=void 0,s!==void 0&&(this.ƀbo=new d().displayParent(this).attach(this),this.ƀca({state:s,container:this.ƀbo}));}).onValueChange(s=>{this.alpha=s;}).attach(this);}setState(t,e){return this.ƀlj.setItem(t,e),this}};var G=class{static{h(this,"GameAssets");}static{this.ƀjs=new Map;}static{this.ƀq=0;}static getAsset(t){let e=this.ƀjs.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.ƀjs.set(i,t),i}static destroyAsset(t){let e=this.ƀjs.get(t);e&&(e.source.removeAllListeners("change"),e.destroy(true),this.ƀjs.delete(t));}static async loadGameAssets(t){let e=new Map,i=[];t.forEach(r=>{if(!helpersLib.Comparator.isString(r.url))throw new Error(`GameAssets: source url should be a string: ${r.url}`);let o=e.get(r.url),a=r.id;o?o.push(a):(e.set(r.url,[a]),i.push({url:r.url,callback:h(l=>{if(l instanceof W__namespace.Texture&&(l.id=a),o=e.get(r.url),o)o.forEach(c=>{this.ƀjs.set(c,l);});else throw new Error(`GameAssets: unexpected error, nameGroup is not found! "./"! ${r}`)},"callback")}));});let s=performance.now();return Promise.all(i.map(r=>W__namespace.Assets.load(r.url))).then(r=>{let o=performance.now();console.info("Asset load completed in: ",Math.round(o-s)/1e3," seconds"),r.forEach((a,l)=>{i[l].callback(a);});}).catch(r=>{throw new Error(`GameAssets: during asset loading, an error occured: ${r}`)})}};var Ae=class n extends W__namespace.Filter{static{h(this,"ExpandWithColorFilter");}static ƀeg(t){let e=`
21
+ `,s}constructor(t,e){super({glProgram:W__namespace.GlProgram.from({vertex:W__namespace.defaultFilterVert,fragment:qi.ƀem(Ce.getValuesForLinearSamplingGauss(t),e)}),resolution:k});}},jt=class extends W__namespace.Filter{static{h(this,"BlurFilter");}constructor(t=new helpersLib.Vector(2,2)){if(super({resolution:k,compatibleRenderers:W__namespace.RendererType.WEBGL}),this.ƀmh=t,this.ƀmh=t.multiplyNumber(k).floor(),this.ƀmh.x<0||this.ƀmh.y<0)throw new Error("BlurFilterLinearSampling: Strength * Resolution must be greater than 0");if(this.ƀmh.x>100||this.ƀmh.y>100)throw new Error("BlurFilterLinearSampling: Strength * Resolution cannot be higher than 100");this.ƀfu=new Qi(this.ƀmh.x,true),this.ƀnk=new Qi(this.ƀmh.y,false),this.padding=Math.max(this.ƀmh.x,this.ƀmh.y);}apply(t,e,i,s){let r=W__namespace.TexturePool.getSameSizeTexture(e);this.ƀnk.apply(t,e,r,true),this.ƀfu.apply(t,r,i,s),W__namespace.TexturePool.returnTexture(r);}get blendMode(){return this.ƀfu.blendMode}set blendMode(t){this.ƀfu&&(this.ƀfu.blendMode=t,this.ƀnk.blendMode=t);}};var Ut=class{static{h(this,"Filters");}get red(){return this.ƀjx}set red(t){this.ƀjx=t,this.ƀjy();}get green(){return this.ƀfg}set green(t){this.ƀfg=t,this.ƀjy();}get blue(){return this.ƀal}set blue(t){this.ƀal=t,this.ƀjy();}get brightness(){return this.ƀaq}set brightness(t){this.ƀaq=t,this.ƀjy();}get contrast(){return this.ƀbu}set contrast(t){this.ƀbu=t,this.ƀjy();}get blur(){return this.ƀam}set blur(t){let e=helpersLib.Comparator.isNumber(t)?new helpersLib.Vector(t,t):t;(this.ƀam&&e&&!this.ƀam.isEqual(e)||this.ƀam&&!e||!this.ƀam&&e)&&(this.ƀam=e,this.ƀan&&(this.ƀan.destroy(),this.ƀan=void 0),e&&(this.ƀan=new jt(e),this.ƀie()));}constructor(t){this.ƀbq=t,this.ƀjx=1,this.ƀfg=1,this.ƀal=1,this.ƀaq=1,this.ƀbu=1,this.ƀie();}removeColorFilter(){this.ƀbj?.destroy(),this.ƀbj=void 0,this.ƀie();}ƀjy(){this.ƀjx===1&&this.ƀfg===1&&this.ƀal===1&&this.ƀaq===1&&this.ƀbu===1?this.ƀbj&&(this.ƀbj.destroy(),this.ƀbj=void 0,this.ƀie()):(this.ƀbj||(this.ƀbj=new W__namespace.ColorMatrixFilter,this.ƀbj.resolution=k,this.ƀie()),this.ƀbj.matrix=[this.ƀjx*this.ƀbu,0,0,0,this.ƀaq-1,0,this.ƀfg*this.ƀbu,0,0,this.ƀaq-1,0,0,this.ƀal*this.ƀbu,0,this.ƀaq-1,0,0,0,1,0]);}ƀie(){let t=[];this.ƀan&&t.push(this.ƀan),this.ƀbj&&t.push(this.ƀbj),this.ƀbq.filters=t;}};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 f=class o extends yt{static{h(this,"Container");}static{this.allContainers=new Map;}static ƀek(t){if(helpersLib.Comparator.isNumber(t)){let e=o.allContainers.get(t);if(!e)throw new Error(`Container: parent not found! id: ${t}`);return e}return t}constructor(t=new W__namespace.Container){super(t),this.addChildTo=this,this.ƀjh=t,o.allContainers.set(this.id,this),this.filters=new Ut(this.ƀjh);}destroy(){this.destroyed||(super.destroy(),o.allContainers.delete(this.id),!this.ƀjh.destroyed&&this.ƀjh.destroy());}ƀx(t,e){this.ƀjh.scale.set(t,e);}ƀeq(t){let e=this.ƀjh.getLocalBounds(),i=new helpersLib.Vector(this.ƀjh.scale.x,this.ƀjh.scale.y),s=new helpersLib.Vector(e.x,e.y).multiply(i),r=new helpersLib.Vector(e.width,e.height).multiply(i);return s.add(r.multiply(t))}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new helpersLib.Vector(this.ƀjh.width,this.ƀjh.height)}setSize(t){return this.ƀjh.width=t.x,this.ƀjh.height=t.y,this}setLayout(t={}){return this.ƀjh.layout={isLeaf:true,width:"intrinsic",height:"intrinsic",...t},this}on(t){return actionsLib.Sequence.create(e=>{let i=h(s=>{if(t===exports.ContainerEventType.Wheel){let n=s.deltaY;e({deltaY:n});}else e(void 0);},"handle");return this.ƀjh.on(t,i),()=>this.ƀjh.off(t,i)}).notIdle()}setZIndex(t){return this.zIndex=t,this}get zIndex(){return this.ƀjh.zIndex}set zIndex(t){this.ƀjh.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new helpersLib.Radian(this.ƀjh.skew.x)}set skewX(t){this.ƀjh.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new helpersLib.Radian(this.ƀjh.skew.y)}set skewY(t){this.ƀjh.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.ƀjh.sortableChildren}set sortableChildren(t){this.ƀjh.sortableChildren=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.ƀjh.eventMode==="dynamic"}set interactive(t){t?this.ƀjh.eventMode="dynamic":this.ƀjh.eventMode="none";}setRenderGroup(t=true){return this.ƀjh.isRenderGroup=t,this}setCursor(t){return this.cursor=t,this}get cursor(){return this.ƀjh.cursor}set cursor(t){this.ƀjh.cursor=t;}getMask(){throw new Error("Container: mask is not available!")}setMask(t){return t?(this.ƀjh.addChild(t.ƀjh),this.ƀjh.mask=t.getMask(),this.ƀhe=t):(this.ƀhe&&this.ƀjh.removeChild(this.ƀhe.ƀjh),this.ƀjh.mask=null),this}hitTest(t){if(this.ƀjh.parent)if(this.ƀjh.hitArea){let e=this.ƀjh.toLocal(t);return this.ƀjh.hitArea.contains(e.x,e.y)}else return this.ƀjh.getBounds().containsPoint(t.x,t.y);else return false}get boundingBox(){let t=this.ƀjh.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 this.ƀjh.measurable=!t,this}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){return o.ƀek(t).ƀe(this.ƀjh,e),this}ƀe(t,e){let i={addUnder:false,cropOverflowingParts:false,...e};i.addUnder?this.addChildTo.ƀjh.addChildAt(t,0):this.addChildTo.ƀjh.addChild(t),i.cropOverflowingParts&&(t.mask=this.getBoundingMask().pixiSprite);}};var kt=class extends actionsLib.Attachable{static{h(this,"StateAnimation");}onStateChange(t){return this.ƀig.subscribe(e=>t(e.item,e.nextItem)).attach(this),this}onValueChange(t){return this.ƀii.subscribe(e=>t(e)).attach(this),this}get state(){return {value:this.ƀn.value,item:this.ƀgl,nextItem:this.ƀhy,queuedItem:this.ƀjt,animationState:this.ƀr}}get paused(){return this.ƀs.paused}set paused(t){this.ƀs.paused=t;}constructor(t){super(),this.ƀn={value:0},this.ƀr="idle",this.ƀig=new actionsLib.Action,this.ƀii=new actionsLib.Action,this.ƀil={duration:500,animation:b.lineer,...t},this.ƀs=new O(this.ƀn,"value",{duration:this.ƀil.duration,animation:this.ƀil.animation,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀs.value.subscribe(()=>{this.ƀn.value!==1&&this.ƀn.value!==0&&this.ƀii.trigger(this.ƀn.value);}).attach(this);}setItem(t,e){if(this.ƀgl===void 0)this.ƀgl=t,this.ƀig.trigger({item:this.ƀgl,nextItem:this.ƀhy}),this.ƀii.trigger(this.ƀn.value);else if(e?.instant)this.ƀs.completeAnimation(),this.ƀr="idle",this.ƀgl=t,this.ƀhy=void 0,this.ƀjt=void 0,this.ƀn.value=0,this.ƀig.trigger({item:this.ƀgl,nextItem:this.ƀhy}),this.ƀii.trigger(this.ƀn.value);else switch(this.ƀr){case "idle":t!==this.ƀgl&&(this.ƀr="transitioning",this.ƀhy=t,this.ƀn.value=0,this.ƀig.trigger({item:this.ƀgl,nextItem:this.ƀhy}),this.ƀii.trigger(this.ƀn.value),this.ƀs.animate({value:1}).tap(()=>this.ƀic()).attach(this));break;case "transitioning":t===this.ƀgl?(this.ƀjt=void 0,this.ƀr="reverting",this.ƀs.animate({value:0},{duration:this.ƀn.value*this.ƀil.duration}).tap(()=>this.ƀic()).attach(this)):t===this.ƀhy?this.ƀjt=void 0:this.ƀjt=t;break;case "reverting":t===this.ƀhy?(this.ƀjt=void 0,this.ƀr="transitioning",this.ƀs.animate({value:1},{duration:(1-this.ƀn.value)*this.ƀil.duration}).tap(()=>this.ƀic()).attach(this)):t===this.ƀgl?this.ƀjt=void 0:this.ƀjt=t;break;default:{this.ƀr;throw new Error}}}ƀic(){switch(this.ƀr){case "transitioning":this.ƀn.value===1&&(this.ƀn.value=0,this.ƀjt!==void 0?(this.ƀr="transitioning",this.ƀgl=this.ƀhy,this.ƀhy=this.ƀjt,this.ƀjt=void 0,this.ƀig.trigger({item:this.ƀgl,nextItem:this.ƀhy}),this.ƀs.animate({value:1}).tap(()=>this.ƀic()).attach(this)):(this.ƀr="idle",this.ƀgl=this.ƀhy,this.ƀhy=void 0,this.ƀig.trigger({item:this.ƀgl,nextItem:this.ƀhy})),this.ƀii.trigger(this.ƀn.value));break;case "reverting":if(this.ƀgl===void 0)throw new Error("StateAnimation: item must be defined when reverting!");this.ƀn.value===0&&(this.ƀjt!==void 0?(this.ƀr="transitioning",this.ƀhy=this.ƀjt,this.ƀjt=void 0,this.ƀn.value=0,this.ƀig.trigger({item:this.ƀgl,nextItem:this.ƀhy}),this.ƀs.animate({value:1}).tap(()=>this.ƀic()).attach(this)):(this.ƀr="idle",this.ƀhy=void 0,this.ƀn.value=0,this.ƀig.trigger({item:this.ƀgl,nextItem:this.ƀhy})),this.ƀii.trigger(this.ƀn.value));break;case "idle":break;default:{this.ƀr;throw new Error}}}};var J=Symbol("empty"),Ae=class extends actionsLib.Attachable{static{h(this,"ThroughEmptyStateAnimation");}onStateChange(t){return this.ƀig.subscribe(e=>t(e)).attach(this),this}onValueChange(t){return this.ƀii.subscribe(e=>t(e)).attach(this),this}get state(){let t=this.ƀly.state.queuedItem;return {value:this.ƀnh,item:this.ƀgl,nextItem:this.ƀr==="appearing"?this.ƀgl:void 0,queuedItem:t===J?void 0:t,animationState:this.ƀr}}constructor(t){super(),this.ƀnh=0,this.ƀr="hidden",this.ƀig=new actionsLib.Action,this.ƀii=new actionsLib.Action,this.ƀly=new kt(t).onStateChange((e,i)=>this.ƀfi(e,i)).onValueChange(e=>this.ƀfn(e)).attach(this),this.ƀly.setItem(J);}setItem(t,e){if(e?.instant){this.ƀr=t!==void 0?"appearing":"disappearing",this.ƀly.setItem(t??J,{instant:true});return}switch(this.ƀr){case "hidden":t!==void 0&&(this.ƀr="appearing",this.ƀly.setItem(t));break;case "visible":t===void 0?(this.ƀr="disappearing",this.ƀly.setItem(J)):t!==this.ƀgl&&(this.ƀr="disappearToChange",this.ƀly.setItem(J),this.ƀly.setItem(t));break;case "appearing":t===void 0?(this.ƀr="disappearing",this.ƀly.setItem(J)):t!==this.ƀgl&&(this.ƀnh>0?(this.ƀr="disappearToChange",this.ƀly.setItem(J),this.ƀly.setItem(t)):(this.ƀly.setItem(J,{instant:true}),this.ƀly.setItem(t)));break;case "disappearing":t!==void 0&&t===this.ƀgl?(this.ƀr="appearing",this.ƀly.setItem(t)):t!==void 0&&(this.ƀr="disappearToChange",this.ƀly.setItem(t));break;case "disappearToChange":t===void 0?(this.ƀr="disappearing",this.ƀly.setItem(J)):t===this.ƀgl?(this.ƀr="appearing",this.ƀly.setItem(t)):this.ƀly.setItem(t);break;default:{this.ƀr;throw new Error}}}ƀfi(t,e){if(e!==void 0){e!==J&&e!==this.ƀgl&&(this.ƀgl=e,this.ƀr="appearing",this.ƀig.trigger(this.ƀgl),this.ƀnh!==0&&(this.ƀnh=0,this.ƀii.trigger(0)));return}if(t===J)this.ƀr==="disappearing"&&(this.ƀgl=void 0,this.ƀr="hidden",this.ƀnh=0,this.ƀig.trigger(void 0),this.ƀii.trigger(0));else {let i=t!==this.ƀgl;this.ƀgl=t,this.ƀr="visible",i&&this.ƀig.trigger(this.ƀgl),(i||this.ƀnh!==1)&&(this.ƀnh=1,this.ƀii.trigger(1));}}ƀfn(t){let e=this.ƀly.state.nextItem;if(e===void 0)return;let i=e===J?1-t:t;i!==this.ƀnh&&(this.ƀnh=i,i!==0&&i!==1&&this.ƀii.trigger(i));}};var or=class extends f{static{h(this,"FadeInContent");}constructor(t,e){super(),this.ƀcd=t;let i={duration:200,animation:b.easeInOut,...e};this.alpha=0,this.ƀly=new Ae(i).onStateChange(s=>{this.ƀbr?.destroy(),this.ƀbr=void 0,s!==void 0&&(this.ƀbr=new f().displayParent(this).attach(this),this.ƀcd({state:s,container:this.ƀbr}));}).onValueChange(s=>{this.alpha=s;}).attach(this);}setState(t,e){return this.ƀly.setItem(t,e),this}};var G=class{static{h(this,"GameAssets");}static{this.ƀkh=new Map;}static{this.ƀt=0;}static getAsset(t){let e=this.ƀkh.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.ƀt++}`;return this.ƀkh.set(i,t),i}static destroyAsset(t){let e=this.ƀkh.get(t);e&&(e.source.removeAllListeners("change"),e.destroy(true),this.ƀkh.delete(t));}static async loadGameAssets(t){let e=new Map,i=[];t.forEach(r=>{if(!helpersLib.Comparator.isString(r.url))throw new Error(`GameAssets: source url should be a string: ${r.url}`);let n=e.get(r.url),a=r.id;n?n.push(a):(e.set(r.url,[a]),i.push({url:r.url,callback:h(l=>{if(l instanceof W__namespace.Texture&&(l.id=a),n=e.get(r.url),n)n.forEach(c=>{this.ƀkh.set(c,l);});else throw new Error(`GameAssets: unexpected error, nameGroup is not found! "./"! ${r}`)},"callback")}));});let s=performance.now();return Promise.all(i.map(r=>W__namespace.Assets.load(r.url))).then(r=>{let n=performance.now();console.info("Asset load completed in: ",Math.round(n-s)/1e3," seconds"),r.forEach((a,l)=>{i[l].callback(a);});}).catch(r=>{throw new Error(`GameAssets: during asset loading, an error occured: ${r}`)})}};var De=class o extends W__namespace.Filter{static{h(this,"ExpandWithColorFilter");}static ƀem(t){let e=`
22
22
  in vec2 vTextureCoord;
23
23
  out vec4 finalColor;
24
24
 
@@ -42,4 +42,53 @@
42
42
  highestAlpha = centerColor.a;`,e+=`
43
43
 
44
44
  finalColor = vec4(uColor, 1.0) * highestAlpha;
45
- }`,e}constructor(t,e){if(super({glProgram:W__namespace.GlProgram.from({vertex:W__namespace.defaultFilterVert,fragment:n.ƀeg(t*k)}),resources:{expandUniforms:{uColor:{value:new Float32Array(3),type:"vec3<f32>"},uExpandSquared:{value:0,type:"f32"}}},resolution:k}),this.ƀdk=t,this.ƀdk=t*k,this.ƀdk<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀdk>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");helpersLib.Comparator.isInteger(this.ƀdk)||(this.ƀdk=Math.floor(this.ƀdk));let i=helpersLib.ColorHelper.normalize(e);this.resources.expandUniforms.uniforms.uColor=new Float32Array([i.red,i.green,i.blue]),this.resources.expandUniforms.uniforms.uExpandSquared=this.ƀdk*this.ƀdk,this.padding=this.ƀdk;}};var Oe=class extends W__namespace.Filter{static{h(this,"GlowFilter");}constructor(t){super({resolution:k,compatibleRenderers:W__namespace.RendererType.WEBGL});let e={blurRadius:1,expand:0,color:helpersLib.ColorHelper.white,...t};this.ƀdl=new Ae(e.expand,e.color);let i=helpersLib.Comparator.isNumber(e.blurRadius)?new helpersLib.Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀak=new Nt(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀak.blendMode="add";}apply(t,e,i,s){let r=W__namespace.TexturePool.getSameSizeTexture(e);this.ƀdl.apply(t,e,r,true),this.ƀak.apply(t,r,i,s),W__namespace.TexturePool.returnTexture(r);}};var re=class n{static{h(this,"GlowSpriteGenerator");}static{this.ƀfb=new Map;}static createGlowSpriteFromSprite(t,e,i){let s=this.ƀbj(e),r=helpersLib.Comparator.isNumber(s.blurRadius)?new helpersLib.Vector(s.blurRadius,s.blurRadius):s.blurRadius,o=this.ƀei(t.texture,r,s.expand,s.color,i),a=new W__namespace.Sprite(o);return this.ƀkh(a,helpersLib.Vector.fromVec2(t.anchor),Math.max(r.x,r.y)+s.expand),a.alpha=s.glowAlpha,a.blendMode=s.blendMode,a}static ƀei(t,e,i,s,r){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(r){let o=`${t.id}-${i}-${e.x}-${e.y}-${s.r}-${s.g}-${s.b}`;if(n.ƀfb.has(o))return n.ƀfb.get(o);{let a=this.ƀej(t,e,i,s);return n.ƀfb.set(o,a),a}}else return this.ƀej(t,e,i,s)}static ƀej(t,e,i,s){let r=new W__namespace.Sprite(t);r.filters=[new Oe({blurRadius:e,expand:i,color:s})];let o=new W__namespace.Container;o.addChild(r);let a=Math.max(e.x,e.y)+i,l=y.instance.generateTexture({target:o,frame:new W__namespace.Rectangle(-a,-a,r.width+a*2,r.height+a*2)});return l.id=G.insertAsset(l),o.destroy({children:true}),l}static ƀkh(t,e,i){let s=(i+(t.width-i*2)*e.x)/t.width,r=(i+(t.height-i*2)*e.y)/t.height;t.anchor.set(s,r);}static ƀbj(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:helpersLib.ColorHelper.white,blendMode:"add"};return t&&(e={...e,...t}),e}};T.onHardReset.subscribe(()=>{re.ƀfb.clear();}).attachToRoot();var et=class n extends d{static{h(this,"Sprite");}static createByName(t){let e=y.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new n(e)}static createSnapshotSprite(t){let e=t.ƀiv,i=y.instance.generateTexture({target:e,resolution:2,antialias:true,textureSourceOptions:{scaleMode:"linear"}}),r={id:G.insertAsset(i),scale:t.scale,size:t.size,anchor:helpersLib.Vector.zero,destroyAssetOnDestroy:true};return new n(r,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀlx=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀlc=t,this.pixiSprite=new W__namespace.Sprite(G.getAsset(t.id)),this.ƀiv.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.ƀlc.destroyAssetOnDestroy&&(G.destroyAsset(this.ƀlc.id),this.ƀix&&G.destroyAsset(this.ƀix.texture.id)),this.ƀgw?.destroy(),this.ƀam?.destroy(),this.ƀix&&!this.ƀix.destroyed&&this.ƀix.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀlx}set textureScale(t){this.ƀlx=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.ƀlc.boundingShapes&&!this.ƀiv.hitArea&&(this.ƀiv.hitArea=new vs(this.ƀlc.boundingShapes,this.size,helpersLib.Vector.fromVec2(this.ƀlc.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.source.autoGenerateMipmaps}set mipmap(t){this.pixiSprite.texture.source.autoGenerateMipmaps=t;}setBlendMode(t){return this.blendMode=t,this}get blendMode(){return this.pixiSprite.blendMode}set blendMode(t){this.pixiSprite.blendMode=t;}setTint(t){return this.tint=t,this}get tint(){return new W__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.ƀix)return this.ƀix.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀix)this.ƀix.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=helpersLib.Vector.fromVec2(this.ƀlc.anchor).to(t);return new helpersLib.Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀix&&(this.ƀix.destroy(),this.ƀix=void 0),t&&(this.ƀix=re.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀlc.destroyAssetOnDestroy),this.ƀix.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀix.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀiv.addChild(this.ƀix)),this}showBoundingShape(t){return t?this.ƀam||(this.ƀam=this.ƀby().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀam&&(this.ƀam.destroy(),this.ƀam=void 0),this}getBoundingMask(){if(!this.ƀgw){if(!this.ƀlc.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀgw=this.ƀby(),this.ƀgw.displayParent(this);}return this.ƀgw}ƀby(){if(!this.ƀlc.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return A.createPolygon(this.ƀlc.boundingShapes,helpersLib.ColorHelper.white).toSprite().attach(this)}download(){let t=y.instance.renderer.extract.canvas(this.ƀiv);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}},vs=class{static{h(this,"CompositeHitArea");}constructor(t,e,i){this.ƀkr=t.map(s=>new W__namespace.Polygon(s.map(r=>new W__namespace.Point(r.x,r.y))));}contains(t,e){return this.ƀkr.some(i=>i.contains(t,e))}};var Me=class{static{h(this,"DashedLineHelper");}static getLines(t,e,i){let s=helpersLib.Vector.fromTo(t,e),r=s.normalize(),o=s.length-i.lineStartGap-i.lineEndGap,a=[];if(o<=0)return a;let l=t.add(r.normalize(i.lineStartGap));if(o<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(r.normalize(o))}),a;let c=o-i.dashGap,p=i.dashLength+i.dashGap,f=Math.floor(c/p),g=c-p*f;f>=1&&g<i.dashLength&&(g+=p,f--);let v=r.normalize(g/2),x=r.normalize(i.dashGap);if(a.push({from:l,to:l.add(v)}),l=l.add(v),f>0){let M=r.normalize(i.dashLength);helpersLib.ArrayHelper.createEmptyArray(f).forEach(()=>{l=l.add(x),a.push({from:l,to:l.add(M)}),l=l.add(M);});}return l=l.add(x),a.push({from:l,to:l.add(v)}),a}};var A=class n extends d{static{h(this,"Graphics");}static{this.ƀdb=new Map;}static createArrow(t,e){let i=new W__namespace.Graphics;return [[{x:0,y:-t/2},{x:t*3/8,y:-t/8},{x:t/4,y:0},{x:0,y:-t/4},{x:-t/4,y:0},{x:-t*3/8,y:-t/8}],[{x:0,y:-t/4},{x:t/8-t/30,y:-t/8-t/30},{x:t/8-t/30,y:t*7/16},{x:-t/8+t/30,y:t*7/16},{x:-t/8+t/30,y:-t/8-t/30}]].forEach(r=>{i.poly(r.map(o=>new W__namespace.Point(o.x,o.y))).fill(e);}),new n(i,JSON.stringify({type:"arrow",size:t,color:e}))}static createDashedLine(t,e,i){let s={width:2,dashLength:10,dashGap:4,lineStartGap:0,lineEndGap:0,color:helpersLib.ColorHelper.white,...i},r=new W__namespace.Graphics;return Me.getLines(t,e,s).forEach(a=>{r.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),r.stroke({width:s.width,color:s.color}),new n(r,JSON.stringify({type:"dashedLine",from:t,to:e,options:s}))}static createVector(t,e,i){let s=new W__namespace.Graphics;return s.moveTo(t.x,t.y),s.lineTo(e.x,e.y),s.stroke({width:2,color:i}),s.circle(t.x,t.y,3),s.fill(helpersLib.ColorHelper.white),s.stroke({width:1,color:i}),new n(s,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let s=new W__namespace.Graphics;return s.rect(0,0,t.x,e),s.rect(0,e,e,t.y-e*2),s.rect(t.x-e,e,e,t.y-e*2),s.rect(0,t.y-e,t.x,e),s.fill(i),new n(s,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=helpersLib.ColorHelper.white){let i=new W__namespace.Graphics;return i.rect(0,0,t.x,t.y).fill(e),new n(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new W__namespace.Graphics;return i.circle(0,0,t).fill(e),new n(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new W__namespace.Graphics;return i.ellipse(0,0,t.x,t.y).fill(e),new n(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new W__namespace.Graphics,s=JSON.stringify({type:"polygon",polygon:t,color:e});return t.forEach(r=>{i.poly(r.map(o=>new W__namespace.Point(o.x,o.y))).fill(e);}),new n(i,s)}static createRegularPolygon(t,e,i){let s=new W__namespace.Graphics,r=new helpersLib.Radian(helpersLib.PI_360/t);s.moveTo(e,0);for(let o=1;o<=t;o++){let l=r.multiply(o).vector.normalize(e),c=e+l.x,p=e+l.y;s.lineTo(c,p);}return s.fill(i),new n(s,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.ƀiv.addChild(t),this.pixiGraphics=t,this.ƀap=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀap,cache:false,...t},i=this.ƀex(e.cacheName,e.cache),s={id:i.textureID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},r=new et(s,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),r}ƀex(t,e){if(e){let i=n.ƀdb.get(t);return i||(i=this.ƀck(),n.ƀdb.set(t,i)),i}else return this.ƀck()}ƀck(){let t=y.instance.generateTexture(this.pixiGraphics);t.id=G.insertAsset(t);let e=this.pixiGraphics.getBounds();return {textureID:t.id,bounds:new helpersLib.Vector(e.x,e.y)}}};var li=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},Ot=class n extends d{static{h(this,"ScrollMaskUI");}static{this.ƀdb=new Map;}constructor(t,e,i,s=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 r=new d;s===exports.ScrollDirection.Horizontal?this.ƀce(e,i,r):this.ƀcl(e,i,r),this.ƀgw=et.createSnapshotSprite(r).attach(this),r.destroy(),t.setMask(this.ƀgw);}ƀcl(t,e,i){e>0&&this.ƀcb(new helpersLib.Vector(t.x,e)).displayParent(i).attach(i),A.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.ƀcb(new helpersLib.Vector(t.x,e)).setPosition(new helpersLib.Vector(t.x,t.y),{round:false}).setRotation(helpersLib.Radian.get180).displayParent(i).attach(i);}ƀce(t,e,i){e>0&&this.ƀcb(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(0,t.y),{round:false}).setRotation(helpersLib.Radian.get270).displayParent(i).attach(i),A.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.ƀcb(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(t.x,0),{round:false}).setRotation(helpersLib.Radian.get90).displayParent(i).attach(i);}ƀcb(t){let i={id:this.ƀcc(t.y),scale:1,size:t,anchor:{x:0,y:0}};return new et(i,{textureSize:t,ignoreAnchor:true})}ƀcc(t){let e=JSON.stringify({type:"gradient",length:t}),i=n.ƀdb.get(e);if(!i){let s=document.createElement("canvas");s.width=1,s.height=t;let r=s.getContext("2d");if(r){let o=new li;helpersLib.ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${o.multiplierFunction(l/t)})`;r.fillStyle=c,r.fillRect(0,l,1,1);});let a=W__namespace.Texture.from(s);i=G.insertAsset(a),n.ƀdb.set(e,i);}else throw new Error("Canvas context is null")}return i}};exports.SlideStateAnimationState=void 0;(function(n){n[n.Appear=1]="Appear",n[n.Disappear=2]="Disappear";})(exports.SlideStateAnimationState||(exports.SlideStateAnimationState={}));var De=class extends actionsLib.Attachable{static{h(this,"SlideStateAnimation");}onStateChange(t){return this.ƀhx.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀhz.subscribe(e=>t(e.value,e.index)).attach(this),this}get state(){return {value:this.ƀlj.state.value,item:this.ƀfy,nextItem:this.ƀho,queuedItem:this.ƀlj.state.queuedItem,animationState:this.ƀo}}constructor(t){super(),this.ƀo="idle",this.ƀhx=new actionsLib.Action,this.ƀhz=new actionsLib.Action,this.ƀic={duration:500,animation:b.easeInOutCubic,...t},this.ƀlj=new jt({duration:this.ƀic.duration,animation:this.ƀic.animation}).onStateChange((e,i)=>this.ƀfe(e,i)).onValueChange(e=>this.ƀfj(e)).attach(this);}setIndex(t,e){if(!helpersLib.Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀfy===void 0?(this.ƀfy=t,this.ƀhx.trigger({state:exports.SlideStateAnimationState.Appear,index:t}),this.ƀlj.setItem(t,e)):this.ƀfy!==t?this.ƀho!==t?this.ƀo==="idle"?(this.ƀo=t>this.ƀfy?"transitionForward":"transitionBackward",this.ƀho=t,this.ƀhx.trigger({state:exports.SlideStateAnimationState.Appear,index:this.ƀho}),this.ƀlj.setItem(t,e)):this.ƀlj.setItem(t,e):this.ƀo==="reverting"&&this.ƀho===t&&(this.ƀo=t>this.ƀfy?"transitionForward":"transitionBackward",this.ƀlj.setItem(t,e)):(this.ƀo==="transitionForward"||this.ƀo==="transitionBackward")&&(this.ƀo="reverting",this.ƀlj.setItem(t,e));}ƀfe(t,e){switch(this.ƀfy!==void 0&&this.ƀfy!==t&&this.ƀfy!==e&&this.ƀhx.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀfy}),this.ƀho!==void 0&&this.ƀho!==t&&this.ƀho!==e&&this.ƀhx.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀho}),e!==void 0&&e!==this.ƀfy&&e!==this.ƀho&&this.ƀhx.trigger({state:exports.SlideStateAnimationState.Appear,index:e}),this.ƀo){case "idle":break;case "transitionForward":case "transitionBackward":e===void 0?(this.ƀo="idle",this.ƀfy=this.ƀho,this.ƀho=void 0):this.ƀfy!==t&&this.ƀff(t,e);break;case "reverting":e===void 0?(this.ƀo="idle",this.ƀho=void 0):this.ƀfy!==e&&this.ƀff(t,e);break;default:{this.ƀo;throw new Error}}}ƀff(t,e){this.ƀfy=t,this.ƀho=e,this.ƀhz.trigger({value:0,index:this.ƀfy}),this.ƀo=this.ƀfy<this.ƀho?"transitionForward":"transitionBackward";}ƀfj(t){let e=1;(this.ƀo==="transitionBackward"||this.ƀo==="reverting"&&this.ƀfy!==void 0&&this.ƀho!==void 0&&this.ƀfy>this.ƀho)&&(e=-1),(this.ƀo==="idle"||t!==0)&&this.ƀhz.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(-e*t),index:this.ƀfy}),this.ƀho!==void 0&&this.ƀhz.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀho});}};exports.ScrollDirection=void 0;(function(n){n[n.Horizontal=1]="Horizontal",n[n.Vertical=2]="Vertical";})(exports.ScrollDirection||(exports.ScrollDirection={}));var ci=class extends d{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀca=t,this.ƀcx="x",this.ƀbq=new Map,this.ƀic={duration:300,animation:b.easeInOutCubic,size:new helpersLib.Vector(500,500),margin:20,direction:exports.ScrollDirection.Horizontal,...e};let i=this.ƀic.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(this.ƀic.size.x+this.ƀic.margin*2,this.ƀic.size.y):new helpersLib.Vector(this.ƀic.size.x,this.ƀic.size.y+this.ƀic.margin*2),s=new d().setPosition(this.ƀic.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(-this.ƀic.margin,0):new helpersLib.Vector(0,-this.ƀic.margin),{round:false}).displayParent(this).attach(this);this.ƀcf(i,this.ƀic.margin,this.ƀic.direction,s),this.ƀcx=this.ƀic.direction===exports.ScrollDirection.Horizontal?"x":"y",this.ƀlj=new De({duration:this.ƀic.duration,animation:this.ƀic.animation}).onStateChange((r,o)=>{if(r===exports.SlideStateAnimationState.Appear){let a=new d().displayParent(this).attach(this);this.ƀbq.set(o,a),this.ƀca({index:o,container:a});}else {let a=this.ƀbq.get(o);a&&(a.destroy(),this.ƀbq.delete(o));}}).onValueChange((r,o)=>{let a=this.ƀbq.get(o);if(a){let l={x:0,y:0};l[this.ƀcx]=i[this.ƀcx]*r+this.ƀic.margin,a.setPosition(helpersLib.Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=s;}setIndex(t,e){return this.ƀlj.setIndex(t,e),this}ƀcf(t,e,i,s){new Ot(s,new helpersLib.Vector(t.x,t.y),e,i).attach(this);}},tr=class extends ci{static{h(this,"SlideInContent");}constructor(t,e,i){super(s=>{let r=this.indexToItem.get(s.index);if(r)e({index:s.index,item:r,container:s.container});else throw new Error(`SlideInContent: The item with index '${s.index}' is not part of the items list`)},i),this.itemToIndex=new Map,this.indexToItem=new Map,t.forEach((s,r)=>{this.itemToIndex.set(s,r),this.indexToItem.set(r,s);});}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 oe=class{static{h(this,"VectorSet");}constructor(){this.ƀmk=new Map;}add(t){let e=this.ƀmk.get(t.x);e||(e=new Set,this.ƀmk.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀmk.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀmk.get(t.x);return e?e.delete(t.y):false}};var pi=class{static{h(this,"DeltaTime");}static adjustMultiplier(t,e){return Math.pow(t,e)}};var _=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 ne=class{static{h(this,"ClosestAvailableSpaceHelper");}static findByConvertingGridSpace(t,e,i){let s=new helpersLib.Vector(Math.ceil(e.size.x/i)-1,Math.ceil(e.size.y/i)-1),r=_.areaToGridArea(e,i);if(this.ƀax(t,r))return helpersLib.Vector.zero;let o=t.movePositionInsideGrid(r.topLeft),a=helpersLib.Vector.fromTo(r.topLeft,o),l=this.find(t,o,s);if(l){let c=l.add(a),p=helpersLib.Vector.fromTo(r.topLeft.multiplyNumber(i),e.topLeft);return new helpersLib.Vector(c.x*i+((s.x+1)*i-e.size.x)/2-p.x,c.y*i+((s.y+1)*i-e.size.y)/2-p.y)}}static find(t,e,i){let s=new oe,r=new helpersLib.Queue(e);for(;r.notEmpty;){let o=r.pop();s.add(o);let a=new helpersLib.Rectangle(o,o.add(i));if(this.ƀax(t,a))return helpersLib.Vector.fromTo(e,o);t.getNeighborPositions(o,"orthogonal").forEach(l=>{s.has(l)||r.add(l);});}}static ƀax(t,e){if(!t.isAreaWithinBounds(e))return false;for(let i=e.topLeft.y;i<=e.bottomRight.y;i++)for(let s=e.topLeft.x;s<=e.bottomRight.x;s++)if(!t.get(new helpersLib.Vector(s,i)))return false;return true}};var er=Math.SQRT2-1,_s=class{static{h(this,"PathfinderNode");}constructor(t,e){this.position=t,this.distanceToEnd=e,this.closed=false,this.distanceFromStart=Number.MAX_SAFE_INTEGER,this.parent=void 0;}get pathLength(){return this.distanceFromStart+this.distanceToEnd}getStepCost(t){return this.position.x!==t.position.x&&this.position.y!==t.position.y?Math.SQRT2:1}createSolutionPath(t){let e=[],i=this;for(;i!==void 0;)e.push(i.position),i=i.parent;return e.reverse(),{directPathAvailable:t,path:e}}},Vs=class{static{h(this,"PathfinderGrid");}constructor(t,e,i,s){this.ƀfd=t,this.ƀlr=i,this.ƀhn=s,this.ƀib=new helpersLib.BinaryHeap("min"),this.ƀhq=new helpersLib.Grid({size:t.size,defaultValue:void 0});let r=this.ƀcg(e);r.distanceFromStart=0,this.ƀib.add(r.pathLength,r),this.ƀaf=r;}get hasOpenNodes(){return this.ƀib.size>0}getNeighbors(t){let e=[];for(let i of this.ƀfd.getNeighborPositions(t.position,this.ƀhn))if(this.ƀfd.get(i)){let s=this.ƀhq.get(i)??this.ƀcg(i);s.closed||e.push(s);}return e}popLowestPathCostNode(){let t=this.ƀib.pop();return t.closed=true,t.distanceToEnd<this.ƀaf.distanceToEnd&&(this.ƀaf=t),t}changeNodeCost(t,e,i){t.distanceFromStart=e,t.parent=i,this.ƀib.updatePriority(t,t.pathLength)||this.ƀib.add(t.pathLength,t);}getBestClosedNode(){return this.ƀaf}ƀcg(t){let e=Math.abs(t.x-this.ƀlr.x),i=Math.abs(t.y-this.ƀlr.y),s=this.ƀhn==="orthogonal"?e+i:e>i?e+er*i:i+er*e,r=new _s(t,s);return this.ƀhq.isPointWithinBounds(t)&&this.ƀhq.set(t,r),r}},ae=class{static{h(this,"PathFinder");}static findPath(t,e,i,s){let r=new Vs(t,e,i,s);for(;r.hasOpenNodes;){let o=r.popLowestPathCostNode();if(o.position.isEqual(i))return o.createSolutionPath(true);for(let a of r.getNeighbors(o)){let l=o.distanceFromStart+o.getStepCost(a);l<a.distanceFromStart&&r.changeNodeCost(a,l,o);}}return r.getBestClosedNode().createSolutionPath(false)}};var Wt=[-1,0,0,1,-1,-1,1,1],$t=[0,-1,1,0,-1,1,-1,1],rr=[10,10,10,10,14,14,14,14],ui=Wt.map((n,t)=>new helpersLib.Vector(n,$t[t]).radian),he=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀlq=t;let i=e.width,s=e.height,r=this.ƀel(e.size);this.ƀmt=i,this.ƀfm=s,this.ƀfn=r;let o=i*s,a=new Uint8Array(o),l=new Int32Array(o),c=e.snapshot();for(let x=0;x<s;x++){let M=c[x],L=x*i;for(let I=0;I<i;I++)M[I]?(a[L+I]=1,l[L+I]=r):l[L+I]=-1;}this.ƀz=a,this.ƀms=l,this.ƀcw=new Uint8Array(o),this.ƀcv=new Array(o);let p=[-1,-i,i,1,-i-1,i-1,-i+1,i+1],f=new Array(r),g=e.cropAreaOutsideOfTheGrid(t),v=[];for(let x=g.topLeft.y;x<=g.bottomRight.y;x++)for(let M=g.topLeft.x;M<=g.bottomRight.x;M++)l[x*i+M]=0,v.push(x*i+M);f[0]=v;for(let x=0;x<r;x++){let M=f[x];if(M){f[x]=void 0;for(let L=0;L<M.length;L++){let I=M[L];if(l[I]!==x)continue;let K=I%i;if(K>0&&K<i-1&&I>=i&&I<o-i){let _t=x+10,$=x+14;for(let H=0;H<8;H++){let j=I+p[H],at=H<4?_t:$;if(at<l[j]){l[j]=at;let Rt=f[at];Rt?Rt.push(j):f[at]=[j];}}}else {let _t=(I-K)/i;for(let $=0;$<8;$++){let H=K+Wt[$],j=_t+$t[$];if(H<0||j<0||H>=i||j>=s)continue;let at=j*i+H,Rt=x+rr[$];if(Rt<l[at]){l[at]=Rt;let Fi=f[Rt];Fi?Fi.push(at):f[Rt]=[at];}}}}}}for(let x=0;x<o;x++)l[x]===-1&&(l[x]=r);}getDirectionToTarget(t){if(t.isInsideRectangle(this.ƀlq))return;let e=this.ƀmt,i=Math.round(t.x),s=Math.round(t.y);i=Math.max(0,Math.min(e-1,i)),s=Math.max(0,Math.min(this.ƀfm-1,s));let r=s*e+i;if(this.ƀcw[r]===1)return this.ƀcv[r];let o=this.ƀaq(i,s,r);return this.ƀcw[r]=1,this.ƀcv[r]=o,o}ƀaq(t,e,i){let s=this.ƀmt,r=this.ƀfm,o=[];for(let a=0;a<8;a++){let l=t+Wt[a],c=e+$t[a];l>=0&&c>=0&&l<s&&c<r&&o.push(a);}if(this.ƀms[i]>=this.ƀfn){let a=o.filter(l=>this.ƀz[(e+$t[l])*s+t+Wt[l]]===1);if(a.length===0)return;if(a.length<o.length)return helpersLib.Radian.getAverage(...a.map(l=>ui[l]))}return this.ƀeb(t,e,o)}ƀeb(t,e,i){let s=this.ƀmt,r=[],o=this.ƀfn;for(let v=0;v<i.length;v++){let x=i[v],M=this.ƀms[(e+$t[x])*s+t+Wt[x]];if(M>=this.ƀfn)continue;let L=M+rr[x];L<o?(r.length=0,r.push(x),o=L):L===o&&r.push(x);}if(r.length===0)return;let a=0,l=0;for(let v=0;v<r.length;v++)a+=Wt[r[v]],l+=$t[r[v]];if(a===0&&l===0)return ui[helpersLib.Random.pickRandomElement(r)];let c=1/Math.sqrt(a*a+l*l),p=t+Math.round(a*c),f=e+Math.round(l*c);return p>=0&&f>=0&&p<s&&f<this.ƀfm&&this.ƀz[f*s+p]===1?new helpersLib.Vector(a,l).radian:ui[helpersLib.Random.pickRandomElement(r)]}get t(){let t=[];for(let e=0;e<this.ƀfm;e++){let i=new Array(this.ƀmt);for(let s=0;s<this.ƀmt;s++)i[s]=this.ƀms[e*this.ƀmt+s];t.push(i);}return new helpersLib.Grid(t)}ƀel(t){return (t.x+t.y)*20}};var R=class n{static{h(this,"AudioAssets");}static{this.ƀao=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.ƀao.set(e.id,i))));}static createSource(t){let e=n.ƀea(t),i=n.context.createBufferSource();return i.buffer=e,i}static ƀea(t){let e=this.ƀao.get(t);if(!e)throw new Error(`Audio: Sound with id ${t} was not loaded.`);return e}};T.onHardReset.subscribe(()=>{R.context=new AudioContext,R.ƀao.clear();}).attachToRoot();var rt=1e3,it=class n{static{h(this,"Audio");}static ƀkk(){return this.ƀgb=new n,this.ƀgb}constructor(){this.ƀgz=R.context.createGain(),this.ƀgy=R.context.createGain(),this.ƀhm=R.context.createGain(),this.ƀkv=R.context.createGain(),this.ƀgz.connect(R.context.destination),this.ƀgy.connect(this.ƀgz),this.ƀhm.connect(this.ƀgy),this.ƀkv.connect(this.ƀgy),this.ƀha=new O(this.ƀgz.gain,"value",{duration:500*2,animation:b.easeIn,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀha.set({value:0});}setVolumes(t){this.ƀgy.gain.value=t.master,this.ƀhm.gain.value=t.music,this.ƀkv.gain.value=t.sound;}appear(t,e="ease"){switch(e){case "ease":return this.ƀha.set({value:t?0:1}),this.ƀha.animate({value:t?1:0}).chainToRoot();case "instant":return this.ƀha.set({value:t?1:0}),actionsLib.SingleEvent.instant();default:{throw new Error}}}};T.onHardReset.subscribe(()=>{it.ƀkk();}).attachToRoot();var Hs=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r};exports.CameraGateway=class yt extends ht(){static{h(this,"CameraGateway");}};exports.CameraGateway=Hs([u()],exports.CameraGateway);var js=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Bt=class extends ht(){static{h(this,"CameraViewGateway");}};Bt=js([u()],Bt);var or;(function(n){n.BackgroundScreen="backgroundScreen",n.Background="background",n.Main="main",n.Foreground="foreground",n.ForegroundScreen="foregroundScreen";})(or||(or={}));exports.FocusingAnimation=void 0;(function(n){n[n.Instant=1]="Instant",n[n.EaseInOut=2]="EaseInOut",n[n.EaseOut=3]="EaseOut";})(exports.FocusingAnimation||(exports.FocusingAnimation={}));var le=class{static{h(this,"Camera");}get position(){return this.ƀas.getCameraPosition()}constructor(){this.ƀas=E.get(exports.CameraGateway),this.ƀaw=E.get(Bt),this.ƀas.createCamera(),this.layers=this.ƀaw.getLayers();}setPosition(t){this.ƀas.setPosition(t);}setTransition(t){this.ƀas.setTransition(t);}appear(t,e="alpha",i=0){return this.ƀaw.appear(t,e,i)}screenPositonToStagePosition(t){return this.ƀaw.screenPositonToStagePosition(t)}};var y=class n{static{h(this,"Game");}static get instance(){return this.ƀgb}static{this.pause=actionsLib.Reducer.createOr();}static{this.freeze=actionsLib.Reducer.createOr();}static get camera(){return this.ƀar}static get audio(){return this.ƀy}static appear(t,e){let i=e?.audio??"ease",s=e?.camera??"alpha";return actionsLib.ActionLib.all([this.audio.appear(t,i),this.camera.appear(t,s,i!=="instant"?0:500)]).mapToVoid().chainToRoot()}static get time(){return w.ƀly}static get setupOptions(){return this.ƀko}constructor(t){if(this.ƀjz=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSize=this.ƀjz.notifier,this.ƀka=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSizeCenter=this.ƀka.notifier,this.devMode=false,n.ƀgb)throw new Error("There can be only one Game instance!");this.ƀbm={screenResolution:void 0,maxScreenResolution:void 0,devMode:false,backgroundColor:helpersLib.ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbm.devMode||false,this.ƀiu=new W__namespace.Application;let e=n.pause.effect(false).attachToRoot();n.freeze.subscribe(i=>{e.update(i),i?R.context.suspend():R.context.resume();}).attachToRoot();}async setup(t){n.ƀko=t;let e=helpersLib.JsonHelper.removeUndefinedProperties({backgroundColor:helpersLib.ColorHelper.rgbToHex(this.ƀbm.backgroundColor),autoStart:false,antialias:this.ƀbm.antialias,resolution:this.ƀbm.resolution,width:this.ƀbm.screenResolution?.width,height:this.ƀbm.screenResolution?.height,useBackBuffer:true,powerPreference:"high-performance",eventFeatures:{globalMove:false}});await this.ƀiu.init(e);let i=document.body.appendChild(this.ƀiu.canvas);this.ƀkj(i),await Promise.all([G.loadGameAssets(t.spriteAssetDefinitions),G.loadGameAssets(t.fontAssetDefinitions),R.load(t.soundAssetDefinitions)]),n.ƀgb=this,this.renderer=this.ƀiu.renderer,globalThis.ƀa=this.ƀiu,this.ƀfh(),n.ƀar=new le,n.ƀy=it.ƀkk(),this.ƀiu.start(),this.ƀiu.ticker.add(()=>{n.freeze.value||w.triggerUpdateTick(this.ƀiu.ticker.deltaMS);}),this.devMode&&await this.renderer.layout.enableDebug(true);}generateTexture(t){let e=this.renderer.layout,i=e.autoUpdate;e.autoUpdate=false;let s=this.renderer.generateTexture(t);return e.autoUpdate=i,s}setResolution(t){if(this.ƀiu.renderer.resolution!==t){this.ƀiu.renderer.resolution=t;let e=this.ƀew();this.ƀiu.renderer.resize(e.x,e.y);}}ƀfh(){this.ƀdg(),this.ƀki(),window.addEventListener("resize",t=>{this.ƀdg(),this.ƀki();});}ƀdg(){let t=this.ƀew();(t.x!==this.ƀiu.screen.width||t.y!==this.ƀiu.screen.height)&&this.ƀiu.renderer.resize(t.x,t.y);}ƀki(){let t=new helpersLib.Vector(this.ƀiu.screen.width,this.ƀiu.screen.height);this.ƀjz.value=t,this.ƀka.value=t.multiplyNumber(.5).round();}ƀew(){let t=this.ƀbm.screenResolution?.width??window.innerWidth,e=this.ƀbm.screenResolution?.height??window.innerHeight;return this.ƀbm.maxScreenResolution&&(t=Math.min(t,this.ƀbm.maxScreenResolution.width),e=Math.min(e,this.ƀbm.maxScreenResolution.height)),new helpersLib.Vector(t,e)}ƀkj(t){this.ƀbm.maxScreenResolution&&(t.style.maxWidth=`${this.ƀbm.maxScreenResolution?.width}px`,t.style.maxHeight=`${this.ƀbm.maxScreenResolution?.height}px`),t.style.width="100%",t.style.height="100%",t.style.backgroundColor=helpersLib.ColorHelper.rgbColorToString(this.ƀbm.backgroundColor);}};var lr=class{static{h(this,"ElectronGame");}static async start(t,e){let{devMode:i,maxScreenResolution:s}=await window.api.getOptions(),r=new y({...t,devMode:i,maxScreenResolution:s});await r.setup(e);let o=y.pause.effect(false).attachToRoot();window.api.onWindowFocus(l=>{o.update(!l);});let a=y.freeze.effect(false).attachToRoot();return document.addEventListener("visibilitychange",()=>{a.update(document.hidden);}),window.api.rendererReady(),window.api.setFullScreen(false),r}};var ce=class n extends actionsLib.IDAttachable{static{h(this,"Sound");}static createByName(t,e){let i=y.setupOptions.soundDefinitions[t];if(!i)throw new Error(`Sound: Could not find sound definition with name ${t}.`);return new n(i,e)}get volume(){return this.ƀdw.gain.value}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀdw.gain.value=t,this}constructor(t,e){super(),this.ƀkw=t,this.ƀdw=R.context.createGain(),this.ƀdw.connect(it.ƀgb.ƀkv),this.ƀfl=this.ƀdw,e?.volume!==void 0&&(this.volume=e.volume),this.ƀjb(e?.time??0);}destroy(){this.destroyed||(super.destroy(),this.ƀll(),this.ƀdw?.disconnect());}ƀmi(){this.ƀfl.disconnect(),this.ƀfl.connect(it.ƀgb.ƀhm);}ƀjb(t){this.ƀll();let e=this.ƀkw.loop;if(this.ƀlf=helpersLib.NumberHelper.clamp(t,0,e?e.to:this.ƀkw.duration),e){let i=e.from,s=e.to;this.ƀjc({soundID:this.ƀkw.id,start:this.ƀlf,end:this.ƀlf<i?i:s,loop:false,onComplete:h(()=>{this.ƀkz.disconnect(),this.ƀjc({soundID:this.ƀkw.id,start:i,end:s,loop:true});},"onComplete")});}else this.ƀjc({soundID:this.ƀkw.id,start:this.ƀlf,end:void 0,loop:false,onComplete:h(()=>this.destroy(),"onComplete")});}ƀll(){this.ƀkz&&(this.ƀkz.onended=null,this.ƀkz.stop(),this.ƀkz.disconnect());}ƀjc(t){this.ƀkz=R.createSource(t.soundID),this.ƀkz.connect(this.ƀdw),t.onComplete&&(this.ƀkz.onended=t.onComplete),t.loop?(this.ƀkz.loop=true,this.ƀkz.loopStart=t.start,this.ƀkz.loopEnd=t.end??this.ƀkz.buffer.duration,this.ƀkz.start(0,t.start)):this.ƀkz.start(0,t.start,t.end?t.end-t.start:void 0);}};var Js=800,_e=-128,wt=class n extends ce{static{h(this,"AdvancedSound");}static createByName(t,e){let i=y.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new n(i,e)}constructor(t,e){super(t,e),this.ƀly=new actionsLib.Variable(0),this.time=this.ƀly.notifier,this.ƀlh=R.context.currentTime-this.ƀlf,this.ƀly.value=this.ƀlf,w.beforeSceneUpdateAction.subscribe(()=>{this.ƀly.value=R.context.currentTime-this.ƀlh;}).attach(this),this.ƀfl.disconnect(),this.ƀkl(e?.fade?helpersLib.NumberHelper.clamp(e.fade,0,1):0),this.ƀkn(e?.muffle?helpersLib.NumberHelper.clamp(e.muffle,0,1):0),this.ƀfl.connect(it.ƀgb.ƀkv);}ƀkl(t=0){this.ƀdo=R.context.createGain(),this.ƀdo.gain.value=1-t,this.ƀdn=new O(this.ƀdo.gain,"value",{duration:500,animation:b.lineer,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀfl.connect(this.ƀdo),this.ƀfl=this.ƀdo;}ƀkn(t=0){this.ƀhk=R.context.createBiquadFilter(),this.ƀhk.type="highshelf",this.ƀhk.frequency.value=Js,this.ƀhk.gain.value=t*_e,this.ƀhl=new O(this.ƀhk.gain,"value",{duration:500,animation:b.lineer,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀfl.connect(this.ƀhk),this.ƀfl=this.ƀhk;}close(){return this.ƀbd?this.onDestroy():(this.ƀbd=true,this.fade(1,rt).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(s=>s>=t).tap(()=>e()).attach(this);return ()=>i.destroy()})}setFade(t){t=helpersLib.NumberHelper.clamp(t,0,1),this.ƀdn.set({value:1-t});}fade(t,e=500){t=helpersLib.NumberHelper.clamp(t,0,1);let i=t>1-this.ƀdo.gain.value;return e===0?(this.ƀdn.set({value:1-t}),actionsLib.SingleEvent.instant()):this.ƀdn.animate({value:1-t},{duration:e,animation:i?b.easeOut:b.easeIn}).chain(this)}setMuffle(t){t=helpersLib.NumberHelper.clamp(t,0,1),this.ƀhl.set({value:t*_e});}muffle(t,e=500){return t=helpersLib.NumberHelper.clamp(t,0,1),e===0?(this.ƀhl.set({value:t*_e}),actionsLib.SingleEvent.instant()):this.ƀhl.animate({value:t*_e},{duration:e}).chain(this)}destroy(){this.destroyed||(this.ƀdo.disconnect(),this.ƀhk.disconnect()),super.destroy();}};var pe=class n extends actionsLib.IDAttachable{static{h(this,"Music");}static createByName(t,e){let i=y.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new n(i,e)}get time(){switch(this.ƀky.value.type){case "paused":return this.ƀky.value.value.time;case "playing":return this.ƀky.value.value.time.value;default:{this.ƀky.value;throw new Error}}}get volume(){return this.ƀky.value.value.volume}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀky.value.value.volume=t,this}constructor(t,e){super(),this.ƀic={stopPlayingOnPause:true,...e},this.ƀkx=t.id;let i;if(this.ƀic.stopPlayingOnPause&&y.pause.value)i={type:"paused",value:{time:0,volume:1}};else {let s=new wt(t,this.ƀic).attach(this);s.ƀmi(),i={type:"playing",value:s};}this.ƀky=new actionsLib.Variable(i),this.ƀic.stopPlayingOnPause&&(this.ƀih=y.pause.subscribe(s=>this.ƀfg(s)).attach(this));}notifyOnTime(t){return actionsLib.SingleEvent.create(e=>{let i=this.ƀky.asyncDropOngoing((s,r)=>{switch(s.type){case "paused":r.drop();break;case "playing":return s.value.notifyOnTime(t);default:{throw new Error}}}).toSingleEvent().tap(()=>e()).attach(this);return ()=>i.destroy()})}close(){return this.ƀbd?this.onDestroy():(this.ƀbd=true,this.ƀih?.destroy(),actionsLib.SingleEvent.instant().async(()=>actionsLib.ActionLib.all([this.ƀky.value.type==="playing"?this.ƀky.value.value.close():actionsLib.SingleEvent.instant(),this.ƀdp?.onDestroy()??actionsLib.SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀfg(t){if(t){if(this.ƀky.value.type==="playing"){let e=this.ƀky.value.value;this.ƀky.value={type:"paused",value:{time:e.time.value,volume:e.volume}},this.ƀdp=e,actionsLib.ActionLib.all([e.fade(1,rt),e.muffle(1,rt)]).tap(()=>{this.ƀdp=void 0,e.destroy();}).attach(this);}}else if(this.ƀky.value.type==="paused"){let{volume:e,time:i}=this.ƀky.value.value,s=wt.createByName(this.ƀkx,{volume:e,time:i,fade:1,muffle:1}).attach(this);s.ƀmi(),actionsLib.ActionLib.all([s.fade(0,rt),s.muffle(0,rt)]).attach(this),this.ƀky.value={type:"playing",value:s};}}};var mi=class extends actionsLib.IDAttachable{static{h(this,"MusicPlayer");}get time(){return this.ƀjd?this.ƀjd.time:0}get volume(){return this.ƀmr}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀmr=t,this.ƀjd&&(this.ƀjd.volume=t),this.ƀig&&(this.ƀig.volume=t),this}constructor(t){super(),this.ƀmr=1,this.ƀic={stopPlayingOnPause:true,playWhenPaused:void 0,volume:1,...t},this.ƀmr=this.ƀic.volume,this.ƀic.playWhenPaused&&this.ƀkp(this.ƀic.playWhenPaused);}play(t){if(this.ƀbd)throw new Error("Play is called while music player is destroyed.");return this.ƀcq=t,actionsLib.SingleEvent.instant().async(()=>{let e=this.ƀjd;if(e)return this.ƀjd=void 0,e.close()}).map(()=>{if(this.ƀcq===t)return this.ƀjd=pe.createByName(t,{stopPlayingOnPause:this.ƀic.stopPlayingOnPause,volume:this.ƀmr}).attach(this),this.ƀjd}).chain(this)}stop(){return actionsLib.SingleEvent.instant().async(()=>{let t=this.ƀjd;if(t)return t.close().tap(()=>{t===this.ƀjd&&(this.ƀjd=void 0);})}).chain(this)}close(){return this.ƀbd?this.onDestroy():(this.ƀbd=true,this.ƀih?.destroy(),actionsLib.SingleEvent.instant().async(()=>actionsLib.ActionLib.all([this.ƀjd?.close()??actionsLib.SingleEvent.instant(),this.ƀig?.close()??actionsLib.SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀkp(t){this.ƀih=y.pause.toSequence().asyncDropOngoing(e=>e&&w.wait(rt).map(()=>e)).tap(e=>{if(e)this.ƀig=wt.createByName(t,{fade:1,volume:this.ƀmr}).attach(this),this.ƀig.ƀmi(),this.ƀig.fade(0);else if(this.ƀig){let i=this.ƀig;this.ƀig.fade(1).tap(()=>i.destroy()).attach(this),this.ƀig=void 0;}}).attach(this);}};var yi=class extends d{static{h(this,"Placeholder");}constructor(t){super(),this.ƀiy=new W__namespace.Graphics,this.ƀiy.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),this.ƀiv.addChild(this.ƀiy);}destroy(){this.destroyed||(super.destroy(),this.ƀiy.destroy());}};var zt=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,s={};if(i){let r={blur:4,angle:helpersLib.Radian.get60,distance:10,color:helpersLib.ColorHelper.black,alpha:.5,...i};s={dropShadow:{blur:r.blur,angle:r.angle.value,distance:r.distance,color:helpersLib.ColorHelper.rgbToHex(r.color),alpha:r.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,...s})}};var Ne=class{static{h(this,"RichTextDataInConverter");}static process(t,e){let i=new Set(e.styles?Object.keys(e.styles):[]),s=scriptEngineLib.RichTextSeparator.process(t,i),r=this.ƀfx(s,e),o=this.ƀs(r);return this.ƀla(o)}static ƀfx(t,e){let i=new Map,s=new Map,r=h((a,l)=>{if(s.has(l))return s.get(l);let c=zt.getPixiTextStyle(a);return s.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀee(a.tags,e,i),p=r(l,c),f=W__namespace.CanvasTextMetrics.measureText(" ",new W__namespace.TextStyle(p),void 0,false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:f.width}})}static ƀee(t,e,i){let s=t.join("+");if(i.has(s))return {style:i.get(s),cacheKey:s};let r=this.ƀbh(t,e);return i.set(s,r),{style:r,cacheKey:s}}static ƀbh(t,e){let i={...e.default};for(let l of t)e.styles&&e.styles[l]&&(i={...i,...e.styles[l]});let{wordWrapWidth:s,align:r,dropShadow:o,...a}=i;return a}static ƀs(t){let e=[],i=[];return t.forEach((s,r)=>{s.text.split(/\r?\n/).forEach((a,l)=>{l>0&&(e.push(i),i=[]),i.push({text:a,cacheKey:s.cacheKey,style:s.style,pixiStyle:s.pixiStyle,spaceWidth:s.spaceWidth});});}),e.push(i),e}static ƀla(t){let e=[];return t.forEach(i=>{if(i.length===0)throw new Error("Internal Error: Line is unexpectedly empty");let s=i.flatMap(r=>this.ƀlb(r.text).map(a=>{let l=new W__namespace.TextStyle(r.pixiStyle),c=W__namespace.CanvasTextMetrics.measureText(a,l,void 0,false);return {text:a,whitespace:a.trim()==="",style:{cacheKey:r.cacheKey,style:r.style,pixiStyle:l,height:c.height,ascent:c.fontProperties.ascent,descent:c.fontProperties.descent,width:c.width,spaceWidth:r.spaceWidth}}}));e.push(s);}),e}static ƀlb(t){if(t==="")return [""];let e=[],i="",s=t[0]===" ";for(let r=0;r<t.length;r++){let o=t[r],a=o===" ";a===s?i+=o:(e.push(i),i=o,s=a);}return i&&e.push(i),e}};var Le=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀco.length===0}get remainingWidth(){return this.ƀmu-this.ƀcr}constructor(t,e){this.ƀmu=t,this.ƀgo=[],this.ƀco=[],this.ƀcr=0,this.ƀgn=new helpersLib.Vector(0,0),this.ƀcp=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀfp=i.horizontalAlignment,this.ƀml=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀmu||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀcs={direction:i.rectangleCutOption.direction,rectangle:this.ƀbu(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀcp,t.y),i=this.ƀen(this.ƀgn.y,this.ƀgn.y+e);return this.ƀcr+t.x<=i}insertWord(t){let e=Math.max(this.ƀcp,t.style.height);if(this.ƀco.length===0){let i=this.ƀeo(this.ƀgn.y,this.ƀgn.y+e);this.ƀgn=new helpersLib.Vector(i,this.ƀgn.y),this.ƀcr=this.ƀgn.x;}this.ƀco.push({chunk:t,position:new helpersLib.Vector(this.ƀcr,this.ƀgn.y)}),this.ƀcp=e,this.ƀcr+=t.style.width;}newLine(){let t=this.ƀgn.y+this.ƀcp,e=this.ƀeo(t,t);this.ƀds(),this.ƀgn=new helpersLib.Vector(e,t),this.ƀcr=this.ƀgn.x,this.ƀcp=0;}print(){return this.ƀds(),this.ƀgo}ƀds(){this.ƀco.length>0&&(this.ƀgo.push(this.ƀg(this.ƀco)),this.ƀco=[]);}ƀg(t){return t=this.ƀmn(t),t=this.ƀfr(t),t}ƀfr(t){if(this.ƀfp==="left")return t;let e=this.ƀgn.y+this.ƀcp,i=this.ƀeo(this.ƀgn.y,e),r=this.ƀen(this.ƀgn.y,e)-i,o=Math.min(r,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀfp==="center"?a=(r-o)/2:a=r-o,t.map(l=>(l={chunk:l.chunk,position:new helpersLib.Vector(l.position.x+a,l.position.y)},l))}ƀmn(t){let e=Math.max(...t.map(s=>s.chunk.style.ascent)),i=Math.max(...t.map(s=>s.chunk.style.descent));return t.map(s=>{let r;switch(this.ƀml){case "top":r=i-s.chunk.style.descent;break;case "center":r=(i-s.chunk.style.descent+e-s.chunk.style.ascent)*.5;break;case "bottom":r=e-s.chunk.style.ascent;break;default:{this.ƀml;throw new Error}}return s={chunk:s.chunk,position:new helpersLib.Vector(s.position.x,s.position.y+r)},s})}ƀeo(t,e){return this.ƀcs&&(this.ƀcs.direction==="topLeft"||this.ƀcs.direction==="bottomLeft")&&(this.ƀcs.rectangle.isPointInside(new helpersLib.Vector(0,t),{includeEdges:false})||this.ƀcs.rectangle.isPointInside(new helpersLib.Vector(0,e),{includeEdges:false}))?this.ƀcs.rectangle.bottomRight.x:0}ƀen(t,e){return this.ƀcs&&(this.ƀcs.direction==="topRight"||this.ƀcs.direction==="bottomRight")&&(this.ƀcs.rectangle.isPointInside(new helpersLib.Vector(this.ƀmu,t),{includeEdges:false})||this.ƀcs.rectangle.isPointInside(new helpersLib.Vector(this.ƀmu,e),{includeEdges:false}))?this.ƀcs.rectangle.topLeft.x:this.ƀmu}ƀbu(t){let e,i;switch(t.direction){case "topRight":e=new helpersLib.Vector(t.position.x,-1/0),i=new helpersLib.Vector(1/0,t.position.y);break;case "topLeft":e=new helpersLib.Vector(-1/0,-1/0),i=t.position;break;case "bottomRight":e=t.position,i=new helpersLib.Vector(1/0,1/0);break;case "bottomLeft":e=new helpersLib.Vector(-1/0,t.position.y),i=new helpersLib.Vector(t.position.x,1/0);break;default:{t.direction;throw new Error}}return new helpersLib.Rectangle(e,i)}};var He=class{static{h(this,"ConsistentSpaceTextWrapper");}static wrapText(t,e){return t.forEach(i=>{i.forEach((s,r)=>{if(e.isSpaceAvailable(new helpersLib.Vector(s.style.width,s.style.height)))if(s.whitespace&&r===i.length-2){let o=i[i.length-1];e.isSpaceAvailable(new helpersLib.Vector(o.style.width+s.style.width,o.style.height))?e.insertWord(s):this.ƀmv(s,e);}else e.insertWord(s);else e.lineIsEmpty?e.insertWord(s):s.whitespace?this.ƀmv(s,e):(e.newLine(),e.insertWord(s));}),e.newLine();}),e.print()}static ƀmv(t,e){let i=Math.max(0,Math.floor(e.remainingWidth/t.style.spaceWidth)),s=Math.max(0,Math.min(i,t.text.length-1));if(s>0){let o={text:" ".repeat(s),whitespace:true,style:{...t.style,width:s*t.style.spaceWidth}};e.insertWord(o);}e.newLine();let r=t.text.length-s-1;if(r>0){let o={text:" ".repeat(r),whitespace:true,style:{...t.style,width:r*t.style.spaceWidth}};e.insertWord(o);}}};var je=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀhe(t),t=this.ƀmc(t),this.ƀaz(t)}static ƀhe(t){return t.map(e=>{let i=[],s,r=true;return e.forEach(o=>{if(!s||s.chunk.style.cacheKey!==o.chunk.style.cacheKey)s&&i.push(s),s=o,r=o.chunk.whitespace;else {let a=s.chunk.text+o.chunk.text;r=o.chunk.whitespace&&r,s={chunk:{text:a,whitespace:r,style:{...s.chunk.style,width:s.chunk.style.width+o.chunk.style.width}},position:s.position};}}),s&&i.push(s),i})}static ƀmc(t){return t.map(e=>{if(e.length===0)return [];let i=e.pop();if(!i.chunk.whitespace||i.chunk.text===""){let s=i.chunk.text.length,r=i.chunk.text.trimEnd();s!==r.length?e.push({chunk:{text:r,whitespace:false,style:{...i.chunk.style,width:i.chunk.style.width-(s-r.length)*i.chunk.style.spaceWidth}},position:i.position}):e.push(i);}return e})}static ƀaz(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 fe=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=Ne.process(t,e),s=helpersLib.JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),r=new Le(e.default.wordWrapWidth??1/0,s),o=He.wrapText(i,r);return je.process(o)}};var oo=1,ur=1/oo,de=class extends d{static{h(this,"Text");}get ƀlv(){if(!this.ƀlw){let t=new W__namespace.TextStyle(this.ƀja);this.ƀlw=W__namespace.CanvasTextMetrics.measureText(this.ƀlu,t);}return this.ƀlw}get ascent(){return this.ƀlv.fontProperties.ascent}constructor(t,e){super(),this.ƀja=zt.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀiz.destroyed&&this.ƀiz.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new helpersLib.Vector(this.ƀiz.anchor.x,this.ƀiz.anchor.y)}set anchor(t){this.ƀi=t,this.ƀiz.anchor.set(t.x,t.y),this.ƀjq();}setText(t){return this.ƀlu!==t&&(this.ƀlu=t,this.ƀjm()),this}setColor(t){let e=helpersLib.ColorHelper.rgbToHex(t);return this.ƀja.fill!==e&&(this.ƀja.fill=e,this.ƀjm()),this}ƀjm(){this.ƀiz?.destroy(),this.ƀlo?.destroy(),this.ƀlo=void 0,this.ƀlw=void 0;let t=new W__namespace.TextStyle(this.ƀja);this.ƀiz=new W__namespace.Text({text:this.ƀlu,style:t}),this.ƀi&&this.ƀiz.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀjq(),this.ƀiz.scale.set(ur,ur),this.ƀiv.addChild(this.ƀiz),this.ƀja.lineThrough&&(this.ƀlo=this.ƀe(this.ƀiz,this.ƀja.fill),this.ƀiv.addChild(this.ƀlo));}ƀjq(){let t=W__namespace.CanvasTextMetrics.measureText(this.ƀlu,new W__namespace.TextStyle({...this.ƀja,dropShadow:false})),e=-this.ƀiz.anchor.x*t.width,i=-this.ƀiz.anchor.y*t.height;this.ƀiz.boundsArea=new W__namespace.Rectangle(e,i,t.width,t.height);}ƀe(t,e){let i=W__namespace.CanvasTextMetrics.measureText(t.text,t.style),s=Math.max(1,Math.round(i.lineHeight*.07)),r=s%2*.5,o=new W__namespace.Graphics,a=0;return i.lines.forEach((l,c)=>{let p=W__namespace.CanvasTextMetrics.measureText(l,t.style),f=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+r,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),o.moveTo(Math.floor(g),f),o.lineTo(Math.floor(g+p.width),f),a+=p.lineHeight;}),o.stroke({width:s,color:e}),o}};var gi=class extends d{static{h(this,"RichText");}constructor(t,e){super(),fe.process(t,e).forEach(s=>new de(s.text,s.style).setPosition(s.position).displayParent(this).attach(this));}};var wi=class extends d{static{h(this,"UpdatableContainer");}},xi=class extends d{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀca=t,this.ƀcy=new Map,this.ƀic={trackBy:h((i,s)=>s,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀcy.keys()),i=0;t.forEach((s,r)=>{let o=this.ƀic.trackBy(s,r),a;this.ƀcy.has(o)?(a=this.ƀcy.get(o),e.delete(o),a.update(s)):(a=this.ƀca(s).displayParent(this).attach(this),this.ƀcy.set(o,a)),this.ƀic.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀic.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀic.positioning.spacing);}),e.forEach(s=>{this.ƀcy.get(s).destroy(),this.ƀcy.delete(s);});}};var me=class n extends d{static{h(this,"MenuUI");}static{this.ƀgd=actionsLib.Reducer.createExistenceChecker();}static{this.isAnyMenuTransitioning=this.ƀgd.notifier;}constructor(t,e){super(),this.ƀhu=new actionsLib.SingleAction,this.onCreate=this.ƀhu.notifier,this.ƀhw=new actionsLib.SingleAction,this.onOpen=this.ƀhw.notifier,this.ƀhr=new actionsLib.SingleAction,this.onClose=this.ƀhr.notifier,this.ƀbd=false;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.setAlpha(0),this.ƀp=new O(this,"alpha",{animation:b.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState});let s=A.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(i.backgroundDarkeningRatio).setInteractive(true).displayParent(this).attach(this);this.ƀhc=et.createByName(t).setPosition(new helpersLib.Vector(0,0)).setInteractive(true).displayParent(this).attach(this),y.instance.screenSize.subscribe(o=>{s.aspectRatio=o.x/o.y,s.scale=Math.max(o.x,o.y),s.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.half}),this.setPosition(o.multiplyNumber(.5));}).attach(this),this.ƀhu.resolve();let r=n.ƀgd.effect().attach(this);this.ƀp.animate({alpha:1}).chain(this).tap(()=>{this.ƀhw.resolve(),r.destroy(),i.closeOnBackgroundClick&&s.on(exports.ContainerEventType.Click).take(1).tap(()=>this.close()).attach(this);}).attachToRoot();}getBoundingMask(){return this.ƀhc.getBoundingMask()}close(){if(!this.ƀbd){this.ƀbd=true;let t=n.ƀgd.effect().attach(this);this.ƀp.animate({alpha:0}).chain(this).map(()=>{this.ƀhr.resolve(),t.destroy(),this.destroy();}).chainToRoot();}return this.onClose.toSingleEvent()}};var bi=class extends dt{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.ƀic=t,queueMicrotask(()=>{if(!this.ƀhd)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀjo(t){this.ƀhd=t,this.ƀhd.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀhd.onCreate.toSingleEvent()}onOpen(){return this.ƀhd.onOpen.toSingleEvent()}onClose(){return this.ƀhd.onClose.toSingleEvent()}close(){return this.ƀhd.close()}};var Pi=class extends Z{static{h(this,"MenuView");}constructor(t,e,i){super();let s=helpersLib.JsonHelper.removeUndefinedProperties({appearAnimationDuration:i.appearAnimationDuration,backgroundDarkeningRatio:i.backgroundDarkeningRatio,closeOnBackgroundClick:t.ƀic.closeOnBackgroundClick}),r=new me(e,s).displayParent(y.camera.layers.foregroundScreen).attach(this);t.ƀjo(r);let o=new actionsLib.SingleAction;r.onCreate.subscribe(()=>o.resolve(r)).attach(this),this.onCreate=o.notifier,this.onOpen=r.onOpen.notifier,this.onClose=r.onClose.notifier;}};var fo=.65,mo=.01,We=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀkb}get contentSize(){return this.ƀbo.size.ceil()}constructor(t,e,i,s){this.ƀbo=t,this.ƀw=e,this.ƀie=i,this.ƀku=s,this.ƀga=false,this.ƀkb=e-i*2,this.ƀbo.y=i,this.ƀlp=i;}onWheel(t){this.setTarget(this.ƀlp-t*fo);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀlp=helpersLib.NumberHelper.clamp(t,this.ƀw-this.ƀie-this.contentSize.y,this.ƀie);}jumpToTarget(){this.ƀbo.y=this.ƀlp;}update(t){let e=this.contentSize;if(e.y<=this.ƀkb){switch(this.ƀku){case "start":this.ƀlp=this.ƀie;break;case "center":this.ƀlp=(this.ƀw-e.y)*.5;break;case "end":this.ƀlp=this.ƀw-e.y-this.ƀie;break;default:{this.ƀku;throw new Error}}this.ƀga||(this.ƀbo.y=this.ƀlp);}this.ƀga=true;let i=this.ƀlp-this.ƀbo.y;this.ƀbo.y=this.ƀbo.y+i*mo*t;}};var go=15,Si=class extends d{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbp}get contentSize(){return this.ƀkc.contentSize}constructor(t,e={}){super();let i={padding:go,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 s=new d().displayParent(this).attach(this);new Ot(s,t,i.padding).attach(this);let r=new W__namespace.Graphics;r.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),s.ƀiv.addChild(r);let o=new d().displayParent(s).attach(this);this.ƀkc=new We(o,t.y,i.padding,i.smallContentAlign),this.ƀbp=new helpersLib.Vector(t.x,this.ƀkc.scrollHeight),r.eventMode="dynamic",r.addEventListener("wheel",a=>{this.ƀkc.onWheel(a.deltaY);}),o.setInteractive(true),o.ƀiv.addEventListener("wheel",a=>{this.ƀkc.onWheel(a.deltaY);}),w.afterSceneUpdateAction.subscribe(a=>this.ƀkc.update(a.delta)).attach(this),this.addChildTo=o;}scrollToTop(t){this.ƀkc.scrollToTop(),t?.instant&&this.ƀkc.jumpToTarget();}scrollToBottom(t){this.ƀkc.scrollToBottom(),t?.instant&&this.ƀkc.jumpToTarget();}};var Ti=class extends d{static{h(this,"LayoutContainer");}constructor(t={}){super(new components.LayoutContainer),this.ƀiv.layout={isLeaf:false,...t};}setLayout(t){return this.ƀiv.layout=t,this}debug(){return this.ƀiv.layout={debug:true},this}debugBackground(){return this.ƀiv.layout={backgroundColor:"#3080FF"},this}};var xo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},N=class extends dt{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);}};N=xo([It()],N);var vo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},bo=1500,ke=class{static{h(this,"CameraService");}createCamera(){return new N().attachToRoot()}getCameraPosition(){let t=N.getInstanceOrFail();return helpersLib.Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=N.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=N.getInstanceOrFail();e.focusingNewTargetInfo.value={time:y.time,duration:t?.duration??bo,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??exports.FocusingAnimation.Instant};}update(t,e){let i=N.getInstanceOrFail(),s=i.targetPosition.value;s&&(i.focusingNewTargetInfo.value?this.ƀgh(i,s,t):i.position.value=s);}ƀgh(t,e,i){let s=t.focusingNewTargetInfo.value;if(s.focusingAnimation===exports.FocusingAnimation.Instant)this.ƀbi(t,e);else {let r=(i-s.time)/s.duration;if(r>=1)this.ƀbi(t,e);else {let o;s.focusingAnimation===exports.FocusingAnimation.EaseInOut?o=U.easeInOut(r):s.focusingAnimation===exports.FocusingAnimation.EaseOut?o=U.easeOut(r):o=1;let a=s.position.lerp(e,o);s.roundPosition&&(Math.abs(a.x-s.position.x)>=s.roundPositionThreshold&&(a=new helpersLib.Vector(Math.round(a.x),a.y)),Math.abs(a.y-s.position.y)>=s.roundPositionThreshold&&(a=new helpersLib.Vector(a.x,Math.round(a.y)))),t.position.value=a;}}}ƀbi(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};ke=vo([u()],ke);var Po=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},So=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ri=class{static{h(this,"CameraController");}constructor(t){this.ƀav=t;}createCamera(){return this.ƀav.createCamera().id}update(t,e){this.ƀav.update(t,e);}setPosition(t){this.ƀav.setPosition(t);}setTransition(t){this.ƀav.setTransition(t);}getCameraPosition(){return this.ƀav.getCameraPosition()}};Ri=Po([lt(exports.CameraGateway),So("design:paramtypes",[ke])],Ri);var ze=class{static{h(this,"PositionConversionHelper");}static includeScaleInScreenPosition(t,e,i){if(e!==1){let s=helpersLib.Vector.fromTo(i,t).multiplyNumber(1/e);return i.add(s)}else return t}};var Eo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Ro=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Gt=class extends Z{static{h(this,"CameraView");}constructor(t){super(),this.ƀdi=t,this.ƀld=(()=>{let e=new d().attach(this);return e.ƀiv=y.instance.ƀiu.stage,e})(),this.ƀjw=new d().setAlpha(0).displayParent(this.ƀld).attach(this),this.ƀag=A.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(this.ƀld).attach(this),this.ƀad=new d().displayParent(this.ƀjw).attach(this),this.ƀau=new d().displayParent(this.ƀjw).attach(this),this.ƀdv=new d().setSortableChildren(true).displayParent(this.ƀjw).attach(this),this.ƀat=new d().setSortableChildren(true).displayParent(this.ƀau).attach(this),this.ƀdu=new d().setSortableChildren(true).setRenderGroup().setZIndex(20).displayParent(this.ƀat).attach(this),this.ƀgu=new d().setSortableChildren(true).setRenderGroup().setZIndex(10).displayParent(this.ƀat).attach(this),this.ƀac=new d().setRenderGroup().setZIndex(0).displayParent(this.ƀat).attach(this),this.ƀh=new O(this.ƀjw,"alpha",{duration:500,animation:b.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀah=new O(this.ƀag,"alpha",{duration:500,animation:b.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),y.instance.screenSize.subscribe(e=>{this.ƀag.aspectRatio=e.x/e.y,this.ƀag.scale=Math.max(e.x,e.y),this.ƀag.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.zero});}).attach(this),this.ƀdi.position.subscribe(e=>{this.ƀat.position=this.ƀbv(e);}).attach(this),this.ƀdi.offset.subscribe(e=>{this.ƀau.position=e;}).attach(this),this.ƀah.set({alpha:0}),this.ƀh.set({alpha:0});}screenPositonToStagePosition(t){let e=ze.includeScaleInScreenPosition(t,this.ƀld.scale,y.instance.screenSizeCenter.value);return new helpersLib.Vector(e.x-this.ƀat.position.x-this.ƀau.position.x,e.y-this.ƀat.position.y-this.ƀau.position.y)}getLayers(){return {backgroundScreen:this.ƀad.id,background:this.ƀac.id,main:this.ƀgu.id,foreground:this.ƀdu.id,foregroundScreen:this.ƀdv.id}}appear(t,e,i){switch(e){case "alpha":return this.ƀah.set({alpha:0}),this.ƀh.set({alpha:t?0:1}),actionsLib.SingleEvent.instant().async(()=>i>0&&w.wait(i),"tap").async(()=>this.ƀh.animate({alpha:t?1:0})).chain(this);case "pureBlack":return this.ƀh.set({alpha:1}),this.ƀah.set({alpha:t?1:0}),actionsLib.SingleEvent.instant().async(()=>i>0&&w.wait(i),"tap").async(()=>this.ƀah.animate({alpha:t?0:1})).chain(this);case "instant":return this.ƀh.set({alpha:t?1:0}),this.ƀah.set({alpha:t?0:1}),actionsLib.SingleEvent.instant();default:{throw new Error}}}ƀbv(t){return helpersLib.Vector.fromTo(t,y.instance.screenSizeCenter.value)}};Gt=Eo([oi({entity:N}),Ro("design:paramtypes",[N])],Gt);var Co=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Ci=class{static{h(this,"CameraViewController");}getLayers(){let t=N.getInstanceOrFail().id;return Gt.getInstanceOrFail(t).getLayers()}appear(t,e,i){let s=N.getInstanceOrFail().id;return Gt.getInstanceOrFail(s).appear(t,e,i)}screenPositonToStagePosition(t){let e=N.getInstanceOrFail().id;return Gt.getInstanceOrFail(e).screenPositonToStagePosition(t)}};Ci=Co([lt(Bt)],Ci);var Ao=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Oo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.KeyboardService=class Ai{static{h(this,"KeyboardService");}constructor(){this.ƀgj=new actionsLib.Action,this.keyPressed=this.ƀgj.notifier,this.ƀgk=new actionsLib.Action,this.keyReleased=this.ƀgk.notifier,this.ƀgq=new Set,this.ƀgp=new Set,window.addEventListener("keydown",t=>{this.ƀgq.add(t.code),this.ƀgp.add(t.code),!t.repeat&&this.ƀgj.trigger({key:t.key,code:t.code});}),window.addEventListener("keyup",t=>{this.ƀgq.delete(t.code),this.ƀgk.trigger({key:t.key,code:t.code});}),window.addEventListener("blur",()=>{this.ƀgq.clear();}),w.afterSceneUpdateAction.subscribe(()=>this.ƀgp.clear()).attachToRoot();}isKeyDown(t,e){return (e?.onlyPressedThisFrame?this.ƀgp:this.ƀgq).has(t)}};exports.KeyboardService=Ao([u(),Oo("design:paramtypes",[])],exports.KeyboardService);var Mo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Do=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.MouseService=class we{static{h(this,"MouseService");}constructor(){this.ƀfz=new actionsLib.Variable(false),this.initialMouseMovementHappened=this.ƀfz.notifier,this.ƀle=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀle.notifier,this.ƀjy=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀjy.notifier,this.ƀgt=new actionsLib.Variable(false),this.mainButtonState=this.ƀgt.notifier,this.ƀkd=new actionsLib.Variable(false),this.secondaryButtonState=this.ƀkd.notifier,this.ƀlg(),window.addEventListener("pointerdown",t=>{t.button===0?this.ƀgt.value=true:t.button===2&&(this.ƀkd.value=true);},{capture:true}),window.addEventListener("pointerup",t=>{t.button===0?this.ƀgt.value=false:t.button===2&&(this.ƀkd.value=false);},{capture:true}),window.addEventListener("blur",()=>{this.ƀgt.value=false,this.ƀkd.value=false;},{capture:true});}ƀlg(){let t=helpersLib.Vector.zero;window.addEventListener("pointermove",e=>{t=new helpersLib.Vector(e.clientX,e.clientY),this.ƀfz.value=true;},{capture:true}),w.beforeSceneUpdateAction.subscribe(()=>{this.ƀjy.value=this.ƀbc(t);}).attachToRoot(),w.afterSceneUpdateAction.subscribe(()=>{this.ƀle.value=y.camera.screenPositonToStagePosition(this.ƀjy.value);}).attachToRoot();}ƀbc(t){let i=y.instance.renderer.canvas.getBoundingClientRect(),s=i.width,r=i.height;if(s<=0||r<=0)return helpersLib.Vector.zero;let o=y.instance.renderer.screen,a=(t.x-i.left)/s*o.width,l=(t.y-i.top)/r*o.height;return a=helpersLib.NumberHelper.clamp(a,0,o.width),l=helpersLib.NumberHelper.clamp(l,0,o.height),new helpersLib.Vector(a,l)}};exports.MouseService=Mo([u(),Do("design:paramtypes",[])],exports.MouseService);var Bo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Go=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.MouseTargetFocusService=class Oi{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀdt}get lastFocusedPosition(){return this.ƀgm}constructor(t){this.ƀhi=t,this.ƀhy=new actionsLib.Action,this.onTargetFocus=this.ƀhy.notifier,this.ƀma=0,this.ƀmb=false,this.ƀdt=false,this.ƀgm=void 0,w.beforeSceneUpdateAction.subscribe(e=>this.ƀme(e.delta)).attachToRoot();}ƀme(t){if(this.ƀhj){let e=this.ƀeu(this.ƀhi.stagePosition.value,this.ƀhj);this.ƀij===void 0?this.ƀij=e:this.ƀay(e,t);}this.ƀhj=this.ƀhi.stagePosition.value;}ƀay(t,e){this.ƀij-t>10?(this.ƀma=Math.max(250,this.ƀma),this.ƀmb=true):this.ƀma>1e3&&(this.ƀmb=true);let i=this.ƀma>=300&&this.ƀmb;this.ƀgi(i,t,e);}ƀgi(t,e,i){(t||e>this.ƀij)&&(this.ƀij=e),t?(this.ƀmb=false,this.ƀma=0,this.ƀdt=true,this.ƀgm=this.ƀhi.stagePosition.value,this.ƀhy.trigger(this.ƀgm)):(this.ƀma+=i,this.ƀdt=false);}ƀeu(t,e){let i=helpersLib.Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};exports.MouseTargetFocusService=Bo([u(),Go("design:paramtypes",[exports.MouseService])],exports.MouseTargetFocusService);var Mi=10.8,Di=10.01;exports.PhysicsShapeType=void 0;(function(n){n[n.Point=1]="Point",n[n.Circle=2]="Circle",n[n.Polygon=3]="Polygon",n[n.Rectangle=4]="Rectangle";})(exports.PhysicsShapeType||(exports.PhysicsShapeType={}));var m=class n{static{h(this,"P2JSHelper");}static aabbToBoundingBox(t){return helpersLib.Rectangle.fromRect({topLeft:{x:t.lowerBound[0],y:t.lowerBound[1]},bottomRight:{x:t.upperBound[0],y:t.upperBound[1]}})}static arrayToVector(t){return new helpersLib.Vector(t[0],t[1])}static vectorToArray(t){return [t.x,t.y]}static arePhysicsGroupsCollidable(t,e,i,s){return (t&s)!==0&&(i&e)!==0}static canCollideWith(t,e){return t.shapes.some(i=>e.shapes.some(s=>n.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,s.collisionGroup,s.collisionMask)))}static cloneP2Body(t){let e=new X__default.default.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var xt="border";var Ho=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r};exports.PhysicsGateway=class xe extends ht(){static{h(this,"PhysicsGateway");}};exports.PhysicsGateway=Ho([u()],exports.PhysicsGateway);var jo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},vt=class extends ht(){static{h(this,"PhysicsInternalGateway");}};vt=jo([u()],vt);var S=class n extends Q{static{h(this,"PhysicsEntity");}static{this.ƀid=new Map;}static{this.ƀin=new Map;}static getFromP2BodyID(t){return n.ƀid.get(t)}static getFromP2BodyIDOrFail(t){let e=n.ƀid.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=n.ƀin.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(n.ƀin.values())}get area(){return this.ƀv}get mass(){return this.ƀgx}get collisions(){return this.ƀbe}constructor(t,e,i){super(),this.ƀhs=new actionsLib.Action,this.onCollision=this.ƀhs.notifier,this.type="dynamic",this.ƀv=0,this.ƀgx=0,this.ƀbe=[],this.physicsWorldID=t,this.ƀip=E.get(vt);let s=this.ƀip.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),r=this.ƀip.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀio=this.ƀip.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀiq=this.ƀip.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀip.createBody(this.physicsWorldID,e,s,r,this.type),this.ƀv=this.p2Body.getArea(),this.ƀgx=this.p2Body.mass,this.p2Body.position=m.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀip.addBody(this.physicsWorldID,this.p2Body,e.addInEmptySpace,e.shapeDefinition.group,e.includeOnPathfinding))throw new Error("PhysicsEntity was not able to be added to the world!");n.ƀid.set(this.p2Body.id,this),n.ƀin.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀip.removeBody(this.physicsWorldID,this.p2Body),n.ƀid.delete(this.p2Body.id),n.ƀin.delete(this.id));}canCollideWith(t){return m.arePhysicsGroupsCollidable(this.ƀio,this.ƀiq,t.ƀio,t.ƀiq)}ƀkf(t){this.ƀbe=t,t.length>0&&this.ƀhs.trigger(t);}};var ve=class extends S{static{h(this,"ImmovablePhysicsEntity");}constructor(t,e){super(t,e,"static"),this.position=m.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 Bi=class extends Q{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),w.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀlk(t,e);}).attach(this);}ƀlk(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 Gi=class extends S{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.ƀfs=false,this.ƀft=false,this.ƀfv=false,this.ƀfu=false,this.ƀik(),this.ƀgr(),E.get(vt).subscribeToPhysicsStep(t,({time:i,delta:s})=>this.ƀlk(i,s)).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}}ƀlk(t,e){this.ƀfs=true,this.ƀft=true,this.ƀfv=true,this.ƀfu=true,this.ƀik();}ƀik(){this.position.value=m.arrayToVector(this.p2Body.position),this.rotation.value=new helpersLib.Radian(this.p2Body.angle),this.velocity.value=m.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀgr(){this.position.subscribe(t=>{this.ƀfs?this.ƀfs=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀft?this.ƀft=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfv?this.ƀfv=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfu?this.ƀfu=false:this.p2Body.angularVelocity=t;}).attach(this);}};var ko=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},zo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},P=class extends Q{static{h(this,"PhysicsWorldEntity");}constructor(t,e,i,s,r,o,a){super(),this.materialDefinitions=new Map,this.physicsBodyGroupToP2Group=new Map,this.physicsBodyGroupToP2Mask=new Map,this.availabilityGridCache=new Map,this.vectorFieldCache=new Map,this.bodiesInContactWith=new Map,this.collisionReports=new Map,this.paused=new actionsLib.Variable(false),this.lastP2Time=new actionsLib.Variable(0),this.onPhysicsStep=new actionsLib.Action,this.mapSize=t,this.mapSizeCenter=this.mapSize.multiplyNumber(.5),this.modifyUpdateCycle=e,this.p2World=i,this.materials=s,this.materialDefinitions=r,this.physicsBodyGroupToP2Group=o,this.physicsBodyGroupToP2Mask=a;}};P=ko([It(),zo("design:paramtypes",[helpersLib.Vector,Boolean,X__default.default.World,Map,Map,Map,Map])],P);var Ko=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},st=class{static{h(this,"PhysicsBodyGroupService");}createBodyGroupsAndMasks(t,e){let i=new Map,s=new Map;return t.map((r,o)=>{if(o>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(r,1<<o),s.set(r,0);}),e.map(([r,o])=>{if(!i.has(r))throw new Error(`Physics body group "${r}" not found`);if(!i.has(o))throw new Error(`Physics body group "${o}" not found`);let a=s.get(r),l=s.get(o),c=i.get(r),p=i.get(o);s.set(r,a|p),s.set(o,l|c);}),{physicsBodyGroupToP2Group:i,physicsBodyGroupToP2Mask:s}}getGroupConstant(t,e){return P.getInstanceByIDOrFail(t).physicsBodyGroupToP2Group.get(e)}getMaskConstant(t,e){return P.getInstanceByIDOrFail(t).physicsBodyGroupToP2Mask.get(e)}canCollide(t,e,i){let s=t.physicsBodyGroupToP2Group.get(e),r=t.physicsBodyGroupToP2Mask.get(e),o=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (r&o)!==0&&(a&s)!==0}};st=Ko([u()],st);var Zo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Qo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Xe=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀim=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((s,r)=>{s.forEach((o,a)=>{this.ƀim.canCollide(t,a,e)&&i.push({grid:o,cellSize:r});});}),i}get(t,e,i){return t.availabilityGridCache.get(e)?.get(i)}set(t,e,i,s){let r=t.availabilityGridCache.get(e);r||(r=new Map,t.availabilityGridCache.set(e,r)),r.set(i,s);}clear(t){t.availabilityGridCache.clear();}};Xe=Zo([u(),Qo("design:paramtypes",[st])],Xe);var qo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},tn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},bt=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀim=t,this.ƀaa=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let s=m.aabbToBoundingBox(e.aabb);this.ƀaa.getCollidableGrids(t,i).forEach(r=>{let o=_.areaToGridArea(s,r.cellSize);r.grid.setArea(o,false);});}findClosestAvailableSpace(t,e,i,s=50){return e.aabbNeedsUpdate=true,e.updateAABB(),ne.findByConvertingGridSpace(this.getAvilabilityGrid(t,s,i),m.aabbToBoundingBox(e.aabb),s)}getAvilabilityGrid(t,e,i){let s=this.ƀaa.get(t,e,i);return s||(s=this.ƀcd(t,e,i),this.ƀaa.set(t,e,i,s)),s}ƀcd(t,e,i){let s=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(r=>{let o=S.getFromP2BodyIDOrFail(r.id);if(o.includeInPathfinding&&this.ƀim.canCollide(t,o.physicsBodyGroup,i)){let a=this.ƀek(r,e);s.setArea(a,false);}}),s}ƀek(t,e){let i=m.aabbToBoundingBox(t.aabb);return _.areaToGridArea(i,e)}};bt=qo([u(),tn("design:paramtypes",[st,Xe])],bt);var sn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},on=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Kt=class{static{h(this,"PathFinderService");}constructor(t){this.ƀil=t;}findPathAStar(t,e,i,s,r){r||(r={}),r.neighborType===void 0&&(r.neighborType="orthogonal"),r.gridCellSize===void 0&&(r.gridCellSize=50);let o=P.getInstanceByIDOrFail(t),a,l;helpersLib.Comparator.isNumber(i)?(l=S.getPhysicsInstanceOrFail(i).p2Body,a=m.arrayToVector(l.position)):a=i;let c=_.positionToGridPosition(e,r.gridCellSize),p=_.positionToGridPosition(a,r.gridCellSize),f=this.ƀil.getAvilabilityGrid(o,r.gridCellSize,s);if(l){let v=m.aabbToBoundingBox(l.aabb),x=_.areaToGridArea(v,r.gridCellSize);f.setArea(x,true);}let g=ae.findPath(f,c,p,r.neighborType);return g.path=g.path.map(v=>_.gridPositionToPosition(v,r.gridCellSize)),g}findPathDirection(t,e,i,s,r=50){let o=P.getInstanceByIDOrFail(t),a;if(helpersLib.Comparator.isNumber(i)){let g=S.getPhysicsInstanceOrFail(i);a=m.aabbToBoundingBox(g.p2Body.aabb);}else a=new helpersLib.Rectangle(i,i);let l=_.areaToGridArea(a,r),c=JSON.stringify({targetGridArea:l,collidableWithGroup:s}),p=o.vectorFieldCache.get(c);if(!p){let g=this.ƀil.getAvilabilityGrid(o,r,s);p=new he(l,g),o.vectorFieldCache.set(c,p);}let f=_.positionToGridPosition(e,r);return p.getDirectionToTarget(f)}};Kt=sn([u(),on("design:paramtypes",[bt])],Kt);var an=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},hn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},nt=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀab=t,this.ƀif=e;}printPathfindingTestGrid(t,e,i,s,r,o){let a=P.getInstanceByIDOrFail(t);this.ƀab.getAvilabilityGrid(a,o,s).map((c,p)=>({position:_.gridPositionToPosition(p,o),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(r)){let p=this.ƀif.findPathDirection(t,c.position,i,s),f;p===void 0?f=A.createRectangleBorders(new helpersLib.Vector(8,8),2,helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):f=A.createArrow(25,c.availability?helpersLib.ColorHelper.green:helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).setRotation(p).attach(a),new O(f,"alpha",{duration:1e3,animation:b.easeIn}).animate({alpha:0}).tap(()=>f.destroy()).attach(f);}});}createExplosionDebugVisual(t,e,i,s,r,o=300){let a=new d().displayParent(e).setAlpha(.5).attach(t);A.createCircle(r,helpersLib.ColorHelper.blue).toSprite().displayParent(a).setPosition(s,{round:false}).setAlpha(.5).attach(t),i.forEach(c=>{let p=c.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;A.createVector(s,c.line.to,p).toSprite().displayParent(a).attach(t);}),new O(a,"alpha",{duration:o,animation:b.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,s,r,o,a=300){let l=new d().displayParent(e).setAlpha(.5).attach(t);A.createElipse(o,helpersLib.ColorHelper.blue).toSprite().displayParent(l).setPosition(s,{round:false}).setRotation(r).setAlpha(.5).attach(t),i.forEach(p=>{let f=p.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;A.createVector(p.line.from,p.line.to,f).toSprite().displayParent(l).attach(t);}),new O(l,"alpha",{duration:a,animation:b.easeIn}).animate({alpha:0}).tap(()=>l.destroy()).attach(l);}createPhysicsEntityShapeVisual(t,e,i){let s=i?.overridePosition??m.arrayToVector(t.position),r=i?.overrideRotation??new helpersLib.Radian(t.angle),o=i?.color??helpersLib.ColorHelper.blue,a=new d().displayParent(e).setPosition(s,{round:false}).setRotation(r).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀda(c,o).displayParent(a).attachToRoot();}),new O(a,"alpha",{duration:1e3,animation:b.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀda(t,e){switch(t.type){case X__default.default.Shape.PARTICLE:throw new Error("Not implemented");case X__default.default.Shape.LINE:throw new Error("Not implemented");case X__default.default.Shape.PLANE:throw new Error("Not implemented");case X__default.default.Shape.CIRCLE:throw new Error("Not implemented");case X__default.default.Shape.CAPSULE:throw new Error("Not implemented");case X__default.default.Shape.BOX:throw new Error("Not implemented");case X__default.default.Shape.HEIGHTFIELD:throw new Error("Not implemented");case X__default.default.Shape.CONVEX:return this.ƀcz(t,e);default:{t.type;throw new Error}}}ƀcz(t,e){let i=[t.vertices.map(s=>({x:s[0],y:s[1]}))];return A.createPolygon(i,e).toSprite()}};nt=an([u(),hn("design:paramtypes",[bt,Kt])],nt);var pn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},un=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ke=class{static{h(this,"HitTestService");}constructor(t){this.ƀlt=t;}hitTest(t,e){let i=t.world,s=S.getFromP2BodyIDOrFail(t.id),r=m.cloneP2Body(t);this.ƀt(r,e);let o=i.broadphase.aabbQuery(i,this.ƀdy(r)).map(l=>S.getFromP2BodyIDOrFail(l.id)).filter(l=>l.includeInPathfinding).filter(l=>s.canCollideWith(l)).map(l=>m.cloneP2Body(l.p2Body)),a=false;if(o.length!==0){let l=new X__default.default.World;l.addBody(r),o.forEach(c=>l.addBody(c)),l.step(1,1,1),a=l.narrowphase.contactEquations.some(c=>c.bodyA===r||c.bodyB===r),l.clear();}if(e?.testLayerID){let l=a?helpersLib.ColorHelper.red:helpersLib.ColorHelper.green;this.ƀlt.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀt(t,e){e?.overridePosition&&(t.position=m.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀdy(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};Ke=pn([u(),un("design:paramtypes",[nt])],Ke);var dn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Ze=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀjn(t,i);});});}step(t,e,i){S.getPhysicsEntities().forEach(s=>{s.ƀbe=[];}),t.p2World.narrowphase.contactEquations.forEach(s=>{this.ƀjn(t,s);}),t.bodiesInContactWith.forEach((s,r)=>{this.ƀfi(s.p2Body),s.entity.ƀkf(t.collisionReports.get(r)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀfi(t){let e=m.arrayToVector(t.velocity);e.length>Mi&&(e=e.normalize(Mi),t.velocity=m.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-Di),Di);}ƀjn(t,e){let i=S.getFromP2BodyID(e.bodyA.id),s=S.getFromP2BodyID(e.bodyB.id);if(i&&s){t.bodiesInContactWith.set(e.bodyA.id,{p2Body:e.bodyA,entity:i}),t.bodiesInContactWith.set(e.bodyB.id,{p2Body:e.bodyB,entity:s});let r=t.collisionReports.get(e.bodyA.id)||[],o=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀed(i,s,e);r.push({self:a,target:l}),o.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,r),t.collisionReports.set(e.bodyB.id,o);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀed(t,e,i){let s=t.convertToDTO(),r=e.convertToDTO(),o=m.arrayToVector(i.contactPointA),a=m.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀes(i);return {collisionDetailsA:this.ƀec(s,i.bodyA.mass,o,l,t.area),collisionDetailsB:this.ƀec(r,i.bodyB.mass,a,c,e.area)}}ƀec(t,e,i,s,r){let o,a=i.add(t.position);return {body:t,getPositionReletiveToObject:h(()=>(o||(o=i.rotate(t.rotation.multiply(-1).vector)),o),"getPositionReletiveToObject"),getPositionOnWorld:h(()=>(a||(a=i.add(t.position)),a),"getPositionOnWorld"),position:i,mass:e,area:r,normal:s}}ƀes(t){let e=m.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};Ze=dn([u()],Ze);var mn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},yn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Qe=class extends ve{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};Qe=mn([It(),yn("design:paramtypes",[Number,Object])],Qe);var gn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Y=1e4,qe=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbx(t,new helpersLib.Vector(e.x/2,-Y/2),new helpersLib.Vector(e.x+Y*2,Y),i),this.ƀbx(t,new helpersLib.Vector(e.x/2,e.y+Y/2),new helpersLib.Vector(e.x+Y*2,Y),i),this.ƀbx(t,new helpersLib.Vector(-Y/2,e.y/2),new helpersLib.Vector(Y,e.y+Y*2),i),this.ƀbx(t,new helpersLib.Vector(e.x+Y/2,e.y/2),new helpersLib.Vector(Y,e.y+Y*2),i);}ƀbx(t,e,i,s){return new Qe(t,{shapeDefinition:{materialName:xt,group:s,shapeType:exports.PhysicsShapeType.Rectangle,shapeData:i},position:e,rotation:helpersLib.Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};qe=gn([u()],qe);var xn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Tr=new X__default.default.Material,vn={id:xt,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},Zt=class{static{h(this,"MaterialsService");}createMaterials(t,e,i,s){let r=new Map,o=new Map;if(i.forEach(a=>{r.set(a.id,new X__default.default.Material),o.set(a.id,a);}),r.has(xt))throw new Error(`Material with name ${xt} cannot be defined, pick another name for the material.`);return r.set(xt,Tr),o.set(xt,vn),this.ƀc(t,e,i,s,r),{materials:r,materialDefinitions:o}}getMaterial(t,e){let i=P.getInstanceByIDOrFail(t);return this.ƀer(e,i.materials)}getMaterialDefinition(t,e){let i=P.getInstanceByIDOrFail(t);return this.ƀeq(e,i.materialDefinitions)}ƀer(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀeq(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,s,r){this.ƀeh(i.map(o=>o.id),s).forEach(o=>{let a=this.ƀer(o.materialA,r),l=this.ƀer(o.materialB,r);t.addContactMaterial(new X__default.default.ContactMaterial(a,l,{friction:o.friction,restitution:o.bounciness,stiffness:o.stiffness,relaxation:o.relaxation}));}),this.ƀd(t,e,i,r);}ƀeh(t,e){let i=new Map;e.forEach(r=>{let o=i.get(r.materialA);o||(o=new Map,i.set(r.materialA,o)),o.set(r.materialB,r);});let s=[];return t.forEach((r,o)=>{for(let a=o;a<t.length;a++){let l=t[a],c=i.get(r)?.get(l);c?s.push(c):s.push({materialA:r,materialB:l,friction:0,bounciness:0,relaxation:4,stiffness:1e6});}}),s}ƀd(t,e,i,s){i.forEach(r=>{let o=this.ƀer(r.id,s);t.addContactMaterial(new X__default.default.ContactMaterial(o,Tr,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};Zt=xn([u()],Zt);var bn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Pn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Qt=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,s,r){this.ƀhb=t,this.ƀal=e,this.ƀab=i,this.ƀbf=s,this.ƀim=r;}createPhysicsWorld(t){let e=new X__default.default.World({gravity:[0,0]}),{materials:i,materialDefinitions:s}=this.ƀhb.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:r,physicsBodyGroupToP2Mask:o}=this.ƀim.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new P(t.mapSize,t.modifyUpdateCycle,e,i,s,r,o).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&w.cleanUpdateModifier();}).attachToRoot(),this.ƀal.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀbf.registerPhysicsWorld(a),t.modifyUpdateCycle?w.registerUpdateModifier((l,c)=>this.ƀlk(a,l,c)):w.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀlk(a,l,c);}).attach(a),a.id}addBody(t,e,i,s,r){let o=P.getInstanceByIDOrFail(t);if(i){let a=this.ƀab.findClosestAvailableSpace(o,e,s);return a?(e.position[0]+=a.x,e.position[1]+=a.y,o.p2World.addBody(e),r&&this.ƀab.onBodyAdded(o,e,s),true):false}else return o.p2World.addBody(e),r&&this.ƀab.onBodyAdded(o,e,s),true}removeBody(t,e){P.getInstanceByID(t)?.p2World.removeBody(e);}ƀlk(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 s=e+i;this.ƀbf.step(t,s,i),t.onPhysicsStep.trigger({time:s,delta:i}),t.lastP2Time.value=t.p2World.time;}return i}setPaused(t,e){P.getInstanceByIDOrFail(e).paused.set(t);}};Qt=bn([u(),Pn("design:paramtypes",[Zt,qe,bt,Ze,st])],Qt);var Tn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},te=class{static{h(this,"RayCastingService");}castClosest(t,e,i){let s=new X__default.default.RaycastResult,r=new X__default.default.Ray({mode:X__default.default.Ray.CLOSEST,from:m.vectorToArray(e.from),to:m.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i)});if(t.p2World.raycast(s,r),s.hasHit())return this.ƀbs(s,e)}castAllFirstContacts(t,e,i){let s=new Map,r=new X__default.default.Ray({mode:X__default.default.Ray.ALL,from:m.vectorToArray(e.from),to:m.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i),callback:h(o=>{let a=s.get(o.body);!s.has(o.body)||o.fraction<a.fraction?s.set(o.body,this.ƀbs(o,e)):o.fraction===a.fraction&&a.isExternal()&&s.set(o.body,this.ƀbs(o,e));},"callback")});return t.p2World.raycast(new X__default.default.RaycastResult,r),Array.from(s.values())}ƀbs(t,e){let i=t.fraction,s=m.arrayToVector(t.normal),r,o,a;return {body:t.body,hitPosition:h(()=>(r===void 0&&(r=e.from.lerp(e.to,i)),r),"hitPosition"),hitDistance:h(()=>(o===void 0&&(o=e.length*i),o),"hitDistance"),isExternal:h(()=>(a===void 0&&(a=e.fromTo.dotProduct(s)<0),a),"isExternal"),normal:s,fraction:i,line:e}}};te=Tn([u()],te);var En=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Tt=class{static{h(this,"ImpactService");}applyImpulse(t,e,i,s){let r=i.normalize(s),o=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(m.vectorToArray(r),o);}};Tt=En([u()],Tt);var Rn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ee=class{static{h(this,"RayCastHitConverterService");}toExplosionHits(t,e=true){let i=new Map;return t.forEach(s=>{s.hits.forEach(r=>{let o=i.get(r.body);if(o){let a=r.fraction<o.closestRaycastHit.fraction?r:o.closestRaycastHit;o.rayCastHits.push(r),i.set(r.body,{hitCount:o.hitCount+1,closestRaycastHit:a,rayCastHits:o.rayCastHits,isExternal:e?o.isExternal:o.isExternal&&r.isExternal(),explosionCenter:r.line.from});}else {let a=r.isExternal();i.set(r.body,{hitCount:1,closestRaycastHit:r,rayCastHits:[r],isExternal:a,explosionCenter:r.line.from});}});}),[...i.values()].map(s=>this.ƀbt(s,t.length))}ƀbt(t,e){let i=t.hitCount/e,s=t.rayCastHits;if(t.isExternal)return {body:S.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:true,normal:t.closestRaycastHit.normal,fraction:t.closestRaycastHit.fraction,ratioOfHits:i,raycastResults:s,getHitPosition:t.closestRaycastHit.hitPosition,getHitDistance:t.closestRaycastHit.hitDistance};{let r=m.arrayToVector(t.closestRaycastHit.body.position);return {body:S.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:false,normal:helpersLib.Vector.fromTo(r,t.explosionCenter).normalize(),fraction:0,ratioOfHits:i,raycastResults:s,getHitPosition:h(()=>t.explosionCenter,"getHitPosition"),getHitDistance:h(()=>0,"getHitDistance")}}}};ee=Rn([u()],ee);var Cn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},An=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Dn=15,ei=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,s){this.ƀji=t,this.ƀlt=e,this.ƀjh=i,this.ƀfw=s;}createElipticExplosion(t,e,i,s,r,o,a){let l=P.getInstanceByIDOrFail(t),c=this.ƀci(e,i,s,r,a?.hitOnlyClosest===true,l),p=this.ƀjh.toExplosionHits(c,false);return this.ƀr(p,o),a?.testLayerID&&this.ƀlt.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,s,a.debugRayDuration),p.map(f=>{let{p2Body:g,...v}=f;return v})}ƀci(t,e,i,s,r,o){let a=[],l=e.vector,c=e.add(helpersLib.Radian.get90).vector,p=c.normalize(i.x);a.push(new helpersLib.Line(t,t.add(p))),a.push(new helpersLib.Line(t,t.add(p.multiplyNumber(-1))));let f=l.normalize(i.y);a.push(new helpersLib.Line(t,t.add(f))),a.push(new helpersLib.Line(t,t.add(f.multiplyNumber(-1))));let g=Math.round(i.y/Dn),v=i.y/(g*2+1)*2,x=l.normalize(v),M=i.x,L=Math.pow(i.y,2);return helpersLib.ArrayHelper.createIntegerArray(g).forEach(I=>{let K=v*(I+1),_t=x.multiplyNumber(I+1),$=c.normalize(this.ƀfa(M,L,K)),H=t.add(_t);a.push(new helpersLib.Line(H,H.add($))),a.push(new helpersLib.Line(H,H.add($.multiplyNumber(-1))));let j=t.add(_t.multiplyNumber(-1));a.push(new helpersLib.Line(j,j.add($))),a.push(new helpersLib.Line(j,j.add($.multiplyNumber(-1))));}),a.map(I=>{if(r){let K=this.ƀji.castClosest(o,I,s);return {line:I,hits:K?[K]:[]}}else {let K=this.ƀji.castAllFirstContacts(o,I,s);return {line:I,hits:K}}})}ƀfa(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀr(t,e){t.forEach(i=>{i.raycastResults.forEach(s=>{let r,o;s.isExternal()?(r=s.line.fromTo,o=e*2):(r=s.line.fromTo.multiplyNumber(-1),o=e*(1-s.fraction)*8),this.ƀfw.applyImpulse(s.body,s.hitPosition(),r,o);});});}};ei=Cn([u(),An("design:paramtypes",[te,nt,ee,Tt])],ei);var Bn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Gn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},ii=class{static{h(this,"ExplosionService");}constructor(t,e,i,s){this.ƀji=t,this.ƀlt=e,this.ƀjh=i,this.ƀfw=s;}createExplosion(t,e,i,s,r,o){let a=P.getInstanceByIDOrFail(t),l=this.ƀey(i),c=this.ƀci(e,i,s,l,o?.hitOnlyClosest===true,a),p=this.ƀjh.toExplosionHits(c);return this.ƀr(e,i,r,l,p),o?.testLayerID&&this.ƀlt.createExplosionDebugVisual(a,o.testLayerID,c,e,i,o.debugRayDuration),p}ƀci(t,e,i,s,r,o){let a=new helpersLib.Radian(helpersLib.PI_360/s),l=new helpersLib.Vector(0,-e),c=a.vector;return helpersLib.ArrayHelper.createEmptyArray(s).map(()=>{let p=t.add(l);return l=l.rotate(c),new helpersLib.Line(t,p)}).map(p=>{if(r){let f=this.ƀji.castClosest(o,p,i);return {line:p,hits:f?[f]:[]}}else {let f=this.ƀji.castAllFirstContacts(o,p,i);return {line:p,hits:f}}})}ƀr(t,e,i,s,r){r.forEach(o=>{if(o.isExternal)o.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀfw.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=helpersLib.Vector.fromTo(t,m.arrayToVector(o.p2Body.position)),l=a.length/e,c=i*s*l/2;this.ƀfw.applyImpulse(o.p2Body,o.getHitPosition(),a,c);}});}ƀey(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};ii=Bn([u(),Gn("design:paramtypes",[te,nt,ee,Tt])],ii);var Ln=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ie=class{static{h(this,"PhysicsQueryService");}getMapSize(t){let e=P.getInstanceByIDOrFail(t);return {dimentions:e.mapSize,center:e.mapSizeCenter}}subscribeToPhysicsStep(t,e){return P.getInstanceByIDOrFail(t).onPhysicsStep.subscribe(e)}};ie=Ln([u()],ie);var Hn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},jn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},_i=class{static{h(this,"PhysicsController");}constructor(t,e,i,s,r,o,a,l){this.ƀit=t,this.ƀif=e,this.ƀlt=i,this.ƀdm=s,this.ƀde=r,this.ƀfo=o,this.ƀis=a,this.ƀfw=l;}createPhysicsWorld(t){return this.ƀit.createPhysicsWorld(t)}getMapSize(t){return this.ƀis.getMapSize(t)}setPaused(t,e){this.ƀit.setPaused(t,e);}hitTest(t,e){let i=S.getPhysicsInstanceOrFail(t);return this.ƀfo.hitTest(i.p2Body,e)}findPath(t,e,i,s,r){return this.ƀif.findPathAStar(t,e,i,s,{neighborType:r})}findPathDirection(t,e,i,s){return this.ƀif.findPathDirection(t,e,i,s)}applyImpulse(t,e,i,s){let r=S.getPhysicsInstanceOrFail(t);this.ƀfw.applyImpulse(r.p2Body,e,i,s);}createExplosion(t,e,i,s,r,o){return this.ƀdm.createExplosion(t,e,i,s,r,o)}createElipticExplosion(t,e,i,s,r,o,a){return this.ƀde.createElipticExplosion(t,e,i,s,r,o,a)}printPathfindingTestGrid(t,e,i,s,r,o=50){this.ƀlt.printPathfindingTestGrid(t,e,i,s,r,o);}};_i=Hn([lt(exports.PhysicsGateway),jn("design:paramtypes",[Qt,Kt,nt,ii,ei,Ke,ie,Tt])],_i);var Un=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ri=class{static{h(this,"ShapeCreationService");}createBody(t,e,i,s,r){let o=P.getInstanceByIDOrFail(t);if(!o.physicsBodyGroupToP2Group.has(e.shapeDefinition.group))throw new Error(`Physics body group "${e.shapeDefinition.group}" not found`);switch(e.shapeDefinition.shapeType){case exports.PhysicsShapeType.Point:return this.ƀbz(o,void 0,i,s,e.shapeDefinition.group,r);case exports.PhysicsShapeType.Circle:return this.ƀbz(o,e.shapeDefinition.shapeData,i,s,e.shapeDefinition.group,r);case exports.PhysicsShapeType.Polygon:return this.ƀch(o,e.shapeDefinition.shapeData,i,s,e.shapeDefinition.group,r);case exports.PhysicsShapeType.Rectangle:return this.ƀcj(o,e.shapeDefinition.shapeData,i,s,e.shapeDefinition.group,r);default:{e.shapeDefinition.shapeType;throw new Error}}}ƀbz(t,e,i,s,r,o){let a=new X__default.default.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(r),collisionMask:t.physicsBodyGroupToP2Mask.get(r),radius:e});a.material=i;let l=new X__default.default.Body({type:o==="dynamic"?X__default.default.Body.DYNAMIC:X__default.default.Body.STATIC,mass:s.density,damping:s.velocityDrag,angularDamping:s.rotationalDrag});return l.addShape(a),l}ƀch(t,e,i,s,r,o){let a=t.physicsBodyGroupToP2Group.get(r),l=t.physicsBodyGroupToP2Mask.get(r),c=e.map(g=>new X__default.default.Convex({vertices:g.map(v=>[v.x,v.y]),collisionGroup:a,collisionMask:l})).map(g=>(g.material=i,g)),p=c.reduce((g,v)=>g+v.area,0),f=new X__default.default.Body({type:o==="dynamic"?X__default.default.Body.DYNAMIC:X__default.default.Body.STATIC,mass:p,damping:s.velocityDrag,angularDamping:s.rotationalDrag});return c.forEach(g=>f.addShape(g)),f.setDensity(s.density),f}ƀcj(t,e,i,s,r,o){let a=new X__default.default.Box({width:e.x,height:e.y,collisionGroup:t.physicsBodyGroupToP2Group.get(r),collisionMask:t.physicsBodyGroupToP2Mask.get(r)});a.material=i;let l=e.x*e.y,c=new X__default.default.Body({type:o==="dynamic"?X__default.default.Body.DYNAMIC:X__default.default.Body.STATIC,mass:l,damping:s.velocityDrag,angularDamping:s.rotationalDrag});return c.addShape(a),c.setDensity(s.density),c}};ri=Un([u()],ri);var Wn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},$n=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Vi=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,s,r){this.ƀit=t,this.ƀir=e,this.ƀkq=i,this.ƀis=s,this.ƀim=r;}createBody(t,e,i,s,r){return this.ƀkq.createBody(t,e,i,s,r)}getMaterial(t,e){return this.ƀir.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀir.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀim.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀim.getMaskConstant(t,e)}addBody(t,e,i,s,r){return this.ƀit.addBody(t,e,i,s,r)}removeBody(t,e){this.ƀit.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀis.subscribeToPhysicsStep(t,e)}};Vi=Wn([lt(vt),$n("design:paramtypes",[Qt,Zt,ri,ie,st])],Vi);exports.AdvancedSound=wt;exports.AnimationFlicker=Li;exports.AnimationInterpolationFunctions=U;exports.Animations=b;exports.Animator=O;exports.BORDER_MATERIAL_NAME=xt;exports.BardLegendsTestingHelper=T;exports.Camera=le;exports.ClosestAvailableSpaceHelper=ne;exports.Container=d;exports.ControllerDecorator=lt;exports.DEFAULT_SHADER_RESOLUTION=k;exports.DeltaTime=pi;exports.DisplayObjectArray=xi;exports.ElectronGame=lr;exports.Entity=Q;exports.EntityDecorator=It;exports.FadeInContent=Yi;exports.Game=y;exports.Gateway=ht;exports.Graphics=A;exports.ImmovablePhysicsEntity=ve;exports.LayoutContainer=Ti;exports.MenuEntity=bi;exports.MenuUI=me;exports.MenuView=Pi;exports.MovableEntity=Bi;exports.MovablePhysicsEntity=Gi;exports.Music=pe;exports.MusicPlayer=mi;exports.PathFinder=ae;exports.PhysicsEntity=S;exports.Placeholder=yi;exports.ROTATIONAL_SPEED_LIMIT=Di;exports.RichText=gi;exports.SOUND_TRANSITION_DURATION=rt;exports.SPEED_LIMIT=Mi;exports.Scene=Vt;exports.SceneDecorator=Nr;exports.ScrollAreaUI=Si;exports.ScrollMaskUI=Ot;exports.Service=E;exports.ServiceDecorator=u;exports.SingletonEntity=dt;exports.SlideInContent=tr;exports.SlideInContentByIndex=ci;exports.SlideStateAnimation=De;exports.Sound=ce;exports.Sprite=et;exports.StateAnimation=jt;exports.Text=de;exports.ThroughEmptyStateAnimation=Re;exports.UpdatableContainer=wi;exports.UpdateCycle=w;exports.VectorFieldPathFinder=he;exports.VectorSet=oe;exports.View=Z;exports.ViewDecorator=oi;
45
+ }`,e}constructor(t,e){if(super({glProgram:W__namespace.GlProgram.from({vertex:W__namespace.defaultFilterVert,fragment:o.ƀem(t*k)}),resources:{expandUniforms:{uColor:{value:new Float32Array(3),type:"vec3<f32>"},uExpandSquared:{value:0,type:"f32"}}},resolution:k}),this.ƀdo=t,this.ƀdo=t*k,this.ƀdo<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀdo>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");helpersLib.Comparator.isInteger(this.ƀdo)||(this.ƀdo=Math.floor(this.ƀdo));let i=helpersLib.ColorHelper.normalize(e);this.resources.expandUniforms.uniforms.uColor=new Float32Array([i.red,i.green,i.blue]),this.resources.expandUniforms.uniforms.uExpandSquared=this.ƀdo*this.ƀdo,this.padding=this.ƀdo;}};var Be=class extends W__namespace.Filter{static{h(this,"GlowFilter");}constructor(t){super({resolution:k,compatibleRenderers:W__namespace.RendererType.WEBGL});let e={blurRadius:1,expand:0,color:helpersLib.ColorHelper.white,...t};this.ƀdp=new De(e.expand,e.color);let i=helpersLib.Comparator.isNumber(e.blurRadius)?new helpersLib.Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀan=new jt(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀan.blendMode="add";}apply(t,e,i,s){let r=W__namespace.TexturePool.getSameSizeTexture(e);this.ƀdp.apply(t,e,r,true),this.ƀan.apply(t,r,i,s),W__namespace.TexturePool.returnTexture(r);}};var Dt=class o{static{h(this,"GlowTextureGenerator");}static{this.ƀff=new Map;}static{this.ƀim=new WeakMap;}static createCombinedParticleTexture(t,e,i){let s=this.ƀbm(e),r=helpersLib.Comparator.isNumber(s.blurRadius)?new helpersLib.Vector(s.blurRadius,s.blurRadius):s.blurRadius;return {texture:this.ƀce(t,e,i,true),margin:Math.max(r.x,r.y)+s.expand}}static createGlowSpriteFromSprite(t,e,i){let s=this.ƀbm(e),r=helpersLib.Comparator.isNumber(s.blurRadius)?new helpersLib.Vector(s.blurRadius,s.blurRadius):s.blurRadius,n=this.ƀce(t.texture,e,i),a=new W__namespace.Sprite(n);return this.ƀkw(a,helpersLib.Vector.fromVec2(t.anchor),Math.max(r.x,r.y)+s.expand),a.alpha=s.glowAlpha,a.blendMode=s.blendMode,a}static ƀce(t,e,i,s=false){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");let r=this.ƀbm(e),n=helpersLib.Comparator.isNumber(r.blurRadius)?new helpersLib.Vector(r.blurRadius,r.blurRadius):r.blurRadius;if(i){let a=o.ƀim.get(e);a===void 0&&(a=`${r.expand}-${n.x}-${n.y}-${r.color.r}-${r.color.g}-${r.color.b}`,o.ƀim.set(e,a));let l=t.id+"-"+a+(s?`-combined-${r.glowAlpha}`:""),c=o.ƀff.get(l);return c||(c=this.ƀec(t,n,r.expand,r.color,s?r.glowAlpha:void 0),o.ƀff.set(l,c)),c}else return this.ƀec(t,n,r.expand,r.color,s?r.glowAlpha:void 0)}static ƀec(t,e,i,s,r){let n=new W__namespace.Sprite(t);n.filters=[new Be({blurRadius:e,expand:i,color:s})];let a=new W__namespace.Container;if(a.addChild(n),r!==void 0){n.alpha=r;let p=new W__namespace.Sprite(t);p.blendMode="add",a.addChild(p);}let l=Math.max(e.x,e.y)+i,c=m.instance.renderer.generateTexture({target:a,frame:new W__namespace.Rectangle(-l,-l,n.width+l*2,n.height+l*2)});return c.id=G.insertAsset(c),a.destroy({children:true}),c}static ƀkw(t,e,i){let s=(i+(t.width-i*2)*e.x)/t.width,r=(i+(t.height-i*2)*e.y)/t.height;t.anchor.set(s,r);}static ƀbm(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:helpersLib.ColorHelper.white,blendMode:"add"};return t&&(e={...e,...t}),e}};P.onHardReset.subscribe(()=>{Dt.ƀff.clear();}).attachToRoot();var it=class o extends f{static{h(this,"Sprite");}static createByName(t){let e=m.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.ƀjh,i=m.instance.generateTexture({target:e,resolution:2,antialias:true,textureSourceOptions:{scaleMode:"linear"}}),r={id:G.insertAsset(i),scale:t.scale,size:t.size,anchor:helpersLib.Vector.zero,destroyAssetOnDestroy:true};return new o(r,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀms=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀlr=t,this.pixiSprite=new W__namespace.Sprite(G.getAsset(t.id)),this.ƀjh.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.ƀlr.destroyAssetOnDestroy&&(G.destroyAsset(this.ƀlr.id),this.ƀjj&&G.destroyAsset(this.ƀjj.texture.id)),this.ƀhf?.destroy(),this.ƀap?.destroy(),this.ƀjj&&!this.ƀjj.destroyed&&this.ƀjj.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀms}set textureScale(t){this.ƀms=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.ƀlr.boundingShapes&&!this.ƀjh.hitArea&&(this.ƀjh.hitArea=new As(this.ƀlr.boundingShapes,this.size,helpersLib.Vector.fromVec2(this.ƀlr.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.source.autoGenerateMipmaps}set mipmap(t){this.pixiSprite.texture.source.autoGenerateMipmaps=t;}setBlendMode(t){return this.blendMode=t,this}get blendMode(){return this.pixiSprite.blendMode}set blendMode(t){this.pixiSprite.blendMode=t;}setTint(t){return this.tint=t,this}get tint(){return new W__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.ƀjj)return this.ƀjj.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀjj)this.ƀjj.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=helpersLib.Vector.fromVec2(this.ƀlr.anchor).to(t);return new helpersLib.Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀjj&&(this.ƀjj.destroy(),this.ƀjj=void 0),t&&(this.ƀjj=Dt.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀlr.destroyAssetOnDestroy),this.ƀjj.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀjj.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀjh.addChild(this.ƀjj)),this}showBoundingShape(t){return t?this.ƀap||(this.ƀap=this.ƀcb().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀap&&(this.ƀap.destroy(),this.ƀap=void 0),this}getBoundingMask(){if(!this.ƀhf){if(!this.ƀlr.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀhf=this.ƀcb(),this.ƀhf.displayParent(this);}return this.ƀhf}ƀcb(){if(!this.ƀlr.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return A.createPolygon(this.ƀlr.boundingShapes,helpersLib.ColorHelper.white).toSprite().attach(this)}download(){let t=m.instance.renderer.extract.canvas(this.ƀjh);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}},As=class{static{h(this,"CompositeHitArea");}constructor(t,e,i){this.ƀlg=t.map(s=>new W__namespace.Polygon(s.map(r=>new W__namespace.Point(r.x,r.y))));}contains(t,e){return this.ƀlg.some(i=>i.contains(t,e))}};var Ve=class{static{h(this,"DashedLineHelper");}static getLines(t,e,i){let s=helpersLib.Vector.fromTo(t,e),r=s.normalize(),n=s.length-i.lineStartGap-i.lineEndGap,a=[];if(n<=0)return a;let l=t.add(r.normalize(i.lineStartGap));if(n<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(r.normalize(n))}),a;let c=n-i.dashGap,p=i.dashLength+i.dashGap,d=Math.floor(c/p),g=c-p*d;d>=1&&g<i.dashLength&&(g+=p,d--);let v=r.normalize(g/2),x=r.normalize(i.dashGap);if(a.push({from:l,to:l.add(v)}),l=l.add(v),d>0){let M=r.normalize(i.dashLength);helpersLib.ArrayHelper.createEmptyArray(d).forEach(()=>{l=l.add(x),a.push({from:l,to:l.add(M)}),l=l.add(M);});}return l=l.add(x),a.push({from:l,to:l.add(v)}),a}};var A=class o extends f{static{h(this,"Graphics");}static{this.ƀdf=new Map;}static createArrow(t,e){let i=new W__namespace.Graphics;return [[{x:0,y:-t/2},{x:t*3/8,y:-t/8},{x:t/4,y:0},{x:0,y:-t/4},{x:-t/4,y:0},{x:-t*3/8,y:-t/8}],[{x:0,y:-t/4},{x:t/8-t/30,y:-t/8-t/30},{x:t/8-t/30,y:t*7/16},{x:-t/8+t/30,y:t*7/16},{x:-t/8+t/30,y:-t/8-t/30}]].forEach(r=>{i.poly(r.map(n=>new W__namespace.Point(n.x,n.y))).fill(e);}),new o(i,JSON.stringify({type:"arrow",size:t,color:e}))}static createDashedLine(t,e,i){let s={width:2,dashLength:10,dashGap:4,lineStartGap:0,lineEndGap:0,color:helpersLib.ColorHelper.white,...i},r=new W__namespace.Graphics;return Ve.getLines(t,e,s).forEach(a=>{r.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),r.stroke({width:s.width,color:s.color}),new o(r,JSON.stringify({type:"dashedLine",from:t,to:e,options:s}))}static createVector(t,e,i){let s=new W__namespace.Graphics;return s.moveTo(t.x,t.y),s.lineTo(e.x,e.y),s.stroke({width:2,color:i}),s.circle(t.x,t.y,3),s.fill(helpersLib.ColorHelper.white),s.stroke({width:1,color:i}),new o(s,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let s=new W__namespace.Graphics;return s.rect(0,0,t.x,e),s.rect(0,e,e,t.y-e*2),s.rect(t.x-e,e,e,t.y-e*2),s.rect(0,t.y-e,t.x,e),s.fill(i),new o(s,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=helpersLib.ColorHelper.white){let i=new W__namespace.Graphics;return i.rect(0,0,t.x,t.y).fill(e),new o(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new W__namespace.Graphics;return i.circle(0,0,t).fill(e),new o(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new W__namespace.Graphics;return i.ellipse(0,0,t.x,t.y).fill(e),new o(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new W__namespace.Graphics,s=JSON.stringify({type:"polygon",polygon:t,color:e});return t.forEach(r=>{i.poly(r.map(n=>new W__namespace.Point(n.x,n.y))).fill(e);}),new o(i,s)}static createRegularPolygon(t,e,i){let s=new W__namespace.Graphics,r=new helpersLib.Radian(helpersLib.PI_360/t);s.moveTo(e,0);for(let n=1;n<=t;n++){let l=r.multiply(n).vector.normalize(e),c=e+l.x,p=e+l.y;s.lineTo(c,p);}return s.fill(i),new o(s,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.ƀjh.addChild(t),this.pixiGraphics=t,this.ƀas=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀas,cache:false,...t},i=this.ƀfb(e.cacheName,e.cache),s={id:i.textureID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},r=new it(s,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),r}ƀfb(t,e){if(e){let i=o.ƀdf.get(t);return i||(i=this.ƀco(),o.ƀdf.set(t,i)),i}else return this.ƀco()}ƀco(){let t=m.instance.generateTexture(this.pixiGraphics);t.id=G.insertAsset(t);let e=this.pixiGraphics.getBounds();return {textureID:t.id,bounds:new helpersLib.Vector(e.x,e.y)}}};var yi=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},Bt=class o extends f{static{h(this,"ScrollMaskUI");}static{this.ƀdf=new Map;}constructor(t,e,i,s=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 r=new f;s===exports.ScrollDirection.Horizontal?this.ƀci(e,i,r):this.ƀcp(e,i,r),this.ƀhf=it.createSnapshotSprite(r).attach(this),r.destroy(),t.setMask(this.ƀhf);}ƀcp(t,e,i){e>0&&this.ƀcf(new helpersLib.Vector(t.x,e)).displayParent(i).attach(i),A.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.ƀcf(new helpersLib.Vector(t.x,e)).setPosition(new helpersLib.Vector(t.x,t.y),{round:false}).setRotation(helpersLib.Radian.get180).displayParent(i).attach(i);}ƀci(t,e,i){e>0&&this.ƀcf(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(0,t.y),{round:false}).setRotation(helpersLib.Radian.get270).displayParent(i).attach(i),A.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.ƀcf(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(t.x,0),{round:false}).setRotation(helpersLib.Radian.get90).displayParent(i).attach(i);}ƀcf(t){let i={id:this.ƀcg(t.y),scale:1,size:t,anchor:{x:0,y:0}};return new it(i,{textureSize:t,ignoreAnchor:true})}ƀcg(t){let e=JSON.stringify({type:"gradient",length:t}),i=o.ƀdf.get(e);if(!i){let s=document.createElement("canvas");s.width=1,s.height=t;let r=s.getContext("2d");if(r){let n=new yi;helpersLib.ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${n.multiplierFunction(l/t)})`;r.fillStyle=c,r.fillRect(0,l,1,1);});let a=W__namespace.Texture.from(s);i=G.insertAsset(a),o.ƀdf.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 Ne=class extends actionsLib.Attachable{static{h(this,"SlideStateAnimation");}onStateChange(t){return this.ƀig.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀii.subscribe(e=>t(e.value,e.index)).attach(this),this}get state(){return {value:this.ƀly.state.value,item:this.ƀgc,nextItem:this.ƀhx,queuedItem:this.ƀly.state.queuedItem,animationState:this.ƀr}}constructor(t){super(),this.ƀr="idle",this.ƀig=new actionsLib.Action,this.ƀii=new actionsLib.Action,this.ƀil={duration:500,animation:b.easeInOutCubic,...t},this.ƀly=new kt({duration:this.ƀil.duration,animation:this.ƀil.animation}).onStateChange((e,i)=>this.ƀfi(e,i)).onValueChange(e=>this.ƀfn(e)).attach(this);}setIndex(t,e){if(!helpersLib.Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀgc===void 0?(this.ƀgc=t,this.ƀig.trigger({state:exports.SlideStateAnimationState.Appear,index:t}),this.ƀly.setItem(t,e)):this.ƀgc!==t?this.ƀhx!==t?this.ƀr==="idle"?(this.ƀr=t>this.ƀgc?"transitionForward":"transitionBackward",this.ƀhx=t,this.ƀig.trigger({state:exports.SlideStateAnimationState.Appear,index:this.ƀhx}),this.ƀly.setItem(t,e)):this.ƀly.setItem(t,e):this.ƀr==="reverting"&&this.ƀhx===t&&(this.ƀr=t>this.ƀgc?"transitionForward":"transitionBackward",this.ƀly.setItem(t,e)):(this.ƀr==="transitionForward"||this.ƀr==="transitionBackward")&&(this.ƀr="reverting",this.ƀly.setItem(t,e));}ƀfi(t,e){switch(this.ƀgc!==void 0&&this.ƀgc!==t&&this.ƀgc!==e&&this.ƀig.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀgc}),this.ƀhx!==void 0&&this.ƀhx!==t&&this.ƀhx!==e&&this.ƀig.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀhx}),e!==void 0&&e!==this.ƀgc&&e!==this.ƀhx&&this.ƀig.trigger({state:exports.SlideStateAnimationState.Appear,index:e}),this.ƀr){case "idle":break;case "transitionForward":case "transitionBackward":e===void 0?(this.ƀr="idle",this.ƀgc=this.ƀhx,this.ƀhx=void 0):this.ƀgc!==t&&this.ƀfj(t,e);break;case "reverting":e===void 0?(this.ƀr="idle",this.ƀhx=void 0):this.ƀgc!==e&&this.ƀfj(t,e);break;default:{this.ƀr;throw new Error}}}ƀfj(t,e){this.ƀgc=t,this.ƀhx=e,this.ƀii.trigger({value:0,index:this.ƀgc}),this.ƀr=this.ƀgc<this.ƀhx?"transitionForward":"transitionBackward";}ƀfn(t){let e=1;(this.ƀr==="transitionBackward"||this.ƀr==="reverting"&&this.ƀgc!==void 0&&this.ƀhx!==void 0&&this.ƀgc>this.ƀhx)&&(e=-1),(this.ƀr==="idle"||t!==0)&&this.ƀii.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(-e*t),index:this.ƀgc}),this.ƀhx!==void 0&&this.ƀii.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀhx});}};exports.ScrollDirection=void 0;(function(o){o[o.Horizontal=1]="Horizontal",o[o.Vertical=2]="Vertical";})(exports.ScrollDirection||(exports.ScrollDirection={}));var gi=class extends f{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀcd=t,this.ƀdb="x",this.ƀbt=new Map,this.ƀil={duration:300,animation:b.easeInOutCubic,size:new helpersLib.Vector(500,500),margin:20,direction:exports.ScrollDirection.Horizontal,...e};let i=this.ƀil.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(this.ƀil.size.x+this.ƀil.margin*2,this.ƀil.size.y):new helpersLib.Vector(this.ƀil.size.x,this.ƀil.size.y+this.ƀil.margin*2),s=new f().setPosition(this.ƀil.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(-this.ƀil.margin,0):new helpersLib.Vector(0,-this.ƀil.margin),{round:false}).displayParent(this).attach(this);this.ƀcj(i,this.ƀil.margin,this.ƀil.direction,s),this.ƀdb=this.ƀil.direction===exports.ScrollDirection.Horizontal?"x":"y",this.ƀly=new Ne({duration:this.ƀil.duration,animation:this.ƀil.animation}).onStateChange((r,n)=>{if(r===exports.SlideStateAnimationState.Appear){let a=new f().displayParent(this).attach(this);this.ƀbt.set(n,a),this.ƀcd({index:n,container:a});}else {let a=this.ƀbt.get(n);a&&(a.destroy(),this.ƀbt.delete(n));}}).onValueChange((r,n)=>{let a=this.ƀbt.get(n);if(a){let l={x:0,y:0};l[this.ƀdb]=i[this.ƀdb]*r+this.ƀil.margin,a.setPosition(helpersLib.Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=s;}setIndex(t,e){return this.ƀly.setIndex(t,e),this}ƀcj(t,e,i,s){new Bt(s,new helpersLib.Vector(t.x,t.y),e,i).attach(this);}},cr=class extends gi{static{h(this,"SlideInContent");}constructor(t,e,i){super(s=>{let r=this.indexToItem.get(s.index);if(r)e({index:s.index,item:r,container:s.container});else throw new Error(`SlideInContent: The item with index '${s.index}' is not part of the items list`)},i),this.itemToIndex=new Map,this.indexToItem=new Map,t.forEach((s,r)=>{this.itemToIndex.set(s,r),this.indexToItem.set(r,s);});}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 he=class{static{h(this,"VectorSet");}constructor(){this.ƀni=new Map;}add(t){let e=this.ƀni.get(t.x);e||(e=new Set,this.ƀni.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀni.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀni.get(t.x);return e?e.delete(t.y):false}};var wi=class{static{h(this,"DeltaTime");}static{this.ƀgu=NaN;}static{this.ƀgs=NaN;}static{this.ƀgv=NaN;}static adjustMultiplier(t,e){return (t!==this.ƀgu||e!==this.ƀgs)&&(this.ƀgu=t,this.ƀgs=e,this.ƀgv=Math.pow(t,e)),this.ƀgv}};var V=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 le=class{static{h(this,"ClosestAvailableSpaceHelper");}static findByConvertingGridSpace(t,e,i){let s=new helpersLib.Vector(Math.ceil(e.size.x/i)-1,Math.ceil(e.size.y/i)-1),r=V.areaToGridArea(e,i);if(this.ƀba(t,r))return helpersLib.Vector.zero;let n=t.movePositionInsideGrid(r.topLeft),a=helpersLib.Vector.fromTo(r.topLeft,n),l=this.find(t,n,s);if(l){let c=l.add(a),p=helpersLib.Vector.fromTo(r.topLeft.multiplyNumber(i),e.topLeft);return new helpersLib.Vector(c.x*i+((s.x+1)*i-e.size.x)/2-p.x,c.y*i+((s.y+1)*i-e.size.y)/2-p.y)}}static find(t,e,i){let s=new he,r=new helpersLib.Queue(e);for(;r.notEmpty;){let n=r.pop();s.add(n);let a=new helpersLib.Rectangle(n,n.add(i));if(this.ƀba(t,a))return helpersLib.Vector.fromTo(e,n);t.getNeighborPositions(n,"orthogonal").forEach(l=>{s.has(l)||r.add(l);});}}static ƀba(t,e){if(!t.isAreaWithinBounds(e))return false;for(let i=e.topLeft.y;i<=e.bottomRight.y;i++)for(let s=e.topLeft.x;s<=e.bottomRight.x;s++)if(!t.get(new helpersLib.Vector(s,i)))return false;return true}};var pr=Math.SQRT2-1,$s=class{static{h(this,"PathfinderNode");}constructor(t,e){this.position=t,this.distanceToEnd=e,this.closed=false,this.distanceFromStart=Number.MAX_SAFE_INTEGER,this.parent=void 0;}get pathLength(){return this.distanceFromStart+this.distanceToEnd}getStepCost(t){return this.position.x!==t.position.x&&this.position.y!==t.position.y?Math.SQRT2:1}createSolutionPath(t){let e=[],i=this;for(;i!==void 0;)e.push(i.position),i=i.parent;return e.reverse(),{directPathAvailable:t,path:e}}},ks=class{static{h(this,"PathfinderGrid");}constructor(t,e,i,s){this.ƀfh=t,this.ƀml=i,this.ƀhw=s,this.ƀik=new helpersLib.BinaryHeap("min"),this.ƀhz=new helpersLib.Grid({size:t.size,defaultValue:void 0});let r=this.ƀck(e);r.distanceFromStart=0,this.ƀik.add(r.pathLength,r),this.ƀai=r;}get hasOpenNodes(){return this.ƀik.size>0}getNeighbors(t){let e=[];for(let i of this.ƀfh.getNeighborPositions(t.position,this.ƀhw))if(this.ƀfh.get(i)){let s=this.ƀhz.get(i)??this.ƀck(i);s.closed||e.push(s);}return e}popLowestPathCostNode(){let t=this.ƀik.pop();return t.closed=true,t.distanceToEnd<this.ƀai.distanceToEnd&&(this.ƀai=t),t}changeNodeCost(t,e,i){t.distanceFromStart=e,t.parent=i,this.ƀik.updatePriority(t,t.pathLength)||this.ƀik.add(t.pathLength,t);}getBestClosedNode(){return this.ƀai}ƀck(t){let e=Math.abs(t.x-this.ƀml.x),i=Math.abs(t.y-this.ƀml.y),s=this.ƀhw==="orthogonal"?e+i:e>i?e+pr*i:i+pr*e,r=new $s(t,s);return this.ƀhz.isPointWithinBounds(t)&&this.ƀhz.set(t,r),r}},ce=class{static{h(this,"PathFinder");}static findPath(t,e,i,s){let r=new ks(t,e,i,s);for(;r.hasOpenNodes;){let n=r.popLowestPathCostNode();if(n.position.isEqual(i))return n.createSolutionPath(true);for(let a of r.getNeighbors(n)){let l=n.distanceFromStart+n.getStepCost(a);l<a.distanceFromStart&&r.changeNodeCost(a,l,n);}}return r.getBestClosedNode().createSolutionPath(false)}};var Jt=[-1,0,0,1,-1,-1,1,1],Yt=[0,-1,1,0,-1,1,-1,1],fr=[10,10,10,10,14,14,14,14],xi=Jt.map((o,t)=>new helpersLib.Vector(o,Yt[t]).radian),pe=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀmk=t;let i=e.width,s=e.height,r=this.ƀep(e.size);this.ƀnr=i,this.ƀfq=s,this.ƀfr=r;let n=i*s,a=new Uint8Array(n),l=new Int32Array(n),c=e.snapshot();for(let x=0;x<s;x++){let M=c[x],_=x*i;for(let C=0;C<i;C++)M[C]?(a[_+C]=1,l[_+C]=r):l[_+C]=-1;}this.ƀac=a,this.ƀnq=l,this.ƀda=new Uint8Array(n),this.ƀcz=new Array(n);let p=[-1,-i,i,1,-i-1,i-1,-i+1,i+1],d=new Array(r),g=e.cropAreaOutsideOfTheGrid(t),v=[];for(let x=g.topLeft.y;x<=g.bottomRight.y;x++)for(let M=g.topLeft.x;M<=g.bottomRight.x;M++)l[x*i+M]=0,v.push(x*i+M);d[0]=v;for(let x=0;x<r;x++){let M=d[x];if(M){d[x]=void 0;for(let _=0;_<M.length;_++){let C=M[_];if(l[C]!==x)continue;let Z=C%i;if(Z>0&&Z<i-1&&C>=i&&C<n-i){let Lt=x+10,$=x+14;for(let H=0;H<8;H++){let j=C+p[H],ht=H<4?Lt:$;if(ht<l[j]){l[j]=ht;let At=d[ht];At?At.push(j):d[ht]=[j];}}}else {let Lt=(C-Z)/i;for(let $=0;$<8;$++){let H=Z+Jt[$],j=Lt+Yt[$];if(H<0||j<0||H>=i||j>=s)continue;let ht=j*i+H,At=x+fr[$];if(At<l[ht]){l[ht]=At;let Yi=d[At];Yi?Yi.push(ht):d[At]=[ht];}}}}}}for(let x=0;x<n;x++)l[x]===-1&&(l[x]=r);}getDirectionToTarget(t){if(t.isInsideRectangle(this.ƀmk))return;let e=this.ƀnr,i=Math.round(t.x),s=Math.round(t.y);i=Math.max(0,Math.min(e-1,i)),s=Math.max(0,Math.min(this.ƀfq-1,s));let r=s*e+i;if(this.ƀda[r]===1)return this.ƀcz[r];let n=this.ƀat(i,s,r);return this.ƀda[r]=1,this.ƀcz[r]=n,n}ƀat(t,e,i){let s=this.ƀnr,r=this.ƀfq,n=[];for(let a=0;a<8;a++){let l=t+Jt[a],c=e+Yt[a];l>=0&&c>=0&&l<s&&c<r&&n.push(a);}if(this.ƀnq[i]>=this.ƀfr){let a=n.filter(l=>this.ƀac[(e+Yt[l])*s+t+Jt[l]]===1);if(a.length===0)return;if(a.length<n.length)return helpersLib.Radian.getAverage(...a.map(l=>xi[l]))}return this.ƀeg(t,e,n)}ƀeg(t,e,i){let s=this.ƀnr,r=[],n=this.ƀfr;for(let v=0;v<i.length;v++){let x=i[v],M=this.ƀnq[(e+Yt[x])*s+t+Jt[x]];if(M>=this.ƀfr)continue;let _=M+fr[x];_<n?(r.length=0,r.push(x),n=_):_===n&&r.push(x);}if(r.length===0)return;let a=0,l=0;for(let v=0;v<r.length;v++)a+=Jt[r[v]],l+=Yt[r[v]];if(a===0&&l===0)return xi[helpersLib.Random.pickRandomElement(r)];let c=1/Math.sqrt(a*a+l*l),p=t+Math.round(a*c),d=e+Math.round(l*c);return p>=0&&d>=0&&p<s&&d<this.ƀfq&&this.ƀac[d*s+p]===1?new helpersLib.Vector(a,l).radian:xi[helpersLib.Random.pickRandomElement(r)]}get t(){let t=[];for(let e=0;e<this.ƀfq;e++){let i=new Array(this.ƀnr);for(let s=0;s<this.ƀnr;s++)i[s]=this.ƀnq[e*this.ƀnr+s];t.push(i);}return new helpersLib.Grid(t)}ƀep(t){return (t.x+t.y)*20}};var E=class o{static{h(this,"AudioAssets");}static{this.ƀar=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.ƀar.set(e.id,i))));}static createSource(t){let e=o.ƀef(t),i=o.context.createBufferSource();return i.buffer=e,i}static ƀef(t){let e=this.ƀar.get(t);if(!e)throw new Error(`Audio: Sound with id ${t} was not loaded.`);return e}};P.onHardReset.subscribe(()=>{E.context=new AudioContext,E.ƀar.clear();}).attachToRoot();var st=1e3,rt=class o{static{h(this,"Audio");}static ƀkz(){return this.ƀgf=new o,this.ƀgf}constructor(){this.ƀhi=E.context.createGain(),this.ƀhh=E.context.createGain(),this.ƀhv=E.context.createGain(),this.ƀlk=E.context.createGain(),this.ƀhi.connect(E.context.destination),this.ƀhh.connect(this.ƀhi),this.ƀhv.connect(this.ƀhh),this.ƀlk.connect(this.ƀhh),this.ƀhj=new O(this.ƀhi.gain,"value",{duration:500*2,animation:b.easeIn,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀhj.set({value:0});}setVolumes(t){this.ƀhh.gain.value=t.master,this.ƀhv.gain.value=t.music,this.ƀlk.gain.value=t.sound;}appear(t,e="ease"){switch(e){case "ease":return this.ƀhj.set({value:t?0:1}),this.ƀhj.animate({value:t?1:0}).chainToRoot();case "instant":return this.ƀhj.set({value:t?1:0}),actionsLib.SingleEvent.instant();default:{throw new Error}}}};P.onHardReset.subscribe(()=>{rt.ƀkz();}).attachToRoot();var Xs=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r};exports.CameraGateway=class xt extends lt(){static{h(this,"CameraGateway");}};exports.CameraGateway=Xs([u()],exports.CameraGateway);var Ks=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Nt=class extends lt(){static{h(this,"CameraViewGateway");}};Nt=Ks([u()],Nt);var mr;(function(o){o.BackgroundScreen="backgroundScreen",o.Background="background",o.Main="main",o.Foreground="foreground",o.ForegroundScreen="foregroundScreen";})(mr||(mr={}));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 ue=class{static{h(this,"Camera");}get position(){return this.ƀav.getCameraPosition()}constructor(){this.ƀav=R.get(exports.CameraGateway),this.ƀaz=R.get(Nt),this.ƀav.createCamera(),this.layers=this.ƀaz.getLayers();}setPosition(t){this.ƀav.setPosition(t);}setTransition(t){this.ƀav.setTransition(t);}appear(t,e="alpha",i=0){return this.ƀaz.appear(t,e,i)}screenPositonToStagePosition(t){return this.ƀaz.screenPositonToStagePosition(t)}};var m=class o{static{h(this,"Game");}static get instance(){return this.ƀgf}static{this.pause=actionsLib.Reducer.createOr();}static{this.freeze=actionsLib.Reducer.createOr();}static get camera(){return this.ƀau}static get audio(){return this.ƀab}static appear(t,e){let i=e?.audio??"ease",s=e?.camera??"alpha";return actionsLib.ActionLib.all([this.audio.appear(t,i),this.camera.appear(t,s,i!=="instant"?0:500)]).mapToVoid().chainToRoot()}static get time(){return w.ƀmt}static get setupOptions(){return this.ƀld}constructor(t){if(this.ƀko=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSize=this.ƀko.notifier,this.ƀkp=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSizeCenter=this.ƀkp.notifier,this.devMode=false,o.ƀgf)throw new Error("There can be only one Game instance!");this.ƀbp={screenResolution:void 0,maxScreenResolution:void 0,devMode:false,backgroundColor:helpersLib.ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbp.devMode||false,this.ƀjg=new W__namespace.Application;let e=o.pause.effect(false).attachToRoot();o.freeze.subscribe(i=>{e.update(i),i?E.context.suspend():E.context.resume();}).attachToRoot();}async setup(t){o.ƀld=t;let e=helpersLib.JsonHelper.removeUndefinedProperties({backgroundColor:helpersLib.ColorHelper.rgbToHex(this.ƀbp.backgroundColor),autoStart:false,antialias:this.ƀbp.antialias,resolution:this.ƀbp.resolution,width:this.ƀbp.screenResolution?.width,height:this.ƀbp.screenResolution?.height,useBackBuffer:true,powerPreference:"high-performance",eventFeatures:{globalMove:false}});await this.ƀjg.init(e);let i=document.body.appendChild(this.ƀjg.canvas);this.ƀky(i),await Promise.all([G.loadGameAssets(t.spriteAssetDefinitions),G.loadGameAssets(t.fontAssetDefinitions),E.load(t.soundAssetDefinitions)]),o.ƀgf=this,this.renderer=this.ƀjg.renderer,globalThis.ƀa=this.ƀjg,this.ƀfl(),o.ƀau=new ue,o.ƀab=rt.ƀkz(),this.ƀjg.start(),this.ƀjg.ticker.add(()=>{o.freeze.value||w.triggerUpdateTick(this.ƀjg.ticker.deltaMS);}),this.devMode&&await this.renderer.layout.enableDebug(true);}generateTexture(t){let e=this.renderer.layout,i=e.autoUpdate;e.autoUpdate=false;let s=this.renderer.generateTexture(t);return e.autoUpdate=i,s}setResolution(t){if(this.ƀjg.renderer.resolution!==t){this.ƀjg.renderer.resolution=t;let e=this.ƀfa();this.ƀjg.renderer.resize(e.x,e.y);}}ƀfl(){this.ƀdk(),this.ƀkx(),window.addEventListener("resize",t=>{this.ƀdk(),this.ƀkx();});}ƀdk(){let t=this.ƀfa();(t.x!==this.ƀjg.screen.width||t.y!==this.ƀjg.screen.height)&&this.ƀjg.renderer.resize(t.x,t.y);}ƀkx(){let t=new helpersLib.Vector(this.ƀjg.screen.width,this.ƀjg.screen.height);this.ƀko.value=t,this.ƀkp.value=t.multiplyNumber(.5).round();}ƀfa(){let t=this.ƀbp.screenResolution?.width??window.innerWidth,e=this.ƀbp.screenResolution?.height??window.innerHeight;return this.ƀbp.maxScreenResolution&&(t=Math.min(t,this.ƀbp.maxScreenResolution.width),e=Math.min(e,this.ƀbp.maxScreenResolution.height)),new helpersLib.Vector(t,e)}ƀky(t){this.ƀbp.maxScreenResolution&&(t.style.maxWidth=`${this.ƀbp.maxScreenResolution?.width}px`,t.style.maxHeight=`${this.ƀbp.maxScreenResolution?.height}px`),t.style.width="100%",t.style.height="100%",t.style.backgroundColor=helpersLib.ColorHelper.rgbColorToString(this.ƀbp.backgroundColor);}};var xr=class{static{h(this,"ElectronGame");}static async start(t,e){let{devMode:i,maxScreenResolution:s}=await window.api.getOptions(),r=new m({...t,devMode:i,maxScreenResolution:s});await r.setup(e);let n=m.pause.effect(false).attachToRoot();window.api.onWindowFocus(l=>{n.update(!l);});let a=m.freeze.effect(false).attachToRoot();return document.addEventListener("visibilitychange",()=>{a.update(document.hidden);}),window.api.rendererReady(),window.api.setFullScreen(false),r}};var fe=class o extends actionsLib.IDAttachable{static{h(this,"Sound");}static createByName(t,e){let i=m.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.ƀea.gain.value}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀea.gain.value=t,this}constructor(t,e){super(),this.ƀll=t,this.ƀea=E.context.createGain(),this.ƀea.connect(rt.ƀgf.ƀlk),this.ƀfp=this.ƀea,e?.volume!==void 0&&(this.volume=e.volume),this.ƀjo(e?.time??0);}destroy(){this.destroyed||(super.destroy(),this.ƀmf(),this.ƀea?.disconnect());}ƀng(){this.ƀfp.disconnect(),this.ƀfp.connect(rt.ƀgf.ƀhv);}ƀjo(t){this.ƀmf();let e=this.ƀll.loop;if(this.ƀlu=helpersLib.NumberHelper.clamp(t,0,e?e.to:this.ƀll.duration),e){let i=e.from,s=e.to;this.ƀjp({soundID:this.ƀll.id,start:this.ƀlu,end:this.ƀlu<i?i:s,loop:false,onComplete:h(()=>{this.ƀlo.disconnect(),this.ƀjp({soundID:this.ƀll.id,start:i,end:s,loop:true});},"onComplete")});}else this.ƀjp({soundID:this.ƀll.id,start:this.ƀlu,end:void 0,loop:false,onComplete:h(()=>this.destroy(),"onComplete")});}ƀmf(){this.ƀlo&&(this.ƀlo.onended=null,this.ƀlo.stop(),this.ƀlo.disconnect());}ƀjp(t){this.ƀlo=E.createSource(t.soundID),this.ƀlo.connect(this.ƀea),t.onComplete&&(this.ƀlo.onended=t.onComplete),t.loop?(this.ƀlo.loop=true,this.ƀlo.loopStart=t.start,this.ƀlo.loopEnd=t.end??this.ƀlo.buffer.duration,this.ƀlo.start(0,t.start)):this.ƀlo.start(0,t.start,t.end?t.end-t.start:void 0);}};var io=800,_e=-128,bt=class o extends fe{static{h(this,"AdvancedSound");}static createByName(t,e){let i=m.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.ƀmt=new actionsLib.Variable(0),this.time=this.ƀmt.notifier,this.ƀlw=E.context.currentTime-this.ƀlu,this.ƀmt.value=this.ƀlu,w.beforeSceneUpdateAction.subscribe(()=>{this.ƀmt.value=E.context.currentTime-this.ƀlw;}).attach(this),this.ƀfp.disconnect(),this.ƀla(e?.fade?helpersLib.NumberHelper.clamp(e.fade,0,1):0),this.ƀlc(e?.muffle?helpersLib.NumberHelper.clamp(e.muffle,0,1):0),this.ƀfp.connect(rt.ƀgf.ƀlk);}ƀla(t=0){this.ƀds=E.context.createGain(),this.ƀds.gain.value=1-t,this.ƀdr=new O(this.ƀds.gain,"value",{duration:500,animation:b.lineer,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀfp.connect(this.ƀds),this.ƀfp=this.ƀds;}ƀlc(t=0){this.ƀht=E.context.createBiquadFilter(),this.ƀht.type="highshelf",this.ƀht.frequency.value=io,this.ƀht.gain.value=t*_e,this.ƀhu=new O(this.ƀht.gain,"value",{duration:500,animation:b.lineer,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀfp.connect(this.ƀht),this.ƀfp=this.ƀht;}close(){return this.ƀbg?this.onDestroy():(this.ƀbg=true,this.fade(1,st).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(s=>s>=t).tap(()=>e()).attach(this);return ()=>i.destroy()})}setFade(t){t=helpersLib.NumberHelper.clamp(t,0,1),this.ƀdr.set({value:1-t});}fade(t,e=500){t=helpersLib.NumberHelper.clamp(t,0,1);let i=t>1-this.ƀds.gain.value;return e===0?(this.ƀdr.set({value:1-t}),actionsLib.SingleEvent.instant()):this.ƀdr.animate({value:1-t},{duration:e,animation:i?b.easeOut:b.easeIn}).chain(this)}setMuffle(t){t=helpersLib.NumberHelper.clamp(t,0,1),this.ƀhu.set({value:t*_e});}muffle(t,e=500){return t=helpersLib.NumberHelper.clamp(t,0,1),e===0?(this.ƀhu.set({value:t*_e}),actionsLib.SingleEvent.instant()):this.ƀhu.animate({value:t*_e},{duration:e}).chain(this)}destroy(){this.destroyed||(this.ƀds.disconnect(),this.ƀht.disconnect()),super.destroy();}};var de=class o extends actionsLib.IDAttachable{static{h(this,"Music");}static createByName(t,e){let i=m.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new o(i,e)}get time(){switch(this.ƀln.value.type){case "paused":return this.ƀln.value.value.time;case "playing":return this.ƀln.value.value.time.value;default:{this.ƀln.value;throw new Error}}}get volume(){return this.ƀln.value.value.volume}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀln.value.value.volume=t,this}constructor(t,e){super(),this.ƀil={stopPlayingOnPause:true,...e},this.ƀlm=t.id;let i;if(this.ƀil.stopPlayingOnPause&&m.pause.value)i={type:"paused",value:{time:0,volume:1}};else {let s=new bt(t,this.ƀil).attach(this);s.ƀng(),i={type:"playing",value:s};}this.ƀln=new actionsLib.Variable(i),this.ƀil.stopPlayingOnPause&&(this.ƀis=m.pause.subscribe(s=>this.ƀfk(s)).attach(this));}notifyOnTime(t){return actionsLib.SingleEvent.create(e=>{let i=this.ƀln.asyncDropOngoing((s,r)=>{switch(s.type){case "paused":r.drop();break;case "playing":return s.value.notifyOnTime(t);default:{throw new Error}}}).toSingleEvent().tap(()=>e()).attach(this);return ()=>i.destroy()})}close(){return this.ƀbg?this.onDestroy():(this.ƀbg=true,this.ƀis?.destroy(),actionsLib.SingleEvent.instant().async(()=>actionsLib.ActionLib.all([this.ƀln.value.type==="playing"?this.ƀln.value.value.close():actionsLib.SingleEvent.instant(),this.ƀdt?.onDestroy()??actionsLib.SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀfk(t){if(t){if(this.ƀln.value.type==="playing"){let e=this.ƀln.value.value;this.ƀln.value={type:"paused",value:{time:e.time.value,volume:e.volume}},this.ƀdt=e,actionsLib.ActionLib.all([e.fade(1,st),e.muffle(1,st)]).tap(()=>{this.ƀdt=void 0,e.destroy();}).attach(this);}}else if(this.ƀln.value.type==="paused"){let{volume:e,time:i}=this.ƀln.value.value,s=bt.createByName(this.ƀlm,{volume:e,time:i,fade:1,muffle:1}).attach(this);s.ƀng(),actionsLib.ActionLib.all([s.fade(0,st),s.muffle(0,st)]).attach(this),this.ƀln.value={type:"playing",value:s};}}};var Pi=class extends actionsLib.IDAttachable{static{h(this,"MusicPlayer");}get time(){return this.ƀjq?this.ƀjq.time:0}get volume(){return this.ƀnp}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀnp=t,this.ƀjq&&(this.ƀjq.volume=t),this.ƀir&&(this.ƀir.volume=t),this}constructor(t){super(),this.ƀnp=1,this.ƀil={stopPlayingOnPause:true,playWhenPaused:void 0,volume:1,...t},this.ƀnp=this.ƀil.volume,this.ƀil.playWhenPaused&&this.ƀle(this.ƀil.playWhenPaused);}play(t){if(this.ƀbg)throw new Error("Play is called while music player is destroyed.");return this.ƀcu=t,actionsLib.SingleEvent.instant().async(()=>{let e=this.ƀjq;if(e)return this.ƀjq=void 0,e.close()}).map(()=>{if(this.ƀcu===t)return this.ƀjq=de.createByName(t,{stopPlayingOnPause:this.ƀil.stopPlayingOnPause,volume:this.ƀnp}).attach(this),this.ƀjq}).chain(this)}stop(){return actionsLib.SingleEvent.instant().async(()=>{let t=this.ƀjq;if(t)return t.close().tap(()=>{t===this.ƀjq&&(this.ƀjq=void 0);})}).chain(this)}close(){return this.ƀbg?this.onDestroy():(this.ƀbg=true,this.ƀis?.destroy(),actionsLib.SingleEvent.instant().async(()=>actionsLib.ActionLib.all([this.ƀjq?.close()??actionsLib.SingleEvent.instant(),this.ƀir?.close()??actionsLib.SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀle(t){this.ƀis=m.pause.toSequence().asyncDropOngoing(e=>e&&w.wait(st).map(()=>e)).tap(e=>{if(e)this.ƀir=bt.createByName(t,{fade:1,volume:this.ƀnp}).attach(this),this.ƀir.ƀng(),this.ƀir.fade(0);else if(this.ƀir){let i=this.ƀir;this.ƀir.fade(1).tap(()=>i.destroy()).attach(this),this.ƀir=void 0;}}).attach(this);}};var Si=2,ao=`
46
+ attribute vec2 aVertex;
47
+ attribute vec2 aUV;
48
+ attribute vec4 aColor;
49
+
50
+ attribute vec2 aPosition;
51
+ attribute float aRotation;
52
+
53
+ uniform mat3 uTranslationMatrix;
54
+ uniform float uRound;
55
+ uniform vec2 uResolution;
56
+ uniform vec4 uColor;
57
+
58
+ varying vec2 vUV;
59
+ varying vec4 vColor;
60
+
61
+ vec2 roundPixels(vec2 position, vec2 targetSize)
62
+ {
63
+ return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
64
+ }
65
+
66
+ void main(void){
67
+ float cosRotation = cos(aRotation);
68
+ float sinRotation = sin(aRotation);
69
+ float x = aVertex.x * cosRotation - aVertex.y * sinRotation;
70
+ float y = aVertex.x * sinRotation + aVertex.y * cosRotation;
71
+
72
+ vec2 v = vec2(x, y);
73
+ v = v + aPosition;
74
+
75
+ gl_Position = vec4((uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
76
+
77
+ if(uRound == 1.0)
78
+ {
79
+ gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
80
+ }
81
+
82
+ vUV = aUV;
83
+ vColor = vec4(aColor.rgb * ${Si}.0 * aColor.a, aColor.a) * uColor;
84
+ }
85
+ `,ho=`
86
+ varying vec2 vUV;
87
+ varying vec4 vColor;
88
+
89
+ uniform sampler2D uTexture;
90
+
91
+ void main(void){
92
+ gl_FragColor = texture2D(uTexture, vUV) * vColor;
93
+ }
94
+ `,je=class extends W__namespace.Shader{static{h(this,"ParticleShader");}constructor(){super({glProgram:W__namespace.GlProgram.from({vertex:ao,fragment:ho}),resources:{uTexture:W__namespace.Texture.WHITE.source,uSampler:new W__namespace.TextureStyle({}),uniforms:{uTranslationMatrix:{value:new W__namespace.Matrix,type:"mat3x3<f32>"},uColor:{value:new W__namespace.Color(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}});}};var ye=class{static{h(this,"ParticleFilters");}constructor(t){this.ƀjl=t,this.ƀmw={r:255,g:255,b:255},this.ƀgr=-1,this.ƀjx=1,this.ƀfg=1,this.ƀal=1,this.ƀaq=1,this.ƀbu=1;}get red(){return this.ƀjx}set red(t){this.ƀjx=t,this.ƀjz();}get green(){return this.ƀfg}set green(t){this.ƀfg=t,this.ƀjz();}get blue(){return this.ƀal}set blue(t){this.ƀal=t,this.ƀjz();}get brightness(){return this.ƀaq}set brightness(t){this.ƀaq=t,this.ƀjz();}get contrast(){return this.ƀbu}set contrast(t){this.ƀbu=t,this.ƀjz();}ƀjz(){let t=this.ƀbu*this.ƀaq/Si,e=helpersLib.NumberHelper.clamp(Math.round(this.ƀmw.r*this.ƀjx*t),0,255)*65536+helpersLib.NumberHelper.clamp(Math.round(this.ƀmw.g*this.ƀfg*t),0,255)*256+helpersLib.NumberHelper.clamp(Math.round(this.ƀmw.b*this.ƀal*t),0,255);e!==this.ƀgr&&(this.ƀgr=e,this.ƀjl.tint=e);}};var ge=class extends yt{static{h(this,"Particle");}constructor(t,e,i){super(e),this.ƀip=t,this.pixiParticle=e,this.ƀms=i,this.filters=new ye(this.pixiParticle),this.filters.ƀjz();}ƀx(t,e){this.pixiParticle.scaleX=t*this.ƀms,this.pixiParticle.scaleY=e*this.ƀms;}ƀeq(t){let e=new helpersLib.Vector(this.pixiParticle.texture.width*this.pixiParticle.scaleX,this.pixiParticle.texture.height*this.pixiParticle.scaleY);return new helpersLib.Vector(-this.pixiParticle.anchorX*e.x,-this.pixiParticle.anchorY*e.y).add(e.multiply(t))}destroy(){this.destroyed||(super.destroy(),this.ƀip.ƀke(this.pixiParticle));}setTint(t){return this.tint=t,this}get tint(){return this.filters.ƀmw}set tint(t){this.filters.ƀmw=t,this.filters.ƀjz();}};var Ri=class o extends yt{static{h(this,"ParticleContainer");}static createByName(t,e){let i=m.setupOptions.spriteDefinitions[t];if(!i)throw new Error(`ParticleContainer: Could not find sprite definition with name ${t}.`);return new o(i,e)}constructor(t,e){if(!t)throw new Error("ParticleContainer: spriteDefinition cannot be nullish!");let{glowEffect:i,...s}=e??{},r=new W__namespace.ParticleContainer({...s,shader:new je});super(r),this.pixiParticleContainer=r,this.filters=new Ut(this.pixiParticleContainer);let n=G.getAsset(t.id);if(this.ƀms=t.scale,i){let{texture:a,margin:l}=Dt.createCombinedParticleTexture(n,i,!t.destroyAssetOnDestroy);this.ƀmr=a,this.ƀk=(l+(a.width-l*2)*t.anchor.x)/a.width,this.ƀl=(l+(a.height-l*2)*t.anchor.y)/a.height;}else this.ƀmr=n,this.ƀk=t.anchor.x,this.ƀl=t.anchor.y;}destroy(){this.destroyed||(super.destroy(),!this.pixiParticleContainer.destroyed&&this.pixiParticleContainer.destroy());}generate(t=false){let e=new W__namespace.Particle({texture:this.ƀmr,anchorX:this.ƀk,anchorY:this.ƀl,scaleX:this.ƀms,scaleY:this.ƀms});return t?this.pixiParticleContainer.addParticleAt(e,0):this.pixiParticleContainer.addParticle(e),new ge(this,e,this.ƀms)}ƀke(t){this.pixiParticleContainer.destroyed||this.pixiParticleContainer.removeParticle(t);}ƀx(t,e){this.pixiParticleContainer.scale.set(t,e);}ƀeq(){throw new Error("ParticleContainer: holdFrom cannot be used, particle container bounds are not calculated!")}displayParent(t,e){return f.ƀek(t).ƀe(this.pixiParticleContainer,e),this}setBlendMode(t){return this.blendMode=t,this}get blendMode(){return this.pixiParticleContainer.blendMode}set blendMode(t){this.pixiParticleContainer.blendMode=t;}update(){return this.pixiParticleContainer.update(),this}};var Ei=class extends f{static{h(this,"Placeholder");}constructor(t){super(),this.ƀjk=new W__namespace.Graphics,this.ƀjk.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),this.ƀjh.addChild(this.ƀjk);}destroy(){this.destroyed||(super.destroy(),this.ƀjk.destroy());}};var Kt=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,s={};if(i){let r={blur:4,angle:helpersLib.Radian.get60,distance:10,color:helpersLib.ColorHelper.black,alpha:.5,...i};s={dropShadow:{blur:r.blur,angle:r.angle.value,distance:r.distance,color:helpersLib.ColorHelper.rgbToHex(r.color),alpha:r.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,...s})}};var $e=class{static{h(this,"RichTextDataInConverter");}static process(t,e){let i=new Set(e.styles?Object.keys(e.styles):[]),s=scriptEngineLib.RichTextSeparator.process(t,i),r=this.ƀgb(s,e),n=this.ƀv(r);return this.ƀlp(n)}static ƀgb(t,e){let i=new Map,s=new Map,r=h((a,l)=>{if(s.has(l))return s.get(l);let c=Kt.getPixiTextStyle(a);return s.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀej(a.tags,e,i),p=r(l,c),d=W__namespace.CanvasTextMetrics.measureText(" ",new W__namespace.TextStyle(p),void 0,false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:d.width}})}static ƀej(t,e,i){let s=t.join("+");if(i.has(s))return {style:i.get(s),cacheKey:s};let r=this.ƀbk(t,e);return i.set(s,r),{style:r,cacheKey:s}}static ƀbk(t,e){let i={...e.default};for(let l of t)e.styles&&e.styles[l]&&(i={...i,...e.styles[l]});let{wordWrapWidth:s,align:r,dropShadow:n,...a}=i;return a}static ƀv(t){let e=[],i=[];return t.forEach((s,r)=>{s.text.split(/\r?\n/).forEach((a,l)=>{l>0&&(e.push(i),i=[]),i.push({text:a,cacheKey:s.cacheKey,style:s.style,pixiStyle:s.pixiStyle,spaceWidth:s.spaceWidth});});}),e.push(i),e}static ƀlp(t){let e=[];return t.forEach(i=>{if(i.length===0)throw new Error("Internal Error: Line is unexpectedly empty");let s=i.flatMap(r=>this.ƀlq(r.text).map(a=>{let l=new W__namespace.TextStyle(r.pixiStyle),c=W__namespace.CanvasTextMetrics.measureText(a,l,void 0,false);return {text:a,whitespace:a.trim()==="",style:{cacheKey:r.cacheKey,style:r.style,pixiStyle:l,height:c.height,ascent:c.fontProperties.ascent,descent:c.fontProperties.descent,width:c.width,spaceWidth:r.spaceWidth}}}));e.push(s);}),e}static ƀlq(t){if(t==="")return [""];let e=[],i="",s=t[0]===" ";for(let r=0;r<t.length;r++){let n=t[r],a=n===" ";a===s?i+=n:(e.push(i),i=n,s=a);}return i&&e.push(i),e}};var ke=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀcs.length===0}get remainingWidth(){return this.ƀns-this.ƀcv}constructor(t,e){this.ƀns=t,this.ƀgx=[],this.ƀcs=[],this.ƀcv=0,this.ƀgw=new helpersLib.Vector(0,0),this.ƀct=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀft=i.horizontalAlignment,this.ƀnj=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀns||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀcw={direction:i.rectangleCutOption.direction,rectangle:this.ƀbx(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀct,t.y),i=this.ƀer(this.ƀgw.y,this.ƀgw.y+e);return this.ƀcv+t.x<=i}insertWord(t){let e=Math.max(this.ƀct,t.style.height);if(this.ƀcs.length===0){let i=this.ƀes(this.ƀgw.y,this.ƀgw.y+e);this.ƀgw=new helpersLib.Vector(i,this.ƀgw.y),this.ƀcv=this.ƀgw.x;}this.ƀcs.push({chunk:t,position:new helpersLib.Vector(this.ƀcv,this.ƀgw.y)}),this.ƀct=e,this.ƀcv+=t.style.width;}newLine(){let t=this.ƀgw.y+this.ƀct,e=this.ƀes(t,t);this.ƀdw(),this.ƀgw=new helpersLib.Vector(e,t),this.ƀcv=this.ƀgw.x,this.ƀct=0;}print(){return this.ƀdw(),this.ƀgx}ƀdw(){this.ƀcs.length>0&&(this.ƀgx.push(this.ƀh(this.ƀcs)),this.ƀcs=[]);}ƀh(t){return t=this.ƀnl(t),t=this.ƀfv(t),t}ƀfv(t){if(this.ƀft==="left")return t;let e=this.ƀgw.y+this.ƀct,i=this.ƀes(this.ƀgw.y,e),r=this.ƀer(this.ƀgw.y,e)-i,n=Math.min(r,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀft==="center"?a=(r-n)/2:a=r-n,t.map(l=>(l={chunk:l.chunk,position:new helpersLib.Vector(l.position.x+a,l.position.y)},l))}ƀnl(t){let e=Math.max(...t.map(s=>s.chunk.style.ascent)),i=Math.max(...t.map(s=>s.chunk.style.descent));return t.map(s=>{let r;switch(this.ƀnj){case "top":r=i-s.chunk.style.descent;break;case "center":r=(i-s.chunk.style.descent+e-s.chunk.style.ascent)*.5;break;case "bottom":r=e-s.chunk.style.ascent;break;default:{this.ƀnj;throw new Error}}return s={chunk:s.chunk,position:new helpersLib.Vector(s.position.x,s.position.y+r)},s})}ƀes(t,e){return this.ƀcw&&(this.ƀcw.direction==="topLeft"||this.ƀcw.direction==="bottomLeft")&&(this.ƀcw.rectangle.isPointInside(new helpersLib.Vector(0,t),{includeEdges:false})||this.ƀcw.rectangle.isPointInside(new helpersLib.Vector(0,e),{includeEdges:false}))?this.ƀcw.rectangle.bottomRight.x:0}ƀer(t,e){return this.ƀcw&&(this.ƀcw.direction==="topRight"||this.ƀcw.direction==="bottomRight")&&(this.ƀcw.rectangle.isPointInside(new helpersLib.Vector(this.ƀns,t),{includeEdges:false})||this.ƀcw.rectangle.isPointInside(new helpersLib.Vector(this.ƀns,e),{includeEdges:false}))?this.ƀcw.rectangle.topLeft.x:this.ƀns}ƀbx(t){let e,i;switch(t.direction){case "topRight":e=new helpersLib.Vector(t.position.x,-1/0),i=new helpersLib.Vector(1/0,t.position.y);break;case "topLeft":e=new helpersLib.Vector(-1/0,-1/0),i=t.position;break;case "bottomRight":e=t.position,i=new helpersLib.Vector(1/0,1/0);break;case "bottomLeft":e=new helpersLib.Vector(-1/0,t.position.y),i=new helpersLib.Vector(t.position.x,1/0);break;default:{t.direction;throw new Error}}return new helpersLib.Rectangle(e,i)}};var ze=class{static{h(this,"ConsistentSpaceTextWrapper");}static wrapText(t,e){return t.forEach(i=>{i.forEach((s,r)=>{if(e.isSpaceAvailable(new helpersLib.Vector(s.style.width,s.style.height)))if(s.whitespace&&r===i.length-2){let n=i[i.length-1];e.isSpaceAvailable(new helpersLib.Vector(n.style.width+s.style.width,n.style.height))?e.insertWord(s):this.ƀnt(s,e);}else e.insertWord(s);else e.lineIsEmpty?e.insertWord(s):s.whitespace?this.ƀnt(s,e):(e.newLine(),e.insertWord(s));}),e.newLine();}),e.print()}static ƀnt(t,e){let i=Math.max(0,Math.floor(e.remainingWidth/t.style.spaceWidth)),s=Math.max(0,Math.min(i,t.text.length-1));if(s>0){let n={text:" ".repeat(s),whitespace:true,style:{...t.style,width:s*t.style.spaceWidth}};e.insertWord(n);}e.newLine();let r=t.text.length-s-1;if(r>0){let n={text:" ".repeat(r),whitespace:true,style:{...t.style,width:r*t.style.spaceWidth}};e.insertWord(n);}}};var Je=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀhn(t),t=this.ƀmy(t),this.ƀbc(t)}static ƀhn(t){return t.map(e=>{let i=[],s,r=true;return e.forEach(n=>{if(!s||s.chunk.style.cacheKey!==n.chunk.style.cacheKey)s&&i.push(s),s=n,r=n.chunk.whitespace;else {let a=s.chunk.text+n.chunk.text;r=n.chunk.whitespace&&r,s={chunk:{text:a,whitespace:r,style:{...s.chunk.style,width:s.chunk.style.width+n.chunk.style.width}},position:s.position};}}),s&&i.push(s),i})}static ƀmy(t){return t.map(e=>{if(e.length===0)return [];let i=e.pop();if(!i.chunk.whitespace||i.chunk.text===""){let s=i.chunk.text.length,r=i.chunk.text.trimEnd();s!==r.length?e.push({chunk:{text:r,whitespace:false,style:{...i.chunk.style,width:i.chunk.style.width-(s-r.length)*i.chunk.style.spaceWidth}},position:i.position}):e.push(i);}return e})}static ƀbc(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 we=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=$e.process(t,e),s=helpersLib.JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),r=new ke(e.default.wordWrapWidth??1/0,s),n=ze.wrapText(i,r);return Je.process(n)}};var go=1,Sr=1/go,xe=class extends f{static{h(this,"Text");}get ƀmp(){if(!this.ƀmq){let t=new W__namespace.TextStyle(this.ƀjn);this.ƀmq=W__namespace.CanvasTextMetrics.measureText(this.ƀmo,t);}return this.ƀmq}get ascent(){return this.ƀmp.fontProperties.ascent}constructor(t,e){super(),this.ƀjn=Kt.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀjm.destroyed&&this.ƀjm.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new helpersLib.Vector(this.ƀjm.anchor.x,this.ƀjm.anchor.y)}set anchor(t){this.ƀj=t,this.ƀjm.anchor.set(t.x,t.y),this.ƀkf();}setText(t){return this.ƀmo!==t&&(this.ƀmo=t,this.ƀka()),this}setColor(t){let e=helpersLib.ColorHelper.rgbToHex(t);return this.ƀjn.fill!==e&&(this.ƀjn.fill=e,this.ƀka()),this}ƀka(){this.ƀjm?.destroy(),this.ƀmi?.destroy(),this.ƀmi=void 0,this.ƀmq=void 0;let t=new W__namespace.TextStyle(this.ƀjn);this.ƀjm=new W__namespace.Text({text:this.ƀmo,style:t}),this.ƀj&&this.ƀjm.anchor.set(this.ƀj.x,this.ƀj.y),this.ƀkf(),this.ƀjm.scale.set(Sr,Sr),this.ƀjh.addChild(this.ƀjm),this.ƀjn.lineThrough&&(this.ƀmi=this.ƀf(this.ƀjm,this.ƀjn.fill),this.ƀjh.addChild(this.ƀmi));}ƀkf(){let t=W__namespace.CanvasTextMetrics.measureText(this.ƀmo,new W__namespace.TextStyle({...this.ƀjn,dropShadow:false})),e=-this.ƀjm.anchor.x*t.width,i=-this.ƀjm.anchor.y*t.height;this.ƀjm.boundsArea=new W__namespace.Rectangle(e,i,t.width,t.height);}ƀf(t,e){let i=W__namespace.CanvasTextMetrics.measureText(t.text,t.style),s=Math.max(1,Math.round(i.lineHeight*.07)),r=s%2*.5,n=new W__namespace.Graphics,a=0;return i.lines.forEach((l,c)=>{let p=W__namespace.CanvasTextMetrics.measureText(l,t.style),d=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+r,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),d),n.lineTo(Math.floor(g+p.width),d),a+=p.lineHeight;}),n.stroke({width:s,color:e}),n}};var Ci=class extends f{static{h(this,"RichText");}constructor(t,e){super(),we.process(t,e).forEach(s=>new xe(s.text,s.style).setPosition(s.position).displayParent(this).attach(this));}};var Ii=class extends f{static{h(this,"UpdatableContainer");}},Ai=class extends f{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀcd=t,this.ƀdc=new Map,this.ƀil={trackBy:h((i,s)=>s,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀdc.keys()),i=0;t.forEach((s,r)=>{let n=this.ƀil.trackBy(s,r),a;this.ƀdc.has(n)?(a=this.ƀdc.get(n),e.delete(n),a.update(s)):(a=this.ƀcd(s).displayParent(this).attach(this),this.ƀdc.set(n,a)),this.ƀil.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀil.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀil.positioning.spacing);}),e.forEach(s=>{this.ƀdc.get(s).destroy(),this.ƀdc.delete(s);});}};var ve=class o extends f{static{h(this,"MenuUI");}static{this.ƀgi=actionsLib.Reducer.createExistenceChecker();}static{this.isAnyMenuTransitioning=this.ƀgi.notifier;}constructor(t,e){super(),this.ƀid=new actionsLib.SingleAction,this.onCreate=this.ƀid.notifier,this.ƀif=new actionsLib.SingleAction,this.onOpen=this.ƀif.notifier,this.ƀia=new actionsLib.SingleAction,this.onClose=this.ƀia.notifier,this.ƀbg=false;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.setAlpha(0),this.ƀs=new O(this,"alpha",{animation:b.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState});let s=A.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(i.backgroundDarkeningRatio).setInteractive(true).displayParent(this).attach(this);this.ƀhl=it.createByName(t).setPosition(new helpersLib.Vector(0,0)).setInteractive(true).displayParent(this).attach(this),m.instance.screenSize.subscribe(n=>{s.aspectRatio=n.x/n.y,s.scale=Math.max(n.x,n.y),s.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.half}),this.setPosition(n.multiplyNumber(.5));}).attach(this),this.ƀid.resolve();let r=o.ƀgi.effect().attach(this);this.ƀs.animate({alpha:1}).chain(this).tap(()=>{this.ƀif.resolve(),r.destroy(),i.closeOnBackgroundClick&&s.on(exports.ContainerEventType.Click).take(1).tap(()=>this.close()).attach(this);}).attachToRoot();}getBoundingMask(){return this.ƀhl.getBoundingMask()}close(){if(!this.ƀbg){this.ƀbg=true;let t=o.ƀgi.effect().attach(this);this.ƀs.animate({alpha:0}).chain(this).map(()=>{this.ƀia.resolve(),t.destroy(),this.destroy();}).chainToRoot();}return this.onClose.toSingleEvent()}};var Mi=class extends mt{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.ƀil=t,queueMicrotask(()=>{if(!this.ƀhm)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀkc(t){this.ƀhm=t,this.ƀhm.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀhm.onCreate.toSingleEvent()}onOpen(){return this.ƀhm.onOpen.toSingleEvent()}onClose(){return this.ƀhm.onClose.toSingleEvent()}close(){return this.ƀhm.close()}};var Di=class extends Q{static{h(this,"MenuView");}constructor(t,e,i){super();let s=helpersLib.JsonHelper.removeUndefinedProperties({appearAnimationDuration:i.appearAnimationDuration,backgroundDarkeningRatio:i.backgroundDarkeningRatio,closeOnBackgroundClick:t.ƀil.closeOnBackgroundClick}),r=new ve(e,s).displayParent(m.camera.layers.foregroundScreen).attach(this);t.ƀkc(r);let n=new actionsLib.SingleAction;r.onCreate.subscribe(()=>n.resolve(r)).attach(this),this.onCreate=n.notifier,this.onOpen=r.onOpen.notifier,this.onClose=r.onClose.notifier;}};var Ro=.65,Eo=.01,Xe=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀkq}get contentSize(){return this.ƀbr.size.ceil()}constructor(t,e,i,s){this.ƀbr=t,this.ƀz=e,this.ƀio=i,this.ƀlj=s,this.ƀge=false,this.ƀkq=e-i*2,this.ƀbr.y=i,this.ƀmj=i;}onWheel(t){this.setTarget(this.ƀmj-t*Ro);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀmj=helpersLib.NumberHelper.clamp(t,this.ƀz-this.ƀio-this.contentSize.y,this.ƀio);}jumpToTarget(){this.ƀbr.y=this.ƀmj;}update(t){let e=this.contentSize;if(e.y<=this.ƀkq){switch(this.ƀlj){case "start":this.ƀmj=this.ƀio;break;case "center":this.ƀmj=(this.ƀz-e.y)*.5;break;case "end":this.ƀmj=this.ƀz-e.y-this.ƀio;break;default:{this.ƀlj;throw new Error}}this.ƀge||(this.ƀbr.y=this.ƀmj);}this.ƀge=true;let i=this.ƀmj-this.ƀbr.y;this.ƀbr.y=this.ƀbr.y+i*Eo*t;}};var Io=15,Bi=class extends f{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbs}get contentSize(){return this.ƀkr.contentSize}constructor(t,e={}){super();let i={padding:Io,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 s=new f().displayParent(this).attach(this);new Bt(s,t,i.padding).attach(this);let r=new W__namespace.Graphics;r.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),s.ƀjh.addChild(r);let n=new f().displayParent(s).attach(this);this.ƀkr=new Xe(n,t.y,i.padding,i.smallContentAlign),this.ƀbs=new helpersLib.Vector(t.x,this.ƀkr.scrollHeight),r.eventMode="dynamic",r.addEventListener("wheel",a=>{this.ƀkr.onWheel(a.deltaY);}),n.setInteractive(true),n.ƀjh.addEventListener("wheel",a=>{this.ƀkr.onWheel(a.deltaY);}),w.afterSceneUpdateAction.subscribe(a=>this.ƀkr.update(a.delta)).attach(this),this.addChildTo=n;}scrollToTop(t){this.ƀkr.scrollToTop(),t?.instant&&this.ƀkr.jumpToTarget();}scrollToBottom(t){this.ƀkr.scrollToBottom(),t?.instant&&this.ƀkr.jumpToTarget();}};var Gi=class extends f{static{h(this,"LayoutContainer");}constructor(t={}){super(new components.LayoutContainer),this.ƀjh.layout={isLeaf:false,...t};}setLayout(t){return this.ƀjh.layout=t,this}debug(){return this.ƀjh.layout={debug:true},this}debugBackground(){return this.ƀjh.layout={backgroundColor:"#3080FF"},this}};var Oo=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},L=class extends mt{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);}};L=Oo([Ot()],L);var Mo=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Do=1500,Ze=class{static{h(this,"CameraService");}createCamera(){return new L().attachToRoot()}getCameraPosition(){let t=L.getInstanceOrFail();return helpersLib.Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=L.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=L.getInstanceOrFail();e.focusingNewTargetInfo.value={time:m.time,duration:t?.duration??Do,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??exports.FocusingAnimation.Instant};}update(t,e){let i=L.getInstanceOrFail(),s=i.targetPosition.value;s&&(i.focusingNewTargetInfo.value?this.ƀgm(i,s,t):i.position.value=s);}ƀgm(t,e,i){let s=t.focusingNewTargetInfo.value;if(s.focusingAnimation===exports.FocusingAnimation.Instant)this.ƀbl(t,e);else {let r=(i-s.time)/s.duration;if(r>=1)this.ƀbl(t,e);else {let n;s.focusingAnimation===exports.FocusingAnimation.EaseInOut?n=U.easeInOut(r):s.focusingAnimation===exports.FocusingAnimation.EaseOut?n=U.easeOut(r):n=1;let a=s.position.lerp(e,n);s.roundPosition&&(Math.abs(a.x-s.position.x)>=s.roundPositionThreshold&&(a=new helpersLib.Vector(Math.round(a.x),a.y)),Math.abs(a.y-s.position.y)>=s.roundPositionThreshold&&(a=new helpersLib.Vector(a.x,Math.round(a.y)))),t.position.value=a;}}}ƀbl(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};Ze=Mo([u()],Ze);var Bo=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Go=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ni=class{static{h(this,"CameraController");}constructor(t){this.ƀay=t;}createCamera(){return this.ƀay.createCamera().id}update(t,e){this.ƀay.update(t,e);}setPosition(t){this.ƀay.setPosition(t);}setTransition(t){this.ƀay.setTransition(t);}getCameraPosition(){return this.ƀay.getCameraPosition()}};Ni=Bo([ct(exports.CameraGateway),Go("design:paramtypes",[Ze])],Ni);var Qe=class{static{h(this,"PositionConversionHelper");}static includeScaleInScreenPosition(t,e,i){if(e!==1){let s=helpersLib.Vector.fromTo(i,t).multiplyNumber(1/e);return i.add(s)}else return t}};var No=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Fo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ft=class extends Q{static{h(this,"CameraView");}constructor(t){super(),this.ƀdm=t,this.ƀls=(()=>{let e=new f().attach(this);return e.ƀjh=m.instance.ƀjg.stage,e})(),this.ƀkl=new f().setAlpha(0).displayParent(this.ƀls).attach(this),this.ƀaj=A.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(this.ƀls).attach(this),this.ƀag=new f().displayParent(this.ƀkl).attach(this),this.ƀax=new f().displayParent(this.ƀkl).attach(this),this.ƀdz=new f().setSortableChildren(true).displayParent(this.ƀkl).attach(this),this.ƀaw=new f().setSortableChildren(true).displayParent(this.ƀax).attach(this),this.ƀdy=new f().setSortableChildren(true).setRenderGroup().setZIndex(20).displayParent(this.ƀaw).attach(this),this.ƀhd=new f().setSortableChildren(true).setRenderGroup().setZIndex(10).displayParent(this.ƀaw).attach(this),this.ƀaf=new f().setRenderGroup().setZIndex(0).displayParent(this.ƀaw).attach(this),this.ƀi=new O(this.ƀkl,"alpha",{duration:500,animation:b.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀak=new O(this.ƀaj,"alpha",{duration:500,animation:b.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),m.instance.screenSize.subscribe(e=>{this.ƀaj.aspectRatio=e.x/e.y,this.ƀaj.scale=Math.max(e.x,e.y),this.ƀaj.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.zero});}).attach(this),this.ƀdm.position.subscribe(e=>{this.ƀaw.position=this.ƀby(e);}).attach(this),this.ƀdm.offset.subscribe(e=>{this.ƀax.position=e;}).attach(this),this.ƀak.set({alpha:0}),this.ƀi.set({alpha:0});}screenPositonToStagePosition(t){let e=Qe.includeScaleInScreenPosition(t,this.ƀls.scale,m.instance.screenSizeCenter.value);return new helpersLib.Vector(e.x-this.ƀaw.position.x-this.ƀax.position.x,e.y-this.ƀaw.position.y-this.ƀax.position.y)}getLayers(){return {backgroundScreen:this.ƀag.id,background:this.ƀaf.id,main:this.ƀhd.id,foreground:this.ƀdy.id,foregroundScreen:this.ƀdz.id}}appear(t,e,i){switch(e){case "alpha":return this.ƀak.set({alpha:0}),this.ƀi.set({alpha:t?0:1}),actionsLib.SingleEvent.instant().async(()=>i>0&&w.wait(i),"tap").async(()=>this.ƀi.animate({alpha:t?1:0})).chain(this);case "pureBlack":return this.ƀi.set({alpha:1}),this.ƀak.set({alpha:t?1:0}),actionsLib.SingleEvent.instant().async(()=>i>0&&w.wait(i),"tap").async(()=>this.ƀak.animate({alpha:t?0:1})).chain(this);case "instant":return this.ƀi.set({alpha:t?1:0}),this.ƀak.set({alpha:t?0:1}),actionsLib.SingleEvent.instant();default:{throw new Error}}}ƀby(t){return helpersLib.Vector.fromTo(t,m.instance.screenSizeCenter.value)}};Ft=No([pi({entity:L}),Fo("design:paramtypes",[L])],Ft);var _o=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Li=class{static{h(this,"CameraViewController");}getLayers(){let t=L.getInstanceOrFail().id;return Ft.getInstanceOrFail(t).getLayers()}appear(t,e,i){let s=L.getInstanceOrFail().id;return Ft.getInstanceOrFail(s).appear(t,e,i)}screenPositonToStagePosition(t){let e=L.getInstanceOrFail().id;return Ft.getInstanceOrFail(e).screenPositonToStagePosition(t)}};Li=_o([ct(Nt)],Li);var Ho=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},jo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.KeyboardService=class _i{static{h(this,"KeyboardService");}constructor(){this.ƀgp=new actionsLib.Action,this.keyPressed=this.ƀgp.notifier,this.ƀgq=new actionsLib.Action,this.keyReleased=this.ƀgq.notifier,this.ƀgz=new Set,this.ƀgy=new Set,window.addEventListener("keydown",t=>{this.ƀgz.add(t.code),this.ƀgy.add(t.code),!t.repeat&&this.ƀgp.trigger({key:t.key,code:t.code});}),window.addEventListener("keyup",t=>{this.ƀgz.delete(t.code),this.ƀgq.trigger({key:t.key,code:t.code});}),window.addEventListener("blur",()=>{this.ƀgz.clear();}),w.afterSceneUpdateAction.subscribe(()=>this.ƀgy.clear()).attachToRoot();}isKeyDown(t,e){return (e?.onlyPressedThisFrame?this.ƀgy:this.ƀgz).has(t)}};exports.KeyboardService=Ho([u(),jo("design:paramtypes",[])],exports.KeyboardService);var Uo=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Wo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.MouseService=class Se{static{h(this,"MouseService");}constructor(){this.ƀgd=new actionsLib.Variable(false),this.initialMouseMovementHappened=this.ƀgd.notifier,this.ƀlt=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀlt.notifier,this.ƀkn=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀkn.notifier,this.ƀhc=new actionsLib.Variable(false),this.mainButtonState=this.ƀhc.notifier,this.ƀks=new actionsLib.Variable(false),this.secondaryButtonState=this.ƀks.notifier,this.ƀlv(),window.addEventListener("pointerdown",t=>{t.button===0?this.ƀhc.value=true:t.button===2&&(this.ƀks.value=true);},{capture:true}),window.addEventListener("pointerup",t=>{t.button===0?this.ƀhc.value=false:t.button===2&&(this.ƀks.value=false);},{capture:true}),window.addEventListener("blur",()=>{this.ƀhc.value=false,this.ƀks.value=false;},{capture:true});}ƀlv(){let t=helpersLib.Vector.zero;window.addEventListener("pointermove",e=>{t=new helpersLib.Vector(e.clientX,e.clientY),this.ƀgd.value=true;},{capture:true}),w.beforeSceneUpdateAction.subscribe(()=>{this.ƀkn.value=this.ƀbf(t);}).attachToRoot(),w.afterSceneUpdateAction.subscribe(()=>{this.ƀlt.value=m.camera.screenPositonToStagePosition(this.ƀkn.value);}).attachToRoot();}ƀbf(t){let i=m.instance.renderer.canvas.getBoundingClientRect(),s=i.width,r=i.height;if(s<=0||r<=0)return helpersLib.Vector.zero;let n=m.instance.renderer.screen,a=(t.x-i.left)/s*n.width,l=(t.y-i.top)/r*n.height;return a=helpersLib.NumberHelper.clamp(a,0,n.width),l=helpersLib.NumberHelper.clamp(l,0,n.height),new helpersLib.Vector(a,l)}};exports.MouseService=Uo([u(),Wo("design:paramtypes",[])],exports.MouseService);var $o=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ko=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.MouseTargetFocusService=class Hi{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀdx}get lastFocusedPosition(){return this.ƀgt}constructor(t){this.ƀhr=t,this.ƀih=new actionsLib.Action,this.onTargetFocus=this.ƀih.notifier,this.ƀmv=0,this.ƀmx=false,this.ƀdx=false,this.ƀgt=void 0,w.beforeSceneUpdateAction.subscribe(e=>this.ƀna(e.delta)).attachToRoot();}ƀna(t){if(this.ƀhs){let e=this.ƀey(this.ƀhr.stagePosition.value,this.ƀhs);this.ƀiu===void 0?this.ƀiu=e:this.ƀbb(e,t);}this.ƀhs=this.ƀhr.stagePosition.value;}ƀbb(t,e){this.ƀiu-t>10?(this.ƀmv=Math.max(250,this.ƀmv),this.ƀmx=true):this.ƀmv>1e3&&(this.ƀmx=true);let i=this.ƀmv>=300&&this.ƀmx;this.ƀgn(i,t,e);}ƀgn(t,e,i){(t||e>this.ƀiu)&&(this.ƀiu=e),t?(this.ƀmx=false,this.ƀmv=0,this.ƀdx=true,this.ƀgt=this.ƀhr.stagePosition.value,this.ƀih.trigger(this.ƀgt)):(this.ƀmv+=i,this.ƀdx=false);}ƀey(t,e){let i=helpersLib.Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};exports.MouseTargetFocusService=$o([u(),ko("design:paramtypes",[exports.MouseService])],exports.MouseTargetFocusService);var ji=10.8,Ui=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 y=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,s){return (t&s)!==0&&(i&e)!==0}static canCollideWith(t,e){return t.shapes.some(i=>e.shapes.some(s=>o.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,s.collisionGroup,s.collisionMask)))}static cloneP2Body(t){let e=new K__default.default.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var Pt="border";var Zo=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r};exports.PhysicsGateway=class Te extends lt(){static{h(this,"PhysicsGateway");}};exports.PhysicsGateway=Zo([u()],exports.PhysicsGateway);var Qo=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},St=class extends lt(){static{h(this,"PhysicsInternalGateway");}};St=Qo([u()],St);var T=class o extends q{static{h(this,"PhysicsEntity");}static{this.ƀin=new Map;}static{this.ƀiz=new Map;}static getFromP2BodyID(t){return o.ƀin.get(t)}static getFromP2BodyIDOrFail(t){let e=o.ƀin.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=o.ƀiz.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(o.ƀiz.values())}get area(){return this.ƀy}get mass(){return this.ƀhg}get collisions(){return this.ƀbh}constructor(t,e,i){super(),this.ƀib=new actionsLib.Action,this.onCollision=this.ƀib.notifier,this.type="dynamic",this.ƀy=0,this.ƀhg=0,this.ƀbh=[],this.physicsWorldID=t,this.ƀjb=R.get(St);let s=this.ƀjb.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),r=this.ƀjb.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀja=this.ƀjb.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀjc=this.ƀjb.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀjb.createBody(this.physicsWorldID,e,s,r,this.type),this.ƀy=this.p2Body.getArea(),this.ƀhg=this.p2Body.mass,this.p2Body.position=y.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀjb.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.ƀin.set(this.p2Body.id,this),o.ƀiz.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀjb.removeBody(this.physicsWorldID,this.p2Body),o.ƀin.delete(this.p2Body.id),o.ƀiz.delete(this.id));}canCollideWith(t){return y.arePhysicsGroupsCollidable(this.ƀja,this.ƀjc,t.ƀja,t.ƀjc)}ƀku(t){this.ƀbh=t,t.length>0&&this.ƀib.trigger(t);}};var Re=class extends T{static{h(this,"ImmovablePhysicsEntity");}constructor(t,e){super(t,e,"static"),this.position=y.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 $i=class o extends q{static{h(this,"MovableEntity");}static{this.ƀmb=new Set;}static{this.ƀmd=[];}static{this.ƀmc=false;}static{this.ƀme=false;}static{P.onHardReset.subscribe(()=>{o.ƀmb=new Set,o.ƀmd=[],o.ƀmc=false,o.ƀme=false;}).attachToRoot();}static ƀma(t,e){o.ƀmc=true;for(let i of o.ƀmb)try{i.ƀlz(t,e);}catch(s){console.error("MovableEntity step error: ",s);}if(o.ƀmc=false,o.ƀmd.length>0){for(let i of o.ƀmd)i.destroyed||o.ƀmb.add(i);o.ƀmd.length=0;}}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),o.ƀmc?o.ƀmd.push(this):o.ƀmb.add(this),o.ƀme||(o.ƀme=true,w.beforeSceneUpdateAction.subscribe(t=>o.ƀma(t.time,t.delta)).attachToRoot());}destroy(){this.destroyed||(o.ƀmb.delete(this),super.destroy());}ƀlz(t,e){let i=this.position.value,s=this.velocity.value;this.position.value=new helpersLib.Vector(i.x+s.x*e,i.y+s.y*e),this.rotation.value=new helpersLib.Radian(this.rotation.value.value+this.rotationalSpeed.value*e);}};var ki=class extends T{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.ƀfw=false,this.ƀfx=false,this.ƀfz=false,this.ƀfy=false,this.ƀiw(),this.ƀha(),R.get(St).subscribeToPhysicsStep(t,({time:i,delta:s})=>this.ƀlz(i,s)).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}}ƀlz(t,e){this.ƀfw=true,this.ƀfx=true,this.ƀfz=true,this.ƀfy=true,this.ƀiw();}ƀiw(){this.position.value=y.arrayToVector(this.p2Body.position),this.rotation.value=new helpersLib.Radian(this.p2Body.angle),this.velocity.value=y.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀha(){this.position.subscribe(t=>{this.ƀfw?this.ƀfw=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfx?this.ƀfx=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfz?this.ƀfz=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfy?this.ƀfy=false:this.p2Body.angularVelocity=t;}).attach(this);}};var rn=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},sn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},S=class extends q{static{h(this,"PhysicsWorldEntity");}constructor(t,e,i,s,r,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=s,this.materialDefinitions=r,this.physicsBodyGroupToP2Group=n,this.physicsBodyGroupToP2Mask=a;}};S=rn([Ot(),sn("design:paramtypes",[helpersLib.Vector,Boolean,K__default.default.World,Map,Map,Map,Map])],S);var hn=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ot=class{static{h(this,"PhysicsBodyGroupService");}createBodyGroupsAndMasks(t,e){let i=new Map,s=new Map;return t.map((r,n)=>{if(n>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(r,1<<n),s.set(r,0);}),e.map(([r,n])=>{if(!i.has(r))throw new Error(`Physics body group "${r}" not found`);if(!i.has(n))throw new Error(`Physics body group "${n}" not found`);let a=s.get(r),l=s.get(n),c=i.get(r),p=i.get(n);s.set(r,a|p),s.set(n,l|c);}),{physicsBodyGroupToP2Group:i,physicsBodyGroupToP2Mask:s}}getGroupConstant(t,e){return S.getInstanceByIDOrFail(t).physicsBodyGroupToP2Group.get(e)}getMaskConstant(t,e){return S.getInstanceByIDOrFail(t).physicsBodyGroupToP2Mask.get(e)}canCollide(t,e,i){let s=t.physicsBodyGroupToP2Group.get(e),r=t.physicsBodyGroupToP2Mask.get(e),n=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (r&n)!==0&&(a&s)!==0}};ot=hn([u()],ot);var ln=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},cn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},ei=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀiy=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((s,r)=>{s.forEach((n,a)=>{this.ƀiy.canCollide(t,a,e)&&i.push({grid:n,cellSize:r});});}),i}get(t,e,i){return t.availabilityGridCache.get(e)?.get(i)}set(t,e,i,s){let r=t.availabilityGridCache.get(e);r||(r=new Map,t.availabilityGridCache.set(e,r)),r.set(i,s);}clear(t){t.availabilityGridCache.clear();}};ei=ln([u(),cn("design:paramtypes",[ot])],ei);var pn=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},un=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Tt=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀiy=t,this.ƀad=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let s=y.aabbToBoundingBox(e.aabb);this.ƀad.getCollidableGrids(t,i).forEach(r=>{let n=V.areaToGridArea(s,r.cellSize);r.grid.setArea(n,false);});}findClosestAvailableSpace(t,e,i,s=50){return e.aabbNeedsUpdate=true,e.updateAABB(),le.findByConvertingGridSpace(this.getAvilabilityGrid(t,s,i),y.aabbToBoundingBox(e.aabb),s)}getAvilabilityGrid(t,e,i){let s=this.ƀad.get(t,e,i);return s||(s=this.ƀch(t,e,i),this.ƀad.set(t,e,i,s)),s}ƀch(t,e,i){let s=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(r=>{let n=T.getFromP2BodyIDOrFail(r.id);if(n.includeInPathfinding&&this.ƀiy.canCollide(t,n.physicsBodyGroup,i)){let a=this.ƀeo(r,e);s.setArea(a,false);}}),s}ƀeo(t,e){let i=y.aabbToBoundingBox(t.aabb);return V.areaToGridArea(i,e)}};Tt=pn([u(),un("design:paramtypes",[ot,ei])],Tt);var mn=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},yn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},te=class{static{h(this,"PathFinderService");}constructor(t){this.ƀix=t;}findPathAStar(t,e,i,s,r){r||(r={}),r.neighborType===void 0&&(r.neighborType="orthogonal"),r.gridCellSize===void 0&&(r.gridCellSize=50);let n=S.getInstanceByIDOrFail(t),a,l;helpersLib.Comparator.isNumber(i)?(l=T.getPhysicsInstanceOrFail(i).p2Body,a=y.arrayToVector(l.position)):a=i;let c=V.positionToGridPosition(e,r.gridCellSize),p=V.positionToGridPosition(a,r.gridCellSize),d=this.ƀix.getAvilabilityGrid(n,r.gridCellSize,s);if(l){let v=y.aabbToBoundingBox(l.aabb),x=V.areaToGridArea(v,r.gridCellSize);d.setArea(x,true);}let g=ce.findPath(d,c,p,r.neighborType);return g.path=g.path.map(v=>V.gridPositionToPosition(v,r.gridCellSize)),g}findPathDirection(t,e,i,s,r=50){let n=S.getInstanceByIDOrFail(t),a;if(helpersLib.Comparator.isNumber(i)){let g=T.getPhysicsInstanceOrFail(i);a=y.aabbToBoundingBox(g.p2Body.aabb);}else a=new helpersLib.Rectangle(i,i);let l=V.areaToGridArea(a,r),c=JSON.stringify({targetGridArea:l,collidableWithGroup:s}),p=n.vectorFieldCache.get(c);if(!p){let g=this.ƀix.getAvilabilityGrid(n,r,s);p=new pe(l,g),n.vectorFieldCache.set(c,p);}let d=V.positionToGridPosition(e,r);return p.getDirectionToTarget(d)}};te=mn([u(),yn("design:paramtypes",[Tt])],te);var wn=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},xn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},at=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀae=t,this.ƀiq=e;}printPathfindingTestGrid(t,e,i,s,r,n){let a=S.getInstanceByIDOrFail(t);this.ƀae.getAvilabilityGrid(a,n,s).map((c,p)=>({position:V.gridPositionToPosition(p,n),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(r)){let p=this.ƀiq.findPathDirection(t,c.position,i,s),d;p===void 0?d=A.createRectangleBorders(new helpersLib.Vector(8,8),2,helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):d=A.createArrow(25,c.availability?helpersLib.ColorHelper.green:helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).setRotation(p).attach(a),new O(d,"alpha",{duration:1e3,animation:b.easeIn}).animate({alpha:0}).tap(()=>d.destroy()).attach(d);}});}createExplosionDebugVisual(t,e,i,s,r,n=300){let a=new f().displayParent(e).setAlpha(.5).attach(t);A.createCircle(r,helpersLib.ColorHelper.blue).toSprite().displayParent(a).setPosition(s,{round:false}).setAlpha(.5).attach(t),i.forEach(c=>{let p=c.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;A.createVector(s,c.line.to,p).toSprite().displayParent(a).attach(t);}),new O(a,"alpha",{duration:n,animation:b.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,s,r,n,a=300){let l=new f().displayParent(e).setAlpha(.5).attach(t);A.createElipse(n,helpersLib.ColorHelper.blue).toSprite().displayParent(l).setPosition(s,{round:false}).setRotation(r).setAlpha(.5).attach(t),i.forEach(p=>{let d=p.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;A.createVector(p.line.from,p.line.to,d).toSprite().displayParent(l).attach(t);}),new O(l,"alpha",{duration:a,animation:b.easeIn}).animate({alpha:0}).tap(()=>l.destroy()).attach(l);}createPhysicsEntityShapeVisual(t,e,i){let s=i?.overridePosition??y.arrayToVector(t.position),r=i?.overrideRotation??new helpersLib.Radian(t.angle),n=i?.color??helpersLib.ColorHelper.blue,a=new f().displayParent(e).setPosition(s,{round:false}).setRotation(r).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀde(c,n).displayParent(a).attachToRoot();}),new O(a,"alpha",{duration:1e3,animation:b.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀde(t,e){switch(t.type){case K__default.default.Shape.PARTICLE:throw new Error("Not implemented");case K__default.default.Shape.LINE:throw new Error("Not implemented");case K__default.default.Shape.PLANE:throw new Error("Not implemented");case K__default.default.Shape.CIRCLE:throw new Error("Not implemented");case K__default.default.Shape.CAPSULE:throw new Error("Not implemented");case K__default.default.Shape.BOX:throw new Error("Not implemented");case K__default.default.Shape.HEIGHTFIELD:throw new Error("Not implemented");case K__default.default.Shape.CONVEX:return this.ƀdd(t,e);default:{t.type;throw new Error}}}ƀdd(t,e){let i=[t.vertices.map(s=>({x:s[0],y:s[1]}))];return A.createPolygon(i,e).toSprite()}};at=wn([u(),xn("design:paramtypes",[Tt,te])],at);var Pn=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Sn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},ii=class{static{h(this,"HitTestService");}constructor(t){this.ƀmn=t;}hitTest(t,e){let i=t.world,s=T.getFromP2BodyIDOrFail(t.id),r=y.cloneP2Body(t);this.ƀw(r,e);let n=i.broadphase.aabbQuery(i,this.ƀed(r)).map(l=>T.getFromP2BodyIDOrFail(l.id)).filter(l=>l.includeInPathfinding).filter(l=>s.canCollideWith(l)).map(l=>y.cloneP2Body(l.p2Body)),a=false;if(n.length!==0){let l=new K__default.default.World;l.addBody(r),n.forEach(c=>l.addBody(c)),l.step(1,1,1),a=l.narrowphase.contactEquations.some(c=>c.bodyA===r||c.bodyB===r),l.clear();}if(e?.testLayerID){let l=a?helpersLib.ColorHelper.red:helpersLib.ColorHelper.green;this.ƀmn.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀw(t,e){e?.overridePosition&&(t.position=y.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀed(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};ii=Pn([u(),Sn("design:paramtypes",[at])],ii);var Rn=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ri=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀkb(t,i);});});}step(t,e,i){T.getPhysicsEntities().forEach(s=>{s.ƀbh=[];}),t.p2World.narrowphase.contactEquations.forEach(s=>{this.ƀkb(t,s);}),t.bodiesInContactWith.forEach((s,r)=>{this.ƀfm(s.p2Body),s.entity.ƀku(t.collisionReports.get(r)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀfm(t){let e=y.arrayToVector(t.velocity);e.length>ji&&(e=e.normalize(ji),t.velocity=y.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-Ui),Ui);}ƀkb(t,e){let i=T.getFromP2BodyID(e.bodyA.id),s=T.getFromP2BodyID(e.bodyB.id);if(i&&s){t.bodiesInContactWith.set(e.bodyA.id,{p2Body:e.bodyA,entity:i}),t.bodiesInContactWith.set(e.bodyB.id,{p2Body:e.bodyB,entity:s});let r=t.collisionReports.get(e.bodyA.id)||[],n=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀei(i,s,e);r.push({self:a,target:l}),n.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,r),t.collisionReports.set(e.bodyB.id,n);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀei(t,e,i){let s=t.convertToDTO(),r=e.convertToDTO(),n=y.arrayToVector(i.contactPointA),a=y.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀew(i);return {collisionDetailsA:this.ƀeh(s,i.bodyA.mass,n,l,t.area),collisionDetailsB:this.ƀeh(r,i.bodyB.mass,a,c,e.area)}}ƀeh(t,e,i,s,r){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:r,normal:s}}ƀew(t){let e=y.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};ri=Rn([u()],ri);var En=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Cn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},si=class extends Re{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};si=En([Ot(),Cn("design:paramtypes",[Number,Object])],si);var In=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},X=1e4,oi=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀca(t,new helpersLib.Vector(e.x/2,-X/2),new helpersLib.Vector(e.x+X*2,X),i),this.ƀca(t,new helpersLib.Vector(e.x/2,e.y+X/2),new helpersLib.Vector(e.x+X*2,X),i),this.ƀca(t,new helpersLib.Vector(-X/2,e.y/2),new helpersLib.Vector(X,e.y+X*2),i),this.ƀca(t,new helpersLib.Vector(e.x+X/2,e.y/2),new helpersLib.Vector(X,e.y+X*2),i);}ƀca(t,e,i,s){return new si(t,{shapeDefinition:{materialName:Pt,group:s,shapeType:exports.PhysicsShapeType.Rectangle,shapeData:i},position:e,rotation:helpersLib.Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};oi=In([u()],oi);var On=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Gr=new K__default.default.Material,Mn={id:Pt,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},ee=class{static{h(this,"MaterialsService");}createMaterials(t,e,i,s){let r=new Map,n=new Map;if(i.forEach(a=>{r.set(a.id,new K__default.default.Material),n.set(a.id,a);}),r.has(Pt))throw new Error(`Material with name ${Pt} cannot be defined, pick another name for the material.`);return r.set(Pt,Gr),n.set(Pt,Mn),this.ƀc(t,e,i,s,r),{materials:r,materialDefinitions:n}}getMaterial(t,e){let i=S.getInstanceByIDOrFail(t);return this.ƀev(e,i.materials)}getMaterialDefinition(t,e){let i=S.getInstanceByIDOrFail(t);return this.ƀeu(e,i.materialDefinitions)}ƀev(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀeu(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,s,r){this.ƀen(i.map(n=>n.id),s).forEach(n=>{let a=this.ƀev(n.materialA,r),l=this.ƀev(n.materialB,r);t.addContactMaterial(new K__default.default.ContactMaterial(a,l,{friction:n.friction,restitution:n.bounciness,stiffness:n.stiffness,relaxation:n.relaxation}));}),this.ƀd(t,e,i,r);}ƀen(t,e){let i=new Map;e.forEach(r=>{let n=i.get(r.materialA);n||(n=new Map,i.set(r.materialA,n)),n.set(r.materialB,r);});let s=[];return t.forEach((r,n)=>{for(let a=n;a<t.length;a++){let l=t[a],c=i.get(r)?.get(l);c?s.push(c):s.push({materialA:r,materialB:l,friction:0,bounciness:0,relaxation:4,stiffness:1e6});}}),s}ƀd(t,e,i,s){i.forEach(r=>{let n=this.ƀev(r.id,s);t.addContactMaterial(new K__default.default.ContactMaterial(n,Gr,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};ee=On([u()],ee);var Dn=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Bn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},ie=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,s,r){this.ƀhk=t,this.ƀao=e,this.ƀae=i,this.ƀbi=s,this.ƀiy=r;}createPhysicsWorld(t){let e=new K__default.default.World({gravity:[0,0]}),{materials:i,materialDefinitions:s}=this.ƀhk.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:r,physicsBodyGroupToP2Mask:n}=this.ƀiy.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new S(t.mapSize,t.modifyUpdateCycle,e,i,s,r,n).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&w.cleanUpdateModifier();}).attachToRoot(),this.ƀao.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀbi.registerPhysicsWorld(a),t.modifyUpdateCycle?w.registerUpdateModifier((l,c)=>this.ƀlz(a,l,c)):w.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀlz(a,l,c);}).attach(a),a.id}addBody(t,e,i,s,r){let n=S.getInstanceByIDOrFail(t);if(i){let a=this.ƀae.findClosestAvailableSpace(n,e,s);return a?(e.position[0]+=a.x,e.position[1]+=a.y,n.p2World.addBody(e),r&&this.ƀae.onBodyAdded(n,e,s),true):false}else return n.p2World.addBody(e),r&&this.ƀae.onBodyAdded(n,e,s),true}removeBody(t,e){S.getInstanceByID(t)?.p2World.removeBody(e);}ƀlz(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 s=e+i;this.ƀbi.step(t,s,i),t.onPhysicsStep.trigger({time:s,delta:i}),t.lastP2Time.value=t.p2World.time;}return i}setPaused(t,e){S.getInstanceByIDOrFail(e).paused.set(t);}};ie=Dn([u(),Bn("design:paramtypes",[ee,oi,Tt,ri,ot])],ie);var Vn=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},se=class{static{h(this,"RayCastingService");}castClosest(t,e,i){let s=new K__default.default.RaycastResult,r=new K__default.default.Ray({mode:K__default.default.Ray.CLOSEST,from:y.vectorToArray(e.from),to:y.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i)});if(t.p2World.raycast(s,r),s.hasHit())return this.ƀbv(s,e)}castAllFirstContacts(t,e,i){let s=new Map,r=new K__default.default.Ray({mode:K__default.default.Ray.ALL,from:y.vectorToArray(e.from),to:y.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i),callback:h(n=>{let a=s.get(n.body);!s.has(n.body)||n.fraction<a.fraction?s.set(n.body,this.ƀbv(n,e)):n.fraction===a.fraction&&a.isExternal()&&s.set(n.body,this.ƀbv(n,e));},"callback")});return t.p2World.raycast(new K__default.default.RaycastResult,r),Array.from(s.values())}ƀbv(t,e){let i=t.fraction,s=y.arrayToVector(t.normal),r,n,a;return {body:t.body,hitPosition:h(()=>(r===void 0&&(r=e.from.lerp(e.to,i)),r),"hitPosition"),hitDistance:h(()=>(n===void 0&&(n=e.length*i),n),"hitDistance"),isExternal:h(()=>(a===void 0&&(a=e.fromTo.dotProduct(s)<0),a),"isExternal"),normal:s,fraction:i,line:e}}};se=Vn([u()],se);var Nn=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Ct=class{static{h(this,"ImpactService");}applyImpulse(t,e,i,s){let r=i.normalize(s),n=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(y.vectorToArray(r),n);}};Ct=Nn([u()],Ct);var Fn=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},oe=class{static{h(this,"RayCastHitConverterService");}toExplosionHits(t,e=true){let i=new Map;return t.forEach(s=>{s.hits.forEach(r=>{let n=i.get(r.body);if(n){let a=r.fraction<n.closestRaycastHit.fraction?r:n.closestRaycastHit;n.rayCastHits.push(r),i.set(r.body,{hitCount:n.hitCount+1,closestRaycastHit:a,rayCastHits:n.rayCastHits,isExternal:e?n.isExternal:n.isExternal&&r.isExternal(),explosionCenter:r.line.from});}else {let a=r.isExternal();i.set(r.body,{hitCount:1,closestRaycastHit:r,rayCastHits:[r],isExternal:a,explosionCenter:r.line.from});}});}),[...i.values()].map(s=>this.ƀbw(s,t.length))}ƀbw(t,e){let i=t.hitCount/e,s=t.rayCastHits;if(t.isExternal)return {body:T.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:true,normal:t.closestRaycastHit.normal,fraction:t.closestRaycastHit.fraction,ratioOfHits:i,raycastResults:s,getHitPosition:t.closestRaycastHit.hitPosition,getHitDistance:t.closestRaycastHit.hitDistance};{let r=y.arrayToVector(t.closestRaycastHit.body.position);return {body:T.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:false,normal:helpersLib.Vector.fromTo(r,t.explosionCenter).normalize(),fraction:0,ratioOfHits:i,raycastResults:s,getHitPosition:h(()=>t.explosionCenter,"getHitPosition"),getHitDistance:h(()=>0,"getHitDistance")}}}};oe=Fn([u()],oe);var _n=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Hn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Wn=15,ai=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,s){this.ƀjv=t,this.ƀmn=e,this.ƀju=i,this.ƀga=s;}createElipticExplosion(t,e,i,s,r,n,a){let l=S.getInstanceByIDOrFail(t),c=this.ƀcm(e,i,s,r,a?.hitOnlyClosest===true,l),p=this.ƀju.toExplosionHits(c,false);return this.ƀu(p,n),a?.testLayerID&&this.ƀmn.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,s,a.debugRayDuration),p.map(d=>{let{p2Body:g,...v}=d;return v})}ƀcm(t,e,i,s,r,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 d=l.normalize(i.y);a.push(new helpersLib.Line(t,t.add(d))),a.push(new helpersLib.Line(t,t.add(d.multiplyNumber(-1))));let g=Math.round(i.y/Wn),v=i.y/(g*2+1)*2,x=l.normalize(v),M=i.x,_=Math.pow(i.y,2);return helpersLib.ArrayHelper.createIntegerArray(g).forEach(C=>{let Z=v*(C+1),Lt=x.multiplyNumber(C+1),$=c.normalize(this.ƀfe(M,_,Z)),H=t.add(Lt);a.push(new helpersLib.Line(H,H.add($))),a.push(new helpersLib.Line(H,H.add($.multiplyNumber(-1))));let j=t.add(Lt.multiplyNumber(-1));a.push(new helpersLib.Line(j,j.add($))),a.push(new helpersLib.Line(j,j.add($.multiplyNumber(-1))));}),a.map(C=>{if(r){let Z=this.ƀjv.castClosest(n,C,s);return {line:C,hits:Z?[Z]:[]}}else {let Z=this.ƀjv.castAllFirstContacts(n,C,s);return {line:C,hits:Z}}})}ƀfe(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀu(t,e){t.forEach(i=>{i.raycastResults.forEach(s=>{let r,n;s.isExternal()?(r=s.line.fromTo,n=e*2):(r=s.line.fromTo.multiplyNumber(-1),n=e*(1-s.fraction)*8),this.ƀga.applyImpulse(s.body,s.hitPosition(),r,n);});});}};ai=_n([u(),Hn("design:paramtypes",[se,at,oe,Ct])],ai);var $n=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},kn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},hi=class{static{h(this,"ExplosionService");}constructor(t,e,i,s){this.ƀjv=t,this.ƀmn=e,this.ƀju=i,this.ƀga=s;}createExplosion(t,e,i,s,r,n){let a=S.getInstanceByIDOrFail(t),l=this.ƀfc(i),c=this.ƀcm(e,i,s,l,n?.hitOnlyClosest===true,a),p=this.ƀju.toExplosionHits(c);return this.ƀu(e,i,r,l,p),n?.testLayerID&&this.ƀmn.createExplosionDebugVisual(a,n.testLayerID,c,e,i,n.debugRayDuration),p}ƀcm(t,e,i,s,r,n){let a=new helpersLib.Radian(helpersLib.PI_360/s),l=new helpersLib.Vector(0,-e),c=a.vector;return helpersLib.ArrayHelper.createEmptyArray(s).map(()=>{let p=t.add(l);return l=l.rotate(c),new helpersLib.Line(t,p)}).map(p=>{if(r){let d=this.ƀjv.castClosest(n,p,i);return {line:p,hits:d?[d]:[]}}else {let d=this.ƀjv.castAllFirstContacts(n,p,i);return {line:p,hits:d}}})}ƀu(t,e,i,s,r){r.forEach(n=>{if(n.isExternal)n.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀga.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=helpersLib.Vector.fromTo(t,y.arrayToVector(n.p2Body.position)),l=a.length/e,c=i*s*l/2;this.ƀga.applyImpulse(n.p2Body,n.getHitPosition(),a,c);}});}ƀfc(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};hi=$n([u(),kn("design:paramtypes",[se,at,oe,Ct])],hi);var Kn=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ne=class{static{h(this,"PhysicsQueryService");}getMapSize(t){let e=S.getInstanceByIDOrFail(t);return {dimentions:e.mapSize,center:e.mapSizeCenter}}subscribeToPhysicsStep(t,e){return S.getInstanceByIDOrFail(t).onPhysicsStep.subscribe(e)}};ne=Kn([u()],ne);var Zn=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Qn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},zi=class{static{h(this,"PhysicsController");}constructor(t,e,i,s,r,n,a,l){this.ƀjf=t,this.ƀiq=e,this.ƀmn=i,this.ƀdq=s,this.ƀdi=r,this.ƀfs=n,this.ƀje=a,this.ƀga=l;}createPhysicsWorld(t){return this.ƀjf.createPhysicsWorld(t)}getMapSize(t){return this.ƀje.getMapSize(t)}setPaused(t,e){this.ƀjf.setPaused(t,e);}hitTest(t,e){let i=T.getPhysicsInstanceOrFail(t);return this.ƀfs.hitTest(i.p2Body,e)}findPath(t,e,i,s,r){return this.ƀiq.findPathAStar(t,e,i,s,{neighborType:r})}findPathDirection(t,e,i,s){return this.ƀiq.findPathDirection(t,e,i,s)}applyImpulse(t,e,i,s){let r=T.getPhysicsInstanceOrFail(t);this.ƀga.applyImpulse(r.p2Body,e,i,s);}createExplosion(t,e,i,s,r,n){return this.ƀdq.createExplosion(t,e,i,s,r,n)}createElipticExplosion(t,e,i,s,r,n,a){return this.ƀdi.createElipticExplosion(t,e,i,s,r,n,a)}printPathfindingTestGrid(t,e,i,s,r,n=50){this.ƀmn.printPathfindingTestGrid(t,e,i,s,r,n);}};zi=Zn([ct(exports.PhysicsGateway),Qn("design:paramtypes",[ie,te,at,hi,ai,ii,ne,Ct])],zi);var qn=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},li=class{static{h(this,"ShapeCreationService");}createBody(t,e,i,s,r){let n=S.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.ƀcc(n,void 0,i,s,e.shapeDefinition.group,r);case exports.PhysicsShapeType.Circle:return this.ƀcc(n,e.shapeDefinition.shapeData,i,s,e.shapeDefinition.group,r);case exports.PhysicsShapeType.Polygon:return this.ƀcl(n,e.shapeDefinition.shapeData,i,s,e.shapeDefinition.group,r);case exports.PhysicsShapeType.Rectangle:return this.ƀcn(n,e.shapeDefinition.shapeData,i,s,e.shapeDefinition.group,r);default:{e.shapeDefinition.shapeType;throw new Error}}}ƀcc(t,e,i,s,r,n){let a=new K__default.default.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(r),collisionMask:t.physicsBodyGroupToP2Mask.get(r),radius:e});a.material=i;let l=new K__default.default.Body({type:n==="dynamic"?K__default.default.Body.DYNAMIC:K__default.default.Body.STATIC,mass:s.density,damping:s.velocityDrag,angularDamping:s.rotationalDrag});return l.addShape(a),l}ƀcl(t,e,i,s,r,n){let a=t.physicsBodyGroupToP2Group.get(r),l=t.physicsBodyGroupToP2Mask.get(r),c=e.map(g=>new K__default.default.Convex({vertices:g.map(v=>[v.x,v.y]),collisionGroup:a,collisionMask:l})).map(g=>(g.material=i,g)),p=c.reduce((g,v)=>g+v.area,0),d=new K__default.default.Body({type:n==="dynamic"?K__default.default.Body.DYNAMIC:K__default.default.Body.STATIC,mass:p,damping:s.velocityDrag,angularDamping:s.rotationalDrag});return c.forEach(g=>d.addShape(g)),d.setDensity(s.density),d}ƀcn(t,e,i,s,r,n){let a=new K__default.default.Box({width:e.x,height:e.y,collisionGroup:t.physicsBodyGroupToP2Group.get(r),collisionMask:t.physicsBodyGroupToP2Mask.get(r)});a.material=i;let l=e.x*e.y,c=new K__default.default.Body({type:n==="dynamic"?K__default.default.Body.DYNAMIC:K__default.default.Body.STATIC,mass:l,damping:s.velocityDrag,angularDamping:s.rotationalDrag});return c.addShape(a),c.setDensity(s.density),c}};li=qn([u()],li);var ta=function(o,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(r=(s<3?n(r):s>3?n(t,e,r):n(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ea=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ji=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,s,r){this.ƀjf=t,this.ƀjd=e,this.ƀlf=i,this.ƀje=s,this.ƀiy=r;}createBody(t,e,i,s,r){return this.ƀlf.createBody(t,e,i,s,r)}getMaterial(t,e){return this.ƀjd.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀjd.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀiy.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀiy.getMaskConstant(t,e)}addBody(t,e,i,s,r){return this.ƀjf.addBody(t,e,i,s,r)}removeBody(t,e){this.ƀjf.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀje.subscribeToPhysicsStep(t,e)}};Ji=ta([ct(St),ea("design:paramtypes",[ie,ee,li,ne,ot])],Ji);exports.AdvancedSound=bt;exports.AnimationFlicker=Ki;exports.AnimationInterpolationFunctions=U;exports.Animations=b;exports.Animator=O;exports.BORDER_MATERIAL_NAME=Pt;exports.BardLegendsTestingHelper=P;exports.Camera=ue;exports.ClosestAvailableSpaceHelper=le;exports.Container=f;exports.ControllerDecorator=ct;exports.DEFAULT_SHADER_RESOLUTION=k;exports.DeltaTime=wi;exports.DisplayObjectArray=Ai;exports.ElectronGame=xr;exports.Entity=q;exports.EntityDecorator=Ot;exports.FadeInContent=or;exports.Game=m;exports.Gateway=lt;exports.Graphics=A;exports.ImmovablePhysicsEntity=Re;exports.LayoutContainer=Gi;exports.MenuEntity=Mi;exports.MenuUI=ve;exports.MenuView=Di;exports.MovableEntity=$i;exports.MovablePhysicsEntity=ki;exports.Music=de;exports.MusicPlayer=Pi;exports.Particle=ge;exports.ParticleContainer=Ri;exports.ParticleFilters=ye;exports.PathFinder=ce;exports.PhysicsEntity=T;exports.Placeholder=Ei;exports.ROTATIONAL_SPEED_LIMIT=Ui;exports.RichText=Ci;exports.SOUND_TRANSITION_DURATION=st;exports.SPEED_LIMIT=ji;exports.Scene=_t;exports.SceneDecorator=Yr;exports.ScrollAreaUI=Bi;exports.ScrollMaskUI=Bt;exports.Service=R;exports.ServiceDecorator=u;exports.SingletonEntity=mt;exports.SlideInContent=cr;exports.SlideInContentByIndex=gi;exports.SlideStateAnimation=Ne;exports.Sound=fe;exports.Sprite=it;exports.StateAnimation=kt;exports.Text=xe;exports.ThroughEmptyStateAnimation=Ae;exports.UpdatableContainer=Ii;exports.UpdateCycle=w;exports.VectorFieldPathFinder=pe;exports.VectorSet=he;exports.View=Q;exports.ViewDecorator=pi;