var an=Object.defineProperty;var _i=Object.getOwnPropertyDescriptor;var ji=Object.getOwnPropertyNames;var Hi=Object.prototype.hasOwnProperty;var o=(n,e)=>an(n,"name",{value:e,configurable:!0});var qi=(n,e)=>{for(var r in e)an(n,r,{get:e[r],enumerable:!0})},zi=(n,e,r,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let h of ji(e))!Hi.call(n,h)&&h!==r&&an(n,h,{get:()=>e[h],enumerable:!(c=_i(e,h))||c.enumerable});return n};var Yi=n=>zi(an({},"__esModule",{value:!0}),n);var Gs=(()=>{for(var n=new Uint8Array(128),e=0;e<64;e++)n[e<26?e+65:e<52?e+71:e<62?e-4:e*4-205]=e;return r=>{for(var c=r.length,h=new Uint8Array((c-(r[c-1]=="=")-(r[c-2]=="="))*3/4|0),m=0,y=0;m>4,h[y++]=O<<4|v>>2,h[y++]=v<<6|z}return h}})();var No={};qi(No,{default:()=>Vo});module.exports=Yi(No);function we(n){return n*Math.PI/180}o(we,"deg2rad");function lt(n){return n*180/Math.PI}o(lt,"rad2deg");function We(n,e,r){return e>r?We(n,r,e):Math.min(Math.max(n,e),r)}o(We,"clamp");function Ze(n,e,r){if(typeof n=="number"&&typeof e=="number")return n+(e-n)*r;if(n instanceof x&&e instanceof x)return n.lerp(e,r);if(n instanceof J&&e instanceof J)return n.lerp(e,r);throw new Error(`Bad value for lerp(): ${n}, ${e}. Only number, Vec2 and Color is supported.`)}o(Ze,"lerp");function et(n,e,r,c,h){return c+(n-e)/(r-e)*(h-c)}o(et,"map");function Bs(n,e,r,c,h){return We(et(n,e,r,c,h),c,h)}o(Bs,"mapc");var x=class n{static{o(this,"Vec2")}x=0;y=0;constructor(e=0,r=e){this.x=e,this.y=r}static fromAngle(e){let r=we(e);return new n(Math.cos(r),Math.sin(r))}static LEFT=new n(-1,0);static RIGHT=new n(1,0);static UP=new n(0,-1);static DOWN=new n(0,1);clone(){return new n(this.x,this.y)}add(...e){let r=M(...e);return new n(this.x+r.x,this.y+r.y)}sub(...e){let r=M(...e);return new n(this.x-r.x,this.y-r.y)}scale(...e){let r=M(...e);return new n(this.x*r.x,this.y*r.y)}dist(...e){let r=M(...e);return this.sub(r).len()}sdist(...e){let r=M(...e);return this.sub(r).slen()}len(){return Math.sqrt(this.dot(this))}slen(){return this.dot(this)}unit(){let e=this.len();return e===0?new n(0):this.scale(1/e)}normal(){return new n(this.y,-this.x)}reflect(e){return this.sub(e.scale(2*this.dot(e)))}project(e){return e.scale(e.dot(this)/e.len())}reject(e){return this.sub(this.project(e))}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}angle(...e){let r=M(...e);return lt(Math.atan2(this.y-r.y,this.x-r.x))}angleBetween(...e){let r=M(...e);return lt(Math.atan2(this.cross(r),this.dot(r)))}lerp(e,r){return new n(Ze(this.x,e.x,r),Ze(this.y,e.y,r))}slerp(e,r){let c=this.dot(e),h=this.cross(e),m=Math.atan2(h,c);return this.scale(Math.sin((1-r)*m)).add(e.scale(Math.sin(r*m))).scale(1/h)}isZero(){return this.x===0&&this.y===0}toFixed(e){return new n(Number(this.x.toFixed(e)),Number(this.y.toFixed(e)))}transform(e){return e.multVec2(this)}eq(e){return this.x===e.x&&this.y===e.y}bbox(){return new re(this,0,0)}toString(){return`vec2(${this.x.toFixed(2)}, ${this.y.toFixed(2)})`}};function M(...n){if(n.length===1){if(n[0]instanceof x)return new x(n[0].x,n[0].y);if(Array.isArray(n[0])&&n[0].length===2)return new x(...n[0])}return new x(...n)}o(M,"vec2");var J=class n{static{o(this,"Color")}r=255;g=255;b=255;constructor(e,r,c){this.r=We(e,0,255),this.g=We(r,0,255),this.b=We(c,0,255)}static fromArray(e){return new n(e[0],e[1],e[2])}static fromHex(e){if(typeof e=="number")return new n(e>>16&255,e>>8&255,e>>0&255);if(typeof e=="string"){let r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return new n(parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16))}else throw new Error("Invalid hex color format")}static fromHSL(e,r,c){if(r==0)return new n(255*c,255*c,255*c);let h=o((z,T,V)=>(V<0&&(V+=1),V>1&&(V-=1),V<1/6?z+(T-z)*6*V:V<1/2?T:V<2/3?z+(T-z)*(2/3-V)*6:z),"hue2rgb"),m=c<.5?c*(1+r):c+r-c*r,y=2*c-m,C=h(y,m,e+1/3),O=h(y,m,e),v=h(y,m,e-1/3);return new n(Math.round(C*255),Math.round(O*255),Math.round(v*255))}static RED=new n(255,0,0);static GREEN=new n(0,255,0);static BLUE=new n(0,0,255);static YELLOW=new n(255,255,0);static MAGENTA=new n(255,0,255);static CYAN=new n(0,255,255);static WHITE=new n(255,255,255);static BLACK=new n(0,0,0);clone(){return new n(this.r,this.g,this.b)}lighten(e){return new n(this.r+e,this.g+e,this.b+e)}darken(e){return this.lighten(-e)}invert(){return new n(255-this.r,255-this.g,255-this.b)}mult(e){return new n(this.r*e.r/255,this.g*e.g/255,this.b*e.b/255)}lerp(e,r){return new n(Ze(this.r,e.r,r),Ze(this.g,e.g,r),Ze(this.b,e.b,r))}toHSL(){let e=this.r/255,r=this.g/255,c=this.b/255,h=Math.max(e,r,c),m=Math.min(e,r,c),y=(h+m)/2,C=y,O=y;if(h==m)y=C=0;else{let v=h-m;switch(C=O>.5?v/(2-h-m):v/(h+m),h){case e:y=(r-c)/v+(rJ.fromHSL(n,e,r),"hsl2rgb"),ce=class n{static{o(this,"Quad")}x=0;y=0;w=1;h=1;constructor(e,r,c,h){this.x=e,this.y=r,this.w=c,this.h=h}scale(e){return new n(this.x+this.w*e.x,this.y+this.h*e.y,this.w*e.w,this.h*e.h)}pos(){return new x(this.x,this.y)}clone(){return new n(this.x,this.y,this.w,this.h)}eq(e){return this.x===e.x&&this.y===e.y&&this.w===e.w&&this.h===e.h}toString(){return`quad(${this.x}, ${this.y}, ${this.w}, ${this.h})`}};function me(n,e,r,c){return new ce(n,e,r,c)}o(me,"quad");var Ct=class n{static{o(this,"Mat2")}a;b;c;d;constructor(e,r,c,h){this.a=e,this.b=r,this.c=c,this.d=h}mul(e){return new n(this.a*e.a+this.b*e.c,this.a*e.b+this.b*e.d,this.c*e.a+this.d*e.c,this.c*e.b+this.d*e.d)}transform(e){return M(this.a*e.x+this.b*e.y,this.c*e.x+this.d*e.y)}get inverse(){let e=this.det;return new n(this.d/e,-this.b/e,-this.c/e,this.a/e)}get transpose(){return new n(this.a,this.c,this.b,this.d)}get eigenvalues(){let e=this.trace/2,r=this.det,c=e+Math.sqrt(e*e-r),h=e-Math.sqrt(e*e-r);return[c,h]}eigenvectors(e,r){return this.c!=0?[[e-this.d,this.c],[r-this.d,this.c]]:this.b!=0?[[this.b,e-this.a],[this.b,r-this.a]]:Math.abs(this.transform(M(1,0)).x-e)0?Math.acos(this.m[0]/e):-Math.acos(this.m[0]/e))}else if(this.m[4]!=0||this.m[5]!=0){let e=Math.sqrt(this.m[4]*this.m[4]+this.m[5]*this.m[5]);return lt(Math.PI/2-(this.m[5]>0?Math.acos(-this.m[4]/e):-Math.acos(this.m[4]/e)))}else return 0}getSkew(){if(this.m[0]!=0||this.m[1]!=0){let e=Math.sqrt(this.m[0]*this.m[0]+this.m[1]*this.m[1]);return new x(Math.atan(this.m[0]*this.m[4]+this.m[1]*this.m[5])/(e*e),0)}else if(this.m[4]!=0||this.m[5]!=0){let e=Math.sqrt(this.m[4]*this.m[4]+this.m[5]*this.m[5]);return new x(0,Math.atan(this.m[0]*this.m[4]+this.m[1]*this.m[5])/(e*e))}else return new x(0,0)}invert(){let e=[],r=this.m[10]*this.m[15]-this.m[14]*this.m[11],c=this.m[9]*this.m[15]-this.m[13]*this.m[11],h=this.m[9]*this.m[14]-this.m[13]*this.m[10],m=this.m[8]*this.m[15]-this.m[12]*this.m[11],y=this.m[8]*this.m[14]-this.m[12]*this.m[10],C=this.m[8]*this.m[13]-this.m[12]*this.m[9],O=this.m[6]*this.m[15]-this.m[14]*this.m[7],v=this.m[5]*this.m[15]-this.m[13]*this.m[7],z=this.m[5]*this.m[14]-this.m[13]*this.m[6],T=this.m[4]*this.m[15]-this.m[12]*this.m[7],V=this.m[4]*this.m[14]-this.m[12]*this.m[6],U=this.m[5]*this.m[15]-this.m[13]*this.m[7],_=this.m[4]*this.m[13]-this.m[12]*this.m[5],K=this.m[6]*this.m[11]-this.m[10]*this.m[7],$=this.m[5]*this.m[11]-this.m[9]*this.m[7],L=this.m[5]*this.m[10]-this.m[9]*this.m[6],ne=this.m[4]*this.m[11]-this.m[8]*this.m[7],A=this.m[4]*this.m[10]-this.m[8]*this.m[6],le=this.m[4]*this.m[9]-this.m[8]*this.m[5];e[0]=this.m[5]*r-this.m[6]*c+this.m[7]*h,e[4]=-(this.m[4]*r-this.m[6]*m+this.m[7]*y),e[8]=this.m[4]*c-this.m[5]*m+this.m[7]*C,e[12]=-(this.m[4]*h-this.m[5]*y+this.m[6]*C),e[1]=-(this.m[1]*r-this.m[2]*c+this.m[3]*h),e[5]=this.m[0]*r-this.m[2]*m+this.m[3]*y,e[9]=-(this.m[0]*c-this.m[1]*m+this.m[3]*C),e[13]=this.m[0]*h-this.m[1]*y+this.m[2]*C,e[2]=this.m[1]*O-this.m[2]*v+this.m[3]*z,e[6]=-(this.m[0]*O-this.m[2]*T+this.m[3]*V),e[10]=this.m[0]*U-this.m[1]*T+this.m[3]*_,e[14]=-(this.m[0]*z-this.m[1]*V+this.m[2]*_),e[3]=-(this.m[1]*K-this.m[2]*$+this.m[3]*L),e[7]=this.m[0]*K-this.m[2]*ne+this.m[3]*A,e[11]=-(this.m[0]*$-this.m[1]*ne+this.m[3]*le),e[15]=this.m[0]*L-this.m[1]*A+this.m[2]*le;let j=this.m[0]*e[0]+this.m[1]*e[4]+this.m[2]*e[8]+this.m[3]*e[12];for(let de=0;de<4;de++)for(let ie=0;ie<4;ie++)e[de*4+ie]*=1/j;return new n(e)}clone(){return new n([...this.m])}toString(){return this.m.toString()}};function Yn(n,e,r,c=h=>-Math.cos(h)){return n+(c(r)+1)/2*(e-n)}o(Yn,"wave");var $i=1103515245,Xi=12345,Is=2147483648,Vt=class{static{o(this,"RNG")}seed;constructor(e){this.seed=e}gen(){return this.seed=($i*this.seed+Xi)%Is,this.seed/Is}genNumber(e,r){return e+this.gen()*(r-e)}genVec2(e,r){return new x(this.genNumber(e.x,r.x),this.genNumber(e.y,r.y))}genColor(e,r){return new J(this.genNumber(e.r,r.r),this.genNumber(e.g,r.g),this.genNumber(e.b,r.b))}genAny(...e){if(e.length===0)return this.gen();if(e.length===1){if(typeof e[0]=="number")return this.genNumber(0,e[0]);if(e[0]instanceof x)return this.genVec2(M(0,0),e[0]);if(e[0]instanceof J)return this.genColor(Z(0,0,0),e[0])}else if(e.length===2){if(typeof e[0]=="number"&&typeof e[1]=="number")return this.genNumber(e[0],e[1]);if(e[0]instanceof x&&e[1]instanceof x)return this.genVec2(e[0],e[1]);if(e[0]instanceof J&&e[1]instanceof J)return this.genColor(e[0],e[1])}}},zn=new Vt(Date.now());function Ls(n){return n!=null&&(zn.seed=n),zn.seed}o(Ls,"randSeed");function Nt(...n){return zn.genAny(...n)}o(Nt,"rand");function $n(...n){return Math.floor(Nt(...n))}o($n,"randi");function Vs(n){return Nt()<=n}o(Vs,"chance");function Xn(n){for(let e=n.length-1;e>0;e--){let r=Math.floor(Math.random()*(e+1));[n[e],n[r]]=[n[r],n[e]]}return n}o(Xn,"shuffle");function Ns(n,e){return n.length<=e?n.slice():Xn(n.slice()).slice(0,e)}o(Ns,"chooseMultiple");function ks(n){return n[$n(n.length)]}o(ks,"choose");function Kn(n,e){return n.pos.x+n.width>e.pos.x&&n.pos.xe.pos.y&&n.pos.y1||h<0||h>1?null:c}o(Ki,"testLineLineT");function cn(n,e){let r=Ki(n,e);return r?M(n.p1.x+r*(n.p2.x-n.p1.x),n.p1.y+r*(n.p2.y-n.p1.y)):null}o(cn,"testLineLine");function hn(n,e){let r=e.p2.sub(e.p1),c=Number.NEGATIVE_INFINITY,h=Number.POSITIVE_INFINITY;if(r.x!=0){let m=(n.pos.x-e.p1.x)/r.x,y=(n.pos.x+n.width-e.p1.x)/r.x;c=Math.max(c,Math.min(m,y)),h=Math.min(h,Math.max(m,y))}if(r.y!=0){let m=(n.pos.y-e.p1.y)/r.y,y=(n.pos.y+n.height-e.p1.y)/r.y;c=Math.max(c,Math.min(m,y)),h=Math.min(h,Math.max(m,y))}return h>=c&&h>=0&&c<=1}o(hn,"testRectLine");function ln(n,e){return e.x>n.pos.x&&e.xn.pos.y&&e.yNumber.EPSILON)return!1;let h=r.dot(c)/c.dot(c);return h>=0&&h<=1}o(Wn,"testLinePoint");function At(n,e){let r=n.p2.sub(n.p1),c=r.dot(r),h=n.p1.sub(e.center),m=2*r.dot(h),y=h.dot(h)-e.radius*e.radius,C=m*m-4*c*y;if(c<=Number.EPSILON||C<0)return!1;if(C==0){let O=-m/(2*c);if(O>=0&&O<=1)return!0}else{let O=(-m+Math.sqrt(C))/(2*c),v=(-m-Math.sqrt(C))/(2*c);if(O>=0&&O<=1||v>=0&&v<=1)return!0}return Qn(e,n.p1)}o(At,"testLineCircle");function Jn(n,e){if(dt(e,n.p1)||dt(e,n.p2))return!0;for(let r=0;rdt(e,r))||e.pts.some(r=>dt(n,r)))}o(Hs,"testPolygonPolygon");function dt(n,e){let r=!1,c=n.pts;for(let h=0,m=c.length-1;he.y!=c[m].y>e.y&&e.x<(c[m].x-c[h].x)*(e.y-c[h].y)/(c[m].y-c[h].y)+c[h].x&&(r=!r);return r}o(dt,"testPolygonPoint");function qs(n,e){e=e.sub(n.center);let r=we(n.angle),c=Math.cos(r),h=Math.sin(r),m=e.x*c+e.y*h,y=-e.x*h+e.y*c;return m*m/(n.radiusX*n.radiusX)+y*y/(n.radiusY*n.radiusY)<1}o(qs,"testEllipsePoint");function un(n,e){let r=e.center.sub(n.center),c=we(n.angle),h=Math.cos(c),m=Math.sin(c),y=r.x*h+r.y*m,C=-r.x*m+r.y*h;return qs(new Ye(M(),n.radiusX+e.radius,n.radiusY+e.radius,0),M(y,C))}o(un,"testEllipseCircle");function zs(n,e){let r=n.toMat2().inverse;return e=new Ie(r.transform(e.p1.sub(n.center)),r.transform(e.p2.sub(n.center))),At(e,new Me(M(),1))}o(zs,"testEllipseLine");function Ji(n,e){if(n.radiusX===n.radiusY)return un(e,new Me(n.center,n.radiusX));if(e.radiusX===e.radiusY)return un(n,new Me(e.center,e.radiusX));let r=new ht(1/n.radiusX**2,0,0,0,1/n.radiusY**2,0,0,0,-1),c=new ht(1/e.radiusX**2,0,0,0,1/e.radiusY**2,0,0,0,-1),h=n.center.x,m=n.center.y,y=e.center.x,C=e.center.y,O=we(n.angle),v=we(e.angle),z=new ht(Math.cos(O),-Math.sin(O),h,Math.sin(O),Math.cos(O),m,0,0,1),T=new ht(Math.cos(v),-Math.sin(v),y,Math.sin(v),Math.cos(v),C,0,0,1),V=z.inverse,U=T.inverse,_=V.transpose.mul(r).mul(V),K=U.transpose.mul(c).mul(U),$=_.m11,L=_.m12,ne=_.m13,A=_.m21,le=_.m22,j=_.m23,de=_.m31,ie=_.m32,ae=_.m33,Se=K.m11,Ne=K.m12,Fe=K.m13,Le=K.m21,Ve=K.m22,ye=K.m23,ke=K.m31,_e=K.m32,je=K.m33,ft=$*le*ae-$*j*ie-L*A*ae+L*j*de+ne*A*ie-ne*le*de,Te=($*le*je-$*j*_e-$*ie*ye+$*ae*Ve-L*A*je+L*j*ke+L*de*ye-L*ae*Le+ne*A*_e-ne*le*ke-ne*de*Ve+ne*ie*Le+A*ie*Fe-A*ae*Ne-le*de*Fe+le*ae*Se+j*de*Ne-j*ie*Se)/ft,Oe=($*Ve*je-$*ye*_e-L*Le*je+L*ye*ke+ne*Le*_e-ne*Ve*ke-A*Ne*je+A*Fe*_e+le*Se*je-le*Fe*ke-j*Se*_e+j*Ne*ke+de*Ne*ye-de*Fe*Ve-ie*Se*ye+ie*Fe*Le+ae*Se*Ve-ae*Ne*Le)/ft,ze=(Se*Ve*je-Se*ye*_e-Ne*Le*je+Ne*ye*ke+Fe*Le*_e-Fe*Ve*ke)/ft;if(Te>=0){let rt=-3*Oe+Te**2,it=3*Te*ze+Oe*Te**2-4*Oe**2,Et=-27*ze**2+18*ze*Te*Oe+Te**2*Oe**2-4*Te**3*ze-4*Oe**3;return!(rt>0&&it<0&&Et>0)}else{let rt=-3*Oe+Te**2,it=-27*ze**2+18*ze*Te*Oe+Te**2*Oe**2-4*Te**3*ze-4*Oe**3;return!(rt>0&&it>0)}}o(Ji,"testEllipseEllipse");function Ys(n,e){return Zn(n,new Ee(e.points()))}o(Ys,"testEllipseRect");function Zn(n,e){let r=n.toMat2().inverse;return e=new Ee(e.pts.map(c=>r.transform(c.sub(n.center)))),kt(new Me(M(),1),e)}o(Zn,"testEllipsePolygon");function Qi(n,e){return e instanceof x?Wn(n,e):e instanceof Me?At(n,e):e instanceof Ie?cn(n,e)!=null:e instanceof re?hn(e,n):e instanceof Ee?Jn(n,e):e instanceof Ye?zs(e,n):!1}o(Qi,"testLineShape");function Zi(n,e){return e instanceof x?Qn(n,e):e instanceof Me?Wi(n,e):e instanceof Ie?At(e,n):e instanceof re?_s(e,n):e instanceof Ee?kt(n,e):e instanceof Ye?un(e,n):!1}o(Zi,"testCircleShape");function eo(n,e){return e instanceof x?ln(n,e):e instanceof Me?_s(n,e):e instanceof Ie?hn(n,e):e instanceof re?Kn(n,e):e instanceof Ee?js(n,e):e instanceof Ye?Ys(e,n):!1}o(eo,"testRectShape");function to(n,e){return e instanceof x?dt(n,e):e instanceof Me?kt(e,n):e instanceof Ie?Jn(e,n):e instanceof re?js(e,n):e instanceof Ee?Hs(e,n):e instanceof Ye?Zn(e,n):!1}o(to,"testPolygonShape");function no(n,e){return e instanceof x?qs(n,e):e instanceof Me?un(n,e):e instanceof Ie?zs(n,e):e instanceof re?Ys(n,e):e instanceof Ee?Zn(n,e):e instanceof Ye?Ji(e,n):!1}o(no,"testEllipseShape");function $s(n,e,r){let c=n,h=r.p1,m=r.p2,y=e,C=m.sub(h),O=y.cross(C);if(Math.abs(O)=1)return null;let T=v.cross(y)/O;if(T<=0||T>=1)return null;let V=C.normal().unit();return e.dot(V)>0&&(V.x*=-1,V.y*=-1),{point:c.add(y.scale(z)),normal:V,fraction:z}}o($s,"raycastLine");function so(n,e,r){let c=Number.NEGATIVE_INFINITY,h=Number.POSITIVE_INFINITY,m;if(n.x!=0){let y=(r.pos.x-n.x)/e.x,C=(r.pos.x+r.width-n.x)/e.x;m=M(-Math.sign(e.x),0),c=Math.max(c,Math.min(y,C)),h=Math.min(h,Math.max(y,C))}if(n.y!=0){let y=(r.pos.y-n.y)/e.y,C=(r.pos.y+r.height-n.y)/e.y;Math.min(y,C)>c&&(m=M(0,-Math.sign(e.y))),c=Math.max(c,Math.min(y,C)),h=Math.min(h,Math.max(y,C))}return h>=c&&c>=0&&c<=1?{point:n.add(e.scale(c)),normal:m,fraction:c}:null}o(so,"raycastRect");function Xs(n,e,r){let c=n,h=r.center,m=e,y=m.dot(m),C=c.sub(h),O=2*m.dot(C),v=C.dot(C)-r.radius*r.radius,z=O*O-4*y*v;if(y<=Number.EPSILON||z<0)return null;if(z==0){let T=-O/(2*y);if(T>=0&&T<=1){let V=c.add(m.scale(T));return{point:V,normal:V.sub(h),fraction:T}}}else{let T=(-O+Math.sqrt(z))/(2*y),V=(-O-Math.sqrt(z))/(2*y),U=null;if(T>=0&&T<=1&&(U=T),V>=0&&V<=1&&(U=Math.min(V,U??V)),U!=null){let _=c.add(m.scale(U));return{point:_,normal:_.sub(h).unit(),fraction:U}}}return null}o(Xs,"raycastCircle");function ro(n,e,r){let c=r.pts,h=null,m=c[c.length-1];for(let y=0;yO.fraction)&&(h=O),m=C}return h}o(ro,"raycastPolygon");function io(n,e,r){let c=r.toMat2(),h=c.inverse,m=h.transform(n.sub(r.center)),y=h.transform(e),C=Xs(m,y,new Me(M(),1));if(C){let O=Ct.rotation(we(-r.angle)),z=Ct.scale(r.radiusX,r.radiusY).transform(C.point),T=c.transform(C.point).add(r.center),V=T.dist(n)/e.len();return{point:T,normal:O.transform(M(r.radiusY**2*z.x,r.radiusX**2*z.y)),fraction:V}}return C}o(io,"raycastEllipse");var Ie=class n{static{o(this,"Line")}p1;p2;constructor(e,r){this.p1=e.clone(),this.p2=r.clone()}transform(e){return new n(e.multVec2(this.p1),e.multVec2(this.p2))}bbox(){return re.fromPoints(this.p1,this.p2)}area(){return this.p1.dist(this.p2)}clone(){return new n(this.p1,this.p2)}collides(e){return Qi(this,e)}contains(e){return this.collides(e)}raycast(e,r){return $s(e,r,this)}},re=class n{static{o(this,"Rect")}pos;width;height;constructor(e,r,c){this.pos=e.clone(),this.width=r,this.height=c}static fromPoints(e,r){return new n(e.clone(),r.x-e.x,r.y-e.y)}center(){return new x(this.pos.x+this.width/2,this.pos.y+this.height/2)}points(){return[this.pos,this.pos.add(this.width,0),this.pos.add(this.width,this.height),this.pos.add(0,this.height)]}transform(e){return new Ee(this.points().map(r=>e.multVec2(r)))}bbox(){return this.clone()}area(){return this.width*this.height}clone(){return new n(this.pos.clone(),this.width,this.height)}distToPoint(e){return Math.sqrt(this.sdistToPoint(e))}sdistToPoint(e){let r=this.pos,c=this.pos.add(this.width,this.height),h=Math.max(r.x-e.x,0,e.x-c.x),m=Math.max(r.y-e.y,0,e.y-c.y);return h*h+m*m}collides(e){return eo(this,e)}contains(e){return this.collides(e)}raycast(e,r){return so(e,r,this)}},Me=class n{static{o(this,"Circle")}center;radius;constructor(e,r){this.center=e.clone(),this.radius=r}transform(e){return new Ye(this.center,this.radius,this.radius).transform(e)}bbox(){return re.fromPoints(this.center.sub(M(this.radius)),this.center.add(M(this.radius)))}area(){return this.radius*this.radius*Math.PI}clone(){return new n(this.center,this.radius)}collides(e){return Zi(this,e)}contains(e){return this.collides(e)}raycast(e,r){return Xs(e,r,this)}},Ye=class n{static{o(this,"Ellipse")}center;radiusX;radiusY;angle;constructor(e,r,c,h=0){this.center=e.clone(),this.radiusX=r,this.radiusY=c,this.angle=h}static fromMat2(e){let r=e.inverse,c=r.transpose.mul(r),[h,m]=c.eigenvalues,[y,C]=c.eigenvectors(h,m),[O,v]=[1/Math.sqrt(h),1/Math.sqrt(m)];return O>v?new n(M(),O,v,lt(Math.atan2(-y[1],y[0]))):new n(M(),v,O,lt(Math.atan2(-C[1],C[0])))}toMat2(){let e=we(-this.angle),r=Math.cos(e),c=Math.sin(e);return new Ct(r*this.radiusX,c*this.radiusY,-c*this.radiusX,r*this.radiusY)}transform(e){if(this.angle==0&&e.getRotation()==0)return new n(e.multVec2(this.center),e.m[0]*this.radiusX,e.m[5]*this.radiusY);{let r=this.toMat2(),c=new ht(e.m[0],e.m[1],0,e.m[4],e.m[5],0,e.m[12],e.m[13],1);r=c.transpose.mul(ht.fromMat2(r)).mul(c).toMat2();let m=n.fromMat2(r);return m.center=e.multVec2(this.center),m}}bbox(){if(this.angle==0)return re.fromPoints(this.center.sub(M(this.radiusX,this.radiusY)),this.center.add(M(this.radiusX,this.radiusY)));{let e=we(this.angle),r=Math.cos(e),c=Math.sin(e),h=this.radiusX*r,m=this.radiusX*c,y=this.radiusY*c,C=this.radiusY*r,O=Math.sqrt(h*h+y*y),v=Math.sqrt(m*m+C*C);return re.fromPoints(this.center.sub(M(O,v)),this.center.add(M(O,v)))}}area(){return this.radiusX*this.radiusY*Math.PI}clone(){return new n(this.center,this.radiusX,this.radiusY,this.angle)}collides(e){return no(this,e)}contains(e){e=e.sub(this.center);let r=we(this.angle),c=Math.cos(r),h=Math.sin(r),m=e.x*c+e.y*h,y=-e.x*h+e.y*c;return m*m/(this.radiusX*this.radiusX)+y*y/(this.radiusY*this.radiusY)<1}raycast(e,r){return io(e,r,this)}},Ee=class n{static{o(this,"Polygon")}pts;constructor(e){if(e.length<3)throw new Error("Polygons should have at least 3 vertices");this.pts=e}transform(e){return new n(this.pts.map(r=>e.multVec2(r)))}bbox(){let e=M(Number.MAX_VALUE),r=M(-Number.MAX_VALUE);for(let c of this.pts)e.x=Math.min(e.x,c.x),r.x=Math.max(r.x,c.x),e.y=Math.min(e.y,c.y),r.y=Math.max(r.y,c.y);return re.fromPoints(e,r)}area(){let e=0,r=this.pts.length;for(let c=0;ce.clone()))}collides(e){return to(this,e)}contains(e){return this.collides(e)}raycast(e,r){return ro(e,r,this)}};function es(n,e,r,c,h){let m=h*h,y=m*h,C=1-h,O=C*C,v=O*C;return n.scale(v).add(e.scale(3*O*h)).add(r.scale(3*C*m)).add(c.scale(y))}o(es,"evaluateBezier");function Ks(n,e){let r=Number.MAX_VALUE,c=M(0);for(let h of[n,e])for(let m=0;mthis.delete(r)}},tt=class n{static{o(this,"EventController")}paused=!1;cancel;constructor(e){this.cancel=e}static join(e){let r=new n(()=>e.forEach(c=>c.cancel()));return Object.defineProperty(r,"paused",{get:()=>e[0].paused,set:c=>e.forEach(h=>h.paused=c)}),r.paused=!1,r}},Ue=class{static{o(this,"Event")}handlers=new _t;add(e){let r=this.handlers.pushd((...h)=>{c.paused||e(...h)}),c=new tt(r);return c}addOnce(e){let r=this.add((...c)=>{r.cancel(),e(...c)});return r}next(){return new Promise(e=>this.addOnce(e))}trigger(...e){this.handlers.forEach(r=>r(...e))}numListeners(){return this.handlers.size}clear(){this.handlers.clear()}},nt=class{static{o(this,"EventHandler")}handlers={};on(e,r){return this.handlers[e]||(this.handlers[e]=new Ue),this.handlers[e].add(r)}onOnce(e,r){let c=this.on(e,(...h)=>{c.cancel(),r(...h)});return c}next(e){return new Promise(r=>{this.onOnce(e,(...c)=>r(c[0]))})}trigger(e,...r){this.handlers[e]&&this.handlers[e].trigger(...r)}remove(e){delete this.handlers[e]}clear(){this.handlers={}}numListeners(e){return this.handlers[e]?.numListeners()??0}};function fn(n,e){if(n===e)return!0;let r=typeof n,c=typeof e;if(r!==c)return!1;if(r==="object"&&c==="object"&&n!==null&&e!==null){if(Array.isArray(n)!==Array.isArray(e))return!1;let h=Object.keys(n),m=Object.keys(e);if(h.length!==m.length)return!1;for(let y of h){let C=n[y],O=e[y];if(!fn(C,O))return!1}return!0}return!1}o(fn,"deepEq");function oo(n){let e=window.atob(n),r=e.length,c=new Uint8Array(r);for(let h=0;hn.match(/^data:\w+\/\w+;base64,.+/),"isDataURL");var Zs=o(n=>n.split(".").slice(0,-1).join("."),"getFileName");function Be(n,e){return(...r)=>{let c=r.length;if(c===n.length)return n(...r);if(c===e.length)return e(...r)}}o(Be,"overload2");var er=(()=>{let n=0;return()=>n++})(),tr=o(n=>n instanceof Error?n.message:String(n),"getErrorMessage");var dn=class{static{o(this,"BinaryHeap")}_items;_compareFn;constructor(e=(r,c)=>r0;){let r=Math.floor((e-1)/2);if(!this._compareFn(this._items[e],this._items[r])&&this._items[e]>=this._items[r])break;this.swap(e,r),e=r}}moveDown(e){for(;e=e&&n<=r}o(vt,"betweenInclusive");var is={"Joy-Con L+R (STANDARD GAMEPAD Vendor: 057e Product: 200e)":{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","6":"ltrigger","7":"rtrigger","8":"select","9":"start","10":"lstick","11":"rstick","12":"dpad-up","13":"dpad-down","14":"dpad-left","15":"dpad-right","16":"home","17":"capture"},sticks:{left:{x:0,y:1},right:{x:2,y:3}}},"Joy-Con (L) (STANDARD GAMEPAD Vendor: 057e Product: 2006)":{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","9":"select","10":"lstick","16":"start"},sticks:{left:{x:0,y:1}}},"Joy-Con (R) (STANDARD GAMEPAD Vendor: 057e Product: 2007)":{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","9":"start","10":"lstick","16":"select"},sticks:{left:{x:0,y:1}}},"Pro Controller (STANDARD GAMEPAD Vendor: 057e Product: 2009)":{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","6":"ltrigger","7":"rtrigger","8":"select","9":"start","10":"lstick","11":"rstick","12":"dpad-up","13":"dpad-down","14":"dpad-left","15":"dpad-right","16":"home","17":"capture"},sticks:{left:{x:0,y:1},right:{x:2,y:3}}},default:{buttons:{"0":"south","1":"east","2":"west","3":"north","4":"lshoulder","5":"rshoulder","6":"ltrigger","7":"rtrigger","8":"select","9":"start","10":"lstick","11":"rstick","12":"dpad-up","13":"dpad-down","14":"dpad-left","15":"dpad-right","16":"home"},sticks:{left:{x:0,y:1},right:{x:2,y:3}}}};var Mt=class{static{o(this,"ButtonState")}pressed=new Set([]);pressedRepeat=new Set([]);released=new Set([]);down=new Set([]);update(){this.pressed.clear(),this.released.clear(),this.pressedRepeat.clear()}press(e){this.pressed.add(e),this.pressedRepeat.add(e),this.down.add(e)}pressRepeat(e){this.pressedRepeat.add(e)}release(e){this.down.delete(e),this.pressed.delete(e),this.released.add(e)}},os=class{static{o(this,"GamepadState")}buttonState=new Mt;stickState=new Map},as=class{static{o(this,"FPSCounter")}dts=[];timer=0;fps=0;tick(e){this.dts.push(e),this.timer+=e,this.timer>=1&&(this.timer=0,this.fps=Math.round(1/(this.dts.reduce((r,c)=>r+c)/this.dts.length)),this.dts=[])}},sr=o(n=>{if(!n.canvas)throw new Error("Please provide a canvas");let e={canvas:n.canvas,loopID:null,stopped:!1,dt:0,time:0,realTime:0,fpsCounter:new as,timeScale:1,skipTime:!1,isHidden:!1,numFrames:0,mousePos:new x(0),mouseDeltaPos:new x(0),keyState:new Mt,mouseState:new Mt,mergedGamepadState:new os,gamepadStates:new Map,gamepads:[],charInputted:[],isMouseMoved:!1,lastWidth:n.canvas.offsetWidth,lastHeight:n.canvas.offsetHeight,events:new nt};function r(){return e.dt*e.timeScale}o(r,"dt");function c(){return e.isHidden}o(c,"isHidden");function h(){return e.time}o(h,"time");function m(){return e.fpsCounter.fps}o(m,"fps");function y(){return e.numFrames}o(y,"numFrames");function C(){return e.canvas.toDataURL()}o(C,"screenshot");function O(l){e.canvas.style.cursor=l}o(O,"setCursor");function v(){return e.canvas.style.cursor}o(v,"getCursor");function z(l){if(l)try{let E=e.canvas.requestPointerLock();E.catch&&E.catch(P=>console.error(P))}catch(E){console.error(E)}else document.exitPointerLock()}o(z,"setCursorLocked");function T(){return!!document.pointerLockElement}o(T,"isCursorLocked");function V(l){l.requestFullscreen?l.requestFullscreen():l.webkitRequestFullscreen&&l.webkitRequestFullscreen()}o(V,"enterFullscreen");function U(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullScreen&&document.webkitExitFullScreen()}o(U,"exitFullscreen");function _(){return document.fullscreenElement||document.webkitFullscreenElement}o(_,"getFullscreenElement");function K(l=!0){l?V(e.canvas):U()}o(K,"setFullscreen");function $(){return!!_()}o($,"isFullscreen");function L(){e.stopped=!0;for(let l in ue)e.canvas.removeEventListener(l,ue[l]);for(let l in He)document.removeEventListener(l,He[l]);for(let l in pe)window.removeEventListener(l,pe[l]);ot.disconnect()}o(L,"quit");function ne(l){e.loopID!==null&&cancelAnimationFrame(e.loopID);let E=0,P=o(H=>{if(e.stopped)return;if(document.visibilityState!=="visible"){e.loopID=requestAnimationFrame(P);return}let ge=H/1e3,ee=ge-e.realTime,Ce=n.maxFPS?1/n.maxFPS:0;e.realTime=ge,E+=ee,E>Ce&&(e.skipTime||(e.dt=E,e.time+=r(),e.fpsCounter.tick(e.dt)),E=0,e.skipTime=!1,e.numFrames++,On(),l(),Gt()),e.loopID=requestAnimationFrame(P)},"frame");P(0)}o(ne,"run");function A(){return"ontouchstart"in window||navigator.maxTouchPoints>0}o(A,"isTouchscreen");function le(){return e.mousePos.clone()}o(le,"mousePos");function j(){return e.mouseDeltaPos.clone()}o(j,"mouseDeltaPos");function de(l="left"){return e.mouseState.pressed.has(l)}o(de,"isMousePressed");function ie(l="left"){return e.mouseState.down.has(l)}o(ie,"isMouseDown");function ae(l="left"){return e.mouseState.released.has(l)}o(ae,"isMouseReleased");function Se(){return e.isMouseMoved}o(Se,"isMouseMoved");function Ne(l){return l===void 0?e.keyState.pressed.size>0:e.keyState.pressed.has(l)}o(Ne,"isKeyPressed");function Fe(l){return l===void 0?e.keyState.pressedRepeat.size>0:e.keyState.pressedRepeat.has(l)}o(Fe,"isKeyPressedRepeat");function Le(l){return l===void 0?e.keyState.down.size>0:e.keyState.down.has(l)}o(Le,"isKeyDown");function Ve(l){return l===void 0?e.keyState.released.size>0:e.keyState.released.has(l)}o(Ve,"isKeyReleased");function ye(l){return l===void 0?e.mergedGamepadState.buttonState.pressed.size>0:e.mergedGamepadState.buttonState.pressed.has(l)}o(ye,"isGamepadButtonPressed");function ke(l){return l===void 0?e.mergedGamepadState.buttonState.down.size>0:e.mergedGamepadState.buttonState.down.has(l)}o(ke,"isGamepadButtonDown");function _e(l){return l===void 0?e.mergedGamepadState.buttonState.released.size>0:e.mergedGamepadState.buttonState.released.has(l)}o(_e,"isGamepadButtonReleased");function je(l){return e.events.on("resize",l)}o(je,"onResize");let ft=Be(l=>e.events.on("keyDown",l),(l,E)=>e.events.on("keyDown",P=>P===l&&E(l))),Te=Be(l=>e.events.on("keyPress",l),(l,E)=>e.events.on("keyPress",P=>P===l&&E(l))),Oe=Be(l=>e.events.on("keyPressRepeat",l),(l,E)=>e.events.on("keyPressRepeat",P=>P===l&&E(l))),ze=Be(l=>e.events.on("keyRelease",l),(l,E)=>e.events.on("keyRelease",P=>P===l&&E(l))),rt=Be(l=>e.events.on("mouseDown",E=>l(E)),(l,E)=>e.events.on("mouseDown",P=>P===l&&E(P))),it=Be(l=>e.events.on("mousePress",E=>l(E)),(l,E)=>e.events.on("mousePress",P=>P===l&&E(P))),Et=Be(l=>e.events.on("mouseRelease",E=>l(E)),(l,E)=>e.events.on("mouseRelease",P=>P===l&&E(P)));function Yt(l){return e.events.on("mouseMove",()=>l(le(),j()))}o(Yt,"onMouseMove");function $t(l){return e.events.on("charInput",l)}o($t,"onCharInput");function Un(l){return e.events.on("touchStart",l)}o(Un,"onTouchStart");function Ot(l){return e.events.on("touchMove",l)}o(Ot,"onTouchMove");function Sn(l){return e.events.on("touchEnd",l)}o(Sn,"onTouchEnd");function Tn(l){return e.events.on("scroll",l)}o(Tn,"onScroll");function Xt(l){return e.events.on("hide",l)}o(Xt,"onHide");function Cn(l){return e.events.on("show",l)}o(Cn,"onShow");function An(l,E){if(typeof l=="function")return e.events.on("gamepadButtonDown",l);if(typeof l=="string"&&typeof E=="function")return e.events.on("gamepadButtonDown",P=>P===l&&E(l))}o(An,"onGamepadButtonDown");function Kt(l,E){if(typeof l=="function")return e.events.on("gamepadButtonPress",l);if(typeof l=="string"&&typeof E=="function")return e.events.on("gamepadButtonPress",P=>P===l&&E(l))}o(Kt,"onGamepadButtonPress");function Wt(l,E){if(typeof l=="function")return e.events.on("gamepadButtonRelease",l);if(typeof l=="string"&&typeof E=="function")return e.events.on("gamepadButtonRelease",P=>P===l&&E(l))}o(Wt,"onGamepadButtonRelease");function Mn(l,E){return e.events.on("gamepadStick",(P,H)=>P===l&&E(H))}o(Mn,"onGamepadStick");function Pt(l){e.events.on("gamepadConnect",l)}o(Pt,"onGamepadConnect");function Rn(l){e.events.on("gamepadDisconnect",l)}o(Rn,"onGamepadDisconnect");function Dt(l){return e.mergedGamepadState.stickState.get(l)||new x(0)}o(Dt,"getGamepadStick");function Pe(){return[...e.charInputted]}o(Pe,"charInputted");function Ut(){return[...e.gamepads]}o(Ut,"getGamepads");function On(){e.events.trigger("input"),e.keyState.down.forEach(l=>e.events.trigger("keyDown",l)),e.mouseState.down.forEach(l=>e.events.trigger("mouseDown",l)),oe()}o(On,"processInput");function Gt(){e.keyState.update(),e.mouseState.update(),e.mergedGamepadState.buttonState.update(),e.mergedGamepadState.stickState.forEach((l,E)=>{e.mergedGamepadState.stickState.set(E,new x(0))}),e.charInputted=[],e.isMouseMoved=!1,e.gamepadStates.forEach(l=>{l.buttonState.update(),l.stickState.forEach((E,P)=>{l.stickState.set(P,new x(0))})})}o(Gt,"resetInput");function Jt(l){let E={index:l.index,isPressed:P=>e.gamepadStates.get(l.index).buttonState.pressed.has(P),isDown:P=>e.gamepadStates.get(l.index).buttonState.down.has(P),isReleased:P=>e.gamepadStates.get(l.index).buttonState.released.has(P),getStick:P=>e.gamepadStates.get(l.index).stickState.get(P)};return e.gamepads.push(E),e.gamepadStates.set(l.index,{buttonState:new Mt,stickState:new Map([["left",new x(0)],["right",new x(0)]])}),E}o(Jt,"registerGamepad");function Pn(l){e.gamepads=e.gamepads.filter(E=>E.index!==l.index),e.gamepadStates.delete(l.index)}o(Pn,"removeGamepad");function oe(){for(let l of navigator.getGamepads())l&&!e.gamepadStates.has(l.index)&&Jt(l);for(let l of e.gamepads){let E=navigator.getGamepads()[l.index],H=(n.gamepads??{})[E.id]??is[E.id]??is.default,ge=e.gamepadStates.get(l.index);for(let ee=0;ee{let E=new x(l.offsetX,l.offsetY),P=new x(l.movementX,l.movementY);if($()){let H=e.canvas.width/xe,ge=e.canvas.height/xe,ee=window.innerWidth,Ce=window.innerHeight,at=ee/Ce,$e=H/ge;if(at>$e){let Xe=Ce/ge,Tt=(ee-H*Xe)/2;E.x=et(l.offsetX-Tt,0,H*Xe,0,H),E.y=et(l.offsetY,0,ge*Xe,0,ge)}else{let Xe=ee/H,Tt=(Ce-ge*Xe)/2;E.x=et(l.offsetX,0,H*Xe,0,H),E.y=et(l.offsetY-Tt,0,ge*Xe,0,ge)}}e.events.onOnce("input",()=>{e.isMouseMoved=!0,e.mousePos=E,e.mouseDeltaPos=P,e.events.trigger("mouseMove")})};let Je=["left","middle","right","back","forward"];ue.mousedown=l=>{e.events.onOnce("input",()=>{let E=Je[l.button];E&&(e.mouseState.press(E),e.events.trigger("mousePress",E))})},ue.mouseup=l=>{e.events.onOnce("input",()=>{let E=Je[l.button];E&&(e.mouseState.release(E),e.events.trigger("mouseRelease",E))})};let St=new Set([" ","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab"]),Qt={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down"," ":"space"};ue.keydown=l=>{St.has(l.key)&&l.preventDefault(),e.events.onOnce("input",()=>{let E=Qt[l.key]||l.key.toLowerCase();E.length===1?(e.events.trigger("charInput",E),e.charInputted.push(E)):E==="space"&&(e.events.trigger("charInput"," "),e.charInputted.push(" ")),l.repeat?(e.keyState.pressRepeat(E),e.events.trigger("keyPressRepeat",E)):(e.keyState.press(E),e.events.trigger("keyPressRepeat",E),e.events.trigger("keyPress",E))})},ue.keyup=l=>{e.events.onOnce("input",()=>{let E=Qt[l.key]||l.key.toLowerCase();e.keyState.release(E),e.events.trigger("keyRelease",E)})},ue.touchstart=l=>{l.preventDefault(),e.events.onOnce("input",()=>{let E=[...l.changedTouches],P=e.canvas.getBoundingClientRect();n.touchToMouse!==!1&&(e.mousePos=new x(E[0].clientX-P.x,E[0].clientY-P.y),e.mouseState.press("left"),e.events.trigger("mousePress","left")),E.forEach(H=>{e.events.trigger("touchStart",new x(H.clientX-P.x,H.clientY-P.y),H)})})},ue.touchmove=l=>{l.preventDefault(),e.events.onOnce("input",()=>{let E=[...l.changedTouches],P=e.canvas.getBoundingClientRect();if(n.touchToMouse!==!1){let H=e.mousePos;e.mousePos=new x(E[0].clientX-P.x,E[0].clientY-P.y),e.mouseDeltaPos=e.mousePos.sub(H),e.events.trigger("mouseMove")}E.forEach(H=>{e.events.trigger("touchMove",new x(H.clientX-P.x,H.clientY-P.y),H)})})},ue.touchend=l=>{e.events.onOnce("input",()=>{let E=[...l.changedTouches],P=e.canvas.getBoundingClientRect();n.touchToMouse!==!1&&(e.mousePos=new x(E[0].clientX-P.x,E[0].clientY-P.y),e.mouseDeltaPos=new x(0,0),e.mouseState.release("left"),e.events.trigger("mouseRelease","left")),E.forEach(H=>{e.events.trigger("touchEnd",new x(H.clientX-P.x,H.clientY-P.y),H)})})},ue.touchcancel=l=>{e.events.onOnce("input",()=>{let E=[...l.changedTouches],P=e.canvas.getBoundingClientRect();n.touchToMouse!==!1&&(e.mousePos=new x(E[0].clientX-P.x,E[0].clientY-P.y),e.mouseState.release("left"),e.events.trigger("mouseRelease","left")),E.forEach(H=>{e.events.trigger("touchEnd",new x(H.clientX-P.x,H.clientY-P.y),H)})})},ue.wheel=l=>{l.preventDefault(),e.events.onOnce("input",()=>{e.events.trigger("scroll",new x(l.deltaX,l.deltaY))})},ue.contextmenu=l=>l.preventDefault(),He.visibilitychange=()=>{document.visibilityState==="visible"?(e.skipTime=!0,e.isHidden=!1,e.events.trigger("show")):(e.isHidden=!0,e.events.trigger("hide"))},pe.gamepadconnected=l=>{let E=Jt(l.gamepad);e.events.onOnce("input",()=>{e.events.trigger("gamepadConnect",E)})},pe.gamepaddisconnected=l=>{let E=Ut().filter(P=>P.index===l.gamepad.index)[0];Pn(l.gamepad),e.events.onOnce("input",()=>{e.events.trigger("gamepadDisconnect",E)})};for(let l in ue)e.canvas.addEventListener(l,ue[l]);for(let l in He)document.addEventListener(l,He[l]);for(let l in pe)window.addEventListener(l,pe[l]);let ot=new ResizeObserver(l=>{for(let E of l)if(E.target===e.canvas){if(e.lastWidth===e.canvas.offsetWidth&&e.lastHeight===e.canvas.offsetHeight)return;e.lastWidth=e.canvas.offsetWidth,e.lastHeight=e.canvas.offsetHeight,e.events.onOnce("input",()=>{e.events.trigger("resize")})}});return ot.observe(e.canvas),{dt:r,time:h,run:ne,canvas:e.canvas,fps:m,numFrames:y,quit:L,isHidden:c,setFullscreen:K,isFullscreen:$,setCursor:O,screenshot:C,getGamepads:Ut,getCursor:v,setCursorLocked:z,isCursorLocked:T,isTouchscreen:A,mousePos:le,mouseDeltaPos:j,isKeyDown:Le,isKeyPressed:Ne,isKeyPressedRepeat:Fe,isKeyReleased:Ve,isMouseDown:ie,isMousePressed:de,isMouseReleased:ae,isMouseMoved:Se,isGamepadButtonPressed:ye,isGamepadButtonDown:ke,isGamepadButtonReleased:_e,getGamepadStick:Dt,charInputted:Pe,onResize:je,onKeyDown:ft,onKeyPress:Te,onKeyPressRepeat:Oe,onKeyRelease:ze,onMouseDown:rt,onMousePress:it,onMouseRelease:Et,onMouseMove:Yt,onCharInput:$t,onTouchStart:Un,onTouchMove:Ot,onTouchEnd:Sn,onScroll:Tn,onHide:Xt,onShow:Cn,onGamepadButtonDown:An,onGamepadButtonPress:Kt,onGamepadButtonRelease:Wt,onGamepadStick:Mn,onGamepadConnect:Pt,onGamepadDisconnect:Rn,events:e.events}},"default");var qe=class n{static{o(this,"Texture")}ctx;src=null;glTex;width;height;constructor(e,r,c,h={}){this.ctx=e;let m=e.gl;this.glTex=e.gl.createTexture(),e.onDestroy(()=>this.free()),this.width=r,this.height=c;let y={linear:m.LINEAR,nearest:m.NEAREST}[h.filter??e.opts.texFilter]??m.NEAREST,C={repeat:m.REPEAT,clampToEadge:m.CLAMP_TO_EDGE}[h.wrap]??m.CLAMP_TO_EDGE;this.bind(),r&&c&&m.texImage2D(m.TEXTURE_2D,0,m.RGBA,r,c,0,m.RGBA,m.UNSIGNED_BYTE,null),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,y),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,y),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,C),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,C),this.unbind()}static fromImage(e,r,c={}){let h=new n(e,r.width,r.height,c);return h.update(r),h.src=r,h}update(e,r=0,c=0){let h=this.ctx.gl;this.bind(),h.texSubImage2D(h.TEXTURE_2D,0,r,c,h.RGBA,h.UNSIGNED_BYTE,e),this.unbind()}bind(){this.ctx.pushTexture2D(this.glTex)}unbind(){this.ctx.popTexture2D()}free(){this.ctx.gl.deleteTexture(this.glTex)}},xt=class{static{o(this,"FrameBuffer")}ctx;tex;glFramebuffer;glRenderbuffer;constructor(e,r,c,h={}){this.ctx=e;let m=e.gl;e.onDestroy(()=>this.free()),this.tex=new qe(e,r,c,h),this.glFramebuffer=m.createFramebuffer(),this.glRenderbuffer=m.createRenderbuffer(),this.bind(),m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,r,c),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,this.tex.glTex,0),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,this.glRenderbuffer),this.unbind()}get width(){return this.tex.width}get height(){return this.tex.height}toImageData(){let e=this.ctx.gl,r=new Uint8ClampedArray(this.width*this.height*4);this.bind(),e.readPixels(0,0,this.width,this.height,e.RGBA,e.UNSIGNED_BYTE,r),this.unbind();let c=this.width*4,h=new Uint8Array(c);for(let m=0;m<(this.height/2|0);m++){let y=m*c,C=(this.height-m-1)*c;h.set(r.subarray(y,y+c)),r.copyWithin(y,C,C+c),r.set(h,C)}return new ImageData(r,this.width,this.height)}toDataURL(){let e=document.createElement("canvas"),r=e.getContext("2d");return e.width=this.width,e.height=this.height,r.putImageData(this.toImageData(),0,0),e.toDataURL()}clear(){let e=this.ctx.gl;e.clear(e.COLOR_BUFFER_BIT)}draw(e){this.bind(),e(),this.unbind()}bind(){this.ctx.pushFramebuffer(this.glFramebuffer),this.ctx.pushRenderbuffer(this.glRenderbuffer),this.ctx.pushViewport({x:0,y:0,w:this.width,h:this.height})}unbind(){this.ctx.popFramebuffer(),this.ctx.popRenderbuffer(),this.ctx.popViewport()}free(){let e=this.ctx.gl;e.deleteFramebuffer(this.glFramebuffer),e.deleteRenderbuffer(this.glRenderbuffer),this.tex.free()}},pn=class{static{o(this,"Shader")}ctx;glProgram;constructor(e,r,c,h){this.ctx=e,e.onDestroy(()=>this.free());let m=e.gl,y=m.createShader(m.VERTEX_SHADER),C=m.createShader(m.FRAGMENT_SHADER);m.shaderSource(y,r),m.shaderSource(C,c),m.compileShader(y),m.compileShader(C);let O=m.createProgram();if(this.glProgram=O,m.attachShader(O,y),m.attachShader(O,C),h.forEach((v,z)=>m.bindAttribLocation(O,z,v)),m.linkProgram(O),!m.getProgramParameter(O,m.LINK_STATUS)){let v=m.getShaderInfoLog(y);if(v)throw new Error("VERTEX SHADER "+v);let z=m.getShaderInfoLog(C);if(z)throw new Error("FRAGMENT SHADER "+z)}m.deleteShader(y),m.deleteShader(C)}bind(){this.ctx.pushProgram(this.glProgram)}unbind(){this.ctx.popProgram()}send(e){let r=this.ctx.gl;for(let c in e){let h=e[c],m=r.getUniformLocation(this.glProgram,c);if(typeof h=="number")r.uniform1f(m,h);else if(h instanceof Ge)r.uniformMatrix4fv(m,!1,new Float32Array(h.m));else if(h instanceof J)r.uniform3f(m,h.r,h.g,h.b);else if(h instanceof x)r.uniform2f(m,h.x,h.y);else if(Array.isArray(h)){let y=h[0];typeof y=="number"?r.uniform1fv(m,h):y instanceof x?r.uniform2fv(m,h.map(C=>[C.x,C.y]).flat()):y instanceof J&&r.uniform3fv(m,h.map(C=>[C.r,C.g,C.b]).flat())}else throw new Error("Unsupported uniform data type")}}free(){this.ctx.gl.deleteProgram(this.glProgram)}},gn=class{static{o(this,"BatchRenderer")}ctx;glVBuf;glIBuf;vqueue=[];iqueue=[];stride;maxVertices;maxIndices;vertexFormat;numDraws=0;curPrimitive=null;curTex=null;curShader=null;curUniform={};constructor(e,r,c,h){let m=e.gl;this.vertexFormat=r,this.ctx=e,this.stride=r.reduce((y,C)=>y+C.size,0),this.maxVertices=c,this.maxIndices=h,this.glVBuf=m.createBuffer(),e.pushArrayBuffer(this.glVBuf),m.bufferData(m.ARRAY_BUFFER,c*4,m.DYNAMIC_DRAW),e.popArrayBuffer(),this.glIBuf=m.createBuffer(),e.pushElementArrayBuffer(this.glIBuf),m.bufferData(m.ELEMENT_ARRAY_BUFFER,h*4,m.DYNAMIC_DRAW),e.popElementArrayBuffer()}push(e,r,c,h,m=null,y={}){(e!==this.curPrimitive||m!==this.curTex||h!==this.curShader||!fn(this.curUniform,y)||this.vqueue.length+r.length*this.stride>this.maxVertices||this.iqueue.length+c.length>this.maxIndices)&&this.flush();let C=this.vqueue.length/this.stride;for(let O of r)this.vqueue.push(O);for(let O of c)this.iqueue.push(O+C);this.curPrimitive=e,this.curShader=h,this.curTex=m,this.curUniform=y}flush(){if(!this.curPrimitive||!this.curShader||this.vqueue.length===0||this.iqueue.length===0)return;let e=this.ctx.gl;this.ctx.pushArrayBuffer(this.glVBuf),e.bufferSubData(e.ARRAY_BUFFER,0,new Float32Array(this.vqueue)),this.ctx.pushElementArrayBuffer(this.glIBuf),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,new Uint16Array(this.iqueue)),this.ctx.setVertexFormat(this.vertexFormat),this.curShader.bind(),this.curShader.send(this.curUniform),this.curTex?.bind(),e.drawElements(this.curPrimitive,this.iqueue.length,e.UNSIGNED_SHORT,0),this.curTex?.unbind(),this.curShader.unbind(),this.ctx.popArrayBuffer(),this.ctx.popElementArrayBuffer(),this.vqueue=[],this.iqueue=[],this.numDraws++}free(){let e=this.ctx.gl;e.deleteBuffer(this.glVBuf),e.deleteBuffer(this.glIBuf)}};function yt(n){let e=[],r=o(m=>{e.push(m),n(m)},"push"),c=o(()=>{e.pop(),n(h()??null)},"pop"),h=o(()=>e[e.length-1],"cur");return[r,c,h]}o(yt,"genStack");function us(n,e={}){let r=[];function c(j){r.push(j)}o(c,"onDestroy");function h(){r.forEach(j=>j()),n.getExtension("WEBGL_lose_context").loseContext()}o(h,"destroy");let m=null;function y(j){if(fn(j,m))return;m=j;let de=j.reduce((ie,ae)=>ie+ae.size,0);j.reduce((ie,ae,Se)=>(n.vertexAttribPointer(Se,ae.size,n.FLOAT,!1,de*4,ie),n.enableVertexAttribArray(Se),ie+ae.size*4),0)}o(y,"setVertexFormat");let[C,O]=yt(j=>n.bindTexture(n.TEXTURE_2D,j)),[v,z]=yt(j=>n.bindBuffer(n.ARRAY_BUFFER,j)),[T,V]=yt(j=>n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,j)),[U,_]=yt(j=>n.bindFramebuffer(n.FRAMEBUFFER,j)),[K,$]=yt(j=>n.bindRenderbuffer(n.RENDERBUFFER,j)),[L,ne]=yt(({x:j,y:de,w:ie,h:ae})=>{n.viewport(j,de,ie,ae)}),[A,le]=yt(j=>n.useProgram(j));return L({x:0,y:0,w:n.drawingBufferWidth,h:n.drawingBufferHeight}),{gl:n,opts:e,onDestroy:c,destroy:h,pushTexture2D:C,popTexture2D:O,pushArrayBuffer:v,popArrayBuffer:z,pushElementArrayBuffer:T,popElementArrayBuffer:V,pushFramebuffer:U,popFramebuffer:_,pushRenderbuffer:K,popRenderbuffer:$,pushViewport:L,popViewport:ne,pushProgram:A,popProgram:le,setVertexFormat:y}}o(us,"initGfx");var Re=class n{static{o(this,"Asset")}loaded=!1;data=null;error=null;onLoadEvents=new Ue;onErrorEvents=new Ue;onFinishEvents=new Ue;constructor(e){e.then(r=>{this.loaded=!0,this.data=r,this.onLoadEvents.trigger(r)}).catch(r=>{if(this.error=r,this.onErrorEvents.numListeners()>0)this.onErrorEvents.trigger(r);else throw r}).finally(()=>{this.onFinishEvents.trigger(),this.loaded=!0})}static loaded(e){let r=new n(Promise.resolve(e));return r.data=e,r.loaded=!0,r}onLoad(e){return this.loaded&&this.data?e(this.data):this.onLoadEvents.add(e),this}onError(e){return this.loaded&&this.error?e(this.error):this.onErrorEvents.add(e),this}onFinish(e){return this.loaded?e():this.onFinishEvents.add(e),this}then(e){return this.onLoad(e)}catch(e){return this.onError(e)}finally(e){return this.onFinish(e)}},st=class{static{o(this,"AssetBucket")}assets=new Map;lastUID=0;add(e,r){let c=e??this.lastUID+++"",h=new Re(r);return this.assets.set(c,h),h}addLoaded(e,r){let c=e??this.lastUID+++"",h=Re.loaded(r);return this.assets.set(c,h),h}get(e){return this.assets.get(e)}progress(){if(this.assets.size===0)return 1;let e=0;return this.assets.forEach(r=>{r.loaded&&e++}),e/this.assets.size}};function cs(n){return fetch(n).then(e=>{if(!e.ok)throw new Error(`Failed to fetch "${n}"`);return e})}o(cs,"fetchURL");function jt(n){return cs(n).then(e=>e.json())}o(jt,"fetchJSON");function rr(n){return cs(n).then(e=>e.text())}o(rr,"fetchText");function ir(n){return cs(n).then(e=>e.arrayBuffer())}o(ir,"fetchArrayBuffer");function Ht(n){let e=new Image;return e.crossOrigin="anonymous",e.src=n,new Promise((r,c)=>{e.onload=()=>r(e),e.onerror=()=>c(new Error(`Failed to load image from "${n}"`))})}o(Ht,"loadImg");var wn=2.5949095,or=1.70158+1,ar=2*Math.PI/3,ur=2*Math.PI/4.5,bn={linear:n=>n,easeInSine:n=>1-Math.cos(n*Math.PI/2),easeOutSine:n=>Math.sin(n*Math.PI/2),easeInOutSine:n=>-(Math.cos(Math.PI*n)-1)/2,easeInQuad:n=>n*n,easeOutQuad:n=>1-(1-n)*(1-n),easeInOutQuad:n=>n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2,easeInCubic:n=>n*n*n,easeOutCubic:n=>1-Math.pow(1-n,3),easeInOutCubic:n=>n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2,easeInQuart:n=>n*n*n*n,easeOutQuart:n=>1-Math.pow(1-n,4),easeInOutQuart:n=>n<.5?8*n*n*n*n:1-Math.pow(-2*n+2,4)/2,easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>1-Math.pow(1-n,5),easeInOutQuint:n=>n<.5?16*n*n*n*n*n:1-Math.pow(-2*n+2,5)/2,easeInExpo:n=>n===0?0:Math.pow(2,10*n-10),easeOutExpo:n=>n===1?1:1-Math.pow(2,-10*n),easeInOutExpo:n=>n===0?0:n===1?1:n<.5?Math.pow(2,20*n-10)/2:(2-Math.pow(2,-20*n+10))/2,easeInCirc:n=>1-Math.sqrt(1-Math.pow(n,2)),easeOutCirc:n=>Math.sqrt(1-Math.pow(n-1,2)),easeInOutCirc:n=>n<.5?(1-Math.sqrt(1-Math.pow(2*n,2)))/2:(Math.sqrt(1-Math.pow(-2*n+2,2))+1)/2,easeInBack:n=>or*n*n*n-1.70158*n*n,easeOutBack:n=>1+or*Math.pow(n-1,3)+1.70158*Math.pow(n-1,2),easeInOutBack:n=>n<.5?Math.pow(2*n,2)*((wn+1)*2*n-wn)/2:(Math.pow(2*n-2,2)*((wn+1)*(n*2-2)+wn)+2)/2,easeInElastic:n=>n===0?0:n===1?1:-Math.pow(2,10*n-10)*Math.sin((n*10-10.75)*ar),easeOutElastic:n=>n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n*10-.75)*ar)+1,easeInOutElastic:n=>n===0?0:n===1?1:n<.5?-(Math.pow(2,20*n-10)*Math.sin((20*n-11.125)*ur))/2:Math.pow(2,-20*n+10)*Math.sin((20*n-11.125)*ur)/2+1,easeInBounce:n=>1-bn.easeOutBounce(1-n),easeOutBounce:n=>n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375,easeInOutBounce:n=>n<.5?(1-bn.easeOutBounce(1-2*n))/2:(1+bn.easeOutBounce(2*n-1))/2},qt=bn;var zt=class{static{o(this,"TexPacker")}textures=[];bigTextures=[];canvas;c2d;x=0;y=0;curHeight=0;gfx;constructor(e,r,c){this.gfx=e,this.canvas=document.createElement("canvas"),this.canvas.width=r,this.canvas.height=c,this.textures=[qe.fromImage(e,this.canvas)],this.bigTextures=[],this.c2d=this.canvas.getContext("2d")}add(e){if(e.width>this.canvas.width||e.height>this.canvas.height){let h=qe.fromImage(this.gfx,e);return this.bigTextures.push(h),[h,new ce(0,0,1,1)]}this.x+e.width>this.canvas.width&&(this.x=0,this.y+=this.curHeight,this.curHeight=0),this.y+e.height>this.canvas.height&&(this.c2d.clearRect(0,0,this.canvas.width,this.canvas.height),this.textures.push(qe.fromImage(this.gfx,this.canvas)),this.x=0,this.y=0,this.curHeight=0);let r=this.textures[this.textures.length-1],c=new x(this.x,this.y);return this.x+=e.width,e.height>this.curHeight&&(this.curHeight=e.height),e instanceof ImageData?this.c2d.putImageData(e,c.x,c.y):this.c2d.drawImage(e,c.x,c.y),r.update(this.canvas),[r,new ce(c.x/this.canvas.width,c.y/this.canvas.height,e.width/this.canvas.width,e.height/this.canvas.height)]}free(){for(let e of this.textures)e.free();for(let e of this.bigTextures)e.free()}};var cr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD0AAAA1CAYAAADyMeOEAAAAAXNSR0IArs4c6QA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x7lXh9ds8oyviFyRqmcXrxf2FUtF89ymFkG6nI2p7WZB4FGvUWfLcVt4ahsdy+TR7ifz6lc0F5v0GfalmXldpE3esrr6PrTR84sjNjS4kpQhQhaUi4lD6KR1xK9DHupfoKoR02vSFDy9FWNoKVivv1/lG7OfZkqR043OZUbWgmtFaomaGl51ZTHCnFv5bqNnFGjZvRtEFUEHSHmI1ZHWgVBXZ5+sxvX7ANlPChpjKsknSllKaPlRU4nZo0Yjq6wiIJGFPMML2mj3M8ZRRe4QkzF6FhCJEFbBn4i0iKswn11yenZiLLKeMRqQdWiZSmlkqrcV9d0gPfksAcqBW+2ZqAoq5gZGSrnTtGwlVmCIqUepxWxerj7iIyNZ7SgiKmJhJw7NJpRgiKmLuHl3KnReA4UIaU+y+WkcbzHQ1DEzMGQ9aJH0BDK6RE0y9wlTDp2HuppERQxc0FFBaZGUMTMB5UlQG/fHyk1odJEaBUUMXWh4oSoFRQxtaHyxMi2uBseQwUKciUoYuaAShTlkaCImQcqUph7QREzF/8DSS/2GZ2/N/sAAAAASUVORK5CYII=";var Uo="3000.1.17",fr=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",vn="topleft",mr=64,So="monospace",yn="monospace",To=36,xn=64,En=256,pr=2048,gr=2048,wr=2048,br=2048,vr=.1,Co=64,hs="linear",Ao=8,Mo=4,fs=[{name:"a_pos",size:2},{name:"a_uv",size:2},{name:"a_color",size:4}],Ro=fs.reduce((n,e)=>n+e.size,0),yr=2048,Oo=yr*4*Ro,Po=yr*6,Do=` attribute vec2 a_pos; attribute vec2 a_uv; attribute vec4 a_color; varying vec2 v_pos; varying vec2 v_uv; varying vec4 v_color; vec4 def_vert() { return vec4(a_pos, 0.0, 1.0); } {{user}} void main() { vec4 pos = vert(a_pos, a_uv, a_color); v_pos = a_pos; v_uv = a_uv; v_color = a_color; gl_Position = pos; } `,Go=` precision mediump float; varying vec2 v_pos; varying vec2 v_uv; varying vec4 v_color; uniform sampler2D u_tex; vec4 def_frag() { return v_color * texture2D(u_tex, v_uv); } {{user}} void main() { gl_FragColor = frag(v_pos, v_uv, v_color, u_tex); if (gl_FragColor.a == 0.0) { discard; } } `,ls=` vec4 vert(vec2 pos, vec2 uv, vec4 color) { return def_vert(); } `,ds=` vec4 frag(vec2 pos, vec2 uv, vec4 color, sampler2D tex) { return def_frag(); } `,Io=new Set(["id","require"]),Bo=new Set(["add","update","draw","destroy","inspect","drawInspect"]);function Rt(n){switch(n){case"topleft":return new x(-1,-1);case"top":return new x(0,-1);case"topright":return new x(1,-1);case"left":return new x(-1,0);case"center":return new x(0,0);case"right":return new x(1,0);case"botleft":return new x(-1,1);case"bot":return new x(0,1);case"botright":return new x(1,1);default:return n}}o(Rt,"anchorPt");function Fo(n){switch(n){case"left":return 0;case"center":return .5;case"right":return 1;default:return 0}}o(Fo,"alignPt");function Lo(n){return n.createBuffer(1,1,44100)}o(Lo,"createEmptyAudioBuffer");var Vo=o((n={})=>{let e=n.root??document.body;e===document.body&&(document.body.style.width="100%",document.body.style.height="100%",document.body.style.margin="0px",document.documentElement.style.width="100%",document.documentElement.style.height="100%");let r=n.canvas??(()=>{let t=document.createElement("canvas");return e.appendChild(t),t})(),c=n.scale??1,h=n.width&&n.height&&!n.stretch&&!n.letterbox;h?(r.width=n.width*c,r.height=n.height*c):(r.width=r.parentElement.offsetWidth,r.height=r.parentElement.offsetHeight);let m=["outline: none","cursor: default"];if(h){let t=r.width,s=r.height;m.push(`width: ${t}px`),m.push(`height: ${s}px`)}else m.push("width: 100%"),m.push("height: 100%");n.crisp&&(m.push("image-rendering: pixelated"),m.push("image-rendering: crisp-edges")),r.style.cssText=m.join(";");let y=n.pixelDensity||window.devicePixelRatio;r.width*=y,r.height*=y,r.tabIndex=0;let C=document.createElement("canvas");C.width=En,C.height=En;let O=C.getContext("2d",{willReadFrequently:!0}),v=sr({canvas:r,touchToMouse:n.touchToMouse,gamepads:n.gamepads,pixelDensity:n.pixelDensity,maxFPS:n.maxFPS}),z=[],T=v.canvas.getContext("webgl",{antialias:!0,depth:!0,stencil:!0,alpha:!0,preserveDrawingBuffer:!0}),V=us(T,{texFilter:n.texFilter}),U=(()=>{let t=Pt(ls,ds),s=qe.fromImage(V,new ImageData(new Uint8ClampedArray([255,255,255,255]),1,1)),i=n.width&&n.height?new xt(V,n.width*y*c,n.height*y*c):new xt(V,T.drawingBufferWidth,T.drawingBufferHeight),a=null,u=1;n.background&&(a=Z(n.background),u=Array.isArray(n.background)?n.background[3]:1,T.clearColor(a.r/255,a.g/255,a.b/255,u??1)),T.enable(T.BLEND),T.blendFuncSeparate(T.SRC_ALPHA,T.ONE_MINUS_SRC_ALPHA,T.ONE,T.ONE_MINUS_SRC_ALPHA);let d=new gn(V,fs,Oo,Po),p=qe.fromImage(V,new ImageData(new Uint8ClampedArray([128,128,128,255,190,190,190,255,190,190,190,255,128,128,128,255]),2,2),{wrap:"repeat",filter:"nearest"});return{lastDrawCalls:0,defShader:t,defTex:s,frameBuffer:i,postShader:null,postShaderUniform:null,renderer:d,transform:new Ge,transformStack:[],bgTex:p,bgColor:a,bgAlpha:u,width:n.width??T.drawingBufferWidth/y/c,height:n.height??T.drawingBufferHeight/y/c,viewport:{x:0,y:0,width:T.drawingBufferWidth,height:T.drawingBufferHeight},fixed:!1}})();class _{static{o(this,"SpriteData")}tex;frames=[new ce(0,0,1,1)];anims={};slice9=null;constructor(s,i,a={},u=null){this.tex=s,i&&(this.frames=i),this.anims=a,this.slice9=u}get width(){return this.tex.width*this.frames[0].w}get height(){return this.tex.height*this.frames[0].h}static from(s,i={}){return typeof s=="string"?_.fromURL(s,i):Promise.resolve(_.fromImage(s,i))}static fromImage(s,i={}){let[a,u]=L.packer.add(s),d=i.frames?i.frames.map(p=>new ce(u.x+p.x*u.w,u.y+p.y*u.h,p.w*u.w,p.h*u.h)):Fe(i.sliceX||1,i.sliceY||1,u.x,u.y,u.w,u.h);return new _(a,d,i.anims,i.slice9)}static fromURL(s,i={}){return Ht(s).then(a=>_.fromImage(a,i))}}class K{static{o(this,"SoundData")}buf;constructor(s){this.buf=s}static fromArrayBuffer(s){return new Promise((i,a)=>$.ctx.decodeAudioData(s,i,a)).then(i=>new K(i))}static fromURL(s){return ss(s)?K.fromArrayBuffer(Js(s)):ir(s).then(i=>K.fromArrayBuffer(i))}}let $=(()=>{let t=new(window.AudioContext||window.webkitAudioContext),s=t.createGain();s.connect(t.destination);let i=new K(Lo(t));return t.decodeAudioData(hr.buffer.slice(0)).then(a=>{i.buf=a}).catch(a=>{console.error("Failed to load burp: ",a)}),{ctx:t,masterNode:s,burpSnd:i}})(),L={urlPrefix:"",sprites:new st,fonts:new st,bitmapFonts:new st,sounds:new st,shaders:new st,custom:new st,music:{},packer:new zt(V,wr,br),loaded:!1};function ne(t){return typeof t!="string"||ss(t)?t:L.urlPrefix+t}o(ne,"fixURL");let A={events:new nt,objEvents:new nt,root:Gn([]),gravity:0,scenes:{},logs:[],cam:{pos:null,scale:new x(1),angle:0,shake:0,transform:new Ge}};A.root.use(Ln());function le(t){return L.custom.add(null,t)}o(le,"load");function j(){let t=[L.sprites,L.sounds,L.shaders,L.fonts,L.bitmapFonts,L.custom];return t.reduce((s,i)=>s+i.progress(),0)/t.length}o(j,"loadProgress");function de(t){return t!==void 0&&(L.urlPrefix=t),L.urlPrefix}o(de,"loadRoot");function ie(t,s){return L.custom.add(t,jt(s))}o(ie,"loadJSON");class ae{static{o(this,"FontData")}fontface;filter=hs;outline=null;size=xn;constructor(s,i={}){if(this.fontface=s,this.filter=i.filter??hs,this.size=i.size??xn,this.size>En)throw new Error(`Max font size: ${En}`);i.outline&&(this.outline={width:1,color:Z(0,0,0)},typeof i.outline=="number"?this.outline.width=i.outline:typeof i.outline=="object"&&(i.outline.width&&(this.outline.width=i.outline.width),i.outline.color&&(this.outline.color=i.outline.color)))}}function Se(t,s,i={}){let a=new FontFace(t,typeof s=="string"?`url(${s})`:s);return document.fonts.add(a),L.fonts.add(t,a.load().catch(u=>{throw new Error(`Failed to load font from "${s}": ${u}`)}).then(u=>new ae(u,i)))}o(Se,"loadFont");function Ne(t,s,i,a,u={}){return L.bitmapFonts.add(t,Ht(s).then(d=>Rn(qe.fromImage(V,d,u),i,a,u.chars??fr)))}o(Ne,"loadBitmapFont");function Fe(t=1,s=1,i=0,a=0,u=1,d=1){let p=[],w=u/t,g=d/s;for(let f=0;f{jt(s).then(u=>{Le(t,u).then(i).catch(a)})}):_.from(t).then(i=>{let a={};for(let u in s){let d=s[u],p=i.frames[0],w=wr*p.w,g=br*p.h,f=d.frames?d.frames.map(R=>new ce(p.x+(d.x+R.x)/w*p.w,p.y+(d.y+R.y)/g*p.h,R.w/w*p.w,R.h/g*p.h)):Fe(d.sliceX||1,d.sliceY||1,p.x+d.x/w*p.w,p.y+d.y/g*p.h,d.width/w*p.w,d.height/g*p.h),b=new _(i.tex,f,d.anims);L.sprites.addLoaded(u,b),a[u]=b}return a}))}o(Le,"loadSpriteAtlas");function Ve(t,s={}){let i=document.createElement("canvas"),a=t[0].width,u=t[0].height;i.width=a*t.length,i.height=u;let d=i.getContext("2d");t.forEach((w,g)=>{w instanceof ImageData?d.putImageData(w,g*a,0):d.drawImage(w,g*a,0)});let p=d.getImageData(0,0,t.length*a,u);return _.fromImage(p,{...s,sliceX:t.length,sliceY:1})}o(Ve,"createSpriteSheet");function ye(t,s,i={sliceX:1,sliceY:1,anims:{}}){return s=ne(s),Array.isArray(s)?s.some(a=>typeof a=="string")?L.sprites.add(t,Promise.all(s.map(a=>typeof a=="string"?Ht(a):Promise.resolve(a))).then(a=>Ve(a,i))):L.sprites.addLoaded(t,Ve(s,i)):typeof s=="string"?L.sprites.add(t,_.from(s,i)):L.sprites.addLoaded(t,_.fromImage(s,i))}o(ye,"loadSprite");function ke(t,s){return s=ne(s),L.sprites.add(t,new Promise(async i=>{let a=typeof s=="string"?await jt(s):s,u=await Promise.all(a.frames.map(Ht)),d=document.createElement("canvas");d.width=a.width,d.height=a.height*a.frames.length;let p=d.getContext("2d");u.forEach((g,f)=>{p.drawImage(g,0,f*a.height)});let w=await ye(null,d,{sliceY:a.frames.length,anims:a.anims});i(w)}))}o(ke,"loadPedit");function _e(t,s,i){s=ne(s),i=ne(i),typeof s=="string"&&!i&&(i=Zs(s)+".json");let a=typeof i=="string"?jt(i):Promise.resolve(i);return L.sprites.add(t,a.then(u=>{let d=u.meta.size,p=u.frames.map(g=>new ce(g.frame.x/d.w,g.frame.y/d.h,g.frame.w/d.w,g.frame.h/d.h)),w={};for(let g of u.meta.frameTags)g.from===g.to?w[g.name]=g.from:w[g.name]={from:g.from,to:g.to,speed:10,loop:!0,pingpong:g.direction==="pingpong"};return _.from(s,{frames:p,anims:w})}))}o(_e,"loadAseprite");function je(t,s,i){return L.shaders.addLoaded(t,Pt(s,i))}o(je,"loadShader");function ft(t,s,i){s=ne(s),i=ne(i);let a=o(d=>d?rr(d):Promise.resolve(null),"resolveUrl"),u=Promise.all([a(s),a(i)]).then(([d,p])=>Pt(d,p));return L.shaders.add(t,u)}o(ft,"loadShaderURL");function Te(t,s){return s=ne(s),L.sounds.add(t,typeof s=="string"?K.fromURL(s):K.fromArrayBuffer(s))}o(Te,"loadSound");function Oe(t,s){let i=new Audio(s);return i.preload="auto",L.music[t]=ne(s)}o(Oe,"loadMusic");function ze(t="bean"){return ye(t,cr)}o(ze,"loadBean");function rt(t){return L.sprites.get(t)}o(rt,"getSprite");function it(t){return L.sounds.get(t)}o(it,"getSound");function Et(t){return L.fonts.get(t)}o(Et,"getFont");function Yt(t){return L.bitmapFonts.get(t)}o(Yt,"getBitmapFont");function $t(t){return L.shaders.get(t)}o($t,"getShader");function Un(t){return L.custom.get(t)}o(Un,"getAsset");function Ot(t){if(typeof t=="string"){let s=rt(t);if(s)return s;if(j()<1)return null;throw new Error(`Sprite not found: ${t}`)}else{if(t instanceof _)return Re.loaded(t);if(t instanceof Re)return t;throw new Error(`Invalid sprite: ${t}`)}}o(Ot,"resolveSprite");function Sn(t){if(typeof t=="string"){let s=it(t);if(s)return s;if(j()<1)return null;throw new Error(`Sound not found: ${t}`)}else{if(t instanceof K)return Re.loaded(t);if(t instanceof Re)return t;throw new Error(`Invalid sound: ${t}`)}}o(Sn,"resolveSound");function Tn(t){if(!t)return U.defShader;if(typeof t=="string"){let s=$t(t);if(s)return s.data??s;if(j()<1)return null;throw new Error(`Shader not found: ${t}`)}else if(t instanceof Re)return t.data?t.data:t;return t}o(Tn,"resolveShader");function Xt(t){if(!t)return Xt(n.font??So);if(typeof t=="string"){let s=Yt(t),i=Et(t);if(s)return s.data??s;if(i)return i.data??i;if(document.fonts.check(`${xn}px ${t}`))return t;if(j()<1)return null;throw new Error(`Font not found: ${t}`)}else if(t instanceof Re)return t.data?t.data:t;return t}o(Xt,"resolveFont");function Cn(t){return t!==void 0&&($.masterNode.gain.value=t),$.masterNode.gain.value}o(Cn,"volume");function An(t,s={}){let i=new Ue,a=new Audio(t);$.ctx.createMediaElementSource(a).connect($.masterNode);function d(){se.paused||v.isHidden()&&!n.backgroundAudio||$.ctx.resume()}o(d,"resumeAudioCtx");function p(){d(),a.play()}return o(p,"play"),s.paused||p(),a.onended=()=>i.trigger(),{play(){p()},seek(w){a.currentTime=w},stop(){a.pause(),this.seek(0)},set loop(w){a.loop=w},get loop(){return a.loop},set paused(w){w?a.pause():p()},get paused(){return a.paused},time(){return a.currentTime},duration(){return a.duration},set volume(w){a.volume=We(w,0,1)},get volume(){return a.volume},set speed(w){a.playbackRate=Math.max(w,0)},get speed(){return a.playbackRate},set detune(w){},get detune(){return 0},onEnd(w){return i.add(w)},then(w){return this.onEnd(w)}}}o(An,"playMusic");function Kt(t,s={}){if(typeof t=="string"&&L.music[t])return An(L.music[t],s);let i=$.ctx,a=s.paused??!1,u=i.createBufferSource(),d=new Ue,p=i.createGain(),w=s.seek??0,g=0,f=0,b=!1;u.loop=!!s.loop,u.detune.value=s.detune??0,u.playbackRate.value=s.speed??1,u.connect(p),u.onended=()=>{Y()>=(u.buffer?.duration??Number.POSITIVE_INFINITY)&&d.trigger()},p.connect($.masterNode),p.gain.value=s.volume??1;let R=o(I=>{u.buffer=I.buf,a||(g=i.currentTime,u.start(0,w),b=!0)},"start"),G=Sn(t);G instanceof Re&&G.onLoad(R);let Y=o(()=>{if(!u.buffer)return 0;let I=a?f-g:i.currentTime-g,D=u.buffer.duration;return u.loop?I%D:Math.min(I,D)},"getTime"),q=o(I=>{let D=i.createBufferSource();return D.buffer=I.buffer,D.loop=I.loop,D.playbackRate.value=I.playbackRate.value,D.detune.value=I.detune.value,D.onended=I.onended,D.connect(p),D},"cloneNode");return{stop(){this.paused=!0,this.seek(0)},set paused(I){if(a!==I)if(a=I,I)b&&(u.stop(),b=!1),f=i.currentTime;else{u=q(u);let D=f-g;u.start(0,D),b=!0,g=i.currentTime-D,f=0}},get paused(){return a},play(I=0){this.seek(I),this.paused=!1},seek(I){u.buffer?.duration&&(I>u.buffer.duration||(a?(u=q(u),g=f-I):(u.stop(),u=q(u),g=i.currentTime-I,u.start(0,I),b=!0,f=0)))},set speed(I){u.playbackRate.value=I},get speed(){return u.playbackRate.value},set detune(I){u.detune.value=I},get detune(){return u.detune.value},set volume(I){p.gain.value=Math.max(I,0)},get volume(){return p.gain.value},set loop(I){u.loop=I},get loop(){return u.loop},duration(){return u.buffer?.duration??0},time(){return Y()%this.duration()},onEnd(I){return d.add(I)},then(I){return this.onEnd(I)}}}o(Kt,"play");function Wt(t){return Kt($.burpSnd,t)}o(Wt,"burp");function Mn(t,s){let i=new xt(V,t,s);return{clear:()=>i.clear(),free:()=>i.free(),toDataURL:()=>i.toDataURL(),toImageData:()=>i.toImageData(),width:i.width,height:i.height,draw:a=>{Pe(),i.bind(),a(),Pe(),i.unbind()}}}o(Mn,"makeCanvas");function Pt(t=ls,s=ds){let i=Do.replace("{{user}}",t??ls),a=Go.replace("{{user}}",s??ds);try{return new pn(V,i,a,fs.map(u=>u.name))}catch(u){let p=/(?^\w+) SHADER ERROR: 0:(?\d+): (?.+)/,w=tr(u).match(p),g=Number(w.groups.line)-14,f=w.groups.msg.trim(),b=w.groups.type.toLowerCase();throw new Error(`${b} shader line ${g}: ${f}`)}}o(Pt,"makeShader");function Rn(t,s,i,a){let u=t.width/s,d={},p=a.split("").entries();for(let[w,g]of p)d[g]=new ce(w%u*s,Math.floor(w/u)*i,s,i);return{tex:t,map:d,size:i}}o(Rn,"makeFont");function Dt(t,s,i,a=U.defTex,u=U.defShader,d={}){let p=Tn(u);if(!p||p instanceof Re)return;let w=U.fixed||i?U.transform:A.cam.transform.mult(U.transform),g=[];for(let f of t){let b=Jt(w.multVec2(f.pos));g.push(b.x,b.y,f.uv.x,f.uv.y,f.color.r/255,f.color.g/255,f.color.b/255,f.opacity)}U.renderer.push(T.TRIANGLES,g,s,p,a,d)}o(Dt,"drawRaw");function Pe(){U.renderer.flush()}o(Pe,"flush");function Ut(){T.clear(T.COLOR_BUFFER_BIT),U.frameBuffer.bind(),T.clear(T.COLOR_BUFFER_BIT),U.bgColor||ut(()=>{Je({width:Ae(),height:De(),quad:new ce(0,0,Ae()/mr,De()/mr),tex:U.bgTex,fixed:!0})}),U.renderer.numDraws=0,U.fixed=!1,U.transformStack.length=0,U.transform=new Ge}o(Ut,"frameStart");function On(t,s){U.postShader=t,U.postShaderUniform=s??null}o(On,"usePostEffect");function Gt(){Pe(),U.lastDrawCalls=U.renderer.numDraws,U.frameBuffer.unbind(),T.viewport(0,0,T.drawingBufferWidth,T.drawingBufferHeight);let t=U.width,s=U.height;U.width=T.drawingBufferWidth/y,U.height=T.drawingBufferHeight/y,St({flipY:!0,tex:U.frameBuffer.tex,pos:new x(U.viewport.x,U.viewport.y),width:U.viewport.width,height:U.viewport.height,shader:U.postShader,uniform:typeof U.postShaderUniform=="function"?U.postShaderUniform():U.postShaderUniform,fixed:!0}),Pe(),U.width=t,U.height=s}o(Gt,"frameEnd");function Jt(t){return new x(t.x/Ae()*2-1,-t.y/De()*2+1)}o(Jt,"screen2ndc");function Pn(t){U.transform=t.clone()}o(Pn,"pushMatrix");function oe(...t){if(t[0]===void 0)return;let s=M(...t);s.x===0&&s.y===0||U.transform.translate(s)}o(oe,"pushTranslate");function ue(...t){if(t[0]===void 0)return;let s=M(...t);s.x===1&&s.y===1||U.transform.scale(s)}o(ue,"pushScale");function He(t){t&&U.transform.rotate(t)}o(He,"pushRotate");function pe(){U.transformStack.push(U.transform.clone())}o(pe,"pushTransform");function xe(){U.transformStack.length>0&&(U.transform=U.transformStack.pop())}o(xe,"popTransform");function Je(t){if(t.width===void 0||t.height===void 0)throw new Error('drawUVQuad() requires property "width" and "height".');if(t.width<=0||t.height<=0)return;let s=t.width,i=t.height,u=Rt(t.anchor||vn).scale(new x(s,i).scale(-.5)),d=t.quad||new ce(0,0,1,1),p=t.color||Z(255,255,255),w=t.opacity??1,g=t.tex?vr/t.tex.width:0,f=t.tex?vr/t.tex.height:0,b=d.x+g,R=d.y+f,G=d.w-g*2,Y=d.h-f*2;pe(),oe(t.pos),He(t.angle),ue(t.scale),oe(u),Dt([{pos:new x(-s/2,i/2),uv:new x(t.flipX?b+G:b,t.flipY?R:R+Y),color:p,opacity:w},{pos:new x(-s/2,-i/2),uv:new x(t.flipX?b+G:b,t.flipY?R+Y:R),color:p,opacity:w},{pos:new x(s/2,-i/2),uv:new x(t.flipX?b:b+G,t.flipY?R+Y:R),color:p,opacity:w},{pos:new x(s/2,i/2),uv:new x(t.flipX?b:b+G,t.flipY?R:R+Y),color:p,opacity:w}],[0,1,3,1,2,3],t.fixed,t.tex,t.shader,t.uniform),xe()}o(Je,"drawUVQuad");function St(t){if(!t.tex)throw new Error('drawTexture() requires property "tex".');let s=t.quad??new ce(0,0,1,1),i=t.tex.width*s.w,a=t.tex.height*s.h,u=new x(1);if(t.tiled){let d=Math.ceil((t.width||i)/i),p=Math.ceil((t.height||a)/a),g=Rt(t.anchor||vn).add(new x(1,1)).scale(.5).scale(d*i,p*a);for(let f=0;f({pos:new x(p.x,p.y),uv:new x(0),color:t.color??J.WHITE,opacity:t.opacity??1}));Dt(d,[0,1,3,1,2,3],t.fixed,U.defTex,t.shader,t.uniform)}o(E,"drawLine");function P(t){let s=t.pts;if(!s)throw new Error('drawLines() requires property "pts".');if(!(s.length<2))if(t.radius&&s.length>=3){let i=s[0].sdist(s[1]);for(let u=1;ues(t.pt1,t.pt2,t.pt3,t.pt4,s),t)}o(ge,"drawBezier");function ee(t){if(!t.p1||!t.p2||!t.p3)throw new Error('drawTriangle() requires properties "p1", "p2" and "p3".');return $e(Object.assign({},t,{pts:[t.p1,t.p2,t.p3]}))}o(ee,"drawTriangle");function Ce(t){if(typeof t.radius!="number")throw new Error('drawCircle() requires property "radius".');t.radius!==0&&at(Object.assign({},t,{radiusX:t.radius,radiusY:t.radius,angle:0}))}o(Ce,"drawCircle");function at(t){if(t.radiusX===void 0||t.radiusY===void 0)throw new Error('drawEllipse() requires properties "radiusX" and "radiusY".');if(t.radiusX===0||t.radiusY===0)return;let s=t.start??0,i=t.end??360,a=Rt(t.anchor??"center").scale(new x(-t.radiusX,-t.radiusY)),u=ot(a,t.radiusX,t.radiusY,s,i,t.resolution);u.unshift(a);let d=Object.assign({},t,{pts:u,radius:0,...t.gradient?{colors:[t.gradient[0],...Array(u.length-1).fill(t.gradient[1])]}:{}});if(i-s>=360&&t.outline){t.fill!==!1&&$e(Object.assign({},d,{outline:null})),$e(Object.assign({},d,{pts:u.slice(1),fill:!1}));return}$e(d)}o(at,"drawEllipse");function $e(t){if(!t.pts)throw new Error('drawPolygon() requires property "pts".');let s=t.pts.length;if(!(s<3)){if(pe(),oe(t.pos),ue(t.scale),He(t.angle),oe(t.offset),t.fill!==!1){let i=t.color??J.WHITE,a=t.pts.map((d,p)=>({pos:new x(d.x,d.y),uv:new x(0,0),color:t.colors&&t.colors[p]?t.colors[p].mult(i):i,opacity:t.opacity??1})),u=[...Array(s-2).keys()].map(d=>[0,d+1,d+2]).flat();Dt(a,t.indices??u,t.fixed,U.defTex,t.shader,t.uniform)}t.outline&&P({pts:[...t.pts,t.pts[0]],radius:t.radius,width:t.outline.width,color:t.outline.color,join:t.outline.join,uniform:t.uniform,fixed:t.fixed,opacity:t.opacity}),xe()}}o($e,"drawPolygon");function Xe(t,s,i){Pe(),T.clear(T.STENCIL_BUFFER_BIT),T.enable(T.STENCIL_TEST),T.stencilFunc(T.NEVER,1,255),T.stencilOp(T.REPLACE,T.REPLACE,T.REPLACE),s(),Pe(),T.stencilFunc(i,1,255),T.stencilOp(T.KEEP,T.KEEP,T.KEEP),t(),Pe(),T.disable(T.STENCIL_TEST)}o(Xe,"drawStenciled");function Tt(t,s){Xe(t,s,T.EQUAL)}o(Tt,"drawMasked");function ms(t,s){Xe(t,s,T.NOTEQUAL)}o(ms,"drawSubtracted");function ps(){return(U.viewport.width+U.viewport.height)/(U.width+U.height)}o(ps,"getViewportScale");function ut(t){Pe();let s=U.width,i=U.height;U.width=U.viewport.width,U.height=U.viewport.height,t(),Pe(),U.width=s,U.height=i}o(ut,"drawUnscaled");function gs(t,s){s.pos&&(t.pos=t.pos.add(s.pos)),s.scale&&(t.scale=t.scale.scale(M(s.scale))),s.angle&&(t.angle+=s.angle),s.color&&t.ch.length===1&&(t.color=t.color.mult(s.color)),s.opacity&&(t.opacity*=s.opacity)}o(gs,"applyCharTransform");let ws=/\[(?