textmode.js 0.8.6-beta.3 → 0.8.6-beta.4

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,6 +1,6 @@
1
- var te = Object.defineProperty;
2
- var ee = (h, t, e) => t in h ? te(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
3
- var a = (h, t, e) => ee(h, typeof t != "symbol" ? t + "" : t, e);
1
+ var ee = Object.defineProperty;
2
+ var ie = (h, t, e) => t in h ? ee(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
3
+ var a = (h, t, e) => ie(h, typeof t != "symbol" ? t + "" : t, e);
4
4
  class P extends Error {
5
5
  constructor(t, e = {}) {
6
6
  super(P.i(t, e)), this.name = "TextmodeError";
@@ -8,8 +8,8 @@ class P extends Error {
8
8
  static i(t, e) {
9
9
  return `${t}${e && Object.keys(e).length > 0 ? `
10
10
 
11
- 📋 Context:` + Object.entries(e).map(([i, r]) => `
12
- - ${i}: ${P.o(r)}`).join("") : ""}
11
+ 📋 Context:` + Object.entries(e).map(([i, s]) => `
12
+ - ${i}: ${P.o(s)}`).join("") : ""}
13
13
 
14
14
  ${"↓".repeat(24)}
15
15
  `;
@@ -27,7 +27,7 @@ ${"↓".repeat(24)}
27
27
  return t + "";
28
28
  }
29
29
  }
30
- var ie = ((h) => (h[h.SILENT = 0] = "SILENT", h[h.WARNING = 1] = "WARNING", h[h.ERROR = 2] = "ERROR", h[h.THROW = 3] = "THROW", h))(ie || {});
30
+ var se = ((h) => (h[h.SILENT = 0] = "SILENT", h[h.WARNING = 1] = "WARNING", h[h.ERROR = 2] = "ERROR", h[h.THROW = 3] = "THROW", h))(se || {});
31
31
  const _ = class _ {
32
32
  constructor() {
33
33
  a(this, "l", { globalLevel: 3 });
@@ -36,14 +36,14 @@ const _ = class _ {
36
36
  return _.h || (_.h = new _()), _.h;
37
37
  }
38
38
  v(t, e) {
39
- const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.", r = "color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;";
39
+ const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.", s = "color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;";
40
40
  switch (this.l.globalLevel) {
41
41
  case 0:
42
42
  return !1;
43
43
  case 1:
44
- return console.group(i, r), console.warn(P.i(t, e)), console.groupEnd(), !1;
44
+ return console.group(i, s), console.warn(P.i(t, e)), console.groupEnd(), !1;
45
45
  case 2:
46
- return console.group(i, r), console.error(P.i(t, e)), console.groupEnd(), !1;
46
+ return console.group(i, s), console.error(P.i(t, e)), console.groupEnd(), !1;
47
47
  default:
48
48
  throw new P(t, e);
49
49
  }
@@ -56,9 +56,9 @@ const _ = class _ {
56
56
  }
57
57
  };
58
58
  a(_, "h", null);
59
- let dt = _;
60
- const vt = dt.u();
61
- class Z {
59
+ let gt = _;
60
+ const At = gt.u();
61
+ class V {
62
62
  constructor(t, e, i) {
63
63
  a(this, "A");
64
64
  a(this, "C");
@@ -74,24 +74,24 @@ class Z {
74
74
  for (let e = 0; e < t; e++) {
75
75
  const i = this.A.getActiveUniform(this.C, e);
76
76
  if (i) {
77
- const r = i.name.replace(/\[0\]$/, ""), s = this.A.getUniformLocation(this.C, r);
78
- s && (this.M.set(r, s), this.$.set(r, { type: i.type, size: i.size }));
77
+ const s = i.name.replace(/\[0\]$/, ""), r = this.A.getUniformLocation(this.C, s);
78
+ r && (this.M.set(s, r), this.$.set(s, { type: i.type, size: i.size }));
79
79
  }
80
80
  }
81
81
  }
82
82
  R(t, e) {
83
- const i = this.k(this.A.VERTEX_SHADER, t), r = this.k(this.A.FRAGMENT_SHADER, e), s = this.A.createProgram();
84
- if (this.A.attachShader(s, i), this.A.attachShader(s, r), this.A.linkProgram(s), !this.A.getProgramParameter(s, this.A.LINK_STATUS)) {
85
- const n = this.A.getProgramInfoLog(s);
83
+ const i = this.k(this.A.VERTEX_SHADER, t), s = this.k(this.A.FRAGMENT_SHADER, e), r = this.A.createProgram();
84
+ if (this.A.attachShader(r, i), this.A.attachShader(r, s), this.A.linkProgram(r), !this.A.getProgramParameter(r, this.A.LINK_STATUS)) {
85
+ const n = this.A.getProgramInfoLog(r);
86
86
  throw Error("Shader program link error: " + n);
87
87
  }
88
- return this.A.deleteShader(i), this.A.deleteShader(r), s;
88
+ return this.A.deleteShader(i), this.A.deleteShader(s), r;
89
89
  }
90
90
  k(t, e) {
91
91
  const i = this.A.createShader(t);
92
92
  if (this.A.shaderSource(i, e), this.A.compileShader(i), !this.A.getShaderParameter(i, this.A.COMPILE_STATUS)) {
93
- const r = this.A.getShaderInfoLog(i);
94
- throw this.A.deleteShader(i), Error("Shader compilation error: " + r);
93
+ const s = this.A.getShaderInfoLog(i);
94
+ throw this.A.deleteShader(i), Error("Shader compilation error: " + s);
95
95
  }
96
96
  return i;
97
97
  }
@@ -108,25 +108,25 @@ class Z {
108
108
  var l, c;
109
109
  const i = this.M.get(t);
110
110
  if (!i) return;
111
- const r = this.$.get(t);
112
- if (!r) return;
113
- const { type: s, size: n } = r, o = this.A;
111
+ const s = this.$.get(t);
112
+ if (!s) return;
113
+ const { type: r, size: n } = s, o = this.A;
114
114
  if (e instanceof WebGLTexture) {
115
115
  const u = this.I(t);
116
116
  return o.uniform1i(i, u), o.activeTexture(o.TEXTURE0 + u), void o.bindTexture(o.TEXTURE_2D, e);
117
117
  }
118
- if (e instanceof X) {
118
+ if (e instanceof K) {
119
119
  const u = this.I(t);
120
120
  return o.uniform1i(i, u), o.activeTexture(o.TEXTURE0 + u), void o.bindTexture(o.TEXTURE_2D, e.textures[0]);
121
121
  }
122
- if (typeof e == "number") return void (s === o.INT || s === o.BOOL ? o.uniform1i(i, e) : o.uniform1f(i, e));
122
+ if (typeof e == "number") return void (r === o.INT || r === o.BOOL ? o.uniform1i(i, e) : o.uniform1f(i, e));
123
123
  if (typeof e == "boolean") return void o.uniform1i(i, e ? 1 : 0);
124
124
  if (Array.isArray(e[0])) {
125
125
  const u = e.flat(), f = { [o.FLOAT_VEC2]: () => o.uniform2fv(i, u), [o.FLOAT_VEC3]: () => o.uniform3fv(i, u), [o.FLOAT_VEC4]: () => o.uniform4fv(i, u) };
126
- (l = f[s]) == null || l.call(f);
126
+ (l = f[r]) == null || l.call(f);
127
127
  } else {
128
128
  const u = e, f = { [o.FLOAT]: () => n > 1 ? o.uniform1fv(i, u) : o.uniform1f(i, u[0]), [o.FLOAT_VEC2]: () => o.uniform2fv(i, u), [o.FLOAT_VEC3]: () => o.uniform3fv(i, u), [o.FLOAT_VEC4]: () => o.uniform4fv(i, u), [o.INT]: () => n > 1 ? o.uniform1iv(i, u) : o.uniform1i(i, u[0]), [o.INT_VEC2]: () => o.uniform2iv(i, u), [o.INT_VEC3]: () => o.uniform3iv(i, u), [o.INT_VEC4]: () => o.uniform4iv(i, u), [o.BOOL]: () => o.uniform1iv(i, u), [o.FLOAT_MAT2]: () => o.uniformMatrix2fv(i, !1, u), [o.FLOAT_MAT3]: () => o.uniformMatrix3fv(i, !1, u), [o.FLOAT_MAT4]: () => o.uniformMatrix4fv(i, !1, u) };
129
- (c = f[s]) == null || c.call(f);
129
+ (c = f[r]) == null || c.call(f);
130
130
  }
131
131
  }
132
132
  I(t) {
@@ -143,7 +143,7 @@ class Z {
143
143
  this.A.deleteProgram(this.C);
144
144
  }
145
145
  }
146
- function xt(h, t, e, i) {
146
+ function Et(h, t, e, i) {
147
147
  return 180 * Math.atan2(i - t, e - h) / Math.PI;
148
148
  }
149
149
  function j(h, t, e, i) {
@@ -152,24 +152,24 @@ function j(h, t, e, i) {
152
152
  function k(h, t, e) {
153
153
  return Math.min(Math.max(h, t), e);
154
154
  }
155
- function Mt(h) {
155
+ function Ct(h) {
156
156
  return (h % 360 + 360) % 360 / 360;
157
157
  }
158
158
  function Ft(h, t, e) {
159
159
  h.bindTexture(h.TEXTURE_2D, t), h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL, 1), h.texImage2D(h.TEXTURE_2D, 0, h.RGBA, h.RGBA, h.UNSIGNED_BYTE, e), h.bindTexture(h.TEXTURE_2D, null);
160
160
  }
161
- function st(h, t, e, i, r) {
162
- h.texParameteri(h.TEXTURE_2D, h.TEXTURE_MIN_FILTER, t), h.texParameteri(h.TEXTURE_2D, h.TEXTURE_MAG_FILTER, e), h.texParameteri(h.TEXTURE_2D, h.TEXTURE_WRAP_S, i), h.texParameteri(h.TEXTURE_2D, h.TEXTURE_WRAP_T, r);
161
+ function rt(h, t, e, i, s) {
162
+ h.texParameteri(h.TEXTURE_2D, h.TEXTURE_MIN_FILTER, t), h.texParameteri(h.TEXTURE_2D, h.TEXTURE_MAG_FILTER, e), h.texParameteri(h.TEXTURE_2D, h.TEXTURE_WRAP_S, i), h.texParameteri(h.TEXTURE_2D, h.TEXTURE_WRAP_T, s);
163
163
  }
164
- function gt(h, t, e, i, r, s = 0, n = WebGL2RenderingContext.FLOAT, o = !1) {
165
- h.enableVertexAttribArray(t), h.vertexAttribPointer(t, e, n, o, i, r), h.vertexAttribDivisor(t, s);
164
+ function pt(h, t, e, i, s, r = 0, n = WebGL2RenderingContext.FLOAT, o = !1) {
165
+ h.enableVertexAttribArray(t), h.vertexAttribPointer(t, e, n, o, i, s), h.vertexAttribDivisor(t, r);
166
166
  }
167
- function Ct(h, t, e, i, r) {
168
- h.bindBuffer(t, e), h.bufferData(t, i, r), h.bindBuffer(t, null);
167
+ function Pt(h, t, e, i, s) {
168
+ h.bindBuffer(t, e), h.bufferData(t, i, s), h.bindBuffer(t, null);
169
169
  }
170
170
  const nt = `#version 300 es
171
- in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in vec4 A7;in vec3 A8;in vec3 A9;in vec4 Aa;in vec4 Ab;in vec3 Ac;uniform vec2 Ur;uniform float Us;uniform float Ut;out vec2 v_uv;out vec3 v_glyphIndex;out vec4 v_glyphColor;out vec4 v_cellColor;out vec4 v_glyphFlags;out vec3 v_worldPosition;out vec3 v_normal;out float v_geometryType;const float A=6.28318530718f;const int B=2;const int C=3;const int D=4;vec2 E(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float M=L*K;float N=F*F;float O=N*F;return M*G+3.0f*L*F*H+3.0f*K*N*I+O*J;}vec2 P(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float N=F*F;return-3.0f*L*G+3.0f*(L-2.0f*K*F)*H+3.0f*(2.0f*K*F-N)*I+3.0f*N*J;}vec3 Q(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x,R.y*T-R.z*U,R.y*U+R.z*T);}vec3 V(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T+R.z*U,R.y,-R.x*U+R.z*T);}vec3 W(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T-R.y*U,R.x*U+R.y*T,R.z);}vec3 X(vec3 R,vec3 Y){vec3 Z=R;if(Y.z!=0.0f){Z=W(Z,Y.z);}if(Y.y!=0.0f){Z=V(Z,Y.y);}if(Y.x!=0.0f){Z=Q(Z,Y.x);}return Z;}void main(){v_uv=A1;v_glyphIndex=A4;v_glyphColor=A5;v_cellColor=A6;v_glyphFlags=A7;vec4 a=Aa;vec4 b=Ab;vec2 c=A3;vec2 d=A2;float e=Ac.x;float f=Ac.y;int g=int(Ac.z);vec2 h=d;vec2 i=h+c*0.5f;float j=f+e*0.5f;vec3 k=vec3(i,j);vec3 l;if(g==D){float F=clamp(A0.x,0.0f,1.0f);vec2 G=b.xy;vec2 H=a.xy;vec2 I=a.zw;vec2 J=b.zw;vec2 m=E(F,G,H,I,J);vec2 n=P(F,G,H,I,J);float o=length(n);vec2 p=o>0.0f?n/o:vec2(1.0f,0.0f);vec2 q=vec2(-p.y,p.x);vec2 r=m;vec2 s=r+q*A0.y*c.y;l=vec3(s,f);}else if(g==C){float t=mod(a.x,A);if(t<0.0f){t+=A;}float u=mod(a.y,A);if(u<0.0f){u+=A;}float v=t-u;if(v<=0.0f){v+=A;}float S=t-A0.x*v;vec2 w=vec2(cos(S),sin(S))*A0.y;vec2 s=w*c+h;l=vec3(s,f);}else if(g==B){vec2 s=A0.xy*c+h;l=vec3(s,f);}vec3 x=X(l,A9);vec3 y=x+A8;vec3 z=vec3(0.0f,0.0f,1.0f);v_worldPosition=y;v_normal=z;v_geometryType=float(g);vec2 AA=(y.xy/Ur)*2.0f;AA.y=-AA.y;float AB=y.z/Ur.y;float AC=clamp(-AB*Us,-0.99f,0.99f);if(Ut>0.5f){gl_Position=vec4(AA,AC,1.0f);}else{float AD=0.5f;float AE=1.0f/(1.0f-AB*AD);AA*=AE;gl_Position=vec4(AA,AC,1.0f);}}`, K = class K {
172
- constructor(t, e, i = e, r = 1, s = {}, n) {
171
+ in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in vec4 A7;in vec3 A8;in vec3 A9;in vec4 Aa;in vec4 Ab;in vec3 Ac;uniform vec2 Ur;uniform float Us;uniform float Ut;out vec2 v_uv;out vec3 v_glyphIndex;out vec4 v_glyphColor;out vec4 v_cellColor;out vec4 v_glyphFlags;out vec3 v_worldPosition;out vec3 v_normal;out float v_geometryType;const float A=6.28318530718f;const int B=2;const int C=3;const int D=4;vec2 E(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float M=L*K;float N=F*F;float O=N*F;return M*G+3.0f*L*F*H+3.0f*K*N*I+O*J;}vec2 P(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float N=F*F;return-3.0f*L*G+3.0f*(L-2.0f*K*F)*H+3.0f*(2.0f*K*F-N)*I+3.0f*N*J;}vec3 Q(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x,R.y*T-R.z*U,R.y*U+R.z*T);}vec3 V(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T+R.z*U,R.y,-R.x*U+R.z*T);}vec3 W(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T-R.y*U,R.x*U+R.y*T,R.z);}vec3 X(vec3 R,vec3 Y){vec3 Z=R;if(Y.z!=0.0f){Z=W(Z,Y.z);}if(Y.y!=0.0f){Z=V(Z,Y.y);}if(Y.x!=0.0f){Z=Q(Z,Y.x);}return Z;}void main(){v_uv=A1;v_glyphIndex=A4;v_glyphColor=A5;v_cellColor=A6;v_glyphFlags=A7;vec4 a=Aa;vec4 b=Ab;vec2 c=A3;vec2 d=A2;float e=Ac.x;float f=Ac.y;int g=int(Ac.z);vec2 h=d;vec2 i=h+c*0.5f;float j=f+e*0.5f;vec3 k=vec3(i,j);vec3 l;if(g==D){float F=clamp(A0.x,0.0f,1.0f);vec2 G=b.xy;vec2 H=a.xy;vec2 I=a.zw;vec2 J=b.zw;vec2 m=E(F,G,H,I,J);vec2 n=P(F,G,H,I,J);float o=length(n);vec2 p=o>0.0f?n/o:vec2(1.0f,0.0f);vec2 q=vec2(-p.y,p.x);vec2 r=m;vec2 s=r+q*A0.y*c.y;l=vec3(s,f);}else if(g==C){float t=mod(a.x,A);if(t<0.0f){t+=A;}float u=mod(a.y,A);if(u<0.0f){u+=A;}float v=t-u;if(v<=0.0f){v+=A;}float S=t-A0.x*v;vec2 w=vec2(cos(S),sin(S))*A0.y;vec2 s=w*c+h;l=vec3(s,f);}else if(g==B){vec2 s=A0.xy*c+h;l=vec3(s,f);}vec3 x=X(l,A9);vec3 y=x+A8;vec3 z=vec3(0.0f,0.0f,1.0f);v_worldPosition=y;v_normal=z;v_geometryType=float(g);vec2 AA=(y.xy/Ur)*2.0f;AA.y=-AA.y;float AB=y.z/Ur.y;float AC=clamp(-AB*Us,-0.99f,0.99f);if(Ut>0.5f){gl_Position=vec4(AA,AC,1.0f);}else{float AD=0.5f;float AE=1.0f/(1.0f-AB*AD);AA*=AE;gl_Position=vec4(AA,AC,1.0f);}}`, X = class X {
172
+ constructor(t, e, i = e, s = 1, r = {}, n) {
173
173
  a(this, "G");
174
174
  a(this, "j");
175
175
  a(this, "l");
@@ -181,16 +181,16 @@ in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in
181
181
  a(this, "K");
182
182
  a(this, "Z", null);
183
183
  a(this, "q", /* @__PURE__ */ new Map());
184
- this.G = e, this.j = i, this.A = t, this.W = k(r, 1, 8), this.K = n, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...s }, K.V || (K.V = new Z(t, nt, `#version 300 es
184
+ this.G = e, this.j = i, this.A = t, this.W = k(s, 1, 8), this.K = n, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...r }, X.V || (X.V = new V(t, nt, `#version 300 es
185
185
  precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uniform sampler2D U2;uniform sampler2D U3;uniform vec2 U4;uniform bool U5;uniform bool U6;uniform bool U7;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){vec2 B=vec2(v_uv.x,1.-v_uv.y);vec2 C=B*U4;vec2 D=(floor(C)+0.5f)/U4;vec4 E=texture(U0,D);vec4 F=U5?texture(U1,D):vec4(0.);if(U5&&F.a==0.){discard;}vec4 G=U6?texture(U2,D):vec4(0.);vec4 H=U7?texture(U3,D):vec4(0.);o_character=E;o_primaryColor=F;o_secondaryColor=G;A=H;}`));
186
186
  const o = t.getParameter(t.MAX_DRAW_BUFFERS), l = t.getParameter(t.MAX_COLOR_ATTACHMENTS);
187
187
  this.W = Math.min(this.W, o, l), this.N = t.createFramebuffer(), this.J(), this.tt(), this.l.depth && this.st();
188
188
  }
189
189
  J() {
190
- const t = this.A, e = this.l.filter === "linear" ? t.LINEAR : t.NEAREST, i = this.l.wrap === "repeat" ? t.REPEAT : t.CLAMP_TO_EDGE, r = this.l.type === "float" ? t.FLOAT : t.UNSIGNED_BYTE, s = r === t.FLOAT ? t.RGBA32F : t.RGBA8, n = t.RGBA;
190
+ const t = this.A, e = this.l.filter === "linear" ? t.LINEAR : t.NEAREST, i = this.l.wrap === "repeat" ? t.REPEAT : t.CLAMP_TO_EDGE, s = this.l.type === "float" ? t.FLOAT : t.UNSIGNED_BYTE, r = s === t.FLOAT ? t.RGBA32F : t.RGBA8, n = t.RGBA;
191
191
  for (let o = 0; o < this.W; o++) {
192
192
  const l = t.createTexture();
193
- t.bindTexture(t.TEXTURE_2D, l), st(t, e, e, i, i), t.texImage2D(t.TEXTURE_2D, 0, s, this.G, this.j, 0, n, r, null), this.X.push(l);
193
+ t.bindTexture(t.TEXTURE_2D, l), rt(t, e, e, i, i), t.texImage2D(t.TEXTURE_2D, 0, r, this.G, this.j, 0, n, s, null), this.X.push(l);
194
194
  }
195
195
  t.bindTexture(t.TEXTURE_2D, null);
196
196
  }
@@ -200,8 +200,8 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
200
200
  else {
201
201
  const e = [];
202
202
  for (let i = 0; i < this.W; i++) {
203
- const r = t.COLOR_ATTACHMENT0 + i;
204
- t.framebufferTexture2D(t.FRAMEBUFFER, r, t.TEXTURE_2D, this.X[i], 0), e.push(r);
203
+ const s = t.COLOR_ATTACHMENT0 + i;
204
+ t.framebufferTexture2D(t.FRAMEBUFFER, s, t.TEXTURE_2D, this.X[i], 0), e.push(s);
205
205
  }
206
206
  t.drawBuffers(e);
207
207
  }
@@ -216,18 +216,18 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
216
216
  }
217
217
  resize(t, e) {
218
218
  this.G = t, this.j = e, this.q.clear();
219
- const i = this.A, r = this.l.type === "float" ? i.FLOAT : i.UNSIGNED_BYTE, s = r === i.FLOAT ? i.RGBA32F : i.RGBA8, n = i.RGBA;
220
- for (const o of this.X) i.bindTexture(i.TEXTURE_2D, o), i.texImage2D(i.TEXTURE_2D, 0, s, this.G, this.j, 0, n, r, null);
219
+ const i = this.A, s = this.l.type === "float" ? i.FLOAT : i.UNSIGNED_BYTE, r = s === i.FLOAT ? i.RGBA32F : i.RGBA8, n = i.RGBA;
220
+ for (const o of this.X) i.bindTexture(i.TEXTURE_2D, o), i.texImage2D(i.TEXTURE_2D, 0, r, this.G, this.j, 0, n, s, null);
221
221
  i.bindTexture(i.TEXTURE_2D, null), this.Y && (i.bindRenderbuffer(i.RENDERBUFFER, this.Y), i.renderbufferStorage(i.RENDERBUFFER, i.DEPTH_COMPONENT24, this.G, this.j), i.bindRenderbuffer(i.RENDERBUFFER, null));
222
222
  }
223
223
  readPixels(t) {
224
224
  const e = this.q.get(t);
225
225
  if (e) return e;
226
- const i = this.A, r = this.G, s = this.j, n = new Uint8Array(r * s * 4), o = i.getParameter(i.READ_FRAMEBUFFER_BINDING);
227
- i.bindFramebuffer(i.READ_FRAMEBUFFER, this.N), i.readBuffer(i.COLOR_ATTACHMENT0 + t), i.readPixels(0, 0, r, s, i.RGBA, i.UNSIGNED_BYTE, n), i.bindFramebuffer(i.READ_FRAMEBUFFER, o);
228
- const l = 4 * r, c = new Uint8Array(n.length);
229
- for (let u = 0; u < s; u++) {
230
- const f = (s - 1 - u) * l, d = u * l;
226
+ const i = this.A, s = this.G, r = this.j, n = new Uint8Array(s * r * 4), o = i.getParameter(i.READ_FRAMEBUFFER_BINDING);
227
+ i.bindFramebuffer(i.READ_FRAMEBUFFER, this.N), i.readBuffer(i.COLOR_ATTACHMENT0 + t), i.readPixels(0, 0, s, r, i.RGBA, i.UNSIGNED_BYTE, n), i.bindFramebuffer(i.READ_FRAMEBUFFER, o);
228
+ const l = 4 * s, c = new Uint8Array(n.length);
229
+ for (let u = 0; u < r; u++) {
230
+ const f = (r - 1 - u) * l, d = u * l;
231
231
  c.set(n.subarray(f, f + l), d);
232
232
  }
233
233
  return this.q.set(t, c), c;
@@ -244,8 +244,8 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
244
244
  }
245
245
  ut() {
246
246
  if (!this.K) return;
247
- const t = this.W > 1, e = this.W > 2, i = this.W > 3, r = { U0: this.X[0], U1: t ? this.X[1] : this.X[0], U2: e ? this.X[2] : this.X[0], U3: i ? this.X[3] : this.X[0], U4: [this.G, this.j], U5: t, U6: e, U7: i }, s = K.V;
248
- this.Z = this.K.dt.ft(s, r, !0);
247
+ const t = this.W > 1, e = this.W > 2, i = this.W > 3, s = { U0: this.X[0], U1: t ? this.X[1] : this.X[0], U2: e ? this.X[2] : this.X[0], U3: i ? this.X[3] : this.X[0], U4: [this.G, this.j], U5: t, U6: e, U7: i }, r = X.V;
248
+ this.Z = this.K.dt.ft(r, s, !0);
249
249
  }
250
250
  dispose() {
251
251
  const t = this.A;
@@ -266,17 +266,17 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
266
266
  return this.W;
267
267
  }
268
268
  };
269
- a(K, "V", null);
270
- let X = K;
271
- const Pt = /* @__PURE__ */ new WeakMap();
269
+ a(X, "V", null);
270
+ let K = X;
271
+ const Lt = /* @__PURE__ */ new WeakMap();
272
272
  function at(h, t) {
273
- Pt.set(h, t);
273
+ Lt.set(h, t);
274
274
  }
275
275
  function St(h) {
276
- return Pt.get(h);
276
+ return Lt.get(h);
277
277
  }
278
- function it(h, t, e, i, r = 255) {
279
- h[0] = t / 255, h[1] = (e ?? t) / 255, h[2] = (i ?? t) / 255, h[3] = r / 255;
278
+ function it(h, t, e, i, s = 255) {
279
+ h[0] = t / 255, h[1] = (e ?? t) / 255, h[2] = (i ?? t) / 255, h[3] = s / 255;
280
280
  }
281
281
  class ht {
282
282
  constructor() {
@@ -349,11 +349,11 @@ class ht {
349
349
  rs(t) {
350
350
  this.xt[0] = t[0], this.xt[1] = t[1], this.xt[2] = t[2];
351
351
  }
352
- ns(t, e, i, r = 255) {
353
- it(this.Ct, t, e, i, r);
352
+ ns(t, e, i, s = 255) {
353
+ it(this.Ct, t, e, i, s);
354
354
  }
355
- hs(t, e, i, r = 255) {
356
- it(this.Mt, t, e, i, r);
355
+ hs(t, e, i, s = 255) {
356
+ it(this.Mt, t, e, i, s);
357
357
  }
358
358
  cs(t) {
359
359
  this.$t = t;
@@ -365,10 +365,10 @@ class ht {
365
365
  this.Pt = t;
366
366
  }
367
367
  fs(t) {
368
- this.Tt = Mt(t);
368
+ this.Tt = Ct(t);
369
369
  }
370
- ds(t, e, i, r) {
371
- it(this.Et, t, e, i, r);
370
+ ds(t, e, i, s) {
371
+ it(this.Et, t, e, i, s);
372
372
  }
373
373
  ps(t) {
374
374
  this.Rt = t;
@@ -389,47 +389,47 @@ class ht {
389
389
  return this.bt;
390
390
  }
391
391
  }
392
- const pt = 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]), z = { vs: 16, gs: WebGL2RenderingContext.TRIANGLES, _s: { As: { size: 2, offset: 0 }, ws: { size: 2, offset: 8 } } };
392
+ const mt = 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]), G = { vs: 16, gs: WebGL2RenderingContext.TRIANGLES, _s: { As: { size: 2, offset: 0 }, ws: { size: 2, offset: 8 } } };
393
393
  class re {
394
394
  constructor(t) {
395
395
  a(this, "A");
396
396
  a(this, "bs");
397
397
  a(this, "Cs");
398
- this.A = t, this.bs = t.createBuffer(), this.Cs = new Float32Array(pt.length);
398
+ this.A = t, this.bs = t.createBuffer(), this.Cs = new Float32Array(mt.length);
399
399
  }
400
- Ms(t, e, i, r) {
401
- const s = this.A, n = St(this.A), o = n[2], l = n[3], c = t / o * 2 - 1, u = (t + i) / o * 2 - 1, f = 1 - (e + r) / l * 2, d = 1 - e / l * 2, g = pt, m = this.Cs;
400
+ Ms(t, e, i, s) {
401
+ const r = this.A, n = St(this.A), o = n[2], l = n[3], c = t / o * 2 - 1, u = (t + i) / o * 2 - 1, f = 1 - (e + s) / l * 2, d = 1 - e / l * 2, g = mt, m = this.Cs;
402
402
  for (let p = 0; p < g.length; p += 4) {
403
403
  const v = g[p], A = g[p + 1], w = g[p + 2], y = g[p + 3], b = c + (v + 0.5) * (u - c), x = f + (A + 0.5) * (d - f);
404
404
  m[p] = b, m[p + 1] = x, m[p + 2] = w, m[p + 3] = y;
405
405
  }
406
- s.bindBuffer(s.ARRAY_BUFFER, this.bs), s.bufferData(s.ARRAY_BUFFER, m, s.DYNAMIC_DRAW), s.enableVertexAttribArray(0), s.vertexAttribPointer(0, 2, s.FLOAT, !1, 16, 0), s.enableVertexAttribArray(1), s.vertexAttribPointer(1, 2, s.FLOAT, !1, 16, 8), s.drawArrays(s.TRIANGLES, 0, 6), s.disableVertexAttribArray(1), s.disableVertexAttribArray(0), s.bindBuffer(s.ARRAY_BUFFER, null);
406
+ r.bindBuffer(r.ARRAY_BUFFER, this.bs), 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
  }
408
408
  $s() {
409
409
  this.A.deleteBuffer(this.bs);
410
410
  }
411
411
  }
412
412
  var E = ((h) => (h.RECTANGLE = "rectangle", h.LINE = "line", h.ELLIPSE = "ellipse", h.ARC = "arc", h.TRIANGLE = "triangle", h.BEZIER_CURVE = "bezier_curve", h))(E || {});
413
- const se = { rectangle: 2, line: 2, ellipse: 2, triangle: 2, arc: 3, bezier_curve: 4 };
414
- class ne {
413
+ const ne = { rectangle: 2, line: 2, ellipse: 2, triangle: 2, arc: 3, bezier_curve: 4 };
414
+ class he {
415
415
  constructor(t) {
416
416
  a(this, "A");
417
417
  a(this, "Fs", /* @__PURE__ */ new Map());
418
418
  this.A = t;
419
419
  }
420
- Ps(t, e, i, r) {
421
- const s = this.A;
420
+ Ps(t, e, i, s) {
421
+ const r = this.A;
422
422
  let n = this.Fs.get(t);
423
423
  n || (n = /* @__PURE__ */ new Map(), this.Fs.set(t, n));
424
424
  let o = n.get(e) || null;
425
425
  if (!o) {
426
- o = s.createVertexArray(), n.set(e, o), s.bindVertexArray(o), s.bindBuffer(s.ARRAY_BUFFER, r);
427
- const l = s.getAttribLocation(t, "A0");
428
- l !== -1 && gt(s, l, i._s.As.size, i.vs, i._s.As.offset, 0, s.FLOAT, !1);
429
- const c = s.getAttribLocation(t, "A1");
430
- c !== -1 && gt(s, c, i._s.ws.size, i.vs, i._s.ws.offset, 0, s.FLOAT, !1);
426
+ o = r.createVertexArray(), n.set(e, o), r.bindVertexArray(o), r.bindBuffer(r.ARRAY_BUFFER, s);
427
+ const l = r.getAttribLocation(t, "A0");
428
+ l !== -1 && pt(r, l, i._s.As.size, i.vs, i._s.As.offset, 0, r.FLOAT, !1);
429
+ const c = r.getAttribLocation(t, "A1");
430
+ c !== -1 && pt(r, c, i._s.ws.size, i.vs, i._s.ws.offset, 0, r.FLOAT, !1);
431
431
  }
432
- s.bindVertexArray(o);
432
+ r.bindVertexArray(o);
433
433
  }
434
434
  Ts() {
435
435
  this.A.bindVertexArray(null);
@@ -440,32 +440,32 @@ class ne {
440
440
  }
441
441
  const D = class D {
442
442
  static Es(t, e, i = 0) {
443
- const r = e || new Float32Array(D.FLOATS_PER_INSTANCE);
444
- let s = i;
445
- r[s++] = t.As[0], r[s++] = t.As[1], r[s++] = t.Rs[0], r[s++] = t.Rs[1], r[s++] = t.Gt[0], r[s++] = t.Gt[1], r[s++] = t.Gt[2], r[s++] = t.jt[0], r[s++] = t.jt[1], r[s++] = t.jt[2], r[s++] = t.jt[3], r[s++] = t.Qt[0], r[s++] = t.Qt[1], r[s++] = t.Qt[2], r[s++] = t.Qt[3], r[s++] = t.Ss[0], r[s++] = t.Ss[1], r[s++] = t.Ss[2], r[s++] = t.Tt;
443
+ const s = e || new Float32Array(D.FLOATS_PER_INSTANCE);
444
+ let r = i;
445
+ s[r++] = t.As[0], s[r++] = t.As[1], s[r++] = t.Rs[0], s[r++] = t.Rs[1], s[r++] = t.Gt[0], s[r++] = t.Gt[1], s[r++] = t.Gt[2], s[r++] = t.jt[0], s[r++] = t.jt[1], s[r++] = t.jt[2], s[r++] = t.jt[3], s[r++] = t.Qt[0], s[r++] = t.Qt[1], s[r++] = t.Qt[2], s[r++] = t.Qt[3], s[r++] = t.Ss[0], s[r++] = t.Ss[1], s[r++] = t.Ss[2], s[r++] = t.Tt;
446
446
  const n = t.ks;
447
- r[s++] = (n == null ? void 0 : n[0]) ?? 0, r[s++] = (n == null ? void 0 : n[1]) ?? 0, r[s++] = (n == null ? void 0 : n[2]) ?? 0;
447
+ s[r++] = (n == null ? void 0 : n[0]) ?? 0, s[r++] = (n == null ? void 0 : n[1]) ?? 0, s[r++] = (n == null ? void 0 : n[2]) ?? 0;
448
448
  const o = t.Ls;
449
- r[s++] = (o == null ? void 0 : o[0]) ?? 0, r[s++] = (o == null ? void 0 : o[1]) ?? 0, r[s++] = (o == null ? void 0 : o[2]) ?? 0;
449
+ s[r++] = (o == null ? void 0 : o[0]) ?? 0, s[r++] = (o == null ? void 0 : o[1]) ?? 0, s[r++] = (o == null ? void 0 : o[2]) ?? 0;
450
450
  const l = t.zs, c = t.Ds, u = t.Os, f = t.Hs, d = t.Bs, g = !(!c || !u);
451
- return g ? (r[s++] = (f == null ? void 0 : f[0]) ?? 0, r[s++] = (f == null ? void 0 : f[1]) ?? 0, r[s++] = (d == null ? void 0 : d[0]) ?? 0, r[s++] = (d == null ? void 0 : d[1]) ?? 0, r[s++] = c[0], r[s++] = c[1], r[s++] = u[0], r[s++] = u[1]) : !g && !!l ? (r[s++] = l[0], r[s++] = l[1], r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0) : (r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0, r[s++] = 0), r[s++] = t.Is ?? 0, r[s++] = t.Gs ?? 0, r[s++] = t.js ?? 0, r;
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++] = c[0], s[r++] = c[1], s[r++] = u[0], s[r++] = u[1]) : !g && !!l ? (s[r++] = l[0], s[r++] = l[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.Is ?? 0, s[r++] = t.Gs ?? 0, s[r++] = t.js ?? 0, s;
452
452
  }
453
453
  static Qs(t, e) {
454
- const i = t.length * D.FLOATS_PER_INSTANCE, r = e || new Float32Array(i);
455
- for (let s = 0; s < t.length; s++) {
456
- const n = s * D.FLOATS_PER_INSTANCE;
457
- D.Es(t[s], r, n);
454
+ const i = t.length * D.FLOATS_PER_INSTANCE, s = e || new Float32Array(i);
455
+ for (let r = 0; r < t.length; r++) {
456
+ const n = r * D.FLOATS_PER_INSTANCE;
457
+ D.Es(t[r], s, n);
458
458
  }
459
- return r;
459
+ return s;
460
460
  }
461
461
  };
462
462
  a(D, "BYTES_PER_INSTANCE", 144), a(D, "FLOATS_PER_INSTANCE", 36);
463
- let O = D;
464
- const C = class C {
463
+ let I = D;
464
+ const F = class F {
465
465
  };
466
- a(C, "STRIDE", O.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 Q = C;
468
- class he {
466
+ a(F, "STRIDE", I.BYTES_PER_INSTANCE), a(F, "ATTRIBUTES", { A2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: F.STRIDE, offset: 0, divisor: 1 }, A3: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: F.STRIDE, offset: 8, divisor: 1 }, A4: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: F.STRIDE, offset: 16, divisor: 1 }, A5: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: F.STRIDE, offset: 28, divisor: 1 }, A6: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: F.STRIDE, offset: 44, divisor: 1 }, A7: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: F.STRIDE, offset: 60, divisor: 1 }, A8: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: F.STRIDE, offset: 76, divisor: 1 }, A9: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: F.STRIDE, offset: 88, divisor: 1 }, Aa: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: F.STRIDE, offset: 100, divisor: 1 }, Ab: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: F.STRIDE, offset: 116, divisor: 1 }, Ac: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: F.STRIDE, offset: 132, divisor: 1 } });
467
+ let Q = F;
468
+ class oe {
469
469
  constructor(t = 1e3, e = 1.5) {
470
470
  a(this, "Ns");
471
471
  a(this, "Xs");
@@ -473,15 +473,15 @@ class he {
473
473
  a(this, "Ws", 0);
474
474
  a(this, "Ks", 0);
475
475
  this.Xs = t, this.Ys = e;
476
- const i = t * O.FLOATS_PER_INSTANCE;
476
+ const i = t * I.FLOATS_PER_INSTANCE;
477
477
  this.Ns = new Float32Array(i);
478
478
  }
479
479
  Zs(t) {
480
480
  if (t <= this.Xs) return;
481
481
  const e = Math.ceil(t * this.Ys), i = this.Xs;
482
482
  this.Xs = e;
483
- const r = e * O.FLOATS_PER_INSTANCE, s = new Float32Array(r), n = i * O.FLOATS_PER_INSTANCE;
484
- s.set(this.Ns.subarray(0, Math.min(n, this.Ws))), this.Ns = s;
483
+ const s = e * I.FLOATS_PER_INSTANCE, r = new Float32Array(s), n = i * I.FLOATS_PER_INSTANCE;
484
+ r.set(this.Ns.subarray(0, Math.min(n, this.Ws))), this.Ns = r;
485
485
  }
486
486
  qs() {
487
487
  return { buffer: this.Ns, offset: this.Ws };
@@ -508,7 +508,7 @@ class he {
508
508
  return this.Ks === 0;
509
509
  }
510
510
  }
511
- class oe {
511
+ class ae {
512
512
  constructor(t) {
513
513
  a(this, "Ns");
514
514
  this.Ns = t;
@@ -517,14 +517,14 @@ class oe {
517
517
  this.Ns.Zs(this.Ns.se + 1);
518
518
  const { buffer: e, offset: i } = this.Ns.qs();
519
519
  e[i + 0] = t.x, e[i + 1] = t.y, e[i + 2] = t.width, e[i + 3] = t.height, e[i + 4] = t.char0, e[i + 5] = t.char1, e[i + 6] = t.char2, e[i + 7] = t.r1, e[i + 8] = t.g1, e[i + 9] = t.b1, e[i + 10] = t.a1, e[i + 11] = t.r2, e[i + 12] = t.g2, e[i + 13] = t.b2, e[i + 14] = t.a2, e[i + 15] = t.invert, e[i + 16] = t.flipX, e[i + 17] = t.flipY, e[i + 18] = t.charRot, e[i + 19] = t.translationX, e[i + 20] = t.translationY, e[i + 21] = t.translationZ, e[i + 22] = t.rotationX, e[i + 23] = t.rotationY, e[i + 24] = t.rotationZ;
520
- const r = t.curveParams0, s = t.curveParams1;
521
- return e[i + 25] = r[0], e[i + 26] = r[1], e[i + 27] = r[2], e[i + 28] = r[3], e[i + 29] = s[0], e[i + 30] = s[1], e[i + 31] = s[2], e[i + 32] = s[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Ns.Vs(O.FLOATS_PER_INSTANCE), this.Ns.se - 1;
520
+ const s = t.curveParams0, r = t.curveParams1;
521
+ return e[i + 25] = s[0], e[i + 26] = s[1], e[i + 27] = s[2], e[i + 28] = s[3], e[i + 29] = r[0], e[i + 30] = r[1], e[i + 31] = r[2], e[i + 32] = r[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Ns.Vs(I.FLOATS_PER_INSTANCE), this.Ns.se - 1;
522
522
  }
523
523
  get se() {
524
524
  return this.Ns.se;
525
525
  }
526
526
  }
527
- class ae {
527
+ class le {
528
528
  constructor(t, e = 1e3) {
529
529
  a(this, "A");
530
530
  a(this, "oe", null);
@@ -535,8 +535,8 @@ class ae {
535
535
  ce(t) {
536
536
  const e = this.A;
537
537
  this.oe && e.deleteBuffer(this.oe), this.oe = e.createBuffer();
538
- const i = t * O.BYTES_PER_INSTANCE;
539
- Ct(e, e.ARRAY_BUFFER, this.oe, i, e.DYNAMIC_DRAW), this.he = t;
538
+ const i = t * I.BYTES_PER_INSTANCE;
539
+ Pt(e, e.ARRAY_BUFFER, this.oe, i, e.DYNAMIC_DRAW), this.he = t;
540
540
  }
541
541
  le(t) {
542
542
  this.ce(t);
@@ -548,50 +548,50 @@ class ae {
548
548
  if (e === 0) return;
549
549
  const i = this.A;
550
550
  i.bindBuffer(i.ARRAY_BUFFER, this.oe);
551
- const r = e * O.FLOATS_PER_INSTANCE;
552
- i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, r);
551
+ const s = e * I.FLOATS_PER_INSTANCE;
552
+ i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, s);
553
553
  }
554
554
  fe(t) {
555
555
  let e = this.ae.get(t);
556
556
  if (!e) {
557
557
  e = /* @__PURE__ */ new Map();
558
558
  const i = this.A;
559
- for (const r in Q.ATTRIBUTES) {
560
- const s = i.getAttribLocation(t, r);
561
- s !== -1 && e.set(r, s);
559
+ for (const s in Q.ATTRIBUTES) {
560
+ const r = i.getAttribLocation(t, s);
561
+ r !== -1 && e.set(s, r);
562
562
  }
563
563
  this.ae.set(t, e);
564
564
  }
565
565
  return e;
566
566
  }
567
567
  de(t) {
568
- const e = this.A, i = t.program, r = this.fe(i);
569
- for (const [s, n] of r) {
570
- const o = Q.ATTRIBUTES[s];
571
- o && gt(e, n, o.size, o.stride, o.offset, o.divisor, o.type, o.normalized);
568
+ const e = this.A, i = t.program, s = this.fe(i);
569
+ for (const [r, n] of s) {
570
+ const o = Q.ATTRIBUTES[r];
571
+ o && pt(e, n, o.size, o.stride, o.offset, o.divisor, o.type, o.normalized);
572
572
  }
573
573
  }
574
574
  pe(t) {
575
575
  const e = this.A, i = this.fe(t.program);
576
- for (const [r, s] of i)
577
- Q.ATTRIBUTES[r] && (e.disableVertexAttribArray(s), e.vertexAttribDivisor(s, 0));
576
+ for (const [s, r] of i)
577
+ Q.ATTRIBUTES[s] && (e.disableVertexAttribArray(r), e.vertexAttribDivisor(r, 0));
578
578
  }
579
579
  $s() {
580
580
  this.oe && (this.A.deleteBuffer(this.oe), this.oe = null), this.ae.clear();
581
581
  }
582
582
  }
583
- class le {
583
+ class ce {
584
584
  constructor(t, e = 1e3, i = 1.5) {
585
585
  a(this, "A");
586
586
  a(this, "Ns");
587
587
  a(this, "ve");
588
588
  a(this, "ge");
589
- this.A = t, this.Ns = new he(e, i), this.ve = new oe(this.Ns), this.ge = new ae(t, e);
589
+ this.A = t, this.Ns = new oe(e, i), this.ve = new ae(this.Ns), this.ge = new le(t, e);
590
590
  }
591
591
  me(t) {
592
- var r, s, n, o, l, c, u, f, d, g;
592
+ var s, r, n, o, l, c, u, f, d, g;
593
593
  const e = [0, 0, 0, 0], i = [0, 0, 0, 0];
594
- return t.Ds && t.Os ? (e[0] = ((r = t.Hs) == null ? void 0 : r[0]) ?? 0, e[1] = ((s = t.Hs) == null ? void 0 : s[1]) ?? 0, e[2] = ((n = t.Bs) == null ? void 0 : n[0]) ?? 0, e[3] = ((o = t.Bs) == null ? void 0 : o[1]) ?? 0, i[0] = t.Ds[0], i[1] = t.Ds[1], i[2] = t.Os[0], i[3] = t.Os[1]) : t.zs && (e[0] = t.zs[0], e[1] = t.zs[1]), this.ne({ x: t.As[0], y: t.As[1], width: t.Rs[0], height: t.Rs[1], char0: t.Gt[0], char1: t.Gt[1], char2: t.Gt[2], r1: t.jt[0], g1: t.jt[1], b1: t.jt[2], a1: t.jt[3], r2: t.Qt[0], g2: t.Qt[1], b2: t.Qt[2], a2: t.Qt[3], invert: t.Ss[0], flipX: t.Ss[1], flipY: t.Ss[2], charRot: t.Tt, translationX: ((l = t.ks) == null ? void 0 : l[0]) ?? 0, translationY: ((c = t.ks) == null ? void 0 : c[1]) ?? 0, translationZ: ((u = t.ks) == null ? void 0 : u[2]) ?? 0, rotationX: ((f = t.Ls) == null ? void 0 : f[0]) ?? 0, rotationY: ((d = t.Ls) == null ? void 0 : d[1]) ?? 0, rotationZ: ((g = t.Ls) == null ? void 0 : g[2]) ?? 0, curveParams0: e, curveParams1: i, depth: t.Is || 0, baseZ: t.Gs || 0, geometryType: t.js || 0 });
594
+ return t.Ds && t.Os ? (e[0] = ((s = t.Hs) == null ? void 0 : s[0]) ?? 0, e[1] = ((r = t.Hs) == null ? void 0 : r[1]) ?? 0, e[2] = ((n = t.Bs) == null ? void 0 : n[0]) ?? 0, e[3] = ((o = t.Bs) == null ? void 0 : o[1]) ?? 0, i[0] = t.Ds[0], i[1] = t.Ds[1], i[2] = t.Os[0], i[3] = t.Os[1]) : t.zs && (e[0] = t.zs[0], e[1] = t.zs[1]), this.ne({ x: t.As[0], y: t.As[1], width: t.Rs[0], height: t.Rs[1], char0: t.Gt[0], char1: t.Gt[1], char2: t.Gt[2], r1: t.jt[0], g1: t.jt[1], b1: t.jt[2], a1: t.jt[3], r2: t.Qt[0], g2: t.Qt[1], b2: t.Qt[2], a2: t.Qt[3], invert: t.Ss[0], flipX: t.Ss[1], flipY: t.Ss[2], charRot: t.Tt, translationX: ((l = t.ks) == null ? void 0 : l[0]) ?? 0, translationY: ((c = t.ks) == null ? void 0 : c[1]) ?? 0, translationZ: ((u = t.ks) == null ? void 0 : u[2]) ?? 0, rotationX: ((f = t.Ls) == null ? void 0 : f[0]) ?? 0, rotationY: ((d = t.Ls) == null ? void 0 : d[1]) ?? 0, rotationZ: ((g = t.Ls) == null ? void 0 : g[2]) ?? 0, curveParams0: e, curveParams1: i, depth: t.Is || 0, baseZ: t.Gs || 0, geometryType: t.js || 0 });
595
595
  }
596
596
  ne(t) {
597
597
  const e = this.ve.ne(t);
@@ -624,15 +624,15 @@ class le {
624
624
  }
625
625
  }
626
626
  class N {
627
- constructor(t, e, i, r) {
627
+ constructor(t, e, i, s) {
628
628
  a(this, "A");
629
629
  a(this, "Ae");
630
630
  a(this, "we");
631
631
  a(this, "be");
632
632
  a(this, "xe", null);
633
- this.A = t, this.Ae = e, this.we = i, this.be = r;
634
- const s = this.A.createBuffer();
635
- Ct(this.A, this.A.ARRAY_BUFFER, s, this.be.Ce, this.A.STATIC_DRAW), this.xe = s;
633
+ this.A = t, this.Ae = e, this.we = i, this.be = s;
634
+ const r = this.A.createBuffer();
635
+ Pt(this.A, this.A.ARRAY_BUFFER, r, this.be.Ce, this.A.STATIC_DRAW), this.xe = r;
636
636
  }
637
637
  get type() {
638
638
  return this.we;
@@ -658,61 +658,61 @@ class N {
658
658
  Fe(t, e, i) {
659
659
  return this.Ae.me(t);
660
660
  }
661
- Pe(t, e, i, r, s, n) {
662
- const o = s.Dt ?? 0, l = s.Ot ?? 0, c = s.Ht ?? 0, u = s.At ?? 0, f = s.wt ?? 0, d = s.bt ?? 0, g = [0, 0, 0, 0], m = [0, 0, 0, 0];
661
+ Pe(t, e, i, s, r, n) {
662
+ const o = r.Dt ?? 0, l = r.Ot ?? 0, c = r.Ht ?? 0, u = r.At ?? 0, f = r.wt ?? 0, d = r.bt ?? 0, g = [0, 0, 0, 0], m = [0, 0, 0, 0];
663
663
  n && (n.bezStartX !== void 0 && n.bezStartY !== void 0 && n.bezEndX !== void 0 && n.bezEndY !== void 0 ? (g[0] = n.cp1x ?? 0, g[1] = n.cp1y ?? 0, g[2] = n.cp2x ?? 0, g[3] = n.cp2y ?? 0, m[0] = n.bezStartX ?? 0, m[1] = n.bezStartY ?? 0, m[2] = n.bezEndX ?? 0, m[3] = n.bezEndY ?? 0) : n.arcStart === void 0 && n.arcStop === void 0 || (g[0] = n.arcStart ?? 0, g[1] = n.arcStop ?? 0));
664
- const p = { x: t, y: e, width: i, height: r, char0: s.Gt[0], char1: s.Gt[1], char2: s.Gt[2], r1: s.jt[0], g1: s.jt[1], b1: s.jt[2], a1: s.jt[3], r2: s.Qt[0], g2: s.Qt[1], b2: s.Qt[2], a2: s.Qt[3], invert: s.Pt ? 1 : 0, flipX: s.Bt ? 1 : 0, flipY: s.It ? 1 : 0, charRot: s.Tt, translationX: o, translationY: l, translationZ: c, rotationX: u, rotationY: f, rotationZ: d, curveParams0: g, curveParams1: m, depth: (n == null ? void 0 : n.depth) ?? 0, baseZ: (n == null ? void 0 : n.baseZ) ?? 0, geometryType: se[this.we] ?? 0 };
664
+ const p = { x: t, y: e, width: i, height: s, char0: r.Gt[0], char1: r.Gt[1], char2: r.Gt[2], r1: r.jt[0], g1: r.jt[1], b1: r.jt[2], a1: r.jt[3], r2: r.Qt[0], g2: r.Qt[1], b2: r.Qt[2], a2: r.Qt[3], invert: r.Pt ? 1 : 0, flipX: r.Bt ? 1 : 0, flipY: r.It ? 1 : 0, charRot: r.Tt, translationX: o, translationY: l, translationZ: c, rotationX: u, rotationY: f, rotationZ: d, curveParams0: g, curveParams1: m, depth: (n == null ? void 0 : n.depth) ?? 0, baseZ: (n == null ? void 0 : n.baseZ) ?? 0, geometryType: ne[this.we] ?? 0 };
665
665
  return this.Ae.ne(p);
666
666
  }
667
667
  }
668
- const ce = { Ce: pt, Te: 6, ...z }, ue = { Ce: 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]), Te: 6, ...z }, fe = { Ce: function(h = 32) {
668
+ const ue = { Ce: mt, Te: 6, ...G }, fe = { Ce: 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]), Te: 6, ...G }, de = { Ce: function(h = 32) {
669
669
  const t = [], e = 2 * Math.PI / h;
670
670
  for (let i = 0; i < h; i++) {
671
- const r = i * e, s = (i + 1) % h * e, n = Math.cos(r), o = Math.sin(r), l = 0.5 * (n + 1), c = 0.5 * (o + 1), u = Math.cos(s), f = Math.sin(s), d = 0.5 * (u + 1), g = 0.5 * (f + 1);
671
+ const s = i * e, r = (i + 1) % h * e, n = Math.cos(s), o = Math.sin(s), l = 0.5 * (n + 1), c = 0.5 * (o + 1), u = Math.cos(r), f = Math.sin(r), d = 0.5 * (u + 1), g = 0.5 * (f + 1);
672
672
  t.push(0, 0, 0.5, 0.5, n, o, l, c, u, f, d, g);
673
673
  }
674
674
  return new Float32Array(t);
675
- }(32), Te: 96, ...z };
676
- let de = { Ce: function(h) {
675
+ }(32), Te: 96, ...G };
676
+ let ge = { Ce: function(h) {
677
677
  const t = [];
678
678
  for (let e = 0; e < h; e++) {
679
- const i = e / h, r = (e + 1) / h;
680
- t.push(i, 0, i, 0, i, 1, i, 1, r, 1, r, 1);
679
+ const i = e / h, s = (e + 1) / h;
680
+ t.push(i, 0, i, 0, i, 1, i, 1, s, 1, s, 1);
681
681
  }
682
682
  return new Float32Array(t);
683
- }(32), Te: 96, ...z };
684
- const ge = { Ce: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Te: 3, ...z }, pe = { Ce: function(h = 16) {
683
+ }(32), Te: 96, ...G };
684
+ const pe = { Ce: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Te: 3, ...G }, me = { Ce: function(h = 16) {
685
685
  const t = [];
686
686
  for (let e = 0; e < h; e++) {
687
- const i = e / h, r = (e + 1) / h;
688
- t.push(i, -0.5, i, 0, r, -0.5, r, 0, i, 0.5, i, 1, i, 0.5, i, 1, r, -0.5, r, 0, r, 0.5, r, 1);
687
+ const i = e / h, s = (e + 1) / h;
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), Te: 96, ...z }, me = { [E.RECTANGLE]: class extends N {
691
+ }(16), Te: 96, ...G }, ve = { [E.RECTANGLE]: class extends N {
692
692
  constructor(h, t) {
693
- super(h, t, E.RECTANGLE, ce);
693
+ super(h, t, E.RECTANGLE, ue);
694
694
  }
695
695
  me(h, t) {
696
696
  return this.Pe(0, 0, h.width, h.height, t);
697
697
  }
698
698
  }, [E.LINE]: class extends N {
699
699
  constructor(h, t) {
700
- super(h, t, E.LINE, ue);
700
+ super(h, t, E.LINE, fe);
701
701
  }
702
702
  me(h, t) {
703
- const e = h.x2 - h.x1, i = h.y2 - h.y1, r = Math.hypot(e, i), s = Math.atan2(i, e), n = t.zt || 1, o = h.x1 + e / 2 - r / 2, l = h.y1 + i / 2, c = { ...t, bt: (t.bt || 0) + s };
704
- return this.Pe(o, l, r, n, c);
703
+ const e = h.x2 - h.x1, i = h.y2 - h.y1, s = Math.hypot(e, i), r = Math.atan2(i, e), n = t.zt || 1, o = h.x1 + e / 2 - s / 2, l = h.y1 + i / 2, c = { ...t, bt: (t.bt || 0) + r };
704
+ return this.Pe(o, l, s, n, c);
705
705
  }
706
706
  }, [E.ELLIPSE]: class extends N {
707
707
  constructor(h, t) {
708
- super(h, t, E.ELLIPSE, fe);
708
+ super(h, t, E.ELLIPSE, de);
709
709
  }
710
710
  me(h, t) {
711
711
  return this.Pe(0, 0, h.width, h.height, t);
712
712
  }
713
713
  }, [E.ARC]: class extends N {
714
714
  constructor(h, t) {
715
- super(h, t, E.ARC, de);
715
+ super(h, t, E.ARC, ge);
716
716
  }
717
717
  me(h, t) {
718
718
  const e = h.start * Math.PI / 180, i = h.stop * Math.PI / 180;
@@ -720,29 +720,29 @@ const ge = { Ce: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Te:
720
720
  }
721
721
  }, [E.TRIANGLE]: class extends N {
722
722
  constructor(h, t) {
723
- super(h, t, E.TRIANGLE, ge);
723
+ super(h, t, E.TRIANGLE, pe);
724
724
  }
725
725
  me(h, t) {
726
- const e = Math.min(h.x1, h.x2, h.x3), i = Math.max(h.x1, h.x2, h.x3), r = Math.min(h.y1, h.y2, h.y3), s = i - e, n = Math.max(h.y1, h.y2, h.y3) - r;
727
- return this.Pe(e, r, s, n, t);
726
+ const e = Math.min(h.x1, h.x2, h.x3), i = Math.max(h.x1, h.x2, h.x3), s = Math.min(h.y1, h.y2, h.y3), r = i - e, n = Math.max(h.y1, h.y2, h.y3) - s;
727
+ return this.Pe(e, s, r, n, t);
728
728
  }
729
729
  }, [E.BEZIER_CURVE]: class extends N {
730
730
  constructor(h, t) {
731
- super(h, t, E.BEZIER_CURVE, pe);
731
+ super(h, t, E.BEZIER_CURVE, me);
732
732
  }
733
733
  me(h, t) {
734
734
  return this.Pe(0, 0, 1, t.zt || 1, t, { cp1x: h.cp1x, cp1y: h.cp1y, cp2x: h.cp2x, cp2y: h.cp2y, bezStartX: h.x1, bezStartY: h.y1, bezEndX: h.x2, bezEndY: h.y2 });
735
735
  }
736
736
  } };
737
- class ve {
737
+ class Ae {
738
738
  constructor(t) {
739
739
  a(this, "A");
740
740
  a(this, "Ee");
741
741
  a(this, "Re");
742
- this.A = t, this.Re = new ne(t), this.Ee = /* @__PURE__ */ new Map();
742
+ this.A = t, this.Re = new he(t), this.Ee = /* @__PURE__ */ new Map();
743
743
  for (const e of Object.values(E)) {
744
- const i = new le(t), r = new me[e](t, i);
745
- this.Ee.set(e, r);
744
+ const i = new ce(t), s = new ve[e](t, i);
745
+ this.Ee.set(e, s);
746
746
  }
747
747
  }
748
748
  Se(t) {
@@ -752,22 +752,22 @@ class ve {
752
752
  }
753
753
  ke(t) {
754
754
  const e = [];
755
- let i = null, r = null, s = null;
756
- for (const n of t) r !== n.material || s !== n.type ? (i && i.length > 0 && e.push({ material: r, type: s, commands: i }), i = [n], r = n.material, s = n.type) : i.push(n);
757
- return i && i.length > 0 && e.push({ material: r, type: s, commands: i }), e;
755
+ let i = null, s = null, r = null;
756
+ for (const n of t) s !== n.material || r !== n.type ? (i && i.length > 0 && e.push({ material: s, type: r, commands: i }), i = [n], s = n.material, r = n.type) : i.push(n);
757
+ return i && i.length > 0 && e.push({ material: s, type: r, commands: i }), e;
758
758
  }
759
759
  Le(t) {
760
- const { material: e, type: i, commands: r } = t, s = this.Ee.get(i);
760
+ const { material: e, type: i, commands: s } = t, r = this.Ee.get(i);
761
761
  e.shader.L(), e.shader.O(e.uniforms);
762
- const n = St(this.A), o = r.length > 0 && r[0].state.Rt;
763
- if (e.shader.O({ Uu: n[2] / n[3], Ur: [n[2], n[3]], Us: 1, Ut: o ? 1 : 0 }), s.Me(), r.forEach((l) => {
764
- s.me(l.params, l.state);
765
- }), s.$e()) {
766
- const l = s.unitGeometry, c = s.unitBuffer;
762
+ const n = St(this.A), o = s.length > 0 && s[0].state.Rt;
763
+ if (e.shader.O({ Uu: n[2] / n[3], Ur: [n[2], n[3]], Us: 1, Ut: o ? 1 : 0 }), r.Me(), s.forEach((l) => {
764
+ r.me(l.params, l.state);
765
+ }), r.$e()) {
766
+ const l = r.unitGeometry, c = r.unitBuffer;
767
767
  try {
768
- this.Re.Ps(e.shader.program, i + "", l, c), s.batch.de(e.shader), s.batch.Ms(l.gs, l.Te);
768
+ this.Re.Ps(e.shader.program, i + "", l, c), r.batch.de(e.shader), r.batch.Ms(l.gs, l.Te);
769
769
  } finally {
770
- s.batch.pe(e.shader), this.Re.Ts(), s.Me();
770
+ r.batch.pe(e.shader), this.Re.Ts(), r.Me();
771
771
  }
772
772
  }
773
773
  }
@@ -776,73 +776,73 @@ class ve {
776
776
  this.Ee.clear(), this.Re.$s();
777
777
  }
778
778
  }
779
- function Lt(h) {
779
+ function Ut(h) {
780
780
  let t = 0;
781
781
  for (let e = 0; e < h.length; e++)
782
782
  t = (t << 5) - t + h.charCodeAt(e), t &= t;
783
783
  return t;
784
784
  }
785
- const Et = /* @__PURE__ */ new WeakMap();
786
- let Ae = 1;
787
- function bt(h) {
785
+ const bt = /* @__PURE__ */ new WeakMap();
786
+ let ye = 1;
787
+ function Tt(h) {
788
788
  if (h == null) return 0;
789
- if (typeof h != "object" && typeof h != "function") return Lt(h + "");
790
- let t = Et.get(h);
791
- return t || (t = Ae++, Et.set(h, t)), t;
789
+ if (typeof h != "object" && typeof h != "function") return Ut(h + "");
790
+ let t = bt.get(h);
791
+ return t || (t = ye++, bt.set(h, t)), t;
792
792
  }
793
793
  function Y(h, t) {
794
794
  return (h << 5) - h + t;
795
795
  }
796
- class ye {
796
+ class we {
797
797
  constructor(t) {
798
798
  a(this, "ze", 0);
799
799
  a(this, "De");
800
800
  a(this, "Oe");
801
801
  a(this, "He", /* @__PURE__ */ new Map());
802
- this.De = new Z(t, nt, `#version 300 es
802
+ this.De = new V(t, nt, `#version 300 es
803
803
  precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellColor;in vec4 v_glyphFlags;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){int B=int(v_glyphFlags.r>0.5?1:0);int C=int(v_glyphFlags.g>0.5?1:0);int D=int(v_glyphFlags.b>0.5?1:0);float E=float(B|(C<<1)|(D<<2))/255.;o_character=vec4(v_glyphIndex.xy,E,clamp(v_glyphFlags.a,0.,1.));o_primaryColor=vec4(v_glyphColor.rgb,v_glyphColor.a);o_secondaryColor=vec4(v_cellColor.rgb,v_cellColor.a);A=vec4(0.);}`), this.Oe = { id: this.ze++, shader: this.De, uniforms: Object.freeze({}), hash: this.Be(this.De, {}), isBuiltIn: !0 };
804
804
  }
805
805
  get Ie() {
806
806
  return this.Oe;
807
807
  }
808
808
  ft(t, e = {}, i = !1) {
809
- const r = this.Be(t, e), s = this.He.get(r);
810
- if (s) return s;
811
- const n = { id: this.ze++, shader: t, uniforms: Object.freeze({ ...e }), hash: r, isBuiltIn: i };
812
- return this.He.set(r, n), n;
809
+ const s = this.Be(t, e), r = this.He.get(s);
810
+ if (r) return r;
811
+ const n = { id: this.ze++, shader: t, uniforms: Object.freeze({ ...e }), hash: s, isBuiltIn: i };
812
+ return this.He.set(s, n), n;
813
813
  }
814
814
  Ge(t, e = {}) {
815
815
  return { id: this.ze++, shader: t, uniforms: Object.freeze({ ...e }), hash: 0, isBuiltIn: !1 };
816
816
  }
817
817
  Be(t, e) {
818
- const i = bt(t.program), r = function(s, n) {
818
+ const i = Tt(t.program), s = function(r, n) {
819
819
  let o = 0;
820
- const l = Object.keys(s).sort();
821
- for (const c of l) o = Y(o, Lt(c)), o = Y(o, n(s[c]));
820
+ const l = Object.keys(r).sort();
821
+ for (const c of l) o = Y(o, Ut(c)), o = Y(o, n(r[c]));
822
822
  return o;
823
823
  }(e, this.je.bind(this));
824
- return Y(i, r);
824
+ return Y(i, s);
825
825
  }
826
826
  je(t) {
827
827
  return typeof t == "number" || typeof t == "boolean" ? function(e) {
828
828
  return typeof e == "boolean" ? e ? 1 : 0 : Math.floor(e);
829
829
  }(t) : Array.isArray(t) ? function(e) {
830
830
  let i = 0;
831
- const r = Array.isArray(e[0]) ? e.flat() : e;
832
- for (const s of r) i = Y(i, typeof s == "number" ? s : 0);
831
+ const s = Array.isArray(e[0]) ? e.flat() : e;
832
+ for (const r of s) i = Y(i, typeof r == "number" ? r : 0);
833
833
  return i;
834
834
  }(t) : t instanceof Float32Array || t instanceof Int32Array ? function(e) {
835
835
  let i = 0;
836
- const r = Math.min(e.length, 16);
837
- for (let s = 0; s < r; s++) i = Y(i, e[s]);
836
+ const s = Math.min(e.length, 16);
837
+ for (let r = 0; r < s; r++) i = Y(i, e[r]);
838
838
  return i;
839
- }(t) : t instanceof WebGLTexture ? bt(t) : 0;
839
+ }(t) : t instanceof WebGLTexture ? Tt(t) : 0;
840
840
  }
841
841
  $s() {
842
842
  this.De != this.De && this.De.dispose(), this.De.dispose(), this.He.clear();
843
843
  }
844
844
  }
845
- class we {
845
+ class xe {
846
846
  constructor() {
847
847
  a(this, "Qe", []);
848
848
  a(this, "Ne", 1);
@@ -850,35 +850,35 @@ class we {
850
850
  }
851
851
  Xe(t, e) {
852
852
  if (this.Rs >= this.Qe.length) {
853
- const r = { id: this.Ne++, type: t, params: {}, state: ht.Lt(), material: e };
854
- this.Qe.push(r);
853
+ const s = { id: this.Ne++, type: t, params: {}, state: ht.Lt(), material: e };
854
+ this.Qe.push(s);
855
855
  }
856
856
  const i = this.Qe[this.Rs];
857
857
  return i.id = this.Ne++, i.type = t, i.material = e, this.Rs++, i;
858
858
  }
859
859
  Ye(t, e, i) {
860
- const r = this.Xe(E.RECTANGLE, i), s = r.params;
861
- return s.width = t.width, s.height = t.height, e.Yt(r.state), r.id;
860
+ const s = this.Xe(E.RECTANGLE, i), r = s.params;
861
+ return r.width = t.width, r.height = t.height, e.Yt(s.state), s.id;
862
862
  }
863
863
  We(t, e, i) {
864
- const r = this.Xe(E.LINE, i), s = r.params;
865
- return s.x1 = t.x1, s.y1 = t.y1, s.x2 = t.x2, s.y2 = t.y2, s.thickness = t.thickness, e.Yt(r.state), r.id;
864
+ const s = this.Xe(E.LINE, i), r = s.params;
865
+ return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, e.Yt(s.state), s.id;
866
866
  }
867
867
  Ke(t, e, i) {
868
- const r = this.Xe(E.ELLIPSE, i), s = r.params;
869
- return s.width = t.width, s.height = t.height, s.startAngle = t.startAngle, s.endAngle = t.endAngle, s.segments = t.segments, e.Yt(r.state), r.id;
868
+ const s = this.Xe(E.ELLIPSE, i), r = s.params;
869
+ return r.width = t.width, r.height = t.height, r.startAngle = t.startAngle, r.endAngle = t.endAngle, r.segments = t.segments, e.Yt(s.state), s.id;
870
870
  }
871
871
  Ze(t, e, i) {
872
- const r = this.Xe(E.ARC, i), s = r.params;
873
- return s.width = t.width, s.height = t.height, s.start = t.start, s.stop = t.stop, e.Yt(r.state), r.id;
872
+ const s = this.Xe(E.ARC, i), r = s.params;
873
+ return r.width = t.width, r.height = t.height, r.start = t.start, r.stop = t.stop, e.Yt(s.state), s.id;
874
874
  }
875
875
  qe(t, e, i) {
876
- const r = this.Xe(E.TRIANGLE, i), s = r.params;
877
- return s.x1 = t.x1, s.y1 = t.y1, s.x2 = t.x2, s.y2 = t.y2, s.x3 = t.x3, s.y3 = t.y3, e.Yt(r.state), r.id;
876
+ const s = this.Xe(E.TRIANGLE, i), r = s.params;
877
+ return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.x3 = t.x3, r.y3 = t.y3, e.Yt(s.state), s.id;
878
878
  }
879
879
  Ve(t, e, i) {
880
- const r = this.Xe(E.BEZIER_CURVE, i), s = r.params;
881
- return s.x1 = t.x1, s.y1 = t.y1, s.cp1x = t.cp1x, s.cp1y = t.cp1y, s.cp2x = t.cp2x, s.cp2y = t.cp2y, s.x2 = t.x2, s.y2 = t.y2, s.thickness = t.thickness, s.segments = t.segments, e.Yt(r.state), r.id;
880
+ const s = this.Xe(E.BEZIER_CURVE, i), r = s.params;
881
+ return r.x1 = t.x1, r.y1 = t.y1, r.cp1x = t.cp1x, r.cp1y = t.cp1y, r.cp2x = t.cp2x, r.cp2y = t.cp2y, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, r.segments = t.segments, e.Yt(s.state), s.id;
882
882
  }
883
883
  ye() {
884
884
  this.Rs = 0;
@@ -889,7 +889,7 @@ class we {
889
889
  return { next: () => t < e ? { value: i[t++], done: !1 } : { value: void 0, done: !0 } };
890
890
  }
891
891
  }
892
- class xe {
892
+ class Ee {
893
893
  constructor(t) {
894
894
  a(this, "A");
895
895
  a(this, "Je", null);
@@ -906,7 +906,7 @@ class xe {
906
906
  a(this, "ci", null);
907
907
  a(this, "li", [0, 0, 0, 0]);
908
908
  a(this, "ui", 1);
909
- this.A = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.si = new ht(), this.dt = new ye(t), this.ei = new we(), this.ti = new ve(t), this.ii = new re(t);
909
+ this.A = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.si = new ht(), this.dt = new we(t), this.ei = new xe(), this.ti = new Ae(t), this.ii = new re(t);
910
910
  const e = [0, 0, t.canvas.width, t.canvas.height];
911
911
  at(t, e), this.oi.push(null), this.hi.push(e), this.ai.push(1), this.ci = null, this.li = e, this.ui = 1;
912
912
  }
@@ -917,17 +917,17 @@ class xe {
917
917
  const t = this.oi.pop() ?? null, e = this.hi.pop() ?? [0, 0, this.A.canvas.width, this.A.canvas.height], i = this.ai.pop() ?? 1;
918
918
  this.rt(t, e[2], e[3], i);
919
919
  }
920
- rt(t, e, i, r = 1) {
921
- const s = this.A;
922
- this.ci !== t && (s.bindFramebuffer(s.FRAMEBUFFER, t), this.ci = t), this.ui = r;
920
+ rt(t, e, i, s = 1) {
921
+ const r = this.A;
922
+ this.ci !== t && (r.bindFramebuffer(r.FRAMEBUFFER, t), this.ci = t), this.ui = s;
923
923
  const n = [0, 0, e, i];
924
- this.li[0] === n[0] && this.li[1] === n[1] && this.li[2] === n[2] && this.li[3] === n[3] || (s.viewport(...n), at(s, n), this.li = n);
924
+ this.li[0] === n[0] && this.li[1] === n[1] && this.li[2] === n[2] && this.li[3] === n[3] || (r.viewport(...n), at(r, n), this.li = n);
925
925
  }
926
926
  fi(t) {
927
927
  this.Je !== t && (this.Je = t, t.L());
928
928
  }
929
929
  di(t, e) {
930
- return new Z(this.A, t, e);
930
+ return new V(this.A, t, e);
931
931
  }
932
932
  pi(t) {
933
933
  this.ri = t, t && (this.ni = {});
@@ -939,13 +939,13 @@ class xe {
939
939
  Object.assign(this.ni, t);
940
940
  }
941
941
  mi(t) {
942
- return new Z(this.A, nt, t);
942
+ return new V(this.A, nt, t);
943
943
  }
944
- _i(t, e, i, r) {
945
- t instanceof X || !r || t.yi(r), this.ei.Ye({ width: e ?? t.width, height: i ?? t.height }, this.si, t.lt());
944
+ _i(t, e, i, s) {
945
+ t instanceof K || !s || t.yi(s), this.ei.Ye({ width: e ?? t.width, height: i ?? t.height }, this.si, t.lt());
946
946
  }
947
- Ai(t, e, i, r) {
948
- this.ii.Ms(t, e, i, r);
947
+ Ai(t, e, i, s) {
948
+ this.ii.Ms(t, e, i, s);
949
949
  }
950
950
  wi(t, e) {
951
951
  if (this.ri) {
@@ -953,39 +953,39 @@ class xe {
953
953
  this.ei.Ye({ width: t, height: e }, this.si, i), this.ri = null, this.ni = {};
954
954
  } else this.ei.Ye({ width: t, height: e }, this.si, this.dt.Ie);
955
955
  }
956
- bi(t, e, i, r) {
957
- this.ei.We({ x1: t, y1: e, x2: i, y2: r }, this.si, this.dt.Ie);
956
+ bi(t, e, i, s) {
957
+ this.ei.We({ x1: t, y1: e, x2: i, y2: s }, this.si, this.dt.Ie);
958
958
  }
959
959
  xi(t, e) {
960
960
  this.ei.Ke({ width: t, height: e }, this.si, this.dt.Ie);
961
961
  }
962
- Ci(t, e, i, r, s, n) {
963
- this.ei.qe({ x1: t, y1: e, x2: i, y2: r, x3: s, y3: n }, this.si, this.dt.Ie);
962
+ Ci(t, e, i, s, r, n) {
963
+ this.ei.qe({ x1: t, y1: e, x2: i, y2: s, x3: r, y3: n }, this.si, this.dt.Ie);
964
964
  }
965
- Mi(t, e, i, r, s, n, o, l) {
966
- this.ei.Ve({ x1: t, y1: e, cp1x: i, cp1y: r, cp2x: s, cp2y: n, x2: o, y2: l }, this.si, this.dt.Ie);
965
+ Mi(t, e, i, s, r, n, o, l) {
966
+ this.ei.Ve({ x1: t, y1: e, cp1x: i, cp1y: s, cp2x: r, cp2y: n, x2: o, y2: l }, this.si, this.dt.Ie);
967
967
  }
968
- $i(t, e, i, r) {
969
- this.ei.Ze({ width: t, height: e, start: i, stop: r }, this.si, this.dt.Ie);
968
+ $i(t, e, i, s) {
969
+ this.ei.Ze({ width: t, height: e, start: i, stop: s }, this.si, this.dt.Ie);
970
970
  }
971
- Fi(t, e, i = 1, r = {}) {
972
- return new X(this.A, t, e, i, r, this);
971
+ Fi(t, e, i = 1, s = {}) {
972
+ return new K(this.A, t, e, i, s, this);
973
973
  }
974
- Pi(t, e = t, i = t, r = 255) {
975
- this.si.ds(t, e ?? t, i ?? t, r);
976
- const [s, n, o, l] = this.si.canvasBackgroundColor;
977
- this.Ti(s, n, o, l, !1);
974
+ Pi(t, e = t, i = t, s = 255) {
975
+ this.si.ds(t, e ?? t, i ?? t, s);
976
+ const [r, n, o, l] = this.si.canvasBackgroundColor;
977
+ this.Ti(r, n, o, l, !1);
978
978
  }
979
- ye(t = 0, e = 0, i = 0, r = 0) {
980
- this.Ti(t, e, i, r, !0);
979
+ ye(t = 0, e = 0, i = 0, s = 0) {
980
+ this.Ti(t, e, i, s, !0);
981
981
  }
982
- Ti(t, e, i, r, s) {
982
+ Ti(t, e, i, s, r) {
983
983
  const n = this.A;
984
984
  if (this.ui > 1) {
985
- const o = s ? [1, 1, 0, 0] : [0, 0, 0, 0];
986
- n.clearBufferfv(n.COLOR, 0, new Float32Array(o)), n.clearBufferfv(n.COLOR, 1, new Float32Array([0, 0, 0, 0])), this.ui >= 3 && n.clearBufferfv(n.COLOR, 2, new Float32Array([t, e, i, r]));
985
+ const o = r ? [1, 1, 0, 0] : [0, 0, 0, 0];
986
+ n.clearBufferfv(n.COLOR, 0, new Float32Array(o)), n.clearBufferfv(n.COLOR, 1, new Float32Array([0, 0, 0, 0])), this.ui >= 3 && n.clearBufferfv(n.COLOR, 2, new Float32Array([t, e, i, s]));
987
987
  for (let l = 3; l < this.ui; l++) n.clearBufferfv(n.COLOR, l, new Float32Array([0, 0, 0, 0]));
988
- } else n.clearColor(t, e, i, r), n.clear(n.COLOR_BUFFER_BIT);
988
+ } else n.clearColor(t, e, i, s), n.clear(n.COLOR_BUFFER_BIT);
989
989
  }
990
990
  Ei() {
991
991
  const t = [0, 0, this.A.canvas.width, this.A.canvas.height];
@@ -1010,14 +1010,14 @@ class xe {
1010
1010
  }
1011
1011
  const R = { readShort: (h, t) => (R.t.uint16[0] = h[t] << 8 | h[t + 1], R.t.int16[0]), readUshort: (h, t) => h[t] << 8 | h[t + 1], readUshorts(h, t, e) {
1012
1012
  const i = [];
1013
- for (let r = 0; r < e; r++) i.push(R.readUshort(h, t + 2 * r));
1013
+ for (let s = 0; s < e; s++) i.push(R.readUshort(h, t + 2 * s));
1014
1014
  return i;
1015
1015
  }, readUint(h, t) {
1016
1016
  const e = R.t.uint8;
1017
1017
  return e[3] = h[t], e[2] = h[t + 1], e[1] = h[t + 2], e[0] = h[t + 3], R.t.uint32[0];
1018
1018
  }, readASCII(h, t, e) {
1019
1019
  let i = "";
1020
- for (let r = 0; r < e; r++) i += String.fromCharCode(h[t + r]);
1020
+ for (let s = 0; s < e; s++) i += String.fromCharCode(h[t + s]);
1021
1021
  return i;
1022
1022
  }, t: (() => {
1023
1023
  const h = new ArrayBuffer(8);
@@ -1029,20 +1029,20 @@ function $(h) {
1029
1029
  function tt(h, t, e) {
1030
1030
  h[t] = e >>> 8 & 255, h[t + 1] = 255 & e;
1031
1031
  }
1032
- function B(h, t, e) {
1032
+ function O(h, t, e) {
1033
1033
  h[t] = e >>> 24 & 255, h[t + 1] = e >>> 16 & 255, h[t + 2] = e >>> 8 & 255, h[t + 3] = 255 & e;
1034
1034
  }
1035
- function Ee(h, t, e) {
1035
+ function be(h, t, e) {
1036
1036
  for (let i = 0; i < e.length; i++) h[t + i] = 255 & e.charCodeAt(i);
1037
1037
  }
1038
1038
  function lt(h, t, e) {
1039
1039
  const i = t + e;
1040
- let r = 0;
1041
- const s = R.t;
1042
- for (let n = t; n < i; n += 4) s.uint8[3] = h[n] || 0, s.uint8[2] = h[n + 1] || 0, s.uint8[1] = h[n + 2] || 0, s.uint8[0] = h[n + 3] || 0, r = r + (s.uint32[0] >>> 0) >>> 0;
1043
- return r >>> 0;
1040
+ let s = 0;
1041
+ const r = R.t;
1042
+ for (let n = t; n < i; n += 4) r.uint8[3] = h[n] || 0, r.uint8[2] = h[n + 1] || 0, r.uint8[1] = h[n + 2] || 0, r.uint8[0] = h[n + 3] || 0, s = s + (r.uint32[0] >>> 0) >>> 0;
1043
+ return s >>> 0;
1044
1044
  }
1045
- class be {
1045
+ class Te {
1046
1046
  constructor(t) {
1047
1047
  a(this, "b");
1048
1048
  a(this, "p", 0);
@@ -1071,17 +1071,17 @@ function H(h) {
1071
1071
  if (e === 0) return { min: 0, max: 0, table: /* @__PURE__ */ new Map() };
1072
1072
  const i = new Uint32Array(e + 1);
1073
1073
  for (const o of h) o && i[o]++;
1074
- const r = new Uint32Array(e + 1);
1075
- let s = 0;
1074
+ const s = new Uint32Array(e + 1);
1075
+ let r = 0;
1076
1076
  i[0] = 0;
1077
- for (let o = 1; o <= e; o++) s = s + i[o - 1] << 1, r[o] = s;
1077
+ for (let o = 1; o <= e; o++) r = r + i[o - 1] << 1, s[o] = r;
1078
1078
  const n = /* @__PURE__ */ new Map();
1079
1079
  for (let o = 0; o < h.length; o++) {
1080
1080
  const l = h[o];
1081
1081
  if (!l) continue;
1082
- const c = r[l]++;
1082
+ const c = s[l]++;
1083
1083
  let u = n.get(l);
1084
- u || (u = [], n.set(l, u)), u[Te(c, l)] = o;
1084
+ u || (u = [], n.set(l, u)), u[Re(c, l)] = o;
1085
1085
  }
1086
1086
  return { min: t, max: e, table: n };
1087
1087
  }
@@ -1089,38 +1089,38 @@ function ct(h, t) {
1089
1089
  let e = 0;
1090
1090
  for (let i = 1; i <= t.max; i++) {
1091
1091
  e |= h.readBits(1) << i - 1;
1092
- const r = t.table.get(i);
1093
- if (r && e < r.length) {
1094
- const s = r[e];
1095
- if (s !== void 0) return s;
1092
+ const s = t.table.get(i);
1093
+ if (s && e < s.length) {
1094
+ const r = s[e];
1095
+ if (r !== void 0) return r;
1096
1096
  }
1097
1097
  }
1098
1098
  throw Error("Invalid Huffman code");
1099
1099
  }
1100
- function Te(h, t) {
1100
+ function Re(h, t) {
1101
1101
  let e = 0;
1102
1102
  for (let i = 0; i < t; i++) e = e << 1 | 1 & h, h >>>= 1;
1103
1103
  return e >>> 0;
1104
1104
  }
1105
- function Re(h) {
1105
+ function Me(h) {
1106
1106
  if (h.length < 2) throw Error("ZLIB data too short");
1107
1107
  const t = h[0], e = h[1];
1108
1108
  if ((15 & t) != 8) throw Error("Unsupported ZLIB compression method");
1109
1109
  if (((t << 8) + e) % 31 != 0) throw Error("Bad ZLIB header check");
1110
1110
  let i = 2;
1111
1111
  32 & e && (i += 4);
1112
- const r = [];
1113
- return function(s, n) {
1112
+ const s = [];
1113
+ return function(r, n) {
1114
1114
  const o = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258], l = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], c = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577], u = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13];
1115
1115
  let f = 0;
1116
1116
  for (; !f; ) {
1117
- f = s.readBits(1);
1118
- const d = s.readBits(2);
1117
+ f = r.readBits(1);
1118
+ const d = r.readBits(2);
1119
1119
  if (d === 0) {
1120
- s.alignToByte();
1121
- const g = s.readBits(16);
1122
- if ((65535 & (65535 ^ g)) !== s.readBits(16)) throw Error("DEFLATE uncompressed LEN/NLEN mismatch");
1123
- for (let m = 0; m < g; m++) n.push(s.readBits(8));
1120
+ r.alignToByte();
1121
+ const g = r.readBits(16);
1122
+ if ((65535 & (65535 ^ g)) !== r.readBits(16)) throw Error("DEFLATE uncompressed LEN/NLEN mismatch");
1123
+ for (let m = 0; m < g; m++) n.push(r.readBits(8));
1124
1124
  } else {
1125
1125
  if (d !== 1 && d !== 2) throw Error("Unsupported DEFLATE type");
1126
1126
  {
@@ -1133,31 +1133,31 @@ function Re(h) {
1133
1133
  for (let v = 280; v <= 287; v++) p[v] = 8;
1134
1134
  g = H(p), m = H(Array(32).fill(5));
1135
1135
  } else {
1136
- const p = s.readBits(5) + 257, v = s.readBits(5) + 1, A = s.readBits(4) + 4, w = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], y = Array(19).fill(0);
1137
- for (let T = 0; T < A; T++) y[w[T]] = s.readBits(3);
1136
+ const p = r.readBits(5) + 257, v = r.readBits(5) + 1, A = r.readBits(4) + 4, w = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], y = Array(19).fill(0);
1137
+ for (let T = 0; T < A; T++) y[w[T]] = r.readBits(3);
1138
1138
  const b = H(y), x = [];
1139
1139
  for (; x.length < p + v; ) {
1140
- const T = ct(s, b);
1140
+ const T = ct(r, b);
1141
1141
  if (T <= 15) x.push(T);
1142
1142
  else if (T === 16) {
1143
- const U = s.readBits(2) + 3, F = x[x.length - 1] || 0;
1144
- for (let J = 0; J < U; J++) x.push(F);
1143
+ const U = r.readBits(2) + 3, C = x[x.length - 1] || 0;
1144
+ for (let J = 0; J < U; J++) x.push(C);
1145
1145
  } else if (T === 17) {
1146
- const U = s.readBits(3) + 3;
1147
- for (let F = 0; F < U; F++) x.push(0);
1146
+ const U = r.readBits(3) + 3;
1147
+ for (let C = 0; C < U; C++) x.push(0);
1148
1148
  } else {
1149
1149
  if (T !== 18) throw Error("Invalid code length symbol");
1150
1150
  {
1151
- const U = s.readBits(7) + 11;
1152
- for (let F = 0; F < U; F++) x.push(0);
1151
+ const U = r.readBits(7) + 11;
1152
+ for (let C = 0; C < U; C++) x.push(0);
1153
1153
  }
1154
1154
  }
1155
1155
  }
1156
- const M = x.slice(0, p), S = x.slice(p, p + v);
1157
- g = H(M), m = H(S);
1156
+ const M = x.slice(0, p), L = x.slice(p, p + v);
1157
+ g = H(M), m = H(L);
1158
1158
  }
1159
1159
  for (; ; ) {
1160
- const p = ct(s, g);
1160
+ const p = ct(r, g);
1161
1161
  if (p < 256) n.push(p);
1162
1162
  else {
1163
1163
  if (p === 256) break;
@@ -1165,59 +1165,59 @@ function Re(h) {
1165
1165
  const v = p - 257;
1166
1166
  let A = o[v];
1167
1167
  const w = l[v];
1168
- w && (A += s.readBits(w));
1169
- const y = ct(s, m);
1168
+ w && (A += r.readBits(w));
1169
+ const y = ct(r, m);
1170
1170
  if (y >= 30) throw Error("Invalid distance symbol");
1171
1171
  let b = c[y];
1172
1172
  const x = u[y];
1173
- x && (b += s.readBits(x));
1173
+ x && (b += r.readBits(x));
1174
1174
  const M = n.length - b;
1175
1175
  if (M < 0) throw Error("Invalid distance");
1176
- for (let S = 0; S < A; S++) n.push(n[M + S] || 0);
1176
+ for (let L = 0; L < A; L++) n.push(n[M + L] || 0);
1177
1177
  } else if (p === 286 || p === 287) throw Error("Reserved length symbol");
1178
1178
  }
1179
1179
  }
1180
1180
  }
1181
1181
  }
1182
1182
  }
1183
- }(new be(h.subarray(i)), r), new Uint8Array(r);
1183
+ }(new Te(h.subarray(i)), s), new Uint8Array(s);
1184
1184
  }
1185
- function Me(h) {
1185
+ function Ce(h) {
1186
1186
  const t = R, e = new Uint8Array(h);
1187
1187
  if (t.readASCII(e, 0, 4) !== "wOFF") throw Error("Invalid WOFF signature");
1188
- const i = t.readUint(e, 4), r = t.readUshort(e, 12), s = t.readUint(e, 16), n = [];
1188
+ const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), n = [];
1189
1189
  let o = 44;
1190
- for (let A = 0; A < r; A++) {
1190
+ for (let A = 0; A < s; A++) {
1191
1191
  const w = t.readASCII(e, o, 4), y = t.readUint(e, o + 4), b = t.readUint(e, o + 8), x = t.readUint(e, o + 12), M = t.readUint(e, o + 16);
1192
1192
  n.push({ tag: w, offset: y, compLength: b, origLength: x, checksum: M }), o += 20;
1193
1193
  }
1194
1194
  for (const A of n) {
1195
1195
  const w = new Uint8Array(e.buffer, A.offset, A.compLength);
1196
1196
  if (A.compLength === A.origLength) A.data = new Uint8Array(w);
1197
- else if (A.data = Re(w), A.data.length !== A.origLength) if (A.data.length < A.origLength) {
1197
+ else if (A.data = Me(w), A.data.length !== A.origLength) if (A.data.length < A.origLength) {
1198
1198
  const y = new Uint8Array(A.origLength);
1199
1199
  y.set(A.data), A.data = y;
1200
1200
  } else A.data = A.data.subarray(0, A.origLength);
1201
1201
  }
1202
- const l = r;
1202
+ const l = s;
1203
1203
  let c = 1, u = 0;
1204
1204
  for (; c << 1 <= l; ) c <<= 1, u++;
1205
1205
  const f = 16 * c, d = 16 * l - f;
1206
1206
  let g = 12 + 16 * l;
1207
1207
  const m = {};
1208
1208
  for (const A of n) m[A.tag] = g, g = $(g + A.data.length);
1209
- const p = new Uint8Array(Math.max(s || 0, g));
1210
- B(p, 0, i), tt(p, 4, l), tt(p, 6, f), tt(p, 8, u), tt(p, 10, d);
1209
+ const p = new Uint8Array(Math.max(r || 0, g));
1210
+ O(p, 0, i), tt(p, 4, l), tt(p, 6, f), tt(p, 8, u), tt(p, 10, d);
1211
1211
  let v = 12;
1212
1212
  for (const A of n) {
1213
- Ee(p, v, A.tag), v += 4;
1213
+ be(p, v, A.tag), v += 4;
1214
1214
  let w = A.data;
1215
1215
  if (A.tag === "head" && w.length >= 12) {
1216
1216
  const y = new Uint8Array(w);
1217
- B(y, 8, 0), B(p, v, lt(y, 0, $(y.length))), v += 4;
1217
+ O(y, 8, 0), O(p, v, lt(y, 0, $(y.length))), v += 4;
1218
1218
  } else
1219
- B(p, v, lt(w, 0, $(w.length))), v += 4;
1220
- B(p, v, m[A.tag]), v += 4, B(p, v, A.data.length), v += 4;
1219
+ O(p, v, lt(w, 0, $(w.length))), v += 4;
1220
+ O(p, v, m[A.tag]), v += 4, O(p, v, A.data.length), v += 4;
1221
1221
  }
1222
1222
  for (const A of n) {
1223
1223
  const w = m[A.tag];
@@ -1226,99 +1226,99 @@ function Me(h) {
1226
1226
  if (n.find((A) => A.tag === "head")) {
1227
1227
  const A = m.head, w = function(y, b) {
1228
1228
  const x = b + 8, M = [y[x], y[x + 1], y[x + 2], y[x + 3]];
1229
- B(y, x, 0);
1230
- const S = 2981146554 - (lt(y, 0, $(y.length)) >>> 0) >>> 0;
1231
- return y[x] = M[0], y[x + 1] = M[1], y[x + 2] = M[2], y[x + 3] = M[3], S >>> 0;
1229
+ O(y, x, 0);
1230
+ const L = 2981146554 - (lt(y, 0, $(y.length)) >>> 0) >>> 0;
1231
+ return y[x] = M[0], y[x + 1] = M[1], y[x + 2] = M[2], y[x + 3] = M[3], L >>> 0;
1232
1232
  }(p, A);
1233
- B(p, A + 8, w);
1233
+ O(p, A + 8, w);
1234
1234
  }
1235
1235
  return p.buffer;
1236
1236
  }
1237
1237
  const Fe = { parseTab(h, t, e) {
1238
1238
  const i = { tables: [], ids: {}, off: t };
1239
1239
  h = new Uint8Array(h.buffer, t, e), t = 0;
1240
- const r = R, s = r.readUshort;
1241
- s(h, t);
1242
- const n = s(h, t += 2);
1240
+ const s = R, r = s.readUshort;
1241
+ r(h, t);
1242
+ const n = r(h, t += 2);
1243
1243
  t += 2;
1244
1244
  const o = [];
1245
1245
  for (let l = 0; l < n; l++) {
1246
- const c = s(h, t), u = s(h, t += 2);
1246
+ const c = r(h, t), u = r(h, t += 2);
1247
1247
  t += 2;
1248
- const f = r.readUint(h, t);
1248
+ const f = s.readUint(h, t);
1249
1249
  t += 4;
1250
1250
  const d = `p${c}e${u}`;
1251
1251
  let g = o.indexOf(f);
1252
1252
  if (g === -1) {
1253
1253
  let m;
1254
1254
  g = i.tables.length, o.push(f);
1255
- const p = s(h, f);
1255
+ const p = r(h, f);
1256
1256
  m = p === 4 ? this.parse4(h, f) : p === 12 ? this.parse12(h, f) : { format: p }, i.tables.push(m);
1257
1257
  }
1258
1258
  i.ids[d] = g;
1259
1259
  }
1260
1260
  return i;
1261
1261
  }, parse4(h, t) {
1262
- const e = R, i = e.readUshort, r = e.readUshorts, s = t, n = i(h, t += 2);
1262
+ const e = R, i = e.readUshort, s = e.readUshorts, r = t, n = i(h, t += 2);
1263
1263
  i(h, t += 2);
1264
1264
  const o = i(h, t += 2) >>> 1, l = { format: 4, searchRange: i(h, t += 2), entrySelector: 0, rangeShift: 0, endCount: [], startCount: [], idDelta: [], idRangeOffset: [], glyphIdArray: [] };
1265
- t += 2, l.entrySelector = i(h, t), t += 2, l.rangeShift = i(h, t), t += 2, l.endCount = r(h, t, o), t += 2 * o, t += 2, l.startCount = r(h, t, o), t += 2 * o;
1265
+ t += 2, l.entrySelector = i(h, t), t += 2, l.rangeShift = i(h, t), t += 2, l.endCount = s(h, t, o), t += 2 * o, t += 2, l.startCount = s(h, t, o), t += 2 * o;
1266
1266
  for (let c = 0; c < o; c++) l.idDelta.push(e.readShort(h, t)), t += 2;
1267
- return l.idRangeOffset = r(h, t, o), t += 2 * o, l.glyphIdArray = r(h, t, s + n - t >> 1), l;
1267
+ return l.idRangeOffset = s(h, t, o), t += 2 * o, l.glyphIdArray = s(h, t, r + n - t >> 1), l;
1268
1268
  }, parse12(h, t) {
1269
1269
  const e = R.readUint;
1270
1270
  e(h, t += 4), e(h, t += 4);
1271
1271
  const i = e(h, t += 4);
1272
1272
  t += 4;
1273
- const r = new Uint32Array(3 * i);
1274
- for (let s = 0; s < 3 * i; s += 3) r[s] = e(h, t + (s << 2)), r[s + 1] = e(h, t + (s << 2) + 4), r[s + 2] = e(h, t + (s << 2) + 8);
1275
- return { format: 12, groups: r };
1276
- } }, Ce = { parseTab(h, t, e) {
1273
+ const s = new Uint32Array(3 * i);
1274
+ for (let r = 0; r < 3 * i; r += 3) s[r] = e(h, t + (r << 2)), s[r + 1] = e(h, t + (r << 2) + 4), s[r + 2] = e(h, t + (r << 2) + 8);
1275
+ return { format: 12, groups: s };
1276
+ } }, Pe = { parseTab(h, t, e) {
1277
1277
  const i = R;
1278
1278
  t += 18;
1279
- const r = i.readUshort(h, t);
1279
+ const s = i.readUshort(h, t);
1280
1280
  t += 2, t += 16;
1281
- const s = i.readShort(h, t);
1281
+ const r = i.readShort(h, t);
1282
1282
  t += 2;
1283
1283
  const n = i.readShort(h, t);
1284
1284
  t += 2;
1285
1285
  const o = i.readShort(h, t);
1286
1286
  t += 2;
1287
1287
  const l = i.readShort(h, t);
1288
- return t += 2, t += 6, { unitsPerEm: r, xMin: s, yMin: n, xMax: o, yMax: l, indexToLocFormat: i.readShort(h, t) };
1289
- } }, Pe = { parseTab(h, t, e) {
1288
+ return t += 2, t += 6, { unitsPerEm: s, xMin: r, yMin: n, xMax: o, yMax: l, indexToLocFormat: i.readShort(h, t) };
1289
+ } }, Le = { parseTab(h, t, e) {
1290
1290
  const i = R;
1291
1291
  t += 4;
1292
- const r = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], s = {};
1293
- for (let n = 0; n < r.length; n++) {
1294
- const o = r[n], l = o === "advanceWidthMax" || o === "numberOfHMetrics" ? i.readUshort : i.readShort;
1295
- s[o] = l(h, t + 2 * n);
1292
+ const s = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], r = {};
1293
+ for (let n = 0; n < s.length; n++) {
1294
+ const o = s[n], l = o === "advanceWidthMax" || o === "numberOfHMetrics" ? i.readUshort : i.readShort;
1295
+ r[o] = l(h, t + 2 * n);
1296
1296
  }
1297
- return s;
1297
+ return r;
1298
1298
  } }, Se = { parseTab(h, t, e, i) {
1299
- const r = R, s = [], n = [], o = i.maxp.numGlyphs, l = i.hhea.numberOfHMetrics;
1299
+ const s = R, r = [], n = [], o = i.maxp.numGlyphs, l = i.hhea.numberOfHMetrics;
1300
1300
  let c = 0, u = 0, f = 0;
1301
- for (; f < l; ) c = r.readUshort(h, t + (f << 2)), u = r.readShort(h, t + (f << 2) + 2), s.push(c), n.push(u), f++;
1302
- for (; f < o; ) s.push(c), n.push(u), f++;
1303
- return { aWidth: s, lsBearing: n };
1304
- } }, Tt = { cmap: Fe, head: Ce, hhea: Pe, maxp: { parseTab(h, t, e) {
1301
+ for (; f < l; ) c = s.readUshort(h, t + (f << 2)), u = s.readShort(h, t + (f << 2) + 2), r.push(c), n.push(u), f++;
1302
+ for (; f < o; ) r.push(c), n.push(u), f++;
1303
+ return { aWidth: r, lsBearing: n };
1304
+ } }, Rt = { cmap: Fe, head: Pe, hhea: Le, maxp: { parseTab(h, t, e) {
1305
1305
  const i = R;
1306
1306
  return i.readUint(h, t), t += 4, { numGlyphs: i.readUshort(h, t) };
1307
1307
  } }, hmtx: Se, loca: { parseTab(h, t, e, i) {
1308
- const r = R, s = [], n = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
1309
- if (n === 0) for (let l = 0; l < o; l++) s.push(r.readUshort(h, t + (l << 1)) << 1);
1310
- else if (n === 1) for (let l = 0; l < o; l++) s.push(r.readUint(h, t + (l << 2)));
1311
- return s;
1312
- } }, glyf: { parseTab(h, t, e, i) {
1313
- const r = [], s = i.maxp.numGlyphs;
1314
- for (let n = 0; n < s; n++) r.push(null);
1308
+ const s = R, r = [], n = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
1309
+ if (n === 0) for (let l = 0; l < o; l++) r.push(s.readUshort(h, t + (l << 1)) << 1);
1310
+ else if (n === 1) for (let l = 0; l < o; l++) r.push(s.readUint(h, t + (l << 2)));
1315
1311
  return r;
1312
+ } }, glyf: { parseTab(h, t, e, i) {
1313
+ const s = [], r = i.maxp.numGlyphs;
1314
+ for (let n = 0; n < r; n++) s.push(null);
1315
+ return s;
1316
1316
  }, Ri(h, t) {
1317
- const e = R, i = h.Si, r = h.loca;
1318
- if (r[t] === r[t + 1]) return null;
1319
- const s = V.findTable(i, "glyf", h.ki);
1320
- if (!s) return null;
1321
- let n = s[0] + r[t];
1317
+ const e = R, i = h.Si, s = h.loca;
1318
+ if (s[t] === s[t + 1]) return null;
1319
+ const r = Z.findTable(i, "glyf", h.ki);
1320
+ if (!r) return null;
1321
+ let n = r[0] + s[t];
1322
1322
  const o = {};
1323
1323
  if (o.noc = e.readShort(i, n), n += 2, o.xMin = e.readShort(i, n), n += 2, o.yMin = e.readShort(i, n), n += 2, o.xMax = e.readShort(i, n), n += 2, o.yMax = e.readShort(i, n), n += 2, o.xMin >= o.xMax || o.yMin >= o.yMax) return null;
1324
1324
  if (o.noc > 0) {
@@ -1351,42 +1351,42 @@ const Fe = { parseTab(h, t, e) {
1351
1351
  for (let d = 0; d < c; d++) u += o.xs[d], f += o.ys[d], o.xs[d] = u, o.ys[d] = f;
1352
1352
  } else o.parts = [], o.endPts = [], o.flags = [], o.xs = [], o.ys = [];
1353
1353
  return o;
1354
- } } }, V = { parse(h) {
1354
+ } } }, Z = { parse(h) {
1355
1355
  const t = new Uint8Array(h);
1356
- R.readASCII(t, 0, 4) === "wOFF" && (h = Me(h));
1357
- const e = new Uint8Array(h), i = Tt, r = {}, s = { Si: e, Li: 0, ki: 0 };
1356
+ R.readASCII(t, 0, 4) === "wOFF" && (h = Ce(h));
1357
+ const e = new Uint8Array(h), i = Rt, s = {}, r = { Si: e, Li: 0, ki: 0 };
1358
1358
  for (const n in i) {
1359
- const o = n, l = V.findTable(e, o, 0);
1359
+ const o = n, l = Z.findTable(e, o, 0);
1360
1360
  if (l) {
1361
1361
  const [c, u] = l;
1362
- let f = r[c];
1363
- f == null && (f = i[o].parseTab(e, c, u, s), r[c] = f), s[o] = f;
1362
+ let f = s[c];
1363
+ f == null && (f = i[o].parseTab(e, c, u, r), s[c] = f), r[o] = f;
1364
1364
  }
1365
1365
  }
1366
- return [s];
1366
+ return [r];
1367
1367
  }, findTable(h, t, e) {
1368
- const i = R, r = i.readUshort(h, e + 4);
1369
- let s = e + 12;
1370
- for (let n = 0; n < r; n++) {
1371
- const o = i.readASCII(h, s, 4);
1372
- i.readUint(h, s + 4);
1373
- const l = i.readUint(h, s + 8), c = i.readUint(h, s + 12);
1368
+ const i = R, s = i.readUshort(h, e + 4);
1369
+ let r = e + 12;
1370
+ for (let n = 0; n < s; n++) {
1371
+ const o = i.readASCII(h, r, 4);
1372
+ i.readUint(h, r + 4);
1373
+ const l = i.readUint(h, r + 8), c = i.readUint(h, r + 12);
1374
1374
  if (o === t) return [l, c];
1375
- s += 16;
1375
+ r += 16;
1376
1376
  }
1377
1377
  return null;
1378
- }, T: Tt, B: R };
1379
- class Le {
1378
+ }, T: Rt, B: R };
1379
+ class Ue {
1380
1380
  zi(t) {
1381
1381
  var i;
1382
1382
  const e = [];
1383
- return (i = t.cmap) != null && i.tables ? (t.cmap.tables.forEach((r) => {
1384
- if (r.format === 4) {
1385
- const s = this.Di(r);
1386
- e.push(...s);
1387
- } else if (r.format === 12) {
1388
- const s = this.Oi(r);
1389
- e.push(...s);
1383
+ return (i = t.cmap) != null && i.tables ? (t.cmap.tables.forEach((s) => {
1384
+ if (s.format === 4) {
1385
+ const r = this.Di(s);
1386
+ e.push(...r);
1387
+ } else if (s.format === 12) {
1388
+ const r = this.Oi(s);
1389
+ e.push(...r);
1390
1390
  }
1391
1391
  }), [...new Set(e)]) : [];
1392
1392
  }
@@ -1394,9 +1394,9 @@ class Le {
1394
1394
  const e = [];
1395
1395
  if (!(t.startCount && t.endCount && t.idRangeOffset && t.idDelta)) return e;
1396
1396
  for (let i = 0; i < t.startCount.length; i++) {
1397
- const r = t.startCount[i], s = t.endCount[i];
1398
- if (r !== 65535 || s !== 65535) {
1399
- for (let n = r; n <= s; n++)
1397
+ const s = t.startCount[i], r = t.endCount[i];
1398
+ if (s !== 65535 || r !== 65535) {
1399
+ for (let n = s; n <= r; n++)
1400
1400
  if (this.Hi(t, n, i) > 0) try {
1401
1401
  const o = String.fromCodePoint(n);
1402
1402
  e.push(o);
@@ -1410,9 +1410,9 @@ class Le {
1410
1410
  const e = [];
1411
1411
  if (!t.groups) return e;
1412
1412
  for (let i = 0; i < t.groups.length; i += 3) {
1413
- const r = t.groups[i], s = t.groups[i + 1], n = t.groups[i + 2];
1414
- for (let o = r; o <= s; o++)
1415
- if (n + (o - r) > 0) try {
1413
+ const s = t.groups[i], r = t.groups[i + 1], n = t.groups[i + 2];
1414
+ for (let o = s; o <= r; o++)
1415
+ if (n + (o - s) > 0) try {
1416
1416
  const l = String.fromCodePoint(o);
1417
1417
  e.push(l);
1418
1418
  } catch {
@@ -1423,61 +1423,61 @@ class Le {
1423
1423
  Hi(t, e, i) {
1424
1424
  if (t.idRangeOffset[i] === 0) return e + t.idDelta[i] & 65535;
1425
1425
  {
1426
- const r = t.idRangeOffset[i] / 2 + (e - t.startCount[i]) - (t.startCount.length - i);
1427
- if (r >= 0 && t.glyphIdArray && r < t.glyphIdArray.length) {
1428
- const s = t.glyphIdArray[r];
1429
- if (s !== 0) return s + t.idDelta[i] & 65535;
1426
+ const s = t.idRangeOffset[i] / 2 + (e - t.startCount[i]) - (t.startCount.length - i);
1427
+ if (s >= 0 && t.glyphIdArray && s < t.glyphIdArray.length) {
1428
+ const r = t.glyphIdArray[s];
1429
+ if (r !== 0) return r + t.idDelta[i] & 65535;
1430
1430
  }
1431
1431
  }
1432
1432
  return 0;
1433
1433
  }
1434
1434
  }
1435
- class Ue {
1435
+ class Ie {
1436
1436
  constructor(t) {
1437
1437
  a(this, "Bi");
1438
1438
  a(this, "Ii");
1439
1439
  a(this, "K");
1440
1440
  this.K = t, this.Bi = document.createElement("canvas"), this.Ii = this.Bi.getContext("2d", { willReadFrequently: !0, alpha: !0 });
1441
1441
  }
1442
- Gi(t, e, i, r) {
1443
- const s = t.length, n = Math.ceil(Math.sqrt(s)), o = Math.ceil(s / n), l = e.width * n, c = e.height * o;
1444
- this.ji(l, c), this.Qi(t, e, n, i, r);
1442
+ Gi(t, e, i, s) {
1443
+ const r = t.length, n = Math.ceil(Math.sqrt(r)), o = Math.ceil(r / n), l = e.width * n, c = e.height * o;
1444
+ this.ji(l, c), this.Qi(t, e, n, i, s);
1445
1445
  const u = this.K.Fi(l, c, 1, { filter: "nearest" });
1446
1446
  return u.et(this.Bi), { framebuffer: u, columns: n, rows: o };
1447
1447
  }
1448
1448
  ji(t, e) {
1449
1449
  this.Bi.width = t, this.Bi.height = e, this.Bi.style.width = t + "px", this.Bi.style.height = e + "px", this.Ii.imageSmoothingEnabled = !1, this.Bi.style.imageRendering = "pixelated", this.Ii.clearRect(0, 0, t, e), this.Ii.textBaseline = "top", this.Ii.textAlign = "left", this.Ii.fillStyle = "white";
1450
1450
  }
1451
- Qi(t, e, i, r, s) {
1452
- const n = r / s.head.unitsPerEm;
1451
+ Qi(t, e, i, s, r) {
1452
+ const n = s / r.head.unitsPerEm;
1453
1453
  for (let o = 0; o < t.length; o++) {
1454
1454
  const l = o % i, c = Math.floor(o / i), u = t[o].glyphData;
1455
1455
  if (!u) continue;
1456
- const f = u.advanceWidth * n, d = l * e.width, g = c * e.height, m = d + 0.5 * e.width, p = g + 0.5 * e.height, v = Math.round(m - 0.5 * e.width), A = Math.round(p - 0.5 * r), w = v + 0.5 * (e.width - f), y = A + s.hhea.ascender * n;
1456
+ const f = u.advanceWidth * n, d = l * e.width, g = c * e.height, m = d + 0.5 * e.width, p = g + 0.5 * e.height, v = Math.round(m - 0.5 * e.width), A = Math.round(p - 0.5 * s), w = v + 0.5 * (e.width - f), y = A + r.hhea.ascender * n;
1457
1457
  this.Ni(u, w, y, n);
1458
1458
  }
1459
1459
  }
1460
- Ni(t, e, i, r) {
1460
+ Ni(t, e, i, s) {
1461
1461
  if (!t || !t.xs || t.noc === 0) return;
1462
- let { xs: s, ys: n, endPts: o, flags: l } = t;
1463
- if (!(s && n && o && l)) return;
1462
+ let { xs: r, ys: n, endPts: o, flags: l } = t;
1463
+ if (!(r && n && o && l)) return;
1464
1464
  this.Ii.beginPath();
1465
1465
  let c = 0;
1466
1466
  for (let u = 0; u < o.length; u++) {
1467
1467
  const f = o[u];
1468
1468
  if (!(f < c)) {
1469
1469
  if (f >= c) {
1470
- const d = e + s[c] * r, g = i - n[c] * r;
1470
+ const d = e + r[c] * s, g = i - n[c] * s;
1471
1471
  this.Ii.moveTo(d, g);
1472
1472
  let m = c + 1;
1473
1473
  for (; m <= f; )
1474
1474
  if (1 & l[m]) {
1475
- const p = e + s[m] * r, v = i - n[m] * r;
1475
+ const p = e + r[m] * s, v = i - n[m] * s;
1476
1476
  this.Ii.lineTo(p, v), m++;
1477
1477
  } else {
1478
- const p = e + s[m] * r, v = i - n[m] * r;
1478
+ const p = e + r[m] * s, v = i - n[m] * s;
1479
1479
  if (m + 1 > f) {
1480
- const w = e + s[c] * r, y = i - n[c] * r;
1480
+ const w = e + r[c] * s, y = i - n[c] * s;
1481
1481
  if (1 & l[c]) this.Ii.quadraticCurveTo(p, v, w, y);
1482
1482
  else {
1483
1483
  const b = (p + w) / 2, x = (v + y) / 2;
@@ -1487,10 +1487,10 @@ class Ue {
1487
1487
  }
1488
1488
  const A = m + 1;
1489
1489
  if (1 & l[A]) {
1490
- const w = e + s[A] * r, y = i - n[A] * r;
1490
+ const w = e + r[A] * s, y = i - n[A] * s;
1491
1491
  this.Ii.quadraticCurveTo(p, v, w, y), m = A + 1;
1492
1492
  } else {
1493
- const w = (p + (e + s[A] * r)) / 2, y = (v + (i - n[A] * r)) / 2;
1493
+ const w = (p + (e + r[A] * s)) / 2, y = (v + (i - n[A] * s)) / 2;
1494
1494
  this.Ii.quadraticCurveTo(p, v, w, y), m = A;
1495
1495
  }
1496
1496
  }
@@ -1502,13 +1502,13 @@ class Ue {
1502
1502
  this.Ii.fill();
1503
1503
  }
1504
1504
  }
1505
- class Ut {
1505
+ class It {
1506
1506
  Xi(t, e) {
1507
1507
  const i = t.cmap;
1508
1508
  if (!i || !i.tables) return 0;
1509
- let r = 0;
1510
- for (const s of i.tables) if (s.format === 4 ? r = this.Yi(e, s) : s.format === 12 && (r = this.Wi(e, s)), r > 0) break;
1511
- return r;
1509
+ let s = 0;
1510
+ for (const r of i.tables) if (r.format === 4 ? s = this.Yi(e, r) : r.format === 12 && (s = this.Wi(e, r)), s > 0) break;
1511
+ return s;
1512
1512
  }
1513
1513
  Ki(t, e) {
1514
1514
  const i = e.codePointAt(0);
@@ -1519,32 +1519,32 @@ class Ut {
1519
1519
  return i && i.aWidth && i.aWidth.length !== 0 ? e < i.aWidth.length ? i.aWidth[e] : i.aWidth[i.aWidth.length - 1] : 0;
1520
1520
  }
1521
1521
  qi(t, e) {
1522
- const i = e / t.head.unitsPerEm, r = t.hhea.ascender * i, s = t.hhea.descender * i, n = t.hhea.lineGap * i;
1523
- return { ascender: r, descender: s, lineGap: n, lineHeight: r - s + n, unitsPerEm: t.head.unitsPerEm, scale: i };
1522
+ const i = e / t.head.unitsPerEm, s = t.hhea.ascender * i, r = t.hhea.descender * i, n = t.hhea.lineGap * i;
1523
+ return { ascender: s, descender: r, lineGap: n, lineHeight: s - r + n, unitsPerEm: t.head.unitsPerEm, scale: i };
1524
1524
  }
1525
1525
  Yi(t, e) {
1526
1526
  const i = e.endCount.length;
1527
- let r = -1;
1528
- for (let s = 0; s < i; s++) if (t <= e.endCount[s]) {
1529
- r = s;
1527
+ let s = -1;
1528
+ for (let r = 0; r < i; r++) if (t <= e.endCount[r]) {
1529
+ s = r;
1530
1530
  break;
1531
1531
  }
1532
- if (r === -1 || t < e.startCount[r]) return 0;
1533
- if (e.idRangeOffset[r] === 0) return t + e.idDelta[r] & 65535;
1532
+ if (s === -1 || t < e.startCount[s]) return 0;
1533
+ if (e.idRangeOffset[s] === 0) return t + e.idDelta[s] & 65535;
1534
1534
  {
1535
- const s = e.idRangeOffset[r] / 2 + (t - e.startCount[r]) - (i - r);
1536
- if (s >= 0 && s < e.glyphIdArray.length) {
1537
- const n = e.glyphIdArray[s];
1538
- return n === 0 ? 0 : n + e.idDelta[r] & 65535;
1535
+ const r = e.idRangeOffset[s] / 2 + (t - e.startCount[s]) - (i - s);
1536
+ if (r >= 0 && r < e.glyphIdArray.length) {
1537
+ const n = e.glyphIdArray[r];
1538
+ return n === 0 ? 0 : n + e.idDelta[s] & 65535;
1539
1539
  }
1540
1540
  }
1541
1541
  return 0;
1542
1542
  }
1543
1543
  Wi(t, e) {
1544
1544
  const i = e.groups.length / 3;
1545
- for (let r = 0; r < i; r++) {
1546
- const s = e.groups[3 * r], n = e.groups[3 * r + 1], o = e.groups[3 * r + 2];
1547
- if (t >= s && t <= n) return o + (t - s);
1545
+ for (let s = 0; s < i; s++) {
1546
+ const r = e.groups[3 * s], n = e.groups[3 * s + 1], o = e.groups[3 * s + 2];
1547
+ if (t >= r && t <= n) return o + (t - r);
1548
1548
  }
1549
1549
  return 0;
1550
1550
  }
@@ -1552,42 +1552,42 @@ class Ut {
1552
1552
  class Oe {
1553
1553
  constructor() {
1554
1554
  a(this, "Vi");
1555
- this.Vi = new Ut();
1555
+ this.Vi = new It();
1556
1556
  }
1557
1557
  Ji(t, e, i) {
1558
- let r = 0;
1559
- const s = this.Vi.qi(i, e), n = s.lineHeight;
1558
+ let s = 0;
1559
+ const r = this.Vi.qi(i, e), n = r.lineHeight;
1560
1560
  for (const o of t) {
1561
1561
  const l = this.Vi.Ki(i, o);
1562
1562
  if (l === 0) continue;
1563
- const c = this.Vi.Zi(i, l) * s.scale;
1564
- r = Math.max(r, c);
1563
+ const c = this.Vi.Zi(i, l) * r.scale;
1564
+ s = Math.max(s, c);
1565
1565
  }
1566
- return { width: Math.ceil(r), height: Math.ceil(n) };
1566
+ return { width: Math.ceil(s), height: Math.ceil(n) };
1567
1567
  }
1568
1568
  }
1569
- class Be {
1569
+ class De {
1570
1570
  constructor() {
1571
1571
  a(this, "tr");
1572
- this.tr = new Ut();
1572
+ this.tr = new It();
1573
1573
  }
1574
1574
  sr(t, e) {
1575
- const i = [], r = /* @__PURE__ */ new Map();
1576
- return t.forEach((s, n) => {
1577
- const o = s.codePointAt(0) || 0, l = { character: s, unicode: o, color: this.er(n), glyphData: this.ir(e, s) };
1578
- i.push(l), r.set(s, l);
1579
- }), { array: i, map: r };
1575
+ const i = [], s = /* @__PURE__ */ new Map();
1576
+ return t.forEach((r, n) => {
1577
+ const o = r.codePointAt(0) || 0, l = { character: r, unicode: o, color: this.er(n), glyphData: this.ir(e, r) };
1578
+ i.push(l), s.set(r, l);
1579
+ }), { array: i, map: s };
1580
1580
  }
1581
1581
  er(t) {
1582
1582
  return [t % 256 / 255, Math.floor(t / 256) % 256 / 255, 0];
1583
1583
  }
1584
1584
  ir(t, e) {
1585
- const i = e.codePointAt(0) || 0, r = this.tr.Xi(t, i);
1586
- if (r === 0) return null;
1587
- let s = 0;
1588
- t.hmtx && t.hmtx.aWidth && r > 0 && t.hmtx.aWidth[r] !== void 0 && (s = t.hmtx.aWidth[r]);
1589
- const n = V.T.glyf.Ri(t, r);
1590
- return n ? { ...n, advanceWidth: s } : null;
1585
+ const i = e.codePointAt(0) || 0, s = this.tr.Xi(t, i);
1586
+ if (s === 0) return null;
1587
+ let r = 0;
1588
+ t.hmtx && t.hmtx.aWidth && s > 0 && t.hmtx.aWidth[s] !== void 0 && (r = t.hmtx.aWidth[s]);
1589
+ const n = Z.T.glyf.Ri(t, s);
1590
+ return n ? { ...n, advanceWidth: r } : null;
1591
1591
  }
1592
1592
  }
1593
1593
  class W {
@@ -1606,7 +1606,7 @@ class W {
1606
1606
  a(this, "mr");
1607
1607
  a(this, "_r");
1608
1608
  a(this, "yr", !1);
1609
- this.cr = e, this.vr = new Le(), this.gr = new Ue(t), this.mr = new Oe(), this._r = new Be();
1609
+ this.cr = e, this.vr = new Ue(), this.gr = new Ie(t), this.mr = new Oe(), this._r = new De();
1610
1610
  }
1611
1611
  async Ar(t) {
1612
1612
  if (this.yr) return;
@@ -1617,7 +1617,7 @@ class W {
1617
1617
  e = await i.arrayBuffer();
1618
1618
  } else
1619
1619
  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();
1620
- await this.wr(e), this.rr = V.parse(e)[0], await this.br();
1620
+ await this.wr(e), this.rr = Z.parse(e)[0], await this.br();
1621
1621
  }
1622
1622
  Cr(t) {
1623
1623
  if (t === void 0) return this.cr;
@@ -1631,9 +1631,9 @@ class W {
1631
1631
  if (!e.ok) throw new P(`Failed to load font file: ${e.status} ${e.statusText}`);
1632
1632
  const i = await e.arrayBuffer();
1633
1633
  await this.wr(i);
1634
- const r = V.parse(i);
1635
- if (!r || r.length === 0) throw Error("Failed to parse font file");
1636
- this.rr = r[0], await this.br();
1634
+ const s = Z.parse(i);
1635
+ if (!s || s.length === 0) throw Error("Failed to parse font file");
1636
+ this.rr = s[0], await this.br();
1637
1637
  } catch (e) {
1638
1638
  throw new P("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
1639
1639
  }
@@ -1645,8 +1645,8 @@ class W {
1645
1645
  async br() {
1646
1646
  const t = this.vr.zi(this.rr), { array: e, map: i } = this._r.sr(t, this.rr);
1647
1647
  this.nr = e, this.hr = i, this.dr = this.mr.Ji(t, this.cr, this.rr);
1648
- const r = this.gr.Gi(this.nr, this.dr, this.cr, this.rr);
1649
- this.ar = r.framebuffer, this.lr = r.columns, this.ur = r.rows, this.yr = !0;
1648
+ const s = this.gr.Gi(this.nr, this.dr, this.cr, this.rr);
1649
+ this.ar = s.framebuffer, this.lr = s.columns, this.ur = s.rows, this.yr = !0;
1650
1650
  }
1651
1651
  $r(t) {
1652
1652
  const e = this.hr.get(t);
@@ -1689,7 +1689,7 @@ class W {
1689
1689
  return this.rr;
1690
1690
  }
1691
1691
  }
1692
- class De {
1692
+ class _e {
1693
1693
  constructor(t, e, i) {
1694
1694
  a(this, "Tr");
1695
1695
  a(this, "Er");
@@ -1756,25 +1756,28 @@ class De {
1756
1756
  this.Or.clear();
1757
1757
  }
1758
1758
  }
1759
- const _e = /^rgba?\(([^)]+)\)$/i;
1759
+ const Be = /^rgba?\(([^)]+)\)$/i;
1760
1760
  function ut(h) {
1761
1761
  return Number.isNaN(h) ? 0 : Math.max(0, Math.min(255, h));
1762
1762
  }
1763
- function Ie(h) {
1763
+ function Ne(h) {
1764
1764
  if (!h) return null;
1765
1765
  const t = h.trim().toLowerCase();
1766
1766
  if (!t) return null;
1767
1767
  let e = null;
1768
1768
  return t.startsWith("rgb") && (e = function(i) {
1769
- const r = _e.exec(i.trim());
1770
- if (!r) return null;
1771
- const s = r[1].split(",").map((u) => u.trim());
1772
- if (s.length < 3) return null;
1773
- const n = ut(parseFloat(s[0])), o = ut(parseFloat(s[1])), l = ut(parseFloat(s[2])), c = s[3] !== void 0 ? 255 * Math.max(0, Math.min(1, parseFloat(s[3]))) : 255;
1769
+ const s = Be.exec(i.trim());
1770
+ if (!s) return null;
1771
+ const r = s[1].split(",").map((u) => u.trim());
1772
+ if (r.length < 3) return null;
1773
+ const n = ut(parseFloat(r[0])), o = ut(parseFloat(r[1])), l = ut(parseFloat(r[2])), c = r[3] !== void 0 ? 255 * Math.max(0, Math.min(1, parseFloat(r[3]))) : 255;
1774
1774
  return [n, o, l, Math.round(c)];
1775
1775
  }(t)), e ? e[3] === 0 ? null : e : null;
1776
1776
  }
1777
- class Ne {
1777
+ function ft(h) {
1778
+ return typeof HTMLCanvasElement < "u" && h instanceof HTMLCanvasElement;
1779
+ }
1780
+ class ke {
1778
1781
  constructor(t = {}) {
1779
1782
  a(this, "kr");
1780
1783
  a(this, "jr", null);
@@ -1782,7 +1785,7 @@ class Ne {
1782
1785
  a(this, "Nr");
1783
1786
  a(this, "Xr", null);
1784
1787
  if (this.Qr = t.overlay ?? !1, this.Xr = t.gl ?? null, this.Xr && this.Qr) throw new P("Cannot use external WebGL context with overlay mode.");
1785
- this.Xr ? (this.kr = this.Xr.canvas, this.Nr = !1) : this.Qr && t.canvas ? (this.jr = t.canvas, this.kr = this.Yr(), this.Nr = !0, this.Wr()) : t.canvas ? (this.kr = t.canvas, this.Nr = !1) : (this.kr = this.Kr(t.width, t.height), this.Nr = !0), this.kr instanceof HTMLCanvasElement && (this.kr.style.imageRendering = "pixelated");
1788
+ this.Xr ? (this.kr = this.Xr.canvas, this.Nr = !1) : this.Qr && t.canvas ? (this.jr = t.canvas, this.kr = this.Yr(), this.Nr = !0, this.Wr()) : t.canvas ? (this.kr = t.canvas, this.Nr = !1) : (this.kr = this.Kr(t.width, t.height), this.Nr = !0), ft(this.kr) && (this.kr.style.imageRendering = "pixelated");
1786
1789
  }
1787
1790
  Kr(t, e) {
1788
1791
  const i = document.createElement("canvas");
@@ -1792,14 +1795,14 @@ class Ne {
1792
1795
  const t = document.createElement("canvas");
1793
1796
  t.className = "textmodeCanvas", t.style.imageRendering = "pixelated";
1794
1797
  const e = this.jr.getBoundingClientRect();
1795
- let i = Math.round(e.width), r = Math.round(e.height);
1798
+ let i = Math.round(e.width), s = Math.round(e.height);
1796
1799
  if (this.jr instanceof HTMLVideoElement) {
1797
1800
  const o = this.jr;
1798
- (i === 0 || r === 0) && o.videoWidth > 0 && o.videoHeight > 0 && (i = o.videoWidth, r = o.videoHeight);
1801
+ (i === 0 || s === 0) && o.videoWidth > 0 && o.videoHeight > 0 && (i = o.videoWidth, s = o.videoHeight);
1799
1802
  }
1800
- t.width = i, t.height = r, t.style.position = "absolute", t.style.pointerEvents = "none";
1801
- const s = window.getComputedStyle(this.jr);
1802
- let n = parseInt(s.zIndex || "0", 10);
1803
+ t.width = i, t.height = s, t.style.position = "absolute", t.style.pointerEvents = "none";
1804
+ const r = window.getComputedStyle(this.jr);
1805
+ let n = parseInt(r.zIndex || "0", 10);
1803
1806
  return isNaN(n) && (n = 0), t.style.zIndex = "" + (n + 1), t;
1804
1807
  }
1805
1808
  Wr() {
@@ -1808,13 +1811,13 @@ class Ne {
1808
1811
  }
1809
1812
  qr() {
1810
1813
  const t = [];
1811
- return this.Qr && this.jr instanceof HTMLElement && (t.push(this.jr), this.jr.parentElement && t.push(this.jr.parentElement)), this.kr instanceof HTMLCanvasElement && (this.kr.parentElement && t.push(this.kr.parentElement), t.push(this.kr)), t.push(document.body), t.push(document.documentElement), t;
1814
+ return this.Qr && this.jr instanceof HTMLElement && (t.push(this.jr), this.jr.parentElement && t.push(this.jr.parentElement)), ft(this.kr) && (this.kr.parentElement && t.push(this.kr.parentElement), t.push(this.kr)), t.push(document.body), t.push(document.documentElement), t;
1812
1815
  }
1813
1816
  Vr() {
1814
1817
  const t = this.qr();
1815
1818
  for (const e of t) {
1816
1819
  if (!e) continue;
1817
- const i = Ie(window.getComputedStyle(e).backgroundColor);
1820
+ const i = Ne(window.getComputedStyle(e).backgroundColor);
1818
1821
  if (i) return i;
1819
1822
  }
1820
1823
  return [255, 255, 255, 255];
@@ -1825,8 +1828,8 @@ class Ne {
1825
1828
  let e = this.jr.offsetParent;
1826
1829
  const i = this.kr;
1827
1830
  if (e && e !== document.body) {
1828
- const r = e.getBoundingClientRect();
1829
- i.style.top = t.top - r.top + "px", i.style.left = t.left - r.left + "px";
1831
+ const s = e.getBoundingClientRect();
1832
+ i.style.top = t.top - s.top + "px", i.style.left = t.left - s.left + "px";
1830
1833
  } else i.style.top = t.top + window.scrollY + "px", i.style.left = t.left + window.scrollX + "px";
1831
1834
  }
1832
1835
  Jr(t, e) {
@@ -1849,7 +1852,7 @@ class Ne {
1849
1852
  e == null || e.loseContext();
1850
1853
  }
1851
1854
  }
1852
- this.Nr && this.kr instanceof HTMLCanvasElement && this.kr.parentNode && this.kr.parentNode.removeChild(this.kr);
1855
+ this.Nr && ft(this.kr) && this.kr.parentNode && this.kr.parentNode.removeChild(this.kr);
1853
1856
  }
1854
1857
  get canvas() {
1855
1858
  return this.kr;
@@ -1867,43 +1870,43 @@ class Ne {
1867
1870
  function et(h) {
1868
1871
  return k(parseInt(h, 16), 0, 255);
1869
1872
  }
1870
- class L {
1871
- constructor(t, e, i, r) {
1873
+ class S {
1874
+ constructor(t, e, i, s) {
1872
1875
  a(this, "sn");
1873
1876
  a(this, "en");
1874
1877
  a(this, "r");
1875
1878
  a(this, "g");
1876
1879
  a(this, "b");
1877
1880
  a(this, "a");
1878
- this.r = k(t, 0, 255), this.g = k(e, 0, 255), this.b = k(i, 0, 255), this.a = k(r, 0, 255), this.sn = [this.r, this.g, this.b, this.a], this.en = [this.r / 255, this.g / 255, this.b / 255, this.a / 255];
1881
+ this.r = k(t, 0, 255), this.g = k(e, 0, 255), this.b = k(i, 0, 255), this.a = k(s, 0, 255), this.sn = [this.r, this.g, this.b, this.a], this.en = [this.r / 255, this.g / 255, this.b / 255, this.a / 255];
1879
1882
  }
1880
- static rn(t, e, i, r) {
1881
- if (L.nn(t)) return t;
1883
+ static rn(t, e, i, s) {
1884
+ if (S.nn(t)) return t;
1882
1885
  if (Array.isArray(t)) {
1883
1886
  if (t.length < 3) throw Error("Component tuples must include at least RGB values.");
1884
- const [s, n, o] = t, l = t.length === 4 ? t[3] : 255;
1885
- return L.hn(s, n, o, l);
1887
+ const [r, n, o] = t, l = t.length === 4 ? t[3] : 255;
1888
+ return S.hn(r, n, o, l);
1886
1889
  }
1887
1890
  if (typeof t == "string") {
1888
- const s = t.trim();
1889
- if (s.length === 0) throw Error("Color strings cannot be empty.");
1890
- return L.an(s);
1891
+ const r = t.trim();
1892
+ if (r.length === 0) throw Error("Color strings cannot be empty.");
1893
+ return S.an(r);
1891
1894
  }
1892
- if (typeof t == "number") return typeof e == "number" && typeof i == "number" ? L.hn(t, e, i, r ?? 255) : L.cn(t);
1895
+ if (typeof t == "number") return typeof e == "number" && typeof i == "number" ? S.hn(t, e, i, s ?? 255) : S.cn(t);
1893
1896
  throw Error("Unsupported color input passed to TextmodeColor.$from.");
1894
1897
  }
1895
- static hn(t, e, i, r = 255) {
1896
- return new L(t, e, i, r);
1898
+ static hn(t, e, i, s = 255) {
1899
+ return new S(t, e, i, s);
1897
1900
  }
1898
1901
  static cn(t, e = 255) {
1899
- return new L(t, t, t, e);
1902
+ return new S(t, t, t, e);
1900
1903
  }
1901
1904
  static an(t) {
1902
- return new L(...function(e) {
1903
- const i = e.replace(/^#|0x/gi, ""), r = (s = i).length === 3 || s.length === 4 ? s.split("").map((n) => n + n).join("") : s;
1904
- var s;
1905
- if (r.length !== 6 && r.length !== 8) throw Error("Invalid hex color: " + e);
1906
- return [et(r.slice(0, 2)), et(r.slice(2, 4)), et(r.slice(4, 6)), r.length === 8 ? et(r.slice(6, 8)) : 255];
1905
+ return new S(...function(e) {
1906
+ const i = e.replace(/^#|0x/gi, ""), s = (r = i).length === 3 || r.length === 4 ? r.split("").map((n) => n + n).join("") : r;
1907
+ var r;
1908
+ if (s.length !== 6 && s.length !== 8) throw Error("Invalid hex color: " + e);
1909
+ return [et(s.slice(0, 2)), et(s.slice(2, 4)), et(s.slice(4, 6)), s.length === 8 ? et(s.slice(6, 8)) : 255];
1907
1910
  }(t));
1908
1911
  }
1909
1912
  get rgb() {
@@ -1916,14 +1919,14 @@ class L {
1916
1919
  return [...this.en];
1917
1920
  }
1918
1921
  withAlpha(t) {
1919
- return new L(this.r, this.g, this.b, t);
1922
+ return new S(this.r, this.g, this.b, t);
1920
1923
  }
1921
1924
  static nn(t) {
1922
- return t instanceof L;
1925
+ return t instanceof S;
1923
1926
  }
1924
1927
  }
1925
- class At {
1926
- constructor(t, e, i, r, s, n, o, l) {
1928
+ class yt {
1929
+ constructor(t, e, i, s, r, n, o, l) {
1927
1930
  a(this, "A");
1928
1931
  a(this, "K");
1929
1932
  a(this, "ln");
@@ -1947,7 +1950,7 @@ class At {
1947
1950
  a(this, "yn", [0, 0, 0, 1]);
1948
1951
  a(this, "An", [[0.1, 0, 0]]);
1949
1952
  a(this, "wn", null);
1950
- this.A = t, this.K = e, this.ln = i, this.gn = r, this.un = s, this.fn = n, this.G = o, this.j = l;
1953
+ this.A = t, this.K = e, this.ln = i, this.gn = s, this.un = r, this.fn = n, this.G = o, this.j = l;
1951
1954
  }
1952
1955
  conversionMode(t) {
1953
1956
  return this.pn = t, this.vn = null, this.Z = null, this;
@@ -1965,7 +1968,7 @@ class At {
1965
1968
  return this.It = t ? 1 : 0, this.Z = null, this;
1966
1969
  }
1967
1970
  charRotation(t) {
1968
- return this.Tt = Mt(t), this.Z = null, this;
1971
+ return this.Tt = Ct(t), this.Z = null, this;
1969
1972
  }
1970
1973
  charColorMode(t) {
1971
1974
  return this.mn = t, this.Z = null, this;
@@ -1973,14 +1976,14 @@ class At {
1973
1976
  cellColorMode(t) {
1974
1977
  return this._n = t, this.Z = null, this;
1975
1978
  }
1976
- charColor(t, e, i, r) {
1977
- return this.bn(this.jt, t, e, i, r), this.Z = null, this;
1979
+ charColor(t, e, i, s) {
1980
+ return this.bn(this.jt, t, e, i, s), this.Z = null, this;
1978
1981
  }
1979
- cellColor(t, e, i, r) {
1980
- return this.bn(this.Qt, t, e, i, r), this.Z = null, this;
1982
+ cellColor(t, e, i, s) {
1983
+ return this.bn(this.Qt, t, e, i, s), this.Z = null, this;
1981
1984
  }
1982
- background(t, e, i, r) {
1983
- return this.bn(this.yn, t, e, i, r), this.Z = null, this;
1985
+ background(t, e, i, s) {
1986
+ return this.bn(this.yn, t, e, i, s), this.Z = null, this;
1984
1987
  }
1985
1988
  characters(t) {
1986
1989
  return this.wn = t, this.xn(t), this.Z = null, this;
@@ -2010,11 +2013,11 @@ class At {
2010
2013
  }
2011
2014
  ut() {
2012
2015
  this.Cn();
2013
- const t = this.Mn(), e = this.$n(), i = t.createShader(e), r = t.createUniforms(e);
2014
- this.Z = this.K.materialManager.Ge(i, r);
2016
+ const t = this.Mn(), e = this.$n(), i = t.createShader(e), s = t.createUniforms(e);
2017
+ this.Z = this.K.materialManager.Ge(i, s);
2015
2018
  }
2016
- bn(t, e, i, r, s) {
2017
- const n = L.rn(e, i, r, s);
2019
+ bn(t, e, i, s, r) {
2020
+ const n = S.rn(e, i, s, r);
2018
2021
  it(t, n.r, n.g, n.b, n.a);
2019
2022
  }
2020
2023
  xn(t) {
@@ -2036,16 +2039,16 @@ class At {
2036
2039
  return { renderer: this.K, gl: this.A, font: this.dn, source: this, gridWidth: this.G, gridHeight: this.j };
2037
2040
  }
2038
2041
  }
2039
- class q extends At {
2040
- constructor(t, e, i, r, s, n, o, l) {
2041
- const c = Math.min(o / s, l / n);
2042
- super(t, e, i, r, s, n, Math.max(1, Math.floor(s * c)), Math.max(1, Math.floor(n * c)));
2042
+ class q extends yt {
2043
+ constructor(t, e, i, s, r, n, o, l) {
2044
+ const c = Math.min(o / r, l / n);
2045
+ super(t, e, i, s, r, n, Math.max(1, Math.floor(r * c)), Math.max(1, Math.floor(n * c)));
2043
2046
  }
2044
- static Tn(t, e, i, r, s) {
2047
+ static Tn(t, e, i, s, r) {
2045
2048
  const n = t.context, o = n.createTexture();
2046
- n.bindTexture(n.TEXTURE_2D, o), n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, 1), st(n, n.NEAREST, n.NEAREST, n.CLAMP_TO_EDGE, n.CLAMP_TO_EDGE), n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, i), n.bindTexture(n.TEXTURE_2D, null);
2049
+ n.bindTexture(n.TEXTURE_2D, o), n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, 1), rt(n, n.NEAREST, n.NEAREST, n.CLAMP_TO_EDGE, n.CLAMP_TO_EDGE), n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, i), n.bindTexture(n.TEXTURE_2D, null);
2047
2050
  const l = i.naturalWidth ?? i.width ?? i.videoWidth ?? 0, c = i.naturalHeight ?? i.height ?? i.videoHeight ?? 0;
2048
- return new q(n, t, o, e, l, c, r, s);
2051
+ return new q(n, t, o, e, l, c, s, r);
2049
2052
  }
2050
2053
  Fn() {
2051
2054
  return this.ln;
@@ -2072,8 +2075,8 @@ class Ot {
2072
2075
  this.Gn === -1 && (this.Gn = performance.now()), this.kn = performance.now();
2073
2076
  const e = (i) => {
2074
2077
  if (!this.Ln) return void (this.Sn = null);
2075
- const r = i - this.kn;
2076
- r >= this.En && (t(), this.kn = i - r % this.En), this.Ln && (this.Sn = requestAnimationFrame(e));
2078
+ const s = i - this.kn;
2079
+ s >= this.En && (t(), this.kn = i - s % this.En), this.Ln && (this.Sn = requestAnimationFrame(e));
2077
2080
  };
2078
2081
  this.Sn = requestAnimationFrame(e);
2079
2082
  }
@@ -2095,7 +2098,7 @@ class Ot {
2095
2098
  if (this.Dn > 0) {
2096
2099
  const e = t - this.Dn;
2097
2100
  this.Bn = e, this.On.push(e), this.On.length > this.Hn && this.On.shift();
2098
- const i = this.On.reduce((r, s) => r + s, 0) / this.On.length;
2101
+ const i = this.On.reduce((s, r) => s + r, 0) / this.On.length;
2099
2102
  this.zn = 1e3 / i;
2100
2103
  }
2101
2104
  this.Dn = t;
@@ -2137,7 +2140,7 @@ class Ot {
2137
2140
  return this.Bn;
2138
2141
  }
2139
2142
  }
2140
- class Bt {
2143
+ class Dt {
2141
2144
  constructor(t, e) {
2142
2145
  a(this, "kr");
2143
2146
  a(this, "ro");
@@ -2202,8 +2205,8 @@ class Bt {
2202
2205
  } else {
2203
2206
  const e = Math.floor((t.cols - 1) / 2), i = Math.floor(t.rows / 2);
2204
2207
  if (this.no.x !== -1 / 0 && this.no.y !== -1 / 0) {
2205
- const r = -e, s = t.cols - e - 1, n = -i, o = t.rows - i - 1;
2206
- (this.no.x < r || this.no.x > s || this.no.y < n || this.no.y > o) && (this.no.x = -1 / 0, this.no.y = -1 / 0);
2208
+ const s = -e, r = t.cols - e - 1, n = -i, o = t.rows - i - 1;
2209
+ (this.no.x < s || this.no.x > r || this.no.y < n || this.no.y > o) && (this.no.x = -1 / 0, this.no.y = -1 / 0);
2207
2210
  }
2208
2211
  }
2209
2212
  } catch {
@@ -2261,15 +2264,15 @@ class Bt {
2261
2264
  $o(t) {
2262
2265
  const e = this.kr.canvas, i = this.ro();
2263
2266
  if (this.oo = { ...this.no }, this.ho = { x: t.clientX, y: t.clientY }, !i) return this.no.x = -1 / 0, void (this.no.y = -1 / 0);
2264
- const r = e.getBoundingClientRect(), s = t.clientX - r.left, n = t.clientY - r.top, o = e.width / r.width, l = n * (e.height / r.height), c = s * o - i.offsetX, u = l - i.offsetY, f = Math.floor(c / i.cellWidth), d = Math.floor(u / i.cellHeight);
2267
+ const s = e.getBoundingClientRect(), r = t.clientX - s.left, n = t.clientY - s.top, o = e.width / s.width, l = n * (e.height / s.height), c = r * o - i.offsetX, u = l - i.offsetY, f = Math.floor(c / i.cellWidth), d = Math.floor(u / i.cellHeight);
2265
2268
  if (f >= 0 && f < i.cols && d >= 0 && d < i.rows) {
2266
2269
  const g = Math.floor((i.cols - 1) / 2);
2267
2270
  this.no.x = f - g, this.no.y = d - Math.floor(i.rows / 2);
2268
2271
  } else this.no.x = -1 / 0, this.no.y = -1 / 0;
2269
2272
  }
2270
2273
  }
2271
- const ke = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Bt }, Symbol.toStringTag, { value: "Module" }));
2272
- class Dt {
2274
+ const Xe = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Dt }, Symbol.toStringTag, { value: "Module" }));
2275
+ class _t {
2273
2276
  constructor() {
2274
2277
  a(this, "Io", /* @__PURE__ */ new Map());
2275
2278
  a(this, "Go", null);
@@ -2321,27 +2324,27 @@ class Dt {
2321
2324
  Ko(t) {
2322
2325
  const e = t.key, i = Date.now();
2323
2326
  this.Io.has(e) || this.Io.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2324
- const r = this.Io.get(e);
2325
- if (!r.isPressed && (r.isPressed = !0, r.lastPressTime = i, this.Go = e, this.Xo)) {
2326
- const s = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !0, originalEvent: t };
2327
- this.Xo(s);
2327
+ const s = this.Io.get(e);
2328
+ if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.Go = e, this.Xo)) {
2329
+ const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !0, originalEvent: t };
2330
+ this.Xo(r);
2328
2331
  }
2329
2332
  }
2330
2333
  Zo(t) {
2331
2334
  const e = t.key, i = Date.now();
2332
2335
  this.Io.has(e) || this.Io.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2333
- const r = this.Io.get(e);
2334
- if (r.isPressed = !1, r.lastReleaseTime = i, this.jo = e, this.Yo) {
2335
- const s = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !1, originalEvent: t };
2336
- this.Yo(s);
2336
+ const s = this.Io.get(e);
2337
+ if (s.isPressed = !1, s.lastReleaseTime = i, this.jo = e, this.Yo) {
2338
+ const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !1, originalEvent: t };
2339
+ this.Yo(r);
2337
2340
  }
2338
2341
  }
2339
2342
  Vo(t) {
2340
2343
  return this.Wo[t] || t.toLowerCase();
2341
2344
  }
2342
2345
  }
2343
- const Ke = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Dt }, Symbol.toStringTag, { value: "Module" }));
2344
- class _t {
2346
+ const Ke = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: _t }, Symbol.toStringTag, { value: "Module" }));
2347
+ class Bt {
2345
2348
  constructor(t, e, i) {
2346
2349
  a(this, "kr");
2347
2350
  a(this, "rh");
@@ -2380,8 +2383,8 @@ class _t {
2380
2383
  a(this, "Hh", 0);
2381
2384
  a(this, "Bh", null);
2382
2385
  this.kr = t, this.ro = e, this.rh = i;
2383
- const r = this.kr.canvas;
2384
- r.style ? (this.uh = r.style.touchAction ?? "", this.fh = r.style.userSelect ?? "", r.style.touchAction || (r.style.touchAction = "none"), r.style.userSelect || (r.style.userSelect = "none")) : (this.uh = "", this.fh = "");
2386
+ const s = this.kr.canvas;
2387
+ s.style ? (this.uh = s.style.touchAction ?? "", this.fh = s.style.userSelect ?? "", s.style.touchAction || (s.style.touchAction = "none"), s.style.userSelect || (s.style.userSelect = "none")) : (this.uh = "", this.fh = "");
2385
2388
  }
2386
2389
  Mo() {
2387
2390
  if (this.vo) return;
@@ -2446,31 +2449,31 @@ class _t {
2446
2449
  this.Fh = t;
2447
2450
  }
2448
2451
  Ih(t) {
2449
- var r;
2452
+ var s;
2450
2453
  if (!this.ro()) return;
2451
- t.preventDefault(), (r = this.rh) == null || r.bo(this.Oh);
2454
+ t.preventDefault(), (s = this.rh) == null || s.bo(this.Oh);
2452
2455
  const e = performance.now(), i = this.ea(t.changedTouches);
2453
- for (const s of i) {
2454
- const n = this.nh.get(s.id);
2455
- n && this.oh.set(s.id, this.ia(n)), this.nh.set(s.id, s);
2456
- const o = { id: s.id, startPosition: s, lastPosition: s, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
2456
+ for (const r of i) {
2457
+ const n = this.nh.get(r.id);
2458
+ n && this.oh.set(r.id, this.ia(n)), this.nh.set(r.id, r);
2459
+ const o = { id: r.id, startPosition: r, lastPosition: r, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
2457
2460
  this.Ch && (o.longPressTimer = window.setTimeout(() => {
2458
- const l = this.nh.get(s.id);
2461
+ const l = this.nh.get(r.id);
2459
2462
  l && (o.longPressFired = !0, this.Ch({ touch: this.ia(l), duration: performance.now() - o.startTime, originalEvent: t }));
2460
- }, this.Rh)), this.hh.set(s.id, o), this._h && this._h(this.ra(s, t, void 0, e));
2463
+ }, this.Rh)), this.hh.set(r.id, o), this._h && this._h(this.ra(r, t, void 0, e));
2461
2464
  }
2462
2465
  this.nh.size === 2 && this.na();
2463
2466
  }
2464
2467
  Gh(t) {
2465
- var r;
2468
+ var s;
2466
2469
  if (!this.ro()) return;
2467
- t.preventDefault(), (r = this.rh) == null || r.bo(this.Oh);
2470
+ t.preventDefault(), (s = this.rh) == null || s.bo(this.Oh);
2468
2471
  const e = performance.now(), i = this.ea(t.changedTouches);
2469
- for (const s of i) {
2470
- const n = this.nh.get(s.id), o = n ? this.ia(n) : void 0;
2471
- o && this.oh.set(s.id, o), this.nh.set(s.id, s);
2472
- const l = this.hh.get(s.id);
2473
- l && (l.lastPosition = s, l.lastTime = e, o) && j(o.clientX, o.clientY, s.clientX, s.clientY) > this.Sh && l.longPressTimer !== null && (window.clearTimeout(l.longPressTimer), l.longPressTimer = null), this.yh && this.yh(this.ra(s, t, o, e));
2472
+ for (const r of i) {
2473
+ const n = this.nh.get(r.id), o = n ? this.ia(n) : void 0;
2474
+ o && this.oh.set(r.id, o), this.nh.set(r.id, r);
2475
+ const l = this.hh.get(r.id);
2476
+ l && (l.lastPosition = r, l.lastTime = e, o) && j(o.clientX, o.clientY, r.clientX, r.clientY) > this.Sh && l.longPressTimer !== null && (window.clearTimeout(l.longPressTimer), l.longPressTimer = null), this.yh && this.yh(this.ra(r, t, o, e));
2474
2477
  }
2475
2478
  this.nh.size === 2 ? this.oa(t) : this.ah = null;
2476
2479
  }
@@ -2478,9 +2481,9 @@ class _t {
2478
2481
  if (!this.ro()) return;
2479
2482
  t.preventDefault();
2480
2483
  const e = performance.now(), i = this.ea(t.changedTouches);
2481
- for (const r of i) {
2482
- const s = this.nh.get(r.id), n = s ? this.ia(s) : void 0, o = this.hh.get(r.id);
2483
- o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.Ah && this.Ah(this.ra(r, t, n, e)), o && this.ha(o, t), this.hh.delete(r.id), this.oh.delete(r.id), this.nh.delete(r.id);
2484
+ for (const s of i) {
2485
+ const r = this.nh.get(s.id), n = r ? this.ia(r) : void 0, o = this.hh.get(s.id);
2486
+ o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.Ah && this.Ah(this.ra(s, t, n, e)), o && this.ha(o, t), this.hh.delete(s.id), this.oh.delete(s.id), this.nh.delete(s.id);
2484
2487
  }
2485
2488
  this.nh.size < 2 && (this.ah = null);
2486
2489
  }
@@ -2488,59 +2491,59 @@ class _t {
2488
2491
  if (!this.ro()) return;
2489
2492
  t.preventDefault();
2490
2493
  const e = performance.now(), i = this.ea(t.changedTouches);
2491
- for (const r of i) {
2492
- const s = this.nh.get(r.id), n = s ? this.ia(s) : void 0, o = this.hh.get(r.id);
2493
- o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.wh && this.wh(this.ra(r, t, n, e)), this.hh.delete(r.id), this.oh.delete(r.id), this.nh.delete(r.id);
2494
+ for (const s of i) {
2495
+ const r = this.nh.get(s.id), n = r ? this.ia(r) : void 0, o = this.hh.get(s.id);
2496
+ o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.wh && this.wh(this.ra(s, t, n, e)), this.hh.delete(s.id), this.oh.delete(s.id), this.nh.delete(s.id);
2494
2497
  }
2495
2498
  this.nh.size < 2 && (this.ah = null);
2496
2499
  }
2497
2500
  ea(t) {
2498
2501
  const e = [];
2499
2502
  for (let i = 0; i < t.length; i += 1) {
2500
- const r = t.item(i);
2501
- r && e.push(this.aa(r));
2503
+ const s = t.item(i);
2504
+ s && e.push(this.aa(s));
2502
2505
  }
2503
2506
  return e;
2504
2507
  }
2505
2508
  aa(t) {
2506
2509
  return this.Nh(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 });
2507
2510
  }
2508
- Nh(t, e, i, r) {
2509
- const s = this.kr.canvas, n = this.ro(), o = s.getBoundingClientRect(), l = t - o.left, c = e - o.top, u = l * (s.width / o.width), f = c * (s.height / o.height);
2510
- if (!n) return { id: i, x: -1 / 0, y: -1 / 0, clientX: t, clientY: e, pressure: r.pressure, radiusX: r.radiusX, radiusY: r.radiusY, rotationAngle: r.rotationAngle };
2511
+ Nh(t, e, i, s) {
2512
+ const r = this.kr.canvas, n = this.ro(), o = r.getBoundingClientRect(), l = t - o.left, c = e - o.top, u = l * (r.width / o.width), f = c * (r.height / o.height);
2513
+ if (!n) return { id: i, x: -1 / 0, y: -1 / 0, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
2511
2514
  const d = u - n.offsetX, g = f - n.offsetY, m = Math.floor(d / n.cellWidth), p = Math.floor(g / n.cellHeight);
2512
- return m >= 0 && m < n.cols && p >= 0 && p < n.rows ? { id: i, x: m - Math.floor((n.cols - 1) / 2), y: p - Math.floor(n.rows / 2), clientX: t, clientY: e, pressure: r.pressure, radiusX: r.radiusX, radiusY: r.radiusY, rotationAngle: r.rotationAngle } : { id: i, x: -1 / 0, y: -1 / 0, clientX: t, clientY: e, pressure: r.pressure, radiusX: r.radiusX, radiusY: r.radiusY, rotationAngle: r.rotationAngle };
2515
+ return m >= 0 && m < n.cols && p >= 0 && p < n.rows ? { id: i, x: m - Math.floor((n.cols - 1) / 2), y: p - Math.floor(n.rows / 2), clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle } : { id: i, x: -1 / 0, y: -1 / 0, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
2513
2516
  }
2514
- ra(t, e, i, r) {
2515
- const s = this.hh.get(t.id), n = Array.from(this.oh.values()).map((c) => this.ia(c)), o = Array.from(this.nh.values()).map((c) => this.ia(c)), l = this.ea(e.changedTouches);
2516
- return { touch: this.ia(t), previousTouch: i ? this.ia(i) : void 0, touches: o, previousTouches: n, changedTouches: l, deltaTime: s ? r - s.lastTime : 0, originalEvent: e };
2517
+ ra(t, e, i, s) {
2518
+ const r = this.hh.get(t.id), n = Array.from(this.oh.values()).map((c) => this.ia(c)), o = Array.from(this.nh.values()).map((c) => this.ia(c)), l = this.ea(e.changedTouches);
2519
+ return { touch: this.ia(t), previousTouch: i ? this.ia(i) : void 0, touches: o, previousTouches: n, changedTouches: l, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
2517
2520
  }
2518
2521
  na() {
2519
2522
  if (this.nh.size !== 2) return void (this.ah = null);
2520
- const t = Array.from(this.nh.values()), [e, i] = t, r = j(e.x, e.y, i.x, i.y), s = xt(e.clientX, e.clientY, i.clientX, i.clientY);
2521
- this.ah = { ids: [e.id, i.id], initialDistance: Math.max(r, 1e-4), initialAngle: s, lastScale: 1, lastRotation: 0 };
2523
+ const t = Array.from(this.nh.values()), [e, i] = t, s = j(e.x, e.y, i.x, i.y), r = Et(e.clientX, e.clientY, i.clientX, i.clientY);
2524
+ this.ah = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
2522
2525
  }
2523
2526
  oa(t) {
2524
2527
  if (this.ah || this.na(), !this.ah) return;
2525
- const [e, i] = this.ah.ids, r = this.nh.get(e), s = this.nh.get(i);
2526
- if (!r || !s) return;
2527
- const n = j(r.x, r.y, s.x, s.y) / this.ah.initialDistance, o = n - this.ah.lastScale;
2528
- this.$h && Math.abs(o) > this.zh && (this.$h({ touches: [this.ia(r), this.ia(s)], scale: n, deltaScale: o, center: this.ca(r, s), originalEvent: t }), this.ah.lastScale = n);
2529
- let l = xt(r.clientX, r.clientY, s.clientX, s.clientY) - this.ah.initialAngle;
2528
+ const [e, i] = this.ah.ids, s = this.nh.get(e), r = this.nh.get(i);
2529
+ if (!s || !r) return;
2530
+ const n = j(s.x, s.y, r.x, r.y) / this.ah.initialDistance, o = n - this.ah.lastScale;
2531
+ this.$h && Math.abs(o) > this.zh && (this.$h({ touches: [this.ia(s), this.ia(r)], scale: n, deltaScale: o, center: this.ca(s, r), originalEvent: t }), this.ah.lastScale = n);
2532
+ let l = Et(s.clientX, s.clientY, r.clientX, r.clientY) - this.ah.initialAngle;
2530
2533
  l = (l + 180) % 360 - 180;
2531
2534
  const c = l - this.ah.lastRotation;
2532
- this.Fh && Math.abs(c) > this.Dh && (this.Fh({ touches: [this.ia(r), this.ia(s)], rotation: l, deltaRotation: c, center: this.ca(r, s), originalEvent: t }), this.ah.lastRotation = l);
2535
+ this.Fh && Math.abs(c) > this.Dh && (this.Fh({ touches: [this.ia(s), this.ia(r)], rotation: l, deltaRotation: c, center: this.ca(s, r), originalEvent: t }), this.ah.lastRotation = l);
2533
2536
  }
2534
2537
  ca(t, e) {
2535
- const i = (t.clientX + e.clientX) / 2, r = (t.clientY + e.clientY) / 2, s = this.Nh(i, r, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: r });
2536
- return { x: s.x, y: s.y };
2538
+ const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.Nh(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
2539
+ return { x: r.x, y: r.y };
2537
2540
  }
2538
2541
  ha(t, e) {
2539
- const i = performance.now(), r = i - t.startTime, s = j(t.startPosition.clientX, t.startPosition.clientY, t.lastPosition.clientX, t.lastPosition.clientY);
2540
- if (!t.longPressFired && r <= this.Ph && s <= this.Eh)
2542
+ const i = performance.now(), s = i - t.startTime, r = j(t.startPosition.clientX, t.startPosition.clientY, t.lastPosition.clientX, t.lastPosition.clientY);
2543
+ if (!t.longPressFired && s <= this.Ph && r <= this.Eh)
2541
2544
  this.la(t.lastPosition, i) && this.xh ? this.xh({ touch: this.ia(t.lastPosition), taps: 2, originalEvent: e }) : this.bh && this.bh({ touch: this.ia(t.lastPosition), taps: 1, originalEvent: e });
2542
- else if (!t.longPressFired && r <= this.Lh && s >= this.kh) {
2543
- const n = { x: t.lastPosition.clientX - t.startPosition.clientX, y: t.lastPosition.clientY - t.startPosition.clientY }, o = Math.max(Math.hypot(n.x, n.y), 1e-4), l = { x: n.x / o, y: n.y / o }, c = { x: n.x / r, y: n.y / r };
2545
+ else if (!t.longPressFired && s <= this.Lh && r >= this.kh) {
2546
+ const n = { x: t.lastPosition.clientX - t.startPosition.clientX, y: t.lastPosition.clientY - t.startPosition.clientY }, o = Math.max(Math.hypot(n.x, n.y), 1e-4), l = { x: n.x / o, y: n.y / o }, c = { x: n.x / s, y: n.y / s };
2544
2547
  this.Mh && this.Mh({ touch: this.ia(t.lastPosition), direction: l, distance: o, velocity: c, originalEvent: e });
2545
2548
  }
2546
2549
  this.Hh = i, this.Bh = this.ia(t.lastPosition);
@@ -2552,24 +2555,24 @@ class _t {
2552
2555
  return { ...t };
2553
2556
  }
2554
2557
  }
2555
- const Xe = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: _t }, Symbol.toStringTag, { value: "Module" }));
2556
- class G extends At {
2557
- constructor(e, i, r, s, n, o, l, c, u, f = !1) {
2558
+ const ze = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Bt }, Symbol.toStringTag, { value: "Module" }));
2559
+ class z extends yt {
2560
+ constructor(e, i, s, r, n, o, l, c, u, f = !1) {
2558
2561
  const d = Math.min(l / n, c / o);
2559
- super(e, i, r, s, n, o, Math.max(1, Math.floor(n * d)), Math.max(1, Math.floor(o * d)));
2562
+ super(e, i, s, r, n, o, Math.max(1, Math.floor(n * d)), Math.max(1, Math.floor(o * d)));
2560
2563
  a(this, "ua");
2561
2564
  a(this, "fa", !1);
2562
2565
  this.ua = u, this.fa = f;
2563
2566
  }
2564
- static da(e, i, r, s, n) {
2567
+ static da(e, i, s, r, n) {
2565
2568
  const o = e.context, l = o.createTexture();
2566
- o.bindTexture(o.TEXTURE_2D, l), o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL, 1), st(o, o.NEAREST, o.NEAREST, o.CLAMP_TO_EDGE, o.CLAMP_TO_EDGE), o.texImage2D(o.TEXTURE_2D, 0, o.RGBA, o.RGBA, o.UNSIGNED_BYTE, r), o.bindTexture(o.TEXTURE_2D, null);
2567
- const c = r.width ?? r.videoWidth ?? 0, u = r.height ?? r.videoHeight ?? 0;
2568
- return new G(o, e, l, i, c, u, s, n, r, !1);
2569
+ o.bindTexture(o.TEXTURE_2D, l), o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL, 1), rt(o, o.NEAREST, o.NEAREST, o.CLAMP_TO_EDGE, o.CLAMP_TO_EDGE), o.texImage2D(o.TEXTURE_2D, 0, o.RGBA, o.RGBA, o.UNSIGNED_BYTE, s), o.bindTexture(o.TEXTURE_2D, null);
2570
+ const c = s.width ?? s.videoWidth ?? 0, u = s.height ?? s.videoHeight ?? 0;
2571
+ return new z(o, e, l, i, c, u, r, n, s, !1);
2569
2572
  }
2570
- static pa(e, i, r, s, n, o, l) {
2573
+ static pa(e, i, s, r, n, o, l) {
2571
2574
  const c = e.context;
2572
- return new G(c, e, r, i, s, n, o, l, null, !0);
2575
+ return new z(c, e, s, i, r, n, o, l, null, !0);
2573
2576
  }
2574
2577
  va() {
2575
2578
  if (this.fa || !this.ua) return;
@@ -2595,12 +2598,12 @@ class G extends At {
2595
2598
  return this.fa;
2596
2599
  }
2597
2600
  }
2598
- class ot extends At {
2599
- constructor(e, i, r, s, n, o, l, c, u) {
2601
+ class ot extends yt {
2602
+ constructor(e, i, s, r, n, o, l, c, u) {
2600
2603
  const f = o / l;
2601
2604
  let d, g;
2602
2605
  f > 1 ? (d = c, g = Math.round(c / f)) : (g = u, d = Math.round(u * f));
2603
- super(e, i, r, s, o, l, d, g);
2606
+ super(e, i, s, r, o, l, d, g);
2604
2607
  a(this, "ga");
2605
2608
  this.ga = n;
2606
2609
  }
@@ -2622,7 +2625,7 @@ class ot extends At {
2622
2625
  Cn() {
2623
2626
  this.va();
2624
2627
  }
2625
- static async Tn(e, i, r, s, n) {
2628
+ static async Tn(e, i, s, r, n) {
2626
2629
  const o = e.context;
2627
2630
  let l;
2628
2631
  l = document.createElement("video"), l.crossOrigin = "anonymous", l.loop = !0, l.muted = !0, l.playsInline = !0, await new Promise((d, g) => {
@@ -2630,12 +2633,12 @@ class ot extends At {
2630
2633
  var v;
2631
2634
  const p = m.target;
2632
2635
  g(Error("Failed to load video: " + (((v = p.error) == null ? void 0 : v.message) || "Unknown error")));
2633
- }, { once: !0 }), l.src = r;
2636
+ }, { once: !0 }), l.src = s;
2634
2637
  });
2635
2638
  const c = o.createTexture();
2636
- o.bindTexture(o.TEXTURE_2D, c), o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL, 1), st(o, o.LINEAR, o.LINEAR, o.CLAMP_TO_EDGE, o.CLAMP_TO_EDGE), o.texImage2D(o.TEXTURE_2D, 0, o.RGBA, o.RGBA, o.UNSIGNED_BYTE, l), o.bindTexture(o.TEXTURE_2D, null);
2639
+ o.bindTexture(o.TEXTURE_2D, c), o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL, 1), rt(o, o.LINEAR, o.LINEAR, o.CLAMP_TO_EDGE, o.CLAMP_TO_EDGE), o.texImage2D(o.TEXTURE_2D, 0, o.RGBA, o.RGBA, o.UNSIGNED_BYTE, l), o.bindTexture(o.TEXTURE_2D, null);
2637
2640
  const u = l.videoWidth, f = l.videoHeight;
2638
- return new ot(o, e, c, i, l, u, f, s, n);
2641
+ return new ot(o, e, c, i, l, u, f, r, n);
2639
2642
  }
2640
2643
  async play() {
2641
2644
  await this.ga.play();
@@ -2672,9 +2675,9 @@ class ot extends At {
2672
2675
  }
2673
2676
  }
2674
2677
  const Ge = (h) => class extends h {
2675
- ma(t, e, i, r) {
2676
- if (L.nn(t)) return t;
2677
- if (typeof t == "number" || typeof t == "string") return this.color(t, e, i, r);
2678
+ ma(t, e, i, s) {
2679
+ if (S.nn(t)) return t;
2680
+ if (typeof t == "number" || typeof t == "string") return this.color(t, e, i, s);
2678
2681
  throw Error("Unsupported color input passed to color-capable method.");
2679
2682
  }
2680
2683
  rotate(t = 0, e = 0, i = 0) {
@@ -2707,8 +2710,8 @@ const Ge = (h) => class extends h {
2707
2710
  pop() {
2708
2711
  this.K.state.ot();
2709
2712
  }
2710
- color(t, e, i, r) {
2711
- return L.rn(t, e, i, r);
2713
+ color(t, e, i, s) {
2714
+ return S.rn(t, e, i, s);
2712
2715
  }
2713
2716
  rect(t = 1, e = 1) {
2714
2717
  this.K.wi(t, e);
@@ -2716,28 +2719,28 @@ const Ge = (h) => class extends h {
2716
2719
  point() {
2717
2720
  this.K.wi(1, 1);
2718
2721
  }
2719
- line(t, e, i, r) {
2720
- this.K.bi(t, e, i, r);
2722
+ line(t, e, i, s) {
2723
+ this.K.bi(t, e, i, s);
2721
2724
  }
2722
2725
  lineWeight(t) {
2723
2726
  this.K.state.Wt(t);
2724
2727
  }
2725
- background(t, e, i, r = 255) {
2726
- const s = this.ma(t, e, i, r);
2727
- this.K.Pi(s.r, s.g, s.b, s.a);
2728
+ background(t, e, i, s = 255) {
2729
+ const r = this.ma(t, e, i, s);
2730
+ this.K.Pi(r.r, r.g, r.b, r.a);
2728
2731
  }
2729
2732
  char(t) {
2730
2733
  const e = Array.from(t);
2731
2734
  if (e.length === 0) throw Error("char() requires at least one character.");
2732
2735
  this.K.state.rs(this._a.font.$r(e[0]));
2733
2736
  }
2734
- charColor(t, e, i, r) {
2735
- const s = this.ma(t, e, i, r);
2736
- this.K.state.ns(s.r, s.g, s.b, s.a);
2737
+ charColor(t, e, i, s) {
2738
+ const r = this.ma(t, e, i, s);
2739
+ this.K.state.ns(r.r, r.g, r.b, r.a);
2737
2740
  }
2738
- cellColor(t, e, i, r) {
2739
- const s = this.ma(t, e, i, r);
2740
- this.K.state.hs(s.r, s.g, s.b, s.a);
2741
+ cellColor(t, e, i, s) {
2742
+ const r = this.ma(t, e, i, s);
2743
+ this.K.state.hs(r.r, r.g, r.b, r.a);
2741
2744
  }
2742
2745
  flipX(t) {
2743
2746
  this.K.state.cs(t);
@@ -2757,14 +2760,14 @@ const Ge = (h) => class extends h {
2757
2760
  ellipse(t, e) {
2758
2761
  this.K.xi(t / 2, e / 2);
2759
2762
  }
2760
- triangle(t, e, i, r, s, n) {
2761
- this.K.Ci(t, e, i, r, s, n);
2763
+ triangle(t, e, i, s, r, n) {
2764
+ this.K.Ci(t, e, i, s, r, n);
2762
2765
  }
2763
- bezierCurve(t, e, i, r, s, n, o, l) {
2764
- this.K.Mi(t, e, i, r, s, n, o, l);
2766
+ bezierCurve(t, e, i, s, r, n, o, l) {
2767
+ this.K.Mi(t, e, i, s, r, n, o, l);
2765
2768
  }
2766
- arc(t, e, i, r) {
2767
- this.K.$i(t / 2, e / 2, i, r);
2769
+ arc(t, e, i, s) {
2770
+ this.K.$i(t / 2, e / 2, i, s);
2768
2771
  }
2769
2772
  shader(t) {
2770
2773
  this.K.pi(t);
@@ -2785,30 +2788,30 @@ const Ge = (h) => class extends h {
2785
2788
  return this.K.mi(t);
2786
2789
  }
2787
2790
  async createShader(t, e) {
2788
- let i, r;
2791
+ let i, s;
2789
2792
  if (typeof t == "string" && (t.startsWith("./") || t.startsWith("../") || t.endsWith(".vert") || t.endsWith(".glsl"))) {
2790
- const s = await fetch(t);
2791
- if (!s.ok) throw Error(`Failed to load vertex shader from ${t}: ${s.statusText}`);
2792
- i = await s.text();
2793
+ const r = await fetch(t);
2794
+ if (!r.ok) throw Error(`Failed to load vertex shader from ${t}: ${r.statusText}`);
2795
+ i = await r.text();
2793
2796
  } else i = t;
2794
2797
  if (typeof e == "string" && (e.startsWith("./") || e.startsWith("../") || e.endsWith(".frag") || e.endsWith(".glsl"))) {
2795
- const s = await fetch(e);
2796
- if (!s.ok) throw Error(`Failed to load fragment shader from ${e}: ${s.statusText}`);
2797
- r = await s.text();
2798
- } else r = e;
2799
- return this.K.di(i, r);
2798
+ const r = await fetch(e);
2799
+ if (!r.ok) throw Error(`Failed to load fragment shader from ${e}: ${r.statusText}`);
2800
+ s = await r.text();
2801
+ } else s = e;
2802
+ return this.K.di(i, s);
2800
2803
  }
2801
2804
  createFramebuffer(t) {
2802
2805
  return this.K.Fi(t.width ?? this.grid.cols, t.height ?? this.grid.rows, t.attachments ?? 3);
2803
2806
  }
2804
2807
  image(t, e, i) {
2805
- var r;
2806
- this.K._i(t, e, i, ((r = this._a) == null ? void 0 : r.font) ?? this.ya.base.font), t instanceof X && this.K.ht();
2808
+ var s;
2809
+ this.K._i(t, e, i, ((s = this._a) == null ? void 0 : s.font) ?? this.ya.base.font), t instanceof K && this.K.ht();
2807
2810
  }
2808
2811
  async loadImage(t) {
2809
- const e = t, i = await new Promise((r, s) => {
2812
+ const e = t, i = await new Promise((s, r) => {
2810
2813
  const n = new Image();
2811
- n.crossOrigin = "anonymous", n.onload = () => r(n), n.onerror = (o) => s(o), n.src = e;
2814
+ n.crossOrigin = "anonymous", n.onload = () => s(n), n.onerror = (o) => r(o), n.src = e;
2812
2815
  });
2813
2816
  return q.Tn(this.K, this.gn, i, this.grid.cols, this.grid.rows);
2814
2817
  }
@@ -2818,11 +2821,11 @@ const Ge = (h) => class extends h {
2818
2821
  createTexture(t, e, i) {
2819
2822
  if (t instanceof WebGLTexture) {
2820
2823
  if (e === void 0 || i === void 0) throw Error("[textmode.js] Width and height are required when creating texture from WebGLTexture.");
2821
- return G.pa(this.K, this.gn, t, e, i, this.grid.cols, this.grid.rows);
2824
+ return z.pa(this.K, this.gn, t, e, i, this.grid.cols, this.grid.rows);
2822
2825
  }
2823
- return G.da(this.K, this.gn, t, this.grid.cols, this.grid.rows);
2826
+ return z.da(this.K, this.gn, t, this.grid.cols, this.grid.rows);
2824
2827
  }
2825
- }, ze = (h) => class extends h {
2828
+ }, je = (h) => class extends h {
2826
2829
  get frameCount() {
2827
2830
  return this.wa.Vn;
2828
2831
  }
@@ -2843,7 +2846,7 @@ const Ge = (h) => class extends h {
2843
2846
  this.wa.Xn(() => this.ba());
2844
2847
  }
2845
2848
  redraw(t = 1) {
2846
- 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.ba();
2849
+ if (At.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.ba();
2847
2850
  }
2848
2851
  isLooping() {
2849
2852
  return this.wa.Kn;
@@ -2863,7 +2866,7 @@ const Ge = (h) => class extends h {
2863
2866
  deltaTime() {
2864
2867
  return this.wa.io;
2865
2868
  }
2866
- }, je = (h) => class extends h {
2869
+ }, Ye = (h) => class extends h {
2867
2870
  constructor(...t) {
2868
2871
  super(...t);
2869
2872
  }
@@ -2888,7 +2891,7 @@ const Ge = (h) => class extends h {
2888
2891
  cursor(t) {
2889
2892
  this.rh.Co(t);
2890
2893
  }
2891
- }, Ye = (h) => class extends h {
2894
+ }, He = (h) => class extends h {
2892
2895
  constructor(...t) {
2893
2896
  super(...t);
2894
2897
  }
@@ -2925,7 +2928,7 @@ const Ge = (h) => class extends h {
2925
2928
  get touches() {
2926
2929
  return this.xa.Xh();
2927
2930
  }
2928
- }, He = (h) => class extends h {
2931
+ }, Qe = (h) => class extends h {
2929
2932
  constructor(...t) {
2930
2933
  super(...t);
2931
2934
  }
@@ -2951,7 +2954,7 @@ const Ge = (h) => class extends h {
2951
2954
  return this.Ca.eh();
2952
2955
  }
2953
2956
  };
2954
- class It {
2957
+ class Nt {
2955
2958
  constructor(t) {
2956
2959
  a(this, "Ma");
2957
2960
  a(this, "$a", /* @__PURE__ */ new Map());
@@ -2971,12 +2974,12 @@ class It {
2971
2974
  if (this.$a.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
2972
2975
  const i = this.Da(e.name);
2973
2976
  try {
2974
- const r = e.install(this.Ma, i);
2975
- r instanceof Promise && r.catch((s) => {
2976
- console.error(`[textmode.js] Async plugin "${e.name}" installation error:`, s), this.Oa(e.name);
2977
+ const s = e.install(this.Ma, i);
2978
+ s instanceof Promise && s.catch((r) => {
2979
+ console.error(`[textmode.js] Async plugin "${e.name}" installation error:`, r), this.Oa(e.name);
2977
2980
  });
2978
- } catch (r) {
2979
- throw this.Oa(e.name), r;
2981
+ } catch (s) {
2982
+ throw this.Oa(e.name), s;
2980
2983
  }
2981
2984
  this.$a.set(e.name, e), this.Fa.push(e.name);
2982
2985
  }
@@ -2987,8 +2990,8 @@ class It {
2987
2990
  const i = this.Da(e.name);
2988
2991
  try {
2989
2992
  await e.install(this.Ma, i);
2990
- } catch (r) {
2991
- throw this.Oa(e.name), r;
2993
+ } catch (s) {
2994
+ throw this.Oa(e.name), s;
2992
2995
  }
2993
2996
  this.$a.set(e.name, e), this.Fa.push(e.name);
2994
2997
  }
@@ -3040,17 +3043,17 @@ class It {
3040
3043
  return e.layers.base.drawFramebuffer;
3041
3044
  }, get asciiFramebuffer() {
3042
3045
  return e.layers.base.asciiFramebuffer;
3043
- }, registerPreDrawHook: (r) => i.Ja(i.Pa, t, r), registerPostDrawHook: (r) => i.Ja(i.Ta, t, r), registerLayerDisposedHook: (r) => i.Ja(i.Ua, t, r), registerLayerPreRenderHook: (r) => i.Ja(i.Ea, t, r), registerLayerPostRenderHook: (r) => i.Ja(i.Ra, t, r), registerPreSetupHook: (r) => i.Ja(i.Sa, t, r), registerPostSetupHook: (r) => i.Ja(i.ka, t, r), extendLayer: (r, s) => {
3044
- i.tc(t, r, s);
3045
- }, removeLayerExtension: (r) => {
3046
- i.sc(t, r);
3046
+ }, registerPreDrawHook: (s) => i.Ja(i.Pa, t, s), registerPostDrawHook: (s) => i.Ja(i.Ta, t, s), registerLayerDisposedHook: (s) => i.Ja(i.Ua, t, s), registerLayerPreRenderHook: (s) => i.Ja(i.Ea, t, s), registerLayerPostRenderHook: (s) => i.Ja(i.Ra, t, s), registerPreSetupHook: (s) => i.Ja(i.Sa, t, s), registerPostSetupHook: (s) => i.Ja(i.ka, t, s), extendLayer: (s, r) => {
3047
+ i.tc(t, s, r);
3048
+ }, removeLayerExtension: (s) => {
3049
+ i.sc(t, s);
3047
3050
  } };
3048
3051
  }
3049
3052
  Ja(t, e, i) {
3050
- const r = t.get(e) ?? /* @__PURE__ */ new Set();
3051
- return r.add(i), t.set(e, r), () => {
3052
- const s = t.get(e);
3053
- s && (s.delete(i), s.size === 0 && t.delete(e));
3053
+ const s = t.get(e) ?? /* @__PURE__ */ new Set();
3054
+ return s.add(i), t.set(e, s), () => {
3055
+ const r = t.get(e);
3056
+ r && (r.delete(i), r.size === 0 && t.delete(e));
3054
3057
  };
3055
3058
  }
3056
3059
  Oa(t) {
@@ -3064,45 +3067,45 @@ class It {
3064
3067
  Ga(t) {
3065
3068
  for (const e of this.Fa) {
3066
3069
  const i = t.get(e);
3067
- i && i.forEach((r) => r());
3070
+ i && i.forEach((s) => s());
3068
3071
  }
3069
3072
  }
3070
3073
  Na(t, e) {
3071
3074
  for (const i of this.Fa) {
3072
- const r = t.get(i);
3073
- r && r.forEach((s) => s(e));
3075
+ const s = t.get(i);
3076
+ s && s.forEach((r) => r(e));
3074
3077
  }
3075
3078
  }
3076
3079
  Ya(t, e) {
3077
3080
  for (const i of this.Fa) {
3078
- const r = t.get(i);
3079
- r && r.forEach((s) => s(e));
3081
+ const s = t.get(i);
3082
+ s && s.forEach((r) => r(e));
3080
3083
  }
3081
3084
  }
3082
3085
  async Za(t) {
3083
3086
  for (const e of this.Fa) {
3084
3087
  const i = t.get(e);
3085
- if (i) for (const r of i) await r();
3088
+ if (i) for (const s of i) await s();
3086
3089
  }
3087
3090
  }
3088
3091
  tc(t, e, i) {
3089
- let r = this.La.get(t);
3090
- r || (r = /* @__PURE__ */ new Map(), this.La.set(t, r));
3091
- for (const [s, n] of this.La) s !== t && n.has(e) && console.warn(`[textmode.js] Plugin "${t}" is overwriting layer method "${e}" previously added by plugin "${s}".`);
3092
- r.set(e, i), this.rc(e, i);
3092
+ let s = this.La.get(t);
3093
+ s || (s = /* @__PURE__ */ new Map(), this.La.set(t, s));
3094
+ for (const [r, n] of this.La) r !== t && n.has(e) && console.warn(`[textmode.js] Plugin "${t}" is overwriting layer method "${e}" previously added by plugin "${r}".`);
3095
+ s.set(e, i), this.rc(e, i);
3093
3096
  }
3094
3097
  sc(t, e) {
3095
3098
  const i = this.La.get(t);
3096
3099
  if (!i) return;
3097
3100
  i.delete(e);
3098
- let r = !1;
3099
- for (const [s, n] of this.La) if (s !== t && n.has(e)) {
3100
- r = !0;
3101
+ let s = !1;
3102
+ for (const [r, n] of this.La) if (r !== t && n.has(e)) {
3103
+ s = !0;
3101
3104
  const o = n.get(e);
3102
3105
  this.rc(e, o);
3103
3106
  break;
3104
3107
  }
3105
- r || this.ec(e);
3108
+ s || this.ec(e);
3106
3109
  }
3107
3110
  rc(t, e) {
3108
3111
  const i = Object.getPrototypeOf(this.Ma.layers.base);
@@ -3113,8 +3116,8 @@ class It {
3113
3116
  i && i.configurable && delete e[t];
3114
3117
  }
3115
3118
  }
3116
- const $e = Object.freeze(Object.defineProperty({ __proto__: null, TextmodePluginManager: It }, Symbol.toStringTag, { value: "Module" }));
3117
- class Nt {
3119
+ const ti = Object.freeze(Object.defineProperty({ __proto__: null, TextmodePluginManager: Nt }, Symbol.toStringTag, { value: "Module" }));
3120
+ class kt {
3118
3121
  constructor() {
3119
3122
  a(this, "nc", /* @__PURE__ */ new Map());
3120
3123
  a(this, "oc", []);
@@ -3138,15 +3141,15 @@ class Nt {
3138
3141
  this.cc = t;
3139
3142
  }
3140
3143
  dc(t, e = 1) {
3141
- const i = `phase-${this.oc.length + 1}-${Date.now()}`, r = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
3142
- return this.nc.set(i, r), this.oc.push(i), this.hc += r.weight, i;
3144
+ const i = `phase-${this.oc.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
3145
+ return this.nc.set(i, s), this.oc.push(i), this.hc += s.weight, i;
3143
3146
  }
3144
3147
  vc(t, e) {
3145
3148
  const i = this.nc.get(t);
3146
3149
  if (!i) return;
3147
3150
  i.progress = Math.max(0, Math.min(1, e)), i.status = i.progress >= 1 ? "complete" : "running";
3148
- const r = this.uc;
3149
- Math.abs(r - this.ac) > 1e-3 && (this.ac = r, this.cc && this.cc(r));
3151
+ const s = this.uc;
3152
+ Math.abs(s - this.ac) > 1e-3 && (this.ac = s, this.cc && this.cc(s));
3150
3153
  }
3151
3154
  gc(t) {
3152
3155
  const e = this.nc.get(t);
@@ -3163,7 +3166,7 @@ class Nt {
3163
3166
  });
3164
3167
  }
3165
3168
  }
3166
- class kt {
3169
+ class Xt {
3167
3170
  constructor(t = "active") {
3168
3171
  a(this, "yc");
3169
3172
  a(this, "wc", "");
@@ -3191,72 +3194,72 @@ class kt {
3191
3194
  Tc() {
3192
3195
  this.yc !== "disabled" && (this.yc = "done");
3193
3196
  }
3194
- Uc() {
3197
+ Ec() {
3195
3198
  this.yc !== "disabled" && (this.yc = "transitioning");
3196
3199
  }
3197
- Ec() {
3200
+ Rc() {
3198
3201
  this.yc === "transitioning" && (this.yc = "done");
3199
3202
  }
3200
- Rc(t) {
3203
+ Sc(t) {
3201
3204
  this.yc !== "disabled" && (this.yc = "error", t instanceof Error ? (this.wc = t.message, this.bc = t.stack || "") : (this.wc = t, this.bc = ""));
3202
3205
  }
3203
- Sc() {
3206
+ kc() {
3204
3207
  this.yc = "disabled";
3205
3208
  }
3206
3209
  }
3207
3210
  class Kt {
3208
3211
  constructor(t, e) {
3209
- a(this, "kc", 0);
3210
- a(this, "Lc", 1);
3211
- a(this, "zc");
3212
+ a(this, "Lc", 0);
3213
+ a(this, "zc", 1);
3212
3214
  a(this, "Dc");
3213
- this.zc = t, this.Dc = e;
3214
- }
3215
- get Oc() {
3216
- return this.Lc;
3215
+ a(this, "Oc");
3216
+ this.Dc = t, this.Oc = e;
3217
3217
  }
3218
3218
  get Hc() {
3219
- return this.Lc < 1;
3219
+ return this.zc;
3220
+ }
3221
+ get Bc() {
3222
+ return this.zc < 1;
3220
3223
  }
3221
3224
  jn() {
3222
- this.zc !== "none" && this.Dc > 0 && (this.kc = performance.now());
3225
+ this.Dc !== "none" && this.Oc > 0 && (this.Lc = performance.now());
3223
3226
  }
3224
3227
  et() {
3225
- if (this.zc === "none" || this.Dc === 0) return this.Lc = 1, !1;
3226
- const t = performance.now() - this.kc, e = Math.min(1, t / this.Dc);
3227
- return e >= 1 ? (this.Lc = 0, !0) : (this.Lc = 1 - e, !1);
3228
+ if (this.Dc === "none" || this.Oc === 0) return this.zc = 1, !1;
3229
+ const t = performance.now() - this.Lc, e = Math.min(1, t / this.Oc);
3230
+ return e >= 1 ? (this.zc = 0, !0) : (this.zc = 1 - e, !1);
3228
3231
  }
3229
3232
  Js() {
3230
- this.Lc = 1, this.kc = 0;
3233
+ this.zc = 1, this.Lc = 0;
3231
3234
  }
3232
3235
  }
3233
- function mt(h, t) {
3236
+ function vt(h, t) {
3234
3237
  const e = h.tone ?? "auto";
3235
3238
  let i = "dark";
3236
- return e === "light" || e === "dark" ? i = e : t && (i = function(r) {
3237
- if (!r) return 0;
3238
- const [s, n, o] = r.map((c) => c / 255), l = (c) => c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
3239
- return 0.2126 * l(s) + 0.7152 * l(n) + 0.0722 * l(o);
3239
+ return e === "light" || e === "dark" ? i = e : t && (i = function(s) {
3240
+ if (!s) return 0;
3241
+ const [r, n, o] = s.map((c) => c / 255), l = (c) => c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
3242
+ return 0.2126 * l(r) + 0.7152 * l(n) + 0.0722 * l(o);
3240
3243
  }(t) > 0.5 ? "light" : "dark"), { mode: i, background: t, textColor: i === "light" ? "#1A1A1A" : "#F8F8F8", subtleColor: i === "light" ? "#4A4A4A" : "#C0C0C0" };
3241
3244
  }
3242
- function Xt(h) {
3245
+ function zt(h) {
3243
3246
  return h.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
3244
3247
  }
3245
3248
  function Gt(h, t) {
3246
3249
  return h.length ? h.map((e) => t.color(e)) : [t.color("#FFFFFF")];
3247
3250
  }
3248
- class zt {
3249
- constructor(t, e, i, r) {
3250
- this.Bc = t, this.id = e, this.label = i, this.Ic = r;
3251
+ class jt {
3252
+ constructor(t, e, i, s) {
3253
+ this.Ic = t, this.id = e, this.label = i, this.Gc = s;
3251
3254
  }
3252
3255
  report(t) {
3253
- this.Bc.vc(this.id, t);
3256
+ this.Ic.vc(this.id, t);
3254
3257
  }
3255
3258
  complete() {
3256
- this.Bc.gc(this.id);
3259
+ this.Ic.gc(this.id);
3257
3260
  }
3258
3261
  fail(t) {
3259
- this.Bc.mc(this.id), this.Ic && this.Ic(t ?? Error(`Loading phase "${this.label}" failed`));
3262
+ this.Ic.mc(this.id), this.Gc && this.Gc(t ?? Error(`Loading phase "${this.label}" failed`));
3260
3263
  }
3261
3264
  async track(t) {
3262
3265
  try {
@@ -3267,7 +3270,7 @@ class zt {
3267
3270
  }
3268
3271
  }
3269
3272
  }
3270
- const Qe = ({ textmodifier: h, grid: t, progress: e, frameCount: i, message: r, palette: s, theme: n, phases: o, transitionOpacity: l, isError: c, errorMessage: u }) => {
3273
+ const We = ({ textmodifier: h, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: n, phases: o, transitionOpacity: l, isError: c, errorMessage: u }) => {
3271
3274
  const f = "|/-\\", d = Math.floor(i / 6) % 4, g = h.color(n.textColor), m = Math.floor(255 * l), p = h.color(g.r, g.g, g.b, m);
3272
3275
  if (h.charColor(p), h.cellColor(0, 0, 0, 0), c) {
3273
3276
  const v = h.color(n.mode === "light" ? "#D32F2F" : "#FF6B6B", m);
@@ -3278,43 +3281,42 @@ const Qe = ({ textmodifier: h, grid: t, progress: e, frameCount: i, message: r,
3278
3281
  if (h.pop(), u) {
3279
3282
  const y = h.color(n.subtleColor), b = h.color(y.r, y.g, y.b, m);
3280
3283
  h.charColor(b);
3281
- const x = Math.floor(0.8 * t.cols), M = u.split(" "), S = [];
3284
+ const x = Math.floor(0.8 * t.cols), M = u.split(" "), L = [];
3282
3285
  let T = "";
3283
- for (const F of M) (T + " " + F).length <= x ? T = T ? T + " " + F : F : (T && S.push(T), T = F);
3284
- T && S.push(T);
3285
- const U = S.slice(0, 3);
3286
- S.length > 3 && (U[2] = U[2].substring(0, x - 3) + "..."), U.forEach((F, J) => {
3287
- const Jt = -Math.floor(F.length / 2);
3288
- h.push(), h.translate(Jt, 3 + J, 0);
3289
- for (const $t of F) h.char($t), h.rect(1, 1), h.translateX(1);
3286
+ for (const C of M) (T + " " + C).length <= x ? T = T ? T + " " + C : C : (T && L.push(T), T = C);
3287
+ T && L.push(T);
3288
+ const U = L.slice(0, 3);
3289
+ L.length > 3 && (U[2] = U[2].substring(0, x - 3) + "..."), U.forEach((C, J) => {
3290
+ const $t = -Math.floor(C.length / 2);
3291
+ h.push(), h.translate($t, 3 + J, 0);
3292
+ for (const te of C) h.char(te), h.rect(1, 1), h.translateX(1);
3290
3293
  h.pop();
3291
3294
  });
3292
3295
  }
3293
3296
  return;
3294
3297
  }
3295
3298
  if (h.push(), h.translate(0, 0, 0), h.char(f[d]), h.rect(1, 1), h.pop(), e > 0 || o.some((v) => v.status !== "pending")) {
3296
- const v = Math.max(6, Math.floor(0.6 * t.cols)), A = -Math.floor(v / 2), w = Math.floor(v * e), y = s.length ? s : [h.color("#FFFFFF")];
3299
+ const v = Math.max(6, Math.floor(0.6 * t.cols)), A = -Math.floor(v / 2), w = Math.floor(v * e), y = r.length ? r : [h.color("#FFFFFF")];
3297
3300
  h.push(), h.translate(A, 3, 0);
3298
3301
  for (let b = 0; b < v; b++) {
3299
- const x = b < w ? "*" : ".", M = y[b % y.length], S = h.color(M.r, M.g, M.b, m);
3300
- h.charColor(S), h.char(x), h.rect(1, 1), h.translateX(1);
3302
+ const x = b < w ? "*" : ".", M = y[b % y.length], L = h.color(M.r, M.g, M.b, m);
3303
+ h.charColor(L), h.char(x), h.rect(1, 1), h.translateX(1);
3301
3304
  }
3302
3305
  h.pop();
3303
3306
  }
3304
- if (r) {
3307
+ if (s) {
3305
3308
  const v = h.color(n.subtleColor), A = h.color(v.r, v.g, v.b, m);
3306
3309
  h.charColor(A);
3307
- const w = -Math.floor(r.length / 2);
3310
+ const w = -Math.floor(s.length / 2);
3308
3311
  h.push(), h.translate(w, 5, 0);
3309
- for (const y of r) h.char(y), h.rect(1, 1), h.translateX(1);
3312
+ for (const y of s) h.char(y), h.rect(1, 1), h.translateX(1);
3310
3313
  h.pop();
3311
3314
  }
3312
3315
  };
3313
- class rt {
3316
+ class st {
3314
3317
  constructor(t, e = {}) {
3315
- a(this, "Gc");
3316
- a(this, "Oc");
3317
3318
  a(this, "jc");
3319
+ a(this, "Hc");
3318
3320
  a(this, "Qc");
3319
3321
  a(this, "Nc");
3320
3322
  a(this, "Xc");
@@ -3322,408 +3324,409 @@ class rt {
3322
3324
  a(this, "Wc");
3323
3325
  a(this, "Kc");
3324
3326
  a(this, "Zc");
3325
- a(this, "rr");
3326
3327
  a(this, "qc");
3328
+ a(this, "rr");
3327
3329
  a(this, "Vc");
3328
3330
  a(this, "Jc");
3329
3331
  a(this, "tl");
3330
- a(this, "sl", () => {
3332
+ a(this, "sl");
3333
+ a(this, "el", () => {
3331
3334
  });
3332
- a(this, "el", []);
3333
- a(this, "il", /* @__PURE__ */ new Map());
3334
- this.Gc = e.visible ?? !0, this.Oc = e.opacity ?? 1, this.jc = e.blendMode ?? "normal", this.Qc = e.offsetX ?? 0, this.Nc = e.offsetY ?? 0, this.Xc = e.rotationZ ?? 0, this.Yc = e.fontSize ?? 16, this.Wc = e.fontSource, e.fontSource instanceof W ? this.rr = e.fontSource : this.rr = new W(t, this.Yc);
3335
+ a(this, "il", []);
3336
+ a(this, "rl", /* @__PURE__ */ new Map());
3337
+ this.jc = e.visible ?? !0, this.Hc = e.opacity ?? 1, this.Qc = e.blendMode ?? "normal", this.Nc = e.offsetX ?? 0, this.Xc = e.offsetY ?? 0, this.Yc = e.rotationZ ?? 0, this.Wc = e.fontSize ?? 16, this.Kc = e.fontSource, e.fontSource instanceof W ? this.rr = e.fontSource : this.rr = new W(t, this.Wc);
3335
3338
  }
3336
- async rl(t) {
3337
- this.Kc = t, this.rr.Pr || await this.rr.Ar(this.Wc);
3339
+ async nl(t) {
3340
+ this.Zc = t, this.rr.Pr || await this.rr.Ar(this.Kc);
3338
3341
  const e = this.rr.maxGlyphDimensions;
3339
- this.Zc = new De(this.Kc.canvas.canvas, e.width, e.height);
3340
- const i = this.Zc;
3341
- this.qc = this.Kc.createFramebuffer(i.cols, i.rows, 3), this.Vc = this.Kc.createFramebuffer(i.width, i.height, 1), this.Jc = this.Kc.createFramebuffer(i.width, i.height, 1), this.tl = [this.Kc.createFramebuffer(i.width, i.height, 1, { depth: !1 }), this.Kc.createFramebuffer(i.width, i.height, 1, { depth: !1 })], this.Zc.Br(() => {
3342
- var r, s, n;
3343
- this.qc.resize(this.Zc.cols, this.Zc.rows), this.Vc.resize(this.Zc.width, this.Zc.height), (r = this.Jc) == null || r.resize(this.Zc.width, this.Zc.height), (s = this.tl) == null || s[0].resize(this.Zc.width, this.Zc.height), (n = this.tl) == null || n[1].resize(this.Zc.width, this.Zc.height);
3342
+ this.qc = new _e(this.Zc.canvas.canvas, e.width, e.height);
3343
+ const i = this.qc;
3344
+ this.Vc = this.Zc.createFramebuffer(i.cols, i.rows, 3), this.Jc = this.Zc.createFramebuffer(i.width, i.height, 1), this.tl = this.Zc.createFramebuffer(i.width, i.height, 1), this.sl = [this.Zc.createFramebuffer(i.width, i.height, 1, { depth: !1 }), this.Zc.createFramebuffer(i.width, i.height, 1, { depth: !1 })], this.qc.Br(() => {
3345
+ var s, r, n;
3346
+ this.Vc.resize(this.qc.cols, this.qc.rows), this.Jc.resize(this.qc.width, this.qc.height), (s = this.tl) == null || s.resize(this.qc.width, this.qc.height), (r = this.sl) == null || r[0].resize(this.qc.width, this.qc.height), (n = this.sl) == null || n[1].resize(this.qc.width, this.qc.height);
3344
3347
  });
3345
3348
  }
3346
3349
  draw(t) {
3347
- this.sl = t;
3350
+ this.el = t;
3348
3351
  }
3349
3352
  show() {
3350
- this.Gc = !0;
3353
+ this.jc = !0;
3351
3354
  }
3352
3355
  hide() {
3353
- this.Gc = !1;
3356
+ this.jc = !1;
3354
3357
  }
3355
3358
  opacity(t) {
3356
- if (t === void 0) return this.Oc;
3357
- this.Oc = Math.min(1, Math.max(0, t));
3359
+ if (t === void 0) return this.Hc;
3360
+ this.Hc = Math.min(1, Math.max(0, t));
3358
3361
  }
3359
3362
  blendMode(t) {
3360
- if (t === void 0) return this.jc;
3361
- this.jc = t;
3363
+ if (t === void 0) return this.Qc;
3364
+ this.Qc = t;
3362
3365
  }
3363
3366
  offset(t, e = 0) {
3364
- if (t === void 0) return { x: this.Qc, y: this.Nc };
3365
- this.Qc = t, this.Nc = e;
3367
+ if (t === void 0) return { x: this.Nc, y: this.Xc };
3368
+ this.Nc = t, this.Xc = e;
3366
3369
  }
3367
3370
  rotateZ(t) {
3368
- if (t === void 0) return this.Xc;
3369
- this.Xc = t;
3371
+ if (t === void 0) return this.Yc;
3372
+ this.Yc = t;
3370
3373
  }
3371
3374
  filter(t, e) {
3372
- this.el.push({ name: t, params: e });
3375
+ this.il.push({ name: t, params: e });
3373
3376
  }
3374
3377
  setPluginState(t, e) {
3375
- this.il.set(t, e);
3378
+ this.rl.set(t, e);
3376
3379
  }
3377
3380
  getPluginState(t) {
3378
- return this.il.get(t);
3381
+ return this.rl.get(t);
3379
3382
  }
3380
3383
  hasPluginState(t) {
3381
- return this.il.has(t);
3384
+ return this.rl.has(t);
3382
3385
  }
3383
3386
  deletePluginState(t) {
3384
- return this.il.delete(t);
3387
+ return this.rl.delete(t);
3385
3388
  }
3386
3389
  fontSize(t) {
3387
- 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 && (this.rr.Cr(t), this.nl());
3390
+ At.m(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) && this.rr.fontSize !== t && (this.rr.Cr(t), this.ol());
3388
3391
  }
3389
3392
  async loadFont(t) {
3390
3393
  if (!this.rr) throw Error("Layer font not initialized. Ensure layer is attached before loading fonts.");
3391
- return t instanceof W ? (this.rr = t, this.rr.Pr || await this.rr.Ar()) : await this.rr.Mr(t), this.nl(), this.rr;
3394
+ return t instanceof W ? (this.rr = t, this.rr.Pr || await this.rr.Ar()) : await this.rr.Mr(t), this.ol(), this.rr;
3392
3395
  }
3393
3396
  ba(t, e) {
3394
- if (!this.Gc || !this.qc || !this.Vc) return;
3395
- const i = this.Kc.renderer, r = this.Zc;
3396
- t.ol.Xa(this), this.qc.begin(), i.state.Kt(), t._a = this;
3397
+ if (!this.jc || !this.Vc || !this.Jc) return;
3398
+ const i = this.Zc.renderer, s = this.qc;
3399
+ t.hl.Xa(this), this.Vc.begin(), i.state.Kt(), t._a = this;
3397
3400
  try {
3398
- this.sl.call(t);
3401
+ this.el.call(t);
3399
3402
  } finally {
3400
3403
  t._a = void 0;
3401
3404
  }
3402
- this.qc.end(), t.ol.Wa(this);
3403
- const s = this.el.length > 0, n = s ? this.Jc : this.Vc;
3404
- n.begin(), i.fi(e), e.O({ u_characterTexture: this.rr.fontFramebuffer, u_charsetDimensions: [this.rr.textureColumns, this.rr.textureRows], Ud: this.qc.textures[0], Ue: this.qc.textures[1], Uf: this.qc.textures[2], Ug: [r.cols, r.rows], Uh: [n.width, n.height], Ui: [0, 0, 0, 0] }), i.Ai(0, 0, r.width, r.height), n.end(), s && this.Kc.filterManager.hl(this.Jc.textures[0], this.Vc, this.el, this.Vc.width, this.Vc.height, this.tl), this.el = [];
3405
+ this.Vc.end(), t.hl.Wa(this);
3406
+ const r = this.il.length > 0, n = r ? this.tl : this.Jc;
3407
+ n.begin(), i.fi(e), e.O({ u_characterTexture: this.rr.fontFramebuffer, u_charsetDimensions: [this.rr.textureColumns, this.rr.textureRows], Ud: this.Vc.textures[0], Ue: this.Vc.textures[1], Uf: this.Vc.textures[2], Ug: [s.cols, s.rows], Uh: [n.width, n.height], Ui: [0, 0, 0, 0] }), i.Ai(0, 0, s.width, s.height), n.end(), r && this.Zc.filterManager.al(this.tl.textures[0], this.Jc, this.il, this.Jc.width, this.Jc.height, this.sl), this.il = [];
3405
3408
  }
3406
3409
  Jr() {
3407
3410
  var t;
3408
- this.qc && this.Vc && ((t = this.Zc) == null || t.Js());
3411
+ this.Vc && this.Jc && ((t = this.qc) == null || t.Js());
3409
3412
  }
3410
3413
  $s() {
3411
- var t, e, i, r, s, n, o;
3412
- (t = this.qc) == null || t.dispose(), (e = this.Vc) == null || e.dispose(), (i = this.Jc) == null || i.dispose(), (r = this.tl) == null || r[0].dispose(), (s = this.tl) == null || s[1].dispose(), (n = this.rr) == null || n.$s(), (o = this.Zc) == null || o.$s();
3414
+ var t, e, i, s, r, n, o;
3415
+ (t = this.Vc) == null || t.dispose(), (e = this.Jc) == null || e.dispose(), (i = this.tl) == null || i.dispose(), (s = this.sl) == null || s[0].dispose(), (r = this.sl) == null || r[1].dispose(), (n = this.rr) == null || n.$s(), (o = this.qc) == null || o.$s();
3413
3416
  }
3414
3417
  get texture() {
3415
3418
  var t;
3416
- return (t = this.Vc) == null ? void 0 : t.textures[0];
3419
+ return (t = this.Jc) == null ? void 0 : t.textures[0];
3417
3420
  }
3418
3421
  get grid() {
3419
- return this.Zc;
3422
+ return this.qc;
3420
3423
  }
3421
3424
  get font() {
3422
3425
  return this.rr;
3423
3426
  }
3424
3427
  get width() {
3425
- return this.Vc ? this.Vc.width : 0;
3428
+ return this.Jc ? this.Jc.width : 0;
3426
3429
  }
3427
3430
  get height() {
3428
- return this.Vc ? this.Vc.height : 0;
3431
+ return this.Jc ? this.Jc.height : 0;
3429
3432
  }
3430
3433
  get drawFramebuffer() {
3431
- return this.qc;
3434
+ return this.Vc;
3432
3435
  }
3433
3436
  get asciiFramebuffer() {
3434
- return this.Vc;
3437
+ return this.Jc;
3435
3438
  }
3436
- nl() {
3437
- if (!this.Zc || !this.rr) return;
3439
+ ol() {
3440
+ if (!this.qc || !this.rr) return;
3438
3441
  const t = this.rr.maxGlyphDimensions;
3439
- this.Zc.Gr(t.width, t.height), this.qc && this.Vc && this.Jr();
3442
+ this.qc.Gr(t.width, t.height), this.Vc && this.Jc && this.Jr();
3440
3443
  }
3441
3444
  }
3442
- const I = `#version 300 es
3443
- layout(location=0)in vec2 A;layout(location=1)in vec2 B;out vec2 v_uv;void main(){v_uv=B;gl_Position=vec4(A,0.,1.);}`, jt = `#version 300 es
3444
- 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);}`, yt = `#version 300 es
3445
- precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`, We = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
3446
- class Yt {
3445
+ const B = `#version 300 es
3446
+ layout(location=0)in vec2 A;layout(location=1)in vec2 B;out vec2 v_uv;void main(){v_uv=B;gl_Position=vec4(A,0.,1.);}`, Yt = `#version 300 es
3447
+ 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);}`, wt = `#version 300 es
3448
+ precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`, Ve = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
3449
+ class Ht {
3447
3450
  constructor(t, e, i) {
3448
3451
  a(this, "Ma");
3449
3452
  a(this, "l");
3450
- a(this, "al");
3451
- a(this, "Bc");
3452
3453
  a(this, "cl");
3454
+ a(this, "Ic");
3453
3455
  a(this, "ll");
3454
3456
  a(this, "ul");
3455
3457
  a(this, "fl");
3456
- a(this, "dl", []);
3457
- a(this, "pl");
3458
- a(this, "vl", performance.now());
3459
- a(this, "ml", 0);
3460
- a(this, "_l", !1);
3458
+ a(this, "dl");
3459
+ a(this, "pl", []);
3460
+ a(this, "vl");
3461
+ a(this, "ml", performance.now());
3462
+ a(this, "_l", 0);
3463
+ a(this, "yl", !1);
3461
3464
  a(this, "yr", !1);
3462
- a(this, "bl");
3463
- this.Ma = t, this.l = { ...We, ...e ?? {} }, this.al = new kt("active"), this.Bc = new Nt(), this.cl = new Kt(this.l.transition, this.l.transitionDuration), this.ll = new Ot(60), this.pl = mt(this.l, i);
3464
- const r = Xt(this.pl);
3465
- this.dl = Gt(r, this.Ma), this.fl = this.yl(), this.Bc.fc((s) => {
3466
- s >= 0.999 && this.Tc();
3465
+ a(this, "xl");
3466
+ this.Ma = t, this.l = { ...Ve, ...e ?? {} }, this.cl = new Xt("active"), this.Ic = new kt(), this.ll = new Kt(this.l.transition, this.l.transitionDuration), this.ul = new Ot(60), this.vl = vt(this.l, i);
3467
+ const s = zt(this.vl);
3468
+ this.pl = Gt(s, this.Ma), this.dl = this.Al(), this.Ic.fc((r) => {
3469
+ r >= 0.999 && this.Tc();
3467
3470
  });
3468
3471
  }
3469
3472
  async Ar() {
3470
3473
  if (this.yr) return;
3471
3474
  const t = this.Ma.K, e = this.Ma.kr;
3472
- this.ul = new rt(t, { visible: !0, opacity: 1, fontSize: 16 }), await this.ul.rl({ renderer: t, canvas: e, filterManager: null, createFramebuffer: (i, r, s = 1, n) => t.Fi(i, r, s, n) }), this.yr = !0;
3475
+ this.fl = new st(t, { visible: !0, opacity: 1, fontSize: 16 }), await this.fl.nl({ renderer: t, canvas: e, filterManager: null, createFramebuffer: (i, s, r = 1, n) => t.Fi(i, s, r, n) }), this.yr = !0;
3473
3476
  }
3474
3477
  get Mc() {
3475
- return this.al.Mc && this._l;
3478
+ return this.cl.Mc && this.yl;
3476
3479
  }
3477
3480
  jn() {
3478
- this._l || (this._l = !0, this.vl = performance.now(), this.ml = 0, this.ll.jn(() => this.Al()));
3481
+ this.yl || (this.yl = !0, this.ml = performance.now(), this._l = 0, this.ul.jn(() => this.wl()));
3479
3482
  }
3480
3483
  Qn() {
3481
- this._l && (this._l = !1, this.ll.Qn());
3484
+ this.yl && (this.yl = !1, this.ul.Qn());
3482
3485
  }
3483
3486
  Jr() {
3484
- this.yr && this.ul.Jr();
3487
+ this.yr && this.fl.Jr();
3485
3488
  }
3486
3489
  $s() {
3487
- this.Qn(), this.yr && (this.ul.$s(), this.yr = !1);
3490
+ this.Qn(), this.yr && (this.fl.$s(), this.yr = !1);
3488
3491
  }
3489
3492
  get progress() {
3490
- return this.Bc.uc;
3493
+ return this.Ic.uc;
3491
3494
  }
3492
3495
  message(t) {
3493
3496
  return typeof t == "string" && (this.l.message = t), this.l.message;
3494
3497
  }
3495
3498
  addPhase(t, e = 1) {
3496
- this.al.Pc();
3497
- const i = this.Bc.dc(t, e);
3498
- return new zt(this.Bc, i, t, (r) => this.error(r));
3499
+ this.cl.Pc();
3500
+ const i = this.Ic.dc(t, e);
3501
+ return new jt(this.Ic, i, t, (s) => this.error(s));
3499
3502
  }
3500
3503
  Tc() {
3501
- this.al.xc !== "error" && (this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.al.Uc(), this.cl.jn()) : (this.al.Tc(), this.Qn(), this.wl()));
3504
+ this.cl.xc !== "error" && (this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.cl.Ec(), this.ll.jn()) : (this.cl.Tc(), this.Qn(), this.bl()));
3502
3505
  }
3503
- wl() {
3504
- this.bl && this.bl();
3506
+ bl() {
3507
+ this.xl && this.xl();
3505
3508
  }
3506
- xl(t) {
3507
- this.bl = t;
3509
+ Cl(t) {
3510
+ this.xl = t;
3508
3511
  }
3509
3512
  error(t) {
3510
- this.al.Rc(t);
3513
+ this.cl.Sc(t);
3511
3514
  }
3512
- Al() {
3513
- if (this.al.Mc) {
3514
- if (this.ml++, this.al.xc === "transitioning" && this.cl.et())
3515
- return this.al.Ec(), this.wl(), void this.Qn();
3516
- this.Cl();
3515
+ wl() {
3516
+ if (this.cl.Mc) {
3517
+ if (this._l++, this.cl.xc === "transitioning" && this.ll.et())
3518
+ return this.cl.Rc(), this.bl(), void this.Qn();
3519
+ this.Ml();
3517
3520
  }
3518
3521
  }
3519
- Cl() {
3522
+ Ml() {
3520
3523
  if (!this.yr) return;
3521
- const t = this.ul, e = t.grid, i = this.Ma.K, r = this.Ma.K.di(I, jt), s = this.Ma.K.di(I, yt), n = { textmodifier: this.Ma, grid: e, progress: this.progress, elapsedMs: performance.now() - this.vl, frameCount: this.ml, message: this.l.message, palette: this.dl, theme: this.pl, phases: this.Bc._c(), transitionOpacity: this.cl.Oc, isError: this.al.xc === "error", errorMessage: this.al.$c || void 0, errorDetails: this.al.Fc || void 0 };
3524
+ const t = this.fl, e = t.grid, i = this.Ma.K, s = this.Ma.K.di(B, Yt), r = this.Ma.K.di(B, wt), n = { textmodifier: this.Ma, grid: e, progress: this.progress, elapsedMs: performance.now() - this.ml, frameCount: this._l, message: this.l.message, palette: this.pl, theme: this.vl, phases: this.Ic._c(), transitionOpacity: this.ll.Hc, isError: this.cl.xc === "error", errorMessage: this.cl.$c || void 0, errorDetails: this.cl.Fc || void 0 };
3522
3525
  t.draw(() => {
3523
3526
  this.Ma.clear(), this.Ma.push();
3524
3527
  try {
3525
- this.fl(n);
3528
+ this.dl(n);
3526
3529
  } finally {
3527
3530
  this.Ma.pop();
3528
3531
  }
3529
- }), t.ba(this.Ma, r);
3532
+ }), t.ba(this.Ma, s);
3530
3533
  const o = t.texture;
3531
- o && (i.ye(...i.state.canvasBackgroundColor), i.fi(s), s.O({ u_texture: o }), i.Ai(e.offsetX, e.offsetY, e.width, e.height));
3534
+ o && (i.ye(...i.state.canvasBackgroundColor), i.fi(r), r.O({ u_texture: o }), i.Ai(e.offsetX, e.offsetY, e.width, e.height));
3532
3535
  }
3533
- Ml(t) {
3534
- this.pl = mt(this.l, t);
3536
+ $l(t) {
3537
+ this.vl = vt(this.l, t);
3535
3538
  }
3536
- yl() {
3537
- const t = this.l.renderer || Qe;
3539
+ Al() {
3540
+ const t = this.l.renderer || We;
3538
3541
  return (e) => {
3539
- t(e), this.$l(e);
3542
+ t(e), this.Fl(e);
3540
3543
  };
3541
3544
  }
3542
- $l(t) {
3543
- const { textmodifier: e, grid: i, frameCount: r, theme: s, transitionOpacity: n } = t, o = [116, 101, 120, 116, 109, 111, 100, 101, 46, 106, 115].map((f) => String.fromCharCode(f)).join(""), l = (i.rows + 1 >> 1) - 2, c = 2 - (i.cols + 1 >> 1), u = s.mode === "light" ? [[233, 30, 99], [156, 39, 176], [255, 111, 0]] : [[142, 249, 243], [241, 91, 181], [255, 155, 113]];
3545
+ Fl(t) {
3546
+ const { textmodifier: e, grid: i, frameCount: s, theme: r, transitionOpacity: n } = t, o = [116, 101, 120, 116, 109, 111, 100, 101, 46, 106, 115].map((f) => String.fromCharCode(f)).join(""), l = (i.rows + 1 >> 1) - 2, c = 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]];
3544
3547
  e.push(), e.translate(c, l, 0);
3545
3548
  for (let f = 0; f < o.length; f++) {
3546
- const d = o[f], g = Math.floor(0.1 * r + 0.5 * f) % u.length, [m, p, v] = u[g], A = Math.floor(255 * n), w = e.color(m, p, v, A);
3549
+ const d = o[f], g = Math.floor(0.1 * s + 0.5 * f) % u.length, [m, p, v] = u[g], A = Math.floor(255 * n), w = e.color(m, p, v, A);
3547
3550
  e.charColor(w), e.char(d), e.point(), e.translateX(1);
3548
3551
  }
3549
3552
  e.pop();
3550
3553
  }
3551
3554
  }
3552
- const Rt = { 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 };
3553
- class Ht {
3555
+ const Mt = { 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 };
3556
+ class Qt {
3554
3557
  constructor(t, e, i) {
3555
3558
  a(this, "K");
3556
- a(this, "Fl");
3557
- a(this, "tl");
3558
- a(this, "Pl", 0);
3559
- this.K = t, this.Fl = t.di(I, `#version 300 es
3560
- precision highp float;uniform sampler2D Uj;uniform sampler2D Uk;uniform vec2 Ul;uniform vec2 Um;uniform vec2 Un;uniform float Uo;uniform float Up;uniform int Uq;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;vec2 j=Um*0.5;vec2 k=i-j;float l=cos(-Up);float m=sin(-Up);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(Uq,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`), this.tl = [this.K.Fi(e, i, 1), this.K.Fi(e, i, 1)];
3561
- }
3562
- Tl(t) {
3563
- const e = this.K.context, { base: i, targetFramebuffer: r, backgroundColor: s, layers: n, canvasWidth: o, canvasHeight: l } = t, c = e.isEnabled(e.DEPTH_TEST), u = e.getParameter(e.DEPTH_WRITEMASK);
3559
+ a(this, "Pl");
3560
+ a(this, "sl");
3561
+ a(this, "Tl", 0);
3562
+ this.K = t, this.Pl = t.di(B, `#version 300 es
3563
+ precision highp float;uniform sampler2D Uj;uniform sampler2D Uk;uniform vec2 Ul;uniform vec2 Um;uniform vec2 Un;uniform float Uo;uniform float Up;uniform int Uq;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;vec2 j=Um*0.5;vec2 k=i-j;float l=cos(-Up);float m=sin(-Up);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(Uq,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`), this.sl = [this.K.Fi(e, i, 1), this.K.Fi(e, i, 1)];
3564
+ }
3565
+ El(t) {
3566
+ const e = this.K.context, { base: i, targetFramebuffer: s, backgroundColor: r, layers: n, canvasWidth: o, canvasHeight: l } = t, c = e.isEnabled(e.DEPTH_TEST), u = e.getParameter(e.DEPTH_WRITEMASK);
3564
3567
  c && e.disable(e.DEPTH_TEST), u && e.depthMask(!1);
3565
- const f = this.tl[0];
3566
- f.begin(), this.K.ye(...s), f.end(), this.Pl = 0, i.layer.Gc && this.El(i.texture, o, l, i.width, i.height, i.layer.Oc, i.offsetX, i.offsetY, i.layer.Xc, "normal");
3568
+ const f = this.sl[0];
3569
+ f.begin(), this.K.ye(...r), f.end(), this.Tl = 0, i.layer.jc && this.Rl(i.texture, o, l, i.width, i.height, i.layer.Hc, i.offsetX, i.offsetY, i.layer.Yc, "normal");
3567
3570
  for (const d of n) {
3568
3571
  const g = d.layer;
3569
- g.Gc && this.El(d.texture, o, l, d.width, d.height, g.Oc, d.offsetX, d.offsetY, g.Xc, g.jc);
3572
+ g.jc && this.Rl(d.texture, o, l, d.width, d.height, g.Hc, d.offsetX, d.offsetY, g.Yc, g.Qc);
3570
3573
  }
3571
- this.Rl(r, o, l), e.depthMask(u), c && e.enable(e.DEPTH_TEST);
3574
+ this.Sl(s, o, l), e.depthMask(u), c && e.enable(e.DEPTH_TEST);
3572
3575
  }
3573
- El(t, e, i, r, s, n, o, l, c, u) {
3574
- const f = this.tl[this.Pl], d = this.Pl === 0 ? 1 : 0, g = this.tl[d], m = c * (Math.PI / 180);
3575
- g.begin(), this.K.fi(this.Fl), this.Fl.O({ Uj: t, Uk: f.textures[0], Ul: [e, i], Um: [r, s], Un: [o, l], Uo: n, Up: m, Uq: Rt[u] }), this.K.Ai(0, 0, f.width, f.height), g.end(), this.Pl = d;
3576
+ Rl(t, e, i, s, r, n, o, l, c, u) {
3577
+ const f = this.sl[this.Tl], d = this.Tl === 0 ? 1 : 0, g = this.sl[d], m = c * (Math.PI / 180);
3578
+ g.begin(), this.K.fi(this.Pl), this.Pl.O({ Uj: t, Uk: f.textures[0], Ul: [e, i], Um: [s, r], Un: [o, l], Uo: n, Up: m, Uq: Mt[u] }), this.K.Ai(0, 0, f.width, f.height), g.end(), this.Tl = d;
3576
3579
  }
3577
- Rl(t, e, i) {
3578
- const r = this.tl[this.Pl];
3579
- t.begin(), this.K.fi(this.Fl), this.Fl.O({ Uj: r.textures[0], Uk: r.textures[0], Ul: [e, i], Um: [r.width, r.height], Un: [0, 0], Uo: 1, Up: 0, Uq: Rt.normal }), this.K.Ai(0, 0, e, i), t.end();
3580
+ Sl(t, e, i) {
3581
+ const s = this.sl[this.Tl];
3582
+ t.begin(), this.K.fi(this.Pl), this.Pl.O({ Uj: s.textures[0], Uk: s.textures[0], Ul: [e, i], Um: [s.width, s.height], Un: [0, 0], Uo: 1, Up: 0, Uq: Mt.normal }), this.K.Ai(0, 0, e, i), t.end();
3580
3583
  }
3581
3584
  Jr(t, e) {
3582
- this.tl[0].resize(t, e), this.tl[1].resize(t, e);
3585
+ this.sl[0].resize(t, e), this.sl[1].resize(t, e);
3583
3586
  }
3584
3587
  $s() {
3585
- this.Fl.dispose(), this.tl[0].dispose(), this.tl[1].dispose();
3588
+ this.Pl.dispose(), this.sl[0].dispose(), this.sl[1].dispose();
3586
3589
  }
3587
3590
  }
3588
3591
  class Ze {
3589
3592
  constructor(t = {}) {
3590
- a(this, "Sl", []);
3591
3593
  a(this, "kl", []);
3592
- a(this, "Ll", !1);
3594
+ a(this, "Ll", []);
3595
+ a(this, "zl", !1);
3593
3596
  a(this, "l");
3594
3597
  this.l = t;
3595
3598
  }
3596
3599
  async initialize(t) {
3597
3600
  var e, i;
3598
- for (const r of this.kl) t && await t(r), this.Sl.push(r), (i = (e = this.l).onAdd) == null || i.call(e, r);
3599
- this.kl = [], this.Ll = !0;
3601
+ for (const s of this.Ll) t && await t(s), this.kl.push(s), (i = (e = this.l).onAdd) == null || i.call(e, s);
3602
+ this.Ll = [], this.zl = !0;
3600
3603
  }
3601
3604
  get isReady() {
3602
- return this.Ll;
3605
+ return this.zl;
3603
3606
  }
3604
3607
  add(t) {
3605
3608
  var e, i;
3606
- return this.Ll ? (this.Sl.push(t), (i = (e = this.l).onAdd) == null || i.call(e, t)) : this.kl.push(t), t;
3609
+ return this.zl ? (this.kl.push(t), (i = (e = this.l).onAdd) == null || i.call(e, t)) : this.Ll.push(t), t;
3607
3610
  }
3608
3611
  addMany(t) {
3609
3612
  for (const e of t) this.add(e);
3610
3613
  return t;
3611
3614
  }
3612
3615
  remove(t) {
3613
- const e = this.Sl.indexOf(t);
3614
- if (e !== -1) return this.Sl.splice(e, 1), this.zl(t), !0;
3615
- const i = this.kl.indexOf(t);
3616
- return i !== -1 && (this.kl.splice(i, 1), this.zl(t), !0);
3616
+ const e = this.kl.indexOf(t);
3617
+ if (e !== -1) return this.kl.splice(e, 1), this.Dl(t), !0;
3618
+ const i = this.Ll.indexOf(t);
3619
+ return i !== -1 && (this.Ll.splice(i, 1), this.Dl(t), !0);
3617
3620
  }
3618
3621
  removeAt(t) {
3619
- if (t < 0 || t >= this.Sl.length) return;
3620
- const [e] = this.Sl.splice(t, 1);
3621
- return this.zl(e), e;
3622
+ if (t < 0 || t >= this.kl.length) return;
3623
+ const [e] = this.kl.splice(t, 1);
3624
+ return this.Dl(e), e;
3622
3625
  }
3623
3626
  move(t, e) {
3624
- var s, n;
3625
- const i = this.Sl.indexOf(t);
3627
+ var r, n;
3628
+ const i = this.kl.indexOf(t);
3626
3629
  if (i !== -1) {
3627
- this.Sl.splice(i, 1);
3628
- const o = Math.max(0, Math.min(this.Sl.length, e));
3629
- return this.Sl.splice(o, 0, t), (n = (s = this.l).onMove) == null || n.call(s, t, i, o), !0;
3630
- }
3631
- const r = this.kl.indexOf(t);
3632
- if (r !== -1) {
3633
- this.kl.splice(r, 1);
3630
+ this.kl.splice(i, 1);
3634
3631
  const o = Math.max(0, Math.min(this.kl.length, e));
3635
- return this.kl.splice(o, 0, t), !0;
3632
+ return this.kl.splice(o, 0, t), (n = (r = this.l).onMove) == null || n.call(r, t, i, o), !0;
3633
+ }
3634
+ const s = this.Ll.indexOf(t);
3635
+ if (s !== -1) {
3636
+ this.Ll.splice(s, 1);
3637
+ const o = Math.max(0, Math.min(this.Ll.length, e));
3638
+ return this.Ll.splice(o, 0, t), !0;
3636
3639
  }
3637
3640
  return !1;
3638
3641
  }
3639
3642
  swap(t, e) {
3640
3643
  var o, l;
3641
3644
  if (t === e) return !0;
3642
- const i = this.Sl.indexOf(t), r = this.Sl.indexOf(e);
3643
- if (i !== -1 && r !== -1) return this.Sl[i] = e, this.Sl[r] = t, (l = (o = this.l).onSwap) == null || l.call(o, t, e, i, r), !0;
3644
- const s = this.kl.indexOf(t), n = this.kl.indexOf(e);
3645
- return s !== -1 && n !== -1 && (this.kl[s] = e, this.kl[n] = t, !0);
3645
+ const i = this.kl.indexOf(t), s = this.kl.indexOf(e);
3646
+ if (i !== -1 && s !== -1) return this.kl[i] = e, this.kl[s] = t, (l = (o = this.l).onSwap) == null || l.call(o, t, e, i, s), !0;
3647
+ const r = this.Ll.indexOf(t), n = this.Ll.indexOf(e);
3648
+ return r !== -1 && n !== -1 && (this.Ll[r] = e, this.Ll[n] = t, !0);
3646
3649
  }
3647
3650
  clear() {
3648
- for (const t of this.Sl) this.zl(t);
3649
- this.Sl = [];
3650
- for (const t of this.kl) this.zl(t);
3651
+ for (const t of this.kl) this.Dl(t);
3651
3652
  this.kl = [];
3653
+ for (const t of this.Ll) this.Dl(t);
3654
+ this.Ll = [];
3652
3655
  }
3653
3656
  dispose() {
3654
- this.clear(), this.Ll = !1;
3657
+ this.clear(), this.zl = !1;
3655
3658
  }
3656
3659
  get all() {
3657
- return this.Sl;
3660
+ return this.kl;
3658
3661
  }
3659
3662
  get pending() {
3660
- return this.kl;
3663
+ return this.Ll;
3661
3664
  }
3662
3665
  get length() {
3663
- return this.Sl.length;
3666
+ return this.kl.length;
3664
3667
  }
3665
3668
  get totalLength() {
3666
- return this.Sl.length + this.kl.length;
3669
+ return this.kl.length + this.Ll.length;
3667
3670
  }
3668
3671
  get isEmpty() {
3669
- return this.Sl.length === 0;
3672
+ return this.kl.length === 0;
3670
3673
  }
3671
3674
  get(t) {
3672
- return this.Sl[t];
3675
+ return this.kl[t];
3673
3676
  }
3674
3677
  get first() {
3675
- return this.Sl[0];
3678
+ return this.kl[0];
3676
3679
  }
3677
3680
  get last() {
3678
- return this.Sl[this.Sl.length - 1];
3681
+ return this.kl[this.kl.length - 1];
3679
3682
  }
3680
3683
  indexOf(t) {
3681
- return this.Sl.indexOf(t);
3684
+ return this.kl.indexOf(t);
3682
3685
  }
3683
3686
  has(t) {
3684
- return this.Sl.includes(t) || this.kl.includes(t);
3687
+ return this.kl.includes(t) || this.Ll.includes(t);
3685
3688
  }
3686
3689
  [Symbol.iterator]() {
3687
- return this.Sl[Symbol.iterator]();
3690
+ return this.kl[Symbol.iterator]();
3688
3691
  }
3689
3692
  forEach(t) {
3690
- this.Sl.forEach(t);
3693
+ this.kl.forEach(t);
3691
3694
  }
3692
3695
  map(t) {
3693
- return this.Sl.map(t);
3696
+ return this.kl.map(t);
3694
3697
  }
3695
3698
  filter(t) {
3696
- return this.Sl.filter(t);
3699
+ return this.kl.filter(t);
3697
3700
  }
3698
3701
  find(t) {
3699
- return this.Sl.find(t);
3702
+ return this.kl.find(t);
3700
3703
  }
3701
3704
  findIndex(t) {
3702
- return this.Sl.findIndex(t);
3705
+ return this.kl.findIndex(t);
3703
3706
  }
3704
3707
  some(t) {
3705
- return this.Sl.some(t);
3708
+ return this.kl.some(t);
3706
3709
  }
3707
3710
  every(t) {
3708
- return this.Sl.every(t);
3711
+ return this.kl.every(t);
3709
3712
  }
3710
3713
  reduce(t, e) {
3711
- return this.Sl.reduce(t, e);
3714
+ return this.kl.reduce(t, e);
3712
3715
  }
3713
- zl(t) {
3714
- var e, i, r, s;
3715
- (i = (e = this.l).onRemove) == null || i.call(e, t), (s = (r = this.l).onDispose) == null || s.call(r, t);
3716
+ Dl(t) {
3717
+ var e, i, s, r;
3718
+ (i = (e = this.l).onRemove) == null || i.call(e, t), (r = (s = this.l).onDispose) == null || r.call(s, t);
3716
3719
  }
3717
3720
  }
3718
- class Qt {
3721
+ class Wt {
3719
3722
  constructor(t) {
3720
3723
  a(this, "K");
3721
- a(this, "Dl", /* @__PURE__ */ new Map());
3722
3724
  a(this, "Ol", /* @__PURE__ */ new Map());
3723
- this.K = t, this.Hl();
3725
+ a(this, "Hl", /* @__PURE__ */ new Map());
3726
+ this.K = t, this.Bl();
3724
3727
  }
3725
- async Bl(t, e, i = {}) {
3726
- const r = Object.entries(i), s = r.length > 0 ? r[0][1][0] : null;
3728
+ async Il(t, e, i = {}) {
3729
+ const s = Object.entries(i), r = s.length > 0 ? s[0][1][0] : null;
3727
3730
  let n;
3728
3731
  if (typeof e == "string") {
3729
3732
  let l = e;
@@ -3732,265 +3735,265 @@ class Qt {
3732
3735
  if (!c.ok) throw Error(`Failed to load shader from ${e}: ${c.statusText}`);
3733
3736
  l = await c.text();
3734
3737
  }
3735
- n = this.K.di(I, l), this.Ol.set(t, n);
3736
- } else n = e, this.Ol.set(t, n);
3738
+ n = this.K.di(B, l), this.Hl.set(t, n);
3739
+ } else n = e, this.Hl.set(t, n);
3737
3740
  const o = { id: t, createShader: () => n, createUniforms: (l, c) => {
3738
3741
  const u = { u_resolution: [c.width, c.height] };
3739
- for (const [f, [d, g]] of r) {
3742
+ for (const [f, [d, g]] of s) {
3740
3743
  let m = g;
3741
- l != null && (typeof l == "number" && d === s ? m = l : typeof l == "object" && d in l && (m = l[d] ?? g)), u[f] = m;
3744
+ l != null && (typeof l == "number" && d === r ? m = l : typeof l == "object" && d in l && (m = l[d] ?? g)), u[f] = m;
3742
3745
  }
3743
3746
  return u;
3744
3747
  } };
3745
- this.Dl.set(t, o);
3748
+ this.Ol.set(t, o);
3746
3749
  }
3747
- Il(t) {
3748
- const e = this.Ol.get(t);
3749
- return e && (e.dispose(), this.Ol.delete(t)), this.Dl.delete(t);
3750
+ Gl(t) {
3751
+ const e = this.Hl.get(t);
3752
+ return e && (e.dispose(), this.Hl.delete(t)), this.Ol.delete(t);
3750
3753
  }
3751
3754
  Pn(t) {
3752
- return this.Dl.get(t);
3755
+ return this.Ol.get(t);
3753
3756
  }
3754
3757
  $s() {
3755
- for (const t of this.Ol.values()) t.dispose();
3756
- this.Ol.clear(), this.Dl.clear();
3758
+ for (const t of this.Hl.values()) t.dispose();
3759
+ this.Hl.clear(), this.Ol.clear();
3757
3760
  }
3758
- Hl() {
3759
- this.Bl("invert", `#version 300 es
3760
- 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
3761
- precision highp float;uniform sampler2D u_texture;uniform float U8;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));vec3 C=mix(A.rgb,vec3(B),U8);fragColor=vec4(C,A.a);}`, { U8: ["amount", 1] }), this.Bl("sepia", `#version 300 es
3762
- precision highp float;uniform sampler2D u_texture;uniform float U8;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);vec3 B;B.r=dot(A.rgb,vec3(0.393,0.769,0.189));B.g=dot(A.rgb,vec3(0.349,0.686,0.168));B.b=dot(A.rgb,vec3(0.272,0.534,0.131));vec3 C=mix(A.rgb,B,U8);fragColor=vec4(C,A.a);}`, { U8: ["amount", 1] }), this.Bl("threshold", `#version 300 es
3763
- precision highp float;uniform sampler2D u_texture;uniform float U9;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));float C=step(U9,B);fragColor=vec4(vec3(C),A.a);}`, { U9: ["threshold", 0.5] });
3761
+ Bl() {
3762
+ this.Il("invert", `#version 300 es
3763
+ 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.Il("grayscale", `#version 300 es
3764
+ precision highp float;uniform sampler2D u_texture;uniform float U8;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));vec3 C=mix(A.rgb,vec3(B),U8);fragColor=vec4(C,A.a);}`, { U8: ["amount", 1] }), this.Il("sepia", `#version 300 es
3765
+ precision highp float;uniform sampler2D u_texture;uniform float U8;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);vec3 B;B.r=dot(A.rgb,vec3(0.393,0.769,0.189));B.g=dot(A.rgb,vec3(0.349,0.686,0.168));B.b=dot(A.rgb,vec3(0.272,0.534,0.131));vec3 C=mix(A.rgb,B,U8);fragColor=vec4(C,A.a);}`, { U8: ["amount", 1] }), this.Il("threshold", `#version 300 es
3766
+ precision highp float;uniform sampler2D u_texture;uniform float Uc;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(Uc,B);fragColor=vec4(vec3(C),A.a);}`, { Uc: ["threshold", 0.5] });
3764
3767
  }
3765
3768
  }
3766
- class Wt {
3769
+ class Vt {
3767
3770
  constructor(t) {
3768
3771
  a(this, "K");
3769
- a(this, "Ol", /* @__PURE__ */ new Map());
3772
+ a(this, "Hl", /* @__PURE__ */ new Map());
3770
3773
  a(this, "V");
3771
- a(this, "tl");
3774
+ a(this, "sl");
3772
3775
  a(this, "yr", !1);
3773
- a(this, "Gl");
3774
- this.K = t, this.Gl = new Qt(this.K), this.V = t.di(I, yt);
3776
+ a(this, "jl");
3777
+ this.K = t, this.jl = new Wt(this.K), this.V = t.di(B, wt);
3775
3778
  }
3776
3779
  async register(t, e, i = {}) {
3777
- await this.Gl.Bl(t, e, i);
3780
+ await this.jl.Il(t, e, i);
3778
3781
  }
3779
3782
  unregister(t) {
3780
- return this.Gl.Il(t) ?? !1;
3783
+ return this.jl.Gl(t) ?? !1;
3781
3784
  }
3782
3785
  has(t) {
3783
- return this.Gl.Pn(t) !== void 0;
3786
+ return this.jl.Pn(t) !== void 0;
3784
3787
  }
3785
3788
  Ar(t, e) {
3786
- this.yr || (this.tl = [this.K.Fi(t, e, 1, { depth: !1 }), this.K.Fi(t, e, 1, { depth: !1 })], this.yr = !0);
3789
+ this.yr || (this.sl = [this.K.Fi(t, e, 1, { depth: !1 }), this.K.Fi(t, e, 1, { depth: !1 })], this.yr = !0);
3787
3790
  }
3788
- jl(t, e, i, r, s) {
3789
- this.tl[0].width === r && this.tl[0].height === s || (this.tl[0].resize(r, s), this.tl[1].resize(r, s)), this.hl(t, e, i, r, s, this.tl);
3791
+ Ql(t, e, i, s, r) {
3792
+ this.sl[0].width === s && this.sl[0].height === r || (this.sl[0].resize(s, r), this.sl[1].resize(s, r)), this.al(t, e, i, s, r, this.sl);
3790
3793
  }
3791
- hl(t, e, i, r, s, n) {
3792
- if (i.length === 0) return void this.Ql(t, e, r, s);
3793
- this.Ql(t, n[0], r, s);
3794
+ al(t, e, i, s, r, n) {
3795
+ if (i.length === 0) return void this.Nl(t, e, s, r);
3796
+ this.Nl(t, n[0], s, r);
3794
3797
  let o = 0;
3795
3798
  for (let l = 0; l < i.length; l++) {
3796
3799
  const c = i[l], u = l === i.length - 1, f = o === 0 ? 1 : 0, d = u ? e : n[f];
3797
- this.Nl(c, n[o], d, r, s), u || (o = f);
3800
+ this.Xl(c, n[o], d, s, r), u || (o = f);
3798
3801
  }
3799
3802
  }
3800
- Nl(t, e, i, r, s) {
3801
- const n = this.Gl.Pn(t.name);
3802
- if (!n) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.Ql(e.textures[0], i, r, s);
3803
- const o = this.Xl(t.name, n, r, s), l = { renderer: this.K, gl: this.K.context, width: r, height: s };
3803
+ Xl(t, e, i, s, r) {
3804
+ const n = this.jl.Pn(t.name);
3805
+ if (!n) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.Nl(e.textures[0], i, s, r);
3806
+ const o = this.Yl(t.name, n, s, r), l = { renderer: this.K, gl: this.K.context, width: s, height: r };
3804
3807
  i.begin(), this.K.fi(o), o.O({ u_texture: e.textures[0] });
3805
3808
  const c = n.createUniforms(t.params, l);
3806
- o.O(c), this.K.Ai(0, 0, r, s), i.end();
3809
+ o.O(c), this.K.Ai(0, 0, s, r), i.end();
3807
3810
  }
3808
- Xl(t, e, i, r) {
3809
- let s = this.Ol.get(t);
3810
- if (!s && e) {
3811
- const n = { renderer: this.K, gl: this.K.context, width: i, height: r };
3812
- s = e.createShader(n), this.Ol.set(t, s);
3811
+ Yl(t, e, i, s) {
3812
+ let r = this.Hl.get(t);
3813
+ if (!r && e) {
3814
+ const n = { renderer: this.K, gl: this.K.context, width: i, height: s };
3815
+ r = e.createShader(n), this.Hl.set(t, r);
3813
3816
  }
3814
- return s;
3817
+ return r;
3815
3818
  }
3816
- Ql(t, e, i, r) {
3817
- e.begin(), this.K.fi(this.V), this.V.O({ u_texture: t, u_resolution: [i, r] }), this.K.Ai(0, 0, i, r), e.end();
3819
+ Nl(t, e, i, s) {
3820
+ e.begin(), this.K.fi(this.V), this.V.O({ u_texture: t, u_resolution: [i, s] }), this.K.Ai(0, 0, i, s), e.end();
3818
3821
  }
3819
3822
  Jr(t, e) {
3820
- this.tl && (this.tl[0].resize(t, e), this.tl[1].resize(t, e));
3823
+ this.sl && (this.sl[0].resize(t, e), this.sl[1].resize(t, e));
3821
3824
  }
3822
3825
  $s() {
3823
- for (const t of this.Ol.values()) t.dispose();
3824
- this.Ol.clear(), this.V.dispose(), this.Gl.$s(), this.tl && (this.tl[0].dispose(), this.tl[1].dispose()), this.yr = !1;
3826
+ for (const t of this.Hl.values()) t.dispose();
3827
+ this.Hl.clear(), this.V.dispose(), this.jl.$s(), this.sl && (this.sl[0].dispose(), this.sl[1].dispose()), this.yr = !1;
3825
3828
  }
3826
3829
  }
3827
- const ti = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: Qt, TextmodeFilterManager: Wt }, Symbol.toStringTag, { value: "Module" }));
3830
+ const ei = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: Wt, TextmodeFilterManager: Vt }, Symbol.toStringTag, { value: "Module" }));
3828
3831
  class Zt {
3829
3832
  constructor(t, e) {
3830
3833
  a(this, "Ma");
3831
3834
  a(this, "K");
3832
- a(this, "Yl");
3833
3835
  a(this, "Wl");
3834
3836
  a(this, "Kl");
3835
3837
  a(this, "Zl");
3836
3838
  a(this, "ql");
3837
3839
  a(this, "Vl");
3838
- a(this, "Ll", !1);
3839
- a(this, "Jl", /* @__PURE__ */ new Set());
3840
- a(this, "tu", []);
3841
- a(this, "su");
3840
+ a(this, "Jl");
3841
+ a(this, "zl", !1);
3842
+ a(this, "tu", /* @__PURE__ */ new Set());
3843
+ a(this, "su", []);
3842
3844
  a(this, "eu");
3843
- this.Ma = t, this.K = t.K, this.Kl = this.K.di(I, jt), this.Zl = this.K.di(I, yt), this.Wl = new Wt(this.K), this.Yl = new Ht(this.K, this.Ma.kr.width, this.Ma.kr.height), this.ql = new Ze({ onRemove: (i) => this.Ma.ol.Qa(i), onDispose: (i) => i == null ? void 0 : i.$s() }), this.Vl = new rt(this.K, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
3845
+ a(this, "iu");
3846
+ this.Ma = t, this.K = t.K, this.Zl = this.K.di(B, Yt), this.ql = this.K.di(B, wt), this.Kl = new Vt(this.K), this.Wl = new Qt(this.K, this.Ma.kr.width, this.Ma.kr.height), this.Vl = new Ze({ onRemove: (i) => this.Ma.hl.Qa(i), onDispose: (i) => i == null ? void 0 : i.$s() }), this.Jl = new st(this.K, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
3844
3847
  }
3845
3848
  async Ar() {
3846
- await this.iu(this.Vl);
3849
+ await this.ru(this.Jl);
3847
3850
  const t = this.Ma.kr;
3848
- this.su = this.K.Fi(t.width, t.height, 1), this.eu = this.K.Fi(t.width, t.height, 1), this.Wl.Ar(t.width, t.height), await this.ql.initialize((e) => this.iu(e)), this.Ll = !0;
3851
+ this.eu = this.K.Fi(t.width, t.height, 1), this.iu = this.K.Fi(t.width, t.height, 1), this.Kl.Ar(t.width, t.height), await this.Vl.initialize((e) => this.ru(e)), this.zl = !0;
3849
3852
  }
3850
- ru(t, e) {
3851
- this.tu.push({ name: t, params: e });
3853
+ nu(t, e) {
3854
+ this.su.push({ name: t, params: e });
3852
3855
  }
3853
- nu() {
3854
- this.tu = [];
3856
+ ou() {
3857
+ this.su = [];
3855
3858
  }
3856
3859
  add(t = {}) {
3857
- const e = new rt(this.K, t);
3858
- return this.ql.isReady && this.iu(e), this.ql.add(e), e;
3860
+ const e = new st(this.K, t);
3861
+ return this.Vl.isReady && this.ru(e), this.Vl.add(e), e;
3859
3862
  }
3860
3863
  remove(t) {
3861
- this.ql.remove(t);
3864
+ this.Vl.remove(t);
3862
3865
  }
3863
3866
  move(t, e) {
3864
- this.ql.move(t, e);
3867
+ this.Vl.move(t, e);
3865
3868
  }
3866
3869
  swap(t, e) {
3867
- this.ql.swap(t, e);
3870
+ this.Vl.swap(t, e);
3868
3871
  }
3869
3872
  clear() {
3870
- this.ql.clear();
3873
+ this.Vl.clear();
3871
3874
  }
3872
- ou(t) {
3873
- this.Ma.ol.Ia(), this.Vl.ba(this.Ma, this.Kl);
3875
+ hu(t) {
3876
+ this.Ma.hl.Ia(), this.Jl.ba(this.Ma, this.Zl);
3874
3877
  const e = [...this.K.state.canvasBackgroundColor];
3875
- this.ql.forEach((i) => i.ba(this.Ma, this.Kl)), this.hu(t, e);
3878
+ this.Vl.forEach((i) => i.ba(this.Ma, this.Zl)), this.au(t, e);
3876
3879
  }
3877
- au() {
3878
- this.ou(this.su);
3879
- let t = this.su.textures[0];
3880
- if (this.tu.length > 0) {
3880
+ cu() {
3881
+ this.hu(this.eu);
3882
+ let t = this.eu.textures[0];
3883
+ if (this.su.length > 0) {
3881
3884
  const i = this.Ma.kr;
3882
- this.Wl.jl(this.su.textures[0], this.eu, this.tu, i.width, i.height), t = this.eu.textures[0], this.tu = [];
3885
+ this.Kl.Ql(this.eu.textures[0], this.iu, this.su, i.width, i.height), t = this.iu.textures[0], this.su = [];
3883
3886
  }
3884
3887
  const e = this.Ma.kr;
3885
- this.K.ye(0, 0, 0, 0), this.K.fi(this.Zl), this.Zl.O({ u_texture: t }), this.K.Ai(0, 0, e.width, e.height), this.Ma.ol.ja();
3888
+ this.K.ye(0, 0, 0, 0), this.K.fi(this.ql), this.ql.O({ u_texture: t }), this.K.Ai(0, 0, e.width, e.height), this.Ma.hl.ja();
3886
3889
  }
3887
- hu(t, e) {
3888
- const i = this.Ma.kr, r = this.Vl.grid, s = this.Vl.texture;
3889
- if (!s) return;
3890
- const n = { layer: this.Vl, texture: s, width: r.width, height: r.height, offsetX: r.offsetX + this.Vl.Qc, offsetY: r.offsetY + this.Vl.Nc }, o = this.ql.filter((l) => !!l.grid && !!l.texture).map((l) => {
3890
+ au(t, e) {
3891
+ const i = this.Ma.kr, s = this.Jl.grid, r = this.Jl.texture;
3892
+ if (!r) return;
3893
+ const n = { layer: this.Jl, texture: r, width: s.width, height: s.height, offsetX: s.offsetX + this.Jl.Nc, offsetY: s.offsetY + this.Jl.Xc }, o = this.Vl.filter((l) => !!l.grid && !!l.texture).map((l) => {
3891
3894
  const c = l.grid;
3892
- return { layer: l, texture: l.texture, width: c.width, height: c.height, offsetX: c.offsetX + l.Qc, offsetY: c.offsetY + l.Nc };
3895
+ return { layer: l, texture: l.texture, width: c.width, height: c.height, offsetX: c.offsetX + l.Nc, offsetY: c.offsetY + l.Xc };
3893
3896
  });
3894
- this.Yl.Tl({ base: n, layers: o, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
3897
+ this.Wl.El({ base: n, layers: o, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
3895
3898
  }
3896
3899
  Jr() {
3897
- var e, i, r;
3898
- if (!this.Ll) return;
3900
+ var e, i, s;
3901
+ if (!this.zl) return;
3899
3902
  const t = this.Ma.kr;
3900
- this.Vl.Jr(), this.ql.forEach((s) => s.Jr()), this.Yl.Jr(t.width, t.height), (e = this.su) == null || e.resize(t.width, t.height), (i = this.eu) == null || i.resize(t.width, t.height), (r = this.Wl) == null || r.Jr(t.width, t.height);
3903
+ this.Jl.Jr(), this.Vl.forEach((r) => r.Jr()), this.Wl.Jr(t.width, t.height), (e = this.eu) == null || e.resize(t.width, t.height), (i = this.iu) == null || i.resize(t.width, t.height), (s = this.Kl) == null || s.Jr(t.width, t.height);
3901
3904
  }
3902
3905
  $s() {
3903
3906
  var t, e;
3904
- this.ql.dispose(), this.Ma.ol.Qa(this.Vl), this.Vl.$s(), this.Wl.$s(), this.Kl.dispose(), this.Zl.dispose(), this.Yl.$s(), (t = this.su) == null || t.dispose(), (e = this.eu) == null || e.dispose(), this.tu = [];
3907
+ this.Vl.dispose(), this.Ma.hl.Qa(this.Jl), this.Jl.$s(), this.Kl.$s(), this.Zl.dispose(), this.ql.dispose(), this.Wl.$s(), (t = this.eu) == null || t.dispose(), (e = this.iu) == null || e.dispose(), this.su = [];
3905
3908
  }
3906
3909
  get all() {
3907
- return this.ql.all;
3910
+ return this.Vl.all;
3908
3911
  }
3909
3912
  get base() {
3910
- return this.Vl;
3913
+ return this.Jl;
3911
3914
  }
3912
3915
  get filters() {
3913
- return this.Wl;
3916
+ return this.Kl;
3914
3917
  }
3915
3918
  get resultFramebuffer() {
3916
- return this.eu;
3919
+ return this.iu;
3917
3920
  }
3918
- cu() {
3919
- const t = this.ql.all;
3921
+ lu() {
3922
+ const t = this.Vl.all;
3920
3923
  for (let e = t.length - 1; e >= 0; e--) {
3921
3924
  const i = t[e];
3922
- if (i.Gc && i.grid) return i.grid;
3925
+ if (i.jc && i.grid) return i.grid;
3923
3926
  }
3924
- return this.Vl.grid;
3927
+ return this.Jl.grid;
3925
3928
  }
3926
- lu(t) {
3927
- this.Jl.add(t);
3929
+ uu(t) {
3930
+ this.tu.add(t);
3928
3931
  }
3929
- uu() {
3930
- for (const t of this.Jl) t();
3932
+ fu() {
3933
+ for (const t of this.tu) t();
3931
3934
  }
3932
- async iu(t) {
3935
+ async ru(t) {
3933
3936
  var i;
3934
- const e = { renderer: this.K, canvas: this.Ma.kr, filterManager: this.Wl, createFramebuffer: (r, s, n = 1, o) => this.K.Fi(r, s, n, o) };
3935
- await t.rl(e), (i = t.grid) == null || i.Br(() => this.uu());
3937
+ const e = { renderer: this.K, canvas: this.Ma.kr, filterManager: this.Kl, createFramebuffer: (s, r, n = 1, o) => this.K.Fi(s, r, n, o) };
3938
+ await t.nl(e), (i = t.grid) == null || i.Br(() => this.fu());
3936
3939
  }
3937
3940
  }
3938
- let ft = null;
3939
- const Ve = { id: "brightness", createShader: ({ gl: h }) => (ft || (ft = new Z(h, nt, `#version 300 es
3940
- precision highp float;in vec2 v_uv;uniform sampler2D u_image;uniform bool u_invert;uniform bool u_flipX;uniform bool u_flipY;uniform float u_charRotation;uniform bool u_charColorFixed;uniform vec4 u_charColor;uniform bool u_cellColorFixed;uniform vec4 u_cellColor;uniform vec4 u_backgroundColor;uniform int u_charCount;uniform vec3 u_charList[255];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;float B(vec3 C){return dot(C,vec3(0.299f,0.587f,0.114f));}void main(){vec2 D=vec2(v_uv.x,1.0f-v_uv.y);vec4 E=texture(u_image,D);float F=B(E.rgb);vec2 G=vec2(0.);if(u_charCount>0){float H=float(u_charCount);float I=clamp(F*(H-1.0f),0.0f,H-1.0f);int J=int(floor(I+0.5f));vec3 K=u_charList[J];G=K.xy;}else{G=vec2(0.0f,0.0f);}vec4 L=u_charColorFixed?u_charColor:E;vec4 M=u_cellColorFixed?u_cellColor:E;if(E.a<0.01f){discard;}o_primaryColor=vec4(L.rgb,L.a);o_secondaryColor=vec4(M.rgb,M.a);A=vec4(0.);int N=int(u_invert?1:0);int O=int(u_flipX?1:0);int P=int(u_flipY?1:0);float Q=float(N|(O<<1)|(P<<2))/255.;o_character=vec4(G,Q,clamp(u_charRotation,0.0f,1.0f));}`)), ft), createUniforms: ({ source: h }) => h.createBaseConversionUniforms() };
3941
- class Vt {
3941
+ let dt = null;
3942
+ const qe = { id: "brightness", createShader: ({ gl: h }) => (dt || (dt = new V(h, nt, `#version 300 es
3943
+ precision highp float;in vec2 v_uv;uniform sampler2D u_image;uniform bool u_invert;uniform bool u_flipX;uniform bool u_flipY;uniform float u_charRotation;uniform bool u_charColorFixed;uniform vec4 u_charColor;uniform bool u_cellColorFixed;uniform vec4 u_cellColor;uniform vec4 u_backgroundColor;uniform int u_charCount;uniform vec3 u_charList[255];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;float B(vec3 C){return dot(C,vec3(0.299f,0.587f,0.114f));}void main(){vec2 D=vec2(v_uv.x,1.0f-v_uv.y);vec4 E=texture(u_image,D);float F=B(E.rgb);vec2 G=vec2(0.);if(u_charCount>0){float H=float(u_charCount);float I=clamp(F*(H-1.0f),0.0f,H-1.0f);int J=int(floor(I+0.5f));vec3 K=u_charList[J];G=K.xy;}else{G=vec2(0.0f,0.0f);}vec4 L=u_charColorFixed?u_charColor:E;vec4 M=u_cellColorFixed?u_cellColor:E;if(E.a<0.01f){discard;}o_primaryColor=vec4(L.rgb,L.a);o_secondaryColor=vec4(M.rgb,M.a);A=vec4(0.);int N=int(u_invert?1:0);int O=int(u_flipX?1:0);int P=int(u_flipY?1:0);float Q=float(N|(O<<1)|(P<<2))/255.;o_character=vec4(G,Q,clamp(u_charRotation,0.0f,1.0f));}`)), dt), createUniforms: ({ source: h }) => h.createBaseConversionUniforms() };
3944
+ class qt {
3942
3945
  constructor() {
3943
- a(this, "fu", /* @__PURE__ */ new Map());
3944
- a(this, "Ol", /* @__PURE__ */ new Map());
3945
- this.du();
3946
- }
3947
- Bl(t) {
3948
- this.fu.set(t.id, t);
3946
+ a(this, "du", /* @__PURE__ */ new Map());
3947
+ a(this, "Hl", /* @__PURE__ */ new Map());
3948
+ this.pu();
3949
3949
  }
3950
3950
  Il(t) {
3951
- const e = this.Ol.get(t);
3952
- return e && (e.dispose(), this.Ol.delete(t)), this.fu.delete(t);
3951
+ this.du.set(t.id, t);
3952
+ }
3953
+ Gl(t) {
3954
+ const e = this.Hl.get(t);
3955
+ return e && (e.dispose(), this.Hl.delete(t)), this.du.delete(t);
3953
3956
  }
3954
3957
  Pn(t) {
3955
- return this.fu.get(t);
3958
+ return this.du.get(t);
3956
3959
  }
3957
- pu(t) {
3958
- return this.fu.has(t);
3960
+ vu(t) {
3961
+ return this.du.has(t);
3959
3962
  }
3960
3963
  $s() {
3961
- for (const t of this.Ol.values()) t.dispose();
3962
- this.Ol.clear(), this.fu.clear();
3964
+ for (const t of this.Hl.values()) t.dispose();
3965
+ this.Hl.clear(), this.du.clear();
3963
3966
  }
3964
- du() {
3965
- this.Bl(Ve);
3967
+ pu() {
3968
+ this.Il(qe);
3966
3969
  }
3967
3970
  }
3968
- class qt {
3971
+ class Jt {
3969
3972
  constructor() {
3970
- a(this, "vu");
3971
- this.vu = new Vt();
3973
+ a(this, "gu");
3974
+ this.gu = new qt();
3972
3975
  }
3973
3976
  register(t) {
3974
- this.vu.Bl(t);
3977
+ this.gu.Il(t);
3975
3978
  }
3976
3979
  unregister(t) {
3977
- return this.vu.Il(t);
3980
+ return this.gu.Gl(t);
3978
3981
  }
3979
3982
  has(t) {
3980
- return this.vu.pu(t);
3983
+ return this.gu.vu(t);
3981
3984
  }
3982
3985
  Pn(t) {
3983
- return this.vu.Pn(t);
3986
+ return this.gu.Pn(t);
3984
3987
  }
3985
3988
  $s() {
3986
- this.vu.$s();
3989
+ this.gu.$s();
3987
3990
  }
3988
3991
  }
3989
- const ei = Object.freeze(Object.defineProperty({ __proto__: null, ConversionRegistry: Vt, TextmodeConversionManager: qt }, Symbol.toStringTag, { value: "Module" }));
3990
- class qe extends function(e, ...i) {
3991
- return i.reduce((r, s) => s(r), e);
3992
+ const ii = Object.freeze(Object.defineProperty({ __proto__: null, ConversionRegistry: qt, TextmodeConversionManager: Jt }, Symbol.toStringTag, { value: "Module" }));
3993
+ class Je extends function(e, ...i) {
3994
+ return i.reduce((s, r) => r(s), e);
3992
3995
  }(class {
3993
- }, Ge, ze, je, Ye, He) {
3996
+ }, Ge, je, Ye, He, Qe) {
3994
3997
  constructor(e = {}) {
3995
3998
  super();
3996
3999
  a(this, "K");
@@ -3999,74 +4002,74 @@ class qe extends function(e, ...i) {
3999
4002
  a(this, "rh");
4000
4003
  a(this, "xa");
4001
4004
  a(this, "Ca");
4002
- a(this, "gu");
4005
+ a(this, "mu");
4003
4006
  a(this, "ya");
4004
4007
  a(this, "_a");
4005
4008
  a(this, "gn");
4006
- a(this, "ol");
4007
- a(this, "mu", !1);
4009
+ a(this, "hl");
4008
4010
  a(this, "_u", !1);
4009
4011
  a(this, "yu", !1);
4010
4012
  a(this, "Au", !1);
4011
- a(this, "wu", () => {
4012
- });
4013
+ a(this, "wu", !1);
4013
4014
  a(this, "bu", () => {
4014
4015
  });
4015
- a(this, "xu");
4016
+ a(this, "xu", () => {
4017
+ });
4016
4018
  a(this, "Cu");
4017
- a(this, "Qr", !1);
4018
4019
  a(this, "Mu");
4020
+ a(this, "Qr", !1);
4019
4021
  a(this, "$u");
4020
- this.ol = new It(this), this.Qr = e.overlay ?? !1, this.kr = new Ne(e), this.K = new xe(this.kr.tn()), this.wa = new Ot(e.frameRate ?? 60), this.gu = new Yt(this, e.loadingScreen, this.kr.Vr()), this.gu.xl(() => {
4021
- this.wa.Vn = 0, this.Au = !0;
4022
+ a(this, "Fu");
4023
+ this.hl = new Nt(this), this.Qr = e.overlay ?? !1, this.kr = new ke(e), this.K = new Ee(this.kr.tn()), this.wa = new Ot(e.frameRate ?? 60), this.mu = new Ht(this, e.loadingScreen, this.kr.Vr()), this.mu.Cl(() => {
4024
+ this.wa.Vn = 0, this.wu = !0;
4022
4025
  }), this.ya = new Zt(this, e);
4023
- const i = () => this.Fu();
4024
- this.rh = new Bt(this.kr, i), this.xa = new _t(this.kr, i, this.rh), this.Ca = new Dt(), this.gn = new qt(), this.ol.za(e.plugins ?? []), this.gu.jn(), this.Pu();
4026
+ const i = () => this.Pu();
4027
+ this.rh = new Dt(this.kr, i), this.xa = new Bt(this.kr, i, this.rh), this.Ca = new _t(), this.gn = new Jt(), this.hl.za(e.plugins ?? []), this.mu.jn(), this.Tu();
4025
4028
  }
4026
- async Pu() {
4027
- await this.ya.Ar(), await this.gu.Ar();
4029
+ async Tu() {
4030
+ await this.ya.Ar(), await this.mu.Ar();
4028
4031
  const e = this.ya.base.grid;
4029
- this.ya.lu(() => {
4032
+ this.ya.uu(() => {
4030
4033
  this.rh.ko(), this.xa.ko();
4031
- }), this.Qr && (this.Mu = q.Tn(this.K, this.gn, this.kr.targetCanvas, e.cols, e.rows)), this.Tu(), this.wa.jn(() => this.ba());
4034
+ }), this.Qr && (this.$u = q.Tn(this.K, this.gn, this.kr.targetCanvas, e.cols, e.rows)), this.Eu(), this.wa.jn(() => this.ba());
4032
4035
  try {
4033
- await this.ol.Ka(), await this.wu(), await this.ol.qa(), this.gu.Tc();
4036
+ await this.hl.Ka(), await this.bu(), await this.hl.qa(), this.mu.Tc();
4034
4037
  } catch (i) {
4035
- console.error("Error during setup:", i), this.gu.error(i);
4038
+ console.error("Error during setup:", i), this.mu.error(i);
4036
4039
  }
4037
4040
  }
4038
- Tu() {
4039
- this.xu = () => {
4040
- this.Qr && this.resizeCanvas(this.kr.targetCanvas.width, this.kr.targetCanvas.height), this.bu();
4041
- }, window.addEventListener("resize", this.xu), this.rh.Mo(), this.xa.Mo(), this.Ca.Mo(), window.addEventListener("blur", () => {
4041
+ Eu() {
4042
+ this.Cu = () => {
4043
+ this.Qr && this.resizeCanvas(this.kr.targetCanvas.width, this.kr.targetCanvas.height), this.xu();
4044
+ }, window.addEventListener("resize", this.Cu), this.rh.Mo(), this.xa.Mo(), this.Ca.Mo(), window.addEventListener("blur", () => {
4042
4045
  this.Ca.ih();
4043
- }), this.Qr && (this.Cu = new ResizeObserver(() => {
4046
+ }), this.Qr && (this.Mu = new ResizeObserver(() => {
4044
4047
  this.resizeCanvas(this.kr.targetCanvas.width, this.kr.targetCanvas.height);
4045
- }), this.Cu.observe(this.kr.targetCanvas));
4048
+ }), this.Mu.observe(this.kr.targetCanvas));
4046
4049
  }
4047
4050
  ba() {
4048
- if (!this.gu.Mc && this.Au) {
4049
- this._u = !0;
4051
+ if (!this.mu.Mc && this.wu) {
4052
+ this.yu = !0;
4050
4053
  try {
4051
- this.wa.Wn(), this.wa.Jn(), this.Qr && Ft(this.K.context, this.Mu.texture, this.kr.targetCanvas), this.ya.au();
4054
+ this.wa.Wn(), this.wa.Jn(), this.Qr && Ft(this.K.context, this.$u.texture, this.kr.targetCanvas), this.ya.cu();
4052
4055
  } finally {
4053
- this._u = !1, this.mu && !this.yu && this.Eu();
4056
+ this.yu = !1, this._u && !this.Au && this.Ru();
4054
4057
  }
4055
4058
  }
4056
4059
  }
4057
4060
  resizeCanvas(e, i) {
4058
- var r;
4059
- this.kr.Jr(e, i), this.gu.Ml(this.kr.Vr()), this.gu.Jr(), (r = this.ya) == null || r.Jr(), this.K.Ei(), this.ba();
4061
+ var s;
4062
+ this.kr.Jr(e, i), this.mu.$l(this.kr.Vr()), this.mu.Jr(), (s = this.ya) == null || s.Jr(), this.K.Ei(), this.ba();
4060
4063
  }
4061
4064
  destroy() {
4062
- this.yu || this.mu || (this.mu = !0, this.wa.Nn(), this._u || this.Eu());
4065
+ this.Au || this._u || (this._u = !0, this.wa.Nn(), this.yu || this.Ru());
4063
4066
  }
4064
- Eu() {
4065
- var e, i, r, s;
4066
- this.mu = !1, this.gu.$s(), this.ol.Va(), window.removeEventListener("resize", this.xu), (e = this.Cu) == null || e.disconnect(), this.rh.So(), this.xa.So(), this.Ca.So(), (i = this.ya) == null || i.$s(), (r = this.gn) == null || r.$s(), this.K.$s(), (s = this.Mu) == null || s.$s(), this.kr.$s(), this.yu = !0;
4067
+ Ru() {
4068
+ var e, i, s, r;
4069
+ this._u = !1, this.mu.$s(), this.hl.Va(), window.removeEventListener("resize", this.Cu), (e = this.Mu) == null || e.disconnect(), this.rh.So(), this.xa.So(), this.Ca.So(), (i = this.ya) == null || i.$s(), (s = this.gn) == null || s.$s(), this.K.$s(), (r = this.$u) == null || r.$s(), this.kr.$s(), this.Au = !0;
4067
4070
  }
4068
4071
  filter(e, i) {
4069
- this.ya.ru(e, i);
4072
+ this.ya.nu(e, i);
4070
4073
  }
4071
4074
  draw(e) {
4072
4075
  this.ya.base.draw(e);
@@ -4082,16 +4085,16 @@ class qe extends function(e, ...i) {
4082
4085
  this.ya.base.fontSize(e);
4083
4086
  }
4084
4087
  inputGrid(e) {
4085
- return e === void 0 ? this.$u ?? "topmost" : e === "topmost" ? (this.$u = void 0, this.rh.ko(), void this.xa.ko()) : (this.$u = e, this.rh.ko(), void this.xa.ko());
4088
+ return e === void 0 ? this.Fu ?? "topmost" : e === "topmost" ? (this.Fu = void 0, this.rh.ko(), void this.xa.ko()) : (this.Fu = e, this.rh.ko(), void this.xa.ko());
4086
4089
  }
4087
- Fu() {
4088
- return this.$u ? this.$u : this.ya.cu();
4090
+ Pu() {
4091
+ return this.Fu ? this.Fu : this.ya.lu();
4089
4092
  }
4090
4093
  async setup(e) {
4091
- this.wu = e;
4094
+ this.bu = e;
4092
4095
  }
4093
4096
  windowResized(e) {
4094
- this.bu = e;
4097
+ this.xu = e;
4095
4098
  }
4096
4099
  get grid() {
4097
4100
  var e;
@@ -4111,13 +4114,13 @@ class qe extends function(e, ...i) {
4111
4114
  return this.kr.canvas;
4112
4115
  }
4113
4116
  get isDisposed() {
4114
- return this.yu;
4117
+ return this.Au;
4115
4118
  }
4116
4119
  get overlay() {
4117
- return this.Mu;
4120
+ return this.$u;
4118
4121
  }
4119
4122
  get loading() {
4120
- return this.gu;
4123
+ return this.mu;
4121
4124
  }
4122
4125
  get layers() {
4123
4126
  return this.ya;
@@ -4129,40 +4132,40 @@ class qe extends function(e, ...i) {
4129
4132
  return this.gn;
4130
4133
  }
4131
4134
  get isRenderingFrame() {
4132
- return this._u;
4135
+ return this.yu;
4133
4136
  }
4134
4137
  }
4135
- class wt {
4138
+ class xt {
4136
4139
  constructor() {
4137
4140
  }
4138
4141
  static create(t = {}) {
4139
- return new qe(t);
4142
+ return new Je(t);
4140
4143
  }
4141
4144
  static setErrorLevel(t) {
4142
- vt._(t);
4145
+ At._(t);
4143
4146
  }
4144
4147
  static get version() {
4145
- return "0.8.6-beta.3";
4148
+ return "0.8.6-beta.4";
4146
4149
  }
4147
4150
  }
4148
- const ii = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: zt, LoadingPhaseTracker: Nt, LoadingScreenManager: Yt, LoadingScreenStateMachine: kt, LoadingScreenTransition: Kt, resolveColorInputs: Gt, resolveDefaultPalette: Xt, resolveTheme: mt }, Symbol.toStringTag, { value: "Module" })), ri = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: W, TextmodeImage: q, TextmodeTexture: G, TextmodeVideo: ot }, Symbol.toStringTag, { value: "Module" })), si = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: Ke, mouse: ke, touch: Xe }, Symbol.toStringTag, { value: "Module" })), ni = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: Ht, TextmodeLayer: rt, TextmodeLayerManager: Zt }, Symbol.toStringTag, { value: "Module" })), hi = wt.create, oi = wt.setErrorLevel, ai = wt.version;
4151
+ const si = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: jt, LoadingPhaseTracker: kt, LoadingScreenManager: Ht, LoadingScreenStateMachine: Xt, LoadingScreenTransition: Kt, resolveColorInputs: Gt, resolveDefaultPalette: zt, resolveTheme: vt }, Symbol.toStringTag, { value: "Module" })), ri = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: W, TextmodeImage: q, TextmodeTexture: z, TextmodeVideo: ot }, Symbol.toStringTag, { value: "Module" })), ni = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: Ke, mouse: Xe, touch: ze }, Symbol.toStringTag, { value: "Module" })), hi = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: Qt, TextmodeLayer: st, TextmodeLayerManager: Zt }, Symbol.toStringTag, { value: "Module" })), oi = xt.create, ai = xt.setErrorLevel, li = xt.version;
4149
4152
  export {
4150
- Ne as TextmodeCanvas,
4151
- L as TextmodeColor,
4152
- ie as TextmodeErrorLevel,
4153
- X as TextmodeFramebuffer,
4154
- De as TextmodeGrid,
4155
- Z as TextmodeShader,
4156
- qe as Textmodifier,
4157
- ei as conversion,
4158
- hi as create,
4159
- ti as filters,
4160
- si as input,
4161
- ni as layering,
4153
+ ke as TextmodeCanvas,
4154
+ S as TextmodeColor,
4155
+ se as TextmodeErrorLevel,
4156
+ K as TextmodeFramebuffer,
4157
+ _e as TextmodeGrid,
4158
+ V as TextmodeShader,
4159
+ Je as Textmodifier,
4160
+ ii as conversion,
4161
+ oi as create,
4162
+ ei as filters,
4163
+ ni as input,
4164
+ hi as layering,
4162
4165
  ri as loadables,
4163
- ii as loading,
4164
- $e as plugins,
4165
- oi as setErrorLevel,
4166
- wt as textmode,
4167
- ai as version
4166
+ si as loading,
4167
+ ti as plugins,
4168
+ ai as setErrorLevel,
4169
+ xt as textmode,
4170
+ li as version
4168
4171
  };