textmode.js 0.9.2 → 0.9.3-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
1
  var he = Object.defineProperty;
2
2
  var oe = (n, t, e) => t in n ? he(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
3
  var o = (n, t, e) => oe(n, typeof t != "symbol" ? t + "" : t, e);
4
- class P extends Error {
4
+ class S extends Error {
5
5
  constructor(t, e) {
6
- super(P.i(t, e)), this.name = "TextmodeError";
6
+ super(S.i(t, e)), this.name = "TextmodeError";
7
7
  }
8
8
  static i(t, e) {
9
9
  return `${t}${e && Object.keys(e).length > 0 ? `
10
10
 
11
11
  📋 Context:` + Object.entries(e).map(([i, s]) => `
12
- - ${i}: ${P.h(s)}`).join("") : ""}
12
+ - ${i}: ${S.h(s)}`).join("") : ""}
13
13
 
14
14
  ${"↓".repeat(24)}
15
15
  `;
@@ -19,10 +19,10 @@ ${"↓".repeat(24)}
19
19
  if (t === void 0) return "undefined";
20
20
  if (typeof t == "string") return `"${t}"`;
21
21
  if (typeof t == "number" || typeof t == "boolean") return t + "";
22
- if (Array.isArray(t)) return t.length === 0 ? "[]" : t.length <= 5 ? `[${t.map((e) => P.h(e)).join(", ")}]` : `[${t.slice(0, 3).map((e) => P.h(e)).join(", ")}, ... +${t.length - 3} more]`;
22
+ if (Array.isArray(t)) return t.length === 0 ? "[]" : t.length <= 5 ? `[${t.map((e) => S.h(e)).join(", ")}]` : `[${t.slice(0, 3).map((e) => S.h(e)).join(", ")}, ... +${t.length - 3} more]`;
23
23
  if (typeof t == "object") {
24
24
  const e = Object.keys(t);
25
- return e.length === 0 ? "{}" : e.length <= 3 ? `{ ${e.map((i) => `${i}: ${P.h(t[i])}`).join(", ")} }` : `{ ${e.slice(0, 2).map((i) => `${i}: ${P.h(t[i])}`).join(", ")}, ... +${e.length - 2} more }`;
25
+ return e.length === 0 ? "{}" : e.length <= 3 ? `{ ${e.map((i) => `${i}: ${S.h(t[i])}`).join(", ")} }` : `{ ${e.slice(0, 2).map((i) => `${i}: ${S.h(t[i])}`).join(", ")}, ... +${e.length - 2} more }`;
26
26
  }
27
27
  return t + "";
28
28
  }
@@ -41,11 +41,11 @@ const D = class D {
41
41
  case 0:
42
42
  return !1;
43
43
  case 1:
44
- return console.group(i, s), console.warn(P.i(t, e)), console.groupEnd(), !1;
44
+ return console.group(i, s), console.warn(S.i(t, e)), console.groupEnd(), !1;
45
45
  case 2:
46
- return console.group(i, s), console.error(P.i(t, e)), console.groupEnd(), !1;
46
+ return console.group(i, s), console.error(S.i(t, e)), console.groupEnd(), !1;
47
47
  default:
48
- throw new P(t, e);
48
+ throw new S(t, e);
49
49
  }
50
50
  }
51
51
  m(t, e, i) {
@@ -70,35 +70,35 @@ class at {
70
70
  this.A.clear();
71
71
  }
72
72
  }
73
- function N(n) {
73
+ function Y(n) {
74
74
  return n * (Math.PI / 180);
75
75
  }
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 O(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
- function Pt(n, t) {
91
+ function St(n, t) {
92
92
  n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, 1), n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, t);
93
93
  }
94
94
  function rt(n, t, e) {
95
- n.bindTexture(n.TEXTURE_2D, t), Pt(n, e), n.bindTexture(n.TEXTURE_2D, null);
95
+ n.bindTexture(n.TEXTURE_2D, t), St(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), Pt(n, e, i, s, r), St(n, t), n.bindTexture(n.TEXTURE_2D, null), h;
100
100
  }
101
- function Ot(n, t, e, i, s) {
101
+ function Pt(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
104
  function j(n, t, e, i, s, r = 0, h = WebGL2RenderingContext.FLOAT, a = !1) {
@@ -107,7 +107,7 @@ function j(n, t, e, i, s, r = 0, h = WebGL2RenderingContext.FLOAT, a = !1) {
107
107
  function Xt(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 = O(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), Pt(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 = { U0: this.S[0], U1: e ? this.S[1] : this.S[0], U2: i ? this.S[2] : this.S[0], U3: s ? this.S[3] : this.S[0], U4: [this.M, this.F], U5: e, U6: i, U7: 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,7 +221,7 @@ class vt extends at {
221
221
  return this.k;
222
222
  }
223
223
  }
224
- function I(n) {
224
+ function N(n) {
225
225
  return typeof n == "object" && n !== null && "textures" in n && Array.isArray(n.textures);
226
226
  }
227
227
  function Ut(n) {
@@ -231,9 +231,9 @@ function Ut(n) {
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 || !!N(n) || typeof WebGLTexture < "u" && n instanceof WebGLTexture;
235
235
  }
236
- class K extends at {
236
+ class V 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 || N(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 || N(i)) && r === i && (h = !1)), !h) return;
293
+ typeof i == "number" || typeof i == "boolean" || i instanceof WebGLTexture || N(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,7 +298,7 @@ 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 (N(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
  }
@@ -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 Ot = /* @__PURE__ */ new WeakMap();
375
375
  function ft(n, t) {
376
- _t.set(n, t);
376
+ Ot.set(n, t);
377
377
  }
378
- function Lt(n) {
379
- return _t.get(n);
378
+ function _t(n) {
379
+ return Ot.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);
@@ -430,13 +430,13 @@ class lt {
430
430
  this.wt = 0, this.bt = 0, this.Ct = 0, this.xt = 0, this.Mt = 0, this.Ft = 0, this.Ot = !1;
431
431
  }
432
432
  Jt(t) {
433
- t !== 0 && (this.xt += N(t));
433
+ t !== 0 && (this.xt += Y(t));
434
434
  }
435
435
  ts(t) {
436
- t !== 0 && (this.Mt += N(t));
436
+ t !== 0 && (this.Mt += Y(t));
437
437
  }
438
438
  ss(t) {
439
- t !== 0 && (this.Ft += N(t));
439
+ t !== 0 && (this.Ft += Y(t));
440
440
  }
441
441
  es(t = 0, e = 0, i = 0) {
442
442
  t === 0 && e === 0 && i === 0 || (this.wt += t, this.bt += e, this.Ct += i);
@@ -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]), H = { 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,10 +541,10 @@ 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
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);
550
550
  }
@@ -561,10 +561,10 @@ 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 {
@@ -575,14 +575,14 @@ class ue {
575
575
  c !== -1 && j(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() {
@@ -593,27 +593,27 @@ class ue {
593
593
  class X {
594
594
  }
595
595
  o(X, "BYTES_PER_INSTANCE", 144), o(X, "FLOATS_PER_INSTANCE", 36);
596
- function O(n, t) {
596
+ function P(n, t) {
597
597
  return { location: -1, size: n, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: X.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", X.BYTES_PER_INSTANCE), o(nt, "ATTRIBUTES", { A2: P(2, 0), A3: P(2, 8), A4: P(3, 16), A5: P(4, 28), A6: P(4, 44), A7: P(4, 60), A8: P(3, 76), A9: P(3, 88), Aa: P(4, 100), Ab: P(4, 116), Ac: P(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;
609
+ this.Hs = t, this.zs = e;
610
610
  const i = t * X.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;
614
+ if (t <= this.Hs) return;
615
+ const e = Math.ceil(t * this.zs), i = this.Hs;
616
+ this.Hs = e;
617
617
  const s = new Float32Array(e * X.FLOATS_PER_INSTANCE), r = i * X.FLOATS_PER_INSTANCE;
618
618
  s.set(this.Os.subarray(0, Math.min(r, this.Bs))), this.Os = s;
619
619
  }
@@ -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,7 +645,7 @@ 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;
@@ -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(X.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");
@@ -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, ...H }, 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, ...H }, 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, ...H };
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, ...H };
824
+ const we = { ke: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), He: 3, ...H }, 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, ...H }, 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,32 +843,32 @@ 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
  }
857
857
  ce(n, t) {
858
- const e = N(n.start), i = N(n.stop);
858
+ const e = Y(n.start), i = Y(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,38 +877,38 @@ 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
914
  function Dt(n) {
@@ -917,29 +917,29 @@ function Dt(n) {
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;
920
+ const Lt = /* @__PURE__ */ new WeakMap();
921
+ let Te = 1;
922
922
  function Mt(n) {
923
923
  if (n == null) return 0;
924
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;
925
+ let t = Lt.get(n);
926
+ return t || (t = Te++, Lt.set(n, t)), t;
927
927
  }
928
- function H(n, t) {
928
+ function k(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 Le {
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 V(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 V(t, ht, `#version 300 es
942
+ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uniform sampler2D U2;uniform sampler2D U3;uniform vec2 U4;uniform bool U5;uniform bool U6;uniform bool U7;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){vec2 B=vec2(v_uv.x,1.-v_uv.y);vec2 C=B*U4;vec2 D=(floor(C)+0.5f)/U4;vec4 E=texture(U0,D);vec4 F=U5?texture(U1,D):vec4(0.);if(U5&&F.a==0.){discard;}vec4 G=U6?texture(U2,D):vec4(0.);vec4 H=U7?texture(U3,D):vec4(0.);o_character=E;o_primaryColor=F;o_secondaryColor=G;A=H;}`), 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;
@@ -954,10 +954,10 @@ precision highp float;in vec2 v_uv;uniform sampler2D U6;uniform sampler2D U7;uni
954
954
  const i = Mt(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 = k(a, Dt(u)), a = k(a, h(r[u]));
958
958
  return a;
959
959
  }(e, this.Je.bind(this));
960
- return H(i, s);
960
+ return k(i, s);
961
961
  }
962
962
  Je(t) {
963
963
  return typeof t == "number" || typeof t == "boolean" ? function(e) {
@@ -965,14 +965,14 @@ precision highp float;in vec2 v_uv;uniform sampler2D U6;uniform sampler2D U7;uni
965
965
  }(t) : Array.isArray(t) ? function(e) {
966
966
  let i = 0;
967
967
  const s = Array.isArray(e[0]) ? e.flat() : e;
968
- for (const r of s) i = H(i, typeof r == "number" ? r : 0);
968
+ for (const r of s) i = k(i, typeof r == "number" ? r : 0);
969
969
  return i;
970
970
  }(t) : t instanceof Float32Array || t instanceof Int32Array ? function(e) {
971
971
  let i = 0;
972
972
  const s = Math.min(e.length, 16);
973
- for (let r = 0; r < s; r++) i = H(i, e[r]);
973
+ for (let r = 0; r < s; r++) i = k(i, e[r]);
974
974
  return i;
975
- }(t) : t instanceof WebGLTexture || I(t) ? Mt(t) : 0;
975
+ }(t) : t instanceof WebGLTexture || N(t) ? Mt(t) : 0;
976
976
  }
977
977
  Ss() {
978
978
  this.Ye.dispose(), this.Ke.dispose(), this.Ze.clear();
@@ -1025,7 +1025,7 @@ class Me {
1025
1025
  return { next: () => t < e ? { value: i[t++], done: !1 } : { value: void 0, done: !0 } };
1026
1026
  }
1027
1027
  }
1028
- class Fe {
1028
+ class Ce {
1029
1029
  constructor(t) {
1030
1030
  o(this, "$");
1031
1031
  o(this, "Ie", null);
@@ -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 Le(t), this.fi = new Me(), 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 V(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 V(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) {
@@ -1162,16 +1162,16 @@ 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 $(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
- function Ce(n, t, e) {
1174
+ function Fe(n, t, e) {
1175
1175
  for (let i = 0; i < e.length; i++) n[t + i] = 255 & e.charCodeAt(i);
1176
1176
  }
1177
1177
  function dt(n, t, e) {
@@ -1181,7 +1181,7 @@ function dt(n, t, e) {
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);
@@ -1220,7 +1220,7 @@ function G(n) {
1220
1220
  if (!l) continue;
1221
1221
  const u = s[l]++;
1222
1222
  let c = h.get(l);
1223
- c || (c = [], h.set(l, c)), c[Pe(u, l)] = a;
1223
+ c || (c = [], h.set(l, c)), c[Se(u, l)] = a;
1224
1224
  }
1225
1225
  return { min: t, max: e, table: h };
1226
1226
  }
@@ -1236,12 +1236,12 @@ function gt(n, t) {
1236
1236
  }
1237
1237
  throw Error("Invalid Huffman code");
1238
1238
  }
1239
- function Pe(n, t) {
1239
+ function Se(n, t) {
1240
1240
  let e = 0;
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 Pe(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) {
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 L = 0; L < A; L++) y[w[L]] = r.readBits(3);
1277
+ const T = G(y), b = [];
1278
+ for (; b.length < d + m; ) {
1279
+ const L = gt(r, T);
1280
+ if (L <= 15) b.push(L);
1281
+ else if (L === 16) {
1282
+ const U = r.readBits(2) + 3, F = b[b.length - 1] || 0;
1283
+ for (let K = 0; K < U; K++) b.push(F);
1284
+ } else if (L === 17) {
1285
1285
  const U = r.readBits(3) + 3;
1286
- for (let C = 0; C < U; C++) w.push(0);
1286
+ for (let F = 0; F < U; F++) b.push(0);
1287
1287
  } else {
1288
- if (T !== 18) throw Error("Invalid code length symbol");
1288
+ if (L !== 18) throw Error("Invalid code length symbol");
1289
1289
  {
1290
1290
  const U = r.readBits(7) + 11;
1291
- for (let C = 0; C < U; C++) w.push(0);
1291
+ for (let F = 0; F < U; F++) 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 C = b.slice(0, d), R = b.slice(d, d + m);
1296
+ p = G(C), v = G(R);
1297
1297
  }
1298
1298
  for (; ; ) {
1299
1299
  const d = gt(r, p);
@@ -1303,23 +1303,23 @@ 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;
1314
- if (F < 0) throw Error("Invalid distance");
1315
- for (let S = 0; S < A; S++) h.push(h[F + S] || 0);
1310
+ let T = u[y];
1311
+ const b = c[y];
1312
+ b && (T += r.readBits(b));
1313
+ const C = h.length - T;
1314
+ if (C < 0) throw Error("Invalid distance");
1315
+ for (let R = 0; R < A; R++) h.push(h[C + 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
1324
  function Xe(n) {
1325
1325
  const t = M, e = new Uint8Array(n);
@@ -1327,13 +1327,13 @@ function Xe(n) {
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), C = t.readUint(e, a + 16);
1331
+ h.push({ tag: w, offset: y, compLength: T, origLength: b, checksum: C }), 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 = Pe(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,32 +1344,32 @@ 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 = $(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
- 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;
1352
+ Fe(d, m, A.tag), 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, $(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, $(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, C = [y[b], y[b + 1], y[b + 2], y[b + 3]];
1368
+ _(y, b, 0);
1369
+ const R = 2981146554 - (dt(y, 0, $(y.length)) >>> 0) >>> 0;
1370
+ return y[b] = C[0], y[b + 1] = C[1], y[b + 2] = C[2], y[b + 3] = C[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
  }
@@ -1412,7 +1412,7 @@ const Ue = { parseTab(n, t, e) {
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) {
1415
+ } }, Oe = { parseTab(n, t, e) {
1416
1416
  const i = M;
1417
1417
  t += 18;
1418
1418
  const s = i.readUshort(n, t);
@@ -1425,7 +1425,7 @@ 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) {
1428
+ } }, _e = { parseTab(n, t, e) {
1429
1429
  const i = M;
1430
1430
  t += 4;
1431
1431
  const s = i.readShort, r = i.readUshort;
@@ -1436,7 +1436,7 @@ const Ue = { parseTab(n, t, e) {
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) {
1439
+ } }, Ct = { cmap: Ue, head: Oe, hhea: _e, maxp: { parseTab(n, t, e) {
1440
1440
  const i = M;
1441
1441
  return i.readUint(n, t), t += 4, { numGlyphs: i.readUshort(n, t) };
1442
1442
  } }, hmtx: De, loca: { parseTab(n, t, e, i) {
@@ -1489,7 +1489,7 @@ const Ue = { parseTab(n, t, e) {
1489
1489
  } } }, ct = { parse(n) {
1490
1490
  const t = new Uint8Array(n);
1491
1491
  M.readASCII(t, 0, 4) === "wOFF" && (n = Xe(n));
1492
- const e = new Uint8Array(n), i = Ft, s = {}, r = { Qi: e, Xi: 0, Ni: 0 };
1492
+ const e = new Uint8Array(n), i = Ct, 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);
1495
1495
  if (l) {
@@ -1510,7 +1510,7 @@ const Ue = { parseTab(n, t, e) {
1510
1510
  r += 16;
1511
1511
  }
1512
1512
  return null;
1513
- }, T: Ft, B: M };
1513
+ }, T: Ct, B: M };
1514
1514
  function Bt(n, t, e) {
1515
1515
  if (n.idRangeOffset[e] === 0) return t + n.idDelta[e] & 65535;
1516
1516
  {
@@ -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;
@@ -1688,10 +1688,10 @@ class zt {
1688
1688
  return 0;
1689
1689
  }
1690
1690
  }
1691
- class Ie {
1691
+ class Ne {
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;
@@ -1705,10 +1705,10 @@ class Ie {
1705
1705
  return { width: Math.ceil(s), height: Math.ceil(h) };
1706
1706
  }
1707
1707
  }
1708
- class Ne {
1708
+ class Ye {
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 z extends at {
1731
1731
  constructor(e, i = 16) {
1732
1732
  super();
1733
1733
  o(this, "yr");
@@ -1741,48 +1741,48 @@ 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 Be(), this.$r = new Ie(e), this.Pr = new Ne(), this.Tr = new Ye();
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
- throw new P("Failed to load font: " + (i instanceof Error ? i.message : "Unknown error"), { originalError: i });
1764
+ throw new S("Failed to load font: " + (i instanceof Error ? i.message : "Unknown error"), { originalError: i });
1765
1765
  }
1766
1766
  }
1767
1767
  async kr(e) {
1768
1768
  const i = await fetch(e);
1769
- if (!i.ok) throw new P(`Failed to load font file: ${i.status} ${i.statusText}`);
1769
+ if (!i.ok) throw new S(`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 ze {
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,17 +1900,17 @@ class Ye {
1899
1900
  function tt(n) {
1900
1901
  return parseInt(n, 16);
1901
1902
  }
1902
- const ke = /^rgba?\(([^)]+)\)$/i;
1903
+ const He = /^rgba?\(([^)]+)\)$/i;
1903
1904
  function B(n) {
1904
- return Number.isNaN(n = Math.round(n)) ? 0 : _(n, 0, 255);
1905
+ return Number.isNaN(n = Math.round(n)) ? 0 : O(n, 0, 255);
1905
1906
  }
1906
- function It(n, t = !1) {
1907
+ function Nt(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 = He.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;
@@ -1918,12 +1919,12 @@ function It(n, t = !1) {
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 * O(g, 0, 1);
1922
1923
  }
1923
1924
  return [a, l, u, Math.round(c)];
1924
1925
  }(e)), i && (t || i[3] !== 0) ? i : null;
1925
1926
  }
1926
- class He {
1927
+ class ke {
1927
1928
  constructor(t = {}) {
1928
1929
  o(this, "Xr");
1929
1930
  o(this, "en", 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 S("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,36 +1950,35 @@ 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
  }
1956
- t.width = i, t.height = s, t.style.position = "absolute", t.style.pointerEvents = "none";
1957
+ t.width = i, t.height = s, t.style.position = "absolute";
1957
1958
  const r = window.getComputedStyle(this.en);
1958
1959
  let h = parseInt(r.zIndex || "0", 10);
1959
1960
  return isNaN(h) && (h = 0), t.style.zIndex = "" + (h + 1), t;
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 = Nt(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";
@@ -1993,7 +1993,7 @@ class He {
1993
1993
  gn() {
1994
1994
  if (this.hn) return this.hn;
1995
1995
  const t = this.Xr.getContext("webgl2", { alpha: !0, premultipliedAlpha: !1, preserveDrawingBuffer: !0, antialias: !1, depth: !0, stencil: !1, powerPreference: "high-performance" });
1996
- if (!t) throw new P("`textmode.js` requires WebGL2 support.");
1996
+ if (!t) throw new S("`textmode.js` requires WebGL2 support.");
1997
1997
  return this.$ = t, t;
1998
1998
  }
1999
1999
  Ss() {
@@ -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;
@@ -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 = Nt(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,19 +2202,19 @@ 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
- class V extends Et {
2208
+ class W extends Et {
2209
2209
  constructor(t, e, i, s, r, h, a, l) {
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);
2214
- return new V(h, t, a, e, l, u, s, r);
2213
+ const h = t.context, a = wt(h, i), { width: l, height: u } = bt(i);
2214
+ return new W(h, t, a, e, l, u, s, r);
2215
2215
  }
2216
2216
  }
2217
- class Nt {
2217
+ class Yt {
2218
2218
  constructor(t = 60) {
2219
2219
  o(this, "Xn");
2220
2220
  o(this, "Yn");
@@ -2300,10 +2300,10 @@ class Nt {
2300
2300
  return this.sh;
2301
2301
  }
2302
2302
  }
2303
- function Yt(n, t, e) {
2303
+ function zt(n, t, e) {
2304
2304
  return n ? n.sn(t, e) : { x: -1 / 0, y: -1 / 0 };
2305
2305
  }
2306
- class kt {
2306
+ class Ht {
2307
2307
  constructor(t, e) {
2308
2308
  o(this, "Xr");
2309
2309
  o(this, "wh");
@@ -2316,20 +2316,20 @@ 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);
2319
+ o(this, "Eh");
2320
+ o(this, "Uh", !1);
2321
2321
  o(this, "kh");
2322
+ o(this, "Lh");
2322
2323
  o(this, "Rh");
2323
2324
  o(this, "Dh");
2324
- o(this, "Lh");
2325
2325
  o(this, "Oh");
2326
2326
  this.Xr = t, this.wh = e;
2327
2327
  }
2328
- zh(t) {
2328
+ Hh(t) {
2329
2329
  const e = performance.now() + Math.max(0, t);
2330
2330
  e > this.Mh && (this.Mh = e);
2331
2331
  }
2332
- Hh() {
2332
+ zh() {
2333
2333
  return performance.now() < this.Mh;
2334
2334
  }
2335
2335
  Bh(t) {
@@ -2337,9 +2337,9 @@ class kt {
2337
2337
  e.style.cursor = t == null || t === "" ? "" : t;
2338
2338
  }
2339
2339
  Ih() {
2340
- if (this.Eh) return;
2340
+ if (this.Uh) return;
2341
2341
  const t = this.Xr.canvas;
2342
- this.Fh = (e) => {
2342
+ t instanceof HTMLCanvasElement && (this.Fh = (e) => {
2343
2343
  this.Gh(e), this.jh(e);
2344
2344
  }, this.$h = () => {
2345
2345
  this.Ch = { ...this.bh }, this.bh.x = -1 / 0, this.bh.y = -1 / 0, this.xh = null;
@@ -2349,17 +2349,17 @@ class kt {
2349
2349
  this.Gh(e), this.Nh(e);
2350
2350
  }, this.Sh = (e) => {
2351
2351
  this.Gh(e), this.Xh(e);
2352
- }, this.Uh = (e) => {
2352
+ }, this.Eh = (e) => {
2353
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;
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.Uh = !0);
2355
2355
  }
2356
2356
  Kh() {
2357
- if (!this.Eh) return;
2357
+ if (!this.Uh) 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.Uh = !1);
2360
2360
  }
2361
2361
  Wh() {
2362
- if (this.Eh) try {
2362
+ if (this.Uh) 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
2365
  this.Gh(t);
@@ -2372,13 +2372,13 @@ class kt {
2372
2372
  this.kh = t;
2373
2373
  }
2374
2374
  qh(t) {
2375
- this.Rh = t;
2375
+ this.Lh = t;
2376
2376
  }
2377
2377
  Vh(t) {
2378
- this.Dh = t;
2378
+ this.Rh = t;
2379
2379
  }
2380
2380
  Jh(t) {
2381
- this.Lh = t;
2381
+ this.Dh = t;
2382
2382
  }
2383
2383
  so(t) {
2384
2384
  this.Oh = t;
@@ -2390,49 +2390,49 @@ class kt {
2390
2390
  return { position: { ...this.bh }, previousPosition: { ...this.Ch }, originalEvent: t, ...e };
2391
2391
  }
2392
2392
  jh(t) {
2393
- this.Lh && !this.Hh() && this.Lh(this.io(t));
2393
+ this.Dh && !this.zh() && this.Dh(this.io(t));
2394
2394
  }
2395
2395
  Qh(t) {
2396
- this.Rh && !this.Hh() && this.Rh(this.io(t, { button: t.button }));
2396
+ this.Lh && !this.zh() && this.Lh(this.io(t, { button: t.button }));
2397
2397
  }
2398
2398
  Nh(t) {
2399
- this.Dh && !this.Hh() && this.Dh(this.io(t, { button: t.button }));
2399
+ this.Rh && !this.zh() && this.Rh(this.io(t, { button: t.button }));
2400
2400
  }
2401
2401
  Xh(t) {
2402
- this.kh && !this.Hh() && this.kh(this.io(t, { button: t.button }));
2402
+ this.kh && !this.zh() && this.kh(this.io(t, { button: t.button }));
2403
2403
  }
2404
2404
  Yh(t) {
2405
- this.Oh && !this.Hh() && this.Oh(this.io(t, { delta: { x: t.deltaX, y: t.deltaY } }));
2405
+ this.Oh && !this.zh() && this.Oh(this.io(t, { delta: { x: t.deltaX, y: t.deltaY } }));
2406
2406
  }
2407
2407
  Gh(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 = zt(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" }));
2415
- class Ht {
2414
+ const Ge = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Ht }, Symbol.toStringTag, { value: "Module" }));
2415
+ class kt {
2416
2416
  constructor() {
2417
2417
  o(this, "ro", /* @__PURE__ */ new Map());
2418
2418
  o(this, "no", null);
2419
2419
  o(this, "ho", null);
2420
2420
  o(this, "oo");
2421
2421
  o(this, "ao");
2422
- o(this, "Eh", !1);
2422
+ o(this, "Uh", !1);
2423
2423
  o(this, "co");
2424
2424
  o(this, "lo");
2425
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" });
2426
2426
  }
2427
2427
  Ih() {
2428
- this.Eh || (this.oo = (t) => {
2428
+ this.Uh || (this.oo = (t) => {
2429
2429
  this.fo(t);
2430
2430
  }, this.ao = (t) => {
2431
2431
  this.do(t);
2432
- }, window.addEventListener("keydown", this.oo, { passive: !1 }), window.addEventListener("keyup", this.ao, { passive: !1 }), this.Eh = !0);
2432
+ }, window.addEventListener("keydown", this.oo, { passive: !1 }), window.addEventListener("keyup", this.ao, { passive: !1 }), this.Uh = !0);
2433
2433
  }
2434
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);
2435
+ this.Uh && (window.removeEventListener("keydown", this.oo), window.removeEventListener("keyup", this.ao), this.Uh = !1, this.ro.clear(), this.no = null, this.ho = null);
2436
2436
  }
2437
2437
  qh(t) {
2438
2438
  this.co = t;
@@ -2480,7 +2480,7 @@ class Ht {
2480
2480
  return this.uo[t] || t.toLowerCase();
2481
2481
  }
2482
2482
  }
2483
- const je = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Ht }, Symbol.toStringTag, { value: "Module" }));
2483
+ const je = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: kt }, Symbol.toStringTag, { value: "Module" }));
2484
2484
  class Gt {
2485
2485
  constructor(t, e, i) {
2486
2486
  o(this, "Xr");
@@ -2496,13 +2496,13 @@ class Gt {
2496
2496
  o(this, "So");
2497
2497
  o(this, "Eo");
2498
2498
  o(this, "ko");
2499
- o(this, "Eh", !1);
2499
+ o(this, "Uh", !1);
2500
+ o(this, "Lo");
2500
2501
  o(this, "Ro");
2501
2502
  o(this, "Do");
2502
- o(this, "Lo");
2503
2503
  o(this, "Oo");
2504
- o(this, "zo");
2505
2504
  o(this, "Ho");
2505
+ o(this, "zo");
2506
2506
  o(this, "Bo");
2507
2507
  o(this, "Io");
2508
2508
  o(this, "Go");
@@ -2524,7 +2524,7 @@ class Gt {
2524
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");
2525
2525
  }
2526
2526
  Ih() {
2527
- if (this.Eh) return;
2527
+ if (this.Uh) return;
2528
2528
  const t = this.Xr.canvas;
2529
2529
  this.To = (e) => {
2530
2530
  this.ea(e);
@@ -2534,12 +2534,12 @@ class Gt {
2534
2534
  this.ra(e);
2535
2535
  }, this.ko = (e) => {
2536
2536
  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;
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.Uh = !0;
2538
2538
  }
2539
2539
  Kh() {
2540
- if (!this.Eh) return;
2540
+ if (!this.Uh) 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.To), t.removeEventListener("touchmove", this.So), t.removeEventListener("touchend", this.Eo), t.removeEventListener("touchcancel", this.ko), this.Uh = !1, this.Fo = null, this.Co.clear(), this.xo.clear(), this.Mo.forEach((e) => {
2543
2543
  e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
2544
2544
  }), this.Mo.clear(), this.sa = null, this.ta = 0, t.style.touchAction = this.$o, t.style.userSelect = this.Po;
2545
2545
  }
@@ -2556,22 +2556,22 @@ class Gt {
2556
2556
  return Array.from(this.Co.values()).map((t) => ({ ...t }));
2557
2557
  }
2558
2558
  aa(t) {
2559
- this.Ro = t;
2559
+ this.Lo = t;
2560
2560
  }
2561
2561
  Jh(t) {
2562
- this.Do = t;
2562
+ this.Ro = t;
2563
2563
  }
2564
2564
  ca(t) {
2565
- this.Lo = t;
2565
+ this.Do = t;
2566
2566
  }
2567
2567
  la(t) {
2568
2568
  this.Oo = t;
2569
2569
  }
2570
2570
  ua(t) {
2571
- this.zo = t;
2571
+ this.Ho = t;
2572
2572
  }
2573
2573
  fa(t) {
2574
- this.Ho = t;
2574
+ this.zo = t;
2575
2575
  }
2576
2576
  da(t) {
2577
2577
  this.Bo = t;
@@ -2588,7 +2588,7 @@ class Gt {
2588
2588
  ea(t) {
2589
2589
  var s;
2590
2590
  if (!this.wh()) return;
2591
- t.preventDefault(), (s = this.bo) == null || s.zh(this.Jo);
2591
+ t.preventDefault(), (s = this.bo) == null || s.Hh(this.Jo);
2592
2592
  const e = performance.now(), i = this.ma(t.changedTouches);
2593
2593
  for (const r of i) {
2594
2594
  const h = this.Co.get(r.id);
@@ -2597,20 +2597,20 @@ class Gt {
2597
2597
  this.Bo && (a.longPressTimer = window.setTimeout(() => {
2598
2598
  const l = this.Co.get(r.id);
2599
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));
2600
+ }, this.Yo)), this.Mo.set(r.id, a), this.Lo && this.Lo(this.ya(r, t, void 0, e));
2601
2601
  }
2602
2602
  this.Co.size === 2 && this.wa();
2603
2603
  }
2604
2604
  ia(t) {
2605
2605
  var s;
2606
2606
  if (!this.wh()) return;
2607
- t.preventDefault(), (s = this.bo) == null || s.zh(this.Jo);
2607
+ t.preventDefault(), (s = this.bo) == null || s.Hh(this.Jo);
2608
2608
  const e = performance.now(), i = this.ma(t.changedTouches);
2609
2609
  for (const r of i) {
2610
2610
  const h = this.Co.get(r.id), a = h ? this._a(h) : void 0;
2611
2611
  a && this.xo.set(r.id, a), this.Co.set(r.id, r);
2612
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));
2613
+ l && (l.lastPosition = r, l.lastTime = e, a) && q(a.clientX, a.clientY, r.clientX, r.clientY) > this.Ko && l.longPressTimer !== null && (window.clearTimeout(l.longPressTimer), l.longPressTimer = null), this.Ro && this.Ro(this.ya(r, t, a, e));
2614
2614
  }
2615
2615
  this.Co.size === 2 ? this.ba(t) : this.Fo = null;
2616
2616
  }
@@ -2620,7 +2620,7 @@ class Gt {
2620
2620
  const e = performance.now(), i = this.ma(t.changedTouches);
2621
2621
  for (const s of i) {
2622
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);
2623
+ a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.Do && this.Do(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);
2624
2624
  }
2625
2625
  this.Co.size < 2 && (this.Fo = null);
2626
2626
  }
@@ -2646,7 +2646,7 @@ class Gt {
2646
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 });
2647
2647
  }
2648
2648
  ha(t, e, i, s) {
2649
- const r = Yt(this.wh(), t, e);
2649
+ const r = zt(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
2652
  ya(t, e, i, s) {
@@ -2655,16 +2655,16 @@ class Gt {
2655
2655
  }
2656
2656
  wa() {
2657
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);
2658
+ const t = Array.from(this.Co.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
2659
  this.Fo = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
2660
2660
  }
2661
2661
  ba(t) {
2662
2662
  if (this.Fo || this.wa(), !this.Fo) return;
2663
2663
  const [e, i] = this.Fo.ids, s = this.Co.get(e), r = this.Co.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;
2665
+ const h = q(s.x, s.y, r.x, r.y) / this.Fo.initialDistance, a = h - this.Fo.lastScale;
2666
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;
2667
+ let l = Tt(s.clientX, s.clientY, r.clientX, r.clientY) - this.Fo.initialAngle;
2668
2668
  l = (l + 180) % 360 - 180;
2669
2669
  const u = l - this.Fo.lastRotation;
2670
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);
@@ -2676,7 +2676,7 @@ class Gt {
2676
2676
  Ca(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
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 });
2679
+ this.Fa(t.lastPosition, i) && this.zo ? this.zo({ touch: this._a(t.lastPosition), taps: 2, originalEvent: e }) : this.Ho && this.Ho({ touch: this._a(t.lastPosition), taps: 1, originalEvent: e });
2680
2680
  else if (!t.longPressFired && s <= this.Zo && a >= this.Wo) {
2681
2681
  const l = Math.max(a, 1e-4), u = { x: r / l, y: h / l }, c = { x: r / s, y: h / s };
2682
2682
  this.Io && this.Io({ touch: this._a(t.lastPosition), direction: u, distance: l, velocity: c, originalEvent: e });
@@ -2684,45 +2684,42 @@ class Gt {
2684
2684
  this.ta = i, this.sa = this._a(t.lastPosition);
2685
2685
  }
2686
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;
2687
+ return !this.sa || e - this.ta > this.No ? !1 : q(t.clientX, t.clientY, this.sa.clientX, this.sa.clientY) <= this.Xo;
2688
2688
  }
2689
2689
  _a(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 Ve = 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
2697
  o(this, "$a");
2698
2698
  this.$a = c;
2699
2699
  }
2700
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);
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() {
2704
+ update() {
2705
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);
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.update();
2712
2712
  }
2713
2713
  get source() {
2714
2714
  return this.$a;
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();
2723
- }
2724
- Ea() {
2725
- this.Ta();
2722
+ super.dispose(), this.Ta.pause(), this.Ta.src = "", this.Ta.load();
2726
2723
  }
2727
2724
  static async Nn(t, e, i, s, r) {
2728
2725
  const h = t.context, a = document.createElement("video");
@@ -2733,43 +2730,43 @@ class ut extends Z {
2733
2730
  g(Error("Failed to load video: " + (((d = v.error) == null ? void 0 : d.message) || "Unknown error")));
2734
2731
  }, { once: !0 }), a.src = i;
2735
2732
  });
2736
- const l = bt(h, a, h.LINEAR, h.LINEAR, h.CLAMP_TO_EDGE, h.CLAMP_TO_EDGE), { width: u, height: c } = wt(a);
2733
+ const l = wt(h, a, h.LINEAR, h.LINEAR, h.CLAMP_TO_EDGE, h.CLAMP_TO_EDGE), { width: u, height: c } = bt(a);
2737
2734
  return new ut(h, t, l, e, a, u, c, s, r);
2738
2735
  }
2739
2736
  async play() {
2740
- await this.Sa.play();
2737
+ await this.Ta.play();
2741
2738
  }
2742
2739
  pause() {
2743
- this.Sa.pause();
2740
+ this.Ta.pause();
2744
2741
  }
2745
2742
  stop() {
2746
- this.Sa.pause(), this.Sa.currentTime = 0;
2743
+ this.Ta.pause(), this.Ta.currentTime = 0;
2747
2744
  }
2748
2745
  speed(t) {
2749
- return this.Sa.playbackRate = t, this;
2746
+ return this.Ta.playbackRate = t, this;
2750
2747
  }
2751
2748
  loop(t = !0) {
2752
- return this.Sa.loop = t, this;
2749
+ return this.Ta.loop = t, this;
2753
2750
  }
2754
2751
  time(t) {
2755
- return this.Sa.currentTime = t, this;
2752
+ return this.Ta.currentTime = t, this;
2756
2753
  }
2757
2754
  volume(t) {
2758
- return this.Sa.volume = _(t, 0, 1), this;
2755
+ return this.Ta.volume = O(t, 0, 1), this;
2759
2756
  }
2760
2757
  get videoElement() {
2761
- return this.Sa;
2758
+ return this.Ta;
2762
2759
  }
2763
2760
  get currentTime() {
2764
- return this.Sa.currentTime;
2761
+ return this.Ta.currentTime;
2765
2762
  }
2766
2763
  get duration() {
2767
- return this.Sa.duration;
2764
+ return this.Ta.duration;
2768
2765
  }
2769
2766
  get isPlaying() {
2770
- return !this.Sa.paused && !this.Sa.ended;
2767
+ return !this.Ta.paused && !this.Ta.ended;
2771
2768
  }
2772
- get Sa() {
2769
+ get Ta() {
2773
2770
  return this.$a;
2774
2771
  }
2775
2772
  }
@@ -2781,86 +2778,86 @@ async function st(n) {
2781
2778
  }
2782
2779
  return n;
2783
2780
  }
2784
- const We = (n) => class extends n {
2781
+ const Ze = (n) => class extends n {
2785
2782
  rotate(t = 0, e = 0, i = 0) {
2786
- this.R.state.Jt(t), this.R.state.ts(e), this.R.state.ss(i);
2783
+ this.L.state.Jt(t), this.L.state.ts(e), this.L.state.ss(i);
2787
2784
  }
2788
2785
  rotateX(t) {
2789
- if (t === void 0) return et(this.R.state.rotationX);
2790
- this.R.state.Jt(t);
2786
+ if (t === void 0) return et(this.L.state.rotationX);
2787
+ this.L.state.Jt(t);
2791
2788
  }
2792
2789
  rotateY(t) {
2793
- if (t === void 0) return et(this.R.state.rotationY);
2794
- this.R.state.ts(t);
2790
+ if (t === void 0) return et(this.L.state.rotationY);
2791
+ this.L.state.ts(t);
2795
2792
  }
2796
2793
  rotateZ(t) {
2797
- if (t === void 0) return et(this.R.state.rotationZ);
2798
- this.R.state.ss(t);
2794
+ if (t === void 0) return et(this.L.state.rotationZ);
2795
+ this.L.state.ss(t);
2799
2796
  }
2800
2797
  translate(t = 0, e = 0, i = 0) {
2801
- this.R.state.es(t, e, i);
2798
+ this.L.state.es(t, e, i);
2802
2799
  }
2803
2800
  translateX(t) {
2804
- if (t === void 0) return this.R.state.translationX;
2805
- this.R.state.es(t, 0, 0);
2801
+ if (t === void 0) return this.L.state.translationX;
2802
+ this.L.state.es(t, 0, 0);
2806
2803
  }
2807
2804
  translateY(t) {
2808
- if (t === void 0) return this.R.state.translationY;
2809
- this.R.state.es(0, t, 0);
2805
+ if (t === void 0) return this.L.state.translationY;
2806
+ this.L.state.es(0, t, 0);
2810
2807
  }
2811
2808
  translateZ(t) {
2812
- if (t === void 0) return this.R.state.translationZ;
2813
- this.R.state.es(0, 0, t);
2809
+ if (t === void 0) return this.L.state.translationZ;
2810
+ this.L.state.es(0, 0, t);
2814
2811
  }
2815
2812
  ortho() {
2816
- this.R.state.As(!0);
2813
+ this.L.state.As(!0);
2817
2814
  }
2818
2815
  push() {
2819
- this.R.state.K();
2816
+ this.L.state.K();
2820
2817
  }
2821
2818
  pop() {
2822
- this.R.state.W();
2819
+ this.L.state.W();
2823
2820
  }
2824
2821
  color(t, e, i, s) {
2825
2822
  return E.yn(t, e, i, s);
2826
2823
  }
2827
2824
  rect(t = 1, e = 1) {
2828
- this.R.ki(t, e);
2825
+ this.L.ki(t, e);
2829
2826
  }
2830
2827
  point() {
2831
- this.R.ki(1, 1);
2828
+ this.L.ki(1, 1);
2832
2829
  }
2833
2830
  line(t, e, i, s) {
2834
- this.R.Ri(t, e, i, s);
2831
+ this.L.Li(t, e, i, s);
2835
2832
  }
2836
2833
  lineWeight(t) {
2837
- if (t === void 0) return this.R.state.lineWeight;
2838
- this.R.state.qt(t);
2834
+ if (t === void 0) return this.L.state.lineWeight;
2835
+ this.L.state.qt(t);
2839
2836
  }
2840
2837
  background(t, e, i, s = 255) {
2841
2838
  if (t === void 0) {
2842
- const [h, a, l, u] = this.R.state.canvasBackgroundColor;
2839
+ const [h, a, l, u] = this.L.state.canvasBackgroundColor;
2843
2840
  return E.xn(h, a, l, u);
2844
2841
  }
2845
2842
  const r = E.yn(t, e, i, s);
2846
- this.R.Bi(r.r, r.g, r.b, r.a);
2843
+ this.L.Bi(r.r, r.g, r.b, r.a);
2847
2844
  }
2848
2845
  char(t) {
2849
- if (t === void 0) return this.R.state.characterString;
2846
+ if (t === void 0) return this.L.state.characterString;
2850
2847
  let e;
2851
2848
  typeof t == "number" ? e = this.font.characters[t].character : e = t;
2852
2849
  const i = Array.from(e);
2853
2850
  if (i.length === 0) throw Error("char() requires at least one character.");
2854
2851
  const s = i[0];
2855
- this.R.state.cs(this.font.Br(s)), this.R.state.ls(s);
2852
+ this.L.state.cs(this.font.Br(s)), this.L.state.ls(s);
2856
2853
  }
2857
2854
  Xt(t, e, i, s) {
2858
2855
  if (t === void 0) {
2859
- const [h, a, l, u] = this.R.state.charColor;
2856
+ const [h, a, l, u] = this.L.state.charColor;
2860
2857
  return E.xn(h, a, l, u);
2861
2858
  }
2862
2859
  const r = E.yn(t, e, i, s);
2863
- this.R.state.us(r.r, r.g, r.b, r.a);
2860
+ this.L.state.us(r.r, r.g, r.b, r.a);
2864
2861
  }
2865
2862
  charColor(t, e, i, s) {
2866
2863
  return this.Xt(t, e, i, s);
@@ -2870,11 +2867,11 @@ const We = (n) => class extends n {
2870
2867
  }
2871
2868
  Yt(t, e, i, s) {
2872
2869
  if (t === void 0) {
2873
- const [h, a, l, u] = this.R.state.cellColor;
2870
+ const [h, a, l, u] = this.L.state.cellColor;
2874
2871
  return E.xn(h, a, l, u);
2875
2872
  }
2876
2873
  const r = E.yn(t, e, i, s);
2877
- this.R.state.fs(r.r, r.g, r.b, r.a);
2874
+ this.L.state.fs(r.r, r.g, r.b, r.a);
2878
2875
  }
2879
2876
  cellColor(t, e, i, s) {
2880
2877
  return this.Yt(t, e, i, s);
@@ -2883,120 +2880,120 @@ const We = (n) => class extends n {
2883
2880
  return this.Yt(t, e, i, s);
2884
2881
  }
2885
2882
  flipX(t) {
2886
- if (t === void 0) return this.R.state.flipX;
2887
- this.R.state.ds(t);
2883
+ if (t === void 0) return this.L.state.flipX;
2884
+ this.L.state.ds(t);
2888
2885
  }
2889
2886
  flipY(t) {
2890
- if (t === void 0) return this.R.state.flipY;
2891
- this.R.state.ps(t);
2887
+ if (t === void 0) return this.L.state.flipY;
2888
+ this.L.state.ps(t);
2892
2889
  }
2893
2890
  charRotation(t) {
2894
- if (t === void 0) return 360 * this.R.state.charRotation;
2895
- this.R.state.gs(t);
2891
+ if (t === void 0) return 360 * this.L.state.charRotation;
2892
+ this.L.state.gs(t);
2896
2893
  }
2897
2894
  invert(t) {
2898
- if (t === void 0) return this.R.state.invert;
2899
- this.R.state.vs(t);
2895
+ if (t === void 0) return this.L.state.invert;
2896
+ this.L.state.vs(t);
2900
2897
  }
2901
2898
  clear() {
2902
- this.R.xe(0, 0, 0, 0);
2899
+ this.L.xe(0, 0, 0, 0);
2903
2900
  }
2904
2901
  ellipse(t = 1, e = 1) {
2905
- this.R.Di(t / 2, e / 2);
2902
+ this.L.Ri(t / 2, e / 2);
2906
2903
  }
2907
2904
  triangle(t, e, i, s, r, h) {
2908
- this.R.Li(t, e, i, s, r, h);
2905
+ this.L.Di(t, e, i, s, r, h);
2909
2906
  }
2910
2907
  bezierCurve(t, e, i, s, r, h, a, l) {
2911
- this.R.Oi(t, e, i, s, r, h, a, l);
2908
+ this.L.Oi(t, e, i, s, r, h, a, l);
2912
2909
  }
2913
2910
  arc(t, e, i, s) {
2914
- this.R.zi(t / 2, e / 2, i, s);
2911
+ this.L.Hi(t / 2, e / 2, i, s);
2915
2912
  }
2916
2913
  shader(t) {
2917
- this.R.Fi(t);
2914
+ this.L.Fi(t);
2918
2915
  }
2919
2916
  resetShader() {
2920
- this.R.$i();
2917
+ this.L.$i();
2921
2918
  }
2922
2919
  setUniform(t, e) {
2923
- this.R._t(t, e);
2920
+ this.L._t(t, e);
2924
2921
  }
2925
2922
  setUniforms(t) {
2926
- this.R.gt(t);
2923
+ this.L.gt(t);
2927
2924
  }
2928
2925
  async createFilterShader(t) {
2929
- const e = await st(t), i = this.R.Pi(e);
2930
- return this.ka(i), i;
2926
+ const e = await st(t), i = this.L.Pi(e);
2927
+ return this.Sa(i), i;
2931
2928
  }
2932
2929
  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;
2930
+ const i = await st(t), s = await st(e), r = this.L.Mi(i, s);
2931
+ return this.Sa(r), r;
2935
2932
  }
2936
2933
  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;
2934
+ const e = this.L.zi(t.width ?? this.grid.cols, t.height ?? this.grid.rows, t.attachments ?? 3);
2935
+ return this.Sa(e), e;
2939
2936
  }
2940
2937
  image(t, e, i) {
2941
- this.R.Ti(t, e, i, this.font), t instanceof vt && this.R.Z();
2938
+ this.L.Ti(t, e, i, this.font), t instanceof vt && this.L.Z();
2942
2939
  }
2943
2940
  async loadImage(t) {
2944
2941
  const e = t, i = await new Promise((r, h) => {
2945
2942
  const a = new Image();
2946
2943
  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;
2944
+ }), s = W.Nn(this.L, this.En, i, this.grid.cols, this.grid.rows);
2945
+ return this.Sa(s), s;
2949
2946
  }
2950
2947
  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;
2948
+ const e = await ut.Nn(this.L, this.En, t, this.grid.cols, this.grid.rows);
2949
+ return this.Sa(e), e;
2953
2950
  }
2954
2951
  createTexture(t) {
2955
- const e = Z.Pa(this.R, this.En, t, this.grid.cols, this.grid.rows);
2956
- return this.ka(e), e;
2952
+ const e = Q.Pa(this.L, this.En, t, this.grid.cols, this.grid.rows);
2953
+ return this.Sa(e), e;
2957
2954
  }
2958
- }, Ve = (n) => class extends n {
2955
+ }, We = (n) => class extends n {
2959
2956
  get frameCount() {
2960
- return this.Ra.gh;
2957
+ return this.Ea.gh;
2961
2958
  }
2962
2959
  set frameCount(t) {
2963
- this.Ra.gh = t;
2960
+ this.Ea.gh = t;
2964
2961
  }
2965
2962
  frameRate(t) {
2966
- return t === void 0 ? this.Ra.dh : this.Ra.ah(t, () => this.Da());
2963
+ return t === void 0 ? this.Ea.dh : this.Ea.ah(t, () => this.ka());
2967
2964
  }
2968
2965
  targetFrameRate(t) {
2969
- if (t === void 0) return this.Ra.ph;
2970
- this.Ra.ph = t;
2966
+ if (t === void 0) return this.Ea.ph;
2967
+ this.Ea.ph = t;
2971
2968
  }
2972
2969
  noLoop() {
2973
- this.Ra.hh();
2970
+ this.Ea.hh();
2974
2971
  }
2975
2972
  loop() {
2976
- this.Ra.oh(() => this.Da());
2973
+ this.Ea.oh(() => this.ka());
2977
2974
  }
2978
2975
  redraw(t = 1) {
2979
- if (yt.m(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.Da();
2976
+ if (yt.m(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.ka();
2980
2977
  }
2981
2978
  isLooping() {
2982
- return this.Ra.fh;
2979
+ return this.Ea.fh;
2983
2980
  }
2984
2981
  get millis() {
2985
- return this.Ra._h;
2982
+ return this.Ea._h;
2986
2983
  }
2987
2984
  set millis(t) {
2988
- this.Ra._h = t;
2985
+ this.Ea._h = t;
2989
2986
  }
2990
2987
  get secs() {
2991
- return this.Ra.yh;
2988
+ return this.Ea.yh;
2992
2989
  }
2993
2990
  set secs(t) {
2994
- this.Ra.yh = t;
2991
+ this.Ea.yh = t;
2995
2992
  }
2996
2993
  deltaTime() {
2997
- return this.Ra.Ah;
2994
+ return this.Ea.Ah;
2998
2995
  }
2999
- }, Ze = (n) => class extends n {
2996
+ }, Qe = (n) => class extends n {
3000
2997
  constructor(...t) {
3001
2998
  super(...t);
3002
2999
  }
@@ -3021,7 +3018,7 @@ const We = (n) => class extends n {
3021
3018
  cursor(t) {
3022
3019
  this.bo.Bh(t);
3023
3020
  }
3024
- }, Qe = (n) => class extends n {
3021
+ }, Ke = (n) => class extends n {
3025
3022
  constructor(...t) {
3026
3023
  super(...t);
3027
3024
  }
@@ -3058,109 +3055,109 @@ const We = (n) => class extends n {
3058
3055
  get touches() {
3059
3056
  return this.La.oa();
3060
3057
  }
3061
- }, $e = (n) => class extends n {
3058
+ }, qe = (n) => class extends n {
3062
3059
  constructor(...t) {
3063
3060
  super(...t);
3064
3061
  }
3065
3062
  keyPressed(t) {
3066
- this.Oa.qh(t);
3063
+ this.Ra.qh(t);
3067
3064
  }
3068
3065
  keyReleased(t) {
3069
- this.Oa.Vh(t);
3066
+ this.Ra.Vh(t);
3070
3067
  }
3071
3068
  isKeyPressed(t) {
3072
- return this.Oa.po(t);
3069
+ return this.Ra.po(t);
3073
3070
  }
3074
3071
  get lastKeyPressed() {
3075
- return this.Oa.mo();
3072
+ return this.Ra.mo();
3076
3073
  }
3077
3074
  get lastKeyReleased() {
3078
- return this.Oa._o();
3075
+ return this.Ra._o();
3079
3076
  }
3080
3077
  get pressedKeys() {
3081
- return this.Oa.yo();
3078
+ return this.Ra.yo();
3082
3079
  }
3083
3080
  get modifierState() {
3084
- return this.Oa.Ao();
3081
+ return this.Ra.Ao();
3085
3082
  }
3086
3083
  };
3087
3084
  class jt {
3088
3085
  constructor(t) {
3089
- o(this, "za");
3090
- o(this, "Ha", /* @__PURE__ */ new Map());
3091
- o(this, "Ba", []);
3086
+ o(this, "Da");
3087
+ o(this, "Oa", /* @__PURE__ */ new Map());
3088
+ o(this, "Ha", []);
3089
+ o(this, "za", /* @__PURE__ */ new Map());
3090
+ o(this, "Ba", /* @__PURE__ */ new Map());
3092
3091
  o(this, "Ia", /* @__PURE__ */ new Map());
3093
3092
  o(this, "Ga", /* @__PURE__ */ new Map());
3094
3093
  o(this, "ja", /* @__PURE__ */ new Map());
3095
3094
  o(this, "Qa", /* @__PURE__ */ new Map());
3096
3095
  o(this, "Na", /* @__PURE__ */ new Map());
3097
3096
  o(this, "Xa", /* @__PURE__ */ new Map());
3098
- o(this, "Ya", /* @__PURE__ */ new Map());
3099
- o(this, "Ka", /* @__PURE__ */ new Map());
3100
- this.za = t;
3097
+ this.Da = t;
3101
3098
  }
3102
- Wa(t) {
3099
+ Ya(t) {
3103
3100
  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);
3101
+ if (this.Oa.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3102
+ const i = this.Ka(e.name);
3106
3103
  try {
3107
- const s = e.install(this.za, i);
3104
+ const s = e.install(this.Da, i);
3108
3105
  s instanceof Promise && s.catch((r) => {
3109
- console.error(`[textmode.js] Async plugin "${e.name}" installation error:`, r), this.qa(e.name);
3106
+ console.error(`[textmode.js] Async plugin "${e.name}" installation error:`, r), this.Wa(e.name);
3110
3107
  });
3111
3108
  } catch (s) {
3112
- throw this.qa(e.name), s;
3109
+ throw this.Wa(e.name), s;
3113
3110
  }
3114
- this.Ha.set(e.name, e), this.Ba.push(e.name);
3111
+ this.Oa.set(e.name, e), this.Ha.push(e.name);
3115
3112
  }
3116
3113
  }
3117
- async Va(t) {
3114
+ async Za(t) {
3118
3115
  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);
3116
+ if (this.Oa.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
3117
+ const i = this.Ka(e.name);
3121
3118
  try {
3122
- await e.install(this.za, i);
3119
+ await e.install(this.Da, i);
3123
3120
  } catch (s) {
3124
- throw this.qa(e.name), s;
3121
+ throw this.Wa(e.name), s;
3125
3122
  }
3126
- this.Ha.set(e.name, e), this.Ba.push(e.name);
3123
+ this.Oa.set(e.name, e), this.Ha.push(e.name);
3127
3124
  }
3128
3125
  }
3129
- async Ja(t) {
3130
- const e = this.Ha.get(t);
3126
+ async qa(t) {
3127
+ const e = this.Oa.get(t);
3131
3128
  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);
3129
+ const i = this.Ka(t);
3130
+ e.uninstall && await e.uninstall(this.Da, i), this.Oa.delete(t), this.Ha.splice(this.Ha.indexOf(t), 1), this.Wa(t);
3131
+ }
3132
+ Va() {
3133
+ this.Ja(this.za, (t) => t());
3134
3134
  }
3135
3135
  tc() {
3136
- this.sc(this.Ia, (t) => t());
3136
+ this.Ja(this.Ba, (t) => t());
3137
3137
  }
3138
- ec() {
3139
- this.sc(this.Ga, (t) => t());
3138
+ sc(t) {
3139
+ this.Ja(this.Ia, (e) => e(t));
3140
3140
  }
3141
- rc(t) {
3142
- this.sc(this.ja, (e) => e(t));
3141
+ ec(t) {
3142
+ this.Ja(this.Ga, (e) => e(t));
3143
3143
  }
3144
- nc(t) {
3145
- this.sc(this.Qa, (e) => e(t));
3144
+ rc(t) {
3145
+ this.Ja(this.ja, (e) => e(t));
3146
3146
  }
3147
- hc(t) {
3148
- this.sc(this.Na, (e) => e(t));
3147
+ async nc() {
3148
+ await this.hc(this.Qa, (t) => t());
3149
3149
  }
3150
3150
  async oc() {
3151
- await this.ac(this.Xa, (t) => t());
3152
- }
3153
- async cc() {
3154
- await this.ac(this.Ya, (t) => t());
3151
+ await this.hc(this.Na, (t) => t());
3155
3152
  }
3156
- async lc() {
3157
- const t = [...this.Ha.keys()];
3158
- for (const e of t) await this.Ja(e);
3153
+ async ac() {
3154
+ const t = [...this.Oa.keys()];
3155
+ for (const e of t) await this.qa(e);
3159
3156
  }
3160
- Za(t) {
3161
- const e = this.za, i = this;
3157
+ Ka(t) {
3158
+ const e = this.Da, i = this;
3162
3159
  return { get renderer() {
3163
- return e.R;
3160
+ return e.L;
3164
3161
  }, get canvas() {
3165
3162
  return e.Xr;
3166
3163
  }, get layerManager() {
@@ -3173,184 +3170,184 @@ class jt {
3173
3170
  return e.layers.base.drawFramebuffer;
3174
3171
  }, get asciiFramebuffer() {
3175
3172
  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);
3173
+ }, registerPreDrawHook: (s) => i.cc(i.za, t, s), registerPostDrawHook: (s) => i.cc(i.Ba, t, s), registerLayerDisposedHook: (s) => i.cc(i.Ia, t, s), registerLayerPreRenderHook: (s) => i.cc(i.Ga, t, s), registerLayerPostRenderHook: (s) => i.cc(i.ja, t, s), registerPreSetupHook: (s) => i.cc(i.Qa, t, s), registerPostSetupHook: (s) => i.cc(i.Na, t, s), extendLayer: (s, r) => {
3174
+ i.lc(t, s, r);
3178
3175
  }, removeLayerExtension: (s) => {
3179
- i.dc(t, s);
3176
+ i.uc(t, s);
3180
3177
  } };
3181
3178
  }
3182
- uc(t, e, i) {
3179
+ cc(t, e, i) {
3183
3180
  const s = t.get(e) ?? /* @__PURE__ */ new Set();
3184
3181
  return s.add(i), t.set(e, s), () => {
3185
3182
  const r = t.get(e);
3186
3183
  r && (r.delete(i), r.size === 0 && t.delete(e));
3187
3184
  };
3188
3185
  }
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);
3186
+ Wa(t) {
3187
+ this.za.delete(t), this.Ba.delete(t), this.Ia.delete(t), this.Ga.delete(t), this.ja.delete(t), this.Qa.delete(t), this.Na.delete(t);
3188
+ const e = this.Xa.get(t);
3192
3189
  if (e) {
3193
- for (const i of e.keys()) this.vc(i);
3194
- this.Ka.delete(t);
3190
+ for (const i of e.keys()) this.fc(i);
3191
+ this.Xa.delete(t);
3195
3192
  }
3196
3193
  }
3197
- sc(t, e) {
3198
- for (const i of this.Ba) {
3194
+ Ja(t, e) {
3195
+ for (const i of this.Ha) {
3199
3196
  const s = t.get(i);
3200
3197
  s && s.forEach(e);
3201
3198
  }
3202
3199
  }
3203
- async ac(t, e) {
3204
- for (const i of this.Ba) {
3200
+ async hc(t, e) {
3201
+ for (const i of this.Ha) {
3205
3202
  const s = t.get(i);
3206
3203
  if (s) for (const r of s) await e(r);
3207
3204
  }
3208
3205
  }
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);
3206
+ lc(t, e, i) {
3207
+ let s = this.Xa.get(t);
3208
+ s || (s = /* @__PURE__ */ new Map(), this.Xa.set(t, s));
3209
+ for (const [r, h] of this.Xa) r !== t && h.has(e) && console.warn(`[textmode.js] Plugin "${t}" is overwriting layer method "${e}" previously added by plugin "${r}".`);
3210
+ s.set(e, i), this.dc(e, i);
3214
3211
  }
3215
- dc(t, e) {
3216
- const i = this.Ka.get(t);
3212
+ uc(t, e) {
3213
+ const i = this.Xa.get(t);
3217
3214
  if (!i) return;
3218
3215
  i.delete(e);
3219
3216
  let s = !1;
3220
- for (const [r, h] of this.Ka) if (r !== t && h.has(e)) {
3217
+ for (const [r, h] of this.Xa) if (r !== t && h.has(e)) {
3221
3218
  s = !0;
3222
3219
  const a = h.get(e);
3223
- this.gc(e, a);
3220
+ this.dc(e, a);
3224
3221
  break;
3225
3222
  }
3226
- s || this.vc(e);
3223
+ s || this.fc(e);
3227
3224
  }
3228
- gc(t, e) {
3229
- const i = Object.getPrototypeOf(this.za.layers.base);
3225
+ dc(t, e) {
3226
+ const i = Object.getPrototypeOf(this.Da.layers.base);
3230
3227
  Object.defineProperty(i, t, { value: e, writable: !0, configurable: !0, enumerable: !1 });
3231
3228
  }
3232
- vc(t) {
3233
- const e = Object.getPrototypeOf(this.za.layers.base), i = Object.getOwnPropertyDescriptor(e, t);
3229
+ fc(t) {
3230
+ const e = Object.getPrototypeOf(this.Da.layers.base), i = Object.getOwnPropertyDescriptor(e, t);
3234
3231
  i && i.configurable && delete e[t];
3235
3232
  }
3236
3233
  }
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
3234
+ const ri = Object.freeze(Object.defineProperty({ __proto__: null, TextmodePluginManager: jt }, Symbol.toStringTag, { value: "Module" })), Z = `#version 300 es
3235
+ 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.);}`, Vt = `#version 300 es
3239
3236
  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 {
3237
+ class Zt {
3241
3238
  constructor() {
3242
- o(this, "mc", /* @__PURE__ */ new Map());
3243
- o(this, "_c", []);
3244
- o(this, "yc", 0);
3245
- o(this, "wc", 0);
3246
- o(this, "bc");
3239
+ o(this, "vc", /* @__PURE__ */ new Map());
3240
+ o(this, "gc", []);
3241
+ o(this, "mc", 0);
3242
+ o(this, "_c", 0);
3243
+ o(this, "yc");
3247
3244
  }
3248
- get Cc() {
3249
- return this.yc;
3245
+ get wc() {
3246
+ return this.mc;
3250
3247
  }
3251
- get xc() {
3252
- if (this.yc === 0) return 0;
3248
+ get bc() {
3249
+ if (this.mc === 0) return 0;
3253
3250
  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);
3251
+ for (const e of this.gc) {
3252
+ const i = this.vc.get(e);
3253
+ i && (t += O(i.progress, 0, 1) * i.weight);
3257
3254
  }
3258
- return Math.min(1, t / this.yc);
3255
+ return Math.min(1, t / this.mc);
3259
3256
  }
3260
- Mc(t) {
3261
- this.bc = t;
3257
+ Cc(t) {
3258
+ this.yc = t;
3262
3259
  }
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;
3260
+ xc(t, e = 1) {
3261
+ const i = `phase-${this.gc.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
3262
+ return this.vc.set(i, s), this.gc.push(i), this.mc += s.weight, i;
3266
3263
  }
3267
- $c(t, e) {
3268
- const i = this.mc.get(t);
3264
+ Mc(t, e) {
3265
+ const i = this.vc.get(t);
3269
3266
  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));
3267
+ i.progress = O(e, 0, 1), i.status = i.progress >= 1 ? "complete" : "running";
3268
+ const s = this.bc;
3269
+ Math.abs(s - this._c) > 1e-3 && (this._c = s, this.yc && this.yc(s));
3273
3270
  }
3274
- Pc(t) {
3275
- const e = this.mc.get(t);
3276
- e && (e.progress = 1, e.status = "complete", this.$c(t, 1));
3271
+ Fc(t) {
3272
+ const e = this.vc.get(t);
3273
+ e && (e.progress = 1, e.status = "complete", this.Mc(t, 1));
3277
3274
  }
3278
- Tc(t) {
3279
- const e = this.mc.get(t);
3275
+ $c(t) {
3276
+ const e = this.vc.get(t);
3280
3277
  e && (e.status = "failed");
3281
3278
  }
3282
- Sc() {
3283
- return this._c.map((t) => {
3284
- const e = this.mc.get(t);
3279
+ Pc() {
3280
+ return this.gc.map((t) => {
3281
+ const e = this.vc.get(t);
3285
3282
  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
3283
  });
3287
3284
  }
3288
3285
  }
3289
- class Vt {
3286
+ class Wt {
3290
3287
  constructor(t = "active") {
3291
- o(this, "Ec");
3292
- o(this, "kc", "");
3293
- o(this, "Rc", "");
3294
- this.Ec = t;
3288
+ o(this, "Tc");
3289
+ o(this, "Sc", "");
3290
+ o(this, "Ec", "");
3291
+ this.Tc = t;
3295
3292
  }
3296
- get Dc() {
3297
- return this.Ec;
3293
+ get kc() {
3294
+ return this.Tc;
3298
3295
  }
3299
3296
  get Lc() {
3300
- return this.Ec !== "disabled";
3297
+ return this.Tc !== "disabled";
3298
+ }
3299
+ get Rc() {
3300
+ return this.Tc === "active" || this.Tc === "transitioning" || this.Tc === "error";
3301
+ }
3302
+ get Dc() {
3303
+ return this.Sc;
3301
3304
  }
3302
3305
  get Oc() {
3303
- return this.Ec === "active" || this.Ec === "transitioning" || this.Ec === "error";
3306
+ return this.Ec;
3304
3307
  }
3305
- get zc() {
3306
- return this.kc;
3308
+ Hc() {
3309
+ this.Tc !== "done" && this.Tc !== "transitioning" || (this.Tc = "active");
3307
3310
  }
3308
- get Hc() {
3309
- return this.Rc;
3311
+ zc() {
3312
+ this.Tc !== "disabled" && (this.Tc = "done");
3310
3313
  }
3311
3314
  Bc() {
3312
- this.Ec !== "done" && this.Ec !== "transitioning" || (this.Ec = "active");
3315
+ this.Tc !== "disabled" && (this.Tc = "transitioning");
3313
3316
  }
3314
3317
  Ic() {
3315
- this.Ec !== "disabled" && (this.Ec = "done");
3318
+ this.Tc === "transitioning" && (this.Tc = "done");
3316
3319
  }
3317
- Gc() {
3318
- this.Ec !== "disabled" && (this.Ec = "transitioning");
3320
+ Gc(t) {
3321
+ this.Tc !== "disabled" && (this.Tc = "error", t instanceof Error ? (this.Sc = t.message, this.Ec = t.stack || "") : (this.Sc = t, this.Ec = ""));
3319
3322
  }
3320
3323
  jc() {
3321
- this.Ec === "transitioning" && (this.Ec = "done");
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 = ""));
3325
- }
3326
- Nc() {
3327
- this.Ec = "disabled";
3324
+ this.Tc = "disabled";
3328
3325
  }
3329
3326
  }
3330
- class Zt {
3327
+ class Qt {
3331
3328
  constructor(t, e) {
3332
- o(this, "Xc", 0);
3333
- o(this, "Yc", 1);
3334
- o(this, "Kc");
3335
- o(this, "Wc");
3336
- this.Kc = t, this.Wc = e;
3329
+ o(this, "Qc", 0);
3330
+ o(this, "Nc", 1);
3331
+ o(this, "Xc");
3332
+ o(this, "Yc");
3333
+ this.Xc = t, this.Yc = e;
3337
3334
  }
3338
- get Zc() {
3339
- return this.Yc;
3335
+ get Kc() {
3336
+ return this.Nc;
3340
3337
  }
3341
- get qc() {
3342
- return this.Yc < 1;
3338
+ get Wc() {
3339
+ return this.Nc < 1;
3343
3340
  }
3344
3341
  rh() {
3345
- this.Kc !== "none" && this.Wc > 0 && (this.Xc = performance.now());
3342
+ this.Xc !== "none" && this.Yc > 0 && (this.Qc = performance.now());
3346
3343
  }
3347
3344
  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);
3345
+ if (this.Xc === "none" || this.Yc === 0) return this.Nc = 1, !1;
3346
+ const t = performance.now() - this.Qc, e = Math.min(1, t / this.Yc);
3347
+ return e >= 1 ? (this.Nc = 0, !0) : (this.Nc = 1 - e, !1);
3351
3348
  }
3352
3349
  Qs() {
3353
- this.Yc = 1, this.Xc = 0;
3350
+ this.Nc = 1, this.Qc = 0;
3354
3351
  }
3355
3352
  }
3356
3353
  function At(n, t) {
@@ -3362,24 +3359,24 @@ function At(n, t) {
3362
3359
  return 0.2126 * l(r) + 0.7152 * l(h) + 0.0722 * l(a);
3363
3360
  }(t) > 0.5 ? "light" : "dark"), { mode: i, background: t, textColor: i === "light" ? "#1A1A1A" : "#F8F8F8", subtleColor: i === "light" ? "#4A4A4A" : "#C0C0C0" };
3364
3361
  }
3365
- function Qt(n) {
3362
+ function Kt(n) {
3366
3363
  return n.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
3367
3364
  }
3368
- function $t(n, t) {
3365
+ function qt(n, t) {
3369
3366
  return n.length ? n.map((e) => E.yn(e)) : [t.color("#FFFFFF")];
3370
3367
  }
3371
- class qt {
3368
+ class $t {
3372
3369
  constructor(t, e, i, s) {
3373
- this.Vc = t, this.id = e, this.label = i, this.Jc = s;
3370
+ this.Zc = t, this.id = e, this.label = i, this.qc = s;
3374
3371
  }
3375
3372
  report(t) {
3376
- this.Vc.$c(this.id, t);
3373
+ this.Zc.Mc(this.id, t);
3377
3374
  }
3378
3375
  complete() {
3379
- this.Vc.Pc(this.id);
3376
+ this.Zc.Fc(this.id);
3380
3377
  }
3381
3378
  fail(t) {
3382
- this.Vc.Tc(this.id), this.Jc && this.Jc(t ?? Error(`Loading phase "${this.label}" failed`));
3379
+ this.Zc.$c(this.id), this.qc && this.qc(t ?? Error(`Loading phase "${this.label}" failed`));
3383
3380
  }
3384
3381
  async track(t) {
3385
3382
  try {
@@ -3390,445 +3387,445 @@ class qt {
3390
3387
  }
3391
3388
  }
3392
3389
  }
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 }) => {
3390
+ const $e = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: a, transitionOpacity: l, isError: u, errorMessage: c }) => {
3394
3391
  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
3392
  if (n.charColor(d), n.cellColor(0, 0, 0, 0), u) {
3396
3393
  const m = E.yn(h.mode === "light" ? "#D32F2F" : "#FF6B6B").withAlpha(v);
3397
3394
  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);
3395
+ const A = "SETUP ERROR", w = -Math.floor(A.length / 2);
3396
+ n.push(), n.translate(w, 0, 0);
3400
3397
  for (const y of A) n.char(y), n.rect(1, 1), n.translateX(1);
3401
3398
  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) => {
3410
- const re = -Math.floor(C.length / 2);
3411
- n.push(), n.translate(re, 3 + Q, 0);
3412
- for (const ne of C) n.char(ne), n.rect(1, 1), n.translateX(1);
3399
+ const y = E.yn(h.subtleColor), T = n.color(y.r, y.g, y.b, v);
3400
+ n.charColor(T);
3401
+ const b = Math.floor(0.8 * t.cols), C = c.split(" "), R = [];
3402
+ let L = "";
3403
+ for (const F of C) (L + " " + F).length <= b ? L = L ? L + " " + F : F : (L && R.push(L), L = F);
3404
+ L && R.push(L);
3405
+ const U = R.slice(0, 3);
3406
+ R.length > 3 && (U[2] = U[2].substring(0, b - 3) + "..."), U.forEach((F, K) => {
3407
+ const re = -Math.floor(F.length / 2);
3408
+ n.push(), n.translate(re, 3 + K, 0);
3409
+ for (const ne of F) n.char(ne), n.rect(1, 1), n.translateX(1);
3413
3410
  n.pop();
3414
3411
  });
3415
3412
  }
3416
3413
  return;
3417
3414
  }
3418
3415
  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")];
3416
+ 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
3417
  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);
3418
+ for (let T = 0; T < m; T++) {
3419
+ const b = T < w ? "*" : ".", C = y[T % y.length], R = n.color(C.r, C.g, C.b, v);
3420
+ n.charColor(R), n.char(b), n.rect(1, 1), n.translateX(1);
3424
3421
  }
3425
3422
  n.pop();
3426
3423
  }
3427
3424
  if (s) {
3428
3425
  const m = E.yn(h.subtleColor), A = n.color(m.r, m.g, m.b, v);
3429
3426
  n.charColor(A);
3430
- const b = -Math.floor(s.length / 2);
3431
- n.push(), n.translate(b, 5, 0);
3427
+ const w = -Math.floor(s.length / 2);
3428
+ n.push(), n.translate(w, 5, 0);
3432
3429
  for (const y of s) n.char(y), n.rect(1, 1), n.translateX(1);
3433
3430
  n.pop();
3434
3431
  }
3435
3432
  };
3436
3433
  class ot {
3437
3434
  constructor(t, e = {}) {
3435
+ o(this, "Vc");
3436
+ o(this, "Kc");
3437
+ o(this, "Jc");
3438
3438
  o(this, "tl");
3439
- o(this, "Zc");
3440
3439
  o(this, "sl");
3441
3440
  o(this, "el");
3442
3441
  o(this, "il");
3443
3442
  o(this, "rl");
3444
3443
  o(this, "nl");
3445
3444
  o(this, "hl");
3445
+ o(this, "yr");
3446
3446
  o(this, "ol");
3447
3447
  o(this, "al");
3448
- o(this, "yr");
3449
3448
  o(this, "cl");
3450
3449
  o(this, "ll");
3451
- o(this, "ul");
3452
- o(this, "fl");
3453
- o(this, "dl", () => {
3450
+ o(this, "ul", () => {
3454
3451
  });
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);
3452
+ o(this, "fl", []);
3453
+ o(this, "dl", /* @__PURE__ */ new Map());
3454
+ this.Vc = e.visible ?? !0, this.Kc = e.opacity ?? 1, this.Jc = e.blendMode ?? "normal", this.tl = e.offsetX ?? 0, this.sl = e.offsetY ?? 0, this.el = e.rotationZ ?? 0, this.il = e.fontSize ?? 16, this.rl = e.fontSource, e.fontSource instanceof z ? this.yr = e.fontSource : this.yr = new z(t, this.il);
3458
3455
  }
3459
- async ml(t) {
3460
- this.ol = t, this.yr.Gr || await this.yr.Er(this.hl);
3456
+ async pl(t) {
3457
+ this.nl = t, this.yr.Gr || await this.yr.Er(this.rl);
3461
3458
  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(() => {
3459
+ this.hl = new ze(this.nl.canvas.canvas, e.width, e.height);
3460
+ const i = this.hl;
3461
+ this.ol = this.nl.createFramebuffer(i.cols, i.rows, 3), this.al = this.nl.createFramebuffer(i.width, i.height, 1), this.cl = this.nl.createFramebuffer(i.width, i.height, 1), this.ll = [this.nl.createFramebuffer(i.width, i.height, 1, { depth: !1 }), this.nl.createFramebuffer(i.width, i.height, 1, { depth: !1 })], this.hl.Vr(() => {
3465
3462
  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);
3463
+ this.ol.resize(this.hl.cols, this.hl.rows), this.al.resize(this.hl.width, this.hl.height), (s = this.cl) == null || s.resize(this.hl.width, this.hl.height), (r = this.ll) == null || r[0].resize(this.hl.width, this.hl.height), (h = this.ll) == null || h[1].resize(this.hl.width, this.hl.height);
3467
3464
  });
3468
3465
  }
3469
3466
  draw(t) {
3470
- this.dl = t;
3467
+ this.ul = t;
3471
3468
  }
3472
3469
  show() {
3473
- this.tl = !0;
3470
+ this.Vc = !0;
3474
3471
  }
3475
3472
  hide() {
3476
- this.tl = !1;
3473
+ this.Vc = !1;
3477
3474
  }
3478
3475
  opacity(t) {
3479
- if (t === void 0) return this.Zc;
3480
- this.Zc = _(t, 0, 1);
3476
+ if (t === void 0) return this.Kc;
3477
+ this.Kc = O(t, 0, 1);
3481
3478
  }
3482
3479
  blendMode(t) {
3483
- if (t === void 0) return this.sl;
3484
- this.sl = t;
3480
+ if (t === void 0) return this.Jc;
3481
+ this.Jc = t;
3485
3482
  }
3486
3483
  offset(t, e = 0) {
3487
- if (t === void 0) return { x: this.el, y: this.il };
3488
- this.el = t, this.il = e;
3484
+ if (t === void 0) return { x: this.tl, y: this.sl };
3485
+ this.tl = t, this.sl = e;
3489
3486
  }
3490
3487
  rotateZ(t) {
3491
- if (t === void 0) return this.rl;
3492
- this.rl = t;
3488
+ if (t === void 0) return this.el;
3489
+ this.el = t;
3493
3490
  }
3494
3491
  filter(t, e) {
3495
- this.pl.push({ name: t, params: e });
3492
+ this.fl.push({ name: t, params: e });
3496
3493
  }
3497
3494
  setPluginState(t, e) {
3498
- this.vl.set(t, e);
3495
+ this.dl.set(t, e);
3499
3496
  }
3500
3497
  getPluginState(t) {
3501
- return this.vl.get(t);
3498
+ return this.dl.get(t);
3502
3499
  }
3503
3500
  hasPluginState(t) {
3504
- return this.vl.has(t);
3501
+ return this.dl.has(t);
3505
3502
  }
3506
3503
  deletePluginState(t) {
3507
- return this.vl.delete(t);
3504
+ return this.dl.delete(t);
3508
3505
  }
3509
3506
  fontSize(t) {
3510
3507
  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());
3508
+ 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.vl());
3512
3509
  }
3513
3510
  async loadFont(t) {
3514
3511
  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;
3512
+ return t instanceof z ? (this.yr !== t && this.yr.dispose(), this.yr = t, this.yr.Gr || await this.yr.Er()) : await this.yr.Or(t), this.vl(), this.yr;
3516
3513
  }
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;
3514
+ ka(t, e) {
3515
+ if (!this.Vc || !this.ol || !this.al) return;
3516
+ const i = this.nl.renderer, s = this.hl;
3517
+ t.ml.ec(this), this.ol.begin(), i.state.Vt(), t._l = this;
3521
3518
  try {
3522
- this.dl.call(t);
3519
+ this.ul.call(t);
3523
3520
  } finally {
3524
- t.Al = void 0;
3521
+ t._l = void 0;
3525
3522
  }
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 = [];
3523
+ this.ol.end(), t.ml.rc(this);
3524
+ const r = this.fl.length > 0, h = r ? this.cl : this.al;
3525
+ h.begin(), i.xi(e), e.gt({ u_characterTexture: this.yr.fontFramebuffer, u_charsetDimensions: [this.yr.textureColumns, this.yr.textureRows], Ua: this.ol.textures[0], U8: this.ol.textures[1], U9: this.ol.textures[2], Ub: [s.cols, s.rows], Uc: [h.width, h.height], Ud: [0, 0, 0, 0] }), i.Ei(0, 0, s.width, s.height), h.end(), r && this.nl.filterManager.yl(this.cl.textures[0], this.al, this.fl, this.al.width, this.al.height, this.ll), this.fl = [];
3529
3526
  }
3530
3527
  vn() {
3531
3528
  var t;
3532
- this.cl && this.ll && ((t = this.al) == null || t.reset());
3529
+ this.ol && this.al && ((t = this.hl) == null || t.reset());
3533
3530
  }
3534
3531
  Ss() {
3535
3532
  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();
3533
+ (t = this.ol) == null || t.dispose(), (e = this.al) == null || e.dispose(), (i = this.cl) == null || i.dispose(), (s = this.ll) == null || s[0].dispose(), (r = this.ll) == null || r[1].dispose(), (h = this.yr) == null || h.dispose(), (a = this.hl) == null || a.Ss();
3537
3534
  }
3538
3535
  get texture() {
3539
3536
  var t;
3540
- return (t = this.ll) == null ? void 0 : t.textures[0];
3537
+ return (t = this.al) == null ? void 0 : t.textures[0];
3541
3538
  }
3542
3539
  get grid() {
3543
- return this.al;
3540
+ return this.hl;
3544
3541
  }
3545
3542
  get font() {
3546
3543
  return this.yr;
3547
3544
  }
3548
3545
  get width() {
3549
- return this.ll ? this.ll.width : 0;
3546
+ return this.al ? this.al.width : 0;
3550
3547
  }
3551
3548
  get height() {
3552
- return this.ll ? this.ll.height : 0;
3549
+ return this.al ? this.al.height : 0;
3553
3550
  }
3554
3551
  get drawFramebuffer() {
3555
- return this.cl;
3552
+ return this.ol;
3556
3553
  }
3557
3554
  get asciiFramebuffer() {
3558
- return this.ll;
3555
+ return this.al;
3559
3556
  }
3560
- _l() {
3561
- if (!this.al || !this.yr) return;
3557
+ vl() {
3558
+ if (!this.hl || !this.yr) return;
3562
3559
  const t = this.yr.maxGlyphDimensions;
3563
- this.al.tn(t.width, t.height), this.cl && this.ll && this.vn();
3560
+ this.hl.tn(t.width, t.height), this.ol && this.al && this.vn();
3564
3561
  }
3565
3562
  }
3566
3563
  const Je = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
3567
3564
  class Jt {
3568
3565
  constructor(t, e, i) {
3569
- o(this, "za");
3566
+ o(this, "Da");
3570
3567
  o(this, "l");
3568
+ o(this, "Al");
3569
+ o(this, "Zc");
3570
+ o(this, "wl");
3571
3571
  o(this, "bl");
3572
- o(this, "Vc");
3573
3572
  o(this, "Cl");
3574
3573
  o(this, "xl");
3575
- o(this, "Ml");
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", performance.now());
3577
+ o(this, "Pl", 0);
3578
+ o(this, "Tl", !1);
3582
3579
  o(this, "Sr", !1);
3583
3580
  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();
3581
+ this.Da = t, this.l = { ...Je, ...e ?? {} }, this.Al = new Wt("active"), this.Zc = new Zt(), this.wl = new Qt(this.l.transition, this.l.transitionDuration), this.bl = new Yt(60), this.Fl = At(this.l, i);
3582
+ const s = Kt(this.Fl);
3583
+ this.Ml = qt(s, this.Da), this.xl = this.Sl(), this.Zc.Cc((r) => {
3584
+ r >= 0.999 && this.zc();
3588
3585
  });
3589
3586
  }
3590
3587
  async Er() {
3591
3588
  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;
3589
+ const t = this.Da.L, e = this.Da.Xr;
3590
+ this.Cl = new ot(t, { visible: !0, opacity: 1, fontSize: 16 }), await this.Cl.pl({ renderer: t, canvas: e, filterManager: null, createFramebuffer: (i, s, r = 1, h) => t.zi(i, s, r, h) }), this.Sr = !0;
3594
3591
  }
3595
- get Oc() {
3596
- return this.bl.Oc && this.El;
3592
+ get Rc() {
3593
+ return this.Al.Rc && this.Tl;
3597
3594
  }
3598
3595
  rh() {
3599
- this.El || (this.El = !0, this.Tl = performance.now(), this.Sl = 0, this.xl.rh(() => this.Rl()));
3596
+ this.Tl || (this.Tl = !0, this.$l = performance.now(), this.Pl = 0, this.bl.rh(() => this.El()));
3600
3597
  }
3601
3598
  nh() {
3602
- this.El && (this.El = !1, this.xl.nh());
3599
+ this.Tl && (this.Tl = !1, this.bl.nh());
3603
3600
  }
3604
3601
  vn() {
3605
- this.Sr && this.Ml.vn();
3602
+ this.Sr && this.Cl.vn();
3606
3603
  }
3607
3604
  Ss() {
3608
- this.nh(), this.Sr && (this.Ml.Ss(), this.Sr = !1);
3605
+ this.nh(), this.Sr && (this.Cl.Ss(), this.Sr = !1);
3609
3606
  }
3610
3607
  get progress() {
3611
- return this.Vc.xc;
3608
+ return this.Zc.bc;
3612
3609
  }
3613
3610
  message(t) {
3614
3611
  return typeof t == "string" && (this.l.message = t), this.l.message;
3615
3612
  }
3616
3613
  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));
3614
+ this.Al.Hc();
3615
+ const i = this.Zc.xc(t, e);
3616
+ return new $t(this.Zc, i, t, (s) => this.error(s));
3620
3617
  }
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()));
3618
+ zc() {
3619
+ this.Al.kc !== "error" && (this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.Al.Bc(), this.wl.rh()) : (this.Al.zc(), this.nh(), this.kl()));
3623
3620
  }
3624
- Dl() {
3621
+ kl() {
3625
3622
  this.Ll && this.Ll();
3626
3623
  }
3627
- Ol(t) {
3624
+ Rl(t) {
3628
3625
  this.Ll = t;
3629
3626
  }
3630
3627
  error(t) {
3631
- this.bl.Qc(t);
3628
+ this.Al.Gc(t);
3632
3629
  }
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();
3637
- this.zl();
3630
+ El() {
3631
+ if (this.Al.Rc) {
3632
+ if (this.Pl++, this.Al.kc === "transitioning" && this.wl.N())
3633
+ return this.Al.Ic(), this.kl(), void this.nh();
3634
+ this.Dl();
3638
3635
  }
3639
3636
  }
3640
- zl() {
3637
+ Dl() {
3641
3638
  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 };
3639
+ const t = this.Cl, e = t.grid, i = this.Da.L, s = { textmodifier: this.Da, grid: e, progress: this.progress, elapsedMs: performance.now() - this.$l, frameCount: this.Pl, message: this.l.message, palette: this.Ml, theme: this.Fl, phases: this.Zc.Pc(), transitionOpacity: this.wl.Kc, isError: this.Al.kc === "error", errorMessage: this.Al.Dc || void 0, errorDetails: this.Al.Oc || void 0 };
3643
3640
  t.draw(() => {
3644
- this.za.resetShader(), this.za.clear(), this.za.push();
3641
+ this.Da.resetShader(), this.Da.clear(), this.Da.push();
3645
3642
  try {
3646
- this.Fl(s);
3643
+ this.xl(s);
3647
3644
  } finally {
3648
- this.za.pop();
3645
+ this.Da.pop();
3649
3646
  }
3650
- }), t.Da(this.za, this.za.Hl);
3647
+ }), t.ka(this.Da, this.Da.Ol);
3651
3648
  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));
3649
+ r && (i.xe(...i.state.canvasBackgroundColor), i.xi(this.Da.Hl), this.Da.Hl.gt({ u_texture: r }), i.Ei(e.offsetX, e.offsetY, e.width, e.height));
3653
3650
  }
3654
- Il(t) {
3655
- this.Pl = At(this.l, t);
3651
+ zl(t) {
3652
+ this.Fl = At(this.l, t);
3656
3653
  }
3657
- kl() {
3658
- const t = this.l.renderer || qe;
3654
+ Sl() {
3655
+ const t = this.l.renderer || $e;
3659
3656
  return (e) => {
3660
- t(e), this.Gl(e);
3657
+ t(e), this.Bl(e);
3661
3658
  };
3662
3659
  }
3663
- Gl(t) {
3660
+ Bl(t) {
3664
3661
  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
3662
  e.push(), e.translate(u, l, 0);
3666
3663
  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);
3664
+ 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);
3665
+ e.charColor(w), e.char(g), e.point(), e.translateX(1);
3669
3666
  }
3670
3667
  e.pop();
3671
3668
  }
3672
3669
  }
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 };
3670
+ const Ft = { 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
3671
  class te {
3675
3672
  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);
3673
+ o(this, "L");
3674
+ o(this, "Il");
3675
+ o(this, "ll");
3676
+ o(this, "Gl", 0);
3677
+ this.L = t, this.Il = t.Mi(Z, `#version 300 es
3678
+ 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.ll = [this.L.zi(e, i, 1), this.L.zi(e, i, 1)];
3679
+ }
3680
+ jl(t) {
3681
+ 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
3682
  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");
3683
+ const f = this.ll[0];
3684
+ f.begin(), this.L.xe(...r), f.end(), this.Gl = 0, i.layer.Vc && this.Ql(i.texture, a, l, i.width, i.height, i.layer.Kc, i.offsetX, i.offsetY, i.layer.el, "normal");
3688
3685
  for (const g of h) {
3689
3686
  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);
3687
+ p.Vc && this.Ql(g.texture, a, l, g.width, g.height, p.Kc, g.offsetX, g.offsetY, p.el, p.Jc);
3691
3688
  }
3692
- this.Yl(s, a, l), e.depthMask(c), u && e.enable(e.DEPTH_TEST);
3689
+ this.Nl(s, a, l), e.depthMask(c), u && e.enable(e.DEPTH_TEST);
3693
3690
  }
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;
3691
+ Ql(t, e, i, s, r, h, a, l, u, c) {
3692
+ const f = this.ll[this.Gl], g = this.Gl === 0 ? 1 : 0, p = this.ll[g], v = Y(u);
3693
+ p.begin(), this.L.xi(this.Il), this.Il.gt({ Uj: t, Uk: f.textures[0], Ul: [e, i], Um: [s, r], Un: [a, l], Uo: h, Up: v, Uq: Ft[c] }), this.L.Ei(0, 0, f.width, f.height), p.end(), this.Gl = g;
3697
3694
  }
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();
3695
+ Nl(t, e, i) {
3696
+ const s = this.ll[this.Gl];
3697
+ t.begin(), this.L.xi(this.Il), this.Il.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: Ft.normal }), this.L.Ei(0, 0, e, i), t.end();
3701
3698
  }
3702
3699
  vn(t, e) {
3703
- this.fl[0].resize(t, e), this.fl[1].resize(t, e);
3700
+ this.ll[0].resize(t, e), this.ll[1].resize(t, e);
3704
3701
  }
3705
3702
  Ss() {
3706
- this.jl.dispose(), this.fl[0].dispose(), this.fl[1].dispose();
3703
+ this.Il.dispose(), this.ll[0].dispose(), this.ll[1].dispose();
3707
3704
  }
3708
3705
  }
3709
3706
  class ti {
3710
3707
  constructor(t = {}) {
3711
- o(this, "Kl", []);
3712
- o(this, "Wl", []);
3713
- o(this, "Zl", !1);
3708
+ o(this, "Xl", []);
3709
+ o(this, "Yl", []);
3710
+ o(this, "Kl", !1);
3714
3711
  o(this, "l");
3715
3712
  this.l = t;
3716
3713
  }
3717
3714
  async initialize(t) {
3718
3715
  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;
3716
+ for (const s of this.Yl) t && await t(s), this.Xl.push(s), (i = (e = this.l).onAdd) == null || i.call(e, s);
3717
+ this.Yl = [], this.Kl = !0;
3721
3718
  }
3722
3719
  get isReady() {
3723
- return this.Zl;
3720
+ return this.Kl;
3724
3721
  }
3725
3722
  add(t) {
3726
3723
  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;
3724
+ return this.Kl ? (this.Xl.push(t), (i = (e = this.l).onAdd) == null || i.call(e, t)) : this.Yl.push(t), t;
3728
3725
  }
3729
3726
  addMany(t) {
3730
3727
  for (const e of t) this.add(e);
3731
3728
  return t;
3732
3729
  }
3733
3730
  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);
3731
+ const e = this.Xl.indexOf(t);
3732
+ if (e !== -1) return this.Xl.splice(e, 1), this.Wl(t), !0;
3733
+ const i = this.Yl.indexOf(t);
3734
+ return i !== -1 && (this.Yl.splice(i, 1), this.Wl(t), !0);
3738
3735
  }
3739
3736
  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;
3737
+ if (t < 0 || t >= this.Xl.length) return;
3738
+ const [e] = this.Xl.splice(t, 1);
3739
+ return this.Wl(e), e;
3743
3740
  }
3744
3741
  move(t, e) {
3745
3742
  var r, h;
3746
- const i = this.Kl.indexOf(t);
3743
+ const i = this.Xl.indexOf(t);
3747
3744
  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;
3745
+ this.Xl.splice(i, 1);
3746
+ const a = O(e, 0, this.Xl.length);
3747
+ return this.Xl.splice(a, 0, t), (h = (r = this.l).onMove) == null || h.call(r, t, i, a), !0;
3751
3748
  }
3752
- const s = this.Wl.indexOf(t);
3749
+ const s = this.Yl.indexOf(t);
3753
3750
  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;
3751
+ this.Yl.splice(s, 1);
3752
+ const a = O(e, 0, this.Yl.length);
3753
+ return this.Yl.splice(a, 0, t), !0;
3757
3754
  }
3758
3755
  return !1;
3759
3756
  }
3760
3757
  swap(t, e) {
3761
3758
  var a, l;
3762
3759
  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);
3760
+ const i = this.Xl.indexOf(t), s = this.Xl.indexOf(e);
3761
+ if (i !== -1 && s !== -1) return this.Xl[i] = e, this.Xl[s] = t, (l = (a = this.l).onSwap) == null || l.call(a, t, e, i, s), !0;
3762
+ const r = this.Yl.indexOf(t), h = this.Yl.indexOf(e);
3763
+ return r !== -1 && h !== -1 && (this.Yl[r] = e, this.Yl[h] = t, !0);
3767
3764
  }
3768
3765
  clear() {
3769
- for (const t of this.Kl) this.ql(t);
3770
- this.Kl = [];
3771
- for (const t of this.Wl) this.ql(t);
3772
- this.Wl = [];
3766
+ for (const t of this.Xl) this.Wl(t);
3767
+ this.Xl = [];
3768
+ for (const t of this.Yl) this.Wl(t);
3769
+ this.Yl = [];
3773
3770
  }
3774
3771
  dispose() {
3775
- this.clear(), this.Zl = !1;
3772
+ this.clear(), this.Kl = !1;
3776
3773
  }
3777
3774
  get all() {
3778
- return this.Kl;
3775
+ return this.Xl;
3779
3776
  }
3780
3777
  get pending() {
3781
- return this.Wl;
3778
+ return this.Yl;
3782
3779
  }
3783
3780
  get length() {
3784
- return this.Kl.length;
3781
+ return this.Xl.length;
3785
3782
  }
3786
3783
  get totalLength() {
3787
- return this.Kl.length + this.Wl.length;
3784
+ return this.Xl.length + this.Yl.length;
3788
3785
  }
3789
3786
  get isEmpty() {
3790
- return this.Kl.length === 0;
3787
+ return this.Xl.length === 0;
3791
3788
  }
3792
3789
  get(t) {
3793
- return this.Kl[t];
3790
+ return this.Xl[t];
3794
3791
  }
3795
3792
  get first() {
3796
- return this.Kl[0];
3793
+ return this.Xl[0];
3797
3794
  }
3798
3795
  get last() {
3799
- return this.Kl[this.Kl.length - 1];
3796
+ return this.Xl[this.Xl.length - 1];
3800
3797
  }
3801
3798
  indexOf(t) {
3802
- return this.Kl.indexOf(t);
3799
+ return this.Xl.indexOf(t);
3803
3800
  }
3804
3801
  has(t) {
3805
- return this.Kl.includes(t) || this.Wl.includes(t);
3802
+ return this.Xl.includes(t) || this.Yl.includes(t);
3806
3803
  }
3807
3804
  [Symbol.iterator]() {
3808
- return this.Kl[Symbol.iterator]();
3805
+ return this.Xl[Symbol.iterator]();
3809
3806
  }
3810
- ql(t) {
3807
+ Wl(t) {
3811
3808
  var e, i, s, r;
3812
3809
  (i = (e = this.l).onRemove) == null || i.call(e, t), (r = (s = this.l).onDispose) == null || r.call(s, t);
3813
3810
  }
3814
3811
  }
3815
3812
  class ee {
3816
3813
  constructor(t) {
3817
- o(this, "R");
3818
- o(this, "Vl", /* @__PURE__ */ new Map());
3819
- o(this, "Jl", /* @__PURE__ */ new Map());
3814
+ o(this, "L");
3815
+ o(this, "Zl", /* @__PURE__ */ new Map());
3816
+ o(this, "ql", /* @__PURE__ */ new Map());
3820
3817
  o(this, "Ke");
3821
- o(this, "fl");
3818
+ o(this, "ll");
3822
3819
  o(this, "Sr", !1);
3823
- this.R = t, this.Ke = t.Mi(W, Kt), this.tu();
3820
+ this.L = t, this.Ke = t.Mi(Z, Vt), this.Vl();
3824
3821
  }
3825
3822
  async register(t, e, i = {}) {
3826
3823
  const s = Object.entries(i), r = s.length > 0 ? s[0][1][0] : null;
3827
3824
  let h;
3828
3825
  if (typeof e == "string") {
3829
3826
  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);
3827
+ h = this.L.Mi(Z, l), this.ql.set(t, h);
3828
+ } else h = e, this.ql.set(t, h);
3832
3829
  const a = { id: t, createShader: () => h, createUniforms: (l, u) => {
3833
3830
  const c = { u_resolution: [u.width, u.height] };
3834
3831
  for (const [f, [g, p]] of s) {
@@ -3844,57 +3841,57 @@ class ee {
3844
3841
  }
3845
3842
  return c;
3846
3843
  } };
3847
- this.Vl.set(t, a);
3844
+ this.Zl.set(t, a);
3848
3845
  }
3849
3846
  unregister(t) {
3850
- const e = this.Jl.get(t);
3851
- return e && (e.dispose(), this.Jl.delete(t)), this.Vl.delete(t);
3847
+ const e = this.ql.get(t);
3848
+ return e && (e.dispose(), this.ql.delete(t)), this.Zl.delete(t);
3852
3849
  }
3853
3850
  has(t) {
3854
- return this.Vl.has(t);
3851
+ return this.Zl.has(t);
3855
3852
  }
3856
3853
  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);
3854
+ this.Sr || (this.ll = [this.L.zi(t, e, 1, { depth: !1 }), this.L.zi(t, e, 1, { depth: !1 })], this.Sr = !0);
3858
3855
  }
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);
3856
+ Jl(t, e, i, s, r) {
3857
+ this.ll[0].width === s && this.ll[0].height === r || (this.ll[0].resize(s, r), this.ll[1].resize(s, r)), this.yl(t, e, i, s, r, this.ll);
3861
3858
  }
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);
3859
+ yl(t, e, i, s, r, h) {
3860
+ if (i.length === 0) return void this.tu(t, e, s, r);
3861
+ this.tu(t, h[0], s, r);
3865
3862
  let a = 0;
3866
3863
  for (let l = 0; l < i.length; l++) {
3867
3864
  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);
3865
+ this.su(u, h[a], g, s, r), c || (a = f);
3869
3866
  }
3870
3867
  }
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] });
3868
+ su(t, e, i, s, r) {
3869
+ const h = this.Zl.get(t.name);
3870
+ if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.tu(e.textures[0], i, s, r);
3871
+ const a = this.eu(t.name, h, s, r), l = { renderer: this.L, gl: this.L.context, width: s, height: r };
3872
+ i.begin(), this.L.xi(a), a.gt({ u_texture: e.textures[0] });
3876
3873
  const u = h.createUniforms(t.params, l);
3877
- a.gt(u), this.R.Ei(0, 0, s, r), i.end();
3874
+ a.gt(u), this.L.Ei(0, 0, s, r), i.end();
3878
3875
  }
3879
- ru(t, e, i, s) {
3880
- let r = this.Jl.get(t);
3876
+ eu(t, e, i, s) {
3877
+ let r = this.ql.get(t);
3881
3878
  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);
3879
+ const h = { renderer: this.L, gl: this.L.context, width: i, height: s };
3880
+ r = e.createShader(h), this.ql.set(t, r);
3884
3881
  }
3885
3882
  return r;
3886
3883
  }
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();
3884
+ tu(t, e, i, s) {
3885
+ 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
3886
  }
3890
3887
  vn(t, e) {
3891
- this.fl && (this.fl[0].resize(t, e), this.fl[1].resize(t, e));
3888
+ this.ll && (this.ll[0].resize(t, e), this.ll[1].resize(t, e));
3892
3889
  }
3893
3890
  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;
3891
+ for (const t of this.ql.values()) t.dispose();
3892
+ this.ql.clear(), this.Zl.clear(), this.Ke.dispose(), this.ll && (this.ll[0].dispose(), this.ll[1].dispose()), this.Sr = !1;
3896
3893
  }
3897
- tu() {
3894
+ Vl() {
3898
3895
  this.register("invert", `#version 300 es
3899
3896
  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
3897
  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
@@ -3905,147 +3902,147 @@ precision highp float;uniform sampler2D u_texture;uniform float Ui;in vec2 v_uv;
3905
3902
  const ni = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFilterManager: ee }, Symbol.toStringTag, { value: "Module" }));
3906
3903
  class ie {
3907
3904
  constructor(t, e) {
3908
- o(this, "za");
3909
- o(this, "R");
3905
+ o(this, "Da");
3906
+ o(this, "L");
3907
+ o(this, "iu");
3908
+ o(this, "ru");
3910
3909
  o(this, "nu");
3911
3910
  o(this, "hu");
3912
- o(this, "ou");
3913
- o(this, "au");
3914
- o(this, "Zl", !1);
3915
- o(this, "cu", /* @__PURE__ */ new Set());
3916
- o(this, "lu", []);
3917
- o(this, "uu");
3918
- 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 });
3911
+ o(this, "Kl", !1);
3912
+ o(this, "ou", /* @__PURE__ */ new Set());
3913
+ o(this, "au", []);
3914
+ o(this, "cu");
3915
+ o(this, "lu");
3916
+ this.Da = t, this.L = t.L, this.ru = new ee(this.L), this.iu = new te(this.L, this.Da.Xr.width, this.Da.Xr.height), this.nu = new ti({ onRemove: (i) => this.Da.ml.sc(i), onDispose: (i) => i == null ? void 0 : i.Ss() }), this.hu = new ot(this.L, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
3920
3917
  }
3921
3918
  async Er() {
3922
- await this.du(this.au);
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;
3919
+ await this.uu(this.hu);
3920
+ const t = this.Da.Xr;
3921
+ this.cu = this.L.zi(t.width, t.height, 1), this.lu = this.L.zi(t.width, t.height, 1), this.ru.Er(t.width, t.height), await this.nu.initialize((e) => this.uu(e)), this.Kl = !0;
3925
3922
  }
3926
- pu(t, e) {
3927
- this.lu.push({ name: t, params: e });
3923
+ fu(t, e) {
3924
+ this.au.push({ name: t, params: e });
3928
3925
  }
3929
- vu() {
3930
- this.lu = [];
3926
+ du() {
3927
+ this.au = [];
3931
3928
  }
3932
3929
  add(t = {}) {
3933
- const e = new ot(this.R, t);
3934
- return this.ou.isReady && this.du(e), this.ou.add(e), e;
3930
+ const e = new ot(this.L, t);
3931
+ return this.nu.isReady && this.uu(e), this.nu.add(e), e;
3935
3932
  }
3936
3933
  remove(t) {
3937
- this.ou.remove(t);
3934
+ this.nu.remove(t);
3938
3935
  }
3939
3936
  move(t, e) {
3940
- this.ou.move(t, e);
3937
+ this.nu.move(t, e);
3941
3938
  }
3942
3939
  swap(t, e) {
3943
- this.ou.swap(t, e);
3940
+ this.nu.swap(t, e);
3944
3941
  }
3945
3942
  clear() {
3946
- this.ou.clear();
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);
3952
- }
3953
- _u() {
3954
- this.gu(this.uu);
3955
- let t = this.uu.textures[0];
3956
- if (this.lu.length > 0) {
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 = [];
3943
+ this.nu.clear();
3944
+ }
3945
+ pu(t) {
3946
+ this.Da.ml.Va(), this.hu.ka(this.Da, this.Da.Ol);
3947
+ const e = [...this.L.state.canvasBackgroundColor];
3948
+ this.nu.all.forEach((i) => i.ka(this.Da, this.Da.Ol)), this.vu(t, e);
3949
+ }
3950
+ gu() {
3951
+ this.pu(this.cu);
3952
+ let t = this.cu.textures[0];
3953
+ if (this.au.length > 0) {
3954
+ const i = this.Da.Xr;
3955
+ this.ru.Jl(this.cu.textures[0], this.lu, this.au, i.width, i.height), t = this.lu.textures[0], this.au = [];
3959
3956
  }
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();
3957
+ const e = this.Da.Xr;
3958
+ this.L.xe(0, 0, 0, 0), this.L.xi(this.Da.Hl), this.Da.Hl.gt({ u_texture: t }), this.L.Ei(0, 0, e.width, e.height), this.Da.ml.tc();
3962
3959
  }
3963
- mu(t, e) {
3964
- const i = this.za.Xr, s = this.au.grid, r = this.au.texture;
3960
+ vu(t, e) {
3961
+ const i = this.Da.Xr, s = this.hu.grid, r = this.hu.texture;
3965
3962
  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) => {
3963
+ const h = { layer: this.hu, texture: r, width: s.width, height: s.height, offsetX: s.offsetX + this.hu.tl, offsetY: s.offsetY + this.hu.sl }, a = this.nu.all.filter((l) => !!l.grid && !!l.texture).map((l) => {
3967
3964
  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 };
3965
+ return { layer: l, texture: l.texture, width: u.width, height: u.height, offsetX: u.offsetX + l.tl, offsetY: u.offsetY + l.sl };
3969
3966
  });
3970
- this.nu.Nl({ base: h, layers: a, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
3967
+ this.iu.jl({ base: h, layers: a, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
3971
3968
  }
3972
3969
  vn() {
3973
3970
  var e, i, s;
3974
- if (!this.Zl) return;
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);
3971
+ if (!this.Kl) return;
3972
+ const t = this.Da.Xr;
3973
+ this.hu.vn(), this.nu.all.forEach((r) => r.vn()), this.iu.vn(t.width, t.height), (e = this.cu) == null || e.resize(t.width, t.height), (i = this.lu) == null || i.resize(t.width, t.height), (s = this.ru) == null || s.vn(t.width, t.height);
3977
3974
  }
3978
3975
  Ss() {
3979
3976
  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 = [];
3977
+ this.nu.dispose(), this.Da.ml.sc(this.hu), this.hu.Ss(), this.ru.Ss(), this.iu.Ss(), (t = this.cu) == null || t.dispose(), (e = this.lu) == null || e.dispose(), this.au = [];
3981
3978
  }
3982
3979
  get all() {
3983
- return this.ou.all;
3980
+ return this.nu.all;
3984
3981
  }
3985
3982
  get base() {
3986
- return this.au;
3983
+ return this.hu;
3987
3984
  }
3988
3985
  get filters() {
3989
- return this.hu;
3986
+ return this.ru;
3990
3987
  }
3991
3988
  get resultFramebuffer() {
3992
- return this.fu;
3989
+ return this.lu;
3993
3990
  }
3994
- yu() {
3995
- const t = this.ou.all;
3991
+ mu() {
3992
+ const t = this.nu.all;
3996
3993
  for (let e = t.length - 1; e >= 0; e--) {
3997
3994
  const i = t[e];
3998
- if (i.tl && i.grid) return i.grid;
3995
+ if (i.Vc && i.grid) return i.grid;
3999
3996
  }
4000
- return this.au.grid;
3997
+ return this.hu.grid;
4001
3998
  }
4002
- Au(t) {
4003
- this.cu.add(t);
3999
+ _u(t) {
4000
+ this.ou.add(t);
4004
4001
  }
4005
- wu() {
4006
- for (const t of this.cu) t();
4002
+ yu() {
4003
+ for (const t of this.ou) t();
4007
4004
  }
4008
- async du(t) {
4005
+ async uu(t) {
4009
4006
  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());
4007
+ const e = { renderer: this.L, canvas: this.Da.Xr, filterManager: this.ru, createFramebuffer: (s, r, h = 1, a) => this.L.zi(s, r, h, a) };
4008
+ await t.pl(e), (i = t.grid) == null || i.Vr(() => this.yu());
4012
4009
  }
4013
4010
  }
4014
- const ei = { id: "brightness", createShader: ({ gl: n }) => new K(n, ht, `#version 300 es
4011
+ const ei = { id: "brightness", createShader: ({ gl: n }) => new V(n, ht, `#version 300 es
4015
4012
  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
4013
  class se {
4017
4014
  constructor() {
4018
- o(this, "bu", /* @__PURE__ */ new Map());
4019
- o(this, "Jl", /* @__PURE__ */ new Map());
4020
- this.Cu();
4015
+ o(this, "Au", /* @__PURE__ */ new Map());
4016
+ o(this, "ql", /* @__PURE__ */ new Map());
4017
+ this.wu();
4021
4018
  }
4022
4019
  register(t) {
4023
- this.bu.set(t.id, t);
4020
+ this.Au.set(t.id, t);
4024
4021
  }
4025
4022
  unregister(t) {
4026
- const e = this.Jl.get(t);
4027
- return e && (e.dispose(), this.Jl.delete(t)), this.bu.delete(t);
4023
+ const e = this.ql.get(t);
4024
+ return e && (e.dispose(), this.ql.delete(t)), this.Au.delete(t);
4028
4025
  }
4029
4026
  has(t) {
4030
- return this.bu.has(t);
4027
+ return this.Au.has(t);
4031
4028
  }
4032
4029
  Qn(t) {
4033
- return this.bu.get(t);
4030
+ return this.Au.get(t);
4034
4031
  }
4035
4032
  jn(t, e) {
4036
- let i = this.Jl.get(t);
4033
+ let i = this.ql.get(t);
4037
4034
  if (!i) {
4038
- const s = this.bu.get(t);
4035
+ const s = this.Au.get(t);
4039
4036
  if (!s) throw Error(`[textmode.js] Conversion mode "${t}" is not registered.`);
4040
- i = s.createShader(e), this.Jl.set(t, i);
4037
+ i = s.createShader(e), this.ql.set(t, i);
4041
4038
  }
4042
4039
  return i;
4043
4040
  }
4044
4041
  Ss() {
4045
- for (const t of this.Jl.values()) t.dispose();
4046
- this.Jl.clear(), this.bu.clear();
4042
+ for (const t of this.ql.values()) t.dispose();
4043
+ this.ql.clear(), this.Au.clear();
4047
4044
  }
4048
- Cu() {
4045
+ wu() {
4049
4046
  this.register(ei);
4050
4047
  }
4051
4048
  }
@@ -4053,128 +4050,128 @@ const hi = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeConver
4053
4050
  class ii extends function(e, ...i) {
4054
4051
  return i.reduce((s, r) => r(s), e);
4055
4052
  }(class {
4056
- }, We, Ve, Ze, Qe, $e) {
4053
+ }, Ze, We, Qe, Ke, qe) {
4057
4054
  constructor(e = {}) {
4058
4055
  super();
4059
- o(this, "R");
4056
+ o(this, "L");
4057
+ o(this, "Ol");
4060
4058
  o(this, "Hl");
4061
- o(this, "Bl");
4062
4059
  o(this, "Xr");
4063
- o(this, "Ra");
4060
+ o(this, "Ea");
4064
4061
  o(this, "bo");
4065
4062
  o(this, "La");
4066
- o(this, "Oa");
4067
- o(this, "xu");
4068
- o(this, "Mu");
4069
- o(this, "Al");
4063
+ o(this, "Ra");
4064
+ o(this, "bu");
4065
+ o(this, "Cu");
4066
+ o(this, "_l");
4070
4067
  o(this, "En");
4071
- o(this, "Fu", /* @__PURE__ */ new Set());
4072
- o(this, "yl");
4068
+ o(this, "xu", /* @__PURE__ */ new Set());
4069
+ o(this, "ml");
4070
+ o(this, "Mu", !1);
4071
+ o(this, "Fu", !1);
4073
4072
  o(this, "$u", !1);
4074
4073
  o(this, "Pu", !1);
4075
- o(this, "Tu", !1);
4076
- o(this, "Su", !1);
4077
- o(this, "Eu", () => {
4074
+ o(this, "Tu", () => {
4078
4075
  });
4079
- o(this, "ku", () => {
4076
+ o(this, "Su", () => {
4080
4077
  });
4081
- o(this, "Ru");
4082
- o(this, "Du");
4078
+ o(this, "Eu");
4079
+ o(this, "ku");
4083
4080
  o(this, "Lu");
4084
4081
  o(this, "rn", !1);
4085
- o(this, "Ou");
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) {
4082
+ o(this, "Ru");
4083
+ o(this, "Du");
4084
+ this.ml = new jt(this), this.rn = e.overlay ?? !1, this.Xr = new ke(e), this.L = new Ce(this.Xr.gn()), this.Ol = this.L.Mi(Z, `#version 300 es
4085
+ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D U8;uniform sampler2D U9;uniform sampler2D Ua;uniform vec2 Ub;uniform vec2 Uc;uniform vec4 Ud;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/Uc;vec2 F=E*Ub;vec2 G=floor(F);vec2 H=(G+0.5)/Ub;vec4 I=texture(U8,H);vec4 J=texture(U9,H);vec4 K=texture(Ua,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(Ud,J,J.a);fragColor=mix(d,I,c);}`), this.Hl = this.L.Mi(Z, Vt), this.Ea = new Yt(e.frameRate ?? 60), this.bu = new Jt(this, e.loadingScreen, this.Xr.pn()), this.bu.Rl(() => {
4086
+ this.Ea.gh = 0, this.Pu = !0;
4087
+ }), this.Cu = new ie(this, e);
4088
+ const i = () => this.Ou();
4089
+ this.bo = new Ht(this.Xr, i), this.La = new Gt(this.Xr, i, this.bo), this.Ra = new kt(), this.En = new se(), this.ml.Ya(e.plugins ?? []), this.bu.rh(), this.Hu();
4090
+ }
4091
+ Sa(e) {
4095
4092
  var i;
4096
- this.Fu.add(e), (i = e.C) == null || i.call(e, () => {
4097
- this.Fu.delete(e);
4093
+ this.xu.add(e), (i = e.C) == null || i.call(e, () => {
4094
+ this.xu.delete(e);
4098
4095
  });
4099
4096
  }
4100
- async Bu() {
4101
- await this.Mu.Er(), await this.xu.Er();
4102
- const e = this.Mu.base.grid;
4103
- this.Mu.Au(() => {
4097
+ async Hu() {
4098
+ await this.Cu.Er(), await this.bu.Er();
4099
+ const e = this.Cu.base.grid;
4100
+ this.Cu._u(() => {
4104
4101
  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());
4102
+ }), this.rn && (this.Ru = W.Nn(this.L, this.En, this.Xr.targetCanvas, e.cols, e.rows)), this.zu(), this.Ea.rh(() => this.ka());
4106
4103
  try {
4107
- await this.yl.oc(), await this.Eu(), await this.yl.cc(), this.xu.Ic();
4104
+ await this.ml.nc(), await this.Tu(), await this.ml.oc(), this.bu.zc();
4108
4105
  } catch (i) {
4109
- console.error("Error during setup:", i), this.xu.error(i);
4106
+ console.error("Error during setup:", i), this.bu.error(i);
4110
4107
  }
4111
4108
  }
4112
- Iu() {
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(() => {
4109
+ zu() {
4110
+ this.Eu = () => {
4111
+ this.rn && this.resizeCanvas(this.Xr.targetCanvas.width, this.Xr.targetCanvas.height), this.Su();
4112
+ }, window.addEventListener("resize", this.Eu), this.bo.Ih(), this.La.Ih(), this.Ra.Ih(), this.ku = () => {
4113
+ this.Ra.wo();
4114
+ }, window.addEventListener("blur", this.ku), this.rn && (this.Lu = new ResizeObserver(() => {
4118
4115
  this.resizeCanvas(this.Xr.targetCanvas.width, this.Xr.targetCanvas.height);
4119
4116
  }), this.Lu.observe(this.Xr.targetCanvas));
4120
4117
  }
4121
- Da() {
4122
- if (!this.xu.Oc && this.Su) {
4123
- this.Pu = !0;
4118
+ ka() {
4119
+ if (!this.bu.Rc && this.Pu) {
4120
+ this.Fu = !0;
4124
4121
  try {
4125
- this.Ra.uh(), this.Ra.mh(), this.rn && rt(this.R.context, this.Ou.texture, this.Xr.targetCanvas), this.Mu._u();
4122
+ this.Ea.uh(), this.Ea.mh(), this.rn && rt(this.L.context, this.Ru.texture, this.Xr.targetCanvas), this.Cu.gu();
4126
4123
  } finally {
4127
- this.Pu = !1, this.$u && !this.Tu && this.Gu();
4124
+ this.Fu = !1, this.Mu && !this.$u && this.Bu();
4128
4125
  }
4129
4126
  }
4130
4127
  }
4131
4128
  resizeCanvas(e, i) {
4132
4129
  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();
4130
+ this.Xr.vn(e, i), this.bu.zl(this.Xr.pn()), this.bu.vn(), (s = this.Cu) == null || s.vn(), this.L.Gi(), this.ka();
4134
4131
  }
4135
4132
  destroy() {
4136
- this.Tu || this.$u || (this.$u = !0, this.Ra.hh(), this.Pu || this.Gu());
4133
+ this.$u || this.Mu || (this.Mu = !0, this.Ea.hh(), this.Fu || this.Bu());
4137
4134
  }
4138
- Gu() {
4135
+ Bu() {
4139
4136
  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;
4137
+ this.Mu = !1, this.Xr.Ss(), this.bu.Ss(), this.ml.ac(), window.removeEventListener("resize", this.Eu), window.removeEventListener("blur", this.ku), (e = this.Lu) == null || e.disconnect(), this.bo.Kh(), this.La.Kh(), this.Ra.Kh(), (i = this.Cu) == null || i.Ss(), (s = this.En) == null || s.Ss();
4138
+ for (const h of this.xu) h.dispose();
4139
+ this.xu.clear(), this.Ol.dispose(), this.Hl.dispose(), this.L.Ss(), (r = this.Ru) == null || r.dispose(), this.$u = !0;
4143
4140
  }
4144
4141
  filter(e, i) {
4145
- this.Mu.pu(e, i);
4142
+ this.Cu.fu(e, i);
4146
4143
  }
4147
4144
  draw(e) {
4148
- this.Mu.base.draw(e);
4145
+ this.Cu.base.draw(e);
4149
4146
  }
4150
4147
  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;
4148
+ if (i) return await this.Cu.base.loadFont(e), this.Cu.base.font;
4149
+ if (e instanceof z) return e.Gr || await e.Er(), e;
4150
+ const s = new z(this.L);
4151
+ return await s.Er(e), this.Sa(s), s;
4155
4152
  }
4156
4153
  fontSize(e) {
4157
- return this.Mu.base.fontSize(e);
4154
+ return this.Cu.base.fontSize(e);
4158
4155
  }
4159
4156
  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());
4157
+ return e === void 0 ? this.Du ?? "topmost" : e === "topmost" ? (this.Du = void 0, this.bo.Wh(), void this.La.Wh()) : (this.Du = e, this.bo.Wh(), void this.La.Wh());
4161
4158
  }
4162
- Hu() {
4163
- return this.zu ? this.zu : this.Mu.yu();
4159
+ Ou() {
4160
+ return this.Du ? this.Du : this.Cu.mu();
4164
4161
  }
4165
4162
  async setup(e) {
4166
- this.Eu = e;
4163
+ this.Tu = e;
4167
4164
  }
4168
4165
  windowResized(e) {
4169
- this.ku = e;
4166
+ this.Su = e;
4170
4167
  }
4171
4168
  get grid() {
4172
4169
  var e;
4173
- return ((e = this.Al) == null ? void 0 : e.grid) ?? this.Mu.base.grid;
4170
+ return ((e = this._l) == null ? void 0 : e.grid) ?? this.Cu.base.grid;
4174
4171
  }
4175
4172
  get font() {
4176
4173
  var e;
4177
- return ((e = this.Al) == null ? void 0 : e.font) ?? this.Mu.base.font;
4174
+ return ((e = this._l) == null ? void 0 : e.font) ?? this.Cu.base.font;
4178
4175
  }
4179
4176
  get width() {
4180
4177
  return this.Xr.width;
@@ -4186,25 +4183,25 @@ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charse
4186
4183
  return this.Xr.canvas;
4187
4184
  }
4188
4185
  get isDisposed() {
4189
- return this.Tu;
4186
+ return this.$u;
4190
4187
  }
4191
4188
  get overlay() {
4192
- return this.Ou;
4189
+ return this.Ru;
4193
4190
  }
4194
4191
  get loading() {
4195
- return this.xu;
4192
+ return this.bu;
4196
4193
  }
4197
4194
  get layers() {
4198
- return this.Mu;
4195
+ return this.Cu;
4199
4196
  }
4200
4197
  get filters() {
4201
- return this.Mu.filters;
4198
+ return this.Cu.filters;
4202
4199
  }
4203
4200
  get conversions() {
4204
4201
  return this.En;
4205
4202
  }
4206
4203
  get isRenderingFrame() {
4207
- return this.Pu;
4204
+ return this.Fu;
4208
4205
  }
4209
4206
  }
4210
4207
  class xt {
@@ -4217,18 +4214,18 @@ class xt {
4217
4214
  yt._(t);
4218
4215
  }
4219
4216
  static get version() {
4220
- return "0.9.2";
4217
+ return "0.9.3-beta.2";
4221
4218
  }
4222
4219
  }
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;
4220
+ const oi = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: $t, LoadingPhaseTracker: Zt, LoadingScreenManager: Jt, LoadingScreenStateMachine: Wt, LoadingScreenTransition: Qt, resolveColorInputs: qt, resolveDefaultPalette: Kt, resolveTheme: At }, Symbol.toStringTag, { value: "Module" })), ai = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: z, TextmodeImage: W, TextmodeSource: Et, TextmodeTexture: Q, TextmodeVideo: ut }, Symbol.toStringTag, { value: "Module" })), li = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: je, mouse: Ge, touch: Ve }, 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
4221
  export {
4225
- He as TextmodeCanvas,
4222
+ ke as TextmodeCanvas,
4226
4223
  E as TextmodeColor,
4227
- P as TextmodeError,
4224
+ S as TextmodeError,
4228
4225
  ae as TextmodeErrorLevel,
4229
4226
  vt as TextmodeFramebuffer,
4230
- Ye as TextmodeGrid,
4231
- K as TextmodeShader,
4227
+ ze as TextmodeGrid,
4228
+ V as TextmodeShader,
4232
4229
  ii as Textmodifier,
4233
4230
  hi as conversion,
4234
4231
  ui as create,