textmode.js 0.9.2 → 0.9.3-beta.1

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.
@@ -28,12 +28,12 @@ ${"↓".repeat(24)}
28
28
  }
29
29
  }
30
30
  var ae = ((n) => (n[n.SILENT = 0] = "SILENT", n[n.WARNING = 1] = "WARNING", n[n.ERROR = 2] = "ERROR", n[n.THROW = 3] = "THROW", n))(ae || {});
31
- const D = class D {
31
+ const B = class B {
32
32
  constructor() {
33
33
  o(this, "l", { globalLevel: 3 });
34
34
  }
35
35
  static u() {
36
- return D.o || (D.o = new D()), D.o;
36
+ return B.o || (B.o = new B()), B.o;
37
37
  }
38
38
  v(t, e) {
39
39
  const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.", s = "color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;";
@@ -55,8 +55,8 @@ const D = class D {
55
55
  this.l.globalLevel = t;
56
56
  }
57
57
  };
58
- o(D, "o", null);
59
- let pt = D;
58
+ o(B, "o", null);
59
+ let pt = B;
60
60
  const yt = pt.u();
61
61
  class at {
62
62
  constructor() {
@@ -76,16 +76,16 @@ function N(n) {
76
76
  function et(n) {
77
77
  return n * (180 / Math.PI);
78
78
  }
79
- function Rt(n, t, e, i) {
79
+ function Tt(n, t, e, i) {
80
80
  return et(Math.atan2(i - t, e - n));
81
81
  }
82
- function $(n, t, e, i) {
82
+ function q(n, t, e, i) {
83
83
  return Math.hypot(e - n, i - t);
84
84
  }
85
- function _(n, t, e) {
85
+ function U(n, t, e) {
86
86
  return Math.min(Math.max(n, t), e);
87
87
  }
88
- function St(n) {
88
+ function Rt(n) {
89
89
  return (n % 360 + 360) % 360 / 360;
90
90
  }
91
91
  function Pt(n, t) {
@@ -94,20 +94,20 @@ function Pt(n, t) {
94
94
  function rt(n, t, e) {
95
95
  n.bindTexture(n.TEXTURE_2D, t), Pt(n, e), n.bindTexture(n.TEXTURE_2D, null);
96
96
  }
97
- function bt(n, t, e = n.NEAREST, i = n.NEAREST, s = n.CLAMP_TO_EDGE, r = n.CLAMP_TO_EDGE) {
97
+ function wt(n, t, e = n.NEAREST, i = n.NEAREST, s = n.CLAMP_TO_EDGE, r = n.CLAMP_TO_EDGE) {
98
98
  const h = n.createTexture();
99
- return n.bindTexture(n.TEXTURE_2D, h), Ot(n, e, i, s, r), Pt(n, t), n.bindTexture(n.TEXTURE_2D, null), h;
99
+ return n.bindTexture(n.TEXTURE_2D, h), St(n, e, i, s, r), Pt(n, t), n.bindTexture(n.TEXTURE_2D, null), h;
100
100
  }
101
- function Ot(n, t, e, i, s) {
101
+ function St(n, t, e, i, s) {
102
102
  n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, t), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, e), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, i), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, s);
103
103
  }
104
- function j(n, t, e, i, s, r = 0, h = WebGL2RenderingContext.FLOAT, a = !1) {
104
+ function W(n, t, e, i, s, r = 0, h = WebGL2RenderingContext.FLOAT, a = !1) {
105
105
  n.enableVertexAttribArray(t), n.vertexAttribPointer(t, e, h, a, i, s), n.vertexAttribDivisor(t, r);
106
106
  }
107
- function Xt(n, t, e, i, s) {
107
+ function Ot(n, t, e, i, s) {
108
108
  n.bindBuffer(t, e), n.bufferData(t, i, s), n.bindBuffer(t, null);
109
109
  }
110
- function wt(n) {
110
+ function bt(n) {
111
111
  let t = 0, e = 0;
112
112
  return n instanceof HTMLVideoElement ? (t = n.videoWidth, e = n.videoHeight) : n instanceof HTMLImageElement ? (t = n.naturalWidth, e = n.naturalHeight) : n instanceof HTMLCanvasElement && (t = n.width, e = n.height), { width: t, height: e };
113
113
  }
@@ -122,10 +122,10 @@ class vt extends at {
122
122
  o(this, "S", []);
123
123
  o(this, "U", null);
124
124
  o(this, "k");
125
- o(this, "R");
126
- o(this, "D", null);
127
- o(this, "L", /* @__PURE__ */ new Map());
128
- this.M = i, this.F = s, this.$ = e, this.k = _(r, 1, 8), this.R = a, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...h };
125
+ o(this, "L");
126
+ o(this, "R", null);
127
+ o(this, "D", /* @__PURE__ */ new Map());
128
+ this.M = i, this.F = s, this.$ = e, this.k = U(r, 1, 8), this.L = a, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...h };
129
129
  const l = e.getParameter(e.MAX_DRAW_BUFFERS), u = e.getParameter(e.MAX_COLOR_ATTACHMENTS);
130
130
  this.k = Math.min(this.k, l, u), this.P = e.createFramebuffer(), this.O(), this.H(), this.l.depth && this.I();
131
131
  }
@@ -133,7 +133,7 @@ class vt extends at {
133
133
  const e = this.$, i = this.l.filter === "linear" ? e.LINEAR : e.NEAREST, s = this.l.wrap === "repeat" ? e.REPEAT : e.CLAMP_TO_EDGE;
134
134
  for (let r = 0; r < this.k; r++) {
135
135
  const h = e.createTexture();
136
- e.bindTexture(e.TEXTURE_2D, h), Ot(e, i, i, s, s), this.G(h, !1), this.S.push(h);
136
+ e.bindTexture(e.TEXTURE_2D, h), St(e, i, i, s, s), this.G(h, !1), this.S.push(h);
137
137
  }
138
138
  e.bindTexture(e.TEXTURE_2D, null);
139
139
  }
@@ -167,13 +167,13 @@ class vt extends at {
167
167
  rt(this.$, this.S[0], e);
168
168
  }
169
169
  resize(e, i) {
170
- this.M = e, this.F = i, this.L.clear();
170
+ this.M = e, this.F = i, this.D.clear();
171
171
  const s = this.$;
172
172
  for (const r of this.S) this.G(r, !0);
173
- s.bindTexture(s.TEXTURE_2D, null), this.j(), this.D = null;
173
+ s.bindTexture(s.TEXTURE_2D, null), this.j(), this.R = null;
174
174
  }
175
175
  readPixels(e) {
176
- const i = this.L.get(e);
176
+ const i = this.D.get(e);
177
177
  if (i) return i;
178
178
  const s = this.$, r = this.M, h = this.F, a = new Uint8Array(r * h * 4), l = s.getParameter(s.READ_FRAMEBUFFER_BINDING);
179
179
  s.bindFramebuffer(s.READ_FRAMEBUFFER, this.P), s.readBuffer(s.COLOR_ATTACHMENT0 + e), s.readPixels(0, 0, r, h, s.RGBA, s.UNSIGNED_BYTE, a), s.bindFramebuffer(s.READ_FRAMEBUFFER, l);
@@ -182,22 +182,22 @@ class vt extends at {
182
182
  const g = (h - 1 - f) * u, p = f * u;
183
183
  c.set(a.subarray(g, g + u), p);
184
184
  }
185
- return this.L.set(e, c), c;
185
+ return this.D.set(e, c), c;
186
186
  }
187
187
  begin() {
188
188
  const e = this.$;
189
- this.L.clear(), this.R.X(), this.R.Y(this.P, this.M, this.F, this.k), this.l.depth && e.clear(e.DEPTH_BUFFER_BIT), this.R.state.K();
189
+ this.D.clear(), this.L.X(), this.L.Y(this.P, this.M, this.F, this.k), this.l.depth && e.clear(e.DEPTH_BUFFER_BIT), this.L.state.K();
190
190
  }
191
191
  end() {
192
- this.R.state.W(), this.R.Z(), this.R.q();
192
+ this.L.state.W(), this.L.Z(), this.L.q();
193
193
  }
194
194
  V() {
195
- return this.D || this.J(), this.D;
195
+ return this.R || this.J(), this.R;
196
196
  }
197
197
  J() {
198
- if (!this.R) return;
199
- const e = this.k > 1, i = this.k > 2, s = this.k > 3, r = { U6: this.S[0], U7: e ? this.S[1] : this.S[0], U8: i ? this.S[2] : this.S[0], U9: s ? this.S[3] : this.S[0], Ua: [this.M, this.F], Ub: e, Uc: i, Ud: s }, h = this.R.materialManager.tt;
200
- this.D = this.R.materialManager.st(h, r);
198
+ if (!this.L) return;
199
+ const e = this.k > 1, i = this.k > 2, s = this.k > 3, r = { Ub: this.S[0], Uc: e ? this.S[1] : this.S[0], Ud: i ? this.S[2] : this.S[0], Ue: s ? this.S[3] : this.S[0], Uf: [this.M, this.F], Ug: e, Uh: i, Ui: s }, h = this.L.materialManager.tt;
200
+ this.R = this.L.materialManager.st(h, r);
201
201
  }
202
202
  dispose() {
203
203
  const e = this.$;
@@ -221,19 +221,19 @@ class vt extends at {
221
221
  return this.k;
222
222
  }
223
223
  }
224
- function I(n) {
224
+ function D(n) {
225
225
  return typeof n == "object" && n !== null && "textures" in n && Array.isArray(n.textures);
226
226
  }
227
- function Ut(n) {
227
+ function Xt(n) {
228
228
  if (typeof n == "number" || typeof n == "boolean") return !0;
229
229
  if (Array.isArray(n)) {
230
230
  if (n.length === 0) return !0;
231
231
  const t = n[0];
232
232
  return typeof t == "number" || !!Array.isArray(t);
233
233
  }
234
- return n instanceof Float32Array || n instanceof Int32Array || !!I(n) || typeof WebGLTexture < "u" && n instanceof WebGLTexture;
234
+ return n instanceof Float32Array || n instanceof Int32Array || !!D(n) || typeof WebGLTexture < "u" && n instanceof WebGLTexture;
235
235
  }
236
- class K extends at {
236
+ class j extends at {
237
237
  constructor(e, i, s) {
238
238
  super();
239
239
  o(this, "$");
@@ -279,7 +279,7 @@ class K extends at {
279
279
  }
280
280
  vt() {
281
281
  this.ht = 0, this.ot.clear();
282
- for (const [e, i] of this.nt) (i instanceof WebGLTexture || I(i)) && this.nt.delete(e);
282
+ for (const [e, i] of this.nt) (i instanceof WebGLTexture || D(i)) && this.nt.delete(e);
283
283
  }
284
284
  gt(e) {
285
285
  for (const i in e) this._t(i, e[i]);
@@ -289,8 +289,8 @@ class K extends at {
289
289
  if (!s) return;
290
290
  const r = this.nt.get(e);
291
291
  let h = !0;
292
- if (r !== void 0 && (typeof i == "number" || typeof i == "boolean" ? r === i && (h = !1) : (i instanceof WebGLTexture || I(i)) && r === i && (h = !1)), !h) return;
293
- typeof i == "number" || typeof i == "boolean" || i instanceof WebGLTexture || I(i) ? this.nt.set(e, i) : this.nt.delete(e);
292
+ if (r !== void 0 && (typeof i == "number" || typeof i == "boolean" ? r === i && (h = !1) : (i instanceof WebGLTexture || D(i)) && r === i && (h = !1)), !h) return;
293
+ typeof i == "number" || typeof i == "boolean" || i instanceof WebGLTexture || D(i) ? this.nt.set(e, i) : this.nt.delete(e);
294
294
  const a = this.rt.get(e);
295
295
  if (!a) return;
296
296
  const { type: l, size: u } = a, c = this.$;
@@ -298,11 +298,11 @@ class K extends at {
298
298
  const f = this.yt(e);
299
299
  return c.uniform1i(s, f), c.activeTexture(c.TEXTURE0 + f), void c.bindTexture(c.TEXTURE_2D, i);
300
300
  }
301
- if (I(i)) {
301
+ if (D(i)) {
302
302
  const f = this.yt(e);
303
303
  return c.uniform1i(s, f), c.activeTexture(c.TEXTURE0 + f), void c.bindTexture(c.TEXTURE_2D, i.textures[0]);
304
304
  }
305
- if (Ut(i), typeof i != "number") if (typeof i != "boolean") if (Array.isArray(i) && Array.isArray(i[0])) {
305
+ if (Xt(i), typeof i != "number") if (typeof i != "boolean") if (Array.isArray(i) && Array.isArray(i[0])) {
306
306
  const f = i.flat();
307
307
  switch (l) {
308
308
  case c.FLOAT_VEC2:
@@ -371,12 +371,12 @@ class K extends at {
371
371
  this.$.deleteProgram(this.et), super.dispose();
372
372
  }
373
373
  }
374
- const _t = /* @__PURE__ */ new WeakMap();
374
+ const Ut = /* @__PURE__ */ new WeakMap();
375
375
  function ft(n, t) {
376
- _t.set(n, t);
376
+ Ut.set(n, t);
377
377
  }
378
- function Lt(n) {
379
- return _t.get(n);
378
+ function _t(n) {
379
+ return Ut.get(n);
380
380
  }
381
381
  function it(n, t, e, i, s = 255) {
382
382
  n[0] = t / 255, n[1] = (e ?? t) / 255, n[2] = (i ?? t) / 255, n[3] = s / 255;
@@ -396,29 +396,29 @@ class lt {
396
396
  o(this, "St", [0, 0, 0, 1]);
397
397
  o(this, "Et", !1);
398
398
  o(this, "kt", !1);
399
- o(this, "Rt", !1);
400
- o(this, "Dt", 0);
401
- o(this, "Lt", [0, 0, 0, 1]);
399
+ o(this, "Lt", !1);
400
+ o(this, "Rt", 0);
401
+ o(this, "Dt", [0, 0, 0, 1]);
402
402
  o(this, "Ot", !1);
403
- o(this, "zt", []);
404
403
  o(this, "Ht", []);
404
+ o(this, "zt", []);
405
405
  }
406
406
  static Bt() {
407
- return { It: 1, wt: 0, bt: 0, Ct: 0, xt: 0, Mt: 0, Ft: 0, Dt: 0, Gt: !1, jt: !1, Rt: !1, Ot: !1, Qt: [0, 0, 0], Nt: "", Xt: [1, 1, 1, 1], Yt: [0, 0, 0, 1] };
407
+ return { It: 1, wt: 0, bt: 0, Ct: 0, xt: 0, Mt: 0, Ft: 0, Rt: 0, Gt: !1, jt: !1, Lt: !1, Ot: !1, Qt: [0, 0, 0], Nt: "", Xt: [1, 1, 1, 1], Yt: [0, 0, 0, 1] };
408
408
  }
409
409
  Kt(t) {
410
- t.It = this.At, t.wt = this.wt, t.bt = this.bt, t.Ct = this.Ct, t.xt = this.xt, t.Mt = this.Mt, t.Ft = this.Ft, t.Gt = this.Et, t.jt = this.kt, t.Rt = this.Rt, t.Dt = this.Dt, t.Ot = this.Ot, t.Qt[0] = this.$t[0], t.Qt[1] = this.$t[1], t.Qt[2] = this.$t[2], t.Nt = this.Pt, t.Xt[0] = this.Tt[0], t.Xt[1] = this.Tt[1], t.Xt[2] = this.Tt[2], t.Xt[3] = this.Tt[3], t.Yt[0] = this.St[0], t.Yt[1] = this.St[1], t.Yt[2] = this.St[2], t.Yt[3] = this.St[3];
410
+ t.It = this.At, t.wt = this.wt, t.bt = this.bt, t.Ct = this.Ct, t.xt = this.xt, t.Mt = this.Mt, t.Ft = this.Ft, t.Gt = this.Et, t.jt = this.kt, t.Lt = this.Lt, t.Rt = this.Rt, t.Ot = this.Ot, t.Qt[0] = this.$t[0], t.Qt[1] = this.$t[1], t.Qt[2] = this.$t[2], t.Nt = this.Pt, t.Xt[0] = this.Tt[0], t.Xt[1] = this.Tt[1], t.Xt[2] = this.Tt[2], t.Xt[3] = this.Tt[3], t.Yt[0] = this.St[0], t.Yt[1] = this.St[1], t.Yt[2] = this.St[2], t.Yt[3] = this.St[3];
411
411
  }
412
412
  Wt(t) {
413
- this.At = t.It, this.wt = t.wt, this.bt = t.bt, this.Ct = t.Ct, this.xt = t.xt, this.Mt = t.Mt, this.Ft = t.Ft, this.Et = t.Gt, this.kt = t.jt, this.Rt = t.Rt, this.Dt = t.Dt, this.Ot = t.Ot, this.$t[0] = t.Qt[0], this.$t[1] = t.Qt[1], this.$t[2] = t.Qt[2], this.Pt = t.Nt, this.Tt[0] = t.Xt[0], this.Tt[1] = t.Xt[1], this.Tt[2] = t.Xt[2], this.Tt[3] = t.Xt[3], this.St[0] = t.Yt[0], this.St[1] = t.Yt[1], this.St[2] = t.Yt[2], this.St[3] = t.Yt[3];
413
+ this.At = t.It, this.wt = t.wt, this.bt = t.bt, this.Ct = t.Ct, this.xt = t.xt, this.Mt = t.Mt, this.Ft = t.Ft, this.Et = t.Gt, this.kt = t.jt, this.Lt = t.Lt, this.Rt = t.Rt, this.Ot = t.Ot, this.$t[0] = t.Qt[0], this.$t[1] = t.Qt[1], this.$t[2] = t.Qt[2], this.Pt = t.Nt, this.Tt[0] = t.Xt[0], this.Tt[1] = t.Xt[1], this.Tt[2] = t.Xt[2], this.Tt[3] = t.Xt[3], this.St[0] = t.Yt[0], this.St[1] = t.Yt[1], this.St[2] = t.Yt[2], this.St[3] = t.Yt[3];
414
414
  }
415
415
  K() {
416
- let t = this.Ht.pop();
417
- t || (t = lt.Bt()), this.Kt(t), this.zt.push(t);
416
+ let t = this.zt.pop();
417
+ t || (t = lt.Bt()), this.Kt(t), this.Ht.push(t);
418
418
  }
419
419
  W() {
420
- const t = this.zt.pop();
421
- t ? (this.Wt(t), this.Ht.push(t)) : console.warn("pop() called without matching push()");
420
+ const t = this.Ht.pop();
421
+ t ? (this.Wt(t), this.zt.push(t)) : console.warn("pop() called without matching push()");
422
422
  }
423
423
  Zt(t) {
424
424
  this.Kt(t);
@@ -469,19 +469,19 @@ class lt {
469
469
  this.kt = t;
470
470
  }
471
471
  vs(t) {
472
- this.Rt = t;
472
+ this.Lt = t;
473
473
  }
474
474
  gs(t) {
475
- this.Dt = St(t);
475
+ this.Rt = Rt(t);
476
476
  }
477
477
  _s(t, e, i, s) {
478
- it(this.Lt, t, e, i, s);
478
+ it(this.Dt, t, e, i, s);
479
479
  }
480
480
  As(t) {
481
481
  this.Ot = t;
482
482
  }
483
483
  get canvasBackgroundColor() {
484
- return this.Lt;
484
+ return this.Dt;
485
485
  }
486
486
  get charColor() {
487
487
  return this.Tt;
@@ -520,7 +520,7 @@ class lt {
520
520
  return this.Ct;
521
521
  }
522
522
  get charRotation() {
523
- return this.Dt;
523
+ return this.Rt;
524
524
  }
525
525
  get flipX() {
526
526
  return this.Et;
@@ -529,10 +529,10 @@ class lt {
529
529
  return this.kt;
530
530
  }
531
531
  get invert() {
532
- return this.Rt;
532
+ return this.Lt;
533
533
  }
534
534
  }
535
- 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]), k = { ws: 16, bs: WebGL2RenderingContext.TRIANGLES, Cs: { Ms: { size: 2, offset: 0 }, Fs: { size: 2, offset: 8 } } };
535
+ 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]), Y = { ws: 16, bs: WebGL2RenderingContext.TRIANGLES, Cs: { Ms: { size: 2, offset: 0 }, Fs: { size: 2, offset: 8 } } };
536
536
  class le {
537
537
  constructor(t) {
538
538
  o(this, "$");
@@ -541,12 +541,12 @@ class le {
541
541
  this.$ = t, this.$s = t.createBuffer(), this.Ps = new Float32Array(mt.length);
542
542
  }
543
543
  Ts(t, e, i, s) {
544
- const r = this.$, h = Lt(this.$), a = h[2], l = h[3], u = t / a * 2 - 1, c = (t + i) / a * 2 - 1, f = 1 - (e + s) / l * 2, g = 1 - e / l * 2, p = mt, v = this.Ps;
544
+ const r = this.$, h = _t(this.$), a = h[2], l = h[3], u = t / a * 2 - 1, c = (t + i) / a * 2 - 1, f = 1 - (e + s) / l * 2, g = 1 - e / l * 2, p = mt, v = this.Ps;
545
545
  for (let d = 0; d < p.length; d += 4) {
546
- const m = p[d], A = p[d + 1], b = p[d + 2], y = p[d + 3], R = u + (m + 0.5) * (c - u), w = f + (A + 0.5) * (g - f);
547
- v[d] = R, v[d + 1] = w, v[d + 2] = b, v[d + 3] = y;
546
+ const m = p[d], A = p[d + 1], w = p[d + 2], y = p[d + 3], T = u + (m + 0.5) * (c - u), b = f + (A + 0.5) * (g - f);
547
+ v[d] = T, v[d + 1] = b, v[d + 2] = w, v[d + 3] = y;
548
548
  }
549
- r.bindBuffer(r.ARRAY_BUFFER, this.$s), r.bufferData(r.ARRAY_BUFFER, v, r.DYNAMIC_DRAW), j(r, 0, 2, 16, 0), j(r, 1, 2, 16, 8), r.drawArrays(r.TRIANGLES, 0, 6), r.disableVertexAttribArray(1), r.disableVertexAttribArray(0), r.bindBuffer(r.ARRAY_BUFFER, null);
549
+ r.bindBuffer(r.ARRAY_BUFFER, this.$s), r.bufferData(r.ARRAY_BUFFER, v, r.DYNAMIC_DRAW), W(r, 0, 2, 16, 0), W(r, 1, 2, 16, 8), r.drawArrays(r.TRIANGLES, 0, 6), r.disableVertexAttribArray(1), r.disableVertexAttribArray(0), r.bindBuffer(r.ARRAY_BUFFER, null);
550
550
  }
551
551
  Ss() {
552
552
  this.$.deleteBuffer(this.$s);
@@ -561,28 +561,28 @@ class ue {
561
561
  o(this, "ks", null);
562
562
  this.$ = t;
563
563
  }
564
- Rs(t, e, i, s) {
564
+ Ls(t, e, i, s) {
565
565
  const r = this.$, h = t.program;
566
566
  let a = this.Es.get(t);
567
- a || (a = /* @__PURE__ */ new Map(), this.Es.set(t, a), t.C(() => this.Ds(t)));
567
+ a || (a = /* @__PURE__ */ new Map(), this.Es.set(t, a), t.C(() => this.Rs(t)));
568
568
  let l = a.get(e) || null;
569
569
  if (l) this.ks !== l && (r.bindVertexArray(l), this.ks = l);
570
570
  else {
571
571
  l = r.createVertexArray(), a.set(e, l), r.bindVertexArray(l), this.ks = l, r.bindBuffer(r.ARRAY_BUFFER, s);
572
572
  const u = r.getAttribLocation(h, "A0");
573
- u !== -1 && j(r, u, i.Cs.Ms.size, i.ws, i.Cs.Ms.offset, 0, r.FLOAT, !1);
573
+ u !== -1 && W(r, u, i.Cs.Ms.size, i.ws, i.Cs.Ms.offset, 0, r.FLOAT, !1);
574
574
  const c = r.getAttribLocation(h, "A1");
575
- c !== -1 && j(r, c, i.Cs.Fs.size, i.ws, i.Cs.Fs.offset, 0, r.FLOAT, !1);
575
+ c !== -1 && W(r, c, i.Cs.Fs.size, i.ws, i.Cs.Fs.offset, 0, r.FLOAT, !1);
576
576
  }
577
577
  }
578
- Ds(t) {
578
+ Rs(t) {
579
579
  const e = this.Es.get(t);
580
580
  if (e) {
581
581
  for (const [, i] of e) i && this.$.deleteVertexArray(i);
582
582
  this.Es.delete(t);
583
583
  }
584
584
  }
585
- Ls() {
585
+ Ds() {
586
586
  this.ks !== null && (this.$.bindVertexArray(null), this.ks = null);
587
587
  }
588
588
  Ss() {
@@ -590,31 +590,31 @@ class ue {
590
590
  this.Es.clear();
591
591
  }
592
592
  }
593
- class X {
593
+ class O {
594
594
  }
595
- o(X, "BYTES_PER_INSTANCE", 144), o(X, "FLOATS_PER_INSTANCE", 36);
596
- function O(n, t) {
597
- return { location: -1, size: n, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: X.BYTES_PER_INSTANCE, offset: t, divisor: 1 };
595
+ o(O, "BYTES_PER_INSTANCE", 144), o(O, "FLOATS_PER_INSTANCE", 36);
596
+ function S(n, t) {
597
+ return { location: -1, size: n, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: O.BYTES_PER_INSTANCE, offset: t, divisor: 1 };
598
598
  }
599
599
  class nt {
600
600
  }
601
- o(nt, "STRIDE", X.BYTES_PER_INSTANCE), o(nt, "ATTRIBUTES", { A2: O(2, 0), A3: O(2, 8), A4: O(3, 16), A5: O(4, 28), A6: O(4, 44), A7: O(4, 60), A8: O(3, 76), A9: O(3, 88), Aa: O(4, 100), Ab: O(4, 116), Ac: O(3, 132) });
601
+ o(nt, "STRIDE", O.BYTES_PER_INSTANCE), o(nt, "ATTRIBUTES", { A2: S(2, 0), A3: S(2, 8), A4: S(3, 16), A5: S(4, 28), A6: S(4, 44), A7: S(4, 60), A8: S(3, 76), A9: S(3, 88), Aa: S(4, 100), Ab: S(4, 116), Ac: S(3, 132) });
602
602
  class fe {
603
603
  constructor(t = 1e3, e = 1.5) {
604
604
  o(this, "Os");
605
- o(this, "zs");
606
605
  o(this, "Hs");
606
+ o(this, "zs");
607
607
  o(this, "Bs", 0);
608
608
  o(this, "Is", 0);
609
- this.zs = t, this.Hs = e;
610
- const i = t * X.FLOATS_PER_INSTANCE;
609
+ this.Hs = t, this.zs = e;
610
+ const i = t * O.FLOATS_PER_INSTANCE;
611
611
  this.Os = new Float32Array(i);
612
612
  }
613
613
  Gs(t) {
614
- if (t <= this.zs) return;
615
- const e = Math.ceil(t * this.Hs), i = this.zs;
616
- this.zs = e;
617
- const s = new Float32Array(e * X.FLOATS_PER_INSTANCE), r = i * X.FLOATS_PER_INSTANCE;
614
+ if (t <= this.Hs) return;
615
+ const e = Math.ceil(t * this.zs), i = this.Hs;
616
+ this.Hs = e;
617
+ const s = new Float32Array(e * O.FLOATS_PER_INSTANCE), r = i * O.FLOATS_PER_INSTANCE;
618
618
  s.set(this.Os.subarray(0, Math.min(r, this.Bs))), this.Os = s;
619
619
  }
620
620
  js(t) {
@@ -630,7 +630,7 @@ class fe {
630
630
  return this.Is;
631
631
  }
632
632
  get Ys() {
633
- return this.zs;
633
+ return this.Hs;
634
634
  }
635
635
  get Ks() {
636
636
  return this.Bs;
@@ -645,11 +645,11 @@ class de {
645
645
  this.Os = t;
646
646
  }
647
647
  Zs(t) {
648
- this.Os.Is >= this.Os.zs && this.Os.Gs(this.Os.Is + 1);
648
+ this.Os.Is >= this.Os.Hs && this.Os.Gs(this.Os.Is + 1);
649
649
  const e = this.Os.Os, i = this.Os.Bs;
650
650
  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;
651
651
  const s = t.curveParams0, r = t.curveParams1;
652
- 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.Os.js(X.FLOATS_PER_INSTANCE), this.Os.Is - 1;
652
+ 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.Os.js(O.FLOATS_PER_INSTANCE), this.Os.Is - 1;
653
653
  }
654
654
  get Xs() {
655
655
  return this.Os.Xs;
@@ -668,8 +668,8 @@ class ge {
668
668
  ee(t) {
669
669
  const e = this.$;
670
670
  this.qs && e.deleteBuffer(this.qs), this.te++, this.qs = e.createBuffer();
671
- const i = t * X.BYTES_PER_INSTANCE;
672
- Xt(e, e.ARRAY_BUFFER, this.qs, i, e.DYNAMIC_DRAW), this.Vs = t;
671
+ const i = t * O.BYTES_PER_INSTANCE;
672
+ Ot(e, e.ARRAY_BUFFER, this.qs, i, e.DYNAMIC_DRAW), this.Vs = t;
673
673
  }
674
674
  ie(t) {
675
675
  this.ee(t);
@@ -681,7 +681,7 @@ class ge {
681
681
  if (e === 0) return;
682
682
  const i = this.$;
683
683
  i.bindBuffer(i.ARRAY_BUFFER, this.qs);
684
- const s = e * X.FLOATS_PER_INSTANCE;
684
+ const s = e * O.FLOATS_PER_INSTANCE;
685
685
  i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, s);
686
686
  }
687
687
  ne(t) {
@@ -703,7 +703,7 @@ class ge {
703
703
  const s = this.ne(i);
704
704
  for (const [r, h] of s) {
705
705
  const a = nt.ATTRIBUTES[r];
706
- a && j(e, h, a.size, a.stride, a.offset, a.divisor, a.type, a.normalized);
706
+ a && W(e, h, a.size, a.stride, a.offset, a.divisor, a.type, a.normalized);
707
707
  }
708
708
  this.se.set(i, this.te);
709
709
  }
@@ -722,9 +722,9 @@ class pe {
722
722
  ce(t) {
723
723
  var r, h, a, l, u, c, f, g, p, v;
724
724
  const e = this.Os;
725
- e.Is >= e.zs && e.Gs(e.Is + 1);
725
+ e.Is >= e.Hs && e.Gs(e.Is + 1);
726
726
  const i = e.Os, s = e.Bs;
727
- return i[s + 0] = t.Ms[0], i[s + 1] = t.Ms[1], i[s + 2] = t.le[0], i[s + 3] = t.le[1], i[s + 4] = t.Qt[0], i[s + 5] = t.Qt[1], i[s + 6] = t.Qt[2], i[s + 7] = t.Xt[0], i[s + 8] = t.Xt[1], i[s + 9] = t.Xt[2], i[s + 10] = t.Xt[3], i[s + 11] = t.Yt[0], i[s + 12] = t.Yt[1], i[s + 13] = t.Yt[2], i[s + 14] = t.Yt[3], i[s + 15] = t.ue[0], i[s + 16] = t.ue[1], i[s + 17] = t.ue[2], i[s + 18] = t.Dt, i[s + 19] = ((r = t.fe) == null ? void 0 : r[0]) ?? 0, i[s + 20] = ((h = t.fe) == null ? void 0 : h[1]) ?? 0, i[s + 21] = ((a = t.fe) == null ? void 0 : a[2]) ?? 0, i[s + 22] = ((l = t.de) == null ? void 0 : l[0]) ?? 0, i[s + 23] = ((u = t.de) == null ? void 0 : u[1]) ?? 0, i[s + 24] = ((c = t.de) == null ? void 0 : c[2]) ?? 0, t.pe && t.ve ? (i[s + 25] = ((f = t.ge) == null ? void 0 : f[0]) ?? 0, i[s + 26] = ((g = t.ge) == null ? void 0 : g[1]) ?? 0, i[s + 27] = ((p = t.me) == null ? void 0 : p[0]) ?? 0, i[s + 28] = ((v = t.me) == null ? void 0 : v[1]) ?? 0, i[s + 29] = t.pe[0], i[s + 30] = t.pe[1], i[s + 31] = t.ve[0], i[s + 32] = t.ve[1]) : t._e ? (i[s + 25] = t._e[0], i[s + 26] = t._e[1], i[s + 27] = 0, i[s + 28] = 0, i[s + 29] = 0, i[s + 30] = 0, i[s + 31] = 0, i[s + 32] = 0) : (i[s + 25] = 0, i[s + 26] = 0, i[s + 27] = 0, i[s + 28] = 0, i[s + 29] = 0, i[s + 30] = 0, i[s + 31] = 0, i[s + 32] = 0), i[s + 33] = t.ye || 0, i[s + 34] = t.Ae || 0, i[s + 35] = t.we || 0, e.js(X.FLOATS_PER_INSTANCE), e.Is - 1;
727
+ return i[s + 0] = t.Ms[0], i[s + 1] = t.Ms[1], i[s + 2] = t.le[0], i[s + 3] = t.le[1], i[s + 4] = t.Qt[0], i[s + 5] = t.Qt[1], i[s + 6] = t.Qt[2], i[s + 7] = t.Xt[0], i[s + 8] = t.Xt[1], i[s + 9] = t.Xt[2], i[s + 10] = t.Xt[3], i[s + 11] = t.Yt[0], i[s + 12] = t.Yt[1], i[s + 13] = t.Yt[2], i[s + 14] = t.Yt[3], i[s + 15] = t.ue[0], i[s + 16] = t.ue[1], i[s + 17] = t.ue[2], i[s + 18] = t.Rt, i[s + 19] = ((r = t.fe) == null ? void 0 : r[0]) ?? 0, i[s + 20] = ((h = t.fe) == null ? void 0 : h[1]) ?? 0, i[s + 21] = ((a = t.fe) == null ? void 0 : a[2]) ?? 0, i[s + 22] = ((l = t.de) == null ? void 0 : l[0]) ?? 0, i[s + 23] = ((u = t.de) == null ? void 0 : u[1]) ?? 0, i[s + 24] = ((c = t.de) == null ? void 0 : c[2]) ?? 0, t.pe && t.ve ? (i[s + 25] = ((f = t.ge) == null ? void 0 : f[0]) ?? 0, i[s + 26] = ((g = t.ge) == null ? void 0 : g[1]) ?? 0, i[s + 27] = ((p = t.me) == null ? void 0 : p[0]) ?? 0, i[s + 28] = ((v = t.me) == null ? void 0 : v[1]) ?? 0, i[s + 29] = t.pe[0], i[s + 30] = t.pe[1], i[s + 31] = t.ve[0], i[s + 32] = t.ve[1]) : t._e ? (i[s + 25] = t._e[0], i[s + 26] = t._e[1], i[s + 27] = 0, i[s + 28] = 0, i[s + 29] = 0, i[s + 30] = 0, i[s + 31] = 0, i[s + 32] = 0) : (i[s + 25] = 0, i[s + 26] = 0, i[s + 27] = 0, i[s + 28] = 0, i[s + 29] = 0, i[s + 30] = 0, i[s + 31] = 0, i[s + 32] = 0), i[s + 33] = t.ye || 0, i[s + 34] = t.Ae || 0, i[s + 35] = t.we || 0, e.js(O.FLOATS_PER_INSTANCE), e.Is - 1;
728
728
  }
729
729
  be() {
730
730
  this.Os.Ys > this.ae.Ys && this.ae.ie(this.Os.Ys);
@@ -759,7 +759,7 @@ class pe {
759
759
  this.ae.Ss();
760
760
  }
761
761
  }
762
- class z {
762
+ class I {
763
763
  constructor(t, e, i, s) {
764
764
  o(this, "$");
765
765
  o(this, "Me");
@@ -772,7 +772,7 @@ class z {
772
772
  var r, h;
773
773
  this.$ = t, this.Me = e, this.Fe = i, this.$e = s, this.Ee = (r = this.Te, h = this.Se, { x: 0, y: 0, width: 0, height: 0, char0: 0, char1: 0, char2: 0, r1: 0, g1: 0, b1: 0, a1: 0, r2: 0, g2: 0, b2: 0, a2: 0, invert: 0, flipX: 0, flipY: 0, charRot: 0, translationX: 0, translationY: 0, translationZ: 0, rotationX: 0, rotationY: 0, rotationZ: 0, curveParams0: r, curveParams1: h, depth: 0, baseZ: 0, geometryType: 0 });
774
774
  const a = this.$.createBuffer();
775
- Xt(this.$, this.$.ARRAY_BUFFER, a, this.$e.ke, this.$.STATIC_DRAW), this.Pe = a;
775
+ Ot(this.$, this.$.ARRAY_BUFFER, a, this.$e.ke, this.$.STATIC_DRAW), this.Pe = a;
776
776
  }
777
777
  get type() {
778
778
  return this.Fe;
@@ -786,33 +786,33 @@ class z {
786
786
  get batch() {
787
787
  return this.Me;
788
788
  }
789
- Re() {
789
+ Le() {
790
790
  this.Me.xe();
791
791
  }
792
- De() {
792
+ Re() {
793
793
  return !this.Me.Ws;
794
794
  }
795
795
  Ss() {
796
796
  this.Me.Ss(), this.$.deleteBuffer(this.Pe);
797
797
  }
798
- Le(t, e, i) {
798
+ De(t, e, i) {
799
799
  return this.Me.ce(t);
800
800
  }
801
801
  Oe(t, e, i, s, r, h) {
802
802
  const a = r.wt ?? 0, l = r.bt ?? 0, u = r.Ct ?? 0, c = r.xt ?? 0, f = r.Mt ?? 0, g = r.Ft ?? 0, p = this.Te, v = this.Se;
803
803
  p[0] = 0, p[1] = 0, p[2] = 0, p[3] = 0, v[0] = 0, v[1] = 0, v[2] = 0, v[3] = 0, h && (h.bezStartX !== void 0 && h.bezStartY !== void 0 && h.bezEndX !== void 0 && h.bezEndY !== void 0 ? (p[0] = h.cp1x ?? 0, p[1] = h.cp1y ?? 0, p[2] = h.cp2x ?? 0, p[3] = h.cp2y ?? 0, v[0] = h.bezStartX ?? 0, v[1] = h.bezStartY ?? 0, v[2] = h.bezEndX ?? 0, v[3] = h.bezEndY ?? 0) : h.arcStart === void 0 && h.arcStop === void 0 || (p[0] = h.arcStart ?? 0, p[1] = h.arcStop ?? 0));
804
804
  const d = this.Ee;
805
- return d.x = t, d.y = e, d.width = i, d.height = s, d.char0 = r.Qt[0], d.char1 = r.Qt[1], d.char2 = r.Qt[2], d.r1 = r.Xt[0], d.g1 = r.Xt[1], d.b1 = r.Xt[2], d.a1 = r.Xt[3], d.r2 = r.Yt[0], d.g2 = r.Yt[1], d.b2 = r.Yt[2], d.a2 = r.Yt[3], d.invert = r.Rt ? 1 : 0, d.flipX = r.Gt ? 1 : 0, d.flipY = r.jt ? 1 : 0, d.charRot = r.Dt, d.translationX = a, d.translationY = l, d.translationZ = u, d.rotationX = c, d.rotationY = f, d.rotationZ = g, d.depth = (h == null ? void 0 : h.depth) ?? 0, d.baseZ = (h == null ? void 0 : h.baseZ) ?? 0, d.geometryType = ce[this.Fe] ?? 0, this.Me.writer.Zs(d);
805
+ return d.x = t, d.y = e, d.width = i, d.height = s, d.char0 = r.Qt[0], d.char1 = r.Qt[1], d.char2 = r.Qt[2], d.r1 = r.Xt[0], d.g1 = r.Xt[1], d.b1 = r.Xt[2], d.a1 = r.Xt[3], d.r2 = r.Yt[0], d.g2 = r.Yt[1], d.b2 = r.Yt[2], d.a2 = r.Yt[3], d.invert = r.Lt ? 1 : 0, d.flipX = r.Gt ? 1 : 0, d.flipY = r.jt ? 1 : 0, d.charRot = r.Rt, d.translationX = a, d.translationY = l, d.translationZ = u, d.rotationX = c, d.rotationY = f, d.rotationZ = g, d.depth = (h == null ? void 0 : h.depth) ?? 0, d.baseZ = (h == null ? void 0 : h.baseZ) ?? 0, d.geometryType = ce[this.Fe] ?? 0, this.Me.writer.Zs(d);
806
806
  }
807
807
  }
808
- const ve = { ke: mt, ze: 6, ...k }, me = { ke: 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]), ze: 6, ...k }, Ae = { ke: function(n = 32) {
808
+ const ve = { ke: mt, He: 6, ...Y }, me = { ke: 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]), He: 6, ...Y }, Ae = { ke: function(n = 32) {
809
809
  const t = [], e = 2 * Math.PI / n;
810
810
  for (let i = 0; i < n; i++) {
811
811
  const s = i * e, r = (i + 1) % n * e, h = Math.cos(s), a = Math.sin(s), l = 0.5 * (h + 1), u = 0.5 * (a + 1), c = Math.cos(r), f = Math.sin(r), g = 0.5 * (c + 1), p = 0.5 * (f + 1);
812
812
  t.push(0, 0, 0.5, 0.5, h, a, l, u, c, f, g, p);
813
813
  }
814
814
  return new Float32Array(t);
815
- }(32), ze: 96, ...k };
815
+ }(32), He: 96, ...Y };
816
816
  let ye = { ke: function(n) {
817
817
  const t = [];
818
818
  for (let e = 0; e < n; e++) {
@@ -820,22 +820,22 @@ let ye = { ke: function(n) {
820
820
  t.push(i, 0, i, 0, i, 1, i, 1, s, 1, s, 1);
821
821
  }
822
822
  return new Float32Array(t);
823
- }(32), ze: 96, ...k };
824
- const be = { ke: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), ze: 3, ...k }, we = { ke: function(n = 16) {
823
+ }(32), He: 96, ...Y };
824
+ const we = { ke: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), He: 3, ...Y }, be = { ke: function(n = 16) {
825
825
  const t = [];
826
826
  for (let e = 0; e < n; e++) {
827
827
  const i = e / n, s = (e + 1) / n;
828
828
  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);
829
829
  }
830
830
  return new Float32Array(t);
831
- }(16), ze: 96, ...k }, Ee = { [x.RECTANGLE]: class extends z {
831
+ }(16), He: 96, ...Y }, Ee = { [x.RECTANGLE]: class extends I {
832
832
  constructor(n, t) {
833
833
  super(n, t, x.RECTANGLE, ve);
834
834
  }
835
835
  ce(n, t) {
836
836
  return this.Oe(0, 0, n.width, n.height, t);
837
837
  }
838
- }, [x.LINE]: class extends z {
838
+ }, [x.LINE]: class extends I {
839
839
  constructor(n, t) {
840
840
  super(n, t, x.LINE, me);
841
841
  }
@@ -843,14 +843,14 @@ const be = { ke: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), ze:
843
843
  const e = n.x2 - n.x1, i = n.y2 - n.y1, s = Math.hypot(e, i), r = Math.atan2(i, e), h = t.It || 1, a = Math.cos(-r), l = Math.sin(-r), u = n.x1 * a - n.y1 * l, c = n.x1 * l + n.y1 * a, f = { ...t, Ft: (t.Ft || 0) + r };
844
844
  return this.Oe(u, c, s, h, f);
845
845
  }
846
- }, [x.ELLIPSE]: class extends z {
846
+ }, [x.ELLIPSE]: class extends I {
847
847
  constructor(n, t) {
848
848
  super(n, t, x.ELLIPSE, Ae);
849
849
  }
850
850
  ce(n, t) {
851
851
  return this.Oe(0, 0, n.width, n.height, t);
852
852
  }
853
- }, [x.ARC]: class extends z {
853
+ }, [x.ARC]: class extends I {
854
854
  constructor(n, t) {
855
855
  super(n, t, x.ARC, ye);
856
856
  }
@@ -858,17 +858,17 @@ const be = { ke: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), ze:
858
858
  const e = N(n.start), i = N(n.stop);
859
859
  return this.Oe(0, 0, n.width, n.height, t, { arcStart: e, arcStop: i });
860
860
  }
861
- }, [x.TRIANGLE]: class extends z {
861
+ }, [x.TRIANGLE]: class extends I {
862
862
  constructor(n, t) {
863
- super(n, t, x.TRIANGLE, be);
863
+ super(n, t, x.TRIANGLE, we);
864
864
  }
865
865
  ce(n, t) {
866
866
  const e = Math.min(n.x1, n.x2, n.x3), i = Math.max(n.x1, n.x2, n.x3), s = Math.min(n.y1, n.y2, n.y3), r = i - e, h = Math.max(n.y1, n.y2, n.y3) - s;
867
867
  return this.Oe(e, s, r, h, t);
868
868
  }
869
- }, [x.BEZIER_CURVE]: class extends z {
869
+ }, [x.BEZIER_CURVE]: class extends I {
870
870
  constructor(n, t) {
871
- super(n, t, x.BEZIER_CURVE, we);
871
+ super(n, t, x.BEZIER_CURVE, be);
872
872
  }
873
873
  ce(n, t) {
874
874
  return this.Oe(0, 0, 1, t.It || 1, t, { cp1x: n.cp1x, cp1y: n.cp1y, cp2x: n.cp2x, cp2y: n.cp2y, bezStartX: n.x1, bezStartY: n.y1, bezEndX: n.x2, bezEndY: n.y2 });
@@ -877,69 +877,69 @@ const be = { ke: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), ze:
877
877
  class xe {
878
878
  constructor(t) {
879
879
  o(this, "$");
880
- o(this, "He");
880
+ o(this, "ze");
881
881
  o(this, "Be");
882
882
  o(this, "Ie", null);
883
883
  o(this, "Ge", /* @__PURE__ */ new Map());
884
884
  o(this, "je", null);
885
- this.$ = t, this.Be = new ue(t), this.He = /* @__PURE__ */ new Map();
885
+ this.$ = t, this.Be = new ue(t), this.ze = /* @__PURE__ */ new Map();
886
886
  for (const e of Object.values(x)) {
887
887
  const i = new pe(t), s = new Ee[e](t, i);
888
- this.He.set(e, s);
888
+ this.ze.set(e, s);
889
889
  }
890
890
  }
891
891
  Qe(t) {
892
892
  this.Ie = null, this.Ge.clear(), this.je = null;
893
893
  let e = null, i = null, s = null, r = !1;
894
- for (const h of t) e === h.material && i === h.type && r === h.state.Ot || (s && s.De() && this.Ne(s, e, i, r), e = h.material, i = h.type, s = this.He.get(i), r = h.state.Ot, s.Re()), s.ce(h.params, h.state);
895
- s && s.De() && this.Ne(s, e, i, r), this.Be.Ls();
894
+ for (const h of t) e === h.material && i === h.type && r === h.state.Ot || (s && s.Re() && this.Ne(s, e, i, r), e = h.material, i = h.type, s = this.ze.get(i), r = h.state.Ot, s.Le()), s.ce(h.params, h.state);
895
+ s && s.Re() && this.Ne(s, e, i, r), this.Be.Ds();
896
896
  }
897
897
  Ne(t, e, i, s) {
898
898
  if (this.Ie !== e.shader && (e.shader.dt(), this.Ie = e.shader), this.je !== e && (e.shader.gt(e.uniforms), this.je = e), this.Ge.get(e.shader) !== s) {
899
- const a = Lt(this.$);
899
+ const a = _t(this.$);
900
900
  e.shader.gt({ Ur: a[2] / a[3], Us: [a[2], a[3]], Ut: 1, Uu: s ? 1 : 0 }), this.Ge.set(e.shader, s);
901
901
  }
902
902
  const r = t.unitGeometry, h = t.unitBuffer;
903
903
  try {
904
- this.Be.Rs(e.shader, i + "", r, h), t.batch.he(e.shader), t.batch.Ts(r.bs, r.ze);
904
+ this.Be.Ls(e.shader, i + "", r, h), t.batch.he(e.shader), t.batch.Ts(r.bs, r.He);
905
905
  } finally {
906
- t.Re();
906
+ t.Le();
907
907
  }
908
908
  }
909
909
  Ss() {
910
- for (const t of this.He.values()) t.Ss();
911
- this.He.clear(), this.Be.Ss();
910
+ for (const t of this.ze.values()) t.Ss();
911
+ this.ze.clear(), this.Be.Ss();
912
912
  }
913
913
  }
914
- function Dt(n) {
914
+ function Bt(n) {
915
915
  let t = 0;
916
916
  for (let e = 0; e < n.length; e++)
917
917
  t = (t << 5) - t + n.charCodeAt(e), t &= t;
918
918
  return t;
919
919
  }
920
- const Tt = /* @__PURE__ */ new WeakMap();
921
- let Re = 1;
922
- function Mt(n) {
920
+ const Mt = /* @__PURE__ */ new WeakMap();
921
+ let Te = 1;
922
+ function Lt(n) {
923
923
  if (n == null) return 0;
924
- if (typeof n != "object" && typeof n != "function") return Dt(n + "");
925
- let t = Tt.get(n);
926
- return t || (t = Re++, Tt.set(n, t)), t;
924
+ if (typeof n != "object" && typeof n != "function") return Bt(n + "");
925
+ let t = Mt.get(n);
926
+ return t || (t = Te++, Mt.set(n, t)), t;
927
927
  }
928
928
  function H(n, t) {
929
929
  return (n << 5) - n + t;
930
930
  }
931
931
  const ht = `#version 300 es
932
932
  in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in vec4 A7;in vec3 A8;in vec3 A9;in vec4 Aa;in vec4 Ab;in vec3 Ac;uniform vec2 Us;uniform float Ut;uniform float Uu;out vec2 v_uv;out vec3 v_glyphIndex;out vec4 v_glyphColor;out vec4 v_cellColor;out vec4 v_glyphFlags;out vec3 v_worldPosition;out vec3 v_normal;out float v_geometryType;const float A=6.28318530718f;const int B=2;const int C=3;const int D=4;vec2 E(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float M=L*K;float N=F*F;float O=N*F;return M*G+3.0f*L*F*H+3.0f*K*N*I+O*J;}vec2 P(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float N=F*F;return-3.0f*L*G+3.0f*(L-2.0f*K*F)*H+3.0f*(2.0f*K*F-N)*I+3.0f*N*J;}vec3 Q(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x,R.y*T-R.z*U,R.y*U+R.z*T);}vec3 V(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T+R.z*U,R.y,-R.x*U+R.z*T);}vec3 W(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T-R.y*U,R.x*U+R.y*T,R.z);}vec3 X(vec3 R,vec3 Y){vec3 Z=R;if(Y.z!=0.0f){Z=W(Z,Y.z);}if(Y.y!=0.0f){Z=V(Z,Y.y);}if(Y.x!=0.0f){Z=Q(Z,Y.x);}return Z;}void main(){v_uv=A1;v_glyphIndex=A4;v_glyphColor=A5;v_cellColor=A6;v_glyphFlags=A7;vec4 a=Aa;vec4 b=Ab;vec2 c=A3;vec2 d=A2;float e=Ac.x;float f=Ac.y;int g=int(Ac.z);vec2 h=d;vec2 i=h+c*0.5f;float j=f+e*0.5f;vec3 k=vec3(i,j);vec3 l;if(g==D){float F=clamp(A0.x,0.0f,1.0f);vec2 G=b.xy;vec2 H=a.xy;vec2 I=a.zw;vec2 J=b.zw;vec2 m=E(F,G,H,I,J);vec2 n=P(F,G,H,I,J);float o=length(n);vec2 p=o>0.0f?n/o:vec2(1.0f,0.0f);vec2 q=vec2(-p.y,p.x);vec2 r=m;vec2 s=r+q*A0.y*c.y;l=vec3(s,f);}else if(g==C){float t=mod(a.x,A);if(t<0.0f){t+=A;}float u=mod(a.y,A);if(u<0.0f){u+=A;}float v=t-u;if(v<=0.0f){v+=A;}float S=t-A0.x*v;vec2 w=vec2(cos(S),sin(S))*A0.y;vec2 s=w*c+h;l=vec3(s,f);}else if(g==B){vec2 s=A0.xy*c+h;l=vec3(s,f);}vec3 x=X(l,A9);vec3 y=x+A8;vec3 z=vec3(0.0f,0.0f,1.0f);v_worldPosition=y;v_normal=z;v_geometryType=float(g);vec2 AA=((y.xy)/Us)*2.0f;AA.y=-AA.y;float AB=y.z/Us.y;float AC=clamp(-AB*Ut,-0.99f,0.99f);if(Uu>0.5f){gl_Position=vec4(AA,AC,1.0f);}else{float AD=0.5f;float AE=1.0f/(1.0f-AB*AD);AA*=AE;gl_Position=vec4(AA,AC,1.0f);}}`;
933
- class Te {
933
+ class Me {
934
934
  constructor(t) {
935
935
  o(this, "Xe", 0);
936
936
  o(this, "Ye");
937
937
  o(this, "Ke");
938
938
  o(this, "We");
939
939
  o(this, "Ze", /* @__PURE__ */ new Map());
940
- this.Ye = new K(t, ht, `#version 300 es
941
- 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.Ke = new K(t, ht, `#version 300 es
942
- precision highp float;in vec2 v_uv;uniform sampler2D U6;uniform sampler2D U7;uniform sampler2D U8;uniform sampler2D U9;uniform vec2 Ua;uniform bool Ub;uniform bool Uc;uniform bool Ud;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*Ua;vec2 D=(floor(C)+0.5f)/Ua;vec4 E=texture(U6,D);vec4 F=Ub?texture(U7,D):vec4(0.);if(Ub&&F.a==0.){discard;}vec4 G=Uc?texture(U8,D):vec4(0.);vec4 H=Ud?texture(U9,D):vec4(0.);o_character=E;o_primaryColor=F;o_secondaryColor=G;A=H;}`), this.We = { id: this.Xe++, shader: this.Ye, uniforms: Object.freeze({}), hash: this.qe(this.Ye, {}), isBuiltIn: !0 };
940
+ this.Ye = new j(t, ht, `#version 300 es
941
+ 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.Ke = new j(t, ht, `#version 300 es
942
+ precision highp float;in vec2 v_uv;uniform sampler2D Ub;uniform sampler2D Uc;uniform sampler2D Ud;uniform sampler2D Ue;uniform vec2 Uf;uniform bool Ug;uniform bool Uh;uniform bool Ui;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*Uf;vec2 D=(floor(C)+0.5f)/Uf;vec4 E=texture(Ub,D);vec4 F=Ug?texture(Uc,D):vec4(0.);if(Ug&&F.a==0.){discard;}vec4 G=Uh?texture(Ud,D):vec4(0.);vec4 H=Ui?texture(Ue,D):vec4(0.);o_character=E;o_primaryColor=F;o_secondaryColor=G;A=H;}`), this.We = { id: this.Xe++, shader: this.Ye, uniforms: Object.freeze({}), hash: this.qe(this.Ye, {}), isBuiltIn: !0 };
943
943
  }
944
944
  get Ve() {
945
945
  return this.We;
@@ -951,10 +951,10 @@ precision highp float;in vec2 v_uv;uniform sampler2D U6;uniform sampler2D U7;uni
951
951
  return { id: this.Xe++, shader: t, uniforms: Object.freeze({ ...e }), hash: 0, isBuiltIn: !1 };
952
952
  }
953
953
  qe(t, e) {
954
- const i = Mt(t.program), s = function(r, h) {
954
+ const i = Lt(t.program), s = function(r, h) {
955
955
  let a = 0;
956
956
  const l = Object.keys(r).sort();
957
- for (const u of l) a = H(a, Dt(u)), a = H(a, h(r[u]));
957
+ for (const u of l) a = H(a, Bt(u)), a = H(a, h(r[u]));
958
958
  return a;
959
959
  }(e, this.Je.bind(this));
960
960
  return H(i, s);
@@ -972,13 +972,13 @@ precision highp float;in vec2 v_uv;uniform sampler2D U6;uniform sampler2D U7;uni
972
972
  const s = Math.min(e.length, 16);
973
973
  for (let r = 0; r < s; r++) i = H(i, e[r]);
974
974
  return i;
975
- }(t) : t instanceof WebGLTexture || I(t) ? Mt(t) : 0;
975
+ }(t) : t instanceof WebGLTexture || D(t) ? Lt(t) : 0;
976
976
  }
977
977
  Ss() {
978
978
  this.Ye.dispose(), this.Ke.dispose(), this.Ze.clear();
979
979
  }
980
980
  }
981
- class Me {
981
+ class Le {
982
982
  constructor() {
983
983
  o(this, "ti", []);
984
984
  o(this, "si", 1);
@@ -1043,7 +1043,7 @@ class Fe {
1043
1043
  o(this, "wi", [0, 0, 0, 0]);
1044
1044
  o(this, "bi", 1);
1045
1045
  o(this, "Ci", new Float32Array(4));
1046
- this.$ = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.ui = new lt(), this.li = new Te(t), this.fi = new Me(), this.ci = new xe(t), this.di = new le(t);
1046
+ this.$ = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.ui = new lt(), this.li = new Me(t), this.fi = new Le(), this.ci = new xe(t), this.di = new le(t);
1047
1047
  const e = [0, 0, t.canvas.width, t.canvas.height];
1048
1048
  ft(t, e), this.mi.push(null), this._i.push(e), this.yi.push(1), this.Ai = null, this.wi = e, this.bi = 1;
1049
1049
  }
@@ -1064,7 +1064,7 @@ class Fe {
1064
1064
  this.Ie !== t && (this.Ie = t, t.dt());
1065
1065
  }
1066
1066
  Mi(t, e) {
1067
- return new K(this.$, t, e);
1067
+ return new j(this.$, t, e);
1068
1068
  }
1069
1069
  Fi(t) {
1070
1070
  this.pi = t, t && (this.gi = {});
@@ -1079,7 +1079,7 @@ class Fe {
1079
1079
  Object.assign(this.gi, t);
1080
1080
  }
1081
1081
  Pi(t) {
1082
- return new K(this.$, ht, t);
1082
+ return new j(this.$, ht, t);
1083
1083
  }
1084
1084
  Ti(t, e, i, s) {
1085
1085
  t instanceof vt || !s || t.Si(s), this.fi.ii({ width: e ?? t.width, height: i ?? t.height }, this.ui, t.V());
@@ -1093,22 +1093,22 @@ class Fe {
1093
1093
  this.fi.ii({ width: t, height: e }, this.ui, i);
1094
1094
  } else this.fi.ii({ width: t, height: e }, this.ui, this.li.Ve);
1095
1095
  }
1096
- Ri(t, e, i, s) {
1096
+ Li(t, e, i, s) {
1097
1097
  this.fi.ri({ x1: t, y1: e, x2: i, y2: s }, this.ui, this.li.Ve);
1098
1098
  }
1099
- Di(t, e) {
1099
+ Ri(t, e) {
1100
1100
  this.fi.ni({ width: t, height: e }, this.ui, this.li.Ve);
1101
1101
  }
1102
- Li(t, e, i, s, r, h) {
1102
+ Di(t, e, i, s, r, h) {
1103
1103
  this.fi.oi({ x1: t, y1: e, x2: i, y2: s, x3: r, y3: h }, this.ui, this.li.Ve);
1104
1104
  }
1105
1105
  Oi(t, e, i, s, r, h, a, l) {
1106
1106
  this.fi.ai({ x1: t, y1: e, cp1x: i, cp1y: s, cp2x: r, cp2y: h, x2: a, y2: l }, this.ui, this.li.Ve);
1107
1107
  }
1108
- zi(t, e, i, s) {
1108
+ Hi(t, e, i, s) {
1109
1109
  this.fi.hi({ width: t, height: e, start: i, stop: s }, this.ui, this.li.Ve);
1110
1110
  }
1111
- Hi(t, e, i = 1, s = {}) {
1111
+ zi(t, e, i = 1, s = {}) {
1112
1112
  return new vt(this.$, t, e, i, s, this);
1113
1113
  }
1114
1114
  Bi(t, e = t, i = t, s = 255) {
@@ -1147,13 +1147,13 @@ class Fe {
1147
1147
  return this.li;
1148
1148
  }
1149
1149
  }
1150
- const M = { readShort: (n, t) => (M.t.uint16[0] = n[t] << 8 | n[t + 1], M.t.int16[0]), readUshort: (n, t) => n[t] << 8 | n[t + 1], readUshorts(n, t, e) {
1150
+ const L = { readShort: (n, t) => (L.t.uint16[0] = n[t] << 8 | n[t + 1], L.t.int16[0]), readUshort: (n, t) => n[t] << 8 | n[t + 1], readUshorts(n, t, e) {
1151
1151
  const i = [];
1152
- for (let s = 0; s < e; s++) i.push(M.readUshort(n, t + 2 * s));
1152
+ for (let s = 0; s < e; s++) i.push(L.readUshort(n, t + 2 * s));
1153
1153
  return i;
1154
1154
  }, readUint(n, t) {
1155
- const e = M.t.uint8;
1156
- return e[3] = n[t], e[2] = n[t + 1], e[1] = n[t + 2], e[0] = n[t + 3], M.t.uint32[0];
1155
+ const e = L.t.uint8;
1156
+ return e[3] = n[t], e[2] = n[t + 1], e[1] = n[t + 2], e[0] = n[t + 3], L.t.uint32[0];
1157
1157
  }, readASCII(n, t, e) {
1158
1158
  let i = "";
1159
1159
  for (let s = 0; s < e; s++) i += String.fromCharCode(n[t + s]);
@@ -1162,13 +1162,13 @@ const M = { readShort: (n, t) => (M.t.uint16[0] = n[t] << 8 | n[t + 1], M.t.int1
1162
1162
  const n = new ArrayBuffer(8);
1163
1163
  return { uint8: new Uint8Array(n), int16: new Int16Array(n), uint16: new Uint16Array(n), uint32: new Uint32Array(n) };
1164
1164
  })() };
1165
- function q(n) {
1165
+ function K(n) {
1166
1166
  return n + 3 & -4;
1167
1167
  }
1168
1168
  function J(n, t, e) {
1169
1169
  n[t] = e >>> 8 & 255, n[t + 1] = 255 & e;
1170
1170
  }
1171
- function L(n, t, e) {
1171
+ function _(n, t, e) {
1172
1172
  n[t] = e >>> 24 & 255, n[t + 1] = e >>> 16 & 255, n[t + 2] = e >>> 8 & 255, n[t + 3] = 255 & e;
1173
1173
  }
1174
1174
  function Ce(n, t, e) {
@@ -1177,11 +1177,11 @@ function Ce(n, t, e) {
1177
1177
  function dt(n, t, e) {
1178
1178
  const i = t + e;
1179
1179
  let s = 0;
1180
- const r = M.t;
1180
+ const r = L.t;
1181
1181
  for (let h = t; h < i; h += 4) r.uint8[3] = n[h] || 0, r.uint8[2] = n[h + 1] || 0, r.uint8[1] = n[h + 2] || 0, r.uint8[0] = n[h + 3] || 0, s = s + (r.uint32[0] >>> 0) >>> 0;
1182
1182
  return s >>> 0;
1183
1183
  }
1184
- class Se {
1184
+ class Re {
1185
1185
  constructor(t) {
1186
1186
  o(this, "b");
1187
1187
  o(this, "p", 0);
@@ -1241,7 +1241,7 @@ function Pe(n, t) {
1241
1241
  for (let i = 0; i < t; i++) e = e << 1 | 1 & n, n >>>= 1;
1242
1242
  return e >>> 0;
1243
1243
  }
1244
- function Oe(n) {
1244
+ function Se(n) {
1245
1245
  if (n.length < 2) throw Error("ZLIB data too short");
1246
1246
  const t = n[0], e = n[1];
1247
1247
  if ((15 & t) != 8) throw Error("Unsupported ZLIB compression method");
@@ -1272,28 +1272,28 @@ function Oe(n) {
1272
1272
  for (let m = 280; m <= 287; m++) d[m] = 8;
1273
1273
  p = G(d), v = G(Array(32).fill(5));
1274
1274
  } else {
1275
- const d = r.readBits(5) + 257, m = r.readBits(5) + 1, A = r.readBits(4) + 4, b = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], y = Array(19).fill(0);
1276
- for (let T = 0; T < A; T++) y[b[T]] = r.readBits(3);
1277
- const R = G(y), w = [];
1278
- for (; w.length < d + m; ) {
1279
- const T = gt(r, R);
1280
- if (T <= 15) w.push(T);
1281
- else if (T === 16) {
1282
- const U = r.readBits(2) + 3, C = w[w.length - 1] || 0;
1283
- for (let Q = 0; Q < U; Q++) w.push(C);
1284
- } else if (T === 17) {
1285
- const U = r.readBits(3) + 3;
1286
- for (let C = 0; C < U; C++) w.push(0);
1275
+ const d = r.readBits(5) + 257, m = 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);
1276
+ for (let M = 0; M < A; M++) y[w[M]] = r.readBits(3);
1277
+ const T = G(y), b = [];
1278
+ for (; b.length < d + m; ) {
1279
+ const M = gt(r, T);
1280
+ if (M <= 15) b.push(M);
1281
+ else if (M === 16) {
1282
+ const X = r.readBits(2) + 3, C = b[b.length - 1] || 0;
1283
+ for (let $ = 0; $ < X; $++) b.push(C);
1284
+ } else if (M === 17) {
1285
+ const X = r.readBits(3) + 3;
1286
+ for (let C = 0; C < X; C++) b.push(0);
1287
1287
  } else {
1288
- if (T !== 18) throw Error("Invalid code length symbol");
1288
+ if (M !== 18) throw Error("Invalid code length symbol");
1289
1289
  {
1290
- const U = r.readBits(7) + 11;
1291
- for (let C = 0; C < U; C++) w.push(0);
1290
+ const X = r.readBits(7) + 11;
1291
+ for (let C = 0; C < X; C++) b.push(0);
1292
1292
  }
1293
1293
  }
1294
1294
  }
1295
- const F = w.slice(0, d), S = w.slice(d, d + m);
1296
- p = G(F), v = G(S);
1295
+ const F = b.slice(0, d), R = b.slice(d, d + m);
1296
+ p = G(F), v = G(R);
1297
1297
  }
1298
1298
  for (; ; ) {
1299
1299
  const d = gt(r, p);
@@ -1303,37 +1303,37 @@ function Oe(n) {
1303
1303
  if (d > 256 && d < 286) {
1304
1304
  const m = d - 257;
1305
1305
  let A = a[m];
1306
- const b = l[m];
1307
- b && (A += r.readBits(b));
1306
+ const w = l[m];
1307
+ w && (A += r.readBits(w));
1308
1308
  const y = gt(r, v);
1309
1309
  if (y >= 30) throw Error("Invalid distance symbol");
1310
- let R = u[y];
1311
- const w = c[y];
1312
- w && (R += r.readBits(w));
1313
- const F = h.length - R;
1310
+ let T = u[y];
1311
+ const b = c[y];
1312
+ b && (T += r.readBits(b));
1313
+ const F = h.length - T;
1314
1314
  if (F < 0) throw Error("Invalid distance");
1315
- for (let S = 0; S < A; S++) h.push(h[F + S] || 0);
1315
+ for (let R = 0; R < A; R++) h.push(h[F + R] || 0);
1316
1316
  } else if (d === 286 || d === 287) throw Error("Reserved length symbol");
1317
1317
  }
1318
1318
  }
1319
1319
  }
1320
1320
  }
1321
1321
  }
1322
- }(new Se(n.subarray(i)), s), new Uint8Array(s);
1322
+ }(new Re(n.subarray(i)), s), new Uint8Array(s);
1323
1323
  }
1324
- function Xe(n) {
1325
- const t = M, e = new Uint8Array(n);
1324
+ function Oe(n) {
1325
+ const t = L, e = new Uint8Array(n);
1326
1326
  if (t.readASCII(e, 0, 4) !== "wOFF") throw Error("Invalid WOFF signature");
1327
1327
  const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), h = [];
1328
1328
  let a = 44;
1329
1329
  for (let A = 0; A < s; A++) {
1330
- const b = t.readASCII(e, a, 4), y = t.readUint(e, a + 4), R = t.readUint(e, a + 8), w = t.readUint(e, a + 12), F = t.readUint(e, a + 16);
1331
- h.push({ tag: b, offset: y, compLength: R, origLength: w, checksum: F }), a += 20;
1330
+ const w = t.readASCII(e, a, 4), y = t.readUint(e, a + 4), T = t.readUint(e, a + 8), b = t.readUint(e, a + 12), F = t.readUint(e, a + 16);
1331
+ h.push({ tag: w, offset: y, compLength: T, origLength: b, checksum: F }), a += 20;
1332
1332
  }
1333
1333
  for (const A of h) {
1334
- const b = new Uint8Array(e.buffer, A.offset, A.compLength);
1335
- if (A.compLength === A.origLength) A.data = new Uint8Array(b);
1336
- else if (A.data = Oe(b), A.data.length !== A.origLength) if (A.data.length < A.origLength) {
1334
+ const w = new Uint8Array(e.buffer, A.offset, A.compLength);
1335
+ if (A.compLength === A.origLength) A.data = new Uint8Array(w);
1336
+ else if (A.data = Se(w), A.data.length !== A.origLength) if (A.data.length < A.origLength) {
1337
1337
  const y = new Uint8Array(A.origLength);
1338
1338
  y.set(A.data), A.data = y;
1339
1339
  } else A.data = A.data.subarray(0, A.origLength);
@@ -1344,39 +1344,39 @@ function Xe(n) {
1344
1344
  const f = 16 * u, g = 16 * l - f;
1345
1345
  let p = 12 + 16 * l;
1346
1346
  const v = {};
1347
- for (const A of h) v[A.tag] = p, p = q(p + A.data.length);
1347
+ for (const A of h) v[A.tag] = p, p = K(p + A.data.length);
1348
1348
  const d = new Uint8Array(Math.max(r || 0, p));
1349
- L(d, 0, i), J(d, 4, l), J(d, 6, f), J(d, 8, c), J(d, 10, g);
1349
+ _(d, 0, i), J(d, 4, l), J(d, 6, f), J(d, 8, c), J(d, 10, g);
1350
1350
  let m = 12;
1351
1351
  for (const A of h) {
1352
1352
  Ce(d, m, A.tag), m += 4;
1353
- const b = A.data;
1354
- if (A.tag === "head" && b.length >= 12) {
1355
- const y = new Uint8Array(b);
1356
- L(y, 8, 0), L(d, m, dt(y, 0, q(y.length))), m += 4;
1353
+ const w = A.data;
1354
+ if (A.tag === "head" && w.length >= 12) {
1355
+ const y = new Uint8Array(w);
1356
+ _(y, 8, 0), _(d, m, dt(y, 0, K(y.length))), m += 4;
1357
1357
  } else
1358
- L(d, m, dt(b, 0, q(b.length))), m += 4;
1359
- L(d, m, v[A.tag]), m += 4, L(d, m, A.data.length), m += 4;
1358
+ _(d, m, dt(w, 0, K(w.length))), m += 4;
1359
+ _(d, m, v[A.tag]), m += 4, _(d, m, A.data.length), m += 4;
1360
1360
  }
1361
1361
  for (const A of h) {
1362
- const b = v[A.tag];
1363
- d.set(A.data, b);
1362
+ const w = v[A.tag];
1363
+ d.set(A.data, w);
1364
1364
  }
1365
1365
  if (h.find((A) => A.tag === "head")) {
1366
- const A = v.head, b = function(y, R) {
1367
- const w = R + 8, F = [y[w], y[w + 1], y[w + 2], y[w + 3]];
1368
- L(y, w, 0);
1369
- const S = 2981146554 - (dt(y, 0, q(y.length)) >>> 0) >>> 0;
1370
- return y[w] = F[0], y[w + 1] = F[1], y[w + 2] = F[2], y[w + 3] = F[3], S >>> 0;
1366
+ const A = v.head, w = function(y, T) {
1367
+ const b = T + 8, F = [y[b], y[b + 1], y[b + 2], y[b + 3]];
1368
+ _(y, b, 0);
1369
+ const R = 2981146554 - (dt(y, 0, K(y.length)) >>> 0) >>> 0;
1370
+ return y[b] = F[0], y[b + 1] = F[1], y[b + 2] = F[2], y[b + 3] = F[3], R >>> 0;
1371
1371
  }(d, A);
1372
- L(d, A + 8, b);
1372
+ _(d, A + 8, w);
1373
1373
  }
1374
1374
  return d.buffer;
1375
1375
  }
1376
- const Ue = { parseTab(n, t, e) {
1376
+ const Xe = { parseTab(n, t, e) {
1377
1377
  const i = { tables: [], ids: {}, off: t };
1378
1378
  n = new Uint8Array(n.buffer, t, e), t = 0;
1379
- const s = M, r = s.readUshort;
1379
+ const s = L, r = s.readUshort;
1380
1380
  r(n, t);
1381
1381
  const h = r(n, t += 2);
1382
1382
  t += 2;
@@ -1398,22 +1398,22 @@ const Ue = { parseTab(n, t, e) {
1398
1398
  }
1399
1399
  return i;
1400
1400
  }, parse4(n, t) {
1401
- const e = M, i = e.readUshort, s = e.readUshorts, r = t, h = i(n, t += 2);
1401
+ const e = L, i = e.readUshort, s = e.readUshorts, r = t, h = i(n, t += 2);
1402
1402
  i(n, t += 2);
1403
1403
  const a = i(n, t += 2) >>> 1, l = { format: 4, searchRange: i(n, t += 2), entrySelector: 0, rangeShift: 0, endCount: [], startCount: [], idDelta: [], idRangeOffset: [], glyphIdArray: [] };
1404
1404
  t += 2, l.entrySelector = i(n, t), t += 2, l.rangeShift = i(n, t), t += 2, l.endCount = s(n, t, a), t += 2 * a, t += 2, l.startCount = s(n, t, a), t += 2 * a;
1405
1405
  for (let u = 0; u < a; u++) l.idDelta.push(e.readShort(n, t)), t += 2;
1406
1406
  return l.idRangeOffset = s(n, t, a), t += 2 * a, l.glyphIdArray = s(n, t, r + h - t >> 1), l;
1407
1407
  }, parse12(n, t) {
1408
- const e = M.readUint;
1408
+ const e = L.readUint;
1409
1409
  e(n, t += 4), e(n, t += 4);
1410
1410
  const i = e(n, t += 4);
1411
1411
  t += 4;
1412
1412
  const s = new Uint32Array(3 * i);
1413
1413
  for (let r = 0; r < 3 * i; r += 3) s[r] = e(n, t + (r << 2)), s[r + 1] = e(n, t + (r << 2) + 4), s[r + 2] = e(n, t + (r << 2) + 8);
1414
1414
  return { format: 12, groups: s };
1415
- } }, _e = { parseTab(n, t, e) {
1416
- const i = M;
1415
+ } }, Ue = { parseTab(n, t, e) {
1416
+ const i = L;
1417
1417
  t += 18;
1418
1418
  const s = i.readUshort(n, t);
1419
1419
  t += 2, t += 16;
@@ -1425,22 +1425,22 @@ const Ue = { parseTab(n, t, e) {
1425
1425
  t += 2;
1426
1426
  const l = i.readShort(n, t);
1427
1427
  return t += 2, t += 6, { unitsPerEm: s, xMin: r, yMin: h, xMax: a, yMax: l, indexToLocFormat: i.readShort(n, t) };
1428
- } }, Le = { parseTab(n, t, e) {
1429
- const i = M;
1428
+ } }, _e = { parseTab(n, t, e) {
1429
+ const i = L;
1430
1430
  t += 4;
1431
1431
  const s = i.readShort, r = i.readUshort;
1432
1432
  return { ascender: s(n, t), descender: s(n, t + 2), lineGap: s(n, t + 4), advanceWidthMax: r(n, t + 6), minLeftSideBearing: s(n, t + 8), minRightSideBearing: s(n, t + 10), xMaxExtent: s(n, t + 12), caretSlopeRise: s(n, t + 14), caretSlopeRun: s(n, t + 16), caretOffset: s(n, t + 18), res0: s(n, t + 20), res1: s(n, t + 22), res2: s(n, t + 24), res3: s(n, t + 26), metricDataFormat: s(n, t + 28), numberOfHMetrics: r(n, t + 30) };
1433
- } }, De = { parseTab(n, t, e, i) {
1434
- const s = M, r = [], h = [], a = i.maxp.numGlyphs, l = i.hhea.numberOfHMetrics;
1433
+ } }, Be = { parseTab(n, t, e, i) {
1434
+ const s = L, r = [], h = [], a = i.maxp.numGlyphs, l = i.hhea.numberOfHMetrics;
1435
1435
  let u = 0, c = 0, f = 0;
1436
1436
  for (; f < l; ) u = s.readUshort(n, t + (f << 2)), c = s.readShort(n, t + (f << 2) + 2), r.push(u), h.push(c), f++;
1437
1437
  for (; f < a; ) r.push(u), h.push(c), f++;
1438
1438
  return { aWidth: r, lsBearing: h };
1439
- } }, Ft = { cmap: Ue, head: _e, hhea: Le, maxp: { parseTab(n, t, e) {
1440
- const i = M;
1439
+ } }, Ft = { cmap: Xe, head: Ue, hhea: _e, maxp: { parseTab(n, t, e) {
1440
+ const i = L;
1441
1441
  return i.readUint(n, t), t += 4, { numGlyphs: i.readUshort(n, t) };
1442
- } }, hmtx: De, loca: { parseTab(n, t, e, i) {
1443
- const s = M, r = [], h = i.head.indexToLocFormat, a = i.maxp.numGlyphs + 1;
1442
+ } }, hmtx: Be, loca: { parseTab(n, t, e, i) {
1443
+ const s = L, r = [], h = i.head.indexToLocFormat, a = i.maxp.numGlyphs + 1;
1444
1444
  if (h === 0) for (let l = 0; l < a; l++) r.push(s.readUshort(n, t + (l << 1)) << 1);
1445
1445
  else if (h === 1) for (let l = 0; l < a; l++) r.push(s.readUint(n, t + (l << 2)));
1446
1446
  return r;
@@ -1449,7 +1449,7 @@ const Ue = { parseTab(n, t, e) {
1449
1449
  for (let h = 0; h < r; h++) s.push(null);
1450
1450
  return s;
1451
1451
  }, ji(n, t) {
1452
- const e = M, i = n.Qi, s = n.loca;
1452
+ const e = L, i = n.Qi, s = n.loca;
1453
1453
  if (s[t] === s[t + 1]) return null;
1454
1454
  const r = ct.findTable(i, "glyf", n.Ni);
1455
1455
  if (!r) return null;
@@ -1488,7 +1488,7 @@ const Ue = { parseTab(n, t, e) {
1488
1488
  return a;
1489
1489
  } } }, ct = { parse(n) {
1490
1490
  const t = new Uint8Array(n);
1491
- M.readASCII(t, 0, 4) === "wOFF" && (n = Xe(n));
1491
+ L.readASCII(t, 0, 4) === "wOFF" && (n = Oe(n));
1492
1492
  const e = new Uint8Array(n), i = Ft, s = {}, r = { Qi: e, Xi: 0, Ni: 0 };
1493
1493
  for (const h in i) {
1494
1494
  const a = h, l = ct.findTable(e, a, 0);
@@ -1500,7 +1500,7 @@ const Ue = { parseTab(n, t, e) {
1500
1500
  }
1501
1501
  return [r];
1502
1502
  }, findTable(n, t, e) {
1503
- const i = M, s = i.readUshort(n, e + 4);
1503
+ const i = L, s = i.readUshort(n, e + 4);
1504
1504
  let r = e + 12;
1505
1505
  for (let h = 0; h < s; h++) {
1506
1506
  const a = i.readASCII(n, r, 4);
@@ -1510,8 +1510,8 @@ const Ue = { parseTab(n, t, e) {
1510
1510
  r += 16;
1511
1511
  }
1512
1512
  return null;
1513
- }, T: Ft, B: M };
1514
- function Bt(n, t, e) {
1513
+ }, T: Ft, B: L };
1514
+ function zt(n, t, e) {
1515
1515
  if (n.idRangeOffset[e] === 0) return t + n.idDelta[e] & 65535;
1516
1516
  {
1517
1517
  const i = n.startCount.length, s = n.idRangeOffset[e] / 2 + (t - n.startCount[e]) - (i - e);
@@ -1522,7 +1522,7 @@ function Bt(n, t, e) {
1522
1522
  }
1523
1523
  return 0;
1524
1524
  }
1525
- class Be {
1525
+ class ze {
1526
1526
  Yi(t) {
1527
1527
  var i;
1528
1528
  const e = [];
@@ -1542,7 +1542,7 @@ class Be {
1542
1542
  for (let i = 0; i < t.startCount.length; i++) {
1543
1543
  const s = t.startCount[i], r = t.endCount[i];
1544
1544
  if (s !== 65535 || r !== 65535) for (let h = s; h <= r; h++)
1545
- Bt(t, h, i) > 0 && this.Zi(e, h);
1545
+ zt(t, h, i) > 0 && this.Zi(e, h);
1546
1546
  }
1547
1547
  return e;
1548
1548
  }
@@ -1564,21 +1564,21 @@ class Be {
1564
1564
  }
1565
1565
  }
1566
1566
  }
1567
- class ze {
1567
+ class Ie {
1568
1568
  constructor(t) {
1569
1569
  o(this, "qi");
1570
1570
  o(this, "Vi");
1571
- o(this, "R");
1571
+ o(this, "L");
1572
1572
  o(this, "P", null);
1573
1573
  o(this, "Ji", 0);
1574
1574
  o(this, "tr", 0);
1575
- this.R = t, this.qi = document.createElement("canvas"), this.Vi = this.qi.getContext("2d", { willReadFrequently: !0, alpha: !0 });
1575
+ this.L = t, this.qi = document.createElement("canvas"), this.Vi = this.qi.getContext("2d", { willReadFrequently: !0, alpha: !0 });
1576
1576
  }
1577
1577
  sr(t, e, i, s) {
1578
1578
  const r = t.length;
1579
1579
  this.Ji = Math.ceil(Math.sqrt(r)), this.tr = Math.ceil(r / this.Ji);
1580
1580
  const h = e.width * this.Ji, a = e.height * this.tr;
1581
- this.er(h, a), this.ir(t, e, this.Ji, i, s), this.P ? this.P.width === h && this.P.height === a || this.P.resize(h, a) : this.P = this.R.Hi(h, a, 1, { filter: "nearest" }), this.P.N(this.qi);
1581
+ this.er(h, a), this.ir(t, e, this.Ji, i, s), this.P ? this.P.width === h && this.P.height === a || this.P.resize(h, a) : this.P = this.L.zi(h, a, 1, { filter: "nearest" }), this.P.N(this.qi);
1582
1582
  }
1583
1583
  er(t, e) {
1584
1584
  this.qi.width = t, this.qi.height = e, this.qi.style.width = t + "px", this.qi.style.height = e + "px", this.Vi.imageSmoothingEnabled = !1, this.qi.style.imageRendering = "pixelated", this.Vi.clearRect(0, 0, t, e), this.Vi.textBaseline = "top", this.Vi.textAlign = "left", this.Vi.fillStyle = "white";
@@ -1588,8 +1588,8 @@ class ze {
1588
1588
  for (let a = 0; a < t.length; a++) {
1589
1589
  const l = a % i, u = Math.floor(a / i), c = t[a].glyphData;
1590
1590
  if (!c) continue;
1591
- const f = c.advanceWidth * h, g = l * e.width, p = u * e.height, v = g + 0.5 * e.width, d = p + 0.5 * e.height, m = Math.round(v - 0.5 * e.width), A = Math.round(d - 0.5 * s), b = m + 0.5 * (e.width - f), y = A + r.hhea.ascender * h;
1592
- this.rr(c, b, y, h);
1591
+ const f = c.advanceWidth * h, g = l * e.width, p = u * e.height, v = g + 0.5 * e.width, d = p + 0.5 * e.height, m = Math.round(v - 0.5 * e.width), A = Math.round(d - 0.5 * s), w = m + 0.5 * (e.width - f), y = A + r.hhea.ascender * h;
1592
+ this.rr(c, w, y, h);
1593
1593
  }
1594
1594
  }
1595
1595
  rr(t, e, i, s) {
@@ -1612,21 +1612,21 @@ class ze {
1612
1612
  } else {
1613
1613
  const d = e + r[v] * s, m = i - h[v] * s;
1614
1614
  if (v + 1 > f) {
1615
- const b = e + r[u] * s, y = i - h[u] * s;
1616
- if (1 & l[u]) this.Vi.quadraticCurveTo(d, m, b, y);
1615
+ const w = e + r[u] * s, y = i - h[u] * s;
1616
+ if (1 & l[u]) this.Vi.quadraticCurveTo(d, m, w, y);
1617
1617
  else {
1618
- const R = (d + b) / 2, w = (m + y) / 2;
1619
- this.Vi.quadraticCurveTo(d, m, R, w);
1618
+ const T = (d + w) / 2, b = (m + y) / 2;
1619
+ this.Vi.quadraticCurveTo(d, m, T, b);
1620
1620
  }
1621
1621
  break;
1622
1622
  }
1623
1623
  const A = v + 1;
1624
1624
  if (1 & l[A]) {
1625
- const b = e + r[A] * s, y = i - h[A] * s;
1626
- this.Vi.quadraticCurveTo(d, m, b, y), v = A + 1;
1625
+ const w = e + r[A] * s, y = i - h[A] * s;
1626
+ this.Vi.quadraticCurveTo(d, m, w, y), v = A + 1;
1627
1627
  } else {
1628
- const b = (d + (e + r[A] * s)) / 2, y = (m + (i - h[A] * s)) / 2;
1629
- this.Vi.quadraticCurveTo(d, m, b, y), v = A;
1628
+ const w = (d + (e + r[A] * s)) / 2, y = (m + (i - h[A] * s)) / 2;
1629
+ this.Vi.quadraticCurveTo(d, m, w, y), v = A;
1630
1630
  }
1631
1631
  }
1632
1632
  this.Vi.closePath();
@@ -1650,7 +1650,7 @@ class ze {
1650
1650
  return this.tr;
1651
1651
  }
1652
1652
  }
1653
- class zt {
1653
+ class It {
1654
1654
  nr(t, e) {
1655
1655
  const i = t.cmap;
1656
1656
  if (!i || !i.tables) return 0;
@@ -1677,7 +1677,7 @@ class zt {
1677
1677
  s = r;
1678
1678
  break;
1679
1679
  }
1680
- return s === -1 || t < e.startCount[s] ? 0 : Bt(e, t, s);
1680
+ return s === -1 || t < e.startCount[s] ? 0 : zt(e, t, s);
1681
1681
  }
1682
1682
  ar(t, e) {
1683
1683
  const i = e.groups.length / 3;
@@ -1688,10 +1688,10 @@ class zt {
1688
1688
  return 0;
1689
1689
  }
1690
1690
  }
1691
- class Ie {
1691
+ class De {
1692
1692
  constructor() {
1693
1693
  o(this, "dr");
1694
- this.dr = new zt();
1694
+ this.dr = new It();
1695
1695
  }
1696
1696
  pr(t, e, i) {
1697
1697
  let s = 0;
@@ -1708,7 +1708,7 @@ class Ie {
1708
1708
  class Ne {
1709
1709
  constructor() {
1710
1710
  o(this, "vr");
1711
- this.vr = new zt();
1711
+ this.vr = new It();
1712
1712
  }
1713
1713
  gr(t, e) {
1714
1714
  const i = [], s = /* @__PURE__ */ new Map();
@@ -1727,7 +1727,7 @@ class Ne {
1727
1727
  return h ? { ...h, advanceWidth: r } : null;
1728
1728
  }
1729
1729
  }
1730
- class Y extends at {
1730
+ class k extends at {
1731
1731
  constructor(e, i = 16) {
1732
1732
  super();
1733
1733
  o(this, "yr");
@@ -1741,25 +1741,25 @@ class Y extends at {
1741
1741
  o(this, "Pr");
1742
1742
  o(this, "Tr");
1743
1743
  o(this, "Sr", !1);
1744
- this.br = i, this.Fr = new Be(), this.$r = new ze(e), this.Pr = new Ie(), this.Tr = new Ne();
1744
+ this.br = i, this.Fr = new ze(), this.$r = new Ie(e), this.Pr = new De(), this.Tr = new Ne();
1745
1745
  }
1746
1746
  async Er(e) {
1747
1747
  if (this.Sr) return;
1748
1748
  const i = e || "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==", s = await this.kr(i);
1749
- await this.Rr(s);
1749
+ await this.Lr(s);
1750
1750
  }
1751
- Dr(e) {
1751
+ Rr(e) {
1752
1752
  if (e === void 0) return this.br;
1753
- this.br = e, this.Lr();
1753
+ this.br = e, this.Dr();
1754
1754
  }
1755
- Lr() {
1755
+ Dr() {
1756
1756
  const e = this.Ar.map((i) => i.character);
1757
1757
  this.Cr = this.Pr.pr(e, this.br, this.yr), this.$r.sr(this.Ar, this.Cr, this.br, this.yr);
1758
1758
  }
1759
1759
  async Or(e) {
1760
1760
  try {
1761
1761
  const i = await this.kr(e);
1762
- await this.Rr(i);
1762
+ await this.Lr(i);
1763
1763
  } catch (i) {
1764
1764
  throw new P("Failed to load font: " + (i instanceof Error ? i.message : "Unknown error"), { originalError: i });
1765
1765
  }
@@ -1769,20 +1769,20 @@ class Y extends at {
1769
1769
  if (!i.ok) throw new P(`Failed to load font file: ${i.status} ${i.statusText}`);
1770
1770
  return i.arrayBuffer();
1771
1771
  }
1772
- async Rr(e) {
1773
- await this.zr(e);
1772
+ async Lr(e) {
1773
+ await this.Hr(e);
1774
1774
  const i = ct.parse(e);
1775
1775
  if (!i || i.length === 0) throw Error("Failed to parse font file");
1776
- this.yr = i[0], await this.Hr();
1776
+ this.yr = i[0], await this.zr();
1777
1777
  }
1778
- async zr(e) {
1778
+ async Hr(e) {
1779
1779
  this.Mr && document.fonts.delete(this.Mr);
1780
1780
  const i = Date.now();
1781
1781
  this.Mr = new FontFace("CustomFont_" + i, e), await this.Mr.load(), document.fonts.add(this.Mr);
1782
1782
  }
1783
- async Hr() {
1783
+ async zr() {
1784
1784
  const e = this.Fr.Yi(this.yr), { array: i, map: s } = this.Tr.gr(e, this.yr);
1785
- this.Ar = i, this.wr = s, this.Lr(), this.Sr = !0;
1785
+ this.Ar = i, this.wr = s, this.Dr(), this.Sr = !0;
1786
1786
  }
1787
1787
  Br(e) {
1788
1788
  const i = this.wr.get(e);
@@ -1825,7 +1825,7 @@ class Y extends at {
1825
1825
  return this.yr;
1826
1826
  }
1827
1827
  }
1828
- class Ye {
1828
+ class ke {
1829
1829
  constructor(t, e, i) {
1830
1830
  o(this, "jr");
1831
1831
  o(this, "tr");
@@ -1889,6 +1889,7 @@ class Ye {
1889
1889
  this.Wr = !1;
1890
1890
  }
1891
1891
  sn(t, e) {
1892
+ if (!(this.Xr instanceof HTMLCanvasElement)) return { x: -1 / 0, y: -1 / 0 };
1892
1893
  const i = this.Xr.getBoundingClientRect(), s = t - i.left, r = e - i.top, h = this.Xr.width / i.width, a = r * (this.Xr.height / i.height), l = s * h - this.Qr, u = a - this.Nr, c = Math.floor(l / this.Yr), f = Math.floor(u / this.Kr);
1893
1894
  return c >= 0 && c < this.jr && f >= 0 && f < this.tr ? { x: c - Math.floor((this.jr - 1) / 2), y: f - Math.floor(this.tr / 2) } : { x: -1 / 0, y: -1 / 0 };
1894
1895
  }
@@ -1899,26 +1900,26 @@ class Ye {
1899
1900
  function tt(n) {
1900
1901
  return parseInt(n, 16);
1901
1902
  }
1902
- const ke = /^rgba?\(([^)]+)\)$/i;
1903
- function B(n) {
1904
- return Number.isNaN(n = Math.round(n)) ? 0 : _(n, 0, 255);
1903
+ const Ye = /^rgba?\(([^)]+)\)$/i;
1904
+ function z(n) {
1905
+ return Number.isNaN(n = Math.round(n)) ? 0 : U(n, 0, 255);
1905
1906
  }
1906
- function It(n, t = !1) {
1907
+ function Dt(n, t = !1) {
1907
1908
  if (!n) return null;
1908
1909
  const e = n.trim().toLowerCase();
1909
1910
  if (!e) return null;
1910
1911
  let i = null;
1911
1912
  return e.startsWith("rgb") && (i = function(s) {
1912
- const r = ke.exec(s.trim());
1913
+ const r = Ye.exec(s.trim());
1913
1914
  if (!r) return null;
1914
1915
  const h = r[1].split(",").map((f) => f.trim());
1915
1916
  if (h.length < 3) return null;
1916
- const a = B(parseFloat(h[0])), l = B(parseFloat(h[1])), u = B(parseFloat(h[2]));
1917
+ const a = z(parseFloat(h[0])), l = z(parseFloat(h[1])), u = z(parseFloat(h[2]));
1917
1918
  let c = 255;
1918
1919
  if (h[3] !== void 0) {
1919
1920
  const f = h[3].trim();
1920
1921
  let g = parseFloat(f);
1921
- f.endsWith("%") && (g /= 100), c = 255 * _(g, 0, 1);
1922
+ f.endsWith("%") && (g /= 100), c = 255 * U(g, 0, 1);
1922
1923
  }
1923
1924
  return [a, l, u, Math.round(c)];
1924
1925
  }(e)), i && (t || i[3] !== 0) ? i : null;
@@ -1935,10 +1936,10 @@ class He {
1935
1936
  if (this.rn = t.overlay ?? !1, t.gl) this.hn = t.gl, this.Xr = t.gl.canvas, this.nn = !1, this.an = !1;
1936
1937
  else if (this.rn && t.canvas) this.en = t.canvas, this.Xr = this.cn(), this.nn = !0, this.ln();
1937
1938
  else if (t.canvas) {
1938
- if (t.canvas instanceof HTMLVideoElement) throw new P("Video elements are only supported in overlay mode.");
1939
+ if (typeof HTMLVideoElement < "u" && t.canvas instanceof HTMLVideoElement) throw new P("Video elements are only supported in overlay mode.");
1939
1940
  this.Xr = t.canvas, this.nn = !1;
1940
1941
  } else this.Xr = this.un(t.width, t.height), this.nn = !0;
1941
- this.Xr.style.imageRendering = "pixelated";
1942
+ typeof HTMLCanvasElement < "u" && this.Xr instanceof HTMLCanvasElement && (this.Xr.style.imageRendering = "pixelated");
1942
1943
  }
1943
1944
  un(t, e) {
1944
1945
  const i = document.createElement("canvas");
@@ -1949,7 +1950,7 @@ class He {
1949
1950
  t.className = "textmodeCanvas", t.style.imageRendering = "pixelated";
1950
1951
  const e = this.en.getBoundingClientRect();
1951
1952
  let i = Math.round(e.width), s = Math.round(e.height);
1952
- if (this.en instanceof HTMLVideoElement) {
1953
+ if (typeof HTMLVideoElement < "u" && this.en instanceof HTMLVideoElement) {
1953
1954
  const a = this.en;
1954
1955
  (i === 0 || s === 0) && a.videoWidth > 0 && a.videoHeight > 0 && (i = a.videoWidth, s = a.videoHeight);
1955
1956
  }
@@ -1960,25 +1961,24 @@ class He {
1960
1961
  }
1961
1962
  ln() {
1962
1963
  var t;
1963
- this.fn(), (t = this.en.parentNode) == null || t.insertBefore(this.Xr, this.en.nextSibling);
1964
+ this.fn(), this.Xr instanceof HTMLCanvasElement && ((t = this.en.parentNode) == null || t.insertBefore(this.Xr, this.en.nextSibling));
1964
1965
  }
1965
1966
  dn() {
1966
1967
  const t = [];
1967
- return this.rn && this.en instanceof HTMLElement && (t.push(this.en), this.en.parentElement && t.push(this.en.parentElement)), this.Xr.parentElement && t.push(this.Xr.parentElement), t.push(this.Xr), t.push(document.body), t.push(document.documentElement), t;
1968
+ return this.rn && this.en instanceof HTMLElement && (t.push(this.en), this.en.parentElement && t.push(this.en.parentElement)), this.Xr instanceof HTMLCanvasElement && (this.Xr.parentElement && t.push(this.Xr.parentElement), t.push(this.Xr)), t.push(document.body), t.push(document.documentElement), t;
1968
1969
  }
1969
1970
  pn() {
1970
1971
  const t = this.dn();
1971
1972
  for (const e of t) {
1972
1973
  if (!e) continue;
1973
- const i = It(window.getComputedStyle(e).backgroundColor);
1974
+ const i = Dt(window.getComputedStyle(e).backgroundColor);
1974
1975
  if (i) return i;
1975
1976
  }
1976
1977
  return [255, 255, 255, 255];
1977
1978
  }
1978
1979
  fn() {
1979
- if (!this.en) return;
1980
- const t = this.en.getBoundingClientRect();
1981
- let e = this.en.offsetParent;
1980
+ if (!this.en || !(this.Xr instanceof HTMLCanvasElement)) return;
1981
+ const t = this.en.getBoundingClientRect(), e = this.en.offsetParent;
1982
1982
  if (e && e !== document.body) {
1983
1983
  const i = e.getBoundingClientRect();
1984
1984
  this.Xr.style.top = t.top - i.top + "px", this.Xr.style.left = t.left - i.left + "px";
@@ -2003,7 +2003,7 @@ class He {
2003
2003
  const e = t.getExtension("WEBGL_lose_context");
2004
2004
  e == null || e.loseContext();
2005
2005
  }
2006
- this.nn && this.Xr.parentNode && this.Xr.parentNode.removeChild(this.Xr);
2006
+ this.nn && typeof HTMLCanvasElement < "u" && this.Xr instanceof HTMLCanvasElement && this.Xr.parentNode && this.Xr.parentNode.removeChild(this.Xr);
2007
2007
  }
2008
2008
  get canvas() {
2009
2009
  return this.Xr;
@@ -2029,7 +2029,7 @@ class E {
2029
2029
  o(this, "g");
2030
2030
  o(this, "b");
2031
2031
  o(this, "a");
2032
- this.r = B(t), this.g = B(e), this.b = B(i), this.a = B(s);
2032
+ this.r = z(t), this.g = z(e), this.b = z(i), this.a = z(s);
2033
2033
  }
2034
2034
  static yn(t, e, i, s) {
2035
2035
  if (E.An(t)) return t;
@@ -2041,7 +2041,7 @@ class E {
2041
2041
  if (typeof t == "string") {
2042
2042
  const r = t.trim();
2043
2043
  if (r.length === 0) throw Error("Color strings cannot be empty.");
2044
- const h = It(r, !0);
2044
+ const h = Dt(r, !0);
2045
2045
  return h ? E.wn(...h) : E.bn(r);
2046
2046
  }
2047
2047
  if (typeof t == "number") return typeof e == "number" && typeof i == "number" ? E.wn(t, e, i, s ?? 255) : typeof e == "number" ? E.Cn(t, e) : E.Cn(t, s ?? 255);
@@ -2086,29 +2086,29 @@ class Et extends at {
2086
2086
  constructor(e, i, s, r, h, a, l, u) {
2087
2087
  super();
2088
2088
  o(this, "$");
2089
- o(this, "R");
2089
+ o(this, "L");
2090
2090
  o(this, "Mn");
2091
2091
  o(this, "Fn");
2092
2092
  o(this, "$n");
2093
2093
  o(this, "M");
2094
2094
  o(this, "F");
2095
- o(this, "D", null);
2095
+ o(this, "R", null);
2096
2096
  o(this, "Pn", null);
2097
2097
  o(this, "Tn", "brightness");
2098
2098
  o(this, "Sn", null);
2099
2099
  o(this, "En");
2100
- o(this, "Rt", 0);
2100
+ o(this, "Lt", 0);
2101
2101
  o(this, "Gt", 0);
2102
2102
  o(this, "jt", 0);
2103
- o(this, "Dt", 0);
2103
+ o(this, "Rt", 0);
2104
2104
  o(this, "kn", "sampled");
2105
- o(this, "Rn", "fixed");
2105
+ o(this, "Ln", "fixed");
2106
2106
  o(this, "Xt", [1, 1, 1, 1]);
2107
2107
  o(this, "Yt", [0, 0, 0, 1]);
2108
- o(this, "Dn", [0, 0, 0, 1]);
2109
- o(this, "Ln", [[0.1, 0, 0]]);
2108
+ o(this, "Rn", [0, 0, 0, 1]);
2109
+ o(this, "Dn", [[0.1, 0, 0]]);
2110
2110
  o(this, "Nt", null);
2111
- this.$ = e, this.R = i, this.Mn = s, this.En = r, this.Fn = h, this.$n = a;
2111
+ this.$ = e, this.L = i, this.Mn = s, this.En = r, this.Fn = h, this.$n = a;
2112
2112
  const { width: c, height: f } = function(g, p, v, d) {
2113
2113
  const m = Math.min(v / g, d / p);
2114
2114
  return { width: Math.max(1, Math.floor(g * m)), height: Math.max(1, Math.floor(p * m)), scale: m };
@@ -2116,43 +2116,43 @@ class Et extends at {
2116
2116
  this.M = c, this.F = f;
2117
2117
  }
2118
2118
  conversionMode(e) {
2119
- return this.Tn = e, this.Sn = null, this.D = null, this;
2119
+ return this.Tn = e, this.Sn = null, this.R = null, this;
2120
2120
  }
2121
2121
  dispose() {
2122
2122
  this.Mn && (this.$.deleteTexture(this.Mn), this.Mn = null), super.dispose();
2123
2123
  }
2124
2124
  invert(e = !0) {
2125
- return this.Rt = e ? 1 : 0, this.D = null, this;
2125
+ return this.Lt = e ? 1 : 0, this.R = null, this;
2126
2126
  }
2127
2127
  flipX(e = !0) {
2128
- return this.Gt = e ? 1 : 0, this.D = null, this;
2128
+ return this.Gt = e ? 1 : 0, this.R = null, this;
2129
2129
  }
2130
2130
  flipY(e = !0) {
2131
- return this.jt = e ? 1 : 0, this.D = null, this;
2131
+ return this.jt = e ? 1 : 0, this.R = null, this;
2132
2132
  }
2133
2133
  charRotation(e) {
2134
- return this.Dt = St(e), this.D = null, this;
2134
+ return this.Rt = Rt(e), this.R = null, this;
2135
2135
  }
2136
2136
  charColorMode(e) {
2137
- return this.kn = e, this.D = null, this;
2137
+ return this.kn = e, this.R = null, this;
2138
2138
  }
2139
2139
  cellColorMode(e) {
2140
- return this.Rn = e, this.D = null, this;
2140
+ return this.Ln = e, this.R = null, this;
2141
2141
  }
2142
2142
  charColor(e, i, s, r) {
2143
- return this.On(this.Xt, e, i, s, r), this.D = null, this;
2143
+ return this.On(this.Xt, e, i, s, r), this.R = null, this;
2144
2144
  }
2145
2145
  cellColor(e, i, s, r) {
2146
- return this.On(this.Yt, e, i, s, r), this.D = null, this;
2146
+ return this.On(this.Yt, e, i, s, r), this.R = null, this;
2147
2147
  }
2148
2148
  background(e, i, s, r) {
2149
- return this.On(this.Dn, e, i, s, r), this.D = null, this;
2149
+ return this.On(this.Rn, e, i, s, r), this.R = null, this;
2150
2150
  }
2151
2151
  characters(e) {
2152
- return this.Nt = e, this.zn(e), this.D = null, this;
2152
+ return this.Nt = e, this.Hn(e), this.R = null, this;
2153
2153
  }
2154
2154
  Si(e) {
2155
- this.Pn !== e && (this.Pn = e, this.Nt && this.zn(this.Nt), this.D = null);
2155
+ this.Pn !== e && (this.Pn = e, this.Nt && this.Hn(this.Nt), this.R = null);
2156
2156
  }
2157
2157
  get texture() {
2158
2158
  return this.Mn;
@@ -2170,29 +2170,29 @@ class Et extends at {
2170
2170
  return this.$n;
2171
2171
  }
2172
2172
  V() {
2173
- return this.D || this.J(), this.D;
2173
+ return this.R || this.J(), this.R;
2174
2174
  }
2175
- Hn() {
2175
+ zn() {
2176
2176
  }
2177
2177
  Bn() {
2178
2178
  return this.Mn;
2179
2179
  }
2180
2180
  J() {
2181
- this.Hn();
2181
+ this.zn();
2182
2182
  const e = this.In(), i = this.Gn(), s = this.En.jn(this.Tn, i), r = e.createUniforms(i);
2183
- this.D = this.R.materialManager.st(s, r);
2183
+ this.R = this.L.materialManager.st(s, r);
2184
2184
  }
2185
2185
  On(e, i, s, r, h) {
2186
2186
  const a = E.yn(i, s, r, h);
2187
2187
  it(e, a.r, a.g, a.b, a.a);
2188
2188
  }
2189
- zn(e) {
2189
+ Hn(e) {
2190
2190
  if (!this.Pn) return;
2191
2191
  const i = this.Pn.Ir(e).filter((s) => Array.isArray(s)).slice(0, 255);
2192
- this.Ln = i.length > 0 ? i : this.Ln;
2192
+ this.Dn = i.length > 0 ? i : this.Dn;
2193
2193
  }
2194
2194
  createBaseConversionUniforms() {
2195
- return { u_image: this.Bn(), u_invert: !!this.Rt, u_flipX: !!this.Gt, u_flipY: !!this.jt, u_charRotation: this.Dt, u_charColorFixed: this.kn === "fixed", u_charColor: this.Xt, u_cellColorFixed: this.Rn === "fixed", u_cellColor: this.Yt, u_backgroundColor: this.Dn, u_charCount: this.Ln.length, u_charList: this.Ln };
2195
+ return { u_image: this.Bn(), u_invert: !!this.Lt, u_flipX: !!this.Gt, u_flipY: !!this.jt, u_charRotation: this.Rt, u_charColorFixed: this.kn === "fixed", u_charColor: this.Xt, u_cellColorFixed: this.Ln === "fixed", u_cellColor: this.Yt, u_backgroundColor: this.Rn, u_charCount: this.Dn.length, u_charList: this.Dn };
2196
2196
  }
2197
2197
  In() {
2198
2198
  if (this.Sn && this.Sn.id === this.Tn) return this.Sn;
@@ -2202,7 +2202,7 @@ class Et extends at {
2202
2202
  }
2203
2203
  Gn() {
2204
2204
  if (!this.Pn) throw Error("[textmode.js] Cannot create conversion context: no active font set. Ensure $setActiveFont() is called before rendering.");
2205
- return { renderer: this.R, gl: this.$, font: this.Pn, source: this };
2205
+ return { renderer: this.L, gl: this.$, font: this.Pn, source: this };
2206
2206
  }
2207
2207
  }
2208
2208
  class V extends Et {
@@ -2210,7 +2210,7 @@ class V extends Et {
2210
2210
  super(t, e, i, s, r, h, a, l);
2211
2211
  }
2212
2212
  static Nn(t, e, i, s, r) {
2213
- const h = t.context, a = bt(h, i), { width: l, height: u } = wt(i);
2213
+ const h = t.context, a = wt(h, i), { width: l, height: u } = bt(i);
2214
2214
  return new V(h, t, a, e, l, u, s, r);
2215
2215
  }
2216
2216
  }
@@ -2300,10 +2300,10 @@ class Nt {
2300
2300
  return this.sh;
2301
2301
  }
2302
2302
  }
2303
- function Yt(n, t, e) {
2303
+ function kt(n, t, e) {
2304
2304
  return n ? n.sn(t, e) : { x: -1 / 0, y: -1 / 0 };
2305
2305
  }
2306
- class kt {
2306
+ class Yt {
2307
2307
  constructor(t, e) {
2308
2308
  o(this, "Xr");
2309
2309
  o(this, "wh");
@@ -2316,262 +2316,259 @@ class kt {
2316
2316
  o(this, "Ph");
2317
2317
  o(this, "Th");
2318
2318
  o(this, "Sh");
2319
- o(this, "Uh");
2320
- o(this, "Eh", !1);
2321
- o(this, "kh");
2319
+ o(this, "Eh");
2320
+ o(this, "kh", !1);
2321
+ o(this, "Lh");
2322
2322
  o(this, "Rh");
2323
2323
  o(this, "Dh");
2324
- o(this, "Lh");
2325
2324
  o(this, "Oh");
2325
+ o(this, "Hh");
2326
2326
  this.Xr = t, this.wh = e;
2327
2327
  }
2328
2328
  zh(t) {
2329
2329
  const e = performance.now() + Math.max(0, t);
2330
2330
  e > this.Mh && (this.Mh = e);
2331
2331
  }
2332
- Hh() {
2332
+ Bh() {
2333
2333
  return performance.now() < this.Mh;
2334
2334
  }
2335
- Bh(t) {
2335
+ Ih(t) {
2336
2336
  const e = this.Xr.canvas;
2337
2337
  e.style.cursor = t == null || t === "" ? "" : t;
2338
2338
  }
2339
- Ih() {
2340
- if (this.Eh) return;
2339
+ Gh() {
2340
+ if (this.kh) return;
2341
2341
  const t = this.Xr.canvas;
2342
- this.Fh = (e) => {
2343
- this.Gh(e), this.jh(e);
2342
+ t instanceof HTMLCanvasElement && (this.Fh = (e) => {
2343
+ this.jh(e), this.Qh(e);
2344
2344
  }, this.$h = () => {
2345
2345
  this.Ch = { ...this.bh }, this.bh.x = -1 / 0, this.bh.y = -1 / 0, this.xh = null;
2346
2346
  }, this.Ph = (e) => {
2347
- this.Gh(e), this.Qh(e);
2347
+ this.jh(e), this.Nh(e);
2348
2348
  }, this.Th = (e) => {
2349
- this.Gh(e), this.Nh(e);
2349
+ this.jh(e), this.Xh(e);
2350
2350
  }, this.Sh = (e) => {
2351
- this.Gh(e), this.Xh(e);
2352
- }, this.Uh = (e) => {
2353
- this.Gh(e), this.Yh(e);
2354
- }, t.addEventListener("mousemove", this.Fh, { passive: !0 }), t.addEventListener("mouseleave", this.$h, { passive: !0 }), t.addEventListener("mousedown", this.Ph, { passive: !0 }), t.addEventListener("mouseup", this.Th, { passive: !0 }), t.addEventListener("click", this.Sh, { passive: !0 }), t.addEventListener("wheel", this.Uh, { passive: !1 }), this.Eh = !0;
2351
+ this.jh(e), this.Yh(e);
2352
+ }, this.Eh = (e) => {
2353
+ this.jh(e), this.Kh(e);
2354
+ }, t.addEventListener("mousemove", this.Fh, { passive: !0 }), t.addEventListener("mouseleave", this.$h, { passive: !0 }), t.addEventListener("mousedown", this.Ph, { passive: !0 }), t.addEventListener("mouseup", this.Th, { passive: !0 }), t.addEventListener("click", this.Sh, { passive: !0 }), t.addEventListener("wheel", this.Eh, { passive: !1 }), this.kh = !0);
2355
2355
  }
2356
- Kh() {
2357
- if (!this.Eh) return;
2356
+ Wh() {
2357
+ if (!this.kh) return;
2358
2358
  const t = this.Xr.canvas;
2359
- t.removeEventListener("mousemove", this.Fh), t.removeEventListener("mouseleave", this.$h), t.removeEventListener("mousedown", this.Ph), t.removeEventListener("mouseup", this.Th), t.removeEventListener("click", this.Sh), t.removeEventListener("wheel", this.Uh), this.Eh = !1;
2359
+ t instanceof HTMLCanvasElement && (t.removeEventListener("mousemove", this.Fh), t.removeEventListener("mouseleave", this.$h), t.removeEventListener("mousedown", this.Ph), t.removeEventListener("mouseup", this.Th), t.removeEventListener("click", this.Sh), t.removeEventListener("wheel", this.Eh), this.kh = !1);
2360
2360
  }
2361
- Wh() {
2362
- if (this.Eh) try {
2361
+ Zh() {
2362
+ if (this.kh) try {
2363
2363
  if (this.xh) {
2364
2364
  const t = new MouseEvent("mousemove", { clientX: this.xh.x, clientY: this.xh.y, bubbles: !1, cancelable: !1 });
2365
- this.Gh(t);
2365
+ this.jh(t);
2366
2366
  }
2367
2367
  } catch {
2368
2368
  this.bh.x = -1 / 0, this.bh.y = -1 / 0;
2369
2369
  }
2370
2370
  }
2371
- Zh(t) {
2372
- this.kh = t;
2373
- }
2374
2371
  qh(t) {
2375
- this.Rh = t;
2372
+ this.Lh = t;
2376
2373
  }
2377
2374
  Vh(t) {
2378
- this.Dh = t;
2375
+ this.Rh = t;
2379
2376
  }
2380
2377
  Jh(t) {
2381
- this.Lh = t;
2378
+ this.Dh = t;
2382
2379
  }
2383
2380
  so(t) {
2384
2381
  this.Oh = t;
2385
2382
  }
2386
- eo() {
2383
+ eo(t) {
2384
+ this.Hh = t;
2385
+ }
2386
+ io() {
2387
2387
  return { x: this.bh.x, y: this.bh.y };
2388
2388
  }
2389
- io(t, e = {}) {
2389
+ ro(t, e = {}) {
2390
2390
  return { position: { ...this.bh }, previousPosition: { ...this.Ch }, originalEvent: t, ...e };
2391
2391
  }
2392
- jh(t) {
2393
- this.Lh && !this.Hh() && this.Lh(this.io(t));
2394
- }
2395
2392
  Qh(t) {
2396
- this.Rh && !this.Hh() && this.Rh(this.io(t, { button: t.button }));
2393
+ this.Oh && !this.Bh() && this.Oh(this.ro(t));
2397
2394
  }
2398
2395
  Nh(t) {
2399
- this.Dh && !this.Hh() && this.Dh(this.io(t, { button: t.button }));
2396
+ this.Rh && !this.Bh() && this.Rh(this.ro(t, { button: t.button }));
2400
2397
  }
2401
2398
  Xh(t) {
2402
- this.kh && !this.Hh() && this.kh(this.io(t, { button: t.button }));
2399
+ this.Dh && !this.Bh() && this.Dh(this.ro(t, { button: t.button }));
2403
2400
  }
2404
2401
  Yh(t) {
2405
- this.Oh && !this.Hh() && this.Oh(this.io(t, { delta: { x: t.deltaX, y: t.deltaY } }));
2402
+ this.Lh && !this.Bh() && this.Lh(this.ro(t, { button: t.button }));
2403
+ }
2404
+ Kh(t) {
2405
+ this.Hh && !this.Bh() && this.Hh(this.ro(t, { delta: { x: t.deltaX, y: t.deltaY } }));
2406
2406
  }
2407
- Gh(t) {
2407
+ jh(t) {
2408
2408
  const e = this.wh();
2409
2409
  this.Ch = { ...this.bh }, this.xh = { x: t.clientX, y: t.clientY };
2410
- const i = Yt(e, t.clientX, t.clientY);
2410
+ const i = kt(e, t.clientX, t.clientY);
2411
2411
  this.bh.x = i.x, this.bh.y = i.y;
2412
2412
  }
2413
2413
  }
2414
- const Ge = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: kt }, Symbol.toStringTag, { value: "Module" }));
2414
+ const Ge = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Yt }, Symbol.toStringTag, { value: "Module" }));
2415
2415
  class Ht {
2416
2416
  constructor() {
2417
- o(this, "ro", /* @__PURE__ */ new Map());
2418
- o(this, "no", null);
2417
+ o(this, "no", /* @__PURE__ */ new Map());
2419
2418
  o(this, "ho", null);
2420
- o(this, "oo");
2419
+ o(this, "oo", null);
2421
2420
  o(this, "ao");
2422
- o(this, "Eh", !1);
2423
2421
  o(this, "co");
2422
+ o(this, "kh", !1);
2424
2423
  o(this, "lo");
2425
- o(this, "uo", { ArrowUp: "UP_ARROW", ArrowDown: "DOWN_ARROW", ArrowLeft: "LEFT_ARROW", ArrowRight: "RIGHT_ARROW", F1: "F1", F2: "F2", F3: "F3", F4: "F4", F5: "F5", F6: "F6", F7: "F7", F8: "F8", F9: "F9", F10: "F10", F11: "F11", F12: "F12", Enter: "ENTER", Return: "RETURN", Tab: "TAB", Escape: "ESCAPE", Backspace: "BACKSPACE", Delete: "DELETE", Insert: "INSERT", Home: "HOME", End: "END", PageUp: "PAGE_UP", PageDown: "PAGE_DOWN", Shift: "SHIFT", Control: "CONTROL", Alt: "ALT", Meta: "META", " ": "SPACE" });
2424
+ o(this, "uo");
2425
+ o(this, "fo", { ArrowUp: "UP_ARROW", ArrowDown: "DOWN_ARROW", ArrowLeft: "LEFT_ARROW", ArrowRight: "RIGHT_ARROW", F1: "F1", F2: "F2", F3: "F3", F4: "F4", F5: "F5", F6: "F6", F7: "F7", F8: "F8", F9: "F9", F10: "F10", F11: "F11", F12: "F12", Enter: "ENTER", Return: "RETURN", Tab: "TAB", Escape: "ESCAPE", Backspace: "BACKSPACE", Delete: "DELETE", Insert: "INSERT", Home: "HOME", End: "END", PageUp: "PAGE_UP", PageDown: "PAGE_DOWN", Shift: "SHIFT", Control: "CONTROL", Alt: "ALT", Meta: "META", " ": "SPACE" });
2426
2426
  }
2427
- Ih() {
2428
- this.Eh || (this.oo = (t) => {
2429
- this.fo(t);
2430
- }, this.ao = (t) => {
2427
+ Gh() {
2428
+ this.kh || (this.ao = (t) => {
2431
2429
  this.do(t);
2432
- }, window.addEventListener("keydown", this.oo, { passive: !1 }), window.addEventListener("keyup", this.ao, { passive: !1 }), this.Eh = !0);
2430
+ }, this.co = (t) => {
2431
+ this.po(t);
2432
+ }, window.addEventListener("keydown", this.ao, { passive: !1 }), window.addEventListener("keyup", this.co, { passive: !1 }), this.kh = !0);
2433
2433
  }
2434
- Kh() {
2435
- this.Eh && (window.removeEventListener("keydown", this.oo), window.removeEventListener("keyup", this.ao), this.Eh = !1, this.ro.clear(), this.no = null, this.ho = null);
2436
- }
2437
- qh(t) {
2438
- this.co = t;
2434
+ Wh() {
2435
+ this.kh && (window.removeEventListener("keydown", this.ao), window.removeEventListener("keyup", this.co), this.kh = !1, this.no.clear(), this.ho = null, this.oo = null);
2439
2436
  }
2440
2437
  Vh(t) {
2441
2438
  this.lo = t;
2442
2439
  }
2443
- po(t) {
2444
- const e = this.vo(t), i = this.ro.get(t) || this.ro.get(e);
2445
- return (i == null ? void 0 : i.isPressed) || !1;
2440
+ Jh(t) {
2441
+ this.uo = t;
2446
2442
  }
2447
- mo() {
2448
- return this.no;
2443
+ vo(t) {
2444
+ const e = this.mo(t), i = this.no.get(t) || this.no.get(e);
2445
+ return (i == null ? void 0 : i.isPressed) || !1;
2449
2446
  }
2450
2447
  _o() {
2451
2448
  return this.ho;
2452
2449
  }
2453
2450
  yo() {
2454
- const t = [];
2455
- for (const [e, i] of this.ro) i.isPressed && t.push(e);
2456
- return t;
2451
+ return this.oo;
2457
2452
  }
2458
2453
  Ao() {
2459
- return { ctrl: this.po("Control"), shift: this.po("Shift"), alt: this.po("Alt"), meta: this.po("Meta") };
2454
+ const t = [];
2455
+ for (const [e, i] of this.no) i.isPressed && t.push(e);
2456
+ return t;
2460
2457
  }
2461
2458
  wo() {
2462
- this.ro.clear(), this.no = null, this.ho = null;
2459
+ return { ctrl: this.vo("Control"), shift: this.vo("Shift"), alt: this.vo("Alt"), meta: this.vo("Meta") };
2460
+ }
2461
+ bo() {
2462
+ this.no.clear(), this.ho = null, this.oo = null;
2463
2463
  }
2464
- fo(t) {
2464
+ do(t) {
2465
2465
  const e = t.key, i = Date.now();
2466
- this.ro.has(e) || this.ro.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2467
- const s = this.ro.get(e);
2468
- s.isPressed || (s.isPressed = !0, s.lastPressTime = i, this.no = e, this.co && this.co(this.io(e, !0, t)));
2466
+ this.no.has(e) || this.no.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2467
+ const s = this.no.get(e);
2468
+ s.isPressed || (s.isPressed = !0, s.lastPressTime = i, this.ho = e, this.lo && this.lo(this.ro(e, !0, t)));
2469
2469
  }
2470
- io(t, e, i) {
2470
+ ro(t, e, i) {
2471
2471
  return { key: t, keyCode: i.keyCode, ctrlKey: i.ctrlKey, shiftKey: i.shiftKey, altKey: i.altKey, metaKey: i.metaKey, isPressed: e, originalEvent: i };
2472
2472
  }
2473
- do(t) {
2473
+ po(t) {
2474
2474
  const e = t.key, i = Date.now();
2475
- this.ro.has(e) || this.ro.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2476
- const s = this.ro.get(e);
2477
- s.isPressed = !1, s.lastReleaseTime = i, this.ho = e, this.lo && this.lo(this.io(e, !1, t));
2475
+ this.no.has(e) || this.no.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
2476
+ const s = this.no.get(e);
2477
+ s.isPressed = !1, s.lastReleaseTime = i, this.oo = e, this.uo && this.uo(this.ro(e, !1, t));
2478
2478
  }
2479
- vo(t) {
2480
- return this.uo[t] || t.toLowerCase();
2479
+ mo(t) {
2480
+ return this.fo[t] || t.toLowerCase();
2481
2481
  }
2482
2482
  }
2483
- const je = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Ht }, Symbol.toStringTag, { value: "Module" }));
2483
+ const We = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Ht }, Symbol.toStringTag, { value: "Module" }));
2484
2484
  class Gt {
2485
2485
  constructor(t, e, i) {
2486
2486
  o(this, "Xr");
2487
- o(this, "bo");
2487
+ o(this, "Co");
2488
2488
  o(this, "wh");
2489
- o(this, "Co", /* @__PURE__ */ new Map());
2490
2489
  o(this, "xo", /* @__PURE__ */ new Map());
2491
2490
  o(this, "Mo", /* @__PURE__ */ new Map());
2492
- o(this, "Fo", null);
2493
- o(this, "$o");
2491
+ o(this, "Fo", /* @__PURE__ */ new Map());
2492
+ o(this, "$o", null);
2494
2493
  o(this, "Po");
2495
2494
  o(this, "To");
2496
2495
  o(this, "So");
2497
2496
  o(this, "Eo");
2498
2497
  o(this, "ko");
2499
- o(this, "Eh", !1);
2498
+ o(this, "Lo");
2499
+ o(this, "kh", !1);
2500
2500
  o(this, "Ro");
2501
2501
  o(this, "Do");
2502
- o(this, "Lo");
2503
2502
  o(this, "Oo");
2504
- o(this, "zo");
2505
2503
  o(this, "Ho");
2504
+ o(this, "zo");
2506
2505
  o(this, "Bo");
2507
2506
  o(this, "Io");
2508
2507
  o(this, "Go");
2509
2508
  o(this, "jo");
2510
- o(this, "Qo", 320);
2511
- o(this, "No", 350);
2512
- o(this, "Xo", 10);
2513
- o(this, "Yo", 550);
2514
- o(this, "Ko", 14);
2515
- o(this, "Wo", 48);
2516
- o(this, "Zo", 650);
2517
- o(this, "qo", 0.02);
2518
- o(this, "Vo", 2);
2519
- o(this, "Jo", 600);
2520
- o(this, "ta", 0);
2521
- o(this, "sa", null);
2522
- this.Xr = t, this.wh = e, this.bo = i;
2509
+ o(this, "Qo");
2510
+ o(this, "No", 320);
2511
+ o(this, "Xo", 350);
2512
+ o(this, "Yo", 10);
2513
+ o(this, "Ko", 550);
2514
+ o(this, "Wo", 14);
2515
+ o(this, "Zo", 48);
2516
+ o(this, "qo", 650);
2517
+ o(this, "Vo", 0.02);
2518
+ o(this, "Jo", 2);
2519
+ o(this, "ta", 600);
2520
+ o(this, "sa", 0);
2521
+ o(this, "ea", null);
2522
+ this.Xr = t, this.wh = e, this.Co = i;
2523
2523
  const s = this.Xr.canvas;
2524
- this.$o = s.style.touchAction, this.Po = s.style.userSelect, s.style.touchAction || (s.style.touchAction = "none"), s.style.userSelect || (s.style.userSelect = "none");
2524
+ this.Po = s.style.touchAction, this.To = s.style.userSelect, s.style.touchAction || (s.style.touchAction = "none"), s.style.userSelect || (s.style.userSelect = "none");
2525
2525
  }
2526
- Ih() {
2527
- if (this.Eh) return;
2526
+ Gh() {
2527
+ if (this.kh) return;
2528
2528
  const t = this.Xr.canvas;
2529
- this.To = (e) => {
2530
- this.ea(e);
2531
- }, this.So = (e) => {
2529
+ this.So = (e) => {
2532
2530
  this.ia(e);
2533
2531
  }, this.Eo = (e) => {
2534
2532
  this.ra(e);
2535
2533
  }, this.ko = (e) => {
2536
2534
  this.na(e);
2537
- }, t.addEventListener("touchstart", this.To, { passive: !1 }), t.addEventListener("touchmove", this.So, { passive: !1 }), t.addEventListener("touchend", this.Eo, { passive: !1 }), t.addEventListener("touchcancel", this.ko, { passive: !1 }), this.Eh = !0;
2535
+ }, this.Lo = (e) => {
2536
+ this.ha(e);
2537
+ }, t.addEventListener("touchstart", this.So, { passive: !1 }), t.addEventListener("touchmove", this.Eo, { passive: !1 }), t.addEventListener("touchend", this.ko, { passive: !1 }), t.addEventListener("touchcancel", this.Lo, { passive: !1 }), this.kh = !0;
2538
2538
  }
2539
- Kh() {
2540
- if (!this.Eh) return;
2539
+ Wh() {
2540
+ if (!this.kh) return;
2541
2541
  const t = this.Xr.canvas;
2542
- t.removeEventListener("touchstart", this.To), t.removeEventListener("touchmove", this.So), t.removeEventListener("touchend", this.Eo), t.removeEventListener("touchcancel", this.ko), this.Eh = !1, this.Fo = null, this.Co.clear(), this.xo.clear(), this.Mo.forEach((e) => {
2542
+ t.removeEventListener("touchstart", this.So), t.removeEventListener("touchmove", this.Eo), t.removeEventListener("touchend", this.ko), t.removeEventListener("touchcancel", this.Lo), this.kh = !1, this.$o = null, this.xo.clear(), this.Mo.clear(), this.Fo.forEach((e) => {
2543
2543
  e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
2544
- }), this.Mo.clear(), this.sa = null, this.ta = 0, t.style.touchAction = this.$o, t.style.userSelect = this.Po;
2544
+ }), this.Fo.clear(), this.ea = null, this.sa = 0, t.style.touchAction = this.Po, t.style.userSelect = this.To;
2545
2545
  }
2546
- Wh() {
2547
- if (!this.wh() || this.Co.size === 0) return;
2546
+ Zh() {
2547
+ if (!this.wh() || this.xo.size === 0) return;
2548
2548
  const t = /* @__PURE__ */ new Map();
2549
- for (const e of this.Co.values()) {
2550
- const i = this.ha(e.clientX, e.clientY, e.id, e);
2549
+ for (const e of this.xo.values()) {
2550
+ const i = this.oa(e.clientX, e.clientY, e.id, e);
2551
2551
  t.set(e.id, i);
2552
2552
  }
2553
- this.Co = t;
2553
+ this.xo = t;
2554
2554
  }
2555
- oa() {
2556
- return Array.from(this.Co.values()).map((t) => ({ ...t }));
2555
+ aa() {
2556
+ return Array.from(this.xo.values()).map((t) => ({ ...t }));
2557
2557
  }
2558
- aa(t) {
2558
+ ca(t) {
2559
2559
  this.Ro = t;
2560
2560
  }
2561
- Jh(t) {
2561
+ so(t) {
2562
2562
  this.Do = t;
2563
2563
  }
2564
- ca(t) {
2565
- this.Lo = t;
2566
- }
2567
2564
  la(t) {
2568
2565
  this.Oo = t;
2569
2566
  }
2570
2567
  ua(t) {
2571
- this.zo = t;
2568
+ this.Ho = t;
2572
2569
  }
2573
2570
  fa(t) {
2574
- this.Ho = t;
2571
+ this.zo = t;
2575
2572
  }
2576
2573
  da(t) {
2577
2574
  this.Bo = t;
@@ -2585,144 +2582,147 @@ class Gt {
2585
2582
  ga(t) {
2586
2583
  this.jo = t;
2587
2584
  }
2588
- ea(t) {
2585
+ ma(t) {
2586
+ this.Qo = t;
2587
+ }
2588
+ ia(t) {
2589
2589
  var s;
2590
2590
  if (!this.wh()) return;
2591
- t.preventDefault(), (s = this.bo) == null || s.zh(this.Jo);
2592
- const e = performance.now(), i = this.ma(t.changedTouches);
2591
+ t.preventDefault(), (s = this.Co) == null || s.zh(this.ta);
2592
+ const e = performance.now(), i = this._a(t.changedTouches);
2593
2593
  for (const r of i) {
2594
- const h = this.Co.get(r.id);
2595
- h && this.xo.set(r.id, this._a(h)), this.Co.set(r.id, r);
2594
+ const h = this.xo.get(r.id);
2595
+ h && this.Mo.set(r.id, this.ya(h)), this.xo.set(r.id, r);
2596
2596
  const a = { id: r.id, startPosition: r, lastPosition: r, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
2597
- this.Bo && (a.longPressTimer = window.setTimeout(() => {
2598
- const l = this.Co.get(r.id);
2599
- l && (a.longPressFired = !0, this.Bo({ touch: this._a(l), duration: performance.now() - a.startTime, originalEvent: t }));
2600
- }, this.Yo)), this.Mo.set(r.id, a), this.Ro && this.Ro(this.ya(r, t, void 0, e));
2597
+ this.Io && (a.longPressTimer = window.setTimeout(() => {
2598
+ const l = this.xo.get(r.id);
2599
+ l && (a.longPressFired = !0, this.Io({ touch: this.ya(l), duration: performance.now() - a.startTime, originalEvent: t }));
2600
+ }, this.Ko)), this.Fo.set(r.id, a), this.Ro && this.Ro(this.wa(r, t, void 0, e));
2601
2601
  }
2602
- this.Co.size === 2 && this.wa();
2602
+ this.xo.size === 2 && this.ba();
2603
2603
  }
2604
- ia(t) {
2604
+ ra(t) {
2605
2605
  var s;
2606
2606
  if (!this.wh()) return;
2607
- t.preventDefault(), (s = this.bo) == null || s.zh(this.Jo);
2608
- const e = performance.now(), i = this.ma(t.changedTouches);
2607
+ t.preventDefault(), (s = this.Co) == null || s.zh(this.ta);
2608
+ const e = performance.now(), i = this._a(t.changedTouches);
2609
2609
  for (const r of i) {
2610
- const h = this.Co.get(r.id), a = h ? this._a(h) : void 0;
2611
- a && this.xo.set(r.id, a), this.Co.set(r.id, r);
2612
- const l = this.Mo.get(r.id);
2613
- l && (l.lastPosition = r, l.lastTime = e, a) && $(a.clientX, a.clientY, r.clientX, r.clientY) > this.Ko && l.longPressTimer !== null && (window.clearTimeout(l.longPressTimer), l.longPressTimer = null), this.Do && this.Do(this.ya(r, t, a, e));
2610
+ const h = this.xo.get(r.id), a = h ? this.ya(h) : void 0;
2611
+ a && this.Mo.set(r.id, a), this.xo.set(r.id, r);
2612
+ const l = this.Fo.get(r.id);
2613
+ l && (l.lastPosition = r, l.lastTime = e, a) && q(a.clientX, a.clientY, r.clientX, r.clientY) > this.Wo && l.longPressTimer !== null && (window.clearTimeout(l.longPressTimer), l.longPressTimer = null), this.Do && this.Do(this.wa(r, t, a, e));
2614
2614
  }
2615
- this.Co.size === 2 ? this.ba(t) : this.Fo = null;
2615
+ this.xo.size === 2 ? this.Ca(t) : this.$o = null;
2616
2616
  }
2617
- ra(t) {
2617
+ na(t) {
2618
2618
  if (!this.wh()) return;
2619
2619
  t.preventDefault();
2620
- const e = performance.now(), i = this.ma(t.changedTouches);
2620
+ const e = performance.now(), i = this._a(t.changedTouches);
2621
2621
  for (const s of i) {
2622
- const r = this.Co.get(s.id), h = r ? this._a(r) : void 0, a = this.Mo.get(s.id);
2623
- a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.Lo && this.Lo(this.ya(s, t, h, e)), a && this.Ca(a, t), this.Mo.delete(s.id), this.xo.delete(s.id), this.Co.delete(s.id);
2622
+ const r = this.xo.get(s.id), h = r ? this.ya(r) : void 0, a = this.Fo.get(s.id);
2623
+ a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.Oo && this.Oo(this.wa(s, t, h, e)), a && this.xa(a, t), this.Fo.delete(s.id), this.Mo.delete(s.id), this.xo.delete(s.id);
2624
2624
  }
2625
- this.Co.size < 2 && (this.Fo = null);
2625
+ this.xo.size < 2 && (this.$o = null);
2626
2626
  }
2627
- na(t) {
2627
+ ha(t) {
2628
2628
  if (!this.wh()) return;
2629
2629
  t.preventDefault();
2630
- const e = performance.now(), i = this.ma(t.changedTouches);
2630
+ const e = performance.now(), i = this._a(t.changedTouches);
2631
2631
  for (const s of i) {
2632
- const r = this.Co.get(s.id), h = r ? this._a(r) : void 0, a = this.Mo.get(s.id);
2633
- a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.Oo && this.Oo(this.ya(s, t, h, e)), this.Mo.delete(s.id), this.xo.delete(s.id), this.Co.delete(s.id);
2632
+ const r = this.xo.get(s.id), h = r ? this.ya(r) : void 0, a = this.Fo.get(s.id);
2633
+ a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.Ho && this.Ho(this.wa(s, t, h, e)), this.Fo.delete(s.id), this.Mo.delete(s.id), this.xo.delete(s.id);
2634
2634
  }
2635
- this.Co.size < 2 && (this.Fo = null);
2635
+ this.xo.size < 2 && (this.$o = null);
2636
2636
  }
2637
- ma(t) {
2637
+ _a(t) {
2638
2638
  const e = [];
2639
2639
  for (let i = 0; i < t.length; i += 1) {
2640
2640
  const s = t.item(i);
2641
- s && e.push(this.xa(s));
2641
+ s && e.push(this.Ma(s));
2642
2642
  }
2643
2643
  return e;
2644
2644
  }
2645
- xa(t) {
2646
- return this.ha(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 });
2645
+ Ma(t) {
2646
+ return this.oa(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 });
2647
2647
  }
2648
- ha(t, e, i, s) {
2649
- const r = Yt(this.wh(), t, e);
2648
+ oa(t, e, i, s) {
2649
+ const r = kt(this.wh(), t, e);
2650
2650
  return { id: i, x: r.x, y: r.y, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
2651
2651
  }
2652
- ya(t, e, i, s) {
2653
- const r = this.Mo.get(t.id), h = Array.from(this.xo.values()).map((u) => this._a(u)), a = Array.from(this.Co.values()).map((u) => this._a(u)), l = this.ma(e.changedTouches);
2654
- return { touch: this._a(t), previousTouch: i ? this._a(i) : void 0, touches: a, previousTouches: h, changedTouches: l, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
2652
+ wa(t, e, i, s) {
2653
+ const r = this.Fo.get(t.id), h = Array.from(this.Mo.values()).map((u) => this.ya(u)), a = Array.from(this.xo.values()).map((u) => this.ya(u)), l = this._a(e.changedTouches);
2654
+ return { touch: this.ya(t), previousTouch: i ? this.ya(i) : void 0, touches: a, previousTouches: h, changedTouches: l, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
2655
2655
  }
2656
- wa() {
2657
- if (this.Co.size !== 2) return void (this.Fo = null);
2658
- const t = Array.from(this.Co.values()), [e, i] = t, s = $(e.x, e.y, i.x, i.y), r = Rt(e.clientX, e.clientY, i.clientX, i.clientY);
2659
- this.Fo = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
2656
+ ba() {
2657
+ if (this.xo.size !== 2) return void (this.$o = null);
2658
+ const t = Array.from(this.xo.values()), [e, i] = t, s = q(e.x, e.y, i.x, i.y), r = Tt(e.clientX, e.clientY, i.clientX, i.clientY);
2659
+ this.$o = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
2660
2660
  }
2661
- ba(t) {
2662
- if (this.Fo || this.wa(), !this.Fo) return;
2663
- const [e, i] = this.Fo.ids, s = this.Co.get(e), r = this.Co.get(i);
2661
+ Ca(t) {
2662
+ if (this.$o || this.ba(), !this.$o) return;
2663
+ const [e, i] = this.$o.ids, s = this.xo.get(e), r = this.xo.get(i);
2664
2664
  if (!s || !r) return;
2665
- const h = $(s.x, s.y, r.x, r.y) / this.Fo.initialDistance, a = h - this.Fo.lastScale;
2666
- this.Go && Math.abs(a) > this.qo && (this.Go({ touches: [this._a(s), this._a(r)], scale: h, deltaScale: a, center: this.Ma(s, r), originalEvent: t }), this.Fo.lastScale = h);
2667
- let l = Rt(s.clientX, s.clientY, r.clientX, r.clientY) - this.Fo.initialAngle;
2665
+ const h = q(s.x, s.y, r.x, r.y) / this.$o.initialDistance, a = h - this.$o.lastScale;
2666
+ this.jo && Math.abs(a) > this.Vo && (this.jo({ touches: [this.ya(s), this.ya(r)], scale: h, deltaScale: a, center: this.Fa(s, r), originalEvent: t }), this.$o.lastScale = h);
2667
+ let l = Tt(s.clientX, s.clientY, r.clientX, r.clientY) - this.$o.initialAngle;
2668
2668
  l = (l + 180) % 360 - 180;
2669
- const u = l - this.Fo.lastRotation;
2670
- this.jo && Math.abs(u) > this.Vo && (this.jo({ touches: [this._a(s), this._a(r)], rotation: l, deltaRotation: u, center: this.Ma(s, r), originalEvent: t }), this.Fo.lastRotation = l);
2669
+ const u = l - this.$o.lastRotation;
2670
+ this.Qo && Math.abs(u) > this.Jo && (this.Qo({ touches: [this.ya(s), this.ya(r)], rotation: l, deltaRotation: u, center: this.Fa(s, r), originalEvent: t }), this.$o.lastRotation = l);
2671
2671
  }
2672
- Ma(t, e) {
2673
- const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.ha(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
2672
+ Fa(t, e) {
2673
+ const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.oa(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
2674
2674
  return { x: r.x, y: r.y };
2675
2675
  }
2676
- Ca(t, e) {
2676
+ xa(t, e) {
2677
2677
  const i = performance.now(), s = i - t.startTime, r = t.lastPosition.clientX - t.startPosition.clientX, h = t.lastPosition.clientY - t.startPosition.clientY, a = Math.hypot(r, h);
2678
- if (!t.longPressFired && s <= this.Qo && a <= this.Xo)
2679
- this.Fa(t.lastPosition, i) && this.Ho ? this.Ho({ touch: this._a(t.lastPosition), taps: 2, originalEvent: e }) : this.zo && this.zo({ touch: this._a(t.lastPosition), taps: 1, originalEvent: e });
2680
- else if (!t.longPressFired && s <= this.Zo && a >= this.Wo) {
2678
+ if (!t.longPressFired && s <= this.No && a <= this.Yo)
2679
+ this.$a(t.lastPosition, i) && this.Bo ? this.Bo({ touch: this.ya(t.lastPosition), taps: 2, originalEvent: e }) : this.zo && this.zo({ touch: this.ya(t.lastPosition), taps: 1, originalEvent: e });
2680
+ else if (!t.longPressFired && s <= this.qo && a >= this.Zo) {
2681
2681
  const l = Math.max(a, 1e-4), u = { x: r / l, y: h / l }, c = { x: r / s, y: h / s };
2682
- this.Io && this.Io({ touch: this._a(t.lastPosition), direction: u, distance: l, velocity: c, originalEvent: e });
2682
+ this.Go && this.Go({ touch: this.ya(t.lastPosition), direction: u, distance: l, velocity: c, originalEvent: e });
2683
2683
  }
2684
- this.ta = i, this.sa = this._a(t.lastPosition);
2684
+ this.sa = i, this.ea = this.ya(t.lastPosition);
2685
2685
  }
2686
- Fa(t, e) {
2687
- return !this.sa || e - this.ta > this.No ? !1 : $(t.clientX, t.clientY, this.sa.clientX, this.sa.clientY) <= this.Xo;
2686
+ $a(t, e) {
2687
+ return !this.ea || e - this.sa > this.Xo ? !1 : q(t.clientX, t.clientY, this.ea.clientX, this.ea.clientY) <= this.Yo;
2688
2688
  }
2689
- _a(t) {
2689
+ ya(t) {
2690
2690
  return { ...t };
2691
2691
  }
2692
2692
  }
2693
- const Ke = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Gt }, Symbol.toStringTag, { value: "Module" }));
2694
- class Z extends Et {
2693
+ const je = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Gt }, Symbol.toStringTag, { value: "Module" }));
2694
+ class Q extends Et {
2695
2695
  constructor(e, i, s, r, h, a, l, u, c) {
2696
2696
  super(e, i, s, r, h, a, l, u);
2697
- o(this, "$a");
2698
- this.$a = c;
2697
+ o(this, "Pa");
2698
+ this.Pa = c;
2699
2699
  }
2700
- static Pa(e, i, s, r, h) {
2701
- const a = e.context, l = bt(a, s), { width: u, height: c } = wt(s);
2702
- return new Z(a, e, l, i, u, c, r, h, s);
2700
+ static Ta(e, i, s, r, h) {
2701
+ const a = e.context, l = wt(a, s), { width: u, height: c } = bt(s);
2702
+ return new Q(a, e, l, i, u, c, r, h, s);
2703
2703
  }
2704
- Ta() {
2705
- this.$a instanceof HTMLVideoElement ? this.$a.readyState >= this.$a.HAVE_CURRENT_DATA && rt(this.$, this.Mn, this.$a) : rt(this.$, this.Mn, this.$a);
2704
+ Sa() {
2705
+ this.Pa instanceof HTMLVideoElement ? this.Pa.readyState >= this.Pa.HAVE_CURRENT_DATA && rt(this.$, this.Mn, this.Pa) : rt(this.$, this.Mn, this.Pa);
2706
2706
  }
2707
2707
  V() {
2708
- return this.D = null, super.V();
2708
+ return this.R = null, super.V();
2709
2709
  }
2710
- Hn() {
2711
- this.Ta();
2710
+ zn() {
2711
+ this.Sa();
2712
2712
  }
2713
2713
  get source() {
2714
- return this.$a;
2714
+ return this.Pa;
2715
2715
  }
2716
2716
  }
2717
- class ut extends Z {
2717
+ class ut extends Q {
2718
2718
  constructor(t, e, i, s, r, h, a, l, u) {
2719
2719
  super(t, e, i, s, h, a, l, u, r);
2720
2720
  }
2721
2721
  dispose() {
2722
- super.dispose(), this.Sa.pause(), this.Sa.src = "", this.Sa.load();
2722
+ super.dispose(), this.Ea.pause(), this.Ea.src = "", this.Ea.load();
2723
2723
  }
2724
- Ea() {
2725
- this.Ta();
2724
+ ka() {
2725
+ this.Sa();
2726
2726
  }
2727
2727
  static async Nn(t, e, i, s, r) {
2728
2728
  const h = t.context, a = document.createElement("video");
@@ -2733,44 +2733,44 @@ class ut extends Z {
2733
2733
  g(Error("Failed to load video: " + (((d = v.error) == null ? void 0 : d.message) || "Unknown error")));
2734
2734
  }, { once: !0 }), a.src = i;
2735
2735
  });
2736
- const l = bt(h, a, h.LINEAR, h.LINEAR, h.CLAMP_TO_EDGE, h.CLAMP_TO_EDGE), { width: u, height: c } = wt(a);
2736
+ const l = wt(h, a, h.LINEAR, h.LINEAR, h.CLAMP_TO_EDGE, h.CLAMP_TO_EDGE), { width: u, height: c } = bt(a);
2737
2737
  return new ut(h, t, l, e, a, u, c, s, r);
2738
2738
  }
2739
2739
  async play() {
2740
- await this.Sa.play();
2740
+ await this.Ea.play();
2741
2741
  }
2742
2742
  pause() {
2743
- this.Sa.pause();
2743
+ this.Ea.pause();
2744
2744
  }
2745
2745
  stop() {
2746
- this.Sa.pause(), this.Sa.currentTime = 0;
2746
+ this.Ea.pause(), this.Ea.currentTime = 0;
2747
2747
  }
2748
2748
  speed(t) {
2749
- return this.Sa.playbackRate = t, this;
2749
+ return this.Ea.playbackRate = t, this;
2750
2750
  }
2751
2751
  loop(t = !0) {
2752
- return this.Sa.loop = t, this;
2752
+ return this.Ea.loop = t, this;
2753
2753
  }
2754
2754
  time(t) {
2755
- return this.Sa.currentTime = t, this;
2755
+ return this.Ea.currentTime = t, this;
2756
2756
  }
2757
2757
  volume(t) {
2758
- return this.Sa.volume = _(t, 0, 1), this;
2758
+ return this.Ea.volume = U(t, 0, 1), this;
2759
2759
  }
2760
2760
  get videoElement() {
2761
- return this.Sa;
2761
+ return this.Ea;
2762
2762
  }
2763
2763
  get currentTime() {
2764
- return this.Sa.currentTime;
2764
+ return this.Ea.currentTime;
2765
2765
  }
2766
2766
  get duration() {
2767
- return this.Sa.duration;
2767
+ return this.Ea.duration;
2768
2768
  }
2769
2769
  get isPlaying() {
2770
- return !this.Sa.paused && !this.Sa.ended;
2770
+ return !this.Ea.paused && !this.Ea.ended;
2771
2771
  }
2772
- get Sa() {
2773
- return this.$a;
2772
+ get Ea() {
2773
+ return this.Pa;
2774
2774
  }
2775
2775
  }
2776
2776
  async function st(n) {
@@ -2781,86 +2781,86 @@ async function st(n) {
2781
2781
  }
2782
2782
  return n;
2783
2783
  }
2784
- const We = (n) => class extends n {
2784
+ const Ze = (n) => class extends n {
2785
2785
  rotate(t = 0, e = 0, i = 0) {
2786
- this.R.state.Jt(t), this.R.state.ts(e), this.R.state.ss(i);
2786
+ this.L.state.Jt(t), this.L.state.ts(e), this.L.state.ss(i);
2787
2787
  }
2788
2788
  rotateX(t) {
2789
- if (t === void 0) return et(this.R.state.rotationX);
2790
- this.R.state.Jt(t);
2789
+ if (t === void 0) return et(this.L.state.rotationX);
2790
+ this.L.state.Jt(t);
2791
2791
  }
2792
2792
  rotateY(t) {
2793
- if (t === void 0) return et(this.R.state.rotationY);
2794
- this.R.state.ts(t);
2793
+ if (t === void 0) return et(this.L.state.rotationY);
2794
+ this.L.state.ts(t);
2795
2795
  }
2796
2796
  rotateZ(t) {
2797
- if (t === void 0) return et(this.R.state.rotationZ);
2798
- this.R.state.ss(t);
2797
+ if (t === void 0) return et(this.L.state.rotationZ);
2798
+ this.L.state.ss(t);
2799
2799
  }
2800
2800
  translate(t = 0, e = 0, i = 0) {
2801
- this.R.state.es(t, e, i);
2801
+ this.L.state.es(t, e, i);
2802
2802
  }
2803
2803
  translateX(t) {
2804
- if (t === void 0) return this.R.state.translationX;
2805
- this.R.state.es(t, 0, 0);
2804
+ if (t === void 0) return this.L.state.translationX;
2805
+ this.L.state.es(t, 0, 0);
2806
2806
  }
2807
2807
  translateY(t) {
2808
- if (t === void 0) return this.R.state.translationY;
2809
- this.R.state.es(0, t, 0);
2808
+ if (t === void 0) return this.L.state.translationY;
2809
+ this.L.state.es(0, t, 0);
2810
2810
  }
2811
2811
  translateZ(t) {
2812
- if (t === void 0) return this.R.state.translationZ;
2813
- this.R.state.es(0, 0, t);
2812
+ if (t === void 0) return this.L.state.translationZ;
2813
+ this.L.state.es(0, 0, t);
2814
2814
  }
2815
2815
  ortho() {
2816
- this.R.state.As(!0);
2816
+ this.L.state.As(!0);
2817
2817
  }
2818
2818
  push() {
2819
- this.R.state.K();
2819
+ this.L.state.K();
2820
2820
  }
2821
2821
  pop() {
2822
- this.R.state.W();
2822
+ this.L.state.W();
2823
2823
  }
2824
2824
  color(t, e, i, s) {
2825
2825
  return E.yn(t, e, i, s);
2826
2826
  }
2827
2827
  rect(t = 1, e = 1) {
2828
- this.R.ki(t, e);
2828
+ this.L.ki(t, e);
2829
2829
  }
2830
2830
  point() {
2831
- this.R.ki(1, 1);
2831
+ this.L.ki(1, 1);
2832
2832
  }
2833
2833
  line(t, e, i, s) {
2834
- this.R.Ri(t, e, i, s);
2834
+ this.L.Li(t, e, i, s);
2835
2835
  }
2836
2836
  lineWeight(t) {
2837
- if (t === void 0) return this.R.state.lineWeight;
2838
- this.R.state.qt(t);
2837
+ if (t === void 0) return this.L.state.lineWeight;
2838
+ this.L.state.qt(t);
2839
2839
  }
2840
2840
  background(t, e, i, s = 255) {
2841
2841
  if (t === void 0) {
2842
- const [h, a, l, u] = this.R.state.canvasBackgroundColor;
2842
+ const [h, a, l, u] = this.L.state.canvasBackgroundColor;
2843
2843
  return E.xn(h, a, l, u);
2844
2844
  }
2845
2845
  const r = E.yn(t, e, i, s);
2846
- this.R.Bi(r.r, r.g, r.b, r.a);
2846
+ this.L.Bi(r.r, r.g, r.b, r.a);
2847
2847
  }
2848
2848
  char(t) {
2849
- if (t === void 0) return this.R.state.characterString;
2849
+ if (t === void 0) return this.L.state.characterString;
2850
2850
  let e;
2851
2851
  typeof t == "number" ? e = this.font.characters[t].character : e = t;
2852
2852
  const i = Array.from(e);
2853
2853
  if (i.length === 0) throw Error("char() requires at least one character.");
2854
2854
  const s = i[0];
2855
- this.R.state.cs(this.font.Br(s)), this.R.state.ls(s);
2855
+ this.L.state.cs(this.font.Br(s)), this.L.state.ls(s);
2856
2856
  }
2857
2857
  Xt(t, e, i, s) {
2858
2858
  if (t === void 0) {
2859
- const [h, a, l, u] = this.R.state.charColor;
2859
+ const [h, a, l, u] = this.L.state.charColor;
2860
2860
  return E.xn(h, a, l, u);
2861
2861
  }
2862
2862
  const r = E.yn(t, e, i, s);
2863
- this.R.state.us(r.r, r.g, r.b, r.a);
2863
+ this.L.state.us(r.r, r.g, r.b, r.a);
2864
2864
  }
2865
2865
  charColor(t, e, i, s) {
2866
2866
  return this.Xt(t, e, i, s);
@@ -2870,11 +2870,11 @@ const We = (n) => class extends n {
2870
2870
  }
2871
2871
  Yt(t, e, i, s) {
2872
2872
  if (t === void 0) {
2873
- const [h, a, l, u] = this.R.state.cellColor;
2873
+ const [h, a, l, u] = this.L.state.cellColor;
2874
2874
  return E.xn(h, a, l, u);
2875
2875
  }
2876
2876
  const r = E.yn(t, e, i, s);
2877
- this.R.state.fs(r.r, r.g, r.b, r.a);
2877
+ this.L.state.fs(r.r, r.g, r.b, r.a);
2878
2878
  }
2879
2879
  cellColor(t, e, i, s) {
2880
2880
  return this.Yt(t, e, i, s);
@@ -2883,77 +2883,77 @@ const We = (n) => class extends n {
2883
2883
  return this.Yt(t, e, i, s);
2884
2884
  }
2885
2885
  flipX(t) {
2886
- if (t === void 0) return this.R.state.flipX;
2887
- this.R.state.ds(t);
2886
+ if (t === void 0) return this.L.state.flipX;
2887
+ this.L.state.ds(t);
2888
2888
  }
2889
2889
  flipY(t) {
2890
- if (t === void 0) return this.R.state.flipY;
2891
- this.R.state.ps(t);
2890
+ if (t === void 0) return this.L.state.flipY;
2891
+ this.L.state.ps(t);
2892
2892
  }
2893
2893
  charRotation(t) {
2894
- if (t === void 0) return 360 * this.R.state.charRotation;
2895
- this.R.state.gs(t);
2894
+ if (t === void 0) return 360 * this.L.state.charRotation;
2895
+ this.L.state.gs(t);
2896
2896
  }
2897
2897
  invert(t) {
2898
- if (t === void 0) return this.R.state.invert;
2899
- this.R.state.vs(t);
2898
+ if (t === void 0) return this.L.state.invert;
2899
+ this.L.state.vs(t);
2900
2900
  }
2901
2901
  clear() {
2902
- this.R.xe(0, 0, 0, 0);
2902
+ this.L.xe(0, 0, 0, 0);
2903
2903
  }
2904
2904
  ellipse(t = 1, e = 1) {
2905
- this.R.Di(t / 2, e / 2);
2905
+ this.L.Ri(t / 2, e / 2);
2906
2906
  }
2907
2907
  triangle(t, e, i, s, r, h) {
2908
- this.R.Li(t, e, i, s, r, h);
2908
+ this.L.Di(t, e, i, s, r, h);
2909
2909
  }
2910
2910
  bezierCurve(t, e, i, s, r, h, a, l) {
2911
- this.R.Oi(t, e, i, s, r, h, a, l);
2911
+ this.L.Oi(t, e, i, s, r, h, a, l);
2912
2912
  }
2913
2913
  arc(t, e, i, s) {
2914
- this.R.zi(t / 2, e / 2, i, s);
2914
+ this.L.Hi(t / 2, e / 2, i, s);
2915
2915
  }
2916
2916
  shader(t) {
2917
- this.R.Fi(t);
2917
+ this.L.Fi(t);
2918
2918
  }
2919
2919
  resetShader() {
2920
- this.R.$i();
2920
+ this.L.$i();
2921
2921
  }
2922
2922
  setUniform(t, e) {
2923
- this.R._t(t, e);
2923
+ this.L._t(t, e);
2924
2924
  }
2925
2925
  setUniforms(t) {
2926
- this.R.gt(t);
2926
+ this.L.gt(t);
2927
2927
  }
2928
2928
  async createFilterShader(t) {
2929
- const e = await st(t), i = this.R.Pi(e);
2930
- return this.ka(i), i;
2929
+ const e = await st(t), i = this.L.Pi(e);
2930
+ return this.La(i), i;
2931
2931
  }
2932
2932
  async createShader(t, e) {
2933
- const i = await st(t), s = await st(e), r = this.R.Mi(i, s);
2934
- return this.ka(r), r;
2933
+ const i = await st(t), s = await st(e), r = this.L.Mi(i, s);
2934
+ return this.La(r), r;
2935
2935
  }
2936
2936
  createFramebuffer(t) {
2937
- const e = this.R.Hi(t.width ?? this.grid.cols, t.height ?? this.grid.rows, t.attachments ?? 3);
2938
- return this.ka(e), e;
2937
+ const e = this.L.zi(t.width ?? this.grid.cols, t.height ?? this.grid.rows, t.attachments ?? 3);
2938
+ return this.La(e), e;
2939
2939
  }
2940
2940
  image(t, e, i) {
2941
- this.R.Ti(t, e, i, this.font), t instanceof vt && this.R.Z();
2941
+ this.L.Ti(t, e, i, this.font), t instanceof vt && this.L.Z();
2942
2942
  }
2943
2943
  async loadImage(t) {
2944
2944
  const e = t, i = await new Promise((r, h) => {
2945
2945
  const a = new Image();
2946
2946
  a.crossOrigin = "anonymous", a.onload = () => r(a), a.onerror = (l) => h(l), a.src = e;
2947
- }), s = V.Nn(this.R, this.En, i, this.grid.cols, this.grid.rows);
2948
- return this.ka(s), s;
2947
+ }), s = V.Nn(this.L, this.En, i, this.grid.cols, this.grid.rows);
2948
+ return this.La(s), s;
2949
2949
  }
2950
2950
  async loadVideo(t) {
2951
- const e = await ut.Nn(this.R, this.En, t, this.grid.cols, this.grid.rows);
2952
- return this.ka(e), e;
2951
+ const e = await ut.Nn(this.L, this.En, t, this.grid.cols, this.grid.rows);
2952
+ return this.La(e), e;
2953
2953
  }
2954
2954
  createTexture(t) {
2955
- const e = Z.Pa(this.R, this.En, t, this.grid.cols, this.grid.rows);
2956
- return this.ka(e), e;
2955
+ const e = Q.Ta(this.L, this.En, t, this.grid.cols, this.grid.rows);
2956
+ return this.La(e), e;
2957
2957
  }
2958
2958
  }, Ve = (n) => class extends n {
2959
2959
  get frameCount() {
@@ -2996,100 +2996,99 @@ const We = (n) => class extends n {
2996
2996
  deltaTime() {
2997
2997
  return this.Ra.Ah;
2998
2998
  }
2999
- }, Ze = (n) => class extends n {
2999
+ }, Qe = (n) => class extends n {
3000
3000
  constructor(...t) {
3001
3001
  super(...t);
3002
3002
  }
3003
3003
  mouseClicked(t) {
3004
- this.bo.Zh(t);
3004
+ this.Co.qh(t);
3005
3005
  }
3006
3006
  mousePressed(t) {
3007
- this.bo.qh(t);
3007
+ this.Co.Vh(t);
3008
3008
  }
3009
3009
  mouseReleased(t) {
3010
- this.bo.Vh(t);
3010
+ this.Co.Jh(t);
3011
3011
  }
3012
3012
  mouseMoved(t) {
3013
- this.bo.Jh(t);
3013
+ this.Co.so(t);
3014
3014
  }
3015
3015
  mouseScrolled(t) {
3016
- this.bo.so(t);
3016
+ this.Co.eo(t);
3017
3017
  }
3018
3018
  get mouse() {
3019
- return this.bo.eo();
3019
+ return this.Co.io();
3020
3020
  }
3021
3021
  cursor(t) {
3022
- this.bo.Bh(t);
3022
+ this.Co.Ih(t);
3023
3023
  }
3024
- }, Qe = (n) => class extends n {
3024
+ }, $e = (n) => class extends n {
3025
3025
  constructor(...t) {
3026
3026
  super(...t);
3027
3027
  }
3028
3028
  touchStarted(t) {
3029
- this.La.aa(t);
3029
+ this.Oa.ca(t);
3030
3030
  }
3031
3031
  touchMoved(t) {
3032
- this.La.Jh(t);
3032
+ this.Oa.so(t);
3033
3033
  }
3034
3034
  touchEnded(t) {
3035
- this.La.ca(t);
3035
+ this.Oa.la(t);
3036
3036
  }
3037
3037
  touchCancelled(t) {
3038
- this.La.la(t);
3038
+ this.Oa.ua(t);
3039
3039
  }
3040
3040
  tap(t) {
3041
- this.La.ua(t);
3041
+ this.Oa.fa(t);
3042
3042
  }
3043
3043
  doubleTap(t) {
3044
- this.La.fa(t);
3044
+ this.Oa.da(t);
3045
3045
  }
3046
3046
  longPress(t) {
3047
- this.La.da(t);
3047
+ this.Oa.pa(t);
3048
3048
  }
3049
3049
  swipe(t) {
3050
- this.La.pa(t);
3050
+ this.Oa.va(t);
3051
3051
  }
3052
3052
  pinch(t) {
3053
- this.La.va(t);
3053
+ this.Oa.ga(t);
3054
3054
  }
3055
3055
  rotateGesture(t) {
3056
- this.La.ga(t);
3056
+ this.Oa.ma(t);
3057
3057
  }
3058
3058
  get touches() {
3059
- return this.La.oa();
3059
+ return this.Oa.aa();
3060
3060
  }
3061
- }, $e = (n) => class extends n {
3061
+ }, qe = (n) => class extends n {
3062
3062
  constructor(...t) {
3063
3063
  super(...t);
3064
3064
  }
3065
3065
  keyPressed(t) {
3066
- this.Oa.qh(t);
3066
+ this.Ha.Vh(t);
3067
3067
  }
3068
3068
  keyReleased(t) {
3069
- this.Oa.Vh(t);
3069
+ this.Ha.Jh(t);
3070
3070
  }
3071
3071
  isKeyPressed(t) {
3072
- return this.Oa.po(t);
3072
+ return this.Ha.vo(t);
3073
3073
  }
3074
3074
  get lastKeyPressed() {
3075
- return this.Oa.mo();
3075
+ return this.Ha._o();
3076
3076
  }
3077
3077
  get lastKeyReleased() {
3078
- return this.Oa._o();
3078
+ return this.Ha.yo();
3079
3079
  }
3080
3080
  get pressedKeys() {
3081
- return this.Oa.yo();
3081
+ return this.Ha.Ao();
3082
3082
  }
3083
3083
  get modifierState() {
3084
- return this.Oa.Ao();
3084
+ return this.Ha.wo();
3085
3085
  }
3086
3086
  };
3087
- class jt {
3087
+ class Wt {
3088
3088
  constructor(t) {
3089
3089
  o(this, "za");
3090
- o(this, "Ha", /* @__PURE__ */ new Map());
3091
- o(this, "Ba", []);
3092
- o(this, "Ia", /* @__PURE__ */ new Map());
3090
+ o(this, "Ba", /* @__PURE__ */ new Map());
3091
+ o(this, "Ia", []);
3093
3092
  o(this, "Ga", /* @__PURE__ */ new Map());
3094
3093
  o(this, "ja", /* @__PURE__ */ new Map());
3095
3094
  o(this, "Qa", /* @__PURE__ */ new Map());
@@ -3097,70 +3096,71 @@ class jt {
3097
3096
  o(this, "Xa", /* @__PURE__ */ new Map());
3098
3097
  o(this, "Ya", /* @__PURE__ */ new Map());
3099
3098
  o(this, "Ka", /* @__PURE__ */ new Map());
3099
+ o(this, "Wa", /* @__PURE__ */ new Map());
3100
3100
  this.za = t;
3101
3101
  }
3102
- Wa(t) {
3102
+ Za(t) {
3103
3103
  for (const e of t) {
3104
- if (this.Ha.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3105
- const i = this.Za(e.name);
3104
+ if (this.Ba.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3105
+ const i = this.qa(e.name);
3106
3106
  try {
3107
3107
  const s = e.install(this.za, i);
3108
3108
  s instanceof Promise && s.catch((r) => {
3109
- console.error(`[textmode.js] Async plugin "${e.name}" installation error:`, r), this.qa(e.name);
3109
+ console.error(`[textmode.js] Async plugin "${e.name}" installation error:`, r), this.Va(e.name);
3110
3110
  });
3111
3111
  } catch (s) {
3112
- throw this.qa(e.name), s;
3112
+ throw this.Va(e.name), s;
3113
3113
  }
3114
- this.Ha.set(e.name, e), this.Ba.push(e.name);
3114
+ this.Ba.set(e.name, e), this.Ia.push(e.name);
3115
3115
  }
3116
3116
  }
3117
- async Va(t) {
3117
+ async Ja(t) {
3118
3118
  for (const e of t) {
3119
- if (this.Ha.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3120
- const i = this.Za(e.name);
3119
+ if (this.Ba.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3120
+ const i = this.qa(e.name);
3121
3121
  try {
3122
3122
  await e.install(this.za, i);
3123
3123
  } catch (s) {
3124
- throw this.qa(e.name), s;
3124
+ throw this.Va(e.name), s;
3125
3125
  }
3126
- this.Ha.set(e.name, e), this.Ba.push(e.name);
3126
+ this.Ba.set(e.name, e), this.Ia.push(e.name);
3127
3127
  }
3128
3128
  }
3129
- async Ja(t) {
3130
- const e = this.Ha.get(t);
3129
+ async tc(t) {
3130
+ const e = this.Ba.get(t);
3131
3131
  if (!e) return;
3132
- const i = this.Za(t);
3133
- e.uninstall && await e.uninstall(this.za, i), this.Ha.delete(t), this.Ba.splice(this.Ba.indexOf(t), 1), this.qa(t);
3134
- }
3135
- tc() {
3136
- this.sc(this.Ia, (t) => t());
3132
+ const i = this.qa(t);
3133
+ e.uninstall && await e.uninstall(this.za, i), this.Ba.delete(t), this.Ia.splice(this.Ia.indexOf(t), 1), this.Va(t);
3137
3134
  }
3138
- ec() {
3139
- this.sc(this.Ga, (t) => t());
3135
+ sc() {
3136
+ this.ec(this.Ga, (t) => t());
3140
3137
  }
3141
- rc(t) {
3142
- this.sc(this.ja, (e) => e(t));
3138
+ rc() {
3139
+ this.ec(this.ja, (t) => t());
3143
3140
  }
3144
3141
  nc(t) {
3145
- this.sc(this.Qa, (e) => e(t));
3142
+ this.ec(this.Qa, (e) => e(t));
3146
3143
  }
3147
3144
  hc(t) {
3148
- this.sc(this.Na, (e) => e(t));
3145
+ this.ec(this.Na, (e) => e(t));
3149
3146
  }
3150
- async oc() {
3151
- await this.ac(this.Xa, (t) => t());
3147
+ oc(t) {
3148
+ this.ec(this.Xa, (e) => e(t));
3152
3149
  }
3153
- async cc() {
3154
- await this.ac(this.Ya, (t) => t());
3150
+ async ac() {
3151
+ await this.cc(this.Ya, (t) => t());
3155
3152
  }
3156
3153
  async lc() {
3157
- const t = [...this.Ha.keys()];
3158
- for (const e of t) await this.Ja(e);
3154
+ await this.cc(this.Ka, (t) => t());
3159
3155
  }
3160
- Za(t) {
3156
+ async uc() {
3157
+ const t = [...this.Ba.keys()];
3158
+ for (const e of t) await this.tc(e);
3159
+ }
3160
+ qa(t) {
3161
3161
  const e = this.za, i = this;
3162
3162
  return { get renderer() {
3163
- return e.R;
3163
+ return e.L;
3164
3164
  }, get canvas() {
3165
3165
  return e.Xr;
3166
3166
  }, get layerManager() {
@@ -3173,184 +3173,184 @@ class jt {
3173
3173
  return e.layers.base.drawFramebuffer;
3174
3174
  }, get asciiFramebuffer() {
3175
3175
  return e.layers.base.asciiFramebuffer;
3176
- }, registerPreDrawHook: (s) => i.uc(i.Ia, t, s), registerPostDrawHook: (s) => i.uc(i.Ga, t, s), registerLayerDisposedHook: (s) => i.uc(i.ja, t, s), registerLayerPreRenderHook: (s) => i.uc(i.Qa, t, s), registerLayerPostRenderHook: (s) => i.uc(i.Na, t, s), registerPreSetupHook: (s) => i.uc(i.Xa, t, s), registerPostSetupHook: (s) => i.uc(i.Ya, t, s), extendLayer: (s, r) => {
3177
- i.fc(t, s, r);
3176
+ }, registerPreDrawHook: (s) => i.fc(i.Ga, t, s), registerPostDrawHook: (s) => i.fc(i.ja, t, s), registerLayerDisposedHook: (s) => i.fc(i.Qa, t, s), registerLayerPreRenderHook: (s) => i.fc(i.Na, t, s), registerLayerPostRenderHook: (s) => i.fc(i.Xa, t, s), registerPreSetupHook: (s) => i.fc(i.Ya, t, s), registerPostSetupHook: (s) => i.fc(i.Ka, t, s), extendLayer: (s, r) => {
3177
+ i.dc(t, s, r);
3178
3178
  }, removeLayerExtension: (s) => {
3179
- i.dc(t, s);
3179
+ i.vc(t, s);
3180
3180
  } };
3181
3181
  }
3182
- uc(t, e, i) {
3182
+ fc(t, e, i) {
3183
3183
  const s = t.get(e) ?? /* @__PURE__ */ new Set();
3184
3184
  return s.add(i), t.set(e, s), () => {
3185
3185
  const r = t.get(e);
3186
3186
  r && (r.delete(i), r.size === 0 && t.delete(e));
3187
3187
  };
3188
3188
  }
3189
- qa(t) {
3190
- this.Ia.delete(t), this.Ga.delete(t), this.ja.delete(t), this.Qa.delete(t), this.Na.delete(t), this.Xa.delete(t), this.Ya.delete(t);
3191
- const e = this.Ka.get(t);
3189
+ Va(t) {
3190
+ this.Ga.delete(t), this.ja.delete(t), this.Qa.delete(t), this.Na.delete(t), this.Xa.delete(t), this.Ya.delete(t), this.Ka.delete(t);
3191
+ const e = this.Wa.get(t);
3192
3192
  if (e) {
3193
- for (const i of e.keys()) this.vc(i);
3194
- this.Ka.delete(t);
3193
+ for (const i of e.keys()) this.gc(i);
3194
+ this.Wa.delete(t);
3195
3195
  }
3196
3196
  }
3197
- sc(t, e) {
3198
- for (const i of this.Ba) {
3197
+ ec(t, e) {
3198
+ for (const i of this.Ia) {
3199
3199
  const s = t.get(i);
3200
3200
  s && s.forEach(e);
3201
3201
  }
3202
3202
  }
3203
- async ac(t, e) {
3204
- for (const i of this.Ba) {
3203
+ async cc(t, e) {
3204
+ for (const i of this.Ia) {
3205
3205
  const s = t.get(i);
3206
3206
  if (s) for (const r of s) await e(r);
3207
3207
  }
3208
3208
  }
3209
- fc(t, e, i) {
3210
- let s = this.Ka.get(t);
3211
- s || (s = /* @__PURE__ */ new Map(), this.Ka.set(t, s));
3212
- for (const [r, h] of this.Ka) r !== t && h.has(e) && console.warn(`[textmode.js] Plugin "${t}" is overwriting layer method "${e}" previously added by plugin "${r}".`);
3213
- s.set(e, i), this.gc(e, i);
3209
+ dc(t, e, i) {
3210
+ let s = this.Wa.get(t);
3211
+ s || (s = /* @__PURE__ */ new Map(), this.Wa.set(t, s));
3212
+ for (const [r, h] of this.Wa) r !== t && h.has(e) && console.warn(`[textmode.js] Plugin "${t}" is overwriting layer method "${e}" previously added by plugin "${r}".`);
3213
+ s.set(e, i), this.mc(e, i);
3214
3214
  }
3215
- dc(t, e) {
3216
- const i = this.Ka.get(t);
3215
+ vc(t, e) {
3216
+ const i = this.Wa.get(t);
3217
3217
  if (!i) return;
3218
3218
  i.delete(e);
3219
3219
  let s = !1;
3220
- for (const [r, h] of this.Ka) if (r !== t && h.has(e)) {
3220
+ for (const [r, h] of this.Wa) if (r !== t && h.has(e)) {
3221
3221
  s = !0;
3222
3222
  const a = h.get(e);
3223
- this.gc(e, a);
3223
+ this.mc(e, a);
3224
3224
  break;
3225
3225
  }
3226
- s || this.vc(e);
3226
+ s || this.gc(e);
3227
3227
  }
3228
- gc(t, e) {
3228
+ mc(t, e) {
3229
3229
  const i = Object.getPrototypeOf(this.za.layers.base);
3230
3230
  Object.defineProperty(i, t, { value: e, writable: !0, configurable: !0, enumerable: !1 });
3231
3231
  }
3232
- vc(t) {
3232
+ gc(t) {
3233
3233
  const e = Object.getPrototypeOf(this.za.layers.base), i = Object.getOwnPropertyDescriptor(e, t);
3234
3234
  i && i.configurable && delete e[t];
3235
3235
  }
3236
3236
  }
3237
- const ri = Object.freeze(Object.defineProperty({ __proto__: null, TextmodePluginManager: jt }, Symbol.toStringTag, { value: "Module" })), W = `#version 300 es
3238
- 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.);}`, Kt = `#version 300 es
3237
+ const ri = Object.freeze(Object.defineProperty({ __proto__: null, TextmodePluginManager: Wt }, Symbol.toStringTag, { value: "Module" })), Z = `#version 300 es
3238
+ 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
3239
3239
  precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`;
3240
- class Wt {
3240
+ class Zt {
3241
3241
  constructor() {
3242
- o(this, "mc", /* @__PURE__ */ new Map());
3243
- o(this, "_c", []);
3244
- o(this, "yc", 0);
3242
+ o(this, "_c", /* @__PURE__ */ new Map());
3243
+ o(this, "yc", []);
3245
3244
  o(this, "wc", 0);
3246
- o(this, "bc");
3247
- }
3248
- get Cc() {
3249
- return this.yc;
3245
+ o(this, "bc", 0);
3246
+ o(this, "Cc");
3250
3247
  }
3251
3248
  get xc() {
3252
- if (this.yc === 0) return 0;
3249
+ return this.wc;
3250
+ }
3251
+ get Mc() {
3252
+ if (this.wc === 0) return 0;
3253
3253
  let t = 0;
3254
- for (const e of this._c) {
3255
- const i = this.mc.get(e);
3256
- i && (t += _(i.progress, 0, 1) * i.weight);
3254
+ for (const e of this.yc) {
3255
+ const i = this._c.get(e);
3256
+ i && (t += U(i.progress, 0, 1) * i.weight);
3257
3257
  }
3258
- return Math.min(1, t / this.yc);
3258
+ return Math.min(1, t / this.wc);
3259
3259
  }
3260
- Mc(t) {
3261
- this.bc = t;
3260
+ Fc(t) {
3261
+ this.Cc = t;
3262
3262
  }
3263
- Fc(t, e = 1) {
3264
- const i = `phase-${this._c.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
3265
- return this.mc.set(i, s), this._c.push(i), this.yc += s.weight, i;
3263
+ $c(t, e = 1) {
3264
+ const i = `phase-${this.yc.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
3265
+ return this._c.set(i, s), this.yc.push(i), this.wc += s.weight, i;
3266
3266
  }
3267
- $c(t, e) {
3268
- const i = this.mc.get(t);
3267
+ Pc(t, e) {
3268
+ const i = this._c.get(t);
3269
3269
  if (!i) return;
3270
- i.progress = _(e, 0, 1), i.status = i.progress >= 1 ? "complete" : "running";
3271
- const s = this.xc;
3272
- Math.abs(s - this.wc) > 1e-3 && (this.wc = s, this.bc && this.bc(s));
3273
- }
3274
- Pc(t) {
3275
- const e = this.mc.get(t);
3276
- e && (e.progress = 1, e.status = "complete", this.$c(t, 1));
3270
+ i.progress = U(e, 0, 1), i.status = i.progress >= 1 ? "complete" : "running";
3271
+ const s = this.Mc;
3272
+ Math.abs(s - this.bc) > 1e-3 && (this.bc = s, this.Cc && this.Cc(s));
3277
3273
  }
3278
3274
  Tc(t) {
3279
- const e = this.mc.get(t);
3275
+ const e = this._c.get(t);
3276
+ e && (e.progress = 1, e.status = "complete", this.Pc(t, 1));
3277
+ }
3278
+ Sc(t) {
3279
+ const e = this._c.get(t);
3280
3280
  e && (e.status = "failed");
3281
3281
  }
3282
- Sc() {
3283
- return this._c.map((t) => {
3284
- const e = this.mc.get(t);
3282
+ Ec() {
3283
+ return this.yc.map((t) => {
3284
+ const e = this._c.get(t);
3285
3285
  return e ? { id: e.id, label: e.label, weight: e.weight, progress: e.progress, status: e.status } : { id: t, label: t, weight: 1, progress: 0, status: "pending" };
3286
3286
  });
3287
3287
  }
3288
3288
  }
3289
3289
  class Vt {
3290
3290
  constructor(t = "active") {
3291
- o(this, "Ec");
3292
- o(this, "kc", "");
3291
+ o(this, "kc");
3292
+ o(this, "Lc", "");
3293
3293
  o(this, "Rc", "");
3294
- this.Ec = t;
3294
+ this.kc = t;
3295
3295
  }
3296
3296
  get Dc() {
3297
- return this.Ec;
3298
- }
3299
- get Lc() {
3300
- return this.Ec !== "disabled";
3297
+ return this.kc;
3301
3298
  }
3302
3299
  get Oc() {
3303
- return this.Ec === "active" || this.Ec === "transitioning" || this.Ec === "error";
3300
+ return this.kc !== "disabled";
3301
+ }
3302
+ get Hc() {
3303
+ return this.kc === "active" || this.kc === "transitioning" || this.kc === "error";
3304
3304
  }
3305
3305
  get zc() {
3306
- return this.kc;
3306
+ return this.Lc;
3307
3307
  }
3308
- get Hc() {
3308
+ get Bc() {
3309
3309
  return this.Rc;
3310
3310
  }
3311
- Bc() {
3312
- this.Ec !== "done" && this.Ec !== "transitioning" || (this.Ec = "active");
3313
- }
3314
3311
  Ic() {
3315
- this.Ec !== "disabled" && (this.Ec = "done");
3312
+ this.kc !== "done" && this.kc !== "transitioning" || (this.kc = "active");
3316
3313
  }
3317
3314
  Gc() {
3318
- this.Ec !== "disabled" && (this.Ec = "transitioning");
3315
+ this.kc !== "disabled" && (this.kc = "done");
3319
3316
  }
3320
3317
  jc() {
3321
- this.Ec === "transitioning" && (this.Ec = "done");
3318
+ this.kc !== "disabled" && (this.kc = "transitioning");
3319
+ }
3320
+ Qc() {
3321
+ this.kc === "transitioning" && (this.kc = "done");
3322
3322
  }
3323
- Qc(t) {
3324
- this.Ec !== "disabled" && (this.Ec = "error", t instanceof Error ? (this.kc = t.message, this.Rc = t.stack || "") : (this.kc = t, this.Rc = ""));
3323
+ Nc(t) {
3324
+ this.kc !== "disabled" && (this.kc = "error", t instanceof Error ? (this.Lc = t.message, this.Rc = t.stack || "") : (this.Lc = t, this.Rc = ""));
3325
3325
  }
3326
- Nc() {
3327
- this.Ec = "disabled";
3326
+ Xc() {
3327
+ this.kc = "disabled";
3328
3328
  }
3329
3329
  }
3330
- class Zt {
3330
+ class Qt {
3331
3331
  constructor(t, e) {
3332
- o(this, "Xc", 0);
3333
- o(this, "Yc", 1);
3334
- o(this, "Kc");
3332
+ o(this, "Yc", 0);
3333
+ o(this, "Kc", 1);
3335
3334
  o(this, "Wc");
3336
- this.Kc = t, this.Wc = e;
3337
- }
3338
- get Zc() {
3339
- return this.Yc;
3335
+ o(this, "Zc");
3336
+ this.Wc = t, this.Zc = e;
3340
3337
  }
3341
3338
  get qc() {
3342
- return this.Yc < 1;
3339
+ return this.Kc;
3340
+ }
3341
+ get Vc() {
3342
+ return this.Kc < 1;
3343
3343
  }
3344
3344
  rh() {
3345
- this.Kc !== "none" && this.Wc > 0 && (this.Xc = performance.now());
3345
+ this.Wc !== "none" && this.Zc > 0 && (this.Yc = performance.now());
3346
3346
  }
3347
3347
  N() {
3348
- if (this.Kc === "none" || this.Wc === 0) return this.Yc = 1, !1;
3349
- const t = performance.now() - this.Xc, e = Math.min(1, t / this.Wc);
3350
- return e >= 1 ? (this.Yc = 0, !0) : (this.Yc = 1 - e, !1);
3348
+ if (this.Wc === "none" || this.Zc === 0) return this.Kc = 1, !1;
3349
+ const t = performance.now() - this.Yc, e = Math.min(1, t / this.Zc);
3350
+ return e >= 1 ? (this.Kc = 0, !0) : (this.Kc = 1 - e, !1);
3351
3351
  }
3352
3352
  Qs() {
3353
- this.Yc = 1, this.Xc = 0;
3353
+ this.Kc = 1, this.Yc = 0;
3354
3354
  }
3355
3355
  }
3356
3356
  function At(n, t) {
@@ -3362,24 +3362,24 @@ function At(n, t) {
3362
3362
  return 0.2126 * l(r) + 0.7152 * l(h) + 0.0722 * l(a);
3363
3363
  }(t) > 0.5 ? "light" : "dark"), { mode: i, background: t, textColor: i === "light" ? "#1A1A1A" : "#F8F8F8", subtleColor: i === "light" ? "#4A4A4A" : "#C0C0C0" };
3364
3364
  }
3365
- function Qt(n) {
3365
+ function $t(n) {
3366
3366
  return n.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
3367
3367
  }
3368
- function $t(n, t) {
3368
+ function qt(n, t) {
3369
3369
  return n.length ? n.map((e) => E.yn(e)) : [t.color("#FFFFFF")];
3370
3370
  }
3371
- class qt {
3371
+ class Kt {
3372
3372
  constructor(t, e, i, s) {
3373
- this.Vc = t, this.id = e, this.label = i, this.Jc = s;
3373
+ this.Jc = t, this.id = e, this.label = i, this.tl = s;
3374
3374
  }
3375
3375
  report(t) {
3376
- this.Vc.$c(this.id, t);
3376
+ this.Jc.Pc(this.id, t);
3377
3377
  }
3378
3378
  complete() {
3379
- this.Vc.Pc(this.id);
3379
+ this.Jc.Tc(this.id);
3380
3380
  }
3381
3381
  fail(t) {
3382
- this.Vc.Tc(this.id), this.Jc && this.Jc(t ?? Error(`Loading phase "${this.label}" failed`));
3382
+ this.Jc.Sc(this.id), this.tl && this.tl(t ?? Error(`Loading phase "${this.label}" failed`));
3383
3383
  }
3384
3384
  async track(t) {
3385
3385
  try {
@@ -3390,25 +3390,25 @@ class qt {
3390
3390
  }
3391
3391
  }
3392
3392
  }
3393
- const qe = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: a, transitionOpacity: l, isError: u, errorMessage: c }) => {
3393
+ const Ke = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: a, transitionOpacity: l, isError: u, errorMessage: c }) => {
3394
3394
  const f = "|/-\\", g = Math.floor(i / 6) % 4, p = E.yn(h.textColor), v = Math.floor(255 * l), d = n.color(p.r, p.g, p.b, v);
3395
3395
  if (n.charColor(d), n.cellColor(0, 0, 0, 0), u) {
3396
3396
  const m = E.yn(h.mode === "light" ? "#D32F2F" : "#FF6B6B").withAlpha(v);
3397
3397
  n.charColor(m), n.push(), n.translate(0, -2, 0), n.char("X"), n.rect(1, 1), n.pop();
3398
- const A = "SETUP ERROR", b = -Math.floor(A.length / 2);
3399
- n.push(), n.translate(b, 0, 0);
3398
+ const A = "SETUP ERROR", w = -Math.floor(A.length / 2);
3399
+ n.push(), n.translate(w, 0, 0);
3400
3400
  for (const y of A) n.char(y), n.rect(1, 1), n.translateX(1);
3401
3401
  if (n.pop(), c) {
3402
- const y = E.yn(h.subtleColor), R = n.color(y.r, y.g, y.b, v);
3403
- n.charColor(R);
3404
- const w = Math.floor(0.8 * t.cols), F = c.split(" "), S = [];
3405
- let T = "";
3406
- for (const C of F) (T + " " + C).length <= w ? T = T ? T + " " + C : C : (T && S.push(T), T = C);
3407
- T && S.push(T);
3408
- const U = S.slice(0, 3);
3409
- S.length > 3 && (U[2] = U[2].substring(0, w - 3) + "..."), U.forEach((C, Q) => {
3402
+ const y = E.yn(h.subtleColor), T = n.color(y.r, y.g, y.b, v);
3403
+ n.charColor(T);
3404
+ const b = Math.floor(0.8 * t.cols), F = c.split(" "), R = [];
3405
+ let M = "";
3406
+ for (const C of F) (M + " " + C).length <= b ? M = M ? M + " " + C : C : (M && R.push(M), M = C);
3407
+ M && R.push(M);
3408
+ const X = R.slice(0, 3);
3409
+ R.length > 3 && (X[2] = X[2].substring(0, b - 3) + "..."), X.forEach((C, $) => {
3410
3410
  const re = -Math.floor(C.length / 2);
3411
- n.push(), n.translate(re, 3 + Q, 0);
3411
+ n.push(), n.translate(re, 3 + $, 0);
3412
3412
  for (const ne of C) n.char(ne), n.rect(1, 1), n.translateX(1);
3413
3413
  n.pop();
3414
3414
  });
@@ -3416,28 +3416,27 @@ const qe = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
3416
3416
  return;
3417
3417
  }
3418
3418
  if (n.push(), n.translate(0, 0, 0), n.char(f[g]), n.rect(1, 1), n.pop(), e > 0 || a.some((m) => m.status !== "pending")) {
3419
- const m = Math.max(6, Math.floor(0.6 * t.cols)), A = -Math.floor(m / 2), b = Math.floor(m * e), y = r.length ? r : [n.color("#FFFFFF")];
3419
+ const m = Math.max(6, Math.floor(0.6 * t.cols)), A = -Math.floor(m / 2), w = Math.floor(m * e), y = r.length ? r : [n.color("#FFFFFF")];
3420
3420
  n.push(), n.translate(A, 3, 0);
3421
- for (let R = 0; R < m; R++) {
3422
- const w = R < b ? "*" : ".", F = y[R % y.length], S = n.color(F.r, F.g, F.b, v);
3423
- n.charColor(S), n.char(w), n.rect(1, 1), n.translateX(1);
3421
+ for (let T = 0; T < m; T++) {
3422
+ const b = T < w ? "*" : ".", F = y[T % y.length], R = n.color(F.r, F.g, F.b, v);
3423
+ n.charColor(R), n.char(b), n.rect(1, 1), n.translateX(1);
3424
3424
  }
3425
3425
  n.pop();
3426
3426
  }
3427
3427
  if (s) {
3428
3428
  const m = E.yn(h.subtleColor), A = n.color(m.r, m.g, m.b, v);
3429
3429
  n.charColor(A);
3430
- const b = -Math.floor(s.length / 2);
3431
- n.push(), n.translate(b, 5, 0);
3430
+ const w = -Math.floor(s.length / 2);
3431
+ n.push(), n.translate(w, 5, 0);
3432
3432
  for (const y of s) n.char(y), n.rect(1, 1), n.translateX(1);
3433
3433
  n.pop();
3434
3434
  }
3435
3435
  };
3436
3436
  class ot {
3437
3437
  constructor(t, e = {}) {
3438
- o(this, "tl");
3439
- o(this, "Zc");
3440
3438
  o(this, "sl");
3439
+ o(this, "qc");
3441
3440
  o(this, "el");
3442
3441
  o(this, "il");
3443
3442
  o(this, "rl");
@@ -3445,122 +3444,123 @@ class ot {
3445
3444
  o(this, "hl");
3446
3445
  o(this, "ol");
3447
3446
  o(this, "al");
3448
- o(this, "yr");
3449
3447
  o(this, "cl");
3448
+ o(this, "yr");
3450
3449
  o(this, "ll");
3451
3450
  o(this, "ul");
3452
3451
  o(this, "fl");
3453
- o(this, "dl", () => {
3452
+ o(this, "dl");
3453
+ o(this, "pl", () => {
3454
3454
  });
3455
- o(this, "pl", []);
3456
- o(this, "vl", /* @__PURE__ */ new Map());
3457
- this.tl = e.visible ?? !0, this.Zc = e.opacity ?? 1, this.sl = e.blendMode ?? "normal", this.el = e.offsetX ?? 0, this.il = e.offsetY ?? 0, this.rl = e.rotationZ ?? 0, this.nl = e.fontSize ?? 16, this.hl = e.fontSource, e.fontSource instanceof Y ? this.yr = e.fontSource : this.yr = new Y(t, this.nl);
3455
+ o(this, "vl", []);
3456
+ o(this, "ml", /* @__PURE__ */ new Map());
3457
+ this.sl = e.visible ?? !0, this.qc = e.opacity ?? 1, this.el = e.blendMode ?? "normal", this.il = e.offsetX ?? 0, this.rl = e.offsetY ?? 0, this.nl = e.rotationZ ?? 0, this.hl = e.fontSize ?? 16, this.ol = e.fontSource, e.fontSource instanceof k ? this.yr = e.fontSource : this.yr = new k(t, this.hl);
3458
3458
  }
3459
- async ml(t) {
3460
- this.ol = t, this.yr.Gr || await this.yr.Er(this.hl);
3459
+ async _l(t) {
3460
+ this.al = t, this.yr.Gr || await this.yr.Er(this.ol);
3461
3461
  const e = this.yr.maxGlyphDimensions;
3462
- this.al = new Ye(this.ol.canvas.canvas, e.width, e.height);
3463
- const i = this.al;
3464
- this.cl = this.ol.createFramebuffer(i.cols, i.rows, 3), this.ll = this.ol.createFramebuffer(i.width, i.height, 1), this.ul = this.ol.createFramebuffer(i.width, i.height, 1), this.fl = [this.ol.createFramebuffer(i.width, i.height, 1, { depth: !1 }), this.ol.createFramebuffer(i.width, i.height, 1, { depth: !1 })], this.al.Vr(() => {
3462
+ this.cl = new ke(this.al.canvas.canvas, e.width, e.height);
3463
+ const i = this.cl;
3464
+ this.ll = this.al.createFramebuffer(i.cols, i.rows, 3), this.ul = this.al.createFramebuffer(i.width, i.height, 1), this.fl = this.al.createFramebuffer(i.width, i.height, 1), this.dl = [this.al.createFramebuffer(i.width, i.height, 1, { depth: !1 }), this.al.createFramebuffer(i.width, i.height, 1, { depth: !1 })], this.cl.Vr(() => {
3465
3465
  var s, r, h;
3466
- this.cl.resize(this.al.cols, this.al.rows), this.ll.resize(this.al.width, this.al.height), (s = this.ul) == null || s.resize(this.al.width, this.al.height), (r = this.fl) == null || r[0].resize(this.al.width, this.al.height), (h = this.fl) == null || h[1].resize(this.al.width, this.al.height);
3466
+ this.ll.resize(this.cl.cols, this.cl.rows), this.ul.resize(this.cl.width, this.cl.height), (s = this.fl) == null || s.resize(this.cl.width, this.cl.height), (r = this.dl) == null || r[0].resize(this.cl.width, this.cl.height), (h = this.dl) == null || h[1].resize(this.cl.width, this.cl.height);
3467
3467
  });
3468
3468
  }
3469
3469
  draw(t) {
3470
- this.dl = t;
3470
+ this.pl = t;
3471
3471
  }
3472
3472
  show() {
3473
- this.tl = !0;
3473
+ this.sl = !0;
3474
3474
  }
3475
3475
  hide() {
3476
- this.tl = !1;
3476
+ this.sl = !1;
3477
3477
  }
3478
3478
  opacity(t) {
3479
- if (t === void 0) return this.Zc;
3480
- this.Zc = _(t, 0, 1);
3479
+ if (t === void 0) return this.qc;
3480
+ this.qc = U(t, 0, 1);
3481
3481
  }
3482
3482
  blendMode(t) {
3483
- if (t === void 0) return this.sl;
3484
- this.sl = t;
3483
+ if (t === void 0) return this.el;
3484
+ this.el = t;
3485
3485
  }
3486
3486
  offset(t, e = 0) {
3487
- if (t === void 0) return { x: this.el, y: this.il };
3488
- this.el = t, this.il = e;
3487
+ if (t === void 0) return { x: this.il, y: this.rl };
3488
+ this.il = t, this.rl = e;
3489
3489
  }
3490
3490
  rotateZ(t) {
3491
- if (t === void 0) return this.rl;
3492
- this.rl = t;
3491
+ if (t === void 0) return this.nl;
3492
+ this.nl = t;
3493
3493
  }
3494
3494
  filter(t, e) {
3495
- this.pl.push({ name: t, params: e });
3495
+ this.vl.push({ name: t, params: e });
3496
3496
  }
3497
3497
  setPluginState(t, e) {
3498
- this.vl.set(t, e);
3498
+ this.ml.set(t, e);
3499
3499
  }
3500
3500
  getPluginState(t) {
3501
- return this.vl.get(t);
3501
+ return this.ml.get(t);
3502
3502
  }
3503
3503
  hasPluginState(t) {
3504
- return this.vl.has(t);
3504
+ return this.ml.has(t);
3505
3505
  }
3506
3506
  deletePluginState(t) {
3507
- return this.vl.delete(t);
3507
+ return this.ml.delete(t);
3508
3508
  }
3509
3509
  fontSize(t) {
3510
3510
  if (t === void 0) return this.yr.fontSize;
3511
- yt.m(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) && this.yr.fontSize !== t && (this.yr.Dr(t), this._l());
3511
+ yt.m(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) && this.yr.fontSize !== t && (this.yr.Rr(t), this.yl());
3512
3512
  }
3513
3513
  async loadFont(t) {
3514
3514
  if (!this.yr) throw Error("Layer font not initialized. Ensure layer is attached before loading fonts.");
3515
- return t instanceof Y ? (this.yr !== t && this.yr.dispose(), this.yr = t, this.yr.Gr || await this.yr.Er()) : await this.yr.Or(t), this._l(), this.yr;
3515
+ return t instanceof k ? (this.yr !== t && this.yr.dispose(), this.yr = t, this.yr.Gr || await this.yr.Er()) : await this.yr.Or(t), this.yl(), this.yr;
3516
3516
  }
3517
3517
  Da(t, e) {
3518
- if (!this.tl || !this.cl || !this.ll) return;
3519
- const i = this.ol.renderer, s = this.al;
3520
- t.yl.nc(this), this.cl.begin(), i.state.Vt(), t.Al = this;
3518
+ if (!this.sl || !this.ll || !this.ul) return;
3519
+ const i = this.al.renderer, s = this.cl;
3520
+ t.Al.hc(this), this.ll.begin(), i.state.Vt(), t.wl = this;
3521
3521
  try {
3522
- this.dl.call(t);
3522
+ this.pl.call(t);
3523
3523
  } finally {
3524
- t.Al = void 0;
3524
+ t.wl = void 0;
3525
3525
  }
3526
- this.cl.end(), t.yl.hc(this);
3527
- const r = this.pl.length > 0, h = r ? this.ul : this.ll;
3528
- h.begin(), i.xi(e), e.gt({ u_characterTexture: this.yr.fontFramebuffer, u_charsetDimensions: [this.yr.textureColumns, this.yr.textureRows], U2: this.cl.textures[0], U0: this.cl.textures[1], U1: this.cl.textures[2], U3: [s.cols, s.rows], U4: [h.width, h.height], U5: [0, 0, 0, 0] }), i.Ei(0, 0, s.width, s.height), h.end(), r && this.ol.filterManager.wl(this.ul.textures[0], this.ll, this.pl, this.ll.width, this.ll.height, this.fl), this.pl = [];
3526
+ this.ll.end(), t.Al.oc(this);
3527
+ const r = this.vl.length > 0, h = r ? this.fl : this.ul;
3528
+ h.begin(), i.xi(e), e.gt({ u_characterTexture: this.yr.fontFramebuffer, u_charsetDimensions: [this.yr.textureColumns, this.yr.textureRows], U2: this.ll.textures[0], U0: this.ll.textures[1], U1: this.ll.textures[2], U3: [s.cols, s.rows], U4: [h.width, h.height], U5: [0, 0, 0, 0] }), i.Ei(0, 0, s.width, s.height), h.end(), r && this.al.filterManager.bl(this.fl.textures[0], this.ul, this.vl, this.ul.width, this.ul.height, this.dl), this.vl = [];
3529
3529
  }
3530
3530
  vn() {
3531
3531
  var t;
3532
- this.cl && this.ll && ((t = this.al) == null || t.reset());
3532
+ this.ll && this.ul && ((t = this.cl) == null || t.reset());
3533
3533
  }
3534
3534
  Ss() {
3535
3535
  var t, e, i, s, r, h, a;
3536
- (t = this.cl) == null || t.dispose(), (e = this.ll) == null || e.dispose(), (i = this.ul) == null || i.dispose(), (s = this.fl) == null || s[0].dispose(), (r = this.fl) == null || r[1].dispose(), (h = this.yr) == null || h.dispose(), (a = this.al) == null || a.Ss();
3536
+ (t = this.ll) == null || t.dispose(), (e = this.ul) == null || e.dispose(), (i = this.fl) == null || i.dispose(), (s = this.dl) == null || s[0].dispose(), (r = this.dl) == null || r[1].dispose(), (h = this.yr) == null || h.dispose(), (a = this.cl) == null || a.Ss();
3537
3537
  }
3538
3538
  get texture() {
3539
3539
  var t;
3540
- return (t = this.ll) == null ? void 0 : t.textures[0];
3540
+ return (t = this.ul) == null ? void 0 : t.textures[0];
3541
3541
  }
3542
3542
  get grid() {
3543
- return this.al;
3543
+ return this.cl;
3544
3544
  }
3545
3545
  get font() {
3546
3546
  return this.yr;
3547
3547
  }
3548
3548
  get width() {
3549
- return this.ll ? this.ll.width : 0;
3549
+ return this.ul ? this.ul.width : 0;
3550
3550
  }
3551
3551
  get height() {
3552
- return this.ll ? this.ll.height : 0;
3552
+ return this.ul ? this.ul.height : 0;
3553
3553
  }
3554
3554
  get drawFramebuffer() {
3555
- return this.cl;
3555
+ return this.ll;
3556
3556
  }
3557
3557
  get asciiFramebuffer() {
3558
- return this.ll;
3558
+ return this.ul;
3559
3559
  }
3560
- _l() {
3561
- if (!this.al || !this.yr) return;
3560
+ yl() {
3561
+ if (!this.cl || !this.yr) return;
3562
3562
  const t = this.yr.maxGlyphDimensions;
3563
- this.al.tn(t.width, t.height), this.cl && this.ll && this.vn();
3563
+ this.cl.tn(t.width, t.height), this.ll && this.ul && this.vn();
3564
3564
  }
3565
3565
  }
3566
3566
  const Je = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
@@ -3568,104 +3568,104 @@ class Jt {
3568
3568
  constructor(t, e, i) {
3569
3569
  o(this, "za");
3570
3570
  o(this, "l");
3571
- o(this, "bl");
3572
- o(this, "Vc");
3573
3571
  o(this, "Cl");
3572
+ o(this, "Jc");
3574
3573
  o(this, "xl");
3575
3574
  o(this, "Ml");
3576
3575
  o(this, "Fl");
3577
- o(this, "$l", []);
3578
- o(this, "Pl");
3579
- o(this, "Tl", performance.now());
3580
- o(this, "Sl", 0);
3581
- o(this, "El", !1);
3576
+ o(this, "$l");
3577
+ o(this, "Pl", []);
3578
+ o(this, "Tl");
3579
+ o(this, "Sl", performance.now());
3580
+ o(this, "El", 0);
3581
+ o(this, "kl", !1);
3582
3582
  o(this, "Sr", !1);
3583
- o(this, "Ll");
3584
- this.za = t, this.l = { ...Je, ...e ?? {} }, this.bl = new Vt("active"), this.Vc = new Wt(), this.Cl = new Zt(this.l.transition, this.l.transitionDuration), this.xl = new Nt(60), this.Pl = At(this.l, i);
3585
- const s = Qt(this.Pl);
3586
- this.$l = $t(s, this.za), this.Fl = this.kl(), this.Vc.Mc((r) => {
3587
- r >= 0.999 && this.Ic();
3583
+ o(this, "Ol");
3584
+ this.za = t, this.l = { ...Je, ...e ?? {} }, this.Cl = new Vt("active"), this.Jc = new Zt(), this.xl = new Qt(this.l.transition, this.l.transitionDuration), this.Ml = new Nt(60), this.Tl = At(this.l, i);
3585
+ const s = $t(this.Tl);
3586
+ this.Pl = qt(s, this.za), this.$l = this.Ll(), this.Jc.Fc((r) => {
3587
+ r >= 0.999 && this.Gc();
3588
3588
  });
3589
3589
  }
3590
3590
  async Er() {
3591
3591
  if (this.Sr) return;
3592
- const t = this.za.R, e = this.za.Xr;
3593
- this.Ml = new ot(t, { visible: !0, opacity: 1, fontSize: 16 }), await this.Ml.ml({ renderer: t, canvas: e, filterManager: null, createFramebuffer: (i, s, r = 1, h) => t.Hi(i, s, r, h) }), this.Sr = !0;
3592
+ const t = this.za.L, e = this.za.Xr;
3593
+ this.Fl = new ot(t, { visible: !0, opacity: 1, fontSize: 16 }), await this.Fl._l({ renderer: t, canvas: e, filterManager: null, createFramebuffer: (i, s, r = 1, h) => t.zi(i, s, r, h) }), this.Sr = !0;
3594
3594
  }
3595
- get Oc() {
3596
- return this.bl.Oc && this.El;
3595
+ get Hc() {
3596
+ return this.Cl.Hc && this.kl;
3597
3597
  }
3598
3598
  rh() {
3599
- this.El || (this.El = !0, this.Tl = performance.now(), this.Sl = 0, this.xl.rh(() => this.Rl()));
3599
+ this.kl || (this.kl = !0, this.Sl = performance.now(), this.El = 0, this.Ml.rh(() => this.Rl()));
3600
3600
  }
3601
3601
  nh() {
3602
- this.El && (this.El = !1, this.xl.nh());
3602
+ this.kl && (this.kl = !1, this.Ml.nh());
3603
3603
  }
3604
3604
  vn() {
3605
- this.Sr && this.Ml.vn();
3605
+ this.Sr && this.Fl.vn();
3606
3606
  }
3607
3607
  Ss() {
3608
- this.nh(), this.Sr && (this.Ml.Ss(), this.Sr = !1);
3608
+ this.nh(), this.Sr && (this.Fl.Ss(), this.Sr = !1);
3609
3609
  }
3610
3610
  get progress() {
3611
- return this.Vc.xc;
3611
+ return this.Jc.Mc;
3612
3612
  }
3613
3613
  message(t) {
3614
3614
  return typeof t == "string" && (this.l.message = t), this.l.message;
3615
3615
  }
3616
3616
  addPhase(t, e = 1) {
3617
- this.bl.Bc();
3618
- const i = this.Vc.Fc(t, e);
3619
- return new qt(this.Vc, i, t, (s) => this.error(s));
3617
+ this.Cl.Ic();
3618
+ const i = this.Jc.$c(t, e);
3619
+ return new Kt(this.Jc, i, t, (s) => this.error(s));
3620
3620
  }
3621
- Ic() {
3622
- this.bl.Dc !== "error" && (this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.bl.Gc(), this.Cl.rh()) : (this.bl.Ic(), this.nh(), this.Dl()));
3621
+ Gc() {
3622
+ this.Cl.Dc !== "error" && (this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.Cl.jc(), this.xl.rh()) : (this.Cl.Gc(), this.nh(), this.Dl()));
3623
3623
  }
3624
3624
  Dl() {
3625
- this.Ll && this.Ll();
3625
+ this.Ol && this.Ol();
3626
3626
  }
3627
- Ol(t) {
3628
- this.Ll = t;
3627
+ Hl(t) {
3628
+ this.Ol = t;
3629
3629
  }
3630
3630
  error(t) {
3631
- this.bl.Qc(t);
3631
+ this.Cl.Nc(t);
3632
3632
  }
3633
3633
  Rl() {
3634
- if (this.bl.Oc) {
3635
- if (this.Sl++, this.bl.Dc === "transitioning" && this.Cl.N())
3636
- return this.bl.jc(), this.Dl(), void this.nh();
3634
+ if (this.Cl.Hc) {
3635
+ if (this.El++, this.Cl.Dc === "transitioning" && this.xl.N())
3636
+ return this.Cl.Qc(), this.Dl(), void this.nh();
3637
3637
  this.zl();
3638
3638
  }
3639
3639
  }
3640
3640
  zl() {
3641
3641
  if (!this.Sr) return;
3642
- const t = this.Ml, e = t.grid, i = this.za.R, s = { textmodifier: this.za, grid: e, progress: this.progress, elapsedMs: performance.now() - this.Tl, frameCount: this.Sl, message: this.l.message, palette: this.$l, theme: this.Pl, phases: this.Vc.Sc(), transitionOpacity: this.Cl.Zc, isError: this.bl.Dc === "error", errorMessage: this.bl.zc || void 0, errorDetails: this.bl.Hc || void 0 };
3642
+ const t = this.Fl, e = t.grid, i = this.za.L, s = { textmodifier: this.za, grid: e, progress: this.progress, elapsedMs: performance.now() - this.Sl, frameCount: this.El, message: this.l.message, palette: this.Pl, theme: this.Tl, phases: this.Jc.Ec(), transitionOpacity: this.xl.qc, isError: this.Cl.Dc === "error", errorMessage: this.Cl.zc || void 0, errorDetails: this.Cl.Bc || void 0 };
3643
3643
  t.draw(() => {
3644
3644
  this.za.resetShader(), this.za.clear(), this.za.push();
3645
3645
  try {
3646
- this.Fl(s);
3646
+ this.$l(s);
3647
3647
  } finally {
3648
3648
  this.za.pop();
3649
3649
  }
3650
- }), t.Da(this.za, this.za.Hl);
3650
+ }), t.Da(this.za, this.za.Bl);
3651
3651
  const r = t.texture;
3652
- r && (i.xe(...i.state.canvasBackgroundColor), i.xi(this.za.Bl), this.za.Bl.gt({ u_texture: r }), i.Ei(e.offsetX, e.offsetY, e.width, e.height));
3652
+ r && (i.xe(...i.state.canvasBackgroundColor), i.xi(this.za.Il), this.za.Il.gt({ u_texture: r }), i.Ei(e.offsetX, e.offsetY, e.width, e.height));
3653
3653
  }
3654
- Il(t) {
3655
- this.Pl = At(this.l, t);
3654
+ Gl(t) {
3655
+ this.Tl = At(this.l, t);
3656
3656
  }
3657
- kl() {
3658
- const t = this.l.renderer || qe;
3657
+ Ll() {
3658
+ const t = this.l.renderer || Ke;
3659
3659
  return (e) => {
3660
- t(e), this.Gl(e);
3660
+ t(e), this.jl(e);
3661
3661
  };
3662
3662
  }
3663
- Gl(t) {
3663
+ jl(t) {
3664
3664
  const { textmodifier: e, grid: i, frameCount: s, theme: r, transitionOpacity: h } = t, a = [116, 101, 120, 116, 109, 111, 100, 101, 46, 106, 115].map((f) => String.fromCharCode(f)).join(""), l = (i.rows + 1 >> 1) - 2, u = 2 - (i.cols + 1 >> 1), c = r.mode === "light" ? [[233, 30, 99], [156, 39, 176], [255, 111, 0]] : [[142, 249, 243], [241, 91, 181], [255, 155, 113]];
3665
3665
  e.push(), e.translate(u, l, 0);
3666
3666
  for (let f = 0; f < a.length; f++) {
3667
- const g = a[f], p = Math.floor(0.1 * s + 0.5 * f) % c.length, [v, d, m] = c[p], A = Math.floor(255 * h), b = e.color(v, d, m, A);
3668
- e.charColor(b), e.char(g), e.point(), e.translateX(1);
3667
+ const g = a[f], p = Math.floor(0.1 * s + 0.5 * f) % c.length, [v, d, m] = c[p], A = Math.floor(255 * h), w = e.color(v, d, m, A);
3668
+ e.charColor(w), e.char(g), e.point(), e.translateX(1);
3669
3669
  }
3670
3670
  e.pop();
3671
3671
  }
@@ -3673,162 +3673,162 @@ class Jt {
3673
3673
  const Ct = { 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 };
3674
3674
  class te {
3675
3675
  constructor(t, e, i) {
3676
- o(this, "R");
3677
- o(this, "jl");
3678
- o(this, "fl");
3679
- o(this, "Ql", 0);
3680
- this.R = t, this.jl = t.Mi(W, `#version 300 es
3681
- 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.fl = [this.R.Hi(e, i, 1), this.R.Hi(e, i, 1)];
3682
- }
3683
- Nl(t) {
3684
- const e = this.R.context, { base: i, targetFramebuffer: s, backgroundColor: r, layers: h, canvasWidth: a, canvasHeight: l } = t, u = e.isEnabled(e.DEPTH_TEST), c = e.getParameter(e.DEPTH_WRITEMASK);
3676
+ o(this, "L");
3677
+ o(this, "Ql");
3678
+ o(this, "dl");
3679
+ o(this, "Nl", 0);
3680
+ this.L = t, this.Ql = t.Mi(Z, `#version 300 es
3681
+ 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.dl = [this.L.zi(e, i, 1), this.L.zi(e, i, 1)];
3682
+ }
3683
+ Xl(t) {
3684
+ const e = this.L.context, { base: i, targetFramebuffer: s, backgroundColor: r, layers: h, canvasWidth: a, canvasHeight: l } = t, u = e.isEnabled(e.DEPTH_TEST), c = e.getParameter(e.DEPTH_WRITEMASK);
3685
3685
  u && e.disable(e.DEPTH_TEST), c && e.depthMask(!1);
3686
- const f = this.fl[0];
3687
- f.begin(), this.R.xe(...r), f.end(), this.Ql = 0, i.layer.tl && this.Xl(i.texture, a, l, i.width, i.height, i.layer.Zc, i.offsetX, i.offsetY, i.layer.rl, "normal");
3686
+ const f = this.dl[0];
3687
+ f.begin(), this.L.xe(...r), f.end(), this.Nl = 0, i.layer.sl && this.Yl(i.texture, a, l, i.width, i.height, i.layer.qc, i.offsetX, i.offsetY, i.layer.nl, "normal");
3688
3688
  for (const g of h) {
3689
3689
  const p = g.layer;
3690
- p.tl && this.Xl(g.texture, a, l, g.width, g.height, p.Zc, g.offsetX, g.offsetY, p.rl, p.sl);
3690
+ p.sl && this.Yl(g.texture, a, l, g.width, g.height, p.qc, g.offsetX, g.offsetY, p.nl, p.el);
3691
3691
  }
3692
- this.Yl(s, a, l), e.depthMask(c), u && e.enable(e.DEPTH_TEST);
3692
+ this.Kl(s, a, l), e.depthMask(c), u && e.enable(e.DEPTH_TEST);
3693
3693
  }
3694
- Xl(t, e, i, s, r, h, a, l, u, c) {
3695
- const f = this.fl[this.Ql], g = this.Ql === 0 ? 1 : 0, p = this.fl[g], v = N(u);
3696
- p.begin(), this.R.xi(this.jl), this.jl.gt({ Uj: t, Uk: f.textures[0], Ul: [e, i], Um: [s, r], Un: [a, l], Uo: h, Up: v, Uq: Ct[c] }), this.R.Ei(0, 0, f.width, f.height), p.end(), this.Ql = g;
3694
+ Yl(t, e, i, s, r, h, a, l, u, c) {
3695
+ const f = this.dl[this.Nl], g = this.Nl === 0 ? 1 : 0, p = this.dl[g], v = N(u);
3696
+ p.begin(), this.L.xi(this.Ql), this.Ql.gt({ Uj: t, Uk: f.textures[0], Ul: [e, i], Um: [s, r], Un: [a, l], Uo: h, Up: v, Uq: Ct[c] }), this.L.Ei(0, 0, f.width, f.height), p.end(), this.Nl = g;
3697
3697
  }
3698
- Yl(t, e, i) {
3699
- const s = this.fl[this.Ql];
3700
- t.begin(), this.R.xi(this.jl), this.jl.gt({ Uj: s.textures[0], Uk: s.textures[0], Ul: [e, i], Um: [s.width, s.height], Un: [0, 0], Uo: 1, Up: 0, Uq: Ct.normal }), this.R.Ei(0, 0, e, i), t.end();
3698
+ Kl(t, e, i) {
3699
+ const s = this.dl[this.Nl];
3700
+ t.begin(), this.L.xi(this.Ql), this.Ql.gt({ Uj: s.textures[0], Uk: s.textures[0], Ul: [e, i], Um: [s.width, s.height], Un: [0, 0], Uo: 1, Up: 0, Uq: Ct.normal }), this.L.Ei(0, 0, e, i), t.end();
3701
3701
  }
3702
3702
  vn(t, e) {
3703
- this.fl[0].resize(t, e), this.fl[1].resize(t, e);
3703
+ this.dl[0].resize(t, e), this.dl[1].resize(t, e);
3704
3704
  }
3705
3705
  Ss() {
3706
- this.jl.dispose(), this.fl[0].dispose(), this.fl[1].dispose();
3706
+ this.Ql.dispose(), this.dl[0].dispose(), this.dl[1].dispose();
3707
3707
  }
3708
3708
  }
3709
3709
  class ti {
3710
3710
  constructor(t = {}) {
3711
- o(this, "Kl", []);
3712
3711
  o(this, "Wl", []);
3713
- o(this, "Zl", !1);
3712
+ o(this, "Zl", []);
3713
+ o(this, "ql", !1);
3714
3714
  o(this, "l");
3715
3715
  this.l = t;
3716
3716
  }
3717
3717
  async initialize(t) {
3718
3718
  var e, i;
3719
- for (const s of this.Wl) t && await t(s), this.Kl.push(s), (i = (e = this.l).onAdd) == null || i.call(e, s);
3720
- this.Wl = [], this.Zl = !0;
3719
+ for (const s of this.Zl) t && await t(s), this.Wl.push(s), (i = (e = this.l).onAdd) == null || i.call(e, s);
3720
+ this.Zl = [], this.ql = !0;
3721
3721
  }
3722
3722
  get isReady() {
3723
- return this.Zl;
3723
+ return this.ql;
3724
3724
  }
3725
3725
  add(t) {
3726
3726
  var e, i;
3727
- return this.Zl ? (this.Kl.push(t), (i = (e = this.l).onAdd) == null || i.call(e, t)) : this.Wl.push(t), t;
3727
+ return this.ql ? (this.Wl.push(t), (i = (e = this.l).onAdd) == null || i.call(e, t)) : this.Zl.push(t), t;
3728
3728
  }
3729
3729
  addMany(t) {
3730
3730
  for (const e of t) this.add(e);
3731
3731
  return t;
3732
3732
  }
3733
3733
  remove(t) {
3734
- const e = this.Kl.indexOf(t);
3735
- if (e !== -1) return this.Kl.splice(e, 1), this.ql(t), !0;
3736
- const i = this.Wl.indexOf(t);
3737
- return i !== -1 && (this.Wl.splice(i, 1), this.ql(t), !0);
3734
+ const e = this.Wl.indexOf(t);
3735
+ if (e !== -1) return this.Wl.splice(e, 1), this.Vl(t), !0;
3736
+ const i = this.Zl.indexOf(t);
3737
+ return i !== -1 && (this.Zl.splice(i, 1), this.Vl(t), !0);
3738
3738
  }
3739
3739
  removeAt(t) {
3740
- if (t < 0 || t >= this.Kl.length) return;
3741
- const [e] = this.Kl.splice(t, 1);
3742
- return this.ql(e), e;
3740
+ if (t < 0 || t >= this.Wl.length) return;
3741
+ const [e] = this.Wl.splice(t, 1);
3742
+ return this.Vl(e), e;
3743
3743
  }
3744
3744
  move(t, e) {
3745
3745
  var r, h;
3746
- const i = this.Kl.indexOf(t);
3746
+ const i = this.Wl.indexOf(t);
3747
3747
  if (i !== -1) {
3748
- this.Kl.splice(i, 1);
3749
- const a = _(e, 0, this.Kl.length);
3750
- return this.Kl.splice(a, 0, t), (h = (r = this.l).onMove) == null || h.call(r, t, i, a), !0;
3748
+ this.Wl.splice(i, 1);
3749
+ const a = U(e, 0, this.Wl.length);
3750
+ return this.Wl.splice(a, 0, t), (h = (r = this.l).onMove) == null || h.call(r, t, i, a), !0;
3751
3751
  }
3752
- const s = this.Wl.indexOf(t);
3752
+ const s = this.Zl.indexOf(t);
3753
3753
  if (s !== -1) {
3754
- this.Wl.splice(s, 1);
3755
- const a = _(e, 0, this.Wl.length);
3756
- return this.Wl.splice(a, 0, t), !0;
3754
+ this.Zl.splice(s, 1);
3755
+ const a = U(e, 0, this.Zl.length);
3756
+ return this.Zl.splice(a, 0, t), !0;
3757
3757
  }
3758
3758
  return !1;
3759
3759
  }
3760
3760
  swap(t, e) {
3761
3761
  var a, l;
3762
3762
  if (t === e) return !0;
3763
- const i = this.Kl.indexOf(t), s = this.Kl.indexOf(e);
3764
- if (i !== -1 && s !== -1) return this.Kl[i] = e, this.Kl[s] = t, (l = (a = this.l).onSwap) == null || l.call(a, t, e, i, s), !0;
3765
- const r = this.Wl.indexOf(t), h = this.Wl.indexOf(e);
3766
- return r !== -1 && h !== -1 && (this.Wl[r] = e, this.Wl[h] = t, !0);
3763
+ const i = this.Wl.indexOf(t), s = this.Wl.indexOf(e);
3764
+ if (i !== -1 && s !== -1) return this.Wl[i] = e, this.Wl[s] = t, (l = (a = this.l).onSwap) == null || l.call(a, t, e, i, s), !0;
3765
+ const r = this.Zl.indexOf(t), h = this.Zl.indexOf(e);
3766
+ return r !== -1 && h !== -1 && (this.Zl[r] = e, this.Zl[h] = t, !0);
3767
3767
  }
3768
3768
  clear() {
3769
- for (const t of this.Kl) this.ql(t);
3770
- this.Kl = [];
3771
- for (const t of this.Wl) this.ql(t);
3769
+ for (const t of this.Wl) this.Vl(t);
3772
3770
  this.Wl = [];
3771
+ for (const t of this.Zl) this.Vl(t);
3772
+ this.Zl = [];
3773
3773
  }
3774
3774
  dispose() {
3775
- this.clear(), this.Zl = !1;
3775
+ this.clear(), this.ql = !1;
3776
3776
  }
3777
3777
  get all() {
3778
- return this.Kl;
3778
+ return this.Wl;
3779
3779
  }
3780
3780
  get pending() {
3781
- return this.Wl;
3781
+ return this.Zl;
3782
3782
  }
3783
3783
  get length() {
3784
- return this.Kl.length;
3784
+ return this.Wl.length;
3785
3785
  }
3786
3786
  get totalLength() {
3787
- return this.Kl.length + this.Wl.length;
3787
+ return this.Wl.length + this.Zl.length;
3788
3788
  }
3789
3789
  get isEmpty() {
3790
- return this.Kl.length === 0;
3790
+ return this.Wl.length === 0;
3791
3791
  }
3792
3792
  get(t) {
3793
- return this.Kl[t];
3793
+ return this.Wl[t];
3794
3794
  }
3795
3795
  get first() {
3796
- return this.Kl[0];
3796
+ return this.Wl[0];
3797
3797
  }
3798
3798
  get last() {
3799
- return this.Kl[this.Kl.length - 1];
3799
+ return this.Wl[this.Wl.length - 1];
3800
3800
  }
3801
3801
  indexOf(t) {
3802
- return this.Kl.indexOf(t);
3802
+ return this.Wl.indexOf(t);
3803
3803
  }
3804
3804
  has(t) {
3805
- return this.Kl.includes(t) || this.Wl.includes(t);
3805
+ return this.Wl.includes(t) || this.Zl.includes(t);
3806
3806
  }
3807
3807
  [Symbol.iterator]() {
3808
- return this.Kl[Symbol.iterator]();
3808
+ return this.Wl[Symbol.iterator]();
3809
3809
  }
3810
- ql(t) {
3810
+ Vl(t) {
3811
3811
  var e, i, s, r;
3812
3812
  (i = (e = this.l).onRemove) == null || i.call(e, t), (r = (s = this.l).onDispose) == null || r.call(s, t);
3813
3813
  }
3814
3814
  }
3815
3815
  class ee {
3816
3816
  constructor(t) {
3817
- o(this, "R");
3818
- o(this, "Vl", /* @__PURE__ */ new Map());
3817
+ o(this, "L");
3819
3818
  o(this, "Jl", /* @__PURE__ */ new Map());
3819
+ o(this, "tu", /* @__PURE__ */ new Map());
3820
3820
  o(this, "Ke");
3821
- o(this, "fl");
3821
+ o(this, "dl");
3822
3822
  o(this, "Sr", !1);
3823
- this.R = t, this.Ke = t.Mi(W, Kt), this.tu();
3823
+ this.L = t, this.Ke = t.Mi(Z, jt), this.su();
3824
3824
  }
3825
3825
  async register(t, e, i = {}) {
3826
3826
  const s = Object.entries(i), r = s.length > 0 ? s[0][1][0] : null;
3827
3827
  let h;
3828
3828
  if (typeof e == "string") {
3829
3829
  const l = await st(e);
3830
- h = this.R.Mi(W, l), this.Jl.set(t, h);
3831
- } else h = e, this.Jl.set(t, h);
3830
+ h = this.L.Mi(Z, l), this.tu.set(t, h);
3831
+ } else h = e, this.tu.set(t, h);
3832
3832
  const a = { id: t, createShader: () => h, createUniforms: (l, u) => {
3833
3833
  const c = { u_resolution: [u.width, u.height] };
3834
3834
  for (const [f, [g, p]] of s) {
@@ -3837,215 +3837,215 @@ class ee {
3837
3837
  if (typeof l == "number" && g === r) v = l;
3838
3838
  else if (typeof l == "object" && g in l) {
3839
3839
  const d = l[g];
3840
- Ut(d) && (v = d);
3840
+ Xt(d) && (v = d);
3841
3841
  }
3842
3842
  }
3843
3843
  c[f] = v;
3844
3844
  }
3845
3845
  return c;
3846
3846
  } };
3847
- this.Vl.set(t, a);
3847
+ this.Jl.set(t, a);
3848
3848
  }
3849
3849
  unregister(t) {
3850
- const e = this.Jl.get(t);
3851
- return e && (e.dispose(), this.Jl.delete(t)), this.Vl.delete(t);
3850
+ const e = this.tu.get(t);
3851
+ return e && (e.dispose(), this.tu.delete(t)), this.Jl.delete(t);
3852
3852
  }
3853
3853
  has(t) {
3854
- return this.Vl.has(t);
3854
+ return this.Jl.has(t);
3855
3855
  }
3856
3856
  Er(t, e) {
3857
- this.Sr || (this.fl = [this.R.Hi(t, e, 1, { depth: !1 }), this.R.Hi(t, e, 1, { depth: !1 })], this.Sr = !0);
3857
+ this.Sr || (this.dl = [this.L.zi(t, e, 1, { depth: !1 }), this.L.zi(t, e, 1, { depth: !1 })], this.Sr = !0);
3858
3858
  }
3859
- su(t, e, i, s, r) {
3860
- this.fl[0].width === s && this.fl[0].height === r || (this.fl[0].resize(s, r), this.fl[1].resize(s, r)), this.wl(t, e, i, s, r, this.fl);
3859
+ eu(t, e, i, s, r) {
3860
+ this.dl[0].width === s && this.dl[0].height === r || (this.dl[0].resize(s, r), this.dl[1].resize(s, r)), this.bl(t, e, i, s, r, this.dl);
3861
3861
  }
3862
- wl(t, e, i, s, r, h) {
3863
- if (i.length === 0) return void this.eu(t, e, s, r);
3864
- this.eu(t, h[0], s, r);
3862
+ bl(t, e, i, s, r, h) {
3863
+ if (i.length === 0) return void this.iu(t, e, s, r);
3864
+ this.iu(t, h[0], s, r);
3865
3865
  let a = 0;
3866
3866
  for (let l = 0; l < i.length; l++) {
3867
3867
  const u = i[l], c = l === i.length - 1, f = a === 0 ? 1 : 0, g = c ? e : h[f];
3868
- this.iu(u, h[a], g, s, r), c || (a = f);
3868
+ this.ru(u, h[a], g, s, r), c || (a = f);
3869
3869
  }
3870
3870
  }
3871
- iu(t, e, i, s, r) {
3872
- const h = this.Vl.get(t.name);
3873
- if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.eu(e.textures[0], i, s, r);
3874
- const a = this.ru(t.name, h, s, r), l = { renderer: this.R, gl: this.R.context, width: s, height: r };
3875
- i.begin(), this.R.xi(a), a.gt({ u_texture: e.textures[0] });
3871
+ ru(t, e, i, s, r) {
3872
+ const h = this.Jl.get(t.name);
3873
+ if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.iu(e.textures[0], i, s, r);
3874
+ const a = this.nu(t.name, h, s, r), l = { renderer: this.L, gl: this.L.context, width: s, height: r };
3875
+ i.begin(), this.L.xi(a), a.gt({ u_texture: e.textures[0] });
3876
3876
  const u = h.createUniforms(t.params, l);
3877
- a.gt(u), this.R.Ei(0, 0, s, r), i.end();
3877
+ a.gt(u), this.L.Ei(0, 0, s, r), i.end();
3878
3878
  }
3879
- ru(t, e, i, s) {
3880
- let r = this.Jl.get(t);
3879
+ nu(t, e, i, s) {
3880
+ let r = this.tu.get(t);
3881
3881
  if (!r && e) {
3882
- const h = { renderer: this.R, gl: this.R.context, width: i, height: s };
3883
- r = e.createShader(h), this.Jl.set(t, r);
3882
+ const h = { renderer: this.L, gl: this.L.context, width: i, height: s };
3883
+ r = e.createShader(h), this.tu.set(t, r);
3884
3884
  }
3885
3885
  return r;
3886
3886
  }
3887
- eu(t, e, i, s) {
3888
- e.begin(), this.R.xi(this.Ke), this.Ke.gt({ u_texture: t, u_resolution: [i, s] }), this.R.Ei(0, 0, i, s), e.end();
3887
+ iu(t, e, i, s) {
3888
+ e.begin(), this.L.xi(this.Ke), this.Ke.gt({ u_texture: t, u_resolution: [i, s] }), this.L.Ei(0, 0, i, s), e.end();
3889
3889
  }
3890
3890
  vn(t, e) {
3891
- this.fl && (this.fl[0].resize(t, e), this.fl[1].resize(t, e));
3891
+ this.dl && (this.dl[0].resize(t, e), this.dl[1].resize(t, e));
3892
3892
  }
3893
3893
  Ss() {
3894
- for (const t of this.Jl.values()) t.dispose();
3895
- this.Jl.clear(), this.Vl.clear(), this.Ke.dispose(), this.fl && (this.fl[0].dispose(), this.fl[1].dispose()), this.Sr = !1;
3894
+ for (const t of this.tu.values()) t.dispose();
3895
+ this.tu.clear(), this.Jl.clear(), this.Ke.dispose(), this.dl && (this.dl[0].dispose(), this.dl[1].dispose()), this.Sr = !1;
3896
3896
  }
3897
- tu() {
3897
+ su() {
3898
3898
  this.register("invert", `#version 300 es
3899
3899
  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.register("grayscale", `#version 300 es
3900
- precision highp float;uniform sampler2D u_texture;uniform float Ue;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),Ue);fragColor=vec4(C,A.a);}`, { Ue: ["amount", 1] }), this.register("sepia", `#version 300 es
3901
- precision highp float;uniform sampler2D u_texture;uniform float Ue;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,Ue);fragColor=vec4(C,A.a);}`, { Ue: ["amount", 1] }), this.register("threshold", `#version 300 es
3902
- precision highp float;uniform sampler2D u_texture;uniform float Ui;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(Ui,B);fragColor=vec4(vec3(C),A.a);}`, { Ui: ["threshold", 0.5] });
3900
+ precision highp float;uniform sampler2D u_texture;uniform float U6;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),U6);fragColor=vec4(C,A.a);}`, { U6: ["amount", 1] }), this.register("sepia", `#version 300 es
3901
+ precision highp float;uniform sampler2D u_texture;uniform float U6;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,U6);fragColor=vec4(C,A.a);}`, { U6: ["amount", 1] }), this.register("threshold", `#version 300 es
3902
+ precision highp float;uniform sampler2D u_texture;uniform float Ua;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(Ua,B);fragColor=vec4(vec3(C),A.a);}`, { Ua: ["threshold", 0.5] });
3903
3903
  }
3904
3904
  }
3905
3905
  const ni = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFilterManager: ee }, Symbol.toStringTag, { value: "Module" }));
3906
3906
  class ie {
3907
3907
  constructor(t, e) {
3908
3908
  o(this, "za");
3909
- o(this, "R");
3910
- o(this, "nu");
3909
+ o(this, "L");
3911
3910
  o(this, "hu");
3912
3911
  o(this, "ou");
3913
3912
  o(this, "au");
3914
- o(this, "Zl", !1);
3915
- o(this, "cu", /* @__PURE__ */ new Set());
3916
- o(this, "lu", []);
3917
- o(this, "uu");
3913
+ o(this, "cu");
3914
+ o(this, "ql", !1);
3915
+ o(this, "lu", /* @__PURE__ */ new Set());
3916
+ o(this, "uu", []);
3918
3917
  o(this, "fu");
3919
- this.za = t, this.R = t.R, this.hu = new ee(this.R), this.nu = new te(this.R, this.za.Xr.width, this.za.Xr.height), this.ou = new ti({ onRemove: (i) => this.za.yl.rc(i), onDispose: (i) => i == null ? void 0 : i.Ss() }), this.au = new ot(this.R, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
3918
+ o(this, "du");
3919
+ this.za = t, this.L = t.L, this.ou = new ee(this.L), this.hu = new te(this.L, this.za.Xr.width, this.za.Xr.height), this.au = new ti({ onRemove: (i) => this.za.Al.nc(i), onDispose: (i) => i == null ? void 0 : i.Ss() }), this.cu = new ot(this.L, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
3920
3920
  }
3921
3921
  async Er() {
3922
- await this.du(this.au);
3922
+ await this.pu(this.cu);
3923
3923
  const t = this.za.Xr;
3924
- this.uu = this.R.Hi(t.width, t.height, 1), this.fu = this.R.Hi(t.width, t.height, 1), this.hu.Er(t.width, t.height), await this.ou.initialize((e) => this.du(e)), this.Zl = !0;
3924
+ this.fu = this.L.zi(t.width, t.height, 1), this.du = this.L.zi(t.width, t.height, 1), this.ou.Er(t.width, t.height), await this.au.initialize((e) => this.pu(e)), this.ql = !0;
3925
3925
  }
3926
- pu(t, e) {
3927
- this.lu.push({ name: t, params: e });
3926
+ vu(t, e) {
3927
+ this.uu.push({ name: t, params: e });
3928
3928
  }
3929
- vu() {
3930
- this.lu = [];
3929
+ gu() {
3930
+ this.uu = [];
3931
3931
  }
3932
3932
  add(t = {}) {
3933
- const e = new ot(this.R, t);
3934
- return this.ou.isReady && this.du(e), this.ou.add(e), e;
3933
+ const e = new ot(this.L, t);
3934
+ return this.au.isReady && this.pu(e), this.au.add(e), e;
3935
3935
  }
3936
3936
  remove(t) {
3937
- this.ou.remove(t);
3937
+ this.au.remove(t);
3938
3938
  }
3939
3939
  move(t, e) {
3940
- this.ou.move(t, e);
3940
+ this.au.move(t, e);
3941
3941
  }
3942
3942
  swap(t, e) {
3943
- this.ou.swap(t, e);
3943
+ this.au.swap(t, e);
3944
3944
  }
3945
3945
  clear() {
3946
- this.ou.clear();
3946
+ this.au.clear();
3947
3947
  }
3948
- gu(t) {
3949
- this.za.yl.tc(), this.au.Da(this.za, this.za.Hl);
3950
- const e = [...this.R.state.canvasBackgroundColor];
3951
- this.ou.all.forEach((i) => i.Da(this.za, this.za.Hl)), this.mu(t, e);
3948
+ mu(t) {
3949
+ this.za.Al.sc(), this.cu.Da(this.za, this.za.Bl);
3950
+ const e = [...this.L.state.canvasBackgroundColor];
3951
+ this.au.all.forEach((i) => i.Da(this.za, this.za.Bl)), this._u(t, e);
3952
3952
  }
3953
- _u() {
3954
- this.gu(this.uu);
3955
- let t = this.uu.textures[0];
3956
- if (this.lu.length > 0) {
3953
+ yu() {
3954
+ this.mu(this.fu);
3955
+ let t = this.fu.textures[0];
3956
+ if (this.uu.length > 0) {
3957
3957
  const i = this.za.Xr;
3958
- this.hu.su(this.uu.textures[0], this.fu, this.lu, i.width, i.height), t = this.fu.textures[0], this.lu = [];
3958
+ this.ou.eu(this.fu.textures[0], this.du, this.uu, i.width, i.height), t = this.du.textures[0], this.uu = [];
3959
3959
  }
3960
3960
  const e = this.za.Xr;
3961
- this.R.xe(0, 0, 0, 0), this.R.xi(this.za.Bl), this.za.Bl.gt({ u_texture: t }), this.R.Ei(0, 0, e.width, e.height), this.za.yl.ec();
3961
+ this.L.xe(0, 0, 0, 0), this.L.xi(this.za.Il), this.za.Il.gt({ u_texture: t }), this.L.Ei(0, 0, e.width, e.height), this.za.Al.rc();
3962
3962
  }
3963
- mu(t, e) {
3964
- const i = this.za.Xr, s = this.au.grid, r = this.au.texture;
3963
+ _u(t, e) {
3964
+ const i = this.za.Xr, s = this.cu.grid, r = this.cu.texture;
3965
3965
  if (!r) return;
3966
- const h = { layer: this.au, texture: r, width: s.width, height: s.height, offsetX: s.offsetX + this.au.el, offsetY: s.offsetY + this.au.il }, a = this.ou.all.filter((l) => !!l.grid && !!l.texture).map((l) => {
3966
+ const h = { layer: this.cu, texture: r, width: s.width, height: s.height, offsetX: s.offsetX + this.cu.il, offsetY: s.offsetY + this.cu.rl }, a = this.au.all.filter((l) => !!l.grid && !!l.texture).map((l) => {
3967
3967
  const u = l.grid;
3968
- return { layer: l, texture: l.texture, width: u.width, height: u.height, offsetX: u.offsetX + l.el, offsetY: u.offsetY + l.il };
3968
+ return { layer: l, texture: l.texture, width: u.width, height: u.height, offsetX: u.offsetX + l.il, offsetY: u.offsetY + l.rl };
3969
3969
  });
3970
- this.nu.Nl({ base: h, layers: a, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
3970
+ this.hu.Xl({ base: h, layers: a, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
3971
3971
  }
3972
3972
  vn() {
3973
3973
  var e, i, s;
3974
- if (!this.Zl) return;
3974
+ if (!this.ql) return;
3975
3975
  const t = this.za.Xr;
3976
- this.au.vn(), this.ou.all.forEach((r) => r.vn()), this.nu.vn(t.width, t.height), (e = this.uu) == null || e.resize(t.width, t.height), (i = this.fu) == null || i.resize(t.width, t.height), (s = this.hu) == null || s.vn(t.width, t.height);
3976
+ this.cu.vn(), this.au.all.forEach((r) => r.vn()), this.hu.vn(t.width, t.height), (e = this.fu) == null || e.resize(t.width, t.height), (i = this.du) == null || i.resize(t.width, t.height), (s = this.ou) == null || s.vn(t.width, t.height);
3977
3977
  }
3978
3978
  Ss() {
3979
3979
  var t, e;
3980
- this.ou.dispose(), this.za.yl.rc(this.au), this.au.Ss(), this.hu.Ss(), this.nu.Ss(), (t = this.uu) == null || t.dispose(), (e = this.fu) == null || e.dispose(), this.lu = [];
3980
+ this.au.dispose(), this.za.Al.nc(this.cu), this.cu.Ss(), this.ou.Ss(), this.hu.Ss(), (t = this.fu) == null || t.dispose(), (e = this.du) == null || e.dispose(), this.uu = [];
3981
3981
  }
3982
3982
  get all() {
3983
- return this.ou.all;
3983
+ return this.au.all;
3984
3984
  }
3985
3985
  get base() {
3986
- return this.au;
3986
+ return this.cu;
3987
3987
  }
3988
3988
  get filters() {
3989
- return this.hu;
3989
+ return this.ou;
3990
3990
  }
3991
3991
  get resultFramebuffer() {
3992
- return this.fu;
3992
+ return this.du;
3993
3993
  }
3994
- yu() {
3995
- const t = this.ou.all;
3994
+ Au() {
3995
+ const t = this.au.all;
3996
3996
  for (let e = t.length - 1; e >= 0; e--) {
3997
3997
  const i = t[e];
3998
- if (i.tl && i.grid) return i.grid;
3998
+ if (i.sl && i.grid) return i.grid;
3999
3999
  }
4000
- return this.au.grid;
4000
+ return this.cu.grid;
4001
4001
  }
4002
- Au(t) {
4003
- this.cu.add(t);
4002
+ wu(t) {
4003
+ this.lu.add(t);
4004
4004
  }
4005
- wu() {
4006
- for (const t of this.cu) t();
4005
+ bu() {
4006
+ for (const t of this.lu) t();
4007
4007
  }
4008
- async du(t) {
4008
+ async pu(t) {
4009
4009
  var i;
4010
- const e = { renderer: this.R, canvas: this.za.Xr, filterManager: this.hu, createFramebuffer: (s, r, h = 1, a) => this.R.Hi(s, r, h, a) };
4011
- await t.ml(e), (i = t.grid) == null || i.Vr(() => this.wu());
4010
+ const e = { renderer: this.L, canvas: this.za.Xr, filterManager: this.ou, createFramebuffer: (s, r, h = 1, a) => this.L.zi(s, r, h, a) };
4011
+ await t._l(e), (i = t.grid) == null || i.Vr(() => this.bu());
4012
4012
  }
4013
4013
  }
4014
- const ei = { id: "brightness", createShader: ({ gl: n }) => new K(n, ht, `#version 300 es
4014
+ const ei = { id: "brightness", createShader: ({ gl: n }) => new j(n, ht, `#version 300 es
4015
4015
  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));}`), createUniforms: ({ source: n }) => n.createBaseConversionUniforms() };
4016
4016
  class se {
4017
4017
  constructor() {
4018
- o(this, "bu", /* @__PURE__ */ new Map());
4019
- o(this, "Jl", /* @__PURE__ */ new Map());
4020
- this.Cu();
4018
+ o(this, "Cu", /* @__PURE__ */ new Map());
4019
+ o(this, "tu", /* @__PURE__ */ new Map());
4020
+ this.xu();
4021
4021
  }
4022
4022
  register(t) {
4023
- this.bu.set(t.id, t);
4023
+ this.Cu.set(t.id, t);
4024
4024
  }
4025
4025
  unregister(t) {
4026
- const e = this.Jl.get(t);
4027
- return e && (e.dispose(), this.Jl.delete(t)), this.bu.delete(t);
4026
+ const e = this.tu.get(t);
4027
+ return e && (e.dispose(), this.tu.delete(t)), this.Cu.delete(t);
4028
4028
  }
4029
4029
  has(t) {
4030
- return this.bu.has(t);
4030
+ return this.Cu.has(t);
4031
4031
  }
4032
4032
  Qn(t) {
4033
- return this.bu.get(t);
4033
+ return this.Cu.get(t);
4034
4034
  }
4035
4035
  jn(t, e) {
4036
- let i = this.Jl.get(t);
4036
+ let i = this.tu.get(t);
4037
4037
  if (!i) {
4038
- const s = this.bu.get(t);
4038
+ const s = this.Cu.get(t);
4039
4039
  if (!s) throw Error(`[textmode.js] Conversion mode "${t}" is not registered.`);
4040
- i = s.createShader(e), this.Jl.set(t, i);
4040
+ i = s.createShader(e), this.tu.set(t, i);
4041
4041
  }
4042
4042
  return i;
4043
4043
  }
4044
4044
  Ss() {
4045
- for (const t of this.Jl.values()) t.dispose();
4046
- this.Jl.clear(), this.bu.clear();
4045
+ for (const t of this.tu.values()) t.dispose();
4046
+ this.tu.clear(), this.Cu.clear();
4047
4047
  }
4048
- Cu() {
4048
+ xu() {
4049
4049
  this.register(ei);
4050
4050
  }
4051
4051
  }
@@ -4053,128 +4053,128 @@ const hi = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeConver
4053
4053
  class ii extends function(e, ...i) {
4054
4054
  return i.reduce((s, r) => r(s), e);
4055
4055
  }(class {
4056
- }, We, Ve, Ze, Qe, $e) {
4056
+ }, Ze, Ve, Qe, $e, qe) {
4057
4057
  constructor(e = {}) {
4058
4058
  super();
4059
- o(this, "R");
4060
- o(this, "Hl");
4059
+ o(this, "L");
4061
4060
  o(this, "Bl");
4061
+ o(this, "Il");
4062
4062
  o(this, "Xr");
4063
4063
  o(this, "Ra");
4064
- o(this, "bo");
4065
- o(this, "La");
4064
+ o(this, "Co");
4066
4065
  o(this, "Oa");
4067
- o(this, "xu");
4066
+ o(this, "Ha");
4068
4067
  o(this, "Mu");
4069
- o(this, "Al");
4068
+ o(this, "Fu");
4069
+ o(this, "wl");
4070
4070
  o(this, "En");
4071
- o(this, "Fu", /* @__PURE__ */ new Set());
4072
- o(this, "yl");
4073
- o(this, "$u", !1);
4071
+ o(this, "$u", /* @__PURE__ */ new Set());
4072
+ o(this, "Al");
4074
4073
  o(this, "Pu", !1);
4075
4074
  o(this, "Tu", !1);
4076
4075
  o(this, "Su", !1);
4077
- o(this, "Eu", () => {
4078
- });
4076
+ o(this, "Eu", !1);
4079
4077
  o(this, "ku", () => {
4080
4078
  });
4079
+ o(this, "Lu", () => {
4080
+ });
4081
4081
  o(this, "Ru");
4082
4082
  o(this, "Du");
4083
- o(this, "Lu");
4084
- o(this, "rn", !1);
4085
4083
  o(this, "Ou");
4084
+ o(this, "rn", !1);
4085
+ o(this, "Hu");
4086
4086
  o(this, "zu");
4087
- this.yl = new jt(this), this.rn = e.overlay ?? !1, this.Xr = new He(e), this.R = new Fe(this.Xr.gn()), this.Hl = this.R.Mi(W, `#version 300 es
4088
- precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D U0;uniform sampler2D U1;uniform sampler2D U2;uniform vec2 U3;uniform vec2 U4;uniform vec4 U5;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/U4;vec2 F=E*U3;vec2 G=floor(F);vec2 H=(G+0.5)/U3;vec4 I=texture(U0,H);vec4 J=texture(U1,H);vec4 K=texture(U2,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(U5,J,J.a);fragColor=mix(d,I,c);}`), this.Bl = this.R.Mi(W, Kt), this.Ra = new Nt(e.frameRate ?? 60), this.xu = new Jt(this, e.loadingScreen, this.Xr.pn()), this.xu.Ol(() => {
4089
- this.Ra.gh = 0, this.Su = !0;
4090
- }), this.Mu = new ie(this, e);
4091
- const i = () => this.Hu();
4092
- this.bo = new kt(this.Xr, i), this.La = new Gt(this.Xr, i, this.bo), this.Oa = new Ht(), this.En = new se(), this.yl.Wa(e.plugins ?? []), this.xu.rh(), this.Bu();
4093
- }
4094
- ka(e) {
4087
+ this.Al = new Wt(this), this.rn = e.overlay ?? !1, this.Xr = new He(e), this.L = new Fe(this.Xr.gn()), this.Bl = this.L.Mi(Z, `#version 300 es
4088
+ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D U0;uniform sampler2D U1;uniform sampler2D U2;uniform vec2 U3;uniform vec2 U4;uniform vec4 U5;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/U4;vec2 F=E*U3;vec2 G=floor(F);vec2 H=(G+0.5)/U3;vec4 I=texture(U0,H);vec4 J=texture(U1,H);vec4 K=texture(U2,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(U5,J,J.a);fragColor=mix(d,I,c);}`), this.Il = this.L.Mi(Z, jt), this.Ra = new Nt(e.frameRate ?? 60), this.Mu = new Jt(this, e.loadingScreen, this.Xr.pn()), this.Mu.Hl(() => {
4089
+ this.Ra.gh = 0, this.Eu = !0;
4090
+ }), this.Fu = new ie(this, e);
4091
+ const i = () => this.Bu();
4092
+ this.Co = new Yt(this.Xr, i), this.Oa = new Gt(this.Xr, i, this.Co), this.Ha = new Ht(), this.En = new se(), this.Al.Za(e.plugins ?? []), this.Mu.rh(), this.Iu();
4093
+ }
4094
+ La(e) {
4095
4095
  var i;
4096
- this.Fu.add(e), (i = e.C) == null || i.call(e, () => {
4097
- this.Fu.delete(e);
4096
+ this.$u.add(e), (i = e.C) == null || i.call(e, () => {
4097
+ this.$u.delete(e);
4098
4098
  });
4099
4099
  }
4100
- async Bu() {
4101
- await this.Mu.Er(), await this.xu.Er();
4102
- const e = this.Mu.base.grid;
4103
- this.Mu.Au(() => {
4104
- this.bo.Wh(), this.La.Wh();
4105
- }), this.rn && (this.Ou = V.Nn(this.R, this.En, this.Xr.targetCanvas, e.cols, e.rows)), this.Iu(), this.Ra.rh(() => this.Da());
4100
+ async Iu() {
4101
+ await this.Fu.Er(), await this.Mu.Er();
4102
+ const e = this.Fu.base.grid;
4103
+ this.Fu.wu(() => {
4104
+ this.Co.Zh(), this.Oa.Zh();
4105
+ }), this.rn && (this.Hu = V.Nn(this.L, this.En, this.Xr.targetCanvas, e.cols, e.rows)), this.Gu(), this.Ra.rh(() => this.Da());
4106
4106
  try {
4107
- await this.yl.oc(), await this.Eu(), await this.yl.cc(), this.xu.Ic();
4107
+ await this.Al.ac(), await this.ku(), await this.Al.lc(), this.Mu.Gc();
4108
4108
  } catch (i) {
4109
- console.error("Error during setup:", i), this.xu.error(i);
4109
+ console.error("Error during setup:", i), this.Mu.error(i);
4110
4110
  }
4111
4111
  }
4112
- Iu() {
4112
+ Gu() {
4113
4113
  this.Ru = () => {
4114
- this.rn && this.resizeCanvas(this.Xr.targetCanvas.width, this.Xr.targetCanvas.height), this.ku();
4115
- }, window.addEventListener("resize", this.Ru), this.bo.Ih(), this.La.Ih(), this.Oa.Ih(), this.Du = () => {
4116
- this.Oa.wo();
4117
- }, window.addEventListener("blur", this.Du), this.rn && (this.Lu = new ResizeObserver(() => {
4114
+ this.rn && this.resizeCanvas(this.Xr.targetCanvas.width, this.Xr.targetCanvas.height), this.Lu();
4115
+ }, window.addEventListener("resize", this.Ru), this.Co.Gh(), this.Oa.Gh(), this.Ha.Gh(), this.Du = () => {
4116
+ this.Ha.bo();
4117
+ }, window.addEventListener("blur", this.Du), this.rn && (this.Ou = new ResizeObserver(() => {
4118
4118
  this.resizeCanvas(this.Xr.targetCanvas.width, this.Xr.targetCanvas.height);
4119
- }), this.Lu.observe(this.Xr.targetCanvas));
4119
+ }), this.Ou.observe(this.Xr.targetCanvas));
4120
4120
  }
4121
4121
  Da() {
4122
- if (!this.xu.Oc && this.Su) {
4123
- this.Pu = !0;
4122
+ if (!this.Mu.Hc && this.Eu) {
4123
+ this.Tu = !0;
4124
4124
  try {
4125
- this.Ra.uh(), this.Ra.mh(), this.rn && rt(this.R.context, this.Ou.texture, this.Xr.targetCanvas), this.Mu._u();
4125
+ this.Ra.uh(), this.Ra.mh(), this.rn && rt(this.L.context, this.Hu.texture, this.Xr.targetCanvas), this.Fu.yu();
4126
4126
  } finally {
4127
- this.Pu = !1, this.$u && !this.Tu && this.Gu();
4127
+ this.Tu = !1, this.Pu && !this.Su && this.ju();
4128
4128
  }
4129
4129
  }
4130
4130
  }
4131
4131
  resizeCanvas(e, i) {
4132
4132
  var s;
4133
- this.Xr.vn(e, i), this.xu.Il(this.Xr.pn()), this.xu.vn(), (s = this.Mu) == null || s.vn(), this.R.Gi(), this.Da();
4133
+ this.Xr.vn(e, i), this.Mu.Gl(this.Xr.pn()), this.Mu.vn(), (s = this.Fu) == null || s.vn(), this.L.Gi(), this.Da();
4134
4134
  }
4135
4135
  destroy() {
4136
- this.Tu || this.$u || (this.$u = !0, this.Ra.hh(), this.Pu || this.Gu());
4136
+ this.Su || this.Pu || (this.Pu = !0, this.Ra.hh(), this.Tu || this.ju());
4137
4137
  }
4138
- Gu() {
4138
+ ju() {
4139
4139
  var e, i, s, r;
4140
- this.$u = !1, this.Xr.Ss(), this.xu.Ss(), this.yl.lc(), window.removeEventListener("resize", this.Ru), window.removeEventListener("blur", this.Du), (e = this.Lu) == null || e.disconnect(), this.bo.Kh(), this.La.Kh(), this.Oa.Kh(), (i = this.Mu) == null || i.Ss(), (s = this.En) == null || s.Ss();
4141
- for (const h of this.Fu) h.dispose();
4142
- this.Fu.clear(), this.Hl.dispose(), this.Bl.dispose(), this.R.Ss(), (r = this.Ou) == null || r.dispose(), this.Tu = !0;
4140
+ this.Pu = !1, this.Xr.Ss(), this.Mu.Ss(), this.Al.uc(), window.removeEventListener("resize", this.Ru), window.removeEventListener("blur", this.Du), (e = this.Ou) == null || e.disconnect(), this.Co.Wh(), this.Oa.Wh(), this.Ha.Wh(), (i = this.Fu) == null || i.Ss(), (s = this.En) == null || s.Ss();
4141
+ for (const h of this.$u) h.dispose();
4142
+ this.$u.clear(), this.Bl.dispose(), this.Il.dispose(), this.L.Ss(), (r = this.Hu) == null || r.dispose(), this.Su = !0;
4143
4143
  }
4144
4144
  filter(e, i) {
4145
- this.Mu.pu(e, i);
4145
+ this.Fu.vu(e, i);
4146
4146
  }
4147
4147
  draw(e) {
4148
- this.Mu.base.draw(e);
4148
+ this.Fu.base.draw(e);
4149
4149
  }
4150
4150
  async loadFont(e, i = !0) {
4151
- if (i) return await this.Mu.base.loadFont(e), this.Mu.base.font;
4152
- if (e instanceof Y) return e.Gr || await e.Er(), e;
4153
- const s = new Y(this.R);
4154
- return await s.Er(e), this.ka(s), s;
4151
+ if (i) return await this.Fu.base.loadFont(e), this.Fu.base.font;
4152
+ if (e instanceof k) return e.Gr || await e.Er(), e;
4153
+ const s = new k(this.L);
4154
+ return await s.Er(e), this.La(s), s;
4155
4155
  }
4156
4156
  fontSize(e) {
4157
- return this.Mu.base.fontSize(e);
4157
+ return this.Fu.base.fontSize(e);
4158
4158
  }
4159
4159
  inputGrid(e) {
4160
- return e === void 0 ? this.zu ?? "topmost" : e === "topmost" ? (this.zu = void 0, this.bo.Wh(), void this.La.Wh()) : (this.zu = e, this.bo.Wh(), void this.La.Wh());
4160
+ return e === void 0 ? this.zu ?? "topmost" : e === "topmost" ? (this.zu = void 0, this.Co.Zh(), void this.Oa.Zh()) : (this.zu = e, this.Co.Zh(), void this.Oa.Zh());
4161
4161
  }
4162
- Hu() {
4163
- return this.zu ? this.zu : this.Mu.yu();
4162
+ Bu() {
4163
+ return this.zu ? this.zu : this.Fu.Au();
4164
4164
  }
4165
4165
  async setup(e) {
4166
- this.Eu = e;
4166
+ this.ku = e;
4167
4167
  }
4168
4168
  windowResized(e) {
4169
- this.ku = e;
4169
+ this.Lu = e;
4170
4170
  }
4171
4171
  get grid() {
4172
4172
  var e;
4173
- return ((e = this.Al) == null ? void 0 : e.grid) ?? this.Mu.base.grid;
4173
+ return ((e = this.wl) == null ? void 0 : e.grid) ?? this.Fu.base.grid;
4174
4174
  }
4175
4175
  get font() {
4176
4176
  var e;
4177
- return ((e = this.Al) == null ? void 0 : e.font) ?? this.Mu.base.font;
4177
+ return ((e = this.wl) == null ? void 0 : e.font) ?? this.Fu.base.font;
4178
4178
  }
4179
4179
  get width() {
4180
4180
  return this.Xr.width;
@@ -4186,25 +4186,25 @@ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charse
4186
4186
  return this.Xr.canvas;
4187
4187
  }
4188
4188
  get isDisposed() {
4189
- return this.Tu;
4189
+ return this.Su;
4190
4190
  }
4191
4191
  get overlay() {
4192
- return this.Ou;
4192
+ return this.Hu;
4193
4193
  }
4194
4194
  get loading() {
4195
- return this.xu;
4195
+ return this.Mu;
4196
4196
  }
4197
4197
  get layers() {
4198
- return this.Mu;
4198
+ return this.Fu;
4199
4199
  }
4200
4200
  get filters() {
4201
- return this.Mu.filters;
4201
+ return this.Fu.filters;
4202
4202
  }
4203
4203
  get conversions() {
4204
4204
  return this.En;
4205
4205
  }
4206
4206
  get isRenderingFrame() {
4207
- return this.Pu;
4207
+ return this.Tu;
4208
4208
  }
4209
4209
  }
4210
4210
  class xt {
@@ -4217,18 +4217,18 @@ class xt {
4217
4217
  yt._(t);
4218
4218
  }
4219
4219
  static get version() {
4220
- return "0.9.2";
4220
+ return "0.9.3-beta.1";
4221
4221
  }
4222
4222
  }
4223
- const oi = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: qt, LoadingPhaseTracker: Wt, LoadingScreenManager: Jt, LoadingScreenStateMachine: Vt, LoadingScreenTransition: Zt, resolveColorInputs: $t, resolveDefaultPalette: Qt, resolveTheme: At }, Symbol.toStringTag, { value: "Module" })), ai = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: Y, TextmodeImage: V, TextmodeSource: Et, TextmodeTexture: Z, TextmodeVideo: ut }, Symbol.toStringTag, { value: "Module" })), li = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: je, mouse: Ge, touch: Ke }, Symbol.toStringTag, { value: "Module" })), ci = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: te, TextmodeLayer: ot, TextmodeLayerManager: ie }, Symbol.toStringTag, { value: "Module" })), ui = xt.create, fi = xt.setErrorLevel, di = xt.version;
4223
+ const oi = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: Kt, LoadingPhaseTracker: Zt, LoadingScreenManager: Jt, LoadingScreenStateMachine: Vt, LoadingScreenTransition: Qt, resolveColorInputs: qt, resolveDefaultPalette: $t, resolveTheme: At }, Symbol.toStringTag, { value: "Module" })), ai = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: k, TextmodeImage: V, TextmodeSource: Et, TextmodeTexture: Q, TextmodeVideo: ut }, Symbol.toStringTag, { value: "Module" })), li = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: We, mouse: Ge, touch: je }, Symbol.toStringTag, { value: "Module" })), ci = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: te, TextmodeLayer: ot, TextmodeLayerManager: ie }, Symbol.toStringTag, { value: "Module" })), ui = xt.create, fi = xt.setErrorLevel, di = xt.version;
4224
4224
  export {
4225
4225
  He as TextmodeCanvas,
4226
4226
  E as TextmodeColor,
4227
4227
  P as TextmodeError,
4228
4228
  ae as TextmodeErrorLevel,
4229
4229
  vt as TextmodeFramebuffer,
4230
- Ye as TextmodeGrid,
4231
- K as TextmodeShader,
4230
+ ke as TextmodeGrid,
4231
+ j as TextmodeShader,
4232
4232
  ii as Textmodifier,
4233
4233
  hi as conversion,
4234
4234
  ui as create,