@kayelaa/canvas 0.1.6 → 0.1.7
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.cjs +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/dist/jsx-dev-runtime.d.cts +1 -1
- package/dist/jsx-dev-runtime.d.ts +1 -1
- package/dist/jsx-runtime.d.cts +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/{kayla-internals-Cad69KZq.d.ts → kayla-internals-KKhcrA30.d.ts} +36 -36
- package/dist/{kayla-internals-SFvqkItz.d.cts → kayla-internals-k7GMYD9t.d.cts} +36 -36
- package/dist/kayla.d.cts +15 -2
- package/dist/kayla.d.ts +15 -2
- package/package.json +1 -1
- package/dist/kayla-B9aCkyUt.d.cts +0 -52
- package/dist/kayla-BsyWegde.d.ts +0 -52
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var $=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var Ke=Object.prototype.hasOwnProperty;var G=(n,e)=>{for(var t in e)$(n,t,{get:e[t],enumerable:!0})},Ie=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Re(e))!Ke.call(n,s)&&s!==t&&$(n,s,{get:()=>e[s],enumerable:!(r=Se(e,s))||r.enumerable});return n};var ke=n=>Ie($({},"__esModule",{value:!0}),n);var Oe={};G(Oe,{Kayla:()=>B,LEA:()=>V,default:()=>Ne});module.exports=ke(Oe);var V={};G(V,{DeltaTweenII:()=>O,ENVIRONMENT:()=>j,GEmitterMemory:()=>W,LeaEntityII:()=>I,LeaEventEmitter:()=>w,LeaGameII:()=>_,LeaRendererII:()=>A,LeaSceneII:()=>F,LeaSerializers:()=>J,LeaTickerII:()=>N,LeaTimeout:()=>z,LeaUtilsII:()=>v,LiaAudio:()=>k,LiaAudioSrc:()=>K,LiaOscSFX:()=>T,LiaSFXMap:()=>Le,NOTE_NAMES:()=>te,RectLeaEntity:()=>L,Vector2:()=>S,colToRGBA:()=>Me,defaultSFXConfig:()=>ne,editRGBA:()=>Ae,generateUUID:()=>ue,getAvoidAngle:()=>he,getEnvironment:()=>ee,getNormalizedColor:()=>Pe,getRayHit:()=>le,isInitiallyMobile:()=>Ge,isMobile:()=>pe,isNode:()=>D,isNote:()=>_e,isWeb:()=>E,parseFillStyle:()=>Z,raycastAvoid:()=>Ve,scaleCoord:()=>Fe,setAnimInterval:()=>ce,sfxHit:()=>oe,sfxJump:()=>ie,sfxLaser:()=>ae,sfxUIClick:()=>re,sfxUIHover:()=>se,shortUID:()=>De,tinyUID:()=>Y});var w=class{#e=new Map;constructor(){this.#e=new Map}on(e,t){let r=this.#e.get(e)||[];return r.push(t),this.#e.set(e,r),this}once(e,t){let r=(...s)=>{this.off(e,r),t(...s)};return this.on(e,r),this}off(e,t){let r=this.#e.get(e);if(!r)return this;let s=r.indexOf(t);return s>=0&&r.splice(s,1),this}emit(e,...t){let r=this.#e.get(e);if(!r||r.length===0){if(e==="error")throw t[0];return!1}return r.slice().forEach(s=>s(...t)),!0}removeAllListeners(e){return e?this.#e.delete(e):this.#e.clear(),this}listenerCount(e){return this.#e.get(e)?.length??0}},A=class extends w{canvas;ctx;running;_rafId;_fps;_frameCount;_fpsTimer;_lastFrameTime;constructor(e,{viewportWidth:t,viewportHeight:r,cameraWidth:s,cameraHeight:o}={}){if(!E)throw new Error("Web-Only");super(),this.canvas=e,this.ctx=e.getContext("2d"),this.automatic=!0,this.#e=t??e.width,this.#t=r??e.height,this.#n=s??e.width,this.#r=o??e.height,this.running=!1,this._rafId=null,this._loop=this._loop.bind(this),this.updateCanvasResolution(),this._fps=60,this._frameCount=0,this._fpsTimer=0}automatic;retransform(){this.ctx.setTransform(1,0,0,1,0,0);let e=this.#n/this.#e,t=this.#r/this.#t;this.ctx.translate(this.#n/2,this.#r/2),this.ctx.scale(e,t),this.ctx.translate(-this.#e/2,-this.#t/2)}#e=0;#t=0;#n=0;#r=0;get viewportWidth(){return this.#e}set viewportWidth(e){this.#e=e,this.retransform()}get width(){return this.#e}get height(){return this.#t}get centerX(){return this.#e/2}get centerY(){return this.#t/2}get left(){return 0}get top(){return 0}get right(){return this.#e}get bottom(){return this.#t}get viewportHeight(){return this.#t}set viewportHeight(e){this.#t=e,this.retransform()}get cameraWidth(){return this.#n}set cameraWidth(e){this.#n=e,this.updateCanvasResolution(),this.retransform()}get cameraHeight(){return this.#r}set cameraHeight(e){this.#r=e,this.updateCanvasResolution(),this.retransform()}updateCanvasResolution(){this.canvas.width=this.#n,this.canvas.height=this.#r}applyTransform(){this.retransform()}get FPS(){return this._fps}_loop(){this.automatic&&this.update(),this._rafId=requestAnimationFrame(this._loop)}update(){if(!this.running||!E)return;let e=performance.now(),t=(e-(this._lastFrameTime??e))/1e3;this._lastFrameTime=e,this._frameCount++,this._fpsTimer+=t,this._fpsTimer>=1&&(this._fps=Math.round(this._frameCount/this._fpsTimer),this._frameCount=0,this._fpsTimer=0),this.ctx.clearRect(0,0,this.#n,this.#r),this.emit("draw",this.ctx)}start(){if(!this.running){if(!E||typeof globalThis.requestAnimationFrame>"u")throw new Error("Raf is not supported");this.running=!0,this._rafId=requestAnimationFrame(this._loop)}}stop(){if(!E||typeof globalThis.requestAnimationFrame>"u")throw new Error("Raf is not supported");this.running=!1,this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null)}},N=class extends w{setNow(e){this.#e=e}#e=0;__intervalId=null;__lastTime=0;constructor(e=16){super(),this.#t=e,this.speedHackDT=1}speedHackDT;get isRaf(){return this.tickInterval===1/0}#t=15;get tickInterval(){return this.#t}set tickInterval(e){this.#t=e,this.__intervalId&&(this.stop(),this.start())}now(){return this.#e}__tick(){let e=performance.now(),t=(e-this.__lastTime)/1e3*this.speedHackDT;this.__lastTime=e,this.#e+=t*1e3,this.emit("tick",t)}createTimeout(e){return new z(e,this)}createTween(e,t=()=>{}){let r=new O(e),s=(o=0)=>{if(r.finished){this.off("tick",s);return}r.update(o)};return r.on("finish",()=>{this.off("tick",s)}),r.on("delta",o=>{t(o)}),this.on("tick",s),r}start(){this.__intervalId===null&&(this.__lastTime=performance.now(),this.__intervalId=E&&!isFinite(this.tickInterval)?ce(()=>this.__tick()).clear:setInterval(()=>this.__tick(),this.tickInterval))}stop(){this.__intervalId!==null&&(typeof this.__intervalId=="function"?this.__intervalId():clearInterval(this.__intervalId)),this.__intervalId=null}getSineMod(e,t=0){return .5+.5*Math.sin((this.now()%e/e+t)*2*Math.PI)}},J;(p=>{function n(a){return a===!0?1:0}p.booleanExport=n;function e(a){return a===0?!1:a===1}p.booleanImport=e;function t(a){return`${a.x}|${a.y}`}p.vec2Export=t;function r(a){let[f,b]=a.split("|"),x=parseFloat(f),R=parseFloat(b);if(isNaN(x)||isNaN(R))throw new Error(`Invalid Vector2 string: ${a}`);return new S(x,R)}p.vec2Import=r,p.booleanMap={mapExport:n,mapImport:e};function o(a){return f=>Number(f.toFixed(a))}p.createRounder=o;function l(a=10){return{mapExport(f){return Math.round(f/a)},mapImport(f){return f*a}}}p.createLowPrecision=l;function h(a){return Math.round(a)}p.lightWeightRounder=h;function u(a=100){return{mapExport(f){return Math.round(f*a)},mapImport(f){return f/a}}}p.createPercent=u;function c(a){let f=new Map(Object.entries(a));return{mapExport:b=>f.get(b)??null,mapImport:b=>Array.from(f.entries()).find(([x,R])=>R===b)?.[0]??null}}p.createLookup=c;function d(a){let f=a*(180/Math.PI);return Math.round((f%360+360)%360)}p.radToDeg=d;function y(a){return a*(Math.PI/180)}p.degToRad=y,p.angleRadToDeg={mapExport:d,mapImport:y};function i(a=10){let f=l(a);return{mapExport(b){return f.mapExport(d(b))},mapImport(b){return f.mapImport(y(b))}}}p.createLowPrecisionRadToDeg=i})(J||={});var I=class n extends w{name="";scaleRotate=0;scale=1;constructor(e,t=0,r=0){super(),this.autoTranslate=!1,this.name=e,this.z=0,this.___pos=new S(t,r),this.nonSerializableProperties=[],this.nonSerializableProperties.push("___pos","autoTranslate","arraySerializeMap"),this.forceSerializableProperties=[],this.forceSerializableProperties.push("x","y")}arraySerializeMap;autoTranslate;z;___pos;nonSerializableProperties;forceSerializableProperties;get pos(){return this.___pos}get x(){return this.pos.x}get y(){return this.pos.y}set x(e){this.pos.x=e}set y(e){this.pos.y=e}handleUpdate(e){if(this.update)try{this.emit("update",e),this.update(e)}catch(t){this.emit("error",t)}}handleDraw(e){if(!(D||!this.draw)){e.save(),this.autoTranslate&&e.translate(this.x,this.y);try{this.emit("draw",e),this.draw(e)}catch(t){this.emit("error",t)}e.restore()}}serialize(){if(Array.isArray(this.arraySerializeMap))return this.arraySerializeMap.map(([s,{mapExport:o}])=>{let l=Reflect.get(this,s);return o?o(l):l});let e=["_events","_eventsCount","_maxListeners","nonSerializableProperties","forceSerializableProperties"],t=[...Reflect.ownKeys(this),...this.forceSerializableProperties].filter(s=>!this.nonSerializableProperties.includes(s)&&!e.includes(s.toString())),r=Object.fromEntries(t.map(s=>{let o=Reflect.get(this,s);if(D&&typeof o=="number"){let l=o.toString().split("."),u=(l[1]?l[1].length:0)>2?Number(o.toFixed(2)):o;return[s,u]}return[s,o]}));return JSON.parse(JSON.stringify(r))}toLocal(e){return e.subtract(this.pos)}toWorld(e){return e.add(this.pos)}deserializeArray(e){return n.deserializeArray(this.arraySerializeMap,e)}static deserializeArray(e,t){if(!e||!Array.isArray(t))return t;let r={};for(let s=0;s<t.length;s++){let o=e[s];if(!o)break;let[l,{mapImport:h}]=o,u=t[s];if(h&&(u=h(u)),typeof l!="string")break;try{Reflect.set(r,l,u)}catch(c){console.error(c)}}return r}},F=class extends w{name="";entities=new Map;paused=!0;constructor(e){super(),this.name=e}handleUpdate(e){if(!this.paused){this.emit("update",e);for(let t of this.entities.values())t.handleUpdate(e)}}handleDraw(e){if(!D&&!this.paused){this.emit("draw",e);for(let t of[...this.entities.values()].sort((r,s)=>r.z-s.z))t.handleDraw(e)}}addEntity(e){if(!(e instanceof I))throw new Error("invalid entity");if(!e.name)throw new Error("Entity must have a name.");this.entities.set(e.name,e)}removeEntity(e){if(!(e instanceof I))throw new Error("invalid entity");this.entities.delete(e.name)}getEntity(e){return this.entities.get(e)}},_=class{scenes;ticker;get centerX(){return this.width/2}get centerY(){return this.height/2}get left(){return 0}get top(){return 0}get right(){return this.width}get bottom(){return this.height}width;height;constructor(e,t,r=16){this.ticker=new N(r),this.scenes=new Map,this.width=e,this.height=t,this.ticker.on("tick",s=>{for(let o of this.scenes.values())o.paused||o.handleUpdate(s)})}addScene(e){if(!e.name)throw new Error("Scene must have a name.");e.paused=!1,this.scenes.set(e.name,e)}removeScene(e){e&&(e.paused=!0),this.scenes.delete(e.name)}now(){return this.ticker.now()}start(){this.ticker.start()}stop(){this.ticker.stop()}},v={lerp(n,e,t){return n+(e-n)*t},clamp(n,e,t){return Math.min(t,Math.max(e,n))},clamp01(n){return Math.min(1,Math.max(0,n))},easeLinear(n){return n},easeInQuad(n){return n*n},easeOutQuad(n){return 1-(1-n)*(1-n)},easeInOutQuad(n){return n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2},easeInSine(n){return 1-Math.cos(n*Math.PI/2)},easeOutSine(n){return Math.sin(n*Math.PI/2)},easeInOutSine(n){return-(Math.cos(Math.PI*n)-1)/2},easeInExpo(n){return n===0?0:Math.pow(2,10*n-10)},easeOutExpo(n){return n===1?1:1-Math.pow(2,-10*n)},easeInOutExpo(n){return n===0?0:n===1?1:n<.5?Math.pow(2,20*n-10)/2:(2-Math.pow(2,-20*n+10))/2},smoothstep(n){return n=v.clamp(n,0,1),n*n*(3-2*n)},randomLerp(n,e){return v.lerp(n,e,Math.random())},randomInt(n,e){return Math.floor(Math.random()*(e-n+1))+n},randomArrayValue(n){return n[v.randomInt(0,n.length-1)]},createBezier(n,e,t,r){function s(h,u,c,d,y){let m=1-h;return m*m*m*u+3*m*m*h*c+3*m*h*h*d+h*h*h*y}function o(h,u,c,d,y){let m=1-h;return 3*m*m*(c-u)+6*m*h*(d-c)+3*h*h*(y-d)}function l(h){let u=h;for(let c=0;c<6;c++){let d=s(u,0,n,t,1),y=o(u,0,n,t,1);if(y===0)break;u-=(d-h)/y}return v.clamp(u,0,1)}return function(u){u=v.clamp(u,0,1);let c=l(u);return s(c,0,e,r,1)}},lengthSquared(...n){return n.reduce((e,t)=>e+t*t,0)},normalizeRad(n){let e=2*Math.PI;return n=n%e,n<0&&(n+=e),n},angleInvertY(n){return v.normalizeRad(-n)},degToRadFlipY(n){return v.angleInvertY(n*Math.PI/180)},minimalAngularDirection(n,e){n=v.normalizeRad(n),e=v.normalizeRad(e);let t=v.normalizeRad(e-n),r=v.normalizeRad(n-e);return t<=r?1:-1}},O=class extends w{constructor({delta:e,ms:t,easing:r}){super(),this.delta=e,this.duration=t,this.elapsed=0,this.easing=r??(s=>s),this.lastValue=0,this.finished=!1}delta;duration;elapsed;lastValue;finished;easing;update(e){this.elapsed+=e*1e3;let t=v.clamp(this.elapsed/this.duration,0,1),r=this.easing(t),s=this.delta*r,o=s-this.lastValue;this.lastValue=s,this.emit("delta",o),t>=1&&(this.finished=!0,this.emit("finish",void 0))}},L=class extends I{constructor(e,t=0,r=0,s=50,o=50){super(e,t,r),this.width=s,this.height=o}width;height;get left(){return this.x-this.width/2}set left(e){this.x=e+this.width/2}get right(){return this.x+this.width/2}set right(e){this.x=e-this.width/2}get top(){return this.y-this.height/2}set top(e){this.y=e+this.height/2}get bottom(){return this.y+this.height/2}set bottom(e){this.y=e-this.height/2}get lx(){return 0}get ly(){return 0}get lleft(){return-this.width/2}get lright(){return this.width/2}get ltop(){return-this.height/2}get lbottom(){return this.height/2}isCollidingWith(e){return!(this.right<e.left||this.left>e.right||this.bottom<e.top||this.top>e.bottom)}color="rgba(0, 0, 255, 0.3)";draw(e){e.translate(this.x,this.y),e.rotate(this.scaleRotate),e.fillStyle=this.color,e.fillRect(-this.width/2,-this.height/2,this.width,this.height)}},z=class extends w{duration;ticker;elapsed;finished;_resolve;promise;_timeoutId;constructor(e,t=null){super(),this.duration=e,this.ticker=t,this.elapsed=0,this.finished=!1,this._resolve=null,this.promise=new Promise(r=>this._resolve=r),this.update=this.update.bind(this),this.ticker&&this.ticker.on("tick",this.update)}update(e=0){this.finished||(this.elapsed+=e*1e3,this.elapsed>=this.duration&&this.finish())}finish(){this.finished||(this.finished=!0,this.emit("finish",void 0),this._resolve&&this._resolve(),this.ticker&&this.ticker.off("tick",this.update))}start(){return this.ticker||(this._timeoutId=setTimeout(()=>this.finish(),this.duration)),this}cancel(){this.finished||(this.finished=!0,!this.ticker&&this._timeoutId!=null&&clearTimeout(this._timeoutId),this.ticker&&this.ticker.off("tick",this.update))}then(e,t){return this.promise.then(e,t)}after(e,t){return this.promise.then(e,t)}},S=class n{constructor(e=0,t=0){this.x=e,this.y=t}x;y;toJSON(){return{x:this.x,y:this.y,vec2:!0}}static isVec2(e){return e&&typeof e=="object"&&"x"in e&&"y"in e&&e.vec2===!0}static fromSerialized(e){return this.isVec2(e)?new this(e.x,e.y):null}rotate(e){let t=Math.cos(e),r=Math.sin(e);return new n(this.x*t-this.y*r,this.x*r+this.y*t)}static from(e){return new n(Math.cos(e),Math.sin(e))}get angle(){return Math.atan2(this.y,this.x)}get length(){return Math.hypot(this.x,this.y)}get lengthSquared(){return this.x*this.x+this.y*this.y}normalized(){let e=this.length;return e===0?new n(0,0):new n(this.x/e,this.y/e)}project(e){return e.scale(this.dotNormalized(e))}reflect(e){let t=this.dot(e);return this.subtract(e.scale(2*t))}dotNormalized(e){let t=this.normalized(),r=e.normalized();return t.x*r.x+t.y*r.y}lengthSquaredTo(e){let t=this.x-e.x,r=this.y-e.y;return t*t+r*r}dot(e){return this.x*e.x+this.y*e.y}distanceTo(e){return Math.hypot(this.x-e.x,this.y-e.y)}distanceToCheap(e){let t=this.x-e.x,r=this.y-e.y;return t*t+r*r}directionTo(e){return new n(e.x-this.x,e.y-this.y).normalized()}add(e){return new n(this.x+e.x,this.y+e.y)}addRaw(e){return new n(this.x+e,this.y+e)}overwite(e){this.x=e.x,this.y=e.y}subtract(e){return new n(this.x-e.x,this.y-e.y)}scale(e){return new n(this.x*e,this.y*e)}toString(){return`Vector2(${this.x}, ${this.y})`}clone(){return new n(this.x,this.y)}};function Pe(n){let e=/^rgba?\(([^)]+)\)$/,t=n.match(e);if(t){let[r,s,o,l=1]=t[1].split(",").map(h=>parseFloat(h));return{r:Math.max(0,Math.min(255,Math.floor(r))),g:Math.max(0,Math.min(255,Math.floor(s))),b:Math.max(0,Math.min(255,Math.floor(o))),a:Math.max(0,Math.min(1,Math.floor(l*255)/255))}}return Z(n)}function Me(n){return`rgba(${n.r}, ${n.g}, ${n.b}, ${n.a})`}function Z(n){if(n=n.trim().toLowerCase(),n[0]==="#"){let t,r,s;if(n.length===7)t=parseInt(n.slice(1,3),16),r=parseInt(n.slice(3,5),16),s=parseInt(n.slice(5,7),16);else if(n.length===4)t=parseInt(n[1]+n[1],16),r=parseInt(n[2]+n[2],16),s=parseInt(n[3]+n[3],16);else throw new Error("Invalid hex color");return{r:t,g:r,b:s,a:1}}let e=n.match(/^rgba?\s*\(\s*(\d+)[, ]\s*(\d+)[, ]\s*(\d+)(?:[, ]\s*([\d.]+))?\s*\)$/);if(e)return{r:parseInt(e[1]),g:parseInt(e[2]),b:parseInt(e[3]),a:e[4]!==void 0?parseFloat(e[4]):1};throw new Error("Unsupported fillStyle format")}function Ae(n,{r:e,g:t,b:r,a:s}={}){let[o,l,h,u,c]=n.match(/rgba?\((\d+),\s*(\d+),\s*(\d+),?\s*([\d.]*)\)?/)||[];return`rgba(${e??l}, ${t??h}, ${r??u}, ${s??(c||1)})`}function Fe(n,e,t){return t+(n-t)*e}function ee(){return typeof process<"u"&&process.release?.name==="node"?"node":typeof window<"u"||typeof self<"u"?"web":"unknown"}var j=ee(),D=j==="node",E=j==="web",k=class n{static unlock(){E&&this.audioCtx.state!=="running"&&this.audioCtx.resume()}static audioCtx=E?new AudioContext:null;static masterGain=E?this.audioCtx.createGain():null;static musicGain=E?this.audioCtx.createGain():null;static sfxGain=E?this.audioCtx.createGain():null;static{E&&(this.masterGain.gain.value=1,this.musicGain.gain.value=1,this.sfxGain.gain.value=1,this.sfxGain.connect(this.masterGain),this.musicGain.connect(this.masterGain),this.masterGain.connect(this.audioCtx.destination))}static get SFX_VOLUME(){return this.sfxGain.gain.value}static get MUSIC_VOLUME(){return this.musicGain.gain.value}static get VOLUME(){return this.masterGain.gain.value}static set SFX_VOLUME(e){this.sfxGain.gain.value=e}static set MUSIC_VOLUME(e){this.musicGain.gain.value=e}static set VOLUME(e){this.masterGain.gain.value=e}static noteToHz(e){return this.tuningFreq*Math.pow(2,(e-9)/12)}static tuningFreq=440;static audioBufferCache=new Map;static loops=new Map;static sfsx=new Map;static loopIdCounter=0;static CACHE_NAME="lia-audio-cache-v1";static async preLoad(e){if(this.audioBufferCache.has(e))return this.audioBufferCache.get(e);let t=n.CACHE_NAME,r,s;if(typeof caches<"u"&&(s=await caches.open(t),r=await s.match(e)),!r){if(r=await fetch(e),!r.ok)throw new Error(`Failed to fetch ${e}`);s&&await s.put(e,r.clone())}let o=await r.arrayBuffer(),l=await this.audioCtx.decodeAudioData(o);return this.audioBufferCache.set(e,l),l}static async getOnlyDownloadedCache(e){let t=n.CACHE_NAME;return await(await caches.open(t)).match(e)}static getCached(e){return this.audioBufferCache.get(e)||null}static async playSound(e,t=.2,r=1,s=!0){try{this.sfsx.has(e)&&this.sfsx.get(e).source.stop(),this.audioBufferCache.has(e)||await this.preLoad(e);let o=this.getCached(e);if(!o)return;let l=new K(o);l.buffer=o;let h=1-.12,u=1+.12;l.playbackRate=r??h+Math.random()*(u-h);let c=this.audioCtx.createGain();c.gain.value=t,l.tempGain=c,l.connect(c),c.connect(this.sfxGain),l.onended=()=>{l.disconnect(),c.disconnect()},l.start(),s&&this.sfsx.set(e,{source:l,gain:c})}catch(o){console.error(o)}}static async playLoop(e,t=1,{loopStart:r=0,loopEnd:s=null,exclusive:o=!0,skipMS:l=0}={}){if(o)for(let y of this.loops.keys())this.stopLoop(y);this.audioBufferCache.has(e)||await this.preLoad(e);let h=this.getCached(e);if(!h)return;let u=new K(h);u.buffer=h,u.loop=!0,typeof r=="number"&&(u.loopStart=r),typeof s=="number"&&(u.loopEnd=s);let c=this.audioCtx.createGain();c.gain.value=t,u.tempGain=c,u.playbackRate=1,u.onended=()=>{u.disconnect(),c.disconnect()},u.connect(c),c.connect(this.musicGain),u.start(0,l/1e3);let d=++this.loopIdCounter;return this.loops.set(d,{source:u,gain:c}),d}static stopLoop(e){let t=this.loops.get(e);t&&(t.source.stop(),t.source.notIndependent||(t.source.disconnect(),t.gain.disconnect()),this.loops.delete(e))}static async createLiaSource(e,{volume:t=1,speed:r=1,loop:s=!1,loopStart:o=0,loopEnd:l=null,isMusic:h=!1,gain:u=null}={}){try{this.audioBufferCache.has(e)||await this.preLoad(e);let c=this.getCached(e);if(!c)return null;let d=new K(c);d.loop=s,d.loopStart=o,d.loopEnd=typeof l=="number"?l:c.duration,d.playbackRate=r;let y=this.audioCtx.createGain();return y.gain.value=t,d.connect(y),d.tempGain=y,y.connect(u||(h?this.musicGain:this.sfxGain)),d.onended=()=>{d.disconnect(),y.disconnect()},d}catch(c){return console.error("Failed to create LiaAudioSrc:",c),null}}},te=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];function _e(n){return te.includes(n)}var K=class{numberOfInputs;numberOfOutputs;constructor(e,t=k.audioCtx){this.context=t,this.buffer=e,this.source=null,this.startTime=0,this.pauseTime=0,this.playbackRate=1,this.isPlaying=!1,this.loop=!1,this.output=E?t.createGain():null,this.output.gain.value=1,this.channelCount=2,this.channelCountMode="max",this.channelInterpretation="speakers",this.numberOfInputs=0,this.numberOfOutputs=1,this.onended=null}channelCount;channelCountMode;channelInterpretation;onended;source;buffer;context;_createSource(){this.source&&(this.source.onended=null);let e=this.context.createBufferSource();return e.buffer=this.buffer,e.playbackRate.value=this.playbackRate,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd>0?this.loopEnd:this.buffer.duration,e.connect(this.output),this.source=e,e.onended=()=>{this.source===e&&(this.isPlaying&&!this.loop&&(this.isPlaying=!1,this.pauseTime=0),typeof this.onended=="function"&&this.onended())},e}play({fadeIn:e=0,offset:t=null}={}){let r=t!==null?t:this.pauseTime;if(this.source){this.source.onended=null;try{this.source.stop()}catch{}}this.source=this._createSource(),this.startTime=this.context.currentTime-r/this.playbackRate,this.source.start(0,r),e>0?(this.output.gain.setValueAtTime(0,this.context.currentTime),this.output.gain.linearRampToValueAtTime(1,this.context.currentTime+e)):this.output.gain.setValueAtTime(1,this.context.currentTime),this.isPlaying=!0}start(e=0,t=0,r){this.isPlaying||(this.source=this._createSource(),this.startTime=this.context.currentTime+e-t/this.playbackRate,r!==void 0?this.source.start(this.context.currentTime+e,t,r):this.source.start(this.context.currentTime+e,t),this.pauseTime=t,this.isPlaying=!0)}pause({fadeOut:e=0}={}){if(!this.isPlaying)return;let t=this.getElapsed()/1e3;if(this.loop&&this.loopEnd>this.loopStart){let r=this.loopEnd-this.loopStart;t=this.loopStart+(t-this.loopStart)%r}if(this.isPlaying=!1,e>0){let r=this.context.currentTime;this.output.gain.setValueAtTime(this.output.gain.value,r),this.output.gain.linearRampToValueAtTime(0,r+e),setTimeout(()=>{if(this.source){this.source.onended=null;try{this.source.stop()}catch{}}this.pauseTime=t,this.output.gain.setValueAtTime(1,this.context.currentTime)},e*1e3)}else{if(this.source){this.source.onended=null;try{this.source.stop()}catch{}}this.pauseTime=t}}getElapsed(){return this.isPlaying?(this.context.currentTime-this.startTime)*this.playbackRate*1e3:this.pauseTime*1e3}setSpeed(e){if(e<=0)throw new Error("Playback rate must be positive");let t=this.getElapsed()/1e3;this.playbackRate=e,this.isPlaying&&(this.pause(),this.pauseTime=t,this.play())}setLoop(e=!0){this.loop=e,this.source&&(this.source.loop=e)}loop;playbackRate;startTime;tempGain=null;connect(e,t=0,r=0){if("value"in e)this.output.connect(e,t);else return this.output.connect(e,t,r),e}disconnect(e,t,r){e===void 0?this.output.disconnect():this.output.disconnect(e,t,r)}output;stop(e=0){if(this.notIndependent)return this.pause();if(!this.source)return;let t=this.context.currentTime+e;this.source.stop(t),this.isPlaying=!1,this.notIndependent||(this.pauseTime=0)}pauseTime;isPlaying;notIndependent=!1;loopStart=0;loopEnd=0},ne={osc:{enabled:!0,type:"sine",freq:440,detune:0},noise:{enabled:!1,level:.5},ampEnv:{attack:.005,decay:.1,sustain:0,release:.1,volume:.3},pitchEnv:{amount:0,decay:.2},filter:{enabled:!1,type:"lowpass",freq:1200,Q:1,envAmount:0,decay:.2},lfo:{enabled:!1,target:"freq",rate:8,depth:20},duration:.4},T=class n{constructor(e={}){this.ctx=k.audioCtx,this.cfg=structuredClone(ne),Object.assign(this.cfg,e)}ctx;cfg;play(e=k.sfxGain){let t=this.ctx,r=t.currentTime,s=this.cfg,o=t.createGain();o.gain.setValueAtTime(1e-4,r);let l=s.ampEnv;o.gain.exponentialRampToValueAtTime(l.volume,r+l.attack),o.gain.exponentialRampToValueAtTime(Math.max(1e-4,l.sustain*l.volume),r+l.attack+l.decay),o.gain.exponentialRampToValueAtTime(1e-4,r+s.duration+l.release);let h=o,u;s.filter.enabled&&(u=t.createBiquadFilter(),u.type=s.filter.type,u.frequency.value=s.filter.freq,u.Q.value=s.filter.Q,u.connect(o),h=u);let c;if(s.osc.enabled){if(c=t.createOscillator(),c.type=s.osc.type,c.frequency.value=s.osc.freq,c.detune.value=s.osc.detune,s.pitchEnv.amount!==0){let a=Math.pow(2,s.pitchEnv.amount/12);c.frequency.exponentialRampToValueAtTime(s.osc.freq*a,r+s.pitchEnv.decay)}c.connect(h),c.start(r),c.stop(r+s.duration+l.release)}let d;if(s.noise.enabled){let a=t.sampleRate*s.duration,f=t.createBuffer(1,a,t.sampleRate),b=f.getChannelData(0);for(let x=0;x<a;x++)b[x]=(Math.random()*2-1)*s.noise.level;d=t.createBufferSource(),d.buffer=f,d.connect(h),d.start(r),d.stop(r+s.duration+l.release)}let y,m;s.lfo.enabled&&c&&(y=t.createOscillator(),y.frequency.value=s.lfo.rate,m=t.createGain(),m.gain.value=s.lfo.depth,y.connect(m),s.lfo.target==="freq"?m.connect(c.frequency):s.lfo.target==="gain"?m.connect(o.gain):s.lfo.target==="filter"&&u&&m.connect(u.frequency),y.start(r),y.stop(r+s.duration)),o.connect(e);let i=[c,d,y,m,u,o],p=r+s.duration+l.release;setTimeout(()=>{i.forEach(a=>a?.disconnect())},(p-t.currentTime)*1e3)}getConfig(){return structuredClone(this.cfg)}setConfig(e){return Object.assign(this.cfg,e),this}getKey(e){return this.cfg[e]}setKey(e,t){return Object.assign(this.cfg[e],t),this}setFreq(e){return this.cfg.osc.freq=e,this}setWave(e){return this.cfg.osc.type=e,this}setVolume(e){return this.cfg.ampEnv.volume=e,this}setAmpEnv(e,t,r,s){return Object.assign(this.cfg.ampEnv,{attack:e,decay:t,sustain:r,release:s}),this}setPitchEnv(e,t){return Object.assign(this.cfg.pitchEnv,{amount:e,decay:t}),this}setNoiseEnabled(e){return this.cfg.noise.enabled=e,this}setNoiseLevel(e){return this.cfg.noise.level=e,this}setFilterEnabled(e){return this.cfg.filter.enabled=e,this}setFilter(e,t,r){return Object.assign(this.cfg.filter,{type:e,freq:t,Q:r,enabled:!0}),this}setLFOEnabled(e){return this.cfg.lfo.enabled=e,this}setLFO(e,t,r){return Object.assign(this.cfg.lfo,{target:e,rate:t,depth:r,enabled:!0}),this}setDuration(e){return this.cfg.duration=e,this}clone(){return new n(structuredClone(this.cfg))}},re=new T({osc:{enabled:!0,type:"square",freq:900,detune:0},ampEnv:{attack:.002,decay:.04,sustain:0,release:.02,volume:.15},duration:.05}),se=new T({osc:{enabled:!0,type:"sine",freq:600,detune:0},ampEnv:{attack:.01,decay:.08,sustain:0,release:.04,volume:.12},duration:.1}),ie=new T({osc:{enabled:!0,type:"triangle",freq:500,detune:0},pitchEnv:{amount:12,decay:.15},ampEnv:{attack:.01,decay:.12,sustain:0,release:.05,volume:.25},duration:.18}),ae=new T({osc:{enabled:!0,type:"sawtooth",freq:1200,detune:0},pitchEnv:{amount:-24,decay:.3},ampEnv:{attack:.005,decay:.25,sustain:0,release:.05,volume:.3},duration:.35}),oe=new T({osc:{enabled:!0,type:"square",freq:180,detune:0},noise:{enabled:!0,level:.4},ampEnv:{attack:.002,decay:.15,sustain:0,release:.05,volume:.35},duration:.2}),Le=new Map([["ui_click",re],["ui_hover",se],["jump",ie],["laser",ae],["hit",oe]]);function De(n=12){let e=Date.now().toString(36),t=crypto.getRandomValues(new Uint8Array(n)),r=Array.from(t).map(s=>s.toString(36).padStart(2,"0")).join("");return(e+r).slice(0,n)}function Y(n=12){let e=Date.now().toString(36),t=crypto.getRandomValues(new Uint8Array(4)),r=Array.from(t).map(s=>s.toString(36).padStart(2,"0")).join("");return(e+r).slice(0,n)}var W=class{peer=null;key;events={};mbAcc=0;connected=!1;constructor(){this.key=`${ue()}_${Date.now()}`}connect(e){e&&(this.peer=e,e.peer=this,this.connected=!0,e.connected=!0),this._emit("open")}isConnected(){return this.connected&&!!this.peer}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter(r=>r!==t))}_emit(e,t){this.events[e]?.forEach(r=>r(t))}send(e,t){if(!this.peer)throw new Error("No peer connected");this.peer._receive(e,t)}_receive(e,t){e?this._emit(e,t):this._emit("message",t)}close(){if(this.connected=!1,this.peer){let e=this.peer;this.peer=null,e.peer=null,e.connected=!1,e._emit("close")}this._emit("close")}getKey(){return this.key}};function ue(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){let n=new Uint8Array(16);return crypto.getRandomValues(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128,[...n].map(e=>e.toString(16).padStart(2,"0")).join("").replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/,"$1-$2-$3-$4-$5")}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{let e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)})}function ce(n){let e=!0;function t(){e&&(n(),requestAnimationFrame(t))}return requestAnimationFrame(t),{clear:()=>e=!1}}function le(n,e,t,r,s){let o=Math.cos(s),l=Math.sin(s),h=[];if(o!==0){let u=(0-n)/o,c=e+u*l;u>0&&c>=0&&c<=r&&h.push({side:"left",t:u})}if(o!==0){let u=(t-n)/o,c=e+u*l;u>0&&c>=0&&c<=r&&h.push({side:"right",t:u})}if(l!==0){let u=(0-e)/l,c=n+u*o;u>0&&c>=0&&c<=t&&h.push({side:"top",t:u})}if(l!==0){let u=(r-e)/l,c=n+u*o;u>0&&c>=0&&c<=t&&h.push({side:"bottom",t:u})}return h.length===0?null:(h.sort((u,c)=>u.t-c.t),h[0])}function he(n,e){let t;switch(e){case"left":case"right":t=Math.PI-n;break;case"top":case"bottom":t=2*Math.PI-n;break}return(t%(2*Math.PI)+2*Math.PI)%(2*Math.PI)}function Ve(n,e,t,r,s){let o=le(n,e,t,r,s);return o?{...o,avoidAngle:he(s,o.side)}:null}function pe(){return D?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}var Ge=pe();var B={};G(B,{Kayla:()=>q,KaylaFragment:()=>Ee,KaylaInternals:()=>C,UI:()=>Ce,createElement:()=>ye,createGame:()=>fe,createReassignableObject:()=>Te,createRenderer:()=>me,createScene:()=>de,self:()=>M,useDisposableRef:()=>we,useEffect:()=>X,useEntity:()=>ve,useExports:()=>xe,useNextStack:()=>Q,usePaint:()=>U,useRef:()=>P,useSelf:()=>ge,useState:()=>H,useTick:()=>be});var q={};G(q,{KaylaFragment:()=>Ee,KaylaInternals:()=>C,createElement:()=>ye,createGame:()=>fe,createReassignableObject:()=>Te,createRenderer:()=>me,createScene:()=>de,self:()=>M,useDisposableRef:()=>we,useEffect:()=>X,useEntity:()=>ve,useExports:()=>xe,useNextStack:()=>Q,usePaint:()=>U,useRef:()=>P,useSelf:()=>ge,useState:()=>H,useTick:()=>be});function fe({width:n,height:e,updateHz:t="frames"}){return new C.KaylaGame(n,e,t==="frames"?1/0:t)}function de(n){let e=new F(n);return new C.KaylaScene(e)}function me(n){return new C.KaylaRenderer(n)}function ye(n,e){return{type:n,props:e}}var C;(y=>{class n extends _{#e;#t;constructor(i,p,a){super(i,p,a),this.#e=new Set,this.#t=!1}get started(){return this.#t}start(){if(!this.#t){for(let i of this.#e)i.start();this.#t=!0,super.start()}}stop(){if(this.#t){for(let i of this.#e)i.stop();this.#t=!1,super.stop()}}addRenderer(i){this.#e.has(i)||(this.#e.add(i),this.#t&&i.start(),i.game=this)}deleteRenderer(i){this.#e.has(i)&&(this.#e.delete(i),this.#t&&i.stop(),delete i.game)}}y.KaylaGame=n;class e extends A{game;pointerX;pointerY;#e;constructor(i){super(i),this.useDraw=this.useDraw.bind(this),this.on("draw",p=>{if(this.game)for(let a of this.game.scenes.values())a.handleDraw(p)}),this.pointerX=0,this.pointerY=0,this.#e=this.#t.bind(this)}#t(i){this.pointerX=i.clientX,this.pointerY=i.clientY}listenPointerUpdates(){this.canvas.addEventListener("pointermove",this.#e)}unlistenPointerUpdates(){this.canvas.removeEventListener("pointermove",this.#e)}pointerPosToWorldPos(i,p){let a=this.canvas.getBoundingClientRect(),f=(i-a.left)/a.width,b=(p-a.top)/a.height,x=f*this.viewportWidth*this.cameraWidth/a.width,R=b*this.viewportHeight*this.cameraHeight/a.height;return new S(x,R)}getMousePos(){return this.pointerPosToWorldPos(this.pointerX,this.pointerY)}useDraw(i){let p=a=>{i(a,new r)};return this.on("draw",p),()=>{this.off("draw",p)}}attachTo(i){i.addRenderer(this),this.game=i}detach(){this.game&&this.game.deleteRenderer(this)}}y.KaylaRenderer=e;class t{current;saves;constructor(){this.saves=[]}useTick(i){if(!this.current)throw new Error("Hook 'useTick' must be executed in the top level scope of a component.");this.current.onTick[this.current.useStepCallIndex]=i,this.current.useStepCallIndex++}usePaint(i){if(!this.current)throw new Error("Hook 'usePaint' must be executed in the top level scope of a component.");this.current.onPaint[this.current.useDrawCallIndex]=i,this.current.useDrawCallIndex++}useEntity(){return P(M)}useSelf(i){let p=P(null);return(p.current===null||p.current===void 0)&&(p.current=i()),p.current}useState(i,{alwaysRecall:p=!1}={}){if(!this.current)throw new Error("Hook 'useState' must be executed in the top level scope of a component.");let f=this.current.state[this.current.useStateCallIndex]??new s(this.current,i,{alwaysRecall:p});return this.current.state[this.current.useStateCallIndex]=f,this.current.useStateCallIndex++,f}useRef(i){if(!this.current)throw new Error("Hook 'useRef' must be executed in the top level scope of a component.");let a=this.current.refs[this.current.useRefCallIndex]??l(i??null);return this.current.refs[this.current.useRefCallIndex]=a,this.current.useRefCallIndex++,a}useEffect(i){if(!this.current)throw new Error("Hook 'useEffect' must be executed in the top level scope of a component.");this.current.onEffect[this.current.useEffectCallIndex]=i,this.current.useEffectCallIndex++}useExports(i,p){if(!this.current)throw new Error("Hook 'useExports' must be executed in the top level scope of a component.");this.current.onExport=p}save(){this.saves.push({current:this.current})}restore(){let i=this.saves.pop();if(!i)throw new Error("Cannot restore without saving.");this.current=i.current}}y.GlobalKayla=t;class r{preventDefault(){this.#e=!0}#e=!1;isPrevented(){return this.#e}}y.KaylaEvent=r;class s{#e;#t;#n;alwaysRecall;constructor(i,p,{alwaysRecall:a=!1}={}){this.#t=i,this.#e=p??void 0,this.#n=Date.now(),this.alwaysRecall=a}get(){return this.#e}add(i,{recall:p}={}){this.set(this.get()+i,{recall:p})}multiply(i,{recall:p}={}){this.set(this.get()*i,{recall:p})}set(i,{recall:p=!1}={}){let a=this.#e;i!==a&&(this.#e=i,(p||this.alwaysRecall)&&this.#t.refresh(),this.#n=Date.now())}get value(){return this.#e}get lastChanged(){return this.#n}}y.KaylaState=s;class o{#e;constructor(i){this.#e=i??void 0}#t;setSetter(i){this.#t=i}get current(){return this.#e}set current(i){this.#e=i,this.#t&&this.#t(this.#e)}}y.KaylaInternalRef=o;function l(m){return new o(m)}y.createReassignableRef=l;class h{state;refs;global;callProps;scene;exports;constructor(i,p,a){if(!a)throw new Error("Empty element");this.scene=p,this.state=[],this.refs=[],this.fc=a.type,this.callProps=a.props??{},this.global=i,this.lastStateDeps=[],this.entity=null,this.lastChildren=[],this.onEffect=[],this.onUnEffect=[],this.onPaint=[],this.onTick=[]}get key(){return this.callProps.key}set key(i){this.callProps.key=i}get children(){return this.callProps.children}set children(i){this.callProps.children=i}entity;onExport=()=>({});onEffect;onUnEffect;onEffectDeps;onPaint;onTick;fc;useStateCallIndex=0;useEffectCallIndex=0;useDrawCallIndex=0;useStepCallIndex=0;useRefCallIndex=0;lastStateDeps;refresh(){let i;this.global.save(),this.global.current=this,this.useStateCallIndex=0,this.useRefCallIndex=0;let p=[];try{let a=this.fc(this.callProps)??[];if(a&&!Array.isArray(a)&&(a=[a]),!Array.isArray(a))throw new Error("Non array or non undefined children received.");p=a}catch(a){i=a}this.useStateCallIndex=0,this.useRefCallIndex=0,this.useDrawCallIndex=0,this.useStepCallIndex=0,this.useEffectCallIndex=0,this.global.restore();try{let a=0,f=[];for(let b of p){let x=this.lastChildren.at(a)??new h(this.global,this.scene,b);this.lastChildren[a]=x,f.push(x),a++}for(let b of this.lastChildren.filter(x=>!f.includes(x))){let x=this.lastChildren.indexOf(b);x!==1&&this.lastChildren.splice(x,1),b.unuse()}for(let b of this.lastChildren)try{b.refresh()}catch(x){console.error(x)}Q(()=>{this.use()})}catch(a){console.error(a)}if(i)throw i}lastChildren;isFirstUse=!0;use(){try{let i=!0;if(this.lastStateDeps??=[],Array.isArray(this.onEffectDeps)&&(i=this.onEffectDeps.some((p,a)=>{let f=this.lastStateDeps.at(a);if(f){let b=p.lastChanged,x=f.stamp;return b>x}})),i||this.isFirstUse){this.isFirstUse=!1,Array.isArray(this.onEffectDeps)&&(this.lastStateDeps=this.onEffectDeps.map(a=>({stamp:a.lastChanged,stateRef:a}))),this.key??=this.fc.name+"_"+Y(),this.entity&&this.scene.getScene().removeEntity(this.entity),this.entity&&this.entity.name!==this.key&&(this.entity=null),this.entity=this.entity??new u(this,this.key);for(let a of this.refs)a.current===M&&(a.current=this.entity);this.callProps.ref instanceof o&&(this.callProps.ref.current=this.entity),this.exports=this.onExport(),this.callProps.exportsRef instanceof o&&(this.callProps.exportsRef.current=this.exports),this.scene.getScene().addEntity(this.entity);let p=this.onEffect.map(a=>a()).filter(a=>a!==void 0);this.onUnEffect=p}}catch(i){throw i}}unuse(){try{for(let i of this.onUnEffect)i()}catch(i){console.error(i)}this.scene.getScene().removeEntity(this.entity)}}y.KaylaFiber=h;class u extends L{#e;constructor(i,p){super(p,0,0,0,0),this.#e=i}update(i){let p=new r;if(this.#e.onTick)for(let a of this.#e.onTick)a(i,p);p.isPrevented()}draw(i){let p=new r;if(this.#e.onPaint)for(let a of this.#e.onPaint)a(i,p);p.isPrevented()||super.draw(i)}}y.KaylaRectEntity=u;class c{constructor(i){this.#t=i,this.#e=null,i.on("update",this.tickHandler.bind(this)),this.drawHandler=this.drawHandler.bind(this)}#e;#t;getScene(){return this.#t}drawHandler(i){return this.#t.handleDraw(i)}attachTo(i){i.addScene(this.#t),this.#e=i}spawn(i){new h(y.singleGlobalInstance,this,i).refresh()}detach(){this.#e&&this.#e.removeScene(this.#t)}tickHandler(){}}y.KaylaScene=c,y.singleGlobalInstance=new y.GlobalKayla})(C||={});var g=C.singleGlobalInstance,H=g.useState.bind(g),P=g.useRef.bind(g),X=g.useEffect.bind(g),be=g.useTick.bind(g),U=g.usePaint.bind(g),xe=g.useExports.bind(g),ge=g.useSelf.bind(g),ve=g.useEntity.bind(g),M=Symbol("self_ref");var Q=n=>{Promise.resolve(1).then(()=>n())},Ee=({children:n})=>Array.isArray(n)?[...n]:n;function we(n){return C.createReassignableRef(n)}function Te(n){if(typeof n!="object"||typeof n=="function"||n===null)return n;let e={current:n};return new Proxy({},{get(r,s,o){return s==="reassignSelf"?l=>{e.current=l}:Reflect.get(e.current,s,o)},set(r,s,o,l){return Reflect.set(e.current,s,o,l)},has(r,s){return Reflect.has(e.current,s)},ownKeys(r){return Reflect.ownKeys(e.current)},getOwnPropertyDescriptor(r,s){return Reflect.getOwnPropertyDescriptor(e.current,s)},deleteProperty(r,s){return Reflect.deleteProperty(e.current,s)}})}Reflect.set(globalThis,"Kayla",q);var Ce;(e=>e.UIComponent=({x:t,y:r,width:s,height:o,children:l})=>{let h=P(M),u=H(!1);return X(()=>{if(u.get()===!0)return;u.set(!0);let c=h.current;c.width=s,c.height=o,c.x=t,c.y=r}),U(c=>{c.fillStyle="rgba(0, 0, 0, 0.5)",c.fillRect(t,r,s,o)}),l??[]})(Ce||={});var Ne={LEA:V,Kayla:B};0&&(module.exports={Kayla,LEA});
|
|
1
|
+
"use strict";var H=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var de=Object.prototype.hasOwnProperty;var X=(n,e)=>{for(var t in e)H(n,t,{get:e[t],enumerable:!0})},me=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of fe(e))!de.call(n,s)&&s!==t&&H(n,s,{get:()=>e[s],enumerable:!(r=pe(e,s))||r.enumerable});return n};var ye=n=>me(H({},"__esModule",{value:!0}),n);var Ne={};X(Ne,{Kayla:()=>P,LEA:()=>D,default:()=>Ge});module.exports=ye(Ne);var D={};X(D,{DeltaTweenII:()=>O,ENVIRONMENT:()=>q,GEmitterMemory:()=>U,LeaEntityII:()=>I,LeaEventEmitter:()=>w,LeaGameII:()=>F,LeaRendererII:()=>M,LeaSceneII:()=>A,LeaSerializers:()=>Y,LeaTickerII:()=>N,LeaTimeout:()=>z,LeaUtilsII:()=>v,LiaAudio:()=>k,LiaAudioSrc:()=>K,LiaOscSFX:()=>T,LiaSFXMap:()=>we,NOTE_NAMES:()=>Z,RectLeaEntity:()=>_,Vector2:()=>C,colToRGBA:()=>xe,defaultSFXConfig:()=>ee,editRGBA:()=>ge,generateUUID:()=>ae,getAvoidAngle:()=>ce,getEnvironment:()=>J,getNormalizedColor:()=>be,getRayHit:()=>ue,isInitiallyMobile:()=>Se,isMobile:()=>le,isNode:()=>L,isNote:()=>Ee,isWeb:()=>E,parseFillStyle:()=>Q,raycastAvoid:()=>Ce,scaleCoord:()=>ve,setAnimInterval:()=>oe,sfxHit:()=>ie,sfxJump:()=>re,sfxLaser:()=>se,sfxUIClick:()=>te,sfxUIHover:()=>ne,shortUID:()=>Te,tinyUID:()=>B});var w=class{#e=new Map;constructor(){this.#e=new Map}on(e,t){let r=this.#e.get(e)||[];return r.push(t),this.#e.set(e,r),this}once(e,t){let r=(...s)=>{this.off(e,r),t(...s)};return this.on(e,r),this}off(e,t){let r=this.#e.get(e);if(!r)return this;let s=r.indexOf(t);return s>=0&&r.splice(s,1),this}emit(e,...t){let r=this.#e.get(e);if(!r||r.length===0){if(e==="error")throw t[0];return!1}return r.slice().forEach(s=>s(...t)),!0}removeAllListeners(e){return e?this.#e.delete(e):this.#e.clear(),this}listenerCount(e){return this.#e.get(e)?.length??0}},M=class extends w{canvas;ctx;running;_rafId;_fps;_frameCount;_fpsTimer;_lastFrameTime;constructor(e,{viewportWidth:t,viewportHeight:r,cameraWidth:s,cameraHeight:o}={}){if(!E)throw new Error("Web-Only");super(),this.canvas=e,this.ctx=e.getContext("2d"),this.automatic=!0,this.#e=t??e.width,this.#t=r??e.height,this.#n=s??e.width,this.#r=o??e.height,this.running=!1,this._rafId=null,this._loop=this._loop.bind(this),this.updateCanvasResolution(),this._fps=60,this._frameCount=0,this._fpsTimer=0}automatic;retransform(){this.ctx.setTransform(1,0,0,1,0,0);let e=this.#n/this.#e,t=this.#r/this.#t;this.ctx.translate(this.#n/2,this.#r/2),this.ctx.scale(e,t),this.ctx.translate(-this.#e/2,-this.#t/2)}#e=0;#t=0;#n=0;#r=0;get viewportWidth(){return this.#e}set viewportWidth(e){this.#e=e,this.retransform()}get width(){return this.#e}get height(){return this.#t}get centerX(){return this.#e/2}get centerY(){return this.#t/2}get left(){return 0}get top(){return 0}get right(){return this.#e}get bottom(){return this.#t}get viewportHeight(){return this.#t}set viewportHeight(e){this.#t=e,this.retransform()}get cameraWidth(){return this.#n}set cameraWidth(e){this.#n=e,this.updateCanvasResolution(),this.retransform()}get cameraHeight(){return this.#r}set cameraHeight(e){this.#r=e,this.updateCanvasResolution(),this.retransform()}updateCanvasResolution(){this.canvas.width=this.#n,this.canvas.height=this.#r}applyTransform(){this.retransform()}get FPS(){return this._fps}_loop(){this.automatic&&this.update(),this._rafId=requestAnimationFrame(this._loop)}update(){if(!this.running||!E)return;let e=performance.now(),t=(e-(this._lastFrameTime??e))/1e3;this._lastFrameTime=e,this._frameCount++,this._fpsTimer+=t,this._fpsTimer>=1&&(this._fps=Math.round(this._frameCount/this._fpsTimer),this._frameCount=0,this._fpsTimer=0),this.ctx.clearRect(0,0,this.#n,this.#r),this.emit("draw",this.ctx)}start(){if(!this.running){if(!E||typeof globalThis.requestAnimationFrame>"u")throw new Error("Raf is not supported");this.running=!0,this._rafId=requestAnimationFrame(this._loop)}}stop(){if(!E||typeof globalThis.requestAnimationFrame>"u")throw new Error("Raf is not supported");this.running=!1,this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null)}},N=class extends w{setNow(e){this.#e=e}#e=0;__intervalId=null;__lastTime=0;constructor(e=16){super(),this.#t=e,this.speedHackDT=1}speedHackDT;get isRaf(){return this.tickInterval===1/0}#t=15;get tickInterval(){return this.#t}set tickInterval(e){this.#t=e,this.__intervalId&&(this.stop(),this.start())}now(){return this.#e}__tick(){let e=performance.now(),t=(e-this.__lastTime)/1e3*this.speedHackDT;this.__lastTime=e,this.#e+=t*1e3,this.emit("tick",t)}createTimeout(e){return new z(e,this)}createTween(e,t=()=>{}){let r=new O(e),s=(o=0)=>{if(r.finished){this.off("tick",s);return}r.update(o)};return r.on("finish",()=>{this.off("tick",s)}),r.on("delta",o=>{t(o)}),this.on("tick",s),r}start(){this.__intervalId===null&&(this.__lastTime=performance.now(),this.__intervalId=E&&!isFinite(this.tickInterval)?oe(()=>this.__tick()).clear:setInterval(()=>this.__tick(),this.tickInterval))}stop(){this.__intervalId!==null&&(typeof this.__intervalId=="function"?this.__intervalId():clearInterval(this.__intervalId)),this.__intervalId=null}getSineMod(e,t=0){return .5+.5*Math.sin((this.now()%e/e+t)*2*Math.PI)}},Y;(p=>{function n(a){return a===!0?1:0}p.booleanExport=n;function e(a){return a===0?!1:a===1}p.booleanImport=e;function t(a){return`${a.x}|${a.y}`}p.vec2Export=t;function r(a){let[f,b]=a.split("|"),x=parseFloat(f),R=parseFloat(b);if(isNaN(x)||isNaN(R))throw new Error(`Invalid Vector2 string: ${a}`);return new C(x,R)}p.vec2Import=r,p.booleanMap={mapExport:n,mapImport:e};function o(a){return f=>Number(f.toFixed(a))}p.createRounder=o;function l(a=10){return{mapExport(f){return Math.round(f/a)},mapImport(f){return f*a}}}p.createLowPrecision=l;function h(a){return Math.round(a)}p.lightWeightRounder=h;function u(a=100){return{mapExport(f){return Math.round(f*a)},mapImport(f){return f/a}}}p.createPercent=u;function c(a){let f=new Map(Object.entries(a));return{mapExport:b=>f.get(b)??null,mapImport:b=>Array.from(f.entries()).find(([x,R])=>R===b)?.[0]??null}}p.createLookup=c;function d(a){let f=a*(180/Math.PI);return Math.round((f%360+360)%360)}p.radToDeg=d;function y(a){return a*(Math.PI/180)}p.degToRad=y,p.angleRadToDeg={mapExport:d,mapImport:y};function i(a=10){let f=l(a);return{mapExport(b){return f.mapExport(d(b))},mapImport(b){return f.mapImport(y(b))}}}p.createLowPrecisionRadToDeg=i})(Y||={});var I=class n extends w{name="";scaleRotate=0;scale=1;constructor(e,t=0,r=0){super(),this.autoTranslate=!1,this.name=e,this.z=0,this.___pos=new C(t,r),this.nonSerializableProperties=[],this.nonSerializableProperties.push("___pos","autoTranslate","arraySerializeMap"),this.forceSerializableProperties=[],this.forceSerializableProperties.push("x","y")}arraySerializeMap;autoTranslate;z;___pos;nonSerializableProperties;forceSerializableProperties;get pos(){return this.___pos}get x(){return this.pos.x}get y(){return this.pos.y}set x(e){this.pos.x=e}set y(e){this.pos.y=e}handleUpdate(e){if(this.update)try{this.emit("update",e),this.update(e)}catch(t){this.emit("error",t)}}handleDraw(e){if(!(L||!this.draw)){e.save(),this.autoTranslate&&e.translate(this.x,this.y);try{this.emit("draw",e),this.draw(e)}catch(t){this.emit("error",t)}e.restore()}}serialize(){if(Array.isArray(this.arraySerializeMap))return this.arraySerializeMap.map(([s,{mapExport:o}])=>{let l=Reflect.get(this,s);return o?o(l):l});let e=["_events","_eventsCount","_maxListeners","nonSerializableProperties","forceSerializableProperties"],t=[...Reflect.ownKeys(this),...this.forceSerializableProperties].filter(s=>!this.nonSerializableProperties.includes(s)&&!e.includes(s.toString())),r=Object.fromEntries(t.map(s=>{let o=Reflect.get(this,s);if(L&&typeof o=="number"){let l=o.toString().split("."),u=(l[1]?l[1].length:0)>2?Number(o.toFixed(2)):o;return[s,u]}return[s,o]}));return JSON.parse(JSON.stringify(r))}toLocal(e){return e.subtract(this.pos)}toWorld(e){return e.add(this.pos)}deserializeArray(e){return n.deserializeArray(this.arraySerializeMap,e)}static deserializeArray(e,t){if(!e||!Array.isArray(t))return t;let r={};for(let s=0;s<t.length;s++){let o=e[s];if(!o)break;let[l,{mapImport:h}]=o,u=t[s];if(h&&(u=h(u)),typeof l!="string")break;try{Reflect.set(r,l,u)}catch(c){console.error(c)}}return r}},A=class extends w{name="";entities=new Map;paused=!0;constructor(e){super(),this.name=e}handleUpdate(e){if(!this.paused){this.emit("update",e);for(let t of this.entities.values())t.handleUpdate(e)}}handleDraw(e){if(!L&&!this.paused){this.emit("draw",e);for(let t of[...this.entities.values()].sort((r,s)=>r.z-s.z))t.handleDraw(e)}}addEntity(e){if(!(e instanceof I))throw new Error("invalid entity");if(!e.name)throw new Error("Entity must have a name.");this.entities.set(e.name,e)}removeEntity(e){if(!(e instanceof I))throw new Error("invalid entity");this.entities.delete(e.name)}getEntity(e){return this.entities.get(e)}},F=class{scenes;ticker;get centerX(){return this.width/2}get centerY(){return this.height/2}get left(){return 0}get top(){return 0}get right(){return this.width}get bottom(){return this.height}width;height;constructor(e,t,r=16){this.ticker=new N(r),this.scenes=new Map,this.width=e,this.height=t,this.ticker.on("tick",s=>{for(let o of this.scenes.values())o.paused||o.handleUpdate(s)})}addScene(e){if(!e.name)throw new Error("Scene must have a name.");e.paused=!1,this.scenes.set(e.name,e)}removeScene(e){e&&(e.paused=!0),this.scenes.delete(e.name)}now(){return this.ticker.now()}start(){this.ticker.start()}stop(){this.ticker.stop()}},v={lerp(n,e,t){return n+(e-n)*t},clamp(n,e,t){return Math.min(t,Math.max(e,n))},clamp01(n){return Math.min(1,Math.max(0,n))},easeLinear(n){return n},easeInQuad(n){return n*n},easeOutQuad(n){return 1-(1-n)*(1-n)},easeInOutQuad(n){return n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2},easeInSine(n){return 1-Math.cos(n*Math.PI/2)},easeOutSine(n){return Math.sin(n*Math.PI/2)},easeInOutSine(n){return-(Math.cos(Math.PI*n)-1)/2},easeInExpo(n){return n===0?0:Math.pow(2,10*n-10)},easeOutExpo(n){return n===1?1:1-Math.pow(2,-10*n)},easeInOutExpo(n){return n===0?0:n===1?1:n<.5?Math.pow(2,20*n-10)/2:(2-Math.pow(2,-20*n+10))/2},smoothstep(n){return n=v.clamp(n,0,1),n*n*(3-2*n)},randomLerp(n,e){return v.lerp(n,e,Math.random())},randomInt(n,e){return Math.floor(Math.random()*(e-n+1))+n},randomArrayValue(n){return n[v.randomInt(0,n.length-1)]},createBezier(n,e,t,r){function s(h,u,c,d,y){let m=1-h;return m*m*m*u+3*m*m*h*c+3*m*h*h*d+h*h*h*y}function o(h,u,c,d,y){let m=1-h;return 3*m*m*(c-u)+6*m*h*(d-c)+3*h*h*(y-d)}function l(h){let u=h;for(let c=0;c<6;c++){let d=s(u,0,n,t,1),y=o(u,0,n,t,1);if(y===0)break;u-=(d-h)/y}return v.clamp(u,0,1)}return function(u){u=v.clamp(u,0,1);let c=l(u);return s(c,0,e,r,1)}},lengthSquared(...n){return n.reduce((e,t)=>e+t*t,0)},normalizeRad(n){let e=2*Math.PI;return n=n%e,n<0&&(n+=e),n},angleInvertY(n){return v.normalizeRad(-n)},degToRadFlipY(n){return v.angleInvertY(n*Math.PI/180)},minimalAngularDirection(n,e){n=v.normalizeRad(n),e=v.normalizeRad(e);let t=v.normalizeRad(e-n),r=v.normalizeRad(n-e);return t<=r?1:-1}},O=class extends w{constructor({delta:e,ms:t,easing:r}){super(),this.delta=e,this.duration=t,this.elapsed=0,this.easing=r??(s=>s),this.lastValue=0,this.finished=!1}delta;duration;elapsed;lastValue;finished;easing;update(e){this.elapsed+=e*1e3;let t=v.clamp(this.elapsed/this.duration,0,1),r=this.easing(t),s=this.delta*r,o=s-this.lastValue;this.lastValue=s,this.emit("delta",o),t>=1&&(this.finished=!0,this.emit("finish",void 0))}},_=class extends I{constructor(e,t=0,r=0,s=50,o=50){super(e,t,r),this.width=s,this.height=o}width;height;get left(){return this.x-this.width/2}set left(e){this.x=e+this.width/2}get right(){return this.x+this.width/2}set right(e){this.x=e-this.width/2}get top(){return this.y-this.height/2}set top(e){this.y=e+this.height/2}get bottom(){return this.y+this.height/2}set bottom(e){this.y=e-this.height/2}get lx(){return 0}get ly(){return 0}get lleft(){return-this.width/2}get lright(){return this.width/2}get ltop(){return-this.height/2}get lbottom(){return this.height/2}isCollidingWith(e){return!(this.right<e.left||this.left>e.right||this.bottom<e.top||this.top>e.bottom)}color="rgba(0, 0, 255, 0.3)";draw(e){e.translate(this.x,this.y),e.rotate(this.scaleRotate),e.fillStyle=this.color,e.fillRect(-this.width/2,-this.height/2,this.width,this.height)}},z=class extends w{duration;ticker;elapsed;finished;_resolve;promise;_timeoutId;constructor(e,t=null){super(),this.duration=e,this.ticker=t,this.elapsed=0,this.finished=!1,this._resolve=null,this.promise=new Promise(r=>this._resolve=r),this.update=this.update.bind(this),this.ticker&&this.ticker.on("tick",this.update)}update(e=0){this.finished||(this.elapsed+=e*1e3,this.elapsed>=this.duration&&this.finish())}finish(){this.finished||(this.finished=!0,this.emit("finish",void 0),this._resolve&&this._resolve(),this.ticker&&this.ticker.off("tick",this.update))}start(){return this.ticker||(this._timeoutId=setTimeout(()=>this.finish(),this.duration)),this}cancel(){this.finished||(this.finished=!0,!this.ticker&&this._timeoutId!=null&&clearTimeout(this._timeoutId),this.ticker&&this.ticker.off("tick",this.update))}then(e,t){return this.promise.then(e,t)}after(e,t){return this.promise.then(e,t)}},C=class n{constructor(e=0,t=0){this.x=e,this.y=t}x;y;toJSON(){return{x:this.x,y:this.y,vec2:!0}}static isVec2(e){return e&&typeof e=="object"&&"x"in e&&"y"in e&&e.vec2===!0}static fromSerialized(e){return this.isVec2(e)?new this(e.x,e.y):null}rotate(e){let t=Math.cos(e),r=Math.sin(e);return new n(this.x*t-this.y*r,this.x*r+this.y*t)}static from(e){return new n(Math.cos(e),Math.sin(e))}get angle(){return Math.atan2(this.y,this.x)}get length(){return Math.hypot(this.x,this.y)}get lengthSquared(){return this.x*this.x+this.y*this.y}normalized(){let e=this.length;return e===0?new n(0,0):new n(this.x/e,this.y/e)}project(e){return e.scale(this.dotNormalized(e))}reflect(e){let t=this.dot(e);return this.subtract(e.scale(2*t))}dotNormalized(e){let t=this.normalized(),r=e.normalized();return t.x*r.x+t.y*r.y}lengthSquaredTo(e){let t=this.x-e.x,r=this.y-e.y;return t*t+r*r}dot(e){return this.x*e.x+this.y*e.y}distanceTo(e){return Math.hypot(this.x-e.x,this.y-e.y)}distanceToCheap(e){let t=this.x-e.x,r=this.y-e.y;return t*t+r*r}directionTo(e){return new n(e.x-this.x,e.y-this.y).normalized()}add(e){return new n(this.x+e.x,this.y+e.y)}addRaw(e){return new n(this.x+e,this.y+e)}overwite(e){this.x=e.x,this.y=e.y}subtract(e){return new n(this.x-e.x,this.y-e.y)}scale(e){return new n(this.x*e,this.y*e)}toString(){return`Vector2(${this.x}, ${this.y})`}clone(){return new n(this.x,this.y)}};function be(n){let e=/^rgba?\(([^)]+)\)$/,t=n.match(e);if(t){let[r,s,o,l=1]=t[1].split(",").map(h=>parseFloat(h));return{r:Math.max(0,Math.min(255,Math.floor(r))),g:Math.max(0,Math.min(255,Math.floor(s))),b:Math.max(0,Math.min(255,Math.floor(o))),a:Math.max(0,Math.min(1,Math.floor(l*255)/255))}}return Q(n)}function xe(n){return`rgba(${n.r}, ${n.g}, ${n.b}, ${n.a})`}function Q(n){if(n=n.trim().toLowerCase(),n[0]==="#"){let t,r,s;if(n.length===7)t=parseInt(n.slice(1,3),16),r=parseInt(n.slice(3,5),16),s=parseInt(n.slice(5,7),16);else if(n.length===4)t=parseInt(n[1]+n[1],16),r=parseInt(n[2]+n[2],16),s=parseInt(n[3]+n[3],16);else throw new Error("Invalid hex color");return{r:t,g:r,b:s,a:1}}let e=n.match(/^rgba?\s*\(\s*(\d+)[, ]\s*(\d+)[, ]\s*(\d+)(?:[, ]\s*([\d.]+))?\s*\)$/);if(e)return{r:parseInt(e[1]),g:parseInt(e[2]),b:parseInt(e[3]),a:e[4]!==void 0?parseFloat(e[4]):1};throw new Error("Unsupported fillStyle format")}function ge(n,{r:e,g:t,b:r,a:s}={}){let[o,l,h,u,c]=n.match(/rgba?\((\d+),\s*(\d+),\s*(\d+),?\s*([\d.]*)\)?/)||[];return`rgba(${e??l}, ${t??h}, ${r??u}, ${s??(c||1)})`}function ve(n,e,t){return t+(n-t)*e}function J(){return typeof process<"u"&&process.release?.name==="node"?"node":typeof window<"u"||typeof self<"u"?"web":"unknown"}var q=J(),L=q==="node",E=q==="web",k=class n{static unlock(){E&&this.audioCtx.state!=="running"&&this.audioCtx.resume()}static audioCtx=E?new AudioContext:null;static masterGain=E?this.audioCtx.createGain():null;static musicGain=E?this.audioCtx.createGain():null;static sfxGain=E?this.audioCtx.createGain():null;static{E&&(this.masterGain.gain.value=1,this.musicGain.gain.value=1,this.sfxGain.gain.value=1,this.sfxGain.connect(this.masterGain),this.musicGain.connect(this.masterGain),this.masterGain.connect(this.audioCtx.destination))}static get SFX_VOLUME(){return this.sfxGain.gain.value}static get MUSIC_VOLUME(){return this.musicGain.gain.value}static get VOLUME(){return this.masterGain.gain.value}static set SFX_VOLUME(e){this.sfxGain.gain.value=e}static set MUSIC_VOLUME(e){this.musicGain.gain.value=e}static set VOLUME(e){this.masterGain.gain.value=e}static noteToHz(e){return this.tuningFreq*Math.pow(2,(e-9)/12)}static tuningFreq=440;static audioBufferCache=new Map;static loops=new Map;static sfsx=new Map;static loopIdCounter=0;static CACHE_NAME="lia-audio-cache-v1";static async preLoad(e){if(this.audioBufferCache.has(e))return this.audioBufferCache.get(e);let t=n.CACHE_NAME,r,s;if(typeof caches<"u"&&(s=await caches.open(t),r=await s.match(e)),!r){if(r=await fetch(e),!r.ok)throw new Error(`Failed to fetch ${e}`);s&&await s.put(e,r.clone())}let o=await r.arrayBuffer(),l=await this.audioCtx.decodeAudioData(o);return this.audioBufferCache.set(e,l),l}static async getOnlyDownloadedCache(e){let t=n.CACHE_NAME;return await(await caches.open(t)).match(e)}static getCached(e){return this.audioBufferCache.get(e)||null}static async playSound(e,t=.2,r=1,s=!0){try{this.sfsx.has(e)&&this.sfsx.get(e).source.stop(),this.audioBufferCache.has(e)||await this.preLoad(e);let o=this.getCached(e);if(!o)return;let l=new K(o);l.buffer=o;let h=1-.12,u=1+.12;l.playbackRate=r??h+Math.random()*(u-h);let c=this.audioCtx.createGain();c.gain.value=t,l.tempGain=c,l.connect(c),c.connect(this.sfxGain),l.onended=()=>{l.disconnect(),c.disconnect()},l.start(),s&&this.sfsx.set(e,{source:l,gain:c})}catch(o){console.error(o)}}static async playLoop(e,t=1,{loopStart:r=0,loopEnd:s=null,exclusive:o=!0,skipMS:l=0}={}){if(o)for(let y of this.loops.keys())this.stopLoop(y);this.audioBufferCache.has(e)||await this.preLoad(e);let h=this.getCached(e);if(!h)return;let u=new K(h);u.buffer=h,u.loop=!0,typeof r=="number"&&(u.loopStart=r),typeof s=="number"&&(u.loopEnd=s);let c=this.audioCtx.createGain();c.gain.value=t,u.tempGain=c,u.playbackRate=1,u.onended=()=>{u.disconnect(),c.disconnect()},u.connect(c),c.connect(this.musicGain),u.start(0,l/1e3);let d=++this.loopIdCounter;return this.loops.set(d,{source:u,gain:c}),d}static stopLoop(e){let t=this.loops.get(e);t&&(t.source.stop(),t.source.notIndependent||(t.source.disconnect(),t.gain.disconnect()),this.loops.delete(e))}static async createLiaSource(e,{volume:t=1,speed:r=1,loop:s=!1,loopStart:o=0,loopEnd:l=null,isMusic:h=!1,gain:u=null}={}){try{this.audioBufferCache.has(e)||await this.preLoad(e);let c=this.getCached(e);if(!c)return null;let d=new K(c);d.loop=s,d.loopStart=o,d.loopEnd=typeof l=="number"?l:c.duration,d.playbackRate=r;let y=this.audioCtx.createGain();return y.gain.value=t,d.connect(y),d.tempGain=y,y.connect(u||(h?this.musicGain:this.sfxGain)),d.onended=()=>{d.disconnect(),y.disconnect()},d}catch(c){return console.error("Failed to create LiaAudioSrc:",c),null}}},Z=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];function Ee(n){return Z.includes(n)}var K=class{numberOfInputs;numberOfOutputs;constructor(e,t=k.audioCtx){this.context=t,this.buffer=e,this.source=null,this.startTime=0,this.pauseTime=0,this.playbackRate=1,this.isPlaying=!1,this.loop=!1,this.output=E?t.createGain():null,this.output.gain.value=1,this.channelCount=2,this.channelCountMode="max",this.channelInterpretation="speakers",this.numberOfInputs=0,this.numberOfOutputs=1,this.onended=null}channelCount;channelCountMode;channelInterpretation;onended;source;buffer;context;_createSource(){this.source&&(this.source.onended=null);let e=this.context.createBufferSource();return e.buffer=this.buffer,e.playbackRate.value=this.playbackRate,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd>0?this.loopEnd:this.buffer.duration,e.connect(this.output),this.source=e,e.onended=()=>{this.source===e&&(this.isPlaying&&!this.loop&&(this.isPlaying=!1,this.pauseTime=0),typeof this.onended=="function"&&this.onended())},e}play({fadeIn:e=0,offset:t=null}={}){let r=t!==null?t:this.pauseTime;if(this.source){this.source.onended=null;try{this.source.stop()}catch{}}this.source=this._createSource(),this.startTime=this.context.currentTime-r/this.playbackRate,this.source.start(0,r),e>0?(this.output.gain.setValueAtTime(0,this.context.currentTime),this.output.gain.linearRampToValueAtTime(1,this.context.currentTime+e)):this.output.gain.setValueAtTime(1,this.context.currentTime),this.isPlaying=!0}start(e=0,t=0,r){this.isPlaying||(this.source=this._createSource(),this.startTime=this.context.currentTime+e-t/this.playbackRate,r!==void 0?this.source.start(this.context.currentTime+e,t,r):this.source.start(this.context.currentTime+e,t),this.pauseTime=t,this.isPlaying=!0)}pause({fadeOut:e=0}={}){if(!this.isPlaying)return;let t=this.getElapsed()/1e3;if(this.loop&&this.loopEnd>this.loopStart){let r=this.loopEnd-this.loopStart;t=this.loopStart+(t-this.loopStart)%r}if(this.isPlaying=!1,e>0){let r=this.context.currentTime;this.output.gain.setValueAtTime(this.output.gain.value,r),this.output.gain.linearRampToValueAtTime(0,r+e),setTimeout(()=>{if(this.source){this.source.onended=null;try{this.source.stop()}catch{}}this.pauseTime=t,this.output.gain.setValueAtTime(1,this.context.currentTime)},e*1e3)}else{if(this.source){this.source.onended=null;try{this.source.stop()}catch{}}this.pauseTime=t}}getElapsed(){return this.isPlaying?(this.context.currentTime-this.startTime)*this.playbackRate*1e3:this.pauseTime*1e3}setSpeed(e){if(e<=0)throw new Error("Playback rate must be positive");let t=this.getElapsed()/1e3;this.playbackRate=e,this.isPlaying&&(this.pause(),this.pauseTime=t,this.play())}setLoop(e=!0){this.loop=e,this.source&&(this.source.loop=e)}loop;playbackRate;startTime;tempGain=null;connect(e,t=0,r=0){if("value"in e)this.output.connect(e,t);else return this.output.connect(e,t,r),e}disconnect(e,t,r){e===void 0?this.output.disconnect():this.output.disconnect(e,t,r)}output;stop(e=0){if(this.notIndependent)return this.pause();if(!this.source)return;let t=this.context.currentTime+e;this.source.stop(t),this.isPlaying=!1,this.notIndependent||(this.pauseTime=0)}pauseTime;isPlaying;notIndependent=!1;loopStart=0;loopEnd=0},ee={osc:{enabled:!0,type:"sine",freq:440,detune:0},noise:{enabled:!1,level:.5},ampEnv:{attack:.005,decay:.1,sustain:0,release:.1,volume:.3},pitchEnv:{amount:0,decay:.2},filter:{enabled:!1,type:"lowpass",freq:1200,Q:1,envAmount:0,decay:.2},lfo:{enabled:!1,target:"freq",rate:8,depth:20},duration:.4},T=class n{constructor(e={}){this.ctx=k.audioCtx,this.cfg=structuredClone(ee),Object.assign(this.cfg,e)}ctx;cfg;play(e=k.sfxGain){let t=this.ctx,r=t.currentTime,s=this.cfg,o=t.createGain();o.gain.setValueAtTime(1e-4,r);let l=s.ampEnv;o.gain.exponentialRampToValueAtTime(l.volume,r+l.attack),o.gain.exponentialRampToValueAtTime(Math.max(1e-4,l.sustain*l.volume),r+l.attack+l.decay),o.gain.exponentialRampToValueAtTime(1e-4,r+s.duration+l.release);let h=o,u;s.filter.enabled&&(u=t.createBiquadFilter(),u.type=s.filter.type,u.frequency.value=s.filter.freq,u.Q.value=s.filter.Q,u.connect(o),h=u);let c;if(s.osc.enabled){if(c=t.createOscillator(),c.type=s.osc.type,c.frequency.value=s.osc.freq,c.detune.value=s.osc.detune,s.pitchEnv.amount!==0){let a=Math.pow(2,s.pitchEnv.amount/12);c.frequency.exponentialRampToValueAtTime(s.osc.freq*a,r+s.pitchEnv.decay)}c.connect(h),c.start(r),c.stop(r+s.duration+l.release)}let d;if(s.noise.enabled){let a=t.sampleRate*s.duration,f=t.createBuffer(1,a,t.sampleRate),b=f.getChannelData(0);for(let x=0;x<a;x++)b[x]=(Math.random()*2-1)*s.noise.level;d=t.createBufferSource(),d.buffer=f,d.connect(h),d.start(r),d.stop(r+s.duration+l.release)}let y,m;s.lfo.enabled&&c&&(y=t.createOscillator(),y.frequency.value=s.lfo.rate,m=t.createGain(),m.gain.value=s.lfo.depth,y.connect(m),s.lfo.target==="freq"?m.connect(c.frequency):s.lfo.target==="gain"?m.connect(o.gain):s.lfo.target==="filter"&&u&&m.connect(u.frequency),y.start(r),y.stop(r+s.duration)),o.connect(e);let i=[c,d,y,m,u,o],p=r+s.duration+l.release;setTimeout(()=>{i.forEach(a=>a?.disconnect())},(p-t.currentTime)*1e3)}getConfig(){return structuredClone(this.cfg)}setConfig(e){return Object.assign(this.cfg,e),this}getKey(e){return this.cfg[e]}setKey(e,t){return Object.assign(this.cfg[e],t),this}setFreq(e){return this.cfg.osc.freq=e,this}setWave(e){return this.cfg.osc.type=e,this}setVolume(e){return this.cfg.ampEnv.volume=e,this}setAmpEnv(e,t,r,s){return Object.assign(this.cfg.ampEnv,{attack:e,decay:t,sustain:r,release:s}),this}setPitchEnv(e,t){return Object.assign(this.cfg.pitchEnv,{amount:e,decay:t}),this}setNoiseEnabled(e){return this.cfg.noise.enabled=e,this}setNoiseLevel(e){return this.cfg.noise.level=e,this}setFilterEnabled(e){return this.cfg.filter.enabled=e,this}setFilter(e,t,r){return Object.assign(this.cfg.filter,{type:e,freq:t,Q:r,enabled:!0}),this}setLFOEnabled(e){return this.cfg.lfo.enabled=e,this}setLFO(e,t,r){return Object.assign(this.cfg.lfo,{target:e,rate:t,depth:r,enabled:!0}),this}setDuration(e){return this.cfg.duration=e,this}clone(){return new n(structuredClone(this.cfg))}},te=new T({osc:{enabled:!0,type:"square",freq:900,detune:0},ampEnv:{attack:.002,decay:.04,sustain:0,release:.02,volume:.15},duration:.05}),ne=new T({osc:{enabled:!0,type:"sine",freq:600,detune:0},ampEnv:{attack:.01,decay:.08,sustain:0,release:.04,volume:.12},duration:.1}),re=new T({osc:{enabled:!0,type:"triangle",freq:500,detune:0},pitchEnv:{amount:12,decay:.15},ampEnv:{attack:.01,decay:.12,sustain:0,release:.05,volume:.25},duration:.18}),se=new T({osc:{enabled:!0,type:"sawtooth",freq:1200,detune:0},pitchEnv:{amount:-24,decay:.3},ampEnv:{attack:.005,decay:.25,sustain:0,release:.05,volume:.3},duration:.35}),ie=new T({osc:{enabled:!0,type:"square",freq:180,detune:0},noise:{enabled:!0,level:.4},ampEnv:{attack:.002,decay:.15,sustain:0,release:.05,volume:.35},duration:.2}),we=new Map([["ui_click",te],["ui_hover",ne],["jump",re],["laser",se],["hit",ie]]);function Te(n=12){let e=Date.now().toString(36),t=crypto.getRandomValues(new Uint8Array(n)),r=Array.from(t).map(s=>s.toString(36).padStart(2,"0")).join("");return(e+r).slice(0,n)}function B(n=12){let e=Date.now().toString(36),t=crypto.getRandomValues(new Uint8Array(4)),r=Array.from(t).map(s=>s.toString(36).padStart(2,"0")).join("");return(e+r).slice(0,n)}var U=class{peer=null;key;events={};mbAcc=0;connected=!1;constructor(){this.key=`${ae()}_${Date.now()}`}connect(e){e&&(this.peer=e,e.peer=this,this.connected=!0,e.connected=!0),this._emit("open")}isConnected(){return this.connected&&!!this.peer}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter(r=>r!==t))}_emit(e,t){this.events[e]?.forEach(r=>r(t))}send(e,t){if(!this.peer)throw new Error("No peer connected");this.peer._receive(e,t)}_receive(e,t){e?this._emit(e,t):this._emit("message",t)}close(){if(this.connected=!1,this.peer){let e=this.peer;this.peer=null,e.peer=null,e.connected=!1,e._emit("close")}this._emit("close")}getKey(){return this.key}};function ae(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){let n=new Uint8Array(16);return crypto.getRandomValues(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128,[...n].map(e=>e.toString(16).padStart(2,"0")).join("").replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/,"$1-$2-$3-$4-$5")}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{let e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)})}function oe(n){let e=!0;function t(){e&&(n(),requestAnimationFrame(t))}return requestAnimationFrame(t),{clear:()=>e=!1}}function ue(n,e,t,r,s){let o=Math.cos(s),l=Math.sin(s),h=[];if(o!==0){let u=(0-n)/o,c=e+u*l;u>0&&c>=0&&c<=r&&h.push({side:"left",t:u})}if(o!==0){let u=(t-n)/o,c=e+u*l;u>0&&c>=0&&c<=r&&h.push({side:"right",t:u})}if(l!==0){let u=(0-e)/l,c=n+u*o;u>0&&c>=0&&c<=t&&h.push({side:"top",t:u})}if(l!==0){let u=(r-e)/l,c=n+u*o;u>0&&c>=0&&c<=t&&h.push({side:"bottom",t:u})}return h.length===0?null:(h.sort((u,c)=>u.t-c.t),h[0])}function ce(n,e){let t;switch(e){case"left":case"right":t=Math.PI-n;break;case"top":case"bottom":t=2*Math.PI-n;break}return(t%(2*Math.PI)+2*Math.PI)%(2*Math.PI)}function Ce(n,e,t,r,s){let o=ue(n,e,t,r,s);return o?{...o,avoidAngle:ce(s,o.side)}:null}function le(){return L?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}var Se=le();var P={};X(P,{KaylaFragment:()=>_e,KaylaInternals:()=>S,createElement:()=>ke,createGame:()=>Re,createReassignableObject:()=>De,createRenderer:()=>Ie,createScene:()=>Ke,self:()=>G,useDisposableRef:()=>Le,useEffect:()=>W,useEntity:()=>Fe,useExports:()=>Me,useNextStack:()=>he,usePaint:()=>j,useRef:()=>V,useSelf:()=>Ae,useState:()=>$,useTick:()=>Pe});function Re({width:n,height:e,updateHz:t="frames"}){return new S.KaylaGame(n,e,t==="frames"?1/0:t)}function Ke(n){let e=new A(n);return new S.KaylaScene(e)}function Ie(n){return new S.KaylaRenderer(n)}function ke(n,e){return{type:n,props:e}}var S;(y=>{class n extends F{#e;#t;constructor(i,p,a){super(i,p,a),this.#e=new Set,this.#t=!1}get started(){return this.#t}start(){if(!this.#t){for(let i of this.#e)i.start();this.#t=!0,super.start()}}stop(){if(this.#t){for(let i of this.#e)i.stop();this.#t=!1,super.stop()}}addRenderer(i){this.#e.has(i)||(this.#e.add(i),this.#t&&i.start(),i.game=this)}deleteRenderer(i){this.#e.has(i)&&(this.#e.delete(i),this.#t&&i.stop(),delete i.game)}}y.KaylaGame=n;class e extends M{game;pointerX;pointerY;#e;constructor(i){super(i),this.useDraw=this.useDraw.bind(this),this.on("draw",p=>{if(this.game)for(let a of this.game.scenes.values())a.handleDraw(p)}),this.pointerX=0,this.pointerY=0,this.#e=this.#t.bind(this)}#t(i){this.pointerX=i.clientX,this.pointerY=i.clientY}listenPointerUpdates(){this.canvas.addEventListener("pointermove",this.#e)}unlistenPointerUpdates(){this.canvas.removeEventListener("pointermove",this.#e)}pointerPosToWorldPos(i,p){let a=this.canvas.getBoundingClientRect(),f=(i-a.left)/a.width,b=(p-a.top)/a.height,x=f*this.viewportWidth*this.cameraWidth/a.width,R=b*this.viewportHeight*this.cameraHeight/a.height;return new C(x,R)}getMousePos(){return this.pointerPosToWorldPos(this.pointerX,this.pointerY)}useDraw(i){let p=a=>{i(a,new r)};return this.on("draw",p),()=>{this.off("draw",p)}}attachTo(i){i.addRenderer(this),this.game=i}detach(){this.game&&this.game.deleteRenderer(this)}}y.KaylaRenderer=e;class t{current;saves;constructor(){this.saves=[]}useTick(i){if(!this.current)throw new Error("Hook 'useTick' must be executed in the top level scope of a component.");this.current.onTick[this.current.useStepCallIndex]=i,this.current.useStepCallIndex++}usePaint(i){if(!this.current)throw new Error("Hook 'usePaint' must be executed in the top level scope of a component.");this.current.onPaint[this.current.useDrawCallIndex]=i,this.current.useDrawCallIndex++}useEntity(){return V(G)}useSelf(i){let p=V(null);return(p.current===null||p.current===void 0)&&(p.current=i()),p.current}useState(i,{alwaysRecall:p=!1}={}){if(!this.current)throw new Error("Hook 'useState' must be executed in the top level scope of a component.");let f=this.current.state[this.current.useStateCallIndex]??new s(this.current,i,{alwaysRecall:p});return this.current.state[this.current.useStateCallIndex]=f,this.current.useStateCallIndex++,f}useRef(i){if(!this.current)throw new Error("Hook 'useRef' must be executed in the top level scope of a component.");let a=this.current.refs[this.current.useRefCallIndex]??l(i??null);return this.current.refs[this.current.useRefCallIndex]=a,this.current.useRefCallIndex++,a}useEffect(i){if(!this.current)throw new Error("Hook 'useEffect' must be executed in the top level scope of a component.");this.current.onEffect[this.current.useEffectCallIndex]=i,this.current.useEffectCallIndex++}useExports(i,p){if(!this.current)throw new Error("Hook 'useExports' must be executed in the top level scope of a component.");this.current.onExport=p}save(){this.saves.push({current:this.current})}restore(){let i=this.saves.pop();if(!i)throw new Error("Cannot restore without saving.");this.current=i.current}}y.GlobalKayla=t;class r{preventDefault(){this.#e=!0}#e=!1;isPrevented(){return this.#e}}y.KaylaEvent=r;class s{#e;#t;#n;alwaysRecall;constructor(i,p,{alwaysRecall:a=!1}={}){this.#t=i,this.#e=p??void 0,this.#n=Date.now(),this.alwaysRecall=a}get(){return this.#e}add(i,{recall:p}={}){this.set(this.get()+i,{recall:p})}multiply(i,{recall:p}={}){this.set(this.get()*i,{recall:p})}set(i,{recall:p=!1}={}){let a=this.#e;i!==a&&(this.#e=i,(p||this.alwaysRecall)&&this.#t.refresh(),this.#n=Date.now())}get value(){return this.#e}get lastChanged(){return this.#n}}y.KaylaState=s;class o{#e;constructor(i){this.#e=i??void 0}#t;setSetter(i){this.#t=i}get current(){return this.#e}set current(i){this.#e=i,this.#t&&this.#t(this.#e)}}y.KaylaInternalRef=o;function l(m){return new o(m)}y.createReassignableRef=l;class h{state;refs;global;callProps;scene;exports;constructor(i,p,a){if(!a)throw new Error("Empty element");this.scene=p,this.state=[],this.refs=[],this.fc=a.type,this.callProps=a.props??{},this.global=i,this.lastStateDeps=[],this.entity=null,this.lastChildren=[],this.onEffect=[],this.onUnEffect=[],this.onPaint=[],this.onTick=[]}get key(){return this.callProps.key}set key(i){this.callProps.key=i}get children(){return this.callProps.children}set children(i){this.callProps.children=i}entity;onExport=()=>({});onEffect;onUnEffect;onEffectDeps;onPaint;onTick;fc;useStateCallIndex=0;useEffectCallIndex=0;useDrawCallIndex=0;useStepCallIndex=0;useRefCallIndex=0;lastStateDeps;refresh(){let i;this.global.save(),this.global.current=this,this.useStateCallIndex=0,this.useRefCallIndex=0;let p=[];try{let a=this.fc(this.callProps)??[];if(a&&!Array.isArray(a)&&(a=[a]),!Array.isArray(a))throw new Error("Non array or non undefined children received.");p=a}catch(a){i=a}this.useStateCallIndex=0,this.useRefCallIndex=0,this.useDrawCallIndex=0,this.useStepCallIndex=0,this.useEffectCallIndex=0,this.global.restore();try{let a=0,f=[];for(let b of p){let x=this.lastChildren.at(a)??new h(this.global,this.scene,b);this.lastChildren[a]=x,f.push(x),a++}for(let b of this.lastChildren.filter(x=>!f.includes(x))){let x=this.lastChildren.indexOf(b);x!==1&&this.lastChildren.splice(x,1),b.unuse()}for(let b of this.lastChildren)try{b.refresh()}catch(x){console.error(x)}he(()=>{this.use()})}catch(a){console.error(a)}if(i)throw i}lastChildren;isFirstUse=!0;use(){try{let i=!0;if(this.lastStateDeps??=[],Array.isArray(this.onEffectDeps)&&(i=this.onEffectDeps.some((p,a)=>{let f=this.lastStateDeps.at(a);if(f){let b=p.lastChanged,x=f.stamp;return b>x}})),i||this.isFirstUse){this.isFirstUse=!1,Array.isArray(this.onEffectDeps)&&(this.lastStateDeps=this.onEffectDeps.map(a=>({stamp:a.lastChanged,stateRef:a}))),this.key??=this.fc.name+"_"+B(),this.entity&&this.scene.getScene().removeEntity(this.entity),this.entity&&this.entity.name!==this.key&&(this.entity=null),this.entity=this.entity??new u(this,this.key);for(let a of this.refs)a.current===G&&(a.current=this.entity);this.callProps.ref instanceof o&&(this.callProps.ref.current=this.entity),this.exports=this.onExport(),this.callProps.exportsRef instanceof o&&(this.callProps.exportsRef.current=this.exports),this.scene.getScene().addEntity(this.entity);let p=this.onEffect.map(a=>a()).filter(a=>a!==void 0);this.onUnEffect=p}}catch(i){throw i}}unuse(){try{for(let i of this.onUnEffect)i()}catch(i){console.error(i)}this.scene.getScene().removeEntity(this.entity)}}y.KaylaFiber=h;class u extends _{#e;constructor(i,p){super(p,0,0,0,0),this.#e=i}update(i){let p=new r;if(this.#e.onTick)for(let a of this.#e.onTick)a(i,p);p.isPrevented()}draw(i){let p=new r;if(this.#e.onPaint)for(let a of this.#e.onPaint)a(i,p);p.isPrevented()||super.draw(i)}}y.KaylaRectEntity=u;class c{constructor(i){this.#t=i,this.#e=null,i.on("update",this.tickHandler.bind(this)),this.drawHandler=this.drawHandler.bind(this)}#e;#t;getScene(){return this.#t}drawHandler(i){return this.#t.handleDraw(i)}attachTo(i){i.addScene(this.#t),this.#e=i}spawn(i){new h(y.singleGlobalInstance,this,i).refresh()}detach(){this.#e&&this.#e.removeScene(this.#t)}tickHandler(){}}y.KaylaScene=c,y.singleGlobalInstance=new y.GlobalKayla})(S||={});var g=S.singleGlobalInstance,$=g.useState.bind(g),V=g.useRef.bind(g),W=g.useEffect.bind(g),Pe=g.useTick.bind(g),j=g.usePaint.bind(g),Me=g.useExports.bind(g),Ae=g.useSelf.bind(g),Fe=g.useEntity.bind(g),G=Symbol("self_ref");var he=n=>{Promise.resolve(1).then(()=>n())},_e=({children:n})=>Array.isArray(n)?[...n]:n;function Le(n){return S.createReassignableRef(n)}function De(n){if(typeof n!="object"||typeof n=="function"||n===null)return n;let e={current:n};return new Proxy({},{get(r,s,o){return s==="reassignSelf"?l=>{e.current=l}:Reflect.get(e.current,s,o)},set(r,s,o,l){return Reflect.set(e.current,s,o,l)},has(r,s){return Reflect.has(e.current,s)},ownKeys(r){return Reflect.ownKeys(e.current)},getOwnPropertyDescriptor(r,s){return Reflect.getOwnPropertyDescriptor(e.current,s)},deleteProperty(r,s){return Reflect.deleteProperty(e.current,s)}})}Reflect.set(globalThis,"Kayla",P);var Ve;(e=>e.UIComponent=({x:t,y:r,width:s,height:o,children:l})=>{let h=V(G),u=$(!1);return W(()=>{if(u.get()===!0)return;u.set(!0);let c=h.current;c.width=s,c.height=o,c.x=t,c.y=r}),j(c=>{c.fillStyle="rgba(0, 0, 0, 0.5)",c.fillRect(t,r,s,o)}),l??[]})(Ve||={});var Ge={LEA:D,Kayla:P};0&&(module.exports={Kayla,LEA});
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Ce=Object.defineProperty;var q=(n,e)=>{for(var t in e)Ce(n,t,{get:e[t],enumerable:!0})};var O={};q(O,{DeltaTweenII:()=>G,ENVIRONMENT:()=>$,GEmitterMemory:()=>B,LeaEntityII:()=>I,LeaEventEmitter:()=>w,LeaGameII:()=>_,LeaRendererII:()=>A,LeaSceneII:()=>F,LeaSerializers:()=>Q,LeaTickerII:()=>V,LeaTimeout:()=>N,LeaUtilsII:()=>v,LiaAudio:()=>k,LiaAudioSrc:()=>K,LiaOscSFX:()=>T,LiaSFXMap:()=>Pe,NOTE_NAMES:()=>ee,RectLeaEntity:()=>L,Vector2:()=>S,colToRGBA:()=>Re,defaultSFXConfig:()=>te,editRGBA:()=>Ke,generateUUID:()=>oe,getAvoidAngle:()=>le,getEnvironment:()=>Z,getNormalizedColor:()=>Se,getRayHit:()=>ce,isInitiallyMobile:()=>Fe,isMobile:()=>he,isNode:()=>D,isNote:()=>ke,isWeb:()=>E,parseFillStyle:()=>J,raycastAvoid:()=>Ae,scaleCoord:()=>Ie,setAnimInterval:()=>ue,sfxHit:()=>ae,sfxJump:()=>se,sfxLaser:()=>ie,sfxUIClick:()=>ne,sfxUIHover:()=>re,shortUID:()=>Me,tinyUID:()=>W});var w=class{#e=new Map;constructor(){this.#e=new Map}on(e,t){let r=this.#e.get(e)||[];return r.push(t),this.#e.set(e,r),this}once(e,t){let r=(...s)=>{this.off(e,r),t(...s)};return this.on(e,r),this}off(e,t){let r=this.#e.get(e);if(!r)return this;let s=r.indexOf(t);return s>=0&&r.splice(s,1),this}emit(e,...t){let r=this.#e.get(e);if(!r||r.length===0){if(e==="error")throw t[0];return!1}return r.slice().forEach(s=>s(...t)),!0}removeAllListeners(e){return e?this.#e.delete(e):this.#e.clear(),this}listenerCount(e){return this.#e.get(e)?.length??0}},A=class extends w{canvas;ctx;running;_rafId;_fps;_frameCount;_fpsTimer;_lastFrameTime;constructor(e,{viewportWidth:t,viewportHeight:r,cameraWidth:s,cameraHeight:o}={}){if(!E)throw new Error("Web-Only");super(),this.canvas=e,this.ctx=e.getContext("2d"),this.automatic=!0,this.#e=t??e.width,this.#t=r??e.height,this.#n=s??e.width,this.#r=o??e.height,this.running=!1,this._rafId=null,this._loop=this._loop.bind(this),this.updateCanvasResolution(),this._fps=60,this._frameCount=0,this._fpsTimer=0}automatic;retransform(){this.ctx.setTransform(1,0,0,1,0,0);let e=this.#n/this.#e,t=this.#r/this.#t;this.ctx.translate(this.#n/2,this.#r/2),this.ctx.scale(e,t),this.ctx.translate(-this.#e/2,-this.#t/2)}#e=0;#t=0;#n=0;#r=0;get viewportWidth(){return this.#e}set viewportWidth(e){this.#e=e,this.retransform()}get width(){return this.#e}get height(){return this.#t}get centerX(){return this.#e/2}get centerY(){return this.#t/2}get left(){return 0}get top(){return 0}get right(){return this.#e}get bottom(){return this.#t}get viewportHeight(){return this.#t}set viewportHeight(e){this.#t=e,this.retransform()}get cameraWidth(){return this.#n}set cameraWidth(e){this.#n=e,this.updateCanvasResolution(),this.retransform()}get cameraHeight(){return this.#r}set cameraHeight(e){this.#r=e,this.updateCanvasResolution(),this.retransform()}updateCanvasResolution(){this.canvas.width=this.#n,this.canvas.height=this.#r}applyTransform(){this.retransform()}get FPS(){return this._fps}_loop(){this.automatic&&this.update(),this._rafId=requestAnimationFrame(this._loop)}update(){if(!this.running||!E)return;let e=performance.now(),t=(e-(this._lastFrameTime??e))/1e3;this._lastFrameTime=e,this._frameCount++,this._fpsTimer+=t,this._fpsTimer>=1&&(this._fps=Math.round(this._frameCount/this._fpsTimer),this._frameCount=0,this._fpsTimer=0),this.ctx.clearRect(0,0,this.#n,this.#r),this.emit("draw",this.ctx)}start(){if(!this.running){if(!E||typeof globalThis.requestAnimationFrame>"u")throw new Error("Raf is not supported");this.running=!0,this._rafId=requestAnimationFrame(this._loop)}}stop(){if(!E||typeof globalThis.requestAnimationFrame>"u")throw new Error("Raf is not supported");this.running=!1,this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null)}},V=class extends w{setNow(e){this.#e=e}#e=0;__intervalId=null;__lastTime=0;constructor(e=16){super(),this.#t=e,this.speedHackDT=1}speedHackDT;get isRaf(){return this.tickInterval===1/0}#t=15;get tickInterval(){return this.#t}set tickInterval(e){this.#t=e,this.__intervalId&&(this.stop(),this.start())}now(){return this.#e}__tick(){let e=performance.now(),t=(e-this.__lastTime)/1e3*this.speedHackDT;this.__lastTime=e,this.#e+=t*1e3,this.emit("tick",t)}createTimeout(e){return new N(e,this)}createTween(e,t=()=>{}){let r=new G(e),s=(o=0)=>{if(r.finished){this.off("tick",s);return}r.update(o)};return r.on("finish",()=>{this.off("tick",s)}),r.on("delta",o=>{t(o)}),this.on("tick",s),r}start(){this.__intervalId===null&&(this.__lastTime=performance.now(),this.__intervalId=E&&!isFinite(this.tickInterval)?ue(()=>this.__tick()).clear:setInterval(()=>this.__tick(),this.tickInterval))}stop(){this.__intervalId!==null&&(typeof this.__intervalId=="function"?this.__intervalId():clearInterval(this.__intervalId)),this.__intervalId=null}getSineMod(e,t=0){return .5+.5*Math.sin((this.now()%e/e+t)*2*Math.PI)}},Q;(p=>{function n(a){return a===!0?1:0}p.booleanExport=n;function e(a){return a===0?!1:a===1}p.booleanImport=e;function t(a){return`${a.x}|${a.y}`}p.vec2Export=t;function r(a){let[f,b]=a.split("|"),x=parseFloat(f),R=parseFloat(b);if(isNaN(x)||isNaN(R))throw new Error(`Invalid Vector2 string: ${a}`);return new S(x,R)}p.vec2Import=r,p.booleanMap={mapExport:n,mapImport:e};function o(a){return f=>Number(f.toFixed(a))}p.createRounder=o;function l(a=10){return{mapExport(f){return Math.round(f/a)},mapImport(f){return f*a}}}p.createLowPrecision=l;function h(a){return Math.round(a)}p.lightWeightRounder=h;function u(a=100){return{mapExport(f){return Math.round(f*a)},mapImport(f){return f/a}}}p.createPercent=u;function c(a){let f=new Map(Object.entries(a));return{mapExport:b=>f.get(b)??null,mapImport:b=>Array.from(f.entries()).find(([x,R])=>R===b)?.[0]??null}}p.createLookup=c;function d(a){let f=a*(180/Math.PI);return Math.round((f%360+360)%360)}p.radToDeg=d;function y(a){return a*(Math.PI/180)}p.degToRad=y,p.angleRadToDeg={mapExport:d,mapImport:y};function i(a=10){let f=l(a);return{mapExport(b){return f.mapExport(d(b))},mapImport(b){return f.mapImport(y(b))}}}p.createLowPrecisionRadToDeg=i})(Q||={});var I=class n extends w{name="";scaleRotate=0;scale=1;constructor(e,t=0,r=0){super(),this.autoTranslate=!1,this.name=e,this.z=0,this.___pos=new S(t,r),this.nonSerializableProperties=[],this.nonSerializableProperties.push("___pos","autoTranslate","arraySerializeMap"),this.forceSerializableProperties=[],this.forceSerializableProperties.push("x","y")}arraySerializeMap;autoTranslate;z;___pos;nonSerializableProperties;forceSerializableProperties;get pos(){return this.___pos}get x(){return this.pos.x}get y(){return this.pos.y}set x(e){this.pos.x=e}set y(e){this.pos.y=e}handleUpdate(e){if(this.update)try{this.emit("update",e),this.update(e)}catch(t){this.emit("error",t)}}handleDraw(e){if(!(D||!this.draw)){e.save(),this.autoTranslate&&e.translate(this.x,this.y);try{this.emit("draw",e),this.draw(e)}catch(t){this.emit("error",t)}e.restore()}}serialize(){if(Array.isArray(this.arraySerializeMap))return this.arraySerializeMap.map(([s,{mapExport:o}])=>{let l=Reflect.get(this,s);return o?o(l):l});let e=["_events","_eventsCount","_maxListeners","nonSerializableProperties","forceSerializableProperties"],t=[...Reflect.ownKeys(this),...this.forceSerializableProperties].filter(s=>!this.nonSerializableProperties.includes(s)&&!e.includes(s.toString())),r=Object.fromEntries(t.map(s=>{let o=Reflect.get(this,s);if(D&&typeof o=="number"){let l=o.toString().split("."),u=(l[1]?l[1].length:0)>2?Number(o.toFixed(2)):o;return[s,u]}return[s,o]}));return JSON.parse(JSON.stringify(r))}toLocal(e){return e.subtract(this.pos)}toWorld(e){return e.add(this.pos)}deserializeArray(e){return n.deserializeArray(this.arraySerializeMap,e)}static deserializeArray(e,t){if(!e||!Array.isArray(t))return t;let r={};for(let s=0;s<t.length;s++){let o=e[s];if(!o)break;let[l,{mapImport:h}]=o,u=t[s];if(h&&(u=h(u)),typeof l!="string")break;try{Reflect.set(r,l,u)}catch(c){console.error(c)}}return r}},F=class extends w{name="";entities=new Map;paused=!0;constructor(e){super(),this.name=e}handleUpdate(e){if(!this.paused){this.emit("update",e);for(let t of this.entities.values())t.handleUpdate(e)}}handleDraw(e){if(!D&&!this.paused){this.emit("draw",e);for(let t of[...this.entities.values()].sort((r,s)=>r.z-s.z))t.handleDraw(e)}}addEntity(e){if(!(e instanceof I))throw new Error("invalid entity");if(!e.name)throw new Error("Entity must have a name.");this.entities.set(e.name,e)}removeEntity(e){if(!(e instanceof I))throw new Error("invalid entity");this.entities.delete(e.name)}getEntity(e){return this.entities.get(e)}},_=class{scenes;ticker;get centerX(){return this.width/2}get centerY(){return this.height/2}get left(){return 0}get top(){return 0}get right(){return this.width}get bottom(){return this.height}width;height;constructor(e,t,r=16){this.ticker=new V(r),this.scenes=new Map,this.width=e,this.height=t,this.ticker.on("tick",s=>{for(let o of this.scenes.values())o.paused||o.handleUpdate(s)})}addScene(e){if(!e.name)throw new Error("Scene must have a name.");e.paused=!1,this.scenes.set(e.name,e)}removeScene(e){e&&(e.paused=!0),this.scenes.delete(e.name)}now(){return this.ticker.now()}start(){this.ticker.start()}stop(){this.ticker.stop()}},v={lerp(n,e,t){return n+(e-n)*t},clamp(n,e,t){return Math.min(t,Math.max(e,n))},clamp01(n){return Math.min(1,Math.max(0,n))},easeLinear(n){return n},easeInQuad(n){return n*n},easeOutQuad(n){return 1-(1-n)*(1-n)},easeInOutQuad(n){return n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2},easeInSine(n){return 1-Math.cos(n*Math.PI/2)},easeOutSine(n){return Math.sin(n*Math.PI/2)},easeInOutSine(n){return-(Math.cos(Math.PI*n)-1)/2},easeInExpo(n){return n===0?0:Math.pow(2,10*n-10)},easeOutExpo(n){return n===1?1:1-Math.pow(2,-10*n)},easeInOutExpo(n){return n===0?0:n===1?1:n<.5?Math.pow(2,20*n-10)/2:(2-Math.pow(2,-20*n+10))/2},smoothstep(n){return n=v.clamp(n,0,1),n*n*(3-2*n)},randomLerp(n,e){return v.lerp(n,e,Math.random())},randomInt(n,e){return Math.floor(Math.random()*(e-n+1))+n},randomArrayValue(n){return n[v.randomInt(0,n.length-1)]},createBezier(n,e,t,r){function s(h,u,c,d,y){let m=1-h;return m*m*m*u+3*m*m*h*c+3*m*h*h*d+h*h*h*y}function o(h,u,c,d,y){let m=1-h;return 3*m*m*(c-u)+6*m*h*(d-c)+3*h*h*(y-d)}function l(h){let u=h;for(let c=0;c<6;c++){let d=s(u,0,n,t,1),y=o(u,0,n,t,1);if(y===0)break;u-=(d-h)/y}return v.clamp(u,0,1)}return function(u){u=v.clamp(u,0,1);let c=l(u);return s(c,0,e,r,1)}},lengthSquared(...n){return n.reduce((e,t)=>e+t*t,0)},normalizeRad(n){let e=2*Math.PI;return n=n%e,n<0&&(n+=e),n},angleInvertY(n){return v.normalizeRad(-n)},degToRadFlipY(n){return v.angleInvertY(n*Math.PI/180)},minimalAngularDirection(n,e){n=v.normalizeRad(n),e=v.normalizeRad(e);let t=v.normalizeRad(e-n),r=v.normalizeRad(n-e);return t<=r?1:-1}},G=class extends w{constructor({delta:e,ms:t,easing:r}){super(),this.delta=e,this.duration=t,this.elapsed=0,this.easing=r??(s=>s),this.lastValue=0,this.finished=!1}delta;duration;elapsed;lastValue;finished;easing;update(e){this.elapsed+=e*1e3;let t=v.clamp(this.elapsed/this.duration,0,1),r=this.easing(t),s=this.delta*r,o=s-this.lastValue;this.lastValue=s,this.emit("delta",o),t>=1&&(this.finished=!0,this.emit("finish",void 0))}},L=class extends I{constructor(e,t=0,r=0,s=50,o=50){super(e,t,r),this.width=s,this.height=o}width;height;get left(){return this.x-this.width/2}set left(e){this.x=e+this.width/2}get right(){return this.x+this.width/2}set right(e){this.x=e-this.width/2}get top(){return this.y-this.height/2}set top(e){this.y=e+this.height/2}get bottom(){return this.y+this.height/2}set bottom(e){this.y=e-this.height/2}get lx(){return 0}get ly(){return 0}get lleft(){return-this.width/2}get lright(){return this.width/2}get ltop(){return-this.height/2}get lbottom(){return this.height/2}isCollidingWith(e){return!(this.right<e.left||this.left>e.right||this.bottom<e.top||this.top>e.bottom)}color="rgba(0, 0, 255, 0.3)";draw(e){e.translate(this.x,this.y),e.rotate(this.scaleRotate),e.fillStyle=this.color,e.fillRect(-this.width/2,-this.height/2,this.width,this.height)}},N=class extends w{duration;ticker;elapsed;finished;_resolve;promise;_timeoutId;constructor(e,t=null){super(),this.duration=e,this.ticker=t,this.elapsed=0,this.finished=!1,this._resolve=null,this.promise=new Promise(r=>this._resolve=r),this.update=this.update.bind(this),this.ticker&&this.ticker.on("tick",this.update)}update(e=0){this.finished||(this.elapsed+=e*1e3,this.elapsed>=this.duration&&this.finish())}finish(){this.finished||(this.finished=!0,this.emit("finish",void 0),this._resolve&&this._resolve(),this.ticker&&this.ticker.off("tick",this.update))}start(){return this.ticker||(this._timeoutId=setTimeout(()=>this.finish(),this.duration)),this}cancel(){this.finished||(this.finished=!0,!this.ticker&&this._timeoutId!=null&&clearTimeout(this._timeoutId),this.ticker&&this.ticker.off("tick",this.update))}then(e,t){return this.promise.then(e,t)}after(e,t){return this.promise.then(e,t)}},S=class n{constructor(e=0,t=0){this.x=e,this.y=t}x;y;toJSON(){return{x:this.x,y:this.y,vec2:!0}}static isVec2(e){return e&&typeof e=="object"&&"x"in e&&"y"in e&&e.vec2===!0}static fromSerialized(e){return this.isVec2(e)?new this(e.x,e.y):null}rotate(e){let t=Math.cos(e),r=Math.sin(e);return new n(this.x*t-this.y*r,this.x*r+this.y*t)}static from(e){return new n(Math.cos(e),Math.sin(e))}get angle(){return Math.atan2(this.y,this.x)}get length(){return Math.hypot(this.x,this.y)}get lengthSquared(){return this.x*this.x+this.y*this.y}normalized(){let e=this.length;return e===0?new n(0,0):new n(this.x/e,this.y/e)}project(e){return e.scale(this.dotNormalized(e))}reflect(e){let t=this.dot(e);return this.subtract(e.scale(2*t))}dotNormalized(e){let t=this.normalized(),r=e.normalized();return t.x*r.x+t.y*r.y}lengthSquaredTo(e){let t=this.x-e.x,r=this.y-e.y;return t*t+r*r}dot(e){return this.x*e.x+this.y*e.y}distanceTo(e){return Math.hypot(this.x-e.x,this.y-e.y)}distanceToCheap(e){let t=this.x-e.x,r=this.y-e.y;return t*t+r*r}directionTo(e){return new n(e.x-this.x,e.y-this.y).normalized()}add(e){return new n(this.x+e.x,this.y+e.y)}addRaw(e){return new n(this.x+e,this.y+e)}overwite(e){this.x=e.x,this.y=e.y}subtract(e){return new n(this.x-e.x,this.y-e.y)}scale(e){return new n(this.x*e,this.y*e)}toString(){return`Vector2(${this.x}, ${this.y})`}clone(){return new n(this.x,this.y)}};function Se(n){let e=/^rgba?\(([^)]+)\)$/,t=n.match(e);if(t){let[r,s,o,l=1]=t[1].split(",").map(h=>parseFloat(h));return{r:Math.max(0,Math.min(255,Math.floor(r))),g:Math.max(0,Math.min(255,Math.floor(s))),b:Math.max(0,Math.min(255,Math.floor(o))),a:Math.max(0,Math.min(1,Math.floor(l*255)/255))}}return J(n)}function Re(n){return`rgba(${n.r}, ${n.g}, ${n.b}, ${n.a})`}function J(n){if(n=n.trim().toLowerCase(),n[0]==="#"){let t,r,s;if(n.length===7)t=parseInt(n.slice(1,3),16),r=parseInt(n.slice(3,5),16),s=parseInt(n.slice(5,7),16);else if(n.length===4)t=parseInt(n[1]+n[1],16),r=parseInt(n[2]+n[2],16),s=parseInt(n[3]+n[3],16);else throw new Error("Invalid hex color");return{r:t,g:r,b:s,a:1}}let e=n.match(/^rgba?\s*\(\s*(\d+)[, ]\s*(\d+)[, ]\s*(\d+)(?:[, ]\s*([\d.]+))?\s*\)$/);if(e)return{r:parseInt(e[1]),g:parseInt(e[2]),b:parseInt(e[3]),a:e[4]!==void 0?parseFloat(e[4]):1};throw new Error("Unsupported fillStyle format")}function Ke(n,{r:e,g:t,b:r,a:s}={}){let[o,l,h,u,c]=n.match(/rgba?\((\d+),\s*(\d+),\s*(\d+),?\s*([\d.]*)\)?/)||[];return`rgba(${e??l}, ${t??h}, ${r??u}, ${s??(c||1)})`}function Ie(n,e,t){return t+(n-t)*e}function Z(){return typeof process<"u"&&process.release?.name==="node"?"node":typeof window<"u"||typeof self<"u"?"web":"unknown"}var $=Z(),D=$==="node",E=$==="web",k=class n{static unlock(){E&&this.audioCtx.state!=="running"&&this.audioCtx.resume()}static audioCtx=E?new AudioContext:null;static masterGain=E?this.audioCtx.createGain():null;static musicGain=E?this.audioCtx.createGain():null;static sfxGain=E?this.audioCtx.createGain():null;static{E&&(this.masterGain.gain.value=1,this.musicGain.gain.value=1,this.sfxGain.gain.value=1,this.sfxGain.connect(this.masterGain),this.musicGain.connect(this.masterGain),this.masterGain.connect(this.audioCtx.destination))}static get SFX_VOLUME(){return this.sfxGain.gain.value}static get MUSIC_VOLUME(){return this.musicGain.gain.value}static get VOLUME(){return this.masterGain.gain.value}static set SFX_VOLUME(e){this.sfxGain.gain.value=e}static set MUSIC_VOLUME(e){this.musicGain.gain.value=e}static set VOLUME(e){this.masterGain.gain.value=e}static noteToHz(e){return this.tuningFreq*Math.pow(2,(e-9)/12)}static tuningFreq=440;static audioBufferCache=new Map;static loops=new Map;static sfsx=new Map;static loopIdCounter=0;static CACHE_NAME="lia-audio-cache-v1";static async preLoad(e){if(this.audioBufferCache.has(e))return this.audioBufferCache.get(e);let t=n.CACHE_NAME,r,s;if(typeof caches<"u"&&(s=await caches.open(t),r=await s.match(e)),!r){if(r=await fetch(e),!r.ok)throw new Error(`Failed to fetch ${e}`);s&&await s.put(e,r.clone())}let o=await r.arrayBuffer(),l=await this.audioCtx.decodeAudioData(o);return this.audioBufferCache.set(e,l),l}static async getOnlyDownloadedCache(e){let t=n.CACHE_NAME;return await(await caches.open(t)).match(e)}static getCached(e){return this.audioBufferCache.get(e)||null}static async playSound(e,t=.2,r=1,s=!0){try{this.sfsx.has(e)&&this.sfsx.get(e).source.stop(),this.audioBufferCache.has(e)||await this.preLoad(e);let o=this.getCached(e);if(!o)return;let l=new K(o);l.buffer=o;let h=1-.12,u=1+.12;l.playbackRate=r??h+Math.random()*(u-h);let c=this.audioCtx.createGain();c.gain.value=t,l.tempGain=c,l.connect(c),c.connect(this.sfxGain),l.onended=()=>{l.disconnect(),c.disconnect()},l.start(),s&&this.sfsx.set(e,{source:l,gain:c})}catch(o){console.error(o)}}static async playLoop(e,t=1,{loopStart:r=0,loopEnd:s=null,exclusive:o=!0,skipMS:l=0}={}){if(o)for(let y of this.loops.keys())this.stopLoop(y);this.audioBufferCache.has(e)||await this.preLoad(e);let h=this.getCached(e);if(!h)return;let u=new K(h);u.buffer=h,u.loop=!0,typeof r=="number"&&(u.loopStart=r),typeof s=="number"&&(u.loopEnd=s);let c=this.audioCtx.createGain();c.gain.value=t,u.tempGain=c,u.playbackRate=1,u.onended=()=>{u.disconnect(),c.disconnect()},u.connect(c),c.connect(this.musicGain),u.start(0,l/1e3);let d=++this.loopIdCounter;return this.loops.set(d,{source:u,gain:c}),d}static stopLoop(e){let t=this.loops.get(e);t&&(t.source.stop(),t.source.notIndependent||(t.source.disconnect(),t.gain.disconnect()),this.loops.delete(e))}static async createLiaSource(e,{volume:t=1,speed:r=1,loop:s=!1,loopStart:o=0,loopEnd:l=null,isMusic:h=!1,gain:u=null}={}){try{this.audioBufferCache.has(e)||await this.preLoad(e);let c=this.getCached(e);if(!c)return null;let d=new K(c);d.loop=s,d.loopStart=o,d.loopEnd=typeof l=="number"?l:c.duration,d.playbackRate=r;let y=this.audioCtx.createGain();return y.gain.value=t,d.connect(y),d.tempGain=y,y.connect(u||(h?this.musicGain:this.sfxGain)),d.onended=()=>{d.disconnect(),y.disconnect()},d}catch(c){return console.error("Failed to create LiaAudioSrc:",c),null}}},ee=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];function ke(n){return ee.includes(n)}var K=class{numberOfInputs;numberOfOutputs;constructor(e,t=k.audioCtx){this.context=t,this.buffer=e,this.source=null,this.startTime=0,this.pauseTime=0,this.playbackRate=1,this.isPlaying=!1,this.loop=!1,this.output=E?t.createGain():null,this.output.gain.value=1,this.channelCount=2,this.channelCountMode="max",this.channelInterpretation="speakers",this.numberOfInputs=0,this.numberOfOutputs=1,this.onended=null}channelCount;channelCountMode;channelInterpretation;onended;source;buffer;context;_createSource(){this.source&&(this.source.onended=null);let e=this.context.createBufferSource();return e.buffer=this.buffer,e.playbackRate.value=this.playbackRate,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd>0?this.loopEnd:this.buffer.duration,e.connect(this.output),this.source=e,e.onended=()=>{this.source===e&&(this.isPlaying&&!this.loop&&(this.isPlaying=!1,this.pauseTime=0),typeof this.onended=="function"&&this.onended())},e}play({fadeIn:e=0,offset:t=null}={}){let r=t!==null?t:this.pauseTime;if(this.source){this.source.onended=null;try{this.source.stop()}catch{}}this.source=this._createSource(),this.startTime=this.context.currentTime-r/this.playbackRate,this.source.start(0,r),e>0?(this.output.gain.setValueAtTime(0,this.context.currentTime),this.output.gain.linearRampToValueAtTime(1,this.context.currentTime+e)):this.output.gain.setValueAtTime(1,this.context.currentTime),this.isPlaying=!0}start(e=0,t=0,r){this.isPlaying||(this.source=this._createSource(),this.startTime=this.context.currentTime+e-t/this.playbackRate,r!==void 0?this.source.start(this.context.currentTime+e,t,r):this.source.start(this.context.currentTime+e,t),this.pauseTime=t,this.isPlaying=!0)}pause({fadeOut:e=0}={}){if(!this.isPlaying)return;let t=this.getElapsed()/1e3;if(this.loop&&this.loopEnd>this.loopStart){let r=this.loopEnd-this.loopStart;t=this.loopStart+(t-this.loopStart)%r}if(this.isPlaying=!1,e>0){let r=this.context.currentTime;this.output.gain.setValueAtTime(this.output.gain.value,r),this.output.gain.linearRampToValueAtTime(0,r+e),setTimeout(()=>{if(this.source){this.source.onended=null;try{this.source.stop()}catch{}}this.pauseTime=t,this.output.gain.setValueAtTime(1,this.context.currentTime)},e*1e3)}else{if(this.source){this.source.onended=null;try{this.source.stop()}catch{}}this.pauseTime=t}}getElapsed(){return this.isPlaying?(this.context.currentTime-this.startTime)*this.playbackRate*1e3:this.pauseTime*1e3}setSpeed(e){if(e<=0)throw new Error("Playback rate must be positive");let t=this.getElapsed()/1e3;this.playbackRate=e,this.isPlaying&&(this.pause(),this.pauseTime=t,this.play())}setLoop(e=!0){this.loop=e,this.source&&(this.source.loop=e)}loop;playbackRate;startTime;tempGain=null;connect(e,t=0,r=0){if("value"in e)this.output.connect(e,t);else return this.output.connect(e,t,r),e}disconnect(e,t,r){e===void 0?this.output.disconnect():this.output.disconnect(e,t,r)}output;stop(e=0){if(this.notIndependent)return this.pause();if(!this.source)return;let t=this.context.currentTime+e;this.source.stop(t),this.isPlaying=!1,this.notIndependent||(this.pauseTime=0)}pauseTime;isPlaying;notIndependent=!1;loopStart=0;loopEnd=0},te={osc:{enabled:!0,type:"sine",freq:440,detune:0},noise:{enabled:!1,level:.5},ampEnv:{attack:.005,decay:.1,sustain:0,release:.1,volume:.3},pitchEnv:{amount:0,decay:.2},filter:{enabled:!1,type:"lowpass",freq:1200,Q:1,envAmount:0,decay:.2},lfo:{enabled:!1,target:"freq",rate:8,depth:20},duration:.4},T=class n{constructor(e={}){this.ctx=k.audioCtx,this.cfg=structuredClone(te),Object.assign(this.cfg,e)}ctx;cfg;play(e=k.sfxGain){let t=this.ctx,r=t.currentTime,s=this.cfg,o=t.createGain();o.gain.setValueAtTime(1e-4,r);let l=s.ampEnv;o.gain.exponentialRampToValueAtTime(l.volume,r+l.attack),o.gain.exponentialRampToValueAtTime(Math.max(1e-4,l.sustain*l.volume),r+l.attack+l.decay),o.gain.exponentialRampToValueAtTime(1e-4,r+s.duration+l.release);let h=o,u;s.filter.enabled&&(u=t.createBiquadFilter(),u.type=s.filter.type,u.frequency.value=s.filter.freq,u.Q.value=s.filter.Q,u.connect(o),h=u);let c;if(s.osc.enabled){if(c=t.createOscillator(),c.type=s.osc.type,c.frequency.value=s.osc.freq,c.detune.value=s.osc.detune,s.pitchEnv.amount!==0){let a=Math.pow(2,s.pitchEnv.amount/12);c.frequency.exponentialRampToValueAtTime(s.osc.freq*a,r+s.pitchEnv.decay)}c.connect(h),c.start(r),c.stop(r+s.duration+l.release)}let d;if(s.noise.enabled){let a=t.sampleRate*s.duration,f=t.createBuffer(1,a,t.sampleRate),b=f.getChannelData(0);for(let x=0;x<a;x++)b[x]=(Math.random()*2-1)*s.noise.level;d=t.createBufferSource(),d.buffer=f,d.connect(h),d.start(r),d.stop(r+s.duration+l.release)}let y,m;s.lfo.enabled&&c&&(y=t.createOscillator(),y.frequency.value=s.lfo.rate,m=t.createGain(),m.gain.value=s.lfo.depth,y.connect(m),s.lfo.target==="freq"?m.connect(c.frequency):s.lfo.target==="gain"?m.connect(o.gain):s.lfo.target==="filter"&&u&&m.connect(u.frequency),y.start(r),y.stop(r+s.duration)),o.connect(e);let i=[c,d,y,m,u,o],p=r+s.duration+l.release;setTimeout(()=>{i.forEach(a=>a?.disconnect())},(p-t.currentTime)*1e3)}getConfig(){return structuredClone(this.cfg)}setConfig(e){return Object.assign(this.cfg,e),this}getKey(e){return this.cfg[e]}setKey(e,t){return Object.assign(this.cfg[e],t),this}setFreq(e){return this.cfg.osc.freq=e,this}setWave(e){return this.cfg.osc.type=e,this}setVolume(e){return this.cfg.ampEnv.volume=e,this}setAmpEnv(e,t,r,s){return Object.assign(this.cfg.ampEnv,{attack:e,decay:t,sustain:r,release:s}),this}setPitchEnv(e,t){return Object.assign(this.cfg.pitchEnv,{amount:e,decay:t}),this}setNoiseEnabled(e){return this.cfg.noise.enabled=e,this}setNoiseLevel(e){return this.cfg.noise.level=e,this}setFilterEnabled(e){return this.cfg.filter.enabled=e,this}setFilter(e,t,r){return Object.assign(this.cfg.filter,{type:e,freq:t,Q:r,enabled:!0}),this}setLFOEnabled(e){return this.cfg.lfo.enabled=e,this}setLFO(e,t,r){return Object.assign(this.cfg.lfo,{target:e,rate:t,depth:r,enabled:!0}),this}setDuration(e){return this.cfg.duration=e,this}clone(){return new n(structuredClone(this.cfg))}},ne=new T({osc:{enabled:!0,type:"square",freq:900,detune:0},ampEnv:{attack:.002,decay:.04,sustain:0,release:.02,volume:.15},duration:.05}),re=new T({osc:{enabled:!0,type:"sine",freq:600,detune:0},ampEnv:{attack:.01,decay:.08,sustain:0,release:.04,volume:.12},duration:.1}),se=new T({osc:{enabled:!0,type:"triangle",freq:500,detune:0},pitchEnv:{amount:12,decay:.15},ampEnv:{attack:.01,decay:.12,sustain:0,release:.05,volume:.25},duration:.18}),ie=new T({osc:{enabled:!0,type:"sawtooth",freq:1200,detune:0},pitchEnv:{amount:-24,decay:.3},ampEnv:{attack:.005,decay:.25,sustain:0,release:.05,volume:.3},duration:.35}),ae=new T({osc:{enabled:!0,type:"square",freq:180,detune:0},noise:{enabled:!0,level:.4},ampEnv:{attack:.002,decay:.15,sustain:0,release:.05,volume:.35},duration:.2}),Pe=new Map([["ui_click",ne],["ui_hover",re],["jump",se],["laser",ie],["hit",ae]]);function Me(n=12){let e=Date.now().toString(36),t=crypto.getRandomValues(new Uint8Array(n)),r=Array.from(t).map(s=>s.toString(36).padStart(2,"0")).join("");return(e+r).slice(0,n)}function W(n=12){let e=Date.now().toString(36),t=crypto.getRandomValues(new Uint8Array(4)),r=Array.from(t).map(s=>s.toString(36).padStart(2,"0")).join("");return(e+r).slice(0,n)}var B=class{peer=null;key;events={};mbAcc=0;connected=!1;constructor(){this.key=`${oe()}_${Date.now()}`}connect(e){e&&(this.peer=e,e.peer=this,this.connected=!0,e.connected=!0),this._emit("open")}isConnected(){return this.connected&&!!this.peer}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter(r=>r!==t))}_emit(e,t){this.events[e]?.forEach(r=>r(t))}send(e,t){if(!this.peer)throw new Error("No peer connected");this.peer._receive(e,t)}_receive(e,t){e?this._emit(e,t):this._emit("message",t)}close(){if(this.connected=!1,this.peer){let e=this.peer;this.peer=null,e.peer=null,e.connected=!1,e._emit("close")}this._emit("close")}getKey(){return this.key}};function oe(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){let n=new Uint8Array(16);return crypto.getRandomValues(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128,[...n].map(e=>e.toString(16).padStart(2,"0")).join("").replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/,"$1-$2-$3-$4-$5")}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{let e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)})}function ue(n){let e=!0;function t(){e&&(n(),requestAnimationFrame(t))}return requestAnimationFrame(t),{clear:()=>e=!1}}function ce(n,e,t,r,s){let o=Math.cos(s),l=Math.sin(s),h=[];if(o!==0){let u=(0-n)/o,c=e+u*l;u>0&&c>=0&&c<=r&&h.push({side:"left",t:u})}if(o!==0){let u=(t-n)/o,c=e+u*l;u>0&&c>=0&&c<=r&&h.push({side:"right",t:u})}if(l!==0){let u=(0-e)/l,c=n+u*o;u>0&&c>=0&&c<=t&&h.push({side:"top",t:u})}if(l!==0){let u=(r-e)/l,c=n+u*o;u>0&&c>=0&&c<=t&&h.push({side:"bottom",t:u})}return h.length===0?null:(h.sort((u,c)=>u.t-c.t),h[0])}function le(n,e){let t;switch(e){case"left":case"right":t=Math.PI-n;break;case"top":case"bottom":t=2*Math.PI-n;break}return(t%(2*Math.PI)+2*Math.PI)%(2*Math.PI)}function Ae(n,e,t,r,s){let o=ce(n,e,t,r,s);return o?{...o,avoidAngle:le(s,o.side)}:null}function he(){return D?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}var Fe=he();var Y={};q(Y,{Kayla:()=>U,KaylaFragment:()=>ve,KaylaInternals:()=>C,UI:()=>Te,createElement:()=>me,createGame:()=>pe,createReassignableObject:()=>we,createRenderer:()=>de,createScene:()=>fe,self:()=>M,useDisposableRef:()=>Ee,useEffect:()=>H,useEntity:()=>ge,useExports:()=>be,useNextStack:()=>j,usePaint:()=>X,useRef:()=>P,useSelf:()=>xe,useState:()=>z,useTick:()=>ye});var U={};q(U,{KaylaFragment:()=>ve,KaylaInternals:()=>C,createElement:()=>me,createGame:()=>pe,createReassignableObject:()=>we,createRenderer:()=>de,createScene:()=>fe,self:()=>M,useDisposableRef:()=>Ee,useEffect:()=>H,useEntity:()=>ge,useExports:()=>be,useNextStack:()=>j,usePaint:()=>X,useRef:()=>P,useSelf:()=>xe,useState:()=>z,useTick:()=>ye});function pe({width:n,height:e,updateHz:t="frames"}){return new C.KaylaGame(n,e,t==="frames"?1/0:t)}function fe(n){let e=new F(n);return new C.KaylaScene(e)}function de(n){return new C.KaylaRenderer(n)}function me(n,e){return{type:n,props:e}}var C;(y=>{class n extends _{#e;#t;constructor(i,p,a){super(i,p,a),this.#e=new Set,this.#t=!1}get started(){return this.#t}start(){if(!this.#t){for(let i of this.#e)i.start();this.#t=!0,super.start()}}stop(){if(this.#t){for(let i of this.#e)i.stop();this.#t=!1,super.stop()}}addRenderer(i){this.#e.has(i)||(this.#e.add(i),this.#t&&i.start(),i.game=this)}deleteRenderer(i){this.#e.has(i)&&(this.#e.delete(i),this.#t&&i.stop(),delete i.game)}}y.KaylaGame=n;class e extends A{game;pointerX;pointerY;#e;constructor(i){super(i),this.useDraw=this.useDraw.bind(this),this.on("draw",p=>{if(this.game)for(let a of this.game.scenes.values())a.handleDraw(p)}),this.pointerX=0,this.pointerY=0,this.#e=this.#t.bind(this)}#t(i){this.pointerX=i.clientX,this.pointerY=i.clientY}listenPointerUpdates(){this.canvas.addEventListener("pointermove",this.#e)}unlistenPointerUpdates(){this.canvas.removeEventListener("pointermove",this.#e)}pointerPosToWorldPos(i,p){let a=this.canvas.getBoundingClientRect(),f=(i-a.left)/a.width,b=(p-a.top)/a.height,x=f*this.viewportWidth*this.cameraWidth/a.width,R=b*this.viewportHeight*this.cameraHeight/a.height;return new S(x,R)}getMousePos(){return this.pointerPosToWorldPos(this.pointerX,this.pointerY)}useDraw(i){let p=a=>{i(a,new r)};return this.on("draw",p),()=>{this.off("draw",p)}}attachTo(i){i.addRenderer(this),this.game=i}detach(){this.game&&this.game.deleteRenderer(this)}}y.KaylaRenderer=e;class t{current;saves;constructor(){this.saves=[]}useTick(i){if(!this.current)throw new Error("Hook 'useTick' must be executed in the top level scope of a component.");this.current.onTick[this.current.useStepCallIndex]=i,this.current.useStepCallIndex++}usePaint(i){if(!this.current)throw new Error("Hook 'usePaint' must be executed in the top level scope of a component.");this.current.onPaint[this.current.useDrawCallIndex]=i,this.current.useDrawCallIndex++}useEntity(){return P(M)}useSelf(i){let p=P(null);return(p.current===null||p.current===void 0)&&(p.current=i()),p.current}useState(i,{alwaysRecall:p=!1}={}){if(!this.current)throw new Error("Hook 'useState' must be executed in the top level scope of a component.");let f=this.current.state[this.current.useStateCallIndex]??new s(this.current,i,{alwaysRecall:p});return this.current.state[this.current.useStateCallIndex]=f,this.current.useStateCallIndex++,f}useRef(i){if(!this.current)throw new Error("Hook 'useRef' must be executed in the top level scope of a component.");let a=this.current.refs[this.current.useRefCallIndex]??l(i??null);return this.current.refs[this.current.useRefCallIndex]=a,this.current.useRefCallIndex++,a}useEffect(i){if(!this.current)throw new Error("Hook 'useEffect' must be executed in the top level scope of a component.");this.current.onEffect[this.current.useEffectCallIndex]=i,this.current.useEffectCallIndex++}useExports(i,p){if(!this.current)throw new Error("Hook 'useExports' must be executed in the top level scope of a component.");this.current.onExport=p}save(){this.saves.push({current:this.current})}restore(){let i=this.saves.pop();if(!i)throw new Error("Cannot restore without saving.");this.current=i.current}}y.GlobalKayla=t;class r{preventDefault(){this.#e=!0}#e=!1;isPrevented(){return this.#e}}y.KaylaEvent=r;class s{#e;#t;#n;alwaysRecall;constructor(i,p,{alwaysRecall:a=!1}={}){this.#t=i,this.#e=p??void 0,this.#n=Date.now(),this.alwaysRecall=a}get(){return this.#e}add(i,{recall:p}={}){this.set(this.get()+i,{recall:p})}multiply(i,{recall:p}={}){this.set(this.get()*i,{recall:p})}set(i,{recall:p=!1}={}){let a=this.#e;i!==a&&(this.#e=i,(p||this.alwaysRecall)&&this.#t.refresh(),this.#n=Date.now())}get value(){return this.#e}get lastChanged(){return this.#n}}y.KaylaState=s;class o{#e;constructor(i){this.#e=i??void 0}#t;setSetter(i){this.#t=i}get current(){return this.#e}set current(i){this.#e=i,this.#t&&this.#t(this.#e)}}y.KaylaInternalRef=o;function l(m){return new o(m)}y.createReassignableRef=l;class h{state;refs;global;callProps;scene;exports;constructor(i,p,a){if(!a)throw new Error("Empty element");this.scene=p,this.state=[],this.refs=[],this.fc=a.type,this.callProps=a.props??{},this.global=i,this.lastStateDeps=[],this.entity=null,this.lastChildren=[],this.onEffect=[],this.onUnEffect=[],this.onPaint=[],this.onTick=[]}get key(){return this.callProps.key}set key(i){this.callProps.key=i}get children(){return this.callProps.children}set children(i){this.callProps.children=i}entity;onExport=()=>({});onEffect;onUnEffect;onEffectDeps;onPaint;onTick;fc;useStateCallIndex=0;useEffectCallIndex=0;useDrawCallIndex=0;useStepCallIndex=0;useRefCallIndex=0;lastStateDeps;refresh(){let i;this.global.save(),this.global.current=this,this.useStateCallIndex=0,this.useRefCallIndex=0;let p=[];try{let a=this.fc(this.callProps)??[];if(a&&!Array.isArray(a)&&(a=[a]),!Array.isArray(a))throw new Error("Non array or non undefined children received.");p=a}catch(a){i=a}this.useStateCallIndex=0,this.useRefCallIndex=0,this.useDrawCallIndex=0,this.useStepCallIndex=0,this.useEffectCallIndex=0,this.global.restore();try{let a=0,f=[];for(let b of p){let x=this.lastChildren.at(a)??new h(this.global,this.scene,b);this.lastChildren[a]=x,f.push(x),a++}for(let b of this.lastChildren.filter(x=>!f.includes(x))){let x=this.lastChildren.indexOf(b);x!==1&&this.lastChildren.splice(x,1),b.unuse()}for(let b of this.lastChildren)try{b.refresh()}catch(x){console.error(x)}j(()=>{this.use()})}catch(a){console.error(a)}if(i)throw i}lastChildren;isFirstUse=!0;use(){try{let i=!0;if(this.lastStateDeps??=[],Array.isArray(this.onEffectDeps)&&(i=this.onEffectDeps.some((p,a)=>{let f=this.lastStateDeps.at(a);if(f){let b=p.lastChanged,x=f.stamp;return b>x}})),i||this.isFirstUse){this.isFirstUse=!1,Array.isArray(this.onEffectDeps)&&(this.lastStateDeps=this.onEffectDeps.map(a=>({stamp:a.lastChanged,stateRef:a}))),this.key??=this.fc.name+"_"+W(),this.entity&&this.scene.getScene().removeEntity(this.entity),this.entity&&this.entity.name!==this.key&&(this.entity=null),this.entity=this.entity??new u(this,this.key);for(let a of this.refs)a.current===M&&(a.current=this.entity);this.callProps.ref instanceof o&&(this.callProps.ref.current=this.entity),this.exports=this.onExport(),this.callProps.exportsRef instanceof o&&(this.callProps.exportsRef.current=this.exports),this.scene.getScene().addEntity(this.entity);let p=this.onEffect.map(a=>a()).filter(a=>a!==void 0);this.onUnEffect=p}}catch(i){throw i}}unuse(){try{for(let i of this.onUnEffect)i()}catch(i){console.error(i)}this.scene.getScene().removeEntity(this.entity)}}y.KaylaFiber=h;class u extends L{#e;constructor(i,p){super(p,0,0,0,0),this.#e=i}update(i){let p=new r;if(this.#e.onTick)for(let a of this.#e.onTick)a(i,p);p.isPrevented()}draw(i){let p=new r;if(this.#e.onPaint)for(let a of this.#e.onPaint)a(i,p);p.isPrevented()||super.draw(i)}}y.KaylaRectEntity=u;class c{constructor(i){this.#t=i,this.#e=null,i.on("update",this.tickHandler.bind(this)),this.drawHandler=this.drawHandler.bind(this)}#e;#t;getScene(){return this.#t}drawHandler(i){return this.#t.handleDraw(i)}attachTo(i){i.addScene(this.#t),this.#e=i}spawn(i){new h(y.singleGlobalInstance,this,i).refresh()}detach(){this.#e&&this.#e.removeScene(this.#t)}tickHandler(){}}y.KaylaScene=c,y.singleGlobalInstance=new y.GlobalKayla})(C||={});var g=C.singleGlobalInstance,z=g.useState.bind(g),P=g.useRef.bind(g),H=g.useEffect.bind(g),ye=g.useTick.bind(g),X=g.usePaint.bind(g),be=g.useExports.bind(g),xe=g.useSelf.bind(g),ge=g.useEntity.bind(g),M=Symbol("self_ref");var j=n=>{Promise.resolve(1).then(()=>n())},ve=({children:n})=>Array.isArray(n)?[...n]:n;function Ee(n){return C.createReassignableRef(n)}function we(n){if(typeof n!="object"||typeof n=="function"||n===null)return n;let e={current:n};return new Proxy({},{get(r,s,o){return s==="reassignSelf"?l=>{e.current=l}:Reflect.get(e.current,s,o)},set(r,s,o,l){return Reflect.set(e.current,s,o,l)},has(r,s){return Reflect.has(e.current,s)},ownKeys(r){return Reflect.ownKeys(e.current)},getOwnPropertyDescriptor(r,s){return Reflect.getOwnPropertyDescriptor(e.current,s)},deleteProperty(r,s){return Reflect.deleteProperty(e.current,s)}})}Reflect.set(globalThis,"Kayla",U);var Te;(e=>e.UIComponent=({x:t,y:r,width:s,height:o,children:l})=>{let h=P(M),u=z(!1);return H(()=>{if(u.get()===!0)return;u.set(!0);let c=h.current;c.width=s,c.height=o,c.x=t,c.y=r}),X(c=>{c.fillStyle="rgba(0, 0, 0, 0.5)",c.fillRect(t,r,s,o)}),l??[]})(Te||={});var De={LEA:O,Kayla:Y};export{Y as Kayla,O as LEA,De as default};
|
|
1
|
+
var he=Object.defineProperty;var W=(n,e)=>{for(var t in e)he(n,t,{get:e[t],enumerable:!0})};var z={};W(z,{DeltaTweenII:()=>N,ENVIRONMENT:()=>X,GEmitterMemory:()=>H,LeaEntityII:()=>I,LeaEventEmitter:()=>w,LeaGameII:()=>A,LeaRendererII:()=>P,LeaSceneII:()=>M,LeaSerializers:()=>j,LeaTickerII:()=>G,LeaTimeout:()=>O,LeaUtilsII:()=>v,LiaAudio:()=>k,LiaAudioSrc:()=>K,LiaOscSFX:()=>T,LiaSFXMap:()=>be,NOTE_NAMES:()=>J,RectLeaEntity:()=>F,Vector2:()=>C,colToRGBA:()=>fe,defaultSFXConfig:()=>Z,editRGBA:()=>de,generateUUID:()=>ie,getAvoidAngle:()=>ue,getEnvironment:()=>Q,getNormalizedColor:()=>pe,getRayHit:()=>oe,isInitiallyMobile:()=>ve,isMobile:()=>ce,isNode:()=>_,isNote:()=>ye,isWeb:()=>E,parseFillStyle:()=>Y,raycastAvoid:()=>ge,scaleCoord:()=>me,setAnimInterval:()=>ae,sfxHit:()=>se,sfxJump:()=>ne,sfxLaser:()=>re,sfxUIClick:()=>ee,sfxUIHover:()=>te,shortUID:()=>xe,tinyUID:()=>U});var w=class{#e=new Map;constructor(){this.#e=new Map}on(e,t){let r=this.#e.get(e)||[];return r.push(t),this.#e.set(e,r),this}once(e,t){let r=(...s)=>{this.off(e,r),t(...s)};return this.on(e,r),this}off(e,t){let r=this.#e.get(e);if(!r)return this;let s=r.indexOf(t);return s>=0&&r.splice(s,1),this}emit(e,...t){let r=this.#e.get(e);if(!r||r.length===0){if(e==="error")throw t[0];return!1}return r.slice().forEach(s=>s(...t)),!0}removeAllListeners(e){return e?this.#e.delete(e):this.#e.clear(),this}listenerCount(e){return this.#e.get(e)?.length??0}},P=class extends w{canvas;ctx;running;_rafId;_fps;_frameCount;_fpsTimer;_lastFrameTime;constructor(e,{viewportWidth:t,viewportHeight:r,cameraWidth:s,cameraHeight:o}={}){if(!E)throw new Error("Web-Only");super(),this.canvas=e,this.ctx=e.getContext("2d"),this.automatic=!0,this.#e=t??e.width,this.#t=r??e.height,this.#n=s??e.width,this.#r=o??e.height,this.running=!1,this._rafId=null,this._loop=this._loop.bind(this),this.updateCanvasResolution(),this._fps=60,this._frameCount=0,this._fpsTimer=0}automatic;retransform(){this.ctx.setTransform(1,0,0,1,0,0);let e=this.#n/this.#e,t=this.#r/this.#t;this.ctx.translate(this.#n/2,this.#r/2),this.ctx.scale(e,t),this.ctx.translate(-this.#e/2,-this.#t/2)}#e=0;#t=0;#n=0;#r=0;get viewportWidth(){return this.#e}set viewportWidth(e){this.#e=e,this.retransform()}get width(){return this.#e}get height(){return this.#t}get centerX(){return this.#e/2}get centerY(){return this.#t/2}get left(){return 0}get top(){return 0}get right(){return this.#e}get bottom(){return this.#t}get viewportHeight(){return this.#t}set viewportHeight(e){this.#t=e,this.retransform()}get cameraWidth(){return this.#n}set cameraWidth(e){this.#n=e,this.updateCanvasResolution(),this.retransform()}get cameraHeight(){return this.#r}set cameraHeight(e){this.#r=e,this.updateCanvasResolution(),this.retransform()}updateCanvasResolution(){this.canvas.width=this.#n,this.canvas.height=this.#r}applyTransform(){this.retransform()}get FPS(){return this._fps}_loop(){this.automatic&&this.update(),this._rafId=requestAnimationFrame(this._loop)}update(){if(!this.running||!E)return;let e=performance.now(),t=(e-(this._lastFrameTime??e))/1e3;this._lastFrameTime=e,this._frameCount++,this._fpsTimer+=t,this._fpsTimer>=1&&(this._fps=Math.round(this._frameCount/this._fpsTimer),this._frameCount=0,this._fpsTimer=0),this.ctx.clearRect(0,0,this.#n,this.#r),this.emit("draw",this.ctx)}start(){if(!this.running){if(!E||typeof globalThis.requestAnimationFrame>"u")throw new Error("Raf is not supported");this.running=!0,this._rafId=requestAnimationFrame(this._loop)}}stop(){if(!E||typeof globalThis.requestAnimationFrame>"u")throw new Error("Raf is not supported");this.running=!1,this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null)}},G=class extends w{setNow(e){this.#e=e}#e=0;__intervalId=null;__lastTime=0;constructor(e=16){super(),this.#t=e,this.speedHackDT=1}speedHackDT;get isRaf(){return this.tickInterval===1/0}#t=15;get tickInterval(){return this.#t}set tickInterval(e){this.#t=e,this.__intervalId&&(this.stop(),this.start())}now(){return this.#e}__tick(){let e=performance.now(),t=(e-this.__lastTime)/1e3*this.speedHackDT;this.__lastTime=e,this.#e+=t*1e3,this.emit("tick",t)}createTimeout(e){return new O(e,this)}createTween(e,t=()=>{}){let r=new N(e),s=(o=0)=>{if(r.finished){this.off("tick",s);return}r.update(o)};return r.on("finish",()=>{this.off("tick",s)}),r.on("delta",o=>{t(o)}),this.on("tick",s),r}start(){this.__intervalId===null&&(this.__lastTime=performance.now(),this.__intervalId=E&&!isFinite(this.tickInterval)?ae(()=>this.__tick()).clear:setInterval(()=>this.__tick(),this.tickInterval))}stop(){this.__intervalId!==null&&(typeof this.__intervalId=="function"?this.__intervalId():clearInterval(this.__intervalId)),this.__intervalId=null}getSineMod(e,t=0){return .5+.5*Math.sin((this.now()%e/e+t)*2*Math.PI)}},j;(p=>{function n(a){return a===!0?1:0}p.booleanExport=n;function e(a){return a===0?!1:a===1}p.booleanImport=e;function t(a){return`${a.x}|${a.y}`}p.vec2Export=t;function r(a){let[f,b]=a.split("|"),x=parseFloat(f),R=parseFloat(b);if(isNaN(x)||isNaN(R))throw new Error(`Invalid Vector2 string: ${a}`);return new C(x,R)}p.vec2Import=r,p.booleanMap={mapExport:n,mapImport:e};function o(a){return f=>Number(f.toFixed(a))}p.createRounder=o;function l(a=10){return{mapExport(f){return Math.round(f/a)},mapImport(f){return f*a}}}p.createLowPrecision=l;function h(a){return Math.round(a)}p.lightWeightRounder=h;function u(a=100){return{mapExport(f){return Math.round(f*a)},mapImport(f){return f/a}}}p.createPercent=u;function c(a){let f=new Map(Object.entries(a));return{mapExport:b=>f.get(b)??null,mapImport:b=>Array.from(f.entries()).find(([x,R])=>R===b)?.[0]??null}}p.createLookup=c;function d(a){let f=a*(180/Math.PI);return Math.round((f%360+360)%360)}p.radToDeg=d;function y(a){return a*(Math.PI/180)}p.degToRad=y,p.angleRadToDeg={mapExport:d,mapImport:y};function i(a=10){let f=l(a);return{mapExport(b){return f.mapExport(d(b))},mapImport(b){return f.mapImport(y(b))}}}p.createLowPrecisionRadToDeg=i})(j||={});var I=class n extends w{name="";scaleRotate=0;scale=1;constructor(e,t=0,r=0){super(),this.autoTranslate=!1,this.name=e,this.z=0,this.___pos=new C(t,r),this.nonSerializableProperties=[],this.nonSerializableProperties.push("___pos","autoTranslate","arraySerializeMap"),this.forceSerializableProperties=[],this.forceSerializableProperties.push("x","y")}arraySerializeMap;autoTranslate;z;___pos;nonSerializableProperties;forceSerializableProperties;get pos(){return this.___pos}get x(){return this.pos.x}get y(){return this.pos.y}set x(e){this.pos.x=e}set y(e){this.pos.y=e}handleUpdate(e){if(this.update)try{this.emit("update",e),this.update(e)}catch(t){this.emit("error",t)}}handleDraw(e){if(!(_||!this.draw)){e.save(),this.autoTranslate&&e.translate(this.x,this.y);try{this.emit("draw",e),this.draw(e)}catch(t){this.emit("error",t)}e.restore()}}serialize(){if(Array.isArray(this.arraySerializeMap))return this.arraySerializeMap.map(([s,{mapExport:o}])=>{let l=Reflect.get(this,s);return o?o(l):l});let e=["_events","_eventsCount","_maxListeners","nonSerializableProperties","forceSerializableProperties"],t=[...Reflect.ownKeys(this),...this.forceSerializableProperties].filter(s=>!this.nonSerializableProperties.includes(s)&&!e.includes(s.toString())),r=Object.fromEntries(t.map(s=>{let o=Reflect.get(this,s);if(_&&typeof o=="number"){let l=o.toString().split("."),u=(l[1]?l[1].length:0)>2?Number(o.toFixed(2)):o;return[s,u]}return[s,o]}));return JSON.parse(JSON.stringify(r))}toLocal(e){return e.subtract(this.pos)}toWorld(e){return e.add(this.pos)}deserializeArray(e){return n.deserializeArray(this.arraySerializeMap,e)}static deserializeArray(e,t){if(!e||!Array.isArray(t))return t;let r={};for(let s=0;s<t.length;s++){let o=e[s];if(!o)break;let[l,{mapImport:h}]=o,u=t[s];if(h&&(u=h(u)),typeof l!="string")break;try{Reflect.set(r,l,u)}catch(c){console.error(c)}}return r}},M=class extends w{name="";entities=new Map;paused=!0;constructor(e){super(),this.name=e}handleUpdate(e){if(!this.paused){this.emit("update",e);for(let t of this.entities.values())t.handleUpdate(e)}}handleDraw(e){if(!_&&!this.paused){this.emit("draw",e);for(let t of[...this.entities.values()].sort((r,s)=>r.z-s.z))t.handleDraw(e)}}addEntity(e){if(!(e instanceof I))throw new Error("invalid entity");if(!e.name)throw new Error("Entity must have a name.");this.entities.set(e.name,e)}removeEntity(e){if(!(e instanceof I))throw new Error("invalid entity");this.entities.delete(e.name)}getEntity(e){return this.entities.get(e)}},A=class{scenes;ticker;get centerX(){return this.width/2}get centerY(){return this.height/2}get left(){return 0}get top(){return 0}get right(){return this.width}get bottom(){return this.height}width;height;constructor(e,t,r=16){this.ticker=new G(r),this.scenes=new Map,this.width=e,this.height=t,this.ticker.on("tick",s=>{for(let o of this.scenes.values())o.paused||o.handleUpdate(s)})}addScene(e){if(!e.name)throw new Error("Scene must have a name.");e.paused=!1,this.scenes.set(e.name,e)}removeScene(e){e&&(e.paused=!0),this.scenes.delete(e.name)}now(){return this.ticker.now()}start(){this.ticker.start()}stop(){this.ticker.stop()}},v={lerp(n,e,t){return n+(e-n)*t},clamp(n,e,t){return Math.min(t,Math.max(e,n))},clamp01(n){return Math.min(1,Math.max(0,n))},easeLinear(n){return n},easeInQuad(n){return n*n},easeOutQuad(n){return 1-(1-n)*(1-n)},easeInOutQuad(n){return n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2},easeInSine(n){return 1-Math.cos(n*Math.PI/2)},easeOutSine(n){return Math.sin(n*Math.PI/2)},easeInOutSine(n){return-(Math.cos(Math.PI*n)-1)/2},easeInExpo(n){return n===0?0:Math.pow(2,10*n-10)},easeOutExpo(n){return n===1?1:1-Math.pow(2,-10*n)},easeInOutExpo(n){return n===0?0:n===1?1:n<.5?Math.pow(2,20*n-10)/2:(2-Math.pow(2,-20*n+10))/2},smoothstep(n){return n=v.clamp(n,0,1),n*n*(3-2*n)},randomLerp(n,e){return v.lerp(n,e,Math.random())},randomInt(n,e){return Math.floor(Math.random()*(e-n+1))+n},randomArrayValue(n){return n[v.randomInt(0,n.length-1)]},createBezier(n,e,t,r){function s(h,u,c,d,y){let m=1-h;return m*m*m*u+3*m*m*h*c+3*m*h*h*d+h*h*h*y}function o(h,u,c,d,y){let m=1-h;return 3*m*m*(c-u)+6*m*h*(d-c)+3*h*h*(y-d)}function l(h){let u=h;for(let c=0;c<6;c++){let d=s(u,0,n,t,1),y=o(u,0,n,t,1);if(y===0)break;u-=(d-h)/y}return v.clamp(u,0,1)}return function(u){u=v.clamp(u,0,1);let c=l(u);return s(c,0,e,r,1)}},lengthSquared(...n){return n.reduce((e,t)=>e+t*t,0)},normalizeRad(n){let e=2*Math.PI;return n=n%e,n<0&&(n+=e),n},angleInvertY(n){return v.normalizeRad(-n)},degToRadFlipY(n){return v.angleInvertY(n*Math.PI/180)},minimalAngularDirection(n,e){n=v.normalizeRad(n),e=v.normalizeRad(e);let t=v.normalizeRad(e-n),r=v.normalizeRad(n-e);return t<=r?1:-1}},N=class extends w{constructor({delta:e,ms:t,easing:r}){super(),this.delta=e,this.duration=t,this.elapsed=0,this.easing=r??(s=>s),this.lastValue=0,this.finished=!1}delta;duration;elapsed;lastValue;finished;easing;update(e){this.elapsed+=e*1e3;let t=v.clamp(this.elapsed/this.duration,0,1),r=this.easing(t),s=this.delta*r,o=s-this.lastValue;this.lastValue=s,this.emit("delta",o),t>=1&&(this.finished=!0,this.emit("finish",void 0))}},F=class extends I{constructor(e,t=0,r=0,s=50,o=50){super(e,t,r),this.width=s,this.height=o}width;height;get left(){return this.x-this.width/2}set left(e){this.x=e+this.width/2}get right(){return this.x+this.width/2}set right(e){this.x=e-this.width/2}get top(){return this.y-this.height/2}set top(e){this.y=e+this.height/2}get bottom(){return this.y+this.height/2}set bottom(e){this.y=e-this.height/2}get lx(){return 0}get ly(){return 0}get lleft(){return-this.width/2}get lright(){return this.width/2}get ltop(){return-this.height/2}get lbottom(){return this.height/2}isCollidingWith(e){return!(this.right<e.left||this.left>e.right||this.bottom<e.top||this.top>e.bottom)}color="rgba(0, 0, 255, 0.3)";draw(e){e.translate(this.x,this.y),e.rotate(this.scaleRotate),e.fillStyle=this.color,e.fillRect(-this.width/2,-this.height/2,this.width,this.height)}},O=class extends w{duration;ticker;elapsed;finished;_resolve;promise;_timeoutId;constructor(e,t=null){super(),this.duration=e,this.ticker=t,this.elapsed=0,this.finished=!1,this._resolve=null,this.promise=new Promise(r=>this._resolve=r),this.update=this.update.bind(this),this.ticker&&this.ticker.on("tick",this.update)}update(e=0){this.finished||(this.elapsed+=e*1e3,this.elapsed>=this.duration&&this.finish())}finish(){this.finished||(this.finished=!0,this.emit("finish",void 0),this._resolve&&this._resolve(),this.ticker&&this.ticker.off("tick",this.update))}start(){return this.ticker||(this._timeoutId=setTimeout(()=>this.finish(),this.duration)),this}cancel(){this.finished||(this.finished=!0,!this.ticker&&this._timeoutId!=null&&clearTimeout(this._timeoutId),this.ticker&&this.ticker.off("tick",this.update))}then(e,t){return this.promise.then(e,t)}after(e,t){return this.promise.then(e,t)}},C=class n{constructor(e=0,t=0){this.x=e,this.y=t}x;y;toJSON(){return{x:this.x,y:this.y,vec2:!0}}static isVec2(e){return e&&typeof e=="object"&&"x"in e&&"y"in e&&e.vec2===!0}static fromSerialized(e){return this.isVec2(e)?new this(e.x,e.y):null}rotate(e){let t=Math.cos(e),r=Math.sin(e);return new n(this.x*t-this.y*r,this.x*r+this.y*t)}static from(e){return new n(Math.cos(e),Math.sin(e))}get angle(){return Math.atan2(this.y,this.x)}get length(){return Math.hypot(this.x,this.y)}get lengthSquared(){return this.x*this.x+this.y*this.y}normalized(){let e=this.length;return e===0?new n(0,0):new n(this.x/e,this.y/e)}project(e){return e.scale(this.dotNormalized(e))}reflect(e){let t=this.dot(e);return this.subtract(e.scale(2*t))}dotNormalized(e){let t=this.normalized(),r=e.normalized();return t.x*r.x+t.y*r.y}lengthSquaredTo(e){let t=this.x-e.x,r=this.y-e.y;return t*t+r*r}dot(e){return this.x*e.x+this.y*e.y}distanceTo(e){return Math.hypot(this.x-e.x,this.y-e.y)}distanceToCheap(e){let t=this.x-e.x,r=this.y-e.y;return t*t+r*r}directionTo(e){return new n(e.x-this.x,e.y-this.y).normalized()}add(e){return new n(this.x+e.x,this.y+e.y)}addRaw(e){return new n(this.x+e,this.y+e)}overwite(e){this.x=e.x,this.y=e.y}subtract(e){return new n(this.x-e.x,this.y-e.y)}scale(e){return new n(this.x*e,this.y*e)}toString(){return`Vector2(${this.x}, ${this.y})`}clone(){return new n(this.x,this.y)}};function pe(n){let e=/^rgba?\(([^)]+)\)$/,t=n.match(e);if(t){let[r,s,o,l=1]=t[1].split(",").map(h=>parseFloat(h));return{r:Math.max(0,Math.min(255,Math.floor(r))),g:Math.max(0,Math.min(255,Math.floor(s))),b:Math.max(0,Math.min(255,Math.floor(o))),a:Math.max(0,Math.min(1,Math.floor(l*255)/255))}}return Y(n)}function fe(n){return`rgba(${n.r}, ${n.g}, ${n.b}, ${n.a})`}function Y(n){if(n=n.trim().toLowerCase(),n[0]==="#"){let t,r,s;if(n.length===7)t=parseInt(n.slice(1,3),16),r=parseInt(n.slice(3,5),16),s=parseInt(n.slice(5,7),16);else if(n.length===4)t=parseInt(n[1]+n[1],16),r=parseInt(n[2]+n[2],16),s=parseInt(n[3]+n[3],16);else throw new Error("Invalid hex color");return{r:t,g:r,b:s,a:1}}let e=n.match(/^rgba?\s*\(\s*(\d+)[, ]\s*(\d+)[, ]\s*(\d+)(?:[, ]\s*([\d.]+))?\s*\)$/);if(e)return{r:parseInt(e[1]),g:parseInt(e[2]),b:parseInt(e[3]),a:e[4]!==void 0?parseFloat(e[4]):1};throw new Error("Unsupported fillStyle format")}function de(n,{r:e,g:t,b:r,a:s}={}){let[o,l,h,u,c]=n.match(/rgba?\((\d+),\s*(\d+),\s*(\d+),?\s*([\d.]*)\)?/)||[];return`rgba(${e??l}, ${t??h}, ${r??u}, ${s??(c||1)})`}function me(n,e,t){return t+(n-t)*e}function Q(){return typeof process<"u"&&process.release?.name==="node"?"node":typeof window<"u"||typeof self<"u"?"web":"unknown"}var X=Q(),_=X==="node",E=X==="web",k=class n{static unlock(){E&&this.audioCtx.state!=="running"&&this.audioCtx.resume()}static audioCtx=E?new AudioContext:null;static masterGain=E?this.audioCtx.createGain():null;static musicGain=E?this.audioCtx.createGain():null;static sfxGain=E?this.audioCtx.createGain():null;static{E&&(this.masterGain.gain.value=1,this.musicGain.gain.value=1,this.sfxGain.gain.value=1,this.sfxGain.connect(this.masterGain),this.musicGain.connect(this.masterGain),this.masterGain.connect(this.audioCtx.destination))}static get SFX_VOLUME(){return this.sfxGain.gain.value}static get MUSIC_VOLUME(){return this.musicGain.gain.value}static get VOLUME(){return this.masterGain.gain.value}static set SFX_VOLUME(e){this.sfxGain.gain.value=e}static set MUSIC_VOLUME(e){this.musicGain.gain.value=e}static set VOLUME(e){this.masterGain.gain.value=e}static noteToHz(e){return this.tuningFreq*Math.pow(2,(e-9)/12)}static tuningFreq=440;static audioBufferCache=new Map;static loops=new Map;static sfsx=new Map;static loopIdCounter=0;static CACHE_NAME="lia-audio-cache-v1";static async preLoad(e){if(this.audioBufferCache.has(e))return this.audioBufferCache.get(e);let t=n.CACHE_NAME,r,s;if(typeof caches<"u"&&(s=await caches.open(t),r=await s.match(e)),!r){if(r=await fetch(e),!r.ok)throw new Error(`Failed to fetch ${e}`);s&&await s.put(e,r.clone())}let o=await r.arrayBuffer(),l=await this.audioCtx.decodeAudioData(o);return this.audioBufferCache.set(e,l),l}static async getOnlyDownloadedCache(e){let t=n.CACHE_NAME;return await(await caches.open(t)).match(e)}static getCached(e){return this.audioBufferCache.get(e)||null}static async playSound(e,t=.2,r=1,s=!0){try{this.sfsx.has(e)&&this.sfsx.get(e).source.stop(),this.audioBufferCache.has(e)||await this.preLoad(e);let o=this.getCached(e);if(!o)return;let l=new K(o);l.buffer=o;let h=1-.12,u=1+.12;l.playbackRate=r??h+Math.random()*(u-h);let c=this.audioCtx.createGain();c.gain.value=t,l.tempGain=c,l.connect(c),c.connect(this.sfxGain),l.onended=()=>{l.disconnect(),c.disconnect()},l.start(),s&&this.sfsx.set(e,{source:l,gain:c})}catch(o){console.error(o)}}static async playLoop(e,t=1,{loopStart:r=0,loopEnd:s=null,exclusive:o=!0,skipMS:l=0}={}){if(o)for(let y of this.loops.keys())this.stopLoop(y);this.audioBufferCache.has(e)||await this.preLoad(e);let h=this.getCached(e);if(!h)return;let u=new K(h);u.buffer=h,u.loop=!0,typeof r=="number"&&(u.loopStart=r),typeof s=="number"&&(u.loopEnd=s);let c=this.audioCtx.createGain();c.gain.value=t,u.tempGain=c,u.playbackRate=1,u.onended=()=>{u.disconnect(),c.disconnect()},u.connect(c),c.connect(this.musicGain),u.start(0,l/1e3);let d=++this.loopIdCounter;return this.loops.set(d,{source:u,gain:c}),d}static stopLoop(e){let t=this.loops.get(e);t&&(t.source.stop(),t.source.notIndependent||(t.source.disconnect(),t.gain.disconnect()),this.loops.delete(e))}static async createLiaSource(e,{volume:t=1,speed:r=1,loop:s=!1,loopStart:o=0,loopEnd:l=null,isMusic:h=!1,gain:u=null}={}){try{this.audioBufferCache.has(e)||await this.preLoad(e);let c=this.getCached(e);if(!c)return null;let d=new K(c);d.loop=s,d.loopStart=o,d.loopEnd=typeof l=="number"?l:c.duration,d.playbackRate=r;let y=this.audioCtx.createGain();return y.gain.value=t,d.connect(y),d.tempGain=y,y.connect(u||(h?this.musicGain:this.sfxGain)),d.onended=()=>{d.disconnect(),y.disconnect()},d}catch(c){return console.error("Failed to create LiaAudioSrc:",c),null}}},J=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];function ye(n){return J.includes(n)}var K=class{numberOfInputs;numberOfOutputs;constructor(e,t=k.audioCtx){this.context=t,this.buffer=e,this.source=null,this.startTime=0,this.pauseTime=0,this.playbackRate=1,this.isPlaying=!1,this.loop=!1,this.output=E?t.createGain():null,this.output.gain.value=1,this.channelCount=2,this.channelCountMode="max",this.channelInterpretation="speakers",this.numberOfInputs=0,this.numberOfOutputs=1,this.onended=null}channelCount;channelCountMode;channelInterpretation;onended;source;buffer;context;_createSource(){this.source&&(this.source.onended=null);let e=this.context.createBufferSource();return e.buffer=this.buffer,e.playbackRate.value=this.playbackRate,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd>0?this.loopEnd:this.buffer.duration,e.connect(this.output),this.source=e,e.onended=()=>{this.source===e&&(this.isPlaying&&!this.loop&&(this.isPlaying=!1,this.pauseTime=0),typeof this.onended=="function"&&this.onended())},e}play({fadeIn:e=0,offset:t=null}={}){let r=t!==null?t:this.pauseTime;if(this.source){this.source.onended=null;try{this.source.stop()}catch{}}this.source=this._createSource(),this.startTime=this.context.currentTime-r/this.playbackRate,this.source.start(0,r),e>0?(this.output.gain.setValueAtTime(0,this.context.currentTime),this.output.gain.linearRampToValueAtTime(1,this.context.currentTime+e)):this.output.gain.setValueAtTime(1,this.context.currentTime),this.isPlaying=!0}start(e=0,t=0,r){this.isPlaying||(this.source=this._createSource(),this.startTime=this.context.currentTime+e-t/this.playbackRate,r!==void 0?this.source.start(this.context.currentTime+e,t,r):this.source.start(this.context.currentTime+e,t),this.pauseTime=t,this.isPlaying=!0)}pause({fadeOut:e=0}={}){if(!this.isPlaying)return;let t=this.getElapsed()/1e3;if(this.loop&&this.loopEnd>this.loopStart){let r=this.loopEnd-this.loopStart;t=this.loopStart+(t-this.loopStart)%r}if(this.isPlaying=!1,e>0){let r=this.context.currentTime;this.output.gain.setValueAtTime(this.output.gain.value,r),this.output.gain.linearRampToValueAtTime(0,r+e),setTimeout(()=>{if(this.source){this.source.onended=null;try{this.source.stop()}catch{}}this.pauseTime=t,this.output.gain.setValueAtTime(1,this.context.currentTime)},e*1e3)}else{if(this.source){this.source.onended=null;try{this.source.stop()}catch{}}this.pauseTime=t}}getElapsed(){return this.isPlaying?(this.context.currentTime-this.startTime)*this.playbackRate*1e3:this.pauseTime*1e3}setSpeed(e){if(e<=0)throw new Error("Playback rate must be positive");let t=this.getElapsed()/1e3;this.playbackRate=e,this.isPlaying&&(this.pause(),this.pauseTime=t,this.play())}setLoop(e=!0){this.loop=e,this.source&&(this.source.loop=e)}loop;playbackRate;startTime;tempGain=null;connect(e,t=0,r=0){if("value"in e)this.output.connect(e,t);else return this.output.connect(e,t,r),e}disconnect(e,t,r){e===void 0?this.output.disconnect():this.output.disconnect(e,t,r)}output;stop(e=0){if(this.notIndependent)return this.pause();if(!this.source)return;let t=this.context.currentTime+e;this.source.stop(t),this.isPlaying=!1,this.notIndependent||(this.pauseTime=0)}pauseTime;isPlaying;notIndependent=!1;loopStart=0;loopEnd=0},Z={osc:{enabled:!0,type:"sine",freq:440,detune:0},noise:{enabled:!1,level:.5},ampEnv:{attack:.005,decay:.1,sustain:0,release:.1,volume:.3},pitchEnv:{amount:0,decay:.2},filter:{enabled:!1,type:"lowpass",freq:1200,Q:1,envAmount:0,decay:.2},lfo:{enabled:!1,target:"freq",rate:8,depth:20},duration:.4},T=class n{constructor(e={}){this.ctx=k.audioCtx,this.cfg=structuredClone(Z),Object.assign(this.cfg,e)}ctx;cfg;play(e=k.sfxGain){let t=this.ctx,r=t.currentTime,s=this.cfg,o=t.createGain();o.gain.setValueAtTime(1e-4,r);let l=s.ampEnv;o.gain.exponentialRampToValueAtTime(l.volume,r+l.attack),o.gain.exponentialRampToValueAtTime(Math.max(1e-4,l.sustain*l.volume),r+l.attack+l.decay),o.gain.exponentialRampToValueAtTime(1e-4,r+s.duration+l.release);let h=o,u;s.filter.enabled&&(u=t.createBiquadFilter(),u.type=s.filter.type,u.frequency.value=s.filter.freq,u.Q.value=s.filter.Q,u.connect(o),h=u);let c;if(s.osc.enabled){if(c=t.createOscillator(),c.type=s.osc.type,c.frequency.value=s.osc.freq,c.detune.value=s.osc.detune,s.pitchEnv.amount!==0){let a=Math.pow(2,s.pitchEnv.amount/12);c.frequency.exponentialRampToValueAtTime(s.osc.freq*a,r+s.pitchEnv.decay)}c.connect(h),c.start(r),c.stop(r+s.duration+l.release)}let d;if(s.noise.enabled){let a=t.sampleRate*s.duration,f=t.createBuffer(1,a,t.sampleRate),b=f.getChannelData(0);for(let x=0;x<a;x++)b[x]=(Math.random()*2-1)*s.noise.level;d=t.createBufferSource(),d.buffer=f,d.connect(h),d.start(r),d.stop(r+s.duration+l.release)}let y,m;s.lfo.enabled&&c&&(y=t.createOscillator(),y.frequency.value=s.lfo.rate,m=t.createGain(),m.gain.value=s.lfo.depth,y.connect(m),s.lfo.target==="freq"?m.connect(c.frequency):s.lfo.target==="gain"?m.connect(o.gain):s.lfo.target==="filter"&&u&&m.connect(u.frequency),y.start(r),y.stop(r+s.duration)),o.connect(e);let i=[c,d,y,m,u,o],p=r+s.duration+l.release;setTimeout(()=>{i.forEach(a=>a?.disconnect())},(p-t.currentTime)*1e3)}getConfig(){return structuredClone(this.cfg)}setConfig(e){return Object.assign(this.cfg,e),this}getKey(e){return this.cfg[e]}setKey(e,t){return Object.assign(this.cfg[e],t),this}setFreq(e){return this.cfg.osc.freq=e,this}setWave(e){return this.cfg.osc.type=e,this}setVolume(e){return this.cfg.ampEnv.volume=e,this}setAmpEnv(e,t,r,s){return Object.assign(this.cfg.ampEnv,{attack:e,decay:t,sustain:r,release:s}),this}setPitchEnv(e,t){return Object.assign(this.cfg.pitchEnv,{amount:e,decay:t}),this}setNoiseEnabled(e){return this.cfg.noise.enabled=e,this}setNoiseLevel(e){return this.cfg.noise.level=e,this}setFilterEnabled(e){return this.cfg.filter.enabled=e,this}setFilter(e,t,r){return Object.assign(this.cfg.filter,{type:e,freq:t,Q:r,enabled:!0}),this}setLFOEnabled(e){return this.cfg.lfo.enabled=e,this}setLFO(e,t,r){return Object.assign(this.cfg.lfo,{target:e,rate:t,depth:r,enabled:!0}),this}setDuration(e){return this.cfg.duration=e,this}clone(){return new n(structuredClone(this.cfg))}},ee=new T({osc:{enabled:!0,type:"square",freq:900,detune:0},ampEnv:{attack:.002,decay:.04,sustain:0,release:.02,volume:.15},duration:.05}),te=new T({osc:{enabled:!0,type:"sine",freq:600,detune:0},ampEnv:{attack:.01,decay:.08,sustain:0,release:.04,volume:.12},duration:.1}),ne=new T({osc:{enabled:!0,type:"triangle",freq:500,detune:0},pitchEnv:{amount:12,decay:.15},ampEnv:{attack:.01,decay:.12,sustain:0,release:.05,volume:.25},duration:.18}),re=new T({osc:{enabled:!0,type:"sawtooth",freq:1200,detune:0},pitchEnv:{amount:-24,decay:.3},ampEnv:{attack:.005,decay:.25,sustain:0,release:.05,volume:.3},duration:.35}),se=new T({osc:{enabled:!0,type:"square",freq:180,detune:0},noise:{enabled:!0,level:.4},ampEnv:{attack:.002,decay:.15,sustain:0,release:.05,volume:.35},duration:.2}),be=new Map([["ui_click",ee],["ui_hover",te],["jump",ne],["laser",re],["hit",se]]);function xe(n=12){let e=Date.now().toString(36),t=crypto.getRandomValues(new Uint8Array(n)),r=Array.from(t).map(s=>s.toString(36).padStart(2,"0")).join("");return(e+r).slice(0,n)}function U(n=12){let e=Date.now().toString(36),t=crypto.getRandomValues(new Uint8Array(4)),r=Array.from(t).map(s=>s.toString(36).padStart(2,"0")).join("");return(e+r).slice(0,n)}var H=class{peer=null;key;events={};mbAcc=0;connected=!1;constructor(){this.key=`${ie()}_${Date.now()}`}connect(e){e&&(this.peer=e,e.peer=this,this.connected=!0,e.connected=!0),this._emit("open")}isConnected(){return this.connected&&!!this.peer}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter(r=>r!==t))}_emit(e,t){this.events[e]?.forEach(r=>r(t))}send(e,t){if(!this.peer)throw new Error("No peer connected");this.peer._receive(e,t)}_receive(e,t){e?this._emit(e,t):this._emit("message",t)}close(){if(this.connected=!1,this.peer){let e=this.peer;this.peer=null,e.peer=null,e.connected=!1,e._emit("close")}this._emit("close")}getKey(){return this.key}};function ie(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){let n=new Uint8Array(16);return crypto.getRandomValues(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128,[...n].map(e=>e.toString(16).padStart(2,"0")).join("").replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/,"$1-$2-$3-$4-$5")}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{let e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)})}function ae(n){let e=!0;function t(){e&&(n(),requestAnimationFrame(t))}return requestAnimationFrame(t),{clear:()=>e=!1}}function oe(n,e,t,r,s){let o=Math.cos(s),l=Math.sin(s),h=[];if(o!==0){let u=(0-n)/o,c=e+u*l;u>0&&c>=0&&c<=r&&h.push({side:"left",t:u})}if(o!==0){let u=(t-n)/o,c=e+u*l;u>0&&c>=0&&c<=r&&h.push({side:"right",t:u})}if(l!==0){let u=(0-e)/l,c=n+u*o;u>0&&c>=0&&c<=t&&h.push({side:"top",t:u})}if(l!==0){let u=(r-e)/l,c=n+u*o;u>0&&c>=0&&c<=t&&h.push({side:"bottom",t:u})}return h.length===0?null:(h.sort((u,c)=>u.t-c.t),h[0])}function ue(n,e){let t;switch(e){case"left":case"right":t=Math.PI-n;break;case"top":case"bottom":t=2*Math.PI-n;break}return(t%(2*Math.PI)+2*Math.PI)%(2*Math.PI)}function ge(n,e,t,r,s){let o=oe(n,e,t,r,s);return o?{...o,avoidAngle:ue(s,o.side)}:null}function ce(){return _?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}var ve=ce();var V={};W(V,{KaylaFragment:()=>ke,KaylaInternals:()=>S,createElement:()=>Ce,createGame:()=>Ee,createReassignableObject:()=>Me,createRenderer:()=>Te,createScene:()=>we,self:()=>D,useDisposableRef:()=>Pe,useEffect:()=>B,useEntity:()=>Ie,useExports:()=>Re,useNextStack:()=>le,usePaint:()=>$,useRef:()=>L,useSelf:()=>Ke,useState:()=>q,useTick:()=>Se});function Ee({width:n,height:e,updateHz:t="frames"}){return new S.KaylaGame(n,e,t==="frames"?1/0:t)}function we(n){let e=new M(n);return new S.KaylaScene(e)}function Te(n){return new S.KaylaRenderer(n)}function Ce(n,e){return{type:n,props:e}}var S;(y=>{class n extends A{#e;#t;constructor(i,p,a){super(i,p,a),this.#e=new Set,this.#t=!1}get started(){return this.#t}start(){if(!this.#t){for(let i of this.#e)i.start();this.#t=!0,super.start()}}stop(){if(this.#t){for(let i of this.#e)i.stop();this.#t=!1,super.stop()}}addRenderer(i){this.#e.has(i)||(this.#e.add(i),this.#t&&i.start(),i.game=this)}deleteRenderer(i){this.#e.has(i)&&(this.#e.delete(i),this.#t&&i.stop(),delete i.game)}}y.KaylaGame=n;class e extends P{game;pointerX;pointerY;#e;constructor(i){super(i),this.useDraw=this.useDraw.bind(this),this.on("draw",p=>{if(this.game)for(let a of this.game.scenes.values())a.handleDraw(p)}),this.pointerX=0,this.pointerY=0,this.#e=this.#t.bind(this)}#t(i){this.pointerX=i.clientX,this.pointerY=i.clientY}listenPointerUpdates(){this.canvas.addEventListener("pointermove",this.#e)}unlistenPointerUpdates(){this.canvas.removeEventListener("pointermove",this.#e)}pointerPosToWorldPos(i,p){let a=this.canvas.getBoundingClientRect(),f=(i-a.left)/a.width,b=(p-a.top)/a.height,x=f*this.viewportWidth*this.cameraWidth/a.width,R=b*this.viewportHeight*this.cameraHeight/a.height;return new C(x,R)}getMousePos(){return this.pointerPosToWorldPos(this.pointerX,this.pointerY)}useDraw(i){let p=a=>{i(a,new r)};return this.on("draw",p),()=>{this.off("draw",p)}}attachTo(i){i.addRenderer(this),this.game=i}detach(){this.game&&this.game.deleteRenderer(this)}}y.KaylaRenderer=e;class t{current;saves;constructor(){this.saves=[]}useTick(i){if(!this.current)throw new Error("Hook 'useTick' must be executed in the top level scope of a component.");this.current.onTick[this.current.useStepCallIndex]=i,this.current.useStepCallIndex++}usePaint(i){if(!this.current)throw new Error("Hook 'usePaint' must be executed in the top level scope of a component.");this.current.onPaint[this.current.useDrawCallIndex]=i,this.current.useDrawCallIndex++}useEntity(){return L(D)}useSelf(i){let p=L(null);return(p.current===null||p.current===void 0)&&(p.current=i()),p.current}useState(i,{alwaysRecall:p=!1}={}){if(!this.current)throw new Error("Hook 'useState' must be executed in the top level scope of a component.");let f=this.current.state[this.current.useStateCallIndex]??new s(this.current,i,{alwaysRecall:p});return this.current.state[this.current.useStateCallIndex]=f,this.current.useStateCallIndex++,f}useRef(i){if(!this.current)throw new Error("Hook 'useRef' must be executed in the top level scope of a component.");let a=this.current.refs[this.current.useRefCallIndex]??l(i??null);return this.current.refs[this.current.useRefCallIndex]=a,this.current.useRefCallIndex++,a}useEffect(i){if(!this.current)throw new Error("Hook 'useEffect' must be executed in the top level scope of a component.");this.current.onEffect[this.current.useEffectCallIndex]=i,this.current.useEffectCallIndex++}useExports(i,p){if(!this.current)throw new Error("Hook 'useExports' must be executed in the top level scope of a component.");this.current.onExport=p}save(){this.saves.push({current:this.current})}restore(){let i=this.saves.pop();if(!i)throw new Error("Cannot restore without saving.");this.current=i.current}}y.GlobalKayla=t;class r{preventDefault(){this.#e=!0}#e=!1;isPrevented(){return this.#e}}y.KaylaEvent=r;class s{#e;#t;#n;alwaysRecall;constructor(i,p,{alwaysRecall:a=!1}={}){this.#t=i,this.#e=p??void 0,this.#n=Date.now(),this.alwaysRecall=a}get(){return this.#e}add(i,{recall:p}={}){this.set(this.get()+i,{recall:p})}multiply(i,{recall:p}={}){this.set(this.get()*i,{recall:p})}set(i,{recall:p=!1}={}){let a=this.#e;i!==a&&(this.#e=i,(p||this.alwaysRecall)&&this.#t.refresh(),this.#n=Date.now())}get value(){return this.#e}get lastChanged(){return this.#n}}y.KaylaState=s;class o{#e;constructor(i){this.#e=i??void 0}#t;setSetter(i){this.#t=i}get current(){return this.#e}set current(i){this.#e=i,this.#t&&this.#t(this.#e)}}y.KaylaInternalRef=o;function l(m){return new o(m)}y.createReassignableRef=l;class h{state;refs;global;callProps;scene;exports;constructor(i,p,a){if(!a)throw new Error("Empty element");this.scene=p,this.state=[],this.refs=[],this.fc=a.type,this.callProps=a.props??{},this.global=i,this.lastStateDeps=[],this.entity=null,this.lastChildren=[],this.onEffect=[],this.onUnEffect=[],this.onPaint=[],this.onTick=[]}get key(){return this.callProps.key}set key(i){this.callProps.key=i}get children(){return this.callProps.children}set children(i){this.callProps.children=i}entity;onExport=()=>({});onEffect;onUnEffect;onEffectDeps;onPaint;onTick;fc;useStateCallIndex=0;useEffectCallIndex=0;useDrawCallIndex=0;useStepCallIndex=0;useRefCallIndex=0;lastStateDeps;refresh(){let i;this.global.save(),this.global.current=this,this.useStateCallIndex=0,this.useRefCallIndex=0;let p=[];try{let a=this.fc(this.callProps)??[];if(a&&!Array.isArray(a)&&(a=[a]),!Array.isArray(a))throw new Error("Non array or non undefined children received.");p=a}catch(a){i=a}this.useStateCallIndex=0,this.useRefCallIndex=0,this.useDrawCallIndex=0,this.useStepCallIndex=0,this.useEffectCallIndex=0,this.global.restore();try{let a=0,f=[];for(let b of p){let x=this.lastChildren.at(a)??new h(this.global,this.scene,b);this.lastChildren[a]=x,f.push(x),a++}for(let b of this.lastChildren.filter(x=>!f.includes(x))){let x=this.lastChildren.indexOf(b);x!==1&&this.lastChildren.splice(x,1),b.unuse()}for(let b of this.lastChildren)try{b.refresh()}catch(x){console.error(x)}le(()=>{this.use()})}catch(a){console.error(a)}if(i)throw i}lastChildren;isFirstUse=!0;use(){try{let i=!0;if(this.lastStateDeps??=[],Array.isArray(this.onEffectDeps)&&(i=this.onEffectDeps.some((p,a)=>{let f=this.lastStateDeps.at(a);if(f){let b=p.lastChanged,x=f.stamp;return b>x}})),i||this.isFirstUse){this.isFirstUse=!1,Array.isArray(this.onEffectDeps)&&(this.lastStateDeps=this.onEffectDeps.map(a=>({stamp:a.lastChanged,stateRef:a}))),this.key??=this.fc.name+"_"+U(),this.entity&&this.scene.getScene().removeEntity(this.entity),this.entity&&this.entity.name!==this.key&&(this.entity=null),this.entity=this.entity??new u(this,this.key);for(let a of this.refs)a.current===D&&(a.current=this.entity);this.callProps.ref instanceof o&&(this.callProps.ref.current=this.entity),this.exports=this.onExport(),this.callProps.exportsRef instanceof o&&(this.callProps.exportsRef.current=this.exports),this.scene.getScene().addEntity(this.entity);let p=this.onEffect.map(a=>a()).filter(a=>a!==void 0);this.onUnEffect=p}}catch(i){throw i}}unuse(){try{for(let i of this.onUnEffect)i()}catch(i){console.error(i)}this.scene.getScene().removeEntity(this.entity)}}y.KaylaFiber=h;class u extends F{#e;constructor(i,p){super(p,0,0,0,0),this.#e=i}update(i){let p=new r;if(this.#e.onTick)for(let a of this.#e.onTick)a(i,p);p.isPrevented()}draw(i){let p=new r;if(this.#e.onPaint)for(let a of this.#e.onPaint)a(i,p);p.isPrevented()||super.draw(i)}}y.KaylaRectEntity=u;class c{constructor(i){this.#t=i,this.#e=null,i.on("update",this.tickHandler.bind(this)),this.drawHandler=this.drawHandler.bind(this)}#e;#t;getScene(){return this.#t}drawHandler(i){return this.#t.handleDraw(i)}attachTo(i){i.addScene(this.#t),this.#e=i}spawn(i){new h(y.singleGlobalInstance,this,i).refresh()}detach(){this.#e&&this.#e.removeScene(this.#t)}tickHandler(){}}y.KaylaScene=c,y.singleGlobalInstance=new y.GlobalKayla})(S||={});var g=S.singleGlobalInstance,q=g.useState.bind(g),L=g.useRef.bind(g),B=g.useEffect.bind(g),Se=g.useTick.bind(g),$=g.usePaint.bind(g),Re=g.useExports.bind(g),Ke=g.useSelf.bind(g),Ie=g.useEntity.bind(g),D=Symbol("self_ref");var le=n=>{Promise.resolve(1).then(()=>n())},ke=({children:n})=>Array.isArray(n)?[...n]:n;function Pe(n){return S.createReassignableRef(n)}function Me(n){if(typeof n!="object"||typeof n=="function"||n===null)return n;let e={current:n};return new Proxy({},{get(r,s,o){return s==="reassignSelf"?l=>{e.current=l}:Reflect.get(e.current,s,o)},set(r,s,o,l){return Reflect.set(e.current,s,o,l)},has(r,s){return Reflect.has(e.current,s)},ownKeys(r){return Reflect.ownKeys(e.current)},getOwnPropertyDescriptor(r,s){return Reflect.getOwnPropertyDescriptor(e.current,s)},deleteProperty(r,s){return Reflect.deleteProperty(e.current,s)}})}Reflect.set(globalThis,"Kayla",V);var Ae;(e=>e.UIComponent=({x:t,y:r,width:s,height:o,children:l})=>{let h=L(D),u=q(!1);return B(()=>{if(u.get()===!0)return;u.set(!0);let c=h.current;c.width=s,c.height=o,c.x=t,c.y=r}),$(c=>{c.fillStyle="rgba(0, 0, 0, 0.5)",c.fillRect(t,r,s,o)}),l??[]})(Ae||={});var Ve={LEA:z,Kayla:V};export{V as Kayla,z as LEA,Ve as default};
|
package/dist/jsx-runtime.d.cts
CHANGED
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -707,41 +707,41 @@ type Reassignable<T extends Record<any, any>> = T & {
|
|
|
707
707
|
};
|
|
708
708
|
declare function createReassignableObject<T extends object>(initial: T): Reassignable<T>;
|
|
709
709
|
|
|
710
|
-
type
|
|
711
|
-
type
|
|
712
|
-
type
|
|
713
|
-
type
|
|
714
|
-
declare const
|
|
715
|
-
type
|
|
716
|
-
type
|
|
717
|
-
type
|
|
718
|
-
type
|
|
719
|
-
declare const
|
|
720
|
-
type
|
|
721
|
-
declare const
|
|
722
|
-
type
|
|
723
|
-
type
|
|
724
|
-
type
|
|
725
|
-
type
|
|
726
|
-
type
|
|
727
|
-
type
|
|
728
|
-
declare const
|
|
729
|
-
declare const
|
|
730
|
-
declare const
|
|
731
|
-
declare const
|
|
732
|
-
declare const
|
|
733
|
-
declare const
|
|
734
|
-
declare const
|
|
735
|
-
declare const
|
|
736
|
-
declare const
|
|
737
|
-
declare const
|
|
738
|
-
declare const
|
|
739
|
-
declare const
|
|
740
|
-
declare const
|
|
741
|
-
declare const
|
|
742
|
-
declare const
|
|
743
|
-
declare namespace
|
|
744
|
-
export { type
|
|
710
|
+
type Kayla_ExportsOfFC<T extends FC<any, any>> = ExportsOfFC<T>;
|
|
711
|
+
type Kayla_FC<Props extends FCProps = FCProps, Exports extends FCExports = FCExports> = FC<Props, Exports>;
|
|
712
|
+
type Kayla_FCExports = FCExports;
|
|
713
|
+
type Kayla_FCProps = FCProps;
|
|
714
|
+
declare const Kayla_JSX: typeof JSX;
|
|
715
|
+
type Kayla_KaylaElement<Props extends FCProps> = KaylaElement<Props>;
|
|
716
|
+
type Kayla_KaylaElementRef = KaylaElementRef;
|
|
717
|
+
type Kayla_KaylaExportables = KaylaExportables;
|
|
718
|
+
type Kayla_KaylaExports<StateMap extends Record<string, KaylaExportables>> = KaylaExports<StateMap>;
|
|
719
|
+
declare const Kayla_KaylaFragment: typeof KaylaFragment;
|
|
720
|
+
type Kayla_KaylaGame = KaylaGame;
|
|
721
|
+
declare const Kayla_KaylaInternals: typeof KaylaInternals;
|
|
722
|
+
type Kayla_KaylaRef<T> = KaylaRef<T>;
|
|
723
|
+
type Kayla_KaylaRenderer = KaylaRenderer;
|
|
724
|
+
type Kayla_KaylaScene = KaylaScene;
|
|
725
|
+
type Kayla_KaylaState<T> = KaylaState<T>;
|
|
726
|
+
type Kayla_PropOfFC<T extends FC<any, any>> = PropOfFC<T>;
|
|
727
|
+
type Kayla_Reassignable<T extends Record<any, any>> = Reassignable<T>;
|
|
728
|
+
declare const Kayla_createElement: typeof createElement;
|
|
729
|
+
declare const Kayla_createGame: typeof createGame;
|
|
730
|
+
declare const Kayla_createReassignableObject: typeof createReassignableObject;
|
|
731
|
+
declare const Kayla_createRenderer: typeof createRenderer;
|
|
732
|
+
declare const Kayla_createScene: typeof createScene;
|
|
733
|
+
declare const Kayla_useDisposableRef: typeof useDisposableRef;
|
|
734
|
+
declare const Kayla_useEffect: typeof useEffect;
|
|
735
|
+
declare const Kayla_useEntity: typeof useEntity;
|
|
736
|
+
declare const Kayla_useExports: typeof useExports;
|
|
737
|
+
declare const Kayla_useNextStack: typeof useNextStack;
|
|
738
|
+
declare const Kayla_usePaint: typeof usePaint;
|
|
739
|
+
declare const Kayla_useRef: typeof useRef;
|
|
740
|
+
declare const Kayla_useSelf: typeof useSelf;
|
|
741
|
+
declare const Kayla_useState: typeof useState;
|
|
742
|
+
declare const Kayla_useTick: typeof useTick;
|
|
743
|
+
declare namespace Kayla {
|
|
744
|
+
export { type Kayla_ExportsOfFC as ExportsOfFC, type Kayla_FC as FC, type Kayla_FCExports as FCExports, type Kayla_FCProps as FCProps, Kayla_JSX as JSX, type Kayla_KaylaElement as KaylaElement, type Kayla_KaylaElementRef as KaylaElementRef, type Kayla_KaylaExportables as KaylaExportables, type Kayla_KaylaExports as KaylaExports, Kayla_KaylaFragment as KaylaFragment, type Kayla_KaylaGame as KaylaGame, Kayla_KaylaInternals as KaylaInternals, type Kayla_KaylaRef as KaylaRef, type Kayla_KaylaRenderer as KaylaRenderer, type Kayla_KaylaScene as KaylaScene, type Kayla_KaylaState as KaylaState, type Kayla_PropOfFC as PropOfFC, type Kayla_Reassignable as Reassignable, Kayla_createElement as createElement, Kayla_createGame as createGame, Kayla_createReassignableObject as createReassignableObject, Kayla_createRenderer as createRenderer, Kayla_createScene as createScene, selfSym as self, Kayla_useDisposableRef as useDisposableRef, Kayla_useEffect as useEffect, Kayla_useEntity as useEntity, Kayla_useExports as useExports, Kayla_useNextStack as useNextStack, Kayla_usePaint as usePaint, Kayla_useRef as useRef, Kayla_useSelf as useSelf, Kayla_useState as useState, Kayla_useTick as useTick };
|
|
745
745
|
}
|
|
746
746
|
|
|
747
|
-
export { useSelf as A, useState as B, useTick as C, type ExportsOfFC as E, type FCProps as F, JSX as J,
|
|
747
|
+
export { useSelf as A, useState as B, useTick as C, type ExportsOfFC as E, type FCProps as F, JSX as J, Kayla as K, type PropOfFC as P, type Reassignable as R, type FC as a, type FCExports as b, type KaylaElement as c, type KaylaElementRef as d, type KaylaExportables as e, type KaylaExports as f, KaylaFragment as g, KaylaGame as h, KaylaInternals as i, type KaylaRef as j, KaylaRenderer as k, KaylaScene as l, KaylaState as m, createElement as n, createGame as o, createReassignableObject as p, createRenderer as q, createScene as r, selfSym as s, useEffect as t, useDisposableRef as u, useEntity as v, useExports as w, useNextStack as x, usePaint as y, useRef as z };
|
|
@@ -707,41 +707,41 @@ type Reassignable<T extends Record<any, any>> = T & {
|
|
|
707
707
|
};
|
|
708
708
|
declare function createReassignableObject<T extends object>(initial: T): Reassignable<T>;
|
|
709
709
|
|
|
710
|
-
type
|
|
711
|
-
type
|
|
712
|
-
type
|
|
713
|
-
type
|
|
714
|
-
declare const
|
|
715
|
-
type
|
|
716
|
-
type
|
|
717
|
-
type
|
|
718
|
-
type
|
|
719
|
-
declare const
|
|
720
|
-
type
|
|
721
|
-
declare const
|
|
722
|
-
type
|
|
723
|
-
type
|
|
724
|
-
type
|
|
725
|
-
type
|
|
726
|
-
type
|
|
727
|
-
type
|
|
728
|
-
declare const
|
|
729
|
-
declare const
|
|
730
|
-
declare const
|
|
731
|
-
declare const
|
|
732
|
-
declare const
|
|
733
|
-
declare const
|
|
734
|
-
declare const
|
|
735
|
-
declare const
|
|
736
|
-
declare const
|
|
737
|
-
declare const
|
|
738
|
-
declare const
|
|
739
|
-
declare const
|
|
740
|
-
declare const
|
|
741
|
-
declare const
|
|
742
|
-
declare const
|
|
743
|
-
declare namespace
|
|
744
|
-
export { type
|
|
710
|
+
type Kayla_ExportsOfFC<T extends FC<any, any>> = ExportsOfFC<T>;
|
|
711
|
+
type Kayla_FC<Props extends FCProps = FCProps, Exports extends FCExports = FCExports> = FC<Props, Exports>;
|
|
712
|
+
type Kayla_FCExports = FCExports;
|
|
713
|
+
type Kayla_FCProps = FCProps;
|
|
714
|
+
declare const Kayla_JSX: typeof JSX;
|
|
715
|
+
type Kayla_KaylaElement<Props extends FCProps> = KaylaElement<Props>;
|
|
716
|
+
type Kayla_KaylaElementRef = KaylaElementRef;
|
|
717
|
+
type Kayla_KaylaExportables = KaylaExportables;
|
|
718
|
+
type Kayla_KaylaExports<StateMap extends Record<string, KaylaExportables>> = KaylaExports<StateMap>;
|
|
719
|
+
declare const Kayla_KaylaFragment: typeof KaylaFragment;
|
|
720
|
+
type Kayla_KaylaGame = KaylaGame;
|
|
721
|
+
declare const Kayla_KaylaInternals: typeof KaylaInternals;
|
|
722
|
+
type Kayla_KaylaRef<T> = KaylaRef<T>;
|
|
723
|
+
type Kayla_KaylaRenderer = KaylaRenderer;
|
|
724
|
+
type Kayla_KaylaScene = KaylaScene;
|
|
725
|
+
type Kayla_KaylaState<T> = KaylaState<T>;
|
|
726
|
+
type Kayla_PropOfFC<T extends FC<any, any>> = PropOfFC<T>;
|
|
727
|
+
type Kayla_Reassignable<T extends Record<any, any>> = Reassignable<T>;
|
|
728
|
+
declare const Kayla_createElement: typeof createElement;
|
|
729
|
+
declare const Kayla_createGame: typeof createGame;
|
|
730
|
+
declare const Kayla_createReassignableObject: typeof createReassignableObject;
|
|
731
|
+
declare const Kayla_createRenderer: typeof createRenderer;
|
|
732
|
+
declare const Kayla_createScene: typeof createScene;
|
|
733
|
+
declare const Kayla_useDisposableRef: typeof useDisposableRef;
|
|
734
|
+
declare const Kayla_useEffect: typeof useEffect;
|
|
735
|
+
declare const Kayla_useEntity: typeof useEntity;
|
|
736
|
+
declare const Kayla_useExports: typeof useExports;
|
|
737
|
+
declare const Kayla_useNextStack: typeof useNextStack;
|
|
738
|
+
declare const Kayla_usePaint: typeof usePaint;
|
|
739
|
+
declare const Kayla_useRef: typeof useRef;
|
|
740
|
+
declare const Kayla_useSelf: typeof useSelf;
|
|
741
|
+
declare const Kayla_useState: typeof useState;
|
|
742
|
+
declare const Kayla_useTick: typeof useTick;
|
|
743
|
+
declare namespace Kayla {
|
|
744
|
+
export { type Kayla_ExportsOfFC as ExportsOfFC, type Kayla_FC as FC, type Kayla_FCExports as FCExports, type Kayla_FCProps as FCProps, Kayla_JSX as JSX, type Kayla_KaylaElement as KaylaElement, type Kayla_KaylaElementRef as KaylaElementRef, type Kayla_KaylaExportables as KaylaExportables, type Kayla_KaylaExports as KaylaExports, Kayla_KaylaFragment as KaylaFragment, type Kayla_KaylaGame as KaylaGame, Kayla_KaylaInternals as KaylaInternals, type Kayla_KaylaRef as KaylaRef, type Kayla_KaylaRenderer as KaylaRenderer, type Kayla_KaylaScene as KaylaScene, type Kayla_KaylaState as KaylaState, type Kayla_PropOfFC as PropOfFC, type Kayla_Reassignable as Reassignable, Kayla_createElement as createElement, Kayla_createGame as createGame, Kayla_createReassignableObject as createReassignableObject, Kayla_createRenderer as createRenderer, Kayla_createScene as createScene, selfSym as self, Kayla_useDisposableRef as useDisposableRef, Kayla_useEffect as useEffect, Kayla_useEntity as useEntity, Kayla_useExports as useExports, Kayla_useNextStack as useNextStack, Kayla_usePaint as usePaint, Kayla_useRef as useRef, Kayla_useSelf as useSelf, Kayla_useState as useState, Kayla_useTick as useTick };
|
|
745
745
|
}
|
|
746
746
|
|
|
747
|
-
export { useSelf as A, useState as B, useTick as C, type ExportsOfFC as E, type FCProps as F, JSX as J,
|
|
747
|
+
export { useSelf as A, useState as B, useTick as C, type ExportsOfFC as E, type FCProps as F, JSX as J, Kayla as K, type PropOfFC as P, type Reassignable as R, type FC as a, type FCExports as b, type KaylaElement as c, type KaylaElementRef as d, type KaylaExportables as e, type KaylaExports as f, KaylaFragment as g, KaylaGame as h, KaylaInternals as i, type KaylaRef as j, KaylaRenderer as k, KaylaScene as l, KaylaState as m, createElement as n, createGame as o, createReassignableObject as p, createRenderer as q, createScene as r, selfSym as s, useEffect as t, useDisposableRef as u, useEntity as v, useExports as w, useNextStack as x, usePaint as y, useRef as z };
|
package/dist/kayla.d.cts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
import { F as FCProps, a as FC } from './kayla-internals-k7GMYD9t.cjs';
|
|
2
|
+
export { E as ExportsOfFC, b as FCExports, J as JSX, K as Kayla, c as KaylaElement, d as KaylaElementRef, e as KaylaExportables, f as KaylaExports, g as KaylaFragment, h as KaylaGame, i as KaylaInternals, j as KaylaRef, k as KaylaRenderer, l as KaylaScene, m as KaylaState, P as PropOfFC, R as Reassignable, n as createElement, o as createGame, p as createReassignableObject, q as createRenderer, r as createScene, s as self, u as useDisposableRef, t as useEffect, v as useEntity, w as useExports, x as useNextStack, y as usePaint, z as useRef, A as useSelf, B as useState, C as useTick } from './kayla-internals-k7GMYD9t.cjs';
|
|
3
3
|
import './lea-DvxsutSf.cjs';
|
|
4
|
+
|
|
5
|
+
declare namespace UI {
|
|
6
|
+
interface UIProps extends FCProps {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
}
|
|
13
|
+
const UIComponent: FC<UIProps>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { FC, FCProps, UI };
|
package/dist/kayla.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
import { F as FCProps, a as FC } from './kayla-internals-KKhcrA30.js';
|
|
2
|
+
export { E as ExportsOfFC, b as FCExports, J as JSX, K as Kayla, c as KaylaElement, d as KaylaElementRef, e as KaylaExportables, f as KaylaExports, g as KaylaFragment, h as KaylaGame, i as KaylaInternals, j as KaylaRef, k as KaylaRenderer, l as KaylaScene, m as KaylaState, P as PropOfFC, R as Reassignable, n as createElement, o as createGame, p as createReassignableObject, q as createRenderer, r as createScene, s as self, u as useDisposableRef, t as useEffect, v as useEntity, w as useExports, x as useNextStack, y as usePaint, z as useRef, A as useSelf, B as useState, C as useTick } from './kayla-internals-KKhcrA30.js';
|
|
3
3
|
import './lea-DvxsutSf.js';
|
|
4
|
+
|
|
5
|
+
declare namespace UI {
|
|
6
|
+
interface UIProps extends FCProps {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
}
|
|
13
|
+
const UIComponent: FC<UIProps>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { FC, FCProps, UI };
|
package/package.json
CHANGED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { F as FCProps, a as FC, E as ExportsOfFC, b as FCExports, J as JSX, k as kaylaInternals, K as KaylaElement, c as KaylaElementRef, d as KaylaExportables, e as KaylaExports, f as KaylaFragment, g as KaylaGame, h as KaylaInternals, i as KaylaRef, j as KaylaRenderer, l as KaylaScene, m as KaylaState, P as PropOfFC, R as Reassignable, n as createElement, o as createGame, p as createReassignableObject, q as createRenderer, r as createScene, s as selfSym, u as useDisposableRef, t as useEffect, v as useEntity, w as useExports, x as useNextStack, y as usePaint, z as useRef, A as useSelf, B as useState, C as useTick } from './kayla-internals-SFvqkItz.cjs';
|
|
2
|
-
|
|
3
|
-
declare namespace UI {
|
|
4
|
-
interface UIProps extends FCProps {
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
onClick?: () => void;
|
|
10
|
-
}
|
|
11
|
-
const UIComponent: FC<UIProps>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
declare const Kayla_ExportsOfFC: typeof ExportsOfFC;
|
|
15
|
-
declare const Kayla_FC: typeof FC;
|
|
16
|
-
declare const Kayla_FCExports: typeof FCExports;
|
|
17
|
-
declare const Kayla_FCProps: typeof FCProps;
|
|
18
|
-
declare const Kayla_JSX: typeof JSX;
|
|
19
|
-
declare const Kayla_KaylaElement: typeof KaylaElement;
|
|
20
|
-
declare const Kayla_KaylaElementRef: typeof KaylaElementRef;
|
|
21
|
-
declare const Kayla_KaylaExportables: typeof KaylaExportables;
|
|
22
|
-
declare const Kayla_KaylaExports: typeof KaylaExports;
|
|
23
|
-
declare const Kayla_KaylaFragment: typeof KaylaFragment;
|
|
24
|
-
declare const Kayla_KaylaGame: typeof KaylaGame;
|
|
25
|
-
declare const Kayla_KaylaInternals: typeof KaylaInternals;
|
|
26
|
-
declare const Kayla_KaylaRef: typeof KaylaRef;
|
|
27
|
-
declare const Kayla_KaylaRenderer: typeof KaylaRenderer;
|
|
28
|
-
declare const Kayla_KaylaScene: typeof KaylaScene;
|
|
29
|
-
declare const Kayla_KaylaState: typeof KaylaState;
|
|
30
|
-
declare const Kayla_PropOfFC: typeof PropOfFC;
|
|
31
|
-
declare const Kayla_Reassignable: typeof Reassignable;
|
|
32
|
-
declare const Kayla_UI: typeof UI;
|
|
33
|
-
declare const Kayla_createElement: typeof createElement;
|
|
34
|
-
declare const Kayla_createGame: typeof createGame;
|
|
35
|
-
declare const Kayla_createReassignableObject: typeof createReassignableObject;
|
|
36
|
-
declare const Kayla_createRenderer: typeof createRenderer;
|
|
37
|
-
declare const Kayla_createScene: typeof createScene;
|
|
38
|
-
declare const Kayla_useDisposableRef: typeof useDisposableRef;
|
|
39
|
-
declare const Kayla_useEffect: typeof useEffect;
|
|
40
|
-
declare const Kayla_useEntity: typeof useEntity;
|
|
41
|
-
declare const Kayla_useExports: typeof useExports;
|
|
42
|
-
declare const Kayla_useNextStack: typeof useNextStack;
|
|
43
|
-
declare const Kayla_usePaint: typeof usePaint;
|
|
44
|
-
declare const Kayla_useRef: typeof useRef;
|
|
45
|
-
declare const Kayla_useSelf: typeof useSelf;
|
|
46
|
-
declare const Kayla_useState: typeof useState;
|
|
47
|
-
declare const Kayla_useTick: typeof useTick;
|
|
48
|
-
declare namespace Kayla {
|
|
49
|
-
export { Kayla_ExportsOfFC as ExportsOfFC, Kayla_FC as FC, Kayla_FCExports as FCExports, Kayla_FCProps as FCProps, Kayla_JSX as JSX, kaylaInternals as Kayla, Kayla_KaylaElement as KaylaElement, Kayla_KaylaElementRef as KaylaElementRef, Kayla_KaylaExportables as KaylaExportables, Kayla_KaylaExports as KaylaExports, Kayla_KaylaFragment as KaylaFragment, Kayla_KaylaGame as KaylaGame, Kayla_KaylaInternals as KaylaInternals, Kayla_KaylaRef as KaylaRef, Kayla_KaylaRenderer as KaylaRenderer, Kayla_KaylaScene as KaylaScene, Kayla_KaylaState as KaylaState, Kayla_PropOfFC as PropOfFC, Kayla_Reassignable as Reassignable, Kayla_UI as UI, Kayla_createElement as createElement, Kayla_createGame as createGame, Kayla_createReassignableObject as createReassignableObject, Kayla_createRenderer as createRenderer, Kayla_createScene as createScene, selfSym as self, Kayla_useDisposableRef as useDisposableRef, Kayla_useEffect as useEffect, Kayla_useEntity as useEntity, Kayla_useExports as useExports, Kayla_useNextStack as useNextStack, Kayla_usePaint as usePaint, Kayla_useRef as useRef, Kayla_useSelf as useSelf, Kayla_useState as useState, Kayla_useTick as useTick };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { Kayla as K, UI as U };
|
package/dist/kayla-BsyWegde.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { F as FCProps, a as FC, E as ExportsOfFC, b as FCExports, J as JSX, k as kaylaInternals, K as KaylaElement, c as KaylaElementRef, d as KaylaExportables, e as KaylaExports, f as KaylaFragment, g as KaylaGame, h as KaylaInternals, i as KaylaRef, j as KaylaRenderer, l as KaylaScene, m as KaylaState, P as PropOfFC, R as Reassignable, n as createElement, o as createGame, p as createReassignableObject, q as createRenderer, r as createScene, s as selfSym, u as useDisposableRef, t as useEffect, v as useEntity, w as useExports, x as useNextStack, y as usePaint, z as useRef, A as useSelf, B as useState, C as useTick } from './kayla-internals-Cad69KZq.js';
|
|
2
|
-
|
|
3
|
-
declare namespace UI {
|
|
4
|
-
interface UIProps extends FCProps {
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
onClick?: () => void;
|
|
10
|
-
}
|
|
11
|
-
const UIComponent: FC<UIProps>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
declare const Kayla_ExportsOfFC: typeof ExportsOfFC;
|
|
15
|
-
declare const Kayla_FC: typeof FC;
|
|
16
|
-
declare const Kayla_FCExports: typeof FCExports;
|
|
17
|
-
declare const Kayla_FCProps: typeof FCProps;
|
|
18
|
-
declare const Kayla_JSX: typeof JSX;
|
|
19
|
-
declare const Kayla_KaylaElement: typeof KaylaElement;
|
|
20
|
-
declare const Kayla_KaylaElementRef: typeof KaylaElementRef;
|
|
21
|
-
declare const Kayla_KaylaExportables: typeof KaylaExportables;
|
|
22
|
-
declare const Kayla_KaylaExports: typeof KaylaExports;
|
|
23
|
-
declare const Kayla_KaylaFragment: typeof KaylaFragment;
|
|
24
|
-
declare const Kayla_KaylaGame: typeof KaylaGame;
|
|
25
|
-
declare const Kayla_KaylaInternals: typeof KaylaInternals;
|
|
26
|
-
declare const Kayla_KaylaRef: typeof KaylaRef;
|
|
27
|
-
declare const Kayla_KaylaRenderer: typeof KaylaRenderer;
|
|
28
|
-
declare const Kayla_KaylaScene: typeof KaylaScene;
|
|
29
|
-
declare const Kayla_KaylaState: typeof KaylaState;
|
|
30
|
-
declare const Kayla_PropOfFC: typeof PropOfFC;
|
|
31
|
-
declare const Kayla_Reassignable: typeof Reassignable;
|
|
32
|
-
declare const Kayla_UI: typeof UI;
|
|
33
|
-
declare const Kayla_createElement: typeof createElement;
|
|
34
|
-
declare const Kayla_createGame: typeof createGame;
|
|
35
|
-
declare const Kayla_createReassignableObject: typeof createReassignableObject;
|
|
36
|
-
declare const Kayla_createRenderer: typeof createRenderer;
|
|
37
|
-
declare const Kayla_createScene: typeof createScene;
|
|
38
|
-
declare const Kayla_useDisposableRef: typeof useDisposableRef;
|
|
39
|
-
declare const Kayla_useEffect: typeof useEffect;
|
|
40
|
-
declare const Kayla_useEntity: typeof useEntity;
|
|
41
|
-
declare const Kayla_useExports: typeof useExports;
|
|
42
|
-
declare const Kayla_useNextStack: typeof useNextStack;
|
|
43
|
-
declare const Kayla_usePaint: typeof usePaint;
|
|
44
|
-
declare const Kayla_useRef: typeof useRef;
|
|
45
|
-
declare const Kayla_useSelf: typeof useSelf;
|
|
46
|
-
declare const Kayla_useState: typeof useState;
|
|
47
|
-
declare const Kayla_useTick: typeof useTick;
|
|
48
|
-
declare namespace Kayla {
|
|
49
|
-
export { Kayla_ExportsOfFC as ExportsOfFC, Kayla_FC as FC, Kayla_FCExports as FCExports, Kayla_FCProps as FCProps, Kayla_JSX as JSX, kaylaInternals as Kayla, Kayla_KaylaElement as KaylaElement, Kayla_KaylaElementRef as KaylaElementRef, Kayla_KaylaExportables as KaylaExportables, Kayla_KaylaExports as KaylaExports, Kayla_KaylaFragment as KaylaFragment, Kayla_KaylaGame as KaylaGame, Kayla_KaylaInternals as KaylaInternals, Kayla_KaylaRef as KaylaRef, Kayla_KaylaRenderer as KaylaRenderer, Kayla_KaylaScene as KaylaScene, Kayla_KaylaState as KaylaState, Kayla_PropOfFC as PropOfFC, Kayla_Reassignable as Reassignable, Kayla_UI as UI, Kayla_createElement as createElement, Kayla_createGame as createGame, Kayla_createReassignableObject as createReassignableObject, Kayla_createRenderer as createRenderer, Kayla_createScene as createScene, selfSym as self, Kayla_useDisposableRef as useDisposableRef, Kayla_useEffect as useEffect, Kayla_useEntity as useEntity, Kayla_useExports as useExports, Kayla_useNextStack as useNextStack, Kayla_usePaint as usePaint, Kayla_useRef as useRef, Kayla_useSelf as useSelf, Kayla_useState as useState, Kayla_useTick as useTick };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { Kayla as K, UI as U };
|