textmode.js 0.8.0-beta.3 → 0.8.0

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.
@@ -1,5 +1,5 @@
1
- var Kt = Object.defineProperty;
2
- var Jt = (n, t, e) => t in n ? Kt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
1
+ var Vt = Object.defineProperty;
2
+ var Jt = (n, t, e) => t in n ? Vt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
3
  var a = (n, t, e) => Jt(n, typeof t != "symbol" ? t + "" : t, e);
4
4
  class U extends Error {
5
5
  constructor(t, e = {}) {
@@ -8,8 +8,8 @@ class U extends Error {
8
8
  static i(t, e) {
9
9
  return `${t}${e && Object.keys(e).length > 0 ? `
10
10
 
11
- 📋 Context:` + Object.entries(e).map(([i, r]) => `
12
- - ${i}: ${U.o(r)}`).join("") : ""}
11
+ 📋 Context:` + Object.entries(e).map(([i, s]) => `
12
+ - ${i}: ${U.o(s)}`).join("") : ""}
13
13
 
14
14
  ${"↓".repeat(24)}
15
15
  `;
@@ -28,22 +28,22 @@ ${"↓".repeat(24)}
28
28
  }
29
29
  }
30
30
  var $t = ((n) => (n[n.SILENT = 0] = "SILENT", n[n.WARNING = 1] = "WARNING", n[n.ERROR = 2] = "ERROR", n[n.THROW = 3] = "THROW", n))($t || {});
31
- const I = class I {
31
+ const D = class D {
32
32
  constructor() {
33
33
  a(this, "l", { globalLevel: 3 });
34
34
  }
35
35
  static u() {
36
- return I.h || (I.h = new I()), I.h;
36
+ return D.h || (D.h = new D()), D.h;
37
37
  }
38
38
  v(t, e) {
39
- const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.", r = "color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;";
39
+ const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.", s = "color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;";
40
40
  switch (this.l.globalLevel) {
41
41
  case 0:
42
42
  return !1;
43
43
  case 1:
44
- return console.group(i, r), console.warn(U.i(t, e)), console.groupEnd(), !1;
44
+ return console.group(i, s), console.warn(U.i(t, e)), console.groupEnd(), !1;
45
45
  case 2:
46
- return console.group(i, r), console.error(U.i(t, e)), console.groupEnd(), !1;
46
+ return console.group(i, s), console.error(U.i(t, e)), console.groupEnd(), !1;
47
47
  default:
48
48
  throw new U(t, e);
49
49
  }
@@ -55,8 +55,8 @@ const I = class I {
55
55
  this.l.globalLevel = t;
56
56
  }
57
57
  };
58
- a(I, "h", null);
59
- let ut = I;
58
+ a(D, "h", null);
59
+ let ut = D;
60
60
  const vt = ut.u();
61
61
  class q {
62
62
  constructor(t, e, i) {
@@ -74,24 +74,24 @@ class q {
74
74
  for (let e = 0; e < t; e++) {
75
75
  const i = this.A.getActiveUniform(this.C, e);
76
76
  if (i) {
77
- const r = i.name.replace(/\[0\]$/, ""), s = this.A.getUniformLocation(this.C, r);
78
- s && (this.M.set(r, s), this.F.set(r, { type: i.type, size: i.size }));
77
+ const s = i.name.replace(/\[0\]$/, ""), r = this.A.getUniformLocation(this.C, s);
78
+ r && (this.M.set(s, r), this.F.set(s, { type: i.type, size: i.size }));
79
79
  }
80
80
  }
81
81
  }
82
82
  R(t, e) {
83
- const i = this.k(this.A.VERTEX_SHADER, t), r = this.k(this.A.FRAGMENT_SHADER, e), s = this.A.createProgram();
84
- if (this.A.attachShader(s, i), this.A.attachShader(s, r), this.A.linkProgram(s), !this.A.getProgramParameter(s, this.A.LINK_STATUS)) {
85
- const h = this.A.getProgramInfoLog(s);
83
+ const i = this.k(this.A.VERTEX_SHADER, t), s = this.k(this.A.FRAGMENT_SHADER, e), r = this.A.createProgram();
84
+ if (this.A.attachShader(r, i), this.A.attachShader(r, s), this.A.linkProgram(r), !this.A.getProgramParameter(r, this.A.LINK_STATUS)) {
85
+ const h = this.A.getProgramInfoLog(r);
86
86
  throw Error("Shader program link error: " + h);
87
87
  }
88
- return this.A.deleteShader(i), this.A.deleteShader(r), s;
88
+ return this.A.deleteShader(i), this.A.deleteShader(s), r;
89
89
  }
90
90
  k(t, e) {
91
91
  const i = this.A.createShader(t);
92
92
  if (this.A.shaderSource(i, e), this.A.compileShader(i), !this.A.getShaderParameter(i, this.A.COMPILE_STATUS)) {
93
- const r = this.A.getShaderInfoLog(i);
94
- throw this.A.deleteShader(i), Error("Shader compilation error: " + r);
93
+ const s = this.A.getShaderInfoLog(i);
94
+ throw this.A.deleteShader(i), Error("Shader compilation error: " + s);
95
95
  }
96
96
  return i;
97
97
  }
@@ -108,25 +108,25 @@ class q {
108
108
  var c, l;
109
109
  const i = this.M.get(t);
110
110
  if (!i) return;
111
- const r = this.F.get(t);
112
- if (!r) return;
113
- const { type: s, size: h } = r, o = this.A;
111
+ const s = this.F.get(t);
112
+ if (!s) return;
113
+ const { type: r, size: h } = s, o = this.A;
114
114
  if (e instanceof WebGLTexture) {
115
115
  const u = this.H(t);
116
116
  return o.uniform1i(i, u), o.activeTexture(o.TEXTURE0 + u), void o.bindTexture(o.TEXTURE_2D, e);
117
117
  }
118
- if (e instanceof X) {
118
+ if (e instanceof Z) {
119
119
  const u = this.H(t);
120
120
  return o.uniform1i(i, u), o.activeTexture(o.TEXTURE0 + u), void o.bindTexture(o.TEXTURE_2D, e.textures[0]);
121
121
  }
122
- if (typeof e == "number") return void (s === o.INT || s === o.BOOL ? o.uniform1i(i, e) : o.uniform1f(i, e));
122
+ if (typeof e == "number") return void (r === o.INT || r === o.BOOL ? o.uniform1i(i, e) : o.uniform1f(i, e));
123
123
  if (typeof e == "boolean") return void o.uniform1i(i, e ? 1 : 0);
124
124
  if (Array.isArray(e[0])) {
125
125
  const u = e.flat(), f = { [o.FLOAT_VEC2]: () => o.uniform2fv(i, u), [o.FLOAT_VEC3]: () => o.uniform3fv(i, u), [o.FLOAT_VEC4]: () => o.uniform4fv(i, u) };
126
- (c = f[s]) == null || c.call(f);
126
+ (c = f[r]) == null || c.call(f);
127
127
  } else {
128
128
  const u = e, f = { [o.FLOAT]: () => h > 1 ? o.uniform1fv(i, u) : o.uniform1f(i, u[0]), [o.FLOAT_VEC2]: () => o.uniform2fv(i, u), [o.FLOAT_VEC3]: () => o.uniform3fv(i, u), [o.FLOAT_VEC4]: () => o.uniform4fv(i, u), [o.INT]: () => h > 1 ? o.uniform1iv(i, u) : o.uniform1i(i, u[0]), [o.INT_VEC2]: () => o.uniform2iv(i, u), [o.INT_VEC3]: () => o.uniform3iv(i, u), [o.INT_VEC4]: () => o.uniform4iv(i, u), [o.BOOL]: () => o.uniform1iv(i, u), [o.FLOAT_MAT2]: () => o.uniformMatrix2fv(i, !1, u), [o.FLOAT_MAT3]: () => o.uniformMatrix3fv(i, !1, u), [o.FLOAT_MAT4]: () => o.uniformMatrix4fv(i, !1, u) };
129
- (l = f[s]) == null || l.call(f);
129
+ (l = f[r]) == null || l.call(f);
130
130
  }
131
131
  }
132
132
  H(t) {
@@ -143,13 +143,13 @@ class q {
143
143
  this.A.deleteProgram(this.C);
144
144
  }
145
145
  }
146
- function mt(n, t, e, i) {
146
+ function At(n, t, e, i) {
147
147
  return 180 * Math.atan2(i - t, e - n) / Math.PI;
148
148
  }
149
149
  function Y(n, t, e, i) {
150
150
  return Math.hypot(e - n, i - t);
151
151
  }
152
- function O(n, t, e) {
152
+ function I(n, t, e) {
153
153
  return Math.min(Math.max(n, t), e);
154
154
  }
155
155
  function xt(n) {
@@ -158,18 +158,18 @@ function xt(n) {
158
158
  function Tt(n, t, e) {
159
159
  n.bindTexture(n.TEXTURE_2D, t), n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, 1), n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, e), n.bindTexture(n.TEXTURE_2D, null);
160
160
  }
161
- function pt(n, t, e, i, r) {
162
- n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, t), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, e), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, i), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, r);
161
+ function pt(n, t, e, i, s) {
162
+ n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, t), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, e), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, i), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, s);
163
163
  }
164
- function ft(n, t, e, i, r, s = 0, h = WebGL2RenderingContext.FLOAT, o = !1) {
165
- n.enableVertexAttribArray(t), n.vertexAttribPointer(t, e, h, o, i, r), n.vertexAttribDivisor(t, s);
164
+ function ft(n, t, e, i, s, r = 0, h = WebGL2RenderingContext.FLOAT, o = !1) {
165
+ n.enableVertexAttribArray(t), n.vertexAttribPointer(t, e, h, o, i, s), n.vertexAttribDivisor(t, r);
166
166
  }
167
- function Rt(n, t, e, i, r) {
168
- n.bindBuffer(t, e), n.bufferData(t, i, r), n.bindBuffer(t, null);
167
+ function Rt(n, t, e, i, s) {
168
+ n.bindBuffer(t, e), n.bufferData(t, i, s), n.bindBuffer(t, null);
169
169
  }
170
- const rt = `#version 300 es
171
- in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in vec4 A7;in vec3 A8;in vec3 A9;in vec4 Aa;in vec4 Ab;in vec3 Ac;uniform vec2 Ur;uniform float Us;uniform float Ut;out vec2 v_uv;out vec3 v_glyphIndex;out vec4 v_glyphColor;out vec4 v_cellColor;out vec4 v_glyphFlags;out vec3 v_worldPosition;out vec3 v_normal;out float v_geometryType;const float A=6.28318530718f;const int B=2;const int C=3;const int D=4;vec2 E(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float M=L*K;float N=F*F;float O=N*F;return M*G+3.0f*L*F*H+3.0f*K*N*I+O*J;}vec2 P(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float N=F*F;return-3.0f*L*G+3.0f*(L-2.0f*K*F)*H+3.0f*(2.0f*K*F-N)*I+3.0f*N*J;}vec3 Q(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x,R.y*T-R.z*U,R.y*U+R.z*T);}vec3 V(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T+R.z*U,R.y,-R.x*U+R.z*T);}vec3 W(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T-R.y*U,R.x*U+R.y*T,R.z);}vec3 X(vec3 R,vec3 Y){vec3 Z=R;if(Y.z!=0.0f){Z=W(Z,Y.z);}if(Y.y!=0.0f){Z=V(Z,Y.y);}if(Y.x!=0.0f){Z=Q(Z,Y.x);}return Z;}void main(){v_uv=A1;v_glyphIndex=A4;v_glyphColor=A5;v_cellColor=A6;v_glyphFlags=A7;vec4 a=Aa;vec4 b=Ab;vec2 c=A3;vec2 d=A2;float e=Ac.x;float f=Ac.y;int g=int(Ac.z);vec2 h=d;vec2 i=h+c*0.5f;float j=f+e*0.5f;vec3 k=vec3(i,j);vec3 l;if(g==D){float F=clamp(A0.x,0.0f,1.0f);vec2 G=b.xy;vec2 H=a.xy;vec2 I=a.zw;vec2 J=b.zw;vec2 m=E(F,G,H,I,J);vec2 n=P(F,G,H,I,J);float o=length(n);vec2 p=o>0.0f?n/o:vec2(1.0f,0.0f);vec2 q=vec2(-p.y,p.x);vec2 r=m;vec2 s=r+q*A0.y*c.y;l=vec3(s,f);}else if(g==C){float t=mod(a.x,A);if(t<0.0f){t+=A;}float u=mod(a.y,A);if(u<0.0f){u+=A;}float v=t-u;if(v<=0.0f){v+=A;}float S=t-A0.x*v;vec2 w=vec2(cos(S),sin(S))*A0.y;vec2 s=w*c+h;l=vec3(s,f);}else if(g==B){vec2 s=A0.xy*c+h;l=vec3(s,f);}vec3 x=X(l,A9);vec3 y=x+A8;vec3 z=vec3(0.0f,0.0f,1.0f);v_worldPosition=y;v_normal=z;v_geometryType=float(g);vec2 AA=(y.xy/Ur)*2.0f;AA.y=-AA.y;float AB=y.z/Ur.y;float AC=clamp(-AB*Us,-0.99f,0.99f);if(Ut>0.5f){gl_Position=vec4(AA,AC,1.0f);}else{float AD=0.5f;float AE=1.0f/(1.0f-AB*AD);AA*=AE;gl_Position=vec4(AA,AC,1.0f);}}`, Z = class Z {
172
- constructor(t, e, i = e, r = 1, s = {}, h) {
170
+ const st = `#version 300 es
171
+ in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in vec4 A7;in vec3 A8;in vec3 A9;in vec4 Aa;in vec4 Ab;in vec3 Ac;uniform vec2 Ur;uniform float Us;uniform float Ut;out vec2 v_uv;out vec3 v_glyphIndex;out vec4 v_glyphColor;out vec4 v_cellColor;out vec4 v_glyphFlags;out vec3 v_worldPosition;out vec3 v_normal;out float v_geometryType;const float A=6.28318530718f;const int B=2;const int C=3;const int D=4;vec2 E(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float M=L*K;float N=F*F;float O=N*F;return M*G+3.0f*L*F*H+3.0f*K*N*I+O*J;}vec2 P(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float N=F*F;return-3.0f*L*G+3.0f*(L-2.0f*K*F)*H+3.0f*(2.0f*K*F-N)*I+3.0f*N*J;}vec3 Q(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x,R.y*T-R.z*U,R.y*U+R.z*T);}vec3 V(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T+R.z*U,R.y,-R.x*U+R.z*T);}vec3 W(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T-R.y*U,R.x*U+R.y*T,R.z);}vec3 X(vec3 R,vec3 Y){vec3 Z=R;if(Y.z!=0.0f){Z=W(Z,Y.z);}if(Y.y!=0.0f){Z=V(Z,Y.y);}if(Y.x!=0.0f){Z=Q(Z,Y.x);}return Z;}void main(){v_uv=A1;v_glyphIndex=A4;v_glyphColor=A5;v_cellColor=A6;v_glyphFlags=A7;vec4 a=Aa;vec4 b=Ab;vec2 c=A3;vec2 d=A2;float e=Ac.x;float f=Ac.y;int g=int(Ac.z);vec2 h=d;vec2 i=h+c*0.5f;float j=f+e*0.5f;vec3 k=vec3(i,j);vec3 l;if(g==D){float F=clamp(A0.x,0.0f,1.0f);vec2 G=b.xy;vec2 H=a.xy;vec2 I=a.zw;vec2 J=b.zw;vec2 m=E(F,G,H,I,J);vec2 n=P(F,G,H,I,J);float o=length(n);vec2 p=o>0.0f?n/o:vec2(1.0f,0.0f);vec2 q=vec2(-p.y,p.x);vec2 r=m;vec2 s=r+q*A0.y*c.y;l=vec3(s,f);}else if(g==C){float t=mod(a.x,A);if(t<0.0f){t+=A;}float u=mod(a.y,A);if(u<0.0f){u+=A;}float v=t-u;if(v<=0.0f){v+=A;}float S=t-A0.x*v;vec2 w=vec2(cos(S),sin(S))*A0.y;vec2 s=w*c+h;l=vec3(s,f);}else if(g==B){vec2 s=A0.xy*c+h;l=vec3(s,f);}vec3 x=X(l,A9);vec3 y=x+A8;vec3 z=vec3(0.0f,0.0f,1.0f);v_worldPosition=y;v_normal=z;v_geometryType=float(g);vec2 AA=(y.xy/Ur)*2.0f;AA.y=-AA.y;float AB=y.z/Ur.y;float AC=clamp(-AB*Us,-0.99f,0.99f);if(Ut>0.5f){gl_Position=vec4(AA,AC,1.0f);}else{float AD=0.5f;float AE=1.0f/(1.0f-AB*AD);AA*=AE;gl_Position=vec4(AA,AC,1.0f);}}`, X = class X {
172
+ constructor(t, e, i = e, s = 1, r = {}, h) {
173
173
  a(this, "N");
174
174
  a(this, "X");
175
175
  a(this, "l");
@@ -181,16 +181,16 @@ in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in
181
181
  a(this, "Z");
182
182
  a(this, "q", null);
183
183
  a(this, "V", /* @__PURE__ */ new Map());
184
- this.N = e, this.X = i, this.A = t, this.W = O(r, 1, 8), this.Z = h, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...s }, Z.J || (Z.J = new q(t, rt, `#version 300 es
184
+ this.N = e, this.X = i, this.A = t, this.W = I(s, 1, 8), this.Z = h, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...r }, X.J || (X.J = new q(t, st, `#version 300 es
185
185
  precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uniform sampler2D U2;uniform sampler2D U3;uniform vec2 U4;uniform bool U5;uniform bool U6;uniform bool U7;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){vec2 B=vec2(v_uv.x,1.-v_uv.y);vec2 C=B*U4;vec2 D=(floor(C)+0.5f)/U4;vec4 E=texture(U0,D);vec4 F=U5?texture(U1,D):vec4(0.);if(U5&&F.a==0.){discard;}vec4 G=U6?texture(U2,D):vec4(0.);vec4 H=U7?texture(U3,D):vec4(0.);o_character=E;o_primaryColor=F;o_secondaryColor=G;A=H;}`));
186
186
  const o = t.getParameter(t.MAX_DRAW_BUFFERS), c = t.getParameter(t.MAX_COLOR_ATTACHMENTS);
187
187
  this.W = Math.min(this.W, o, c), this.Y = t.createFramebuffer(), this.tt(), this.st(), this.l.depth && this.it();
188
188
  }
189
189
  tt() {
190
- const t = this.A, e = this.l.filter === "linear" ? t.LINEAR : t.NEAREST, i = this.l.wrap === "repeat" ? t.REPEAT : t.CLAMP_TO_EDGE, r = this.l.type === "float" ? t.FLOAT : t.UNSIGNED_BYTE, s = r === t.FLOAT ? t.RGBA32F : t.RGBA8, h = t.RGBA;
190
+ const t = this.A, e = this.l.filter === "linear" ? t.LINEAR : t.NEAREST, i = this.l.wrap === "repeat" ? t.REPEAT : t.CLAMP_TO_EDGE, s = this.l.type === "float" ? t.FLOAT : t.UNSIGNED_BYTE, r = s === t.FLOAT ? t.RGBA32F : t.RGBA8, h = t.RGBA;
191
191
  for (let o = 0; o < this.W; o++) {
192
192
  const c = t.createTexture();
193
- t.bindTexture(t.TEXTURE_2D, c), pt(t, e, e, i, i), t.texImage2D(t.TEXTURE_2D, 0, s, this.N, this.X, 0, h, r, null), this.j.push(c);
193
+ t.bindTexture(t.TEXTURE_2D, c), pt(t, e, e, i, i), t.texImage2D(t.TEXTURE_2D, 0, r, this.N, this.X, 0, h, s, null), this.j.push(c);
194
194
  }
195
195
  t.bindTexture(t.TEXTURE_2D, null);
196
196
  }
@@ -200,8 +200,8 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
200
200
  else {
201
201
  const e = [];
202
202
  for (let i = 0; i < this.W; i++) {
203
- const r = t.COLOR_ATTACHMENT0 + i;
204
- t.framebufferTexture2D(t.FRAMEBUFFER, r, t.TEXTURE_2D, this.j[i], 0), e.push(r);
203
+ const s = t.COLOR_ATTACHMENT0 + i;
204
+ t.framebufferTexture2D(t.FRAMEBUFFER, s, t.TEXTURE_2D, this.j[i], 0), e.push(s);
205
205
  }
206
206
  t.drawBuffers(e);
207
207
  }
@@ -216,18 +216,18 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
216
216
  }
217
217
  resize(t, e) {
218
218
  this.N = t, this.X = e, this.V.clear();
219
- const i = this.A, r = this.l.type === "float" ? i.FLOAT : i.UNSIGNED_BYTE, s = r === i.FLOAT ? i.RGBA32F : i.RGBA8, h = i.RGBA;
220
- for (const o of this.j) i.bindTexture(i.TEXTURE_2D, o), i.texImage2D(i.TEXTURE_2D, 0, s, this.N, this.X, 0, h, r, null);
219
+ const i = this.A, s = this.l.type === "float" ? i.FLOAT : i.UNSIGNED_BYTE, r = s === i.FLOAT ? i.RGBA32F : i.RGBA8, h = i.RGBA;
220
+ for (const o of this.j) i.bindTexture(i.TEXTURE_2D, o), i.texImage2D(i.TEXTURE_2D, 0, r, this.N, this.X, 0, h, s, null);
221
221
  i.bindTexture(i.TEXTURE_2D, null), this.K && (i.bindRenderbuffer(i.RENDERBUFFER, this.K), i.renderbufferStorage(i.RENDERBUFFER, i.DEPTH_COMPONENT24, this.N, this.X), i.bindRenderbuffer(i.RENDERBUFFER, null));
222
222
  }
223
223
  readPixels(t) {
224
224
  const e = this.V.get(t);
225
225
  if (e) return e;
226
- const i = this.A, r = this.N, s = this.X, h = new Uint8Array(r * s * 4), o = i.getParameter(i.READ_FRAMEBUFFER_BINDING);
227
- i.bindFramebuffer(i.READ_FRAMEBUFFER, this.Y), i.readBuffer(i.COLOR_ATTACHMENT0 + t), i.readPixels(0, 0, r, s, i.RGBA, i.UNSIGNED_BYTE, h), i.bindFramebuffer(i.READ_FRAMEBUFFER, o);
228
- const c = 4 * r, l = new Uint8Array(h.length);
229
- for (let u = 0; u < s; u++) {
230
- const f = (s - 1 - u) * c, d = u * c;
226
+ const i = this.A, s = this.N, r = this.X, h = new Uint8Array(s * r * 4), o = i.getParameter(i.READ_FRAMEBUFFER_BINDING);
227
+ i.bindFramebuffer(i.READ_FRAMEBUFFER, this.Y), i.readBuffer(i.COLOR_ATTACHMENT0 + t), i.readPixels(0, 0, s, r, i.RGBA, i.UNSIGNED_BYTE, h), i.bindFramebuffer(i.READ_FRAMEBUFFER, o);
228
+ const c = 4 * s, l = new Uint8Array(h.length);
229
+ for (let u = 0; u < r; u++) {
230
+ const f = (r - 1 - u) * c, d = u * c;
231
231
  l.set(h.subarray(f, f + c), d);
232
232
  }
233
233
  return this.V.set(t, l), l;
@@ -244,8 +244,8 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
244
244
  }
245
245
  ft() {
246
246
  if (!this.Z) return;
247
- const t = this.W > 1, e = this.W > 2, i = this.W > 3, r = { U0: this.j[0], U1: t ? this.j[1] : this.j[0], U2: e ? this.j[2] : this.j[0], U3: i ? this.j[3] : this.j[0], U4: [this.N, this.X], U5: t, U6: e, U7: i }, s = Z.J;
248
- this.q = this.Z.vt.dt(s, r, !0);
247
+ const t = this.W > 1, e = this.W > 2, i = this.W > 3, s = { U0: this.j[0], U1: t ? this.j[1] : this.j[0], U2: e ? this.j[2] : this.j[0], U3: i ? this.j[3] : this.j[0], U4: [this.N, this.X], U5: t, U6: e, U7: i }, r = X.J;
248
+ this.q = this.Z.vt.dt(r, s, !0);
249
249
  }
250
250
  gt() {
251
251
  const t = this.A;
@@ -266,19 +266,19 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
266
266
  return this.W;
267
267
  }
268
268
  };
269
- a(Z, "J", null);
270
- let X = Z;
271
- const Ct = /* @__PURE__ */ new WeakMap();
269
+ a(X, "J", null);
270
+ let Z = X;
271
+ const Ft = /* @__PURE__ */ new WeakMap();
272
272
  function ht(n, t) {
273
- Ct.set(n, t);
273
+ Ft.set(n, t);
274
274
  }
275
- function Ft(n) {
276
- return Ct.get(n);
275
+ function Ct(n) {
276
+ return Ft.get(n);
277
277
  }
278
- function tt(n, t, e, i, r = 255) {
279
- n[0] = t / 255, n[1] = (e ?? t) / 255, n[2] = (i ?? t) / 255, n[3] = r / 255;
278
+ function tt(n, t, e, i, s = 255) {
279
+ n[0] = t / 255, n[1] = (e ?? t) / 255, n[2] = (i ?? t) / 255, n[3] = s / 255;
280
280
  }
281
- class st {
281
+ class rt {
282
282
  constructor() {
283
283
  a(this, "_t", 1);
284
284
  a(this, "yt", 0);
@@ -300,17 +300,17 @@ class st {
300
300
  a(this, "Dt", []);
301
301
  }
302
302
  static Lt() {
303
- return { Ot: 1, Bt: 0, It: 0, Ht: 0, bt: 0, Ct: 0, xt: 0, Rt: 0, Gt: !1, Qt: !1, Et: !1, zt: !1, Nt: [0, 0, 0], Xt: [1, 1, 1, 1], Yt: [0, 0, 0, 1] };
303
+ return { Ot: 1, It: 0, Bt: 0, Ht: 0, bt: 0, Ct: 0, xt: 0, Rt: 0, Gt: !1, Qt: !1, Et: !1, zt: !1, Nt: [0, 0, 0], Xt: [1, 1, 1, 1], Yt: [0, 0, 0, 1] };
304
304
  }
305
305
  jt(t) {
306
- t.Ot = this._t, t.Bt = this.yt, t.It = this.At, t.Ht = this.wt, t.bt = this.bt, t.Ct = this.Ct, t.xt = this.xt, t.Gt = this.Pt, t.Qt = this.Tt, t.Et = this.Et, t.Rt = this.Rt, t.zt = this.zt, t.Nt[0] = this.Mt[0], t.Nt[1] = this.Mt[1], t.Nt[2] = this.Mt[2], t.Xt[0] = this.Ft[0], t.Xt[1] = this.Ft[1], t.Xt[2] = this.Ft[2], t.Xt[3] = this.Ft[3], t.Yt[0] = this.$t[0], t.Yt[1] = this.$t[1], t.Yt[2] = this.$t[2], t.Yt[3] = this.$t[3];
306
+ t.Ot = this._t, t.It = this.yt, t.Bt = this.At, t.Ht = this.wt, t.bt = this.bt, t.Ct = this.Ct, t.xt = this.xt, t.Gt = this.Pt, t.Qt = this.Tt, t.Et = this.Et, t.Rt = this.Rt, t.zt = this.zt, t.Nt[0] = this.Mt[0], t.Nt[1] = this.Mt[1], t.Nt[2] = this.Mt[2], t.Xt[0] = this.Ft[0], t.Xt[1] = this.Ft[1], t.Xt[2] = this.Ft[2], t.Xt[3] = this.Ft[3], t.Yt[0] = this.$t[0], t.Yt[1] = this.$t[1], t.Yt[2] = this.$t[2], t.Yt[3] = this.$t[3];
307
307
  }
308
308
  Kt(t) {
309
- this._t = t.Ot, this.yt = t.Bt, this.At = t.It, this.wt = t.Ht, this.bt = t.bt, this.Ct = t.Ct, this.xt = t.xt, this.Pt = t.Gt, this.Tt = t.Qt, this.Et = t.Et, this.Rt = t.Rt, this.zt = t.zt, this.Mt[0] = t.Nt[0], this.Mt[1] = t.Nt[1], this.Mt[2] = t.Nt[2], this.Ft[0] = t.Xt[0], this.Ft[1] = t.Xt[1], this.Ft[2] = t.Xt[2], this.Ft[3] = t.Xt[3], this.$t[0] = t.Yt[0], this.$t[1] = t.Yt[1], this.$t[2] = t.Yt[2], this.$t[3] = t.Yt[3];
309
+ this._t = t.Ot, this.yt = t.It, this.At = t.Bt, this.wt = t.Ht, this.bt = t.bt, this.Ct = t.Ct, this.xt = t.xt, this.Pt = t.Gt, this.Tt = t.Qt, this.Et = t.Et, this.Rt = t.Rt, this.zt = t.zt, this.Mt[0] = t.Nt[0], this.Mt[1] = t.Nt[1], this.Mt[2] = t.Nt[2], this.Ft[0] = t.Xt[0], this.Ft[1] = t.Xt[1], this.Ft[2] = t.Xt[2], this.Ft[3] = t.Xt[3], this.$t[0] = t.Yt[0], this.$t[1] = t.Yt[1], this.$t[2] = t.Yt[2], this.$t[3] = t.Yt[3];
310
310
  }
311
311
  ot() {
312
312
  let t = this.Dt.pop();
313
- t || (t = st.Lt()), this.jt(t), this.kt.push(t);
313
+ t || (t = rt.Lt()), this.jt(t), this.kt.push(t);
314
314
  }
315
315
  ht() {
316
316
  const t = this.kt.pop();
@@ -349,11 +349,11 @@ class st {
349
349
  hs(t) {
350
350
  this.Mt[0] = t[0], this.Mt[1] = t[1], this.Mt[2] = t[2];
351
351
  }
352
- cs(t, e, i, r = 255) {
353
- tt(this.Ft, t, e, i, r);
352
+ cs(t, e, i, s = 255) {
353
+ tt(this.Ft, t, e, i, s);
354
354
  }
355
- ls(t, e, i, r = 255) {
356
- tt(this.$t, t, e, i, r);
355
+ ls(t, e, i, s = 255) {
356
+ tt(this.$t, t, e, i, s);
357
357
  }
358
358
  us(t) {
359
359
  this.Pt = t;
@@ -367,8 +367,8 @@ class st {
367
367
  vs(t) {
368
368
  this.Rt = xt(t);
369
369
  }
370
- ps(t, e, i, r) {
371
- tt(this.St, t, e, i, r);
370
+ ps(t, e, i, s) {
371
+ tt(this.St, t, e, i, s);
372
372
  }
373
373
  gs(t) {
374
374
  this.zt = t;
@@ -397,13 +397,13 @@ class te {
397
397
  a(this, "Fs");
398
398
  this.A = t, this.Ms = t.createBuffer(), this.Fs = new Float32Array(dt.length);
399
399
  }
400
- $s(t, e, i, r) {
401
- const s = this.A, h = Ft(this.A), o = h[2], c = h[3], l = t / o * 2 - 1, u = (t + i) / o * 2 - 1, f = 1 - (e + r) / c * 2, d = 1 - e / c * 2, g = dt, p = this.Fs;
400
+ $s(t, e, i, s) {
401
+ const r = this.A, h = Ct(this.A), o = h[2], c = h[3], l = t / o * 2 - 1, u = (t + i) / o * 2 - 1, f = 1 - (e + s) / c * 2, d = 1 - e / c * 2, g = dt, p = this.Fs;
402
402
  for (let v = 0; v < g.length; v += 4) {
403
- const A = g[v], m = g[v + 1], b = g[v + 2], y = g[v + 3], x = l + (A + 0.5) * (u - l), E = f + (m + 0.5) * (d - f);
403
+ const m = g[v], A = g[v + 1], b = g[v + 2], y = g[v + 3], x = l + (m + 0.5) * (u - l), E = f + (A + 0.5) * (d - f);
404
404
  p[v] = x, p[v + 1] = E, p[v + 2] = b, p[v + 3] = y;
405
405
  }
406
- s.bindBuffer(s.ARRAY_BUFFER, this.Ms), s.bufferData(s.ARRAY_BUFFER, p, s.DYNAMIC_DRAW), s.enableVertexAttribArray(0), s.vertexAttribPointer(0, 2, s.FLOAT, !1, 16, 0), s.enableVertexAttribArray(1), s.vertexAttribPointer(1, 2, s.FLOAT, !1, 16, 8), s.drawArrays(s.TRIANGLES, 0, 6), s.disableVertexAttribArray(1), s.disableVertexAttribArray(0), s.bindBuffer(s.ARRAY_BUFFER, null);
406
+ r.bindBuffer(r.ARRAY_BUFFER, this.Ms), r.bufferData(r.ARRAY_BUFFER, p, r.DYNAMIC_DRAW), r.enableVertexAttribArray(0), r.vertexAttribPointer(0, 2, r.FLOAT, !1, 16, 0), r.enableVertexAttribArray(1), r.vertexAttribPointer(1, 2, r.FLOAT, !1, 16, 8), r.drawArrays(r.TRIANGLES, 0, 6), r.disableVertexAttribArray(1), r.disableVertexAttribArray(0), r.bindBuffer(r.ARRAY_BUFFER, null);
407
407
  }
408
408
  gt() {
409
409
  this.A.deleteBuffer(this.Ms);
@@ -417,19 +417,19 @@ class ie {
417
417
  a(this, "Ps", /* @__PURE__ */ new Map());
418
418
  this.A = t;
419
419
  }
420
- Ts(t, e, i, r) {
421
- const s = this.A;
420
+ Ts(t, e, i, s) {
421
+ const r = this.A;
422
422
  let h = this.Ps.get(t);
423
423
  h || (h = /* @__PURE__ */ new Map(), this.Ps.set(t, h));
424
424
  let o = h.get(e) || null;
425
425
  if (!o) {
426
- o = s.createVertexArray(), h.set(e, o), s.bindVertexArray(o), s.bindBuffer(s.ARRAY_BUFFER, r);
427
- const c = s.getAttribLocation(t, "A0");
428
- c !== -1 && ft(s, c, i.ws.bs.size, i._s, i.ws.bs.offset, 0, s.FLOAT, !1);
429
- const l = s.getAttribLocation(t, "A1");
430
- l !== -1 && ft(s, l, i.ws.Cs.size, i._s, i.ws.Cs.offset, 0, s.FLOAT, !1);
426
+ o = r.createVertexArray(), h.set(e, o), r.bindVertexArray(o), r.bindBuffer(r.ARRAY_BUFFER, s);
427
+ const c = r.getAttribLocation(t, "A0");
428
+ c !== -1 && ft(r, c, i.ws.bs.size, i._s, i.ws.bs.offset, 0, r.FLOAT, !1);
429
+ const l = r.getAttribLocation(t, "A1");
430
+ l !== -1 && ft(r, l, i.ws.Cs.size, i._s, i.ws.Cs.offset, 0, r.FLOAT, !1);
431
431
  }
432
- s.bindVertexArray(o);
432
+ r.bindVertexArray(o);
433
433
  }
434
434
  Es() {
435
435
  this.A.bindVertexArray(null);
@@ -438,34 +438,34 @@ class ie {
438
438
  for (const [, t] of this.Ps) for (const [, e] of t) e && this.A.deleteVertexArray(e);
439
439
  }
440
440
  }
441
- const D = class D {
441
+ const _ = class _ {
442
442
  static Rs(t, e, i = 0) {
443
- const r = e || new Float32Array(D.FLOATS_PER_INSTANCE);
444
- let s = i;
445
- r[s++] = t.bs[0], r[s++] = t.bs[1], r[s++] = t.Ss[0], r[s++] = t.Ss[1], r[s++] = t.Nt[0], r[s++] = t.Nt[1], r[s++] = t.Nt[2], r[s++] = t.Xt[0], r[s++] = t.Xt[1], r[s++] = t.Xt[2], r[s++] = t.Xt[3], r[s++] = t.Yt[0], r[s++] = t.Yt[1], r[s++] = t.Yt[2], r[s++] = t.Yt[3], r[s++] = t.zs[0], r[s++] = t.zs[1], r[s++] = t.zs[2], r[s++] = t.Rt;
443
+ const s = e || new Float32Array(_.FLOATS_PER_INSTANCE);
444
+ let r = i;
445
+ s[r++] = t.bs[0], s[r++] = t.bs[1], s[r++] = t.Ss[0], s[r++] = t.Ss[1], s[r++] = t.Nt[0], s[r++] = t.Nt[1], s[r++] = t.Nt[2], s[r++] = t.Xt[0], s[r++] = t.Xt[1], s[r++] = t.Xt[2], s[r++] = t.Xt[3], s[r++] = t.Yt[0], s[r++] = t.Yt[1], s[r++] = t.Yt[2], s[r++] = t.Yt[3], s[r++] = t.zs[0], s[r++] = t.zs[1], s[r++] = t.zs[2], s[r++] = t.Rt;
446
446
  const h = t.ks;
447
- r[s++] = (h == null ? void 0 : h[0]) ?? 0, r[s++] = (h == null ? void 0 : h[1]) ?? 0, r[s++] = (h == null ? void 0 : h[2]) ?? 0;
447
+ s[r++] = (h == null ? void 0 : h[0]) ?? 0, s[r++] = (h == null ? void 0 : h[1]) ?? 0, s[r++] = (h == null ? void 0 : h[2]) ?? 0;
448
448
  const o = t.Ds;
449
- r[s++] = (o == null ? void 0 : o[0]) ?? 0, r[s++] = (o == null ? void 0 : o[1]) ?? 0, r[s++] = (o == null ? void 0 : o[2]) ?? 0;
450
- const c = t.Ls, l = t.Os, u = t.Bs, f = t.Is, d = t.Hs, g = !(!l || !u);
451
- return g ? (r[s++] = (f == null ? void 0 : f[0]) ?? 0, r[s++] = (f == null ? void 0 : f[1]) ?? 0, r[s++] = (d == null ? void 0 : d[0]) ?? 0, r[s++] = (d == null ? void 0 : d[1]) ?? 0, r[s++] = l[0], r[s++] = l[1], r[s++] = u[0], r[s++] = u[1]) : !g && !!c ? (r[s++] = c[0], r[s++] = c[1], r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0) : (r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0), r[s++] = t.Gs ?? 0, r[s++] = t.Qs ?? 0, r[s++] = t.Ns ?? 0, r;
449
+ s[r++] = (o == null ? void 0 : o[0]) ?? 0, s[r++] = (o == null ? void 0 : o[1]) ?? 0, s[r++] = (o == null ? void 0 : o[2]) ?? 0;
450
+ const c = t.Ls, l = t.Os, u = t.Is, f = t.Bs, d = t.Hs, g = !(!l || !u);
451
+ return g ? (s[r++] = (f == null ? void 0 : f[0]) ?? 0, s[r++] = (f == null ? void 0 : f[1]) ?? 0, s[r++] = (d == null ? void 0 : d[0]) ?? 0, s[r++] = (d == null ? void 0 : d[1]) ?? 0, s[r++] = l[0], s[r++] = l[1], s[r++] = u[0], s[r++] = u[1]) : !g && !!c ? (s[r++] = c[0], s[r++] = c[1], s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0) : (s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0), s[r++] = t.Gs ?? 0, s[r++] = t.Qs ?? 0, s[r++] = t.Ns ?? 0, s;
452
452
  }
453
453
  static Xs(t, e) {
454
- const i = t.length * D.FLOATS_PER_INSTANCE, r = e || new Float32Array(i);
455
- for (let s = 0; s < t.length; s++) {
456
- const h = s * D.FLOATS_PER_INSTANCE;
457
- D.Rs(t[s], r, h);
454
+ const i = t.length * _.FLOATS_PER_INSTANCE, s = e || new Float32Array(i);
455
+ for (let r = 0; r < t.length; r++) {
456
+ const h = r * _.FLOATS_PER_INSTANCE;
457
+ _.Rs(t[r], s, h);
458
458
  }
459
- return r;
459
+ return s;
460
460
  }
461
461
  };
462
- a(D, "BYTES_PER_INSTANCE", 144), a(D, "FLOATS_PER_INSTANCE", 36);
463
- let N = D;
462
+ a(_, "BYTES_PER_INSTANCE", 144), a(_, "FLOATS_PER_INSTANCE", 36);
463
+ let B = _;
464
464
  const M = class M {
465
465
  };
466
- a(M, "STRIDE", N.BYTES_PER_INSTANCE), a(M, "ATTRIBUTES", { A2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 0, divisor: 1 }, A3: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 8, divisor: 1 }, A4: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 16, divisor: 1 }, A5: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 28, divisor: 1 }, A6: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 44, divisor: 1 }, A7: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 60, divisor: 1 }, A8: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 76, divisor: 1 }, A9: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 88, divisor: 1 }, Aa: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 100, divisor: 1 }, Ab: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 116, divisor: 1 }, Ac: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 132, divisor: 1 } });
466
+ a(M, "STRIDE", B.BYTES_PER_INSTANCE), a(M, "ATTRIBUTES", { A2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 0, divisor: 1 }, A3: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 8, divisor: 1 }, A4: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 16, divisor: 1 }, A5: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 28, divisor: 1 }, A6: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 44, divisor: 1 }, A7: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 60, divisor: 1 }, A8: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 76, divisor: 1 }, A9: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 88, divisor: 1 }, Aa: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 100, divisor: 1 }, Ab: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 116, divisor: 1 }, Ac: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: M.STRIDE, offset: 132, divisor: 1 } });
467
467
  let W = M;
468
- class re {
468
+ class se {
469
469
  constructor(t = 1e3, e = 1.5) {
470
470
  a(this, "Ys");
471
471
  a(this, "js");
@@ -473,15 +473,15 @@ class re {
473
473
  a(this, "Ws", 0);
474
474
  a(this, "Zs", 0);
475
475
  this.js = t, this.Ks = e;
476
- const i = t * N.FLOATS_PER_INSTANCE;
476
+ const i = t * B.FLOATS_PER_INSTANCE;
477
477
  this.Ys = new Float32Array(i);
478
478
  }
479
479
  qs(t) {
480
480
  if (t <= this.js) return;
481
481
  const e = Math.ceil(t * this.Ks), i = this.js;
482
482
  this.js = e;
483
- const r = e * N.FLOATS_PER_INSTANCE, s = new Float32Array(r), h = i * N.FLOATS_PER_INSTANCE;
484
- s.set(this.Ys.subarray(0, Math.min(h, this.Ws))), this.Ys = s;
483
+ const s = e * B.FLOATS_PER_INSTANCE, r = new Float32Array(s), h = i * B.FLOATS_PER_INSTANCE;
484
+ r.set(this.Ys.subarray(0, Math.min(h, this.Ws))), this.Ys = r;
485
485
  }
486
486
  Vs() {
487
487
  return { buffer: this.Ys, offset: this.Ws };
@@ -508,7 +508,7 @@ class re {
508
508
  return this.Zs === 0;
509
509
  }
510
510
  }
511
- class se {
511
+ class re {
512
512
  constructor(t) {
513
513
  a(this, "Ys");
514
514
  this.Ys = t;
@@ -517,8 +517,8 @@ class se {
517
517
  this.Ys.qs(this.Ys.ii + 1);
518
518
  const { buffer: e, offset: i } = this.Ys.Vs();
519
519
  e[i + 0] = t.x, e[i + 1] = t.y, e[i + 2] = t.width, e[i + 3] = t.height, e[i + 4] = t.char0, e[i + 5] = t.char1, e[i + 6] = t.char2, e[i + 7] = t.r1, e[i + 8] = t.g1, e[i + 9] = t.b1, e[i + 10] = t.a1, e[i + 11] = t.r2, e[i + 12] = t.g2, e[i + 13] = t.b2, e[i + 14] = t.a2, e[i + 15] = t.invert, e[i + 16] = t.flipX, e[i + 17] = t.flipY, e[i + 18] = t.charRot, e[i + 19] = t.translationX, e[i + 20] = t.translationY, e[i + 21] = t.translationZ, e[i + 22] = t.rotationX, e[i + 23] = t.rotationY, e[i + 24] = t.rotationZ;
520
- const r = t.curveParams0, s = t.curveParams1;
521
- return e[i + 25] = r[0], e[i + 26] = r[1], e[i + 27] = r[2], e[i + 28] = r[3], e[i + 29] = s[0], e[i + 30] = s[1], e[i + 31] = s[2], e[i + 32] = s[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Ys.Js(N.FLOATS_PER_INSTANCE), this.Ys.ii - 1;
520
+ const s = t.curveParams0, r = t.curveParams1;
521
+ return e[i + 25] = s[0], e[i + 26] = s[1], e[i + 27] = s[2], e[i + 28] = s[3], e[i + 29] = r[0], e[i + 30] = r[1], e[i + 31] = r[2], e[i + 32] = r[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Ys.Js(B.FLOATS_PER_INSTANCE), this.Ys.ii - 1;
522
522
  }
523
523
  get ii() {
524
524
  return this.Ys.ii;
@@ -535,7 +535,7 @@ class ne {
535
535
  li(t) {
536
536
  const e = this.A;
537
537
  this.hi && e.deleteBuffer(this.hi), this.hi = e.createBuffer();
538
- const i = t * N.BYTES_PER_INSTANCE;
538
+ const i = t * B.BYTES_PER_INSTANCE;
539
539
  Rt(e, e.ARRAY_BUFFER, this.hi, i, e.DYNAMIC_DRAW), this.ai = t;
540
540
  }
541
541
  ui(t) {
@@ -548,33 +548,33 @@ class ne {
548
548
  if (e === 0) return;
549
549
  const i = this.A;
550
550
  i.bindBuffer(i.ARRAY_BUFFER, this.hi);
551
- const r = e * N.FLOATS_PER_INSTANCE;
552
- i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, r);
551
+ const s = e * B.FLOATS_PER_INSTANCE;
552
+ i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, s);
553
553
  }
554
554
  di(t) {
555
555
  let e = this.ci.get(t);
556
556
  if (!e) {
557
557
  e = /* @__PURE__ */ new Map();
558
558
  const i = this.A;
559
- for (const r in W.ATTRIBUTES) {
560
- const s = i.getAttribLocation(t, r);
561
- s !== -1 && e.set(r, s);
559
+ for (const s in W.ATTRIBUTES) {
560
+ const r = i.getAttribLocation(t, s);
561
+ r !== -1 && e.set(s, r);
562
562
  }
563
563
  this.ci.set(t, e);
564
564
  }
565
565
  return e;
566
566
  }
567
567
  pi(t) {
568
- const e = this.A, i = t.G, r = this.di(i);
569
- for (const [s, h] of r) {
570
- const o = W.ATTRIBUTES[s];
568
+ const e = this.A, i = t.G, s = this.di(i);
569
+ for (const [r, h] of s) {
570
+ const o = W.ATTRIBUTES[r];
571
571
  o && ft(e, h, o.size, o.stride, o.offset, o.divisor, o.type, o.normalized);
572
572
  }
573
573
  }
574
574
  gi(t) {
575
575
  const e = this.A, i = this.di(t.G);
576
- for (const [r, s] of i)
577
- W.ATTRIBUTES[r] && (e.disableVertexAttribArray(s), e.vertexAttribDivisor(s, 0));
576
+ for (const [s, r] of i)
577
+ W.ATTRIBUTES[s] && (e.disableVertexAttribArray(r), e.vertexAttribDivisor(r, 0));
578
578
  }
579
579
  gt() {
580
580
  this.hi && (this.A.deleteBuffer(this.hi), this.hi = null), this.ci.clear();
@@ -586,12 +586,12 @@ class he {
586
586
  a(this, "Ys");
587
587
  a(this, "mi");
588
588
  a(this, "_i");
589
- this.A = t, this.Ys = new re(e, i), this.mi = new se(this.Ys), this._i = new ne(t, e);
589
+ this.A = t, this.Ys = new se(e, i), this.mi = new re(this.Ys), this._i = new ne(t, e);
590
590
  }
591
591
  yi(t) {
592
- var r, s, h, o, c, l, u, f, d, g;
592
+ var s, r, h, o, c, l, u, f, d, g;
593
593
  const e = [0, 0, 0, 0], i = [0, 0, 0, 0];
594
- return t.Os && t.Bs ? (e[0] = ((r = t.Is) == null ? void 0 : r[0]) ?? 0, e[1] = ((s = t.Is) == null ? void 0 : s[1]) ?? 0, e[2] = ((h = t.Hs) == null ? void 0 : h[0]) ?? 0, e[3] = ((o = t.Hs) == null ? void 0 : o[1]) ?? 0, i[0] = t.Os[0], i[1] = t.Os[1], i[2] = t.Bs[0], i[3] = t.Bs[1]) : t.Ls && (e[0] = t.Ls[0], e[1] = t.Ls[1]), this.oi({ x: t.bs[0], y: t.bs[1], width: t.Ss[0], height: t.Ss[1], char0: t.Nt[0], char1: t.Nt[1], char2: t.Nt[2], r1: t.Xt[0], g1: t.Xt[1], b1: t.Xt[2], a1: t.Xt[3], r2: t.Yt[0], g2: t.Yt[1], b2: t.Yt[2], a2: t.Yt[3], invert: t.zs[0], flipX: t.zs[1], flipY: t.zs[2], charRot: t.Rt, translationX: ((c = t.ks) == null ? void 0 : c[0]) ?? 0, translationY: ((l = t.ks) == null ? void 0 : l[1]) ?? 0, translationZ: ((u = t.ks) == null ? void 0 : u[2]) ?? 0, rotationX: ((f = t.Ds) == null ? void 0 : f[0]) ?? 0, rotationY: ((d = t.Ds) == null ? void 0 : d[1]) ?? 0, rotationZ: ((g = t.Ds) == null ? void 0 : g[2]) ?? 0, curveParams0: e, curveParams1: i, depth: t.Gs || 0, baseZ: t.Qs || 0, geometryType: t.Ns || 0 });
594
+ return t.Os && t.Is ? (e[0] = ((s = t.Bs) == null ? void 0 : s[0]) ?? 0, e[1] = ((r = t.Bs) == null ? void 0 : r[1]) ?? 0, e[2] = ((h = t.Hs) == null ? void 0 : h[0]) ?? 0, e[3] = ((o = t.Hs) == null ? void 0 : o[1]) ?? 0, i[0] = t.Os[0], i[1] = t.Os[1], i[2] = t.Is[0], i[3] = t.Is[1]) : t.Ls && (e[0] = t.Ls[0], e[1] = t.Ls[1]), this.oi({ x: t.bs[0], y: t.bs[1], width: t.Ss[0], height: t.Ss[1], char0: t.Nt[0], char1: t.Nt[1], char2: t.Nt[2], r1: t.Xt[0], g1: t.Xt[1], b1: t.Xt[2], a1: t.Xt[3], r2: t.Yt[0], g2: t.Yt[1], b2: t.Yt[2], a2: t.Yt[3], invert: t.zs[0], flipX: t.zs[1], flipY: t.zs[2], charRot: t.Rt, translationX: ((c = t.ks) == null ? void 0 : c[0]) ?? 0, translationY: ((l = t.ks) == null ? void 0 : l[1]) ?? 0, translationZ: ((u = t.ks) == null ? void 0 : u[2]) ?? 0, rotationX: ((f = t.Ds) == null ? void 0 : f[0]) ?? 0, rotationY: ((d = t.Ds) == null ? void 0 : d[1]) ?? 0, rotationZ: ((g = t.Ds) == null ? void 0 : g[2]) ?? 0, curveParams0: e, curveParams1: i, depth: t.Gs || 0, baseZ: t.Qs || 0, geometryType: t.Ns || 0 });
595
595
  }
596
596
  oi(t) {
597
597
  const e = this.mi.oi(t);
@@ -623,16 +623,16 @@ class he {
623
623
  this._i.gt();
624
624
  }
625
625
  }
626
- class _ {
627
- constructor(t, e, i, r) {
626
+ class O {
627
+ constructor(t, e, i, s) {
628
628
  a(this, "A");
629
629
  a(this, "bi");
630
630
  a(this, "Ci");
631
631
  a(this, "xi");
632
632
  a(this, "Mi", null);
633
- this.A = t, this.bi = e, this.Ci = i, this.xi = r;
634
- const s = this.A.createBuffer();
635
- Rt(this.A, this.A.ARRAY_BUFFER, s, this.xi.Fi, this.A.STATIC_DRAW), this.Mi = s;
633
+ this.A = t, this.bi = e, this.Ci = i, this.xi = s;
634
+ const r = this.A.createBuffer();
635
+ Rt(this.A, this.A.ARRAY_BUFFER, r, this.xi.Fi, this.A.STATIC_DRAW), this.Mi = r;
636
636
  }
637
637
  get type() {
638
638
  return this.Ci;
@@ -658,17 +658,17 @@ class _ {
658
658
  Ti(t, e, i) {
659
659
  return this.bi.yi(t);
660
660
  }
661
- Ei(t, e, i, r, s, h) {
662
- const o = s.Bt ?? 0, c = s.It ?? 0, l = s.Ht ?? 0, u = s.bt ?? 0, f = s.Ct ?? 0, d = s.xt ?? 0, g = [0, 0, 0, 0], p = [0, 0, 0, 0];
661
+ Ei(t, e, i, s, r, h) {
662
+ const o = r.It ?? 0, c = r.Bt ?? 0, l = r.Ht ?? 0, u = r.bt ?? 0, f = r.Ct ?? 0, d = r.xt ?? 0, g = [0, 0, 0, 0], p = [0, 0, 0, 0];
663
663
  h && (h.bezStartX !== void 0 && h.bezStartY !== void 0 && h.bezEndX !== void 0 && h.bezEndY !== void 0 ? (g[0] = h.cp1x ?? 0, g[1] = h.cp1y ?? 0, g[2] = h.cp2x ?? 0, g[3] = h.cp2y ?? 0, p[0] = h.bezStartX ?? 0, p[1] = h.bezStartY ?? 0, p[2] = h.bezEndX ?? 0, p[3] = h.bezEndY ?? 0) : h.arcStart === void 0 && h.arcStop === void 0 || (g[0] = h.arcStart ?? 0, g[1] = h.arcStop ?? 0));
664
- const v = { x: t, y: e, width: i, height: r, char0: s.Nt[0], char1: s.Nt[1], char2: s.Nt[2], r1: s.Xt[0], g1: s.Xt[1], b1: s.Xt[2], a1: s.Xt[3], r2: s.Yt[0], g2: s.Yt[1], b2: s.Yt[2], a2: s.Yt[3], invert: s.Et ? 1 : 0, flipX: s.Gt ? 1 : 0, flipY: s.Qt ? 1 : 0, charRot: s.Rt, translationX: o, translationY: c, translationZ: l, rotationX: u, rotationY: f, rotationZ: d, curveParams0: g, curveParams1: p, depth: (h == null ? void 0 : h.depth) ?? 0, baseZ: (h == null ? void 0 : h.baseZ) ?? 0, geometryType: ee[this.Ci] ?? 0 };
664
+ const v = { x: t, y: e, width: i, height: s, char0: r.Nt[0], char1: r.Nt[1], char2: r.Nt[2], r1: r.Xt[0], g1: r.Xt[1], b1: r.Xt[2], a1: r.Xt[3], r2: r.Yt[0], g2: r.Yt[1], b2: r.Yt[2], a2: r.Yt[3], invert: r.Et ? 1 : 0, flipX: r.Gt ? 1 : 0, flipY: r.Qt ? 1 : 0, charRot: r.Rt, translationX: o, translationY: c, translationZ: l, rotationX: u, rotationY: f, rotationZ: d, curveParams0: g, curveParams1: p, depth: (h == null ? void 0 : h.depth) ?? 0, baseZ: (h == null ? void 0 : h.baseZ) ?? 0, geometryType: ee[this.Ci] ?? 0 };
665
665
  return this.bi.oi(v);
666
666
  }
667
667
  }
668
668
  const oe = { Fi: dt, Ri: 6, ...k }, ae = { Fi: new Float32Array([0, -0.5, 0, 0, 1, -0.5, 1, 0, 0, 0.5, 0, 1, 0, 0.5, 0, 1, 1, -0.5, 1, 0, 1, 0.5, 1, 1]), Ri: 6, ...k }, ce = { Fi: function(n = 32) {
669
669
  const t = [], e = 2 * Math.PI / n;
670
670
  for (let i = 0; i < n; i++) {
671
- const r = i * e, s = (i + 1) % n * e, h = Math.cos(r), o = Math.sin(r), c = 0.5 * (h + 1), l = 0.5 * (o + 1), u = Math.cos(s), f = Math.sin(s), d = 0.5 * (u + 1), g = 0.5 * (f + 1);
671
+ const s = i * e, r = (i + 1) % n * e, h = Math.cos(s), o = Math.sin(s), c = 0.5 * (h + 1), l = 0.5 * (o + 1), u = Math.cos(r), f = Math.sin(r), d = 0.5 * (u + 1), g = 0.5 * (f + 1);
672
672
  t.push(0, 0, 0.5, 0.5, h, o, c, l, u, f, d, g);
673
673
  }
674
674
  return new Float32Array(t);
@@ -676,41 +676,41 @@ const oe = { Fi: dt, Ri: 6, ...k }, ae = { Fi: new Float32Array([0, -0.5, 0, 0,
676
676
  let le = { Fi: function(n) {
677
677
  const t = [];
678
678
  for (let e = 0; e < n; e++) {
679
- const i = e / n, r = (e + 1) / n;
680
- t.push(i, 0, i, 0, i, 1, i, 1, r, 1, r, 1);
679
+ const i = e / n, s = (e + 1) / n;
680
+ t.push(i, 0, i, 0, i, 1, i, 1, s, 1, s, 1);
681
681
  }
682
682
  return new Float32Array(t);
683
683
  }(32), Ri: 96, ...k };
684
684
  const ue = { Fi: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ri: 3, ...k }, fe = { Fi: function(n = 16) {
685
685
  const t = [];
686
686
  for (let e = 0; e < n; e++) {
687
- const i = e / n, r = (e + 1) / n;
688
- t.push(i, -0.5, i, 0, r, -0.5, r, 0, i, 0.5, i, 1, i, 0.5, i, 1, r, -0.5, r, 0, r, 0.5, r, 1);
687
+ const i = e / n, s = (e + 1) / n;
688
+ t.push(i, -0.5, i, 0, s, -0.5, s, 0, i, 0.5, i, 1, i, 0.5, i, 1, s, -0.5, s, 0, s, 0.5, s, 1);
689
689
  }
690
690
  return new Float32Array(t);
691
- }(16), Ri: 96, ...k }, de = { [w.RECTANGLE]: class extends _ {
691
+ }(16), Ri: 96, ...k }, de = { [w.RECTANGLE]: class extends O {
692
692
  constructor(n, t) {
693
693
  super(n, t, w.RECTANGLE, oe);
694
694
  }
695
695
  yi(n, t) {
696
696
  return this.Ei(0, 0, n.width, n.height, t);
697
697
  }
698
- }, [w.LINE]: class extends _ {
698
+ }, [w.LINE]: class extends O {
699
699
  constructor(n, t) {
700
700
  super(n, t, w.LINE, ae);
701
701
  }
702
702
  yi(n, t) {
703
- const e = n.x2 - n.x1, i = n.y2 - n.y1, r = Math.hypot(e, i), s = Math.atan2(i, e), h = t.Ot || 1, o = n.x1 + e / 2 - r / 2, c = n.y1 + i / 2, l = { ...t, xt: (t.xt || 0) + s };
704
- return this.Ei(o, c, r, h, l);
703
+ const e = n.x2 - n.x1, i = n.y2 - n.y1, s = Math.hypot(e, i), r = Math.atan2(i, e), h = t.Ot || 1, o = n.x1 + e / 2 - s / 2, c = n.y1 + i / 2, l = { ...t, xt: (t.xt || 0) + r };
704
+ return this.Ei(o, c, s, h, l);
705
705
  }
706
- }, [w.ELLIPSE]: class extends _ {
706
+ }, [w.ELLIPSE]: class extends O {
707
707
  constructor(n, t) {
708
708
  super(n, t, w.ELLIPSE, ce);
709
709
  }
710
710
  yi(n, t) {
711
711
  return this.Ei(0, 0, n.width, n.height, t);
712
712
  }
713
- }, [w.ARC]: class extends _ {
713
+ }, [w.ARC]: class extends O {
714
714
  constructor(n, t) {
715
715
  super(n, t, w.ARC, le);
716
716
  }
@@ -718,15 +718,15 @@ const ue = { Fi: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ri:
718
718
  const e = n.start * Math.PI / 180, i = n.stop * Math.PI / 180;
719
719
  return this.Ei(0, 0, n.width, n.height, t, { arcStart: e, arcStop: i });
720
720
  }
721
- }, [w.TRIANGLE]: class extends _ {
721
+ }, [w.TRIANGLE]: class extends O {
722
722
  constructor(n, t) {
723
723
  super(n, t, w.TRIANGLE, ue);
724
724
  }
725
725
  yi(n, t) {
726
- const e = Math.min(n.x1, n.x2, n.x3), i = Math.max(n.x1, n.x2, n.x3), r = Math.min(n.y1, n.y2, n.y3), s = i - e, h = Math.max(n.y1, n.y2, n.y3) - r;
727
- return this.Ei(e, r, s, h, t);
726
+ const e = Math.min(n.x1, n.x2, n.x3), i = Math.max(n.x1, n.x2, n.x3), s = Math.min(n.y1, n.y2, n.y3), r = i - e, h = Math.max(n.y1, n.y2, n.y3) - s;
727
+ return this.Ei(e, s, r, h, t);
728
728
  }
729
- }, [w.BEZIER_CURVE]: class extends _ {
729
+ }, [w.BEZIER_CURVE]: class extends O {
730
730
  constructor(n, t) {
731
731
  super(n, t, w.BEZIER_CURVE, fe);
732
732
  }
@@ -741,8 +741,8 @@ class ge {
741
741
  a(this, "zi");
742
742
  this.A = t, this.zi = new ie(t), this.Si = /* @__PURE__ */ new Map();
743
743
  for (const e of Object.values(w)) {
744
- const i = new he(t), r = new de[e](t, i);
745
- this.Si.set(e, r);
744
+ const i = new he(t), s = new de[e](t, i);
745
+ this.Si.set(e, s);
746
746
  }
747
747
  }
748
748
  ki(t) {
@@ -752,22 +752,22 @@ class ge {
752
752
  }
753
753
  Di(t) {
754
754
  const e = [];
755
- let i = null, r = null, s = null;
756
- for (const h of t) r !== h.material || s !== h.type ? (i && i.length > 0 && e.push({ material: r, type: s, commands: i }), i = [h], r = h.material, s = h.type) : i.push(h);
757
- return i && i.length > 0 && e.push({ material: r, type: s, commands: i }), e;
755
+ let i = null, s = null, r = null;
756
+ for (const h of t) s !== h.material || r !== h.type ? (i && i.length > 0 && e.push({ material: s, type: r, commands: i }), i = [h], s = h.material, r = h.type) : i.push(h);
757
+ return i && i.length > 0 && e.push({ material: s, type: r, commands: i }), e;
758
758
  }
759
759
  Li(t) {
760
- const { material: e, type: i, commands: r } = t, s = this.Si.get(i);
760
+ const { material: e, type: i, commands: s } = t, r = this.Si.get(i);
761
761
  e.shader.D(), e.shader.O(e.uniforms);
762
- const h = Ft(this.A), o = r.length > 0 && r[0].state.zt;
763
- if (e.shader.O({ Uu: h[2] / h[3], Ur: [h[2], h[3]], Us: 1, Ut: o ? 1 : 0 }), s.$i(), r.forEach((c) => {
764
- s.yi(c.params, c.state);
765
- }), s.Pi()) {
766
- const c = s.unitGeometry, l = s.unitBuffer;
762
+ const h = Ct(this.A), o = s.length > 0 && s[0].state.zt;
763
+ if (e.shader.O({ Uu: h[2] / h[3], Ur: [h[2], h[3]], Us: 1, Ut: o ? 1 : 0 }), r.$i(), s.forEach((c) => {
764
+ r.yi(c.params, c.state);
765
+ }), r.Pi()) {
766
+ const c = r.unitGeometry, l = r.unitBuffer;
767
767
  try {
768
- this.zi.Ts(e.shader.G, i + "", c, l), s.batch.pi(e.shader), s.batch.$s(c.As, c.Ri);
768
+ this.zi.Ts(e.shader.G, i + "", c, l), r.batch.pi(e.shader), r.batch.$s(c.As, c.Ri);
769
769
  } finally {
770
- s.batch.gi(e.shader), this.zi.Es(), s.$i();
770
+ r.batch.gi(e.shader), this.zi.Es(), r.$i();
771
771
  }
772
772
  }
773
773
  }
@@ -796,53 +796,53 @@ function G(n, t) {
796
796
  class pe {
797
797
  constructor(t) {
798
798
  a(this, "Oi", 0);
799
- a(this, "Bi");
800
799
  a(this, "Ii");
800
+ a(this, "Bi");
801
801
  a(this, "Hi", /* @__PURE__ */ new Map());
802
- this.Bi = new q(t, rt, `#version 300 es
803
- precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellColor;in vec4 v_glyphFlags;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){int B=int(v_glyphFlags.r>0.5?1:0);int C=int(v_glyphFlags.g>0.5?1:0);int D=int(v_glyphFlags.b>0.5?1:0);float E=float(B|(C<<1)|(D<<2))/255.;o_character=vec4(v_glyphIndex.xy,E,clamp(v_glyphFlags.a,0.,1.));o_primaryColor=vec4(v_glyphColor.rgb,v_glyphColor.a);o_secondaryColor=vec4(v_cellColor.rgb,v_cellColor.a);A=vec4(0.);}`), this.Ii = { id: this.Oi++, shader: this.Bi, uniforms: Object.freeze({}), hash: this.Gi(this.Bi, {}), isBuiltIn: !0 };
802
+ this.Ii = new q(t, st, `#version 300 es
803
+ precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellColor;in vec4 v_glyphFlags;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){int B=int(v_glyphFlags.r>0.5?1:0);int C=int(v_glyphFlags.g>0.5?1:0);int D=int(v_glyphFlags.b>0.5?1:0);float E=float(B|(C<<1)|(D<<2))/255.;o_character=vec4(v_glyphIndex.xy,E,clamp(v_glyphFlags.a,0.,1.));o_primaryColor=vec4(v_glyphColor.rgb,v_glyphColor.a);o_secondaryColor=vec4(v_cellColor.rgb,v_cellColor.a);A=vec4(0.);}`), this.Bi = { id: this.Oi++, shader: this.Ii, uniforms: Object.freeze({}), hash: this.Gi(this.Ii, {}), isBuiltIn: !0 };
804
804
  }
805
805
  get Qi() {
806
- return this.Ii;
806
+ return this.Bi;
807
807
  }
808
808
  dt(t, e = {}, i = !1) {
809
- const r = this.Gi(t, e), s = this.Hi.get(r);
810
- if (s) return s;
811
- const h = { id: this.Oi++, shader: t, uniforms: Object.freeze({ ...e }), hash: r, isBuiltIn: i };
812
- return this.Hi.set(r, h), h;
809
+ const s = this.Gi(t, e), r = this.Hi.get(s);
810
+ if (r) return r;
811
+ const h = { id: this.Oi++, shader: t, uniforms: Object.freeze({ ...e }), hash: s, isBuiltIn: i };
812
+ return this.Hi.set(s, h), h;
813
813
  }
814
814
  Ni(t, e = {}) {
815
815
  return { id: this.Oi++, shader: t, uniforms: Object.freeze({ ...e }), hash: 0, isBuiltIn: !1 };
816
816
  }
817
817
  Gi(t, e) {
818
- const i = bt(t.G), r = function(s, h) {
818
+ const i = bt(t.G), s = function(r, h) {
819
819
  let o = 0;
820
- const c = Object.keys(s).sort();
821
- for (const l of c) o = G(o, Mt(l)), o = G(o, h(s[l]));
820
+ const c = Object.keys(r).sort();
821
+ for (const l of c) o = G(o, Mt(l)), o = G(o, h(r[l]));
822
822
  return o;
823
823
  }(e, this.Xi.bind(this));
824
- return G(i, r);
824
+ return G(i, s);
825
825
  }
826
826
  Xi(t) {
827
827
  return typeof t == "number" || typeof t == "boolean" ? function(e) {
828
828
  return typeof e == "boolean" ? e ? 1 : 0 : Math.floor(e);
829
829
  }(t) : Array.isArray(t) ? function(e) {
830
830
  let i = 0;
831
- const r = Array.isArray(e[0]) ? e.flat() : e;
832
- for (const s of r) i = G(i, typeof s == "number" ? s : 0);
831
+ const s = Array.isArray(e[0]) ? e.flat() : e;
832
+ for (const r of s) i = G(i, typeof r == "number" ? r : 0);
833
833
  return i;
834
834
  }(t) : t instanceof Float32Array || t instanceof Int32Array ? function(e) {
835
835
  let i = 0;
836
- const r = Math.min(e.length, 16);
837
- for (let s = 0; s < r; s++) i = G(i, e[s]);
836
+ const s = Math.min(e.length, 16);
837
+ for (let r = 0; r < s; r++) i = G(i, e[r]);
838
838
  return i;
839
839
  }(t) : t instanceof WebGLTexture ? bt(t) : 0;
840
840
  }
841
841
  gt() {
842
- this.Bi != this.Bi && this.Bi.dispose(), this.Bi.dispose(), this.Hi.clear();
842
+ this.Ii != this.Ii && this.Ii.dispose(), this.Ii.dispose(), this.Hi.clear();
843
843
  }
844
844
  }
845
- class Ae {
845
+ class me {
846
846
  constructor() {
847
847
  a(this, "Yi", []);
848
848
  a(this, "ji", 1);
@@ -850,35 +850,35 @@ class Ae {
850
850
  }
851
851
  Ki(t, e) {
852
852
  if (this.Ss >= this.Yi.length) {
853
- const r = { id: this.ji++, type: t, params: {}, state: st.Lt(), material: e };
854
- this.Yi.push(r);
853
+ const s = { id: this.ji++, type: t, params: {}, state: rt.Lt(), material: e };
854
+ this.Yi.push(s);
855
855
  }
856
856
  const i = this.Yi[this.Ss];
857
857
  return i.id = this.ji++, i.type = t, i.material = e, this.Ss++, i;
858
858
  }
859
859
  Wi(t, e, i) {
860
- const r = this.Ki(w.RECTANGLE, i), s = r.params;
861
- return s.width = t.width, s.height = t.height, e.Wt(r.state), r.id;
860
+ const s = this.Ki(w.RECTANGLE, i), r = s.params;
861
+ return r.width = t.width, r.height = t.height, e.Wt(s.state), s.id;
862
862
  }
863
863
  Zi(t, e, i) {
864
- const r = this.Ki(w.LINE, i), s = r.params;
865
- return s.x1 = t.x1, s.y1 = t.y1, s.x2 = t.x2, s.y2 = t.y2, s.thickness = t.thickness, e.Wt(r.state), r.id;
864
+ const s = this.Ki(w.LINE, i), r = s.params;
865
+ return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, e.Wt(s.state), s.id;
866
866
  }
867
867
  qi(t, e, i) {
868
- const r = this.Ki(w.ELLIPSE, i), s = r.params;
869
- return s.width = t.width, s.height = t.height, s.startAngle = t.startAngle, s.endAngle = t.endAngle, s.segments = t.segments, e.Wt(r.state), r.id;
868
+ const s = this.Ki(w.ELLIPSE, i), r = s.params;
869
+ return r.width = t.width, r.height = t.height, r.startAngle = t.startAngle, r.endAngle = t.endAngle, r.segments = t.segments, e.Wt(s.state), s.id;
870
870
  }
871
871
  Vi(t, e, i) {
872
- const r = this.Ki(w.ARC, i), s = r.params;
873
- return s.width = t.width, s.height = t.height, s.start = t.start, s.stop = t.stop, e.Wt(r.state), r.id;
872
+ const s = this.Ki(w.ARC, i), r = s.params;
873
+ return r.width = t.width, r.height = t.height, r.start = t.start, r.stop = t.stop, e.Wt(s.state), s.id;
874
874
  }
875
875
  Ji(t, e, i) {
876
- const r = this.Ki(w.TRIANGLE, i), s = r.params;
877
- return s.x1 = t.x1, s.y1 = t.y1, s.x2 = t.x2, s.y2 = t.y2, s.x3 = t.x3, s.y3 = t.y3, e.Wt(r.state), r.id;
876
+ const s = this.Ki(w.TRIANGLE, i), r = s.params;
877
+ return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.x3 = t.x3, r.y3 = t.y3, e.Wt(s.state), s.id;
878
878
  }
879
879
  te(t, e, i) {
880
- const r = this.Ki(w.BEZIER_CURVE, i), s = r.params;
881
- return s.x1 = t.x1, s.y1 = t.y1, s.cp1x = t.cp1x, s.cp1y = t.cp1y, s.cp2x = t.cp2x, s.cp2y = t.cp2y, s.x2 = t.x2, s.y2 = t.y2, s.thickness = t.thickness, s.segments = t.segments, e.Wt(r.state), r.id;
880
+ const s = this.Ki(w.BEZIER_CURVE, i), r = s.params;
881
+ return r.x1 = t.x1, r.y1 = t.y1, r.cp1x = t.cp1x, r.cp1y = t.cp1y, r.cp2x = t.cp2x, r.cp2y = t.cp2y, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, r.segments = t.segments, e.Wt(s.state), s.id;
882
882
  }
883
883
  wi() {
884
884
  this.Ss = 0;
@@ -889,7 +889,7 @@ class Ae {
889
889
  return { next: () => t < e ? { value: i[t++], done: !1 } : { value: void 0, done: !0 } };
890
890
  }
891
891
  }
892
- class me {
892
+ class Ae {
893
893
  constructor(t) {
894
894
  a(this, "A");
895
895
  a(this, "se", null);
@@ -906,7 +906,7 @@ class me {
906
906
  a(this, "ue", null);
907
907
  a(this, "fe", [0, 0, 0, 0]);
908
908
  a(this, "de", 1);
909
- this.A = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.ee = new st(), this.vt = new pe(t), this.re = new Ae(), this.ie = new ge(t), this.ne = new te(t);
909
+ this.A = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.ee = new rt(), this.vt = new pe(t), this.re = new me(), this.ie = new ge(t), this.ne = new te(t);
910
910
  const e = [0, 0, t.canvas.width, t.canvas.height];
911
911
  ht(t, e), this.ae.push(null), this.ce.push(e), this.le.push(1), this.ue = null, this.fe = e, this.de = 1;
912
912
  }
@@ -917,11 +917,11 @@ class me {
917
917
  const t = this.ae.pop() ?? null, e = this.ce.pop() ?? [0, 0, this.A.canvas.width, this.A.canvas.height], i = this.le.pop() ?? 1;
918
918
  this.nt(t, e[2], e[3], i);
919
919
  }
920
- nt(t, e, i, r = 1) {
921
- const s = this.A;
922
- this.ue !== t && (s.bindFramebuffer(s.FRAMEBUFFER, t), this.ue = t), this.de = r;
920
+ nt(t, e, i, s = 1) {
921
+ const r = this.A;
922
+ this.ue !== t && (r.bindFramebuffer(r.FRAMEBUFFER, t), this.ue = t), this.de = s;
923
923
  const h = [0, 0, e, i];
924
- this.fe[0] === h[0] && this.fe[1] === h[1] && this.fe[2] === h[2] && this.fe[3] === h[3] || (s.viewport(...h), ht(s, h), this.fe = h);
924
+ this.fe[0] === h[0] && this.fe[1] === h[1] && this.fe[2] === h[2] && this.fe[3] === h[3] || (r.viewport(...h), ht(r, h), this.fe = h);
925
925
  }
926
926
  ve(t) {
927
927
  this.se !== t && (this.se = t, t.D());
@@ -939,13 +939,13 @@ class me {
939
939
  Object.assign(this.he, t);
940
940
  }
941
941
  _e(t) {
942
- return new q(this.A, rt, t);
942
+ return new q(this.A, st, t);
943
943
  }
944
- ye(t, e, i, r) {
945
- t instanceof X || !r || t.Ae(r), this.re.Wi({ width: e ?? t.width, height: i ?? t.height }, this.ee, t.ut());
944
+ ye(t, e, i, s) {
945
+ t instanceof Z || !s || t.Ae(s), this.re.Wi({ width: e ?? t.width, height: i ?? t.height }, this.ee, t.ut());
946
946
  }
947
- we(t, e, i, r) {
948
- this.ne.$s(t, e, i, r);
947
+ we(t, e, i, s) {
948
+ this.ne.$s(t, e, i, s);
949
949
  }
950
950
  be(t, e) {
951
951
  if (this.oe) {
@@ -953,39 +953,39 @@ class me {
953
953
  this.re.Wi({ width: t, height: e }, this.ee, i), this.oe = null, this.he = {};
954
954
  } else this.re.Wi({ width: t, height: e }, this.ee, this.vt.Qi);
955
955
  }
956
- Ce(t, e, i, r) {
957
- this.re.Zi({ x1: t, y1: e, x2: i, y2: r }, this.ee, this.vt.Qi);
956
+ Ce(t, e, i, s) {
957
+ this.re.Zi({ x1: t, y1: e, x2: i, y2: s }, this.ee, this.vt.Qi);
958
958
  }
959
959
  xe(t, e) {
960
960
  this.re.qi({ width: t, height: e }, this.ee, this.vt.Qi);
961
961
  }
962
- Me(t, e, i, r, s, h) {
963
- this.re.Ji({ x1: t, y1: e, x2: i, y2: r, x3: s, y3: h }, this.ee, this.vt.Qi);
962
+ Me(t, e, i, s, r, h) {
963
+ this.re.Ji({ x1: t, y1: e, x2: i, y2: s, x3: r, y3: h }, this.ee, this.vt.Qi);
964
964
  }
965
- Fe(t, e, i, r, s, h, o, c) {
966
- this.re.te({ x1: t, y1: e, cp1x: i, cp1y: r, cp2x: s, cp2y: h, x2: o, y2: c }, this.ee, this.vt.Qi);
965
+ Fe(t, e, i, s, r, h, o, c) {
966
+ this.re.te({ x1: t, y1: e, cp1x: i, cp1y: s, cp2x: r, cp2y: h, x2: o, y2: c }, this.ee, this.vt.Qi);
967
967
  }
968
- $e(t, e, i, r) {
969
- this.re.Vi({ width: t, height: e, start: i, stop: r }, this.ee, this.vt.Qi);
968
+ $e(t, e, i, s) {
969
+ this.re.Vi({ width: t, height: e, start: i, stop: s }, this.ee, this.vt.Qi);
970
970
  }
971
- Pe(t, e, i = 1, r = {}) {
972
- return new X(this.A, t, e, i, r, this);
971
+ Pe(t, e, i = 1, s = {}) {
972
+ return new Z(this.A, t, e, i, s, this);
973
973
  }
974
- Te(t, e = t, i = t, r = 255) {
975
- this.ee.ps(t, e ?? t, i ?? t, r);
976
- const [s, h, o, c] = this.ee.canvasBackgroundColor;
977
- this.Ee(s, h, o, c, !1);
974
+ Te(t, e = t, i = t, s = 255) {
975
+ this.ee.ps(t, e ?? t, i ?? t, s);
976
+ const [r, h, o, c] = this.ee.canvasBackgroundColor;
977
+ this.Ee(r, h, o, c, !1);
978
978
  }
979
- wi(t = 0, e = 0, i = 0, r = 0) {
980
- this.Ee(t, e, i, r, !0);
979
+ wi(t = 0, e = 0, i = 0, s = 0) {
980
+ this.Ee(t, e, i, s, !0);
981
981
  }
982
- Ee(t, e, i, r, s) {
982
+ Ee(t, e, i, s, r) {
983
983
  const h = this.A;
984
984
  if (this.de > 1) {
985
- const o = s ? [1, 1, 0, 0] : [0, 0, 0, 0];
986
- h.clearBufferfv(h.COLOR, 0, new Float32Array(o)), h.clearBufferfv(h.COLOR, 1, new Float32Array([0, 0, 0, 0])), this.de >= 3 && h.clearBufferfv(h.COLOR, 2, new Float32Array([t, e, i, r]));
985
+ const o = r ? [1, 1, 0, 0] : [0, 0, 0, 0];
986
+ h.clearBufferfv(h.COLOR, 0, new Float32Array(o)), h.clearBufferfv(h.COLOR, 1, new Float32Array([0, 0, 0, 0])), this.de >= 3 && h.clearBufferfv(h.COLOR, 2, new Float32Array([t, e, i, s]));
987
987
  for (let c = 3; c < this.de; c++) h.clearBufferfv(h.COLOR, c, new Float32Array([0, 0, 0, 0]));
988
- } else h.clearColor(t, e, i, r), h.clear(h.COLOR_BUFFER_BIT);
988
+ } else h.clearColor(t, e, i, s), h.clear(h.COLOR_BUFFER_BIT);
989
989
  }
990
990
  Re() {
991
991
  const t = [0, 0, this.A.canvas.width, this.A.canvas.height];
@@ -1010,26 +1010,26 @@ class me {
1010
1010
  }
1011
1011
  const R = { readShort: (n, t) => (R.t.uint16[0] = n[t] << 8 | n[t + 1], R.t.int16[0]), readUshort: (n, t) => n[t] << 8 | n[t + 1], readUshorts(n, t, e) {
1012
1012
  const i = [];
1013
- for (let r = 0; r < e; r++) i.push(R.readUshort(n, t + 2 * r));
1013
+ for (let s = 0; s < e; s++) i.push(R.readUshort(n, t + 2 * s));
1014
1014
  return i;
1015
1015
  }, readUint(n, t) {
1016
1016
  const e = R.t.uint8;
1017
1017
  return e[3] = n[t], e[2] = n[t + 1], e[1] = n[t + 2], e[0] = n[t + 3], R.t.uint32[0];
1018
1018
  }, readASCII(n, t, e) {
1019
1019
  let i = "";
1020
- for (let r = 0; r < e; r++) i += String.fromCharCode(n[t + r]);
1020
+ for (let s = 0; s < e; s++) i += String.fromCharCode(n[t + s]);
1021
1021
  return i;
1022
1022
  }, t: (() => {
1023
1023
  const n = new ArrayBuffer(8);
1024
1024
  return { uint8: new Uint8Array(n), int16: new Int16Array(n), uint16: new Uint16Array(n), uint32: new Uint32Array(n) };
1025
1025
  })() };
1026
- function K(n) {
1026
+ function V(n) {
1027
1027
  return n + 3 & -4;
1028
1028
  }
1029
1029
  function J(n, t, e) {
1030
1030
  n[t] = e >>> 8 & 255, n[t + 1] = 255 & e;
1031
1031
  }
1032
- function B(n, t, e) {
1032
+ function N(n, t, e) {
1033
1033
  n[t] = e >>> 24 & 255, n[t + 1] = e >>> 16 & 255, n[t + 2] = e >>> 8 & 255, n[t + 3] = 255 & e;
1034
1034
  }
1035
1035
  function ye(n, t, e) {
@@ -1037,10 +1037,10 @@ function ye(n, t, e) {
1037
1037
  }
1038
1038
  function ot(n, t, e) {
1039
1039
  const i = t + e;
1040
- let r = 0;
1041
- const s = R.t;
1042
- for (let h = t; h < i; h += 4) s.uint8[3] = n[h] || 0, s.uint8[2] = n[h + 1] || 0, s.uint8[1] = n[h + 2] || 0, s.uint8[0] = n[h + 3] || 0, r = r + (s.uint32[0] >>> 0) >>> 0;
1043
- return r >>> 0;
1040
+ let s = 0;
1041
+ const r = R.t;
1042
+ for (let h = t; h < i; h += 4) r.uint8[3] = n[h] || 0, r.uint8[2] = n[h + 1] || 0, r.uint8[1] = n[h + 2] || 0, r.uint8[0] = n[h + 3] || 0, s = s + (r.uint32[0] >>> 0) >>> 0;
1043
+ return s >>> 0;
1044
1044
  }
1045
1045
  class be {
1046
1046
  constructor(t) {
@@ -1071,15 +1071,15 @@ function H(n) {
1071
1071
  if (e === 0) return { min: 0, max: 0, table: /* @__PURE__ */ new Map() };
1072
1072
  const i = new Uint32Array(e + 1);
1073
1073
  for (const o of n) o && i[o]++;
1074
- const r = new Uint32Array(e + 1);
1075
- let s = 0;
1074
+ const s = new Uint32Array(e + 1);
1075
+ let r = 0;
1076
1076
  i[0] = 0;
1077
- for (let o = 1; o <= e; o++) s = s + i[o - 1] << 1, r[o] = s;
1077
+ for (let o = 1; o <= e; o++) r = r + i[o - 1] << 1, s[o] = r;
1078
1078
  const h = /* @__PURE__ */ new Map();
1079
1079
  for (let o = 0; o < n.length; o++) {
1080
1080
  const c = n[o];
1081
1081
  if (!c) continue;
1082
- const l = r[c]++;
1082
+ const l = s[c]++;
1083
1083
  let u = h.get(c);
1084
1084
  u || (u = [], h.set(c, u)), u[Ee(l, c)] = o;
1085
1085
  }
@@ -1089,10 +1089,10 @@ function at(n, t) {
1089
1089
  let e = 0;
1090
1090
  for (let i = 1; i <= t.max; i++) {
1091
1091
  e |= n.readBits(1) << i - 1;
1092
- const r = t.table.get(i);
1093
- if (r && e < r.length) {
1094
- const s = r[e];
1095
- if (s !== void 0) return s;
1092
+ const s = t.table.get(i);
1093
+ if (s && e < s.length) {
1094
+ const r = s[e];
1095
+ if (r !== void 0) return r;
1096
1096
  }
1097
1097
  }
1098
1098
  throw Error("Invalid Huffman code");
@@ -1109,214 +1109,214 @@ function we(n) {
1109
1109
  if (((t << 8) + e) % 31 != 0) throw Error("Bad ZLIB header check");
1110
1110
  let i = 2;
1111
1111
  32 & e && (i += 4);
1112
- const r = [];
1113
- return function(s, h) {
1112
+ const s = [];
1113
+ return function(r, h) {
1114
1114
  const o = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258], c = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], l = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577], u = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13];
1115
1115
  let f = 0;
1116
1116
  for (; !f; ) {
1117
- f = s.readBits(1);
1118
- const d = s.readBits(2);
1117
+ f = r.readBits(1);
1118
+ const d = r.readBits(2);
1119
1119
  if (d === 0) {
1120
- s.alignToByte();
1121
- const g = s.readBits(16);
1122
- if ((65535 & (65535 ^ g)) !== s.readBits(16)) throw Error("DEFLATE uncompressed LEN/NLEN mismatch");
1123
- for (let p = 0; p < g; p++) h.push(s.readBits(8));
1120
+ r.alignToByte();
1121
+ const g = r.readBits(16);
1122
+ if ((65535 & (65535 ^ g)) !== r.readBits(16)) throw Error("DEFLATE uncompressed LEN/NLEN mismatch");
1123
+ for (let p = 0; p < g; p++) h.push(r.readBits(8));
1124
1124
  } else {
1125
1125
  if (d !== 1 && d !== 2) throw Error("Unsupported DEFLATE type");
1126
1126
  {
1127
1127
  let g, p;
1128
1128
  if (d === 1) {
1129
1129
  const v = Array(288).fill(0);
1130
- for (let A = 0; A <= 143; A++) v[A] = 8;
1131
- for (let A = 144; A <= 255; A++) v[A] = 9;
1132
- for (let A = 256; A <= 279; A++) v[A] = 7;
1133
- for (let A = 280; A <= 287; A++) v[A] = 8;
1130
+ for (let m = 0; m <= 143; m++) v[m] = 8;
1131
+ for (let m = 144; m <= 255; m++) v[m] = 9;
1132
+ for (let m = 256; m <= 279; m++) v[m] = 7;
1133
+ for (let m = 280; m <= 287; m++) v[m] = 8;
1134
1134
  g = H(v), p = H(Array(32).fill(5));
1135
1135
  } else {
1136
- const v = s.readBits(5) + 257, A = s.readBits(5) + 1, m = s.readBits(4) + 4, b = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], y = Array(19).fill(0);
1137
- for (let T = 0; T < m; T++) y[b[T]] = s.readBits(3);
1136
+ const v = r.readBits(5) + 257, m = r.readBits(5) + 1, A = r.readBits(4) + 4, b = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], y = Array(19).fill(0);
1137
+ for (let T = 0; T < A; T++) y[b[T]] = r.readBits(3);
1138
1138
  const x = H(y), E = [];
1139
- for (; E.length < v + A; ) {
1140
- const T = at(s, x);
1139
+ for (; E.length < v + m; ) {
1140
+ const T = at(r, x);
1141
1141
  if (T <= 15) E.push(T);
1142
1142
  else if (T === 16) {
1143
- const L = s.readBits(2) + 3, F = E[E.length - 1] || 0;
1144
- for (let Q = 0; Q < L; Q++) E.push(F);
1143
+ const L = r.readBits(2) + 3, C = E[E.length - 1] || 0;
1144
+ for (let K = 0; K < L; K++) E.push(C);
1145
1145
  } else if (T === 17) {
1146
- const L = s.readBits(3) + 3;
1147
- for (let F = 0; F < L; F++) E.push(0);
1146
+ const L = r.readBits(3) + 3;
1147
+ for (let C = 0; C < L; C++) E.push(0);
1148
1148
  } else {
1149
1149
  if (T !== 18) throw Error("Invalid code length symbol");
1150
1150
  {
1151
- const L = s.readBits(7) + 11;
1152
- for (let F = 0; F < L; F++) E.push(0);
1151
+ const L = r.readBits(7) + 11;
1152
+ for (let C = 0; C < L; C++) E.push(0);
1153
1153
  }
1154
1154
  }
1155
1155
  }
1156
- const C = E.slice(0, v), P = E.slice(v, v + A);
1157
- g = H(C), p = H(P);
1156
+ const F = E.slice(0, v), P = E.slice(v, v + m);
1157
+ g = H(F), p = H(P);
1158
1158
  }
1159
1159
  for (; ; ) {
1160
- const v = at(s, g);
1160
+ const v = at(r, g);
1161
1161
  if (v < 256) h.push(v);
1162
1162
  else {
1163
1163
  if (v === 256) break;
1164
1164
  if (v > 256 && v < 286) {
1165
- const A = v - 257;
1166
- let m = o[A];
1167
- const b = c[A];
1168
- b && (m += s.readBits(b));
1169
- const y = at(s, p);
1165
+ const m = v - 257;
1166
+ let A = o[m];
1167
+ const b = c[m];
1168
+ b && (A += r.readBits(b));
1169
+ const y = at(r, p);
1170
1170
  if (y >= 30) throw Error("Invalid distance symbol");
1171
1171
  let x = l[y];
1172
1172
  const E = u[y];
1173
- E && (x += s.readBits(E));
1174
- const C = h.length - x;
1175
- if (C < 0) throw Error("Invalid distance");
1176
- for (let P = 0; P < m; P++) h.push(h[C + P] || 0);
1173
+ E && (x += r.readBits(E));
1174
+ const F = h.length - x;
1175
+ if (F < 0) throw Error("Invalid distance");
1176
+ for (let P = 0; P < A; P++) h.push(h[F + P] || 0);
1177
1177
  } else if (v === 286 || v === 287) throw Error("Reserved length symbol");
1178
1178
  }
1179
1179
  }
1180
1180
  }
1181
1181
  }
1182
1182
  }
1183
- }(new be(n.subarray(i)), r), new Uint8Array(r);
1183
+ }(new be(n.subarray(i)), s), new Uint8Array(s);
1184
1184
  }
1185
1185
  function xe(n) {
1186
1186
  const t = R, e = new Uint8Array(n);
1187
1187
  if (t.readASCII(e, 0, 4) !== "wOFF") throw Error("Invalid WOFF signature");
1188
- const i = t.readUint(e, 4), r = t.readUshort(e, 12), s = t.readUint(e, 16), h = [];
1188
+ const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), h = [];
1189
1189
  let o = 44;
1190
- for (let m = 0; m < r; m++) {
1191
- const b = t.readASCII(e, o, 4), y = t.readUint(e, o + 4), x = t.readUint(e, o + 8), E = t.readUint(e, o + 12), C = t.readUint(e, o + 16);
1192
- h.push({ tag: b, offset: y, compLength: x, origLength: E, checksum: C }), o += 20;
1193
- }
1194
- for (const m of h) {
1195
- const b = new Uint8Array(e.buffer, m.offset, m.compLength);
1196
- if (m.compLength === m.origLength) m.data = new Uint8Array(b);
1197
- else if (m.data = we(b), m.data.length !== m.origLength) if (m.data.length < m.origLength) {
1198
- const y = new Uint8Array(m.origLength);
1199
- y.set(m.data), m.data = y;
1200
- } else m.data = m.data.subarray(0, m.origLength);
1201
- }
1202
- const c = r;
1190
+ for (let A = 0; A < s; A++) {
1191
+ const b = t.readASCII(e, o, 4), y = t.readUint(e, o + 4), x = t.readUint(e, o + 8), E = t.readUint(e, o + 12), F = t.readUint(e, o + 16);
1192
+ h.push({ tag: b, offset: y, compLength: x, origLength: E, checksum: F }), o += 20;
1193
+ }
1194
+ for (const A of h) {
1195
+ const b = new Uint8Array(e.buffer, A.offset, A.compLength);
1196
+ if (A.compLength === A.origLength) A.data = new Uint8Array(b);
1197
+ else if (A.data = we(b), A.data.length !== A.origLength) if (A.data.length < A.origLength) {
1198
+ const y = new Uint8Array(A.origLength);
1199
+ y.set(A.data), A.data = y;
1200
+ } else A.data = A.data.subarray(0, A.origLength);
1201
+ }
1202
+ const c = s;
1203
1203
  let l = 1, u = 0;
1204
1204
  for (; l << 1 <= c; ) l <<= 1, u++;
1205
1205
  const f = 16 * l, d = 16 * c - f;
1206
1206
  let g = 12 + 16 * c;
1207
1207
  const p = {};
1208
- for (const m of h) p[m.tag] = g, g = K(g + m.data.length);
1209
- const v = new Uint8Array(Math.max(s || 0, g));
1210
- B(v, 0, i), J(v, 4, c), J(v, 6, f), J(v, 8, u), J(v, 10, d);
1211
- let A = 12;
1212
- for (const m of h) {
1213
- ye(v, A, m.tag), A += 4;
1214
- let b = m.data;
1215
- if (m.tag === "head" && b.length >= 12) {
1208
+ for (const A of h) p[A.tag] = g, g = V(g + A.data.length);
1209
+ const v = new Uint8Array(Math.max(r || 0, g));
1210
+ N(v, 0, i), J(v, 4, c), J(v, 6, f), J(v, 8, u), J(v, 10, d);
1211
+ let m = 12;
1212
+ for (const A of h) {
1213
+ ye(v, m, A.tag), m += 4;
1214
+ let b = A.data;
1215
+ if (A.tag === "head" && b.length >= 12) {
1216
1216
  const y = new Uint8Array(b);
1217
- B(y, 8, 0), B(v, A, ot(y, 0, K(y.length))), A += 4;
1217
+ N(y, 8, 0), N(v, m, ot(y, 0, V(y.length))), m += 4;
1218
1218
  } else
1219
- B(v, A, ot(b, 0, K(b.length))), A += 4;
1220
- B(v, A, p[m.tag]), A += 4, B(v, A, m.data.length), A += 4;
1221
- }
1222
- for (const m of h) {
1223
- const b = p[m.tag];
1224
- v.set(m.data, b);
1225
- }
1226
- if (h.find((m) => m.tag === "head")) {
1227
- const m = p.head, b = function(y, x) {
1228
- const E = x + 8, C = [y[E], y[E + 1], y[E + 2], y[E + 3]];
1229
- B(y, E, 0);
1230
- const P = 2981146554 - (ot(y, 0, K(y.length)) >>> 0) >>> 0;
1231
- return y[E] = C[0], y[E + 1] = C[1], y[E + 2] = C[2], y[E + 3] = C[3], P >>> 0;
1232
- }(v, m);
1233
- B(v, m + 8, b);
1219
+ N(v, m, ot(b, 0, V(b.length))), m += 4;
1220
+ N(v, m, p[A.tag]), m += 4, N(v, m, A.data.length), m += 4;
1221
+ }
1222
+ for (const A of h) {
1223
+ const b = p[A.tag];
1224
+ v.set(A.data, b);
1225
+ }
1226
+ if (h.find((A) => A.tag === "head")) {
1227
+ const A = p.head, b = function(y, x) {
1228
+ const E = x + 8, F = [y[E], y[E + 1], y[E + 2], y[E + 3]];
1229
+ N(y, E, 0);
1230
+ const P = 2981146554 - (ot(y, 0, V(y.length)) >>> 0) >>> 0;
1231
+ return y[E] = F[0], y[E + 1] = F[1], y[E + 2] = F[2], y[E + 3] = F[3], P >>> 0;
1232
+ }(v, A);
1233
+ N(v, A + 8, b);
1234
1234
  }
1235
1235
  return v.buffer;
1236
1236
  }
1237
1237
  const Te = { parseTab(n, t, e) {
1238
1238
  const i = { tables: [], ids: {}, off: t };
1239
1239
  n = new Uint8Array(n.buffer, t, e), t = 0;
1240
- const r = R, s = r.readUshort, h = s(n, t += 2);
1240
+ const s = R, r = s.readUshort, h = r(n, t += 2);
1241
1241
  t += 2;
1242
1242
  const o = [];
1243
1243
  for (let c = 0; c < h; c++) {
1244
- const l = s(n, t), u = s(n, t += 2);
1244
+ const l = r(n, t), u = r(n, t += 2);
1245
1245
  t += 2;
1246
- const f = r.readUint(n, t);
1246
+ const f = s.readUint(n, t);
1247
1247
  t += 4;
1248
1248
  const d = `p${l}e${u}`;
1249
1249
  let g = o.indexOf(f);
1250
1250
  if (g === -1) {
1251
1251
  let p;
1252
1252
  g = i.tables.length, o.push(f);
1253
- const v = s(n, f);
1253
+ const v = r(n, f);
1254
1254
  p = v === 4 ? this.parse4(n, f) : v === 12 ? this.parse12(n, f) : { format: v }, i.tables.push(p);
1255
1255
  }
1256
1256
  i.ids[d] = g;
1257
1257
  }
1258
1258
  return i;
1259
1259
  }, parse4(n, t) {
1260
- const e = R, i = e.readUshort, r = e.readUshorts, s = t, h = i(n, t += 2);
1260
+ const e = R, i = e.readUshort, s = e.readUshorts, r = t, h = i(n, t += 2);
1261
1261
  t += 2;
1262
1262
  const o = i(n, t += 2) >>> 1, c = { format: 4, searchRange: i(n, t += 2), entrySelector: 0, rangeShift: 0, endCount: [], startCount: [], idDelta: [], idRangeOffset: [], glyphIdArray: [] };
1263
- t += 2, c.entrySelector = i(n, t), t += 2, c.rangeShift = i(n, t), t += 2, c.endCount = r(n, t, o), t += 2 * o, t += 2, c.startCount = r(n, t, o), t += 2 * o;
1263
+ t += 2, c.entrySelector = i(n, t), t += 2, c.rangeShift = i(n, t), t += 2, c.endCount = s(n, t, o), t += 2 * o, t += 2, c.startCount = s(n, t, o), t += 2 * o;
1264
1264
  for (let l = 0; l < o; l++) c.idDelta.push(e.readShort(n, t)), t += 2;
1265
- return c.idRangeOffset = r(n, t, o), t += 2 * o, c.glyphIdArray = r(n, t, s + h - t >> 1), c;
1265
+ return c.idRangeOffset = s(n, t, o), t += 2 * o, c.glyphIdArray = s(n, t, r + h - t >> 1), c;
1266
1266
  }, parse12(n, t) {
1267
1267
  const e = R.readUint;
1268
1268
  e(n, t += 4), e(n, t += 4);
1269
1269
  const i = e(n, t += 4);
1270
1270
  t += 4;
1271
- const r = new Uint32Array(3 * i);
1272
- for (let s = 0; s < 3 * i; s += 3) r[s] = e(n, t + (s << 2)), r[s + 1] = e(n, t + (s << 2) + 4), r[s + 2] = e(n, t + (s << 2) + 8);
1273
- return { format: 12, groups: r };
1271
+ const s = new Uint32Array(3 * i);
1272
+ for (let r = 0; r < 3 * i; r += 3) s[r] = e(n, t + (r << 2)), s[r + 1] = e(n, t + (r << 2) + 4), s[r + 2] = e(n, t + (r << 2) + 8);
1273
+ return { format: 12, groups: s };
1274
1274
  } }, Re = { parseTab(n, t, e) {
1275
1275
  const i = R;
1276
1276
  t += 18;
1277
- const r = i.readUshort(n, t);
1277
+ const s = i.readUshort(n, t);
1278
1278
  t += 2, t += 16;
1279
- const s = i.readShort(n, t);
1279
+ const r = i.readShort(n, t);
1280
1280
  t += 2;
1281
1281
  const h = i.readShort(n, t);
1282
1282
  t += 2;
1283
1283
  const o = i.readShort(n, t);
1284
1284
  t += 2;
1285
1285
  const c = i.readShort(n, t);
1286
- return t += 2, t += 6, { unitsPerEm: r, xMin: s, yMin: h, xMax: o, yMax: c, indexToLocFormat: i.readShort(n, t) };
1287
- } }, Ce = { parseTab(n, t, e) {
1286
+ return t += 2, t += 6, { unitsPerEm: s, xMin: r, yMin: h, xMax: o, yMax: c, indexToLocFormat: i.readShort(n, t) };
1287
+ } }, Fe = { parseTab(n, t, e) {
1288
1288
  const i = R;
1289
1289
  t += 4;
1290
- const r = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], s = {};
1291
- for (let h = 0; h < r.length; h++) {
1292
- const o = r[h], c = o === "advanceWidthMax" || o === "numberOfHMetrics" ? i.readUshort : i.readShort;
1293
- s[o] = c(n, t + 2 * h);
1290
+ const s = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], r = {};
1291
+ for (let h = 0; h < s.length; h++) {
1292
+ const o = s[h], c = o === "advanceWidthMax" || o === "numberOfHMetrics" ? i.readUshort : i.readShort;
1293
+ r[o] = c(n, t + 2 * h);
1294
1294
  }
1295
- return s;
1296
- } }, Fe = { parseTab(n, t, e, i) {
1297
- const r = R, s = [], h = [], o = i.maxp.numGlyphs, c = i.hhea.numberOfHMetrics;
1295
+ return r;
1296
+ } }, Ce = { parseTab(n, t, e, i) {
1297
+ const s = R, r = [], h = [], o = i.maxp.numGlyphs, c = i.hhea.numberOfHMetrics;
1298
1298
  let l = 0, u = 0, f = 0;
1299
- for (; f < c; ) l = r.readUshort(n, t + (f << 2)), u = r.readShort(n, t + (f << 2) + 2), s.push(l), h.push(u), f++;
1300
- for (; f < o; ) s.push(l), h.push(u), f++;
1301
- return { aWidth: s, lsBearing: h };
1302
- } }, Et = { cmap: Te, head: Re, hhea: Ce, maxp: { parseTab(n, t, e) {
1299
+ for (; f < c; ) l = s.readUshort(n, t + (f << 2)), u = s.readShort(n, t + (f << 2) + 2), r.push(l), h.push(u), f++;
1300
+ for (; f < o; ) r.push(l), h.push(u), f++;
1301
+ return { aWidth: r, lsBearing: h };
1302
+ } }, Et = { cmap: Te, head: Re, hhea: Fe, maxp: { parseTab(n, t, e) {
1303
1303
  const i = R;
1304
1304
  return i.readUint(n, t), t += 4, { numGlyphs: i.readUshort(n, t) };
1305
- } }, hmtx: Fe, loca: { parseTab(n, t, e, i) {
1306
- const r = R, s = [], h = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
1307
- if (h === 0) for (let c = 0; c < o; c++) s.push(r.readUshort(n, t + (c << 1)) << 1);
1308
- else if (h === 1) for (let c = 0; c < o; c++) s.push(r.readUint(n, t + (c << 2)));
1309
- return s;
1310
- } }, glyf: { parseTab(n, t, e, i) {
1311
- const r = [], s = i.maxp.numGlyphs;
1312
- for (let h = 0; h < s; h++) r.push(null);
1305
+ } }, hmtx: Ce, loca: { parseTab(n, t, e, i) {
1306
+ const s = R, r = [], h = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
1307
+ if (h === 0) for (let c = 0; c < o; c++) r.push(s.readUshort(n, t + (c << 1)) << 1);
1308
+ else if (h === 1) for (let c = 0; c < o; c++) r.push(s.readUint(n, t + (c << 2)));
1313
1309
  return r;
1310
+ } }, glyf: { parseTab(n, t, e, i) {
1311
+ const s = [], r = i.maxp.numGlyphs;
1312
+ for (let h = 0; h < r; h++) s.push(null);
1313
+ return s;
1314
1314
  }, Se(n, t) {
1315
- const e = R, i = n.ze, r = n.loca;
1316
- if (r[t] === r[t + 1]) return null;
1317
- const s = j.findTable(i, "glyf", n.ke);
1318
- if (!s) return null;
1319
- let h = s[0] + r[t];
1315
+ const e = R, i = n.ze, s = n.loca;
1316
+ if (s[t] === s[t + 1]) return null;
1317
+ const r = j.findTable(i, "glyf", n.ke);
1318
+ if (!r) return null;
1319
+ let h = r[0] + s[t];
1320
1320
  const o = {};
1321
1321
  if (o.noc = e.readShort(i, h), h += 2, o.xMin = e.readShort(i, h), h += 2, o.yMin = e.readShort(i, h), h += 2, o.xMax = e.readShort(i, h), h += 2, o.yMax = e.readShort(i, h), h += 2, o.xMin >= o.xMax || o.yMin >= o.yMax) return null;
1322
1322
  if (o.noc > 0) {
@@ -1352,25 +1352,25 @@ const Te = { parseTab(n, t, e) {
1352
1352
  } } }, j = { parse(n) {
1353
1353
  const t = new Uint8Array(n);
1354
1354
  R.readASCII(t, 0, 4) === "wOFF" && (n = xe(n));
1355
- const e = new Uint8Array(n), i = Et, r = {}, s = { ze: e, De: 0, ke: 0 };
1355
+ const e = new Uint8Array(n), i = Et, s = {}, r = { ze: e, De: 0, ke: 0 };
1356
1356
  for (const h in i) {
1357
1357
  const o = h, c = j.findTable(e, o, 0);
1358
1358
  if (c) {
1359
1359
  const [l, u] = c;
1360
- let f = r[l];
1361
- f == null && (f = i[o].parseTab(e, l, u, s), r[l] = f), s[o] = f;
1360
+ let f = s[l];
1361
+ f == null && (f = i[o].parseTab(e, l, u, r), s[l] = f), r[o] = f;
1362
1362
  }
1363
1363
  }
1364
- return [s];
1364
+ return [r];
1365
1365
  }, findTable(n, t, e) {
1366
- const i = R, r = i.readUshort(n, e + 4);
1367
- let s = e + 12;
1368
- for (let h = 0; h < r; h++) {
1369
- const o = i.readASCII(n, s, 4);
1370
- i.readUint(n, s + 4);
1371
- const c = i.readUint(n, s + 8), l = i.readUint(n, s + 12);
1366
+ const i = R, s = i.readUshort(n, e + 4);
1367
+ let r = e + 12;
1368
+ for (let h = 0; h < s; h++) {
1369
+ const o = i.readASCII(n, r, 4);
1370
+ i.readUint(n, r + 4);
1371
+ const c = i.readUint(n, r + 8), l = i.readUint(n, r + 12);
1372
1372
  if (o === t) return [c, l];
1373
- s += 16;
1373
+ r += 16;
1374
1374
  }
1375
1375
  return null;
1376
1376
  }, T: Et, B: R };
@@ -1378,13 +1378,13 @@ class Me {
1378
1378
  Le(t) {
1379
1379
  var i;
1380
1380
  const e = [];
1381
- return (i = t.cmap) != null && i.tables ? (t.cmap.tables.forEach((r) => {
1382
- if (r.format === 4) {
1383
- const s = this.Oe(r);
1384
- e.push(...s);
1385
- } else if (r.format === 12) {
1386
- const s = this.Be(r);
1387
- e.push(...s);
1381
+ return (i = t.cmap) != null && i.tables ? (t.cmap.tables.forEach((s) => {
1382
+ if (s.format === 4) {
1383
+ const r = this.Oe(s);
1384
+ e.push(...r);
1385
+ } else if (s.format === 12) {
1386
+ const r = this.Ie(s);
1387
+ e.push(...r);
1388
1388
  }
1389
1389
  }), [...new Set(e)]) : [];
1390
1390
  }
@@ -1392,10 +1392,10 @@ class Me {
1392
1392
  const e = [];
1393
1393
  if (!(t.startCount && t.endCount && t.idRangeOffset && t.idDelta)) return e;
1394
1394
  for (let i = 0; i < t.startCount.length; i++) {
1395
- const r = t.startCount[i], s = t.endCount[i];
1396
- if (r !== 65535 || s !== 65535) {
1397
- for (let h = r; h <= s; h++)
1398
- if (this.Ie(t, h, i) > 0) try {
1395
+ const s = t.startCount[i], r = t.endCount[i];
1396
+ if (s !== 65535 || r !== 65535) {
1397
+ for (let h = s; h <= r; h++)
1398
+ if (this.Be(t, h, i) > 0) try {
1399
1399
  const o = String.fromCodePoint(h);
1400
1400
  e.push(o);
1401
1401
  } catch {
@@ -1404,13 +1404,13 @@ class Me {
1404
1404
  }
1405
1405
  return e;
1406
1406
  }
1407
- Be(t) {
1407
+ Ie(t) {
1408
1408
  const e = [];
1409
1409
  if (!t.groups) return e;
1410
1410
  for (let i = 0; i < t.groups.length; i += 3) {
1411
- const r = t.groups[i], s = t.groups[i + 1], h = t.groups[i + 2];
1412
- for (let o = r; o <= s; o++)
1413
- if (h + (o - r) > 0) try {
1411
+ const s = t.groups[i], r = t.groups[i + 1], h = t.groups[i + 2];
1412
+ for (let o = s; o <= r; o++)
1413
+ if (h + (o - s) > 0) try {
1414
1414
  const c = String.fromCodePoint(o);
1415
1415
  e.push(c);
1416
1416
  } catch {
@@ -1418,13 +1418,13 @@ class Me {
1418
1418
  }
1419
1419
  return e;
1420
1420
  }
1421
- Ie(t, e, i) {
1421
+ Be(t, e, i) {
1422
1422
  if (t.idRangeOffset[i] === 0) return e + t.idDelta[i] & 65535;
1423
1423
  {
1424
- const r = t.idRangeOffset[i] / 2 + (e - t.startCount[i]) - (t.startCount.length - i);
1425
- if (r >= 0 && t.glyphIdArray && r < t.glyphIdArray.length) {
1426
- const s = t.glyphIdArray[r];
1427
- if (s !== 0) return s + t.idDelta[i] & 65535;
1424
+ const s = t.idRangeOffset[i] / 2 + (e - t.startCount[i]) - (t.startCount.length - i);
1425
+ if (s >= 0 && t.glyphIdArray && s < t.glyphIdArray.length) {
1426
+ const r = t.glyphIdArray[s];
1427
+ if (r !== 0) return r + t.idDelta[i] & 65535;
1428
1428
  }
1429
1429
  }
1430
1430
  return 0;
@@ -1437,59 +1437,59 @@ class Pe {
1437
1437
  a(this, "Z");
1438
1438
  this.Z = t, this.He = document.createElement("canvas"), this.Ge = this.He.getContext("2d", { willReadFrequently: !0, alpha: !0 });
1439
1439
  }
1440
- Qe(t, e, i, r) {
1441
- const s = t.length, h = Math.ceil(Math.sqrt(s)), o = Math.ceil(s / h), c = e.width * h, l = e.height * o;
1442
- this.Ne(c, l), this.Xe(t, e, h, i, r);
1440
+ Qe(t, e, i, s) {
1441
+ const r = t.length, h = Math.ceil(Math.sqrt(r)), o = Math.ceil(r / h), c = e.width * h, l = e.height * o;
1442
+ this.Ne(c, l), this.Xe(t, e, h, i, s);
1443
1443
  const u = this.Z.Pe(c, l, 1, { filter: "nearest" });
1444
1444
  return u.et(this.He), { framebuffer: u, columns: h, rows: o };
1445
1445
  }
1446
1446
  Ne(t, e) {
1447
1447
  this.He.width = t, this.He.height = e, this.He.style.width = t + "px", this.He.style.height = e + "px", this.Ge.imageSmoothingEnabled = !1, this.He.style.imageRendering = "pixelated", this.Ge.clearRect(0, 0, t, e), this.Ge.textBaseline = "top", this.Ge.textAlign = "left", this.Ge.fillStyle = "white";
1448
1448
  }
1449
- Xe(t, e, i, r, s) {
1450
- const h = r / s.head.unitsPerEm;
1449
+ Xe(t, e, i, s, r) {
1450
+ const h = s / r.head.unitsPerEm;
1451
1451
  for (let o = 0; o < t.length; o++) {
1452
1452
  const c = o % i, l = Math.floor(o / i), u = t[o].glyphData;
1453
1453
  if (!u) continue;
1454
- const f = u.advanceWidth * h, d = c * e.width, g = l * e.height, p = d + 0.5 * e.width, v = g + 0.5 * e.height, A = Math.round(p - 0.5 * e.width), m = Math.round(v - 0.5 * r), b = A + 0.5 * (e.width - f), y = m + s.hhea.ascender * h;
1454
+ const f = u.advanceWidth * h, d = c * e.width, g = l * e.height, p = d + 0.5 * e.width, v = g + 0.5 * e.height, m = Math.round(p - 0.5 * e.width), A = Math.round(v - 0.5 * s), b = m + 0.5 * (e.width - f), y = A + r.hhea.ascender * h;
1455
1455
  this.Ye(u, b, y, h);
1456
1456
  }
1457
1457
  }
1458
- Ye(t, e, i, r) {
1458
+ Ye(t, e, i, s) {
1459
1459
  if (!t || !t.xs || t.noc === 0) return;
1460
- let { xs: s, ys: h, endPts: o, flags: c } = t;
1461
- if (!(s && h && o && c)) return;
1460
+ let { xs: r, ys: h, endPts: o, flags: c } = t;
1461
+ if (!(r && h && o && c)) return;
1462
1462
  this.Ge.beginPath();
1463
1463
  let l = 0;
1464
1464
  for (let u = 0; u < o.length; u++) {
1465
1465
  const f = o[u];
1466
1466
  if (!(f < l)) {
1467
1467
  if (f >= l) {
1468
- const d = e + s[l] * r, g = i - h[l] * r;
1468
+ const d = e + r[l] * s, g = i - h[l] * s;
1469
1469
  this.Ge.moveTo(d, g);
1470
1470
  let p = l + 1;
1471
1471
  for (; p <= f; )
1472
1472
  if (1 & c[p]) {
1473
- const v = e + s[p] * r, A = i - h[p] * r;
1474
- this.Ge.lineTo(v, A), p++;
1473
+ const v = e + r[p] * s, m = i - h[p] * s;
1474
+ this.Ge.lineTo(v, m), p++;
1475
1475
  } else {
1476
- const v = e + s[p] * r, A = i - h[p] * r;
1476
+ const v = e + r[p] * s, m = i - h[p] * s;
1477
1477
  if (p + 1 > f) {
1478
- const b = e + s[l] * r, y = i - h[l] * r;
1479
- if (1 & c[l]) this.Ge.quadraticCurveTo(v, A, b, y);
1478
+ const b = e + r[l] * s, y = i - h[l] * s;
1479
+ if (1 & c[l]) this.Ge.quadraticCurveTo(v, m, b, y);
1480
1480
  else {
1481
- const x = (v + b) / 2, E = (A + y) / 2;
1482
- this.Ge.quadraticCurveTo(v, A, x, E);
1481
+ const x = (v + b) / 2, E = (m + y) / 2;
1482
+ this.Ge.quadraticCurveTo(v, m, x, E);
1483
1483
  }
1484
1484
  break;
1485
1485
  }
1486
- const m = p + 1;
1487
- if (1 & c[m]) {
1488
- const b = e + s[m] * r, y = i - h[m] * r;
1489
- this.Ge.quadraticCurveTo(v, A, b, y), p = m + 1;
1486
+ const A = p + 1;
1487
+ if (1 & c[A]) {
1488
+ const b = e + r[A] * s, y = i - h[A] * s;
1489
+ this.Ge.quadraticCurveTo(v, m, b, y), p = A + 1;
1490
1490
  } else {
1491
- const b = (v + (e + s[m] * r)) / 2, y = (A + (i - h[m] * r)) / 2;
1492
- this.Ge.quadraticCurveTo(v, A, b, y), p = m;
1491
+ const b = (v + (e + r[A] * s)) / 2, y = (m + (i - h[A] * s)) / 2;
1492
+ this.Ge.quadraticCurveTo(v, m, b, y), p = A;
1493
1493
  }
1494
1494
  }
1495
1495
  this.Ge.closePath();
@@ -1504,9 +1504,9 @@ class Pt {
1504
1504
  je(t, e) {
1505
1505
  const i = t.cmap;
1506
1506
  if (!i || !i.tables) return 0;
1507
- let r = 0;
1508
- for (const s of i.tables) if (s.format === 4 ? r = this.Ke(e, s) : s.format === 12 && (r = this.We(e, s)), r > 0) break;
1509
- return r;
1507
+ let s = 0;
1508
+ for (const r of i.tables) if (r.format === 4 ? s = this.Ke(e, r) : r.format === 12 && (s = this.We(e, r)), s > 0) break;
1509
+ return s;
1510
1510
  }
1511
1511
  Ze(t, e) {
1512
1512
  const i = e.codePointAt(0);
@@ -1517,32 +1517,32 @@ class Pt {
1517
1517
  return i && i.aWidth && i.aWidth.length !== 0 ? e < i.aWidth.length ? i.aWidth[e] : i.aWidth[i.aWidth.length - 1] : 0;
1518
1518
  }
1519
1519
  Ve(t, e) {
1520
- const i = e / t.head.unitsPerEm, r = t.hhea.ascender * i, s = t.hhea.descender * i, h = t.hhea.lineGap * i;
1521
- return { ascender: r, descender: s, lineGap: h, lineHeight: r - s + h, unitsPerEm: t.head.unitsPerEm, scale: i };
1520
+ const i = e / t.head.unitsPerEm, s = t.hhea.ascender * i, r = t.hhea.descender * i, h = t.hhea.lineGap * i;
1521
+ return { ascender: s, descender: r, lineGap: h, lineHeight: s - r + h, unitsPerEm: t.head.unitsPerEm, scale: i };
1522
1522
  }
1523
1523
  Ke(t, e) {
1524
1524
  const i = e.endCount.length;
1525
- let r = -1;
1526
- for (let s = 0; s < i; s++) if (t <= e.endCount[s]) {
1527
- r = s;
1525
+ let s = -1;
1526
+ for (let r = 0; r < i; r++) if (t <= e.endCount[r]) {
1527
+ s = r;
1528
1528
  break;
1529
1529
  }
1530
- if (r === -1 || t < e.startCount[r]) return 0;
1531
- if (e.idRangeOffset[r] === 0) return t + e.idDelta[r] & 65535;
1530
+ if (s === -1 || t < e.startCount[s]) return 0;
1531
+ if (e.idRangeOffset[s] === 0) return t + e.idDelta[s] & 65535;
1532
1532
  {
1533
- const s = e.idRangeOffset[r] / 2 + (t - e.startCount[r]) - (i - r);
1534
- if (s >= 0 && s < e.glyphIdArray.length) {
1535
- const h = e.glyphIdArray[s];
1536
- return h === 0 ? 0 : h + e.idDelta[r] & 65535;
1533
+ const r = e.idRangeOffset[s] / 2 + (t - e.startCount[s]) - (i - s);
1534
+ if (r >= 0 && r < e.glyphIdArray.length) {
1535
+ const h = e.glyphIdArray[r];
1536
+ return h === 0 ? 0 : h + e.idDelta[s] & 65535;
1537
1537
  }
1538
1538
  }
1539
1539
  return 0;
1540
1540
  }
1541
1541
  We(t, e) {
1542
1542
  const i = e.groups.length / 3;
1543
- for (let r = 0; r < i; r++) {
1544
- const s = e.groups[3 * r], h = e.groups[3 * r + 1], o = e.groups[3 * r + 2];
1545
- if (t >= s && t <= h) return o + (t - s);
1543
+ for (let s = 0; s < i; s++) {
1544
+ const r = e.groups[3 * s], h = e.groups[3 * s + 1], o = e.groups[3 * s + 2];
1545
+ if (t >= r && t <= h) return o + (t - r);
1546
1546
  }
1547
1547
  return 0;
1548
1548
  }
@@ -1553,15 +1553,15 @@ class Se {
1553
1553
  this.Je = new Pt();
1554
1554
  }
1555
1555
  tr(t, e, i) {
1556
- let r = 0;
1557
- const s = this.Je.Ve(i, e), h = s.lineHeight;
1556
+ let s = 0;
1557
+ const r = this.Je.Ve(i, e), h = r.lineHeight;
1558
1558
  for (const o of t) {
1559
1559
  const c = this.Je.Ze(i, o);
1560
1560
  if (c === 0) continue;
1561
- const l = this.Je.qe(i, c) * s.scale;
1562
- r = Math.max(r, l);
1561
+ const l = this.Je.qe(i, c) * r.scale;
1562
+ s = Math.max(s, l);
1563
1563
  }
1564
- return { width: Math.ceil(r), height: Math.ceil(h) };
1564
+ return { width: Math.ceil(s), height: Math.ceil(h) };
1565
1565
  }
1566
1566
  }
1567
1567
  class Ue {
@@ -1570,22 +1570,22 @@ class Ue {
1570
1570
  this.sr = new Pt();
1571
1571
  }
1572
1572
  ir(t, e) {
1573
- const i = [], r = /* @__PURE__ */ new Map();
1574
- return t.forEach((s, h) => {
1575
- const o = s.codePointAt(0) || 0, c = { character: s, unicode: o, color: this.er(h), glyphData: this.rr(e, s) };
1576
- i.push(c), r.set(s, c);
1577
- }), { array: i, map: r };
1573
+ const i = [], s = /* @__PURE__ */ new Map();
1574
+ return t.forEach((r, h) => {
1575
+ const o = r.codePointAt(0) || 0, c = { character: r, unicode: o, color: this.er(h), glyphData: this.rr(e, r) };
1576
+ i.push(c), s.set(r, c);
1577
+ }), { array: i, map: s };
1578
1578
  }
1579
1579
  er(t) {
1580
1580
  return [t % 256 / 255, Math.floor(t / 256) % 256 / 255, 0];
1581
1581
  }
1582
1582
  rr(t, e) {
1583
- const i = e.codePointAt(0) || 0, r = this.sr.je(t, i);
1584
- if (r === 0) return null;
1585
- let s = 0;
1586
- t.hmtx && t.hmtx.aWidth && r > 0 && t.hmtx.aWidth[r] !== void 0 && (s = t.hmtx.aWidth[r]);
1587
- const h = j.T.glyf.Se(t, r);
1588
- return h ? { ...h, advanceWidth: s } : null;
1583
+ const i = e.codePointAt(0) || 0, s = this.sr.je(t, i);
1584
+ if (s === 0) return null;
1585
+ let r = 0;
1586
+ t.hmtx && t.hmtx.aWidth && s > 0 && t.hmtx.aWidth[s] !== void 0 && (r = t.hmtx.aWidth[s]);
1587
+ const h = j.T.glyf.Se(t, s);
1588
+ return h ? { ...h, advanceWidth: r } : null;
1589
1589
  }
1590
1590
  }
1591
1591
  class et {
@@ -1629,9 +1629,9 @@ class et {
1629
1629
  if (!e.ok) throw new U(`Failed to load font file: ${e.status} ${e.statusText}`);
1630
1630
  const i = await e.arrayBuffer();
1631
1631
  await this.br(i);
1632
- const r = j.parse(i);
1633
- if (!r || r.length === 0) throw Error("Failed to parse font file");
1634
- this.nr = r[0], await this.Cr();
1632
+ const s = j.parse(i);
1633
+ if (!s || s.length === 0) throw Error("Failed to parse font file");
1634
+ this.nr = s[0], await this.Cr();
1635
1635
  } catch (e) {
1636
1636
  throw new U("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
1637
1637
  }
@@ -1643,8 +1643,8 @@ class et {
1643
1643
  async Cr() {
1644
1644
  const t = this.gr.Le(this.nr), { array: e, map: i } = this.yr.ir(t, this.nr);
1645
1645
  this.hr = e, this.ar = i, this.vr = this._r.tr(t, this.lr, this.nr);
1646
- const r = this.mr.Qe(this.hr, this.vr, this.lr, this.nr);
1647
- this.cr = r.framebuffer, this.ur = r.columns, this.dr = r.rows, this.Ar = !0;
1646
+ const s = this.mr.Qe(this.hr, this.vr, this.lr, this.nr);
1647
+ this.cr = s.framebuffer, this.ur = s.columns, this.dr = s.rows, this.Ar = !0;
1648
1648
  }
1649
1649
  $r(t) {
1650
1650
  const e = this.ar.get(t);
@@ -1699,20 +1699,20 @@ class Le {
1699
1699
  a(this, "Dr");
1700
1700
  a(this, "Lr");
1701
1701
  a(this, "Or", !1);
1702
- a(this, "Br", /* @__PURE__ */ new Set());
1702
+ a(this, "Ir", /* @__PURE__ */ new Set());
1703
1703
  this.kr = t, this.Dr = e, this.Lr = i, this.ti();
1704
1704
  }
1705
- Ir() {
1706
- if (this.N = this.Er * this.Dr, this.X = this.Rr * this.Lr, this.Sr = Math.floor((this.kr.width - this.N) / 2), this.zr = Math.floor((this.kr.height - this.X) / 2), this.Br.size > 0) for (const t of this.Br) t();
1705
+ Br() {
1706
+ if (this.N = this.Er * this.Dr, this.X = this.Rr * this.Lr, this.Sr = Math.floor((this.kr.width - this.N) / 2), this.zr = Math.floor((this.kr.height - this.X) / 2), this.Ir.size > 0) for (const t of this.Ir) t();
1707
1707
  }
1708
1708
  Hr(t) {
1709
- this.Br.add(t);
1709
+ this.Ir.add(t);
1710
1710
  }
1711
1711
  Gr(t) {
1712
- this.Br.delete(t);
1712
+ this.Ir.delete(t);
1713
1713
  }
1714
1714
  ti() {
1715
- this.Or || (this.Er = Math.floor(this.kr.width / this.Dr), this.Rr = Math.floor(this.kr.height / this.Lr)), this.Ir();
1715
+ this.Or || (this.Er = Math.floor(this.kr.width / this.Dr), this.Rr = Math.floor(this.kr.height / this.Lr)), this.Br();
1716
1716
  }
1717
1717
  Qr(t, e) {
1718
1718
  this.Dr = t, this.Lr = e, this.ti();
@@ -1727,13 +1727,13 @@ class Le {
1727
1727
  return this.Er;
1728
1728
  }
1729
1729
  set cols(t) {
1730
- this.Or = !0, this.Er = Math.max(1, Math.floor(t)), typeof this.Rr != "number" && (this.Rr = Math.max(1, Math.floor(this.kr.height / this.Lr))), this.Ir();
1730
+ this.Or = !0, this.Er = Math.max(1, Math.floor(t)), typeof this.Rr != "number" && (this.Rr = Math.max(1, Math.floor(this.kr.height / this.Lr))), this.Br();
1731
1731
  }
1732
1732
  get rows() {
1733
1733
  return this.Rr;
1734
1734
  }
1735
1735
  set rows(t) {
1736
- this.Or = !0, this.Rr = Math.max(1, Math.floor(t)), typeof this.Er != "number" && (this.Er = Math.max(1, Math.floor(this.kr.width / this.Dr))), this.Ir();
1736
+ this.Or = !0, this.Rr = Math.max(1, Math.floor(t)), typeof this.Er != "number" && (this.Er = Math.max(1, Math.floor(this.kr.width / this.Dr))), this.Br();
1737
1737
  }
1738
1738
  get width() {
1739
1739
  return this.N;
@@ -1751,28 +1751,28 @@ class Le {
1751
1751
  this.Or = !1;
1752
1752
  }
1753
1753
  gt() {
1754
- this.Br.clear();
1754
+ this.Ir.clear();
1755
1755
  }
1756
1756
  }
1757
- const Ne = /^rgba?\(([^)]+)\)$/i;
1757
+ const Be = /^rgba?\(([^)]+)\)$/i;
1758
1758
  function ct(n) {
1759
1759
  return Number.isNaN(n) ? 0 : Math.max(0, Math.min(255, n));
1760
1760
  }
1761
- function Be(n) {
1761
+ function Ne(n) {
1762
1762
  if (!n) return null;
1763
1763
  const t = n.trim().toLowerCase();
1764
1764
  if (!t) return null;
1765
1765
  let e = null;
1766
1766
  return t.startsWith("rgb") && (e = function(i) {
1767
- const r = Ne.exec(i.trim());
1768
- if (!r) return null;
1769
- const s = r[1].split(",").map((u) => u.trim());
1770
- if (s.length < 3) return null;
1771
- const h = ct(parseFloat(s[0])), o = ct(parseFloat(s[1])), c = ct(parseFloat(s[2])), l = s[3] !== void 0 ? 255 * Math.max(0, Math.min(1, parseFloat(s[3]))) : 255;
1767
+ const s = Be.exec(i.trim());
1768
+ if (!s) return null;
1769
+ const r = s[1].split(",").map((u) => u.trim());
1770
+ if (r.length < 3) return null;
1771
+ const h = ct(parseFloat(r[0])), o = ct(parseFloat(r[1])), c = ct(parseFloat(r[2])), l = r[3] !== void 0 ? 255 * Math.max(0, Math.min(1, parseFloat(r[3]))) : 255;
1772
1772
  return [h, o, c, Math.round(l)];
1773
1773
  }(t)), e ? e[3] === 0 ? null : e : null;
1774
1774
  }
1775
- class De {
1775
+ class _e {
1776
1776
  constructor(t = {}) {
1777
1777
  a(this, "kr");
1778
1778
  a(this, "Nr", null);
@@ -1788,14 +1788,14 @@ class De {
1788
1788
  const t = document.createElement("canvas");
1789
1789
  t.className = "textmodeCanvas", t.style.imageRendering = "pixelated";
1790
1790
  const e = this.Nr.getBoundingClientRect();
1791
- let i = Math.round(e.width), r = Math.round(e.height);
1791
+ let i = Math.round(e.width), s = Math.round(e.height);
1792
1792
  if (this.Nr instanceof HTMLVideoElement) {
1793
1793
  const o = this.Nr;
1794
- (i === 0 || r === 0) && o.videoWidth > 0 && o.videoHeight > 0 && (i = o.videoWidth, r = o.videoHeight);
1794
+ (i === 0 || s === 0) && o.videoWidth > 0 && o.videoHeight > 0 && (i = o.videoWidth, s = o.videoHeight);
1795
1795
  }
1796
- t.width = i, t.height = r, t.style.position = "absolute", t.style.pointerEvents = "none";
1797
- const s = window.getComputedStyle(this.Nr);
1798
- let h = parseInt(s.zIndex || "0", 10);
1796
+ t.width = i, t.height = s, t.style.position = "absolute", t.style.pointerEvents = "none";
1797
+ const r = window.getComputedStyle(this.Nr);
1798
+ let h = parseInt(r.zIndex || "0", 10);
1799
1799
  return isNaN(h) && (h = 0), t.style.zIndex = "" + (h + 1), t;
1800
1800
  }
1801
1801
  Kr() {
@@ -1810,7 +1810,7 @@ class De {
1810
1810
  const t = this.qr();
1811
1811
  for (const e of t) {
1812
1812
  if (!e) continue;
1813
- const i = Be(window.getComputedStyle(e).backgroundColor);
1813
+ const i = Ne(window.getComputedStyle(e).backgroundColor);
1814
1814
  if (i) return i;
1815
1815
  }
1816
1816
  return [255, 255, 255, 255];
@@ -1857,45 +1857,45 @@ class De {
1857
1857
  }
1858
1858
  }
1859
1859
  function $(n) {
1860
- return O(parseInt(n, 16), 0, 255);
1860
+ return I(parseInt(n, 16), 0, 255);
1861
1861
  }
1862
1862
  class S {
1863
- constructor(t, e, i, r) {
1863
+ constructor(t, e, i, s) {
1864
1864
  a(this, "sn");
1865
1865
  a(this, "en");
1866
1866
  a(this, "r");
1867
1867
  a(this, "g");
1868
1868
  a(this, "b");
1869
1869
  a(this, "a");
1870
- this.r = O(t, 0, 255), this.g = O(e, 0, 255), this.b = O(i, 0, 255), this.a = O(r, 0, 255), this.sn = [this.r, this.g, this.b, this.a], this.en = [this.r / 255, this.g / 255, this.b / 255, this.a / 255];
1870
+ this.r = I(t, 0, 255), this.g = I(e, 0, 255), this.b = I(i, 0, 255), this.a = I(s, 0, 255), this.sn = [this.r, this.g, this.b, this.a], this.en = [this.r / 255, this.g / 255, this.b / 255, this.a / 255];
1871
1871
  }
1872
- static rn(t, e, i, r) {
1872
+ static rn(t, e, i, s) {
1873
1873
  if (S.nn(t)) return t;
1874
1874
  if (Array.isArray(t)) {
1875
1875
  if (t.length < 3) throw Error("Component tuples must include at least RGB values.");
1876
- const [s, h, o] = t, c = t.length === 4 ? t[3] : 255;
1877
- return S.hn(s, h, o, c);
1876
+ const [r, h, o] = t, c = t.length === 4 ? t[3] : 255;
1877
+ return S.hn(r, h, o, c);
1878
1878
  }
1879
1879
  if (typeof t == "string") {
1880
- const s = t.trim();
1881
- if (s.length === 0) throw Error("Color strings cannot be empty.");
1882
- return S.an(s);
1880
+ const r = t.trim();
1881
+ if (r.length === 0) throw Error("Color strings cannot be empty.");
1882
+ return S.an(r);
1883
1883
  }
1884
- if (typeof t == "number") return typeof e == "number" && typeof i == "number" ? S.hn(t, e, i, r ?? 255) : S.cn(t);
1884
+ if (typeof t == "number") return typeof e == "number" && typeof i == "number" ? S.hn(t, e, i, s ?? 255) : S.cn(t);
1885
1885
  throw Error("Unsupported color input passed to TextmodeColor.$from.");
1886
1886
  }
1887
- static hn(t, e, i, r = 255) {
1888
- return new S(t, e, i, r);
1887
+ static hn(t, e, i, s = 255) {
1888
+ return new S(t, e, i, s);
1889
1889
  }
1890
1890
  static cn(t, e = 255) {
1891
1891
  return new S(t, t, t, e);
1892
1892
  }
1893
1893
  static an(t) {
1894
1894
  return new S(...function(e) {
1895
- const i = e.replace(/^#|0x/gi, ""), r = (s = i).length === 3 || s.length === 4 ? s.split("").map((h) => h + h).join("") : s;
1896
- var s;
1897
- if (r.length !== 6 && r.length !== 8) throw Error("Invalid hex color: " + e);
1898
- return [$(r.slice(0, 2)), $(r.slice(2, 4)), $(r.slice(4, 6)), r.length === 8 ? $(r.slice(6, 8)) : 255];
1895
+ const i = e.replace(/^#|0x/gi, ""), s = (r = i).length === 3 || r.length === 4 ? r.split("").map((h) => h + h).join("") : r;
1896
+ var r;
1897
+ if (s.length !== 6 && s.length !== 8) throw Error("Invalid hex color: " + e);
1898
+ return [$(s.slice(0, 2)), $(s.slice(2, 4)), $(s.slice(4, 6)), s.length === 8 ? $(s.slice(6, 8)) : 255];
1899
1899
  }(t));
1900
1900
  }
1901
1901
  get rgb() {
@@ -1915,7 +1915,7 @@ class S {
1915
1915
  }
1916
1916
  }
1917
1917
  class St {
1918
- constructor(t, e, i, r, s, h, o, c) {
1918
+ constructor(t, e, i, s, r, h, o, c) {
1919
1919
  a(this, "A");
1920
1920
  a(this, "Z");
1921
1921
  a(this, "ln");
@@ -1939,7 +1939,7 @@ class St {
1939
1939
  a(this, "yn", [0, 0, 0, 1]);
1940
1940
  a(this, "An", [[0.1, 0, 0]]);
1941
1941
  a(this, "wn", null);
1942
- this.A = t, this.Z = e, this.ln = i, this.gn = r, this.un = s, this.fn = h, this.N = o, this.X = c;
1942
+ this.A = t, this.Z = e, this.ln = i, this.gn = s, this.un = r, this.fn = h, this.N = o, this.X = c;
1943
1943
  }
1944
1944
  conversionMode(t) {
1945
1945
  return this.vn = t, this.pn = null, this.q = null, this;
@@ -1965,14 +1965,14 @@ class St {
1965
1965
  cellColorMode(t) {
1966
1966
  return this._n = t, this.q = null, this;
1967
1967
  }
1968
- charColor(t, e, i, r) {
1969
- return this.bn(this.Xt, t, e, i, r), this.q = null, this;
1968
+ charColor(t, e, i, s) {
1969
+ return this.bn(this.Xt, t, e, i, s), this.q = null, this;
1970
1970
  }
1971
- cellColor(t, e, i, r) {
1972
- return this.bn(this.Yt, t, e, i, r), this.q = null, this;
1971
+ cellColor(t, e, i, s) {
1972
+ return this.bn(this.Yt, t, e, i, s), this.q = null, this;
1973
1973
  }
1974
- background(t, e, i, r) {
1975
- return this.bn(this.yn, t, e, i, r), this.q = null, this;
1974
+ background(t, e, i, s) {
1975
+ return this.bn(this.yn, t, e, i, s), this.q = null, this;
1976
1976
  }
1977
1977
  characters(t) {
1978
1978
  return this.wn = t, this.Cn(t), this.q = null, this;
@@ -2002,11 +2002,11 @@ class St {
2002
2002
  }
2003
2003
  ft() {
2004
2004
  this.xn();
2005
- const t = this.Mn(), e = this.Fn(), i = t.createShader(e), r = t.createUniforms(e);
2006
- this.q = this.Z.materialManager.Ni(i, r);
2005
+ const t = this.Mn(), e = this.Fn(), i = t.createShader(e), s = t.createUniforms(e);
2006
+ this.q = this.Z.materialManager.Ni(i, s);
2007
2007
  }
2008
- bn(t, e, i, r, s) {
2009
- const h = S.rn(e, i, r, s);
2008
+ bn(t, e, i, s, r) {
2009
+ const h = S.rn(e, i, s, r);
2010
2010
  tt(t, h.r, h.g, h.b, h.a);
2011
2011
  }
2012
2012
  Cn(t) {
@@ -2029,15 +2029,15 @@ class St {
2029
2029
  }
2030
2030
  }
2031
2031
  class z extends St {
2032
- constructor(t, e, i, r, s, h, o, c) {
2033
- const l = Math.min(o / s, c / h);
2034
- super(t, e, i, r, s, h, Math.max(1, Math.floor(s * l)), Math.max(1, Math.floor(h * l)));
2032
+ constructor(t, e, i, s, r, h, o, c) {
2033
+ const l = Math.min(o / r, c / h);
2034
+ super(t, e, i, s, r, h, Math.max(1, Math.floor(r * l)), Math.max(1, Math.floor(h * l)));
2035
2035
  }
2036
- static Tn(t, e, i, r, s) {
2036
+ static Tn(t, e, i, s, r) {
2037
2037
  const h = t.context, o = h.createTexture();
2038
2038
  h.bindTexture(h.TEXTURE_2D, o), h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL, 1), pt(h, h.NEAREST, h.NEAREST, h.CLAMP_TO_EDGE, h.CLAMP_TO_EDGE), h.texImage2D(h.TEXTURE_2D, 0, h.RGBA, h.RGBA, h.UNSIGNED_BYTE, i), h.bindTexture(h.TEXTURE_2D, null);
2039
2039
  const c = i.naturalWidth ?? i.width ?? i.videoWidth ?? 0, l = i.naturalHeight ?? i.height ?? i.videoHeight ?? 0;
2040
- return new z(h, t, o, e, c, l, r, s);
2040
+ return new z(h, t, o, e, c, l, s, r);
2041
2041
  }
2042
2042
  $n() {
2043
2043
  return this.ln;
@@ -2053,16 +2053,16 @@ class Ut {
2053
2053
  a(this, "Dn", 0);
2054
2054
  a(this, "Ln", []);
2055
2055
  a(this, "On", 10);
2056
- a(this, "Bn", 0);
2056
+ a(this, "In", 0);
2057
2057
  this.En = 1e3 / t;
2058
2058
  }
2059
- In(t) {
2059
+ Bn(t) {
2060
2060
  if (!this.zn) return;
2061
2061
  this.Sn = performance.now();
2062
2062
  const e = (i) => {
2063
2063
  if (!this.zn) return void (this.Rn = null);
2064
- const r = i - this.Sn;
2065
- r >= this.En && (t(), this.Sn = i - r % this.En), this.zn && (this.Rn = requestAnimationFrame(e));
2064
+ const s = i - this.Sn;
2065
+ s >= this.En && (t(), this.Sn = i - s % this.En), this.zn && (this.Rn = requestAnimationFrame(e));
2066
2066
  };
2067
2067
  this.Rn = requestAnimationFrame(e);
2068
2068
  }
@@ -2073,18 +2073,18 @@ class Ut {
2073
2073
  this.zn && (this.zn = !1, this.Hn());
2074
2074
  }
2075
2075
  Qn(t) {
2076
- this.zn || (this.zn = !0, this.In(t));
2076
+ this.zn || (this.zn = !0, this.Bn(t));
2077
2077
  }
2078
2078
  Nn(t, e) {
2079
2079
  if (t === void 0) return this.kn;
2080
- this.En = 1e3 / t, this.zn && e && (this.Hn(), this.In(e));
2080
+ this.En = 1e3 / t, this.zn && e && (this.Hn(), this.Bn(e));
2081
2081
  }
2082
2082
  Xn() {
2083
2083
  const t = performance.now();
2084
2084
  if (this.Dn > 0) {
2085
2085
  const e = t - this.Dn;
2086
2086
  this.Ln.push(e), this.Ln.length > this.On && this.Ln.shift();
2087
- const i = this.Ln.reduce((r, s) => r + s, 0) / this.Ln.length;
2087
+ const i = this.Ln.reduce((s, r) => s + r, 0) / this.Ln.length;
2088
2088
  this.kn = 1e3 / i;
2089
2089
  }
2090
2090
  this.Dn = t;
@@ -2096,13 +2096,13 @@ class Ut {
2096
2096
  return this.kn;
2097
2097
  }
2098
2098
  get Kn() {
2099
- return this.Bn;
2099
+ return this.In;
2100
2100
  }
2101
2101
  set Kn(t) {
2102
- this.Bn = t;
2102
+ this.In = t;
2103
2103
  }
2104
2104
  Wn() {
2105
- this.Bn++;
2105
+ this.In++;
2106
2106
  }
2107
2107
  }
2108
2108
  class Lt {
@@ -2170,8 +2170,8 @@ class Lt {
2170
2170
  } else {
2171
2171
  const e = Math.floor((t.cols - 1) / 2), i = Math.floor(t.rows / 2);
2172
2172
  if (this.qn.x !== -1 / 0 && this.qn.y !== -1 / 0) {
2173
- const r = -e, s = t.cols - e - 1, h = -i, o = t.rows - i - 1;
2174
- (this.qn.x < r || this.qn.x > s || this.qn.y < h || this.qn.y > o) && (this.qn.x = -1 / 0, this.qn.y = -1 / 0);
2173
+ const s = -e, r = t.cols - e - 1, h = -i, o = t.rows - i - 1;
2174
+ (this.qn.x < s || this.qn.x > r || this.qn.y < h || this.qn.y > o) && (this.qn.x = -1 / 0, this.qn.y = -1 / 0);
2175
2175
  }
2176
2176
  }
2177
2177
  } catch {
@@ -2187,13 +2187,13 @@ class Lt {
2187
2187
  To(t) {
2188
2188
  this.uo = t;
2189
2189
  }
2190
- Eo(t) {
2190
+ Uo(t) {
2191
2191
  this.fo = t;
2192
2192
  }
2193
- Ro(t) {
2193
+ Eo(t) {
2194
2194
  this.do = t;
2195
2195
  }
2196
- So() {
2196
+ Ro() {
2197
2197
  return { x: this.qn.x, y: this.qn.y };
2198
2198
  }
2199
2199
  Ao(t) {
@@ -2229,102 +2229,103 @@ class Lt {
2229
2229
  yo(t) {
2230
2230
  const e = this.kr.canvas, i = this.Zn();
2231
2231
  if (this.Vn = { ...this.qn }, this.Jn = { x: t.clientX, y: t.clientY }, !i) return this.qn.x = -1 / 0, void (this.qn.y = -1 / 0);
2232
- const r = e.getBoundingClientRect(), s = t.clientX - r.left, h = t.clientY - r.top, o = e.width / r.width, c = h * (e.height / r.height), l = s * o - i.offsetX, u = c - i.offsetY, f = Math.floor(l / i.cellWidth), d = Math.floor(u / i.cellHeight);
2232
+ const s = e.getBoundingClientRect(), r = t.clientX - s.left, h = t.clientY - s.top, o = e.width / s.width, c = h * (e.height / s.height), l = r * o - i.offsetX, u = c - i.offsetY, f = Math.floor(l / i.cellWidth), d = Math.floor(u / i.cellHeight);
2233
2233
  if (f >= 0 && f < i.cols && d >= 0 && d < i.rows) {
2234
2234
  const g = Math.floor((i.cols - 1) / 2);
2235
2235
  this.qn.x = f - g, this.qn.y = d - Math.floor(i.rows / 2);
2236
2236
  } else this.qn.x = -1 / 0, this.qn.y = -1 / 0;
2237
2237
  }
2238
2238
  }
2239
- const Ie = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Lt }, Symbol.toStringTag, { value: "Module" }));
2240
- class Nt {
2239
+ const De = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Lt }, Symbol.toStringTag, { value: "Module" }));
2240
+ class Bt {
2241
2241
  constructor() {
2242
- a(this, "zo", /* @__PURE__ */ new Map());
2242
+ a(this, "So", /* @__PURE__ */ new Map());
2243
+ a(this, "zo", null);
2243
2244
  a(this, "ko", null);
2244
- a(this, "Do", null);
2245
+ a(this, "Do");
2245
2246
  a(this, "Lo");
2246
- a(this, "Oo");
2247
2247
  a(this, "ao", !1);
2248
- a(this, "Bo");
2248
+ a(this, "Oo");
2249
2249
  a(this, "Io");
2250
- a(this, "Ho", { ArrowUp: "UP_ARROW", ArrowDown: "DOWN_ARROW", ArrowLeft: "LEFT_ARROW", ArrowRight: "RIGHT_ARROW", F1: "F1", F2: "F2", F3: "F3", F4: "F4", F5: "F5", F6: "F6", F7: "F7", F8: "F8", F9: "F9", F10: "F10", F11: "F11", F12: "F12", Enter: "ENTER", Return: "RETURN", Tab: "TAB", Escape: "ESCAPE", Backspace: "BACKSPACE", Delete: "DELETE", Insert: "INSERT", Home: "HOME", End: "END", PageUp: "PAGE_UP", PageDown: "PAGE_DOWN", Shift: "SHIFT", Control: "CONTROL", Alt: "ALT", Meta: "META", " ": "SPACE" });
2250
+ a(this, "Bo", { ArrowUp: "UP_ARROW", ArrowDown: "DOWN_ARROW", ArrowLeft: "LEFT_ARROW", ArrowRight: "RIGHT_ARROW", F1: "F1", F2: "F2", F3: "F3", F4: "F4", F5: "F5", F6: "F6", F7: "F7", F8: "F8", F9: "F9", F10: "F10", F11: "F11", F12: "F12", Enter: "ENTER", Return: "RETURN", Tab: "TAB", Escape: "ESCAPE", Backspace: "BACKSPACE", Delete: "DELETE", Insert: "INSERT", Home: "HOME", End: "END", PageUp: "PAGE_UP", PageDown: "PAGE_DOWN", Shift: "SHIFT", Control: "CONTROL", Alt: "ALT", Meta: "META", " ": "SPACE" });
2251
2251
  }
2252
2252
  _o() {
2253
- this.ao || (this.Lo = (t) => {
2253
+ this.ao || (this.Do = (t) => {
2254
+ this.Ho(t);
2255
+ }, this.Lo = (t) => {
2254
2256
  this.Go(t);
2255
- }, this.Oo = (t) => {
2256
- this.Qo(t);
2257
- }, window.addEventListener("keydown", this.Lo, { passive: !1 }), window.addEventListener("keyup", this.Oo, { passive: !1 }), this.ao = !0);
2257
+ }, window.addEventListener("keydown", this.Do, { passive: !1 }), window.addEventListener("keyup", this.Lo, { passive: !1 }), this.ao = !0);
2258
2258
  }
2259
2259
  Mo() {
2260
- this.ao && (window.removeEventListener("keydown", this.Lo), window.removeEventListener("keyup", this.Oo), this.ao = !1, this.zo.clear(), this.ko = null, this.Do = null);
2260
+ this.ao && (window.removeEventListener("keydown", this.Do), window.removeEventListener("keyup", this.Lo), this.ao = !1, this.So.clear(), this.zo = null, this.ko = null);
2261
2261
  }
2262
2262
  Po(t) {
2263
- this.Bo = t;
2263
+ this.Oo = t;
2264
2264
  }
2265
2265
  To(t) {
2266
2266
  this.Io = t;
2267
2267
  }
2268
- No(t) {
2269
- const e = this.Xo(t), i = this.zo.get(t) || this.zo.get(e);
2268
+ Qo(t) {
2269
+ const e = this.No(t), i = this.So.get(t) || this.So.get(e);
2270
2270
  return (i == null ? void 0 : i.isPressed) || !1;
2271
2271
  }
2272
+ Xo() {
2273
+ return this.zo;
2274
+ }
2272
2275
  Yo() {
2273
2276
  return this.ko;
2274
2277
  }
2275
2278
  jo() {
2276
- return this.Do;
2277
- }
2278
- Ko() {
2279
2279
  const t = [];
2280
- for (const [e, i] of this.zo) i.isPressed && t.push(e);
2280
+ for (const [e, i] of this.So) i.isPressed && t.push(e);
2281
2281
  return t;
2282
2282
  }
2283
- Wo() {
2284
- return { ctrl: this.No("Control"), shift: this.No("Shift"), alt: this.No("Alt"), meta: this.No("Meta") };
2283
+ Ko() {
2284
+ return { ctrl: this.Qo("Control"), shift: this.Qo("Shift"), alt: this.Qo("Alt"), meta: this.Qo("Meta") };
2285
2285
  }
2286
- Zo() {
2287
- this.zo.clear(), this.ko = null, this.Do = null;
2286
+ Wo() {
2287
+ this.So.clear(), this.zo = null, this.ko = null;
2288
2288
  }
2289
- Go(t) {
2289
+ Ho(t) {
2290
2290
  const e = t.key, i = Date.now();
2291
- this.zo.has(e) || this.zo.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2292
- const r = this.zo.get(e);
2293
- if (!r.isPressed && (r.isPressed = !0, r.lastPressTime = i, this.ko = e, this.Bo)) {
2294
- const s = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !0, originalEvent: t };
2295
- this.Bo(s);
2291
+ this.So.has(e) || this.So.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2292
+ const s = this.So.get(e);
2293
+ if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.zo = e, this.Oo)) {
2294
+ const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !0, originalEvent: t };
2295
+ this.Oo(r);
2296
2296
  }
2297
2297
  }
2298
- Qo(t) {
2298
+ Go(t) {
2299
2299
  const e = t.key, i = Date.now();
2300
- this.zo.has(e) || this.zo.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2301
- const r = this.zo.get(e);
2302
- if (r.isPressed = !1, r.lastReleaseTime = i, this.Do = e, this.Io) {
2303
- const s = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !1, originalEvent: t };
2304
- this.Io(s);
2300
+ this.So.has(e) || this.So.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2301
+ const s = this.So.get(e);
2302
+ if (s.isPressed = !1, s.lastReleaseTime = i, this.ko = e, this.Io) {
2303
+ const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !1, originalEvent: t };
2304
+ this.Io(r);
2305
2305
  }
2306
2306
  }
2307
- Xo(t) {
2308
- return this.Ho[t] || t.toLowerCase();
2307
+ No(t) {
2308
+ return this.Bo[t] || t.toLowerCase();
2309
2309
  }
2310
2310
  }
2311
- const _e = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Nt }, Symbol.toStringTag, { value: "Module" }));
2312
- class Bt {
2311
+ const Oe = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Bt }, Symbol.toStringTag, { value: "Module" }));
2312
+ class Nt {
2313
2313
  constructor(t, e, i) {
2314
2314
  a(this, "kr");
2315
- a(this, "qo");
2315
+ a(this, "Zo");
2316
2316
  a(this, "Zn");
2317
+ a(this, "qo", /* @__PURE__ */ new Map());
2317
2318
  a(this, "Vo", /* @__PURE__ */ new Map());
2318
2319
  a(this, "Jo", /* @__PURE__ */ new Map());
2319
- a(this, "th", /* @__PURE__ */ new Map());
2320
- a(this, "sh", null);
2320
+ a(this, "th", null);
2321
+ a(this, "sh");
2321
2322
  a(this, "ih");
2322
2323
  a(this, "eh");
2323
2324
  a(this, "rh");
2324
2325
  a(this, "nh");
2325
2326
  a(this, "oh");
2326
- a(this, "hh");
2327
2327
  a(this, "ao", !1);
2328
+ a(this, "hh");
2328
2329
  a(this, "ah");
2329
2330
  a(this, "uh");
2330
2331
  a(this, "fh");
@@ -2334,59 +2335,61 @@ class Bt {
2334
2335
  a(this, "mh");
2335
2336
  a(this, "_h");
2336
2337
  a(this, "yh");
2337
- a(this, "Ah");
2338
- a(this, "wh", 320);
2339
- a(this, "bh", 350);
2340
- a(this, "Ch", 10);
2341
- a(this, "xh", 550);
2342
- a(this, "Mh", 14);
2343
- a(this, "Fh", 48);
2344
- a(this, "$h", 650);
2345
- a(this, "Ph", 0.02);
2346
- a(this, "Th", 2);
2347
- a(this, "Eh", 600);
2348
- a(this, "Rh", 0);
2349
- a(this, "Sh", null);
2350
- this.kr = t, this.Zn = e, this.qo = i;
2351
- const r = this.kr.canvas;
2352
- this.ih = r.style.touchAction, this.eh = r.style.userSelect, r.style.touchAction || (r.style.touchAction = "none"), r.style.userSelect || (r.style.userSelect = "none");
2338
+ a(this, "Ah", 320);
2339
+ a(this, "wh", 350);
2340
+ a(this, "bh", 10);
2341
+ a(this, "Ch", 550);
2342
+ a(this, "xh", 14);
2343
+ a(this, "Mh", 48);
2344
+ a(this, "Fh", 650);
2345
+ a(this, "$h", 0.02);
2346
+ a(this, "Ph", 2);
2347
+ a(this, "Th", 600);
2348
+ a(this, "Eh", 0);
2349
+ a(this, "Rh", null);
2350
+ this.kr = t, this.Zn = e, this.Zo = i;
2351
+ const s = this.kr.canvas;
2352
+ this.sh = s.style.touchAction, this.ih = s.style.userSelect, s.style.touchAction || (s.style.touchAction = "none"), s.style.userSelect || (s.style.userSelect = "none");
2353
2353
  }
2354
2354
  _o() {
2355
2355
  if (this.ao) return;
2356
2356
  const t = this.kr.canvas;
2357
- this.rh = (e) => {
2357
+ this.eh = (e) => {
2358
+ this.Sh(e);
2359
+ }, this.rh = (e) => {
2358
2360
  this.zh(e);
2359
2361
  }, this.nh = (e) => {
2360
2362
  this.kh(e);
2361
2363
  }, this.oh = (e) => {
2362
2364
  this.Dh(e);
2363
- }, this.hh = (e) => {
2364
- this.Lh(e);
2365
- }, t.addEventListener("touchstart", this.rh, { passive: !1 }), t.addEventListener("touchmove", this.nh, { passive: !1 }), t.addEventListener("touchend", this.oh, { passive: !1 }), t.addEventListener("touchcancel", this.hh, { passive: !1 }), this.ao = !0;
2365
+ }, t.addEventListener("touchstart", this.eh, { passive: !1 }), t.addEventListener("touchmove", this.rh, { passive: !1 }), t.addEventListener("touchend", this.nh, { passive: !1 }), t.addEventListener("touchcancel", this.oh, { passive: !1 }), this.ao = !0;
2366
2366
  }
2367
2367
  Mo() {
2368
2368
  if (!this.ao) return;
2369
2369
  const t = this.kr.canvas;
2370
- t.removeEventListener("touchstart", this.rh), t.removeEventListener("touchmove", this.nh), t.removeEventListener("touchend", this.oh), t.removeEventListener("touchcancel", this.hh), this.ao = !1, this.sh = null, this.Vo.clear(), this.Jo.clear(), this.th.forEach((e) => {
2370
+ t.removeEventListener("touchstart", this.eh), t.removeEventListener("touchmove", this.rh), t.removeEventListener("touchend", this.nh), t.removeEventListener("touchcancel", this.oh), this.ao = !1, this.th = null, this.qo.clear(), this.Vo.clear(), this.Jo.forEach((e) => {
2371
2371
  e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
2372
- }), this.th.clear(), this.Sh = null, this.Rh = 0, t.style.touchAction = this.ih, t.style.userSelect = this.eh;
2372
+ }), this.Jo.clear(), this.Rh = null, this.Eh = 0, t.style.touchAction = this.sh, t.style.userSelect = this.ih;
2373
2373
  }
2374
2374
  Fo() {
2375
- if (!this.Zn() || this.Vo.size === 0) return;
2375
+ if (!this.Zn() || this.qo.size === 0) return;
2376
2376
  const t = /* @__PURE__ */ new Map();
2377
- for (const e of this.Vo.values()) {
2378
- const i = this.Oh(e.clientX, e.clientY, e.id, e);
2377
+ for (const e of this.qo.values()) {
2378
+ const i = this.Lh(e.clientX, e.clientY, e.id, e);
2379
2379
  t.set(e.id, i);
2380
2380
  }
2381
- this.Vo = t;
2381
+ this.qo = t;
2382
2382
  }
2383
- Bh() {
2384
- return Array.from(this.Vo.values()).map((t) => ({ ...t }));
2383
+ Oh() {
2384
+ return Array.from(this.qo.values()).map((t) => ({ ...t }));
2385
2385
  }
2386
2386
  Ih(t) {
2387
+ this.hh = t;
2388
+ }
2389
+ Uo(t) {
2387
2390
  this.ah = t;
2388
2391
  }
2389
- Eo(t) {
2392
+ Bh(t) {
2390
2393
  this.uh = t;
2391
2394
  }
2392
2395
  Hh(t) {
@@ -2410,133 +2413,130 @@ class Bt {
2410
2413
  jh(t) {
2411
2414
  this.yh = t;
2412
2415
  }
2413
- Kh(t) {
2414
- this.Ah = t;
2416
+ Sh(t) {
2417
+ var s;
2418
+ if (!this.Zn()) return;
2419
+ t.preventDefault(), (s = this.Zo) == null || s.vo(this.Th);
2420
+ const e = performance.now(), i = this.Kh(t.changedTouches);
2421
+ for (const r of i) {
2422
+ const h = this.qo.get(r.id);
2423
+ h && this.Vo.set(r.id, this.Wh(h)), this.qo.set(r.id, r);
2424
+ const o = { id: r.id, startPosition: r, lastPosition: r, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
2425
+ this.gh && (o.longPressTimer = window.setTimeout(() => {
2426
+ const c = this.qo.get(r.id);
2427
+ c && (o.longPressFired = !0, this.gh({ touch: this.Wh(c), duration: performance.now() - o.startTime, originalEvent: t }));
2428
+ }, this.Ch)), this.Jo.set(r.id, o), this.hh && this.hh(this.Zh(r, t, void 0, e));
2429
+ }
2430
+ this.qo.size === 2 && this.qh();
2415
2431
  }
2416
2432
  zh(t) {
2417
- var r;
2433
+ var s;
2418
2434
  if (!this.Zn()) return;
2419
- t.preventDefault(), (r = this.qo) == null || r.vo(this.Eh);
2420
- const e = performance.now(), i = this.Wh(t.changedTouches);
2421
- for (const s of i) {
2422
- const h = this.Vo.get(s.id);
2423
- h && this.Jo.set(s.id, this.Zh(h)), this.Vo.set(s.id, s);
2424
- const o = { id: s.id, startPosition: s, lastPosition: s, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
2425
- this.mh && (o.longPressTimer = window.setTimeout(() => {
2426
- const c = this.Vo.get(s.id);
2427
- c && (o.longPressFired = !0, this.mh({ touch: this.Zh(c), duration: performance.now() - o.startTime, originalEvent: t }));
2428
- }, this.xh)), this.th.set(s.id, o), this.ah && this.ah(this.qh(s, t, void 0, e));
2435
+ t.preventDefault(), (s = this.Zo) == null || s.vo(this.Th);
2436
+ const e = performance.now(), i = this.Kh(t.changedTouches);
2437
+ for (const r of i) {
2438
+ const h = this.qo.get(r.id), o = h ? this.Wh(h) : void 0;
2439
+ o && this.Vo.set(r.id, o), this.qo.set(r.id, r);
2440
+ const c = this.Jo.get(r.id);
2441
+ c && (c.lastPosition = r, c.lastTime = e, o) && Y(o.clientX, o.clientY, r.clientX, r.clientY) > this.xh && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.ah && this.ah(this.Zh(r, t, o, e));
2429
2442
  }
2430
- this.Vo.size === 2 && this.Vh();
2443
+ this.qo.size === 2 ? this.Vh(t) : this.th = null;
2431
2444
  }
2432
2445
  kh(t) {
2433
- var r;
2434
2446
  if (!this.Zn()) return;
2435
- t.preventDefault(), (r = this.qo) == null || r.vo(this.Eh);
2436
- const e = performance.now(), i = this.Wh(t.changedTouches);
2447
+ t.preventDefault();
2448
+ const e = performance.now(), i = this.Kh(t.changedTouches);
2437
2449
  for (const s of i) {
2438
- const h = this.Vo.get(s.id), o = h ? this.Zh(h) : void 0;
2439
- o && this.Jo.set(s.id, o), this.Vo.set(s.id, s);
2440
- const c = this.th.get(s.id);
2441
- c && (c.lastPosition = s, c.lastTime = e, o) && Y(o.clientX, o.clientY, s.clientX, s.clientY) > this.Mh && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.uh && this.uh(this.qh(s, t, o, e));
2450
+ const r = this.qo.get(s.id), h = r ? this.Wh(r) : void 0, o = this.Jo.get(s.id);
2451
+ o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.uh && this.uh(this.Zh(s, t, h, e)), o && this.Jh(o, t), this.Jo.delete(s.id), this.Vo.delete(s.id), this.qo.delete(s.id);
2442
2452
  }
2443
- this.Vo.size === 2 ? this.Jh(t) : this.sh = null;
2453
+ this.qo.size < 2 && (this.th = null);
2444
2454
  }
2445
2455
  Dh(t) {
2446
2456
  if (!this.Zn()) return;
2447
2457
  t.preventDefault();
2448
- const e = performance.now(), i = this.Wh(t.changedTouches);
2449
- for (const r of i) {
2450
- const s = this.Vo.get(r.id), h = s ? this.Zh(s) : void 0, o = this.th.get(r.id);
2451
- o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.fh && this.fh(this.qh(r, t, h, e)), o && this.ta(o, t), this.th.delete(r.id), this.Jo.delete(r.id), this.Vo.delete(r.id);
2452
- }
2453
- this.Vo.size < 2 && (this.sh = null);
2454
- }
2455
- Lh(t) {
2456
- if (!this.Zn()) return;
2457
- t.preventDefault();
2458
- const e = performance.now(), i = this.Wh(t.changedTouches);
2459
- for (const r of i) {
2460
- const s = this.Vo.get(r.id), h = s ? this.Zh(s) : void 0, o = this.th.get(r.id);
2461
- o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.dh && this.dh(this.qh(r, t, h, e)), this.th.delete(r.id), this.Jo.delete(r.id), this.Vo.delete(r.id);
2458
+ const e = performance.now(), i = this.Kh(t.changedTouches);
2459
+ for (const s of i) {
2460
+ const r = this.qo.get(s.id), h = r ? this.Wh(r) : void 0, o = this.Jo.get(s.id);
2461
+ o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.fh && this.fh(this.Zh(s, t, h, e)), this.Jo.delete(s.id), this.Vo.delete(s.id), this.qo.delete(s.id);
2462
2462
  }
2463
- this.Vo.size < 2 && (this.sh = null);
2463
+ this.qo.size < 2 && (this.th = null);
2464
2464
  }
2465
- Wh(t) {
2465
+ Kh(t) {
2466
2466
  const e = [];
2467
2467
  for (let i = 0; i < t.length; i += 1) {
2468
- const r = t.item(i);
2469
- r && e.push(this.sa(r));
2468
+ const s = t.item(i);
2469
+ s && e.push(this.ta(s));
2470
2470
  }
2471
2471
  return e;
2472
2472
  }
2473
- sa(t) {
2474
- return this.Oh(t.clientX, t.clientY, t.identifier, { id: t.identifier, x: -1, y: -1, clientX: t.clientX, clientY: t.clientY, pressure: t.force, radiusX: t.radiusX, radiusY: t.radiusY, rotationAngle: t.rotationAngle });
2473
+ ta(t) {
2474
+ return this.Lh(t.clientX, t.clientY, t.identifier, { id: t.identifier, x: -1, y: -1, clientX: t.clientX, clientY: t.clientY, pressure: t.force, radiusX: t.radiusX, radiusY: t.radiusY, rotationAngle: t.rotationAngle });
2475
2475
  }
2476
- Oh(t, e, i, r) {
2477
- const s = this.kr.canvas, h = this.Zn(), o = s.getBoundingClientRect(), c = t - o.left, l = e - o.top, u = c * (s.width / o.width), f = l * (s.height / o.height);
2478
- if (!h) return { id: i, x: -1 / 0, y: -1 / 0, clientX: t, clientY: e, pressure: r.pressure, radiusX: r.radiusX, radiusY: r.radiusY, rotationAngle: r.rotationAngle };
2476
+ Lh(t, e, i, s) {
2477
+ const r = this.kr.canvas, h = this.Zn(), o = r.getBoundingClientRect(), c = t - o.left, l = e - o.top, u = c * (r.width / o.width), f = l * (r.height / o.height);
2478
+ if (!h) return { id: i, x: -1 / 0, y: -1 / 0, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
2479
2479
  const d = u - h.offsetX, g = f - h.offsetY, p = Math.floor(d / h.cellWidth), v = Math.floor(g / h.cellHeight);
2480
- return p >= 0 && p < h.cols && v >= 0 && v < h.rows ? { id: i, x: p - Math.floor((h.cols - 1) / 2), y: v - Math.floor(h.rows / 2), clientX: t, clientY: e, pressure: r.pressure, radiusX: r.radiusX, radiusY: r.radiusY, rotationAngle: r.rotationAngle } : { id: i, x: -1 / 0, y: -1 / 0, clientX: t, clientY: e, pressure: r.pressure, radiusX: r.radiusX, radiusY: r.radiusY, rotationAngle: r.rotationAngle };
2481
- }
2482
- qh(t, e, i, r) {
2483
- const s = this.th.get(t.id), h = Array.from(this.Jo.values()).map((l) => this.Zh(l)), o = Array.from(this.Vo.values()).map((l) => this.Zh(l)), c = this.Wh(e.changedTouches);
2484
- return { touch: this.Zh(t), previousTouch: i ? this.Zh(i) : void 0, touches: o, previousTouches: h, changedTouches: c, deltaTime: s ? r - s.lastTime : 0, originalEvent: e };
2485
- }
2486
- Vh() {
2487
- if (this.Vo.size !== 2) return void (this.sh = null);
2488
- const t = Array.from(this.Vo.values()), [e, i] = t, r = Y(e.x, e.y, i.x, i.y), s = mt(e.clientX, e.clientY, i.clientX, i.clientY);
2489
- this.sh = { ids: [e.id, i.id], initialDistance: Math.max(r, 1e-4), initialAngle: s, lastScale: 1, lastRotation: 0 };
2490
- }
2491
- Jh(t) {
2492
- if (this.sh || this.Vh(), !this.sh) return;
2493
- const [e, i] = this.sh.ids, r = this.Vo.get(e), s = this.Vo.get(i);
2494
- if (!r || !s) return;
2495
- const h = Y(r.x, r.y, s.x, s.y) / this.sh.initialDistance, o = h - this.sh.lastScale;
2496
- this.yh && Math.abs(o) > this.Ph && (this.yh({ touches: [this.Zh(r), this.Zh(s)], scale: h, deltaScale: o, center: this.ia(r, s), originalEvent: t }), this.sh.lastScale = h);
2497
- let c = mt(r.clientX, r.clientY, s.clientX, s.clientY) - this.sh.initialAngle;
2480
+ return p >= 0 && p < h.cols && v >= 0 && v < h.rows ? { id: i, x: p - Math.floor((h.cols - 1) / 2), y: v - Math.floor(h.rows / 2), clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle } : { id: i, x: -1 / 0, y: -1 / 0, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
2481
+ }
2482
+ Zh(t, e, i, s) {
2483
+ const r = this.Jo.get(t.id), h = Array.from(this.Vo.values()).map((l) => this.Wh(l)), o = Array.from(this.qo.values()).map((l) => this.Wh(l)), c = this.Kh(e.changedTouches);
2484
+ return { touch: this.Wh(t), previousTouch: i ? this.Wh(i) : void 0, touches: o, previousTouches: h, changedTouches: c, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
2485
+ }
2486
+ qh() {
2487
+ if (this.qo.size !== 2) return void (this.th = null);
2488
+ const t = Array.from(this.qo.values()), [e, i] = t, s = Y(e.x, e.y, i.x, i.y), r = At(e.clientX, e.clientY, i.clientX, i.clientY);
2489
+ this.th = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
2490
+ }
2491
+ Vh(t) {
2492
+ if (this.th || this.qh(), !this.th) return;
2493
+ const [e, i] = this.th.ids, s = this.qo.get(e), r = this.qo.get(i);
2494
+ if (!s || !r) return;
2495
+ const h = Y(s.x, s.y, r.x, r.y) / this.th.initialDistance, o = h - this.th.lastScale;
2496
+ this._h && Math.abs(o) > this.$h && (this._h({ touches: [this.Wh(s), this.Wh(r)], scale: h, deltaScale: o, center: this.sa(s, r), originalEvent: t }), this.th.lastScale = h);
2497
+ let c = At(s.clientX, s.clientY, r.clientX, r.clientY) - this.th.initialAngle;
2498
2498
  c = (c + 180) % 360 - 180;
2499
- const l = c - this.sh.lastRotation;
2500
- this.Ah && Math.abs(l) > this.Th && (this.Ah({ touches: [this.Zh(r), this.Zh(s)], rotation: c, deltaRotation: l, center: this.ia(r, s), originalEvent: t }), this.sh.lastRotation = c);
2499
+ const l = c - this.th.lastRotation;
2500
+ this.yh && Math.abs(l) > this.Ph && (this.yh({ touches: [this.Wh(s), this.Wh(r)], rotation: c, deltaRotation: l, center: this.sa(s, r), originalEvent: t }), this.th.lastRotation = c);
2501
2501
  }
2502
- ia(t, e) {
2503
- const i = (t.clientX + e.clientX) / 2, r = (t.clientY + e.clientY) / 2, s = this.Oh(i, r, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: r });
2504
- return { x: s.x, y: s.y };
2502
+ sa(t, e) {
2503
+ const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.Lh(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
2504
+ return { x: r.x, y: r.y };
2505
2505
  }
2506
- ta(t, e) {
2507
- const i = performance.now(), r = i - t.startTime, s = Y(t.startPosition.clientX, t.startPosition.clientY, t.lastPosition.clientX, t.lastPosition.clientY);
2508
- if (!t.longPressFired && r <= this.wh && s <= this.Ch)
2509
- this.ea(t.lastPosition, i) && this.gh ? this.gh({ touch: this.Zh(t.lastPosition), taps: 2, originalEvent: e }) : this.ph && this.ph({ touch: this.Zh(t.lastPosition), taps: 1, originalEvent: e });
2510
- else if (!t.longPressFired && r <= this.$h && s >= this.Fh) {
2511
- const h = { x: t.lastPosition.clientX - t.startPosition.clientX, y: t.lastPosition.clientY - t.startPosition.clientY }, o = Math.max(Math.hypot(h.x, h.y), 1e-4), c = { x: h.x / o, y: h.y / o }, l = { x: h.x / r, y: h.y / r };
2512
- this._h && this._h({ touch: this.Zh(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
2506
+ Jh(t, e) {
2507
+ const i = performance.now(), s = i - t.startTime, r = Y(t.startPosition.clientX, t.startPosition.clientY, t.lastPosition.clientX, t.lastPosition.clientY);
2508
+ if (!t.longPressFired && s <= this.Ah && r <= this.bh)
2509
+ this.ia(t.lastPosition, i) && this.ph ? this.ph({ touch: this.Wh(t.lastPosition), taps: 2, originalEvent: e }) : this.dh && this.dh({ touch: this.Wh(t.lastPosition), taps: 1, originalEvent: e });
2510
+ else if (!t.longPressFired && s <= this.Fh && r >= this.Mh) {
2511
+ const h = { x: t.lastPosition.clientX - t.startPosition.clientX, y: t.lastPosition.clientY - t.startPosition.clientY }, o = Math.max(Math.hypot(h.x, h.y), 1e-4), c = { x: h.x / o, y: h.y / o }, l = { x: h.x / s, y: h.y / s };
2512
+ this.mh && this.mh({ touch: this.Wh(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
2513
2513
  }
2514
- this.Rh = i, this.Sh = this.Zh(t.lastPosition);
2514
+ this.Eh = i, this.Rh = this.Wh(t.lastPosition);
2515
2515
  }
2516
- ea(t, e) {
2517
- return !this.Sh || e - this.Rh > this.bh ? !1 : Y(t.clientX, t.clientY, this.Sh.clientX, this.Sh.clientY) <= this.Ch;
2516
+ ia(t, e) {
2517
+ return !this.Rh || e - this.Eh > this.wh ? !1 : Y(t.clientX, t.clientY, this.Rh.clientX, this.Rh.clientY) <= this.bh;
2518
2518
  }
2519
- Zh(t) {
2519
+ Wh(t) {
2520
2520
  return { ...t };
2521
2521
  }
2522
2522
  }
2523
- const Oe = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Bt }, Symbol.toStringTag, { value: "Module" }));
2523
+ const Ie = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Nt }, Symbol.toStringTag, { value: "Module" }));
2524
2524
  class nt extends St {
2525
- constructor(e, i, r, s, h, o, c, l, u) {
2525
+ constructor(e, i, s, r, h, o, c, l, u) {
2526
2526
  const f = o / c;
2527
2527
  let d, g;
2528
2528
  f > 1 ? (d = l, g = Math.round(l / f)) : (g = u, d = Math.round(u * f));
2529
- super(e, i, r, s, o, c, d, g);
2530
- a(this, "ra");
2531
- this.ra = h;
2529
+ super(e, i, s, r, o, c, d, g);
2530
+ a(this, "ea");
2531
+ this.ea = h;
2532
2532
  }
2533
2533
  gt() {
2534
- super.gt(), this.ra.pause(), this.ra.src = "", this.ra.load();
2534
+ super.gt(), this.ea.pause(), this.ea.src = "", this.ea.load();
2535
2535
  }
2536
- na() {
2537
- if (this.ra.readyState >= this.ra.HAVE_CURRENT_DATA) {
2536
+ ra() {
2537
+ if (this.ea.readyState >= this.ea.HAVE_CURRENT_DATA) {
2538
2538
  const e = this.A;
2539
- e.bindTexture(e.TEXTURE_2D, this.ln), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, this.ra), e.bindTexture(e.TEXTURE_2D, null);
2539
+ e.bindTexture(e.TEXTURE_2D, this.ln), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, this.ea), e.bindTexture(e.TEXTURE_2D, null);
2540
2540
  }
2541
2541
  }
2542
2542
  $n() {
@@ -2546,61 +2546,61 @@ class nt extends St {
2546
2546
  return this.q = null, super.ut();
2547
2547
  }
2548
2548
  xn() {
2549
- this.na();
2549
+ this.ra();
2550
2550
  }
2551
- static async Tn(e, i, r, s, h) {
2551
+ static async Tn(e, i, s, r, h) {
2552
2552
  const o = e.context;
2553
2553
  let c;
2554
2554
  c = document.createElement("video"), c.crossOrigin = "anonymous", c.loop = !0, c.muted = !0, c.playsInline = !0, await new Promise((d, g) => {
2555
2555
  c.addEventListener("loadedmetadata", () => d(), { once: !0 }), c.addEventListener("error", (p) => {
2556
- var A;
2556
+ var m;
2557
2557
  const v = p.target;
2558
- g(Error("Failed to load video: " + (((A = v.error) == null ? void 0 : A.message) || "Unknown error")));
2559
- }, { once: !0 }), c.src = r;
2558
+ g(Error("Failed to load video: " + (((m = v.error) == null ? void 0 : m.message) || "Unknown error")));
2559
+ }, { once: !0 }), c.src = s;
2560
2560
  });
2561
2561
  const l = o.createTexture();
2562
2562
  o.bindTexture(o.TEXTURE_2D, l), o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL, 1), pt(o, o.LINEAR, o.LINEAR, o.CLAMP_TO_EDGE, o.CLAMP_TO_EDGE), o.texImage2D(o.TEXTURE_2D, 0, o.RGBA, o.RGBA, o.UNSIGNED_BYTE, c), o.bindTexture(o.TEXTURE_2D, null);
2563
2563
  const u = c.videoWidth, f = c.videoHeight;
2564
- return new nt(o, e, l, i, c, u, f, s, h);
2564
+ return new nt(o, e, l, i, c, u, f, r, h);
2565
2565
  }
2566
2566
  async play() {
2567
- await this.ra.play();
2567
+ await this.ea.play();
2568
2568
  }
2569
2569
  pause() {
2570
- this.ra.pause();
2570
+ this.ea.pause();
2571
2571
  }
2572
2572
  stop() {
2573
- this.ra.pause(), this.ra.currentTime = 0;
2573
+ this.ea.pause(), this.ea.currentTime = 0;
2574
2574
  }
2575
2575
  speed(e) {
2576
- return this.ra.playbackRate = e, this;
2576
+ return this.ea.playbackRate = e, this;
2577
2577
  }
2578
2578
  loop(e = !0) {
2579
- return this.ra.loop = e, this;
2579
+ return this.ea.loop = e, this;
2580
2580
  }
2581
2581
  time(e) {
2582
- return this.ra.currentTime = e, this;
2582
+ return this.ea.currentTime = e, this;
2583
2583
  }
2584
2584
  volume(e) {
2585
- return this.ra.volume = Math.max(0, Math.min(1, e)), this;
2585
+ return this.ea.volume = Math.max(0, Math.min(1, e)), this;
2586
2586
  }
2587
2587
  get videoElement() {
2588
- return this.ra;
2588
+ return this.ea;
2589
2589
  }
2590
2590
  get currentTime() {
2591
- return this.ra.currentTime;
2591
+ return this.ea.currentTime;
2592
2592
  }
2593
2593
  get duration() {
2594
- return this.ra.duration;
2594
+ return this.ea.duration;
2595
2595
  }
2596
2596
  get isPlaying() {
2597
- return !this.ra.paused && !this.ra.ended;
2597
+ return !this.ea.paused && !this.ea.ended;
2598
2598
  }
2599
2599
  }
2600
- const Ze = (n) => class extends n {
2601
- oa(t, e, i, r) {
2600
+ const Xe = (n) => class extends n {
2601
+ na(t, e, i, s) {
2602
2602
  if (S.nn(t)) return t;
2603
- if (typeof t == "number" || typeof t == "string") return this.color(t, e, i, r);
2603
+ if (typeof t == "number" || typeof t == "string") return this.color(t, e, i, s);
2604
2604
  throw Error("Unsupported color input passed to color-capable method.");
2605
2605
  }
2606
2606
  rotate(t = 0, e = 0, i = 0) {
@@ -2633,8 +2633,8 @@ const Ze = (n) => class extends n {
2633
2633
  pop() {
2634
2634
  this.Z.state.ht();
2635
2635
  }
2636
- color(t, e, i, r) {
2637
- return S.rn(t, e, i, r);
2636
+ color(t, e, i, s) {
2637
+ return S.rn(t, e, i, s);
2638
2638
  }
2639
2639
  rect(t = 1, e = 1) {
2640
2640
  this.Z.be(t, e);
@@ -2642,28 +2642,28 @@ const Ze = (n) => class extends n {
2642
2642
  point() {
2643
2643
  this.Z.be(1, 1);
2644
2644
  }
2645
- line(t, e, i, r) {
2646
- this.Z.Ce(t, e, i, r);
2645
+ line(t, e, i, s) {
2646
+ this.Z.Ce(t, e, i, s);
2647
2647
  }
2648
2648
  lineWeight(t) {
2649
2649
  this.Z.state.Zt(t);
2650
2650
  }
2651
- background(t, e, i, r = 255) {
2652
- const s = this.oa(t, e, i, r);
2653
- this.Z.Te(s.r, s.g, s.b, s.a);
2651
+ background(t, e, i, s = 255) {
2652
+ const r = this.na(t, e, i, s);
2653
+ this.Z.Te(r.r, r.g, r.b, r.a);
2654
2654
  }
2655
2655
  char(t) {
2656
2656
  const e = Array.from(t);
2657
2657
  if (e.length === 0) throw Error("char() requires at least one character.");
2658
2658
  this.Z.state.hs(this.dn.$r(e[0]));
2659
2659
  }
2660
- charColor(t, e, i, r) {
2661
- const s = this.oa(t, e, i, r);
2662
- this.Z.state.cs(s.r, s.g, s.b, s.a);
2660
+ charColor(t, e, i, s) {
2661
+ const r = this.na(t, e, i, s);
2662
+ this.Z.state.cs(r.r, r.g, r.b, r.a);
2663
2663
  }
2664
- cellColor(t, e, i, r) {
2665
- const s = this.oa(t, e, i, r);
2666
- this.Z.state.ls(s.r, s.g, s.b, s.a);
2664
+ cellColor(t, e, i, s) {
2665
+ const r = this.na(t, e, i, s);
2666
+ this.Z.state.ls(r.r, r.g, r.b, r.a);
2667
2667
  }
2668
2668
  flipX(t) {
2669
2669
  this.Z.state.us(t);
@@ -2683,14 +2683,14 @@ const Ze = (n) => class extends n {
2683
2683
  ellipse(t, e) {
2684
2684
  this.Z.xe(t / 2, e / 2);
2685
2685
  }
2686
- triangle(t, e, i, r, s, h) {
2687
- this.Z.Me(t, e, i, r, s, h);
2686
+ triangle(t, e, i, s, r, h) {
2687
+ this.Z.Me(t, e, i, s, r, h);
2688
2688
  }
2689
- bezierCurve(t, e, i, r, s, h, o, c) {
2690
- this.Z.Fe(t, e, i, r, s, h, o, c);
2689
+ bezierCurve(t, e, i, s, r, h, o, c) {
2690
+ this.Z.Fe(t, e, i, s, r, h, o, c);
2691
2691
  }
2692
- arc(t, e, i, r) {
2693
- this.Z.$e(t / 2, e / 2, i, r);
2692
+ arc(t, e, i, s) {
2693
+ this.Z.$e(t / 2, e / 2, i, s);
2694
2694
  }
2695
2695
  shader(t) {
2696
2696
  this.Z.ge(t);
@@ -2714,256 +2714,256 @@ const Ze = (n) => class extends n {
2714
2714
  return this.Z.Pe(t.width ?? this.grid.cols, t.height ?? this.grid.rows, t.attachments ?? 3);
2715
2715
  }
2716
2716
  image(t, e, i) {
2717
- const r = this.dn ?? this.ha.base.font;
2718
- this.Z.ye(t, e, i, r), t instanceof X && this.Z.ct();
2717
+ const s = this.dn ?? this.oa.base.font;
2718
+ this.Z.ye(t, e, i, s), t instanceof Z && this.Z.ct();
2719
2719
  }
2720
2720
  async loadImage(t) {
2721
2721
  if (typeof t != "string")
2722
2722
  return z.Tn(this.Z, this.gn, t, this.grid.cols, this.grid.rows);
2723
- const e = t, i = await new Promise((r, s) => {
2723
+ const e = t, i = await new Promise((s, r) => {
2724
2724
  const h = new Image();
2725
- h.crossOrigin = "anonymous", h.onload = () => r(h), h.onerror = (o) => s(o), h.src = e;
2725
+ h.crossOrigin = "anonymous", h.onload = () => s(h), h.onerror = (o) => r(o), h.src = e;
2726
2726
  });
2727
2727
  return z.Tn(this.Z, this.gn, i, this.grid.cols, this.grid.rows);
2728
2728
  }
2729
2729
  async loadVideo(t) {
2730
2730
  return await nt.Tn(this.Z, this.gn, t, this.grid.cols, this.grid.rows);
2731
2731
  }
2732
- }, Xe = (n) => class extends n {
2732
+ }, Ze = (n) => class extends n {
2733
2733
  get frameCount() {
2734
- return this.aa.Kn;
2734
+ return this.ha.Kn;
2735
2735
  }
2736
2736
  set frameCount(t) {
2737
- this.aa.Kn = t;
2737
+ this.ha.Kn = t;
2738
2738
  }
2739
2739
  frameRate(t) {
2740
- return t === void 0 ? this.aa.jn : this.aa.Nn(t, () => this.ca());
2740
+ return t === void 0 ? this.ha.jn : this.ha.Nn(t, () => this.aa());
2741
2741
  }
2742
2742
  noLoop() {
2743
- this.aa.Gn();
2743
+ this.ha.Gn();
2744
2744
  }
2745
2745
  loop() {
2746
- this.aa.Qn(() => this.ca());
2746
+ this.ha.Qn(() => this.aa());
2747
2747
  }
2748
2748
  redraw(t = 1) {
2749
- if (vt.m(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.ca();
2749
+ if (vt.m(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.aa();
2750
2750
  }
2751
2751
  isLooping() {
2752
- return this.aa.Yn;
2752
+ return this.ha.Yn;
2753
2753
  }
2754
2754
  }, ze = (n) => class extends n {
2755
2755
  constructor(...t) {
2756
2756
  super(...t);
2757
2757
  }
2758
2758
  mouseClicked(t) {
2759
- this.qo.$o(t);
2759
+ this.Zo.$o(t);
2760
2760
  }
2761
2761
  mousePressed(t) {
2762
- this.qo.Po(t);
2762
+ this.Zo.Po(t);
2763
2763
  }
2764
2764
  mouseReleased(t) {
2765
- this.qo.To(t);
2765
+ this.Zo.To(t);
2766
2766
  }
2767
2767
  mouseMoved(t) {
2768
- this.qo.Eo(t);
2768
+ this.Zo.Uo(t);
2769
2769
  }
2770
2770
  mouseScrolled(t) {
2771
- this.qo.Ro(t);
2771
+ this.Zo.Eo(t);
2772
2772
  }
2773
2773
  get mouse() {
2774
- return this.qo.So();
2774
+ return this.Zo.Ro();
2775
2775
  }
2776
2776
  cursor(t) {
2777
- this.qo.mo(t);
2777
+ this.Zo.mo(t);
2778
2778
  }
2779
2779
  }, ke = (n) => class extends n {
2780
2780
  constructor(...t) {
2781
2781
  super(...t);
2782
2782
  }
2783
2783
  touchStarted(t) {
2784
- this.la.Ih(t);
2784
+ this.ca.Ih(t);
2785
2785
  }
2786
2786
  touchMoved(t) {
2787
- this.la.Eo(t);
2787
+ this.ca.Uo(t);
2788
2788
  }
2789
2789
  touchEnded(t) {
2790
- this.la.Hh(t);
2790
+ this.ca.Bh(t);
2791
2791
  }
2792
2792
  touchCancelled(t) {
2793
- this.la.Gh(t);
2793
+ this.ca.Hh(t);
2794
2794
  }
2795
2795
  tap(t) {
2796
- this.la.Qh(t);
2796
+ this.ca.Gh(t);
2797
2797
  }
2798
2798
  doubleTap(t) {
2799
- this.la.Nh(t);
2799
+ this.ca.Qh(t);
2800
2800
  }
2801
2801
  longPress(t) {
2802
- this.la.Xh(t);
2802
+ this.ca.Nh(t);
2803
2803
  }
2804
2804
  swipe(t) {
2805
- this.la.Yh(t);
2805
+ this.ca.Xh(t);
2806
2806
  }
2807
2807
  pinch(t) {
2808
- this.la.jh(t);
2808
+ this.ca.Yh(t);
2809
2809
  }
2810
2810
  rotateGesture(t) {
2811
- this.la.Kh(t);
2811
+ this.ca.jh(t);
2812
2812
  }
2813
2813
  get touches() {
2814
- return this.la.Bh();
2814
+ return this.ca.Oh();
2815
2815
  }
2816
2816
  }, Ye = (n) => class extends n {
2817
2817
  constructor(...t) {
2818
2818
  super(...t);
2819
2819
  }
2820
2820
  keyPressed(t) {
2821
- this.ua.Po(t);
2821
+ this.la.Po(t);
2822
2822
  }
2823
2823
  keyReleased(t) {
2824
- this.ua.To(t);
2824
+ this.la.To(t);
2825
2825
  }
2826
2826
  isKeyPressed(t) {
2827
- return this.ua.No(t);
2827
+ return this.la.Qo(t);
2828
2828
  }
2829
2829
  get lastKeyPressed() {
2830
- return this.ua.Yo();
2830
+ return this.la.Xo();
2831
2831
  }
2832
2832
  get lastKeyReleased() {
2833
- return this.ua.jo();
2833
+ return this.la.Yo();
2834
2834
  }
2835
2835
  get pressedKeys() {
2836
- return this.ua.Ko();
2836
+ return this.la.jo();
2837
2837
  }
2838
2838
  get modifierState() {
2839
- return this.ua.Wo();
2839
+ return this.la.Ko();
2840
2840
  }
2841
2841
  };
2842
2842
  class Ge {
2843
2843
  constructor(t) {
2844
- a(this, "fa");
2845
- a(this, "da", /* @__PURE__ */ new Map());
2846
- a(this, "va", []);
2844
+ a(this, "ua");
2845
+ a(this, "fa", /* @__PURE__ */ new Map());
2846
+ a(this, "da", []);
2847
+ a(this, "va", /* @__PURE__ */ new Map());
2847
2848
  a(this, "pa", /* @__PURE__ */ new Map());
2848
- a(this, "ga", /* @__PURE__ */ new Map());
2849
- this.fa = t;
2849
+ this.ua = t;
2850
2850
  }
2851
- async ma(t) {
2851
+ async ga(t) {
2852
2852
  for (const e of t) {
2853
- if (this.da.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
2854
- const i = this._a(e.name);
2853
+ if (this.fa.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
2854
+ const i = this.ma(e.name);
2855
2855
  try {
2856
- await e.install(this.fa, i);
2857
- } catch (r) {
2858
- throw this.ya(e.name), r;
2856
+ await e.install(this.ua, i);
2857
+ } catch (s) {
2858
+ throw this._a(e.name), s;
2859
2859
  }
2860
- this.da.set(e.name, e), this.va.push(e.name);
2860
+ this.fa.set(e.name, e), this.da.push(e.name);
2861
2861
  }
2862
2862
  }
2863
- async wa(t) {
2864
- const e = this.da.get(t);
2863
+ async ya(t) {
2864
+ const e = this.fa.get(t);
2865
2865
  if (!e) return;
2866
- const i = this._a(t);
2867
- e.uninstall && await e.uninstall(this.fa, i), this.da.delete(t), this.va.splice(this.va.indexOf(t), 1), this.ya(t);
2866
+ const i = this.ma(t);
2867
+ e.uninstall && await e.uninstall(this.ua, i), this.fa.delete(t), this.da.splice(this.da.indexOf(t), 1), this._a(t);
2868
2868
  }
2869
- ba() {
2870
- this.Ca(this.pa);
2869
+ wa() {
2870
+ this.ba(this.va);
2871
2871
  }
2872
- xa() {
2873
- this.Ca(this.ga);
2872
+ Ca() {
2873
+ this.ba(this.pa);
2874
2874
  }
2875
- async Ma() {
2876
- const t = [...this.da.keys()];
2877
- for (const e of t) await this.wa(e);
2875
+ async xa() {
2876
+ const t = [...this.fa.keys()];
2877
+ for (const e of t) await this.ya(e);
2878
2878
  }
2879
- _a(t) {
2880
- const e = this.fa.layers.base, i = e.drawFramebuffer, r = e.asciiFramebuffer;
2881
- return { renderer: this.fa.Z, font: e.font, grid: e.grid, canvas: this.fa.kr, drawFramebuffer: i, asciiFramebuffer: r, registerPreDrawHook: (s) => this.Fa(this.pa, t, s), registerPostDrawHook: (s) => this.Fa(this.ga, t, s) };
2882
- }
2883
- Fa(t, e, i) {
2884
- const r = t.get(e) ?? /* @__PURE__ */ new Set();
2885
- return r.add(i), t.set(e, r), () => {
2886
- const s = t.get(e);
2887
- s && (s.delete(i), s.size === 0 && t.delete(e));
2879
+ ma(t) {
2880
+ const e = this.ua.layers.base, i = e.drawFramebuffer, s = e.asciiFramebuffer;
2881
+ return { renderer: this.ua.Z, font: e.font, grid: e.grid, canvas: this.ua.kr, drawFramebuffer: i, asciiFramebuffer: s, registerPreDrawHook: (r) => this.Ma(this.va, t, r), registerPostDrawHook: (r) => this.Ma(this.pa, t, r) };
2882
+ }
2883
+ Ma(t, e, i) {
2884
+ const s = t.get(e) ?? /* @__PURE__ */ new Set();
2885
+ return s.add(i), t.set(e, s), () => {
2886
+ const r = t.get(e);
2887
+ r && (r.delete(i), r.size === 0 && t.delete(e));
2888
2888
  };
2889
2889
  }
2890
- ya(t) {
2891
- this.pa.delete(t), this.ga.delete(t);
2890
+ _a(t) {
2891
+ this.va.delete(t), this.pa.delete(t);
2892
2892
  }
2893
- Ca(t) {
2894
- for (const e of this.va) {
2893
+ ba(t) {
2894
+ for (const e of this.da) {
2895
2895
  const i = t.get(e);
2896
- i && i.forEach((r) => r());
2896
+ i && i.forEach((s) => s());
2897
2897
  }
2898
2898
  }
2899
2899
  }
2900
- const V = `#version 300 es
2901
- in vec2 A0;in vec2 A1;out vec2 v_uv;void main(){v_uv=A1;gl_Position=vec4(A0,0.,1.);}`, Dt = `#version 300 es
2900
+ const Q = `#version 300 es
2901
+ in vec2 A0;in vec2 A1;out vec2 v_uv;void main(){v_uv=A1;gl_Position=vec4(A0,0.,1.);}`, _t = `#version 300 es
2902
2902
  precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`;
2903
- class It {
2903
+ class Dt {
2904
2904
  constructor() {
2905
- a(this, "$a", /* @__PURE__ */ new Map());
2906
- a(this, "Pa", []);
2905
+ a(this, "Fa", /* @__PURE__ */ new Map());
2906
+ a(this, "$a", []);
2907
+ a(this, "Pa", 0);
2907
2908
  a(this, "Ta", 0);
2908
- a(this, "Ua", 0);
2909
2909
  a(this, "Ea");
2910
2910
  }
2911
2911
  get Ra() {
2912
- return this.Ta;
2912
+ return this.Pa;
2913
2913
  }
2914
2914
  get Sa() {
2915
- if (this.Ta === 0) return 0;
2915
+ if (this.Pa === 0) return 0;
2916
2916
  let t = 0;
2917
- for (const e of this.Pa) {
2918
- const i = this.$a.get(e);
2917
+ for (const e of this.$a) {
2918
+ const i = this.Fa.get(e);
2919
2919
  i && (t += Math.min(1, Math.max(0, i.progress)) * i.weight);
2920
2920
  }
2921
- return Math.min(1, t / this.Ta);
2921
+ return Math.min(1, t / this.Pa);
2922
2922
  }
2923
2923
  za(t) {
2924
2924
  this.Ea = t;
2925
2925
  }
2926
2926
  ka(t, e = 1) {
2927
- const i = `phase-${this.Pa.length + 1}-${Date.now()}`, r = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
2928
- return this.$a.set(i, r), this.Pa.push(i), this.Ta += r.weight, i;
2927
+ const i = `phase-${this.$a.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
2928
+ return this.Fa.set(i, s), this.$a.push(i), this.Pa += s.weight, i;
2929
2929
  }
2930
2930
  Da(t, e) {
2931
- const i = this.$a.get(t);
2931
+ const i = this.Fa.get(t);
2932
2932
  if (!i) return;
2933
2933
  i.progress = Math.max(0, Math.min(1, e)), i.status = i.progress >= 1 ? "complete" : "running";
2934
- const r = this.Sa;
2935
- Math.abs(r - this.Ua) > 1e-3 && (this.Ua = r, this.Ea && this.Ea(r));
2934
+ const s = this.Sa;
2935
+ Math.abs(s - this.Ta) > 1e-3 && (this.Ta = s, this.Ea && this.Ea(s));
2936
2936
  }
2937
2937
  La(t) {
2938
- const e = this.$a.get(t);
2938
+ const e = this.Fa.get(t);
2939
2939
  e && (e.progress = 1, e.status = "complete", this.Da(t, 1));
2940
2940
  }
2941
2941
  Oa(t) {
2942
- const e = this.$a.get(t);
2942
+ const e = this.Fa.get(t);
2943
2943
  e && (e.status = "failed");
2944
2944
  }
2945
- Ba() {
2946
- return this.Pa.map((t) => {
2947
- const e = this.$a.get(t);
2945
+ Ia() {
2946
+ return this.$a.map((t) => {
2947
+ const e = this.Fa.get(t);
2948
2948
  return e ? { id: e.id, label: e.label, weight: e.weight, progress: e.progress, status: e.status } : { id: t, label: t, weight: 1, progress: 0, status: "pending" };
2949
2949
  });
2950
2950
  }
2951
2951
  }
2952
- class _t {
2952
+ class Ot {
2953
2953
  constructor(t = "active") {
2954
- a(this, "Ia");
2954
+ a(this, "Ba");
2955
2955
  a(this, "Ha", "");
2956
2956
  a(this, "Ga", "");
2957
- this.Ia = t;
2957
+ this.Ba = t;
2958
2958
  }
2959
2959
  get Qa() {
2960
- return this.Ia;
2960
+ return this.Ba;
2961
2961
  }
2962
2962
  get Na() {
2963
- return this.Ia !== "disabled";
2963
+ return this.Ba !== "disabled";
2964
2964
  }
2965
2965
  get Xa() {
2966
- return this.Ia === "active" || this.Ia === "transitioning" || this.Ia === "error";
2966
+ return this.Ba === "active" || this.Ba === "transitioning" || this.Ba === "error";
2967
2967
  }
2968
2968
  get Ya() {
2969
2969
  return this.Ha;
@@ -2972,25 +2972,25 @@ class _t {
2972
2972
  return this.Ga;
2973
2973
  }
2974
2974
  Ka() {
2975
- this.Ia !== "done" && this.Ia !== "transitioning" || (this.Ia = "active");
2975
+ this.Ba !== "done" && this.Ba !== "transitioning" || (this.Ba = "active");
2976
2976
  }
2977
2977
  Wa() {
2978
- this.Ia !== "disabled" && (this.Ia = "done");
2978
+ this.Ba !== "disabled" && (this.Ba = "done");
2979
2979
  }
2980
2980
  Za() {
2981
- this.Ia !== "disabled" && (this.Ia = "transitioning");
2981
+ this.Ba !== "disabled" && (this.Ba = "transitioning");
2982
2982
  }
2983
2983
  qa() {
2984
- this.Ia === "transitioning" && (this.Ia = "done");
2984
+ this.Ba === "transitioning" && (this.Ba = "done");
2985
2985
  }
2986
2986
  Va(t) {
2987
- this.Ia !== "disabled" && (this.Ia = "error", t instanceof Error ? (this.Ha = t.message, this.Ga = t.stack || "") : (this.Ha = t, this.Ga = ""));
2987
+ this.Ba !== "disabled" && (this.Ba = "error", t instanceof Error ? (this.Ha = t.message, this.Ga = t.stack || "") : (this.Ha = t, this.Ga = ""));
2988
2988
  }
2989
2989
  Ja() {
2990
- this.Ia = "disabled";
2990
+ this.Ba = "disabled";
2991
2991
  }
2992
2992
  }
2993
- class Ot {
2993
+ class It {
2994
2994
  constructor(t, e) {
2995
2995
  a(this, "tc", 0);
2996
2996
  a(this, "sc", 1);
@@ -3004,7 +3004,7 @@ class Ot {
3004
3004
  get oc() {
3005
3005
  return this.sc < 1;
3006
3006
  }
3007
- In() {
3007
+ Bn() {
3008
3008
  this.ec !== "none" && this.rc > 0 && (this.tc = performance.now());
3009
3009
  }
3010
3010
  et() {
@@ -3019,16 +3019,16 @@ class Ot {
3019
3019
  function gt(n, t) {
3020
3020
  const e = n.tone ?? "auto";
3021
3021
  let i = "dark";
3022
- return e === "light" || e === "dark" ? i = e : t && (i = function(r) {
3023
- if (!r) return 0;
3024
- const [s, h, o] = r.map((l) => l / 255), c = (l) => l <= 0.04045 ? l / 12.92 : Math.pow((l + 0.055) / 1.055, 2.4);
3025
- return 0.2126 * c(s) + 0.7152 * c(h) + 0.0722 * c(o);
3022
+ return e === "light" || e === "dark" ? i = e : t && (i = function(s) {
3023
+ if (!s) return 0;
3024
+ const [r, h, o] = s.map((l) => l / 255), c = (l) => l <= 0.04045 ? l / 12.92 : Math.pow((l + 0.055) / 1.055, 2.4);
3025
+ return 0.2126 * c(r) + 0.7152 * c(h) + 0.0722 * c(o);
3026
3026
  }(t) > 0.5 ? "light" : "dark"), { mode: i, background: t, textColor: i === "light" ? "#1A1A1A" : "#F8F8F8", subtleColor: i === "light" ? "#4A4A4A" : "#C0C0C0" };
3027
3027
  }
3028
- function Zt(n) {
3028
+ function Xt(n) {
3029
3029
  return n.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
3030
3030
  }
3031
- function Xt(n, t) {
3031
+ function Zt(n, t) {
3032
3032
  return n.length ? n.map((e) => t.color(e)) : [t.color("#FFFFFF")];
3033
3033
  }
3034
3034
  class zt {
@@ -3053,46 +3053,46 @@ class zt {
3053
3053
  }
3054
3054
  }
3055
3055
  }
3056
- const He = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: r, palette: s, theme: h, phases: o, transitionOpacity: c, isError: l, errorMessage: u }) => {
3056
+ const He = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: o, transitionOpacity: c, isError: l, errorMessage: u }) => {
3057
3057
  const f = "|/-\\", d = Math.floor(i / 6) % 4, g = n.color(h.textColor), p = Math.floor(255 * c), v = n.color(g.r, g.g, g.b, p);
3058
3058
  if (n.charColor(v), n.cellColor(0, 0, 0, 0), l) {
3059
- const A = n.color(h.mode === "light" ? "#D32F2F" : "#FF6B6B", p);
3060
- n.charColor(A), n.push(), n.translate(0, -2, 0), n.char("X"), n.rect(1, 1), n.pop();
3061
- const m = "SETUP ERROR", b = -Math.floor(m.length / 2);
3059
+ const m = n.color(h.mode === "light" ? "#D32F2F" : "#FF6B6B", p);
3060
+ n.charColor(m), n.push(), n.translate(0, -2, 0), n.char("X"), n.rect(1, 1), n.pop();
3061
+ const A = "SETUP ERROR", b = -Math.floor(A.length / 2);
3062
3062
  n.push(), n.translate(b, 0, 0);
3063
- for (const y of m) n.char(y), n.rect(1, 1), n.translateX(1);
3063
+ for (const y of A) n.char(y), n.rect(1, 1), n.translateX(1);
3064
3064
  if (n.pop(), u) {
3065
3065
  const y = n.color(h.subtleColor), x = n.color(y.r, y.g, y.b, p);
3066
3066
  n.charColor(x);
3067
- const E = Math.floor(0.8 * t.cols), C = u.split(" "), P = [];
3067
+ const E = Math.floor(0.8 * t.cols), F = u.split(" "), P = [];
3068
3068
  let T = "";
3069
- for (const F of C) (T + " " + F).length <= E ? T = T ? T + " " + F : F : (T && P.push(T), T = F);
3069
+ for (const C of F) (T + " " + C).length <= E ? T = T ? T + " " + C : C : (T && P.push(T), T = C);
3070
3070
  T && P.push(T);
3071
3071
  const L = P.slice(0, 3);
3072
- P.length > 3 && (L[2] = L[2].substring(0, E - 3) + "..."), L.forEach((F, Q) => {
3073
- const Vt = -Math.floor(F.length / 2);
3074
- n.push(), n.translate(Vt, 3 + Q, 0);
3075
- for (const Qt of F) n.char(Qt), n.rect(1, 1), n.translateX(1);
3072
+ P.length > 3 && (L[2] = L[2].substring(0, E - 3) + "..."), L.forEach((C, K) => {
3073
+ const Qt = -Math.floor(C.length / 2);
3074
+ n.push(), n.translate(Qt, 3 + K, 0);
3075
+ for (const Kt of C) n.char(Kt), n.rect(1, 1), n.translateX(1);
3076
3076
  n.pop();
3077
3077
  });
3078
3078
  }
3079
3079
  return;
3080
3080
  }
3081
- if (n.push(), n.translate(0, 0, 0), n.char(f[d]), n.rect(1, 1), n.pop(), e > 0 || o.some((A) => A.status !== "pending")) {
3082
- const A = Math.max(6, Math.floor(0.6 * t.cols)), m = -Math.floor(A / 2), b = Math.floor(A * e), y = s.length ? s : [n.color("#FFFFFF")];
3083
- n.push(), n.translate(m, 3, 0);
3084
- for (let x = 0; x < A; x++) {
3085
- const E = x < b ? "*" : ".", C = y[x % y.length], P = n.color(C.r, C.g, C.b, p);
3081
+ if (n.push(), n.translate(0, 0, 0), n.char(f[d]), n.rect(1, 1), n.pop(), e > 0 || o.some((m) => m.status !== "pending")) {
3082
+ const m = Math.max(6, Math.floor(0.6 * t.cols)), A = -Math.floor(m / 2), b = Math.floor(m * e), y = r.length ? r : [n.color("#FFFFFF")];
3083
+ n.push(), n.translate(A, 3, 0);
3084
+ for (let x = 0; x < m; x++) {
3085
+ const E = x < b ? "*" : ".", F = y[x % y.length], P = n.color(F.r, F.g, F.b, p);
3086
3086
  n.charColor(P), n.char(E), n.rect(1, 1), n.translateX(1);
3087
3087
  }
3088
3088
  n.pop();
3089
3089
  }
3090
- if (r) {
3091
- const A = n.color(h.subtleColor), m = n.color(A.r, A.g, A.b, p);
3092
- n.charColor(m);
3093
- const b = -Math.floor(r.length / 2);
3090
+ if (s) {
3091
+ const m = n.color(h.subtleColor), A = n.color(m.r, m.g, m.b, p);
3092
+ n.charColor(A);
3093
+ const b = -Math.floor(s.length / 2);
3094
3094
  n.push(), n.translate(b, 5, 0);
3095
- for (const y of r) n.char(y), n.rect(1, 1), n.translateX(1);
3095
+ for (const y of s) n.char(y), n.rect(1, 1), n.translateX(1);
3096
3096
  n.pop();
3097
3097
  }
3098
3098
  };
@@ -3116,7 +3116,7 @@ class it {
3116
3116
  a(this, "Cc", null);
3117
3117
  a(this, "xc", !1);
3118
3118
  a(this, "Mc", []);
3119
- this.ac = e.visible ?? !0, this.nc = e.opacity ?? 1, this.cc = e.blendMode ?? "normal", this.lc = e.offsetX ?? 0, this.uc = e.offsetY ?? 0, this.fc = e.rotation ?? 0, this.dc = e.fontSize ?? 16, this.vc = e.fontSource, e.fontSource instanceof et ? this.nr = e.fontSource : this.nr = new et(t, this.dc);
3119
+ this.ac = e.visible ?? !0, this.nc = e.opacity ?? 1, this.cc = e.blendMode ?? "normal", this.lc = e.offsetX ?? 0, this.uc = e.offsetY ?? 0, this.fc = e.rotationZ ?? 0, this.dc = e.fontSize ?? 16, this.vc = e.fontSource, e.fontSource instanceof et ? this.nr = e.fontSource : this.nr = new et(t, this.dc);
3120
3120
  }
3121
3121
  async Fc(t) {
3122
3122
  this.gc = t, this.nr.Tr || await this.nr.wr(this.vc);
@@ -3124,8 +3124,8 @@ class it {
3124
3124
  this.mc = new Le(this.gc.canvas.canvas, e.width, e.height);
3125
3125
  const i = this.mc;
3126
3126
  this._c = this.gc.createFramebuffer(i.cols, i.rows, 3), this.yc = this.gc.createFramebuffer(i.width, i.height, 1), this.wc = this.gc.createFramebuffer(i.width, i.height, 1), this.bc = [this.gc.createFramebuffer(i.width, i.height, 1, { depth: !1 }), this.gc.createFramebuffer(i.width, i.height, 1, { depth: !1 })], this.xc = !1, this.mc.Hr(() => {
3127
- var r, s, h;
3128
- this._c.resize(this.mc.cols, this.mc.rows), this.yc.resize(this.mc.width, this.mc.height), (r = this.wc) == null || r.resize(this.mc.width, this.mc.height), (s = this.bc) == null || s[0].resize(this.mc.width, this.mc.height), (h = this.bc) == null || h[1].resize(this.mc.width, this.mc.height);
3127
+ var s, r, h;
3128
+ this._c.resize(this.mc.cols, this.mc.rows), this.yc.resize(this.mc.width, this.mc.height), (s = this.wc) == null || s.resize(this.mc.width, this.mc.height), (r = this.bc) == null || r[0].resize(this.mc.width, this.mc.height), (h = this.bc) == null || h[1].resize(this.mc.width, this.mc.height);
3129
3129
  });
3130
3130
  }
3131
3131
  $c() {
@@ -3170,30 +3170,30 @@ class it {
3170
3170
  if (!this.nr) throw Error("Layer font not initialized. Ensure layer is attached before loading fonts.");
3171
3171
  return t instanceof et ? (this.nr = t, this.nr.Tr || await this.nr.wr()) : await this.nr.Fr(t), this.Tc(), this.nr;
3172
3172
  }
3173
- ca(t, e, i) {
3174
- const r = i == null ? void 0 : i.fallbackDraw;
3173
+ aa(t, e, i) {
3174
+ const s = i == null ? void 0 : i.fallbackDraw;
3175
3175
  if (!this.ac) return void (this.xc = !1);
3176
- if (!this.Cc && !r) return void (this.xc = !1);
3177
- const s = this.gc.renderer;
3178
- this._c.begin(), s.state.qt(), t.dn = this.nr, t.Uc = this.mc;
3176
+ if (!this.Cc && !s) return void (this.xc = !1);
3177
+ const r = this.gc.renderer;
3178
+ this._c.begin(), r.state.qt(), t.dn = this.nr, t.Ec = this.mc;
3179
3179
  try {
3180
- this.Cc ? this.Cc.call(t) : r == null || r();
3180
+ this.Cc ? this.Cc.call(t) : s == null || s();
3181
3181
  } finally {
3182
- t.dn = void 0, t.Uc = void 0;
3182
+ t.dn = void 0, t.Ec = void 0;
3183
3183
  }
3184
3184
  this._c.end();
3185
3185
  const h = this.Mc.length > 0, o = h ? this.wc : this.yc;
3186
- o.begin(), s.ve(e);
3186
+ o.begin(), r.ve(e);
3187
3187
  const c = this.mc;
3188
- e.O({ u_characterTexture: this.nr.fontFramebuffer, u_charsetDimensions: [this.nr.textureColumns, this.nr.textureRows], Ul: this._c.textures[0], Um: this._c.textures[1], Un: this._c.textures[2], Uo: [c.cols, c.rows], Up: [o.width, o.height], Uq: [0, 0, 0, 0] }), s.we(0, 0, c.width, c.height), o.end(), h && this.gc.filterManager.Ec(this.wc.textures[0], this.yc, this.Mc, this.yc.width, this.yc.height, this.bc), this.Mc = [], this.xc = !0;
3188
+ e.O({ u_characterTexture: this.nr.fontFramebuffer, u_charsetDimensions: [this.nr.textureColumns, this.nr.textureRows], Ug: this._c.textures[0], Uh: this._c.textures[1], Ui: this._c.textures[2], Uj: [c.cols, c.rows], Uk: [o.width, o.height], Ul: [0, 0, 0, 0] }), r.we(0, 0, c.width, c.height), o.end(), h && this.gc.filterManager.Rc(this.wc.textures[0], this.yc, this.Mc, this.yc.width, this.yc.height, this.bc), this.Mc = [], this.xc = !0;
3189
3189
  }
3190
3190
  Jr() {
3191
3191
  var t;
3192
3192
  this._c && this.yc && ((t = this.mc) == null || t.ti());
3193
3193
  }
3194
3194
  gt() {
3195
- var t, e, i, r, s, h, o;
3196
- (t = this._c) == null || t.gt(), (e = this.yc) == null || e.gt(), (i = this.wc) == null || i.gt(), (r = this.bc) == null || r[0].gt(), (s = this.bc) == null || s[1].gt(), (h = this.nr) == null || h.gt(), (o = this.mc) == null || o.gt();
3195
+ var t, e, i, s, r, h, o;
3196
+ (t = this._c) == null || t.gt(), (e = this.yc) == null || e.gt(), (i = this.wc) == null || i.gt(), (s = this.bc) == null || s[0].gt(), (r = this.bc) == null || r[1].gt(), (h = this.nr) == null || h.gt(), (o = this.mc) == null || o.gt();
3197
3197
  }
3198
3198
  get texture() {
3199
3199
  var t;
@@ -3212,7 +3212,7 @@ class it {
3212
3212
  get height() {
3213
3213
  return this.yc ? this.yc.height : 0;
3214
3214
  }
3215
- get Rc() {
3215
+ get Sc() {
3216
3216
  return this.xc;
3217
3217
  }
3218
3218
  get drawFramebuffer() {
@@ -3230,46 +3230,46 @@ class it {
3230
3230
  const We = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
3231
3231
  class kt {
3232
3232
  constructor(t, e, i) {
3233
- a(this, "fa");
3233
+ a(this, "ua");
3234
3234
  a(this, "l");
3235
- a(this, "Sc");
3236
- a(this, "hc");
3237
3235
  a(this, "zc");
3236
+ a(this, "hc");
3238
3237
  a(this, "kc");
3239
3238
  a(this, "Dc");
3240
3239
  a(this, "Lc");
3241
- a(this, "Oc", []);
3240
+ a(this, "Oc");
3241
+ a(this, "Ic", []);
3242
3242
  a(this, "Bc");
3243
- a(this, "Ic", performance.now());
3244
- a(this, "Hc", 0);
3245
- a(this, "Gc", !1);
3243
+ a(this, "Hc", performance.now());
3244
+ a(this, "Gc", 0);
3245
+ a(this, "Qc", !1);
3246
3246
  a(this, "Ar", !1);
3247
- a(this, "jc");
3248
- this.fa = t, this.l = { ...We, ...e ?? {} }, this.Sc = new _t("active"), this.hc = new It(), this.zc = new Ot(this.l.transition, this.l.transitionDuration), this.kc = new Ut(60), this.Bc = gt(this.l, i);
3249
- const r = Zt(this.Bc);
3250
- this.Oc = Xt(r, this.fa), this.Lc = this.Qc(), this.hc.za((s) => {
3251
- s >= 0.999 && this.Wa();
3247
+ a(this, "Kc");
3248
+ this.ua = t, this.l = { ...We, ...e ?? {} }, this.zc = new Ot("active"), this.hc = new Dt(), this.kc = new It(this.l.transition, this.l.transitionDuration), this.Dc = new Ut(60), this.Bc = gt(this.l, i);
3249
+ const s = Xt(this.Bc);
3250
+ this.Ic = Zt(s, this.ua), this.Oc = this.Nc(), this.hc.za((r) => {
3251
+ r >= 0.999 && this.Wa();
3252
3252
  });
3253
3253
  }
3254
3254
  async wr() {
3255
3255
  if (this.Ar) return;
3256
- const t = this.fa.Z, e = this.fa.kr, i = this.fa.Nc;
3257
- this.Dc = new it(t, { visible: !0, opacity: 1, fontSize: 16 }), await this.Dc.Fc({ renderer: t, canvas: e, filterManager: i, createFramebuffer: (r, s, h = 1, o) => t.Pe(r, s, h, o) }), this.Ar = !0;
3256
+ const t = this.ua.Z, e = this.ua.kr, i = this.ua.Xc;
3257
+ this.Lc = new it(t, { visible: !0, opacity: 1, fontSize: 16 }), await this.Lc.Fc({ renderer: t, canvas: e, filterManager: i, createFramebuffer: (s, r, h = 1, o) => t.Pe(s, r, h, o) }), this.Ar = !0;
3258
3258
  }
3259
3259
  get Xa() {
3260
- return this.Sc.Xa && this.Gc;
3260
+ return this.zc.Xa && this.Qc;
3261
3261
  }
3262
- In() {
3263
- this.Gc || (this.Gc = !0, this.Ic = performance.now(), this.Hc = 0, this.kc.In(() => this.Xc()));
3262
+ Bn() {
3263
+ this.Qc || (this.Qc = !0, this.Hc = performance.now(), this.Gc = 0, this.Dc.Bn(() => this.Yc()));
3264
3264
  }
3265
3265
  Hn() {
3266
- this.Gc && (this.Gc = !1, this.kc.Hn());
3266
+ this.Qc && (this.Qc = !1, this.Dc.Hn());
3267
3267
  }
3268
3268
  Jr() {
3269
- this.Ar && this.Dc.Jr();
3269
+ this.Ar && this.Lc.Jr();
3270
3270
  }
3271
3271
  gt() {
3272
- this.Hn(), this.Ar && (this.Dc.gt(), this.Ar = !1);
3272
+ this.Hn(), this.Ar && (this.Lc.gt(), this.Ar = !1);
3273
3273
  }
3274
3274
  get progress() {
3275
3275
  return this.hc.Sa;
@@ -3278,57 +3278,57 @@ class kt {
3278
3278
  return typeof t == "string" && (this.l.message = t), this.l.message;
3279
3279
  }
3280
3280
  addPhase(t, e = 1) {
3281
- this.Sc.Ka();
3281
+ this.zc.Ka();
3282
3282
  const i = this.hc.ka(t, e);
3283
3283
  return new zt(this.hc, i, t);
3284
3284
  }
3285
3285
  Wa() {
3286
- this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.Sc.Za(), this.zc.In()) : (this.Sc.Wa(), this.Hn(), this.Yc());
3286
+ this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.zc.Za(), this.kc.Bn()) : (this.zc.Wa(), this.Hn(), this.jc());
3287
3287
  }
3288
- Yc() {
3289
- this.jc && this.jc();
3288
+ jc() {
3289
+ this.Kc && this.Kc();
3290
3290
  }
3291
- Kc(t) {
3292
- this.jc = t;
3291
+ Wc(t) {
3292
+ this.Kc = t;
3293
3293
  }
3294
3294
  error(t) {
3295
- this.Sc.Va(t);
3295
+ this.zc.Va(t);
3296
3296
  }
3297
- Xc() {
3298
- if (this.Sc.Xa) {
3299
- if (this.Hc++, this.Sc.Qa === "transitioning" && this.zc.et())
3300
- return this.Sc.qa(), this.Yc(), void this.Hn();
3301
- this.Wc();
3297
+ Yc() {
3298
+ if (this.zc.Xa) {
3299
+ if (this.Gc++, this.zc.Qa === "transitioning" && this.kc.et())
3300
+ return this.zc.qa(), this.jc(), void this.Hn();
3301
+ this.Zc();
3302
3302
  }
3303
3303
  }
3304
- Wc() {
3304
+ Zc() {
3305
3305
  if (!this.Ar) return;
3306
- const t = this.Dc, e = t.grid, i = this.fa.Z, r = this.fa.Zc, s = this.fa.qc, h = { textmodifier: this.fa, grid: e, progress: this.progress, elapsedMs: performance.now() - this.Ic, frameCount: this.Hc, message: this.l.message, palette: this.Oc, theme: this.Bc, phases: this.hc.Ba(), transitionOpacity: this.zc.nc, isError: this.Sc.Qa === "error", errorMessage: this.Sc.Ya || void 0, errorDetails: this.Sc.ja || void 0 };
3306
+ const t = this.Lc, e = t.grid, i = this.ua.Z, s = this.ua.qc, r = this.ua.Vc, h = { textmodifier: this.ua, grid: e, progress: this.progress, elapsedMs: performance.now() - this.Hc, frameCount: this.Gc, message: this.l.message, palette: this.Ic, theme: this.Bc, phases: this.hc.Ia(), transitionOpacity: this.kc.nc, isError: this.zc.Qa === "error", errorMessage: this.zc.Ya || void 0, errorDetails: this.zc.ja || void 0 };
3307
3307
  t.draw(() => {
3308
- this.fa.clear(), this.fa.push();
3308
+ this.ua.clear(), this.ua.push();
3309
3309
  try {
3310
- this.Lc(h);
3310
+ this.Oc(h);
3311
3311
  } finally {
3312
- this.fa.pop();
3312
+ this.ua.pop();
3313
3313
  }
3314
- }), t.ca(this.fa, r);
3314
+ }), t.aa(this.ua, s);
3315
3315
  const o = t.texture;
3316
- o && (i.wi(...i.state.canvasBackgroundColor), i.ve(s), s.O({ u_texture: o }), i.we(e.offsetX, e.offsetY, e.width, e.height));
3316
+ o && (i.wi(...i.state.canvasBackgroundColor), i.ve(r), r.O({ u_texture: o }), i.we(e.offsetX, e.offsetY, e.width, e.height));
3317
3317
  }
3318
- Vc(t) {
3318
+ Jc(t) {
3319
3319
  this.Bc = gt(this.l, t);
3320
3320
  }
3321
- Qc() {
3321
+ Nc() {
3322
3322
  const t = this.l.renderer || He;
3323
3323
  return (e) => {
3324
- t(e), this.Jc(e);
3324
+ t(e), this.tl(e);
3325
3325
  };
3326
3326
  }
3327
- Jc(t) {
3328
- const { textmodifier: e, grid: i, frameCount: r, theme: s, transitionOpacity: h } = t, o = [116, 101, 120, 116, 109, 111, 100, 101, 46, 106, 115].map((f) => String.fromCharCode(f)).join(""), c = (i.rows + 1 >> 1) - 2, l = 2 - (i.cols + 1 >> 1), u = s.mode === "light" ? [[233, 30, 99], [156, 39, 176], [255, 111, 0]] : [[142, 249, 243], [241, 91, 181], [255, 155, 113]];
3327
+ tl(t) {
3328
+ const { textmodifier: e, grid: i, frameCount: s, theme: r, transitionOpacity: h } = t, o = [116, 101, 120, 116, 109, 111, 100, 101, 46, 106, 115].map((f) => String.fromCharCode(f)).join(""), c = (i.rows + 1 >> 1) - 2, l = 2 - (i.cols + 1 >> 1), u = r.mode === "light" ? [[233, 30, 99], [156, 39, 176], [255, 111, 0]] : [[142, 249, 243], [241, 91, 181], [255, 155, 113]];
3329
3329
  e.push(), e.translate(l, c, 0);
3330
3330
  for (let f = 0; f < o.length; f++) {
3331
- const d = o[f], g = Math.floor(0.1 * r + 0.5 * f) % u.length, [p, v, A] = u[g], m = Math.floor(255 * h), b = e.color(p, v, A, m);
3331
+ const d = o[f], g = Math.floor(0.1 * s + 0.5 * f) % u.length, [p, v, m] = u[g], A = Math.floor(255 * h), b = e.color(p, v, m, A);
3332
3332
  e.charColor(b), e.char(d), e.point(), e.translateX(1);
3333
3333
  }
3334
3334
  e.pop();
@@ -3338,150 +3338,150 @@ const wt = { normal: 0, additive: 1, multiply: 2, screen: 3, subtract: 4, darken
3338
3338
  class Yt {
3339
3339
  constructor(t, e, i) {
3340
3340
  a(this, "Z");
3341
- a(this, "tl");
3341
+ a(this, "sl");
3342
3342
  a(this, "bc");
3343
- a(this, "sl", 0);
3344
- this.Z = t, this.tl = t.pe(V, `#version 300 es
3345
- precision highp float;uniform sampler2D Ud;uniform sampler2D Ue;uniform vec2 Uf;uniform vec2 Ug;uniform vec2 Uh;uniform float Ui;uniform float Uj;uniform int Uk;in vec2 v_uv;out vec4 fragColor;const int A=0;const int B=1;const int C=2;const int D=3;const int E=4;const int F=5;const int G=6;const int H=7;const int I=8;const int J=9;const int K=10;const int L=11;const int M=12;const int N=13;vec3 O(vec3 P,vec3 Q){return Q;}vec3 R(vec3 P,vec3 Q){return P+Q;}vec3 S(vec3 P,vec3 Q){return P*Q;}vec3 T(vec3 P,vec3 Q){return 1.-(1.-P)*(1.-Q);}vec3 U(vec3 P,vec3 Q){return max(P-Q,0.);}vec3 V(vec3 P,vec3 Q){return min(P,Q);}vec3 W(vec3 P,vec3 Q){return max(P,Q);}vec3 X(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,P));}vec3 Y(vec3 P,vec3 Q){return mix(P-(1.-2.*Q)*P*(1.-P),mix(P+(2.*Q-1.)*(P*(3.-2.*P)-P),P+(2.*Q-1.)*(sqrt(P)-P),step(0.25,P)),step(0.5,Q));}vec3 Z(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,Q));}vec3 a(vec3 P,vec3 Q){return mix(min(vec3(1.),P/max(1.-Q,0.0001)),vec3(1.),step(1.,Q));}vec3 b(vec3 P,vec3 Q){return mix(1.-min(vec3(1.),(1.-P)/max(Q,0.0001)),vec3(0.),step(Q,vec3(0.)));}vec3 c(vec3 P,vec3 Q){return abs(P-Q);}vec3 d(vec3 P,vec3 Q){return P+Q-2.*P*Q;}vec3 e(int f,vec3 P,vec3 Q){if(f==A)return O(P,Q);if(f==B)return R(P,Q);if(f==C)return S(P,Q);if(f==D)return T(P,Q);if(f==E)return U(P,Q);if(f==F)return V(P,Q);if(f==G)return W(P,Q);if(f==H)return X(P,Q);if(f==I)return Y(P,Q);if(f==J)return Z(P,Q);if(f==K)return a(P,Q);if(f==L)return b(P,Q);if(f==M)return c(P,Q);if(f==N)return d(P,Q);return O(P,Q);}void main(){vec4 g=texture(Ue,v_uv);vec2 h=v_uv*Uf;vec2 i=h-Uh;vec2 j=Ug*0.5;vec2 k=i-j;float l=cos(-Uj);float m=sin(-Uj);vec2 n=vec2(k.x*l-k.y*m,k.x*m+k.y*l);i=n+j;bool o=any(lessThan(i,vec2(0.)))||any(greaterThanEqual(i,Ug));if(o){fragColor=g;return;}vec2 p=(floor(i)+0.5)/Ug;vec4 q=texture(Ud,p);float r=q.a*Ui;if(r<=0.){fragColor=g;return;}vec3 s=e(Uk,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`), this.bc = [this.Z.Pe(e, i, 1), this.Z.Pe(e, i, 1)];
3343
+ a(this, "il", 0);
3344
+ this.Z = t, this.sl = t.pe(Q, `#version 300 es
3345
+ precision highp float;uniform sampler2D U8;uniform sampler2D U9;uniform vec2 Ua;uniform vec2 Ub;uniform vec2 Uc;uniform float Ud;uniform float Ue;uniform int Uf;in vec2 v_uv;out vec4 fragColor;const int A=0;const int B=1;const int C=2;const int D=3;const int E=4;const int F=5;const int G=6;const int H=7;const int I=8;const int J=9;const int K=10;const int L=11;const int M=12;const int N=13;vec3 O(vec3 P,vec3 Q){return Q;}vec3 R(vec3 P,vec3 Q){return P+Q;}vec3 S(vec3 P,vec3 Q){return P*Q;}vec3 T(vec3 P,vec3 Q){return 1.-(1.-P)*(1.-Q);}vec3 U(vec3 P,vec3 Q){return max(P-Q,0.);}vec3 V(vec3 P,vec3 Q){return min(P,Q);}vec3 W(vec3 P,vec3 Q){return max(P,Q);}vec3 X(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,P));}vec3 Y(vec3 P,vec3 Q){return mix(P-(1.-2.*Q)*P*(1.-P),mix(P+(2.*Q-1.)*(P*(3.-2.*P)-P),P+(2.*Q-1.)*(sqrt(P)-P),step(0.25,P)),step(0.5,Q));}vec3 Z(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,Q));}vec3 a(vec3 P,vec3 Q){return mix(min(vec3(1.),P/max(1.-Q,0.0001)),vec3(1.),step(1.,Q));}vec3 b(vec3 P,vec3 Q){return mix(1.-min(vec3(1.),(1.-P)/max(Q,0.0001)),vec3(0.),step(Q,vec3(0.)));}vec3 c(vec3 P,vec3 Q){return abs(P-Q);}vec3 d(vec3 P,vec3 Q){return P+Q-2.*P*Q;}vec3 e(int f,vec3 P,vec3 Q){if(f==A)return O(P,Q);if(f==B)return R(P,Q);if(f==C)return S(P,Q);if(f==D)return T(P,Q);if(f==E)return U(P,Q);if(f==F)return V(P,Q);if(f==G)return W(P,Q);if(f==H)return X(P,Q);if(f==I)return Y(P,Q);if(f==J)return Z(P,Q);if(f==K)return a(P,Q);if(f==L)return b(P,Q);if(f==M)return c(P,Q);if(f==N)return d(P,Q);return O(P,Q);}void main(){vec4 g=texture(U9,v_uv);vec2 h=v_uv*Ua;vec2 i=h-Uc;vec2 j=Ub*0.5;vec2 k=i-j;float l=cos(-Ue);float m=sin(-Ue);vec2 n=vec2(k.x*l-k.y*m,k.x*m+k.y*l);i=n+j;bool o=any(lessThan(i,vec2(0.)))||any(greaterThanEqual(i,Ub));if(o){fragColor=g;return;}vec2 p=(floor(i)+0.5)/Ub;vec4 q=texture(U8,p);float r=q.a*Ud;if(r<=0.){fragColor=g;return;}vec3 s=e(Uf,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`), this.bc = [this.Z.Pe(e, i, 1), this.Z.Pe(e, i, 1)];
3346
3346
  }
3347
- il(t) {
3348
- const e = this.Z.context, { base: i, targetFramebuffer: r, backgroundColor: s, layers: h, canvasWidth: o, canvasHeight: c } = t, l = e.isEnabled(e.DEPTH_TEST), u = e.getParameter(e.DEPTH_WRITEMASK);
3347
+ el(t) {
3348
+ const e = this.Z.context, { base: i, targetFramebuffer: s, backgroundColor: r, layers: h, canvasWidth: o, canvasHeight: c } = t, l = e.isEnabled(e.DEPTH_TEST), u = e.getParameter(e.DEPTH_WRITEMASK);
3349
3349
  l && e.disable(e.DEPTH_TEST), u && e.depthMask(!1);
3350
3350
  const f = this.bc[0];
3351
- f.begin(), this.Z.wi(...s), f.end(), this.sl = 0, i.layer.ac && this.el(i.texture, o, c, i.width, i.height, i.layer.nc, i.offsetX, i.offsetY, i.layer.fc, "normal", e);
3351
+ f.begin(), this.Z.wi(...r), f.end(), this.il = 0, i.layer.ac && this.rl(i.texture, o, c, i.width, i.height, i.layer.nc, i.offsetX, i.offsetY, i.layer.fc, "normal", e);
3352
3352
  for (const d of h) {
3353
3353
  const g = d.layer;
3354
- g.ac && g.Rc && this.el(d.texture, o, c, d.width, d.height, g.nc, d.offsetX, d.offsetY, g.fc, g.cc, e);
3354
+ g.ac && g.Sc && this.rl(d.texture, o, c, d.width, d.height, g.nc, d.offsetX, d.offsetY, g.fc, g.cc, e);
3355
3355
  }
3356
- this.rl(r, o, c, e), e.depthMask(u), l && e.enable(e.DEPTH_TEST);
3356
+ this.nl(s, o, c, e), e.depthMask(u), l && e.enable(e.DEPTH_TEST);
3357
3357
  }
3358
- el(t, e, i, r, s, h, o, c, l, u, f) {
3359
- const d = this.bc[this.sl], g = this.sl === 0 ? 1 : 0, p = this.bc[g], v = l * (Math.PI / 180);
3360
- p.begin(), f.disable(f.BLEND), this.Z.ve(this.tl), this.tl.O({ Ud: t, Ue: d.textures[0], Uf: [e, i], Ug: [r, s], Uh: [o, c], Ui: h, Uj: v, Uk: wt[u] }), this.Z.we(0, 0, d.width, d.height), p.end(), this.sl = g;
3358
+ rl(t, e, i, s, r, h, o, c, l, u, f) {
3359
+ const d = this.bc[this.il], g = this.il === 0 ? 1 : 0, p = this.bc[g], v = l * (Math.PI / 180);
3360
+ p.begin(), f.disable(f.BLEND), this.Z.ve(this.sl), this.sl.O({ U8: t, U9: d.textures[0], Ua: [e, i], Ub: [s, r], Uc: [o, c], Ud: h, Ue: v, Uf: wt[u] }), this.Z.we(0, 0, d.width, d.height), p.end(), this.il = g;
3361
3361
  }
3362
- rl(t, e, i, r) {
3363
- const s = this.bc[this.sl];
3364
- t.begin(), r.disable(r.BLEND), this.Z.ve(this.tl), this.tl.O({ Ud: s.textures[0], Ue: s.textures[0], Uf: [e, i], Ug: [s.width, s.height], Uh: [0, 0], Ui: 1, Uj: 0, Uk: wt.normal }), this.Z.we(0, 0, e, i), t.end();
3362
+ nl(t, e, i, s) {
3363
+ const r = this.bc[this.il];
3364
+ t.begin(), s.disable(s.BLEND), this.Z.ve(this.sl), this.sl.O({ U8: r.textures[0], U9: r.textures[0], Ua: [e, i], Ub: [r.width, r.height], Uc: [0, 0], Ud: 1, Ue: 0, Uf: wt.normal }), this.Z.we(0, 0, e, i), t.end();
3365
3365
  }
3366
3366
  Jr(t, e) {
3367
3367
  this.bc[0].resize(t, e), this.bc[1].resize(t, e);
3368
3368
  }
3369
3369
  gt() {
3370
- this.tl.dispose(), this.bc[0].gt(), this.bc[1].gt();
3370
+ this.sl.dispose(), this.bc[0].gt(), this.bc[1].gt();
3371
3371
  }
3372
3372
  }
3373
3373
  class Gt {
3374
3374
  constructor(t, e) {
3375
- a(this, "fa");
3375
+ a(this, "ua");
3376
3376
  a(this, "Z");
3377
- a(this, "nl");
3378
3377
  a(this, "ol");
3379
- a(this, "hl", []);
3378
+ a(this, "hl");
3380
3379
  a(this, "al", []);
3381
- a(this, "cl");
3382
- a(this, "ll", !1);
3383
- a(this, "ul", /* @__PURE__ */ new Set());
3384
- this.fa = t, this.Z = t.Z, this.nl = t.Zc, this.ol = new Yt(this.Z, this.fa.kr.width, this.fa.kr.height), this.cl = new it(this.Z, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
3380
+ a(this, "cl", []);
3381
+ a(this, "ll");
3382
+ a(this, "ul", !1);
3383
+ a(this, "fl", /* @__PURE__ */ new Set());
3384
+ this.ua = t, this.Z = t.Z, this.ol = t.qc, this.hl = new Yt(this.Z, this.ua.kr.width, this.ua.kr.height), this.ll = new it(this.Z, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
3385
3385
  }
3386
3386
  async wr() {
3387
- if (!this.ll) {
3388
- await this.fl(this.cl);
3389
- for (const t of this.hl) await this.fl(t), this.al.push(t);
3390
- this.hl = [], this.ll = !0;
3387
+ if (!this.ul) {
3388
+ await this.dl(this.ll);
3389
+ for (const t of this.al) await this.dl(t), this.cl.push(t);
3390
+ this.al = [], this.ul = !0;
3391
3391
  }
3392
3392
  }
3393
3393
  add(t = {}) {
3394
3394
  const e = new it(this.Z, t);
3395
- return this.ll ? (this.fl(e), this.al.push(e)) : this.hl.push(e), e;
3395
+ return this.ul ? (this.dl(e), this.cl.push(e)) : this.al.push(e), e;
3396
3396
  }
3397
3397
  remove(t) {
3398
- this.dl(this.al, t) || this.dl(this.hl, t);
3398
+ this.vl(this.cl, t) || this.vl(this.al, t);
3399
3399
  }
3400
3400
  move(t, e) {
3401
- this.vl(this.al, t, e) || this.vl(this.hl, t, e);
3401
+ this.pl(this.cl, t, e) || this.pl(this.al, t, e);
3402
3402
  }
3403
3403
  swap(t, e) {
3404
- t !== e && (this.pl(this.al, t, e) || this.pl(this.hl, t, e));
3404
+ t !== e && (this.ml(this.cl, t, e) || this.ml(this.al, t, e));
3405
3405
  }
3406
3406
  clear() {
3407
- this.cl.gt(), this.al.forEach((t) => t.gt()), this.al = [], this.hl.forEach((t) => t.gt()), this.hl = [];
3407
+ this.ll.gt(), this.cl.forEach((t) => t.gt()), this.cl = [], this.al.forEach((t) => t.gt()), this.al = [];
3408
3408
  }
3409
- ml(t, e) {
3410
- this.cl.ca(this.fa, this.nl, { fallbackDraw: e });
3409
+ _l(t, e) {
3410
+ this.ll.aa(this.ua, this.ol, { fallbackDraw: e });
3411
3411
  const i = [...this.Z.state.canvasBackgroundColor];
3412
- this._l(), this.yl(t, i);
3412
+ this.yl(), this.Al(t, i);
3413
3413
  }
3414
- _l() {
3415
- this.al.length !== 0 && this.al.forEach((t) => t.ca(this.fa, this.nl));
3414
+ yl() {
3415
+ this.cl.length !== 0 && this.cl.forEach((t) => t.aa(this.ua, this.ol));
3416
3416
  }
3417
- yl(t, e) {
3418
- const i = this.fa.kr, r = this.cl.grid, s = this.cl.texture;
3419
- if (!s) return;
3420
- const h = { layer: this.cl, texture: s, width: r.width, height: r.height, offsetX: r.offsetX + this.cl.lc, offsetY: r.offsetY + this.cl.uc }, o = this.al.map((c) => {
3417
+ Al(t, e) {
3418
+ const i = this.ua.kr, s = this.ll.grid, r = this.ll.texture;
3419
+ if (!r) return;
3420
+ const h = { layer: this.ll, texture: r, width: s.width, height: s.height, offsetX: s.offsetX + this.ll.lc, offsetY: s.offsetY + this.ll.uc }, o = this.cl.map((c) => {
3421
3421
  const l = c.grid;
3422
3422
  return { layer: c, texture: c.texture, width: l.width, height: l.height, offsetX: l.offsetX + c.lc, offsetY: l.offsetY + c.uc };
3423
3423
  });
3424
- this.ol.il({ base: h, layers: o, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
3424
+ this.hl.el({ base: h, layers: o, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
3425
3425
  }
3426
3426
  Jr() {
3427
- this.ll && (this.cl.Jr(), this.al.forEach((t) => t.Jr()), this.ol.Jr(this.fa.kr.width, this.fa.kr.height));
3427
+ this.ul && (this.ll.Jr(), this.cl.forEach((t) => t.Jr()), this.hl.Jr(this.ua.kr.width, this.ua.kr.height));
3428
3428
  }
3429
3429
  gt() {
3430
- this.al.forEach((t) => t.gt()), this.hl.forEach((t) => t.gt()), this.cl.gt(), this.ol.gt();
3430
+ this.cl.forEach((t) => t.gt()), this.al.forEach((t) => t.gt()), this.ll.gt(), this.hl.gt();
3431
3431
  }
3432
3432
  get all() {
3433
- return this.al;
3433
+ return this.cl;
3434
3434
  }
3435
3435
  get base() {
3436
- return this.cl;
3436
+ return this.ll;
3437
3437
  }
3438
- getTopmostGrid() {
3439
- for (let t = this.al.length - 1; t >= 0; t--) {
3440
- const e = this.al[t];
3438
+ wl() {
3439
+ for (let t = this.cl.length - 1; t >= 0; t--) {
3440
+ const e = this.cl[t];
3441
3441
  if (e.ac && e.grid) return e.grid;
3442
3442
  }
3443
- return this.cl.grid;
3443
+ return this.ll.grid;
3444
3444
  }
3445
- Al(t) {
3446
- this.ul.add(t);
3445
+ bl(t) {
3446
+ this.fl.add(t);
3447
3447
  }
3448
- wl() {
3449
- for (const t of this.ul) t();
3448
+ Cl() {
3449
+ for (const t of this.fl) t();
3450
3450
  }
3451
- async fl(t) {
3451
+ async dl(t) {
3452
3452
  var i;
3453
- const e = { renderer: this.Z, canvas: this.fa.kr, filterManager: this.fa.Nc, createFramebuffer: (r, s, h = 1, o) => this.Z.Pe(r, s, h, o) };
3454
- await t.Fc(e), (i = t.grid) == null || i.Hr(() => this.wl());
3453
+ const e = { renderer: this.Z, canvas: this.ua.kr, filterManager: this.ua.Xc, createFramebuffer: (s, r, h = 1, o) => this.Z.Pe(s, r, h, o) };
3454
+ await t.Fc(e), (i = t.grid) == null || i.Hr(() => this.Cl());
3455
3455
  }
3456
- dl(t, e) {
3456
+ vl(t, e) {
3457
3457
  const i = t.indexOf(e);
3458
3458
  if (i === -1) return !1;
3459
- const [r] = t.splice(i, 1);
3460
- return r.gt(), !0;
3461
- }
3462
- vl(t, e, i) {
3463
- const r = t.indexOf(e);
3464
- if (r === -1) return !1;
3465
- t.splice(r, 1);
3466
- const s = Math.max(0, Math.min(t.length, i));
3467
- return t.splice(s, 0, e), !0;
3459
+ const [s] = t.splice(i, 1);
3460
+ return s.gt(), !0;
3468
3461
  }
3469
3462
  pl(t, e, i) {
3470
- const r = t.indexOf(e);
3471
- if (r === -1) return !1;
3472
- const s = t.indexOf(i);
3473
- return s !== -1 && (t[r] = i, t[s] = e, !0);
3463
+ const s = t.indexOf(e);
3464
+ if (s === -1) return !1;
3465
+ t.splice(s, 1);
3466
+ const r = Math.max(0, Math.min(t.length, i));
3467
+ return t.splice(r, 0, e), !0;
3468
+ }
3469
+ ml(t, e, i) {
3470
+ const s = t.indexOf(e);
3471
+ if (s === -1) return !1;
3472
+ const r = t.indexOf(i);
3473
+ return r !== -1 && (t[s] = i, t[r] = e, !0);
3474
3474
  }
3475
3475
  }
3476
3476
  class Ht {
3477
3477
  constructor(t) {
3478
3478
  a(this, "Z");
3479
- a(this, "bl", /* @__PURE__ */ new Map());
3480
- a(this, "Cl", /* @__PURE__ */ new Map());
3481
- this.Z = t, this.xl();
3479
+ a(this, "xl", /* @__PURE__ */ new Map());
3480
+ a(this, "Ml", /* @__PURE__ */ new Map());
3481
+ this.Z = t, this.Fl();
3482
3482
  }
3483
- async Ml(t, e, i = {}) {
3484
- const r = Object.entries(i), s = r.length > 0 ? r[0][1][0] : null;
3483
+ async $l(t, e, i = {}) {
3484
+ const s = Object.entries(i), r = s.length > 0 ? s[0][1][0] : null;
3485
3485
  let h;
3486
3486
  if (typeof e == "string") {
3487
3487
  let c = e;
@@ -3490,265 +3490,272 @@ class Ht {
3490
3490
  if (!l.ok) throw Error(`Failed to load shader from ${e}: ${l.statusText}`);
3491
3491
  c = await l.text();
3492
3492
  }
3493
- h = this.Z.pe(V, c), this.Cl.set(t, h);
3494
- } else h = e, this.Cl.set(t, h);
3493
+ h = this.Z.pe(Q, c), this.Ml.set(t, h);
3494
+ } else h = e, this.Ml.set(t, h);
3495
3495
  const o = { id: t, createShader: () => h, createUniforms: (c, l) => {
3496
3496
  const u = { u_resolution: [l.width, l.height] };
3497
- for (const [f, [d, g]] of r) {
3497
+ for (const [f, [d, g]] of s) {
3498
3498
  let p = g;
3499
- c != null && (typeof c == "number" && d === s ? p = c : typeof c == "object" && d in c && (p = c[d] ?? g)), u[f] = p;
3499
+ c != null && (typeof c == "number" && d === r ? p = c : typeof c == "object" && d in c && (p = c[d] ?? g)), u[f] = p;
3500
3500
  }
3501
3501
  return u;
3502
3502
  } };
3503
- this.bl.set(t, o);
3503
+ this.xl.set(t, o);
3504
3504
  }
3505
- Fl(t) {
3506
- const e = this.Cl.get(t);
3507
- return e && (e.dispose(), this.Cl.delete(t)), this.bl.delete(t);
3505
+ Pl(t) {
3506
+ const e = this.Ml.get(t);
3507
+ return e && (e.dispose(), this.Ml.delete(t)), this.xl.delete(t);
3508
3508
  }
3509
3509
  Pn(t) {
3510
- return this.bl.get(t);
3510
+ return this.xl.get(t);
3511
3511
  }
3512
3512
  gt() {
3513
- for (const t of this.Cl.values()) t.dispose();
3514
- this.Cl.clear(), this.bl.clear();
3513
+ for (const t of this.Ml.values()) t.dispose();
3514
+ this.Ml.clear(), this.xl.clear();
3515
3515
  }
3516
- xl() {
3517
- this.Ml("invert", `#version 300 es
3518
- precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);fragColor=vec4(1.-A.rgb,A.a);}`, {}), this.Ml("grayscale", `#version 300 es
3519
- precision highp float;uniform sampler2D u_texture;uniform float U8;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));vec3 C=mix(A.rgb,vec3(B),U8);fragColor=vec4(C,A.a);}`, { U8: ["amount", 1] }), this.Ml("sepia", `#version 300 es
3520
- precision highp float;uniform sampler2D u_texture;uniform float U8;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);vec3 B;B.r=dot(A.rgb,vec3(0.393,0.769,0.189));B.g=dot(A.rgb,vec3(0.349,0.686,0.168));B.b=dot(A.rgb,vec3(0.272,0.534,0.131));vec3 C=mix(A.rgb,B,U8);fragColor=vec4(C,A.a);}`, { U8: ["amount", 1] }), this.Ml("threshold", `#version 300 es
3521
- precision highp float;uniform sampler2D u_texture;uniform float U9;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));float C=step(U9,B);fragColor=vec4(vec3(C),A.a);}`, { U9: ["threshold", 0.5] });
3516
+ Fl() {
3517
+ this.$l("invert", `#version 300 es
3518
+ precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);fragColor=vec4(1.-A.rgb,A.a);}`, {}), this.$l("grayscale", `#version 300 es
3519
+ precision highp float;uniform sampler2D u_texture;uniform float Um;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));vec3 C=mix(A.rgb,vec3(B),Um);fragColor=vec4(C,A.a);}`, { Um: ["amount", 1] }), this.$l("sepia", `#version 300 es
3520
+ precision highp float;uniform sampler2D u_texture;uniform float Um;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);vec3 B;B.r=dot(A.rgb,vec3(0.393,0.769,0.189));B.g=dot(A.rgb,vec3(0.349,0.686,0.168));B.b=dot(A.rgb,vec3(0.272,0.534,0.131));vec3 C=mix(A.rgb,B,Um);fragColor=vec4(C,A.a);}`, { Um: ["amount", 1] }), this.$l("threshold", `#version 300 es
3521
+ precision highp float;uniform sampler2D u_texture;uniform float Un;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));float C=step(Un,B);fragColor=vec4(vec3(C),A.a);}`, { Un: ["threshold", 0.5] });
3522
3522
  }
3523
3523
  }
3524
3524
  class Wt {
3525
3525
  constructor(t) {
3526
3526
  a(this, "Z");
3527
- a(this, "Cl", /* @__PURE__ */ new Map());
3527
+ a(this, "Ml", /* @__PURE__ */ new Map());
3528
3528
  a(this, "J");
3529
3529
  a(this, "bc");
3530
3530
  a(this, "Ar", !1);
3531
- a(this, "$l");
3532
- this.Z = t, this.$l = new Ht(this.Z), this.J = t.pe(V, Dt);
3531
+ a(this, "Tl");
3532
+ this.Z = t, this.Tl = new Ht(this.Z), this.J = t.pe(Q, _t);
3533
3533
  }
3534
3534
  async register(t, e, i = {}) {
3535
- await this.$l.Ml(t, e, i);
3535
+ await this.Tl.$l(t, e, i);
3536
3536
  }
3537
3537
  unregister(t) {
3538
- return this.$l.Fl(t) ?? !1;
3538
+ return this.Tl.Pl(t) ?? !1;
3539
3539
  }
3540
3540
  has(t) {
3541
- return this.$l.Pn(t) !== void 0;
3541
+ return this.Tl.Pn(t) !== void 0;
3542
3542
  }
3543
3543
  wr(t, e) {
3544
3544
  this.Ar || (this.bc = [this.Z.Pe(t, e, 1, { depth: !1 }), this.Z.Pe(t, e, 1, { depth: !1 })], this.Ar = !0);
3545
3545
  }
3546
- Pl(t, e, i, r, s) {
3547
- this.bc[0].width === r && this.bc[0].height === s || (this.bc[0].resize(r, s), this.bc[1].resize(r, s)), this.Ec(t, e, i, r, s, this.bc);
3546
+ El(t, e, i, s, r) {
3547
+ this.bc[0].width === s && this.bc[0].height === r || (this.bc[0].resize(s, r), this.bc[1].resize(s, r)), this.Rc(t, e, i, s, r, this.bc);
3548
3548
  }
3549
- Ec(t, e, i, r, s, h) {
3550
- if (i.length === 0) return void this.Tl(t, e, r, s);
3549
+ Rc(t, e, i, s, r, h) {
3550
+ if (i.length === 0) return void this.Rl(t, e, s, r);
3551
3551
  const o = this.Z.context, c = o.isEnabled(o.BLEND);
3552
- o.disable(o.BLEND), this.Tl(t, h[0], r, s);
3552
+ o.disable(o.BLEND), this.Rl(t, h[0], s, r);
3553
3553
  let l = 0;
3554
3554
  for (let u = 0; u < i.length; u++) {
3555
3555
  const f = i[u], d = u === i.length - 1, g = l === 0 ? 1 : 0, p = d ? e : h[g];
3556
- this.El(f, h[l], p, r, s), d || (l = g);
3556
+ this.Sl(f, h[l], p, s, r), d || (l = g);
3557
3557
  }
3558
3558
  c && o.enable(o.BLEND);
3559
3559
  }
3560
- El(t, e, i, r, s) {
3561
- const h = this.$l.Pn(t.name);
3562
- if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.Tl(e.textures[0], i, r, s);
3563
- const o = this.Rl(t.name, h, r, s), c = { renderer: this.Z, gl: this.Z.context, width: r, height: s };
3560
+ Sl(t, e, i, s, r) {
3561
+ const h = this.Tl.Pn(t.name);
3562
+ if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.Rl(e.textures[0], i, s, r);
3563
+ const o = this.zl(t.name, h, s, r), c = { renderer: this.Z, gl: this.Z.context, width: s, height: r };
3564
3564
  i.begin(), this.Z.ve(o), o.O({ u_texture: e.textures[0] });
3565
3565
  const l = h.createUniforms(t.params, c);
3566
- o.O(l), this.Z.we(0, 0, r, s), i.end();
3566
+ o.O(l), this.Z.we(0, 0, s, r), i.end();
3567
3567
  }
3568
- Rl(t, e, i, r) {
3569
- let s = this.Cl.get(t);
3570
- if (!s && e) {
3571
- const h = { renderer: this.Z, gl: this.Z.context, width: i, height: r };
3572
- s = e.createShader(h), this.Cl.set(t, s);
3568
+ zl(t, e, i, s) {
3569
+ let r = this.Ml.get(t);
3570
+ if (!r && e) {
3571
+ const h = { renderer: this.Z, gl: this.Z.context, width: i, height: s };
3572
+ r = e.createShader(h), this.Ml.set(t, r);
3573
3573
  }
3574
- return s;
3574
+ return r;
3575
3575
  }
3576
- Tl(t, e, i, r) {
3577
- e.begin(), this.Z.ve(this.J), this.J.O({ u_texture: t, u_resolution: [i, r] }), this.Z.we(0, 0, i, r), e.end();
3576
+ Rl(t, e, i, s) {
3577
+ e.begin(), this.Z.ve(this.J), this.J.O({ u_texture: t, u_resolution: [i, s] }), this.Z.we(0, 0, i, s), e.end();
3578
3578
  }
3579
3579
  Jr(t, e) {
3580
3580
  this.bc && (this.bc[0].resize(t, e), this.bc[1].resize(t, e));
3581
3581
  }
3582
3582
  gt() {
3583
- for (const t of this.Cl.values()) t.dispose();
3584
- this.Cl.clear(), this.J.dispose(), this.$l.gt(), this.bc && (this.bc[0].gt(), this.bc[1].gt()), this.Ar = !1;
3583
+ for (const t of this.Ml.values()) t.dispose();
3584
+ this.Ml.clear(), this.J.dispose(), this.Tl.gt(), this.bc && (this.bc[0].gt(), this.bc[1].gt()), this.Ar = !1;
3585
3585
  }
3586
3586
  }
3587
- const Qe = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: Ht, TextmodeFilterManager: Wt }, Symbol.toStringTag, { value: "Module" }));
3587
+ const Ke = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: Ht, TextmodeFilterManager: Wt }, Symbol.toStringTag, { value: "Module" }));
3588
3588
  let lt = null;
3589
- const qe = { id: "brightness", createShader: ({ gl: n }) => (lt || (lt = new q(n, rt, `#version 300 es
3589
+ const qe = { id: "brightness", createShader: ({ gl: n }) => (lt || (lt = new q(n, st, `#version 300 es
3590
3590
  precision highp float;in vec2 v_uv;uniform sampler2D u_image;uniform bool u_invert;uniform bool u_flipX;uniform bool u_flipY;uniform float u_charRotation;uniform bool u_charColorFixed;uniform vec4 u_charColor;uniform bool u_cellColorFixed;uniform vec4 u_cellColor;uniform vec4 u_backgroundColor;uniform int u_charCount;uniform vec3 u_charList[255];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;float B(vec3 C){return dot(C,vec3(0.299f,0.587f,0.114f));}void main(){vec2 D=vec2(v_uv.x,1.0f-v_uv.y);vec4 E=texture(u_image,D);float F=B(E.rgb);vec2 G=vec2(0.);if(u_charCount>0){float H=float(u_charCount);float I=clamp(F*(H-1.0f),0.0f,H-1.0f);int J=int(floor(I+0.5f));vec3 K=u_charList[J];G=K.xy;}else{G=vec2(0.0f,0.0f);}vec4 L=u_charColorFixed?u_charColor:E;vec4 M=u_cellColorFixed?u_cellColor:E;if(E.a<0.01f){discard;}o_primaryColor=vec4(L.rgb,L.a);o_secondaryColor=vec4(M.rgb,M.a);A=vec4(0.);int N=int(u_invert?1:0);int O=int(u_flipX?1:0);int P=int(u_flipY?1:0);float Q=float(N|(O<<1)|(P<<2))/255.;o_character=vec4(G,Q,clamp(u_charRotation,0.0f,1.0f));}`)), lt), createUniforms: ({ source: n }) => n.createBaseConversionUniforms() };
3591
3591
  class qt {
3592
3592
  constructor() {
3593
- a(this, "Sl", /* @__PURE__ */ new Map());
3594
- a(this, "Cl", /* @__PURE__ */ new Map());
3595
- this.zl();
3593
+ a(this, "kl", /* @__PURE__ */ new Map());
3594
+ a(this, "Ml", /* @__PURE__ */ new Map());
3595
+ this.Dl();
3596
3596
  }
3597
- Ml(t) {
3598
- this.Sl.set(t.id, t);
3597
+ $l(t) {
3598
+ this.kl.set(t.id, t);
3599
3599
  }
3600
- Fl(t) {
3601
- const e = this.Cl.get(t);
3602
- return e && (e.dispose(), this.Cl.delete(t)), this.Sl.delete(t);
3600
+ Pl(t) {
3601
+ const e = this.Ml.get(t);
3602
+ return e && (e.dispose(), this.Ml.delete(t)), this.kl.delete(t);
3603
3603
  }
3604
3604
  Pn(t) {
3605
- return this.Sl.get(t);
3605
+ return this.kl.get(t);
3606
3606
  }
3607
- kl(t) {
3608
- return this.Sl.has(t);
3607
+ Ll(t) {
3608
+ return this.kl.has(t);
3609
3609
  }
3610
3610
  gt() {
3611
- for (const t of this.Cl.values()) t.dispose();
3612
- this.Cl.clear(), this.Sl.clear();
3611
+ for (const t of this.Ml.values()) t.dispose();
3612
+ this.Ml.clear(), this.kl.clear();
3613
3613
  }
3614
- zl() {
3615
- this.Ml(qe);
3614
+ Dl() {
3615
+ this.$l(qe);
3616
3616
  }
3617
3617
  }
3618
3618
  class jt {
3619
3619
  constructor() {
3620
- a(this, "Dl");
3621
- this.Dl = new qt();
3620
+ a(this, "Ol");
3621
+ this.Ol = new qt();
3622
3622
  }
3623
3623
  register(t) {
3624
- this.Dl.Ml(t);
3624
+ this.Ol.$l(t);
3625
3625
  }
3626
3626
  unregister(t) {
3627
- return this.Dl.Fl(t);
3627
+ return this.Ol.Pl(t);
3628
3628
  }
3629
3629
  has(t) {
3630
- return this.Dl.kl(t);
3630
+ return this.Ol.Ll(t);
3631
3631
  }
3632
3632
  Pn(t) {
3633
- return this.Dl.Pn(t);
3633
+ return this.Ol.Pn(t);
3634
3634
  }
3635
3635
  gt() {
3636
- this.Dl.gt();
3636
+ this.Ol.gt();
3637
3637
  }
3638
3638
  }
3639
- const Ke = Object.freeze(Object.defineProperty({ __proto__: null, ConversionRegistry: qt, TextmodeConversionManager: jt }, Symbol.toStringTag, { value: "Module" }));
3639
+ const Ve = Object.freeze(Object.defineProperty({ __proto__: null, ConversionRegistry: qt, TextmodeConversionManager: jt }, Symbol.toStringTag, { value: "Module" }));
3640
3640
  class je extends function(e, ...i) {
3641
- return i.reduce((r, s) => s(r), e);
3641
+ return i.reduce((s, r) => r(s), e);
3642
3642
  }(class {
3643
- }, Ze, Xe, ze, ke, Ye) {
3643
+ }, Xe, Ze, ze, ke, Ye) {
3644
3644
  constructor(e = {}) {
3645
3645
  super();
3646
3646
  a(this, "Z");
3647
3647
  a(this, "kr");
3648
- a(this, "aa");
3649
- a(this, "qo");
3648
+ a(this, "ha");
3649
+ a(this, "Zo");
3650
+ a(this, "ca");
3650
3651
  a(this, "la");
3651
- a(this, "ua");
3652
- a(this, "Ll");
3653
- a(this, "Zc");
3652
+ a(this, "Il");
3654
3653
  a(this, "qc");
3655
- a(this, "ha");
3654
+ a(this, "Vc");
3655
+ a(this, "oa");
3656
3656
  a(this, "dn");
3657
- a(this, "Uc");
3658
- a(this, "Nc");
3657
+ a(this, "Ec");
3658
+ a(this, "Xc");
3659
3659
  a(this, "gn");
3660
- a(this, "Ol", []);
3661
- a(this, "Bl");
3662
- a(this, "Il");
3660
+ a(this, "Bl", []);
3663
3661
  a(this, "Hl");
3664
- a(this, "Gl", !1);
3665
- a(this, "Ql", !1);
3662
+ a(this, "Gl");
3663
+ a(this, "Ql");
3666
3664
  a(this, "Nl", !1);
3667
3665
  a(this, "Xl", !1);
3668
- a(this, "Yl", () => {
3666
+ a(this, "Yl", !1);
3667
+ a(this, "jl", !1);
3668
+ a(this, "Kl", () => {
3669
3669
  });
3670
3670
  a(this, "Cc", () => {
3671
3671
  });
3672
- a(this, "jl", () => {
3672
+ a(this, "Wl", () => {
3673
3673
  });
3674
- a(this, "Kl");
3675
- a(this, "Wl");
3676
- a(this, "Xr", !1);
3677
3674
  a(this, "Zl");
3678
- this.Hl = new Ge(this), this.Xr = e.overlay ?? !1, this.kr = new De(e), this.Z = new me(this.kr.tn()), this.aa = new Ut(e.frameRate ?? 60), this.Ll = new kt(this, e.loadingScreen, this.kr.Vr()), this.Ll.Kc(() => {
3679
- this.aa.Kn = 0, this.Xl = !0;
3680
- }), this.Zc = this.Z.pe(V, `#version 300 es
3681
- precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D Um;uniform sampler2D Un;uniform sampler2D Ul;uniform vec2 Uo;uniform vec2 Up;uniform vec4 Uq;in vec2 v_uv;out vec4 fragColor;mat2 A(float B){float C=sin(B);float D=cos(B);return mat2(D,-C,C,D);}void main(){vec2 E=gl_FragCoord.xy/Up;vec2 F=E*Uo;vec2 G=floor(F);vec2 H=(G+0.5)/Uo;vec4 I=texture(Um,H);vec4 J=texture(Un,H);vec4 K=texture(Ul,H);int L=int(K.b*255.+0.5);bool M=(L&1)!=0;bool N=(L&2)!=0;bool O=(L&4)!=0;int P=int(K.r*255.+0.5)+int(K.g*255.+0.5)*256;int Q=int(u_charsetDimensions.x);int R=P/Q;int S=P-(R*Q);float T=(u_charsetDimensions.y-1.)-float(R);vec2 U=1./u_charsetDimensions;vec2 V=vec2(float(S),T)*U;vec2 W=V+U;float X=-K.a*360.*0.017453292;vec2 Y=fract(F)-0.5f;vec2 Z=vec2(N?-1.:1.,O?-1.:1.);Y*=Z;Y=A(X)*Y+0.5;vec2 a=V+clamp(Y,0.,1.)*U;const float b=0.0001;if(any(lessThan(a,V-b))||any(greaterThan(a,W+b))){fragColor=M?I:J;return;}vec4 c=texture(u_characterTexture,a);if(M)c.rgb=mix(c.rgb,1.-c.rgb,float(M));vec4 d=mix(Uq,J,J.a);fragColor=mix(d,I,c);}`), this.qc = this.Z.pe(V, Dt), this.ha = new Gt(this, e);
3682
- const i = () => this.ha.getTopmostGrid();
3683
- this.qo = new Lt(this.kr, i), this.la = new Bt(this.kr, i, this.qo), this.ua = new Nt(), this.Nc = new Wt(this.Z), this.gn = new jt(), this.Ll.In(), this.ql(e);
3684
- }
3685
- async ql(e) {
3686
- await this.ha.wr(), await this.Ll.wr();
3687
- const i = this.ha.base.grid;
3688
- this.ha.Al(() => {
3689
- this.qo.Fo(), this.la.Fo();
3690
- }), this.Bl = this.Z.Pe(this.kr.width, this.kr.height, 1), this.Il = this.Z.Pe(this.kr.width, this.kr.height, 1), this.Nc.wr(this.kr.width, this.kr.height), this.Xr && (this.Zl = z.Tn(this.Z, this.gn, this.kr.targetCanvas, i.cols, i.rows)), this.Vl(), this.aa.In(() => this.ca()), await this.Hl.ma(e.plugins ?? []);
3675
+ a(this, "ql");
3676
+ a(this, "Xr", !1);
3677
+ a(this, "Vl");
3678
+ a(this, "Jl");
3679
+ this.Ql = new Ge(this), this.Xr = e.overlay ?? !1, this.kr = new _e(e), this.Z = new Ae(this.kr.tn()), this.ha = new Ut(e.frameRate ?? 60), this.Il = new kt(this, e.loadingScreen, this.kr.Vr()), this.Il.Wc(() => {
3680
+ this.ha.Kn = 0, this.jl = !0;
3681
+ }), this.qc = this.Z.pe(Q, `#version 300 es
3682
+ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D Uh;uniform sampler2D Ui;uniform sampler2D Ug;uniform vec2 Uj;uniform vec2 Uk;uniform vec4 Ul;in vec2 v_uv;out vec4 fragColor;mat2 A(float B){float C=sin(B);float D=cos(B);return mat2(D,-C,C,D);}void main(){vec2 E=gl_FragCoord.xy/Uk;vec2 F=E*Uj;vec2 G=floor(F);vec2 H=(G+0.5)/Uj;vec4 I=texture(Uh,H);vec4 J=texture(Ui,H);vec4 K=texture(Ug,H);int L=int(K.b*255.+0.5);bool M=(L&1)!=0;bool N=(L&2)!=0;bool O=(L&4)!=0;int P=int(K.r*255.+0.5)+int(K.g*255.+0.5)*256;int Q=int(u_charsetDimensions.x);int R=P/Q;int S=P-(R*Q);float T=(u_charsetDimensions.y-1.)-float(R);vec2 U=1./u_charsetDimensions;vec2 V=vec2(float(S),T)*U;vec2 W=V+U;float X=-K.a*360.*0.017453292;vec2 Y=fract(F)-0.5f;vec2 Z=vec2(N?-1.:1.,O?-1.:1.);Y*=Z;Y=A(X)*Y+0.5;vec2 a=V+clamp(Y,0.,1.)*U;const float b=0.0001;if(any(lessThan(a,V-b))||any(greaterThan(a,W+b))){fragColor=M?I:J;return;}vec4 c=texture(u_characterTexture,a);if(M)c.rgb=mix(c.rgb,1.-c.rgb,float(M));vec4 d=mix(Ul,J,J.a);fragColor=mix(d,I,c);}`), this.Vc = this.Z.pe(Q, _t), this.oa = new Gt(this, e);
3683
+ const i = () => this.tu();
3684
+ this.Zo = new Lt(this.kr, i), this.ca = new Nt(this.kr, i, this.Zo), this.la = new Bt(), this.Xc = new Wt(this.Z), this.gn = new jt(), this.Il.Bn(), this.su(e);
3685
+ }
3686
+ async su(e) {
3687
+ await this.oa.wr(), await this.Il.wr();
3688
+ const i = this.oa.base.grid;
3689
+ this.oa.bl(() => {
3690
+ this.Zo.Fo(), this.ca.Fo();
3691
+ }), this.Hl = this.Z.Pe(this.kr.width, this.kr.height, 1), this.Gl = this.Z.Pe(this.kr.width, this.kr.height, 1), this.Xc.wr(this.kr.width, this.kr.height), this.Xr && (this.Vl = z.Tn(this.Z, this.gn, this.kr.targetCanvas, i.cols, i.rows)), this.iu(), this.ha.Bn(() => this.aa()), await this.Ql.ga(e.plugins ?? []);
3691
3692
  try {
3692
- await this.Yl(), this.Ll.Wa();
3693
- } catch (r) {
3694
- console.error("Error during setup:", r), this.Ll.error(r);
3693
+ await this.Kl(), this.Il.Wa();
3694
+ } catch (s) {
3695
+ console.error("Error during setup:", s), this.Il.error(s);
3695
3696
  }
3696
3697
  }
3697
- Vl() {
3698
- this.Kl = () => {
3699
- this.Xr && this.resizeCanvas(this.kr.targetCanvas.width, this.kr.targetCanvas.height), this.jl();
3700
- }, window.addEventListener("resize", this.Kl), this.qo._o(), this.la._o(), this.ua._o(), window.addEventListener("blur", () => {
3701
- this.ua.Zo();
3702
- }), this.Xr && (this.Wl = new ResizeObserver(() => {
3698
+ iu() {
3699
+ this.Zl = () => {
3700
+ this.Xr && this.resizeCanvas(this.kr.targetCanvas.width, this.kr.targetCanvas.height), this.Wl();
3701
+ }, window.addEventListener("resize", this.Zl), this.Zo._o(), this.ca._o(), this.la._o(), window.addEventListener("blur", () => {
3702
+ this.la.Wo();
3703
+ }), this.Xr && (this.ql = new ResizeObserver(() => {
3703
3704
  this.resizeCanvas(this.kr.targetCanvas.width, this.kr.targetCanvas.height);
3704
- }), this.Wl.observe(this.kr.targetCanvas));
3705
+ }), this.ql.observe(this.kr.targetCanvas));
3705
3706
  }
3706
- ca() {
3707
- if (!this.Ll.Xa && this.Xl) {
3708
- this.Ql = !0;
3707
+ aa() {
3708
+ if (!this.Il.Xa && this.jl) {
3709
+ this.Xl = !0;
3709
3710
  try {
3710
- this.aa.Xn(), this.aa.Wn(), this.Xr && Tt(this.Z.context, this.Zl.texture, this.kr.targetCanvas), this.Hl.ba(), this.Z.state.qt(), this.ha.ml(this.Bl, () => this.Cc());
3711
- let e = this.Bl.textures[0];
3712
- this.Ol.length > 0 && (this.Nc.Pl(this.Bl.textures[0], this.Il, this.Ol, this.kr.width, this.kr.height), e = this.Il.textures[0], this.Ol = []), this.Z.wi(0, 0, 0, 0), this.Z.ve(this.qc), this.qc.O({ u_texture: e }), this.Z.we(0, 0, this.kr.width, this.kr.height), this.Hl.xa();
3711
+ this.ha.Xn(), this.ha.Wn(), this.Xr && Tt(this.Z.context, this.Vl.texture, this.kr.targetCanvas), this.Ql.wa(), this.Z.state.qt(), this.oa._l(this.Hl, () => this.Cc());
3712
+ let e = this.Hl.textures[0];
3713
+ this.Bl.length > 0 && (this.Xc.El(this.Hl.textures[0], this.Gl, this.Bl, this.kr.width, this.kr.height), e = this.Gl.textures[0], this.Bl = []), this.Z.wi(0, 0, 0, 0), this.Z.ve(this.Vc), this.Vc.O({ u_texture: e }), this.Z.we(0, 0, this.kr.width, this.kr.height), this.Ql.Ca();
3713
3714
  } finally {
3714
- this.Ql = !1, this.Gl && !this.Nl && this.Jl();
3715
+ this.Xl = !1, this.Nl && !this.Yl && this.eu();
3715
3716
  }
3716
3717
  }
3717
3718
  }
3718
3719
  resizeCanvas(e, i) {
3719
- var r, s, h, o;
3720
- this.kr.Jr(e, i), this.Ll.Vc(this.kr.Vr()), this.Ll.Jr(), (r = this.Bl) == null || r.resize(this.kr.width, this.kr.height), (s = this.Il) == null || s.resize(this.kr.width, this.kr.height), (h = this.Nc) == null || h.Jr(this.kr.width, this.kr.height), (o = this.ha) == null || o.Jr(), this.Z.Re(), this.ca();
3720
+ var s, r, h, o;
3721
+ this.kr.Jr(e, i), this.Il.Jc(this.kr.Vr()), this.Il.Jr(), (s = this.Hl) == null || s.resize(this.kr.width, this.kr.height), (r = this.Gl) == null || r.resize(this.kr.width, this.kr.height), (h = this.Xc) == null || h.Jr(this.kr.width, this.kr.height), (o = this.oa) == null || o.Jr(), this.Z.Re(), this.aa();
3721
3722
  }
3722
3723
  destroy() {
3723
- this.Nl || this.Gl || (this.Gl = !0, this.aa.Gn(), this.Ql || this.Jl());
3724
+ this.Yl || this.Nl || (this.Nl = !0, this.ha.Gn(), this.Xl || this.eu());
3724
3725
  }
3725
- Jl() {
3726
- var e, i, r, s, h, o, c;
3727
- this.Gl = !1, this.Ll.gt(), this.Hl.Ma(), window.removeEventListener("resize", this.Kl), (e = this.Wl) == null || e.disconnect(), this.qo.Mo(), this.la.Mo(), this.ua.Mo(), this.Zc.dispose(), (i = this.ha) == null || i.gt(), (r = this.Nc) == null || r.gt(), (s = this.gn) == null || s.gt(), (h = this.Bl) == null || h.gt(), (o = this.Il) == null || o.gt(), this.Z.gt(), this.qc.dispose(), (c = this.Zl) == null || c.gt(), this.kr.gt(), this.Nl = !0;
3726
+ eu() {
3727
+ var e, i, s, r, h, o, c;
3728
+ this.Nl = !1, this.Il.gt(), this.Ql.xa(), window.removeEventListener("resize", this.Zl), (e = this.ql) == null || e.disconnect(), this.Zo.Mo(), this.ca.Mo(), this.la.Mo(), this.qc.dispose(), (i = this.oa) == null || i.gt(), (s = this.Xc) == null || s.gt(), (r = this.gn) == null || r.gt(), (h = this.Hl) == null || h.gt(), (o = this.Gl) == null || o.gt(), this.Z.gt(), this.Vc.dispose(), (c = this.Vl) == null || c.gt(), this.kr.gt(), this.Yl = !0;
3728
3729
  }
3729
3730
  filter(e, i) {
3730
- this.Ol.push({ name: e, params: i });
3731
+ this.Bl.push({ name: e, params: i });
3731
3732
  }
3732
3733
  async loadFont(e) {
3733
- return await this.ha.base.loadFont(e), this.ha.base.font;
3734
+ return await this.oa.base.loadFont(e), this.oa.base.font;
3734
3735
  }
3735
3736
  fontSize(e) {
3736
- vt.m(typeof e == "number" && e > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: e }) && this.ha.base.font.fontSize !== e && this.ha.base.font.Mr(e);
3737
+ vt.m(typeof e == "number" && e > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: e }) && this.oa.base.font.fontSize !== e && this.oa.base.font.Mr(e);
3738
+ }
3739
+ inputGrid(e) {
3740
+ return e === void 0 ? this.Jl ?? "topmost" : e === "topmost" ? (this.Jl = void 0, this.Zo.Fo(), void this.ca.Fo()) : (this.Jl = e, this.Zo.Fo(), void this.ca.Fo());
3741
+ }
3742
+ tu() {
3743
+ return this.Jl ? this.Jl : this.oa.wl();
3737
3744
  }
3738
3745
  async setup(e) {
3739
- this.Yl = e;
3746
+ this.Kl = e;
3740
3747
  }
3741
3748
  draw(e) {
3742
3749
  this.Cc = e;
3743
3750
  }
3744
3751
  windowResized(e) {
3745
- this.jl = e;
3752
+ this.Wl = e;
3746
3753
  }
3747
3754
  get grid() {
3748
- return this.Uc ?? this.ha.base.grid;
3755
+ return this.Ec ?? this.oa.base.grid;
3749
3756
  }
3750
3757
  get font() {
3751
- return this.dn ?? this.ha.base.font;
3758
+ return this.dn ?? this.oa.base.font;
3752
3759
  }
3753
3760
  get width() {
3754
3761
  return this.kr.width;
@@ -3760,25 +3767,25 @@ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charse
3760
3767
  return this.kr.canvas;
3761
3768
  }
3762
3769
  get isDisposed() {
3763
- return this.Nl;
3770
+ return this.Yl;
3764
3771
  }
3765
3772
  get overlay() {
3766
- return this.Zl;
3773
+ return this.Vl;
3767
3774
  }
3768
3775
  get loading() {
3769
- return this.Ll;
3776
+ return this.Il;
3770
3777
  }
3771
3778
  get layers() {
3772
- return this.ha;
3779
+ return this.oa;
3773
3780
  }
3774
3781
  get filters() {
3775
- return this.Nc;
3782
+ return this.Xc;
3776
3783
  }
3777
3784
  get conversions() {
3778
3785
  return this.gn;
3779
3786
  }
3780
3787
  }
3781
- class At {
3788
+ class mt {
3782
3789
  constructor() {
3783
3790
  }
3784
3791
  static create(t = {}) {
@@ -3788,25 +3795,25 @@ class At {
3788
3795
  vt._(t);
3789
3796
  }
3790
3797
  static get version() {
3791
- return "0.8.0-beta.3";
3798
+ return "0.8.0";
3792
3799
  }
3793
3800
  }
3794
- const Je = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: zt, LoadingPhaseTracker: It, LoadingScreenManager: kt, LoadingScreenStateMachine: _t, LoadingScreenTransition: Ot, resolveColorInputs: Xt, resolveDefaultPalette: Zt, resolveTheme: gt }, Symbol.toStringTag, { value: "Module" })), $e = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: et, TextmodeImage: z, TextmodeVideo: nt }, Symbol.toStringTag, { value: "Module" })), ti = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: _e, mouse: Ie, touch: Oe }, Symbol.toStringTag, { value: "Module" })), ei = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: Yt, TextmodeLayer: it, TextmodeLayerManager: Gt }, Symbol.toStringTag, { value: "Module" })), ii = At.create, ri = At.setErrorLevel, si = At.version;
3801
+ const Je = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: zt, LoadingPhaseTracker: Dt, LoadingScreenManager: kt, LoadingScreenStateMachine: Ot, LoadingScreenTransition: It, resolveColorInputs: Zt, resolveDefaultPalette: Xt, resolveTheme: gt }, Symbol.toStringTag, { value: "Module" })), $e = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: et, TextmodeImage: z, TextmodeVideo: nt }, Symbol.toStringTag, { value: "Module" })), ti = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: Oe, mouse: De, touch: Ie }, Symbol.toStringTag, { value: "Module" })), ei = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: Yt, TextmodeLayer: it, TextmodeLayerManager: Gt }, Symbol.toStringTag, { value: "Module" })), ii = mt.create, si = mt.setErrorLevel, ri = mt.version;
3795
3802
  export {
3796
- De as TextmodeCanvas,
3803
+ _e as TextmodeCanvas,
3797
3804
  S as TextmodeColor,
3798
3805
  $t as TextmodeErrorLevel,
3799
- X as TextmodeFramebuffer,
3806
+ Z as TextmodeFramebuffer,
3800
3807
  Le as TextmodeGrid,
3801
3808
  je as Textmodifier,
3802
- Ke as conversion,
3809
+ Ve as conversion,
3803
3810
  ii as create,
3804
- Qe as filters,
3811
+ Ke as filters,
3805
3812
  ti as input,
3806
3813
  ei as layering,
3807
3814
  $e as loadables,
3808
3815
  Je as loading,
3809
- ri as setErrorLevel,
3810
- At as textmode,
3811
- si as version
3816
+ si as setErrorLevel,
3817
+ mt as textmode,
3818
+ ri as version
3812
3819
  };