textmode.js 0.9.1 → 0.9.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.
- package/dist/textmode.esm.js +952 -952
- package/dist/textmode.umd.js +13 -13
- package/package.json +1 -1
package/dist/textmode.esm.js
CHANGED
|
@@ -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
|
|
4
|
+
class P extends Error {
|
|
5
5
|
constructor(t, e) {
|
|
6
|
-
super(
|
|
6
|
+
super(P.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}: ${
|
|
12
|
+
- ${i}: ${P.h(s)}`).join("") : ""}
|
|
13
13
|
|
|
14
14
|
${"↓".repeat(24)}
|
|
15
15
|
`;
|
|
@@ -19,21 +19,21 @@ ${"↓".repeat(24)}
|
|
|
19
19
|
if (t === void 0) return "undefined";
|
|
20
20
|
if (typeof t == "string") return `"${t}"`;
|
|
21
21
|
if (typeof t == "number" || typeof t == "boolean") return t + "";
|
|
22
|
-
if (Array.isArray(t)) return t.length === 0 ? "[]" : t.length <= 5 ? `[${t.map((e) =>
|
|
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]`;
|
|
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}: ${
|
|
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 }`;
|
|
26
26
|
}
|
|
27
27
|
return t + "";
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
var ae = ((n) => (n[n.SILENT = 0] = "SILENT", n[n.WARNING = 1] = "WARNING", n[n.ERROR = 2] = "ERROR", n[n.THROW = 3] = "THROW", n))(ae || {});
|
|
31
|
-
const
|
|
31
|
+
const D = class D {
|
|
32
32
|
constructor() {
|
|
33
33
|
o(this, "l", { globalLevel: 3 });
|
|
34
34
|
}
|
|
35
35
|
static u() {
|
|
36
|
-
return
|
|
36
|
+
return D.o || (D.o = new D()), D.o;
|
|
37
37
|
}
|
|
38
38
|
v(t, e) {
|
|
39
39
|
const i = "%c[textmode.js] Oops! (╯°□°)╯︵ Something went wrong in your code.", s = "color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;";
|
|
@@ -41,11 +41,11 @@ const _ = class _ {
|
|
|
41
41
|
case 0:
|
|
42
42
|
return !1;
|
|
43
43
|
case 1:
|
|
44
|
-
return console.group(i, s), console.warn(
|
|
44
|
+
return console.group(i, s), console.warn(P.i(t, e)), console.groupEnd(), !1;
|
|
45
45
|
case 2:
|
|
46
|
-
return console.group(i, s), console.error(
|
|
46
|
+
return console.group(i, s), console.error(P.i(t, e)), console.groupEnd(), !1;
|
|
47
47
|
default:
|
|
48
|
-
throw new
|
|
48
|
+
throw new P(t, e);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
m(t, e, i) {
|
|
@@ -55,8 +55,8 @@ const _ = class _ {
|
|
|
55
55
|
this.l.globalLevel = t;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
o(
|
|
59
|
-
let pt =
|
|
58
|
+
o(D, "o", null);
|
|
59
|
+
let pt = D;
|
|
60
60
|
const yt = pt.u();
|
|
61
61
|
class at {
|
|
62
62
|
constructor() {
|
|
@@ -79,35 +79,35 @@ function et(n) {
|
|
|
79
79
|
function Rt(n, t, e, i) {
|
|
80
80
|
return et(Math.atan2(i - t, e - n));
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function $(n, t, e, i) {
|
|
83
83
|
return Math.hypot(e - n, i - t);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function _(n, t, e) {
|
|
86
86
|
return Math.min(Math.max(n, t), e);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function St(n) {
|
|
89
89
|
return (n % 360 + 360) % 360 / 360;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function Pt(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),
|
|
95
|
+
n.bindTexture(n.TEXTURE_2D, t), Pt(n, e), n.bindTexture(n.TEXTURE_2D, null);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function bt(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),
|
|
99
|
+
return n.bindTexture(n.TEXTURE_2D, h), Ot(n, e, i, s, r), Pt(n, t), n.bindTexture(n.TEXTURE_2D, null), h;
|
|
100
100
|
}
|
|
101
101
|
function Ot(n, t, e, i, s) {
|
|
102
102
|
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, t), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, e), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, i), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, s);
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function j(n, t, e, i, s, r = 0, h = WebGL2RenderingContext.FLOAT, a = !1) {
|
|
105
105
|
n.enableVertexAttribArray(t), n.vertexAttribPointer(t, e, h, a, i, s), n.vertexAttribDivisor(t, r);
|
|
106
106
|
}
|
|
107
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
|
|
110
|
+
function wt(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
|
}
|
|
@@ -125,7 +125,7 @@ class vt extends at {
|
|
|
125
125
|
o(this, "R");
|
|
126
126
|
o(this, "D", null);
|
|
127
127
|
o(this, "L", /* @__PURE__ */ new Map());
|
|
128
|
-
this.M = i, this.F = s, this.$ = e, this.k =
|
|
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 };
|
|
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
|
}
|
|
@@ -196,7 +196,7 @@ class vt extends at {
|
|
|
196
196
|
}
|
|
197
197
|
J() {
|
|
198
198
|
if (!this.R) return;
|
|
199
|
-
const e = this.k > 1, i = this.k > 2, s = this.k > 3, r = {
|
|
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
200
|
this.D = this.R.materialManager.st(h, r);
|
|
201
201
|
}
|
|
202
202
|
dispose() {
|
|
@@ -221,7 +221,7 @@ class vt extends at {
|
|
|
221
221
|
return this.k;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function I(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 || !!
|
|
234
|
+
return n instanceof Float32Array || n instanceof Int32Array || !!I(n) || typeof WebGLTexture < "u" && n instanceof WebGLTexture;
|
|
235
235
|
}
|
|
236
|
-
class
|
|
236
|
+
class K extends at {
|
|
237
237
|
constructor(e, i, s) {
|
|
238
238
|
super();
|
|
239
239
|
o(this, "$");
|
|
@@ -279,7 +279,7 @@ class j 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 ||
|
|
282
|
+
for (const [e, i] of this.nt) (i instanceof WebGLTexture || I(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 j 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 ||
|
|
293
|
-
typeof i == "number" || typeof i == "boolean" || i instanceof WebGLTexture ||
|
|
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);
|
|
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 j 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 (
|
|
301
|
+
if (I(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 j extends at {
|
|
|
371
371
|
this.$.deleteProgram(this.et), super.dispose();
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
|
-
const
|
|
374
|
+
const _t = /* @__PURE__ */ new WeakMap();
|
|
375
375
|
function ft(n, t) {
|
|
376
|
-
|
|
376
|
+
_t.set(n, t);
|
|
377
377
|
}
|
|
378
378
|
function Lt(n) {
|
|
379
|
-
return
|
|
379
|
+
return _t.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;
|
|
@@ -472,7 +472,7 @@ class lt {
|
|
|
472
472
|
this.Rt = t;
|
|
473
473
|
}
|
|
474
474
|
gs(t) {
|
|
475
|
-
this.Dt =
|
|
475
|
+
this.Dt = St(t);
|
|
476
476
|
}
|
|
477
477
|
_s(t, e, i, s) {
|
|
478
478
|
it(this.Lt, t, e, i, s);
|
|
@@ -543,16 +543,16 @@ class le {
|
|
|
543
543
|
Ts(t, e, i, s) {
|
|
544
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;
|
|
545
545
|
for (let d = 0; d < p.length; d += 4) {
|
|
546
|
-
const m = p[d], A = p[d + 1],
|
|
547
|
-
v[d] = R, v[d + 1] =
|
|
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;
|
|
548
548
|
}
|
|
549
|
-
r.bindBuffer(r.ARRAY_BUFFER, this.$s), r.bufferData(r.ARRAY_BUFFER, v, r.DYNAMIC_DRAW),
|
|
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
|
}
|
|
551
551
|
Ss() {
|
|
552
552
|
this.$.deleteBuffer(this.$s);
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
|
-
var
|
|
555
|
+
var x = ((n) => (n.RECTANGLE = "rectangle", n.LINE = "line", n.ELLIPSE = "ellipse", n.ARC = "arc", n.TRIANGLE = "triangle", n.BEZIER_CURVE = "bezier_curve", n))(x || {});
|
|
556
556
|
const ce = { rectangle: 2, line: 2, ellipse: 2, triangle: 2, arc: 3, bezier_curve: 4 };
|
|
557
557
|
class ue {
|
|
558
558
|
constructor(t) {
|
|
@@ -570,9 +570,9 @@ class ue {
|
|
|
570
570
|
else {
|
|
571
571
|
l = r.createVertexArray(), a.set(e, l), r.bindVertexArray(l), this.ks = l, r.bindBuffer(r.ARRAY_BUFFER, s);
|
|
572
572
|
const u = r.getAttribLocation(h, "A0");
|
|
573
|
-
u !== -1 &&
|
|
573
|
+
u !== -1 && j(r, u, i.Cs.Ms.size, i.ws, i.Cs.Ms.offset, 0, r.FLOAT, !1);
|
|
574
574
|
const c = r.getAttribLocation(h, "A1");
|
|
575
|
-
c !== -1 &&
|
|
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
578
|
Ds(t) {
|
|
@@ -703,7 +703,7 @@ class ge {
|
|
|
703
703
|
const s = this.ne(i);
|
|
704
704
|
for (const [r, h] of s) {
|
|
705
705
|
const a = nt.ATTRIBUTES[r];
|
|
706
|
-
a &&
|
|
706
|
+
a && j(e, h, a.size, a.stride, a.offset, a.divisor, a.type, a.normalized);
|
|
707
707
|
}
|
|
708
708
|
this.se.set(i, this.te);
|
|
709
709
|
}
|
|
@@ -759,7 +759,7 @@ class pe {
|
|
|
759
759
|
this.ae.Ss();
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
|
-
class
|
|
762
|
+
class z {
|
|
763
763
|
constructor(t, e, i, s) {
|
|
764
764
|
o(this, "$");
|
|
765
765
|
o(this, "Me");
|
|
@@ -821,60 +821,60 @@ let ye = { ke: function(n) {
|
|
|
821
821
|
}
|
|
822
822
|
return new Float32Array(t);
|
|
823
823
|
}(32), ze: 96, ...k };
|
|
824
|
-
const
|
|
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) {
|
|
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 },
|
|
831
|
+
}(16), ze: 96, ...k }, Ee = { [x.RECTANGLE]: class extends z {
|
|
832
832
|
constructor(n, t) {
|
|
833
|
-
super(n, t,
|
|
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
|
-
}, [
|
|
838
|
+
}, [x.LINE]: class extends z {
|
|
839
839
|
constructor(n, t) {
|
|
840
|
-
super(n, t,
|
|
840
|
+
super(n, t, x.LINE, me);
|
|
841
841
|
}
|
|
842
842
|
ce(n, t) {
|
|
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
|
-
}, [
|
|
846
|
+
}, [x.ELLIPSE]: class extends z {
|
|
847
847
|
constructor(n, t) {
|
|
848
|
-
super(n, t,
|
|
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
|
-
}, [
|
|
853
|
+
}, [x.ARC]: class extends z {
|
|
854
854
|
constructor(n, t) {
|
|
855
|
-
super(n, t,
|
|
855
|
+
super(n, t, x.ARC, ye);
|
|
856
856
|
}
|
|
857
857
|
ce(n, t) {
|
|
858
858
|
const e = N(n.start), i = N(n.stop);
|
|
859
859
|
return this.Oe(0, 0, n.width, n.height, t, { arcStart: e, arcStop: i });
|
|
860
860
|
}
|
|
861
|
-
}, [
|
|
861
|
+
}, [x.TRIANGLE]: class extends z {
|
|
862
862
|
constructor(n, t) {
|
|
863
|
-
super(n, t,
|
|
863
|
+
super(n, t, x.TRIANGLE, be);
|
|
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
|
-
}, [
|
|
869
|
+
}, [x.BEZIER_CURVE]: class extends z {
|
|
870
870
|
constructor(n, t) {
|
|
871
|
-
super(n, t,
|
|
871
|
+
super(n, t, x.BEZIER_CURVE, we);
|
|
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 });
|
|
875
875
|
}
|
|
876
876
|
} };
|
|
877
|
-
class
|
|
877
|
+
class xe {
|
|
878
878
|
constructor(t) {
|
|
879
879
|
o(this, "$");
|
|
880
880
|
o(this, "He");
|
|
@@ -883,8 +883,8 @@ class Ee {
|
|
|
883
883
|
o(this, "Ge", /* @__PURE__ */ new Map());
|
|
884
884
|
o(this, "je", null);
|
|
885
885
|
this.$ = t, this.Be = new ue(t), this.He = /* @__PURE__ */ new Map();
|
|
886
|
-
for (const e of Object.values(
|
|
887
|
-
const i = new pe(t), s = new
|
|
886
|
+
for (const e of Object.values(x)) {
|
|
887
|
+
const i = new pe(t), s = new Ee[e](t, i);
|
|
888
888
|
this.He.set(e, s);
|
|
889
889
|
}
|
|
890
890
|
}
|
|
@@ -911,7 +911,7 @@ class Ee {
|
|
|
911
911
|
this.He.clear(), this.Be.Ss();
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
|
-
function
|
|
914
|
+
function Dt(n) {
|
|
915
915
|
let t = 0;
|
|
916
916
|
for (let e = 0; e < n.length; e++)
|
|
917
917
|
t = (t << 5) - t + n.charCodeAt(e), t &= t;
|
|
@@ -919,13 +919,13 @@ function _t(n) {
|
|
|
919
919
|
}
|
|
920
920
|
const Tt = /* @__PURE__ */ new WeakMap();
|
|
921
921
|
let Re = 1;
|
|
922
|
-
function
|
|
922
|
+
function Mt(n) {
|
|
923
923
|
if (n == null) return 0;
|
|
924
|
-
if (typeof n != "object" && typeof n != "function") return
|
|
924
|
+
if (typeof n != "object" && typeof n != "function") return Dt(n + "");
|
|
925
925
|
let t = Tt.get(n);
|
|
926
926
|
return t || (t = Re++, Tt.set(n, t)), t;
|
|
927
927
|
}
|
|
928
|
-
function
|
|
928
|
+
function H(n, t) {
|
|
929
929
|
return (n << 5) - n + t;
|
|
930
930
|
}
|
|
931
931
|
const ht = `#version 300 es
|
|
@@ -937,9 +937,9 @@ class Te {
|
|
|
937
937
|
o(this, "Ke");
|
|
938
938
|
o(this, "We");
|
|
939
939
|
o(this, "Ze", /* @__PURE__ */ new Map());
|
|
940
|
-
this.Ye = new
|
|
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
|
|
942
|
-
precision highp float;in vec2 v_uv;uniform sampler2D
|
|
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 };
|
|
943
943
|
}
|
|
944
944
|
get Ve() {
|
|
945
945
|
return this.We;
|
|
@@ -951,13 +951,13 @@ precision highp float;in vec2 v_uv;uniform sampler2D Ub;uniform sampler2D Uc;uni
|
|
|
951
951
|
return { id: this.Xe++, shader: t, uniforms: Object.freeze({ ...e }), hash: 0, isBuiltIn: !1 };
|
|
952
952
|
}
|
|
953
953
|
qe(t, e) {
|
|
954
|
-
const i =
|
|
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 =
|
|
957
|
+
for (const u of l) a = H(a, Dt(u)), a = H(a, h(r[u]));
|
|
958
958
|
return a;
|
|
959
959
|
}(e, this.Je.bind(this));
|
|
960
|
-
return
|
|
960
|
+
return H(i, s);
|
|
961
961
|
}
|
|
962
962
|
Je(t) {
|
|
963
963
|
return typeof t == "number" || typeof t == "boolean" ? function(e) {
|
|
@@ -965,20 +965,20 @@ precision highp float;in vec2 v_uv;uniform sampler2D Ub;uniform sampler2D Uc;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 =
|
|
968
|
+
for (const r of s) i = H(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 =
|
|
973
|
+
for (let r = 0; r < s; r++) i = H(i, e[r]);
|
|
974
974
|
return i;
|
|
975
|
-
}(t) : t instanceof WebGLTexture ||
|
|
975
|
+
}(t) : t instanceof WebGLTexture || I(t) ? Mt(t) : 0;
|
|
976
976
|
}
|
|
977
977
|
Ss() {
|
|
978
978
|
this.Ye.dispose(), this.Ke.dispose(), this.Ze.clear();
|
|
979
979
|
}
|
|
980
980
|
}
|
|
981
|
-
class
|
|
981
|
+
class Me {
|
|
982
982
|
constructor() {
|
|
983
983
|
o(this, "ti", []);
|
|
984
984
|
o(this, "si", 1);
|
|
@@ -993,27 +993,27 @@ class Fe {
|
|
|
993
993
|
return i.id = this.si++, i.type = t, i.material = e, this.le++, i;
|
|
994
994
|
}
|
|
995
995
|
ii(t, e, i) {
|
|
996
|
-
const s = this.ei(
|
|
996
|
+
const s = this.ei(x.RECTANGLE, i), r = s.params;
|
|
997
997
|
return r.width = t.width, r.height = t.height, e.Zt(s.state), s.id;
|
|
998
998
|
}
|
|
999
999
|
ri(t, e, i) {
|
|
1000
|
-
const s = this.ei(
|
|
1000
|
+
const s = this.ei(x.LINE, i), r = s.params;
|
|
1001
1001
|
return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, e.Zt(s.state), s.id;
|
|
1002
1002
|
}
|
|
1003
1003
|
ni(t, e, i) {
|
|
1004
|
-
const s = this.ei(
|
|
1004
|
+
const s = this.ei(x.ELLIPSE, i), r = s.params;
|
|
1005
1005
|
return r.width = t.width, r.height = t.height, r.startAngle = t.startAngle, r.endAngle = t.endAngle, r.segments = t.segments, e.Zt(s.state), s.id;
|
|
1006
1006
|
}
|
|
1007
1007
|
hi(t, e, i) {
|
|
1008
|
-
const s = this.ei(
|
|
1008
|
+
const s = this.ei(x.ARC, i), r = s.params;
|
|
1009
1009
|
return r.width = t.width, r.height = t.height, r.start = t.start, r.stop = t.stop, e.Zt(s.state), s.id;
|
|
1010
1010
|
}
|
|
1011
1011
|
oi(t, e, i) {
|
|
1012
|
-
const s = this.ei(
|
|
1012
|
+
const s = this.ei(x.TRIANGLE, i), r = s.params;
|
|
1013
1013
|
return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.x3 = t.x3, r.y3 = t.y3, e.Zt(s.state), s.id;
|
|
1014
1014
|
}
|
|
1015
1015
|
ai(t, e, i) {
|
|
1016
|
-
const s = this.ei(
|
|
1016
|
+
const s = this.ei(x.BEZIER_CURVE, i), r = s.params;
|
|
1017
1017
|
return r.x1 = t.x1, r.y1 = t.y1, r.cp1x = t.cp1x, r.cp1y = t.cp1y, r.cp2x = t.cp2x, r.cp2y = t.cp2y, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, r.segments = t.segments, e.Zt(s.state), s.id;
|
|
1018
1018
|
}
|
|
1019
1019
|
xe() {
|
|
@@ -1025,7 +1025,7 @@ class Fe {
|
|
|
1025
1025
|
return { next: () => t < e ? { value: i[t++], done: !1 } : { value: void 0, done: !0 } };
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
1028
|
-
class
|
|
1028
|
+
class Fe {
|
|
1029
1029
|
constructor(t) {
|
|
1030
1030
|
o(this, "$");
|
|
1031
1031
|
o(this, "Ie", null);
|
|
@@ -1043,7 +1043,7 @@ class Me {
|
|
|
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
|
|
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);
|
|
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 Me {
|
|
|
1064
1064
|
this.Ie !== t && (this.Ie = t, t.dt());
|
|
1065
1065
|
}
|
|
1066
1066
|
Mi(t, e) {
|
|
1067
|
-
return new
|
|
1067
|
+
return new K(this.$, t, e);
|
|
1068
1068
|
}
|
|
1069
1069
|
Fi(t) {
|
|
1070
1070
|
this.pi = t, t && (this.gi = {});
|
|
@@ -1079,7 +1079,7 @@ class Me {
|
|
|
1079
1079
|
Object.assign(this.gi, t);
|
|
1080
1080
|
}
|
|
1081
1081
|
Pi(t) {
|
|
1082
|
-
return new
|
|
1082
|
+
return new K(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());
|
|
@@ -1147,13 +1147,13 @@ class Me {
|
|
|
1147
1147
|
return this.li;
|
|
1148
1148
|
}
|
|
1149
1149
|
}
|
|
1150
|
-
const
|
|
1150
|
+
const M = { readShort: (n, t) => (M.t.uint16[0] = n[t] << 8 | n[t + 1], M.t.int16[0]), readUshort: (n, t) => n[t] << 8 | n[t + 1], readUshorts(n, t, e) {
|
|
1151
1151
|
const i = [];
|
|
1152
|
-
for (let s = 0; s < e; s++) i.push(
|
|
1152
|
+
for (let s = 0; s < e; s++) i.push(M.readUshort(n, t + 2 * s));
|
|
1153
1153
|
return i;
|
|
1154
1154
|
}, readUint(n, t) {
|
|
1155
|
-
const e =
|
|
1156
|
-
return e[3] = n[t], e[2] = n[t + 1], e[1] = n[t + 2], e[0] = n[t + 3],
|
|
1155
|
+
const e = M.t.uint8;
|
|
1156
|
+
return e[3] = n[t], e[2] = n[t + 1], e[1] = n[t + 2], e[0] = n[t + 3], M.t.uint32[0];
|
|
1157
1157
|
}, readASCII(n, t, e) {
|
|
1158
1158
|
let i = "";
|
|
1159
1159
|
for (let s = 0; s < e; s++) i += String.fromCharCode(n[t + s]);
|
|
@@ -1162,7 +1162,7 @@ const F = { readShort: (n, t) => (F.t.uint16[0] = n[t] << 8 | n[t + 1], F.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
|
|
1165
|
+
function q(n) {
|
|
1166
1166
|
return n + 3 & -4;
|
|
1167
1167
|
}
|
|
1168
1168
|
function J(n, t, e) {
|
|
@@ -1177,11 +1177,11 @@ function Ce(n, t, e) {
|
|
|
1177
1177
|
function dt(n, t, e) {
|
|
1178
1178
|
const i = t + e;
|
|
1179
1179
|
let s = 0;
|
|
1180
|
-
const r =
|
|
1180
|
+
const r = M.t;
|
|
1181
1181
|
for (let h = t; h < i; h += 4) r.uint8[3] = n[h] || 0, r.uint8[2] = n[h + 1] || 0, r.uint8[1] = n[h + 2] || 0, r.uint8[0] = n[h + 3] || 0, s = s + (r.uint32[0] >>> 0) >>> 0;
|
|
1182
1182
|
return s >>> 0;
|
|
1183
1183
|
}
|
|
1184
|
-
class
|
|
1184
|
+
class Se {
|
|
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[
|
|
1223
|
+
c || (c = [], h.set(l, c)), c[Pe(u, l)] = a;
|
|
1224
1224
|
}
|
|
1225
1225
|
return { min: t, max: e, table: h };
|
|
1226
1226
|
}
|
|
@@ -1236,7 +1236,7 @@ function gt(n, t) {
|
|
|
1236
1236
|
}
|
|
1237
1237
|
throw Error("Invalid Huffman code");
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1239
|
+
function Pe(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;
|
|
@@ -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,
|
|
1276
|
-
for (let T = 0; T < A; T++) y[
|
|
1277
|
-
const R = G(y),
|
|
1278
|
-
for (;
|
|
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
1279
|
const T = gt(r, R);
|
|
1280
|
-
if (T <= 15)
|
|
1280
|
+
if (T <= 15) w.push(T);
|
|
1281
1281
|
else if (T === 16) {
|
|
1282
|
-
const U = r.readBits(2) + 3, C =
|
|
1283
|
-
for (let
|
|
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
1284
|
} else if (T === 17) {
|
|
1285
1285
|
const U = r.readBits(3) + 3;
|
|
1286
|
-
for (let C = 0; C < U; C++)
|
|
1286
|
+
for (let C = 0; C < U; C++) w.push(0);
|
|
1287
1287
|
} else {
|
|
1288
1288
|
if (T !== 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++)
|
|
1291
|
+
for (let C = 0; C < U; C++) w.push(0);
|
|
1292
1292
|
}
|
|
1293
1293
|
}
|
|
1294
1294
|
}
|
|
1295
|
-
const
|
|
1296
|
-
p = G(
|
|
1295
|
+
const F = w.slice(0, d), S = w.slice(d, d + m);
|
|
1296
|
+
p = G(F), v = G(S);
|
|
1297
1297
|
}
|
|
1298
1298
|
for (; ; ) {
|
|
1299
1299
|
const d = gt(r, p);
|
|
@@ -1303,37 +1303,37 @@ function Oe(n) {
|
|
|
1303
1303
|
if (d > 256 && d < 286) {
|
|
1304
1304
|
const m = d - 257;
|
|
1305
1305
|
let A = a[m];
|
|
1306
|
-
const
|
|
1307
|
-
|
|
1306
|
+
const b = l[m];
|
|
1307
|
+
b && (A += r.readBits(b));
|
|
1308
1308
|
const y = gt(r, v);
|
|
1309
1309
|
if (y >= 30) throw Error("Invalid distance symbol");
|
|
1310
1310
|
let R = u[y];
|
|
1311
|
-
const
|
|
1312
|
-
|
|
1313
|
-
const
|
|
1314
|
-
if (
|
|
1315
|
-
for (let
|
|
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);
|
|
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
|
|
1322
|
+
}(new Se(n.subarray(i)), s), new Uint8Array(s);
|
|
1323
1323
|
}
|
|
1324
1324
|
function Xe(n) {
|
|
1325
|
-
const t =
|
|
1325
|
+
const t = M, e = new Uint8Array(n);
|
|
1326
1326
|
if (t.readASCII(e, 0, 4) !== "wOFF") throw Error("Invalid WOFF signature");
|
|
1327
1327
|
const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), h = [];
|
|
1328
1328
|
let a = 44;
|
|
1329
1329
|
for (let A = 0; A < s; A++) {
|
|
1330
|
-
const
|
|
1331
|
-
h.push({ tag:
|
|
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;
|
|
1332
1332
|
}
|
|
1333
1333
|
for (const A of h) {
|
|
1334
|
-
const
|
|
1335
|
-
if (A.compLength === A.origLength) A.data = new Uint8Array(
|
|
1336
|
-
else if (A.data = Oe(
|
|
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) {
|
|
1337
1337
|
const y = new Uint8Array(A.origLength);
|
|
1338
1338
|
y.set(A.data), A.data = y;
|
|
1339
1339
|
} else A.data = A.data.subarray(0, A.origLength);
|
|
@@ -1344,39 +1344,39 @@ function Xe(n) {
|
|
|
1344
1344
|
const f = 16 * u, g = 16 * l - f;
|
|
1345
1345
|
let p = 12 + 16 * l;
|
|
1346
1346
|
const v = {};
|
|
1347
|
-
for (const A of h) v[A.tag] = p, p =
|
|
1347
|
+
for (const A of h) v[A.tag] = p, p = q(p + A.data.length);
|
|
1348
1348
|
const d = new Uint8Array(Math.max(r || 0, p));
|
|
1349
1349
|
L(d, 0, i), J(d, 4, l), J(d, 6, f), J(d, 8, c), J(d, 10, g);
|
|
1350
1350
|
let m = 12;
|
|
1351
1351
|
for (const A of h) {
|
|
1352
1352
|
Ce(d, m, A.tag), m += 4;
|
|
1353
|
-
const
|
|
1354
|
-
if (A.tag === "head" &&
|
|
1355
|
-
const y = new Uint8Array(
|
|
1356
|
-
L(y, 8, 0), L(d, m, dt(y, 0,
|
|
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;
|
|
1357
1357
|
} else
|
|
1358
|
-
L(d, m, dt(
|
|
1358
|
+
L(d, m, dt(b, 0, q(b.length))), m += 4;
|
|
1359
1359
|
L(d, m, v[A.tag]), m += 4, L(d, m, A.data.length), m += 4;
|
|
1360
1360
|
}
|
|
1361
1361
|
for (const A of h) {
|
|
1362
|
-
const
|
|
1363
|
-
d.set(A.data,
|
|
1362
|
+
const b = v[A.tag];
|
|
1363
|
+
d.set(A.data, b);
|
|
1364
1364
|
}
|
|
1365
1365
|
if (h.find((A) => A.tag === "head")) {
|
|
1366
|
-
const A = v.head,
|
|
1367
|
-
const
|
|
1368
|
-
L(y,
|
|
1369
|
-
const
|
|
1370
|
-
return y[
|
|
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;
|
|
1371
1371
|
}(d, A);
|
|
1372
|
-
L(d, A + 8,
|
|
1372
|
+
L(d, A + 8, b);
|
|
1373
1373
|
}
|
|
1374
1374
|
return d.buffer;
|
|
1375
1375
|
}
|
|
1376
1376
|
const Ue = { parseTab(n, t, e) {
|
|
1377
1377
|
const i = { tables: [], ids: {}, off: t };
|
|
1378
1378
|
n = new Uint8Array(n.buffer, t, e), t = 0;
|
|
1379
|
-
const s =
|
|
1379
|
+
const s = M, r = s.readUshort;
|
|
1380
1380
|
r(n, t);
|
|
1381
1381
|
const h = r(n, t += 2);
|
|
1382
1382
|
t += 2;
|
|
@@ -1398,22 +1398,22 @@ const Ue = { parseTab(n, t, e) {
|
|
|
1398
1398
|
}
|
|
1399
1399
|
return i;
|
|
1400
1400
|
}, parse4(n, t) {
|
|
1401
|
-
const e =
|
|
1401
|
+
const e = M, i = e.readUshort, s = e.readUshorts, r = t, h = i(n, t += 2);
|
|
1402
1402
|
i(n, t += 2);
|
|
1403
1403
|
const a = i(n, t += 2) >>> 1, l = { format: 4, searchRange: i(n, t += 2), entrySelector: 0, rangeShift: 0, endCount: [], startCount: [], idDelta: [], idRangeOffset: [], glyphIdArray: [] };
|
|
1404
1404
|
t += 2, l.entrySelector = i(n, t), t += 2, l.rangeShift = i(n, t), t += 2, l.endCount = s(n, t, a), t += 2 * a, t += 2, l.startCount = s(n, t, a), t += 2 * a;
|
|
1405
1405
|
for (let u = 0; u < a; u++) l.idDelta.push(e.readShort(n, t)), t += 2;
|
|
1406
1406
|
return l.idRangeOffset = s(n, t, a), t += 2 * a, l.glyphIdArray = s(n, t, r + h - t >> 1), l;
|
|
1407
1407
|
}, parse12(n, t) {
|
|
1408
|
-
const e =
|
|
1408
|
+
const e = M.readUint;
|
|
1409
1409
|
e(n, t += 4), e(n, t += 4);
|
|
1410
1410
|
const i = e(n, t += 4);
|
|
1411
1411
|
t += 4;
|
|
1412
1412
|
const s = new Uint32Array(3 * i);
|
|
1413
1413
|
for (let r = 0; r < 3 * i; r += 3) s[r] = e(n, t + (r << 2)), s[r + 1] = e(n, t + (r << 2) + 4), s[r + 2] = e(n, t + (r << 2) + 8);
|
|
1414
1414
|
return { format: 12, groups: s };
|
|
1415
|
-
} },
|
|
1416
|
-
const i =
|
|
1415
|
+
} }, _e = { parseTab(n, t, e) {
|
|
1416
|
+
const i = M;
|
|
1417
1417
|
t += 18;
|
|
1418
1418
|
const s = i.readUshort(n, t);
|
|
1419
1419
|
t += 2, t += 16;
|
|
@@ -1426,21 +1426,21 @@ const Ue = { parseTab(n, t, e) {
|
|
|
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
1428
|
} }, Le = { parseTab(n, t, e) {
|
|
1429
|
-
const i =
|
|
1429
|
+
const i = M;
|
|
1430
1430
|
t += 4;
|
|
1431
1431
|
const s = i.readShort, r = i.readUshort;
|
|
1432
1432
|
return { ascender: s(n, t), descender: s(n, t + 2), lineGap: s(n, t + 4), advanceWidthMax: r(n, t + 6), minLeftSideBearing: s(n, t + 8), minRightSideBearing: s(n, t + 10), xMaxExtent: s(n, t + 12), caretSlopeRise: s(n, t + 14), caretSlopeRun: s(n, t + 16), caretOffset: s(n, t + 18), res0: s(n, t + 20), res1: s(n, t + 22), res2: s(n, t + 24), res3: s(n, t + 26), metricDataFormat: s(n, t + 28), numberOfHMetrics: r(n, t + 30) };
|
|
1433
|
-
} },
|
|
1434
|
-
const s =
|
|
1433
|
+
} }, De = { parseTab(n, t, e, i) {
|
|
1434
|
+
const s = M, r = [], h = [], a = i.maxp.numGlyphs, l = i.hhea.numberOfHMetrics;
|
|
1435
1435
|
let u = 0, c = 0, f = 0;
|
|
1436
1436
|
for (; f < l; ) u = s.readUshort(n, t + (f << 2)), c = s.readShort(n, t + (f << 2) + 2), r.push(u), h.push(c), f++;
|
|
1437
1437
|
for (; f < a; ) r.push(u), h.push(c), f++;
|
|
1438
1438
|
return { aWidth: r, lsBearing: h };
|
|
1439
|
-
} },
|
|
1440
|
-
const i =
|
|
1439
|
+
} }, Ft = { cmap: Ue, head: _e, hhea: Le, maxp: { parseTab(n, t, e) {
|
|
1440
|
+
const i = M;
|
|
1441
1441
|
return i.readUint(n, t), t += 4, { numGlyphs: i.readUshort(n, t) };
|
|
1442
|
-
} }, hmtx:
|
|
1443
|
-
const s =
|
|
1442
|
+
} }, hmtx: De, loca: { parseTab(n, t, e, i) {
|
|
1443
|
+
const s = M, r = [], h = i.head.indexToLocFormat, a = i.maxp.numGlyphs + 1;
|
|
1444
1444
|
if (h === 0) for (let l = 0; l < a; l++) r.push(s.readUshort(n, t + (l << 1)) << 1);
|
|
1445
1445
|
else if (h === 1) for (let l = 0; l < a; l++) r.push(s.readUint(n, t + (l << 2)));
|
|
1446
1446
|
return r;
|
|
@@ -1449,7 +1449,7 @@ const Ue = { parseTab(n, t, e) {
|
|
|
1449
1449
|
for (let h = 0; h < r; h++) s.push(null);
|
|
1450
1450
|
return s;
|
|
1451
1451
|
}, ji(n, t) {
|
|
1452
|
-
const e =
|
|
1452
|
+
const e = M, i = n.Qi, s = n.loca;
|
|
1453
1453
|
if (s[t] === s[t + 1]) return null;
|
|
1454
1454
|
const r = ct.findTable(i, "glyf", n.Ni);
|
|
1455
1455
|
if (!r) return null;
|
|
@@ -1488,8 +1488,8 @@ const Ue = { parseTab(n, t, e) {
|
|
|
1488
1488
|
return a;
|
|
1489
1489
|
} } }, ct = { parse(n) {
|
|
1490
1490
|
const t = new Uint8Array(n);
|
|
1491
|
-
|
|
1492
|
-
const e = new Uint8Array(n), i =
|
|
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 };
|
|
1493
1493
|
for (const h in i) {
|
|
1494
1494
|
const a = h, l = ct.findTable(e, a, 0);
|
|
1495
1495
|
if (l) {
|
|
@@ -1500,7 +1500,7 @@ const Ue = { parseTab(n, t, e) {
|
|
|
1500
1500
|
}
|
|
1501
1501
|
return [r];
|
|
1502
1502
|
}, findTable(n, t, e) {
|
|
1503
|
-
const i =
|
|
1503
|
+
const i = M, s = i.readUshort(n, e + 4);
|
|
1504
1504
|
let r = e + 12;
|
|
1505
1505
|
for (let h = 0; h < s; h++) {
|
|
1506
1506
|
const a = i.readASCII(n, r, 4);
|
|
@@ -1510,7 +1510,7 @@ const Ue = { parseTab(n, t, e) {
|
|
|
1510
1510
|
r += 16;
|
|
1511
1511
|
}
|
|
1512
1512
|
return null;
|
|
1513
|
-
}, T:
|
|
1513
|
+
}, T: Ft, 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,7 +1564,7 @@ class Be {
|
|
|
1564
1564
|
}
|
|
1565
1565
|
}
|
|
1566
1566
|
}
|
|
1567
|
-
class
|
|
1567
|
+
class ze {
|
|
1568
1568
|
constructor(t) {
|
|
1569
1569
|
o(this, "qi");
|
|
1570
1570
|
o(this, "Vi");
|
|
@@ -1588,8 +1588,8 @@ class Ie {
|
|
|
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),
|
|
1592
|
-
this.rr(c,
|
|
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);
|
|
1593
1593
|
}
|
|
1594
1594
|
}
|
|
1595
1595
|
rr(t, e, i, s) {
|
|
@@ -1612,21 +1612,21 @@ class Ie {
|
|
|
1612
1612
|
} else {
|
|
1613
1613
|
const d = e + r[v] * s, m = i - h[v] * s;
|
|
1614
1614
|
if (v + 1 > f) {
|
|
1615
|
-
const
|
|
1616
|
-
if (1 & l[u]) this.Vi.quadraticCurveTo(d, m,
|
|
1615
|
+
const b = e + r[u] * s, y = i - h[u] * s;
|
|
1616
|
+
if (1 & l[u]) this.Vi.quadraticCurveTo(d, m, b, y);
|
|
1617
1617
|
else {
|
|
1618
|
-
const R = (d +
|
|
1619
|
-
this.Vi.quadraticCurveTo(d, m, R,
|
|
1618
|
+
const R = (d + b) / 2, w = (m + y) / 2;
|
|
1619
|
+
this.Vi.quadraticCurveTo(d, m, R, w);
|
|
1620
1620
|
}
|
|
1621
1621
|
break;
|
|
1622
1622
|
}
|
|
1623
1623
|
const A = v + 1;
|
|
1624
1624
|
if (1 & l[A]) {
|
|
1625
|
-
const
|
|
1626
|
-
this.Vi.quadraticCurveTo(d, m,
|
|
1625
|
+
const b = e + r[A] * s, y = i - h[A] * s;
|
|
1626
|
+
this.Vi.quadraticCurveTo(d, m, b, y), v = A + 1;
|
|
1627
1627
|
} else {
|
|
1628
|
-
const
|
|
1629
|
-
this.Vi.quadraticCurveTo(d, m,
|
|
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;
|
|
1630
1630
|
}
|
|
1631
1631
|
}
|
|
1632
1632
|
this.Vi.closePath();
|
|
@@ -1650,7 +1650,7 @@ class Ie {
|
|
|
1650
1650
|
return this.tr;
|
|
1651
1651
|
}
|
|
1652
1652
|
}
|
|
1653
|
-
class
|
|
1653
|
+
class zt {
|
|
1654
1654
|
nr(t, e) {
|
|
1655
1655
|
const i = t.cmap;
|
|
1656
1656
|
if (!i || !i.tables) return 0;
|
|
@@ -1688,10 +1688,10 @@ class It {
|
|
|
1688
1688
|
return 0;
|
|
1689
1689
|
}
|
|
1690
1690
|
}
|
|
1691
|
-
class
|
|
1691
|
+
class Ie {
|
|
1692
1692
|
constructor() {
|
|
1693
1693
|
o(this, "dr");
|
|
1694
|
-
this.dr = new
|
|
1694
|
+
this.dr = new zt();
|
|
1695
1695
|
}
|
|
1696
1696
|
pr(t, e, i) {
|
|
1697
1697
|
let s = 0;
|
|
@@ -1708,7 +1708,7 @@ class He {
|
|
|
1708
1708
|
class Ne {
|
|
1709
1709
|
constructor() {
|
|
1710
1710
|
o(this, "vr");
|
|
1711
|
-
this.vr = new
|
|
1711
|
+
this.vr = new zt();
|
|
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
|
|
1730
|
+
class Y extends at {
|
|
1731
1731
|
constructor(e, i = 16) {
|
|
1732
1732
|
super();
|
|
1733
1733
|
o(this, "yr");
|
|
@@ -1741,7 +1741,7 @@ class z 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
|
|
1744
|
+
this.br = i, this.Fr = new Be(), this.$r = new ze(e), this.Pr = new Ie(), this.Tr = new Ne();
|
|
1745
1745
|
}
|
|
1746
1746
|
async Er(e) {
|
|
1747
1747
|
if (this.Sr) return;
|
|
@@ -1761,12 +1761,12 @@ class z extends at {
|
|
|
1761
1761
|
const i = await this.kr(e);
|
|
1762
1762
|
await this.Rr(i);
|
|
1763
1763
|
} catch (i) {
|
|
1764
|
-
throw new
|
|
1764
|
+
throw new P("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
|
|
1769
|
+
if (!i.ok) throw new P(`Failed to load font file: ${i.status} ${i.statusText}`);
|
|
1770
1770
|
return i.arrayBuffer();
|
|
1771
1771
|
}
|
|
1772
1772
|
async Rr(e) {
|
|
@@ -1825,7 +1825,7 @@ class z extends at {
|
|
|
1825
1825
|
return this.yr;
|
|
1826
1826
|
}
|
|
1827
1827
|
}
|
|
1828
|
-
class
|
|
1828
|
+
class Ye {
|
|
1829
1829
|
constructor(t, e, i) {
|
|
1830
1830
|
o(this, "jr");
|
|
1831
1831
|
o(this, "tr");
|
|
@@ -1901,9 +1901,9 @@ function tt(n) {
|
|
|
1901
1901
|
}
|
|
1902
1902
|
const ke = /^rgba?\(([^)]+)\)$/i;
|
|
1903
1903
|
function B(n) {
|
|
1904
|
-
return Number.isNaN(n = Math.round(n)) ? 0 :
|
|
1904
|
+
return Number.isNaN(n = Math.round(n)) ? 0 : _(n, 0, 255);
|
|
1905
1905
|
}
|
|
1906
|
-
function
|
|
1906
|
+
function It(n, t = !1) {
|
|
1907
1907
|
if (!n) return null;
|
|
1908
1908
|
const e = n.trim().toLowerCase();
|
|
1909
1909
|
if (!e) return null;
|
|
@@ -1918,12 +1918,12 @@ function Ht(n, t = !1) {
|
|
|
1918
1918
|
if (h[3] !== void 0) {
|
|
1919
1919
|
const f = h[3].trim();
|
|
1920
1920
|
let g = parseFloat(f);
|
|
1921
|
-
f.endsWith("%") && (g /= 100), c = 255 *
|
|
1921
|
+
f.endsWith("%") && (g /= 100), c = 255 * _(g, 0, 1);
|
|
1922
1922
|
}
|
|
1923
1923
|
return [a, l, u, Math.round(c)];
|
|
1924
1924
|
}(e)), i && (t || i[3] !== 0) ? i : null;
|
|
1925
1925
|
}
|
|
1926
|
-
class
|
|
1926
|
+
class He {
|
|
1927
1927
|
constructor(t = {}) {
|
|
1928
1928
|
o(this, "Xr");
|
|
1929
1929
|
o(this, "en", null);
|
|
@@ -1935,7 +1935,7 @@ class Ye {
|
|
|
1935
1935
|
if (this.rn = t.overlay ?? !1, t.gl) this.hn = t.gl, this.Xr = t.gl.canvas, this.nn = !1, this.an = !1;
|
|
1936
1936
|
else if (this.rn && t.canvas) this.en = t.canvas, this.Xr = this.cn(), this.nn = !0, this.ln();
|
|
1937
1937
|
else if (t.canvas) {
|
|
1938
|
-
if (t.canvas instanceof HTMLVideoElement) throw new
|
|
1938
|
+
if (t.canvas instanceof HTMLVideoElement) throw new P("Video elements are only supported in overlay mode.");
|
|
1939
1939
|
this.Xr = t.canvas, this.nn = !1;
|
|
1940
1940
|
} else this.Xr = this.un(t.width, t.height), this.nn = !0;
|
|
1941
1941
|
this.Xr.style.imageRendering = "pixelated";
|
|
@@ -1970,7 +1970,7 @@ class Ye {
|
|
|
1970
1970
|
const t = this.dn();
|
|
1971
1971
|
for (const e of t) {
|
|
1972
1972
|
if (!e) continue;
|
|
1973
|
-
const i =
|
|
1973
|
+
const i = It(window.getComputedStyle(e).backgroundColor);
|
|
1974
1974
|
if (i) return i;
|
|
1975
1975
|
}
|
|
1976
1976
|
return [255, 255, 255, 255];
|
|
@@ -1993,7 +1993,7 @@ class Ye {
|
|
|
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
|
|
1996
|
+
if (!t) throw new P("`textmode.js` requires WebGL2 support.");
|
|
1997
1997
|
return this.$ = t, t;
|
|
1998
1998
|
}
|
|
1999
1999
|
Ss() {
|
|
@@ -2021,7 +2021,7 @@ class Ye {
|
|
|
2021
2021
|
return this.an;
|
|
2022
2022
|
}
|
|
2023
2023
|
}
|
|
2024
|
-
class
|
|
2024
|
+
class E {
|
|
2025
2025
|
constructor(t, e, i, s) {
|
|
2026
2026
|
o(this, "mn");
|
|
2027
2027
|
o(this, "_n");
|
|
@@ -2032,29 +2032,29 @@ class x {
|
|
|
2032
2032
|
this.r = B(t), this.g = B(e), this.b = B(i), this.a = B(s);
|
|
2033
2033
|
}
|
|
2034
2034
|
static yn(t, e, i, s) {
|
|
2035
|
-
if (
|
|
2035
|
+
if (E.An(t)) return t;
|
|
2036
2036
|
if (Array.isArray(t)) {
|
|
2037
2037
|
if (t.length < 3) throw Error("Component tuples must include at least RGB values.");
|
|
2038
2038
|
const [r, h, a] = t, l = t.length === 4 ? t[3] : 255;
|
|
2039
|
-
return
|
|
2039
|
+
return E.wn(r, h, a, l);
|
|
2040
2040
|
}
|
|
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 =
|
|
2045
|
-
return h ?
|
|
2044
|
+
const h = It(r, !0);
|
|
2045
|
+
return h ? E.wn(...h) : E.bn(r);
|
|
2046
2046
|
}
|
|
2047
|
-
if (typeof t == "number") return typeof e == "number" && typeof i == "number" ?
|
|
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);
|
|
2048
2048
|
throw Error("Unsupported color input passed to TextmodeColor.$from.");
|
|
2049
2049
|
}
|
|
2050
2050
|
static wn(t, e, i, s = 255) {
|
|
2051
|
-
return new
|
|
2051
|
+
return new E(t, e, i, s);
|
|
2052
2052
|
}
|
|
2053
2053
|
static Cn(t, e = 255) {
|
|
2054
|
-
return new
|
|
2054
|
+
return new E(t, t, t, e);
|
|
2055
2055
|
}
|
|
2056
2056
|
static bn(t) {
|
|
2057
|
-
return new
|
|
2057
|
+
return new E(...function(e) {
|
|
2058
2058
|
const i = e.trim().replace(/^#|0x/gi, "");
|
|
2059
2059
|
if (!/^[0-9A-Fa-f]+$/.test(i)) throw Error("Invalid hex color: " + e);
|
|
2060
2060
|
const s = (r = i).length === 3 || r.length === 4 ? r.split("").map((h) => h + h).join("") : r;
|
|
@@ -2064,7 +2064,7 @@ class x {
|
|
|
2064
2064
|
}(t));
|
|
2065
2065
|
}
|
|
2066
2066
|
static xn(t, e, i, s) {
|
|
2067
|
-
return new
|
|
2067
|
+
return new E(Math.round(255 * t), Math.round(255 * e), Math.round(255 * i), Math.round(255 * s));
|
|
2068
2068
|
}
|
|
2069
2069
|
get rgb() {
|
|
2070
2070
|
return [this.r, this.g, this.b];
|
|
@@ -2076,13 +2076,13 @@ class x {
|
|
|
2076
2076
|
return this._n || (this._n = [this.r / 255, this.g / 255, this.b / 255, this.a / 255]), [...this._n];
|
|
2077
2077
|
}
|
|
2078
2078
|
withAlpha(t) {
|
|
2079
|
-
return new
|
|
2079
|
+
return new E(this.r, this.g, this.b, t);
|
|
2080
2080
|
}
|
|
2081
2081
|
static An(t) {
|
|
2082
|
-
return t instanceof
|
|
2082
|
+
return t instanceof E;
|
|
2083
2083
|
}
|
|
2084
2084
|
}
|
|
2085
|
-
class
|
|
2085
|
+
class Et extends at {
|
|
2086
2086
|
constructor(e, i, s, r, h, a, l, u) {
|
|
2087
2087
|
super();
|
|
2088
2088
|
o(this, "$");
|
|
@@ -2131,7 +2131,7 @@ class xt extends at {
|
|
|
2131
2131
|
return this.jt = e ? 1 : 0, this.D = null, this;
|
|
2132
2132
|
}
|
|
2133
2133
|
charRotation(e) {
|
|
2134
|
-
return this.Dt =
|
|
2134
|
+
return this.Dt = St(e), this.D = null, this;
|
|
2135
2135
|
}
|
|
2136
2136
|
charColorMode(e) {
|
|
2137
2137
|
return this.kn = e, this.D = null, this;
|
|
@@ -2183,7 +2183,7 @@ class xt extends at {
|
|
|
2183
2183
|
this.D = this.R.materialManager.st(s, r);
|
|
2184
2184
|
}
|
|
2185
2185
|
On(e, i, s, r, h) {
|
|
2186
|
-
const a =
|
|
2186
|
+
const a = E.yn(i, s, r, h);
|
|
2187
2187
|
it(e, a.r, a.g, a.b, a.a);
|
|
2188
2188
|
}
|
|
2189
2189
|
zn(e) {
|
|
@@ -2205,12 +2205,12 @@ class xt extends at {
|
|
|
2205
2205
|
return { renderer: this.R, gl: this.$, font: this.Pn, source: this };
|
|
2206
2206
|
}
|
|
2207
2207
|
}
|
|
2208
|
-
class V extends
|
|
2208
|
+
class V 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 =
|
|
2213
|
+
const h = t.context, a = bt(h, i), { width: l, height: u } = wt(i);
|
|
2214
2214
|
return new V(h, t, a, e, l, u, s, r);
|
|
2215
2215
|
}
|
|
2216
2216
|
}
|
|
@@ -2300,7 +2300,7 @@ class Nt {
|
|
|
2300
2300
|
return this.sh;
|
|
2301
2301
|
}
|
|
2302
2302
|
}
|
|
2303
|
-
function
|
|
2303
|
+
function Yt(n, t, e) {
|
|
2304
2304
|
return n ? n.sn(t, e) : { x: -1 / 0, y: -1 / 0 };
|
|
2305
2305
|
}
|
|
2306
2306
|
class kt {
|
|
@@ -2316,58 +2316,61 @@ class kt {
|
|
|
2316
2316
|
o(this, "Ph");
|
|
2317
2317
|
o(this, "Th");
|
|
2318
2318
|
o(this, "Sh");
|
|
2319
|
-
o(this, "
|
|
2320
|
-
o(this, "
|
|
2319
|
+
o(this, "Uh");
|
|
2320
|
+
o(this, "Eh", !1);
|
|
2321
|
+
o(this, "kh");
|
|
2321
2322
|
o(this, "Rh");
|
|
2322
2323
|
o(this, "Dh");
|
|
2323
2324
|
o(this, "Lh");
|
|
2324
2325
|
o(this, "Oh");
|
|
2325
|
-
o(this, "zh");
|
|
2326
2326
|
this.Xr = t, this.wh = e;
|
|
2327
2327
|
}
|
|
2328
|
-
|
|
2328
|
+
zh(t) {
|
|
2329
2329
|
const e = performance.now() + Math.max(0, t);
|
|
2330
2330
|
e > this.Mh && (this.Mh = e);
|
|
2331
2331
|
}
|
|
2332
|
-
|
|
2332
|
+
Hh() {
|
|
2333
2333
|
return performance.now() < this.Mh;
|
|
2334
2334
|
}
|
|
2335
|
-
|
|
2335
|
+
Bh(t) {
|
|
2336
2336
|
const e = this.Xr.canvas;
|
|
2337
2337
|
e.style.cursor = t == null || t === "" ? "" : t;
|
|
2338
2338
|
}
|
|
2339
|
-
|
|
2340
|
-
if (this.
|
|
2339
|
+
Ih() {
|
|
2340
|
+
if (this.Eh) return;
|
|
2341
2341
|
const t = this.Xr.canvas;
|
|
2342
2342
|
this.Fh = (e) => {
|
|
2343
|
-
this.
|
|
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;
|
|
2346
2346
|
}, this.Ph = (e) => {
|
|
2347
|
-
this.
|
|
2347
|
+
this.Gh(e), this.Qh(e);
|
|
2348
2348
|
}, this.Th = (e) => {
|
|
2349
|
-
this.
|
|
2349
|
+
this.Gh(e), this.Nh(e);
|
|
2350
2350
|
}, this.Sh = (e) => {
|
|
2351
|
-
this.
|
|
2352
|
-
}, this.
|
|
2353
|
-
this.
|
|
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.
|
|
2351
|
+
this.Gh(e), this.Xh(e);
|
|
2352
|
+
}, this.Uh = (e) => {
|
|
2353
|
+
this.Gh(e), this.Yh(e);
|
|
2354
|
+
}, t.addEventListener("mousemove", this.Fh, { passive: !0 }), t.addEventListener("mouseleave", this.$h, { passive: !0 }), t.addEventListener("mousedown", this.Ph, { passive: !0 }), t.addEventListener("mouseup", this.Th, { passive: !0 }), t.addEventListener("click", this.Sh, { passive: !0 }), t.addEventListener("wheel", this.Uh, { passive: !1 }), this.Eh = !0;
|
|
2355
2355
|
}
|
|
2356
|
-
|
|
2357
|
-
if (!this.
|
|
2356
|
+
Kh() {
|
|
2357
|
+
if (!this.Eh) 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.
|
|
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;
|
|
2360
2360
|
}
|
|
2361
|
-
|
|
2362
|
-
if (this.
|
|
2361
|
+
Wh() {
|
|
2362
|
+
if (this.Eh) try {
|
|
2363
2363
|
if (this.xh) {
|
|
2364
2364
|
const t = new MouseEvent("mousemove", { clientX: this.xh.x, clientY: this.xh.y, bubbles: !1, cancelable: !1 });
|
|
2365
|
-
this.
|
|
2365
|
+
this.Gh(t);
|
|
2366
2366
|
}
|
|
2367
2367
|
} catch {
|
|
2368
2368
|
this.bh.x = -1 / 0, this.bh.y = -1 / 0;
|
|
2369
2369
|
}
|
|
2370
2370
|
}
|
|
2371
|
+
Zh(t) {
|
|
2372
|
+
this.kh = t;
|
|
2373
|
+
}
|
|
2371
2374
|
qh(t) {
|
|
2372
2375
|
this.Rh = t;
|
|
2373
2376
|
}
|
|
@@ -2380,123 +2383,121 @@ class kt {
|
|
|
2380
2383
|
so(t) {
|
|
2381
2384
|
this.Oh = t;
|
|
2382
2385
|
}
|
|
2383
|
-
eo(
|
|
2384
|
-
this.zh = t;
|
|
2385
|
-
}
|
|
2386
|
-
io() {
|
|
2386
|
+
eo() {
|
|
2387
2387
|
return { x: this.bh.x, y: this.bh.y };
|
|
2388
2388
|
}
|
|
2389
|
-
|
|
2389
|
+
io(t, e = {}) {
|
|
2390
2390
|
return { position: { ...this.bh }, previousPosition: { ...this.Ch }, originalEvent: t, ...e };
|
|
2391
2391
|
}
|
|
2392
|
+
jh(t) {
|
|
2393
|
+
this.Lh && !this.Hh() && this.Lh(this.io(t));
|
|
2394
|
+
}
|
|
2392
2395
|
Qh(t) {
|
|
2393
|
-
this.
|
|
2396
|
+
this.Rh && !this.Hh() && this.Rh(this.io(t, { button: t.button }));
|
|
2394
2397
|
}
|
|
2395
2398
|
Nh(t) {
|
|
2396
|
-
this.Dh && !this.
|
|
2399
|
+
this.Dh && !this.Hh() && this.Dh(this.io(t, { button: t.button }));
|
|
2397
2400
|
}
|
|
2398
2401
|
Xh(t) {
|
|
2399
|
-
this.
|
|
2402
|
+
this.kh && !this.Hh() && this.kh(this.io(t, { button: t.button }));
|
|
2400
2403
|
}
|
|
2401
2404
|
Yh(t) {
|
|
2402
|
-
this.
|
|
2403
|
-
}
|
|
2404
|
-
Kh(t) {
|
|
2405
|
-
this.zh && !this.Bh() && this.zh(this.ro(t, { delta: { x: t.deltaX, y: t.deltaY } }));
|
|
2405
|
+
this.Oh && !this.Hh() && 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 =
|
|
2410
|
+
const i = Yt(e, t.clientX, t.clientY);
|
|
2411
2411
|
this.bh.x = i.x, this.bh.y = i.y;
|
|
2412
2412
|
}
|
|
2413
2413
|
}
|
|
2414
2414
|
const Ge = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: kt }, Symbol.toStringTag, { value: "Module" }));
|
|
2415
|
-
class
|
|
2415
|
+
class Ht {
|
|
2416
2416
|
constructor() {
|
|
2417
|
-
o(this, "
|
|
2417
|
+
o(this, "ro", /* @__PURE__ */ new Map());
|
|
2418
|
+
o(this, "no", null);
|
|
2418
2419
|
o(this, "ho", null);
|
|
2419
|
-
o(this, "oo"
|
|
2420
|
+
o(this, "oo");
|
|
2420
2421
|
o(this, "ao");
|
|
2422
|
+
o(this, "Eh", !1);
|
|
2421
2423
|
o(this, "co");
|
|
2422
|
-
o(this, "kh", !1);
|
|
2423
2424
|
o(this, "lo");
|
|
2424
|
-
o(this, "uo");
|
|
2425
|
-
o(this, "fo", { ArrowUp: "UP_ARROW", ArrowDown: "DOWN_ARROW", ArrowLeft: "LEFT_ARROW", ArrowRight: "RIGHT_ARROW", F1: "F1", F2: "F2", F3: "F3", F4: "F4", F5: "F5", F6: "F6", F7: "F7", F8: "F8", F9: "F9", F10: "F10", F11: "F11", F12: "F12", Enter: "ENTER", Return: "RETURN", Tab: "TAB", Escape: "ESCAPE", Backspace: "BACKSPACE", Delete: "DELETE", Insert: "INSERT", Home: "HOME", End: "END", PageUp: "PAGE_UP", PageDown: "PAGE_DOWN", Shift: "SHIFT", Control: "CONTROL", Alt: "ALT", Meta: "META", " ": "SPACE" });
|
|
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
|
-
|
|
2428
|
-
this.
|
|
2427
|
+
Ih() {
|
|
2428
|
+
this.Eh || (this.oo = (t) => {
|
|
2429
|
+
this.fo(t);
|
|
2430
|
+
}, this.ao = (t) => {
|
|
2429
2431
|
this.do(t);
|
|
2430
|
-
}, this.
|
|
2431
|
-
this.po(t);
|
|
2432
|
-
}, window.addEventListener("keydown", this.ao, { passive: !1 }), window.addEventListener("keyup", this.co, { passive: !1 }), this.kh = !0);
|
|
2432
|
+
}, window.addEventListener("keydown", this.oo, { passive: !1 }), window.addEventListener("keyup", this.ao, { passive: !1 }), this.Eh = !0);
|
|
2433
2433
|
}
|
|
2434
|
-
|
|
2435
|
-
this.
|
|
2434
|
+
Kh() {
|
|
2435
|
+
this.Eh && (window.removeEventListener("keydown", this.oo), window.removeEventListener("keyup", this.ao), this.Eh = !1, this.ro.clear(), this.no = null, this.ho = null);
|
|
2436
|
+
}
|
|
2437
|
+
qh(t) {
|
|
2438
|
+
this.co = t;
|
|
2436
2439
|
}
|
|
2437
2440
|
Vh(t) {
|
|
2438
2441
|
this.lo = t;
|
|
2439
2442
|
}
|
|
2440
|
-
|
|
2441
|
-
this.
|
|
2442
|
-
}
|
|
2443
|
-
vo(t) {
|
|
2444
|
-
const e = this.mo(t), i = this.no.get(t) || this.no.get(e);
|
|
2443
|
+
po(t) {
|
|
2444
|
+
const e = this.vo(t), i = this.ro.get(t) || this.ro.get(e);
|
|
2445
2445
|
return (i == null ? void 0 : i.isPressed) || !1;
|
|
2446
2446
|
}
|
|
2447
|
+
mo() {
|
|
2448
|
+
return this.no;
|
|
2449
|
+
}
|
|
2447
2450
|
_o() {
|
|
2448
2451
|
return this.ho;
|
|
2449
2452
|
}
|
|
2450
2453
|
yo() {
|
|
2451
|
-
return this.oo;
|
|
2452
|
-
}
|
|
2453
|
-
Ao() {
|
|
2454
2454
|
const t = [];
|
|
2455
|
-
for (const [e, i] of this.
|
|
2455
|
+
for (const [e, i] of this.ro) i.isPressed && t.push(e);
|
|
2456
2456
|
return t;
|
|
2457
2457
|
}
|
|
2458
|
-
|
|
2459
|
-
return { ctrl: this.
|
|
2458
|
+
Ao() {
|
|
2459
|
+
return { ctrl: this.po("Control"), shift: this.po("Shift"), alt: this.po("Alt"), meta: this.po("Meta") };
|
|
2460
2460
|
}
|
|
2461
|
-
|
|
2462
|
-
this.
|
|
2461
|
+
wo() {
|
|
2462
|
+
this.ro.clear(), this.no = null, this.ho = null;
|
|
2463
2463
|
}
|
|
2464
|
-
|
|
2464
|
+
fo(t) {
|
|
2465
2465
|
const e = t.key, i = Date.now();
|
|
2466
|
-
this.
|
|
2467
|
-
const s = this.
|
|
2468
|
-
s.isPressed || (s.isPressed = !0, s.lastPressTime = i, this.
|
|
2466
|
+
this.ro.has(e) || this.ro.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
2467
|
+
const s = this.ro.get(e);
|
|
2468
|
+
s.isPressed || (s.isPressed = !0, s.lastPressTime = i, this.no = e, this.co && this.co(this.io(e, !0, t)));
|
|
2469
2469
|
}
|
|
2470
|
-
|
|
2470
|
+
io(t, e, i) {
|
|
2471
2471
|
return { key: t, keyCode: i.keyCode, ctrlKey: i.ctrlKey, shiftKey: i.shiftKey, altKey: i.altKey, metaKey: i.metaKey, isPressed: e, originalEvent: i };
|
|
2472
2472
|
}
|
|
2473
|
-
|
|
2473
|
+
do(t) {
|
|
2474
2474
|
const e = t.key, i = Date.now();
|
|
2475
|
-
this.
|
|
2476
|
-
const s = this.
|
|
2477
|
-
s.isPressed = !1, s.lastReleaseTime = i, this.
|
|
2475
|
+
this.ro.has(e) || this.ro.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
2476
|
+
const s = this.ro.get(e);
|
|
2477
|
+
s.isPressed = !1, s.lastReleaseTime = i, this.ho = e, this.lo && this.lo(this.io(e, !1, t));
|
|
2478
2478
|
}
|
|
2479
|
-
|
|
2480
|
-
return this.
|
|
2479
|
+
vo(t) {
|
|
2480
|
+
return this.uo[t] || t.toLowerCase();
|
|
2481
2481
|
}
|
|
2482
2482
|
}
|
|
2483
|
-
const
|
|
2483
|
+
const je = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: Ht }, Symbol.toStringTag, { value: "Module" }));
|
|
2484
2484
|
class Gt {
|
|
2485
2485
|
constructor(t, e, i) {
|
|
2486
2486
|
o(this, "Xr");
|
|
2487
|
-
o(this, "
|
|
2487
|
+
o(this, "bo");
|
|
2488
2488
|
o(this, "wh");
|
|
2489
|
+
o(this, "Co", /* @__PURE__ */ new Map());
|
|
2489
2490
|
o(this, "xo", /* @__PURE__ */ new Map());
|
|
2490
2491
|
o(this, "Mo", /* @__PURE__ */ new Map());
|
|
2491
|
-
o(this, "Fo",
|
|
2492
|
-
o(this, "$o"
|
|
2492
|
+
o(this, "Fo", null);
|
|
2493
|
+
o(this, "$o");
|
|
2493
2494
|
o(this, "Po");
|
|
2494
2495
|
o(this, "To");
|
|
2495
2496
|
o(this, "So");
|
|
2496
2497
|
o(this, "Eo");
|
|
2497
2498
|
o(this, "ko");
|
|
2499
|
+
o(this, "Eh", !1);
|
|
2498
2500
|
o(this, "Ro");
|
|
2499
|
-
o(this, "kh", !1);
|
|
2500
2501
|
o(this, "Do");
|
|
2501
2502
|
o(this, "Lo");
|
|
2502
2503
|
o(this, "Oo");
|
|
@@ -2506,59 +2507,61 @@ class Gt {
|
|
|
2506
2507
|
o(this, "Io");
|
|
2507
2508
|
o(this, "Go");
|
|
2508
2509
|
o(this, "jo");
|
|
2509
|
-
o(this, "Qo");
|
|
2510
|
-
o(this, "No",
|
|
2511
|
-
o(this, "Xo",
|
|
2512
|
-
o(this, "Yo",
|
|
2513
|
-
o(this, "Ko",
|
|
2514
|
-
o(this, "Wo",
|
|
2515
|
-
o(this, "Zo",
|
|
2516
|
-
o(this, "qo",
|
|
2517
|
-
o(this, "Vo",
|
|
2518
|
-
o(this, "Jo",
|
|
2519
|
-
o(this, "ta",
|
|
2520
|
-
o(this, "sa",
|
|
2521
|
-
|
|
2522
|
-
this.Xr = t, this.wh = e, this.Co = i;
|
|
2510
|
+
o(this, "Qo", 320);
|
|
2511
|
+
o(this, "No", 350);
|
|
2512
|
+
o(this, "Xo", 10);
|
|
2513
|
+
o(this, "Yo", 550);
|
|
2514
|
+
o(this, "Ko", 14);
|
|
2515
|
+
o(this, "Wo", 48);
|
|
2516
|
+
o(this, "Zo", 650);
|
|
2517
|
+
o(this, "qo", 0.02);
|
|
2518
|
+
o(this, "Vo", 2);
|
|
2519
|
+
o(this, "Jo", 600);
|
|
2520
|
+
o(this, "ta", 0);
|
|
2521
|
+
o(this, "sa", null);
|
|
2522
|
+
this.Xr = t, this.wh = e, this.bo = i;
|
|
2523
2523
|
const s = this.Xr.canvas;
|
|
2524
|
-
this
|
|
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
|
-
|
|
2527
|
-
if (this.
|
|
2526
|
+
Ih() {
|
|
2527
|
+
if (this.Eh) return;
|
|
2528
2528
|
const t = this.Xr.canvas;
|
|
2529
|
-
this.
|
|
2529
|
+
this.To = (e) => {
|
|
2530
|
+
this.ea(e);
|
|
2531
|
+
}, this.So = (e) => {
|
|
2530
2532
|
this.ia(e);
|
|
2531
2533
|
}, this.Eo = (e) => {
|
|
2532
2534
|
this.ra(e);
|
|
2533
2535
|
}, this.ko = (e) => {
|
|
2534
2536
|
this.na(e);
|
|
2535
|
-
}, this.
|
|
2536
|
-
this.ha(e);
|
|
2537
|
-
}, t.addEventListener("touchstart", this.So, { passive: !1 }), t.addEventListener("touchmove", this.Eo, { passive: !1 }), t.addEventListener("touchend", this.ko, { passive: !1 }), t.addEventListener("touchcancel", this.Ro, { passive: !1 }), this.kh = !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.Eh = !0;
|
|
2538
2538
|
}
|
|
2539
|
-
|
|
2540
|
-
if (!this.
|
|
2539
|
+
Kh() {
|
|
2540
|
+
if (!this.Eh) return;
|
|
2541
2541
|
const t = this.Xr.canvas;
|
|
2542
|
-
t.removeEventListener("touchstart", this.
|
|
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) => {
|
|
2543
2543
|
e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
|
|
2544
|
-
}), this.
|
|
2544
|
+
}), this.Mo.clear(), this.sa = null, this.ta = 0, t.style.touchAction = this.$o, t.style.userSelect = this.Po;
|
|
2545
2545
|
}
|
|
2546
|
-
|
|
2547
|
-
if (!this.wh() || this.
|
|
2546
|
+
Wh() {
|
|
2547
|
+
if (!this.wh() || this.Co.size === 0) return;
|
|
2548
2548
|
const t = /* @__PURE__ */ new Map();
|
|
2549
|
-
for (const e of this.
|
|
2550
|
-
const i = this.
|
|
2549
|
+
for (const e of this.Co.values()) {
|
|
2550
|
+
const i = this.ha(e.clientX, e.clientY, e.id, e);
|
|
2551
2551
|
t.set(e.id, i);
|
|
2552
2552
|
}
|
|
2553
|
-
this.
|
|
2553
|
+
this.Co = t;
|
|
2554
2554
|
}
|
|
2555
|
-
|
|
2556
|
-
return Array.from(this.
|
|
2555
|
+
oa() {
|
|
2556
|
+
return Array.from(this.Co.values()).map((t) => ({ ...t }));
|
|
2557
2557
|
}
|
|
2558
|
-
|
|
2558
|
+
aa(t) {
|
|
2559
|
+
this.Ro = t;
|
|
2560
|
+
}
|
|
2561
|
+
Jh(t) {
|
|
2559
2562
|
this.Do = t;
|
|
2560
2563
|
}
|
|
2561
|
-
|
|
2564
|
+
ca(t) {
|
|
2562
2565
|
this.Lo = t;
|
|
2563
2566
|
}
|
|
2564
2567
|
la(t) {
|
|
@@ -2582,147 +2585,144 @@ class Gt {
|
|
|
2582
2585
|
ga(t) {
|
|
2583
2586
|
this.jo = t;
|
|
2584
2587
|
}
|
|
2585
|
-
|
|
2586
|
-
this.Qo = t;
|
|
2587
|
-
}
|
|
2588
|
-
ia(t) {
|
|
2588
|
+
ea(t) {
|
|
2589
2589
|
var s;
|
|
2590
2590
|
if (!this.wh()) return;
|
|
2591
|
-
t.preventDefault(), (s = this.
|
|
2592
|
-
const e = performance.now(), i = this.
|
|
2591
|
+
t.preventDefault(), (s = this.bo) == null || s.zh(this.Jo);
|
|
2592
|
+
const e = performance.now(), i = this.ma(t.changedTouches);
|
|
2593
2593
|
for (const r of i) {
|
|
2594
|
-
const h = this.
|
|
2595
|
-
h && this.
|
|
2594
|
+
const h = this.Co.get(r.id);
|
|
2595
|
+
h && this.xo.set(r.id, this._a(h)), this.Co.set(r.id, r);
|
|
2596
2596
|
const a = { id: r.id, startPosition: r, lastPosition: r, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
|
|
2597
|
-
this.
|
|
2598
|
-
const l = this.
|
|
2599
|
-
l && (a.longPressFired = !0, this.
|
|
2600
|
-
}, this.
|
|
2597
|
+
this.Bo && (a.longPressTimer = window.setTimeout(() => {
|
|
2598
|
+
const l = this.Co.get(r.id);
|
|
2599
|
+
l && (a.longPressFired = !0, this.Bo({ touch: this._a(l), duration: performance.now() - a.startTime, originalEvent: t }));
|
|
2600
|
+
}, this.Yo)), this.Mo.set(r.id, a), this.Ro && this.Ro(this.ya(r, t, void 0, e));
|
|
2601
2601
|
}
|
|
2602
|
-
this.
|
|
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.
|
|
2608
|
-
const e = performance.now(), i = this.
|
|
2607
|
+
t.preventDefault(), (s = this.bo) == null || s.zh(this.Jo);
|
|
2608
|
+
const e = performance.now(), i = this.ma(t.changedTouches);
|
|
2609
2609
|
for (const r of i) {
|
|
2610
|
-
const h = this.
|
|
2611
|
-
a && this.
|
|
2612
|
-
const l = this.
|
|
2613
|
-
l && (l.lastPosition = r, l.lastTime = e, a) &&
|
|
2610
|
+
const h = this.Co.get(r.id), a = h ? this._a(h) : void 0;
|
|
2611
|
+
a && this.xo.set(r.id, a), this.Co.set(r.id, r);
|
|
2612
|
+
const l = this.Mo.get(r.id);
|
|
2613
|
+
l && (l.lastPosition = r, l.lastTime = e, a) && $(a.clientX, a.clientY, r.clientX, r.clientY) > this.Ko && l.longPressTimer !== null && (window.clearTimeout(l.longPressTimer), l.longPressTimer = null), this.Do && this.Do(this.ya(r, t, a, e));
|
|
2614
2614
|
}
|
|
2615
|
-
this.
|
|
2615
|
+
this.Co.size === 2 ? this.ba(t) : this.Fo = null;
|
|
2616
2616
|
}
|
|
2617
|
-
|
|
2617
|
+
ra(t) {
|
|
2618
2618
|
if (!this.wh()) return;
|
|
2619
2619
|
t.preventDefault();
|
|
2620
|
-
const e = performance.now(), i = this.
|
|
2620
|
+
const e = performance.now(), i = this.ma(t.changedTouches);
|
|
2621
2621
|
for (const s of i) {
|
|
2622
|
-
const r = this.
|
|
2623
|
-
a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.
|
|
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);
|
|
2624
2624
|
}
|
|
2625
|
-
this.
|
|
2625
|
+
this.Co.size < 2 && (this.Fo = null);
|
|
2626
2626
|
}
|
|
2627
|
-
|
|
2627
|
+
na(t) {
|
|
2628
2628
|
if (!this.wh()) return;
|
|
2629
2629
|
t.preventDefault();
|
|
2630
|
-
const e = performance.now(), i = this.
|
|
2630
|
+
const e = performance.now(), i = this.ma(t.changedTouches);
|
|
2631
2631
|
for (const s of i) {
|
|
2632
|
-
const r = this.
|
|
2633
|
-
a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.
|
|
2632
|
+
const r = this.Co.get(s.id), h = r ? this._a(r) : void 0, a = this.Mo.get(s.id);
|
|
2633
|
+
a && a.longPressTimer !== null && (window.clearTimeout(a.longPressTimer), a.longPressTimer = null), this.Oo && this.Oo(this.ya(s, t, h, e)), this.Mo.delete(s.id), this.xo.delete(s.id), this.Co.delete(s.id);
|
|
2634
2634
|
}
|
|
2635
|
-
this.
|
|
2635
|
+
this.Co.size < 2 && (this.Fo = null);
|
|
2636
2636
|
}
|
|
2637
|
-
|
|
2637
|
+
ma(t) {
|
|
2638
2638
|
const e = [];
|
|
2639
2639
|
for (let i = 0; i < t.length; i += 1) {
|
|
2640
2640
|
const s = t.item(i);
|
|
2641
|
-
s && e.push(this.
|
|
2641
|
+
s && e.push(this.xa(s));
|
|
2642
2642
|
}
|
|
2643
2643
|
return e;
|
|
2644
2644
|
}
|
|
2645
|
-
|
|
2646
|
-
return this.
|
|
2645
|
+
xa(t) {
|
|
2646
|
+
return this.ha(t.clientX, t.clientY, t.identifier, { id: t.identifier, x: -1, y: -1, clientX: t.clientX, clientY: t.clientY, pressure: t.force, radiusX: t.radiusX, radiusY: t.radiusY, rotationAngle: t.rotationAngle });
|
|
2647
2647
|
}
|
|
2648
|
-
|
|
2649
|
-
const r =
|
|
2648
|
+
ha(t, e, i, s) {
|
|
2649
|
+
const r = Yt(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
|
-
|
|
2653
|
-
const r = this.
|
|
2654
|
-
return { touch: this.
|
|
2652
|
+
ya(t, e, i, s) {
|
|
2653
|
+
const r = this.Mo.get(t.id), h = Array.from(this.xo.values()).map((u) => this._a(u)), a = Array.from(this.Co.values()).map((u) => this._a(u)), l = this.ma(e.changedTouches);
|
|
2654
|
+
return { touch: this._a(t), previousTouch: i ? this._a(i) : void 0, touches: a, previousTouches: h, changedTouches: l, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
|
|
2655
2655
|
}
|
|
2656
|
-
|
|
2657
|
-
if (this.
|
|
2658
|
-
const t = Array.from(this.
|
|
2659
|
-
this
|
|
2656
|
+
wa() {
|
|
2657
|
+
if (this.Co.size !== 2) return void (this.Fo = null);
|
|
2658
|
+
const t = Array.from(this.Co.values()), [e, i] = t, s = $(e.x, e.y, i.x, i.y), r = Rt(e.clientX, e.clientY, i.clientX, i.clientY);
|
|
2659
|
+
this.Fo = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
|
|
2660
2660
|
}
|
|
2661
|
-
|
|
2662
|
-
if (this
|
|
2663
|
-
const [e, i] = this
|
|
2661
|
+
ba(t) {
|
|
2662
|
+
if (this.Fo || this.wa(), !this.Fo) return;
|
|
2663
|
+
const [e, i] = this.Fo.ids, s = this.Co.get(e), r = this.Co.get(i);
|
|
2664
2664
|
if (!s || !r) return;
|
|
2665
|
-
const h =
|
|
2666
|
-
this.
|
|
2667
|
-
let l = Rt(s.clientX, s.clientY, r.clientX, r.clientY) - this
|
|
2665
|
+
const h = $(s.x, s.y, r.x, r.y) / this.Fo.initialDistance, a = h - this.Fo.lastScale;
|
|
2666
|
+
this.Go && Math.abs(a) > this.qo && (this.Go({ touches: [this._a(s), this._a(r)], scale: h, deltaScale: a, center: this.Ma(s, r), originalEvent: t }), this.Fo.lastScale = h);
|
|
2667
|
+
let l = Rt(s.clientX, s.clientY, r.clientX, r.clientY) - this.Fo.initialAngle;
|
|
2668
2668
|
l = (l + 180) % 360 - 180;
|
|
2669
|
-
const u = l - this
|
|
2670
|
-
this.
|
|
2669
|
+
const u = l - this.Fo.lastRotation;
|
|
2670
|
+
this.jo && Math.abs(u) > this.Vo && (this.jo({ touches: [this._a(s), this._a(r)], rotation: l, deltaRotation: u, center: this.Ma(s, r), originalEvent: t }), this.Fo.lastRotation = l);
|
|
2671
2671
|
}
|
|
2672
|
-
|
|
2673
|
-
const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.
|
|
2672
|
+
Ma(t, e) {
|
|
2673
|
+
const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.ha(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
|
|
2674
2674
|
return { x: r.x, y: r.y };
|
|
2675
2675
|
}
|
|
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
|
-
if (!t.longPressFired && s <= this.
|
|
2679
|
-
this
|
|
2680
|
-
else if (!t.longPressFired && s <= this.
|
|
2678
|
+
if (!t.longPressFired && s <= this.Qo && a <= this.Xo)
|
|
2679
|
+
this.Fa(t.lastPosition, i) && this.Ho ? this.Ho({ touch: this._a(t.lastPosition), taps: 2, originalEvent: e }) : this.zo && this.zo({ touch: this._a(t.lastPosition), taps: 1, originalEvent: e });
|
|
2680
|
+
else if (!t.longPressFired && s <= this.Zo && a >= this.Wo) {
|
|
2681
2681
|
const l = Math.max(a, 1e-4), u = { x: r / l, y: h / l }, c = { x: r / s, y: h / s };
|
|
2682
|
-
this.
|
|
2682
|
+
this.Io && this.Io({ touch: this._a(t.lastPosition), direction: u, distance: l, velocity: c, originalEvent: e });
|
|
2683
2683
|
}
|
|
2684
|
-
this.
|
|
2684
|
+
this.ta = i, this.sa = this._a(t.lastPosition);
|
|
2685
2685
|
}
|
|
2686
|
-
|
|
2687
|
-
return !this.
|
|
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;
|
|
2688
2688
|
}
|
|
2689
|
-
|
|
2689
|
+
_a(t) {
|
|
2690
2690
|
return { ...t };
|
|
2691
2691
|
}
|
|
2692
2692
|
}
|
|
2693
|
-
const
|
|
2694
|
-
class
|
|
2693
|
+
const Ke = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Gt }, Symbol.toStringTag, { value: "Module" }));
|
|
2694
|
+
class Z extends Et {
|
|
2695
2695
|
constructor(e, i, s, r, h, a, l, u, c) {
|
|
2696
2696
|
super(e, i, s, r, h, a, l, u);
|
|
2697
|
-
o(this, "
|
|
2698
|
-
this
|
|
2697
|
+
o(this, "$a");
|
|
2698
|
+
this.$a = c;
|
|
2699
2699
|
}
|
|
2700
|
-
static
|
|
2701
|
-
const a = e.context, l =
|
|
2702
|
-
return new
|
|
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);
|
|
2703
2703
|
}
|
|
2704
|
-
|
|
2705
|
-
this
|
|
2704
|
+
Ta() {
|
|
2705
|
+
this.$a instanceof HTMLVideoElement ? this.$a.readyState >= this.$a.HAVE_CURRENT_DATA && rt(this.$, this.Mn, this.$a) : rt(this.$, this.Mn, this.$a);
|
|
2706
2706
|
}
|
|
2707
2707
|
V() {
|
|
2708
2708
|
return this.D = null, super.V();
|
|
2709
2709
|
}
|
|
2710
2710
|
Hn() {
|
|
2711
|
-
this.
|
|
2711
|
+
this.Ta();
|
|
2712
2712
|
}
|
|
2713
2713
|
get source() {
|
|
2714
|
-
return this
|
|
2714
|
+
return this.$a;
|
|
2715
2715
|
}
|
|
2716
2716
|
}
|
|
2717
|
-
class ut extends
|
|
2717
|
+
class ut extends Z {
|
|
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.
|
|
2722
|
+
super.dispose(), this.Sa.pause(), this.Sa.src = "", this.Sa.load();
|
|
2723
2723
|
}
|
|
2724
|
-
|
|
2725
|
-
this.
|
|
2724
|
+
Ea() {
|
|
2725
|
+
this.Ta();
|
|
2726
2726
|
}
|
|
2727
2727
|
static async Nn(t, e, i, s, r) {
|
|
2728
2728
|
const h = t.context, a = document.createElement("video");
|
|
@@ -2733,44 +2733,44 @@ class ut extends Q {
|
|
|
2733
2733
|
g(Error("Failed to load video: " + (((d = v.error) == null ? void 0 : d.message) || "Unknown error")));
|
|
2734
2734
|
}, { once: !0 }), a.src = i;
|
|
2735
2735
|
});
|
|
2736
|
-
const l =
|
|
2736
|
+
const l = bt(h, a, h.LINEAR, h.LINEAR, h.CLAMP_TO_EDGE, h.CLAMP_TO_EDGE), { width: u, height: c } = wt(a);
|
|
2737
2737
|
return new ut(h, t, l, e, a, u, c, s, r);
|
|
2738
2738
|
}
|
|
2739
2739
|
async play() {
|
|
2740
|
-
await this.
|
|
2740
|
+
await this.Sa.play();
|
|
2741
2741
|
}
|
|
2742
2742
|
pause() {
|
|
2743
|
-
this.
|
|
2743
|
+
this.Sa.pause();
|
|
2744
2744
|
}
|
|
2745
2745
|
stop() {
|
|
2746
|
-
this.
|
|
2746
|
+
this.Sa.pause(), this.Sa.currentTime = 0;
|
|
2747
2747
|
}
|
|
2748
2748
|
speed(t) {
|
|
2749
|
-
return this.
|
|
2749
|
+
return this.Sa.playbackRate = t, this;
|
|
2750
2750
|
}
|
|
2751
2751
|
loop(t = !0) {
|
|
2752
|
-
return this.
|
|
2752
|
+
return this.Sa.loop = t, this;
|
|
2753
2753
|
}
|
|
2754
2754
|
time(t) {
|
|
2755
|
-
return this.
|
|
2755
|
+
return this.Sa.currentTime = t, this;
|
|
2756
2756
|
}
|
|
2757
2757
|
volume(t) {
|
|
2758
|
-
return this.
|
|
2758
|
+
return this.Sa.volume = _(t, 0, 1), this;
|
|
2759
2759
|
}
|
|
2760
2760
|
get videoElement() {
|
|
2761
|
-
return this.
|
|
2761
|
+
return this.Sa;
|
|
2762
2762
|
}
|
|
2763
2763
|
get currentTime() {
|
|
2764
|
-
return this.
|
|
2764
|
+
return this.Sa.currentTime;
|
|
2765
2765
|
}
|
|
2766
2766
|
get duration() {
|
|
2767
|
-
return this.
|
|
2767
|
+
return this.Sa.duration;
|
|
2768
2768
|
}
|
|
2769
2769
|
get isPlaying() {
|
|
2770
|
-
return !this.
|
|
2770
|
+
return !this.Sa.paused && !this.Sa.ended;
|
|
2771
2771
|
}
|
|
2772
|
-
get
|
|
2773
|
-
return this
|
|
2772
|
+
get Sa() {
|
|
2773
|
+
return this.$a;
|
|
2774
2774
|
}
|
|
2775
2775
|
}
|
|
2776
2776
|
async function st(n) {
|
|
@@ -2781,7 +2781,7 @@ async function st(n) {
|
|
|
2781
2781
|
}
|
|
2782
2782
|
return n;
|
|
2783
2783
|
}
|
|
2784
|
-
const
|
|
2784
|
+
const We = (n) => class extends n {
|
|
2785
2785
|
rotate(t = 0, e = 0, i = 0) {
|
|
2786
2786
|
this.R.state.Jt(t), this.R.state.ts(e), this.R.state.ss(i);
|
|
2787
2787
|
}
|
|
@@ -2822,7 +2822,7 @@ const Ze = (n) => class extends n {
|
|
|
2822
2822
|
this.R.state.W();
|
|
2823
2823
|
}
|
|
2824
2824
|
color(t, e, i, s) {
|
|
2825
|
-
return
|
|
2825
|
+
return E.yn(t, e, i, s);
|
|
2826
2826
|
}
|
|
2827
2827
|
rect(t = 1, e = 1) {
|
|
2828
2828
|
this.R.ki(t, e);
|
|
@@ -2840,9 +2840,9 @@ const Ze = (n) => class extends n {
|
|
|
2840
2840
|
background(t, e, i, s = 255) {
|
|
2841
2841
|
if (t === void 0) {
|
|
2842
2842
|
const [h, a, l, u] = this.R.state.canvasBackgroundColor;
|
|
2843
|
-
return
|
|
2843
|
+
return E.xn(h, a, l, u);
|
|
2844
2844
|
}
|
|
2845
|
-
const r =
|
|
2845
|
+
const r = E.yn(t, e, i, s);
|
|
2846
2846
|
this.R.Bi(r.r, r.g, r.b, r.a);
|
|
2847
2847
|
}
|
|
2848
2848
|
char(t) {
|
|
@@ -2857,9 +2857,9 @@ const Ze = (n) => class extends n {
|
|
|
2857
2857
|
Xt(t, e, i, s) {
|
|
2858
2858
|
if (t === void 0) {
|
|
2859
2859
|
const [h, a, l, u] = this.R.state.charColor;
|
|
2860
|
-
return
|
|
2860
|
+
return E.xn(h, a, l, u);
|
|
2861
2861
|
}
|
|
2862
|
-
const r =
|
|
2862
|
+
const r = E.yn(t, e, i, s);
|
|
2863
2863
|
this.R.state.us(r.r, r.g, r.b, r.a);
|
|
2864
2864
|
}
|
|
2865
2865
|
charColor(t, e, i, s) {
|
|
@@ -2871,9 +2871,9 @@ const Ze = (n) => class extends n {
|
|
|
2871
2871
|
Yt(t, e, i, s) {
|
|
2872
2872
|
if (t === void 0) {
|
|
2873
2873
|
const [h, a, l, u] = this.R.state.cellColor;
|
|
2874
|
-
return
|
|
2874
|
+
return E.xn(h, a, l, u);
|
|
2875
2875
|
}
|
|
2876
|
-
const r =
|
|
2876
|
+
const r = E.yn(t, e, i, s);
|
|
2877
2877
|
this.R.state.fs(r.r, r.g, r.b, r.a);
|
|
2878
2878
|
}
|
|
2879
2879
|
cellColor(t, e, i, s) {
|
|
@@ -2927,15 +2927,15 @@ const Ze = (n) => class extends n {
|
|
|
2927
2927
|
}
|
|
2928
2928
|
async createFilterShader(t) {
|
|
2929
2929
|
const e = await st(t), i = this.R.Pi(e);
|
|
2930
|
-
return this.
|
|
2930
|
+
return this.ka(i), i;
|
|
2931
2931
|
}
|
|
2932
2932
|
async createShader(t, e) {
|
|
2933
2933
|
const i = await st(t), s = await st(e), r = this.R.Mi(i, s);
|
|
2934
|
-
return this.
|
|
2934
|
+
return this.ka(r), r;
|
|
2935
2935
|
}
|
|
2936
2936
|
createFramebuffer(t) {
|
|
2937
2937
|
const e = this.R.Hi(t.width ?? this.grid.cols, t.height ?? this.grid.rows, t.attachments ?? 3);
|
|
2938
|
-
return this.
|
|
2938
|
+
return this.ka(e), e;
|
|
2939
2939
|
}
|
|
2940
2940
|
image(t, e, i) {
|
|
2941
2941
|
this.R.Ti(t, e, i, this.font), t instanceof vt && this.R.Z();
|
|
@@ -2945,150 +2945,151 @@ const Ze = (n) => class extends n {
|
|
|
2945
2945
|
const a = new Image();
|
|
2946
2946
|
a.crossOrigin = "anonymous", a.onload = () => r(a), a.onerror = (l) => h(l), a.src = e;
|
|
2947
2947
|
}), s = V.Nn(this.R, this.En, i, this.grid.cols, this.grid.rows);
|
|
2948
|
-
return this.
|
|
2948
|
+
return this.ka(s), s;
|
|
2949
2949
|
}
|
|
2950
2950
|
async loadVideo(t) {
|
|
2951
2951
|
const e = await ut.Nn(this.R, this.En, t, this.grid.cols, this.grid.rows);
|
|
2952
|
-
return this.
|
|
2952
|
+
return this.ka(e), e;
|
|
2953
2953
|
}
|
|
2954
2954
|
createTexture(t) {
|
|
2955
|
-
const e =
|
|
2956
|
-
return this.
|
|
2955
|
+
const e = Z.Pa(this.R, this.En, t, this.grid.cols, this.grid.rows);
|
|
2956
|
+
return this.ka(e), e;
|
|
2957
2957
|
}
|
|
2958
2958
|
}, Ve = (n) => class extends n {
|
|
2959
2959
|
get frameCount() {
|
|
2960
|
-
return this.
|
|
2960
|
+
return this.Ra.gh;
|
|
2961
2961
|
}
|
|
2962
2962
|
set frameCount(t) {
|
|
2963
|
-
this.
|
|
2963
|
+
this.Ra.gh = t;
|
|
2964
2964
|
}
|
|
2965
2965
|
frameRate(t) {
|
|
2966
|
-
return t === void 0 ? this.
|
|
2966
|
+
return t === void 0 ? this.Ra.dh : this.Ra.ah(t, () => this.Da());
|
|
2967
2967
|
}
|
|
2968
2968
|
targetFrameRate(t) {
|
|
2969
|
-
if (t === void 0) return this.
|
|
2970
|
-
this.
|
|
2969
|
+
if (t === void 0) return this.Ra.ph;
|
|
2970
|
+
this.Ra.ph = t;
|
|
2971
2971
|
}
|
|
2972
2972
|
noLoop() {
|
|
2973
|
-
this.
|
|
2973
|
+
this.Ra.hh();
|
|
2974
2974
|
}
|
|
2975
2975
|
loop() {
|
|
2976
|
-
this.
|
|
2976
|
+
this.Ra.oh(() => this.Da());
|
|
2977
2977
|
}
|
|
2978
2978
|
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.
|
|
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();
|
|
2980
2980
|
}
|
|
2981
2981
|
isLooping() {
|
|
2982
|
-
return this.
|
|
2982
|
+
return this.Ra.fh;
|
|
2983
2983
|
}
|
|
2984
2984
|
get millis() {
|
|
2985
|
-
return this.
|
|
2985
|
+
return this.Ra._h;
|
|
2986
2986
|
}
|
|
2987
2987
|
set millis(t) {
|
|
2988
|
-
this.
|
|
2988
|
+
this.Ra._h = t;
|
|
2989
2989
|
}
|
|
2990
2990
|
get secs() {
|
|
2991
|
-
return this.
|
|
2991
|
+
return this.Ra.yh;
|
|
2992
2992
|
}
|
|
2993
2993
|
set secs(t) {
|
|
2994
|
-
this.
|
|
2994
|
+
this.Ra.yh = t;
|
|
2995
2995
|
}
|
|
2996
2996
|
deltaTime() {
|
|
2997
|
-
return this.
|
|
2997
|
+
return this.Ra.Ah;
|
|
2998
2998
|
}
|
|
2999
|
-
},
|
|
2999
|
+
}, Ze = (n) => class extends n {
|
|
3000
3000
|
constructor(...t) {
|
|
3001
3001
|
super(...t);
|
|
3002
3002
|
}
|
|
3003
3003
|
mouseClicked(t) {
|
|
3004
|
-
this.
|
|
3004
|
+
this.bo.Zh(t);
|
|
3005
3005
|
}
|
|
3006
3006
|
mousePressed(t) {
|
|
3007
|
-
this.
|
|
3007
|
+
this.bo.qh(t);
|
|
3008
3008
|
}
|
|
3009
3009
|
mouseReleased(t) {
|
|
3010
|
-
this.
|
|
3010
|
+
this.bo.Vh(t);
|
|
3011
3011
|
}
|
|
3012
3012
|
mouseMoved(t) {
|
|
3013
|
-
this.
|
|
3013
|
+
this.bo.Jh(t);
|
|
3014
3014
|
}
|
|
3015
3015
|
mouseScrolled(t) {
|
|
3016
|
-
this.
|
|
3016
|
+
this.bo.so(t);
|
|
3017
3017
|
}
|
|
3018
3018
|
get mouse() {
|
|
3019
|
-
return this.
|
|
3019
|
+
return this.bo.eo();
|
|
3020
3020
|
}
|
|
3021
3021
|
cursor(t) {
|
|
3022
|
-
this.
|
|
3022
|
+
this.bo.Bh(t);
|
|
3023
3023
|
}
|
|
3024
|
-
},
|
|
3024
|
+
}, Qe = (n) => class extends n {
|
|
3025
3025
|
constructor(...t) {
|
|
3026
3026
|
super(...t);
|
|
3027
3027
|
}
|
|
3028
3028
|
touchStarted(t) {
|
|
3029
|
-
this.
|
|
3029
|
+
this.La.aa(t);
|
|
3030
3030
|
}
|
|
3031
3031
|
touchMoved(t) {
|
|
3032
|
-
this.
|
|
3032
|
+
this.La.Jh(t);
|
|
3033
3033
|
}
|
|
3034
3034
|
touchEnded(t) {
|
|
3035
|
-
this.
|
|
3035
|
+
this.La.ca(t);
|
|
3036
3036
|
}
|
|
3037
3037
|
touchCancelled(t) {
|
|
3038
|
-
this.
|
|
3038
|
+
this.La.la(t);
|
|
3039
3039
|
}
|
|
3040
3040
|
tap(t) {
|
|
3041
|
-
this.
|
|
3041
|
+
this.La.ua(t);
|
|
3042
3042
|
}
|
|
3043
3043
|
doubleTap(t) {
|
|
3044
|
-
this.
|
|
3044
|
+
this.La.fa(t);
|
|
3045
3045
|
}
|
|
3046
3046
|
longPress(t) {
|
|
3047
|
-
this.
|
|
3047
|
+
this.La.da(t);
|
|
3048
3048
|
}
|
|
3049
3049
|
swipe(t) {
|
|
3050
|
-
this.
|
|
3050
|
+
this.La.pa(t);
|
|
3051
3051
|
}
|
|
3052
3052
|
pinch(t) {
|
|
3053
|
-
this.
|
|
3053
|
+
this.La.va(t);
|
|
3054
3054
|
}
|
|
3055
3055
|
rotateGesture(t) {
|
|
3056
|
-
this.
|
|
3056
|
+
this.La.ga(t);
|
|
3057
3057
|
}
|
|
3058
3058
|
get touches() {
|
|
3059
|
-
return this.
|
|
3059
|
+
return this.La.oa();
|
|
3060
3060
|
}
|
|
3061
|
-
},
|
|
3061
|
+
}, $e = (n) => class extends n {
|
|
3062
3062
|
constructor(...t) {
|
|
3063
3063
|
super(...t);
|
|
3064
3064
|
}
|
|
3065
3065
|
keyPressed(t) {
|
|
3066
|
-
this.
|
|
3066
|
+
this.Oa.qh(t);
|
|
3067
3067
|
}
|
|
3068
3068
|
keyReleased(t) {
|
|
3069
|
-
this.
|
|
3069
|
+
this.Oa.Vh(t);
|
|
3070
3070
|
}
|
|
3071
3071
|
isKeyPressed(t) {
|
|
3072
|
-
return this.
|
|
3072
|
+
return this.Oa.po(t);
|
|
3073
3073
|
}
|
|
3074
3074
|
get lastKeyPressed() {
|
|
3075
|
-
return this.
|
|
3075
|
+
return this.Oa.mo();
|
|
3076
3076
|
}
|
|
3077
3077
|
get lastKeyReleased() {
|
|
3078
|
-
return this.
|
|
3078
|
+
return this.Oa._o();
|
|
3079
3079
|
}
|
|
3080
3080
|
get pressedKeys() {
|
|
3081
|
-
return this.
|
|
3081
|
+
return this.Oa.yo();
|
|
3082
3082
|
}
|
|
3083
3083
|
get modifierState() {
|
|
3084
|
-
return this.
|
|
3084
|
+
return this.Oa.Ao();
|
|
3085
3085
|
}
|
|
3086
3086
|
};
|
|
3087
|
-
class
|
|
3087
|
+
class jt {
|
|
3088
3088
|
constructor(t) {
|
|
3089
|
-
o(this, "
|
|
3090
|
-
o(this, "
|
|
3091
|
-
o(this, "
|
|
3089
|
+
o(this, "za");
|
|
3090
|
+
o(this, "Ha", /* @__PURE__ */ new Map());
|
|
3091
|
+
o(this, "Ba", []);
|
|
3092
|
+
o(this, "Ia", /* @__PURE__ */ new Map());
|
|
3092
3093
|
o(this, "Ga", /* @__PURE__ */ new Map());
|
|
3093
3094
|
o(this, "ja", /* @__PURE__ */ new Map());
|
|
3094
3095
|
o(this, "Qa", /* @__PURE__ */ new Map());
|
|
@@ -3096,69 +3097,68 @@ class Wt {
|
|
|
3096
3097
|
o(this, "Xa", /* @__PURE__ */ new Map());
|
|
3097
3098
|
o(this, "Ya", /* @__PURE__ */ new Map());
|
|
3098
3099
|
o(this, "Ka", /* @__PURE__ */ new Map());
|
|
3099
|
-
|
|
3100
|
-
this.Ha = t;
|
|
3100
|
+
this.za = t;
|
|
3101
3101
|
}
|
|
3102
|
-
|
|
3102
|
+
Wa(t) {
|
|
3103
3103
|
for (const e of t) {
|
|
3104
|
-
if (this.
|
|
3105
|
-
const i = this.
|
|
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);
|
|
3106
3106
|
try {
|
|
3107
|
-
const s = e.install(this.
|
|
3107
|
+
const s = e.install(this.za, i);
|
|
3108
3108
|
s instanceof Promise && s.catch((r) => {
|
|
3109
|
-
console.error(`[textmode.js] Async plugin "${e.name}" installation error:`, r), this.
|
|
3109
|
+
console.error(`[textmode.js] Async plugin "${e.name}" installation error:`, r), this.qa(e.name);
|
|
3110
3110
|
});
|
|
3111
3111
|
} catch (s) {
|
|
3112
|
-
throw this.
|
|
3112
|
+
throw this.qa(e.name), s;
|
|
3113
3113
|
}
|
|
3114
|
-
this.
|
|
3114
|
+
this.Ha.set(e.name, e), this.Ba.push(e.name);
|
|
3115
3115
|
}
|
|
3116
3116
|
}
|
|
3117
|
-
async
|
|
3117
|
+
async Va(t) {
|
|
3118
3118
|
for (const e of t) {
|
|
3119
|
-
if (this.
|
|
3120
|
-
const i = this.
|
|
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);
|
|
3121
3121
|
try {
|
|
3122
|
-
await e.install(this.
|
|
3122
|
+
await e.install(this.za, i);
|
|
3123
3123
|
} catch (s) {
|
|
3124
|
-
throw this.
|
|
3124
|
+
throw this.qa(e.name), s;
|
|
3125
3125
|
}
|
|
3126
|
-
this.
|
|
3126
|
+
this.Ha.set(e.name, e), this.Ba.push(e.name);
|
|
3127
3127
|
}
|
|
3128
3128
|
}
|
|
3129
|
-
async
|
|
3130
|
-
const e = this.
|
|
3129
|
+
async Ja(t) {
|
|
3130
|
+
const e = this.Ha.get(t);
|
|
3131
3131
|
if (!e) return;
|
|
3132
|
-
const i = this.
|
|
3133
|
-
e.uninstall && await e.uninstall(this.
|
|
3132
|
+
const i = this.Za(t);
|
|
3133
|
+
e.uninstall && await e.uninstall(this.za, i), this.Ha.delete(t), this.Ba.splice(this.Ba.indexOf(t), 1), this.qa(t);
|
|
3134
|
+
}
|
|
3135
|
+
tc() {
|
|
3136
|
+
this.sc(this.Ia, (t) => t());
|
|
3134
3137
|
}
|
|
3135
|
-
|
|
3136
|
-
this.
|
|
3138
|
+
ec() {
|
|
3139
|
+
this.sc(this.Ga, (t) => t());
|
|
3137
3140
|
}
|
|
3138
|
-
rc() {
|
|
3139
|
-
this.
|
|
3141
|
+
rc(t) {
|
|
3142
|
+
this.sc(this.ja, (e) => e(t));
|
|
3140
3143
|
}
|
|
3141
3144
|
nc(t) {
|
|
3142
|
-
this.
|
|
3145
|
+
this.sc(this.Qa, (e) => e(t));
|
|
3143
3146
|
}
|
|
3144
3147
|
hc(t) {
|
|
3145
|
-
this.
|
|
3148
|
+
this.sc(this.Na, (e) => e(t));
|
|
3146
3149
|
}
|
|
3147
|
-
oc(
|
|
3148
|
-
this.
|
|
3150
|
+
async oc() {
|
|
3151
|
+
await this.ac(this.Xa, (t) => t());
|
|
3149
3152
|
}
|
|
3150
|
-
async
|
|
3151
|
-
await this.
|
|
3153
|
+
async cc() {
|
|
3154
|
+
await this.ac(this.Ya, (t) => t());
|
|
3152
3155
|
}
|
|
3153
3156
|
async lc() {
|
|
3154
|
-
|
|
3157
|
+
const t = [...this.Ha.keys()];
|
|
3158
|
+
for (const e of t) await this.Ja(e);
|
|
3155
3159
|
}
|
|
3156
|
-
|
|
3157
|
-
const
|
|
3158
|
-
for (const e of t) await this.tc(e);
|
|
3159
|
-
}
|
|
3160
|
-
qa(t) {
|
|
3161
|
-
const e = this.Ha, i = this;
|
|
3160
|
+
Za(t) {
|
|
3161
|
+
const e = this.za, i = this;
|
|
3162
3162
|
return { get renderer() {
|
|
3163
3163
|
return e.R;
|
|
3164
3164
|
}, get canvas() {
|
|
@@ -3173,184 +3173,184 @@ class Wt {
|
|
|
3173
3173
|
return e.layers.base.drawFramebuffer;
|
|
3174
3174
|
}, get asciiFramebuffer() {
|
|
3175
3175
|
return e.layers.base.asciiFramebuffer;
|
|
3176
|
-
}, registerPreDrawHook: (s) => i.
|
|
3177
|
-
i.
|
|
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);
|
|
3178
3178
|
}, removeLayerExtension: (s) => {
|
|
3179
|
-
i.
|
|
3179
|
+
i.dc(t, s);
|
|
3180
3180
|
} };
|
|
3181
3181
|
}
|
|
3182
|
-
|
|
3182
|
+
uc(t, e, i) {
|
|
3183
3183
|
const s = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
3184
3184
|
return s.add(i), t.set(e, s), () => {
|
|
3185
3185
|
const r = t.get(e);
|
|
3186
3186
|
r && (r.delete(i), r.size === 0 && t.delete(e));
|
|
3187
3187
|
};
|
|
3188
3188
|
}
|
|
3189
|
-
|
|
3190
|
-
this.
|
|
3191
|
-
const e = this.
|
|
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);
|
|
3192
3192
|
if (e) {
|
|
3193
|
-
for (const i of e.keys()) this.
|
|
3194
|
-
this.
|
|
3193
|
+
for (const i of e.keys()) this.vc(i);
|
|
3194
|
+
this.Ka.delete(t);
|
|
3195
3195
|
}
|
|
3196
3196
|
}
|
|
3197
|
-
|
|
3198
|
-
for (const i of this.
|
|
3197
|
+
sc(t, e) {
|
|
3198
|
+
for (const i of this.Ba) {
|
|
3199
3199
|
const s = t.get(i);
|
|
3200
3200
|
s && s.forEach(e);
|
|
3201
3201
|
}
|
|
3202
3202
|
}
|
|
3203
|
-
async
|
|
3204
|
-
for (const i of this.
|
|
3203
|
+
async ac(t, e) {
|
|
3204
|
+
for (const i of this.Ba) {
|
|
3205
3205
|
const s = t.get(i);
|
|
3206
3206
|
if (s) for (const r of s) await e(r);
|
|
3207
3207
|
}
|
|
3208
3208
|
}
|
|
3209
|
-
|
|
3210
|
-
let s = this.
|
|
3211
|
-
s || (s = /* @__PURE__ */ new Map(), this.
|
|
3212
|
-
for (const [r, h] of this.
|
|
3213
|
-
s.set(e, i), this.
|
|
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);
|
|
3214
3214
|
}
|
|
3215
|
-
|
|
3216
|
-
const i = this.
|
|
3215
|
+
dc(t, e) {
|
|
3216
|
+
const i = this.Ka.get(t);
|
|
3217
3217
|
if (!i) return;
|
|
3218
3218
|
i.delete(e);
|
|
3219
3219
|
let s = !1;
|
|
3220
|
-
for (const [r, h] of this.
|
|
3220
|
+
for (const [r, h] of this.Ka) if (r !== t && h.has(e)) {
|
|
3221
3221
|
s = !0;
|
|
3222
3222
|
const a = h.get(e);
|
|
3223
|
-
this.
|
|
3223
|
+
this.gc(e, a);
|
|
3224
3224
|
break;
|
|
3225
3225
|
}
|
|
3226
|
-
s || this.
|
|
3226
|
+
s || this.vc(e);
|
|
3227
3227
|
}
|
|
3228
|
-
|
|
3229
|
-
const i = Object.getPrototypeOf(this.
|
|
3228
|
+
gc(t, e) {
|
|
3229
|
+
const i = Object.getPrototypeOf(this.za.layers.base);
|
|
3230
3230
|
Object.defineProperty(i, t, { value: e, writable: !0, configurable: !0, enumerable: !1 });
|
|
3231
3231
|
}
|
|
3232
|
-
|
|
3233
|
-
const e = Object.getPrototypeOf(this.
|
|
3232
|
+
vc(t) {
|
|
3233
|
+
const e = Object.getPrototypeOf(this.za.layers.base), i = Object.getOwnPropertyDescriptor(e, t);
|
|
3234
3234
|
i && i.configurable && delete e[t];
|
|
3235
3235
|
}
|
|
3236
3236
|
}
|
|
3237
|
-
const ri = Object.freeze(Object.defineProperty({ __proto__: null, TextmodePluginManager:
|
|
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.);}`,
|
|
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
|
|
3239
3239
|
precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`;
|
|
3240
|
-
class
|
|
3240
|
+
class Wt {
|
|
3241
3241
|
constructor() {
|
|
3242
|
-
o(this, "
|
|
3243
|
-
o(this, "
|
|
3242
|
+
o(this, "mc", /* @__PURE__ */ new Map());
|
|
3243
|
+
o(this, "_c", []);
|
|
3244
|
+
o(this, "yc", 0);
|
|
3244
3245
|
o(this, "wc", 0);
|
|
3245
|
-
o(this, "bc"
|
|
3246
|
-
o(this, "Cc");
|
|
3246
|
+
o(this, "bc");
|
|
3247
3247
|
}
|
|
3248
|
-
get
|
|
3249
|
-
return this.
|
|
3248
|
+
get Cc() {
|
|
3249
|
+
return this.yc;
|
|
3250
3250
|
}
|
|
3251
|
-
get
|
|
3252
|
-
if (this.
|
|
3251
|
+
get xc() {
|
|
3252
|
+
if (this.yc === 0) return 0;
|
|
3253
3253
|
let t = 0;
|
|
3254
|
-
for (const e of this.
|
|
3255
|
-
const i = this.
|
|
3256
|
-
i && (t +=
|
|
3254
|
+
for (const e of this._c) {
|
|
3255
|
+
const i = this.mc.get(e);
|
|
3256
|
+
i && (t += _(i.progress, 0, 1) * i.weight);
|
|
3257
3257
|
}
|
|
3258
|
-
return Math.min(1, t / this.
|
|
3258
|
+
return Math.min(1, t / this.yc);
|
|
3259
3259
|
}
|
|
3260
|
-
|
|
3261
|
-
this.
|
|
3260
|
+
Mc(t) {
|
|
3261
|
+
this.bc = t;
|
|
3262
3262
|
}
|
|
3263
|
-
|
|
3264
|
-
const i = `phase-${this.
|
|
3265
|
-
return this.
|
|
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;
|
|
3266
3266
|
}
|
|
3267
|
-
|
|
3268
|
-
const i = this.
|
|
3267
|
+
$c(t, e) {
|
|
3268
|
+
const i = this.mc.get(t);
|
|
3269
3269
|
if (!i) return;
|
|
3270
|
-
i.progress =
|
|
3271
|
-
const s = this.
|
|
3272
|
-
Math.abs(s - this.
|
|
3270
|
+
i.progress = _(e, 0, 1), i.status = i.progress >= 1 ? "complete" : "running";
|
|
3271
|
+
const s = this.xc;
|
|
3272
|
+
Math.abs(s - this.wc) > 1e-3 && (this.wc = s, this.bc && this.bc(s));
|
|
3273
3273
|
}
|
|
3274
|
-
|
|
3275
|
-
const e = this.
|
|
3276
|
-
e && (e.progress = 1, e.status = "complete", this
|
|
3274
|
+
Pc(t) {
|
|
3275
|
+
const e = this.mc.get(t);
|
|
3276
|
+
e && (e.progress = 1, e.status = "complete", this.$c(t, 1));
|
|
3277
3277
|
}
|
|
3278
|
-
|
|
3279
|
-
const e = this.
|
|
3278
|
+
Tc(t) {
|
|
3279
|
+
const e = this.mc.get(t);
|
|
3280
3280
|
e && (e.status = "failed");
|
|
3281
3281
|
}
|
|
3282
|
-
|
|
3283
|
-
return this.
|
|
3284
|
-
const e = this.
|
|
3282
|
+
Sc() {
|
|
3283
|
+
return this._c.map((t) => {
|
|
3284
|
+
const e = this.mc.get(t);
|
|
3285
3285
|
return e ? { id: e.id, label: e.label, weight: e.weight, progress: e.progress, status: e.status } : { id: t, label: t, weight: 1, progress: 0, status: "pending" };
|
|
3286
3286
|
});
|
|
3287
3287
|
}
|
|
3288
3288
|
}
|
|
3289
3289
|
class Vt {
|
|
3290
3290
|
constructor(t = "active") {
|
|
3291
|
-
o(this, "
|
|
3291
|
+
o(this, "Ec");
|
|
3292
|
+
o(this, "kc", "");
|
|
3292
3293
|
o(this, "Rc", "");
|
|
3293
|
-
|
|
3294
|
-
|
|
3294
|
+
this.Ec = t;
|
|
3295
|
+
}
|
|
3296
|
+
get Dc() {
|
|
3297
|
+
return this.Ec;
|
|
3295
3298
|
}
|
|
3296
3299
|
get Lc() {
|
|
3297
|
-
return this.
|
|
3300
|
+
return this.Ec !== "disabled";
|
|
3298
3301
|
}
|
|
3299
3302
|
get Oc() {
|
|
3300
|
-
return this.
|
|
3303
|
+
return this.Ec === "active" || this.Ec === "transitioning" || this.Ec === "error";
|
|
3301
3304
|
}
|
|
3302
3305
|
get zc() {
|
|
3303
|
-
return this.kc
|
|
3306
|
+
return this.kc;
|
|
3304
3307
|
}
|
|
3305
3308
|
get Hc() {
|
|
3306
3309
|
return this.Rc;
|
|
3307
3310
|
}
|
|
3308
|
-
|
|
3309
|
-
|
|
3311
|
+
Bc() {
|
|
3312
|
+
this.Ec !== "done" && this.Ec !== "transitioning" || (this.Ec = "active");
|
|
3310
3313
|
}
|
|
3311
3314
|
Ic() {
|
|
3312
|
-
this.
|
|
3315
|
+
this.Ec !== "disabled" && (this.Ec = "done");
|
|
3313
3316
|
}
|
|
3314
3317
|
Gc() {
|
|
3315
|
-
this.
|
|
3318
|
+
this.Ec !== "disabled" && (this.Ec = "transitioning");
|
|
3316
3319
|
}
|
|
3317
3320
|
jc() {
|
|
3318
|
-
this.
|
|
3321
|
+
this.Ec === "transitioning" && (this.Ec = "done");
|
|
3319
3322
|
}
|
|
3320
|
-
Qc() {
|
|
3321
|
-
this.
|
|
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 = ""));
|
|
3322
3325
|
}
|
|
3323
|
-
Nc(
|
|
3324
|
-
this.
|
|
3325
|
-
}
|
|
3326
|
-
Xc() {
|
|
3327
|
-
this.kc = "disabled";
|
|
3326
|
+
Nc() {
|
|
3327
|
+
this.Ec = "disabled";
|
|
3328
3328
|
}
|
|
3329
3329
|
}
|
|
3330
|
-
class
|
|
3330
|
+
class Zt {
|
|
3331
3331
|
constructor(t, e) {
|
|
3332
|
-
o(this, "
|
|
3333
|
-
o(this, "
|
|
3332
|
+
o(this, "Xc", 0);
|
|
3333
|
+
o(this, "Yc", 1);
|
|
3334
|
+
o(this, "Kc");
|
|
3334
3335
|
o(this, "Wc");
|
|
3335
|
-
|
|
3336
|
-
this.Wc = t, this.Zc = e;
|
|
3336
|
+
this.Kc = t, this.Wc = e;
|
|
3337
3337
|
}
|
|
3338
|
-
get
|
|
3339
|
-
return this.
|
|
3338
|
+
get Zc() {
|
|
3339
|
+
return this.Yc;
|
|
3340
3340
|
}
|
|
3341
|
-
get
|
|
3342
|
-
return this.
|
|
3341
|
+
get qc() {
|
|
3342
|
+
return this.Yc < 1;
|
|
3343
3343
|
}
|
|
3344
3344
|
rh() {
|
|
3345
|
-
this.
|
|
3345
|
+
this.Kc !== "none" && this.Wc > 0 && (this.Xc = performance.now());
|
|
3346
3346
|
}
|
|
3347
3347
|
N() {
|
|
3348
|
-
if (this.
|
|
3349
|
-
const t = performance.now() - this.
|
|
3350
|
-
return e >= 1 ? (this.
|
|
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);
|
|
3351
3351
|
}
|
|
3352
3352
|
Qs() {
|
|
3353
|
-
this.
|
|
3353
|
+
this.Yc = 1, this.Xc = 0;
|
|
3354
3354
|
}
|
|
3355
3355
|
}
|
|
3356
3356
|
function At(n, t) {
|
|
@@ -3362,24 +3362,24 @@ function At(n, t) {
|
|
|
3362
3362
|
return 0.2126 * l(r) + 0.7152 * l(h) + 0.0722 * l(a);
|
|
3363
3363
|
}(t) > 0.5 ? "light" : "dark"), { mode: i, background: t, textColor: i === "light" ? "#1A1A1A" : "#F8F8F8", subtleColor: i === "light" ? "#4A4A4A" : "#C0C0C0" };
|
|
3364
3364
|
}
|
|
3365
|
-
function
|
|
3365
|
+
function Qt(n) {
|
|
3366
3366
|
return n.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
|
|
3367
3367
|
}
|
|
3368
|
-
function
|
|
3369
|
-
return n.length ? n.map((e) =>
|
|
3368
|
+
function $t(n, t) {
|
|
3369
|
+
return n.length ? n.map((e) => E.yn(e)) : [t.color("#FFFFFF")];
|
|
3370
3370
|
}
|
|
3371
|
-
class
|
|
3371
|
+
class qt {
|
|
3372
3372
|
constructor(t, e, i, s) {
|
|
3373
|
-
this.
|
|
3373
|
+
this.Vc = t, this.id = e, this.label = i, this.Jc = s;
|
|
3374
3374
|
}
|
|
3375
3375
|
report(t) {
|
|
3376
|
-
this.
|
|
3376
|
+
this.Vc.$c(this.id, t);
|
|
3377
3377
|
}
|
|
3378
3378
|
complete() {
|
|
3379
|
-
this.
|
|
3379
|
+
this.Vc.Pc(this.id);
|
|
3380
3380
|
}
|
|
3381
3381
|
fail(t) {
|
|
3382
|
-
this.
|
|
3382
|
+
this.Vc.Tc(this.id), this.Jc && this.Jc(t ?? Error(`Loading phase "${this.label}" failed`));
|
|
3383
3383
|
}
|
|
3384
3384
|
async track(t) {
|
|
3385
3385
|
try {
|
|
@@ -3390,25 +3390,25 @@ class Kt {
|
|
|
3390
3390
|
}
|
|
3391
3391
|
}
|
|
3392
3392
|
}
|
|
3393
|
-
const
|
|
3394
|
-
const f = "|/-\\", g = Math.floor(i / 6) % 4, p =
|
|
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 }) => {
|
|
3394
|
+
const f = "|/-\\", g = Math.floor(i / 6) % 4, p = E.yn(h.textColor), v = Math.floor(255 * l), d = n.color(p.r, p.g, p.b, v);
|
|
3395
3395
|
if (n.charColor(d), n.cellColor(0, 0, 0, 0), u) {
|
|
3396
|
-
const m =
|
|
3396
|
+
const m = E.yn(h.mode === "light" ? "#D32F2F" : "#FF6B6B").withAlpha(v);
|
|
3397
3397
|
n.charColor(m), n.push(), n.translate(0, -2, 0), n.char("X"), n.rect(1, 1), n.pop();
|
|
3398
|
-
const A = "SETUP ERROR",
|
|
3399
|
-
n.push(), n.translate(
|
|
3398
|
+
const A = "SETUP ERROR", b = -Math.floor(A.length / 2);
|
|
3399
|
+
n.push(), n.translate(b, 0, 0);
|
|
3400
3400
|
for (const y of A) n.char(y), n.rect(1, 1), n.translateX(1);
|
|
3401
3401
|
if (n.pop(), c) {
|
|
3402
|
-
const y =
|
|
3402
|
+
const y = E.yn(h.subtleColor), R = n.color(y.r, y.g, y.b, v);
|
|
3403
3403
|
n.charColor(R);
|
|
3404
|
-
const
|
|
3404
|
+
const w = Math.floor(0.8 * t.cols), F = c.split(" "), S = [];
|
|
3405
3405
|
let T = "";
|
|
3406
|
-
for (const C of
|
|
3407
|
-
T &&
|
|
3408
|
-
const U =
|
|
3409
|
-
|
|
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
3410
|
const re = -Math.floor(C.length / 2);
|
|
3411
|
-
n.push(), n.translate(re, 3 +
|
|
3411
|
+
n.push(), n.translate(re, 3 + Q, 0);
|
|
3412
3412
|
for (const ne of C) n.char(ne), n.rect(1, 1), n.translateX(1);
|
|
3413
3413
|
n.pop();
|
|
3414
3414
|
});
|
|
@@ -3416,27 +3416,28 @@ const Ke = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
|
|
|
3416
3416
|
return;
|
|
3417
3417
|
}
|
|
3418
3418
|
if (n.push(), n.translate(0, 0, 0), n.char(f[g]), n.rect(1, 1), n.pop(), e > 0 || a.some((m) => m.status !== "pending")) {
|
|
3419
|
-
const m = Math.max(6, Math.floor(0.6 * t.cols)), A = -Math.floor(m / 2),
|
|
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")];
|
|
3420
3420
|
n.push(), n.translate(A, 3, 0);
|
|
3421
3421
|
for (let R = 0; R < m; R++) {
|
|
3422
|
-
const
|
|
3423
|
-
n.charColor(
|
|
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);
|
|
3424
3424
|
}
|
|
3425
3425
|
n.pop();
|
|
3426
3426
|
}
|
|
3427
3427
|
if (s) {
|
|
3428
|
-
const m =
|
|
3428
|
+
const m = E.yn(h.subtleColor), A = n.color(m.r, m.g, m.b, v);
|
|
3429
3429
|
n.charColor(A);
|
|
3430
|
-
const
|
|
3431
|
-
n.push(), n.translate(
|
|
3430
|
+
const b = -Math.floor(s.length / 2);
|
|
3431
|
+
n.push(), n.translate(b, 5, 0);
|
|
3432
3432
|
for (const y of s) n.char(y), n.rect(1, 1), n.translateX(1);
|
|
3433
3433
|
n.pop();
|
|
3434
3434
|
}
|
|
3435
3435
|
};
|
|
3436
3436
|
class ot {
|
|
3437
3437
|
constructor(t, e = {}) {
|
|
3438
|
+
o(this, "tl");
|
|
3439
|
+
o(this, "Zc");
|
|
3438
3440
|
o(this, "sl");
|
|
3439
|
-
o(this, "qc");
|
|
3440
3441
|
o(this, "el");
|
|
3441
3442
|
o(this, "il");
|
|
3442
3443
|
o(this, "rl");
|
|
@@ -3444,228 +3445,227 @@ class ot {
|
|
|
3444
3445
|
o(this, "hl");
|
|
3445
3446
|
o(this, "ol");
|
|
3446
3447
|
o(this, "al");
|
|
3447
|
-
o(this, "cl");
|
|
3448
3448
|
o(this, "yr");
|
|
3449
|
+
o(this, "cl");
|
|
3449
3450
|
o(this, "ll");
|
|
3450
3451
|
o(this, "ul");
|
|
3451
3452
|
o(this, "fl");
|
|
3452
|
-
o(this, "dl")
|
|
3453
|
-
o(this, "pl", () => {
|
|
3453
|
+
o(this, "dl", () => {
|
|
3454
3454
|
});
|
|
3455
|
-
o(this, "
|
|
3456
|
-
o(this, "
|
|
3457
|
-
this.
|
|
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);
|
|
3458
3458
|
}
|
|
3459
|
-
async
|
|
3460
|
-
this.
|
|
3459
|
+
async ml(t) {
|
|
3460
|
+
this.ol = t, this.yr.Gr || await this.yr.Er(this.hl);
|
|
3461
3461
|
const e = this.yr.maxGlyphDimensions;
|
|
3462
|
-
this.
|
|
3463
|
-
const i = this.
|
|
3464
|
-
this.
|
|
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(() => {
|
|
3465
3465
|
var s, r, h;
|
|
3466
|
-
this.
|
|
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);
|
|
3467
3467
|
});
|
|
3468
3468
|
}
|
|
3469
3469
|
draw(t) {
|
|
3470
|
-
this.
|
|
3470
|
+
this.dl = t;
|
|
3471
3471
|
}
|
|
3472
3472
|
show() {
|
|
3473
|
-
this.
|
|
3473
|
+
this.tl = !0;
|
|
3474
3474
|
}
|
|
3475
3475
|
hide() {
|
|
3476
|
-
this.
|
|
3476
|
+
this.tl = !1;
|
|
3477
3477
|
}
|
|
3478
3478
|
opacity(t) {
|
|
3479
|
-
if (t === void 0) return this.
|
|
3480
|
-
this.
|
|
3479
|
+
if (t === void 0) return this.Zc;
|
|
3480
|
+
this.Zc = _(t, 0, 1);
|
|
3481
3481
|
}
|
|
3482
3482
|
blendMode(t) {
|
|
3483
|
-
if (t === void 0) return this.
|
|
3484
|
-
this.
|
|
3483
|
+
if (t === void 0) return this.sl;
|
|
3484
|
+
this.sl = t;
|
|
3485
3485
|
}
|
|
3486
3486
|
offset(t, e = 0) {
|
|
3487
|
-
if (t === void 0) return { x: this.
|
|
3488
|
-
this.
|
|
3487
|
+
if (t === void 0) return { x: this.el, y: this.il };
|
|
3488
|
+
this.el = t, this.il = e;
|
|
3489
3489
|
}
|
|
3490
3490
|
rotateZ(t) {
|
|
3491
|
-
if (t === void 0) return this.
|
|
3492
|
-
this.
|
|
3491
|
+
if (t === void 0) return this.rl;
|
|
3492
|
+
this.rl = t;
|
|
3493
3493
|
}
|
|
3494
3494
|
filter(t, e) {
|
|
3495
|
-
this.
|
|
3495
|
+
this.pl.push({ name: t, params: e });
|
|
3496
3496
|
}
|
|
3497
3497
|
setPluginState(t, e) {
|
|
3498
|
-
this.
|
|
3498
|
+
this.vl.set(t, e);
|
|
3499
3499
|
}
|
|
3500
3500
|
getPluginState(t) {
|
|
3501
|
-
return this.
|
|
3501
|
+
return this.vl.get(t);
|
|
3502
3502
|
}
|
|
3503
3503
|
hasPluginState(t) {
|
|
3504
|
-
return this.
|
|
3504
|
+
return this.vl.has(t);
|
|
3505
3505
|
}
|
|
3506
3506
|
deletePluginState(t) {
|
|
3507
|
-
return this.
|
|
3507
|
+
return this.vl.delete(t);
|
|
3508
3508
|
}
|
|
3509
3509
|
fontSize(t) {
|
|
3510
3510
|
if (t === void 0) return this.yr.fontSize;
|
|
3511
|
-
yt.m(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) && this.yr.fontSize !== t && (this.yr.Dr(t), this.
|
|
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());
|
|
3512
3512
|
}
|
|
3513
3513
|
async loadFont(t) {
|
|
3514
3514
|
if (!this.yr) throw Error("Layer font not initialized. Ensure layer is attached before loading fonts.");
|
|
3515
|
-
return t instanceof
|
|
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;
|
|
3516
3516
|
}
|
|
3517
|
-
|
|
3518
|
-
if (!this.
|
|
3519
|
-
const i = this.
|
|
3520
|
-
t.
|
|
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;
|
|
3521
3521
|
try {
|
|
3522
|
-
this.
|
|
3522
|
+
this.dl.call(t);
|
|
3523
3523
|
} finally {
|
|
3524
|
-
t.
|
|
3524
|
+
t.Al = void 0;
|
|
3525
3525
|
}
|
|
3526
|
-
this.
|
|
3527
|
-
const r = this.
|
|
3528
|
-
h.begin(), i.xi(e), e.gt({ u_characterTexture: this.yr.fontFramebuffer, u_charsetDimensions: [this.yr.textureColumns, this.yr.textureRows], U2: this.
|
|
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 = [];
|
|
3529
3529
|
}
|
|
3530
3530
|
vn() {
|
|
3531
3531
|
var t;
|
|
3532
|
-
this.
|
|
3532
|
+
this.cl && this.ll && ((t = this.al) == null || t.reset());
|
|
3533
3533
|
}
|
|
3534
3534
|
Ss() {
|
|
3535
3535
|
var t, e, i, s, r, h, a;
|
|
3536
|
-
(t = this.
|
|
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();
|
|
3537
3537
|
}
|
|
3538
3538
|
get texture() {
|
|
3539
3539
|
var t;
|
|
3540
|
-
return (t = this.
|
|
3540
|
+
return (t = this.ll) == null ? void 0 : t.textures[0];
|
|
3541
3541
|
}
|
|
3542
3542
|
get grid() {
|
|
3543
|
-
return this.
|
|
3543
|
+
return this.al;
|
|
3544
3544
|
}
|
|
3545
3545
|
get font() {
|
|
3546
3546
|
return this.yr;
|
|
3547
3547
|
}
|
|
3548
3548
|
get width() {
|
|
3549
|
-
return this.
|
|
3549
|
+
return this.ll ? this.ll.width : 0;
|
|
3550
3550
|
}
|
|
3551
3551
|
get height() {
|
|
3552
|
-
return this.
|
|
3552
|
+
return this.ll ? this.ll.height : 0;
|
|
3553
3553
|
}
|
|
3554
3554
|
get drawFramebuffer() {
|
|
3555
|
-
return this.
|
|
3555
|
+
return this.cl;
|
|
3556
3556
|
}
|
|
3557
3557
|
get asciiFramebuffer() {
|
|
3558
|
-
return this.
|
|
3558
|
+
return this.ll;
|
|
3559
3559
|
}
|
|
3560
|
-
|
|
3561
|
-
if (!this.
|
|
3560
|
+
_l() {
|
|
3561
|
+
if (!this.al || !this.yr) return;
|
|
3562
3562
|
const t = this.yr.maxGlyphDimensions;
|
|
3563
|
-
this.
|
|
3563
|
+
this.al.tn(t.width, t.height), this.cl && this.ll && this.vn();
|
|
3564
3564
|
}
|
|
3565
3565
|
}
|
|
3566
3566
|
const Je = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
|
|
3567
3567
|
class Jt {
|
|
3568
3568
|
constructor(t, e, i) {
|
|
3569
|
-
o(this, "
|
|
3569
|
+
o(this, "za");
|
|
3570
3570
|
o(this, "l");
|
|
3571
|
+
o(this, "bl");
|
|
3572
|
+
o(this, "Vc");
|
|
3571
3573
|
o(this, "Cl");
|
|
3572
|
-
o(this, "Jc");
|
|
3573
3574
|
o(this, "xl");
|
|
3574
3575
|
o(this, "Ml");
|
|
3575
3576
|
o(this, "Fl");
|
|
3576
|
-
o(this, "$l");
|
|
3577
|
-
o(this, "Pl"
|
|
3578
|
-
o(this, "Tl");
|
|
3579
|
-
o(this, "Sl",
|
|
3580
|
-
o(this, "El",
|
|
3581
|
-
o(this, "kl", !1);
|
|
3577
|
+
o(this, "$l", []);
|
|
3578
|
+
o(this, "Pl");
|
|
3579
|
+
o(this, "Tl", performance.now());
|
|
3580
|
+
o(this, "Sl", 0);
|
|
3581
|
+
o(this, "El", !1);
|
|
3582
3582
|
o(this, "Sr", !1);
|
|
3583
|
-
o(this, "
|
|
3584
|
-
this.
|
|
3585
|
-
const s =
|
|
3586
|
-
this
|
|
3587
|
-
r >= 0.999 && this.
|
|
3583
|
+
o(this, "Ll");
|
|
3584
|
+
this.za = t, this.l = { ...Je, ...e ?? {} }, this.bl = new Vt("active"), this.Vc = new Wt(), this.Cl = new Zt(this.l.transition, this.l.transitionDuration), this.xl = new Nt(60), this.Pl = At(this.l, i);
|
|
3585
|
+
const s = Qt(this.Pl);
|
|
3586
|
+
this.$l = $t(s, this.za), this.Fl = this.kl(), this.Vc.Mc((r) => {
|
|
3587
|
+
r >= 0.999 && this.Ic();
|
|
3588
3588
|
});
|
|
3589
3589
|
}
|
|
3590
3590
|
async Er() {
|
|
3591
3591
|
if (this.Sr) return;
|
|
3592
|
-
const t = this.
|
|
3593
|
-
this.
|
|
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;
|
|
3594
3594
|
}
|
|
3595
|
-
get
|
|
3596
|
-
return this.
|
|
3595
|
+
get Oc() {
|
|
3596
|
+
return this.bl.Oc && this.El;
|
|
3597
3597
|
}
|
|
3598
3598
|
rh() {
|
|
3599
|
-
this.
|
|
3599
|
+
this.El || (this.El = !0, this.Tl = performance.now(), this.Sl = 0, this.xl.rh(() => this.Rl()));
|
|
3600
3600
|
}
|
|
3601
3601
|
nh() {
|
|
3602
|
-
this.
|
|
3602
|
+
this.El && (this.El = !1, this.xl.nh());
|
|
3603
3603
|
}
|
|
3604
3604
|
vn() {
|
|
3605
|
-
this.Sr && this.
|
|
3605
|
+
this.Sr && this.Ml.vn();
|
|
3606
3606
|
}
|
|
3607
3607
|
Ss() {
|
|
3608
|
-
this.nh(), this.Sr && (this.
|
|
3608
|
+
this.nh(), this.Sr && (this.Ml.Ss(), this.Sr = !1);
|
|
3609
3609
|
}
|
|
3610
3610
|
get progress() {
|
|
3611
|
-
return this.
|
|
3611
|
+
return this.Vc.xc;
|
|
3612
3612
|
}
|
|
3613
3613
|
message(t) {
|
|
3614
3614
|
return typeof t == "string" && (this.l.message = t), this.l.message;
|
|
3615
3615
|
}
|
|
3616
3616
|
addPhase(t, e = 1) {
|
|
3617
|
-
this.
|
|
3618
|
-
const i = this.
|
|
3619
|
-
return new
|
|
3617
|
+
this.bl.Bc();
|
|
3618
|
+
const i = this.Vc.Fc(t, e);
|
|
3619
|
+
return new qt(this.Vc, i, t, (s) => this.error(s));
|
|
3620
3620
|
}
|
|
3621
|
-
|
|
3622
|
-
this.
|
|
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()));
|
|
3623
3623
|
}
|
|
3624
|
-
|
|
3625
|
-
this.
|
|
3624
|
+
Dl() {
|
|
3625
|
+
this.Ll && this.Ll();
|
|
3626
3626
|
}
|
|
3627
|
-
|
|
3628
|
-
this.
|
|
3627
|
+
Ol(t) {
|
|
3628
|
+
this.Ll = t;
|
|
3629
3629
|
}
|
|
3630
3630
|
error(t) {
|
|
3631
|
-
this.
|
|
3631
|
+
this.bl.Qc(t);
|
|
3632
3632
|
}
|
|
3633
|
-
|
|
3634
|
-
if (this.
|
|
3635
|
-
if (this.
|
|
3636
|
-
return this.
|
|
3637
|
-
this.
|
|
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();
|
|
3638
3638
|
}
|
|
3639
3639
|
}
|
|
3640
|
-
|
|
3640
|
+
zl() {
|
|
3641
3641
|
if (!this.Sr) return;
|
|
3642
|
-
const t = this.
|
|
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 };
|
|
3643
3643
|
t.draw(() => {
|
|
3644
|
-
this.
|
|
3644
|
+
this.za.resetShader(), this.za.clear(), this.za.push();
|
|
3645
3645
|
try {
|
|
3646
|
-
this
|
|
3646
|
+
this.Fl(s);
|
|
3647
3647
|
} finally {
|
|
3648
|
-
this.
|
|
3648
|
+
this.za.pop();
|
|
3649
3649
|
}
|
|
3650
|
-
}), t.
|
|
3650
|
+
}), t.Da(this.za, this.za.Hl);
|
|
3651
3651
|
const r = t.texture;
|
|
3652
|
-
r && (i.xe(...i.state.canvasBackgroundColor), i.xi(this.
|
|
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));
|
|
3653
3653
|
}
|
|
3654
|
-
|
|
3655
|
-
this.
|
|
3654
|
+
Il(t) {
|
|
3655
|
+
this.Pl = At(this.l, t);
|
|
3656
3656
|
}
|
|
3657
|
-
|
|
3658
|
-
const t = this.l.renderer ||
|
|
3657
|
+
kl() {
|
|
3658
|
+
const t = this.l.renderer || qe;
|
|
3659
3659
|
return (e) => {
|
|
3660
|
-
t(e), this.
|
|
3660
|
+
t(e), this.Gl(e);
|
|
3661
3661
|
};
|
|
3662
3662
|
}
|
|
3663
|
-
|
|
3663
|
+
Gl(t) {
|
|
3664
3664
|
const { textmodifier: e, grid: i, frameCount: s, theme: r, transitionOpacity: h } = t, a = [116, 101, 120, 116, 109, 111, 100, 101, 46, 106, 115].map((f) => String.fromCharCode(f)).join(""), l = (i.rows + 1 >> 1) - 2, u = 2 - (i.cols + 1 >> 1), c = r.mode === "light" ? [[233, 30, 99], [156, 39, 176], [255, 111, 0]] : [[142, 249, 243], [241, 91, 181], [255, 155, 113]];
|
|
3665
3665
|
e.push(), e.translate(u, l, 0);
|
|
3666
3666
|
for (let f = 0; f < a.length; f++) {
|
|
3667
|
-
const g = a[f], p = Math.floor(0.1 * s + 0.5 * f) % c.length, [v, d, m] = c[p], A = Math.floor(255 * h),
|
|
3668
|
-
e.charColor(
|
|
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);
|
|
3669
3669
|
}
|
|
3670
3670
|
e.pop();
|
|
3671
3671
|
}
|
|
@@ -3674,140 +3674,140 @@ const Ct = { normal: 0, additive: 1, multiply: 2, screen: 3, subtract: 4, darken
|
|
|
3674
3674
|
class te {
|
|
3675
3675
|
constructor(t, e, i) {
|
|
3676
3676
|
o(this, "R");
|
|
3677
|
-
o(this, "
|
|
3678
|
-
o(this, "
|
|
3679
|
-
o(this, "
|
|
3680
|
-
this.R = t, this.
|
|
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.
|
|
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
3682
|
}
|
|
3683
|
-
|
|
3683
|
+
Nl(t) {
|
|
3684
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);
|
|
3685
3685
|
u && e.disable(e.DEPTH_TEST), c && e.depthMask(!1);
|
|
3686
|
-
const f = this.
|
|
3687
|
-
f.begin(), this.R.xe(...r), f.end(), this.
|
|
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");
|
|
3688
3688
|
for (const g of h) {
|
|
3689
3689
|
const p = g.layer;
|
|
3690
|
-
p.
|
|
3690
|
+
p.tl && this.Xl(g.texture, a, l, g.width, g.height, p.Zc, g.offsetX, g.offsetY, p.rl, p.sl);
|
|
3691
3691
|
}
|
|
3692
|
-
this.
|
|
3692
|
+
this.Yl(s, a, l), e.depthMask(c), u && e.enable(e.DEPTH_TEST);
|
|
3693
3693
|
}
|
|
3694
|
-
|
|
3695
|
-
const f = this.
|
|
3696
|
-
p.begin(), this.R.xi(this.
|
|
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;
|
|
3697
3697
|
}
|
|
3698
|
-
|
|
3699
|
-
const s = this.
|
|
3700
|
-
t.begin(), this.R.xi(this.
|
|
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();
|
|
3701
3701
|
}
|
|
3702
3702
|
vn(t, e) {
|
|
3703
|
-
this.
|
|
3703
|
+
this.fl[0].resize(t, e), this.fl[1].resize(t, e);
|
|
3704
3704
|
}
|
|
3705
3705
|
Ss() {
|
|
3706
|
-
this.
|
|
3706
|
+
this.jl.dispose(), this.fl[0].dispose(), this.fl[1].dispose();
|
|
3707
3707
|
}
|
|
3708
3708
|
}
|
|
3709
3709
|
class ti {
|
|
3710
3710
|
constructor(t = {}) {
|
|
3711
|
+
o(this, "Kl", []);
|
|
3711
3712
|
o(this, "Wl", []);
|
|
3712
|
-
o(this, "Zl",
|
|
3713
|
-
o(this, "ql", !1);
|
|
3713
|
+
o(this, "Zl", !1);
|
|
3714
3714
|
o(this, "l");
|
|
3715
3715
|
this.l = t;
|
|
3716
3716
|
}
|
|
3717
3717
|
async initialize(t) {
|
|
3718
3718
|
var e, i;
|
|
3719
|
-
for (const s of this.
|
|
3720
|
-
this.
|
|
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;
|
|
3721
3721
|
}
|
|
3722
3722
|
get isReady() {
|
|
3723
|
-
return this.
|
|
3723
|
+
return this.Zl;
|
|
3724
3724
|
}
|
|
3725
3725
|
add(t) {
|
|
3726
3726
|
var e, i;
|
|
3727
|
-
return this.
|
|
3727
|
+
return this.Zl ? (this.Kl.push(t), (i = (e = this.l).onAdd) == null || i.call(e, t)) : this.Wl.push(t), t;
|
|
3728
3728
|
}
|
|
3729
3729
|
addMany(t) {
|
|
3730
3730
|
for (const e of t) this.add(e);
|
|
3731
3731
|
return t;
|
|
3732
3732
|
}
|
|
3733
3733
|
remove(t) {
|
|
3734
|
-
const e = this.
|
|
3735
|
-
if (e !== -1) return this.
|
|
3736
|
-
const i = this.
|
|
3737
|
-
return i !== -1 && (this.
|
|
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);
|
|
3738
3738
|
}
|
|
3739
3739
|
removeAt(t) {
|
|
3740
|
-
if (t < 0 || t >= this.
|
|
3741
|
-
const [e] = this.
|
|
3742
|
-
return this.
|
|
3740
|
+
if (t < 0 || t >= this.Kl.length) return;
|
|
3741
|
+
const [e] = this.Kl.splice(t, 1);
|
|
3742
|
+
return this.ql(e), e;
|
|
3743
3743
|
}
|
|
3744
3744
|
move(t, e) {
|
|
3745
3745
|
var r, h;
|
|
3746
|
-
const i = this.
|
|
3746
|
+
const i = this.Kl.indexOf(t);
|
|
3747
3747
|
if (i !== -1) {
|
|
3748
|
-
this.
|
|
3749
|
-
const a =
|
|
3750
|
-
return this.
|
|
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;
|
|
3751
3751
|
}
|
|
3752
|
-
const s = this.
|
|
3752
|
+
const s = this.Wl.indexOf(t);
|
|
3753
3753
|
if (s !== -1) {
|
|
3754
|
-
this.
|
|
3755
|
-
const a =
|
|
3756
|
-
return this.
|
|
3754
|
+
this.Wl.splice(s, 1);
|
|
3755
|
+
const a = _(e, 0, this.Wl.length);
|
|
3756
|
+
return this.Wl.splice(a, 0, t), !0;
|
|
3757
3757
|
}
|
|
3758
3758
|
return !1;
|
|
3759
3759
|
}
|
|
3760
3760
|
swap(t, e) {
|
|
3761
3761
|
var a, l;
|
|
3762
3762
|
if (t === e) return !0;
|
|
3763
|
-
const i = this.
|
|
3764
|
-
if (i !== -1 && s !== -1) return this.
|
|
3765
|
-
const r = this.
|
|
3766
|
-
return r !== -1 && h !== -1 && (this.
|
|
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);
|
|
3767
3767
|
}
|
|
3768
3768
|
clear() {
|
|
3769
|
-
for (const t of this.
|
|
3769
|
+
for (const t of this.Kl) this.ql(t);
|
|
3770
|
+
this.Kl = [];
|
|
3771
|
+
for (const t of this.Wl) this.ql(t);
|
|
3770
3772
|
this.Wl = [];
|
|
3771
|
-
for (const t of this.Zl) this.Vl(t);
|
|
3772
|
-
this.Zl = [];
|
|
3773
3773
|
}
|
|
3774
3774
|
dispose() {
|
|
3775
|
-
this.clear(), this.
|
|
3775
|
+
this.clear(), this.Zl = !1;
|
|
3776
3776
|
}
|
|
3777
3777
|
get all() {
|
|
3778
|
-
return this.
|
|
3778
|
+
return this.Kl;
|
|
3779
3779
|
}
|
|
3780
3780
|
get pending() {
|
|
3781
|
-
return this.
|
|
3781
|
+
return this.Wl;
|
|
3782
3782
|
}
|
|
3783
3783
|
get length() {
|
|
3784
|
-
return this.
|
|
3784
|
+
return this.Kl.length;
|
|
3785
3785
|
}
|
|
3786
3786
|
get totalLength() {
|
|
3787
|
-
return this.
|
|
3787
|
+
return this.Kl.length + this.Wl.length;
|
|
3788
3788
|
}
|
|
3789
3789
|
get isEmpty() {
|
|
3790
|
-
return this.
|
|
3790
|
+
return this.Kl.length === 0;
|
|
3791
3791
|
}
|
|
3792
3792
|
get(t) {
|
|
3793
|
-
return this.
|
|
3793
|
+
return this.Kl[t];
|
|
3794
3794
|
}
|
|
3795
3795
|
get first() {
|
|
3796
|
-
return this.
|
|
3796
|
+
return this.Kl[0];
|
|
3797
3797
|
}
|
|
3798
3798
|
get last() {
|
|
3799
|
-
return this.
|
|
3799
|
+
return this.Kl[this.Kl.length - 1];
|
|
3800
3800
|
}
|
|
3801
3801
|
indexOf(t) {
|
|
3802
|
-
return this.
|
|
3802
|
+
return this.Kl.indexOf(t);
|
|
3803
3803
|
}
|
|
3804
3804
|
has(t) {
|
|
3805
|
-
return this.
|
|
3805
|
+
return this.Kl.includes(t) || this.Wl.includes(t);
|
|
3806
3806
|
}
|
|
3807
3807
|
[Symbol.iterator]() {
|
|
3808
|
-
return this.
|
|
3808
|
+
return this.Kl[Symbol.iterator]();
|
|
3809
3809
|
}
|
|
3810
|
-
|
|
3810
|
+
ql(t) {
|
|
3811
3811
|
var e, i, s, r;
|
|
3812
3812
|
(i = (e = this.l).onRemove) == null || i.call(e, t), (r = (s = this.l).onDispose) == null || r.call(s, t);
|
|
3813
3813
|
}
|
|
@@ -3815,20 +3815,20 @@ class ti {
|
|
|
3815
3815
|
class ee {
|
|
3816
3816
|
constructor(t) {
|
|
3817
3817
|
o(this, "R");
|
|
3818
|
+
o(this, "Vl", /* @__PURE__ */ new Map());
|
|
3818
3819
|
o(this, "Jl", /* @__PURE__ */ new Map());
|
|
3819
|
-
o(this, "tu", /* @__PURE__ */ new Map());
|
|
3820
3820
|
o(this, "Ke");
|
|
3821
|
-
o(this, "
|
|
3821
|
+
o(this, "fl");
|
|
3822
3822
|
o(this, "Sr", !1);
|
|
3823
|
-
this.R = t, this.Ke = t.Mi(
|
|
3823
|
+
this.R = t, this.Ke = t.Mi(W, Kt), this.tu();
|
|
3824
3824
|
}
|
|
3825
3825
|
async register(t, e, i = {}) {
|
|
3826
3826
|
const s = Object.entries(i), r = s.length > 0 ? s[0][1][0] : null;
|
|
3827
3827
|
let h;
|
|
3828
3828
|
if (typeof e == "string") {
|
|
3829
3829
|
const l = await st(e);
|
|
3830
|
-
h = this.R.Mi(
|
|
3831
|
-
} else h = e, this.
|
|
3830
|
+
h = this.R.Mi(W, l), this.Jl.set(t, h);
|
|
3831
|
+
} else h = e, this.Jl.set(t, h);
|
|
3832
3832
|
const a = { id: t, createShader: () => h, createUniforms: (l, u) => {
|
|
3833
3833
|
const c = { u_resolution: [u.width, u.height] };
|
|
3834
3834
|
for (const [f, [g, p]] of s) {
|
|
@@ -3844,208 +3844,208 @@ class ee {
|
|
|
3844
3844
|
}
|
|
3845
3845
|
return c;
|
|
3846
3846
|
} };
|
|
3847
|
-
this.
|
|
3847
|
+
this.Vl.set(t, a);
|
|
3848
3848
|
}
|
|
3849
3849
|
unregister(t) {
|
|
3850
|
-
const e = this.
|
|
3851
|
-
return e && (e.dispose(), this.
|
|
3850
|
+
const e = this.Jl.get(t);
|
|
3851
|
+
return e && (e.dispose(), this.Jl.delete(t)), this.Vl.delete(t);
|
|
3852
3852
|
}
|
|
3853
3853
|
has(t) {
|
|
3854
|
-
return this.
|
|
3854
|
+
return this.Vl.has(t);
|
|
3855
3855
|
}
|
|
3856
3856
|
Er(t, e) {
|
|
3857
|
-
this.Sr || (this.
|
|
3857
|
+
this.Sr || (this.fl = [this.R.Hi(t, e, 1, { depth: !1 }), this.R.Hi(t, e, 1, { depth: !1 })], this.Sr = !0);
|
|
3858
3858
|
}
|
|
3859
|
-
|
|
3860
|
-
this.
|
|
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);
|
|
3861
3861
|
}
|
|
3862
|
-
|
|
3863
|
-
if (i.length === 0) return void this.
|
|
3864
|
-
this.
|
|
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);
|
|
3865
3865
|
let a = 0;
|
|
3866
3866
|
for (let l = 0; l < i.length; l++) {
|
|
3867
3867
|
const u = i[l], c = l === i.length - 1, f = a === 0 ? 1 : 0, g = c ? e : h[f];
|
|
3868
|
-
this.
|
|
3868
|
+
this.iu(u, h[a], g, s, r), c || (a = f);
|
|
3869
3869
|
}
|
|
3870
3870
|
}
|
|
3871
|
-
|
|
3872
|
-
const h = this.
|
|
3873
|
-
if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.
|
|
3874
|
-
const a = this.
|
|
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
3875
|
i.begin(), this.R.xi(a), a.gt({ u_texture: e.textures[0] });
|
|
3876
3876
|
const u = h.createUniforms(t.params, l);
|
|
3877
3877
|
a.gt(u), this.R.Ei(0, 0, s, r), i.end();
|
|
3878
3878
|
}
|
|
3879
|
-
|
|
3880
|
-
let r = this.
|
|
3879
|
+
ru(t, e, i, s) {
|
|
3880
|
+
let r = this.Jl.get(t);
|
|
3881
3881
|
if (!r && e) {
|
|
3882
3882
|
const h = { renderer: this.R, gl: this.R.context, width: i, height: s };
|
|
3883
|
-
r = e.createShader(h), this.
|
|
3883
|
+
r = e.createShader(h), this.Jl.set(t, r);
|
|
3884
3884
|
}
|
|
3885
3885
|
return r;
|
|
3886
3886
|
}
|
|
3887
|
-
|
|
3887
|
+
eu(t, e, i, s) {
|
|
3888
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();
|
|
3889
3889
|
}
|
|
3890
3890
|
vn(t, e) {
|
|
3891
|
-
this.
|
|
3891
|
+
this.fl && (this.fl[0].resize(t, e), this.fl[1].resize(t, e));
|
|
3892
3892
|
}
|
|
3893
3893
|
Ss() {
|
|
3894
|
-
for (const t of this.
|
|
3895
|
-
this.
|
|
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;
|
|
3896
3896
|
}
|
|
3897
|
-
|
|
3897
|
+
tu() {
|
|
3898
3898
|
this.register("invert", `#version 300 es
|
|
3899
3899
|
precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);fragColor=vec4(1.-A.rgb,A.a);}`, {}), this.register("grayscale", `#version 300 es
|
|
3900
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3901
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3902
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3900
|
+
precision highp float;uniform sampler2D u_texture;uniform float Ue;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));vec3 C=mix(A.rgb,vec3(B),Ue);fragColor=vec4(C,A.a);}`, { Ue: ["amount", 1] }), this.register("sepia", `#version 300 es
|
|
3901
|
+
precision highp float;uniform sampler2D u_texture;uniform float Ue;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);vec3 B;B.r=dot(A.rgb,vec3(0.393,0.769,0.189));B.g=dot(A.rgb,vec3(0.349,0.686,0.168));B.b=dot(A.rgb,vec3(0.272,0.534,0.131));vec3 C=mix(A.rgb,B,Ue);fragColor=vec4(C,A.a);}`, { Ue: ["amount", 1] }), this.register("threshold", `#version 300 es
|
|
3902
|
+
precision highp float;uniform sampler2D u_texture;uniform float Ui;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));float C=step(Ui,B);fragColor=vec4(vec3(C),A.a);}`, { Ui: ["threshold", 0.5] });
|
|
3903
3903
|
}
|
|
3904
3904
|
}
|
|
3905
3905
|
const ni = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFilterManager: ee }, Symbol.toStringTag, { value: "Module" }));
|
|
3906
3906
|
class ie {
|
|
3907
3907
|
constructor(t, e) {
|
|
3908
|
-
o(this, "
|
|
3908
|
+
o(this, "za");
|
|
3909
3909
|
o(this, "R");
|
|
3910
|
+
o(this, "nu");
|
|
3910
3911
|
o(this, "hu");
|
|
3911
3912
|
o(this, "ou");
|
|
3912
3913
|
o(this, "au");
|
|
3913
|
-
o(this, "
|
|
3914
|
-
o(this, "
|
|
3915
|
-
o(this, "lu",
|
|
3916
|
-
o(this, "uu"
|
|
3914
|
+
o(this, "Zl", !1);
|
|
3915
|
+
o(this, "cu", /* @__PURE__ */ new Set());
|
|
3916
|
+
o(this, "lu", []);
|
|
3917
|
+
o(this, "uu");
|
|
3917
3918
|
o(this, "fu");
|
|
3918
|
-
|
|
3919
|
-
this.Ha = t, this.R = t.R, this.ou = new ee(this.R), this.hu = new te(this.R, this.Ha.Xr.width, this.Ha.Xr.height), this.au = new ti({ onRemove: (i) => this.Ha.Al.nc(i), onDispose: (i) => i == null ? void 0 : i.Ss() }), this.cu = new ot(this.R, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
|
|
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 });
|
|
3920
3920
|
}
|
|
3921
3921
|
async Er() {
|
|
3922
|
-
await this.
|
|
3923
|
-
const t = this.
|
|
3924
|
-
this.
|
|
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;
|
|
3925
3925
|
}
|
|
3926
|
-
|
|
3927
|
-
this.
|
|
3926
|
+
pu(t, e) {
|
|
3927
|
+
this.lu.push({ name: t, params: e });
|
|
3928
3928
|
}
|
|
3929
|
-
|
|
3930
|
-
this.
|
|
3929
|
+
vu() {
|
|
3930
|
+
this.lu = [];
|
|
3931
3931
|
}
|
|
3932
3932
|
add(t = {}) {
|
|
3933
3933
|
const e = new ot(this.R, t);
|
|
3934
|
-
return this.
|
|
3934
|
+
return this.ou.isReady && this.du(e), this.ou.add(e), e;
|
|
3935
3935
|
}
|
|
3936
3936
|
remove(t) {
|
|
3937
|
-
this.
|
|
3937
|
+
this.ou.remove(t);
|
|
3938
3938
|
}
|
|
3939
3939
|
move(t, e) {
|
|
3940
|
-
this.
|
|
3940
|
+
this.ou.move(t, e);
|
|
3941
3941
|
}
|
|
3942
3942
|
swap(t, e) {
|
|
3943
|
-
this.
|
|
3943
|
+
this.ou.swap(t, e);
|
|
3944
3944
|
}
|
|
3945
3945
|
clear() {
|
|
3946
|
-
this.
|
|
3946
|
+
this.ou.clear();
|
|
3947
3947
|
}
|
|
3948
|
-
|
|
3949
|
-
this.
|
|
3948
|
+
gu(t) {
|
|
3949
|
+
this.za.yl.tc(), this.au.Da(this.za, this.za.Hl);
|
|
3950
3950
|
const e = [...this.R.state.canvasBackgroundColor];
|
|
3951
|
-
this.
|
|
3952
|
-
}
|
|
3953
|
-
|
|
3954
|
-
this.
|
|
3955
|
-
let t = this.
|
|
3956
|
-
if (this.
|
|
3957
|
-
const i = this.
|
|
3958
|
-
this.
|
|
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 = [];
|
|
3959
3959
|
}
|
|
3960
|
-
const e = this.
|
|
3961
|
-
this.R.xe(0, 0, 0, 0), this.R.xi(this.
|
|
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();
|
|
3962
3962
|
}
|
|
3963
|
-
|
|
3964
|
-
const i = this.
|
|
3963
|
+
mu(t, e) {
|
|
3964
|
+
const i = this.za.Xr, s = this.au.grid, r = this.au.texture;
|
|
3965
3965
|
if (!r) return;
|
|
3966
|
-
const h = { layer: this.
|
|
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) => {
|
|
3967
3967
|
const u = l.grid;
|
|
3968
|
-
return { layer: l, texture: l.texture, width: u.width, height: u.height, offsetX: u.offsetX + l.
|
|
3968
|
+
return { layer: l, texture: l.texture, width: u.width, height: u.height, offsetX: u.offsetX + l.el, offsetY: u.offsetY + l.il };
|
|
3969
3969
|
});
|
|
3970
|
-
this.
|
|
3970
|
+
this.nu.Nl({ base: h, layers: a, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
|
|
3971
3971
|
}
|
|
3972
3972
|
vn() {
|
|
3973
3973
|
var e, i, s;
|
|
3974
|
-
if (!this.
|
|
3975
|
-
const t = this.
|
|
3976
|
-
this.
|
|
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);
|
|
3977
3977
|
}
|
|
3978
3978
|
Ss() {
|
|
3979
3979
|
var t, e;
|
|
3980
|
-
this.
|
|
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 = [];
|
|
3981
3981
|
}
|
|
3982
3982
|
get all() {
|
|
3983
|
-
return this.
|
|
3983
|
+
return this.ou.all;
|
|
3984
3984
|
}
|
|
3985
3985
|
get base() {
|
|
3986
|
-
return this.
|
|
3986
|
+
return this.au;
|
|
3987
3987
|
}
|
|
3988
3988
|
get filters() {
|
|
3989
|
-
return this.
|
|
3989
|
+
return this.hu;
|
|
3990
3990
|
}
|
|
3991
3991
|
get resultFramebuffer() {
|
|
3992
|
-
return this.
|
|
3992
|
+
return this.fu;
|
|
3993
3993
|
}
|
|
3994
|
-
|
|
3995
|
-
const t = this.
|
|
3994
|
+
yu() {
|
|
3995
|
+
const t = this.ou.all;
|
|
3996
3996
|
for (let e = t.length - 1; e >= 0; e--) {
|
|
3997
3997
|
const i = t[e];
|
|
3998
|
-
if (i.
|
|
3998
|
+
if (i.tl && i.grid) return i.grid;
|
|
3999
3999
|
}
|
|
4000
|
-
return this.
|
|
4000
|
+
return this.au.grid;
|
|
4001
4001
|
}
|
|
4002
|
-
|
|
4003
|
-
this.
|
|
4002
|
+
Au(t) {
|
|
4003
|
+
this.cu.add(t);
|
|
4004
4004
|
}
|
|
4005
|
-
|
|
4006
|
-
for (const t of this.
|
|
4005
|
+
wu() {
|
|
4006
|
+
for (const t of this.cu) t();
|
|
4007
4007
|
}
|
|
4008
|
-
async
|
|
4008
|
+
async du(t) {
|
|
4009
4009
|
var i;
|
|
4010
|
-
const e = { renderer: this.R, canvas: this.
|
|
4011
|
-
await t.
|
|
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());
|
|
4012
4012
|
}
|
|
4013
4013
|
}
|
|
4014
|
-
const ei = { id: "brightness", createShader: ({ gl: n }) => new
|
|
4014
|
+
const ei = { id: "brightness", createShader: ({ gl: n }) => new K(n, ht, `#version 300 es
|
|
4015
4015
|
precision highp float;in vec2 v_uv;uniform sampler2D u_image;uniform bool u_invert;uniform bool u_flipX;uniform bool u_flipY;uniform float u_charRotation;uniform bool u_charColorFixed;uniform vec4 u_charColor;uniform bool u_cellColorFixed;uniform vec4 u_cellColor;uniform vec4 u_backgroundColor;uniform int u_charCount;uniform vec3 u_charList[255];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;float B(vec3 C){return dot(C,vec3(0.299f,0.587f,0.114f));}void main(){vec2 D=vec2(v_uv.x,1.0f-v_uv.y);vec4 E=texture(u_image,D);float F=B(E.rgb);vec2 G=vec2(0.);if(u_charCount>0){float H=float(u_charCount);float I=clamp(F*(H-1.0f),0.0f,H-1.0f);int J=int(floor(I+0.5f));vec3 K=u_charList[J];G=K.xy;}else{G=vec2(0.0f,0.0f);}vec4 L=u_charColorFixed?u_charColor:E;vec4 M=u_cellColorFixed?u_cellColor:E;if(E.a<0.01f){discard;}o_primaryColor=vec4(L.rgb,L.a);o_secondaryColor=vec4(M.rgb,M.a);A=vec4(0.);int N=int(u_invert?1:0);int O=int(u_flipX?1:0);int P=int(u_flipY?1:0);float Q=float(N|(O<<1)|(P<<2))/255.;o_character=vec4(G,Q,clamp(u_charRotation,0.0f,1.0f));}`), createUniforms: ({ source: n }) => n.createBaseConversionUniforms() };
|
|
4016
4016
|
class se {
|
|
4017
4017
|
constructor() {
|
|
4018
|
-
o(this, "
|
|
4019
|
-
o(this, "
|
|
4020
|
-
this.
|
|
4018
|
+
o(this, "bu", /* @__PURE__ */ new Map());
|
|
4019
|
+
o(this, "Jl", /* @__PURE__ */ new Map());
|
|
4020
|
+
this.Cu();
|
|
4021
4021
|
}
|
|
4022
4022
|
register(t) {
|
|
4023
|
-
this.
|
|
4023
|
+
this.bu.set(t.id, t);
|
|
4024
4024
|
}
|
|
4025
4025
|
unregister(t) {
|
|
4026
|
-
const e = this.
|
|
4027
|
-
return e && (e.dispose(), this.
|
|
4026
|
+
const e = this.Jl.get(t);
|
|
4027
|
+
return e && (e.dispose(), this.Jl.delete(t)), this.bu.delete(t);
|
|
4028
4028
|
}
|
|
4029
4029
|
has(t) {
|
|
4030
|
-
return this.
|
|
4030
|
+
return this.bu.has(t);
|
|
4031
4031
|
}
|
|
4032
4032
|
Qn(t) {
|
|
4033
|
-
return this.
|
|
4033
|
+
return this.bu.get(t);
|
|
4034
4034
|
}
|
|
4035
4035
|
jn(t, e) {
|
|
4036
|
-
let i = this.
|
|
4036
|
+
let i = this.Jl.get(t);
|
|
4037
4037
|
if (!i) {
|
|
4038
|
-
const s = this.
|
|
4038
|
+
const s = this.bu.get(t);
|
|
4039
4039
|
if (!s) throw Error(`[textmode.js] Conversion mode "${t}" is not registered.`);
|
|
4040
|
-
i = s.createShader(e), this.
|
|
4040
|
+
i = s.createShader(e), this.Jl.set(t, i);
|
|
4041
4041
|
}
|
|
4042
4042
|
return i;
|
|
4043
4043
|
}
|
|
4044
4044
|
Ss() {
|
|
4045
|
-
for (const t of this.
|
|
4046
|
-
this.
|
|
4045
|
+
for (const t of this.Jl.values()) t.dispose();
|
|
4046
|
+
this.Jl.clear(), this.bu.clear();
|
|
4047
4047
|
}
|
|
4048
|
-
|
|
4048
|
+
Cu() {
|
|
4049
4049
|
this.register(ei);
|
|
4050
4050
|
}
|
|
4051
4051
|
}
|
|
@@ -4053,128 +4053,128 @@ const hi = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeConver
|
|
|
4053
4053
|
class ii extends function(e, ...i) {
|
|
4054
4054
|
return i.reduce((s, r) => r(s), e);
|
|
4055
4055
|
}(class {
|
|
4056
|
-
},
|
|
4056
|
+
}, We, Ve, Ze, Qe, $e) {
|
|
4057
4057
|
constructor(e = {}) {
|
|
4058
4058
|
super();
|
|
4059
4059
|
o(this, "R");
|
|
4060
|
+
o(this, "Hl");
|
|
4060
4061
|
o(this, "Bl");
|
|
4061
|
-
o(this, "Il");
|
|
4062
4062
|
o(this, "Xr");
|
|
4063
|
-
o(this, "
|
|
4064
|
-
o(this, "
|
|
4063
|
+
o(this, "Ra");
|
|
4064
|
+
o(this, "bo");
|
|
4065
|
+
o(this, "La");
|
|
4065
4066
|
o(this, "Oa");
|
|
4066
|
-
o(this, "
|
|
4067
|
+
o(this, "xu");
|
|
4067
4068
|
o(this, "Mu");
|
|
4068
|
-
o(this, "Fu");
|
|
4069
|
-
o(this, "wl");
|
|
4070
|
-
o(this, "En");
|
|
4071
|
-
o(this, "$u", /* @__PURE__ */ new Set());
|
|
4072
4069
|
o(this, "Al");
|
|
4070
|
+
o(this, "En");
|
|
4071
|
+
o(this, "Fu", /* @__PURE__ */ new Set());
|
|
4072
|
+
o(this, "yl");
|
|
4073
|
+
o(this, "$u", !1);
|
|
4073
4074
|
o(this, "Pu", !1);
|
|
4074
4075
|
o(this, "Tu", !1);
|
|
4075
4076
|
o(this, "Su", !1);
|
|
4076
|
-
o(this, "Eu",
|
|
4077
|
-
o(this, "ku", () => {
|
|
4077
|
+
o(this, "Eu", () => {
|
|
4078
4078
|
});
|
|
4079
|
-
o(this, "
|
|
4079
|
+
o(this, "ku", () => {
|
|
4080
4080
|
});
|
|
4081
|
+
o(this, "Ru");
|
|
4081
4082
|
o(this, "Du");
|
|
4082
4083
|
o(this, "Lu");
|
|
4083
|
-
o(this, "Ou");
|
|
4084
4084
|
o(this, "rn", !1);
|
|
4085
|
+
o(this, "Ou");
|
|
4085
4086
|
o(this, "zu");
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
Ra(e) {
|
|
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) {
|
|
4095
4095
|
var i;
|
|
4096
|
-
this
|
|
4097
|
-
this
|
|
4096
|
+
this.Fu.add(e), (i = e.C) == null || i.call(e, () => {
|
|
4097
|
+
this.Fu.delete(e);
|
|
4098
4098
|
});
|
|
4099
4099
|
}
|
|
4100
|
-
async
|
|
4101
|
-
await this.
|
|
4102
|
-
const e = this.
|
|
4103
|
-
this.
|
|
4104
|
-
this.
|
|
4105
|
-
}), this.rn && (this.
|
|
4100
|
+
async Bu() {
|
|
4101
|
+
await this.Mu.Er(), await this.xu.Er();
|
|
4102
|
+
const e = this.Mu.base.grid;
|
|
4103
|
+
this.Mu.Au(() => {
|
|
4104
|
+
this.bo.Wh(), this.La.Wh();
|
|
4105
|
+
}), this.rn && (this.Ou = V.Nn(this.R, this.En, this.Xr.targetCanvas, e.cols, e.rows)), this.Iu(), this.Ra.rh(() => this.Da());
|
|
4106
4106
|
try {
|
|
4107
|
-
await this.
|
|
4107
|
+
await this.yl.oc(), await this.Eu(), await this.yl.cc(), this.xu.Ic();
|
|
4108
4108
|
} catch (i) {
|
|
4109
|
-
console.error("Error during setup:", i), this.
|
|
4109
|
+
console.error("Error during setup:", i), this.xu.error(i);
|
|
4110
4110
|
}
|
|
4111
4111
|
}
|
|
4112
|
-
|
|
4113
|
-
this.
|
|
4114
|
-
this.rn && this.resizeCanvas(this.Xr.targetCanvas.width, this.Xr.targetCanvas.height), this.
|
|
4115
|
-
}, window.addEventListener("resize", this.
|
|
4116
|
-
this.
|
|
4117
|
-
}, window.addEventListener("blur", this.
|
|
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(() => {
|
|
4118
4118
|
this.resizeCanvas(this.Xr.targetCanvas.width, this.Xr.targetCanvas.height);
|
|
4119
|
-
}), this.
|
|
4119
|
+
}), this.Lu.observe(this.Xr.targetCanvas));
|
|
4120
4120
|
}
|
|
4121
|
-
|
|
4122
|
-
if (!this.
|
|
4123
|
-
this.
|
|
4121
|
+
Da() {
|
|
4122
|
+
if (!this.xu.Oc && this.Su) {
|
|
4123
|
+
this.Pu = !0;
|
|
4124
4124
|
try {
|
|
4125
|
-
this.
|
|
4125
|
+
this.Ra.uh(), this.Ra.mh(), this.rn && rt(this.R.context, this.Ou.texture, this.Xr.targetCanvas), this.Mu._u();
|
|
4126
4126
|
} finally {
|
|
4127
|
-
this.
|
|
4127
|
+
this.Pu = !1, this.$u && !this.Tu && this.Gu();
|
|
4128
4128
|
}
|
|
4129
4129
|
}
|
|
4130
4130
|
}
|
|
4131
4131
|
resizeCanvas(e, i) {
|
|
4132
4132
|
var s;
|
|
4133
|
-
this.Xr.vn(e, i), this.
|
|
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();
|
|
4134
4134
|
}
|
|
4135
4135
|
destroy() {
|
|
4136
|
-
this.
|
|
4136
|
+
this.Tu || this.$u || (this.$u = !0, this.Ra.hh(), this.Pu || this.Gu());
|
|
4137
4137
|
}
|
|
4138
|
-
|
|
4138
|
+
Gu() {
|
|
4139
4139
|
var e, i, s, r;
|
|
4140
|
-
this
|
|
4141
|
-
for (const h of this
|
|
4142
|
-
this
|
|
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;
|
|
4143
4143
|
}
|
|
4144
4144
|
filter(e, i) {
|
|
4145
|
-
this.
|
|
4145
|
+
this.Mu.pu(e, i);
|
|
4146
4146
|
}
|
|
4147
4147
|
draw(e) {
|
|
4148
|
-
this.
|
|
4148
|
+
this.Mu.base.draw(e);
|
|
4149
4149
|
}
|
|
4150
4150
|
async loadFont(e, i = !0) {
|
|
4151
|
-
if (i) return await this.
|
|
4152
|
-
if (e instanceof
|
|
4153
|
-
const s = new
|
|
4154
|
-
return await s.Er(e), this.
|
|
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;
|
|
4155
4155
|
}
|
|
4156
4156
|
fontSize(e) {
|
|
4157
|
-
return this.
|
|
4157
|
+
return this.Mu.base.fontSize(e);
|
|
4158
4158
|
}
|
|
4159
4159
|
inputGrid(e) {
|
|
4160
|
-
return e === void 0 ? this.
|
|
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());
|
|
4161
4161
|
}
|
|
4162
|
-
|
|
4163
|
-
return this.
|
|
4162
|
+
Hu() {
|
|
4163
|
+
return this.zu ? this.zu : this.Mu.yu();
|
|
4164
4164
|
}
|
|
4165
4165
|
async setup(e) {
|
|
4166
|
-
this.
|
|
4166
|
+
this.Eu = e;
|
|
4167
4167
|
}
|
|
4168
4168
|
windowResized(e) {
|
|
4169
|
-
this.
|
|
4169
|
+
this.ku = e;
|
|
4170
4170
|
}
|
|
4171
4171
|
get grid() {
|
|
4172
4172
|
var e;
|
|
4173
|
-
return ((e = this.
|
|
4173
|
+
return ((e = this.Al) == null ? void 0 : e.grid) ?? this.Mu.base.grid;
|
|
4174
4174
|
}
|
|
4175
4175
|
get font() {
|
|
4176
4176
|
var e;
|
|
4177
|
-
return ((e = this.
|
|
4177
|
+
return ((e = this.Al) == null ? void 0 : e.font) ?? this.Mu.base.font;
|
|
4178
4178
|
}
|
|
4179
4179
|
get width() {
|
|
4180
4180
|
return this.Xr.width;
|
|
@@ -4186,28 +4186,28 @@ precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charse
|
|
|
4186
4186
|
return this.Xr.canvas;
|
|
4187
4187
|
}
|
|
4188
4188
|
get isDisposed() {
|
|
4189
|
-
return this.
|
|
4189
|
+
return this.Tu;
|
|
4190
4190
|
}
|
|
4191
4191
|
get overlay() {
|
|
4192
|
-
return this.
|
|
4192
|
+
return this.Ou;
|
|
4193
4193
|
}
|
|
4194
4194
|
get loading() {
|
|
4195
|
-
return this.
|
|
4195
|
+
return this.xu;
|
|
4196
4196
|
}
|
|
4197
4197
|
get layers() {
|
|
4198
|
-
return this.
|
|
4198
|
+
return this.Mu;
|
|
4199
4199
|
}
|
|
4200
4200
|
get filters() {
|
|
4201
|
-
return this.
|
|
4201
|
+
return this.Mu.filters;
|
|
4202
4202
|
}
|
|
4203
4203
|
get conversions() {
|
|
4204
4204
|
return this.En;
|
|
4205
4205
|
}
|
|
4206
4206
|
get isRenderingFrame() {
|
|
4207
|
-
return this.
|
|
4207
|
+
return this.Pu;
|
|
4208
4208
|
}
|
|
4209
4209
|
}
|
|
4210
|
-
class
|
|
4210
|
+
class xt {
|
|
4211
4211
|
constructor() {
|
|
4212
4212
|
}
|
|
4213
4213
|
static create(t = {}) {
|
|
@@ -4217,18 +4217,18 @@ class Et {
|
|
|
4217
4217
|
yt._(t);
|
|
4218
4218
|
}
|
|
4219
4219
|
static get version() {
|
|
4220
|
-
return "0.9.
|
|
4220
|
+
return "0.9.2";
|
|
4221
4221
|
}
|
|
4222
4222
|
}
|
|
4223
|
-
const oi = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase:
|
|
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;
|
|
4224
4224
|
export {
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4225
|
+
He as TextmodeCanvas,
|
|
4226
|
+
E as TextmodeColor,
|
|
4227
|
+
P as TextmodeError,
|
|
4228
4228
|
ae as TextmodeErrorLevel,
|
|
4229
4229
|
vt as TextmodeFramebuffer,
|
|
4230
|
-
|
|
4231
|
-
|
|
4230
|
+
Ye as TextmodeGrid,
|
|
4231
|
+
K as TextmodeShader,
|
|
4232
4232
|
ii as Textmodifier,
|
|
4233
4233
|
hi as conversion,
|
|
4234
4234
|
ui as create,
|
|
@@ -4239,6 +4239,6 @@ export {
|
|
|
4239
4239
|
oi as loading,
|
|
4240
4240
|
ri as plugins,
|
|
4241
4241
|
fi as setErrorLevel,
|
|
4242
|
-
|
|
4242
|
+
xt as textmode,
|
|
4243
4243
|
di as version
|
|
4244
4244
|
};
|