@oidoid/void 0.1.0-7 → 0.1.0-8
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/package.json +7 -8
- package/dist/public/index.js +1 -1
- package/dist/public/index.js.map +1 -1
- package/dist/public/{void-v0.1.0-6+20251020.7cdf98d.html → void-v0.1.0-8+20251022.b364155.html} +2 -2
- package/package.json +7 -8
- package/dist/meta.json +0 -1
- package/dist/public/favicon/favicon16.png +0 -0
- package/dist/public/favicon/favicon192.png +0 -0
- package/dist/public/favicon/favicon32.png +0 -0
- package/dist/public/favicon/favicon48.png +0 -0
- package/dist/public/favicon/favicon64.png +0 -0
- package/dist/public/preload-atlas.png +0 -0
- package/dist/public/void-v0.1.0-6+20251020.e4e9eef.html +0 -111
- package/dist/public/void-v0.1.0-7+20251021.7cdf98d.html +0 -111
- package/schema/config-file.test.ts +0 -55
- package/schema/config-file.ts +0 -69
- package/schema/config-file.v0.json +0 -68
- package/tools/atlas-pack/aseprite.ts +0 -60
- package/tools/atlas-pack/atlas-json-parser.test.ts +0 -780
- package/tools/atlas-pack/atlas-json-parser.ts +0 -159
- package/tools/atlas-pack/atlas-pack.ts +0 -51
- package/tools/bundle/bundle.ts +0 -64
- package/tools/bundle/html-plugin.ts +0 -135
- package/tools/types/config.ts +0 -65
- package/tools/types/package-json.ts +0 -4
- package/tools/utils/argv.test.ts +0 -41
- package/tools/utils/argv.ts +0 -29
- package/tools/utils/exec.ts +0 -22
- package/tools/utils/file-util.ts +0 -11
- package/tools/utils/html-parser.ts +0 -9
- package/tools/void.ts +0 -55
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Stephen Niedzielski <stephen@oidoid.com> (https://oidoid.com)",
|
|
3
3
|
"bin": {
|
|
4
|
-
"void": "tools/void.
|
|
4
|
+
"void": "dist/tools/void.js"
|
|
5
5
|
},
|
|
6
6
|
"bugs": "https://github.com/oidoid/void/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -25,10 +25,9 @@
|
|
|
25
25
|
".": "./dist/src/index.js"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
|
-
"dist",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"!tools/tsconfig*",
|
|
28
|
+
"dist/",
|
|
29
|
+
"!dist/meta.json",
|
|
30
|
+
"!dist/public/**/*.png",
|
|
32
31
|
"!**/tsconfig.tsbuildinfo"
|
|
33
32
|
],
|
|
34
33
|
"homepage": "https://github.com/oidoid/void",
|
|
@@ -41,7 +40,7 @@
|
|
|
41
40
|
"publishConfig": {
|
|
42
41
|
"access": "public"
|
|
43
42
|
},
|
|
44
|
-
"published": "
|
|
43
|
+
"published": "20251022",
|
|
45
44
|
"repository": {
|
|
46
45
|
"type": "git",
|
|
47
46
|
"url": "git+https://github.com/oidoid/void.git"
|
|
@@ -59,8 +58,8 @@
|
|
|
59
58
|
"test": "npm run test:format && npm run test:unit && npm run build",
|
|
60
59
|
"test:format": "npm run formatter",
|
|
61
60
|
"test:unit": "sh -c 'node --experimental-test-coverage --test ${@:-$(find src schema tools -name \\*.test.ts -printf %p\\ )}' --",
|
|
62
|
-
"version": "npm pkg set published=$(date +%Y%m%d) && npm test"
|
|
61
|
+
"version": "npm pkg set published=$(date +%Y%m%d) && npm run clean && npm test"
|
|
63
62
|
},
|
|
64
63
|
"type": "module",
|
|
65
|
-
"version": "0.1.0-
|
|
64
|
+
"version": "0.1.0-8"
|
|
66
65
|
}
|
package/dist/public/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var o={published:"
|
|
1
|
+
var o={published:"20251022",version:"0.1.0-8"};var _=o;var Q={id:"mem-prop-5x6",name:"mem 5x6",cellWidth:5,cellHeight:6,leading:1,lineHeight:7,baseline:1,kerning:{" 0":0," 1":0," 2":0," 3":0," 4":0," 5":0," 6":0," 7":0," 8":0," 9":0,"##":-1,"#_":0,"',":0,"'.":0,"'/":0,"'J":0,"'S":0,"'_":0,"'j":0,"'s":0,"(+":0,"(-":0,"(<":0,"(f":0,"({":0,"(~":0,")_":0,"*,":0,"*.":0,"*/":0,"*S":0,"*_":0,"*j":0,"*s":0,"+)":0,"+,":0,"+.":0,"+/":0,"+>":0,"+?":0,"+I":0,"+S":0,"+T":0,"+Z":0,"+]":0,"+_":0,"+`":0,"+j":0,"+s":0,"+}":0,",'":0,",*":0,",+":0,",-":0,",<":0,",?":0,",T":0,",Y":0,",Z":0,',"':0,",\\":0,",^":0,",`":0,",f":0,",t":0,",z":0,",{":0,",~":0,"-)":0,"-,":0,"--":0,"-.":0,"-/":0,"->":0,"-?":0,"-I":0,"-S":0,"-T":0,"-Z":0,"-]":0,"-_":0,"-`":0,"-j":0,"-s":0,"-}":0,".'":0,".*":0,".+":0,".-":0,".<":0,".?":0,".T":0,".Y":0,".Z":0,'."':0,".\\":0,".^":0,".`":0,".f":0,".t":0,".z":0,".{":0,".~":0,"/,":0,"/.":0,"//":0,"/J":0,"/S":0,"/_":0,"/j":0,"/s":0,"0 ":0,"1 ":0,"1T":0,"1Y":0,"1Z":0,"1f":0,"1t":0,"1z":0,"2 ":0,"3 ":0,"4 ":0,"5 ":0,"6 ":0,"7 ":0,"8 ":0,"9 ":0,":?":0,":T":0,":Z":0,":`":0,";?":0,";T":0,";Z":0,"<+":0,"<-":0,"<<":0,"<f":0,"<{":0,"<~":0,"==":0,"=_":0,">)":0,">,":0,">.":0,">/":0,">>":0,">?":0,">I":0,">S":0,">T":0,">Z":0,">]":0,">_":0,">`":0,">j":0,">s":0,">}":0,"?,":0,"?.":0,"?/":0,"?S":0,"?_":0,"?j":0,"?s":0,"@_":0,"C+":0,"C-":0,"C<":0,Cf:0,"C{":0,"C~":0,D_:0,"E+":0,"E-":0,"E<":0,Ef:0,"E{":0,"E~":0,"F&":0,"F+":0,"F,":0,"F-":0,"F.":0,"F/":0,"F:":0,"F;":0,"F<":0,FJ:0,FS:0,F_:0,Fa:0,Fe:0,Ff:0,Fg:0,Fj:0,Fq:0,Fs:0,"F{":0,"F~":0,"I+":0,"I-":0,"I<":0,If:0,"I{":0,"I~":0,"L'":0,"L*":0,"L+":0,"L-":0,L4:0,L7:0,"L<":0,"L?":0,LT:0,LY:0,LZ:0,'L"':0,"L\\":0,"L^":0,"L`":0,Lf:0,Lt:0,Lz:0,"L{":0,"L~":0,"P,":0,"P.":0,"P/":0,PS:0,P_:0,Pj:0,Ps:0,"S&":0,"S+":0,"S,":0,"S-":0,"S.":0,"S/":0,"S:":0,"S;":0,"S<":0,SJ:0,SS:0,S_:0,Sa:0,Se:0,Sf:0,Sg:0,Sj:0,Sq:0,Ss:0,"S{":0,"S~":0,"T&":0,"T+":0,"T,":0,"T-":0,"T.":0,"T/":0,"T:":0,"T;":0,"T<":0,TJ:0,TS:0,T_:0,Ta:0,Te:0,Tf:0,Tg:0,Tj:0,Tq:0,Ts:0,"T{":0,"T~":0,V_:0,"Y,":0,"Y.":0,"Y/":0,YS:0,Y_:0,Yj:0,Ys:0,"Z'":0,"Z*":0,"Z+":0,"Z-":0,Z4:0,Z7:0,"Z<":0,"Z?":0,ZT:0,ZY:0,ZZ:0,'Z"':0,"Z\\":0,"Z^":0,"Z`":0,Zf:0,Zt:0,Zz:0,"Z{":0,"Z~":0,"[+":0,"[-":0,"[<":0,"[f":0,"[{":0,"[~":0,'",':0,'".':0,'"/':0,'"J':0,'"S':0,'"_':0,'"j':0,'"s':0,"\\'":0,"\\*":0,"\\+":0,"\\-":0,"\\<":0,"\\?":0,"\\T":0,"\\Y":0,"\\Z":0,'\\"':0,"\\\\":0,"\\^":0,"\\`":0,"\\f":0,"\\t":0,"\\z":0,"\\{":0,"\\~":0,"^,":0,"^.":0,"^/":0,"^J":0,"^S":0,"^_":0,"^j":0,"^s":0,"_#":0,"_%":0,"_'":0,"_(":0,"_*":0,"_+":0,"_-":0,"_<":0,"_=":0,"_?":0,"_@":0,_T:0,_V:0,_Y:0,_Z:0,'_"':0,"_\\":0,"_^":0,__:0,"_`":0,_a:0,_e:0,_f:0,_t:0,_v:0,_z:0,"_{":0,"_~":0,"`,":0,"`.":0,"`/":0,"`J":0,"`S":0,"`_":0,"`j":0,"`s":0,"f,":0,"f.":0,"f/":0,fS:0,f_:0,fj:0,fs:0,"q#":0,q$:0,"q%":0,"q&":0,"q'":0,"q(":0,"q*":0,"q+":0,"q-":0,q0:0,q1:0,q2:0,q3:0,q4:0,q5:0,q6:0,q7:0,q8:0,q9:0,"q<":0,"q=":0,"q?":0,"q@":0,qA:0,qB:0,qC:0,qD:0,qE:0,qF:0,qG:0,qH:0,qI:0,qJ:0,qK:0,qL:0,qM:0,qN:0,qO:0,qP:0,qQ:0,qR:0,qS:0,qT:0,qU:0,qV:0,qW:0,qX:0,qY:0,qZ:0,"q[":0,'q"':0,"q\\":0,"q]":0,"q^":0,"q`":0,qa:0,qb:0,qc:0,qd:0,qe:0,qf:0,qh:0,qk:0,qm:0,qn:0,qo:0,qq:0,qr:0,qs:0,qt:0,qu:0,qv:0,qw:0,qx:0,qz:0,"q{":0,"q}":0,"q~":0,"r,":0,"r.":0,"r/":0,rS:0,r_:0,rj:-1,rs:0,"s,":0,"s.":0,"s/":0,sJ:0,sS:0,s_:0,sj:0,ss:0,"z'":0,"z*":0,"z+":0,"z-":0,z4:0,z7:0,"z<":0,"z?":0,zT:0,zY:0,zZ:0,'z"':0,"z\\":0,"z^":0,"z`":0,zf:0,zt:0,zz:0,"z{":0,"z~":0,"{+":0,"{-":0,"{<":0,"{f":0,"{{":0,"{~":0,"})":0,"},":0,"}.":0,"}/":0,"}>":0,"}?":0,"}I":0,"}S":0,"}T":0,"}Z":0,"}]":0,"}_":0,"}`":0,"}j":0,"}s":0,"}}":0,"~'":0,"~?":0,"~T":0,"~Z":0,'~"':0,"~\\":0,"~^":0,"~_":0,"~`":0,"~t":0,"~z":0},defaultKerning:1,defaultWhitespaceKerning:-1,endOfLineKerning:0,charWidth:{" ":4,"!":1,"#":5,"&":4,"'":1,"(":2,")":2,",":1,".":1,":":1,";":1,"@":5,M:5,W:5,"[":2,"\n":0,"]":2,"`":2,i:1,l:1,m:5,q:4,w:5,"|":1},defaultCharWidth:3};var C=Q;var h={Top:0,UIA:1,UIB:2,UIC:3,UID:4,UIE:5,UIF:6,UIG:7,A:8,B:9,C:10,D:11,E:12,F:13,Bottom:14,Hidden:15};function B(i,e){return Math.max(h.Top,Math.min(h.Bottom,i+e))}function x(i,e){let t={w:e.w??1,h:e.h??1};if(!i.w||!i.h||!t.w||!t.h)return!1;let r={x:i.x??0,y:i.y??0};return r.x<e.x+t.w&&r.x+i.w>e.x&&r.y<e.y+t.h&&r.y+i.h>e.y}function ee(i,e){i.w=e.w,i.h=e.h}function g(i,e){return i.w===e.w&&i.h===e.h}function te(i,e){return{x:i.x+e.x,y:i.y+e.y}}function ie(i,e){i.x=e.x,i.y=e.y}function re(i,e){return _e($(i,e))}function f(i,e){return i.x===e.x&&i.y===e.y}function _e(i){return Math.hypot(i.x,i.y)}function ne(i,e){return{x:Math.max(i.x,e.x),y:Math.max(i.y,e.y)}}function se(i,e){return{x:Math.min(i.x,e.x),y:Math.min(i.y,e.y)}}function $(i,e){return{x:i.x-e.x,y:i.y-e.y}}var b=class{#e;#t;#i=!0;constructor(e,t){this.#e={w:e.sprites.alloc(),nw:e.sprites.alloc(),n:e.sprites.alloc(),ne:e.sprites.alloc(),e:e.sprites.alloc(),se:e.sprites.alloc(),s:e.sprites.alloc(),sw:e.sprites.alloc(),origin:e.sprites.alloc()},this.#e.w.tag=t.w?.tag??t.e?.tag??t.n.tag,this.#e.n.tag=t.n.tag,this.#e.e.tag=t.e?.tag??this.#e.w.tag,this.#e.s.tag=t.s?.tag??this.#e.n.tag,this.#e.nw.tag=t.nw?.tag??t.se?.tag??t.n.tag,this.#e.ne.tag=t.ne?.tag??t.sw?.tag??t.nw?.tag??t.n.tag,this.#e.se.tag=t.se?.tag??this.#e.nw.tag,this.#e.sw.tag=t.sw?.tag??this.#e.ne.tag,this.#e.origin.tag=t.origin.tag,this.#e.w.z=this.#e.nw.z=this.#e.n.z=this.#e.ne.z=this.#e.e.z=this.#e.se.z=this.#e.s.z=this.#e.sw.z=this.#e.origin.z=t.z??0,this.#e.w.stretch=t.w?.stretch??t.e?.stretch??!1,this.#e.n.stretch=t.n.stretch??t.s?.stretch??!1,this.#e.e.stretch=t.e?.stretch??this.#e.w.stretch,this.#e.s.stretch=t.s?.stretch??this.#e.n.stretch,this.#e.nw.stretch=t.nw?.stretch??t.se?.stretch??!1,this.#e.ne.stretch=t.ne?.stretch??t.sw?.stretch??!1,this.#e.se.stretch=t.se?.stretch??this.#e.nw.stretch,this.#e.sw.stretch=t.sw?.stretch??this.#e.ne.stretch,this.#e.origin.stretch=t.origin.stretch??!1,this.#e.w.flipX=t.w?.flip?.x??!t.e?.flip?.x,this.#e.w.flipY=t.w?.flip?.y??!!t.e?.flip?.y,this.#e.n.flipX=t.n.flip?.x??!!t.s?.flip?.x,this.#e.n.flipY=t.n.flip?.y??!t.s?.flip?.y,this.#e.e.flipX=t.e?.flip?.x??!this.#e.w.flipX,this.#e.e.flipY=t.e?.flip?.y??this.#e.w.flipY,this.#e.s.flipX=t.s?.flip?.x??this.#e.n.flipX,this.#e.s.flipY=t.s?.flip?.y??!this.#e.n.flipY,this.#e.origin.flipX=!!t.origin.flip?.x,this.#e.origin.flipY=!!t.origin.flip?.y,this.#e.n.h=t.border?.n??t.border?.s??this.#e.n.h,this.#e.w.w=t.border?.w??t.border?.e??this.#e.n.h,this.#e.e.w=t.border?.e??this.#e.w.w,this.#e.s.h=t.border?.s??this.#e.n.h,this.#e.nw.w=this.#e.w.w,this.#e.nw.h=this.#e.n.h,this.#e.ne.w=this.#e.e.w,this.#e.ne.h=this.#e.n.h,this.#e.se.w=this.#e.e.w,this.#e.se.h=this.#e.s.h,this.#e.sw.w=this.#e.w.w,this.#e.sw.h=this.#e.s.h,this.#t={w:t.margin?.w??0,h:t.margin?.h??0};let r=t.wh?.w==null?this.#e.w.w+this.#e.n.w+this.#e.e.w:t.wh.w;this.#e.n.w=r-1,this.wh={w:r,h:t.wh?.h==null?this.#e.n.h+this.#e.e.h+this.#e.s.h:t.wh.h},this.#e.nw.x=(t.x??0)-1,this.xy={x:t.x??0,y:t.y??0}}free(e){e.sprites.free(this.#e.w,this.#e.nw,this.#e.n,this.#e.ne,this.#e.e,this.#e.se,this.#e.s,this.#e.sw,this.#e.origin)}update(){if(this.#i)return this.#i=!1,!0}get wh(){return{w:this.#e.w.w+this.#e.n.w+this.#e.e.w+this.#t.w,h:this.#e.n.h+this.#e.w.h+this.#e.s.h+this.#t.h}}set wh(e){g(e,this.wh)||(this.#e.w.h=e.h-this.#e.n.h-this.#e.s.h-this.#t.h,this.#e.n.w=e.w-this.#e.w.w-this.#e.e.w-this.#t.w,this.#e.s.w=this.#e.n.w,this.#e.e.h=this.#e.w.h,this.#e.origin.w=this.#e.n.w,this.#e.origin.h=this.#e.e.h,this.#r(),this.#i=!0)}get xy(){return{x:this.#e.nw.x-this.#t.w/2,y:this.#e.nw.y-this.#t.h/2}}set xy(e){f(e,this.xy)||(this.#e.nw.x=e.x+this.#t.w/2,this.#e.nw.y=e.y+this.#t.h/2,this.#e.w.x=this.#e.nw.x,this.#e.w.y=this.#e.nw.y+this.#e.nw.h,this.#e.n.x=this.#e.nw.x+this.#e.nw.w,this.#e.n.y=this.#e.nw.y,this.#e.origin.x=this.#e.n.x,this.#e.origin.y=this.#e.nw.y+this.#e.ne.h,this.#r(),this.#i=!0)}#r(){this.#e.ne.x=this.#e.n.x+this.#e.n.w,this.#e.ne.y=this.#e.nw.y,this.#e.e.x=this.#e.ne.x,this.#e.e.y=this.#e.nw.y+this.#e.ne.h,this.#e.se.x=this.#e.e.x,this.#e.se.y=this.#e.e.y+this.#e.e.h,this.#e.s.x=this.#e.n.x,this.#e.s.y=this.#e.se.y,this.#e.sw.x=this.#e.nw.x,this.#e.sw.y=this.#e.se.y}};function oe(i,e){let t=e.codePointAt(0);return(t==null||t>255)&&(t=63),`${i.id}--${t.toString(16).padStart(2,"0")}`}function ae(i,e,t){return t==null?i.endOfLineKerning:i.kerning[e+t]!=null?i.kerning[e+t]:/^\s?$/.test(e)||/^\s?$/.test(t)?i.defaultWhitespaceKerning:i.defaultKerning}function j(i,e){return i.charWidth[e]??i.defaultCharWidth}function le(i){let e=[],t=i.scale??1,r=i.start??{x:0,y:0},n=i.maxW??1/0,s={x:r.x,y:r.y},a=0;for(;e.length<i.str.length;){let d=e.length,m=i.str[d],u;m===`
|
|
2
2
|
`?u=Be(i.font,s,r.x,t):/^\s*$/.test(m)?u=Ye(i.font,s,n,de(i.font,m,i.str[d+1],t),r.x,t):(u=he(i.font,s,n,i.str,d,r.x,t),s.x>0&&u.cursor.y===w(i.font,r.x,s.y,t).y&&n-s.x+u.cursor.x<=n&&(s=w(i.font,r.x,s.y,t),u=he(i.font,s,n,i.str,d,r.x,t))),e.push(...u.chars),s.x=u.cursor.x,s.y=u.cursor.y,a=Math.max(a,u.cursor.x-r.x)}return{chars:e,cursor:s,wh:{w:a,h:w(i.font,r.x,s.y,t).y-r.y}}}function he(i,e,t,r,n,s,a){let d=[],{x:m,y:u}=e;for(;;n++){let p=r[n];if(!p||/^\s*$/.test(p))break;let S=de(i,p,r[n+1],a);m>s&&m+S>s+t&&({x:m,y:u}=w(i,s,u,a)),d.push({x:m,y:u,w:j(i,p),h:i.cellHeight}),m+=S}return{chars:d,cursor:{x:m,y:u}}}function w(i,e,t,r){return{x:e,y:t+i.lineHeight*r}}function Be(i,e,t,r){return{chars:[void 0],cursor:w(i,t,e.y,r)}}function Ye(i,e,t,r,n,s){let a=e.x>0&&e.x+r>=t?w(i,n,e.y,s):{x:e.x+r,y:e.y};return{chars:[void 0],cursor:a}}function de(i,e,t,r){return r*(j(i,e)+ae(i,e,t))}var y=class{#e=1/0;#t="Outdated";#i=h.UIA;#r=1;#s=[];#n="";#o={w:0,h:0};#a={x:0,y:0};free(e){e.sprites.free(...this.#s)}layout(e){if(this.#t!=="Outdated")return!1;let t=0,r=le({font:C,maxW:this.#e,scale:this.#r,start:this.#a,str:this.#n});this.#o={w:r.wh.w,h:r.wh.h};for(let[n,s]of r.chars.entries()){if(s==null)continue;let a=this.#s[t]??=e.sprites.alloc();a.x=s.x,a.y=s.y,a.tag=oe(C,this.#n[n]),a.stretch=!0,a.w*=this.#r,a.h*=this.#r,a.z=this.#i,t++}for(;this.#s.length>t;)e.sprites.free(this.#s.pop());return this.#t="Updated",!0}get maxW(){return this.#e}set maxW(e){e!==this.#e&&(this.#e=e,this.#t="Outdated")}get scale(){return this.#r}set scale(e){e!==this.#r&&(this.#r=e,this.#t="Outdated")}get text(){return this.#n}set text(e){e!==this.#n&&(this.#n=e,this.#t="Outdated")}update(e){if(this.#t!=="Rendered")return this.#t==="Outdated"&&this.layout(e),this.#t="Rendered",!0}get scaledLeading(){return C.leading*this.#r}get wh(){return this.#o}get xy(){return this.#a}set xy(e){f(e,this.#a)||(this.#a.x=e.x,this.#a.y=e.y,this.#t="Outdated")}get z(){return this.#i}set z(e){e!==this.#i&&(this.#i=e,this.#t="Outdated")}};var Y=class{#e;#t=!0;#i;#r;#s=!1;#n=!1;#o=new y;#a={x:0,y:0};constructor(e,t){let r=t.button.z??h.UID;this.#e=new b(e,{...t.button,x:t.x,y:t.y,z:r,wh:{w:t.w,h:t.h}}),this.#i={sprite:e.sprites.alloc(),z:t.pressed.z??B(r,2)},this.#r={sprite:e.sprites.alloc(),z:t.selected.z??B(this.#i.z,-1)},this.#i.sprite.tag=t.pressed.tag,this.#i.sprite.x=t.x??0,this.#i.sprite.y=t.y??0,this.#i.sprite.w=t.w??this.#e.wh.w,this.#i.sprite.h=t.h??this.#e.wh.h,this.#i.sprite.z=h.Hidden,this.#r.sprite.tag=t.selected.tag,this.#r.sprite.x=t.x??0,this.#r.sprite.y=t.y??0,this.#r.sprite.w=t.w??this.#e.wh.w,this.#r.sprite.h=t.h??this.#e.wh.h,this.#r.sprite.z=h.Hidden,this.#o.text=t.text?.text??"",this.#o.scale=t.text?.scale??1,this.#o.layout(e),this.#l(e),this.#o.maxW=t.w??this.#e.wh.w,this.#o.z=t.text?.z??B(r,-1),this.#n=t.toggle??!1}get selected(){return this.#r.z!==h.Hidden}free(e){this.#e.free(e),this.#o.free(e),e.sprites.free(this.#r.sprite,this.#i.sprite)}get on(){return this.#i.sprite.z!==h.Hidden}set on(e){this.#i.sprite.z=e?this.#i.z:h.Hidden}get onStart(){return this.on&&this.#s}set text(e){this.#o.text=e}update(e){let t=this.#t;this.#e.update()&&(t=!0),this.#o.update(e)&&(t=!0);let r=!e.input.handled&&!!e.zoo.cursor?.hits(e,this.#r.sprite,"UI"),s=r&&e.input.isOnStart("Click")||e.zoo.cursor?.keyboard&&e.input.isOnStart("A")?this.#n?!this.on:!0:this.#n?this.on:e.input.isOn("Click")||!!e.zoo.cursor?.keyboard&&e.input.isOn("A");return this.#s=this.on!==s,this.#s&&(this.on=s,t=!0),r&&(e.input.point?.click||e.input.point?.type==="Mouse")?(t||=this.#r.sprite.z!==this.#r.z,this.#r.sprite.z=this.#r.z):(t||=this.#r.sprite.z!==h.Hidden,this.#r.sprite.z=h.Hidden),e.input.handled||=r,this.#t=!1,t}setXY(e,t){f(t,this.#a)||(this.#a.x=t.x,this.#a.y=t.y,this.#e.xy=t,this.#l(e),this.#i.sprite.xy=t,this.#r.sprite.xy=t,this.#t=!0)}#l(e){this.#o.layout(e),this.#o.xy={x:this.#e.xy.x+this.#e.wh.w/2-this.#o.wh.w/2,y:this.#e.xy.y+this.#e.wh.h/2-(this.#o.wh.h-this.#o.scaledLeading)/2}}};var v=class{keyboard=!1;#e;#t;#i;constructor(e,t,r){this.#i=t,this.#t=r??this.#i,this.#e=e.sprites.alloc(),this.#e.tag=t,this.#e.z=h.Hidden}free(e){e.sprites.free(this.#e)}hitbox(e,t){let r=t==="Level",n=this.#e.hitbox;if(!n)throw Error("cursor has no hitbox");return{x:(r?e.cam.x:0)+n.x,y:(r?e.cam.y:0)+n.y,w:n.w,h:n.h}}hits(e,t,r){return this.visible&&x(this.hitbox(e,r),t)}update(e){if(e.input.point?.invalid)return this.#e.tag=e.input.point.click?this.#t:this.#i,this.#e.xy=e.input.point.local,this.#e.z=e.input.point?.type==="Mouse"?h.Top:h.Hidden,!0;if(this.keyboard&&e.input.isAnyOn("L","R","U","D"))return e.input.isOn("L")&&(this.#e.x-=1),e.input.isOn("R")&&(this.#e.x+=1),e.input.isOn("U")&&(this.#e.y-=1),e.input.isOn("D")&&(this.#e.y+=1),this.#e.z=h.Top,!0}get visible(){return this.#e.z!==h.Hidden}};var A=class{#e;#t=!0;#i={w:0,h:0};#r={x:0,y:0};#s;#n;constructor(e,t,r){this.#n=e.sprites.alloc(),this.#n.tag=t,this.#s=r}get fill(){return this.#e}set fill(e){this.#e!==e&&(this.#e=e,this.#t=!0)}free(e){e.sprites.free(this.#n)}get h(){return this.#n.h}set h(e){this.#n.h!==e&&(this.#n.h=e,this.#t=!0)}get margin(){return this.#i}set margin(e){g(e,this.#i)||(ee(this.#i,e),this.#t=!0)}get modulo(){return this.#r}set modulo(e){f(e,this.#r)||(ie(this.#r,e),this.#t=!0)}get pivot(){return this.#s}set pivot(e){this.#s!==e&&(this.#s=e,this.#t=!0)}update(e){if(!this.#t&&!e.cam.invalid)return;let t=e.cam.follow({w:this.#n.w,h:this.#n.h},this.#n.z,this.#s,{fill:this.#e,modulo:this.#r,margin:this.#i});return this.#n.x=t.x,this.#n.y=t.y,this.#t=!1,!0}get w(){return this.#n.w}set w(e){this.#n.w!==e&&(this.#n.w=e,this.#t=!0)}get z(){return this.#n.z}set z(e){this.#n.z=e}};var l=Ae(globalThis.location?.href);function Ae(i){if(!i)return;let e=[...new URL(i).searchParams].find(([s])=>s.toLowerCase()==="debug")?.[1];if(e==null)return;let t=Object.fromEntries(e.split(",").filter(Boolean).map(s=>s.split("="))),r={};for(let s in t)r[s.toLowerCase()]=t[s]||"true";let n={cam:void 0,input:void 0,mem:void 0,render:void 0};return new Proxy(r,{get(s,a){if(typeof a!="string"||(a=a.toLowerCase(),s[a]))return s[a];if(!e||"all"in t||a in n&&"void"in t)return"true"}})}var M=class{#e;#t=new Set;#i=!1;add(...e){for(let t of e)this.#t.add(t),t instanceof v&&(this.#e=t)}clear(){this.#e=void 0,this.#t.clear()}get cursor(){return this.#e}get invalid(){return this.#i}remove(...e){for(let t of e)this.#t.delete(t),t===this.#e&&(this.#e=void 0)}update(e){this.#i=!1;for(let t of this.#t)t.update?.(e)&&(!this.#i&&l?.invalid&&console.debug("ent update invalid",t),this.#i=!0)}};function me(i){return{anim:i.anim,celXYWH:Me(i),tags:Object.keys(i.anim)}}function Me(i){let e=[],t=0;for(let r of Object.values(i.anim))e.push(...Xe(r,i.celXY,t)),t+=r.cels*2;return e}function Xe(i,e,t){let r=[];for(let n=0;n<16;n++){let s=t+2*(n%i.cels);r.push(e[s],e[s+1],i.w,i.h)}return r}var X=class{#e=0;#t=1;#i=!0;#r=1;#s={w:1/0,h:1/0};#n="Int";#o=1;#a=1;#l={w:1,h:1};#h=0;#u=0;#d=0;center(e){this.x=Math.floor(e.x-this.w/2),this.y=Math.floor(e.y-this.h/2)}clientToXY(e){let t=this.clientToXYLocal(e);return{x:this.#h+t.x,y:this.#u+t.y}}clientToXYLocal(e){return{x:e.x/this.#l.w*this.#a,y:e.y/this.#l.h*this.#t}}follow(e,t,r,n){let s=n?.margin?.w??0,a=t>h.UIG?Math.trunc(this.x):0;switch(r){case"SW":case"W":case"NW":a+=s;break;case"SE":case"E":case"NE":a+=this.w-(e.w+s);break;case"N":case"S":case"Origin":a+=Math.trunc(this.w/2)-Math.trunc(e.w/2);break}a-=a%((n?.modulo?.x??a)||1);let d=n?.margin?.h??0,m=t>h.UIG?Math.trunc(this.y):0;switch(r){case"N":case"NE":case"NW":m+=d;break;case"SE":case"S":case"SW":m+=this.h-(e.h+d);break;case"E":case"W":case"Origin":m+=Math.trunc(this.h/2)-Math.trunc(e.h/2);break}m-=m%((n?.modulo?.y??m)||1);let u=n?.fill==="X"||n?.fill==="XY"?this.w-2*s:e.w,p=n?.fill==="Y"||n?.fill==="XY"?this.h-2*d:e.h;return{x:a,y:m,w:u,h:p}}get h(){return this.#t}isVisible(e){return x(this,e)}get invalid(){return this.#i}get minScale(){return this.#r}set minScale(e){this.#o!==e&&(this.#o=e,this.#m())}get minWH(){return this.#s}set minWH(e){this.#s.w===e.w&&this.#s.h===e.h||(this.#s.w=e.w,this.#s.h=e.h,this.#m())}get mode(){return this.#n}set mode(e){this.#n!==e&&(this.#n=e,this.#m())}get portrait(){return this.h>this.w}postupdate(){this.#i=!1}get scale(){return this.#o}toString(){return`Cam{(${this.x} ${this.y}) ${this.w}\xD7${this.h}}`}update(e){if(!e.parentElement)throw Error("canvas has no parent");let{clientWidth:t,clientHeight:r}=e.parentElement;this.#i||=this.#l.w!==t||this.#l.h!==r||this.#e!==devicePixelRatio,this.#i&&(this.#e=devicePixelRatio,this.#l.w=t,this.#l.h=r,this.#m(),e.width=this.#a,e.height=this.#t,e.style.width=`${this.#a*this.#o/devicePixelRatio}px`,e.style.height=`${this.#t*this.#o/devicePixelRatio}px`)}get w(){return this.#a}get whClient(){return this.#l}get x(){return this.#h}set x(e){this.#i||=this.x!==e,this.#h=e}get y(){return this.#u}set y(e){this.#i||=this.y!==e,this.#u=e}get zoomOut(){return this.#d}set zoomOut(e){e=Math.max(0,e),this.#d!==e&&(this.#d=e,this.#m())}#m(){!this.#i&&l?.invalid&&console.debug("cam invalid"),this.#i=!0;let e={w:this.#l.w*devicePixelRatio,h:this.#l.h*devicePixelRatio},t=Math.max(this.#r,Math.min(e.w/this.#s.w,e.h/this.#s.h)-(this.#n==="Int"?Math.trunc(this.#d):this.#d));this.#o=this.#n==="Int"?Math.trunc(t):t,this.#a=Math.ceil(e.w/this.#o),this.#t=Math.ceil(e.h/this.#o)}};function ue(i,e){return(i%e+e)%e}var c=12,Zt=1/64,K={w:4095,h:4095},Z=class{i;#e;constructor(e,t){this.#e=e,this.i=t}above(e){return(this.z===e.z?(e.zend?e.y+e.h:e.y)-(this.zend?this.y+this.h:this.y):this.z-e.z)<0}get cel(){return this.#e.view.getUint8(this.i+10)&31}set cel(e){let t=this.#e.view.getUint8(this.i+10);this.#e.view.setUint8(this.i+10,t&-32|e&31)}clips(e){return x(this,e)}get flipX(){return!!(this.#e.view.getUint8(this.i+6)&64)}set flipX(e){let t=this.#e.view.getUint8(this.i+6);this.#e.view.setUint8(this.i+6,t&-65|-e&64)}get flipY(){return!!(this.#e.view.getUint8(this.i+6)&32)}set flipY(e){let t=this.#e.view.getUint8(this.i+6);this.#e.view.setUint8(this.i+6,t&-33|-e&32)}get h(){return this.#e.view.getUint16(this.i+8,!0)>>>4}set h(e){let t=this.#e.view.getUint16(this.i+8,!0);this.#e.view.setUint16(this.i+8,t&-65521|(e&4095)<<4,!0)}get id(){return this.#e.view.getUint16(this.i+10,!0)>>>5&2047}set id(e){let t=this.#e.view.getUint16(this.i+10,!0);this.#e.view.setUint16(this.i+10,t&-65505|(e&2047)<<5,!0)}get stretch(){return!!(this.#e.view.getUint8(this.i+6)&128)}set stretch(e){let t=this.#e.view.getUint8(this.i+6);this.#e.view.setUint8(this.i+6,t&-129|-e&128)}get w(){return this.#e.view.getUint16(this.i+7,!0)&4095}set w(e){let t=this.#e.view.getUint16(this.i+7,!0);this.#e.view.setUint16(this.i+7,t&-4096|e&4095,!0)}get x(){return(this.#e.view.getUint32(this.i+0,!0)<<8>>8)/64}set x(e){let t=this.#e.view.getUint32(this.i+0,!0);this.#e.view.setUint32(this.i+0,t&-16777216|e*64&16777215,!0)}get xy(){return{x:this.x,y:this.y}}set xy(e){this.x=e.x,this.y=e.y}get y(){return(this.#e.view.getUint32(this.i+3,!0)<<8>>8)/64}set y(e){let t=this.#e.view.getUint32(this.i+3,!0);this.#e.view.setUint32(this.i+3,t&-16777216|e*64&16777215,!0)}get z(){return this.#e.view.getUint8(this.i+6)&15}set z(e){let t=this.#e.view.getUint8(this.i+6);this.#e.view.setUint8(this.i+6,t&-16|e&15)}get zend(){return!!(this.#e.view.getUint8(this.i+6)&16)}set zend(e){let t=this.#e.view.getUint8(this.i+6);this.#e.view.setUint8(this.i+6,t&-17|-e&16)}},T=class i extends Z{#e;#t;#i;#r;constructor(e,t,r,n){super(e,t),this.#e=r,this.#r=n}get anim(){return this.#e.anim[this.tag]}get flipX(){return super.flipX}set flipX(e){this.flipX!==e&&(super.flipX=e,this.#t=void 0,this.#i=void 0)}get flipY(){return super.flipY}set flipY(e){this.flipY!==e&&(super.flipY=e,this.#t=void 0,this.#i=void 0)}get h(){return super.h}set h(e){this.h!==e&&(super.h=e,this.#t=void 0,this.#i=void 0)}get hitbox(){if(this.#t)return this.#t;let{hitbox:e}=this.anim;if(e)return this.#t??={x:this.x+(this.flipX?this.w-e.w-e.x:e.x),y:this.y+(this.flipY?this.h-e.h-e.y:e.y),w:e.w,h:e.h}}hits(e){let t=this.hitbox;if(!t)return!1;let r=e instanceof i?e.hurtbox:e;return!!r&&x(t,r)}get hurtbox(){if(this.#i)return this.#i;let{hurtbox:e}=this.anim;if(e)return this.#i??={x:this.x+(this.flipX?this.w-e.w-e.x:e.x),y:this.y+(this.flipY?this.h-e.h-e.y:e.y),w:e.w,h:e.h}}get id(){return super.id}set id(e){this.id!==e&&(super.id=e,this.#t=void 0,this.#i=void 0)}get looped(){return ue(this.#s-this.cel,32)>=this.anim.cels}reset(){this.cel=this.#s}get tag(){return this.#e.tags[this.id]}set tag(e){let t=this.#e.anim[e];this.w=t.w,this.h=t.h,this.id=t.id,this.reset()}toString(){return`Sprite{${this.tag} (${this.x} ${this.y} ${this.z}) ${this.w}\xD7${this.h}}`}get w(){return super.w}set w(e){this.w!==e&&(super.w=e,this.#t=void 0,this.#i=void 0)}get x(){return super.x}set x(e){this.x!==e&&(super.x=e,this.#t=void 0,this.#i=void 0)}get y(){return super.y}set y(e){this.y!==e&&(super.y=e,this.#t=void 0,this.#i=void 0)}get#s(){return this.#r.age/62.5%(this.anim.cels*2)}};var P=class{enable=!1;#e;constructor(e){this.#e=e}register(e){let t=this.#e[`${e}EventListener`].bind(this.#e);return t("contextmenu",this.#t),t("touchstart",this.#t,{passive:!1}),this}[Symbol.dispose](){this.register("remove")}#t=e=>{!e.isTrusted||e.metaKey||e.altKey||e.ctrlKey||this.enable||e.preventDefault()}};var z=class{bits=0;bitByAxis={};bitByButton={};onEvent=()=>{};#e;constructor(e){this.#e=e}get connected(){return isSecureContext&&navigator.getGamepads().filter(Boolean).length>0}register(e){let t=this.#e[`${e}EventListener`].bind(this.#e);return t("gamepadconnected",this.onEvent),t("gamepaddisconnected",this.onEvent),this}reset(){this.bits=0}[Symbol.dispose](){this.register("remove")}update(){if(isSecureContext)for(let e of navigator.getGamepads()){for(let[t,r]of e?.axes.entries()??[]){let n=this.bitByAxis[t];if(!n)continue;let s=r<0?n[0]:r===0?0:n[1];this.bits|=Math.abs(r)>=.5?s:0}for(let[t,r]of e?.buttons.entries()??[]){let n=this.bitByButton[t];n!=null&&(this.bits|=r.pressed?n:0)}}}};var W=class{bitByCode={};invalid=!1;onEvent=()=>{};#e={};#t;constructor(e){this.#t=e}get bits(){let e=0;for(let t in this.bitByCode)e|=this.#e[t]?this.bitByCode[t]:0;return e}postupdate(){this.invalid=!1}register(e){let t=this.#t[`${e}EventListener`].bind(this.#t);for(let r of["keydown","keyup"])t(r,this.#i);return this}reset(){this.invalid=!1,this.#e={}}[Symbol.dispose](){this.register("remove")}#i=e=>{!e.isTrusted||this.bitByCode[e.code]==null||e.type==="keydown"&&(e.metaKey||e.altKey||e.ctrlKey)||(this.invalid=!0,this.#e[e.code]=e.type==="keydown",e.preventDefault(),this.onEvent())}};var Pe={mouse:"Mouse",pen:"Pen",touch:"Touch"},ze=["pointercancel","pointerdown","pointermove","pointerup"],k=class{bitByButton={};dragMinClient=5;invalid=!1;onEvent=()=>{};primary;secondary={};#e;#t;constructor(e){this.#t=e}get boundsClient(){if(!this.primary?.bits&&!Object.keys(this.secondary).length)return;let e={x:1/0,y:1/0},t={x:-1/0,y:-1/0};for(let r of[this.primary,...Object.values(this.secondary)])r?.bits&&(e=se(e,r.xyClient),t=ne(t,r.xyClient));return{x:e.x,y:e.y,w:t.x-e.x,h:t.y-e.y}}get centerClient(){let e=this.boundsClient;return e?te(e,{x:e.w/2,y:e.h/2}):this.primary?.xyClient}get locked(){return this.#t.ownerDocument.pointerLockElement===this.#t}get pinchClient(){if(!this.#e)return;let e=this.#s;return e?$(e,this.#e):void 0}postupdate(){this.invalid=!1}register(e){let t=this.#t[`${e}EventListener`].bind(this.#t);for(let r of ze)t(r,this.#r);return this}reset(){this.invalid=!1,this.primary=void 0;for(let e in this.secondary)delete this.secondary[e];this.#e=void 0}update(){((this.primary?.bits?1:0)+Object.values(this.secondary).length<2||!this.#e)&&(this.#e=this.#s)}[Symbol.dispose](){this.register("remove")}#i(e){let t=0;for(let r=1;r<=e;r<<=1)(r&e)===r&&(t|=this.bitByButton[r]??0);return t}#r=e=>{if(!e.isTrusted)return;this.invalid=!0;let t=e.metaKey||e.altKey||e.ctrlKey?0:this.#i(e.buttons);t&&e.preventDefault();let r=this.locked;if(e.type==="pointerdown"&&!r)try{this.#t.setPointerCapture(e.pointerId)}catch{}let n=e.isPrimary?this.primary:this.secondary[e.pointerId],s;if(r){let S=1/devicePixelRatio;s={x:Math.min(Math.max(0,(n?.xyClient.x??e.offsetX)+e.movementX*S),this.#t.clientWidth),y:Math.min(Math.max(0,(n?.xyClient.y??e.offsetY)+e.movementY*S),this.#t.clientHeight)}}else s={x:e.offsetX,y:e.offsetY};let a=e.type,d=Pe[e.pointerType],m;e.type==="pointerdown"?m={x:s.x,y:s.y}:e.type==="pointermove"&&(m=n?.clickClient);let u=!!t&&(n?.drag||!!m&&re(m,s)>=this.dragMinClient),p={clickClient:m,bits:t,drag:u,ev:a,id:e.pointerId,primary:e.isPrimary,type:d,xyClient:s};e.isPrimary?this.primary=p:t?this.secondary[e.pointerId]=p:delete this.secondary[e.pointerId],this.onEvent()};get#s(){if((this.primary?.bits?1:0)+Object.values(this.secondary).length<2)return;let e=this.boundsClient;return e?{x:e.w,y:e.h}:void 0}};var H=class{deltaClient;onEvent=()=>{};#e;constructor(e){this.#e=e}postupdate(){this.deltaClient=void 0}register(e){return this.#e[`${e}EventListener`].bind(this.#e)("wheel",this.#t,{passive:!0}),this}reset(){this.deltaClient=void 0}[Symbol.dispose](){this.register("remove")}#t=e=>{!e.isTrusted||e.metaKey||e.altKey||e.ctrlKey||(this.deltaClient={x:e.deltaX,y:e.deltaY,z:e.deltaZ},this.onEvent())}};var O=class{comboMaxIntervalMillis=300;gestured=!1;handled=!1;invalid=!1;minHeldMillis=300;#e={};#t={};#i=0;#r;#s=[];#n;#o;#a=0;#l;#h;#u;#d=0;#m;#f;constructor(e,t){this.#r=e,this.#n=new P(t),this.#o=new z(globalThis),this.#l=new W(t.ownerDocument),this.#h=new k(t),this.#m=new H(t)}get anyOn(){return this.#i!==0}get combo(){let e=[];for(let t of this.#s){let r=[];for(let n=1;n<=t;n<<=1)(n&t)===n&&this.#t[n]&&r.push(this.#t[n]);r.sort(),e.push(r)}return e}get contextMenu(){return this.#n}get gamepad(){return this.#o.connected?{}:void 0}get held(){return!this.handled&&this.#a>=this.minHeldMillis}isAnyOn(...e){return!this.handled&&!!(this.#i&this.#c(e))}isAnyOnStart(...e){return this.started&&this.isAnyOn(...e)}isCombo(...e){return e.length===this.#s.length&&this.isComboEndsWith(...e)}isComboEndsWith(...e){for(let[t,r]of e.entries()){let n=this.#c(r);if(this.#s.at(-e.length+t)!==n)return!1}return!this.handled&&(this.#s.at(-1)===this.#i||!this.#i)}isComboEndsWithStart(...e){return this.isOnStart(...e.at(-1))&&this.isComboEndsWith(...e)}isComboStart(...e){return this.isOnStart(...e.at(-1))&&this.isCombo(...e)}isOff(...e){return!this.handled&&!this.isOn(...e)}isOffStart(...e){let t=this.#c(e);return(this.#d&t)===t&&this.started&&this.isOff(...e)}isOn(...e){let t=this.#c(e);return!this.handled&&(this.#i&t)===t}isOnStart(...e){return this.started&&this.isOn(...e)}get key(){return{invalid:this.#l.invalid}}mapDefault(){let e=this;return e.mapKeyboardCode("L","ArrowLeft"),e.mapKeyboardCode("R","ArrowRight"),e.mapKeyboardCode("U","ArrowUp"),e.mapKeyboardCode("D","ArrowDown"),e.mapKeyboardCode("C","KeyC"),e.mapKeyboardCode("A","KeyX"),e.mapKeyboardCode("B","KeyZ"),e.mapKeyboardCode("Menu","Enter"),e.mapKeyboardCode("Back","Escape"),e.mapGamepadAxis("L","R",0,2),e.mapGamepadAxis("U","D",1,3),e.mapGamepadButton("L",14),e.mapGamepadButton("R",15),e.mapGamepadButton("U",12),e.mapGamepadButton("D",13),e.mapGamepadButton("C",2),e.mapGamepadButton("B",0),e.mapGamepadButton("A",1),e.mapGamepadButton("Menu",9),e.mapGamepadButton("Back",8),e.mapPointerClick("Click",1),e.mapPointerClick("Click2",2),e.mapPointerClick("ClickMiddle",4),e}mapGamepadAxis(e,t,...r){for(let n of r)this.#o.bitByAxis[n]=[this.#p(e),this.#p(t)]}mapGamepadButton(e,...t){for(let r of t)this.#o.bitByButton[r]=this.#p(e)}mapKeyboardCode(e,...t){for(let r of t)this.#l.bitByCode[r]=this.#p(e)}mapPointerClick(e,...t){for(let r of t)this.#h.bitByButton[r]=this.#p(e)}get on(){let e=[];for(let t in this.#e)this.isOn(t)&&e.push(t);return e.sort()}set onEvent(e){this.#o.onEvent=e,this.#l.onEvent=e,this.#h.onEvent=e,this.#m.onEvent=e}get point(){return this.#u}get pointer(){return this.#h}register(e){return globalThis[`${e}EventListener`]("blur",this.reset),this.#n.register(e),this.#o.register(e),this.#l.register(e),this.#h.register(e),this.#m.register(e),this}reset=()=>{this.#i=0,this.#d=0,this.handled=!1,this.#a=0,this.#s.length=0,this.#o.reset(),this.#l.reset(),this.#h.reset(),this.#u=void 0,this.#m.reset(),this.#f=void 0};get started(){return!this.handled&&this.#i!==this.#d}update(e){if(this.handled=!1,this.#o.update(),this.#h.update(),this.#d=this.#i,this.#i=this.#o.bits|this.#l.bits|(this.#h.primary?.bits??0),this.invalid=this.#i!==this.#d||this.#h.invalid||!!this.#m.deltaClient,this.gestured||=!!this.#i,(e>this.comboMaxIntervalMillis&&this.#i!==this.#d||this.#a+e>this.comboMaxIntervalMillis&&!this.#i)&&(this.#s.length=0),this.#i===this.#d?this.#a=this.#a+e:this.#a=e,this.#i&&this.#i!==this.#d&&(this.#d&&(this.#s.length=0),this.#s.push(this.#i)),this.#h.primary){let t=this.#h.pinchClient,r=this.#h.primary.drag&&!Object.values(this.#h.secondary).length,n=[];for(let d of Object.values(this.#h.secondary))n.push({type:d.type,click:d.clickClient?{client:d.clickClient,local:this.#r.clientToXYLocal(d.clickClient),...this.#r.clientToXY(d.clickClient)}:void 0,...this.#r.clientToXY(d.xyClient),client:d.xyClient,local:this.#r.clientToXYLocal(d.xyClient)});let s=this.#h.centerClient,a={client:s,local:this.#r.clientToXYLocal(s),...this.#r.clientToXY(s)};this.#u={center:a,click:this.#h.primary.clickClient?{client:this.#h.primary.clickClient,local:this.#r.clientToXYLocal(this.#h.primary.clickClient),...this.#r.clientToXY(this.#h.primary.clickClient)}:void 0,drag:{on:r,start:!this.#u?.drag.on&&r,end:!!this.#u?.drag.on&&!r},invalid:this.#h.invalid,pinch:t?{client:t,xy:this.#r.clientToXY(t)}:void 0,secondary:n,type:this.#h.primary.type,...this.#r.clientToXY(this.#h.primary.xyClient),client:this.#h.primary.xyClient,local:this.#r.clientToXYLocal(this.#h.primary.xyClient)}}else this.#u=void 0;this.#f=this.#m.deltaClient?{delta:{client:this.#m.deltaClient,xy:this.#r.clientToXY(this.#m.deltaClient)}}:void 0,this.#l.postupdate(),this.#h.postupdate(),this.#m.postupdate()}[Symbol.dispose](){this.register("remove")}get wheel(){return this.#f}#c(e){let t=0;for(let r of e)t|=this.#e[r]??0;return t}#p(e){let t=this.#e[e]??=1<<Object.keys(this.#e).length;return this.#t[t]=e,t}};var E=class{#e;#t;#i=0;#r;#s;constructor(e){if(e.allocBytes<=0)throw Error("byte allocation must be > 0");if(e.pageBlocks<=0)throw Error("page blocks must be > 0");this.#t={...e,minPages:e.minPages??1};let t=this.#t.minPages*e.pageBlocks;this.#e=new Array(t),this.#r=new Uint8Array,this.#a(t,"Init")}alloc(){this.#i>=this.#n&&this.#a(this.#n+this.#t.pageBlocks,"Call");let e=this.#e[this.#i];return e.i=this.#i*this.#t.allocBytes,this.#i++,e}clear(){this.#i=0;let e=this.#t.minPages*this.#t.pageBlocks;this.#n>e&&this.#a(e,"Call")}free(...e){for(let t of e)this.#o(t)}get size(){return this.#i}get view(){return this.#s}toDebugString(){let e="";for(let t=0;t<this.#r.buffer.byteLength;t++)t&&!(t%this.#t.allocBytes)&&(e+=" "),e+=this.#r[t].toString(16).padStart(2,"0");return e}get#n(){return this.#r.buffer.byteLength/this.#t.allocBytes}#o(e){if(!this.#i)throw Error("pool underflow");this.#i--;let t=this.#i*this.#t.allocBytes;this.#r.copyWithin(e.i,t,t+this.#t.allocBytes),this.#e[this.#i].i=e.i,[this.#e[e.i],this.#e[this.#i]]=[this.#e[this.#i],this.#e[e.i]];let r=Math.floor((this.#n-this.#i)/this.#t.pageBlocks);r&&this.#n/this.#t.pageBlocks-r>=this.#t.minPages&&this.#a(this.#n-r*this.#t.pageBlocks,"Call")}#a(e,t){t==="Call"&&l?.mem&&console.debug(`[mem] ${e<this.#n?"shrinking":"growing"} pool to ${e}`),this.#e.length=e;for(let s=this.#n;s<e;s++)this.#e[s]=this.#t.alloc(this);let r=new ArrayBuffer(e*this.#t.allocBytes),n=new Uint8Array(r);n.set(this.#r.subarray(0,e*this.#t.allocBytes)),this.#r=n,this.#s=new DataView(r)}};function pe(i){return`#${i.toString(16).padStart(8,"0")}`}function ce(i,e){i.parentNode===document.body&&(document.body.style.margin="0",document.body.style.width="100dvw",document.body.style.height="100dvh",document.body.style.overflow="hidden",document.body.style.background=pe(e))}function fe(){if(document.querySelector('meta[name="viewport"]'))return;let i=document.createElement("meta");i.name="viewport",i.content="width=device-width, maximum-scale=1, minimum-scale=1, user-scalable=no",document.head.appendChild(i)}function ye(i,e){return i??=document.createElement("canvas"),i.width=0,i.style.cursor="none",i.style.display="block",i.style.outline="none",i.style.cursor="none",e==="Int"&&(i.style.imageRendering="pixelated"),i.style.touchAction="none",i.tabIndex=0,i.focus(),i.parentNode||document.body.append(i),i}async function xe(i){let e=new Promise((t,r)=>{i.onload=()=>t(i),i.onerror=()=>r(Error(`image load error for ${i.src}`))});return i.complete?i:await e}function be(i,e,t,r){let n=ke(i,e,t);return i.useProgram(n),{buffer:i.createBuffer(),program:n,textures:r,uniform:We(i,n),vao:i.createVertexArray()}}function We(i,e){let t=e?i.getProgramParameter(e,i.ACTIVE_UNIFORMS):0,r=l?.render?new Proxy({},{get(n,s){if(n[s]==null)throw Error(`no shader uniform "${s}"`);return n[s]}}):{};for(let n=0;n<t;++n){let s=i.getActiveUniform(e,n);if(!s)throw Error(`no shader uniform at index ${n}`);let a=i.getUniformLocation(e,s.name);if(!a)throw Error(`no shader uniform "${s.name}"`);let d=s.name.replace("[0]","");r[d]=a}return r}function ke(i,e,t){let r=i.createProgram();if(!r)return null;let n=ge(i,"VERTEX_SHADER",e),s=ge(i,"FRAGMENT_SHADER",t);if(!n||!s)return null;if(i.attachShader(r,n),i.attachShader(r,s),i.linkProgram(r),l?.render&&!i.getProgramParameter(r,i.LINK_STATUS)){let a=i.getProgramInfoLog(r)?.slice(0,-1);throw Error(`shader link failure; ${a}`)}return i.detachShader(r,s),i.detachShader(r,n),i.deleteShader(s),i.deleteShader(n),r}function ge(i,e,t){let r=i.createShader(i[e]);if(!r)return r;if(i.shaderSource(r,t.trim()),i.compileShader(r),l?.render&&!i.getShaderParameter(r,i.COMPILE_STATUS)){let n=i.getShaderInfoLog(r)?.slice(0,-1);throw Error(`shader compile failure; ${n}`)}return r}var we=`#version 300 es
|
|
3
3
|
#pragma debug(${l?.render?"on":"off"})
|
|
4
4
|
#pragma optimize(${l?.render?"off":"on"})
|