bard-legends-framework 1.1.4 → 1.1.5

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');require('reflect-metadata');var helpersLib=require('helpers-lib'),U=require('p2'),V=require('pixi.js'),scriptEngineLib=require('script-engine-lib');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 U__default=/*#__PURE__*/_interopDefault(U);var V__namespace=/*#__PURE__*/_interopNamespace(V);var hr=Object.defineProperty;var h=(o,t)=>hr(o,"name",{value:t,configurable:true});var G=class{static{h(this,"BardLegendsHardReset");}static{this.ƀes=new actionsLib.Action;}static{this.onHardReset=this.ƀes.notifier;}static hardReset(){actionsLib.ActionLib.hardReset(),this.ƀes.trigger();}};function d(){return function(o){let t=P.ƀec(o);o.$meta={paramtypes:t,type:"service"};}}h(d,"ServiceDecorator");var P=class{static{h(this,"Service");}static{this.ƀit=new Map;}static get(t){let e=this.ƀit.get(t);if(!e){if(!t.$meta)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let i=this.ƀif([],t.$meta.paramtypes);e=new t(...i),this.ƀit.set(t,e);}return e}static ƀec(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e}static ƀif(t,e){let i=[...t];if(e.length>t.length){let s=e.slice(t.length).map(n=>{if(n&&n.$meta?.type==="service")return this.get(n)});i.push(...s);}return i}};G.onHardReset.subscribe(()=>{P.ƀit=new Map;}).attachToRoot();var $=class{static{h(this,"ControllerLink");}constructor(){this.ƀbm=[],this.ƀid=[];}trigger(t,...e){let i=this.ƀbm.find(r=>!!r[t]);if(i)return i[t](...e);throw new Error(`ServiceLink: no defined function with the name: "${t}", found in the linked controllers!`)}registerController(t){Reflect.ownKeys(t.constructor.prototype).filter(e=>e!=="constructor").map(e=>e.toString()).forEach(e=>{if(this.ƀid.includes(e))throw new Error(`ServiceLink: the function is already registered, function name: "${e}"`);this.ƀid.push(e);}),this.ƀbm.push(t);}};function q(o){return function(t){let e=P.ƀec(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=P.ƀif([],e);i.some(s=>s===void 0)&&console.error(i,e,t.name);let r=new t(...i);o.controllerLink.registerController(r);}t.$meta={type:"controller"};}}h(q,"ControllerDecorator");var y=class o{static{h(this,"UpdateCycle");}static{this.ƀad=new actionsLib.Action;}static{this.beforeSceneUpdateAction=this.ƀad.notifier;}static{this.ƀil=new actionsLib.Action;}static{this.sceneUpdateAction=this.ƀil.notifier;}static{this.ƀf=new actionsLib.Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀjx=0;}static{this.ƀkf=void 0;}static wait(t){let e=this.ƀjx+t;return actionsLib.SingleEvent.create(i=>{let r=o.beforeSceneUpdateAction.subscribe(s=>{s.time>=e&&i();}).attachToRoot();return ()=>r.destroy()})}static registerUpdateModifier(t){if(!this.ƀkf)this.ƀkf=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀkf=void 0;}static triggerUpdateTick(t){this.ƀkf&&(t=this.ƀkf(this.ƀjx,t)),this.ƀjx+=t,this.ƀfr=t,t>0&&(o.ƀad.trigger({time:this.ƀjx,delta:t}),o.ƀil.trigger({time:this.ƀjx,delta:t}),o.ƀf.trigger({time:this.ƀjx,delta:t}));}static get lastDelta(){return this.ƀfr}static{this.ƀfr=0;}};G.onHardReset.subscribe(()=>{y.ƀad.clear(),y.ƀil.clear(),y.ƀf.clear(),y.ƀkf=void 0,y.ƀjx=0;}).attachToRoot();var _=class o{static{h(this,"EntityStoreHelper");}static{this.ƀaw=new Map;}static registerEntityClass(t){this.ƀaw.set(t.id,new Map);}static registerEntity(t){this.ƀaw.get(t.classID).set(t.id,t);}static unregisterEntity(t,e){let i=t.id;this.ƀaw.get(i)?.delete(e);}static getEntity(t,e){return this.ƀaw.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.ƀaw.get(t.id);return Array.from(e.values())}};G.onHardReset.subscribe(()=>{_.ƀaw.clear();}).attachToRoot();var rt=class o{static{h(this,"EntityViewsHelper");}static{this.ƀko=new Map;}static registerView(t,e){o.ƀko.has(e)||o.ƀko.set(e,[]);let i=o.ƀko.get(e);i&&i.push(t),_.getEntities(e).forEach(s=>{this.ƀch(s,t);});}static ƀch(t,e){try{let i=P.ƀif([this],e.$meta.paramtypes);o.entityID=t.id;let r=new e(t,...i.slice(1));t.destroyed?r.destroy():t.ƀkn.ƀkp.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀcw=t,this.ƀkp=[];}createViews(){if(!this.ƀcw.destroyed){let t=o.ƀko.get(this.ƀcw.constructor);t&&t.forEach(e=>{o.ƀch(this.ƀcw,e);});}}updateViews(t,e){for(let i=0;i<this.ƀkp.length;i++){let r=this.ƀkp[i];r.destroyed||r.update(t,e);}}destroyViews(){this.ƀkp.forEach(t=>{t.destroy();});}};G.onHardReset.subscribe(()=>{rt.ƀko=new Map;}).attachToRoot();function dt(){return function(o){o.$meta={type:"entity"},_.registerEntityClass(o);}}h(dt,"EntityDecorator");var z=class extends actionsLib.IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return _.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=_.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return _.getEntities(this)}constructor(){super(),this.ƀkn=new rt(this),_.registerEntity(this),y.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.update(t.time,t.delta),this.ƀkn.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀkn.destroyViews(),_.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀkn.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀkn.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀkn.createViews(),this}update(t,e){}};var ut=class extends z{static{h(this,"SingletonEntity");}static getInstance(){return _.getSingleton(this)}static getInstanceOrFail(){return _.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}"`)}};function gr(){return function(o){return o.$meta={paramtypes:P.ƀec(o),type:"scene"},o}}h(gr,"SceneDecorator");var St=class o extends actionsLib.IDAttachable{static{h(this,"Scene");}static{this.ƀik=false;}static{this.ƀb=new actionsLib.Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveScene(){return o.ƀb.value}static getActiveSceneOrFail(){if(!o.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return o.ƀb.value}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.ƀik)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(o.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=t[0];o.ƀik=true;let i=P.ƀif([],this.$meta.paramtypes),r=new this(...i).attachToRoot();return o.ƀb.set(r),r.init(e).map(()=>(o.ƀik=false,r)).chainToRoot()}constructor(){super(),this.ƀgn=new actionsLib.Action,this.onClose=this.ƀgn.notifier,y.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(o.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(o.ƀik)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");o.ƀik=true;let e=t[0];return this.prepareToClose().map(()=>(super.destroy(),o.ƀb.set(void 0),o.ƀik=false,this.ƀgn.trigger(e),e)).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};G.onHardReset.subscribe(()=>{St.ƀb.set(void 0);}).attachToRoot();function Ye(o){return function(t){t.$meta={paramtypes:P.ƀec(t),viewInstances:new Map,entity:o.entity,type:"view"},rt.registerView(t,o.entity);}}h(Ye,"ViewDecorator");var Wt=class extends actionsLib.IDAttachable{static{h(this,"View");}static getInstance(t){return this.$meta.entity.validateID(t)?this.$meta.viewInstances.get(t):void 0}static getInstanceOrFail(t){if(!this.$meta.entity.validateID(t))throw new Error(`View: getInstance is called with entity id: "${t}", that is not belonging to the class: "${this.$meta.entity}"`);let i=this.$meta.viewInstances.get(t);if(!i)throw new Error(`View: getInstanceOrFail is called with entity id: "${t}", that is not found!`);return i}constructor(){super(),this.attachToRoot(),this.ƀcx=rt.entityID,this.ƀei().set(this.ƀcx,this);}destroy(){this.destroyed||(super.destroy(),this.ƀei().delete(this.ƀcx));}update(t,e){}ƀei(){return this.constructor.$meta.viewInstances}};var f=class o{static{h(this,"P2JSHelper");}static aabbToBoundingBox(t){return helpersLib.Rectangle.fromRect({topLeft:{x:t.lowerBound[0],y:t.lowerBound[1]},bottomRight:{x:t.upperBound[0],y:t.upperBound[1]}})}static arrayToVector(t){return new helpersLib.Vector(t[0],t[1])}static vectorToArray(t){return [t.x,t.y]}static arePhysicsGroupsCollidable(t,e,i,r){return (t&r)!==0&&(i&e)!==0}static canCollideWith(t,e){return t.shapes.some(i=>e.shapes.some(r=>o.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new U__default.default.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var br=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},J=new $,Ct=class{static{h(this,"PhysicsInternalGateway");}createBody(t,e,i,r,s){return J.trigger("createBody",t,e,i,r,s)}getMaterial(t,e){return J.trigger("getMaterial",t,e)}getMaterialDefinition(t,e){return J.trigger("getMaterialDefinition",t,e)}getGroupConstant(t,e){return J.trigger("getGroupConstant",t,e)}getMaskConstant(t,e){return J.trigger("getMaskConstant",t,e)}addBody(t,e,i,r,s){return J.trigger("addBody",t,e,i,r,s)}removeBody(t,e){return J.trigger("removeBody",t,e)}subscribeToPhysicsStep(t,e){return J.trigger("subscribeToPhysicsStep",t,e)}};Ct=br([d()],Ct);var b=class o extends z{static{h(this,"PhysicsEntity");}static{this.ƀhc=new Map;}static{this.ƀhj=new Map;}static getFromP2BodyID(t){return o.ƀhc.get(t)}static getFromP2BodyIDOrFail(t){let e=o.ƀhc.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=o.ƀhj.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(o.ƀhj.values())}get area(){return this.ƀu}get mass(){return this.ƀgd}get collisions(){return this.ƀay}constructor(t,e,i){super(),this.ƀgo=new actionsLib.Action,this.onCollision=this.ƀgo.notifier,this.type="dynamic",this.ƀu=0,this.ƀgd=0,this.ƀay=[],this.physicsWorldID=t,this.ƀhl=P.get(Ct);let r=this.ƀhl.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀhl.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀhk=this.ƀhl.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀhm=this.ƀhl.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀhl.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀu=this.p2Body.getArea(),this.ƀgd=this.p2Body.mass,this.p2Body.position=f.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀhl.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.ƀhc.set(this.p2Body.id,this),o.ƀhj.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀhl.removeBody(this.physicsWorldID,this.p2Body),o.ƀhc.delete(this.p2Body.id),o.ƀhj.delete(this.id));}canCollideWith(t){return f.arePhysicsGroupsCollidable(this.ƀhk,this.ƀhm,t.ƀhk,t.ƀhm)}ƀiu(t){this.ƀay=t,t.length>0&&this.ƀgo.trigger(t);}};var Ut=class extends b{static{h(this,"ImmovablePhysicsEntity");}constructor(t,e){super(t,e,"static"),this.position=f.arrayToVector(this.p2Body.position),this.rotation=new helpersLib.Radian(this.p2Body.angle);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position,rotation:this.rotation,velocity:helpersLib.Vector.zero,rotationalSpeed:0}}};var Xe=class extends z{static{h(this,"MovableEntity");}constructor(){super(),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.rotation=new actionsLib.Variable(helpersLib.Radian.get0),this.velocity=new actionsLib.Variable(helpersLib.Vector.zero),this.rotationalSpeed=new actionsLib.Variable(0),y.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀjm(t,e);}).attach(this);}ƀjm(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 Ke=class extends b{static{h(this,"MovablePhysicsEntity");}constructor(t,e){super(t,e,"dynamic"),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.rotation=new actionsLib.Variable(helpersLib.Radian.get0),this.velocity=new actionsLib.Variable(helpersLib.Vector.zero),this.rotationalSpeed=new actionsLib.Variable(0),this.ƀez=false,this.ƀfa=false,this.ƀfc=false,this.ƀfb=false,this.ƀhg(),this.ƀfx(),P.get(Ct).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀjm(i,r)).attach(this);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position.value,rotation:this.rotation.value,velocity:this.velocity.value,rotationalSpeed:this.rotationalSpeed.value}}ƀjm(t,e){this.ƀez=true,this.ƀfa=true,this.ƀfc=true,this.ƀfb=true,this.ƀhg();}ƀhg(){this.position.value=f.arrayToVector(this.p2Body.position),this.rotation.value=new helpersLib.Radian(this.p2Body.angle),this.velocity.value=f.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀfx(){this.position.subscribe(t=>{this.ƀez?this.ƀez=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfa?this.ƀfa=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfc?this.ƀfc=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfb?this.ƀfb=false:this.p2Body.angularVelocity=t;}).attach(this);}};var Ze=10.8,Qe=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 st="border";var Y=class{static{h(this,"AnimationInterpolationFunctions");}static boomerangTime(t){return 1-Math.abs(t-.5)*2}static lineer(t){return t}static easeIn(t){return Math.pow(t,2)}static easeOut(t){return 1-Math.pow(1-t,2)}static easeInOut(t){return t<.5?2*t*t:(t-=1,1-2*t*t)}static easeInOutCubic(t){let e=2*t-2;return t<.5?4*Math.pow(t,3):(t-1)*Math.pow(e,2)+1}},Tr=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return Y.lineer(t)}},Er=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return Y.easeIn(t)}},Rr=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return Y.easeOut(t)}},Ir=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return Y.easeInOut(t)}},Ar=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return Y.easeInOutCubic(t)}},Ai=class{static{h(this,"AnimationFlicker");}start(){this.ƀjy=new Array(10).fill(0),helpersLib.Random.integerBetween(0,9),this.ƀjy[helpersLib.Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(helpersLib.Random.integerBetween(0,9),this.ƀjy[helpersLib.Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(helpersLib.Random.integerBetween(0,9),this.ƀjy[helpersLib.Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀjy[e]}},S=class{static{h(this,"Animations");}static{this.lineer=new Tr;}static{this.easeIn=new Er;}static{this.easeOut=new Rr;}static{this.easeInOut=new Ir;}static{this.easeInOutCubic=new Ar;}};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 A=class o{static{h(this,"Animator");}static{this.ƀk=new WeakMap;}static ƀdj(t){let e=o.ƀk.get(t);return e||(e=new helpersLib.MapToWeakRefs,o.ƀk.set(t,e)),e}get animating(){return this.ƀgx!==void 0}get target(){return this.ƀjp}get value(){return this.ƀkh||(this.ƀkh=new actionsLib.Variable(this.ƀjp)),this.ƀkh.notifier}constructor(t,e,i){this.ƀfl=false,this.ƀjb=false,this.ƀjp=t,this.ƀha={duration:200,animation:S.lineer,reAnimateHandling:exports.ReAnimateHandlingType.ThrowError,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState,...i},this.ƀl=helpersLib.Comparator.isArray(e)?e:[e],this.ƀfy(t,this.ƀl);}animate(t,e){let i={...this.ƀha,...e};if(this.ƀgx)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();case exports.ReAnimateHandlingType.CompletePrevious:this.ƀiv(i.completionHandling,this.ƀgx.ƀhv,true);break;default:{throw new Error(`Animator: unknown re-animate handling type: "${i.reAnimateHandling}"`)}}return actionsLib.SingleEvent.create(s=>{this.ƀfl&&(this.ƀjb=true);let n=this.ƀl.reduce((c,p)=>(c[p]={ƀjj:this.ƀjp[p],ƀjr:t[p]},c),{}),a={ƀcs:i.duration,ƀct:0,ƀhv:n,ƀbf:i.completionHandling,ƀm:i.animation,ƀbe:s};if(a.ƀbf!==exports.AnimationsCompletionHandlingType.Loop&&this.ƀfj(a)){this.ƀgx=void 0,s();return}else a.ƀm.start();let l=this.ƀgx;return this.ƀgx=a,this.ƀcv(),l?.ƀbe(),()=>{this.ƀgx===a&&(this.ƀjp instanceof actionsLib.Attachable&&this.ƀjp.destroyed||this.ƀiv(a.ƀbf,a.ƀhv,true),this.ƀgx=void 0,this.ƀke?.destroy(),this.ƀke=void 0);}})}set(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r]&&(e=true,this.ƀjp[r]=t[r]);}e&&this.ƀkh?.set(this.ƀjp),this.ƀgx?.ƀbe();}completeAnimation(t){if(this.ƀgx){t=t??this.ƀgx.ƀbf,this.ƀiv(t,this.ƀgx.ƀhv,true);let e=this.ƀgx.ƀbe;this.ƀgx=void 0,e();}}ƀcv(){this.ƀke||(this.ƀke=y.beforeSceneUpdateAction.subscribe(t=>{this.ƀfl=true;try{let e=this.ƀgx;if(!e)return;e.ƀct+=t.delta;let i=e.ƀct>=e.ƀcs;if(i)if(e.ƀbf===exports.AnimationsCompletionHandlingType.Loop)e.ƀct%=e.ƀcs,e.ƀm.start(),i=!1;else {this.ƀiv(e.ƀbf,e.ƀhv,!1),this.ƀgx=void 0,e.ƀbe(),this.ƀgx||(this.ƀke?.destroy(),this.ƀke=void 0);return}if(!i){let r=e.ƀm.multiplierFunction(e.ƀct/e.ƀcs),s=!1;for(let n=0;n<this.ƀl.length;n++){let a=this.ƀl[n],l=e.ƀhv[a],p=(l.ƀjr-l.ƀjj)*r+l.ƀjj;p!==this.ƀjp[a]&&(s=!0,this.ƀjp[a]=p);}s&&this.ƀkh?.set(this.ƀjp);}}finally{this.ƀfl=false,this.ƀjb&&(this.ƀjb=false,this.ƀke?.destroy(),this.ƀke=void 0,this.ƀcv());}}).attachToRoot());}ƀfj(t){for(let e=0;e<this.ƀl.length;e++){let i=this.ƀl[e];if(this.ƀjp[i]!==t.ƀhv[i].ƀjr)return false}return true}ƀiv(t,e,i){switch(t){case exports.AnimationsCompletionHandlingType.ReturnToOriginal:this.ƀih(e);break;case exports.AnimationsCompletionHandlingType.StayInCurrentState:i||this.ƀfo(e);break;case exports.AnimationsCompletionHandlingType.JumpToEnd:this.ƀfo(e);break;case exports.AnimationsCompletionHandlingType.Loop:this.ƀih(e);break;default:{throw new Error(`Animator: unknown completion handling type: "${t}"`)}}}ƀih(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r].ƀjj&&(e=true,this.ƀjp[r]=t[r].ƀjj);}e&&this.ƀkh?.set(this.ƀjp);}ƀfo(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r].ƀjr&&(e=true,this.ƀjp[r]=t[r].ƀjr);}e&&this.ƀkh?.set(this.ƀjp);}ƀfy(t,e){let i=o.ƀdj(t);for(let r of e){if(i.has(r))throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(t,void 0,2)}", Property: "${r}"`);i.set(r,this);}}};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";})(exports.ContainerEventType||(exports.ContainerEventType={}));exports.Cursor=void 0;(function(o){o.Default="default",o.Pointer="pointer";})(exports.Cursor||(exports.Cursor={}));var ue=class extends actionsLib.IDAttachable{static{h(this,"ContainerAttributes");}constructor(){super(),this.ƀgh=false,this.ƀdc=false,this.ƀii=1,this.ƀw=1,this.pixiContainer=new V__namespace.Container;}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new helpersLib.Vector(this.pixiContainer.width,this.pixiContainer.height)}setSize(t){return this.pixiContainer.width=t.x,this.pixiContainer.height=t.y,this}setPosition(t,e){if(e?.holdFrom){let i=this.pixiContainer.getLocalBounds(),r=new helpersLib.Vector(this.pixiContainer.scale.x,this.pixiContainer.scale.y),s=new helpersLib.Vector(i.x,i.y).multiply(r),n=new helpersLib.Vector(i.width,i.height).multiply(r),a=s.add(n.multiply(e.holdFrom));t=t.subtract(a);}return e?.round!==false&&(t=t.round({rollHalfsDown:true})),this.position=t,this}get position(){return new helpersLib.Vector(this.pixiContainer.x,this.pixiContainer.y)}set position(t){this.pixiContainer.position=t;}get x(){return this.pixiContainer.x}set x(t){this.pixiContainer.x=t;}get y(){return this.pixiContainer.y}set y(t){this.pixiContainer.y=t;}on(t){return actionsLib.Sequence.create(e=>{let i=h(r=>e(),"handle");return this.pixiContainer.on(t,i),()=>this.pixiContainer.off(t,i)})}setRotation(t){return this.rotation=t,this}get rotation(){return new helpersLib.Radian(this.pixiContainer.rotation)}set rotation(t){this.pixiContainer.rotation=t.value;}get rotationValue(){return this.rotation.value}set rotationValue(t){this.rotation=new helpersLib.Radian(t);}setZIndex(t){return this.zIndex=t,this}get zIndex(){return this.pixiContainer.zIndex}set zIndex(t){this.pixiContainer.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new helpersLib.Radian(this.pixiContainer.skew.x)}set skewX(t){this.pixiContainer.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new helpersLib.Radian(this.pixiContainer.skew.y)}set skewY(t){this.pixiContainer.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.pixiContainer.sortableChildren}set sortableChildren(t){this.pixiContainer.sortableChildren=t;}setAlpha(t){return this.pixiContainer.alpha=t,this}get alpha(){return this.pixiContainer.alpha}set alpha(t){this.pixiContainer.alpha=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.pixiContainer.interactive}set interactive(t){t?this.pixiContainer.eventMode="dynamic":this.pixiContainer.eventMode="none";}setCursor(t){return this.cursor=t,this}get cursor(){return this.pixiContainer.cursor}set cursor(t){this.pixiContainer.cursor=t;}getMask(){throw new Error("ContainerAttributes: mask is not available!")}setMask(t){return t?(this.pixiContainer.addChild(t.pixiContainer),this.pixiContainer.mask=t.getMask(),this.ƀgb=t):(this.ƀgb&&this.pixiContainer.removeChild(this.ƀgb.pixiContainer),this.pixiContainer.mask=null),this}hitTest(t){if(this.pixiContainer.parent)if(this.pixiContainer.hitArea){let e=this.pixiContainer.toLocal(t);return this.pixiContainer.hitArea.contains(e.x,e.y)}else return this.pixiContainer.getBounds().contains(t.x,t.y);else return false}get boundingBox(){let t=this.pixiContainer.getLocalBounds();return new helpersLib.Rectangle(new helpersLib.Vector(t.x,t.y),new helpersLib.Vector(t.x+t.width,t.y+t.height))}ignoreBounds(t=true){return t?(this.ƀhb||(this.ƀhb=this.pixiContainer.calculateBounds),this.pixiContainer.calculateBounds=()=>this.pixiContainer._bounds.clear()):this.ƀhb&&(this.pixiContainer.calculateBounds=this.ƀhb),this}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀgh}set mirror(t){this.ƀgh=t,this.ƀkg();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdc}set flip(t){this.ƀdc=t,this.ƀkg();}setScale(t){return this.scale=t,this}get scale(){return this.ƀii}set scale(t){this.ƀii=t,this.ƀkg();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀw}set aspectRatio(t){this.ƀw=t,this.ƀkg();}ƀkg(){this.pixiContainer.scale.set(this.ƀii,this.ƀii),this.ƀw<1?this.pixiContainer.scale.x*=this.ƀw:this.ƀw>1&&(this.pixiContainer.scale.y/=this.ƀw),this.ƀgh&&(this.pixiContainer.scale.x*=-1),this.ƀdc&&(this.pixiContainer.scale.y*=-1);}};var O=2;exports.BlendMode=void 0;(function(o){o[o.Normal=0]="Normal",o[o.Add=1]="Add",o[o.Screen=3]="Screen",o[o.Luminosity=16]="Luminosity",o[o.ColorDodge=7]="ColorDodge";})(exports.BlendMode||(exports.BlendMode={}));var fe=class{static{h(this,"GaussianValuesHelper");}static ƀdh(t,e){let i=e*e,r=1/(helpersLib.PI_360*i),s=-(t*t)/(2*i);return r*Math.exp(s)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),r=.005*i,s=helpersLib.NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<r)i-=l*2;else return true}),n=1/i,a=s.map(l=>l*n);return this.ƀbr(a)}static getValuesForLinearSamplingGauss(t){if(t===0)return [{offset:0,multiplier:1}];if(t===1)return [{offset:0,multiplier:.5},{offset:1,multiplier:.25}];{let e=helpersLib.ArrayHelper.createIntegerArray(Math.ceil(t*.75)).map(r=>this.ƀdh(r,t*.4)),i=e.reduce((r,s)=>r+s,0);return i=i*2-e[0],e=e.map(r=>r/i),this.ƀbr(e)}}static ƀbr(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let r=t[i]+t[i+1],s=i+t[i+1]/r;e.push({offset:s,multiplier:r});}if(t.length%2===0){let i=t[t.length-1],r=t.length-1;e.push({offset:r,multiplier:i});}return e}};var Di=class ti extends V__namespace.Filter{static{h(this,"BlurFilterPass");}static ƀeh(){return `
1
+ 'use strict';var actionsLib=require('actions-lib');require('reflect-metadata');var helpersLib=require('helpers-lib'),U=require('p2'),V=require('pixi.js'),scriptEngineLib=require('script-engine-lib');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 U__default=/*#__PURE__*/_interopDefault(U);var V__namespace=/*#__PURE__*/_interopNamespace(V);var hr=Object.defineProperty;var h=(o,t)=>hr(o,"name",{value:t,configurable:true});var G=class{static{h(this,"BardLegendsHardReset");}static{this.ƀes=new actionsLib.Action;}static{this.onHardReset=this.ƀes.notifier;}static hardReset(){actionsLib.ActionLib.hardReset(),this.ƀes.trigger();}};function d(){return function(o){let t=P.ƀec(o);o.$meta={paramtypes:t,type:"service"};}}h(d,"ServiceDecorator");var P=class{static{h(this,"Service");}static{this.ƀit=new Map;}static get(t){let e=this.ƀit.get(t);if(!e){if(!t.$meta)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let i=this.ƀif([],t.$meta.paramtypes);e=new t(...i),this.ƀit.set(t,e);}return e}static ƀec(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e}static ƀif(t,e){let i=[...t];if(e.length>t.length){let s=e.slice(t.length).map(n=>{if(n&&n.$meta?.type==="service")return this.get(n)});i.push(...s);}return i}};G.onHardReset.subscribe(()=>{P.ƀit=new Map;}).attachToRoot();var $=class{static{h(this,"ControllerLink");}constructor(){this.ƀbm=[],this.ƀid=[];}trigger(t,...e){let i=this.ƀbm.find(r=>!!r[t]);if(i)return i[t](...e);throw new Error(`ServiceLink: no defined function with the name: "${t}", found in the linked controllers!`)}registerController(t){Reflect.ownKeys(t.constructor.prototype).filter(e=>e!=="constructor").map(e=>e.toString()).forEach(e=>{if(this.ƀid.includes(e))throw new Error(`ServiceLink: the function is already registered, function name: "${e}"`);this.ƀid.push(e);}),this.ƀbm.push(t);}};function q(o){return function(t){let e=P.ƀec(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=P.ƀif([],e);i.some(s=>s===void 0)&&console.error(i,e,t.name);let r=new t(...i);o.controllerLink.registerController(r);}t.$meta={type:"controller"};}}h(q,"ControllerDecorator");var y=class o{static{h(this,"UpdateCycle");}static{this.ƀad=new actionsLib.Action;}static{this.beforeSceneUpdateAction=this.ƀad.notifier;}static{this.ƀil=new actionsLib.Action;}static{this.sceneUpdateAction=this.ƀil.notifier;}static{this.ƀf=new actionsLib.Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀjx=0;}static{this.ƀkf=void 0;}static wait(t){let e=this.ƀjx+t;return actionsLib.SingleEvent.create(i=>{let r=o.beforeSceneUpdateAction.subscribe(s=>{s.time>=e&&i();}).attachToRoot();return ()=>r.destroy()})}static registerUpdateModifier(t){if(!this.ƀkf)this.ƀkf=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀkf=void 0;}static triggerUpdateTick(t){this.ƀkf&&(t=this.ƀkf(this.ƀjx,t)),this.ƀjx+=t,this.ƀfr=t,t>0&&(o.ƀad.trigger({time:this.ƀjx,delta:t}),o.ƀil.trigger({time:this.ƀjx,delta:t}),o.ƀf.trigger({time:this.ƀjx,delta:t}));}static get lastDelta(){return this.ƀfr}static{this.ƀfr=0;}};G.onHardReset.subscribe(()=>{y.ƀad.clear(),y.ƀil.clear(),y.ƀf.clear(),y.ƀkf=void 0,y.ƀjx=0;}).attachToRoot();var _=class o{static{h(this,"EntityStoreHelper");}static{this.ƀaw=new Map;}static registerEntityClass(t){this.ƀaw.set(t.id,new Map);}static registerEntity(t){this.ƀaw.get(t.classID).set(t.id,t);}static unregisterEntity(t,e){let i=t.id;this.ƀaw.get(i)?.delete(e);}static getEntity(t,e){return this.ƀaw.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.ƀaw.get(t.id);return Array.from(e.values())}};G.onHardReset.subscribe(()=>{_.ƀaw.clear();}).attachToRoot();var rt=class o{static{h(this,"EntityViewsHelper");}static{this.ƀko=new Map;}static registerView(t,e){o.ƀko.has(e)||o.ƀko.set(e,[]);let i=o.ƀko.get(e);i&&i.push(t),_.getEntities(e).forEach(s=>{this.ƀch(s,t);});}static ƀch(t,e){try{let i=P.ƀif([this],e.$meta.paramtypes);o.entityID=t.id;let r=new e(t,...i.slice(1));t.destroyed?r.destroy():t.ƀkn.ƀkp.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀcw=t,this.ƀkp=[];}createViews(){if(!this.ƀcw.destroyed){let t=o.ƀko.get(this.ƀcw.constructor);t&&t.forEach(e=>{o.ƀch(this.ƀcw,e);});}}updateViews(t,e){for(let i=0;i<this.ƀkp.length;i++){let r=this.ƀkp[i];r.destroyed||r.update(t,e);}}destroyViews(){this.ƀkp.forEach(t=>{t.destroy();});}};G.onHardReset.subscribe(()=>{rt.ƀko=new Map;}).attachToRoot();function dt(){return function(o){o.$meta={type:"entity"},_.registerEntityClass(o);}}h(dt,"EntityDecorator");var z=class extends actionsLib.IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return _.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=_.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return _.getEntities(this)}constructor(){super(),this.ƀkn=new rt(this),_.registerEntity(this),y.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.update(t.time,t.delta),this.ƀkn.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀkn.destroyViews(),_.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀkn.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀkn.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀkn.createViews(),this}update(t,e){}};var ut=class extends z{static{h(this,"SingletonEntity");}static getInstance(){return _.getSingleton(this)}static getInstanceOrFail(){return _.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}"`)}};function gr(){return function(o){return o.$meta={paramtypes:P.ƀec(o),type:"scene"},o}}h(gr,"SceneDecorator");var St=class o extends actionsLib.IDAttachable{static{h(this,"Scene");}static{this.ƀik=false;}static{this.ƀb=new actionsLib.Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveScene(){return o.ƀb.value}static getActiveSceneOrFail(){if(!o.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return o.ƀb.value}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.ƀik)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(o.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=t[0];o.ƀik=true;let i=P.ƀif([],this.$meta.paramtypes),r=new this(...i).attachToRoot();return o.ƀb.set(r),r.init(e).map(()=>(o.ƀik=false,r)).chainToRoot()}constructor(){super(),this.ƀgn=new actionsLib.Action,this.onClose=this.ƀgn.notifier,y.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(o.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(o.ƀik)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");o.ƀik=true;let e=t[0];return this.prepareToClose().map(()=>(super.destroy(),o.ƀb.set(void 0),o.ƀik=false,this.ƀgn.trigger(e),e)).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};G.onHardReset.subscribe(()=>{St.ƀb.set(void 0);}).attachToRoot();function Ye(o){return function(t){t.$meta={paramtypes:P.ƀec(t),viewInstances:new Map,entity:o.entity,type:"view"},rt.registerView(t,o.entity);}}h(Ye,"ViewDecorator");var Wt=class extends actionsLib.IDAttachable{static{h(this,"View");}static getInstance(t){return this.$meta.entity.validateID(t)?this.$meta.viewInstances.get(t):void 0}static getInstanceOrFail(t){if(!this.$meta.entity.validateID(t))throw new Error(`View: getInstance is called with entity id: "${t}", that is not belonging to the class: "${this.$meta.entity}"`);let i=this.$meta.viewInstances.get(t);if(!i)throw new Error(`View: getInstanceOrFail is called with entity id: "${t}", that is not found!`);return i}constructor(){super(),this.attachToRoot(),this.ƀcx=rt.entityID,this.ƀei().set(this.ƀcx,this);}destroy(){this.destroyed||(super.destroy(),this.ƀei().delete(this.ƀcx));}update(t,e){}ƀei(){return this.constructor.$meta.viewInstances}};var f=class o{static{h(this,"P2JSHelper");}static aabbToBoundingBox(t){return helpersLib.Rectangle.fromRect({topLeft:{x:t.lowerBound[0],y:t.lowerBound[1]},bottomRight:{x:t.upperBound[0],y:t.upperBound[1]}})}static arrayToVector(t){return new helpersLib.Vector(t[0],t[1])}static vectorToArray(t){return [t.x,t.y]}static arePhysicsGroupsCollidable(t,e,i,r){return (t&r)!==0&&(i&e)!==0}static canCollideWith(t,e){return t.shapes.some(i=>e.shapes.some(r=>o.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new U__default.default.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var br=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},J=new $,Ct=class{static{h(this,"PhysicsInternalGateway");}createBody(t,e,i,r,s){return J.trigger("createBody",t,e,i,r,s)}getMaterial(t,e){return J.trigger("getMaterial",t,e)}getMaterialDefinition(t,e){return J.trigger("getMaterialDefinition",t,e)}getGroupConstant(t,e){return J.trigger("getGroupConstant",t,e)}getMaskConstant(t,e){return J.trigger("getMaskConstant",t,e)}addBody(t,e,i,r,s){return J.trigger("addBody",t,e,i,r,s)}removeBody(t,e){return J.trigger("removeBody",t,e)}subscribeToPhysicsStep(t,e){return J.trigger("subscribeToPhysicsStep",t,e)}};Ct=br([d()],Ct);var b=class o extends z{static{h(this,"PhysicsEntity");}static{this.ƀhc=new Map;}static{this.ƀhj=new Map;}static getFromP2BodyID(t){return o.ƀhc.get(t)}static getFromP2BodyIDOrFail(t){let e=o.ƀhc.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=o.ƀhj.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(o.ƀhj.values())}get area(){return this.ƀu}get mass(){return this.ƀgd}get collisions(){return this.ƀay}constructor(t,e,i){super(),this.ƀgo=new actionsLib.Action,this.onCollision=this.ƀgo.notifier,this.type="dynamic",this.ƀu=0,this.ƀgd=0,this.ƀay=[],this.physicsWorldID=t,this.ƀhl=P.get(Ct);let r=this.ƀhl.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀhl.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀhk=this.ƀhl.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀhm=this.ƀhl.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀhl.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀu=this.p2Body.getArea(),this.ƀgd=this.p2Body.mass,this.p2Body.position=f.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀhl.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.ƀhc.set(this.p2Body.id,this),o.ƀhj.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀhl.removeBody(this.physicsWorldID,this.p2Body),o.ƀhc.delete(this.p2Body.id),o.ƀhj.delete(this.id));}canCollideWith(t){return f.arePhysicsGroupsCollidable(this.ƀhk,this.ƀhm,t.ƀhk,t.ƀhm)}ƀiu(t){this.ƀay=t,t.length>0&&this.ƀgo.trigger(t);}};var Ut=class extends b{static{h(this,"ImmovablePhysicsEntity");}constructor(t,e){super(t,e,"static"),this.position=f.arrayToVector(this.p2Body.position),this.rotation=new helpersLib.Radian(this.p2Body.angle);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position,rotation:this.rotation,velocity:helpersLib.Vector.zero,rotationalSpeed:0}}};var Xe=class extends z{static{h(this,"MovableEntity");}constructor(){super(),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.rotation=new actionsLib.Variable(helpersLib.Radian.get0),this.velocity=new actionsLib.Variable(helpersLib.Vector.zero),this.rotationalSpeed=new actionsLib.Variable(0),y.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀjm(t,e);}).attach(this);}ƀjm(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 Ke=class extends b{static{h(this,"MovablePhysicsEntity");}constructor(t,e){super(t,e,"dynamic"),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.rotation=new actionsLib.Variable(helpersLib.Radian.get0),this.velocity=new actionsLib.Variable(helpersLib.Vector.zero),this.rotationalSpeed=new actionsLib.Variable(0),this.ƀez=false,this.ƀfa=false,this.ƀfc=false,this.ƀfb=false,this.ƀhg(),this.ƀfx(),P.get(Ct).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀjm(i,r)).attach(this);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position.value,rotation:this.rotation.value,velocity:this.velocity.value,rotationalSpeed:this.rotationalSpeed.value}}ƀjm(t,e){this.ƀez=true,this.ƀfa=true,this.ƀfc=true,this.ƀfb=true,this.ƀhg();}ƀhg(){this.position.value=f.arrayToVector(this.p2Body.position),this.rotation.value=new helpersLib.Radian(this.p2Body.angle),this.velocity.value=f.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀfx(){this.position.subscribe(t=>{this.ƀez?this.ƀez=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfa?this.ƀfa=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfc?this.ƀfc=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfb?this.ƀfb=false:this.p2Body.angularVelocity=t;}).attach(this);}};var Ze=10.8,Qe=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 st="border";var Y=class{static{h(this,"AnimationInterpolationFunctions");}static boomerangTime(t){return 1-Math.abs(t-.5)*2}static lineer(t){return t}static easeIn(t){return Math.pow(t,2)}static easeOut(t){return 1-Math.pow(1-t,2)}static easeInOut(t){return t<.5?2*t*t:(t-=1,1-2*t*t)}static easeInOutCubic(t){let e=2*t-2;return t<.5?4*Math.pow(t,3):(t-1)*Math.pow(e,2)+1}},Tr=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return Y.lineer(t)}},Er=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return Y.easeIn(t)}},Rr=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return Y.easeOut(t)}},Ir=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return Y.easeInOut(t)}},Ar=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return Y.easeInOutCubic(t)}},Ai=class{static{h(this,"AnimationFlicker");}start(){this.ƀjy=new Array(10).fill(0),helpersLib.Random.integerBetween(0,9),this.ƀjy[helpersLib.Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(helpersLib.Random.integerBetween(0,9),this.ƀjy[helpersLib.Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(helpersLib.Random.integerBetween(0,9),this.ƀjy[helpersLib.Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀjy[e]}},S=class{static{h(this,"Animations");}static{this.lineer=new Tr;}static{this.easeIn=new Er;}static{this.easeOut=new Rr;}static{this.easeInOut=new Ir;}static{this.easeInOutCubic=new Ar;}};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 A=class o{static{h(this,"Animator");}static{this.ƀk=new WeakMap;}static ƀdj(t){let e=o.ƀk.get(t);return e||(e=new helpersLib.MapToWeakRefs,o.ƀk.set(t,e)),e}get animating(){return this.ƀgx!==void 0}get target(){return this.ƀjp}get value(){return this.ƀkh||(this.ƀkh=new actionsLib.Variable(this.ƀjp)),this.ƀkh.notifier}constructor(t,e,i){this.ƀfl=false,this.ƀjb=false,this.ƀjp=t,this.ƀha={duration:200,animation:S.lineer,reAnimateHandling:exports.ReAnimateHandlingType.ThrowError,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState,...i},this.ƀl=helpersLib.Comparator.isArray(e)?e:[e],this.ƀfy(t,this.ƀl);}animate(t,e){let i={...this.ƀha,...e},r=this.ƀgx;if(this.ƀgx)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();case exports.ReAnimateHandlingType.CompletePrevious:this.ƀiv(i.completionHandling,this.ƀgx.ƀhv,true);break;default:{throw new Error(`Animator: unknown re-animate handling type: "${i.reAnimateHandling}"`)}}return actionsLib.SingleEvent.create(n=>{this.ƀfl&&(this.ƀjb=true);let a=this.ƀl.reduce((c,p)=>(c[p]={ƀjj:this.ƀjp[p],ƀjr:t[p]},c),{}),l={ƀcs:i.duration,ƀct:0,ƀhv:a,ƀbf:i.completionHandling,ƀm:i.animation,ƀbe:n};if(l.ƀbf!==exports.AnimationsCompletionHandlingType.Loop&&this.ƀfj(l)){this.ƀgx=void 0,n(),r?.ƀbe(),this.ƀgx||(this.ƀke?.destroy(),this.ƀke=void 0);return}else l.ƀm.start();return this.ƀgx=l,this.ƀcv(),r?.ƀbe(),()=>{this.ƀgx===l&&(this.ƀjp instanceof actionsLib.Attachable&&this.ƀjp.destroyed||this.ƀiv(l.ƀbf,l.ƀhv,true),this.ƀgx=void 0,this.ƀke?.destroy(),this.ƀke=void 0);}})}set(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r]&&(e=true,this.ƀjp[r]=t[r]);}e&&this.ƀkh?.set(this.ƀjp),this.ƀgx?.ƀbe();}completeAnimation(t){if(this.ƀgx){t=t??this.ƀgx.ƀbf,this.ƀiv(t,this.ƀgx.ƀhv,true);let e=this.ƀgx.ƀbe;this.ƀgx=void 0,e();}}ƀcv(){this.ƀke||(this.ƀke=y.beforeSceneUpdateAction.subscribe(t=>{this.ƀfl=true;try{let e=this.ƀgx;if(!e)return;e.ƀct+=t.delta;let i=e.ƀct>=e.ƀcs;if(i)if(e.ƀbf===exports.AnimationsCompletionHandlingType.Loop)e.ƀct%=e.ƀcs,e.ƀm.start(),i=!1;else {this.ƀiv(e.ƀbf,e.ƀhv,!1),this.ƀgx=void 0,e.ƀbe(),this.ƀgx||(this.ƀke?.destroy(),this.ƀke=void 0);return}if(!i){let r=e.ƀm.multiplierFunction(e.ƀct/e.ƀcs),s=!1;for(let n=0;n<this.ƀl.length;n++){let a=this.ƀl[n],l=e.ƀhv[a],p=(l.ƀjr-l.ƀjj)*r+l.ƀjj;p!==this.ƀjp[a]&&(s=!0,this.ƀjp[a]=p);}s&&this.ƀkh?.set(this.ƀjp);}}finally{this.ƀfl=false,this.ƀjb&&(this.ƀjb=false,this.ƀke?.destroy(),this.ƀke=void 0,this.ƀcv());}}).attachToRoot());}ƀfj(t){for(let e=0;e<this.ƀl.length;e++){let i=this.ƀl[e];if(this.ƀjp[i]!==t.ƀhv[i].ƀjr)return false}return true}ƀiv(t,e,i){switch(t){case exports.AnimationsCompletionHandlingType.ReturnToOriginal:this.ƀih(e);break;case exports.AnimationsCompletionHandlingType.StayInCurrentState:i||this.ƀfo(e);break;case exports.AnimationsCompletionHandlingType.JumpToEnd:this.ƀfo(e);break;case exports.AnimationsCompletionHandlingType.Loop:this.ƀih(e);break;default:{throw new Error(`Animator: unknown completion handling type: "${t}"`)}}}ƀih(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r].ƀjj&&(e=true,this.ƀjp[r]=t[r].ƀjj);}e&&this.ƀkh?.set(this.ƀjp);}ƀfo(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r].ƀjr&&(e=true,this.ƀjp[r]=t[r].ƀjr);}e&&this.ƀkh?.set(this.ƀjp);}ƀfy(t,e){let i=o.ƀdj(t);for(let r of e){if(i.has(r))throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(t,void 0,2)}", Property: "${r}"`);i.set(r,this);}}};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";})(exports.ContainerEventType||(exports.ContainerEventType={}));exports.Cursor=void 0;(function(o){o.Default="default",o.Pointer="pointer";})(exports.Cursor||(exports.Cursor={}));var ue=class extends actionsLib.IDAttachable{static{h(this,"ContainerAttributes");}constructor(){super(),this.ƀgh=false,this.ƀdc=false,this.ƀii=1,this.ƀw=1,this.pixiContainer=new V__namespace.Container;}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new helpersLib.Vector(this.pixiContainer.width,this.pixiContainer.height)}setSize(t){return this.pixiContainer.width=t.x,this.pixiContainer.height=t.y,this}setPosition(t,e){if(e?.holdFrom){let i=this.pixiContainer.getLocalBounds(),r=new helpersLib.Vector(this.pixiContainer.scale.x,this.pixiContainer.scale.y),s=new helpersLib.Vector(i.x,i.y).multiply(r),n=new helpersLib.Vector(i.width,i.height).multiply(r),a=s.add(n.multiply(e.holdFrom));t=t.subtract(a);}return e?.round!==false&&(t=t.round({rollHalfsDown:true})),this.position=t,this}get position(){return new helpersLib.Vector(this.pixiContainer.x,this.pixiContainer.y)}set position(t){this.pixiContainer.position=t;}get x(){return this.pixiContainer.x}set x(t){this.pixiContainer.x=t;}get y(){return this.pixiContainer.y}set y(t){this.pixiContainer.y=t;}on(t){return actionsLib.Sequence.create(e=>{let i=h(r=>e(),"handle");return this.pixiContainer.on(t,i),()=>this.pixiContainer.off(t,i)})}setRotation(t){return this.rotation=t,this}get rotation(){return new helpersLib.Radian(this.pixiContainer.rotation)}set rotation(t){this.pixiContainer.rotation=t.value;}get rotationValue(){return this.rotation.value}set rotationValue(t){this.rotation=new helpersLib.Radian(t);}setZIndex(t){return this.zIndex=t,this}get zIndex(){return this.pixiContainer.zIndex}set zIndex(t){this.pixiContainer.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new helpersLib.Radian(this.pixiContainer.skew.x)}set skewX(t){this.pixiContainer.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new helpersLib.Radian(this.pixiContainer.skew.y)}set skewY(t){this.pixiContainer.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.pixiContainer.sortableChildren}set sortableChildren(t){this.pixiContainer.sortableChildren=t;}setAlpha(t){return this.pixiContainer.alpha=t,this}get alpha(){return this.pixiContainer.alpha}set alpha(t){this.pixiContainer.alpha=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.pixiContainer.interactive}set interactive(t){t?this.pixiContainer.eventMode="dynamic":this.pixiContainer.eventMode="none";}setCursor(t){return this.cursor=t,this}get cursor(){return this.pixiContainer.cursor}set cursor(t){this.pixiContainer.cursor=t;}getMask(){throw new Error("ContainerAttributes: mask is not available!")}setMask(t){return t?(this.pixiContainer.addChild(t.pixiContainer),this.pixiContainer.mask=t.getMask(),this.ƀgb=t):(this.ƀgb&&this.pixiContainer.removeChild(this.ƀgb.pixiContainer),this.pixiContainer.mask=null),this}hitTest(t){if(this.pixiContainer.parent)if(this.pixiContainer.hitArea){let e=this.pixiContainer.toLocal(t);return this.pixiContainer.hitArea.contains(e.x,e.y)}else return this.pixiContainer.getBounds().contains(t.x,t.y);else return false}get boundingBox(){let t=this.pixiContainer.getLocalBounds();return new helpersLib.Rectangle(new helpersLib.Vector(t.x,t.y),new helpersLib.Vector(t.x+t.width,t.y+t.height))}ignoreBounds(t=true){return t?(this.ƀhb||(this.ƀhb=this.pixiContainer.calculateBounds),this.pixiContainer.calculateBounds=()=>this.pixiContainer._bounds.clear()):this.ƀhb&&(this.pixiContainer.calculateBounds=this.ƀhb),this}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀgh}set mirror(t){this.ƀgh=t,this.ƀkg();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdc}set flip(t){this.ƀdc=t,this.ƀkg();}setScale(t){return this.scale=t,this}get scale(){return this.ƀii}set scale(t){this.ƀii=t,this.ƀkg();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀw}set aspectRatio(t){this.ƀw=t,this.ƀkg();}ƀkg(){this.pixiContainer.scale.set(this.ƀii,this.ƀii),this.ƀw<1?this.pixiContainer.scale.x*=this.ƀw:this.ƀw>1&&(this.pixiContainer.scale.y/=this.ƀw),this.ƀgh&&(this.pixiContainer.scale.x*=-1),this.ƀdc&&(this.pixiContainer.scale.y*=-1);}};var O=2;exports.BlendMode=void 0;(function(o){o[o.Normal=0]="Normal",o[o.Add=1]="Add",o[o.Screen=3]="Screen",o[o.Luminosity=16]="Luminosity",o[o.ColorDodge=7]="ColorDodge";})(exports.BlendMode||(exports.BlendMode={}));var fe=class{static{h(this,"GaussianValuesHelper");}static ƀdh(t,e){let i=e*e,r=1/(helpersLib.PI_360*i),s=-(t*t)/(2*i);return r*Math.exp(s)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),r=.005*i,s=helpersLib.NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<r)i-=l*2;else return true}),n=1/i,a=s.map(l=>l*n);return this.ƀbr(a)}static getValuesForLinearSamplingGauss(t){if(t===0)return [{offset:0,multiplier:1}];if(t===1)return [{offset:0,multiplier:.5},{offset:1,multiplier:.25}];{let e=helpersLib.ArrayHelper.createIntegerArray(Math.ceil(t*.75)).map(r=>this.ƀdh(r,t*.4)),i=e.reduce((r,s)=>r+s,0);return i=i*2-e[0],e=e.map(r=>r/i),this.ƀbr(e)}}static ƀbr(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let r=t[i]+t[i+1],s=i+t[i+1]/r;e.push({offset:s,multiplier:r});}if(t.length%2===0){let i=t[t.length-1],r=t.length-1;e.push({offset:r,multiplier:i});}return e}};var Di=class ti extends V__namespace.Filter{static{h(this,"BlurFilterPass");}static ƀeh(){return `
2
2
  attribute vec2 aVertexPosition;
3
3
  attribute vec2 aTextureCoord;
4
4
 
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import {Action,ActionLib,SingleEvent,IDAttachable,Variable,Attachable,Sequence,Reducer,SingleAction}from'actions-lib';import'reflect-metadata';import {Rectangle,Vector,Radian,Random,MapToWeakRefs,Comparator,NumberHelper,ArrayHelper,ColorHelper,PI_360,Queue,GridNeighborType,BinaryHeap,Grid,Line}from'helpers-lib';import U from'p2';import*as V from'pixi.js';import {RichTextSeparator}from'script-engine-lib';var hr=Object.defineProperty;var h=(o,t)=>hr(o,"name",{value:t,configurable:true});var G=class{static{h(this,"BardLegendsHardReset");}static{this.ƀes=new Action;}static{this.onHardReset=this.ƀes.notifier;}static hardReset(){ActionLib.hardReset(),this.ƀes.trigger();}};function d(){return function(o){let t=P.ƀec(o);o.$meta={paramtypes:t,type:"service"};}}h(d,"ServiceDecorator");var P=class{static{h(this,"Service");}static{this.ƀit=new Map;}static get(t){let e=this.ƀit.get(t);if(!e){if(!t.$meta)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let i=this.ƀif([],t.$meta.paramtypes);e=new t(...i),this.ƀit.set(t,e);}return e}static ƀec(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e}static ƀif(t,e){let i=[...t];if(e.length>t.length){let s=e.slice(t.length).map(n=>{if(n&&n.$meta?.type==="service")return this.get(n)});i.push(...s);}return i}};G.onHardReset.subscribe(()=>{P.ƀit=new Map;}).attachToRoot();var $=class{static{h(this,"ControllerLink");}constructor(){this.ƀbm=[],this.ƀid=[];}trigger(t,...e){let i=this.ƀbm.find(r=>!!r[t]);if(i)return i[t](...e);throw new Error(`ServiceLink: no defined function with the name: "${t}", found in the linked controllers!`)}registerController(t){Reflect.ownKeys(t.constructor.prototype).filter(e=>e!=="constructor").map(e=>e.toString()).forEach(e=>{if(this.ƀid.includes(e))throw new Error(`ServiceLink: the function is already registered, function name: "${e}"`);this.ƀid.push(e);}),this.ƀbm.push(t);}};function q(o){return function(t){let e=P.ƀec(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=P.ƀif([],e);i.some(s=>s===void 0)&&console.error(i,e,t.name);let r=new t(...i);o.controllerLink.registerController(r);}t.$meta={type:"controller"};}}h(q,"ControllerDecorator");var y=class o{static{h(this,"UpdateCycle");}static{this.ƀad=new Action;}static{this.beforeSceneUpdateAction=this.ƀad.notifier;}static{this.ƀil=new Action;}static{this.sceneUpdateAction=this.ƀil.notifier;}static{this.ƀf=new Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀjx=0;}static{this.ƀkf=void 0;}static wait(t){let e=this.ƀjx+t;return SingleEvent.create(i=>{let r=o.beforeSceneUpdateAction.subscribe(s=>{s.time>=e&&i();}).attachToRoot();return ()=>r.destroy()})}static registerUpdateModifier(t){if(!this.ƀkf)this.ƀkf=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀkf=void 0;}static triggerUpdateTick(t){this.ƀkf&&(t=this.ƀkf(this.ƀjx,t)),this.ƀjx+=t,this.ƀfr=t,t>0&&(o.ƀad.trigger({time:this.ƀjx,delta:t}),o.ƀil.trigger({time:this.ƀjx,delta:t}),o.ƀf.trigger({time:this.ƀjx,delta:t}));}static get lastDelta(){return this.ƀfr}static{this.ƀfr=0;}};G.onHardReset.subscribe(()=>{y.ƀad.clear(),y.ƀil.clear(),y.ƀf.clear(),y.ƀkf=void 0,y.ƀjx=0;}).attachToRoot();var _=class o{static{h(this,"EntityStoreHelper");}static{this.ƀaw=new Map;}static registerEntityClass(t){this.ƀaw.set(t.id,new Map);}static registerEntity(t){this.ƀaw.get(t.classID).set(t.id,t);}static unregisterEntity(t,e){let i=t.id;this.ƀaw.get(i)?.delete(e);}static getEntity(t,e){return this.ƀaw.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.ƀaw.get(t.id);return Array.from(e.values())}};G.onHardReset.subscribe(()=>{_.ƀaw.clear();}).attachToRoot();var rt=class o{static{h(this,"EntityViewsHelper");}static{this.ƀko=new Map;}static registerView(t,e){o.ƀko.has(e)||o.ƀko.set(e,[]);let i=o.ƀko.get(e);i&&i.push(t),_.getEntities(e).forEach(s=>{this.ƀch(s,t);});}static ƀch(t,e){try{let i=P.ƀif([this],e.$meta.paramtypes);o.entityID=t.id;let r=new e(t,...i.slice(1));t.destroyed?r.destroy():t.ƀkn.ƀkp.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀcw=t,this.ƀkp=[];}createViews(){if(!this.ƀcw.destroyed){let t=o.ƀko.get(this.ƀcw.constructor);t&&t.forEach(e=>{o.ƀch(this.ƀcw,e);});}}updateViews(t,e){for(let i=0;i<this.ƀkp.length;i++){let r=this.ƀkp[i];r.destroyed||r.update(t,e);}}destroyViews(){this.ƀkp.forEach(t=>{t.destroy();});}};G.onHardReset.subscribe(()=>{rt.ƀko=new Map;}).attachToRoot();function dt(){return function(o){o.$meta={type:"entity"},_.registerEntityClass(o);}}h(dt,"EntityDecorator");var z=class extends IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return _.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=_.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return _.getEntities(this)}constructor(){super(),this.ƀkn=new rt(this),_.registerEntity(this),y.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.update(t.time,t.delta),this.ƀkn.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀkn.destroyViews(),_.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀkn.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀkn.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀkn.createViews(),this}update(t,e){}};var ut=class extends z{static{h(this,"SingletonEntity");}static getInstance(){return _.getSingleton(this)}static getInstanceOrFail(){return _.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}"`)}};function gr(){return function(o){return o.$meta={paramtypes:P.ƀec(o),type:"scene"},o}}h(gr,"SceneDecorator");var St=class o extends IDAttachable{static{h(this,"Scene");}static{this.ƀik=false;}static{this.ƀb=new Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveScene(){return o.ƀb.value}static getActiveSceneOrFail(){if(!o.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return o.ƀb.value}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.ƀik)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(o.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=t[0];o.ƀik=true;let i=P.ƀif([],this.$meta.paramtypes),r=new this(...i).attachToRoot();return o.ƀb.set(r),r.init(e).map(()=>(o.ƀik=false,r)).chainToRoot()}constructor(){super(),this.ƀgn=new Action,this.onClose=this.ƀgn.notifier,y.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(o.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(o.ƀik)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");o.ƀik=true;let e=t[0];return this.prepareToClose().map(()=>(super.destroy(),o.ƀb.set(void 0),o.ƀik=false,this.ƀgn.trigger(e),e)).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};G.onHardReset.subscribe(()=>{St.ƀb.set(void 0);}).attachToRoot();function Ye(o){return function(t){t.$meta={paramtypes:P.ƀec(t),viewInstances:new Map,entity:o.entity,type:"view"},rt.registerView(t,o.entity);}}h(Ye,"ViewDecorator");var Wt=class extends IDAttachable{static{h(this,"View");}static getInstance(t){return this.$meta.entity.validateID(t)?this.$meta.viewInstances.get(t):void 0}static getInstanceOrFail(t){if(!this.$meta.entity.validateID(t))throw new Error(`View: getInstance is called with entity id: "${t}", that is not belonging to the class: "${this.$meta.entity}"`);let i=this.$meta.viewInstances.get(t);if(!i)throw new Error(`View: getInstanceOrFail is called with entity id: "${t}", that is not found!`);return i}constructor(){super(),this.attachToRoot(),this.ƀcx=rt.entityID,this.ƀei().set(this.ƀcx,this);}destroy(){this.destroyed||(super.destroy(),this.ƀei().delete(this.ƀcx));}update(t,e){}ƀei(){return this.constructor.$meta.viewInstances}};var f=class o{static{h(this,"P2JSHelper");}static aabbToBoundingBox(t){return Rectangle.fromRect({topLeft:{x:t.lowerBound[0],y:t.lowerBound[1]},bottomRight:{x:t.upperBound[0],y:t.upperBound[1]}})}static arrayToVector(t){return new Vector(t[0],t[1])}static vectorToArray(t){return [t.x,t.y]}static arePhysicsGroupsCollidable(t,e,i,r){return (t&r)!==0&&(i&e)!==0}static canCollideWith(t,e){return t.shapes.some(i=>e.shapes.some(r=>o.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new U.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var br=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},J=new $,Ct=class{static{h(this,"PhysicsInternalGateway");}createBody(t,e,i,r,s){return J.trigger("createBody",t,e,i,r,s)}getMaterial(t,e){return J.trigger("getMaterial",t,e)}getMaterialDefinition(t,e){return J.trigger("getMaterialDefinition",t,e)}getGroupConstant(t,e){return J.trigger("getGroupConstant",t,e)}getMaskConstant(t,e){return J.trigger("getMaskConstant",t,e)}addBody(t,e,i,r,s){return J.trigger("addBody",t,e,i,r,s)}removeBody(t,e){return J.trigger("removeBody",t,e)}subscribeToPhysicsStep(t,e){return J.trigger("subscribeToPhysicsStep",t,e)}};Ct=br([d()],Ct);var b=class o extends z{static{h(this,"PhysicsEntity");}static{this.ƀhc=new Map;}static{this.ƀhj=new Map;}static getFromP2BodyID(t){return o.ƀhc.get(t)}static getFromP2BodyIDOrFail(t){let e=o.ƀhc.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=o.ƀhj.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(o.ƀhj.values())}get area(){return this.ƀu}get mass(){return this.ƀgd}get collisions(){return this.ƀay}constructor(t,e,i){super(),this.ƀgo=new Action,this.onCollision=this.ƀgo.notifier,this.type="dynamic",this.ƀu=0,this.ƀgd=0,this.ƀay=[],this.physicsWorldID=t,this.ƀhl=P.get(Ct);let r=this.ƀhl.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀhl.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀhk=this.ƀhl.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀhm=this.ƀhl.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀhl.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀu=this.p2Body.getArea(),this.ƀgd=this.p2Body.mass,this.p2Body.position=f.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀhl.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.ƀhc.set(this.p2Body.id,this),o.ƀhj.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀhl.removeBody(this.physicsWorldID,this.p2Body),o.ƀhc.delete(this.p2Body.id),o.ƀhj.delete(this.id));}canCollideWith(t){return f.arePhysicsGroupsCollidable(this.ƀhk,this.ƀhm,t.ƀhk,t.ƀhm)}ƀiu(t){this.ƀay=t,t.length>0&&this.ƀgo.trigger(t);}};var Ut=class extends b{static{h(this,"ImmovablePhysicsEntity");}constructor(t,e){super(t,e,"static"),this.position=f.arrayToVector(this.p2Body.position),this.rotation=new Radian(this.p2Body.angle);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position,rotation:this.rotation,velocity:Vector.zero,rotationalSpeed:0}}};var Xe=class extends z{static{h(this,"MovableEntity");}constructor(){super(),this.position=new Variable(Vector.zero),this.rotation=new Variable(Radian.get0),this.velocity=new Variable(Vector.zero),this.rotationalSpeed=new Variable(0),y.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀjm(t,e);}).attach(this);}ƀjm(t,e){this.position.value=this.position.value.add(this.velocity.value.multiplyNumber(e)),this.rotation.value=new Radian(this.rotation.value.value+this.rotationalSpeed.value*e);}};var Ke=class extends b{static{h(this,"MovablePhysicsEntity");}constructor(t,e){super(t,e,"dynamic"),this.position=new Variable(Vector.zero),this.rotation=new Variable(Radian.get0),this.velocity=new Variable(Vector.zero),this.rotationalSpeed=new Variable(0),this.ƀez=false,this.ƀfa=false,this.ƀfc=false,this.ƀfb=false,this.ƀhg(),this.ƀfx(),P.get(Ct).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀjm(i,r)).attach(this);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position.value,rotation:this.rotation.value,velocity:this.velocity.value,rotationalSpeed:this.rotationalSpeed.value}}ƀjm(t,e){this.ƀez=true,this.ƀfa=true,this.ƀfc=true,this.ƀfb=true,this.ƀhg();}ƀhg(){this.position.value=f.arrayToVector(this.p2Body.position),this.rotation.value=new Radian(this.p2Body.angle),this.velocity.value=f.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀfx(){this.position.subscribe(t=>{this.ƀez?this.ƀez=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfa?this.ƀfa=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfc?this.ƀfc=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfb?this.ƀfb=false:this.p2Body.angularVelocity=t;}).attach(this);}};var Ze=10.8,Qe=10.01,tt;(function(o){o[o.Point=1]="Point",o[o.Circle=2]="Circle",o[o.Polygon=3]="Polygon",o[o.Rectangle=4]="Rectangle";})(tt||(tt={}));var st="border";var Y=class{static{h(this,"AnimationInterpolationFunctions");}static boomerangTime(t){return 1-Math.abs(t-.5)*2}static lineer(t){return t}static easeIn(t){return Math.pow(t,2)}static easeOut(t){return 1-Math.pow(1-t,2)}static easeInOut(t){return t<.5?2*t*t:(t-=1,1-2*t*t)}static easeInOutCubic(t){let e=2*t-2;return t<.5?4*Math.pow(t,3):(t-1)*Math.pow(e,2)+1}},Tr=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return Y.lineer(t)}},Er=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return Y.easeIn(t)}},Rr=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return Y.easeOut(t)}},Ir=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return Y.easeInOut(t)}},Ar=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return Y.easeInOutCubic(t)}},Ai=class{static{h(this,"AnimationFlicker");}start(){this.ƀjy=new Array(10).fill(0),Random.integerBetween(0,9),this.ƀjy[Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(Random.integerBetween(0,9),this.ƀjy[Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(Random.integerBetween(0,9),this.ƀjy[Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀjy[e]}},S=class{static{h(this,"Animations");}static{this.lineer=new Tr;}static{this.easeIn=new Er;}static{this.easeOut=new Rr;}static{this.easeInOut=new Ir;}static{this.easeInOutCubic=new Ar;}};var F;(function(o){o[o.ThrowError=1]="ThrowError",o[o.IgnoreNewAnimation=2]="IgnoreNewAnimation",o[o.CompletePrevious=3]="CompletePrevious";})(F||(F={}));var R;(function(o){o[o.ReturnToOriginal=1]="ReturnToOriginal",o[o.StayInCurrentState=2]="StayInCurrentState",o[o.JumpToEnd=3]="JumpToEnd",o[o.Loop=4]="Loop";})(R||(R={}));var A=class o{static{h(this,"Animator");}static{this.ƀk=new WeakMap;}static ƀdj(t){let e=o.ƀk.get(t);return e||(e=new MapToWeakRefs,o.ƀk.set(t,e)),e}get animating(){return this.ƀgx!==void 0}get target(){return this.ƀjp}get value(){return this.ƀkh||(this.ƀkh=new Variable(this.ƀjp)),this.ƀkh.notifier}constructor(t,e,i){this.ƀfl=false,this.ƀjb=false,this.ƀjp=t,this.ƀha={duration:200,animation:S.lineer,reAnimateHandling:F.ThrowError,completionHandling:R.StayInCurrentState,...i},this.ƀl=Comparator.isArray(e)?e:[e],this.ƀfy(t,this.ƀl);}animate(t,e){let i={...this.ƀha,...e};if(this.ƀgx)switch(i.reAnimateHandling){case F.ThrowError:throw new Error("Animator: new animation triggered while another is not complete yet.");case F.IgnoreNewAnimation:return SingleEvent.instant();case F.CompletePrevious:this.ƀiv(i.completionHandling,this.ƀgx.ƀhv,true);break;default:{throw new Error(`Animator: unknown re-animate handling type: "${i.reAnimateHandling}"`)}}return SingleEvent.create(s=>{this.ƀfl&&(this.ƀjb=true);let n=this.ƀl.reduce((c,p)=>(c[p]={ƀjj:this.ƀjp[p],ƀjr:t[p]},c),{}),a={ƀcs:i.duration,ƀct:0,ƀhv:n,ƀbf:i.completionHandling,ƀm:i.animation,ƀbe:s};if(a.ƀbf!==R.Loop&&this.ƀfj(a)){this.ƀgx=void 0,s();return}else a.ƀm.start();let l=this.ƀgx;return this.ƀgx=a,this.ƀcv(),l?.ƀbe(),()=>{this.ƀgx===a&&(this.ƀjp instanceof Attachable&&this.ƀjp.destroyed||this.ƀiv(a.ƀbf,a.ƀhv,true),this.ƀgx=void 0,this.ƀke?.destroy(),this.ƀke=void 0);}})}set(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r]&&(e=true,this.ƀjp[r]=t[r]);}e&&this.ƀkh?.set(this.ƀjp),this.ƀgx?.ƀbe();}completeAnimation(t){if(this.ƀgx){t=t??this.ƀgx.ƀbf,this.ƀiv(t,this.ƀgx.ƀhv,true);let e=this.ƀgx.ƀbe;this.ƀgx=void 0,e();}}ƀcv(){this.ƀke||(this.ƀke=y.beforeSceneUpdateAction.subscribe(t=>{this.ƀfl=true;try{let e=this.ƀgx;if(!e)return;e.ƀct+=t.delta;let i=e.ƀct>=e.ƀcs;if(i)if(e.ƀbf===R.Loop)e.ƀct%=e.ƀcs,e.ƀm.start(),i=!1;else {this.ƀiv(e.ƀbf,e.ƀhv,!1),this.ƀgx=void 0,e.ƀbe(),this.ƀgx||(this.ƀke?.destroy(),this.ƀke=void 0);return}if(!i){let r=e.ƀm.multiplierFunction(e.ƀct/e.ƀcs),s=!1;for(let n=0;n<this.ƀl.length;n++){let a=this.ƀl[n],l=e.ƀhv[a],p=(l.ƀjr-l.ƀjj)*r+l.ƀjj;p!==this.ƀjp[a]&&(s=!0,this.ƀjp[a]=p);}s&&this.ƀkh?.set(this.ƀjp);}}finally{this.ƀfl=false,this.ƀjb&&(this.ƀjb=false,this.ƀke?.destroy(),this.ƀke=void 0,this.ƀcv());}}).attachToRoot());}ƀfj(t){for(let e=0;e<this.ƀl.length;e++){let i=this.ƀl[e];if(this.ƀjp[i]!==t.ƀhv[i].ƀjr)return false}return true}ƀiv(t,e,i){switch(t){case R.ReturnToOriginal:this.ƀih(e);break;case R.StayInCurrentState:i||this.ƀfo(e);break;case R.JumpToEnd:this.ƀfo(e);break;case R.Loop:this.ƀih(e);break;default:{throw new Error(`Animator: unknown completion handling type: "${t}"`)}}}ƀih(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r].ƀjj&&(e=true,this.ƀjp[r]=t[r].ƀjj);}e&&this.ƀkh?.set(this.ƀjp);}ƀfo(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r].ƀjr&&(e=true,this.ƀjp[r]=t[r].ƀjr);}e&&this.ƀkh?.set(this.ƀjp);}ƀfy(t,e){let i=o.ƀdj(t);for(let r of e){if(i.has(r))throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(t,void 0,2)}", Property: "${r}"`);i.set(r,this);}}};var $t;(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";})($t||($t={}));var qe;(function(o){o.Default="default",o.Pointer="pointer";})(qe||(qe={}));var ue=class extends IDAttachable{static{h(this,"ContainerAttributes");}constructor(){super(),this.ƀgh=false,this.ƀdc=false,this.ƀii=1,this.ƀw=1,this.pixiContainer=new V.Container;}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new Vector(this.pixiContainer.width,this.pixiContainer.height)}setSize(t){return this.pixiContainer.width=t.x,this.pixiContainer.height=t.y,this}setPosition(t,e){if(e?.holdFrom){let i=this.pixiContainer.getLocalBounds(),r=new Vector(this.pixiContainer.scale.x,this.pixiContainer.scale.y),s=new Vector(i.x,i.y).multiply(r),n=new Vector(i.width,i.height).multiply(r),a=s.add(n.multiply(e.holdFrom));t=t.subtract(a);}return e?.round!==false&&(t=t.round({rollHalfsDown:true})),this.position=t,this}get position(){return new Vector(this.pixiContainer.x,this.pixiContainer.y)}set position(t){this.pixiContainer.position=t;}get x(){return this.pixiContainer.x}set x(t){this.pixiContainer.x=t;}get y(){return this.pixiContainer.y}set y(t){this.pixiContainer.y=t;}on(t){return Sequence.create(e=>{let i=h(r=>e(),"handle");return this.pixiContainer.on(t,i),()=>this.pixiContainer.off(t,i)})}setRotation(t){return this.rotation=t,this}get rotation(){return new Radian(this.pixiContainer.rotation)}set rotation(t){this.pixiContainer.rotation=t.value;}get rotationValue(){return this.rotation.value}set rotationValue(t){this.rotation=new Radian(t);}setZIndex(t){return this.zIndex=t,this}get zIndex(){return this.pixiContainer.zIndex}set zIndex(t){this.pixiContainer.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new Radian(this.pixiContainer.skew.x)}set skewX(t){this.pixiContainer.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new Radian(this.pixiContainer.skew.y)}set skewY(t){this.pixiContainer.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.pixiContainer.sortableChildren}set sortableChildren(t){this.pixiContainer.sortableChildren=t;}setAlpha(t){return this.pixiContainer.alpha=t,this}get alpha(){return this.pixiContainer.alpha}set alpha(t){this.pixiContainer.alpha=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.pixiContainer.interactive}set interactive(t){t?this.pixiContainer.eventMode="dynamic":this.pixiContainer.eventMode="none";}setCursor(t){return this.cursor=t,this}get cursor(){return this.pixiContainer.cursor}set cursor(t){this.pixiContainer.cursor=t;}getMask(){throw new Error("ContainerAttributes: mask is not available!")}setMask(t){return t?(this.pixiContainer.addChild(t.pixiContainer),this.pixiContainer.mask=t.getMask(),this.ƀgb=t):(this.ƀgb&&this.pixiContainer.removeChild(this.ƀgb.pixiContainer),this.pixiContainer.mask=null),this}hitTest(t){if(this.pixiContainer.parent)if(this.pixiContainer.hitArea){let e=this.pixiContainer.toLocal(t);return this.pixiContainer.hitArea.contains(e.x,e.y)}else return this.pixiContainer.getBounds().contains(t.x,t.y);else return false}get boundingBox(){let t=this.pixiContainer.getLocalBounds();return new Rectangle(new Vector(t.x,t.y),new Vector(t.x+t.width,t.y+t.height))}ignoreBounds(t=true){return t?(this.ƀhb||(this.ƀhb=this.pixiContainer.calculateBounds),this.pixiContainer.calculateBounds=()=>this.pixiContainer._bounds.clear()):this.ƀhb&&(this.pixiContainer.calculateBounds=this.ƀhb),this}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀgh}set mirror(t){this.ƀgh=t,this.ƀkg();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdc}set flip(t){this.ƀdc=t,this.ƀkg();}setScale(t){return this.scale=t,this}get scale(){return this.ƀii}set scale(t){this.ƀii=t,this.ƀkg();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀw}set aspectRatio(t){this.ƀw=t,this.ƀkg();}ƀkg(){this.pixiContainer.scale.set(this.ƀii,this.ƀii),this.ƀw<1?this.pixiContainer.scale.x*=this.ƀw:this.ƀw>1&&(this.pixiContainer.scale.y/=this.ƀw),this.ƀgh&&(this.pixiContainer.scale.x*=-1),this.ƀdc&&(this.pixiContainer.scale.y*=-1);}};var O=2,Et;(function(o){o[o.Normal=0]="Normal",o[o.Add=1]="Add",o[o.Screen=3]="Screen",o[o.Luminosity=16]="Luminosity",o[o.ColorDodge=7]="ColorDodge";})(Et||(Et={}));var fe=class{static{h(this,"GaussianValuesHelper");}static ƀdh(t,e){let i=e*e,r=1/(PI_360*i),s=-(t*t)/(2*i);return r*Math.exp(s)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),r=.005*i,s=NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<r)i-=l*2;else return true}),n=1/i,a=s.map(l=>l*n);return this.ƀbr(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=ArrayHelper.createIntegerArray(Math.ceil(t*.75)).map(r=>this.ƀdh(r,t*.4)),i=e.reduce((r,s)=>r+s,0);return i=i*2-e[0],e=e.map(r=>r/i),this.ƀbr(e)}}static ƀbr(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let r=t[i]+t[i+1],s=i+t[i+1]/r;e.push({offset:s,multiplier:r});}if(t.length%2===0){let i=t[t.length-1],r=t.length-1;e.push({offset:r,multiplier:i});}return e}};var Di=class ti extends V.Filter{static{h(this,"BlurFilterPass");}static ƀeh(){return `
1
+ import {Action,ActionLib,SingleEvent,IDAttachable,Variable,Attachable,Sequence,Reducer,SingleAction}from'actions-lib';import'reflect-metadata';import {Rectangle,Vector,Radian,Random,MapToWeakRefs,Comparator,NumberHelper,ArrayHelper,ColorHelper,PI_360,Queue,GridNeighborType,BinaryHeap,Grid,Line}from'helpers-lib';import U from'p2';import*as V from'pixi.js';import {RichTextSeparator}from'script-engine-lib';var hr=Object.defineProperty;var h=(o,t)=>hr(o,"name",{value:t,configurable:true});var G=class{static{h(this,"BardLegendsHardReset");}static{this.ƀes=new Action;}static{this.onHardReset=this.ƀes.notifier;}static hardReset(){ActionLib.hardReset(),this.ƀes.trigger();}};function d(){return function(o){let t=P.ƀec(o);o.$meta={paramtypes:t,type:"service"};}}h(d,"ServiceDecorator");var P=class{static{h(this,"Service");}static{this.ƀit=new Map;}static get(t){let e=this.ƀit.get(t);if(!e){if(!t.$meta)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let i=this.ƀif([],t.$meta.paramtypes);e=new t(...i),this.ƀit.set(t,e);}return e}static ƀec(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e}static ƀif(t,e){let i=[...t];if(e.length>t.length){let s=e.slice(t.length).map(n=>{if(n&&n.$meta?.type==="service")return this.get(n)});i.push(...s);}return i}};G.onHardReset.subscribe(()=>{P.ƀit=new Map;}).attachToRoot();var $=class{static{h(this,"ControllerLink");}constructor(){this.ƀbm=[],this.ƀid=[];}trigger(t,...e){let i=this.ƀbm.find(r=>!!r[t]);if(i)return i[t](...e);throw new Error(`ServiceLink: no defined function with the name: "${t}", found in the linked controllers!`)}registerController(t){Reflect.ownKeys(t.constructor.prototype).filter(e=>e!=="constructor").map(e=>e.toString()).forEach(e=>{if(this.ƀid.includes(e))throw new Error(`ServiceLink: the function is already registered, function name: "${e}"`);this.ƀid.push(e);}),this.ƀbm.push(t);}};function q(o){return function(t){let e=P.ƀec(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=P.ƀif([],e);i.some(s=>s===void 0)&&console.error(i,e,t.name);let r=new t(...i);o.controllerLink.registerController(r);}t.$meta={type:"controller"};}}h(q,"ControllerDecorator");var y=class o{static{h(this,"UpdateCycle");}static{this.ƀad=new Action;}static{this.beforeSceneUpdateAction=this.ƀad.notifier;}static{this.ƀil=new Action;}static{this.sceneUpdateAction=this.ƀil.notifier;}static{this.ƀf=new Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀjx=0;}static{this.ƀkf=void 0;}static wait(t){let e=this.ƀjx+t;return SingleEvent.create(i=>{let r=o.beforeSceneUpdateAction.subscribe(s=>{s.time>=e&&i();}).attachToRoot();return ()=>r.destroy()})}static registerUpdateModifier(t){if(!this.ƀkf)this.ƀkf=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀkf=void 0;}static triggerUpdateTick(t){this.ƀkf&&(t=this.ƀkf(this.ƀjx,t)),this.ƀjx+=t,this.ƀfr=t,t>0&&(o.ƀad.trigger({time:this.ƀjx,delta:t}),o.ƀil.trigger({time:this.ƀjx,delta:t}),o.ƀf.trigger({time:this.ƀjx,delta:t}));}static get lastDelta(){return this.ƀfr}static{this.ƀfr=0;}};G.onHardReset.subscribe(()=>{y.ƀad.clear(),y.ƀil.clear(),y.ƀf.clear(),y.ƀkf=void 0,y.ƀjx=0;}).attachToRoot();var _=class o{static{h(this,"EntityStoreHelper");}static{this.ƀaw=new Map;}static registerEntityClass(t){this.ƀaw.set(t.id,new Map);}static registerEntity(t){this.ƀaw.get(t.classID).set(t.id,t);}static unregisterEntity(t,e){let i=t.id;this.ƀaw.get(i)?.delete(e);}static getEntity(t,e){return this.ƀaw.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.ƀaw.get(t.id);return Array.from(e.values())}};G.onHardReset.subscribe(()=>{_.ƀaw.clear();}).attachToRoot();var rt=class o{static{h(this,"EntityViewsHelper");}static{this.ƀko=new Map;}static registerView(t,e){o.ƀko.has(e)||o.ƀko.set(e,[]);let i=o.ƀko.get(e);i&&i.push(t),_.getEntities(e).forEach(s=>{this.ƀch(s,t);});}static ƀch(t,e){try{let i=P.ƀif([this],e.$meta.paramtypes);o.entityID=t.id;let r=new e(t,...i.slice(1));t.destroyed?r.destroy():t.ƀkn.ƀkp.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀcw=t,this.ƀkp=[];}createViews(){if(!this.ƀcw.destroyed){let t=o.ƀko.get(this.ƀcw.constructor);t&&t.forEach(e=>{o.ƀch(this.ƀcw,e);});}}updateViews(t,e){for(let i=0;i<this.ƀkp.length;i++){let r=this.ƀkp[i];r.destroyed||r.update(t,e);}}destroyViews(){this.ƀkp.forEach(t=>{t.destroy();});}};G.onHardReset.subscribe(()=>{rt.ƀko=new Map;}).attachToRoot();function dt(){return function(o){o.$meta={type:"entity"},_.registerEntityClass(o);}}h(dt,"EntityDecorator");var z=class extends IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return _.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=_.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return _.getEntities(this)}constructor(){super(),this.ƀkn=new rt(this),_.registerEntity(this),y.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.update(t.time,t.delta),this.ƀkn.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀkn.destroyViews(),_.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀkn.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀkn.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀkn.createViews(),this}update(t,e){}};var ut=class extends z{static{h(this,"SingletonEntity");}static getInstance(){return _.getSingleton(this)}static getInstanceOrFail(){return _.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}"`)}};function gr(){return function(o){return o.$meta={paramtypes:P.ƀec(o),type:"scene"},o}}h(gr,"SceneDecorator");var St=class o extends IDAttachable{static{h(this,"Scene");}static{this.ƀik=false;}static{this.ƀb=new Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveScene(){return o.ƀb.value}static getActiveSceneOrFail(){if(!o.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return o.ƀb.value}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.ƀik)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(o.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=t[0];o.ƀik=true;let i=P.ƀif([],this.$meta.paramtypes),r=new this(...i).attachToRoot();return o.ƀb.set(r),r.init(e).map(()=>(o.ƀik=false,r)).chainToRoot()}constructor(){super(),this.ƀgn=new Action,this.onClose=this.ƀgn.notifier,y.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(o.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(o.ƀik)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");o.ƀik=true;let e=t[0];return this.prepareToClose().map(()=>(super.destroy(),o.ƀb.set(void 0),o.ƀik=false,this.ƀgn.trigger(e),e)).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};G.onHardReset.subscribe(()=>{St.ƀb.set(void 0);}).attachToRoot();function Ye(o){return function(t){t.$meta={paramtypes:P.ƀec(t),viewInstances:new Map,entity:o.entity,type:"view"},rt.registerView(t,o.entity);}}h(Ye,"ViewDecorator");var Wt=class extends IDAttachable{static{h(this,"View");}static getInstance(t){return this.$meta.entity.validateID(t)?this.$meta.viewInstances.get(t):void 0}static getInstanceOrFail(t){if(!this.$meta.entity.validateID(t))throw new Error(`View: getInstance is called with entity id: "${t}", that is not belonging to the class: "${this.$meta.entity}"`);let i=this.$meta.viewInstances.get(t);if(!i)throw new Error(`View: getInstanceOrFail is called with entity id: "${t}", that is not found!`);return i}constructor(){super(),this.attachToRoot(),this.ƀcx=rt.entityID,this.ƀei().set(this.ƀcx,this);}destroy(){this.destroyed||(super.destroy(),this.ƀei().delete(this.ƀcx));}update(t,e){}ƀei(){return this.constructor.$meta.viewInstances}};var f=class o{static{h(this,"P2JSHelper");}static aabbToBoundingBox(t){return Rectangle.fromRect({topLeft:{x:t.lowerBound[0],y:t.lowerBound[1]},bottomRight:{x:t.upperBound[0],y:t.upperBound[1]}})}static arrayToVector(t){return new Vector(t[0],t[1])}static vectorToArray(t){return [t.x,t.y]}static arePhysicsGroupsCollidable(t,e,i,r){return (t&r)!==0&&(i&e)!==0}static canCollideWith(t,e){return t.shapes.some(i=>e.shapes.some(r=>o.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new U.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var br=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},J=new $,Ct=class{static{h(this,"PhysicsInternalGateway");}createBody(t,e,i,r,s){return J.trigger("createBody",t,e,i,r,s)}getMaterial(t,e){return J.trigger("getMaterial",t,e)}getMaterialDefinition(t,e){return J.trigger("getMaterialDefinition",t,e)}getGroupConstant(t,e){return J.trigger("getGroupConstant",t,e)}getMaskConstant(t,e){return J.trigger("getMaskConstant",t,e)}addBody(t,e,i,r,s){return J.trigger("addBody",t,e,i,r,s)}removeBody(t,e){return J.trigger("removeBody",t,e)}subscribeToPhysicsStep(t,e){return J.trigger("subscribeToPhysicsStep",t,e)}};Ct=br([d()],Ct);var b=class o extends z{static{h(this,"PhysicsEntity");}static{this.ƀhc=new Map;}static{this.ƀhj=new Map;}static getFromP2BodyID(t){return o.ƀhc.get(t)}static getFromP2BodyIDOrFail(t){let e=o.ƀhc.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=o.ƀhj.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(o.ƀhj.values())}get area(){return this.ƀu}get mass(){return this.ƀgd}get collisions(){return this.ƀay}constructor(t,e,i){super(),this.ƀgo=new Action,this.onCollision=this.ƀgo.notifier,this.type="dynamic",this.ƀu=0,this.ƀgd=0,this.ƀay=[],this.physicsWorldID=t,this.ƀhl=P.get(Ct);let r=this.ƀhl.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀhl.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀhk=this.ƀhl.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀhm=this.ƀhl.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀhl.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀu=this.p2Body.getArea(),this.ƀgd=this.p2Body.mass,this.p2Body.position=f.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀhl.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.ƀhc.set(this.p2Body.id,this),o.ƀhj.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀhl.removeBody(this.physicsWorldID,this.p2Body),o.ƀhc.delete(this.p2Body.id),o.ƀhj.delete(this.id));}canCollideWith(t){return f.arePhysicsGroupsCollidable(this.ƀhk,this.ƀhm,t.ƀhk,t.ƀhm)}ƀiu(t){this.ƀay=t,t.length>0&&this.ƀgo.trigger(t);}};var Ut=class extends b{static{h(this,"ImmovablePhysicsEntity");}constructor(t,e){super(t,e,"static"),this.position=f.arrayToVector(this.p2Body.position),this.rotation=new Radian(this.p2Body.angle);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position,rotation:this.rotation,velocity:Vector.zero,rotationalSpeed:0}}};var Xe=class extends z{static{h(this,"MovableEntity");}constructor(){super(),this.position=new Variable(Vector.zero),this.rotation=new Variable(Radian.get0),this.velocity=new Variable(Vector.zero),this.rotationalSpeed=new Variable(0),y.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀjm(t,e);}).attach(this);}ƀjm(t,e){this.position.value=this.position.value.add(this.velocity.value.multiplyNumber(e)),this.rotation.value=new Radian(this.rotation.value.value+this.rotationalSpeed.value*e);}};var Ke=class extends b{static{h(this,"MovablePhysicsEntity");}constructor(t,e){super(t,e,"dynamic"),this.position=new Variable(Vector.zero),this.rotation=new Variable(Radian.get0),this.velocity=new Variable(Vector.zero),this.rotationalSpeed=new Variable(0),this.ƀez=false,this.ƀfa=false,this.ƀfc=false,this.ƀfb=false,this.ƀhg(),this.ƀfx(),P.get(Ct).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀjm(i,r)).attach(this);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position.value,rotation:this.rotation.value,velocity:this.velocity.value,rotationalSpeed:this.rotationalSpeed.value}}ƀjm(t,e){this.ƀez=true,this.ƀfa=true,this.ƀfc=true,this.ƀfb=true,this.ƀhg();}ƀhg(){this.position.value=f.arrayToVector(this.p2Body.position),this.rotation.value=new Radian(this.p2Body.angle),this.velocity.value=f.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀfx(){this.position.subscribe(t=>{this.ƀez?this.ƀez=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfa?this.ƀfa=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfc?this.ƀfc=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfb?this.ƀfb=false:this.p2Body.angularVelocity=t;}).attach(this);}};var Ze=10.8,Qe=10.01,tt;(function(o){o[o.Point=1]="Point",o[o.Circle=2]="Circle",o[o.Polygon=3]="Polygon",o[o.Rectangle=4]="Rectangle";})(tt||(tt={}));var st="border";var Y=class{static{h(this,"AnimationInterpolationFunctions");}static boomerangTime(t){return 1-Math.abs(t-.5)*2}static lineer(t){return t}static easeIn(t){return Math.pow(t,2)}static easeOut(t){return 1-Math.pow(1-t,2)}static easeInOut(t){return t<.5?2*t*t:(t-=1,1-2*t*t)}static easeInOutCubic(t){let e=2*t-2;return t<.5?4*Math.pow(t,3):(t-1)*Math.pow(e,2)+1}},Tr=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return Y.lineer(t)}},Er=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return Y.easeIn(t)}},Rr=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return Y.easeOut(t)}},Ir=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return Y.easeInOut(t)}},Ar=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return Y.easeInOutCubic(t)}},Ai=class{static{h(this,"AnimationFlicker");}start(){this.ƀjy=new Array(10).fill(0),Random.integerBetween(0,9),this.ƀjy[Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(Random.integerBetween(0,9),this.ƀjy[Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(Random.integerBetween(0,9),this.ƀjy[Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀjy[e]}},S=class{static{h(this,"Animations");}static{this.lineer=new Tr;}static{this.easeIn=new Er;}static{this.easeOut=new Rr;}static{this.easeInOut=new Ir;}static{this.easeInOutCubic=new Ar;}};var F;(function(o){o[o.ThrowError=1]="ThrowError",o[o.IgnoreNewAnimation=2]="IgnoreNewAnimation",o[o.CompletePrevious=3]="CompletePrevious";})(F||(F={}));var R;(function(o){o[o.ReturnToOriginal=1]="ReturnToOriginal",o[o.StayInCurrentState=2]="StayInCurrentState",o[o.JumpToEnd=3]="JumpToEnd",o[o.Loop=4]="Loop";})(R||(R={}));var A=class o{static{h(this,"Animator");}static{this.ƀk=new WeakMap;}static ƀdj(t){let e=o.ƀk.get(t);return e||(e=new MapToWeakRefs,o.ƀk.set(t,e)),e}get animating(){return this.ƀgx!==void 0}get target(){return this.ƀjp}get value(){return this.ƀkh||(this.ƀkh=new Variable(this.ƀjp)),this.ƀkh.notifier}constructor(t,e,i){this.ƀfl=false,this.ƀjb=false,this.ƀjp=t,this.ƀha={duration:200,animation:S.lineer,reAnimateHandling:F.ThrowError,completionHandling:R.StayInCurrentState,...i},this.ƀl=Comparator.isArray(e)?e:[e],this.ƀfy(t,this.ƀl);}animate(t,e){let i={...this.ƀha,...e},r=this.ƀgx;if(this.ƀgx)switch(i.reAnimateHandling){case F.ThrowError:throw new Error("Animator: new animation triggered while another is not complete yet.");case F.IgnoreNewAnimation:return SingleEvent.instant();case F.CompletePrevious:this.ƀiv(i.completionHandling,this.ƀgx.ƀhv,true);break;default:{throw new Error(`Animator: unknown re-animate handling type: "${i.reAnimateHandling}"`)}}return SingleEvent.create(n=>{this.ƀfl&&(this.ƀjb=true);let a=this.ƀl.reduce((c,p)=>(c[p]={ƀjj:this.ƀjp[p],ƀjr:t[p]},c),{}),l={ƀcs:i.duration,ƀct:0,ƀhv:a,ƀbf:i.completionHandling,ƀm:i.animation,ƀbe:n};if(l.ƀbf!==R.Loop&&this.ƀfj(l)){this.ƀgx=void 0,n(),r?.ƀbe(),this.ƀgx||(this.ƀke?.destroy(),this.ƀke=void 0);return}else l.ƀm.start();return this.ƀgx=l,this.ƀcv(),r?.ƀbe(),()=>{this.ƀgx===l&&(this.ƀjp instanceof Attachable&&this.ƀjp.destroyed||this.ƀiv(l.ƀbf,l.ƀhv,true),this.ƀgx=void 0,this.ƀke?.destroy(),this.ƀke=void 0);}})}set(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r]&&(e=true,this.ƀjp[r]=t[r]);}e&&this.ƀkh?.set(this.ƀjp),this.ƀgx?.ƀbe();}completeAnimation(t){if(this.ƀgx){t=t??this.ƀgx.ƀbf,this.ƀiv(t,this.ƀgx.ƀhv,true);let e=this.ƀgx.ƀbe;this.ƀgx=void 0,e();}}ƀcv(){this.ƀke||(this.ƀke=y.beforeSceneUpdateAction.subscribe(t=>{this.ƀfl=true;try{let e=this.ƀgx;if(!e)return;e.ƀct+=t.delta;let i=e.ƀct>=e.ƀcs;if(i)if(e.ƀbf===R.Loop)e.ƀct%=e.ƀcs,e.ƀm.start(),i=!1;else {this.ƀiv(e.ƀbf,e.ƀhv,!1),this.ƀgx=void 0,e.ƀbe(),this.ƀgx||(this.ƀke?.destroy(),this.ƀke=void 0);return}if(!i){let r=e.ƀm.multiplierFunction(e.ƀct/e.ƀcs),s=!1;for(let n=0;n<this.ƀl.length;n++){let a=this.ƀl[n],l=e.ƀhv[a],p=(l.ƀjr-l.ƀjj)*r+l.ƀjj;p!==this.ƀjp[a]&&(s=!0,this.ƀjp[a]=p);}s&&this.ƀkh?.set(this.ƀjp);}}finally{this.ƀfl=false,this.ƀjb&&(this.ƀjb=false,this.ƀke?.destroy(),this.ƀke=void 0,this.ƀcv());}}).attachToRoot());}ƀfj(t){for(let e=0;e<this.ƀl.length;e++){let i=this.ƀl[e];if(this.ƀjp[i]!==t.ƀhv[i].ƀjr)return false}return true}ƀiv(t,e,i){switch(t){case R.ReturnToOriginal:this.ƀih(e);break;case R.StayInCurrentState:i||this.ƀfo(e);break;case R.JumpToEnd:this.ƀfo(e);break;case R.Loop:this.ƀih(e);break;default:{throw new Error(`Animator: unknown completion handling type: "${t}"`)}}}ƀih(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r].ƀjj&&(e=true,this.ƀjp[r]=t[r].ƀjj);}e&&this.ƀkh?.set(this.ƀjp);}ƀfo(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r].ƀjr&&(e=true,this.ƀjp[r]=t[r].ƀjr);}e&&this.ƀkh?.set(this.ƀjp);}ƀfy(t,e){let i=o.ƀdj(t);for(let r of e){if(i.has(r))throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(t,void 0,2)}", Property: "${r}"`);i.set(r,this);}}};var $t;(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";})($t||($t={}));var qe;(function(o){o.Default="default",o.Pointer="pointer";})(qe||(qe={}));var ue=class extends IDAttachable{static{h(this,"ContainerAttributes");}constructor(){super(),this.ƀgh=false,this.ƀdc=false,this.ƀii=1,this.ƀw=1,this.pixiContainer=new V.Container;}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new Vector(this.pixiContainer.width,this.pixiContainer.height)}setSize(t){return this.pixiContainer.width=t.x,this.pixiContainer.height=t.y,this}setPosition(t,e){if(e?.holdFrom){let i=this.pixiContainer.getLocalBounds(),r=new Vector(this.pixiContainer.scale.x,this.pixiContainer.scale.y),s=new Vector(i.x,i.y).multiply(r),n=new Vector(i.width,i.height).multiply(r),a=s.add(n.multiply(e.holdFrom));t=t.subtract(a);}return e?.round!==false&&(t=t.round({rollHalfsDown:true})),this.position=t,this}get position(){return new Vector(this.pixiContainer.x,this.pixiContainer.y)}set position(t){this.pixiContainer.position=t;}get x(){return this.pixiContainer.x}set x(t){this.pixiContainer.x=t;}get y(){return this.pixiContainer.y}set y(t){this.pixiContainer.y=t;}on(t){return Sequence.create(e=>{let i=h(r=>e(),"handle");return this.pixiContainer.on(t,i),()=>this.pixiContainer.off(t,i)})}setRotation(t){return this.rotation=t,this}get rotation(){return new Radian(this.pixiContainer.rotation)}set rotation(t){this.pixiContainer.rotation=t.value;}get rotationValue(){return this.rotation.value}set rotationValue(t){this.rotation=new Radian(t);}setZIndex(t){return this.zIndex=t,this}get zIndex(){return this.pixiContainer.zIndex}set zIndex(t){this.pixiContainer.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new Radian(this.pixiContainer.skew.x)}set skewX(t){this.pixiContainer.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new Radian(this.pixiContainer.skew.y)}set skewY(t){this.pixiContainer.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.pixiContainer.sortableChildren}set sortableChildren(t){this.pixiContainer.sortableChildren=t;}setAlpha(t){return this.pixiContainer.alpha=t,this}get alpha(){return this.pixiContainer.alpha}set alpha(t){this.pixiContainer.alpha=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.pixiContainer.interactive}set interactive(t){t?this.pixiContainer.eventMode="dynamic":this.pixiContainer.eventMode="none";}setCursor(t){return this.cursor=t,this}get cursor(){return this.pixiContainer.cursor}set cursor(t){this.pixiContainer.cursor=t;}getMask(){throw new Error("ContainerAttributes: mask is not available!")}setMask(t){return t?(this.pixiContainer.addChild(t.pixiContainer),this.pixiContainer.mask=t.getMask(),this.ƀgb=t):(this.ƀgb&&this.pixiContainer.removeChild(this.ƀgb.pixiContainer),this.pixiContainer.mask=null),this}hitTest(t){if(this.pixiContainer.parent)if(this.pixiContainer.hitArea){let e=this.pixiContainer.toLocal(t);return this.pixiContainer.hitArea.contains(e.x,e.y)}else return this.pixiContainer.getBounds().contains(t.x,t.y);else return false}get boundingBox(){let t=this.pixiContainer.getLocalBounds();return new Rectangle(new Vector(t.x,t.y),new Vector(t.x+t.width,t.y+t.height))}ignoreBounds(t=true){return t?(this.ƀhb||(this.ƀhb=this.pixiContainer.calculateBounds),this.pixiContainer.calculateBounds=()=>this.pixiContainer._bounds.clear()):this.ƀhb&&(this.pixiContainer.calculateBounds=this.ƀhb),this}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀgh}set mirror(t){this.ƀgh=t,this.ƀkg();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdc}set flip(t){this.ƀdc=t,this.ƀkg();}setScale(t){return this.scale=t,this}get scale(){return this.ƀii}set scale(t){this.ƀii=t,this.ƀkg();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀw}set aspectRatio(t){this.ƀw=t,this.ƀkg();}ƀkg(){this.pixiContainer.scale.set(this.ƀii,this.ƀii),this.ƀw<1?this.pixiContainer.scale.x*=this.ƀw:this.ƀw>1&&(this.pixiContainer.scale.y/=this.ƀw),this.ƀgh&&(this.pixiContainer.scale.x*=-1),this.ƀdc&&(this.pixiContainer.scale.y*=-1);}};var O=2,Et;(function(o){o[o.Normal=0]="Normal",o[o.Add=1]="Add",o[o.Screen=3]="Screen",o[o.Luminosity=16]="Luminosity",o[o.ColorDodge=7]="ColorDodge";})(Et||(Et={}));var fe=class{static{h(this,"GaussianValuesHelper");}static ƀdh(t,e){let i=e*e,r=1/(PI_360*i),s=-(t*t)/(2*i);return r*Math.exp(s)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),r=.005*i,s=NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<r)i-=l*2;else return true}),n=1/i,a=s.map(l=>l*n);return this.ƀbr(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=ArrayHelper.createIntegerArray(Math.ceil(t*.75)).map(r=>this.ƀdh(r,t*.4)),i=e.reduce((r,s)=>r+s,0);return i=i*2-e[0],e=e.map(r=>r/i),this.ƀbr(e)}}static ƀbr(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let r=t[i]+t[i+1],s=i+t[i+1]/r;e.push({offset:s,multiplier:r});}if(t.length%2===0){let i=t[t.length-1],r=t.length-1;e.push({offset:r,multiplier:i});}return e}};var Di=class ti extends V.Filter{static{h(this,"BlurFilterPass");}static ƀeh(){return `
2
2
  attribute vec2 aVertexPosition;
3
3
  attribute vec2 aTextureCoord;
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bard-legends-framework",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Bard Legends Framework",
5
5
  "main": "dist/index.js",
6
6
  "publishConfig": {