textmode.js 0.7.1-beta.1 → 0.7.1-beta.3

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,15 +1,15 @@
1
- var jt = Object.defineProperty;
2
- var Vt = (n, t, e) => t in n ? jt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var a = (n, t, e) => Vt(n, typeof t != "symbol" ? t + "" : t, e);
4
- class S extends Error {
1
+ var Qt = Object.defineProperty;
2
+ var qt = (n, t, e) => t in n ? Qt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var a = (n, t, e) => qt(n, typeof t != "symbol" ? t + "" : t, e);
4
+ class U extends Error {
5
5
  constructor(t, e = {}) {
6
- super(S.i(t, e)), this.name = "TextmodeError";
6
+ super(U.i(t, e)), this.name = "TextmodeError";
7
7
  }
8
8
  static i(t, e) {
9
9
  return `${t}${e && Object.keys(e).length > 0 ? `
10
10
 
11
11
  📋 Context:` + Object.entries(e).map(([i, s]) => `
12
- - ${i}: ${S.h(s)}`).join("") : ""}
12
+ - ${i}: ${U.h(s)}`).join("") : ""}
13
13
 
14
14
  ${"↓".repeat(24)}
15
15
  `;
@@ -19,21 +19,21 @@ ${"↓".repeat(24)}
19
19
  if (t === void 0) return "undefined";
20
20
  if (typeof t == "string") return `"${t}"`;
21
21
  if (typeof t == "number" || typeof t == "boolean") return t + "";
22
- if (Array.isArray(t)) return t.length === 0 ? "[]" : t.length <= 5 ? `[${t.map((e) => S.h(e)).join(", ")}]` : `[${t.slice(0, 3).map((e) => S.h(e)).join(", ")}, ... +${t.length - 3} more]`;
22
+ if (Array.isArray(t)) return t.length === 0 ? "[]" : t.length <= 5 ? `[${t.map((e) => U.h(e)).join(", ")}]` : `[${t.slice(0, 3).map((e) => U.h(e)).join(", ")}, ... +${t.length - 3} more]`;
23
23
  if (typeof t == "object") {
24
24
  const e = Object.keys(t);
25
- return e.length === 0 ? "{}" : e.length <= 3 ? `{ ${e.map((i) => `${i}: ${S.h(t[i])}`).join(", ")} }` : `{ ${e.slice(0, 2).map((i) => `${i}: ${S.h(t[i])}`).join(", ")}, ... +${e.length - 2} more }`;
25
+ return e.length === 0 ? "{}" : e.length <= 3 ? `{ ${e.map((i) => `${i}: ${U.h(t[i])}`).join(", ")} }` : `{ ${e.slice(0, 2).map((i) => `${i}: ${U.h(t[i])}`).join(", ")}, ... +${e.length - 2} more }`;
26
26
  }
27
27
  return t + "";
28
28
  }
29
29
  }
30
30
  var Jt = ((n) => (n[n.SILENT = 0] = "SILENT", n[n.WARNING = 1] = "WARNING", n[n.ERROR = 2] = "ERROR", n[n.THROW = 3] = "THROW", n))(Jt || {});
31
- const O = class O {
31
+ const B = class B {
32
32
  constructor() {
33
33
  a(this, "l", { globalLevel: 3 });
34
34
  }
35
35
  static u() {
36
- return O.o || (O.o = new O()), O.o;
36
+ return B.o || (B.o = new B()), B.o;
37
37
  }
38
38
  v(t, e) {
39
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;";
@@ -41,11 +41,11 @@ const O = class O {
41
41
  case 0:
42
42
  return !1;
43
43
  case 1:
44
- return console.group(i, s), console.warn(S.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, s), console.error(S.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
- throw new S(t, e);
48
+ throw new U(t, e);
49
49
  }
50
50
  }
51
51
  m(t, e, i) {
@@ -55,8 +55,8 @@ const O = class O {
55
55
  this.l.globalLevel = t;
56
56
  }
57
57
  };
58
- a(O, "o", null);
59
- let lt = O;
58
+ a(B, "o", null);
59
+ let lt = B;
60
60
  const vt = lt.u();
61
61
  class H {
62
62
  constructor(t, e, i) {
@@ -115,7 +115,7 @@ class H {
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 W) {
118
+ if (e instanceof j) {
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
  }
@@ -149,7 +149,7 @@ function Et(n, t, e, i) {
149
149
  function z(n, t, e, i) {
150
150
  return Math.hypot(e - n, i - t);
151
151
  }
152
- function B(n, t, e) {
152
+ function Z(n, t, e) {
153
153
  return Math.min(Math.max(n, t), e);
154
154
  }
155
155
  function Tt(n) {
@@ -168,21 +168,21 @@ function Ft(n, t, e, i, s) {
168
168
  n.bindBuffer(t, e), n.bufferData(t, i, s), n.bindBuffer(t, null);
169
169
  }
170
170
  const it = `#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 U9;uniform float Ua;uniform float Ub;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/U9)*2.0f;AA.y=-AA.y;float AB=y.z/U9.y;float AC=clamp(-AB*Ua,-0.99f,0.99f);if(Ub>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 {
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 Us;uniform float Ut;uniform float Uu;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/Us)*2.0f;AA.y=-AA.y;float AB=y.z/Us.y;float AC=clamp(-AB*Ut,-0.99f,0.99f);if(Uu>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);}}`, O = class O {
172
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");
176
176
  a(this, "A");
177
177
  a(this, "Y");
178
- a(this, "W", []);
179
- a(this, "j", null);
178
+ a(this, "j", []);
179
+ a(this, "W", null);
180
180
  a(this, "K");
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.K = B(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 H(t, it, `#version 300 es
185
- precision highp float;in vec2 v_uv;uniform sampler2D U1;uniform sampler2D U2;uniform sampler2D U3;uniform sampler2D U4;uniform vec2 U5;uniform bool U6;uniform bool U7;uniform bool U8;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*U5;vec2 D=(floor(C)+0.5f)/U5;vec4 E=texture(U1,D);vec4 F=U6?texture(U2,D):vec4(0.);if(U6&&F.a==0.){discard;}vec4 G=U7?texture(U3,D):vec4(0.);vec4 H=U8?texture(U4,D):vec4(0.);o_character=E;o_primaryColor=F;o_secondaryColor=G;A=H;}`));
184
+ this.N = e, this.X = i, this.A = t, this.K = Z(s, 1, 8), this.Z = h, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...r }, O.J || (O.J = new H(t, it, `#version 300 es
185
+ precision highp float;in vec2 v_uv;uniform sampler2D U5;uniform sampler2D U6;uniform sampler2D U7;uniform sampler2D U8;uniform vec2 U9;uniform bool Ua;uniform bool Ub;uniform bool Uc;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*U9;vec2 D=(floor(C)+0.5f)/U9;vec4 E=texture(U5,D);vec4 F=Ua?texture(U6,D):vec4(0.);if(Ua&&F.a==0.){discard;}vec4 G=Ub?texture(U7,D):vec4(0.);vec4 H=Uc?texture(U8,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.K = Math.min(this.K, o, c), this.Y = t.createFramebuffer(), this.tt(), this.st(), this.l.depth && this.it();
188
188
  }
@@ -190,18 +190,18 @@ precision highp float;in vec2 v_uv;uniform sampler2D U1;uniform sampler2D U2;uni
190
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.K; o++) {
192
192
  const c = t.createTexture();
193
- t.bindTexture(t.TEXTURE_2D, c), et(t, e, e, i, i), t.texImage2D(t.TEXTURE_2D, 0, r, this.N, this.X, 0, h, s, null), this.W.push(c);
193
+ t.bindTexture(t.TEXTURE_2D, c), et(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
  }
197
197
  st() {
198
198
  const t = this.A;
199
- if (t.bindFramebuffer(t.FRAMEBUFFER, this.Y), this.K === 1) t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, this.W[0], 0);
199
+ if (t.bindFramebuffer(t.FRAMEBUFFER, this.Y), this.K === 1) t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, this.j[0], 0);
200
200
  else {
201
201
  const e = [];
202
202
  for (let i = 0; i < this.K; i++) {
203
203
  const s = t.COLOR_ATTACHMENT0 + i;
204
- t.framebufferTexture2D(t.FRAMEBUFFER, s, t.TEXTURE_2D, this.W[i], 0), e.push(s);
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
  }
@@ -209,16 +209,16 @@ precision highp float;in vec2 v_uv;uniform sampler2D U1;uniform sampler2D U2;uni
209
209
  }
210
210
  it() {
211
211
  const t = this.A;
212
- this.j = t.createRenderbuffer(), t.bindRenderbuffer(t.RENDERBUFFER, this.j), t.renderbufferStorage(t.RENDERBUFFER, t.DEPTH_COMPONENT24, this.N, this.X), t.bindFramebuffer(t.FRAMEBUFFER, this.Y), t.framebufferRenderbuffer(t.FRAMEBUFFER, t.DEPTH_ATTACHMENT, t.RENDERBUFFER, this.j), t.bindFramebuffer(t.FRAMEBUFFER, null), t.bindRenderbuffer(t.RENDERBUFFER, null);
212
+ this.W = t.createRenderbuffer(), t.bindRenderbuffer(t.RENDERBUFFER, this.W), t.renderbufferStorage(t.RENDERBUFFER, t.DEPTH_COMPONENT24, this.N, this.X), t.bindFramebuffer(t.FRAMEBUFFER, this.Y), t.framebufferRenderbuffer(t.FRAMEBUFFER, t.DEPTH_ATTACHMENT, t.RENDERBUFFER, this.W), t.bindFramebuffer(t.FRAMEBUFFER, null), t.bindRenderbuffer(t.RENDERBUFFER, null);
213
213
  }
214
214
  et(t) {
215
- Rt(this.A, this.W[0], t);
215
+ Rt(this.A, this.j[0], t);
216
216
  }
217
217
  resize(t, e) {
218
218
  this.N = t, this.X = e, this.V.clear();
219
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.W) i.bindTexture(i.TEXTURE_2D, o), i.texImage2D(i.TEXTURE_2D, 0, r, this.N, this.X, 0, h, s, null);
221
- i.bindTexture(i.TEXTURE_2D, null), this.j && (i.bindRenderbuffer(i.RENDERBUFFER, this.j), i.renderbufferStorage(i.RENDERBUFFER, i.DEPTH_COMPONENT24, this.N, this.X), i.bindRenderbuffer(i.RENDERBUFFER, null));
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
+ i.bindTexture(i.TEXTURE_2D, null), this.W && (i.bindRenderbuffer(i.RENDERBUFFER, this.W), 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);
@@ -244,14 +244,14 @@ precision highp float;in vec2 v_uv;uniform sampler2D U1;uniform sampler2D U2;uni
244
244
  }
245
245
  ft() {
246
246
  if (!this.Z) return;
247
- const t = this.K > 1, e = this.K > 2, i = this.K > 3, s = { U1: this.W[0], U2: t ? this.W[1] : this.W[0], U3: e ? this.W[2] : this.W[0], U4: i ? this.W[3] : this.W[0], U5: [this.N, this.X], U6: t, U7: e, U8: i }, r = X.J;
247
+ const t = this.K > 1, e = this.K > 2, i = this.K > 3, s = { U5: this.j[0], U6: t ? this.j[1] : this.j[0], U7: e ? this.j[2] : this.j[0], U8: i ? this.j[3] : this.j[0], U9: [this.N, this.X], Ua: t, Ub: e, Uc: i }, r = O.J;
248
248
  this.q = this.Z.vt.dt(r, s, !0);
249
249
  }
250
250
  gt() {
251
251
  const t = this.A;
252
252
  t.deleteFramebuffer(this.Y);
253
- for (const e of this.W) t.deleteTexture(e);
254
- this.j && t.deleteRenderbuffer(this.j);
253
+ for (const e of this.j) t.deleteTexture(e);
254
+ this.W && t.deleteRenderbuffer(this.W);
255
255
  }
256
256
  get width() {
257
257
  return this.N;
@@ -260,20 +260,20 @@ precision highp float;in vec2 v_uv;uniform sampler2D U1;uniform sampler2D U2;uni
260
260
  return this.X;
261
261
  }
262
262
  get textures() {
263
- return this.W;
263
+ return this.j;
264
264
  }
265
265
  get attachmentCount() {
266
266
  return this.K;
267
267
  }
268
268
  };
269
- a(X, "J", null);
270
- let W = X;
271
- const Pt = /* @__PURE__ */ new WeakMap();
269
+ a(O, "J", null);
270
+ let j = O;
271
+ const Ct = /* @__PURE__ */ new WeakMap();
272
272
  function nt(n, t) {
273
- Pt.set(n, t);
273
+ Ct.set(n, t);
274
274
  }
275
- function Ct(n) {
276
- return Pt.get(n);
275
+ function Pt(n) {
276
+ return Ct.get(n);
277
277
  }
278
278
  function tt(n, t, e, i, s = 255) {
279
279
  n[0] = t / 255, n[1] = (e ?? t) / 255, n[2] = (i ?? t) / 255, n[3] = s / 255;
@@ -283,8 +283,8 @@ class st {
283
283
  a(this, "_t", 1);
284
284
  a(this, "yt", 0);
285
285
  a(this, "At", 0);
286
- a(this, "wt", 0);
287
286
  a(this, "bt", 0);
287
+ a(this, "wt", 0);
288
288
  a(this, "Ct", 0);
289
289
  a(this, "xt", 0);
290
290
  a(this, "Mt", [0, 0, 0]);
@@ -300,33 +300,33 @@ class st {
300
300
  a(this, "Dt", []);
301
301
  }
302
302
  static Lt() {
303
- return { Ot: 1, It: 0, Bt: 0, Ht: 0, bt: 0, Ct: 0, xt: 0, Et: 0, Gt: !1, Qt: !1, Rt: !1, kt: !1, Nt: [0, 0, 0], Xt: [1, 1, 1, 1], Yt: [0, 0, 0, 1] };
304
- }
305
- Wt(t) {
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.$t, t.Qt = this.Tt, t.Rt = this.Rt, t.Et = this.Et, t.kt = this.kt, 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.Pt[0], t.Yt[1] = this.Pt[1], t.Yt[2] = this.Pt[2], t.Yt[3] = this.Pt[3];
303
+ return { Ot: 1, It: 0, Bt: 0, Ht: 0, wt: 0, Ct: 0, xt: 0, Et: 0, Gt: !1, Qt: !1, Rt: !1, kt: !1, Nt: [0, 0, 0], Xt: [1, 1, 1, 1], Yt: [0, 0, 0, 1] };
307
304
  }
308
305
  jt(t) {
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.$t = t.Gt, this.Tt = t.Qt, this.Rt = t.Rt, this.Et = t.Et, this.kt = t.kt, 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.Pt[0] = t.Yt[0], this.Pt[1] = t.Yt[1], this.Pt[2] = t.Yt[2], this.Pt[3] = t.Yt[3];
306
+ t.Ot = this._t, t.It = this.yt, t.Bt = this.At, t.Ht = this.bt, t.wt = this.wt, t.Ct = this.Ct, t.xt = this.xt, t.Gt = this.$t, t.Qt = this.Tt, t.Rt = this.Rt, t.Et = this.Et, t.kt = this.kt, 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.Pt[0], t.Yt[1] = this.Pt[1], t.Yt[2] = this.Pt[2], t.Yt[3] = this.Pt[3];
307
+ }
308
+ Wt(t) {
309
+ this._t = t.Ot, this.yt = t.It, this.At = t.Bt, this.bt = t.Ht, this.wt = t.wt, this.Ct = t.Ct, this.xt = t.xt, this.$t = t.Gt, this.Tt = t.Qt, this.Rt = t.Rt, this.Et = t.Et, this.kt = t.kt, 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.Pt[0] = t.Yt[0], this.Pt[1] = t.Yt[1], this.Pt[2] = t.Yt[2], this.Pt[3] = t.Yt[3];
310
310
  }
311
311
  ht() {
312
312
  let t = this.Dt.pop();
313
- t || (t = st.Lt()), this.Wt(t), this.zt.push(t);
313
+ t || (t = st.Lt()), this.jt(t), this.zt.push(t);
314
314
  }
315
315
  ot() {
316
316
  const t = this.zt.pop();
317
- t ? (this.jt(t), this.Dt.push(t)) : console.warn("pop() called without matching push()");
317
+ t ? (this.Wt(t), this.Dt.push(t)) : console.warn("pop() called without matching push()");
318
318
  }
319
319
  Kt(t) {
320
- this.Wt(t);
320
+ this.jt(t);
321
321
  }
322
322
  Zt(t) {
323
323
  this._t = Math.abs(t);
324
324
  }
325
325
  qt() {
326
- this.yt = 0, this.At = 0, this.wt = 0, this.bt = 0, this.Ct = 0, this.xt = 0, this.kt = !1;
326
+ this.yt = 0, this.At = 0, this.bt = 0, this.wt = 0, this.Ct = 0, this.xt = 0, this.kt = !1;
327
327
  }
328
328
  Vt(t) {
329
- t !== 0 && (this.bt += t * Math.PI / 180);
329
+ t !== 0 && (this.wt += t * Math.PI / 180);
330
330
  }
331
331
  Jt(t) {
332
332
  t !== 0 && (this.Ct += t * Math.PI / 180);
@@ -335,7 +335,7 @@ class st {
335
335
  t !== 0 && (this.xt += t * Math.PI / 180);
336
336
  }
337
337
  ss(t = 0, e = 0, i = 0) {
338
- t === 0 && e === 0 && i === 0 || (this.yt += t, this.At += e, this.wt += i);
338
+ t === 0 && e === 0 && i === 0 || (this.yt += t, this.At += e, this.bt += i);
339
339
  }
340
340
  es(t) {
341
341
  this.ss(t, 0, 0);
@@ -380,7 +380,7 @@ class st {
380
380
  return this.kt;
381
381
  }
382
382
  get rotationX() {
383
- return this.bt;
383
+ return this.wt;
384
384
  }
385
385
  get rotationY() {
386
386
  return this.Ct;
@@ -389,7 +389,7 @@ class st {
389
389
  return this.xt;
390
390
  }
391
391
  }
392
- const ft = new Float32Array([-0.5, -0.5, 0, 0, 0.5, -0.5, 1, 0, -0.5, 0.5, 0, 1, -0.5, 0.5, 0, 1, 0.5, -0.5, 1, 0, 0.5, 0.5, 1, 1]), Y = { _s: 16, As: WebGL2RenderingContext.TRIANGLES, ws: { bs: { size: 2, offset: 0 }, Cs: { size: 2, offset: 8 } } };
392
+ const ft = new Float32Array([-0.5, -0.5, 0, 0, 0.5, -0.5, 1, 0, -0.5, 0.5, 0, 1, -0.5, 0.5, 0, 1, 0.5, -0.5, 1, 0, 0.5, 0.5, 1, 1]), Y = { _s: 16, As: WebGL2RenderingContext.TRIANGLES, bs: { ws: { size: 2, offset: 0 }, Cs: { size: 2, offset: 8 } } };
393
393
  class $t {
394
394
  constructor(t) {
395
395
  a(this, "A");
@@ -398,10 +398,10 @@ class $t {
398
398
  this.A = t, this.Ms = t.createBuffer(), this.Fs = new Float32Array(ft.length);
399
399
  }
400
400
  Ps(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 = ft, m = this.Fs;
401
+ const r = this.A, h = Pt(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 = ft, m = this.Fs;
402
402
  for (let v = 0; v < g.length; v += 4) {
403
- const A = g[v], p = g[v + 1], y = g[v + 2], E = g[v + 3], x = l + (A + 0.5) * (u - l), b = f + (p + 0.5) * (d - f);
404
- m[v] = x, m[v + 1] = b, m[v + 2] = y, m[v + 3] = E;
403
+ const A = g[v], p = g[v + 1], y = g[v + 2], E = g[v + 3], b = l + (A + 0.5) * (u - l), x = f + (p + 0.5) * (d - f);
404
+ m[v] = b, m[v + 1] = x, m[v + 2] = y, m[v + 3] = E;
405
405
  }
406
406
  r.bindBuffer(r.ARRAY_BUFFER, this.Ms), r.bufferData(r.ARRAY_BUFFER, m, 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
  }
@@ -425,9 +425,9 @@ class ee {
425
425
  if (!o) {
426
426
  o = r.createVertexArray(), h.set(e, o), r.bindVertexArray(o), r.bindBuffer(r.ARRAY_BUFFER, s);
427
427
  const c = r.getAttribLocation(t, "A0");
428
- c !== -1 && ut(r, c, i.ws.bs.size, i._s, i.ws.bs.offset, 0, r.FLOAT, !1);
428
+ c !== -1 && ut(r, c, i.bs.ws.size, i._s, i.bs.ws.offset, 0, r.FLOAT, !1);
429
429
  const l = r.getAttribLocation(t, "A1");
430
- l !== -1 && ut(r, l, i.ws.Cs.size, i._s, i.ws.Cs.offset, 0, r.FLOAT, !1);
430
+ l !== -1 && ut(r, l, i.bs.Cs.size, i._s, i.bs.Cs.offset, 0, r.FLOAT, !1);
431
431
  }
432
432
  r.bindVertexArray(o);
433
433
  }
@@ -438,11 +438,11 @@ class ee {
438
438
  for (const [, t] of this.$s) 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 Es(t, e, i = 0) {
443
- const s = e || new Float32Array(D.FLOATS_PER_INSTANCE);
443
+ const s = e || new Float32Array(_.FLOATS_PER_INSTANCE);
444
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.ks[0], s[r++] = t.ks[1], s[r++] = t.ks[2], s[r++] = t.Et;
445
+ s[r++] = t.ws[0], s[r++] = t.ws[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.ks[0], s[r++] = t.ks[1], s[r++] = t.ks[2], s[r++] = t.Et;
446
446
  const h = t.zs;
447
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;
@@ -451,36 +451,36 @@ const D = class D {
451
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, s = e || new Float32Array(i);
454
+ const i = t.length * _.FLOATS_PER_INSTANCE, s = e || new Float32Array(i);
455
455
  for (let r = 0; r < t.length; r++) {
456
- const h = r * D.FLOATS_PER_INSTANCE;
457
- D.Es(t[r], s, h);
456
+ const h = r * _.FLOATS_PER_INSTANCE;
457
+ _.Es(t[r], s, h);
458
458
  }
459
459
  return s;
460
460
  }
461
461
  };
462
- a(D, "BYTES_PER_INSTANCE", 144), a(D, "FLOATS_PER_INSTANCE", 36);
463
- let L = D;
464
- const C = class C {
462
+ a(_, "BYTES_PER_INSTANCE", 144), a(_, "FLOATS_PER_INSTANCE", 36);
463
+ let D = _;
464
+ const P = class P {
465
465
  };
466
- a(C, "STRIDE", L.BYTES_PER_INSTANCE), a(C, "ATTRIBUTES", { A2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 0, divisor: 1 }, A3: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 8, divisor: 1 }, A4: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 16, divisor: 1 }, A5: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 28, divisor: 1 }, A6: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 44, divisor: 1 }, A7: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 60, divisor: 1 }, A8: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 76, divisor: 1 }, A9: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 88, divisor: 1 }, Aa: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 100, divisor: 1 }, Ab: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 116, divisor: 1 }, Ac: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: C.STRIDE, offset: 132, divisor: 1 } });
467
- let k = C;
466
+ a(P, "STRIDE", D.BYTES_PER_INSTANCE), a(P, "ATTRIBUTES", { A2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 0, divisor: 1 }, A3: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 8, divisor: 1 }, A4: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 16, divisor: 1 }, A5: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 28, divisor: 1 }, A6: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 44, divisor: 1 }, A7: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 60, divisor: 1 }, A8: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 76, divisor: 1 }, A9: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 88, divisor: 1 }, Aa: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 100, divisor: 1 }, Ab: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 116, divisor: 1 }, Ac: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 132, divisor: 1 } });
467
+ let k = P;
468
468
  class ie {
469
469
  constructor(t = 1e3, e = 1.5) {
470
470
  a(this, "Ys");
471
- a(this, "Ws");
472
471
  a(this, "js");
472
+ a(this, "Ws");
473
473
  a(this, "Ks", 0);
474
474
  a(this, "Zs", 0);
475
- this.Ws = t, this.js = e;
476
- const i = t * L.FLOATS_PER_INSTANCE;
475
+ this.js = t, this.Ws = e;
476
+ const i = t * D.FLOATS_PER_INSTANCE;
477
477
  this.Ys = new Float32Array(i);
478
478
  }
479
479
  qs(t) {
480
- if (t <= this.Ws) return;
481
- const e = Math.ceil(t * this.js), i = this.Ws;
482
- this.Ws = e;
483
- const s = e * L.FLOATS_PER_INSTANCE, r = new Float32Array(s), h = i * L.FLOATS_PER_INSTANCE;
480
+ if (t <= this.js) return;
481
+ const e = Math.ceil(t * this.Ws), i = this.js;
482
+ this.js = e;
483
+ const s = e * D.FLOATS_PER_INSTANCE, r = new Float32Array(s), h = i * D.FLOATS_PER_INSTANCE;
484
484
  r.set(this.Ys.subarray(0, Math.min(h, this.Ks))), this.Ys = r;
485
485
  }
486
486
  Vs() {
@@ -499,7 +499,7 @@ class ie {
499
499
  return this.Zs;
500
500
  }
501
501
  get ei() {
502
- return this.Ws;
502
+ return this.js;
503
503
  }
504
504
  get ri() {
505
505
  return this.Ks;
@@ -518,7 +518,7 @@ class se {
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
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(L.FLOATS_PER_INSTANCE), this.Ys.ii - 1;
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(D.FLOATS_PER_INSTANCE), this.Ys.ii - 1;
522
522
  }
523
523
  get ii() {
524
524
  return this.Ys.ii;
@@ -535,7 +535,7 @@ class re {
535
535
  li(t) {
536
536
  const e = this.A;
537
537
  this.oi && e.deleteBuffer(this.oi), this.oi = e.createBuffer();
538
- const i = t * L.BYTES_PER_INSTANCE;
538
+ const i = t * D.BYTES_PER_INSTANCE;
539
539
  Ft(e, e.ARRAY_BUFFER, this.oi, i, e.DYNAMIC_DRAW), this.ai = t;
540
540
  }
541
541
  ui(t) {
@@ -548,7 +548,7 @@ class re {
548
548
  if (e === 0) return;
549
549
  const i = this.A;
550
550
  i.bindBuffer(i.ARRAY_BUFFER, this.oi);
551
- const s = e * L.FLOATS_PER_INSTANCE;
551
+ const s = e * D.FLOATS_PER_INSTANCE;
552
552
  i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, s);
553
553
  }
554
554
  di(t) {
@@ -591,7 +591,7 @@ class ne {
591
591
  yi(t) {
592
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.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.hi({ 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.ks[0], flipX: t.ks[1], flipY: t.ks[2], charRot: t.Et, translationX: ((c = t.zs) == null ? void 0 : c[0]) ?? 0, translationY: ((l = t.zs) == null ? void 0 : l[1]) ?? 0, translationZ: ((u = t.zs) == 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.hi({ x: t.ws[0], y: t.ws[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.ks[0], flipX: t.ks[1], flipY: t.ks[2], charRot: t.Et, translationX: ((c = t.zs) == null ? void 0 : c[0]) ?? 0, translationY: ((l = t.zs) == null ? void 0 : l[1]) ?? 0, translationZ: ((u = t.zs) == 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
  hi(t) {
597
597
  const e = this.mi.hi(t);
@@ -603,7 +603,7 @@ class ne {
603
603
  get ni() {
604
604
  return this.Ys.ni;
605
605
  }
606
- wi() {
606
+ bi() {
607
607
  this.Ys.ti();
608
608
  }
609
609
  pi(t) {
@@ -623,14 +623,14 @@ class ne {
623
623
  this._i.gt();
624
624
  }
625
625
  }
626
- class _ {
626
+ class X {
627
627
  constructor(t, e, i, s) {
628
628
  a(this, "A");
629
- a(this, "bi");
629
+ a(this, "wi");
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 = s;
633
+ this.A = t, this.wi = e, this.Ci = i, this.xi = s;
634
634
  const r = this.A.createBuffer();
635
635
  Ft(this.A, this.A.ARRAY_BUFFER, r, this.xi.Fi, this.A.STATIC_DRAW), this.Mi = r;
636
636
  }
@@ -644,25 +644,25 @@ class _ {
644
644
  return this.Mi;
645
645
  }
646
646
  get batch() {
647
- return this.bi;
647
+ return this.wi;
648
648
  }
649
649
  Pi() {
650
- this.bi.wi();
650
+ this.wi.bi();
651
651
  }
652
652
  $i() {
653
- return !this.bi.ni;
653
+ return !this.wi.ni;
654
654
  }
655
655
  gt() {
656
- this.bi.gt(), this.A.deleteBuffer(this.Mi);
656
+ this.wi.gt(), this.A.deleteBuffer(this.Mi);
657
657
  }
658
658
  Ti(t, e, i) {
659
- return this.bi.yi(t);
659
+ return this.wi.yi(t);
660
660
  }
661
661
  Ri(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], m = [0, 0, 0, 0];
662
+ const o = r.It ?? 0, c = r.Bt ?? 0, l = r.Ht ?? 0, u = r.wt ?? 0, f = r.Ct ?? 0, d = r.xt ?? 0, g = [0, 0, 0, 0], m = [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, m[0] = h.bezStartX ?? 0, m[1] = h.bezStartY ?? 0, m[2] = h.bezEndX ?? 0, m[3] = h.bezEndY ?? 0) : h.arcStart === void 0 && h.arcStop === void 0 || (g[0] = h.arcStart ?? 0, g[1] = h.arcStop ?? 0));
664
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.Rt ? 1 : 0, flipX: r.Gt ? 1 : 0, flipY: r.Qt ? 1 : 0, charRot: r.Et, translationX: o, translationY: c, translationZ: l, rotationX: u, rotationY: f, rotationZ: d, curveParams0: g, curveParams1: m, depth: (h == null ? void 0 : h.depth) ?? 0, baseZ: (h == null ? void 0 : h.baseZ) ?? 0, geometryType: te[this.Ci] ?? 0 };
665
- return this.bi.hi(v);
665
+ return this.wi.hi(v);
666
666
  }
667
667
  }
668
668
  const he = { Fi: ft, Ei: 6, ...Y }, oe = { 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]), Ei: 6, ...Y }, ae = { Fi: function(n = 32) {
@@ -688,14 +688,14 @@ const le = { Fi: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ei:
688
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), Ei: 96, ...Y }, fe = { [w.RECTANGLE]: class extends _ {
691
+ }(16), Ei: 96, ...Y }, fe = { [w.RECTANGLE]: class extends X {
692
692
  constructor(n, t) {
693
693
  super(n, t, w.RECTANGLE, he);
694
694
  }
695
695
  yi(n, t) {
696
696
  return this.Ri(0, 0, n.width, n.height, t);
697
697
  }
698
- }, [w.LINE]: class extends _ {
698
+ }, [w.LINE]: class extends X {
699
699
  constructor(n, t) {
700
700
  super(n, t, w.LINE, oe);
701
701
  }
@@ -703,14 +703,14 @@ const le = { Fi: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ei:
703
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
704
  return this.Ri(o, c, s, h, l);
705
705
  }
706
- }, [w.ELLIPSE]: class extends _ {
706
+ }, [w.ELLIPSE]: class extends X {
707
707
  constructor(n, t) {
708
708
  super(n, t, w.ELLIPSE, ae);
709
709
  }
710
710
  yi(n, t) {
711
711
  return this.Ri(0, 0, n.width, n.height, t);
712
712
  }
713
- }, [w.ARC]: class extends _ {
713
+ }, [w.ARC]: class extends X {
714
714
  constructor(n, t) {
715
715
  super(n, t, w.ARC, ce);
716
716
  }
@@ -718,7 +718,7 @@ const le = { Fi: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ei:
718
718
  const e = n.start * Math.PI / 180, i = n.stop * Math.PI / 180;
719
719
  return this.Ri(0, 0, n.width, n.height, t, { arcStart: e, arcStop: i });
720
720
  }
721
- }, [w.TRIANGLE]: class extends _ {
721
+ }, [w.TRIANGLE]: class extends X {
722
722
  constructor(n, t) {
723
723
  super(n, t, w.TRIANGLE, le);
724
724
  }
@@ -726,7 +726,7 @@ const le = { Fi: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ei:
726
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
727
  return this.Ri(e, s, r, h, t);
728
728
  }
729
- }, [w.BEZIER_CURVE]: class extends _ {
729
+ }, [w.BEZIER_CURVE]: class extends X {
730
730
  constructor(n, t) {
731
731
  super(n, t, w.BEZIER_CURVE, ue);
732
732
  }
@@ -758,8 +758,8 @@ class de {
758
758
  Li(t) {
759
759
  const { material: e, type: i, commands: s } = t, r = this.Si.get(i);
760
760
  e.shader.D(), e.shader.O(e.uniforms);
761
- const h = Ct(this.A), o = s.length > 0 && s[0].state.kt;
762
- e.shader.O({ Uz: h[2] / h[3], U9: [h[2], h[3]], Ua: 1, Ub: o ? 1 : 0 }), r.Pi();
761
+ const h = Pt(this.A), o = s.length > 0 && s[0].state.kt;
762
+ e.shader.O({ Uv: h[2] / h[3], Us: [h[2], h[3]], Ut: 1, Uu: o ? 1 : 0 }), r.Pi();
763
763
  for (const c of s) r.yi(c.params, c.state);
764
764
  if (r.$i()) {
765
765
  const c = r.unitGeometry, l = r.unitBuffer;
@@ -783,7 +783,7 @@ function Mt(n) {
783
783
  }
784
784
  const yt = /* @__PURE__ */ new WeakMap();
785
785
  let ge = 1;
786
- function bt(n) {
786
+ function xt(n) {
787
787
  if (n == null) return 0;
788
788
  if (typeof n != "object" && typeof n != "function") return Mt(n + "");
789
789
  let t = yt.get(n);
@@ -814,7 +814,7 @@ precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellCo
814
814
  return { id: this.Oi++, shader: t, uniforms: Object.freeze({ ...e }), hash: 0, isBuiltIn: !1 };
815
815
  }
816
816
  Gi(t, e) {
817
- const i = bt(t.G), s = function(r, h) {
817
+ const i = xt(t.G), s = function(r, h) {
818
818
  let o = 0;
819
819
  const c = Object.keys(r).sort();
820
820
  for (const l of c) o = G(o, Mt(l)), o = G(o, h(r[l]));
@@ -835,7 +835,7 @@ precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellCo
835
835
  const s = Math.min(e.length, 16);
836
836
  for (let r = 0; r < s; r++) i = G(i, e[r]);
837
837
  return i;
838
- }(t) : t instanceof WebGLTexture ? bt(t) : 0;
838
+ }(t) : t instanceof WebGLTexture ? xt(t) : 0;
839
839
  }
840
840
  gt() {
841
841
  this.Ii != this.Ii && this.Ii.dispose(), this.Ii.dispose(), this.Hi.clear();
@@ -844,42 +844,42 @@ precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellCo
844
844
  class me {
845
845
  constructor() {
846
846
  a(this, "Yi", []);
847
- a(this, "Wi", 1);
847
+ a(this, "ji", 1);
848
848
  a(this, "Ss", 0);
849
849
  }
850
- ji(t, e) {
850
+ Wi(t, e) {
851
851
  if (this.Ss >= this.Yi.length) {
852
- const s = { id: this.Wi++, type: t, params: {}, state: st.Lt(), material: e };
852
+ const s = { id: this.ji++, type: t, params: {}, state: st.Lt(), material: e };
853
853
  this.Yi.push(s);
854
854
  }
855
855
  const i = this.Yi[this.Ss];
856
- return i.id = this.Wi++, i.type = t, i.material = e, this.Ss++, i;
856
+ return i.id = this.ji++, i.type = t, i.material = e, this.Ss++, i;
857
857
  }
858
858
  Ki(t, e, i) {
859
- const s = this.ji(w.RECTANGLE, i), r = s.params;
859
+ const s = this.Wi(w.RECTANGLE, i), r = s.params;
860
860
  return r.width = t.width, r.height = t.height, e.Kt(s.state), s.id;
861
861
  }
862
862
  Zi(t, e, i) {
863
- const s = this.ji(w.LINE, i), r = s.params;
863
+ const s = this.Wi(w.LINE, i), r = s.params;
864
864
  return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, e.Kt(s.state), s.id;
865
865
  }
866
866
  qi(t, e, i) {
867
- const s = this.ji(w.ELLIPSE, i), r = s.params;
867
+ const s = this.Wi(w.ELLIPSE, i), r = s.params;
868
868
  return r.width = t.width, r.height = t.height, r.startAngle = t.startAngle, r.endAngle = t.endAngle, r.segments = t.segments, e.Kt(s.state), s.id;
869
869
  }
870
870
  Vi(t, e, i) {
871
- const s = this.ji(w.ARC, i), r = s.params;
871
+ const s = this.Wi(w.ARC, i), r = s.params;
872
872
  return r.width = t.width, r.height = t.height, r.start = t.start, r.stop = t.stop, e.Kt(s.state), s.id;
873
873
  }
874
874
  Ji(t, e, i) {
875
- const s = this.ji(w.TRIANGLE, i), r = s.params;
875
+ const s = this.Wi(w.TRIANGLE, i), r = s.params;
876
876
  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.Kt(s.state), s.id;
877
877
  }
878
878
  te(t, e, i) {
879
- const s = this.ji(w.BEZIER_CURVE, i), r = s.params;
879
+ const s = this.Wi(w.BEZIER_CURVE, i), r = s.params;
880
880
  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.Kt(s.state), s.id;
881
881
  }
882
- wi() {
882
+ bi() {
883
883
  this.Ss = 0;
884
884
  }
885
885
  [Symbol.iterator]() {
@@ -946,13 +946,13 @@ class pe {
946
946
  Ae(t, e, i, s) {
947
947
  this.ne.Ps(t, e, i, s);
948
948
  }
949
- we(t, e) {
949
+ be(t, e) {
950
950
  if (this.he) {
951
951
  const i = this.vt.Ni(this.he, this.oe);
952
952
  this.re.Ki({ width: t, height: e }, this.ee, i), this.he = null, this.oe = {};
953
953
  } else this.re.Ki({ width: t, height: e }, this.ee, this.vt.Qi);
954
954
  }
955
- be(t, e, i, s) {
955
+ we(t, e, i, s) {
956
956
  this.re.Zi({ x1: t, y1: e, x2: i, y2: s }, this.ee, this.vt.Qi);
957
957
  }
958
958
  Ce(t, e) {
@@ -968,14 +968,14 @@ class pe {
968
968
  this.re.Vi({ width: t, height: e, start: i, stop: s }, this.ee, this.vt.Qi);
969
969
  }
970
970
  Pe(t, e, i = 1, s = {}) {
971
- return new W(this.A, t, e, i, s, this);
971
+ return new j(this.A, t, e, i, s, this);
972
972
  }
973
973
  $e(t, e = t, i = t, s = 255) {
974
974
  this.ee.ps(t, e ?? t, i ?? t, s);
975
975
  const [r, h, o, c] = this.ee.canvasBackgroundColor;
976
976
  this.Te(r, h, o, c, !1);
977
977
  }
978
- wi(t = 0, e = 0, i = 0, s = 0) {
978
+ bi(t = 0, e = 0, i = 0, s = 0) {
979
979
  this.Te(t, e, i, s, !0);
980
980
  }
981
981
  Te(t, e, i, s, r) {
@@ -992,7 +992,7 @@ class pe {
992
992
  }
993
993
  ct() {
994
994
  const t = this.re;
995
- this.ie.zi(t), t.wi(), this.se = null;
995
+ this.ie.zi(t), t.bi(), this.se = null;
996
996
  }
997
997
  gt() {
998
998
  this.vt.gt(), this.ie.gt(), this.ne.gt();
@@ -1022,13 +1022,13 @@ const R = { readShort: (n, t) => (R.t.uint16[0] = n[t] << 8 | n[t + 1], R.t.int1
1022
1022
  const n = new ArrayBuffer(8);
1023
1023
  return { uint8: new Uint8Array(n), int16: new Int16Array(n), uint16: new Uint16Array(n), uint32: new Uint32Array(n) };
1024
1024
  })() };
1025
- function V(n) {
1025
+ function q(n) {
1026
1026
  return n + 3 & -4;
1027
1027
  }
1028
1028
  function J(n, t, e) {
1029
1029
  n[t] = e >>> 8 & 255, n[t + 1] = 255 & e;
1030
1030
  }
1031
- function N(n, t, e) {
1031
+ function L(n, t, e) {
1032
1032
  n[t] = e >>> 24 & 255, n[t + 1] = e >>> 16 & 255, n[t + 2] = e >>> 8 & 255, n[t + 3] = 255 & e;
1033
1033
  }
1034
1034
  function Ae(n, t, e) {
@@ -1064,7 +1064,7 @@ class Ee {
1064
1064
  return this.p;
1065
1065
  }
1066
1066
  }
1067
- function Q(n) {
1067
+ function V(n) {
1068
1068
  let t = 32, e = 0;
1069
1069
  for (const o of n) o && (o < t && (t = o), o > e && (e = o));
1070
1070
  if (e === 0) return { min: 0, max: 0, table: /* @__PURE__ */ new Map() };
@@ -1101,7 +1101,7 @@ function ye(n, t) {
1101
1101
  for (let i = 0; i < t; i++) e = e << 1 | 1 & n, n >>>= 1;
1102
1102
  return e >>> 0;
1103
1103
  }
1104
- function be(n) {
1104
+ function xe(n) {
1105
1105
  if (n.length < 2) throw Error("ZLIB data too short");
1106
1106
  const t = n[0], e = n[1];
1107
1107
  if ((15 & t) != 8) throw Error("Unsupported ZLIB compression method");
@@ -1130,30 +1130,30 @@ function be(n) {
1130
1130
  for (let A = 144; A <= 255; A++) v[A] = 9;
1131
1131
  for (let A = 256; A <= 279; A++) v[A] = 7;
1132
1132
  for (let A = 280; A <= 287; A++) v[A] = 8;
1133
- g = Q(v), m = Q(Array(32).fill(5));
1133
+ g = V(v), m = V(Array(32).fill(5));
1134
1134
  } else {
1135
1135
  const v = r.readBits(5) + 257, A = r.readBits(5) + 1, p = r.readBits(4) + 4, y = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], E = Array(19).fill(0);
1136
1136
  for (let T = 0; T < p; T++) E[y[T]] = r.readBits(3);
1137
- const x = Q(E), b = [];
1138
- for (; b.length < v + A; ) {
1139
- const T = ot(r, x);
1140
- if (T <= 15) b.push(T);
1137
+ const b = V(E), x = [];
1138
+ for (; x.length < v + A; ) {
1139
+ const T = ot(r, b);
1140
+ if (T <= 15) x.push(T);
1141
1141
  else if (T === 16) {
1142
- const Z = r.readBits(2) + 3, P = b[b.length - 1] || 0;
1143
- for (let j = 0; j < Z; j++) b.push(P);
1142
+ const S = r.readBits(2) + 3, C = x[x.length - 1] || 0;
1143
+ for (let Q = 0; Q < S; Q++) x.push(C);
1144
1144
  } else if (T === 17) {
1145
- const Z = r.readBits(3) + 3;
1146
- for (let P = 0; P < Z; P++) b.push(0);
1145
+ const S = r.readBits(3) + 3;
1146
+ for (let C = 0; C < S; C++) x.push(0);
1147
1147
  } else {
1148
1148
  if (T !== 18) throw Error("Invalid code length symbol");
1149
1149
  {
1150
- const Z = r.readBits(7) + 11;
1151
- for (let P = 0; P < Z; P++) b.push(0);
1150
+ const S = r.readBits(7) + 11;
1151
+ for (let C = 0; C < S; C++) x.push(0);
1152
1152
  }
1153
1153
  }
1154
1154
  }
1155
- const F = b.slice(0, v), U = b.slice(v, v + A);
1156
- g = Q(F), m = Q(U);
1155
+ const F = x.slice(0, v), N = x.slice(v, v + A);
1156
+ g = V(F), m = V(N);
1157
1157
  }
1158
1158
  for (; ; ) {
1159
1159
  const v = ot(r, g);
@@ -1167,12 +1167,12 @@ function be(n) {
1167
1167
  y && (p += r.readBits(y));
1168
1168
  const E = ot(r, m);
1169
1169
  if (E >= 30) throw Error("Invalid distance symbol");
1170
- let x = l[E];
1171
- const b = u[E];
1172
- b && (x += r.readBits(b));
1173
- const F = h.length - x;
1170
+ let b = l[E];
1171
+ const x = u[E];
1172
+ x && (b += r.readBits(x));
1173
+ const F = h.length - b;
1174
1174
  if (F < 0) throw Error("Invalid distance");
1175
- for (let U = 0; U < p; U++) h.push(h[F + U] || 0);
1175
+ for (let N = 0; N < p; N++) h.push(h[F + N] || 0);
1176
1176
  } else if (v === 286 || v === 287) throw Error("Reserved length symbol");
1177
1177
  }
1178
1178
  }
@@ -1187,13 +1187,13 @@ function we(n) {
1187
1187
  const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), h = [];
1188
1188
  let o = 44;
1189
1189
  for (let p = 0; p < s; p++) {
1190
- const y = t.readASCII(e, o, 4), E = t.readUint(e, o + 4), x = t.readUint(e, o + 8), b = t.readUint(e, o + 12), F = t.readUint(e, o + 16);
1191
- h.push({ tag: y, offset: E, compLength: x, origLength: b, checksum: F }), o += 20;
1190
+ const y = t.readASCII(e, o, 4), E = t.readUint(e, o + 4), b = t.readUint(e, o + 8), x = t.readUint(e, o + 12), F = t.readUint(e, o + 16);
1191
+ h.push({ tag: y, offset: E, compLength: b, origLength: x, checksum: F }), o += 20;
1192
1192
  }
1193
1193
  for (const p of h) {
1194
1194
  const y = new Uint8Array(e.buffer, p.offset, p.compLength);
1195
1195
  if (p.compLength === p.origLength) p.data = new Uint8Array(y);
1196
- else if (p.data = be(y), p.data.length !== p.origLength) if (p.data.length < p.origLength) {
1196
+ else if (p.data = xe(y), p.data.length !== p.origLength) if (p.data.length < p.origLength) {
1197
1197
  const E = new Uint8Array(p.origLength);
1198
1198
  E.set(p.data), p.data = E;
1199
1199
  } else p.data = p.data.subarray(0, p.origLength);
@@ -1204,36 +1204,36 @@ function we(n) {
1204
1204
  const f = 16 * l, d = 16 * c - f;
1205
1205
  let g = 12 + 16 * c;
1206
1206
  const m = {};
1207
- for (const p of h) m[p.tag] = g, g = V(g + p.data.length);
1207
+ for (const p of h) m[p.tag] = g, g = q(g + p.data.length);
1208
1208
  const v = new Uint8Array(Math.max(r || 0, g));
1209
- N(v, 0, i), J(v, 4, c), J(v, 6, f), J(v, 8, u), J(v, 10, d);
1209
+ L(v, 0, i), J(v, 4, c), J(v, 6, f), J(v, 8, u), J(v, 10, d);
1210
1210
  let A = 12;
1211
1211
  for (const p of h) {
1212
1212
  Ae(v, A, p.tag), A += 4;
1213
1213
  let y = p.data;
1214
1214
  if (p.tag === "head" && y.length >= 12) {
1215
1215
  const E = new Uint8Array(y);
1216
- N(E, 8, 0), N(v, A, ht(E, 0, V(E.length))), A += 4;
1216
+ L(E, 8, 0), L(v, A, ht(E, 0, q(E.length))), A += 4;
1217
1217
  } else
1218
- N(v, A, ht(y, 0, V(y.length))), A += 4;
1219
- N(v, A, m[p.tag]), A += 4, N(v, A, p.data.length), A += 4;
1218
+ L(v, A, ht(y, 0, q(y.length))), A += 4;
1219
+ L(v, A, m[p.tag]), A += 4, L(v, A, p.data.length), A += 4;
1220
1220
  }
1221
1221
  for (const p of h) {
1222
1222
  const y = m[p.tag];
1223
1223
  v.set(p.data, y);
1224
1224
  }
1225
1225
  if (h.find((p) => p.tag === "head")) {
1226
- const p = m.head, y = function(E, x) {
1227
- const b = x + 8, F = [E[b], E[b + 1], E[b + 2], E[b + 3]];
1228
- N(E, b, 0);
1229
- const U = 2981146554 - (ht(E, 0, V(E.length)) >>> 0) >>> 0;
1230
- return E[b] = F[0], E[b + 1] = F[1], E[b + 2] = F[2], E[b + 3] = F[3], U >>> 0;
1226
+ const p = m.head, y = function(E, b) {
1227
+ const x = b + 8, F = [E[x], E[x + 1], E[x + 2], E[x + 3]];
1228
+ L(E, x, 0);
1229
+ const N = 2981146554 - (ht(E, 0, q(E.length)) >>> 0) >>> 0;
1230
+ return E[x] = F[0], E[x + 1] = F[1], E[x + 2] = F[2], E[x + 3] = F[3], N >>> 0;
1231
1231
  }(v, p);
1232
- N(v, p + 8, y);
1232
+ L(v, p + 8, y);
1233
1233
  }
1234
1234
  return v.buffer;
1235
1235
  }
1236
- const xe = { parseTab(n, t, e) {
1236
+ const be = { parseTab(n, t, e) {
1237
1237
  const i = { tables: [], ids: {}, off: t };
1238
1238
  n = new Uint8Array(n.buffer, t, e), t = 0;
1239
1239
  const s = R, r = s.readUshort, h = r(n, t += 2);
@@ -1298,7 +1298,7 @@ const xe = { parseTab(n, t, e) {
1298
1298
  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++;
1299
1299
  for (; f < o; ) r.push(l), h.push(u), f++;
1300
1300
  return { aWidth: r, lsBearing: h };
1301
- } }, wt = { cmap: xe, head: Te, hhea: Re, maxp: { parseTab(n, t, e) {
1301
+ } }, wt = { cmap: be, head: Te, hhea: Re, maxp: { parseTab(n, t, e) {
1302
1302
  const i = R;
1303
1303
  return i.readUint(n, t), t += 4, { numGlyphs: i.readUshort(n, t) };
1304
1304
  } }, hmtx: Fe, loca: { parseTab(n, t, e, i) {
@@ -1313,7 +1313,7 @@ const xe = { parseTab(n, t, e) {
1313
1313
  }, Ee(n, t) {
1314
1314
  const e = R, i = n.Se, s = n.loca;
1315
1315
  if (s[t] === s[t + 1]) return null;
1316
- const r = q.findTable(i, "glyf", n.ke);
1316
+ const r = W.findTable(i, "glyf", n.ke);
1317
1317
  if (!r) return null;
1318
1318
  let h = r[0] + s[t];
1319
1319
  const o = {};
@@ -1348,12 +1348,12 @@ const xe = { parseTab(n, t, e) {
1348
1348
  for (let d = 0; d < l; d++) u += o.xs[d], f += o.ys[d], o.xs[d] = u, o.ys[d] = f;
1349
1349
  } else o.parts = [], o.endPts = [], o.flags = [], o.xs = [], o.ys = [];
1350
1350
  return o;
1351
- } } }, q = { parse(n) {
1351
+ } } }, W = { parse(n) {
1352
1352
  const t = new Uint8Array(n);
1353
1353
  R.readASCII(t, 0, 4) === "wOFF" && (n = we(n));
1354
1354
  const e = new Uint8Array(n), i = wt, s = {}, r = { Se: e, ze: 0, ke: 0 };
1355
1355
  for (const h in i) {
1356
- const o = h, c = q.findTable(e, o, 0);
1356
+ const o = h, c = W.findTable(e, o, 0);
1357
1357
  if (c) {
1358
1358
  const [l, u] = c;
1359
1359
  let f = s[l];
@@ -1373,7 +1373,7 @@ const xe = { parseTab(n, t, e) {
1373
1373
  }
1374
1374
  return null;
1375
1375
  }, T: wt, B: R };
1376
- class Pe {
1376
+ class Ce {
1377
1377
  De(t) {
1378
1378
  var i;
1379
1379
  const e = [];
@@ -1429,7 +1429,7 @@ class Pe {
1429
1429
  return 0;
1430
1430
  }
1431
1431
  }
1432
- class Ce {
1432
+ class Pe {
1433
1433
  constructor(t) {
1434
1434
  a(this, "Be");
1435
1435
  a(this, "He");
@@ -1477,8 +1477,8 @@ class Ce {
1477
1477
  const y = e + r[l] * s, E = i - h[l] * s;
1478
1478
  if (1 & c[l]) this.He.quadraticCurveTo(v, A, y, E);
1479
1479
  else {
1480
- const x = (v + y) / 2, b = (A + E) / 2;
1481
- this.He.quadraticCurveTo(v, A, x, b);
1480
+ const b = (v + y) / 2, x = (A + E) / 2;
1481
+ this.He.quadraticCurveTo(v, A, b, x);
1482
1482
  }
1483
1483
  break;
1484
1484
  }
@@ -1499,12 +1499,12 @@ class Ce {
1499
1499
  this.He.fill();
1500
1500
  }
1501
1501
  }
1502
- class Ut {
1502
+ class Nt {
1503
1503
  Ye(t, e) {
1504
1504
  const i = t.cmap;
1505
1505
  if (!i || !i.tables) return 0;
1506
1506
  let s = 0;
1507
- for (const r of i.tables) if (r.format === 4 ? s = this.We(e, r) : r.format === 12 && (s = this.je(e, r)), s > 0) break;
1507
+ for (const r of i.tables) if (r.format === 4 ? s = this.je(e, r) : r.format === 12 && (s = this.We(e, r)), s > 0) break;
1508
1508
  return s;
1509
1509
  }
1510
1510
  Ke(t, e) {
@@ -1519,7 +1519,7 @@ class Ut {
1519
1519
  const i = e / t.head.unitsPerEm, s = t.hhea.ascender * i, r = t.hhea.descender * i, h = t.hhea.lineGap * i;
1520
1520
  return { ascender: s, descender: r, lineGap: h, lineHeight: s - r + h, unitsPerEm: t.head.unitsPerEm, scale: i };
1521
1521
  }
1522
- We(t, e) {
1522
+ je(t, e) {
1523
1523
  const i = e.endCount.length;
1524
1524
  let s = -1;
1525
1525
  for (let r = 0; r < i; r++) if (t <= e.endCount[r]) {
@@ -1537,7 +1537,7 @@ class Ut {
1537
1537
  }
1538
1538
  return 0;
1539
1539
  }
1540
- je(t, e) {
1540
+ We(t, e) {
1541
1541
  const i = e.groups.length / 3;
1542
1542
  for (let s = 0; s < i; s++) {
1543
1543
  const r = e.groups[3 * s], h = e.groups[3 * s + 1], o = e.groups[3 * s + 2];
@@ -1549,7 +1549,7 @@ class Ut {
1549
1549
  class Me {
1550
1550
  constructor() {
1551
1551
  a(this, "Ve");
1552
- this.Ve = new Ut();
1552
+ this.Ve = new Nt();
1553
1553
  }
1554
1554
  Je(t, e, i) {
1555
1555
  let s = 0;
@@ -1563,10 +1563,10 @@ class Me {
1563
1563
  return { width: Math.ceil(s), height: Math.ceil(h) };
1564
1564
  }
1565
1565
  }
1566
- class Ue {
1566
+ class Ne {
1567
1567
  constructor() {
1568
1568
  a(this, "tr");
1569
- this.tr = new Ut();
1569
+ this.tr = new Nt();
1570
1570
  }
1571
1571
  sr(t, e) {
1572
1572
  const i = [], s = /* @__PURE__ */ new Map();
@@ -1583,7 +1583,7 @@ class Ue {
1583
1583
  if (s === 0) return null;
1584
1584
  let r = 0;
1585
1585
  t.hmtx && t.hmtx.aWidth && s > 0 && t.hmtx.aWidth[s] !== void 0 && (r = t.hmtx.aWidth[s]);
1586
- const h = q.T.glyf.Ee(t, s);
1586
+ const h = W.T.glyf.Ee(t, s);
1587
1587
  return h ? { ...h, advanceWidth: r } : null;
1588
1588
  }
1589
1589
  }
@@ -1602,19 +1602,19 @@ class mt {
1602
1602
  a(this, "gr");
1603
1603
  a(this, "mr");
1604
1604
  a(this, "_r");
1605
- this.cr = e, this.pr = new Pe(), this.gr = new Ce(t), this.mr = new Me(), this._r = new Ue();
1605
+ this.cr = e, this.pr = new Ce(), this.gr = new Pe(t), this.mr = new Me(), this._r = new Ne();
1606
1606
  }
1607
1607
  async yr(t) {
1608
1608
  let e;
1609
1609
  if (t) {
1610
1610
  const i = await fetch(t);
1611
- if (!i.ok) throw new S(`Failed to load font file: ${i.status} ${i.statusText}`);
1611
+ if (!i.ok) throw new U(`Failed to load font file: ${i.status} ${i.statusText}`);
1612
1612
  e = await i.arrayBuffer();
1613
1613
  } else
1614
1614
  e = await (await fetch("data:font/woff;base64,d09GRgABAAAAABbwAAoAAAAAfywAAQABAAAAAAAAAAAAAAAAAAAAAAAAAABjbWFwAAAA9AAAAbsAAAkgIO8lSWdseWYAAAKwAAAOfgAAaLS4ctN0aGVhZAAAETAAAAAsAAAAOCi8/PVoaGVhAAARXAAAABkAAAAkCwEFAmhtdHgAABF4AAAAhQAABAQEAIOAbG9jYQAAEgAAAAKUAAAECAAy54BtYXhwAAAUlAAAABgAAAAgASIAgm5hbWUAABSsAAAB5wAAA6RWz85KT1MvMgAAFpQAAABFAAAAYM+QEyRwb3N0AAAW3AAAABQAAAAgAGkANHja7dRPSFRRFMfx38wdXblw4cJC7M0bz60gWlULGUFctWgR0UIQQkmDyn27kpAQaaEO2jhWJuafiQFtcDJtSqGhiFZtot5x3jzEVQQhlRJcOb0khiRc1+J94R64uw8cOADCAJT/avwZAiIpRCK3/P999KAS9biOSUxhBhlksYjnWMFrvME7vMca1vEF37ANAwkNqYRKqkk1rdLqscqpVVVQryzbils3rJnocHTWPmgfso/ap+0OuysWjlXHogQKUxVVUw3VUh010DE6QXHqph7qpT66TQmaoAxlaZnyVKC39FHHdbNu0e36or6kr4r4TgsTu75HmEcOy76vUPaVsIFNbOHHX74F3/fyD9+A7ztg1//2de76rH18Z8u+AXqwx/dBN5Z9XfqKiKzLqqzIC8nLkixKThZkXuZkVh7KuNyTuzImKRmVO1KxU7ETMtvmu/lqPptPxjOuKXo3vcveYQ+l2lKlO+Im3H632z3vnis+KaaLKc7zM87yHGc4zdM8zkke5H6+xp3cwRe4jVv5DLdwE5/ik3ycj3Cdk3eWnKfOmDPqJJ3hX9sOCvpPC65QcIWCgv5pPwGY9ak7AHja3V07ryQ5FT62axjQaDWsVmiCFQJpA4QINiAgICDYgICAgICAgICAgICAgIAA//AuF9Xlsn2etqv67iIY6apv3+6yj31e33nYA95FiD4uAAHeA7jyLzoA2Paf/Lp/Dun5W8x/Be/AxyCfO79fnj+e25/ZZzlewcM+3wIhwpfwE/Sc9e8YDyLU1ycF5XUD+to+L98O/An8VKQj0lnOtYdM776OJ71fTVC8//N1rLKDGsXl863OjSl5/iyIUu0HjJ+d+uO3rX3rXd33d/DjfR0/h6/n1iK5kWf36Hf2AxpVa6zU7ZLTnt3Q3wN7+tK6MVcBjUP/3vj56diHuT3YxVbKSvl9FdJHeFE4jfmJn2DSSOS9fuJ27SH7umuoL3oLWGOLxh3f2b8bnn/5Ql8n5SEYFD33q/0lKXxwjQfDOZtGgyEz+W8X5txl2zVb9MXO2S8HfD3ncbHousP6WPV2i/R7C+c06HK5ye/lfdl3Bj5Q2qitaLYhgLQWZY+fr/65A9Ly1r10jI783HOffJWZJ6ee8uuB0nmMXeSqWvRz5Dx/tiWf7H0OF+1DuK7vhy4ffP8An/doofqbQNXTqmlNT1c0v4/Eqpy29eBMLHty0PKZoCMW6VqRlDXNwvbD4RW2MYfyjNdXV3LaJuEdKgXcHvX2nHiz27RxHmC9w/qn0AbS+mJbSeX8pO1zlbbogPK7zJxAs3iFtrV8W/LHsHVZvxJ6Rlt7gum1nvjpnHNO4gFJqaoBWOKFVwKqAangorb2j5KKvG5N31O1ownZdhcZH7FuT9nznoxRv4ylrbfvzA9D88GO8uGDtgN0/1O09ntFlv3YhbIf/ml3/dPGqvi6rCMw6jNd53PM07BnK2eCJXmnzxrruI8ObOuxmZ/dxbd5nS77U7I/xaMdLm5/DXzuLLcwXlOLIVQ0an722pou6raGnpp/QYiwR0V5nwDL0Gk/f2TSUalIGOkSvfNAcVNCesV9a2q675FtsVAk4c5GPEfZT27XVqT9PmpxXtVn0577KO3MGrkXs+xKkHZk6EMUS440uO01t+Ark8yGYYjtsleqoPQksLuF0kOd/7TtbZ3XvNalNRNLqK+90fEDTAfy1FWWOBcT9fkTmrExe+viDNccYF+JqHeIbyBtlYxhStbmSc8DSX9/rICoXkkGSMfEJR7QsYAjNlhgn6iNS7T0AtakNnvaJ+W1TeQdeIxHaHtXaMtU+GP3CL5v+2RqHfc5JC6k9DJ6HhFaHHfu9Lc1Z5HlB5JWNOc8NupiUSlpa/7NIx0W0Ra10YcOVWnDfqhodmgI1CM5nrJS1DYKlMmyeAmoZaLrQnmNSRxAV7qZ0u0sr2Q8WbzUrRivE200nZ+x371Yj+idQH+bsOAFD16woZXuheBJI85UYyA+Ht17bJsTKLHHG+tuQpJX/AGX4eu2lq+vh8gQPgaLUpk1h7fcb1SJ4LEnGb+rdUHRHw96riVV36L5EgdqHNByqCTy82hnkrSSk3k5KTNWnJZ/buTlOvQngiceAkd4OHPz0K+tdOmGUYwJht2kcuBEntSRPOmZfyc40tFqD40IQeb2goGZvKIVzW4G5DMcQ4qOY3zVRzpmo1sMg+U1VemumtLofjFeCcxqJIUnM2vJuQeCHiOOwx4ss7pF6u+PtXxmZApbjCti22JtA+hVxUw7z6Xs2sSzMkeklSLPfwalYkjjt/0bHye4gKkXeaig5MpILVRiAd1vCrtP5Aj5uaN2PF1zxrE7koOgaY2PPL9FkccCKlprUZGr+zr0tw56iCvwGBTs+MFFxVbWeTaCQTj2WCBM1NnoWNxOBpBZU8f00hPsFDr+15wPevNsJG4IN+OGwKyWzKnW8S/GDUHZOd+44SsvbDvCuhYUTQSaQSFeWtoR4Xc833VimVzRvgm58QwZFQTthQ+awgQTeuVI7gLrF638Yixi+ot4RVZ5niDPFxBediyXNj++jUWDgkU3Zc96fDKwv4iiylyA4nalMkLX9C1hf24DNNkZyNDkflOPF4BqwdYbv1vLG9VX03W96PVKiCq+A01i5utY2d9YfSMP0qvQ7eFQUHSKvNfpCl21nqNafqf1UQksqfVe1PEPPNiJpY81iZoP119ZTUHojdpseMYqec5zr/2Jgo695rmycZWzSgOpXzMpbFrHu1Zmq/xA8pX3cgEQZU1/YzaexuQbXIoxF9THdaEzz9VaE5fgNVIPR/sIS8fQyipam9JXqHdOtPEIRllqzP7Ewh9063Z2IYH+GiLNUPFXJIcEM4RYc7bEkjwQL4/1fx+aHL8/62Of5vo3y+p92QX2fh18zrNFcPX9sfZAdBDZu8vxCM4clX31Qr9RrLPkDDDau8v8LZRar2N8lSOj1NGsLJeBZam1TIuwpzwepL3CJAvyANsPnj3BAzsD3a5X6ydEaZUSs50b7g2JrYcyG2lRL+xl+jD+Gfod33w82P0FTuYREa3c70CRS82XCtxIueJHXuIMB6tMt+x7lf7m5U4tyK9L3smuLrxqDxYPI30rYzk2h2NzgPXqAvPrQdqUxvdWF2zVwDrHCq0RoI0Hcrzcn9D8BMxYEMszZBzooqa/jsTxSeTthXTm9FC2n+pYEh8uVqyL9436quMD6pnK7njZM6msy4uYsunVquBSi4clVn8gblYc96TFyF04ll2oqCB300cDIbPxrZoqXZ1DHWvNh2irrNxstSaZYa2VB333tOr9mRcx7ETmXKmSFz6GkidstKjZFE8qIX26eG8KoS/b9uij9GFOiwFIVj5NyErT8rZGstdmD4lc4/xaNevd1uwOPCLX7Ems2TTc81MrUVmzyqdOr1v1PCPat9jmQfUYJEEbzNCSse4DevSYCIXal+bDCC3I2+EeTFKd7ltnFNN0sGLIfRcGfSWKD0BPANWTQIqcNtsaAON/1A/BeywPGhybs2ZEA1sH9FbgDMpTQx5L5k4fN/RR8lBHvif2ftB7oa8isVdrdWDxp/Hp6N8MsdUgqdS0M12EZrhC7TpJZZLZOZelRdeDUyffq3s6xPhztK4Xd9h6f4pIieNu4lI/jEN1XEMjbafK6lry/jkOYedyVMyp2vaHGlM8zBjCkdi28NdrNldgLa/a0orYtN6OwoMh7vPAsxb9eNTDrOdJBWuXsb6En8Evb5yTrJw1Y1XTHnmCFNtPkhHnuN+8QwHGi3JUJf4zeaTJsBpFdnik5V4fZq510ifEHMf7M55f2fteR1DJ73gzf4vyO42Or3Z5mZcWdlY6wb3sRvd0olKfGeaCWm5yGEtDwzLH6yPS95wmcVb2BBrYzig5tGb7Bvb5fkyfvW2nRhlxF3cyz8qGOF//eVLXq7P4oQTop9UASTKPr91h1zu5wu753DbqtXUO8pOT6wzdnQfWn2X3Csr5ktxP4FUmlBHHPThBO0mQ6wTFVxbM5mPCeXWP7ha4YDf8BdvAeaGd/XntlgHlW2eMFAR2CBPYAQzPrGeVy1ieYCOQdtpXGZyss4F2rkr5W8tJh06NTd/HGi+1vbiPN6JTeSfP5k0ihAhRQwgad9wQ1dhoKAntU87DfZy/K8SuEsPg82VQRU5xUGU+ZVrp8SMYtOHiwFC+Z1jLG2dqRuhAw01cZ2qeXBk/ROjaAS1TIuKHVp+Fi5YMrHqqahlY3YbJ0E/N2uUTq/0Cvt717Vfwa/gNfAO/hd/B7+EP8Ef4E/wZ/gJ/hb/B3+Ef8E/4F/z7nla+5T+Afp1wHdQRH/F/+/lF6VrSbuP4v/18VHMVmm7q6TX/Czha0mxJrf+YyNyOfRcYeKSap3+b8UufB8GnJSdec6Iu+toF6nHkaeZxvJ5h4PVgj3ILMz5teArdxnr8/PPoCXqiuvR91zoh2pvS8b0SqUD1FLPubHPaK9Q5lU+GzwI3PgfCOsB9NORgqm5OqfVxLMd1L9+A/s2s+0/0a93MTd3NNRHapruGQLnhZTSzpBMuYFNaz7N5RffPo/MnV2zac3wfRX6Vng0As1cTmE5M38U0eS+H0rvZxXtg6460jlQTZ3Snxw+pO9TKz+mOB5vffTs6umGj+UjMb3/QKfndvlP47UsVAO9Drzo11h+T/rF09Po0st98jHsKh31Ruj2UnbYWLuEd/pM9wOwpZ+KqccfWNZsc4F6c3jtf2ou7Ca6akqXRPThzsadua+/4hq7vgmn6uqux6bXw6AjnLMJbXMM5Ixwi8mR2rc3AOfg2nrs4zZlnDFaChbCtk/bwilwMfBxc0iMYy0MX40x2o/ft9D2Znn9Kl+3MO90HUb747jnzjpyCKVeTuij6DllsctyiUzXN0dgE9We1yK54WBffFqtew9TXpbYfy7dILWH/SXxmqeg4zlvRsZfIbuFnic0SHfRtfj4vsaVq532jl/QpYBykzpe/jec7n1uOmhuETi2xzM5vfy01xQC0vkp6PiKpDd07x6qcUc719K0A1YZjpvLivftqNpzxV/tDtXPTWFrbaowzXj+czsG+nmMt/bQspzj7fnvxeeuG4O/s/Xe412VW3+5VuPT+EV97/r++14Gc3ZvQRHrXMz91IrWHZ4FnK7WOVGjJPfAO3R0BczdLKuevQd5LPVsXd/X8PK6Ll2jK0/NM7P4V1PuI51FvsEMV+KhV4T2+22IQF85a0FlLWXs/IHTOX1B5CGCeEDh6V2ZiTK+eee/dnNjOa2xXz2zndd7sq+XYEZ/Gx/exoK5PoOceWNdnef9W9KCT9EYXqkrPxuhC9GA7faMXpHef1smLTDe1qaDY1N4ozLI4fqsHlwpf+3Cu9F1E/Z4AajG3V8430/6bCdq8QQs9b4OqJyQa1+6BACWaTPI8zrROa//7QGJ19U4tHeTTtePNqu3PnVhXJFSjzZFz4eo3Ndqidi/O6J5Z7X+VsS3cYki51T35Iv+merFeuGe69cbJM3Jq1Fn4kUA5rze4o9CRs22iy5jMsYLMS8g5/wOjbDW/AAB42mNgZGBgAOIzT9tXxvPbfGVgYGEAgZokCXVkmgUizsHABFLNwAAACJYG1HjaY2BkYGBhAAEIyc7AwMiAAhgZAQHPABQAAAB42r1TwRaAIAgD88P59PRA0hxUlw578mBDQOwi0i+oDUzb7nC/xyKH8SuwHH/jSx83jnE745c1RO44G9E1WTE14AQtYvKO6PN6BXRW5EONgCazSS4VXiere+sp7F7cQeSp7Pe2YkaxN7fVFhg/8z/1hfnfaBXnZ8k7wNzp/y13+wRWwErCAAAAeNpl0ylUVVEUBuCtoiKgoiIzAjIIMj9mZBZYMsmMjwcuBhEIBoPBYDAYDAaDwWA0GAwGgsFgMBgMBoPBYDAYDAaDweBnlrX+9e6955x/2oeI//664HbEgTL4HnHwZ8Sh1/AlIm0W3kUc3oN9+BFxJBva4E3E0SvwLCIdR/qniGO98Coiw3vG04hMv5n/fj9GZBUD3iz8xx9FnMiBJxEn0+E+/IrIppNt/VQzvITfEadH4HnEmUG4BV8jchaBn7NZgCMXdy7uXGfzeMjjKZ/PfBwF9hTYU/AhotC5QtpFtIt4K7oLnyOK6RXTKP4TUcJDCe5zNXAHcJTiKOWxlEZZPeAo00U5b+XyltM9vw24KvBWyFzpTOWLiCr5qu6BPdV0qx+Cni+sAc4a3mvw1nqu/RZxsRJkrEsDWeo2wAzq8dY/iGgwpwbfGvTdaA6NOmnUb5PnpiTY00S3SXfN/DU/BustdFrMq8VagqcE/YReEjK3+t4qayuPbTTbdNH2PqJdL+06a5e33VoHjg7vHdY7cXTK2ekedPHWha+b5279ddPo1ndPPuDrkbkH3yX5e/XXy3OvzH34+sy132+//P14B/AO6GuA3qBOB3U6hH/It2Haw2Y2rI9hHV6WdcSsR6eAl1GZx3Qwpr9xcxv3PqGDCbyTvE3KM+muT+lwypkpe6bNaZqfaX6v8j7D8wyNGbwzbyNmdTMrzxxfc9bndDFn5vM8zds37x4smMeCHhf5WTKHJb0uuc/L/C7bs4zrGr2kO5m0ntRZkv8VfazIkvI9RSelg5ReUrKvOrvqHq7p4Lr5retx3fcN/5Mb+Dfs25RpE/8mji0etqzfwLHteZufmzrZobfj/K5ednna0/fe/l+Pca7seNpjYGRgYGRkaGBQYAABJgY0AAAP+ACmeNp1ksFO20AQhv8NgRJaUApSy61LDxVc4uAjNxoJReoNKdCrYy8hZb1rrTcIuPMKfaY+QM899RH6AP3tDJEKqlcefzvzz/xrywD21ScoLK9N3ktW5E3hDl6hL7zG7HvhLrMfhNfxGonwBjUnwj2uz8JbzH4R3sZbPArvIMV34T28wQ+6qG6Puz5+Civyb+EOO/4Ir6GvOsJdaLUrvI53KhXeoGYs3MOu+iq8hai+CW/jo/olvIOiA+E97HeKw/xIp8M0nYQ6O/MunpvZwmbhafv01JK/MKGee6ePB8N/JCFzN6dO+8o4bee5cbnRM+NMyKyuFqHytdHR3MXSF0ZfNQOn93rVORoNm4l64ua3NMjsdYxVfZIkeTBZZC73ZeldPfBhllSLKR0KX2ZzlzyY4BO2JmNjrdeXPtjiAIfIcQTNbz/knWKCgBoZzuDhEHEOgxkWsMyFF9Xne/1Mf8Fdo5i3dY1jDOjz/ymB0eEGp63ao2J/Q5YT8pabqOnQsGn1lvuKjoHRc05Tj4x3jCUzRZu5Wp1winvGl54jruHqjI3C0fVW3qDxuWZ/pEvNPzjhylkxrETR5fQoW09HzYDPwJMm7emm8g5Fq8nIjpWHdronLV0TjJmxXJ4nuGwnWPYcAH8BoeumrAB42mNgYmFgnMDAysDCxMDEAAIQGoiNGc6A+CwMENDAwNDNwFDwGMpliHT00WNwYFBQy4aogJCMgSCSGcJTYGAAAEBYBpIAAAB42mNgZoCANAZjIMnIgAYADecAng==")).arrayBuffer();
1615
- await this.Ar(e), this.rr = q.parse(e)[0], await this.wr();
1615
+ await this.Ar(e), this.rr = W.parse(e)[0], await this.br();
1616
1616
  }
1617
- br(t) {
1617
+ wr(t) {
1618
1618
  if (t === void 0) return this.cr;
1619
1619
  this.cr = t, this.dr = this.mr.Je(this.nr.map((i) => i.character), this.cr, this.rr);
1620
1620
  const e = this.gr.Ge(this.nr, this.dr, this.cr, this.rr);
@@ -1623,21 +1623,21 @@ class mt {
1623
1623
  async Cr(t) {
1624
1624
  try {
1625
1625
  const e = await fetch(t);
1626
- if (!e.ok) throw new S(`Failed to load font file: ${e.status} ${e.statusText}`);
1626
+ if (!e.ok) throw new U(`Failed to load font file: ${e.status} ${e.statusText}`);
1627
1627
  const i = await e.arrayBuffer();
1628
1628
  await this.Ar(i);
1629
- const s = q.parse(i);
1629
+ const s = W.parse(i);
1630
1630
  if (!s || s.length === 0) throw Error("Failed to parse font file");
1631
- this.rr = s[0], await this.wr();
1631
+ this.rr = s[0], await this.br();
1632
1632
  } catch (e) {
1633
- throw new S("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
1633
+ throw new U("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
1634
1634
  }
1635
1635
  }
1636
1636
  async Ar(t) {
1637
1637
  const e = Date.now();
1638
1638
  this.vr = new FontFace("CustomFont_" + e, t), await this.vr.load(), document.fonts.add(this.vr);
1639
1639
  }
1640
- async wr() {
1640
+ async br() {
1641
1641
  const t = this.pr.De(this.rr), { array: e, map: i } = this._r.sr(t, this.rr);
1642
1642
  this.nr = e, this.hr = i, this.dr = this.mr.Je(t, this.cr, this.rr);
1643
1643
  const s = this.gr.Ge(this.nr, this.dr, this.cr, this.rr);
@@ -1681,7 +1681,7 @@ class mt {
1681
1681
  return this.rr;
1682
1682
  }
1683
1683
  }
1684
- class St {
1684
+ class Ut {
1685
1685
  constructor(t, e, i) {
1686
1686
  a(this, "Pr");
1687
1687
  a(this, "$r");
@@ -1725,17 +1725,17 @@ class St {
1725
1725
  return this.Rr;
1726
1726
  }
1727
1727
  }
1728
- const Se = /^rgba?\(([^)]+)\)$/i;
1728
+ const Ue = /^rgba?\(([^)]+)\)$/i;
1729
1729
  function at(n) {
1730
1730
  return Number.isNaN(n) ? 0 : Math.max(0, Math.min(255, n));
1731
1731
  }
1732
- function Ze(n) {
1732
+ function Se(n) {
1733
1733
  if (!n) return null;
1734
1734
  const t = n.trim().toLowerCase();
1735
1735
  if (!t) return null;
1736
1736
  let e = null;
1737
1737
  return t.startsWith("rgb") && (e = function(i) {
1738
- const s = Se.exec(i.trim());
1738
+ const s = Ue.exec(i.trim());
1739
1739
  if (!s) return null;
1740
1740
  const r = s[1].split(",").map((u) => u.trim());
1741
1741
  if (r.length < 3) return null;
@@ -1743,7 +1743,7 @@ function Ze(n) {
1743
1743
  return [h, o, c, Math.round(l)];
1744
1744
  }(t)), e ? e[3] === 0 ? null : e : null;
1745
1745
  }
1746
- class Le {
1746
+ class De {
1747
1747
  constructor(t = {}) {
1748
1748
  a(this, "Er");
1749
1749
  a(this, "Dr", null);
@@ -1781,7 +1781,7 @@ class Le {
1781
1781
  const t = this.Qr();
1782
1782
  for (const e of t) {
1783
1783
  if (!e) continue;
1784
- const i = Ze(window.getComputedStyle(e).backgroundColor);
1784
+ const i = Se(window.getComputedStyle(e).backgroundColor);
1785
1785
  if (i) return i;
1786
1786
  }
1787
1787
  return [255, 255, 255, 255];
@@ -1803,7 +1803,7 @@ class Le {
1803
1803
  }
1804
1804
  Yr() {
1805
1805
  const t = this.Er.getContext("webgl2", { alpha: !0, premultipliedAlpha: !1, preserveDrawingBuffer: !0, antialias: !1, depth: !0, stencil: !1, powerPreference: "high-performance" });
1806
- if (!t) throw new S("`textmode.js` requires WebGL2 support.");
1806
+ if (!t) throw new U("`textmode.js` requires WebGL2 support.");
1807
1807
  return t;
1808
1808
  }
1809
1809
  gt() {
@@ -1828,17 +1828,17 @@ class Le {
1828
1828
  }
1829
1829
  }
1830
1830
  function $(n) {
1831
- return B(parseInt(n, 16), 0, 255);
1831
+ return Z(parseInt(n, 16), 0, 255);
1832
1832
  }
1833
1833
  class M {
1834
1834
  constructor(t, e, i, s) {
1835
- a(this, "Wr");
1836
1835
  a(this, "jr");
1836
+ a(this, "Wr");
1837
1837
  a(this, "r");
1838
1838
  a(this, "g");
1839
1839
  a(this, "b");
1840
1840
  a(this, "a");
1841
- this.r = B(t, 0, 255), this.g = B(e, 0, 255), this.b = B(i, 0, 255), this.a = B(s, 0, 255), this.Wr = [this.r, this.g, this.b, this.a], this.jr = [this.r / 255, this.g / 255, this.b / 255, this.a / 255];
1841
+ this.r = Z(t, 0, 255), this.g = Z(e, 0, 255), this.b = Z(i, 0, 255), this.a = Z(s, 0, 255), this.jr = [this.r, this.g, this.b, this.a], this.Wr = [this.r / 255, this.g / 255, this.b / 255, this.a / 255];
1842
1842
  }
1843
1843
  static Kr(t, e, i, s) {
1844
1844
  if (M.Zr(t)) return t;
@@ -1873,10 +1873,10 @@ class M {
1873
1873
  return [this.r, this.g, this.b];
1874
1874
  }
1875
1875
  get rgba() {
1876
- return [...this.Wr];
1876
+ return [...this.jr];
1877
1877
  }
1878
1878
  get normalized() {
1879
- return [...this.jr];
1879
+ return [...this.Wr];
1880
1880
  }
1881
1881
  withAlpha(t) {
1882
1882
  return new M(this.r, this.g, this.b, t);
@@ -1886,16 +1886,16 @@ class M {
1886
1886
  }
1887
1887
  }
1888
1888
  const pt = /* @__PURE__ */ new Map();
1889
- function Ne(n) {
1889
+ function Le(n) {
1890
1890
  pt.set(n.id, n);
1891
1891
  }
1892
1892
  function $e(n) {
1893
1893
  pt.delete(n);
1894
1894
  }
1895
- function De(n) {
1895
+ function _e(n) {
1896
1896
  return pt.get(n);
1897
1897
  }
1898
- class Zt {
1898
+ class St {
1899
1899
  constructor(t, e, i, s, r, h, o, c) {
1900
1900
  a(this, "A");
1901
1901
  a(this, "Z");
@@ -2000,7 +2000,7 @@ class Zt {
2000
2000
  }
2001
2001
  ft() {
2002
2002
  this.yn();
2003
- const t = this.An(), e = this.wn(), i = t.createShader(e), s = t.createUniforms(e);
2003
+ const t = this.An(), e = this.bn(), i = t.createShader(e), s = t.createUniforms(e);
2004
2004
  this.q = this.Z.materialManager.Ni(i, s);
2005
2005
  }
2006
2006
  gn(t, e, i, s, r) {
@@ -2013,19 +2013,19 @@ class Zt {
2013
2013
  }
2014
2014
  createBaseConversionUniforms() {
2015
2015
  const t = this.vn > 0;
2016
- return { u_image: this.bn(), u_invert: !!this.Rt, u_flipX: !!this.Gt, u_flipY: !!this.Qt, u_charRotation: this.Et, u_charColorFixed: this.hn === "fixed", u_charColor: this.Xt, u_cellColorFixed: this.an === "fixed", u_cellColor: this.Yt, u_backgroundColor: this.cn, u_charCount: this.ln.length, u_charList: this.ln, u_colorFilterEnabled: t, u_colorFilterSize: t ? this.vn : 0, u_colorFilterPalette: this.dn };
2016
+ return { u_image: this.wn(), u_invert: !!this.Rt, u_flipX: !!this.Gt, u_flipY: !!this.Qt, u_charRotation: this.Et, u_charColorFixed: this.hn === "fixed", u_charColor: this.Xt, u_cellColorFixed: this.an === "fixed", u_cellColor: this.Yt, u_backgroundColor: this.cn, u_charCount: this.ln.length, u_charList: this.ln, u_colorFilterEnabled: t, u_colorFilterSize: t ? this.vn : 0, u_colorFilterPalette: this.dn };
2017
2017
  }
2018
2018
  An() {
2019
2019
  if (this.nn && this.nn.id === this.rn) return this.nn;
2020
- const t = De(this.rn);
2020
+ const t = _e(this.rn);
2021
2021
  if (!t) throw Error(`[textmode.js] Conversion mode "${this.rn}" is not registered. If this mode is provided by an add-on, make sure its plugin is installed before loading sources.`);
2022
2022
  return this.nn = t, t;
2023
2023
  }
2024
- wn() {
2024
+ bn() {
2025
2025
  return { renderer: this.Z, gl: this.A, font: this.rr, source: this, gridWidth: this.N, gridHeight: this.X };
2026
2026
  }
2027
2027
  }
2028
- class I extends Zt {
2028
+ class I extends St {
2029
2029
  constructor(t, e, i, s, r, h, o, c) {
2030
2030
  const l = Math.min(o / r, c / h);
2031
2031
  super(t, e, i, s, r, h, Math.max(1, Math.floor(r * l)), Math.max(1, Math.floor(h * l)));
@@ -2036,24 +2036,24 @@ class I extends Zt {
2036
2036
  const c = i.naturalWidth ?? i.width ?? i.videoWidth ?? 0, l = i.naturalHeight ?? i.height ?? i.videoHeight ?? 0;
2037
2037
  return new I(h, t, o, e, c, l, s, r);
2038
2038
  }
2039
- bn() {
2039
+ wn() {
2040
2040
  return this.tn;
2041
2041
  }
2042
2042
  }
2043
- class Lt {
2043
+ class Dt {
2044
2044
  constructor(t = 60) {
2045
2045
  a(this, "xn");
2046
2046
  a(this, "Mn", null);
2047
2047
  a(this, "Fn", 0);
2048
2048
  a(this, "Pn", !0);
2049
2049
  a(this, "$n", 0);
2050
- a(this, "Un", 0);
2051
- a(this, "Tn", []);
2052
- a(this, "Rn", 10);
2053
- a(this, "En", 0);
2050
+ a(this, "Tn", 0);
2051
+ a(this, "Rn", []);
2052
+ a(this, "En", 10);
2053
+ a(this, "Sn", 0);
2054
2054
  this.xn = 1e3 / t;
2055
2055
  }
2056
- Sn(t) {
2056
+ kn(t) {
2057
2057
  if (!this.Pn) return;
2058
2058
  this.Fn = performance.now();
2059
2059
  const e = (i) => {
@@ -2063,117 +2063,114 @@ class Lt {
2063
2063
  };
2064
2064
  this.Mn = requestAnimationFrame(e);
2065
2065
  }
2066
- kn() {
2066
+ zn() {
2067
2067
  this.Mn && (cancelAnimationFrame(this.Mn), this.Mn = null);
2068
2068
  }
2069
- zn() {
2070
- this.Pn && (this.Pn = !1, this.kn());
2069
+ Dn() {
2070
+ this.Pn && (this.Pn = !1, this.zn());
2071
2071
  }
2072
- Dn(t) {
2073
- this.Pn || (this.Pn = !0, this.Sn(t));
2072
+ Ln(t) {
2073
+ this.Pn || (this.Pn = !0, this.kn(t));
2074
2074
  }
2075
- Ln(t, e) {
2075
+ On(t, e) {
2076
2076
  if (t === void 0) return this.$n;
2077
- this.xn = 1e3 / t, this.Pn && e && (this.kn(), this.Sn(e));
2077
+ this.xn = 1e3 / t, this.Pn && e && (this.zn(), this.kn(e));
2078
2078
  }
2079
- On() {
2079
+ In() {
2080
2080
  const t = performance.now();
2081
- if (this.Un > 0) {
2082
- const e = t - this.Un;
2083
- this.Tn.push(e), this.Tn.length > this.Rn && this.Tn.shift();
2084
- const i = this.Tn.reduce((s, r) => s + r, 0) / this.Tn.length;
2081
+ if (this.Tn > 0) {
2082
+ const e = t - this.Tn;
2083
+ this.Rn.push(e), this.Rn.length > this.En && this.Rn.shift();
2084
+ const i = this.Rn.reduce((s, r) => s + r, 0) / this.Rn.length;
2085
2085
  this.$n = 1e3 / i;
2086
2086
  }
2087
- this.Un = t;
2087
+ this.Tn = t;
2088
2088
  }
2089
- get In() {
2089
+ get Bn() {
2090
2090
  return this.Pn;
2091
2091
  }
2092
- get Bn() {
2092
+ get Hn() {
2093
2093
  return this.$n;
2094
2094
  }
2095
- get Hn() {
2096
- return this.En;
2095
+ get Gn() {
2096
+ return this.Sn;
2097
2097
  }
2098
- set Hn(t) {
2099
- this.En = t;
2098
+ set Gn(t) {
2099
+ this.Sn = t;
2100
2100
  }
2101
- Gn() {
2102
- this.En++;
2101
+ Qn() {
2102
+ this.Sn++;
2103
2103
  }
2104
2104
  }
2105
- class Nt {
2105
+ class Lt {
2106
2106
  constructor(t) {
2107
2107
  a(this, "Er");
2108
- a(this, "Qn");
2109
- a(this, "Nn", { x: -1, y: -1 });
2108
+ a(this, "Nn");
2110
2109
  a(this, "Xn", { x: -1, y: -1 });
2111
- a(this, "Yn", null);
2110
+ a(this, "Yn", { x: -1, y: -1 });
2111
+ a(this, "jn", null);
2112
2112
  a(this, "Wn", 0);
2113
- a(this, "jn");
2114
2113
  a(this, "Kn");
2115
2114
  a(this, "Zn");
2116
2115
  a(this, "qn");
2117
2116
  a(this, "Vn");
2118
2117
  a(this, "Jn");
2119
- a(this, "th", !1);
2120
- a(this, "sh");
2118
+ a(this, "th");
2119
+ a(this, "sh", !1);
2121
2120
  a(this, "ih");
2122
2121
  a(this, "eh");
2123
2122
  a(this, "rh");
2124
2123
  a(this, "nh");
2124
+ a(this, "hh");
2125
2125
  this.Er = t;
2126
2126
  }
2127
- hh(t) {
2127
+ oh(t) {
2128
2128
  const e = performance.now() + Math.max(0, t);
2129
2129
  e > this.Wn && (this.Wn = e);
2130
2130
  }
2131
- oh() {
2131
+ ah() {
2132
2132
  return performance.now() < this.Wn;
2133
2133
  }
2134
- ah(t) {
2134
+ uh(t) {
2135
2135
  const e = this.Er.canvas;
2136
2136
  e.style.cursor = t == null || t === "" ? "" : t;
2137
2137
  }
2138
2138
  yr(t) {
2139
- this.Qn = t, this.uh();
2139
+ this.Nn = t, this.fh();
2140
2140
  }
2141
- fh() {
2142
- if (this.th) return;
2141
+ dh() {
2142
+ if (this.sh) return;
2143
2143
  const t = this.Er.canvas;
2144
- this.jn = (e) => {
2145
- this.dh(e), this.ph(e);
2146
- }, this.Kn = () => {
2147
- this.Xn = { ...this.Nn }, this.Nn.x = -1, this.Nn.y = -1, this.Yn = null;
2148
- }, this.Zn = (e) => {
2149
- this.dh(e), this.gh(e);
2144
+ this.Kn = (e) => {
2145
+ this.ph(e), this.gh(e);
2146
+ }, this.Zn = () => {
2147
+ this.Yn = { ...this.Xn }, this.Xn.x = -1, this.Xn.y = -1, this.jn = null;
2150
2148
  }, this.qn = (e) => {
2151
- this.dh(e), this.mh(e);
2149
+ this.ph(e), this.mh(e);
2152
2150
  }, this.Vn = (e) => {
2153
- this.dh(e), this._h(e);
2151
+ this.ph(e), this._h(e);
2154
2152
  }, this.Jn = (e) => {
2155
- this.dh(e), this.yh(e);
2156
- }, t.addEventListener("mousemove", this.jn, { passive: !0 }), t.addEventListener("mouseleave", this.Kn, { passive: !0 }), t.addEventListener("mousedown", this.Zn, { passive: !0 }), t.addEventListener("mouseup", this.qn, { passive: !0 }), t.addEventListener("click", this.Vn, { passive: !0 }), t.addEventListener("wheel", this.Jn, { passive: !1 }), this.th = !0;
2153
+ this.ph(e), this.yh(e);
2154
+ }, this.th = (e) => {
2155
+ this.ph(e), this.Ah(e);
2156
+ }, t.addEventListener("mousemove", this.Kn, { passive: !0 }), t.addEventListener("mouseleave", this.Zn, { passive: !0 }), t.addEventListener("mousedown", this.qn, { passive: !0 }), t.addEventListener("mouseup", this.Vn, { passive: !0 }), t.addEventListener("click", this.Jn, { passive: !0 }), t.addEventListener("wheel", this.th, { passive: !1 }), this.sh = !0;
2157
2157
  }
2158
- Ah() {
2159
- if (!this.th) return;
2158
+ bh() {
2159
+ if (!this.sh) return;
2160
2160
  const t = this.Er.canvas;
2161
- t.removeEventListener("mousemove", this.jn), t.removeEventListener("mouseleave", this.Kn), t.removeEventListener("mousedown", this.Zn), t.removeEventListener("mouseup", this.qn), t.removeEventListener("click", this.Vn), t.removeEventListener("wheel", this.Jn), this.th = !1;
2162
- }
2163
- uh() {
2164
- if (this.th) try {
2165
- if (this.Yn) {
2166
- const t = new MouseEvent("mousemove", { clientX: this.Yn.x, clientY: this.Yn.y, bubbles: !1, cancelable: !1 });
2167
- this.dh(t);
2168
- } else this.Nn.x !== -1 && this.Nn.y !== -1 && (this.Nn.x >= this.Qn.cols || this.Nn.y >= this.Qn.rows) && (this.Nn.x = -1, this.Nn.y = -1);
2161
+ t.removeEventListener("mousemove", this.Kn), t.removeEventListener("mouseleave", this.Zn), t.removeEventListener("mousedown", this.qn), t.removeEventListener("mouseup", this.Vn), t.removeEventListener("click", this.Jn), t.removeEventListener("wheel", this.th), this.sh = !1;
2162
+ }
2163
+ fh() {
2164
+ if (this.sh) try {
2165
+ if (this.jn) {
2166
+ const t = new MouseEvent("mousemove", { clientX: this.jn.x, clientY: this.jn.y, bubbles: !1, cancelable: !1 });
2167
+ this.ph(t);
2168
+ } else this.Xn.x !== -1 && this.Xn.y !== -1 && (this.Xn.x >= this.Nn.cols || this.Xn.y >= this.Nn.rows) && (this.Xn.x = -1, this.Xn.y = -1);
2169
2169
  } catch {
2170
- this.Nn.x = -1, this.Nn.y = -1;
2170
+ this.Xn.x = -1, this.Xn.y = -1;
2171
2171
  }
2172
2172
  }
2173
2173
  wh(t) {
2174
- this.sh = t;
2175
- }
2176
- bh(t) {
2177
2174
  this.ih = t;
2178
2175
  }
2179
2176
  Ch(t) {
@@ -2185,136 +2182,138 @@ class Nt {
2185
2182
  Mh(t) {
2186
2183
  this.nh = t;
2187
2184
  }
2188
- Fh() {
2189
- return { x: this.Nn.x, y: this.Nn.y };
2185
+ Fh(t) {
2186
+ this.hh = t;
2190
2187
  }
2191
- ph(t) {
2192
- if (this.rh && !this.oh()) {
2193
- const e = { position: { ...this.Nn }, previousPosition: { ...this.Xn }, originalEvent: t };
2194
- this.rh(e);
2195
- }
2188
+ Ph() {
2189
+ return { x: this.Xn.x, y: this.Xn.y };
2196
2190
  }
2197
2191
  gh(t) {
2198
- if (this.ih && !this.oh()) {
2199
- const e = { position: { ...this.Nn }, previousPosition: { ...this.Xn }, button: t.button, originalEvent: t };
2200
- this.ih(e);
2192
+ if (this.nh && !this.ah()) {
2193
+ const e = { position: { ...this.Xn }, previousPosition: { ...this.Yn }, originalEvent: t };
2194
+ this.nh(e);
2201
2195
  }
2202
2196
  }
2203
2197
  mh(t) {
2204
- if (this.eh && !this.oh()) {
2205
- const e = { position: { ...this.Nn }, previousPosition: { ...this.Xn }, button: t.button, originalEvent: t };
2198
+ if (this.eh && !this.ah()) {
2199
+ const e = { position: { ...this.Xn }, previousPosition: { ...this.Yn }, button: t.button, originalEvent: t };
2206
2200
  this.eh(e);
2207
2201
  }
2208
2202
  }
2209
2203
  _h(t) {
2210
- if (this.sh && !this.oh()) {
2211
- const e = { position: { ...this.Nn }, previousPosition: { ...this.Xn }, button: t.button, originalEvent: t };
2212
- this.sh(e);
2204
+ if (this.rh && !this.ah()) {
2205
+ const e = { position: { ...this.Xn }, previousPosition: { ...this.Yn }, button: t.button, originalEvent: t };
2206
+ this.rh(e);
2213
2207
  }
2214
2208
  }
2215
2209
  yh(t) {
2216
- if (this.nh && !this.oh()) {
2217
- const e = { position: { ...this.Nn }, previousPosition: { ...this.Xn }, delta: { x: t.deltaX, y: t.deltaY }, originalEvent: t };
2218
- this.nh(e);
2210
+ if (this.ih && !this.ah()) {
2211
+ const e = { position: { ...this.Xn }, previousPosition: { ...this.Yn }, button: t.button, originalEvent: t };
2212
+ this.ih(e);
2213
+ }
2214
+ }
2215
+ Ah(t) {
2216
+ if (this.hh && !this.ah()) {
2217
+ const e = { position: { ...this.Xn }, previousPosition: { ...this.Yn }, delta: { x: t.deltaX, y: t.deltaY }, originalEvent: t };
2218
+ this.hh(e);
2219
2219
  }
2220
2220
  }
2221
- dh(t) {
2221
+ ph(t) {
2222
2222
  const e = this.Er.canvas;
2223
- this.Xn = { ...this.Nn }, this.Yn = { x: t.clientX, y: t.clientY };
2224
- const i = e.getBoundingClientRect(), s = t.clientX - i.left, r = t.clientY - i.top, h = e.width / i.width, o = r * (e.height / i.height), c = s * h - this.Qn.offsetX, l = o - this.Qn.offsetY, u = Math.floor(c / this.Qn.cellWidth), f = Math.floor(l / this.Qn.cellHeight);
2225
- u >= 0 && u < this.Qn.cols && f >= 0 && f < this.Qn.rows ? (this.Nn.x = u, this.Nn.y = f) : (this.Nn.x = -1, this.Nn.y = -1);
2223
+ this.Yn = { ...this.Xn }, this.jn = { x: t.clientX, y: t.clientY };
2224
+ const i = e.getBoundingClientRect(), s = t.clientX - i.left, r = t.clientY - i.top, h = e.width / i.width, o = r * (e.height / i.height), c = s * h - this.Nn.offsetX, l = o - this.Nn.offsetY, u = Math.floor(c / this.Nn.cellWidth), f = Math.floor(l / this.Nn.cellHeight);
2225
+ u >= 0 && u < this.Nn.cols && f >= 0 && f < this.Nn.rows ? (this.Xn.x = u, this.Xn.y = f) : (this.Xn.x = -1, this.Xn.y = -1);
2226
2226
  }
2227
2227
  }
2228
- const Oe = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Nt }, Symbol.toStringTag, { value: "Module" }));
2229
- class Dt {
2228
+ const Be = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Lt }, Symbol.toStringTag, { value: "Module" }));
2229
+ class _t {
2230
2230
  constructor() {
2231
- a(this, "Ph", /* @__PURE__ */ new Map());
2232
- a(this, "$h", null);
2231
+ a(this, "$h", /* @__PURE__ */ new Map());
2233
2232
  a(this, "Th", null);
2234
- a(this, "Rh");
2233
+ a(this, "Rh", null);
2235
2234
  a(this, "Eh");
2236
- a(this, "th", !1);
2237
2235
  a(this, "Sh");
2236
+ a(this, "sh", !1);
2238
2237
  a(this, "kh");
2239
- a(this, "zh", { 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" });
2238
+ a(this, "zh");
2239
+ a(this, "Dh", { 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" });
2240
2240
  }
2241
- fh() {
2242
- this.th || (this.Rh = (t) => {
2243
- this.Dh(t);
2244
- }, this.Eh = (t) => {
2241
+ dh() {
2242
+ this.sh || (this.Eh = (t) => {
2245
2243
  this.Lh(t);
2246
- }, window.addEventListener("keydown", this.Rh, { passive: !1 }), window.addEventListener("keyup", this.Eh, { passive: !1 }), this.th = !0);
2244
+ }, this.Sh = (t) => {
2245
+ this.Oh(t);
2246
+ }, window.addEventListener("keydown", this.Eh, { passive: !1 }), window.addEventListener("keyup", this.Sh, { passive: !1 }), this.sh = !0);
2247
2247
  }
2248
- Ah() {
2249
- this.th && (window.removeEventListener("keydown", this.Rh), window.removeEventListener("keyup", this.Eh), this.th = !1, this.Ph.clear(), this.$h = null, this.Th = null);
2250
- }
2251
- bh(t) {
2252
- this.Sh = t;
2248
+ bh() {
2249
+ this.sh && (window.removeEventListener("keydown", this.Eh), window.removeEventListener("keyup", this.Sh), this.sh = !1, this.$h.clear(), this.Th = null, this.Rh = null);
2253
2250
  }
2254
2251
  Ch(t) {
2255
2252
  this.kh = t;
2256
2253
  }
2257
- Oh(t) {
2258
- const e = this.Ih(t), i = this.Ph.get(t) || this.Ph.get(e);
2259
- return (i == null ? void 0 : i.isPressed) || !1;
2254
+ xh(t) {
2255
+ this.zh = t;
2260
2256
  }
2261
- Bh() {
2262
- return this.$h;
2257
+ Ih(t) {
2258
+ const e = this.Bh(t), i = this.$h.get(t) || this.$h.get(e);
2259
+ return (i == null ? void 0 : i.isPressed) || !1;
2263
2260
  }
2264
2261
  Hh() {
2265
2262
  return this.Th;
2266
2263
  }
2267
2264
  Gh() {
2268
- const t = [];
2269
- for (const [e, i] of this.Ph) i.isPressed && t.push(e);
2270
- return t;
2265
+ return this.Rh;
2271
2266
  }
2272
2267
  Qh() {
2273
- return { ctrl: this.Oh("Control"), shift: this.Oh("Shift"), alt: this.Oh("Alt"), meta: this.Oh("Meta") };
2268
+ const t = [];
2269
+ for (const [e, i] of this.$h) i.isPressed && t.push(e);
2270
+ return t;
2274
2271
  }
2275
2272
  Nh() {
2276
- this.Ph.clear(), this.$h = null, this.Th = null;
2273
+ return { ctrl: this.Ih("Control"), shift: this.Ih("Shift"), alt: this.Ih("Alt"), meta: this.Ih("Meta") };
2274
+ }
2275
+ Xh() {
2276
+ this.$h.clear(), this.Th = null, this.Rh = null;
2277
2277
  }
2278
- Dh(t) {
2278
+ Lh(t) {
2279
2279
  const e = t.key, i = Date.now();
2280
- this.Ph.has(e) || this.Ph.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2281
- const s = this.Ph.get(e);
2282
- if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.$h = e, this.Sh)) {
2280
+ this.$h.has(e) || this.$h.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2281
+ const s = this.$h.get(e);
2282
+ if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.Th = e, this.kh)) {
2283
2283
  const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !0, originalEvent: t };
2284
- this.Sh(r);
2284
+ this.kh(r);
2285
2285
  }
2286
2286
  }
2287
- Lh(t) {
2287
+ Oh(t) {
2288
2288
  const e = t.key, i = Date.now();
2289
- this.Ph.has(e) || this.Ph.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2290
- const s = this.Ph.get(e);
2291
- if (s.isPressed = !1, s.lastReleaseTime = i, this.Th = e, this.kh) {
2289
+ this.$h.has(e) || this.$h.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2290
+ const s = this.$h.get(e);
2291
+ if (s.isPressed = !1, s.lastReleaseTime = i, this.Rh = e, this.zh) {
2292
2292
  const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !1, originalEvent: t };
2293
- this.kh(r);
2293
+ this.zh(r);
2294
2294
  }
2295
2295
  }
2296
- Ih(t) {
2297
- return this.zh[t] || t.toLowerCase();
2296
+ Bh(t) {
2297
+ return this.Dh[t] || t.toLowerCase();
2298
2298
  }
2299
2299
  }
2300
- const _e = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Dt }, Symbol.toStringTag, { value: "Module" }));
2301
- class Ot {
2300
+ const Xe = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: _t }, Symbol.toStringTag, { value: "Module" }));
2301
+ class Bt {
2302
2302
  constructor(t, e) {
2303
2303
  a(this, "Er");
2304
- a(this, "Xh");
2305
- a(this, "Qn");
2306
- a(this, "Yh", /* @__PURE__ */ new Map());
2307
- a(this, "Wh", /* @__PURE__ */ new Map());
2304
+ a(this, "Yh");
2305
+ a(this, "Nn");
2308
2306
  a(this, "jh", /* @__PURE__ */ new Map());
2309
- a(this, "Kh", null);
2310
- a(this, "Zh");
2307
+ a(this, "Wh", /* @__PURE__ */ new Map());
2308
+ a(this, "Kh", /* @__PURE__ */ new Map());
2309
+ a(this, "Zh", null);
2311
2310
  a(this, "qh");
2312
2311
  a(this, "Vh");
2313
2312
  a(this, "Jh");
2314
2313
  a(this, "so");
2315
2314
  a(this, "io");
2316
- a(this, "th", !1);
2317
2315
  a(this, "eo");
2316
+ a(this, "sh", !1);
2318
2317
  a(this, "ro");
2319
2318
  a(this, "no");
2320
2319
  a(this, "ho");
@@ -2324,294 +2323,295 @@ class Ot {
2324
2323
  a(this, "lo");
2325
2324
  a(this, "uo");
2326
2325
  a(this, "fo");
2327
- a(this, "do", 320);
2328
- a(this, "vo", 350);
2329
- a(this, "po", 10);
2330
- a(this, "mo", 550);
2331
- a(this, "_o", 14);
2332
- a(this, "yo", 48);
2333
- a(this, "Ao", 650);
2326
+ a(this, "do");
2327
+ a(this, "vo", 320);
2328
+ a(this, "po", 350);
2329
+ a(this, "mo", 10);
2330
+ a(this, "_o", 550);
2331
+ a(this, "yo", 14);
2332
+ a(this, "Ao", 48);
2333
+ a(this, "bo", 650);
2334
2334
  a(this, "wo", 0.02);
2335
- a(this, "bo", 2);
2336
- a(this, "Co", 600);
2337
- a(this, "xo", 0);
2338
- a(this, "Mo", null);
2339
- this.Er = t, this.Xh = e;
2335
+ a(this, "Co", 2);
2336
+ a(this, "xo", 600);
2337
+ a(this, "Mo", 0);
2338
+ a(this, "Fo", null);
2339
+ this.Er = t, this.Yh = e;
2340
2340
  const i = this.Er.canvas;
2341
- this.Zh = i.style.touchAction, this.qh = i.style.userSelect, i.style.touchAction || (i.style.touchAction = "none"), i.style.userSelect || (i.style.userSelect = "none");
2341
+ this.qh = i.style.touchAction, this.Vh = i.style.userSelect, i.style.touchAction || (i.style.touchAction = "none"), i.style.userSelect || (i.style.userSelect = "none");
2342
2342
  }
2343
2343
  yr(t) {
2344
- this.Qn = t, this.uh();
2344
+ this.Nn = t, this.fh();
2345
2345
  }
2346
- fh() {
2347
- if (this.th) return;
2346
+ dh() {
2347
+ if (this.sh) return;
2348
2348
  const t = this.Er.canvas;
2349
- this.Vh = (e) => {
2350
- this.Fo(e);
2351
- }, this.Jh = (e) => {
2349
+ this.Jh = (e) => {
2352
2350
  this.Po(e);
2353
2351
  }, this.so = (e) => {
2354
2352
  this.$o(e);
2355
2353
  }, this.io = (e) => {
2356
- this.Uo(e);
2357
- }, t.addEventListener("touchstart", this.Vh, { passive: !1 }), t.addEventListener("touchmove", this.Jh, { passive: !1 }), t.addEventListener("touchend", this.so, { passive: !1 }), t.addEventListener("touchcancel", this.io, { passive: !1 }), this.th = !0;
2354
+ this.To(e);
2355
+ }, this.eo = (e) => {
2356
+ this.Ro(e);
2357
+ }, t.addEventListener("touchstart", this.Jh, { passive: !1 }), t.addEventListener("touchmove", this.so, { passive: !1 }), t.addEventListener("touchend", this.io, { passive: !1 }), t.addEventListener("touchcancel", this.eo, { passive: !1 }), this.sh = !0;
2358
2358
  }
2359
- Ah() {
2360
- if (!this.th) return;
2359
+ bh() {
2360
+ if (!this.sh) return;
2361
2361
  const t = this.Er.canvas;
2362
- t.removeEventListener("touchstart", this.Vh), t.removeEventListener("touchmove", this.Jh), t.removeEventListener("touchend", this.so), t.removeEventListener("touchcancel", this.io), this.th = !1, this.Kh = null, this.Yh.clear(), this.Wh.clear(), this.jh.forEach((e) => {
2362
+ t.removeEventListener("touchstart", this.Jh), t.removeEventListener("touchmove", this.so), t.removeEventListener("touchend", this.io), t.removeEventListener("touchcancel", this.eo), this.sh = !1, this.Zh = null, this.jh.clear(), this.Wh.clear(), this.Kh.forEach((e) => {
2363
2363
  e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
2364
- }), this.jh.clear(), this.Mo = null, this.xo = 0, t.style.touchAction = this.Zh, t.style.userSelect = this.qh;
2364
+ }), this.Kh.clear(), this.Fo = null, this.Mo = 0, t.style.touchAction = this.qh, t.style.userSelect = this.Vh;
2365
2365
  }
2366
- uh() {
2367
- if (!this.Qn || this.Yh.size === 0) return;
2366
+ fh() {
2367
+ if (!this.Nn || this.jh.size === 0) return;
2368
2368
  const t = /* @__PURE__ */ new Map();
2369
- for (const e of this.Yh.values()) {
2370
- const i = this.To(e.clientX, e.clientY, e.id, e);
2369
+ for (const e of this.jh.values()) {
2370
+ const i = this.Eo(e.clientX, e.clientY, e.id, e);
2371
2371
  t.set(e.id, i);
2372
2372
  }
2373
- this.Yh = t;
2373
+ this.jh = t;
2374
2374
  }
2375
- Ro() {
2376
- return Array.from(this.Yh.values()).map((t) => ({ ...t }));
2375
+ So() {
2376
+ return Array.from(this.jh.values()).map((t) => ({ ...t }));
2377
2377
  }
2378
- Eo(t) {
2379
- this.eo = t;
2380
- }
2381
- xh(t) {
2378
+ ko(t) {
2382
2379
  this.ro = t;
2383
2380
  }
2384
- So(t) {
2381
+ Mh(t) {
2385
2382
  this.no = t;
2386
2383
  }
2387
- ko(t) {
2384
+ zo(t) {
2388
2385
  this.ho = t;
2389
2386
  }
2390
- zo(t) {
2387
+ Do(t) {
2391
2388
  this.oo = t;
2392
2389
  }
2393
- Do(t) {
2390
+ Lo(t) {
2394
2391
  this.ao = t;
2395
2392
  }
2396
- Lo(t) {
2393
+ Oo(t) {
2397
2394
  this.co = t;
2398
2395
  }
2399
- Oo(t) {
2396
+ Io(t) {
2400
2397
  this.lo = t;
2401
2398
  }
2402
- Io(t) {
2399
+ Bo(t) {
2403
2400
  this.uo = t;
2404
2401
  }
2405
- Bo(t) {
2402
+ Ho(t) {
2406
2403
  this.fo = t;
2407
2404
  }
2408
- Fo(t) {
2405
+ Go(t) {
2406
+ this.do = t;
2407
+ }
2408
+ Po(t) {
2409
2409
  var s;
2410
- if (!this.Qn) return;
2411
- t.preventDefault(), (s = this.Xh) == null || s.hh(this.Co);
2412
- const e = performance.now(), i = this.Ho(t.changedTouches);
2410
+ if (!this.Nn) return;
2411
+ t.preventDefault(), (s = this.Yh) == null || s.oh(this.xo);
2412
+ const e = performance.now(), i = this.Qo(t.changedTouches);
2413
2413
  for (const r of i) {
2414
- const h = this.Yh.get(r.id);
2415
- h && this.Wh.set(r.id, this.Go(h)), this.Yh.set(r.id, r);
2414
+ const h = this.jh.get(r.id);
2415
+ h && this.Wh.set(r.id, this.No(h)), this.jh.set(r.id, r);
2416
2416
  const o = { id: r.id, startPosition: r, lastPosition: r, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
2417
- this.co && (o.longPressTimer = window.setTimeout(() => {
2418
- const c = this.Yh.get(r.id);
2419
- c && (o.longPressFired = !0, this.co({ touch: this.Go(c), duration: performance.now() - o.startTime, originalEvent: t }));
2420
- }, this.mo)), this.jh.set(r.id, o), this.eo && this.eo(this.Qo(r, t, void 0, e));
2417
+ this.lo && (o.longPressTimer = window.setTimeout(() => {
2418
+ const c = this.jh.get(r.id);
2419
+ c && (o.longPressFired = !0, this.lo({ touch: this.No(c), duration: performance.now() - o.startTime, originalEvent: t }));
2420
+ }, this._o)), this.Kh.set(r.id, o), this.ro && this.ro(this.Xo(r, t, void 0, e));
2421
2421
  }
2422
- this.Yh.size === 2 && this.No();
2422
+ this.jh.size === 2 && this.Yo();
2423
2423
  }
2424
- Po(t) {
2424
+ $o(t) {
2425
2425
  var s;
2426
- if (!this.Qn) return;
2427
- t.preventDefault(), (s = this.Xh) == null || s.hh(this.Co);
2428
- const e = performance.now(), i = this.Ho(t.changedTouches);
2426
+ if (!this.Nn) return;
2427
+ t.preventDefault(), (s = this.Yh) == null || s.oh(this.xo);
2428
+ const e = performance.now(), i = this.Qo(t.changedTouches);
2429
2429
  for (const r of i) {
2430
- const h = this.Yh.get(r.id), o = h ? this.Go(h) : void 0;
2431
- o && this.Wh.set(r.id, o), this.Yh.set(r.id, r);
2432
- const c = this.jh.get(r.id);
2433
- c && (c.lastPosition = r, c.lastTime = e, o) && z(o.clientX, o.clientY, r.clientX, r.clientY) > this._o && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.ro && this.ro(this.Qo(r, t, o, e));
2430
+ const h = this.jh.get(r.id), o = h ? this.No(h) : void 0;
2431
+ o && this.Wh.set(r.id, o), this.jh.set(r.id, r);
2432
+ const c = this.Kh.get(r.id);
2433
+ c && (c.lastPosition = r, c.lastTime = e, o) && z(o.clientX, o.clientY, r.clientX, r.clientY) > this.yo && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.no && this.no(this.Xo(r, t, o, e));
2434
2434
  }
2435
- this.Yh.size === 2 ? this.Xo(t) : this.Kh = null;
2435
+ this.jh.size === 2 ? this.jo(t) : this.Zh = null;
2436
2436
  }
2437
- $o(t) {
2438
- if (!this.Qn) return;
2437
+ To(t) {
2438
+ if (!this.Nn) return;
2439
2439
  t.preventDefault();
2440
- const e = performance.now(), i = this.Ho(t.changedTouches);
2440
+ const e = performance.now(), i = this.Qo(t.changedTouches);
2441
2441
  for (const s of i) {
2442
- const r = this.Yh.get(s.id), h = r ? this.Go(r) : void 0, o = this.jh.get(s.id);
2443
- o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.no && this.no(this.Qo(s, t, h, e)), o && this.Yo(o, t), this.jh.delete(s.id), this.Wh.delete(s.id), this.Yh.delete(s.id);
2442
+ const r = this.jh.get(s.id), h = r ? this.No(r) : void 0, o = this.Kh.get(s.id);
2443
+ o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.ho && this.ho(this.Xo(s, t, h, e)), o && this.Wo(o, t), this.Kh.delete(s.id), this.Wh.delete(s.id), this.jh.delete(s.id);
2444
2444
  }
2445
- this.Yh.size < 2 && (this.Kh = null);
2445
+ this.jh.size < 2 && (this.Zh = null);
2446
2446
  }
2447
- Uo(t) {
2448
- if (!this.Qn) return;
2447
+ Ro(t) {
2448
+ if (!this.Nn) return;
2449
2449
  t.preventDefault();
2450
- const e = performance.now(), i = this.Ho(t.changedTouches);
2450
+ const e = performance.now(), i = this.Qo(t.changedTouches);
2451
2451
  for (const s of i) {
2452
- const r = this.Yh.get(s.id), h = r ? this.Go(r) : void 0, o = this.jh.get(s.id);
2453
- o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.ho && this.ho(this.Qo(s, t, h, e)), this.jh.delete(s.id), this.Wh.delete(s.id), this.Yh.delete(s.id);
2452
+ const r = this.jh.get(s.id), h = r ? this.No(r) : void 0, o = this.Kh.get(s.id);
2453
+ o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.oo && this.oo(this.Xo(s, t, h, e)), this.Kh.delete(s.id), this.Wh.delete(s.id), this.jh.delete(s.id);
2454
2454
  }
2455
- this.Yh.size < 2 && (this.Kh = null);
2455
+ this.jh.size < 2 && (this.Zh = null);
2456
2456
  }
2457
- Ho(t) {
2457
+ Qo(t) {
2458
2458
  const e = [];
2459
2459
  for (let i = 0; i < t.length; i += 1) {
2460
2460
  const s = t.item(i);
2461
- s && e.push(this.Wo(s));
2461
+ s && e.push(this.Ko(s));
2462
2462
  }
2463
2463
  return e;
2464
2464
  }
2465
- Wo(t) {
2466
- return this.To(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 });
2465
+ Ko(t) {
2466
+ return this.Eo(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 });
2467
2467
  }
2468
- To(t, e, i, s) {
2469
- const r = this.Er.canvas, h = r.getBoundingClientRect(), o = t - h.left, c = e - h.top, l = r.width / h.width, u = c * (r.height / h.height), f = o * l - this.Qn.offsetX, d = u - this.Qn.offsetY, g = Math.floor(f / this.Qn.cellWidth), m = Math.floor(d / this.Qn.cellHeight), v = g >= 0 && g < this.Qn.cols && m >= 0 && m < this.Qn.rows;
2468
+ Eo(t, e, i, s) {
2469
+ const r = this.Er.canvas, h = r.getBoundingClientRect(), o = t - h.left, c = e - h.top, l = r.width / h.width, u = c * (r.height / h.height), f = o * l - this.Nn.offsetX, d = u - this.Nn.offsetY, g = Math.floor(f / this.Nn.cellWidth), m = Math.floor(d / this.Nn.cellHeight), v = g >= 0 && g < this.Nn.cols && m >= 0 && m < this.Nn.rows;
2470
2470
  return { id: i, x: v ? g : -1, y: v ? m : -1, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
2471
2471
  }
2472
- Qo(t, e, i, s) {
2473
- const r = this.jh.get(t.id), h = Array.from(this.Wh.values()).map((l) => this.Go(l)), o = Array.from(this.Yh.values()).map((l) => this.Go(l)), c = this.Ho(e.changedTouches);
2474
- return { touch: this.Go(t), previousTouch: i ? this.Go(i) : void 0, touches: o, previousTouches: h, changedTouches: c, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
2472
+ Xo(t, e, i, s) {
2473
+ const r = this.Kh.get(t.id), h = Array.from(this.Wh.values()).map((l) => this.No(l)), o = Array.from(this.jh.values()).map((l) => this.No(l)), c = this.Qo(e.changedTouches);
2474
+ return { touch: this.No(t), previousTouch: i ? this.No(i) : void 0, touches: o, previousTouches: h, changedTouches: c, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
2475
2475
  }
2476
- No() {
2477
- if (this.Yh.size !== 2) return void (this.Kh = null);
2478
- const t = Array.from(this.Yh.values()), [e, i] = t, s = z(e.x, e.y, i.x, i.y), r = Et(e.clientX, e.clientY, i.clientX, i.clientY);
2479
- this.Kh = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
2476
+ Yo() {
2477
+ if (this.jh.size !== 2) return void (this.Zh = null);
2478
+ const t = Array.from(this.jh.values()), [e, i] = t, s = z(e.x, e.y, i.x, i.y), r = Et(e.clientX, e.clientY, i.clientX, i.clientY);
2479
+ this.Zh = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
2480
2480
  }
2481
- Xo(t) {
2482
- if (this.Kh || this.No(), !this.Kh) return;
2483
- const [e, i] = this.Kh.ids, s = this.Yh.get(e), r = this.Yh.get(i);
2481
+ jo(t) {
2482
+ if (this.Zh || this.Yo(), !this.Zh) return;
2483
+ const [e, i] = this.Zh.ids, s = this.jh.get(e), r = this.jh.get(i);
2484
2484
  if (!s || !r) return;
2485
- const h = z(s.x, s.y, r.x, r.y) / this.Kh.initialDistance, o = h - this.Kh.lastScale;
2486
- this.uo && Math.abs(o) > this.wo && (this.uo({ touches: [this.Go(s), this.Go(r)], scale: h, deltaScale: o, center: this.jo(s, r), originalEvent: t }), this.Kh.lastScale = h);
2487
- let c = Et(s.clientX, s.clientY, r.clientX, r.clientY) - this.Kh.initialAngle;
2485
+ const h = z(s.x, s.y, r.x, r.y) / this.Zh.initialDistance, o = h - this.Zh.lastScale;
2486
+ this.fo && Math.abs(o) > this.wo && (this.fo({ touches: [this.No(s), this.No(r)], scale: h, deltaScale: o, center: this.Zo(s, r), originalEvent: t }), this.Zh.lastScale = h);
2487
+ let c = Et(s.clientX, s.clientY, r.clientX, r.clientY) - this.Zh.initialAngle;
2488
2488
  c = (c + 180) % 360 - 180;
2489
- const l = c - this.Kh.lastRotation;
2490
- this.fo && Math.abs(l) > this.bo && (this.fo({ touches: [this.Go(s), this.Go(r)], rotation: c, deltaRotation: l, center: this.jo(s, r), originalEvent: t }), this.Kh.lastRotation = c);
2489
+ const l = c - this.Zh.lastRotation;
2490
+ this.do && Math.abs(l) > this.Co && (this.do({ touches: [this.No(s), this.No(r)], rotation: c, deltaRotation: l, center: this.Zo(s, r), originalEvent: t }), this.Zh.lastRotation = c);
2491
2491
  }
2492
- jo(t, e) {
2493
- const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.To(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
2492
+ Zo(t, e) {
2493
+ const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.Eo(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
2494
2494
  return { x: r.x, y: r.y };
2495
2495
  }
2496
- Yo(t, e) {
2496
+ Wo(t, e) {
2497
2497
  const i = performance.now(), s = i - t.startTime, r = z(t.startPosition.clientX, t.startPosition.clientY, t.lastPosition.clientX, t.lastPosition.clientY);
2498
- if (!t.longPressFired && s <= this.do && r <= this.po)
2499
- this.Ko(t.lastPosition, i) && this.ao ? this.ao({ touch: this.Go(t.lastPosition), taps: 2, originalEvent: e }) : this.oo && this.oo({ touch: this.Go(t.lastPosition), taps: 1, originalEvent: e });
2500
- else if (!t.longPressFired && s <= this.Ao && r >= this.yo) {
2498
+ if (!t.longPressFired && s <= this.vo && r <= this.mo)
2499
+ this.qo(t.lastPosition, i) && this.co ? this.co({ touch: this.No(t.lastPosition), taps: 2, originalEvent: e }) : this.ao && this.ao({ touch: this.No(t.lastPosition), taps: 1, originalEvent: e });
2500
+ else if (!t.longPressFired && s <= this.bo && r >= this.Ao) {
2501
2501
  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 };
2502
- this.lo && this.lo({ touch: this.Go(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
2502
+ this.uo && this.uo({ touch: this.No(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
2503
2503
  }
2504
- this.xo = i, this.Mo = this.Go(t.lastPosition);
2504
+ this.Mo = i, this.Fo = this.No(t.lastPosition);
2505
2505
  }
2506
- Ko(t, e) {
2507
- return !this.Mo || e - this.xo > this.vo ? !1 : z(t.clientX, t.clientY, this.Mo.clientX, this.Mo.clientY) <= this.po;
2506
+ qo(t, e) {
2507
+ return !this.Fo || e - this.Mo > this.po ? !1 : z(t.clientX, t.clientY, this.Fo.clientX, this.Fo.clientY) <= this.mo;
2508
2508
  }
2509
- Go(t) {
2509
+ No(t) {
2510
2510
  return { ...t };
2511
2511
  }
2512
2512
  }
2513
- const Be = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Ot }, Symbol.toStringTag, { value: "Module" }));
2514
- class Xe {
2513
+ const Ze = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Bt }, Symbol.toStringTag, { value: "Module" }));
2514
+ class Oe {
2515
2515
  constructor(t, e) {
2516
2516
  a(this, "A");
2517
- a(this, "Zo");
2517
+ a(this, "Vo");
2518
2518
  a(this, "$n", null);
2519
- a(this, "qo", 0);
2520
- a(this, "Vo", !1);
2521
- a(this, "Jo", []);
2522
- a(this, "ta", -1);
2523
- this.A = t, this.Zo = e;
2519
+ a(this, "Jo", 0);
2520
+ a(this, "ta", !1);
2521
+ a(this, "sa", []);
2522
+ a(this, "ia", -1);
2523
+ this.A = t, this.Vo = e;
2524
2524
  }
2525
2525
  get isPreloaded() {
2526
- return this.Vo;
2526
+ return this.ta;
2527
2527
  }
2528
2528
  get totalFrames() {
2529
- return this.qo;
2529
+ return this.Jo;
2530
2530
  }
2531
2531
  get frameRate() {
2532
2532
  return this.$n;
2533
2533
  }
2534
2534
  get textures() {
2535
- return this.Jo;
2535
+ return this.sa;
2536
2536
  }
2537
2537
  dispose() {
2538
- this.sa(), this.Jo = [], this.$n = null, this.qo = 0, this.Vo = !1, this.ta = -1;
2538
+ this.ea(), this.sa = [], this.$n = null, this.Jo = 0, this.ta = !1, this.ia = -1;
2539
2539
  }
2540
2540
  async preload(t, e) {
2541
2541
  var i;
2542
2542
  try {
2543
2543
  if (t <= 0) throw Error("Video preload requires a frameRate greater than 0.");
2544
- const s = this.Zo.duration;
2544
+ const s = this.Vo.duration;
2545
2545
  if (!isFinite(s) || s <= 0) throw Error("Video duration is invalid, cannot preload frames.");
2546
2546
  const r = Math.max(1, Math.ceil(s * t));
2547
- return this.ia(t, r), await this.ea(t, e) ? (this.ra("captureStream", e), "captureStream") : (await this.na(t, e), this.ra("seeking", e), "seeking");
2547
+ return this.ra(t, r), await this.na(t, e) ? (this.ha("captureStream", e), "captureStream") : (await this.oa(t, e), this.ha("seeking", e), "seeking");
2548
2548
  } catch (s) {
2549
2549
  const r = s instanceof Error ? s : Error(s + "");
2550
2550
  throw (i = e == null ? void 0 : e.onError) == null || i.call(e, r), this.dispose(), r;
2551
2551
  }
2552
2552
  }
2553
- ia(t, e) {
2554
- this.sa(), this.$n = t, this.qo = e, this.Jo = [], this.Vo = !1, this.ta = -1;
2555
- }
2556
2553
  ra(t, e) {
2554
+ this.ea(), this.$n = t, this.Jo = e, this.sa = [], this.ta = !1, this.ia = -1;
2555
+ }
2556
+ ha(t, e) {
2557
2557
  var i;
2558
- if (this.Jo.length === 0) throw Error(`Video preload via ${t} completed but produced 0 frames.`);
2559
- this.qo = this.Jo.length, this.Vo = !0, this.ta = -1, this.Zo.pause(), this.Zo.currentTime = 0, e != null && e.onProgress && e.onProgress({ percent: 100, loadedFrames: this.qo, totalFrames: this.qo, strategy: t }), (i = e == null ? void 0 : e.onComplete) == null || i.call(e, { totalFrames: this.qo, strategy: t });
2558
+ if (this.sa.length === 0) throw Error(`Video preload via ${t} completed but produced 0 frames.`);
2559
+ this.Jo = this.sa.length, this.ta = !0, this.ia = -1, this.Vo.pause(), this.Vo.currentTime = 0, e != null && e.onProgress && e.onProgress({ percent: 100, loadedFrames: this.Jo, totalFrames: this.Jo, strategy: t }), (i = e == null ? void 0 : e.onComplete) == null || i.call(e, { totalFrames: this.Jo, strategy: t });
2560
2560
  }
2561
- ha(t) {
2561
+ aa(t) {
2562
2562
  const e = this.A, i = e.createTexture();
2563
2563
  return e.bindTexture(e.TEXTURE_2D, i), e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, 1), et(e, e.LINEAR, e.LINEAR, e.CLAMP_TO_EDGE, e.CLAMP_TO_EDGE), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, t), e.bindTexture(e.TEXTURE_2D, null), i;
2564
2564
  }
2565
- oa(t, e) {
2566
- if (!(e != null && e.onProgress) || this.qo === 0) return;
2567
- const i = Math.min(99, Math.floor(this.Jo.length / this.qo * 100)), s = 10 * Math.floor(i / 10);
2568
- s > this.ta && (this.ta = s, e.onProgress({ percent: i, loadedFrames: this.Jo.length, totalFrames: this.qo, strategy: t }));
2565
+ ca(t, e) {
2566
+ if (!(e != null && e.onProgress) || this.Jo === 0) return;
2567
+ const i = Math.min(99, Math.floor(this.sa.length / this.Jo * 100)), s = 10 * Math.floor(i / 10);
2568
+ s > this.ia && (this.ia = s, e.onProgress({ percent: i, loadedFrames: this.sa.length, totalFrames: this.Jo, strategy: t }));
2569
2569
  }
2570
- async ea(t, e) {
2571
- const i = globalThis, s = i == null ? void 0 : i.MediaStreamTrackProcessor, r = this.Zo.captureStream;
2570
+ async na(t, e) {
2571
+ const i = globalThis, s = i == null ? void 0 : i.MediaStreamTrackProcessor, r = this.Vo.captureStream;
2572
2572
  if (typeof s != "function" || typeof r != "function") return !1;
2573
2573
  let h, o = null;
2574
2574
  try {
2575
- const c = r.call(this.Zo);
2575
+ const c = r.call(this.Vo);
2576
2576
  if (h = c.getVideoTracks()[0], !h) return c.getTracks().forEach((f) => f.stop()), !1;
2577
- if (o = new s({ track: h }).readable.getReader(), this.Zo.currentTime = 0, this.Zo.muted = !0, await this.Zo.play().catch(() => {
2578
- }), this.Zo.paused) return !1;
2577
+ if (o = new s({ track: h }).readable.getReader(), this.Vo.currentTime = 0, this.Vo.muted = !0, await this.Vo.play().catch(() => {
2578
+ }), this.Vo.paused) return !1;
2579
2579
  const l = 1e6 / t;
2580
2580
  let u = 0;
2581
- for (; this.Jo.length < this.qo; ) {
2581
+ for (; this.sa.length < this.Jo; ) {
2582
2582
  const f = await o.read();
2583
2583
  if (f.done) break;
2584
2584
  const d = f.value;
2585
2585
  if (d) try {
2586
2586
  const g = typeof d.timestamp == "number" ? d.timestamp : u;
2587
- (this.Jo.length === 0 || g >= u) && (this.Jo.push(this.ha(d)), u = g + l, this.oa("captureStream", e));
2587
+ (this.sa.length === 0 || g >= u) && (this.sa.push(this.aa(d)), u = g + l, this.ca("captureStream", e));
2588
2588
  } finally {
2589
2589
  d.close();
2590
2590
  }
2591
2591
  }
2592
- return o.releaseLock(), h.stop(), o = null, h = void 0, this.Zo.pause(), this.Zo.currentTime = 0, this.Jo.length !== 0;
2592
+ return o.releaseLock(), h.stop(), o = null, h = void 0, this.Vo.pause(), this.Vo.currentTime = 0, this.sa.length !== 0;
2593
2593
  } catch {
2594
- return this.sa(), this.Jo = [], this.ta = -1, !1;
2594
+ return this.ea(), this.sa = [], this.ia = -1, !1;
2595
2595
  } finally {
2596
2596
  if (o) try {
2597
2597
  await o.cancel();
2598
2598
  } catch {
2599
2599
  }
2600
- h && h.stop(), this.Zo.pause(), this.Zo.currentTime = 0;
2600
+ h && h.stop(), this.Vo.pause(), this.Vo.currentTime = 0;
2601
2601
  }
2602
2602
  }
2603
- async na(t, e) {
2604
- const i = 1 / t, s = this.qo, r = this.Zo;
2603
+ async oa(t, e) {
2604
+ const i = 1 / t, s = this.Jo, r = this.Vo;
2605
2605
  r.pause();
2606
2606
  for (let h = 0; h < s; h++) {
2607
2607
  const o = Math.min(r.duration, h * i);
2608
- await this.aa(o), this.Jo.push(this.ha(r)), this.oa("seeking", e);
2608
+ await this.la(o), this.sa.push(this.aa(r)), this.ca("seeking", e);
2609
2609
  }
2610
2610
  r.currentTime = 0;
2611
2611
  }
2612
- aa(t) {
2612
+ la(t) {
2613
2613
  return new Promise((e, i) => {
2614
- const s = this.Zo, r = () => {
2614
+ const s = this.Vo, r = () => {
2615
2615
  s.removeEventListener("seeked", h), s.removeEventListener("error", o);
2616
2616
  }, h = () => {
2617
2617
  r(), e();
@@ -2624,47 +2624,47 @@ class Xe {
2624
2624
  s.currentTime = l;
2625
2625
  });
2626
2626
  }
2627
- sa() {
2628
- for (const t of this.Jo) this.A.deleteTexture(t);
2627
+ ea() {
2628
+ for (const t of this.sa) this.A.deleteTexture(t);
2629
2629
  }
2630
2630
  }
2631
- class rt extends Zt {
2631
+ class rt extends St {
2632
2632
  constructor(e, i, s, r, h, o, c, l, u) {
2633
2633
  const f = o / c;
2634
2634
  let d, g;
2635
2635
  f > 1 ? (d = l, g = Math.round(l / f)) : (g = u, d = Math.round(u * f));
2636
2636
  super(e, i, s, r, o, c, d, g);
2637
- a(this, "Zo");
2638
- a(this, "ca", 0);
2639
- a(this, "la", null);
2640
- this.Zo = h;
2637
+ a(this, "Vo");
2638
+ a(this, "ua", 0);
2639
+ a(this, "fa", null);
2640
+ this.Vo = h;
2641
2641
  }
2642
2642
  gt() {
2643
2643
  var e;
2644
- super.gt(), (e = this.la) == null || e.dispose(), this.la = null, this.Zo.pause(), this.Zo.src = "", this.Zo.load();
2644
+ super.gt(), (e = this.fa) == null || e.dispose(), this.fa = null, this.Vo.pause(), this.Vo.src = "", this.Vo.load();
2645
2645
  }
2646
- ua() {
2646
+ da() {
2647
2647
  var e;
2648
- if (!((e = this.la) != null && e.isPreloaded) && this.Zo.readyState >= this.Zo.HAVE_CURRENT_DATA) {
2648
+ if (!((e = this.fa) != null && e.isPreloaded) && this.Vo.readyState >= this.Vo.HAVE_CURRENT_DATA) {
2649
2649
  const i = this.A;
2650
- i.bindTexture(i.TEXTURE_2D, this.tn), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, i.RGBA, i.UNSIGNED_BYTE, this.Zo), i.bindTexture(i.TEXTURE_2D, null);
2650
+ i.bindTexture(i.TEXTURE_2D, this.tn), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, i.RGBA, i.UNSIGNED_BYTE, this.Vo), i.bindTexture(i.TEXTURE_2D, null);
2651
2651
  }
2652
2652
  }
2653
- bn() {
2653
+ wn() {
2654
2654
  var i, s;
2655
- const e = (i = this.la) == null ? void 0 : i.textures;
2656
- return e && e.length > 0 && ((s = this.la) != null && s.isPreloaded) ? e[this.ca % e.length] : this.tn;
2655
+ const e = (i = this.fa) == null ? void 0 : i.textures;
2656
+ return e && e.length > 0 && ((s = this.fa) != null && s.isPreloaded) ? e[this.ua % e.length] : this.tn;
2657
2657
  }
2658
2658
  ut() {
2659
2659
  return this.q = null, super.ut();
2660
2660
  }
2661
2661
  yn() {
2662
- this.ua();
2662
+ this.da();
2663
2663
  }
2664
2664
  frame(e) {
2665
2665
  var s, r;
2666
- const i = ((s = this.la) == null ? void 0 : s.totalFrames) ?? 0;
2667
- return (r = this.la) != null && r.isPreloaded && e !== void 0 && i > 0 && (this.ca = (e % i + i) % i, this.q = null), this;
2666
+ const i = ((s = this.fa) == null ? void 0 : s.totalFrames) ?? 0;
2667
+ return (r = this.fa) != null && r.isPreloaded && e !== void 0 && i > 0 && (this.ua = (e % i + i) % i, this.q = null), this;
2668
2668
  }
2669
2669
  static async Cn(e, i, s, r, h, o) {
2670
2670
  const c = e.context, l = o == null ? void 0 : o.frameRate;
@@ -2679,28 +2679,28 @@ class rt extends Zt {
2679
2679
  const f = c.createTexture();
2680
2680
  c.bindTexture(c.TEXTURE_2D, f), c.pixelStorei(c.UNPACK_FLIP_Y_WEBGL, 1), et(c, c.LINEAR, c.LINEAR, c.CLAMP_TO_EDGE, c.CLAMP_TO_EDGE), c.texImage2D(c.TEXTURE_2D, 0, c.RGBA, c.RGBA, c.UNSIGNED_BYTE, u), c.bindTexture(c.TEXTURE_2D, null);
2681
2681
  const d = u.videoWidth, g = u.videoHeight, m = new rt(c, e, f, i, u, d, g, r, h);
2682
- return l && l > 0 && (m.la = new Xe(c, u), await m.la.preload(l, o), m.ca = 0), m;
2682
+ return l && l > 0 && (m.fa = new Oe(c, u), await m.fa.preload(l, o), m.ua = 0), m;
2683
2683
  }
2684
2684
  async play() {
2685
- await this.Zo.play();
2685
+ await this.Vo.play();
2686
2686
  }
2687
2687
  pause() {
2688
- this.Zo.pause();
2688
+ this.Vo.pause();
2689
2689
  }
2690
2690
  stop() {
2691
- this.Zo.pause(), this.Zo.currentTime = 0;
2691
+ this.Vo.pause(), this.Vo.currentTime = 0;
2692
2692
  }
2693
2693
  speed(e) {
2694
- return this.Zo.playbackRate = e, this;
2694
+ return this.Vo.playbackRate = e, this;
2695
2695
  }
2696
2696
  loop(e = !0) {
2697
- return this.Zo.loop = e, this;
2697
+ return this.Vo.loop = e, this;
2698
2698
  }
2699
2699
  time(e) {
2700
- return this.Zo.currentTime = e, this;
2700
+ return this.Vo.currentTime = e, this;
2701
2701
  }
2702
2702
  volume(e) {
2703
- return this.Zo.volume = Math.max(0, Math.min(1, e)), this;
2703
+ return this.Vo.volume = Math.max(0, Math.min(1, e)), this;
2704
2704
  }
2705
2705
  get texture() {
2706
2706
  return this.tn;
@@ -2718,24 +2718,24 @@ class rt extends Zt {
2718
2718
  return this.en;
2719
2719
  }
2720
2720
  get videoElement() {
2721
- return this.Zo;
2721
+ return this.Vo;
2722
2722
  }
2723
2723
  get currentTime() {
2724
- return this.Zo.currentTime;
2724
+ return this.Vo.currentTime;
2725
2725
  }
2726
2726
  get duration() {
2727
- return this.Zo.duration;
2727
+ return this.Vo.duration;
2728
2728
  }
2729
2729
  get isPlaying() {
2730
- return !this.Zo.paused && !this.Zo.ended;
2730
+ return !this.Vo.paused && !this.Vo.ended;
2731
2731
  }
2732
2732
  get totalFrames() {
2733
2733
  var e;
2734
- return ((e = this.la) == null ? void 0 : e.totalFrames) ?? 0;
2734
+ return ((e = this.fa) == null ? void 0 : e.totalFrames) ?? 0;
2735
2735
  }
2736
2736
  }
2737
2737
  const Ie = (n) => class extends n {
2738
- fa(t, e, i, s) {
2738
+ va(t, e, i, s) {
2739
2739
  if (M.Zr(t)) return t;
2740
2740
  if (typeof t == "number" || typeof t == "string") return this.color(t, e, i, s);
2741
2741
  throw Error("Unsupported color input passed to color-capable method.");
@@ -2774,19 +2774,19 @@ const Ie = (n) => class extends n {
2774
2774
  return M.Kr(t, e, i, s);
2775
2775
  }
2776
2776
  rect(t = 1, e = 1) {
2777
- this.Z.we(t, e);
2777
+ this.Z.be(t, e);
2778
2778
  }
2779
2779
  point() {
2780
- this.Z.we(1, 1);
2780
+ this.Z.be(1, 1);
2781
2781
  }
2782
2782
  line(t, e, i, s) {
2783
- this.Z.be(t, e, i, s);
2783
+ this.Z.we(t, e, i, s);
2784
2784
  }
2785
2785
  lineWeight(t) {
2786
2786
  this.Z.state.Zt(t);
2787
2787
  }
2788
2788
  background(t, e, i, s = 255) {
2789
- const r = this.fa(t, e, i, s);
2789
+ const r = this.va(t, e, i, s);
2790
2790
  this.Z.$e(r.r, r.g, r.b, r.a);
2791
2791
  }
2792
2792
  char(t) {
@@ -2795,11 +2795,11 @@ const Ie = (n) => class extends n {
2795
2795
  this.Z.state.hs(this.rr.Mr(e[0]));
2796
2796
  }
2797
2797
  charColor(t, e, i, s) {
2798
- const r = this.fa(t, e, i, s);
2798
+ const r = this.va(t, e, i, s);
2799
2799
  this.Z.state.cs(r.r, r.g, r.b, r.a);
2800
2800
  }
2801
2801
  cellColor(t, e, i, s) {
2802
- const r = this.fa(t, e, i, s);
2802
+ const r = this.va(t, e, i, s);
2803
2803
  this.Z.state.ls(r.r, r.g, r.b, r.a);
2804
2804
  }
2805
2805
  flipX(t) {
@@ -2815,7 +2815,7 @@ const Ie = (n) => class extends n {
2815
2815
  this.Z.state.ds(t);
2816
2816
  }
2817
2817
  clear() {
2818
- this.Z.wi(0, 0, 0, 0);
2818
+ this.Z.bi(0, 0, 0, 0);
2819
2819
  }
2820
2820
  ellipse(t, e) {
2821
2821
  this.Z.Ce(t / 2, e / 2);
@@ -2851,324 +2851,324 @@ const Ie = (n) => class extends n {
2851
2851
  return this.Z.Pe(t.width ?? this.grid.cols, t.height ?? this.grid.rows, t.attachments ?? 3);
2852
2852
  }
2853
2853
  image(t, e, i) {
2854
- this.Z.ye(t, e, i), t instanceof W && this.Z.ct();
2854
+ this.Z.ye(t, e, i), t instanceof j && this.Z.ct();
2855
2855
  }
2856
2856
  ortho() {
2857
2857
  this.Z.state.gs(!0);
2858
2858
  }
2859
2859
  async loadImage(t) {
2860
2860
  if (typeof t != "string") {
2861
- const r = I.Cn(this.Z, this.rr, t, this.Qn.cols, this.Qn.rows);
2862
- return this.da(r), r;
2861
+ const r = I.Cn(this.Z, this.rr, t, this.Nn.cols, this.Nn.rows);
2862
+ return this.pa(r), r;
2863
2863
  }
2864
2864
  const e = t, i = await new Promise((r, h) => {
2865
2865
  const o = new Image();
2866
2866
  o.crossOrigin = "anonymous", o.onload = () => r(o), o.onerror = (c) => h(c), o.src = e;
2867
- }), s = I.Cn(this.Z, this.rr, i, this.Qn.cols, this.Qn.rows);
2868
- return this.da(s), s;
2867
+ }), s = I.Cn(this.Z, this.rr, i, this.Nn.cols, this.Nn.rows);
2868
+ return this.pa(s), s;
2869
2869
  }
2870
2870
  async loadVideo(t, e) {
2871
- const i = await rt.Cn(this.Z, this.rr, t, this.Qn.cols, this.Qn.rows, e);
2872
- return this.da(i), i;
2871
+ const i = await rt.Cn(this.Z, this.rr, t, this.Nn.cols, this.Nn.rows, e);
2872
+ return this.pa(i), i;
2873
2873
  }
2874
2874
  }, Ye = (n) => class extends n {
2875
2875
  async loadFont(t) {
2876
2876
  return this.rr.Cr(t).then(() => {
2877
2877
  const e = this.rr.maxGlyphDimensions;
2878
- this.Qn.zr(e.width, e.height), this.va.resize(this.Qn.cols, this.Qn.rows), this.pa.Xr(), this.Z.Re(), this.Xh.uh(), this.ga.uh();
2879
- for (const i of this.ma) i._n(this.rr);
2878
+ this.Nn.zr(e.width, e.height), this.ga.resize(this.Nn.cols, this.Nn.rows), this.ma.Xr(), this.Z.Re(), this.Yh.fh(), this._a.fh();
2879
+ for (const i of this.ya) i._n(this.rr);
2880
2880
  });
2881
2881
  }
2882
2882
  fontSize(t) {
2883
2883
  if (!vt.m(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) || this.rr.fontSize === t) return;
2884
- this.rr.br(t);
2884
+ this.rr.wr(t);
2885
2885
  const e = this.rr.maxGlyphDimensions;
2886
- this.Qn.zr(e.width, e.height), this.va.resize(this.Qn.cols, this.Qn.rows), this.pa.Xr(), this.Z.Re(), this.Xh.uh(), this.ga.uh();
2886
+ this.Nn.zr(e.width, e.height), this.ga.resize(this.Nn.cols, this.Nn.rows), this.ma.Xr(), this.Z.Re(), this.Yh.fh(), this._a.fh();
2887
2887
  }
2888
2888
  }, ze = (n) => class extends n {
2889
2889
  get frameCount() {
2890
- return this._a.Hn;
2890
+ return this.ba.Gn;
2891
2891
  }
2892
2892
  set frameCount(t) {
2893
- this._a.Hn = t;
2893
+ this.ba.Gn = t;
2894
2894
  }
2895
2895
  frameRate(t) {
2896
- return t === void 0 ? this._a.Bn : this._a.Ln(t, () => this.ya());
2896
+ return t === void 0 ? this.ba.Hn : this.ba.On(t, () => this.wa());
2897
2897
  }
2898
2898
  noLoop() {
2899
- this._a.zn();
2899
+ this.ba.Dn();
2900
2900
  }
2901
2901
  loop() {
2902
- this._a.Dn(() => this.ya());
2902
+ this.ba.Ln(() => this.wa());
2903
2903
  }
2904
2904
  redraw(t = 1) {
2905
- 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.ya();
2905
+ 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.wa();
2906
2906
  }
2907
2907
  isLooping() {
2908
- return this._a.In;
2908
+ return this.ba.Bn;
2909
2909
  }
2910
2910
  }, Ge = (n) => class extends n {
2911
2911
  constructor(...t) {
2912
2912
  super(...t);
2913
2913
  }
2914
2914
  mouseClicked(t) {
2915
- this.Xh.wh(t);
2915
+ this.Yh.wh(t);
2916
2916
  }
2917
2917
  mousePressed(t) {
2918
- this.Xh.bh(t);
2918
+ this.Yh.Ch(t);
2919
2919
  }
2920
2920
  mouseReleased(t) {
2921
- this.Xh.Ch(t);
2921
+ this.Yh.xh(t);
2922
2922
  }
2923
2923
  mouseMoved(t) {
2924
- this.Xh.xh(t);
2924
+ this.Yh.Mh(t);
2925
2925
  }
2926
2926
  mouseScrolled(t) {
2927
- this.Xh.Mh(t);
2927
+ this.Yh.Fh(t);
2928
2928
  }
2929
2929
  get mouse() {
2930
- return this.Xh.Fh();
2930
+ return this.Yh.Ph();
2931
2931
  }
2932
2932
  cursor(t) {
2933
- this.Xh.ah(t);
2933
+ this.Yh.uh(t);
2934
2934
  }
2935
- }, Qe = (n) => class extends n {
2935
+ }, Ve = (n) => class extends n {
2936
2936
  constructor(...t) {
2937
2937
  super(...t);
2938
2938
  }
2939
2939
  touchStarted(t) {
2940
- this.ga.Eo(t);
2940
+ this._a.ko(t);
2941
2941
  }
2942
2942
  touchMoved(t) {
2943
- this.ga.xh(t);
2943
+ this._a.Mh(t);
2944
2944
  }
2945
2945
  touchEnded(t) {
2946
- this.ga.So(t);
2946
+ this._a.zo(t);
2947
2947
  }
2948
2948
  touchCancelled(t) {
2949
- this.ga.ko(t);
2949
+ this._a.Do(t);
2950
2950
  }
2951
2951
  tap(t) {
2952
- this.ga.zo(t);
2952
+ this._a.Lo(t);
2953
2953
  }
2954
2954
  doubleTap(t) {
2955
- this.ga.Do(t);
2955
+ this._a.Oo(t);
2956
2956
  }
2957
2957
  longPress(t) {
2958
- this.ga.Lo(t);
2958
+ this._a.Io(t);
2959
2959
  }
2960
2960
  swipe(t) {
2961
- this.ga.Oo(t);
2961
+ this._a.Bo(t);
2962
2962
  }
2963
2963
  pinch(t) {
2964
- this.ga.Io(t);
2964
+ this._a.Ho(t);
2965
2965
  }
2966
2966
  rotateGesture(t) {
2967
- this.ga.Bo(t);
2967
+ this._a.Go(t);
2968
2968
  }
2969
2969
  get touches() {
2970
- return this.ga.Ro();
2970
+ return this._a.So();
2971
2971
  }
2972
2972
  }, ke = (n) => class extends n {
2973
2973
  constructor(...t) {
2974
2974
  super(...t);
2975
2975
  }
2976
2976
  keyPressed(t) {
2977
- this.wa.bh(t);
2977
+ this.Ca.Ch(t);
2978
2978
  }
2979
2979
  keyReleased(t) {
2980
- this.wa.Ch(t);
2980
+ this.Ca.xh(t);
2981
2981
  }
2982
2982
  isKeyPressed(t) {
2983
- return this.wa.Oh(t);
2983
+ return this.Ca.Ih(t);
2984
2984
  }
2985
2985
  get lastKeyPressed() {
2986
- return this.wa.Bh();
2986
+ return this.Ca.Hh();
2987
2987
  }
2988
2988
  get lastKeyReleased() {
2989
- return this.wa.Hh();
2989
+ return this.Ca.Gh();
2990
2990
  }
2991
2991
  get pressedKeys() {
2992
- return this.wa.Gh();
2992
+ return this.Ca.Qh();
2993
2993
  }
2994
2994
  get modifierState() {
2995
- return this.wa.Qh();
2995
+ return this.Ca.Nh();
2996
2996
  }
2997
2997
  };
2998
2998
  class He {
2999
2999
  constructor(t) {
3000
- a(this, "ba");
3001
- a(this, "Ca", /* @__PURE__ */ new Map());
3002
- a(this, "xa", []);
3000
+ a(this, "xa");
3003
3001
  a(this, "Ma", /* @__PURE__ */ new Map());
3004
- a(this, "Fa", /* @__PURE__ */ new Map());
3005
- this.ba = t;
3002
+ a(this, "Fa", []);
3003
+ a(this, "Pa", /* @__PURE__ */ new Map());
3004
+ a(this, "$a", /* @__PURE__ */ new Map());
3005
+ this.xa = t;
3006
3006
  }
3007
- async Pa(t) {
3007
+ async Ta(t) {
3008
3008
  for (const e of t) {
3009
- if (this.Ca.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3010
- const i = this.$a(e.name);
3009
+ if (this.Ma.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3010
+ const i = this.Ra(e.name);
3011
3011
  try {
3012
- await e.install(this.ba, i);
3012
+ await e.install(this.xa, i);
3013
3013
  } catch (s) {
3014
- throw this.Ta(e.name), s;
3014
+ throw this.Ea(e.name), s;
3015
3015
  }
3016
- this.Ca.set(e.name, e), this.xa.push(e.name);
3016
+ this.Ma.set(e.name, e), this.Fa.push(e.name);
3017
3017
  }
3018
3018
  }
3019
- async Ra(t) {
3020
- const e = this.Ca.get(t);
3019
+ async Sa(t) {
3020
+ const e = this.Ma.get(t);
3021
3021
  if (!e) return;
3022
- const i = this.$a(t);
3023
- e.uninstall && await e.uninstall(this.ba, i), this.Ca.delete(t), this.xa.splice(this.xa.indexOf(t), 1), this.Ta(t);
3024
- }
3025
- Ea() {
3026
- this.Sa(this.Ma);
3022
+ const i = this.Ra(t);
3023
+ e.uninstall && await e.uninstall(this.xa, i), this.Ma.delete(t), this.Fa.splice(this.Fa.indexOf(t), 1), this.Ea(t);
3027
3024
  }
3028
3025
  ka() {
3029
- this.Sa(this.Fa);
3026
+ this.za(this.Pa);
3030
3027
  }
3031
- async za() {
3032
- const t = [...this.Ca.keys()];
3033
- for (const e of t) await this.Ra(e);
3028
+ Da() {
3029
+ this.za(this.$a);
3034
3030
  }
3035
- $a(t) {
3036
- return { renderer: this.ba.Z, font: this.ba.rr, grid: this.ba.Qn, canvas: this.ba.Er, drawFramebuffer: this.ba.va, asciiFramebuffer: this.ba.Da, registerPreDrawHook: (e) => this.La(this.Ma, t, e), registerPostDrawHook: (e) => this.La(this.Fa, t, e) };
3031
+ async La() {
3032
+ const t = [...this.Ma.keys()];
3033
+ for (const e of t) await this.Sa(e);
3037
3034
  }
3038
- La(t, e, i) {
3035
+ Ra(t) {
3036
+ return { renderer: this.xa.Z, font: this.xa.rr, grid: this.xa.Nn, canvas: this.xa.Er, drawFramebuffer: this.xa.ga, asciiFramebuffer: this.xa.Oa, registerPreDrawHook: (e) => this.Ia(this.Pa, t, e), registerPostDrawHook: (e) => this.Ia(this.$a, t, e) };
3037
+ }
3038
+ Ia(t, e, i) {
3039
3039
  const s = t.get(e) ?? /* @__PURE__ */ new Set();
3040
3040
  return s.add(i), t.set(e, s), () => {
3041
3041
  const r = t.get(e);
3042
3042
  r && (r.delete(i), r.size === 0 && t.delete(e));
3043
3043
  };
3044
3044
  }
3045
- Ta(t) {
3046
- this.Ma.delete(t), this.Fa.delete(t);
3045
+ Ea(t) {
3046
+ this.Pa.delete(t), this.$a.delete(t);
3047
3047
  }
3048
- Sa(t) {
3049
- for (const e of this.xa) {
3048
+ za(t) {
3049
+ for (const e of this.Fa) {
3050
3050
  const i = t.get(e);
3051
3051
  i && i.forEach((s) => s());
3052
3052
  }
3053
3053
  }
3054
3054
  }
3055
3055
  const K = `#version 300 es
3056
- 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
3056
+ in vec2 A0;in vec2 A1;out vec2 v_uv;void main(){v_uv=A1;gl_Position=vec4(A0,0.,1.);}`, Xt = `#version 300 es
3057
3057
  precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`;
3058
- class Bt {
3058
+ class Zt {
3059
3059
  constructor() {
3060
- a(this, "Oa", /* @__PURE__ */ new Map());
3061
- a(this, "Ia", []);
3062
- a(this, "Ba", 0);
3063
- a(this, "Ha", 0);
3064
- a(this, "Ga");
3060
+ a(this, "Ba", /* @__PURE__ */ new Map());
3061
+ a(this, "Ha", []);
3062
+ a(this, "Ga", 0);
3063
+ a(this, "Qa", 0);
3064
+ a(this, "Na");
3065
3065
  }
3066
- get Qa() {
3067
- return this.Ba;
3066
+ get Xa() {
3067
+ return this.Ga;
3068
3068
  }
3069
- get Na() {
3070
- if (this.Ba === 0) return 0;
3069
+ get Ya() {
3070
+ if (this.Ga === 0) return 0;
3071
3071
  let t = 0;
3072
- for (const e of this.Ia) {
3073
- const i = this.Oa.get(e);
3072
+ for (const e of this.Ha) {
3073
+ const i = this.Ba.get(e);
3074
3074
  i && (t += Math.min(1, Math.max(0, i.progress)) * i.weight);
3075
3075
  }
3076
- return Math.min(1, t / this.Ba);
3076
+ return Math.min(1, t / this.Ga);
3077
3077
  }
3078
- Xa(t) {
3079
- this.Ga = t;
3078
+ ja(t) {
3079
+ this.Na = t;
3080
3080
  }
3081
- Ya(t, e = 1) {
3082
- const i = `phase-${this.Ia.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
3083
- return this.Oa.set(i, s), this.Ia.push(i), this.Ba += s.weight, i;
3081
+ Wa(t, e = 1) {
3082
+ const i = `phase-${this.Ha.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
3083
+ return this.Ba.set(i, s), this.Ha.push(i), this.Ga += s.weight, i;
3084
3084
  }
3085
- Wa(t, e) {
3086
- const i = this.Oa.get(t);
3085
+ Ka(t, e) {
3086
+ const i = this.Ba.get(t);
3087
3087
  if (!i) return;
3088
3088
  i.progress = Math.max(0, Math.min(1, e)), i.status = i.progress >= 1 ? "complete" : "running";
3089
- const s = this.Na;
3090
- Math.abs(s - this.Ha) > 1e-3 && (this.Ha = s, this.Ga && this.Ga(s));
3089
+ const s = this.Ya;
3090
+ Math.abs(s - this.Qa) > 1e-3 && (this.Qa = s, this.Na && this.Na(s));
3091
3091
  }
3092
- ja(t) {
3093
- const e = this.Oa.get(t);
3094
- e && (e.progress = 1, e.status = "complete", this.Wa(t, 1));
3092
+ Za(t) {
3093
+ const e = this.Ba.get(t);
3094
+ e && (e.progress = 1, e.status = "complete", this.Ka(t, 1));
3095
3095
  }
3096
- Ka(t) {
3097
- const e = this.Oa.get(t);
3096
+ qa(t) {
3097
+ const e = this.Ba.get(t);
3098
3098
  e && (e.status = "failed");
3099
3099
  }
3100
- Za() {
3101
- return this.Ia.map((t) => {
3102
- const e = this.Oa.get(t);
3100
+ Va() {
3101
+ return this.Ha.map((t) => {
3102
+ const e = this.Ba.get(t);
3103
3103
  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" };
3104
3104
  });
3105
3105
  }
3106
3106
  }
3107
- class Xt {
3107
+ class Ot {
3108
3108
  constructor(t = "active") {
3109
- a(this, "qa");
3110
- a(this, "Va", "");
3111
- a(this, "Ja", "");
3112
- this.qa = t;
3113
- }
3114
- get tc() {
3115
- return this.qa;
3116
- }
3117
- get sc() {
3118
- return this.qa !== "disabled";
3109
+ a(this, "Ja");
3110
+ a(this, "tc", "");
3111
+ a(this, "sc", "");
3112
+ this.Ja = t;
3119
3113
  }
3120
3114
  get ec() {
3121
- return this.qa === "active" || this.qa === "transitioning" || this.qa === "error";
3115
+ return this.Ja;
3122
3116
  }
3123
3117
  get rc() {
3124
- return this.Va;
3118
+ return this.Ja !== "disabled";
3125
3119
  }
3126
3120
  get nc() {
3127
- return this.Ja;
3121
+ return this.Ja === "active" || this.Ja === "transitioning" || this.Ja === "error";
3128
3122
  }
3129
- hc() {
3130
- this.qa !== "done" && this.qa !== "transitioning" || (this.qa = "active");
3123
+ get hc() {
3124
+ return this.tc;
3131
3125
  }
3132
- oc() {
3133
- this.qa !== "disabled" && (this.qa = "done");
3126
+ get oc() {
3127
+ return this.sc;
3134
3128
  }
3135
3129
  ac() {
3136
- this.qa !== "disabled" && (this.qa = "transitioning");
3130
+ this.Ja !== "done" && this.Ja !== "transitioning" || (this.Ja = "active");
3137
3131
  }
3138
3132
  cc() {
3139
- this.qa === "transitioning" && (this.qa = "done");
3133
+ this.Ja !== "disabled" && (this.Ja = "done");
3140
3134
  }
3141
- lc(t) {
3142
- this.qa !== "disabled" && (this.qa = "error", t instanceof Error ? (this.Va = t.message, this.Ja = t.stack || "") : (this.Va = t, this.Ja = ""));
3135
+ lc() {
3136
+ this.Ja !== "disabled" && (this.Ja = "transitioning");
3143
3137
  }
3144
3138
  uc() {
3145
- this.qa = "disabled";
3139
+ this.Ja === "transitioning" && (this.Ja = "done");
3140
+ }
3141
+ fc(t) {
3142
+ this.Ja !== "disabled" && (this.Ja = "error", t instanceof Error ? (this.tc = t.message, this.sc = t.stack || "") : (this.tc = t, this.sc = ""));
3143
+ }
3144
+ dc() {
3145
+ this.Ja = "disabled";
3146
3146
  }
3147
3147
  }
3148
3148
  class It {
3149
3149
  constructor(t, e) {
3150
- a(this, "fc", 0);
3151
- a(this, "dc", 1);
3152
- a(this, "vc");
3153
- a(this, "gc");
3154
- this.vc = t, this.gc = e;
3150
+ a(this, "vc", 0);
3151
+ a(this, "gc", 1);
3152
+ a(this, "mc");
3153
+ a(this, "_c");
3154
+ this.mc = t, this._c = e;
3155
3155
  }
3156
- get mc() {
3157
- return this.dc;
3156
+ get yc() {
3157
+ return this.gc;
3158
3158
  }
3159
- get _c() {
3160
- return this.dc < 1;
3159
+ get bc() {
3160
+ return this.gc < 1;
3161
3161
  }
3162
- Sn() {
3163
- this.vc !== "none" && this.gc > 0 && (this.fc = performance.now());
3162
+ kn() {
3163
+ this.mc !== "none" && this._c > 0 && (this.vc = performance.now());
3164
3164
  }
3165
3165
  et() {
3166
- if (this.vc === "none" || this.gc === 0) return this.dc = 1, !1;
3167
- const t = performance.now() - this.fc, e = Math.min(1, t / this.gc);
3168
- return e >= 1 ? (this.dc = 0, !0) : (this.dc = 1 - e, !1);
3166
+ if (this.mc === "none" || this._c === 0) return this.gc = 1, !1;
3167
+ const t = performance.now() - this.vc, e = Math.min(1, t / this._c);
3168
+ return e >= 1 ? (this.gc = 0, !0) : (this.gc = 1 - e, !1);
3169
3169
  }
3170
3170
  ti() {
3171
- this.dc = 1, this.fc = 0;
3171
+ this.gc = 1, this.vc = 0;
3172
3172
  }
3173
3173
  }
3174
3174
  function dt(n, t) {
@@ -3186,7 +3186,7 @@ function Yt(n) {
3186
3186
  function zt(n, t) {
3187
3187
  return n.length ? n.map((e) => t.color(e)) : [t.color("#FFFFFF")];
3188
3188
  }
3189
- const We = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: o, transitionOpacity: c, isError: l, errorMessage: u }) => {
3189
+ const je = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: o, transitionOpacity: c, isError: l, errorMessage: u }) => {
3190
3190
  const f = "|/-\\", d = Math.floor(i / 6) % 4, g = n.color(h.textColor), m = Math.floor(255 * c), v = n.color(g.r, g.g, g.b, m);
3191
3191
  if (n.charColor(v), n.cellColor(0, 0, 0, 0), l) {
3192
3192
  const A = n.color(h.mode === "light" ? "#D32F2F" : "#FF6B6B", m);
@@ -3195,17 +3195,17 @@ const We = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
3195
3195
  n.push(), n.translate(y, 0, 0);
3196
3196
  for (const E of p) n.char(E), n.rect(1, 1), n.translateX(1);
3197
3197
  if (n.pop(), u) {
3198
- const E = n.color(h.subtleColor), x = n.color(E.r, E.g, E.b, m);
3199
- n.charColor(x);
3200
- const b = Math.floor(0.8 * t.cols), F = u.split(" "), U = [];
3198
+ const E = n.color(h.subtleColor), b = n.color(E.r, E.g, E.b, m);
3199
+ n.charColor(b);
3200
+ const x = Math.floor(0.8 * t.cols), F = u.split(" "), N = [];
3201
3201
  let T = "";
3202
- for (const P of F) (T + " " + P).length <= b ? T = T ? T + " " + P : P : (T && U.push(T), T = P);
3203
- T && U.push(T);
3204
- const Z = U.slice(0, 3);
3205
- U.length > 3 && (Z[2] = Z[2].substring(0, b - 3) + "..."), Z.forEach((P, j) => {
3206
- const qt = -Math.floor(P.length / 2);
3207
- n.push(), n.translate(qt, 3 + j, 0);
3208
- for (const Kt of P) n.char(Kt), n.rect(1, 1), n.translateX(1);
3202
+ for (const C of F) (T + " " + C).length <= x ? T = T ? T + " " + C : C : (T && N.push(T), T = C);
3203
+ T && N.push(T);
3204
+ const S = N.slice(0, 3);
3205
+ N.length > 3 && (S[2] = S[2].substring(0, x - 3) + "..."), S.forEach((C, Q) => {
3206
+ const Wt = -Math.floor(C.length / 2);
3207
+ n.push(), n.translate(Wt, 3 + Q, 0);
3208
+ for (const Kt of C) n.char(Kt), n.rect(1, 1), n.translateX(1);
3209
3209
  n.pop();
3210
3210
  });
3211
3211
  }
@@ -3214,9 +3214,9 @@ const We = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
3214
3214
  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")) {
3215
3215
  const A = Math.max(6, Math.floor(0.6 * t.cols)), p = -Math.floor(A / 2), y = Math.floor(A * e), E = r.length ? r : [n.color("#FFFFFF")];
3216
3216
  n.push(), n.translate(p, 3, 0);
3217
- for (let x = 0; x < A; x++) {
3218
- const b = x < y ? "*" : ".", F = E[x % E.length], U = n.color(F.r, F.g, F.b, m);
3219
- n.charColor(U), n.char(b), n.rect(1, 1), n.translateX(1);
3217
+ for (let b = 0; b < A; b++) {
3218
+ const x = b < y ? "*" : ".", F = E[b % E.length], N = n.color(F.r, F.g, F.b, m);
3219
+ n.charColor(N), n.char(x), n.rect(1, 1), n.translateX(1);
3220
3220
  }
3221
3221
  n.pop();
3222
3222
  }
@@ -3228,19 +3228,19 @@ const We = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
3228
3228
  for (const E of s) n.char(E), n.rect(1, 1), n.translateX(1);
3229
3229
  n.pop();
3230
3230
  }
3231
- }, qe = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
3231
+ }, We = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
3232
3232
  class Ke {
3233
3233
  constructor(t, e, i) {
3234
- this.yc = t, this.id = e, this.label = i;
3234
+ this.wc = t, this.id = e, this.label = i;
3235
3235
  }
3236
3236
  report(t) {
3237
- this.yc.Wa(this.id, t);
3237
+ this.wc.Ka(this.id, t);
3238
3238
  }
3239
3239
  complete() {
3240
- this.yc.ja(this.id);
3240
+ this.wc.Za(this.id);
3241
3241
  }
3242
3242
  fail(t) {
3243
- this.yc.Ka(this.id);
3243
+ this.wc.qa(this.id);
3244
3244
  }
3245
3245
  async track(t) {
3246
3246
  try {
@@ -3253,104 +3253,104 @@ class Ke {
3253
3253
  }
3254
3254
  class Gt {
3255
3255
  constructor(t, e, i) {
3256
- a(this, "ba");
3256
+ a(this, "xa");
3257
3257
  a(this, "l");
3258
- a(this, "wc");
3259
- a(this, "yc");
3260
- a(this, "bc");
3261
3258
  a(this, "Cc");
3259
+ a(this, "wc");
3262
3260
  a(this, "xc");
3263
3261
  a(this, "Mc");
3264
3262
  a(this, "Fc");
3265
3263
  a(this, "Pc");
3266
- a(this, "Z");
3267
- a(this, "$c", []);
3264
+ a(this, "$c");
3268
3265
  a(this, "Tc");
3269
- a(this, "Rc", performance.now());
3270
- a(this, "Ec", 0);
3271
- a(this, "Sc", !1);
3272
- a(this, "kc", !1);
3273
- a(this, "Oc");
3274
- this.ba = t, this.l = { ...qe, ...e ?? {} }, this.wc = new Xt("active"), this.yc = new Bt(), this.bc = new It(this.l.transition, this.l.transitionDuration), this.Cc = new Lt(60), this.Tc = dt(this.l, i);
3275
- const s = Yt(this.Tc);
3276
- this.$c = zt(s, this.ba), this.Z = this.zc(), this.yc.Xa((r) => {
3277
- r >= 0.999 && this.oc();
3266
+ a(this, "Z");
3267
+ a(this, "Rc", []);
3268
+ a(this, "Ec");
3269
+ a(this, "Sc", performance.now());
3270
+ a(this, "kc", 0);
3271
+ a(this, "zc", !1);
3272
+ a(this, "Dc", !1);
3273
+ a(this, "Bc");
3274
+ this.xa = t, this.l = { ...We, ...e ?? {} }, this.Cc = new Ot("active"), this.wc = new Zt(), this.xc = new It(this.l.transition, this.l.transitionDuration), this.Mc = new Dt(60), this.Ec = dt(this.l, i);
3275
+ const s = Yt(this.Ec);
3276
+ this.Rc = zt(s, this.xa), this.Z = this.Lc(), this.wc.ja((r) => {
3277
+ r >= 0.999 && this.cc();
3278
3278
  });
3279
3279
  }
3280
3280
  async yr(t) {
3281
- if (this.kc) return;
3282
- const e = this.ba.Z, i = this.ba.Er;
3283
- this.xc = new mt(e, 16), await this.xc.yr(t);
3284
- const s = this.xc.maxGlyphDimensions;
3285
- this.Mc = new St(i.canvas, s.width, s.height), this.Fc = e.Pe(this.Mc.cols, this.Mc.rows, 3), this.Pc = e.Pe(this.Mc.width, this.Mc.height, 1), this.kc = !0;
3281
+ if (this.Dc) return;
3282
+ const e = this.xa.Z, i = this.xa.Er;
3283
+ this.Fc = new mt(e, 16), await this.Fc.yr(t);
3284
+ const s = this.Fc.maxGlyphDimensions;
3285
+ this.Pc = new Ut(i.canvas, s.width, s.height), this.$c = e.Pe(this.Pc.cols, this.Pc.rows, 3), this.Tc = e.Pe(this.Pc.width, this.Pc.height, 1), this.Dc = !0;
3286
3286
  }
3287
- get ec() {
3288
- return this.wc.ec && this.Sc;
3289
- }
3290
- Sn() {
3291
- this.Sc || (this.Sc = !0, this.Rc = performance.now(), this.Ec = 0, this.Cc.Sn(() => this.Dc()));
3287
+ get nc() {
3288
+ return this.Cc.nc && this.zc;
3292
3289
  }
3293
3290
  kn() {
3294
- this.Sc && (this.Sc = !1, this.Cc.kn());
3291
+ this.zc || (this.zc = !0, this.Sc = performance.now(), this.kc = 0, this.Mc.kn(() => this.Oc()));
3292
+ }
3293
+ zn() {
3294
+ this.zc && (this.zc = !1, this.Mc.zn());
3295
3295
  }
3296
3296
  Xr() {
3297
- this.kc && (this.Mc.ti(), this.Fc.resize(this.Mc.cols, this.Mc.rows), this.Pc.resize(this.Mc.width, this.Mc.height));
3297
+ this.Dc && (this.Pc.ti(), this.$c.resize(this.Pc.cols, this.Pc.rows), this.Tc.resize(this.Pc.width, this.Pc.height));
3298
3298
  }
3299
3299
  gt() {
3300
- this.kn(), this.kc && (this.xc.gt(), this.Fc.gt(), this.Pc.gt(), this.kc = !1);
3300
+ this.zn(), this.Dc && (this.Fc.gt(), this.$c.gt(), this.Tc.gt(), this.Dc = !1);
3301
3301
  }
3302
3302
  get progress() {
3303
- return this.yc.Na;
3303
+ return this.wc.Ya;
3304
3304
  }
3305
3305
  message(t) {
3306
3306
  return typeof t == "string" && (this.l.message = t), this.l.message;
3307
3307
  }
3308
3308
  addPhase(t, e = 1) {
3309
- this.wc.hc();
3310
- const i = this.yc.Ya(t, e);
3311
- return new Ke(this.yc, i, t);
3309
+ this.Cc.ac();
3310
+ const i = this.wc.Wa(t, e);
3311
+ return new Ke(this.wc, i, t);
3312
3312
  }
3313
- oc() {
3314
- this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.wc.ac(), this.bc.Sn()) : (this.wc.oc(), this.kn(), this.Lc());
3313
+ cc() {
3314
+ this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.Cc.lc(), this.xc.kn()) : (this.Cc.cc(), this.zn(), this.Ic());
3315
3315
  }
3316
- Lc() {
3317
- this.Oc && this.Oc();
3316
+ Ic() {
3317
+ this.Bc && this.Bc();
3318
3318
  }
3319
- Ic(t) {
3320
- this.Oc = t;
3319
+ Hc(t) {
3320
+ this.Bc = t;
3321
3321
  }
3322
3322
  error(t) {
3323
- this.wc.lc(t);
3323
+ this.Cc.fc(t);
3324
3324
  }
3325
- Dc() {
3326
- if (this.wc.ec) {
3327
- if (this.Ec++, this.wc.tc === "transitioning" && this.bc.et())
3328
- return this.wc.cc(), this.Lc(), void this.kn();
3329
- this.Bc();
3325
+ Oc() {
3326
+ if (this.Cc.nc) {
3327
+ if (this.kc++, this.Cc.ec === "transitioning" && this.xc.et())
3328
+ return this.Cc.uc(), this.Ic(), void this.zn();
3329
+ this.Gc();
3330
3330
  }
3331
3331
  }
3332
- Bc() {
3333
- if (!this.kc) return;
3334
- const t = this.Fc, e = this.xc, i = this.Mc, s = this.Pc, r = this.ba.Z, h = this.ba.Er, o = this.ba.Hc, c = this.ba.Gc;
3335
- r.state.qt(), t.begin(), this.ba.clear(), this.ba.push();
3332
+ Gc() {
3333
+ if (!this.Dc) return;
3334
+ const t = this.$c, e = this.Fc, i = this.Pc, s = this.Tc, r = this.xa.Z, h = this.xa.Er, o = this.xa.Qc, c = this.xa.Nc;
3335
+ r.state.qt(), t.begin(), this.xa.clear(), this.xa.push();
3336
3336
  try {
3337
- const l = { textmodifier: this.ba, grid: i, progress: this.progress, elapsedMs: performance.now() - this.Rc, frameCount: this.Ec, message: this.l.message, palette: this.$c, theme: this.Tc, phases: this.yc.Za(), transitionOpacity: this.bc.mc, isError: this.wc.tc === "error", errorMessage: this.wc.rc || void 0, errorDetails: this.wc.nc || void 0 };
3337
+ const l = { textmodifier: this.xa, grid: i, progress: this.progress, elapsedMs: performance.now() - this.Sc, frameCount: this.kc, message: this.l.message, palette: this.Rc, theme: this.Ec, phases: this.wc.Va(), transitionOpacity: this.xc.yc, isError: this.Cc.ec === "error", errorMessage: this.Cc.hc || void 0, errorDetails: this.Cc.oc || void 0 };
3338
3338
  this.Z(l);
3339
3339
  } finally {
3340
- this.ba.pop();
3340
+ this.xa.pop();
3341
3341
  }
3342
- t.end(), s.begin(), r.ve(o), o.O({ u_characterTexture: e.fontFramebuffer, u_charsetDimensions: [e.textureColumns, e.textureRows], Ue: t.textures[0], Uc: t.textures[1], Ud: t.textures[2], Uf: [i.cols, i.rows], Ug: [s.width, s.height], Uh: r.state.canvasBackgroundColor }), r.Ae(0, 0, h.width, h.height), s.end(), r.wi(...r.state.canvasBackgroundColor), r.ve(c), c.O({ Ui: s.textures[0], Uj: [s.width, s.height], Uk: [i.offsetX, i.offsetY], Ul: [i.width, i.height] }), r.Ae(i.offsetX, i.offsetY, i.width, i.height);
3342
+ t.end(), s.begin(), r.ve(o), o.O({ u_characterTexture: e.fontFramebuffer, u_charsetDimensions: [e.textureColumns, e.textureRows], Ud: t.textures[0], Ue: t.textures[1], Uf: t.textures[2], Ug: [i.cols, i.rows], Uh: [s.width, s.height], Ui: r.state.canvasBackgroundColor }), r.Ae(0, 0, h.width, h.height), s.end(), r.bi(...r.state.canvasBackgroundColor), r.ve(c), c.O({ u_texture: s.textures[0] }), r.Ae(i.offsetX, i.offsetY, i.width, i.height);
3343
3343
  }
3344
- Qc(t) {
3345
- this.Tc = dt(this.l, t);
3344
+ Xc(t) {
3345
+ this.Ec = dt(this.l, t);
3346
3346
  }
3347
- zc() {
3348
- const t = this.l.renderer || We;
3347
+ Lc() {
3348
+ const t = this.l.renderer || je;
3349
3349
  return (e) => {
3350
- t(e), this.Nc(e);
3350
+ t(e), this.Yc(e);
3351
3351
  };
3352
3352
  }
3353
- Nc(t) {
3353
+ Yc(t) {
3354
3354
  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]];
3355
3355
  e.push(), e.translate(l, c, 0);
3356
3356
  for (let f = 0; f < o.length; f++) {
@@ -3362,221 +3362,221 @@ class Gt {
3362
3362
  }
3363
3363
  class gt {
3364
3364
  constructor(t = {}) {
3365
- a(this, "Xc");
3366
- a(this, "mc");
3367
- a(this, "Yc");
3368
- a(this, "Wc");
3369
3365
  a(this, "jc");
3366
+ a(this, "yc");
3367
+ a(this, "Wc");
3370
3368
  a(this, "Kc");
3371
3369
  a(this, "Zc");
3372
3370
  a(this, "qc");
3373
3371
  a(this, "Vc");
3374
3372
  a(this, "Jc");
3375
- a(this, "tl", null);
3376
- a(this, "sl", !1);
3377
- a(this, "il", !0);
3378
- a(this, "el", []);
3379
- this.Xc = t.visible ?? !0, this.mc = Math.min(1, Math.max(0, t.opacity ?? 1)), this.Yc = t.blendMode ?? "normal", this.Wc = Math.round(t.offsetX ?? 0), this.jc = Math.round(t.offsetY ?? 0), this.Kc = t.rotation ?? 0;
3373
+ a(this, "tl");
3374
+ a(this, "sl");
3375
+ a(this, "il", null);
3376
+ a(this, "el", !1);
3377
+ a(this, "rl", !0);
3378
+ a(this, "nl", []);
3379
+ this.jc = t.visible ?? !0, this.yc = Math.min(1, Math.max(0, t.opacity ?? 1)), this.Wc = t.blendMode ?? "normal", this.Kc = Math.round(t.offsetX ?? 0), this.Zc = Math.round(t.offsetY ?? 0), this.qc = t.rotation ?? 0;
3380
3380
  }
3381
- rl() {
3382
- return this.tl !== null;
3381
+ hl() {
3382
+ return this.il !== null;
3383
3383
  }
3384
- nl() {
3385
- const t = this.el;
3386
- return this.el = [], t;
3384
+ ol() {
3385
+ const t = this.nl;
3386
+ return this.nl = [], t;
3387
3387
  }
3388
- hl(t) {
3389
- this.tl && this.tl.call(t);
3388
+ al(t) {
3389
+ this.il && this.il.call(t);
3390
3390
  }
3391
3391
  draw(t) {
3392
- this.tl = t;
3392
+ this.il = t;
3393
3393
  }
3394
3394
  show() {
3395
- this.Xc = !0;
3395
+ this.jc = !0;
3396
3396
  }
3397
3397
  hide() {
3398
- this.Xc = !1;
3398
+ this.jc = !1;
3399
3399
  }
3400
3400
  opacity(t) {
3401
- if (t === void 0) return this.mc;
3402
- this.mc = Math.min(1, Math.max(0, t));
3401
+ if (t === void 0) return this.yc;
3402
+ this.yc = Math.min(1, Math.max(0, t));
3403
3403
  }
3404
3404
  blendMode(t) {
3405
- if (t === void 0) return this.Yc;
3406
- this.Yc = t;
3405
+ if (t === void 0) return this.Wc;
3406
+ this.Wc = t;
3407
3407
  }
3408
3408
  offset(t, e = 0) {
3409
- if (t === void 0) return { x: this.Wc, y: this.jc };
3410
- this.Wc = Math.round(t), this.jc = Math.round(e);
3409
+ if (t === void 0) return { x: this.Kc, y: this.Zc };
3410
+ this.Kc = Math.round(t), this.Zc = Math.round(e);
3411
3411
  }
3412
3412
  rotateZ(t) {
3413
- if (t === void 0) return this.Kc;
3414
- this.Kc = t;
3413
+ if (t === void 0) return this.qc;
3414
+ this.qc = t;
3415
3415
  }
3416
3416
  filter(t, e) {
3417
- this.el.push({ name: t, params: e });
3417
+ this.nl.push({ name: t, params: e });
3418
3418
  }
3419
- ol(t) {
3420
- this.Zc = t, this.al(t.grid);
3419
+ cl(t) {
3420
+ this.Vc = t, this.ll(t.grid);
3421
3421
  }
3422
- ya(t, e) {
3423
- if (!this.Xc || !this.tl) return void (this.sl = !1);
3424
- const i = this.Zc.renderer;
3425
- this.el = [], this.qc.begin(), i.state.qt(), this.tl.call(t), this.qc.end();
3426
- const s = this.el.length > 0, r = s ? this.Jc : this.Vc;
3427
- r.begin(), i.ve(e), e.O({ u_characterTexture: this.Zc.font.fontFramebuffer, u_charsetDimensions: [this.Zc.font.textureColumns, this.Zc.font.textureRows], Ue: this.qc.textures[0], Uc: this.qc.textures[1], Ud: this.qc.textures[2], Uf: [this.Zc.grid.cols, this.Zc.grid.rows], Ug: [r.width, r.height], Uh: [0, 0, 0, 0] }), i.Ae(0, 0, this.Zc.grid.width, this.Zc.grid.height), r.end(), s && this.Zc.filterManager.cl(this.Jc.textures[0], this.Vc, this.el, this.Vc.width, this.Vc.height, this.Zc.layerPingPongBuffers), this.sl = !0;
3422
+ wa(t, e) {
3423
+ if (!this.jc || !this.il) return void (this.el = !1);
3424
+ const i = this.Vc.renderer;
3425
+ this.nl = [], this.Jc.begin(), i.state.qt(), this.il.call(t), this.Jc.end();
3426
+ const s = this.nl.length > 0, r = s ? this.sl : this.tl;
3427
+ r.begin(), i.bi(0, 0, 0, 0), i.ve(e), e.O({ u_characterTexture: this.Vc.font.fontFramebuffer, u_charsetDimensions: [this.Vc.font.textureColumns, this.Vc.font.textureRows], Ud: this.Jc.textures[0], Ue: this.Jc.textures[1], Uf: this.Jc.textures[2], Ug: [this.Vc.grid.cols, this.Vc.grid.rows], Uh: [r.width, r.height], Ui: [0, 0, 0, 0] }), i.Ae(0, 0, this.Vc.grid.width, this.Vc.grid.height), r.end(), s && this.Vc.filterManager.ul(this.sl.textures[0], this.tl, this.nl, this.tl.width, this.tl.height, this.Vc.layerPingPongBuffers), this.el = !0;
3428
3428
  }
3429
3429
  Xr(t) {
3430
3430
  var e;
3431
- this.Zc && (this.Zc = { ...this.Zc, grid: t }), this.qc && this.Vc && (this.qc.resize(t.cols, t.rows), this.Vc.resize(t.width, t.height), (e = this.Jc) == null || e.resize(t.width, t.height));
3431
+ this.Vc && (this.Vc = { ...this.Vc, grid: t }), this.Jc && this.tl && (this.Jc.resize(t.cols, t.rows), this.tl.resize(t.width, t.height), (e = this.sl) == null || e.resize(t.width, t.height));
3432
3432
  }
3433
3433
  gt() {
3434
3434
  var t, e, i;
3435
- this.il && ((t = this.qc) == null || t.gt(), (e = this.Vc) == null || e.gt(), (i = this.Jc) == null || i.gt());
3435
+ this.rl && ((t = this.Jc) == null || t.gt(), (e = this.tl) == null || e.gt(), (i = this.sl) == null || i.gt());
3436
3436
  }
3437
3437
  get texture() {
3438
3438
  var t;
3439
- return (t = this.Vc) == null ? void 0 : t.textures[0];
3439
+ return (t = this.tl) == null ? void 0 : t.textures[0];
3440
3440
  }
3441
3441
  get width() {
3442
- return this.Vc ? this.Vc.width : 0;
3442
+ return this.tl ? this.tl.width : 0;
3443
3443
  }
3444
3444
  get height() {
3445
- return this.Vc ? this.Vc.height : 0;
3445
+ return this.tl ? this.tl.height : 0;
3446
3446
  }
3447
- get ll() {
3448
- return this.sl;
3447
+ get fl() {
3448
+ return this.el;
3449
3449
  }
3450
3450
  get drawFramebuffer() {
3451
- return this.qc;
3451
+ return this.Jc;
3452
3452
  }
3453
- al(t) {
3454
- this.Zc && (this.qc = this.Zc.externalDrawFramebuffer ?? this.Zc.createFramebuffer(t.cols, t.rows, 4), this.Vc = this.Zc.externalAsciiFramebuffer ?? this.Zc.createFramebuffer(t.width, t.height, 1), this.Zc.externalAsciiFramebuffer || (this.Jc = this.Zc.createFramebuffer(t.width, t.height, 1)), this.il = !this.Zc.externalDrawFramebuffer && !this.Zc.externalAsciiFramebuffer, this.sl = !1);
3453
+ ll(t) {
3454
+ this.Vc && (this.Jc = this.Vc.externalDrawFramebuffer ?? this.Vc.createFramebuffer(t.cols, t.rows, 4), this.tl = this.Vc.externalAsciiFramebuffer ?? this.Vc.createFramebuffer(t.width, t.height, 1), this.Vc.externalAsciiFramebuffer || (this.sl = this.Vc.createFramebuffer(t.width, t.height, 1)), this.rl = !this.Vc.externalDrawFramebuffer && !this.Vc.externalAsciiFramebuffer, this.el = !1);
3455
3455
  }
3456
3456
  }
3457
- const xt = { normal: 0, additive: 1, multiply: 2, screen: 3, subtract: 4, darken: 5, lighten: 6, overlay: 7, softLight: 8, hardLight: 9, colorDodge: 10, colorBurn: 11, difference: 12, exclusion: 13 };
3458
- class Qt {
3457
+ const bt = { normal: 0, additive: 1, multiply: 2, screen: 3, subtract: 4, darken: 5, lighten: 6, overlay: 7, softLight: 8, hardLight: 9, colorDodge: 10, colorBurn: 11, difference: 12, exclusion: 13 };
3458
+ class Vt {
3459
3459
  constructor(t) {
3460
3460
  a(this, "Z");
3461
- a(this, "ul");
3462
- a(this, "fl", null);
3463
- a(this, "dl", 0);
3464
- this.Z = t, this.ul = t.pe(K, `#version 300 es
3465
- precision highp float;uniform sampler2D Uq;uniform sampler2D Ur;uniform vec2 Us;uniform vec2 Ut;uniform vec2 Uu;uniform float Uv;uniform vec2 Uw;uniform float Ux;uniform int Uy;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(Ur,v_uv);vec2 h=v_uv*Us;vec2 i=h-Uu-Uw;vec2 j=Ut*0.5;vec2 k=i-j;float l=cos(-Ux);float m=sin(-Ux);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,Ut));if(o){fragColor=g;return;}vec2 p=(floor(i)+0.5)/Ut;vec4 q=texture(Uq,p);float r=q.a*Uv;if(r<=0.){fragColor=g;return;}vec3 s=e(Uy,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`);
3461
+ a(this, "dl");
3462
+ a(this, "vl", null);
3463
+ a(this, "pl", 0);
3464
+ this.Z = t, this.dl = t.pe(K, `#version 300 es
3465
+ precision highp float;uniform sampler2D Uj;uniform sampler2D Uk;uniform vec2 Ul;uniform vec2 Um;uniform vec2 Un;uniform float Uo;uniform vec2 Up;uniform float Uq;uniform int Ur;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(Uk,v_uv);vec2 h=v_uv*Ul;vec2 i=h-Un-Up;vec2 j=Um*0.5;vec2 k=i-j;float l=cos(-Uq);float m=sin(-Uq);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,Um));if(o){fragColor=g;return;}vec2 p=(floor(i)+0.5)/Um;vec4 q=texture(Uj,p);float r=q.a*Uo;if(r<=0.){fragColor=g;return;}vec3 s=e(Ur,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`);
3466
3466
  }
3467
3467
  yr(t, e) {
3468
- this.fl || (this.fl = [this.Z.Pe(t, e, 1), this.Z.Pe(t, e, 1)]);
3468
+ this.vl || (this.vl = [this.Z.Pe(t, e, 1), this.Z.Pe(t, e, 1)]);
3469
3469
  }
3470
- vl(t) {
3470
+ ml(t) {
3471
3471
  const e = this.Z.context, { baseTexture: i, targetFramebuffer: s, backgroundColor: r, baseLayer: h, layers: o, canvasWidth: c, canvasHeight: l, gridWidth: u, gridHeight: f, baseOffsetX: d, baseOffsetY: g } = t, m = e.isEnabled(e.DEPTH_TEST), v = e.getParameter(e.DEPTH_WRITEMASK);
3472
3472
  m && e.disable(e.DEPTH_TEST), v && e.depthMask(!1);
3473
- const A = this.fl[0];
3474
- A.begin(), this.Z.wi(...r), A.end(), this.dl = 0, h.Xc && this.pl(i, c, l, u, f, h.mc, d + h.Wc, g + h.jc, h.Kc, "normal", e);
3475
- for (const p of o) p.Xc && p.ll && this.pl(p.texture, c, l, p.width, p.height, p.mc, d + p.Wc, g + p.jc, p.Kc, p.Yc, e);
3476
- this.ml(s, c, l, e), e.depthMask(v), m && e.enable(e.DEPTH_TEST);
3473
+ const A = this.vl[0], p = this.vl[1];
3474
+ A.begin(), this.Z.bi(...r), A.end(), p.begin(), this.Z.bi(0, 0, 0, 0), p.end(), this.pl = 0, h.jc && this._l(i, c, l, u, f, h.yc, d + h.Kc, g + h.Zc, h.qc, "normal", e);
3475
+ for (const y of o) y.jc && y.fl && this._l(y.texture, c, l, y.width, y.height, y.yc, d + y.Kc, g + y.Zc, y.qc, y.Wc, e);
3476
+ this.yl(s, c, l, e), e.depthMask(v), m && e.enable(e.DEPTH_TEST);
3477
3477
  }
3478
- pl(t, e, i, s, r, h, o, c, l, u, f) {
3479
- const d = this.fl[this.dl], g = this.dl === 0 ? 1 : 0, m = this.fl[g], v = l * (Math.PI / 180);
3480
- m.begin(), f.disable(f.BLEND), this.Z.ve(this.ul), this.ul.O({ Uq: t, Ur: d.textures[0], Us: [e, i], Ut: [s, r], Uu: [o, c], Uv: h, Uw: [0, 0], Ux: v, Uy: xt[u] }), this.Z.Ae(0, 0, d.width, d.height), m.end(), this.dl = g;
3478
+ _l(t, e, i, s, r, h, o, c, l, u, f) {
3479
+ const d = this.vl[this.pl], g = this.pl === 0 ? 1 : 0, m = this.vl[g], v = l * (Math.PI / 180);
3480
+ m.begin(), f.disable(f.BLEND), this.Z.ve(this.dl), this.dl.O({ Uj: t, Uk: d.textures[0], Ul: [e, i], Um: [s, r], Un: [o, c], Uo: h, Up: [0, 0], Uq: v, Ur: bt[u] }), this.Z.Ae(0, 0, d.width, d.height), m.end(), this.pl = g;
3481
3481
  }
3482
- ml(t, e, i, s) {
3483
- const r = this.fl[this.dl];
3484
- t.begin(), s.disable(s.BLEND), this.Z.ve(this.ul), this.ul.O({ Uq: r.textures[0], Ur: r.textures[0], Us: [e, i], Ut: [r.width, r.height], Uu: [0, 0], Uv: 1, Uw: [0, 0], Ux: 0, Uy: xt.normal }), this.Z.Ae(0, 0, e, i), t.end();
3482
+ yl(t, e, i, s) {
3483
+ const r = this.vl[this.pl];
3484
+ t.begin(), s.disable(s.BLEND), this.Z.ve(this.dl), this.dl.O({ Uj: r.textures[0], Uk: r.textures[0], Ul: [e, i], Um: [r.width, r.height], Un: [0, 0], Uo: 1, Up: [0, 0], Uq: 0, Ur: bt.normal }), this.Z.Ae(0, 0, e, i), t.end();
3485
3485
  }
3486
3486
  Xr(t, e) {
3487
- this.fl && (this.fl[0].resize(t, e), this.fl[1].resize(t, e));
3487
+ this.vl && (this.vl[0].resize(t, e), this.vl[1].resize(t, e));
3488
3488
  }
3489
3489
  gt() {
3490
- this.ul.dispose(), this.fl && (this.fl[0].gt(), this.fl[1].gt(), this.fl = null);
3490
+ this.dl.dispose(), this.vl && (this.vl[0].gt(), this.vl[1].gt(), this.vl = null);
3491
3491
  }
3492
3492
  }
3493
3493
  class kt {
3494
3494
  constructor(t) {
3495
- a(this, "ba");
3495
+ a(this, "xa");
3496
3496
  a(this, "Z");
3497
- a(this, "_l");
3498
- a(this, "yl");
3499
- a(this, "Al", []);
3500
- a(this, "wl", []);
3497
+ a(this, "Al");
3501
3498
  a(this, "bl");
3502
- a(this, "Cl");
3499
+ a(this, "wl", []);
3500
+ a(this, "Cl", []);
3503
3501
  a(this, "xl");
3504
3502
  a(this, "Ml");
3505
- a(this, "Fl", !1);
3506
- this.ba = t, this.Z = t.Z, this._l = t.Hc, this.yl = new Qt(this.Z), this.bl = new gt({ visible: !0, opacity: 1 });
3503
+ a(this, "Fl");
3504
+ a(this, "Pl");
3505
+ a(this, "$l", !1);
3506
+ this.xa = t, this.Z = t.Z, this.Al = t.Qc, this.bl = new Vt(this.Z), this.xl = new gt({ visible: !0, opacity: 1 });
3507
3507
  }
3508
3508
  add(t = {}) {
3509
3509
  const e = new gt(t);
3510
- return this.Fl ? (this.Pl(e), this.wl.push(e)) : this.Al.push(e), e;
3510
+ return this.$l ? (this.Tl(e), this.Cl.push(e)) : this.wl.push(e), e;
3511
3511
  }
3512
3512
  remove(t) {
3513
- this.$l(this.wl, t) || this.$l(this.Al, t);
3513
+ this.Rl(this.Cl, t) || this.Rl(this.wl, t);
3514
3514
  }
3515
3515
  move(t, e) {
3516
- this.Tl(this.wl, t, e) || this.Tl(this.Al, t, e);
3516
+ this.El(this.Cl, t, e) || this.El(this.wl, t, e);
3517
3517
  }
3518
3518
  swap(t, e) {
3519
- t !== e && (this.Rl(this.wl, t, e) || this.Rl(this.Al, t, e));
3519
+ t !== e && (this.Sl(this.Cl, t, e) || this.Sl(this.wl, t, e));
3520
3520
  }
3521
3521
  yr() {
3522
- if (this.Fl) return;
3523
- const t = this.ba.Qn;
3524
- this.Cl = this.Z.Pe(t.width, t.height, 1), this.xl = this.Z.Pe(t.width, t.height, 1), this.Ml = [this.Z.Pe(t.width, t.height, 1, { depth: !1 }), this.Z.Pe(t.width, t.height, 1, { depth: !1 })], this.El(), this.yl.yr(this.ba.Er.width, this.ba.Er.height);
3525
- for (const e of this.Al) this.Pl(e), this.wl.push(e);
3526
- this.Al.length = 0, this.Fl = !0;
3522
+ if (this.$l) return;
3523
+ const t = this.xa.Nn;
3524
+ this.Ml = this.Z.Pe(t.width, t.height, 1), this.Fl = this.Z.Pe(t.width, t.height, 1), this.Pl = [this.Z.Pe(t.width, t.height, 1, { depth: !1 }), this.Z.Pe(t.width, t.height, 1, { depth: !1 })], this.kl(), this.bl.yr(this.xa.Er.width, this.xa.Er.height);
3525
+ for (const e of this.wl) this.Tl(e), this.Cl.push(e);
3526
+ this.wl.length = 0, this.$l = !0;
3527
3527
  }
3528
- Sl(t, e) {
3529
- const i = this.ba.Qn, s = this.ba.font, r = this.ba.va, h = this.bl.nl(), o = h.length > 0, c = o ? this.xl : this.Cl;
3530
- c.begin(), this.Z.ve(this._l), this._l.O({ u_characterTexture: s.fontFramebuffer, u_charsetDimensions: [s.textureColumns, s.textureRows], Ue: r.textures[0], Uc: r.textures[1], Ud: r.textures[2], Uf: [i.cols, i.rows], Ug: [c.width, c.height], Uh: this.Z.state.canvasBackgroundColor }), this.Z.Ae(0, 0, i.width, i.height), c.end(), o && this.ba.kl.cl(this.xl.textures[0], this.Cl, h, this.Cl.width, this.Cl.height, this.Ml), this.zl(), this.Dl(t, e);
3528
+ zl(t, e) {
3529
+ const i = this.xa.Nn, s = this.xa.font, r = this.xa.ga, h = this.xl.ol(), o = h.length > 0, c = o ? this.Fl : this.Ml;
3530
+ c.begin(), this.Z.bi(0, 0, 0, 0), this.Z.ve(this.Al), this.Al.O({ u_characterTexture: s.fontFramebuffer, u_charsetDimensions: [s.textureColumns, s.textureRows], Ud: r.textures[0], Ue: r.textures[1], Uf: r.textures[2], Ug: [i.cols, i.rows], Uh: [c.width, c.height], Ui: this.Z.state.canvasBackgroundColor }), this.Z.Ae(0, 0, i.width, i.height), c.end(), o && this.xa.Dl.ul(this.Fl.textures[0], this.Ml, h, this.Ml.width, this.Ml.height, this.Pl), this.Ll(), this.Ol(t, e);
3531
3531
  }
3532
- zl() {
3533
- if (this.wl.length !== 0) for (const t of this.wl) t.ya(this.ba, this._l);
3532
+ Ll() {
3533
+ if (this.Cl.length !== 0) for (const t of this.Cl) t.wa(this.xa, this.Al);
3534
3534
  }
3535
- Dl(t, e) {
3536
- const i = this.ba.Qn, s = this.ba.Er;
3537
- this.yl.vl({ baseTexture: this.Cl.textures[0], targetFramebuffer: t, backgroundColor: e, baseLayer: this.bl, layers: this.wl, canvasWidth: s.width, canvasHeight: s.height, gridWidth: i.width, gridHeight: i.height, baseOffsetX: i.offsetX, baseOffsetY: i.offsetY });
3535
+ Ol(t, e) {
3536
+ const i = this.xa.Nn, s = this.xa.Er;
3537
+ this.bl.ml({ baseTexture: this.Ml.textures[0], targetFramebuffer: t, backgroundColor: e, baseLayer: this.xl, layers: this.Cl, canvasWidth: s.width, canvasHeight: s.height, gridWidth: i.width, gridHeight: i.height, baseOffsetX: i.offsetX, baseOffsetY: i.offsetY });
3538
3538
  }
3539
3539
  Xr() {
3540
- if (!this.Fl) return;
3541
- const t = this.ba.Qn;
3542
- this.Cl.resize(t.width, t.height), this.xl.resize(t.width, t.height), this.bl.Xr(t), this.Ml && (this.Ml[0].resize(t.width, t.height), this.Ml[1].resize(t.width, t.height));
3543
- for (const e of this.wl) e.Xr(t);
3544
- this.yl.Xr(this.ba.Er.width, this.ba.Er.height);
3540
+ if (!this.$l) return;
3541
+ const t = this.xa.Nn;
3542
+ this.Ml.resize(t.width, t.height), this.Fl.resize(t.width, t.height), this.xl.Xr(t), this.Pl && (this.Pl[0].resize(t.width, t.height), this.Pl[1].resize(t.width, t.height));
3543
+ for (const e of this.Cl) e.Xr(t);
3544
+ this.bl.Xr(this.xa.Er.width, this.xa.Er.height);
3545
3545
  }
3546
3546
  gt() {
3547
3547
  var t, e, i, s;
3548
+ for (const r of this.Cl) r.gt();
3548
3549
  for (const r of this.wl) r.gt();
3549
- for (const r of this.Al) r.gt();
3550
- this.wl.length = 0, this.Al.length = 0, this.bl.gt(), (t = this.Cl) == null || t.gt(), (e = this.xl) == null || e.gt(), (i = this.Ml) == null || i[0].gt(), (s = this.Ml) == null || s[1].gt(), this.yl.gt();
3550
+ this.Cl.length = 0, this.wl.length = 0, this.xl.gt(), (t = this.Ml) == null || t.gt(), (e = this.Fl) == null || e.gt(), (i = this.Pl) == null || i[0].gt(), (s = this.Pl) == null || s[1].gt(), this.bl.gt();
3551
3551
  }
3552
3552
  get all() {
3553
- return this.wl;
3553
+ return this.Cl;
3554
3554
  }
3555
3555
  get base() {
3556
- return this.bl;
3556
+ return this.xl;
3557
3557
  }
3558
- Pl(t) {
3559
- const e = { renderer: this.Z, grid: this.ba.Qn, font: this.ba.font, filterManager: this.ba.kl, layerPingPongBuffers: this.Ml, createFramebuffer: (i, s, r = 1) => this.Z.Pe(i, s, r) };
3560
- t.ol(e);
3558
+ Tl(t) {
3559
+ const e = { renderer: this.Z, grid: this.xa.Nn, font: this.xa.font, filterManager: this.xa.Dl, layerPingPongBuffers: this.Pl, createFramebuffer: (i, s, r = 1) => this.Z.Pe(i, s, r) };
3560
+ t.cl(e);
3561
3561
  }
3562
- El() {
3563
- const t = { renderer: this.Z, grid: this.ba.Qn, font: this.ba.font, filterManager: this.ba.kl, layerPingPongBuffers: this.Ml, createFramebuffer: (e, i, s = 1) => this.Z.Pe(e, i, s), externalDrawFramebuffer: this.ba.va, externalAsciiFramebuffer: this.Cl };
3564
- this.bl.ol(t);
3562
+ kl() {
3563
+ const t = { renderer: this.Z, grid: this.xa.Nn, font: this.xa.font, filterManager: this.xa.Dl, layerPingPongBuffers: this.Pl, createFramebuffer: (e, i, s = 1) => this.Z.Pe(e, i, s), externalDrawFramebuffer: this.xa.ga, externalAsciiFramebuffer: this.Ml };
3564
+ this.xl.cl(t);
3565
3565
  }
3566
- $l(t, e) {
3566
+ Rl(t, e) {
3567
3567
  const i = t.indexOf(e);
3568
3568
  if (i === -1) return !1;
3569
3569
  const [s] = t.splice(i, 1);
3570
3570
  return s.gt(), !0;
3571
3571
  }
3572
- Tl(t, e, i) {
3572
+ El(t, e, i) {
3573
3573
  const s = t.indexOf(e);
3574
3574
  if (s === -1) return !1;
3575
3575
  t.splice(s, 1);
3576
3576
  const r = Math.max(0, Math.min(t.length, i));
3577
3577
  return t.splice(r, 0, e), !0;
3578
3578
  }
3579
- Rl(t, e, i) {
3579
+ Sl(t, e, i) {
3580
3580
  const s = t.indexOf(e);
3581
3581
  if (s === -1) return !1;
3582
3582
  const r = t.indexOf(i);
@@ -3586,11 +3586,11 @@ class kt {
3586
3586
  class Ht {
3587
3587
  constructor(t) {
3588
3588
  a(this, "Z");
3589
- a(this, "Ll", /* @__PURE__ */ new Map());
3590
- a(this, "Ol", /* @__PURE__ */ new Map());
3591
- this.Z = t, this.Il();
3589
+ a(this, "Il", /* @__PURE__ */ new Map());
3590
+ a(this, "Bl", /* @__PURE__ */ new Map());
3591
+ this.Z = t, this.Hl();
3592
3592
  }
3593
- async Bl(t, e, i = {}) {
3593
+ async Gl(t, e, i = {}) {
3594
3594
  const s = Object.entries(i), r = s.length > 0 ? s[0][1][0] : null;
3595
3595
  let h;
3596
3596
  if (typeof e == "string") {
@@ -3600,8 +3600,8 @@ class Ht {
3600
3600
  if (!l.ok) throw Error(`Failed to load shader from ${e}: ${l.statusText}`);
3601
3601
  c = await l.text();
3602
3602
  }
3603
- h = this.Z.pe(K, c), this.Ol.set(t, h);
3604
- } else h = e, this.Ol.set(t, h);
3603
+ h = this.Z.pe(K, c), this.Bl.set(t, h);
3604
+ } else h = e, this.Bl.set(t, h);
3605
3605
  const o = { id: t, createShader: () => h, createUniforms: (c, l) => {
3606
3606
  const u = { u_resolution: [l.width, l.height] };
3607
3607
  for (const [f, [d, g]] of s) {
@@ -3610,191 +3610,191 @@ class Ht {
3610
3610
  }
3611
3611
  return u;
3612
3612
  } };
3613
- this.Ll.set(t, o);
3613
+ this.Il.set(t, o);
3614
3614
  }
3615
- Hl(t) {
3616
- const e = this.Ol.get(t);
3617
- return e && (e.dispose(), this.Ol.delete(t)), this.Ll.delete(t);
3615
+ Ql(t) {
3616
+ const e = this.Bl.get(t);
3617
+ return e && (e.dispose(), this.Bl.delete(t)), this.Il.delete(t);
3618
3618
  }
3619
- Gl(t) {
3620
- return this.Ll.get(t);
3619
+ Nl(t) {
3620
+ return this.Il.get(t);
3621
3621
  }
3622
3622
  gt() {
3623
- for (const t of this.Ol.values()) t.dispose();
3624
- this.Ol.clear(), this.Ll.clear();
3623
+ for (const t of this.Bl.values()) t.dispose();
3624
+ this.Bl.clear(), this.Il.clear();
3625
3625
  }
3626
- Il() {
3627
- this.Bl("invert", `#version 300 es
3628
- 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.Bl("grayscale", `#version 300 es
3629
- 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.Bl("sepia", `#version 300 es
3630
- 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.Bl("threshold", `#version 300 es
3631
- precision highp float;uniform sampler2D u_texture;uniform float Up;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(Up,B);fragColor=vec4(vec3(C),A.a);}`, { Up: ["threshold", 0.5] });
3626
+ Hl() {
3627
+ this.Gl("invert", `#version 300 es
3628
+ 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.Gl("grayscale", `#version 300 es
3629
+ precision highp float;uniform sampler2D u_texture;uniform float U1;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),U1);fragColor=vec4(C,A.a);}`, { U1: ["amount", 1] }), this.Gl("sepia", `#version 300 es
3630
+ precision highp float;uniform sampler2D u_texture;uniform float U1;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,U1);fragColor=vec4(C,A.a);}`, { U1: ["amount", 1] }), this.Gl("threshold", `#version 300 es
3631
+ precision highp float;uniform sampler2D u_texture;uniform float U2;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(U2,B);fragColor=vec4(vec3(C),A.a);}`, { U2: ["threshold", 0.5] });
3632
3632
  }
3633
3633
  }
3634
- class Wt {
3634
+ class jt {
3635
3635
  constructor(t) {
3636
3636
  a(this, "Z");
3637
- a(this, "Ol", /* @__PURE__ */ new Map());
3637
+ a(this, "Bl", /* @__PURE__ */ new Map());
3638
3638
  a(this, "J");
3639
- a(this, "fl");
3640
- a(this, "kc", !1);
3641
- a(this, "Ql");
3642
- this.Z = t, this.Ql = new Ht(this.Z), this.J = t.pe(K, _t);
3639
+ a(this, "vl");
3640
+ a(this, "Dc", !1);
3641
+ a(this, "Xl");
3642
+ this.Z = t, this.Xl = new Ht(this.Z), this.J = t.pe(K, Xt);
3643
3643
  }
3644
3644
  async register(t, e, i = {}) {
3645
- await this.Ql.Bl(t, e, i);
3645
+ await this.Xl.Gl(t, e, i);
3646
3646
  }
3647
3647
  unregister(t) {
3648
- return this.Ql.Hl(t) ?? !1;
3648
+ return this.Xl.Ql(t) ?? !1;
3649
3649
  }
3650
3650
  has(t) {
3651
- return this.Ql.Gl(t) !== void 0;
3651
+ return this.Xl.Nl(t) !== void 0;
3652
3652
  }
3653
3653
  yr(t, e) {
3654
- this.kc || (this.fl = [this.Z.Pe(t, e, 1, { depth: !1 }), this.Z.Pe(t, e, 1, { depth: !1 })], this.kc = !0);
3654
+ this.Dc || (this.vl = [this.Z.Pe(t, e, 1, { depth: !1 }), this.Z.Pe(t, e, 1, { depth: !1 })], this.Dc = !0);
3655
3655
  }
3656
- Nl(t, e, i, s, r) {
3657
- this.fl[0].width === s && this.fl[0].height === r || (this.fl[0].resize(s, r), this.fl[1].resize(s, r)), this.cl(t, e, i, s, r, this.fl);
3656
+ Yl(t, e, i, s, r) {
3657
+ this.vl[0].width === s && this.vl[0].height === r || (this.vl[0].resize(s, r), this.vl[1].resize(s, r)), this.ul(t, e, i, s, r, this.vl);
3658
3658
  }
3659
- cl(t, e, i, s, r, h) {
3660
- if (i.length === 0) return void this.Xl(t, e, s, r);
3659
+ ul(t, e, i, s, r, h) {
3660
+ if (i.length === 0) return void this.jl(t, e, s, r);
3661
3661
  const o = this.Z.context, c = o.isEnabled(o.BLEND);
3662
- o.disable(o.BLEND), this.Xl(t, h[0], s, r);
3662
+ o.disable(o.BLEND), this.jl(t, h[0], s, r);
3663
3663
  let l = 0;
3664
3664
  for (let u = 0; u < i.length; u++) {
3665
3665
  const f = i[u], d = u === i.length - 1, g = l === 0 ? 1 : 0, m = d ? e : h[g];
3666
- this.Yl(f, h[l], m, s, r), d || (l = g);
3666
+ this.Wl(f, h[l], m, s, r), d || (l = g);
3667
3667
  }
3668
3668
  c && o.enable(o.BLEND);
3669
3669
  }
3670
- Yl(t, e, i, s, r) {
3671
- const h = this.Ql.Gl(t.name);
3672
- if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.Xl(e.textures[0], i, s, r);
3673
- const o = this.Wl(t.name, h, s, r), c = { renderer: this.Z, gl: this.Z.context, width: s, height: r };
3670
+ Wl(t, e, i, s, r) {
3671
+ const h = this.Xl.Nl(t.name);
3672
+ if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.jl(e.textures[0], i, s, r);
3673
+ const o = this.Kl(t.name, h, s, r), c = { renderer: this.Z, gl: this.Z.context, width: s, height: r };
3674
3674
  i.begin(), this.Z.ve(o), o.O({ u_texture: e.textures[0] });
3675
3675
  const l = h.createUniforms(t.params, c);
3676
3676
  o.O(l), this.Z.Ae(0, 0, s, r), i.end();
3677
3677
  }
3678
- Wl(t, e, i, s) {
3679
- let r = this.Ol.get(t);
3678
+ Kl(t, e, i, s) {
3679
+ let r = this.Bl.get(t);
3680
3680
  if (!r && e) {
3681
3681
  const h = { renderer: this.Z, gl: this.Z.context, width: i, height: s };
3682
- r = e.createShader(h), this.Ol.set(t, r);
3682
+ r = e.createShader(h), this.Bl.set(t, r);
3683
3683
  }
3684
3684
  return r;
3685
3685
  }
3686
- Xl(t, e, i, s) {
3686
+ jl(t, e, i, s) {
3687
3687
  e.begin(), this.Z.ve(this.J), this.J.O({ u_texture: t, u_resolution: [i, s] }), this.Z.Ae(0, 0, i, s), e.end();
3688
3688
  }
3689
3689
  Xr(t, e) {
3690
- this.fl && (this.fl[0].resize(t, e), this.fl[1].resize(t, e));
3690
+ this.vl && (this.vl[0].resize(t, e), this.vl[1].resize(t, e));
3691
3691
  }
3692
3692
  gt() {
3693
- for (const t of this.Ol.values()) t.dispose();
3694
- this.Ol.clear(), this.J.dispose(), this.Ql.gt(), this.fl && (this.fl[0].gt(), this.fl[1].gt()), this.kc = !1;
3693
+ for (const t of this.Bl.values()) t.dispose();
3694
+ this.Bl.clear(), this.J.dispose(), this.Xl.gt(), this.vl && (this.vl[0].gt(), this.vl[1].gt()), this.Dc = !1;
3695
3695
  }
3696
3696
  }
3697
- const ti = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: Ht, TextmodeFilterManager: Wt }, Symbol.toStringTag, { value: "Module" }));
3698
- class je extends function(e, ...i) {
3697
+ const ti = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: Ht, TextmodeFilterManager: jt }, Symbol.toStringTag, { value: "Module" }));
3698
+ class Qe extends function(e, ...i) {
3699
3699
  return i.reduce((s, r) => r(s), e);
3700
3700
  }(class {
3701
- }, Ie, Ye, ze, Ge, Qe, ke) {
3701
+ }, Ie, Ye, ze, Ge, Ve, ke) {
3702
3702
  constructor(e = {}) {
3703
3703
  super();
3704
3704
  a(this, "Z");
3705
3705
  a(this, "rr");
3706
3706
  a(this, "Er");
3707
- a(this, "Qn");
3707
+ a(this, "Nn");
3708
+ a(this, "ba");
3709
+ a(this, "Yh");
3708
3710
  a(this, "_a");
3709
- a(this, "Xh");
3710
- a(this, "ga");
3711
- a(this, "wa");
3712
- a(this, "jl");
3713
- a(this, "va");
3714
- a(this, "Hc");
3715
- a(this, "Da");
3716
- a(this, "Gc");
3717
- a(this, "pa");
3718
- a(this, "kl");
3719
- a(this, "Kl", []);
3711
+ a(this, "Ca");
3720
3712
  a(this, "Zl");
3721
- a(this, "ql");
3713
+ a(this, "ga");
3714
+ a(this, "Qc");
3715
+ a(this, "Oa");
3716
+ a(this, "Nc");
3717
+ a(this, "ma");
3718
+ a(this, "Dl");
3719
+ a(this, "ql", []);
3722
3720
  a(this, "Vl");
3723
- a(this, "Jl", !1);
3724
- a(this, "tu", !1);
3721
+ a(this, "Jl");
3722
+ a(this, "tu");
3725
3723
  a(this, "su", !1);
3726
3724
  a(this, "iu", !1);
3727
- a(this, "eu", () => {
3725
+ a(this, "eu", !1);
3726
+ a(this, "ru", !1);
3727
+ a(this, "nu", () => {
3728
3728
  });
3729
- a(this, "tl", () => {
3729
+ a(this, "il", () => {
3730
3730
  });
3731
- a(this, "ru", () => {
3731
+ a(this, "hu", () => {
3732
3732
  });
3733
- a(this, "nu");
3734
- a(this, "hu");
3735
- a(this, "Lr", !1);
3736
3733
  a(this, "ou");
3737
- a(this, "ma", /* @__PURE__ */ new Set());
3738
- this.Vl = new He(this), this.Lr = e.overlay ?? !1, this.Er = new Le(e), this.Z = new pe(this.Er.Yr()), this.rr = new mt(this.Z, e.fontSize ?? 16), this._a = new Lt(e.frameRate ?? 60), this.jl = new Gt(this, e.loadingScreen, this.Er.Nr()), this.jl.Ic(() => {
3739
- this._a.Hn = 0, this.iu = !0;
3740
- }), this.Xh = new Nt(this.Er), this.ga = new Ot(this.Er, this.Xh), this.wa = new Dt(), this.Hc = this.Z.pe(K, `#version 300 es
3741
- precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D Uc;uniform sampler2D Ud;uniform sampler2D Ue;uniform vec2 Uf;uniform vec2 Ug;uniform vec4 Uh;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/Ug;vec2 F=E*Uf;vec2 G=floor(F);vec2 H=(G+0.5)/Uf;vec4 I=texture(Uc,H);vec4 J=texture(Ud,H);vec4 K=texture(Ue,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(Uh,J,J.a);fragColor=mix(d,I,c);}`), this.pa = new kt(this), this.kl = new Wt(this.Z), this.jl.Sn(), this.au(e);
3742
- }
3743
- async au(e) {
3744
- await Promise.all([this.rr.yr(e.fontSource), this.jl.yr(e.fontSource)]);
3734
+ a(this, "au");
3735
+ a(this, "Lr", !1);
3736
+ a(this, "cu");
3737
+ a(this, "ya", /* @__PURE__ */ new Set());
3738
+ this.tu = new He(this), this.Lr = e.overlay ?? !1, this.Er = new De(e), this.Z = new pe(this.Er.Yr()), this.rr = new mt(this.Z, e.fontSize ?? 16), this.ba = new Dt(e.frameRate ?? 60), this.Zl = new Gt(this, e.loadingScreen, this.Er.Nr()), this.Zl.Hc(() => {
3739
+ this.ba.Gn = 0, this.ru = !0;
3740
+ }), this.Yh = new Lt(this.Er), this._a = new Bt(this.Er, this.Yh), this.Ca = new _t(), this.Qc = this.Z.pe(K, `#version 300 es
3741
+ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D Ue;uniform sampler2D Uf;uniform sampler2D Ud;uniform vec2 Ug;uniform vec2 Uh;uniform vec4 Ui;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/Uh;vec2 F=E*Ug;vec2 G=floor(F);vec2 H=(G+0.5)/Ug;vec4 I=texture(Ue,H);vec4 J=texture(Uf,H);vec4 K=texture(Ud,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(Ui,J,J.a);fragColor=mix(d,I,c);}`), this.ma = new kt(this), this.Dl = new jt(this.Z), this.Zl.kn(), this.lu(e);
3742
+ }
3743
+ async lu(e) {
3744
+ await Promise.all([this.rr.yr(e.fontSource), this.Zl.yr(e.fontSource)]);
3745
3745
  const i = this.rr.maxGlyphDimensions;
3746
- this.Qn = new St(this.Er.canvas, i.width, i.height), this.Xh.yr(this.Qn), this.ga.yr(this.Qn), this.va = this.Z.Pe(this.Qn.cols, this.Qn.rows, 3), this.Da = this.Z.Pe(this.Qn.width, this.Qn.height, 1), this.Zl = this.Z.Pe(this.Er.width, this.Er.height, 1), this.ql = this.Z.Pe(this.Er.width, this.Er.height, 1), this.kl.yr(this.Er.width, this.Er.height), this.pa.yr(), this.Lr && (this.ou = I.Cn(this.Z, this.rr, this.Er.targetCanvas, this.Qn.cols, this.Qn.rows), this.da(this.ou)), this.Gc = this.Z.pe(K, _t), this.cu(), this._a.Sn(() => this.ya()), await this.Vl.Pa(e.plugins ?? []);
3746
+ this.Nn = new Ut(this.Er.canvas, i.width, i.height), this.Yh.yr(this.Nn), this._a.yr(this.Nn), this.ga = this.Z.Pe(this.Nn.cols, this.Nn.rows, 3), this.Oa = this.Z.Pe(this.Nn.width, this.Nn.height, 1), this.Vl = this.Z.Pe(this.Er.width, this.Er.height, 1), this.Jl = this.Z.Pe(this.Er.width, this.Er.height, 1), this.Dl.yr(this.Er.width, this.Er.height), this.ma.yr(), this.Lr && (this.cu = I.Cn(this.Z, this.rr, this.Er.targetCanvas, this.Nn.cols, this.Nn.rows), this.pa(this.cu)), this.Nc = this.Z.pe(K, Xt), this.uu(), this.ba.kn(() => this.wa()), await this.tu.Ta(e.plugins ?? []);
3747
3747
  try {
3748
- await this.eu(), this.jl.oc();
3748
+ await this.nu(), this.Zl.cc();
3749
3749
  } catch (s) {
3750
- console.error("Error during setup:", s), this.jl.error(s);
3750
+ console.error("Error during setup:", s), this.Zl.error(s);
3751
3751
  }
3752
3752
  }
3753
- cu() {
3754
- this.nu = () => {
3755
- this.Lr && this.resizeCanvas(this.Er.targetCanvas.width, this.Er.targetCanvas.height), this.ru();
3756
- }, window.addEventListener("resize", this.nu), this.Xh.fh(), this.ga.fh(), this.wa.fh(), window.addEventListener("blur", () => {
3757
- this.wa.Nh();
3758
- }), this.Lr && (this.hu = new ResizeObserver(() => {
3753
+ uu() {
3754
+ this.ou = () => {
3755
+ this.Lr && this.resizeCanvas(this.Er.targetCanvas.width, this.Er.targetCanvas.height), this.hu();
3756
+ }, window.addEventListener("resize", this.ou), this.Yh.dh(), this._a.dh(), this.Ca.dh(), window.addEventListener("blur", () => {
3757
+ this.Ca.Xh();
3758
+ }), this.Lr && (this.au = new ResizeObserver(() => {
3759
3759
  this.resizeCanvas(this.Er.targetCanvas.width, this.Er.targetCanvas.height);
3760
- }), this.hu.observe(this.Er.targetCanvas));
3760
+ }), this.au.observe(this.Er.targetCanvas));
3761
3761
  }
3762
- ya() {
3763
- if (!this.jl.ec && this.iu) {
3764
- this.tu = !0;
3762
+ wa() {
3763
+ if (!this.Zl.nc && this.ru) {
3764
+ this.iu = !0;
3765
3765
  try {
3766
- this._a.On(), this._a.Gn(), this.Lr && Rt(this.Z.context, this.ou.texture, this.Er.targetCanvas), this.Vl.Ea(), this.Z.state.qt(), this.va.begin(), this.pa.base.rl() ? this.pa.base.hl(this) : this.tl(), this.va.end();
3766
+ this.ba.In(), this.ba.Qn(), this.Lr && Rt(this.Z.context, this.cu.texture, this.Er.targetCanvas), this.tu.ka(), this.Z.state.qt(), this.ga.begin(), this.ma.base.hl() ? this.ma.base.al(this) : this.il(), this.ga.end();
3767
3767
  const e = [...this.Z.state.canvasBackgroundColor];
3768
- this.pa.Sl(this.Zl, e);
3769
- let i = this.Zl.textures[0];
3770
- this.Kl.length > 0 && (this.kl.Nl(this.Zl.textures[0], this.ql, this.Kl, this.Er.width, this.Er.height), i = this.ql.textures[0], this.Kl = []), this.Z.wi(0, 0, 0, 0), this.Z.ve(this.Gc), this.Gc.O({ u_texture: i }), this.Z.Ae(0, 0, this.Er.width, this.Er.height), this.Vl.ka();
3768
+ this.ma.zl(this.Vl, e);
3769
+ let i = this.Vl.textures[0];
3770
+ this.ql.length > 0 && (this.Dl.Yl(this.Vl.textures[0], this.Jl, this.ql, this.Er.width, this.Er.height), i = this.Jl.textures[0], this.ql = []), this.Z.bi(0, 0, 0, 0), this.Z.ve(this.Nc), this.Nc.O({ u_texture: i }), this.Z.Ae(0, 0, this.Er.width, this.Er.height), this.tu.Da();
3771
3771
  } finally {
3772
- this.tu = !1, this.Jl && !this.su && this.lu();
3772
+ this.iu = !1, this.su && !this.eu && this.fu();
3773
3773
  }
3774
3774
  }
3775
3775
  }
3776
3776
  resizeCanvas(e, i) {
3777
3777
  var s, r, h, o;
3778
- this.Er.Xr(e, i), this.jl.Qc(this.Er.Nr()), this.Qn.ti(), this.jl.Xr(), this.va.resize(this.Qn.cols, this.Qn.rows), this.Da.resize(this.Qn.width, this.Qn.height), (s = this.Zl) == null || s.resize(this.Er.width, this.Er.height), (r = this.ql) == null || r.resize(this.Er.width, this.Er.height), (h = this.kl) == null || h.Xr(this.Er.width, this.Er.height), (o = this.pa) == null || o.Xr(), this.Z.Re(), this.Xh.uh(), this.ga.uh(), this.ya();
3778
+ this.Er.Xr(e, i), this.Zl.Xc(this.Er.Nr()), this.Nn.ti(), this.Zl.Xr(), this.ga.resize(this.Nn.cols, this.Nn.rows), this.Oa.resize(this.Nn.width, this.Nn.height), (s = this.Vl) == null || s.resize(this.Er.width, this.Er.height), (r = this.Jl) == null || r.resize(this.Er.width, this.Er.height), (h = this.Dl) == null || h.Xr(this.Er.width, this.Er.height), (o = this.ma) == null || o.Xr(), this.Z.Re(), this.Yh.fh(), this._a.fh(), this.wa();
3779
3779
  }
3780
3780
  destroy() {
3781
- this.su || this.Jl || (this.Jl = !0, this._a.zn(), this.tu || this.lu());
3781
+ this.eu || this.su || (this.su = !0, this.ba.Dn(), this.iu || this.fu());
3782
3782
  }
3783
- lu() {
3783
+ fu() {
3784
3784
  var e, i, s, r, h, o;
3785
- this.Jl = !1, this.jl.gt(), this.Vl.za(), window.removeEventListener("resize", this.nu), (e = this.hu) == null || e.disconnect(), this.Xh.Ah(), this.ga.Ah(), this.wa.Ah(), this.va.gt(), this.Hc.dispose(), (i = this.pa) == null || i.gt(), (s = this.kl) == null || s.gt(), (r = this.Zl) == null || r.gt(), (h = this.ql) == null || h.gt(), this.rr.gt(), this.Z.gt(), this.Da.gt(), this.Gc.dispose(), (o = this.ou) == null || o.gt(), this.Er.gt(), this.su = !0;
3785
+ this.su = !1, this.Zl.gt(), this.tu.La(), window.removeEventListener("resize", this.ou), (e = this.au) == null || e.disconnect(), this.Yh.bh(), this._a.bh(), this.Ca.bh(), this.ga.gt(), this.Qc.dispose(), (i = this.ma) == null || i.gt(), (s = this.Dl) == null || s.gt(), (r = this.Vl) == null || r.gt(), (h = this.Jl) == null || h.gt(), this.rr.gt(), this.Z.gt(), this.Oa.gt(), this.Nc.dispose(), (o = this.cu) == null || o.gt(), this.Er.gt(), this.eu = !0;
3786
3786
  }
3787
3787
  setup(e) {
3788
- this.eu = e;
3788
+ this.nu = e;
3789
3789
  }
3790
3790
  draw(e) {
3791
- this.tl = e;
3791
+ this.il = e;
3792
3792
  }
3793
3793
  windowResized(e) {
3794
- this.ru = e;
3794
+ this.hu = e;
3795
3795
  }
3796
3796
  get grid() {
3797
- return this.Qn;
3797
+ return this.Nn;
3798
3798
  }
3799
3799
  get font() {
3800
3800
  return this.rr;
@@ -3809,63 +3809,63 @@ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charse
3809
3809
  return this.Er.canvas;
3810
3810
  }
3811
3811
  get drawFramebuffer() {
3812
- return this.va;
3812
+ return this.ga;
3813
3813
  }
3814
3814
  get isDisposed() {
3815
- return this.su;
3815
+ return this.eu;
3816
3816
  }
3817
3817
  get overlay() {
3818
- return this.ou;
3818
+ return this.cu;
3819
3819
  }
3820
3820
  get loading() {
3821
- return this.jl;
3821
+ return this.Zl;
3822
3822
  }
3823
3823
  get layers() {
3824
- return this.pa;
3824
+ return this.ma;
3825
3825
  }
3826
3826
  get filters() {
3827
- return this.kl;
3827
+ return this.Dl;
3828
3828
  }
3829
3829
  filter(e, i) {
3830
- this.Kl.push({ name: e, params: i });
3830
+ this.ql.push({ name: e, params: i });
3831
3831
  }
3832
- da(e) {
3833
- this.ma.has(e) || this.ma.add(e);
3832
+ pa(e) {
3833
+ this.ya.has(e) || this.ya.add(e);
3834
3834
  }
3835
3835
  }
3836
3836
  class At {
3837
3837
  constructor() {
3838
3838
  }
3839
3839
  static create(t = {}) {
3840
- return new je(t);
3840
+ return new Qe(t);
3841
3841
  }
3842
3842
  static setErrorLevel(t) {
3843
3843
  vt._(t);
3844
3844
  }
3845
3845
  static get version() {
3846
- return "0.7.1-beta.1";
3846
+ return "0.7.1-beta.3";
3847
3847
  }
3848
3848
  }
3849
3849
  let ct = null;
3850
- const Ve = { id: "brightness", createShader: ({ gl: n }) => (ct || (ct = new H(n, it, `#version 300 es
3851
- 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];uniform bool u_colorFilterEnabled;uniform int u_colorFilterSize;uniform vec4 u_colorFilterPalette[64];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));}float D(vec3 E,vec3 F){vec3 G=E-F;return dot(G,G);}vec4 H(vec4 I){if(!u_colorFilterEnabled||u_colorFilterSize<=0){return I;}int J=min(u_colorFilterSize,64);vec3 K=u_colorFilterPalette[0].rgb;float L=D(I.rgb,K);for(int M=1;M<64;++M){if(M>=J){break;}vec3 N=u_colorFilterPalette[M].rgb;float O=D(I.rgb,N);if(O<L){L=O;K=N;}}return vec4(K,I.a);}void main(){vec2 P=vec2(v_uv.x,1.0f-v_uv.y);vec4 I=texture(u_image,P);I=H(I);float F=B(I.rgb);vec2 Q=vec2(0.);if(u_charCount>0){float R=float(u_charCount);float S=clamp(F*(R-1.0f),0.0f,R-1.0f);int T=int(floor(S+0.5f));vec3 U=u_charList[T];Q=U.xy;}else{Q=vec2(0.0f,0.0f);}vec4 V=u_charColorFixed?u_charColor:I;vec4 W=u_cellColorFixed?u_cellColor:I;if(I.a<0.01f){discard;}o_primaryColor=vec4(V.rgb,V.a);o_secondaryColor=vec4(W.rgb,W.a);A=vec4(0.);int X=int(u_invert?1:0);int Y=int(u_flipX?1:0);int Z=int(u_flipY?1:0);float a=float(X|(Y<<1)|(Z<<2))/255.;o_character=vec4(Q,a,clamp(u_charRotation,0.0f,1.0f));}`)), ct), createUniforms: ({ source: n }) => n.createBaseConversionUniforms() }, ei = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhaseTracker: Bt, LoadingScreenManager: Gt, LoadingScreenStateMachine: Xt, LoadingScreenTransition: It, resolveColorInputs: zt, resolveDefaultPalette: Yt, resolveTheme: dt }, Symbol.toStringTag, { value: "Module" })), ii = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: mt, TextmodeImage: I, TextmodeVideo: rt }, Symbol.toStringTag, { value: "Module" })), si = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: _e, mouse: Oe, touch: Be }, Symbol.toStringTag, { value: "Module" })), ri = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: Qt, TextmodeLayer: gt, TextmodeLayerManager: kt }, Symbol.toStringTag, { value: "Module" }));
3852
- Ne(Ve);
3850
+ const qe = { id: "brightness", createShader: ({ gl: n }) => (ct || (ct = new H(n, it, `#version 300 es
3851
+ 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];uniform bool u_colorFilterEnabled;uniform int u_colorFilterSize;uniform vec4 u_colorFilterPalette[64];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));}float D(vec3 E,vec3 F){vec3 G=E-F;return dot(G,G);}vec4 H(vec4 I){if(!u_colorFilterEnabled||u_colorFilterSize<=0){return I;}int J=min(u_colorFilterSize,64);vec3 K=u_colorFilterPalette[0].rgb;float L=D(I.rgb,K);for(int M=1;M<64;++M){if(M>=J){break;}vec3 N=u_colorFilterPalette[M].rgb;float O=D(I.rgb,N);if(O<L){L=O;K=N;}}return vec4(K,I.a);}void main(){vec2 P=vec2(v_uv.x,1.0f-v_uv.y);vec4 I=texture(u_image,P);I=H(I);float F=B(I.rgb);vec2 Q=vec2(0.);if(u_charCount>0){float R=float(u_charCount);float S=clamp(F*(R-1.0f),0.0f,R-1.0f);int T=int(floor(S+0.5f));vec3 U=u_charList[T];Q=U.xy;}else{Q=vec2(0.0f,0.0f);}vec4 V=u_charColorFixed?u_charColor:I;vec4 W=u_cellColorFixed?u_cellColor:I;if(I.a<0.01f){discard;}o_primaryColor=vec4(V.rgb,V.a);o_secondaryColor=vec4(W.rgb,W.a);A=vec4(0.);int X=int(u_invert?1:0);int Y=int(u_flipX?1:0);int Z=int(u_flipY?1:0);float a=float(X|(Y<<1)|(Z<<2))/255.;o_character=vec4(Q,a,clamp(u_charRotation,0.0f,1.0f));}`)), ct), createUniforms: ({ source: n }) => n.createBaseConversionUniforms() }, ei = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhaseTracker: Zt, LoadingScreenManager: Gt, LoadingScreenStateMachine: Ot, LoadingScreenTransition: It, resolveColorInputs: zt, resolveDefaultPalette: Yt, resolveTheme: dt }, Symbol.toStringTag, { value: "Module" })), ii = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: mt, TextmodeImage: I, TextmodeVideo: rt }, Symbol.toStringTag, { value: "Module" })), si = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: Xe, mouse: Be, touch: Ze }, Symbol.toStringTag, { value: "Module" })), ri = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: Vt, TextmodeLayer: gt, TextmodeLayerManager: kt }, Symbol.toStringTag, { value: "Module" }));
3852
+ Le(qe);
3853
3853
  const ni = At.create, hi = At.setErrorLevel, oi = At.version;
3854
3854
  export {
3855
- Le as TextmodeCanvas,
3855
+ De as TextmodeCanvas,
3856
3856
  M as TextmodeColor,
3857
3857
  Jt as TextmodeErrorLevel,
3858
- W as TextmodeFramebuffer,
3859
- St as TextmodeGrid,
3860
- je as Textmodifier,
3858
+ j as TextmodeFramebuffer,
3859
+ Ut as TextmodeGrid,
3860
+ Qe as Textmodifier,
3861
3861
  ni as create,
3862
3862
  ti as filters,
3863
- De as getConversionStrategy,
3863
+ _e as getConversionStrategy,
3864
3864
  si as input,
3865
3865
  ri as layering,
3866
3866
  ii as loadables,
3867
3867
  ei as loading,
3868
- Ne as registerConversionStrategy,
3868
+ Le as registerConversionStrategy,
3869
3869
  hi as setErrorLevel,
3870
3870
  At as textmode,
3871
3871
  $e as unregisterConversionStrategy,