textmode.js 0.6.0-beta.4 → 0.6.0-beta.5
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 +1480 -1480
- package/dist/textmode.umd.js +10 -10
- package/package.json +1 -1
package/dist/textmode.esm.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (n, t, e) =>
|
|
4
|
-
class
|
|
1
|
+
var Xt = Object.defineProperty;
|
|
2
|
+
var Yt = (n, t, e) => t in n ? Xt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var a = (n, t, e) => Yt(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
class B extends Error {
|
|
5
5
|
constructor(t, e = {}) {
|
|
6
|
-
super(
|
|
6
|
+
super(B.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}: ${B.o(s)}`).join("") : ""}
|
|
13
13
|
|
|
14
14
|
${"↓".repeat(24)}
|
|
15
15
|
`;
|
|
@@ -19,15 +19,15 @@ ${"↓".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) => B.o(e)).join(", ")}]` : `[${t.slice(0, 3).map((e) => B.o(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}: ${B.o(t[i])}`).join(", ")} }` : `{ ${e.slice(0, 2).map((i) => `${i}: ${B.o(t[i])}`).join(", ")}, ... +${e.length - 2} more }`;
|
|
26
26
|
}
|
|
27
27
|
return t + "";
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
var
|
|
30
|
+
var zt = ((n) => (n[n.SILENT = 0] = "SILENT", n[n.WARNING = 1] = "WARNING", n[n.ERROR = 2] = "ERROR", n[n.THROW = 3] = "THROW", n))(zt || {});
|
|
31
31
|
const I = class I {
|
|
32
32
|
constructor() {
|
|
33
33
|
a(this, "l", { globalLevel: 3 });
|
|
@@ -41,11 +41,11 @@ const I = class I {
|
|
|
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(B.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(B.i(t, e)), console.groupEnd(), !1;
|
|
47
47
|
default:
|
|
48
|
-
throw new
|
|
48
|
+
throw new B(t, e);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
m(t, e, i) {
|
|
@@ -64,10 +64,10 @@ class j {
|
|
|
64
64
|
a(this, "C");
|
|
65
65
|
a(this, "M", /* @__PURE__ */ new Map());
|
|
66
66
|
a(this, "F", /* @__PURE__ */ new Map());
|
|
67
|
-
a(this, "
|
|
68
|
-
this.A = t, this.C = this
|
|
67
|
+
a(this, "$", 0);
|
|
68
|
+
this.A = t, this.C = this.P(e, i), this.R();
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
R() {
|
|
71
71
|
const t = this.A.getProgramParameter(this.C, this.A.ACTIVE_UNIFORMS);
|
|
72
72
|
for (let e = 0; e < t; e++) {
|
|
73
73
|
const i = this.A.getActiveUniform(this.C, e);
|
|
@@ -77,15 +77,15 @@ class j {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
const i = this.
|
|
80
|
+
P(t, e) {
|
|
81
|
+
const i = this.S(this.A.VERTEX_SHADER, t), s = this.S(this.A.FRAGMENT_SHADER, e), r = this.A.createProgram();
|
|
82
82
|
if (this.A.attachShader(r, i), this.A.attachShader(r, s), this.A.linkProgram(r), !this.A.getProgramParameter(r, this.A.LINK_STATUS)) {
|
|
83
83
|
const o = this.A.getProgramInfoLog(r);
|
|
84
84
|
throw Error("Shader program link error: " + o);
|
|
85
85
|
}
|
|
86
86
|
return this.A.deleteShader(i), this.A.deleteShader(s), r;
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
S(t, e) {
|
|
89
89
|
const i = this.A.createShader(t);
|
|
90
90
|
if (this.A.shaderSource(i, e), this.A.compileShader(i), !this.A.getShaderParameter(i, this.A.COMPILE_STATUS)) {
|
|
91
91
|
const s = this.A.getShaderInfoLog(i);
|
|
@@ -93,16 +93,16 @@ class j {
|
|
|
93
93
|
}
|
|
94
94
|
return i;
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
U() {
|
|
97
97
|
this.A.useProgram(this.C), this.k();
|
|
98
98
|
}
|
|
99
99
|
k() {
|
|
100
|
-
this
|
|
100
|
+
this.$ = 0;
|
|
101
101
|
}
|
|
102
102
|
I(t) {
|
|
103
|
-
for (const e in t) this.
|
|
103
|
+
for (const e in t) this.L(e, t[e]);
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
L(t, e) {
|
|
106
106
|
var c, l;
|
|
107
107
|
const i = this.M.get(t);
|
|
108
108
|
if (!i) return;
|
|
@@ -110,11 +110,11 @@ class j {
|
|
|
110
110
|
if (!s) return;
|
|
111
111
|
const { type: r, size: o } = s, h = this.A;
|
|
112
112
|
if (e instanceof WebGLTexture) {
|
|
113
|
-
const u = this
|
|
113
|
+
const u = this.$++;
|
|
114
114
|
return h.uniform1i(i, u), h.activeTexture(h.TEXTURE0 + u), void h.bindTexture(h.TEXTURE_2D, e);
|
|
115
115
|
}
|
|
116
116
|
if (e instanceof et) {
|
|
117
|
-
const u = this
|
|
117
|
+
const u = this.$++;
|
|
118
118
|
return h.uniform1i(i, u), h.activeTexture(h.TEXTURE0 + u), void h.bindTexture(h.TEXTURE_2D, e.textures[0]);
|
|
119
119
|
}
|
|
120
120
|
if (typeof e == "number") return void (r === h.INT || r === h.BOOL ? h.uniform1i(i, e) : h.uniform1f(i, e));
|
|
@@ -127,7 +127,7 @@ class j {
|
|
|
127
127
|
(l = f[r]) == null || l.call(f);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
get
|
|
130
|
+
get O() {
|
|
131
131
|
return this.C;
|
|
132
132
|
}
|
|
133
133
|
D() {
|
|
@@ -137,13 +137,13 @@ class j {
|
|
|
137
137
|
function yt(n, t, e, i) {
|
|
138
138
|
return 180 * Math.atan2(i - t, e - n) / Math.PI;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function Y(n, t, e, i) {
|
|
141
141
|
return Math.hypot(e - n, i - t);
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function G(n, t, e) {
|
|
144
144
|
return Math.min(Math.max(n, t), e);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function bt(n) {
|
|
147
147
|
return (n % 360 + 360) % 360 / 360;
|
|
148
148
|
}
|
|
149
149
|
function xt(n, t, e) {
|
|
@@ -155,11 +155,11 @@ function tt(n, t, e, i, s) {
|
|
|
155
155
|
function ut(n, t, e, i, s, r = 0, o = WebGL2RenderingContext.FLOAT, h = !1) {
|
|
156
156
|
n.enableVertexAttribArray(t), n.vertexAttribPointer(t, e, o, h, i, s), n.vertexAttribDivisor(t, r);
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function Ft(n, t, e, i, s) {
|
|
159
159
|
n.bindBuffer(t, e), n.bufferData(t, i, s), n.bindBuffer(t, null);
|
|
160
160
|
}
|
|
161
161
|
const it = `#version 300 es
|
|
162
|
-
in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in vec4 A7;in vec3 A8;in vec3 A9;in vec4 Aa;in vec4 Ab;in vec3 Ac;uniform vec2
|
|
162
|
+
in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in vec4 A7;in vec3 A8;in vec3 A9;in vec4 Aa;in vec4 Ab;in vec3 Ac;uniform vec2 Ua;uniform float Ub;uniform float Uc;out vec2 v_uv;out vec3 v_glyphIndex;out vec4 v_glyphColor;out vec4 v_cellColor;out vec4 v_glyphFlags;out vec3 v_worldPosition;out vec3 v_normal;out float v_geometryType;const float A=6.28318530718f;const int B=2;const int C=3;const int D=4;vec2 E(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float M=L*K;float N=F*F;float O=N*F;return M*G+3.0f*L*F*H+3.0f*K*N*I+O*J;}vec2 P(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float N=F*F;return-3.0f*L*G+3.0f*(L-2.0f*K*F)*H+3.0f*(2.0f*K*F-N)*I+3.0f*N*J;}vec3 Q(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x,R.y*T-R.z*U,R.y*U+R.z*T);}vec3 V(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T+R.z*U,R.y,-R.x*U+R.z*T);}vec3 W(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T-R.y*U,R.x*U+R.y*T,R.z);}vec3 X(vec3 R,vec3 Y){vec3 Z=R;if(Y.z!=0.0f){Z=W(Z,Y.z);}if(Y.y!=0.0f){Z=V(Z,Y.y);}if(Y.x!=0.0f){Z=Q(Z,Y.x);}return Z;}void main(){v_uv=A1;v_glyphIndex=A4;v_glyphColor=A5;v_cellColor=A6;v_glyphFlags=A7;vec4 a=Aa;vec4 b=Ab;vec2 c=A3;vec2 d=A2;float e=Ac.x;float f=Ac.y;int g=int(Ac.z);vec2 h=d;vec2 i=h+c*0.5f;float j=f+e*0.5f;vec3 k=vec3(i,j);vec3 l;if(g==D){float F=clamp(A0.x,0.0f,1.0f);vec2 G=b.xy;vec2 H=a.xy;vec2 I=a.zw;vec2 J=b.zw;vec2 m=E(F,G,H,I,J);vec2 n=P(F,G,H,I,J);float o=length(n);vec2 p=o>0.0f?n/o:vec2(1.0f,0.0f);vec2 q=vec2(-p.y,p.x);vec2 r=m;vec2 s=r+q*A0.y*c.y;l=vec3(s,f);}else if(g==C){float t=mod(a.x,A);if(t<0.0f){t+=A;}float u=mod(a.y,A);if(u<0.0f){u+=A;}float v=t-u;if(v<=0.0f){v+=A;}float S=t-A0.x*v;vec2 w=vec2(cos(S),sin(S))*A0.y;vec2 s=w*c+h;l=vec3(s,f);}else if(g==B){vec2 s=A0.xy*c+h;l=vec3(s,f);}vec3 x=X(l,A9);vec3 y=x+A8;vec3 z=vec3(0.0f,0.0f,1.0f);v_worldPosition=y;v_normal=z;v_geometryType=float(g);vec2 AA=(y.xy/Ua)*2.0f;AA.y=-AA.y;float AB=y.z/Ua.y;float AC=clamp(-AB*Ub,-0.99f,0.99f);if(Uc>0.5f){gl_Position=vec4(AA,AC,1.0f);}else{float AD=0.5f;float AE=1.0f/(1.0f-AB*AD);AA*=AE;gl_Position=vec4(AA,AC,1.0f);}}`, H = class H {
|
|
163
163
|
constructor(t, e, i = e, s = 1, r = {}, o) {
|
|
164
164
|
a(this, "H");
|
|
165
165
|
a(this, "G");
|
|
@@ -172,8 +172,8 @@ in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in
|
|
|
172
172
|
a(this, "W");
|
|
173
173
|
a(this, "Z", null);
|
|
174
174
|
a(this, "j", /* @__PURE__ */ new Map());
|
|
175
|
-
this.H = e, this.G = i, this.A = t, this.K =
|
|
176
|
-
precision highp float;in vec2 v_uv;uniform sampler2D
|
|
175
|
+
this.H = e, this.G = i, this.A = t, this.K = G(s, 1, 8), this.W = o, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...r }, H.V || (H.V = new j(t, it, `#version 300 es
|
|
176
|
+
precision highp float;in vec2 v_uv;uniform sampler2D Ud;uniform sampler2D Ue;uniform sampler2D Uf;uniform vec2 Ug;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;void main(){vec2 A=vec2(v_uv.x,1.-v_uv.y);vec2 B=A*Ug;vec2 C=(floor(B)+0.5f)/Ug;vec4 D=texture(Ud,C);vec4 E=texture(Ue,C);if(E.a==0.){discard;}vec4 F=texture(Uf,C);o_character=D;o_primaryColor=E;o_secondaryColor=F;}`));
|
|
177
177
|
const h = t.getParameter(t.MAX_DRAW_BUFFERS), c = t.getParameter(t.MAX_COLOR_ATTACHMENTS);
|
|
178
178
|
this.K = Math.min(this.K, h, c), this.N = t.createFramebuffer(), this.q(), this.J(), this.l.depth && this.tt();
|
|
179
179
|
}
|
|
@@ -225,19 +225,19 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uc;uniform sampler2D Ud;uni
|
|
|
225
225
|
}
|
|
226
226
|
begin() {
|
|
227
227
|
const t = this.A;
|
|
228
|
-
this.j.clear(), this.W.
|
|
228
|
+
this.j.clear(), this.W.et(), this.W.it(this.N, this.H, this.G), this.l.depth && t.clear(t.DEPTH_BUFFER_BIT), this.W.state.rt();
|
|
229
229
|
}
|
|
230
230
|
end() {
|
|
231
231
|
this.W.state.nt(), this.W.ot();
|
|
232
232
|
const t = this.W.ht();
|
|
233
|
-
this.W.
|
|
233
|
+
this.W.it(t.framebuffer, t.viewport[2], t.viewport[3]);
|
|
234
234
|
}
|
|
235
235
|
ct() {
|
|
236
236
|
return this.Z || this.lt(), this.Z;
|
|
237
237
|
}
|
|
238
238
|
lt() {
|
|
239
239
|
if (!this.W) return;
|
|
240
|
-
const t = {
|
|
240
|
+
const t = { Ud: this.X[0], Ue: this.X[1], Uf: this.X[2], Ug: [this.H, this.G] }, e = H.V;
|
|
241
241
|
this.Z = this.W.ft.ut(e, t, !0);
|
|
242
242
|
}
|
|
243
243
|
D() {
|
|
@@ -259,14 +259,14 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uc;uniform sampler2D Ud;uni
|
|
|
259
259
|
return this.K;
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
|
-
a(
|
|
263
|
-
let et =
|
|
264
|
-
const
|
|
262
|
+
a(H, "V", null);
|
|
263
|
+
let et = H;
|
|
264
|
+
const Rt = /* @__PURE__ */ new WeakMap();
|
|
265
265
|
function nt(n, t) {
|
|
266
|
-
|
|
266
|
+
Rt.set(n, t);
|
|
267
267
|
}
|
|
268
268
|
function Ct(n) {
|
|
269
|
-
return
|
|
269
|
+
return Rt.get(n);
|
|
270
270
|
}
|
|
271
271
|
function $(n, t, e, i, s = 255) {
|
|
272
272
|
n[0] = t / 255, n[1] = (e ?? t) / 255, n[2] = (i ?? t) / 255, n[3] = s / 255;
|
|
@@ -282,8 +282,8 @@ class rt {
|
|
|
282
282
|
a(this, "wt", 0);
|
|
283
283
|
a(this, "bt", [0, 0, 0]);
|
|
284
284
|
a(this, "Ct", [1, 1, 1, 1]);
|
|
285
|
-
a(this, "
|
|
286
|
-
a(this, "
|
|
285
|
+
a(this, "xt", [0, 0, 0, 1]);
|
|
286
|
+
a(this, "Mt", !1);
|
|
287
287
|
a(this, "Ft", !1);
|
|
288
288
|
a(this, "$t", !1);
|
|
289
289
|
a(this, "Tt", 0);
|
|
@@ -292,78 +292,78 @@ class rt {
|
|
|
292
292
|
a(this, "Rt", []);
|
|
293
293
|
a(this, "St", []);
|
|
294
294
|
}
|
|
295
|
-
static
|
|
296
|
-
return {
|
|
295
|
+
static Ut() {
|
|
296
|
+
return { kt: 1, zt: 0, It: 0, Lt: 0, At: 0, yt: 0, wt: 0, Tt: 0, Ot: !1, Dt: !1, $t: !1, Et: !1, Ht: [0, 0, 0], Bt: [1, 1, 1, 1], Gt: [0, 0, 0, 1] };
|
|
297
297
|
}
|
|
298
|
-
|
|
299
|
-
t.
|
|
298
|
+
Nt(t) {
|
|
299
|
+
t.kt = this.dt, t.zt = this.gt, t.It = this.vt, t.Lt = this._t, t.At = this.At, t.yt = this.yt, t.wt = this.wt, t.Ot = this.Mt, t.Dt = this.Ft, t.$t = this.$t, t.Tt = this.Tt, t.Et = this.Et, t.Ht[0] = this.bt[0], t.Ht[1] = this.bt[1], t.Ht[2] = this.bt[2], t.Bt[0] = this.Ct[0], t.Bt[1] = this.Ct[1], t.Bt[2] = this.Ct[2], t.Bt[3] = this.Ct[3], t.Gt[0] = this.xt[0], t.Gt[1] = this.xt[1], t.Gt[2] = this.xt[2], t.Gt[3] = this.xt[3];
|
|
300
300
|
}
|
|
301
|
-
|
|
302
|
-
this.dt = t.
|
|
301
|
+
Xt(t) {
|
|
302
|
+
this.dt = t.kt, this.gt = t.zt, this.vt = t.It, this._t = t.Lt, this.At = t.At, this.yt = t.yt, this.wt = t.wt, this.Mt = t.Ot, this.Ft = t.Dt, this.$t = t.$t, this.Tt = t.Tt, this.Et = t.Et, this.bt[0] = t.Ht[0], this.bt[1] = t.Ht[1], this.bt[2] = t.Ht[2], this.Ct[0] = t.Bt[0], this.Ct[1] = t.Bt[1], this.Ct[2] = t.Bt[2], this.Ct[3] = t.Bt[3], this.xt[0] = t.Gt[0], this.xt[1] = t.Gt[1], this.xt[2] = t.Gt[2], this.xt[3] = t.Gt[3];
|
|
303
303
|
}
|
|
304
304
|
rt() {
|
|
305
305
|
let t = this.St.pop();
|
|
306
|
-
t || (t = rt.
|
|
306
|
+
t || (t = rt.Ut()), this.Nt(t), this.Rt.push(t);
|
|
307
307
|
}
|
|
308
308
|
nt() {
|
|
309
309
|
const t = this.Rt.pop();
|
|
310
|
-
t ? (this.
|
|
310
|
+
t ? (this.Xt(t), this.St.push(t)) : console.warn("pop() called without matching push()");
|
|
311
311
|
}
|
|
312
|
-
|
|
313
|
-
this.
|
|
312
|
+
Yt(t) {
|
|
313
|
+
this.Nt(t);
|
|
314
314
|
}
|
|
315
|
-
|
|
315
|
+
Kt(t) {
|
|
316
316
|
this.dt = Math.abs(t);
|
|
317
317
|
}
|
|
318
|
-
|
|
318
|
+
Wt() {
|
|
319
319
|
this.gt = 0, this.vt = 0, this._t = 0, this.At = 0, this.yt = 0, this.wt = 0, this.Et = !1;
|
|
320
320
|
}
|
|
321
|
-
|
|
321
|
+
Zt(t) {
|
|
322
322
|
t !== 0 && (this.At += t * Math.PI / 180);
|
|
323
323
|
}
|
|
324
|
-
|
|
324
|
+
jt(t) {
|
|
325
325
|
t !== 0 && (this.yt += t * Math.PI / 180);
|
|
326
326
|
}
|
|
327
|
-
|
|
327
|
+
Vt(t) {
|
|
328
328
|
t !== 0 && (this.wt += t * Math.PI / 180);
|
|
329
329
|
}
|
|
330
|
-
|
|
330
|
+
qt(t = 0, e = 0, i = 0) {
|
|
331
331
|
t === 0 && e === 0 && i === 0 || (this.gt += t, this.vt += e, this._t += i);
|
|
332
332
|
}
|
|
333
|
+
Qt(t) {
|
|
334
|
+
this.qt(t, 0, 0);
|
|
335
|
+
}
|
|
333
336
|
Jt(t) {
|
|
334
|
-
this.
|
|
337
|
+
this.qt(0, t, 0);
|
|
335
338
|
}
|
|
336
339
|
ts(t) {
|
|
337
|
-
this.
|
|
340
|
+
this.qt(0, 0, t);
|
|
338
341
|
}
|
|
339
342
|
ss(t) {
|
|
340
|
-
this.Qt(0, 0, t);
|
|
341
|
-
}
|
|
342
|
-
es(t) {
|
|
343
343
|
this.bt[0] = t[0], this.bt[1] = t[1], this.bt[2] = t[2];
|
|
344
344
|
}
|
|
345
|
-
|
|
345
|
+
es(t, e, i, s = 255) {
|
|
346
346
|
$(this.Ct, t, e, i, s);
|
|
347
347
|
}
|
|
348
|
-
|
|
349
|
-
$(this.
|
|
348
|
+
rs(t, e, i, s = 255) {
|
|
349
|
+
$(this.xt, t, e, i, s);
|
|
350
|
+
}
|
|
351
|
+
ns(t) {
|
|
352
|
+
this.Mt = t;
|
|
350
353
|
}
|
|
351
354
|
hs(t) {
|
|
352
|
-
this.xt = t;
|
|
353
|
-
}
|
|
354
|
-
cs(t) {
|
|
355
355
|
this.Ft = t;
|
|
356
356
|
}
|
|
357
|
-
|
|
357
|
+
cs(t) {
|
|
358
358
|
this.$t = t;
|
|
359
359
|
}
|
|
360
|
-
|
|
361
|
-
this.Tt =
|
|
360
|
+
ls(t) {
|
|
361
|
+
this.Tt = bt(t);
|
|
362
362
|
}
|
|
363
|
-
|
|
363
|
+
us(t, e, i, s) {
|
|
364
364
|
$(this.Pt, t, e, i, s);
|
|
365
365
|
}
|
|
366
|
-
|
|
366
|
+
fs(t) {
|
|
367
367
|
this.Et = t;
|
|
368
368
|
}
|
|
369
369
|
get canvasBackgroundColor() {
|
|
@@ -382,616 +382,616 @@ class rt {
|
|
|
382
382
|
return this.wt;
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
|
-
const ft = new Float32Array([-0.5, -0.5, 0, 0, 0.5, -0.5, 1, 0, -0.5, 0.5, 0, 1, -0.5, 0.5, 0, 1, 0.5, -0.5, 1, 0, 0.5, 0.5, 1, 1]),
|
|
385
|
+
const ft = new Float32Array([-0.5, -0.5, 0, 0, 0.5, -0.5, 1, 0, -0.5, 0.5, 0, 1, -0.5, 0.5, 0, 1, 0.5, -0.5, 1, 0, 0.5, 0.5, 1, 1]), X = { ds: 16, ps: WebGL2RenderingContext.TRIANGLES, gs: { vs: { size: 2, offset: 0 }, _s: { size: 2, offset: 8 } } };
|
|
386
386
|
class Kt {
|
|
387
387
|
constructor(t) {
|
|
388
388
|
a(this, "A");
|
|
389
|
+
a(this, "As");
|
|
389
390
|
a(this, "ws");
|
|
390
|
-
|
|
391
|
-
this.A = t, this.ws = t.createBuffer(), this.bs = new Float32Array(ft.length);
|
|
391
|
+
this.A = t, this.As = t.createBuffer(), this.ws = new Float32Array(ft.length);
|
|
392
392
|
}
|
|
393
|
-
|
|
394
|
-
const r = this.A, o = Ct(this.A), h = o[2], c = o[3], l = t / h * 2 - 1, u = (t + i) / h * 2 - 1, f = 1 - (e + s) / c * 2, A = 1 - e / c * 2, g = ft, p = this.
|
|
393
|
+
bs(t, e, i, s) {
|
|
394
|
+
const r = this.A, o = Ct(this.A), h = o[2], c = o[3], l = t / h * 2 - 1, u = (t + i) / h * 2 - 1, f = 1 - (e + s) / c * 2, A = 1 - e / c * 2, g = ft, p = this.ws;
|
|
395
395
|
for (let d = 0; d < g.length; d += 4) {
|
|
396
|
-
const v = g[d], m = g[d + 1], E = g[d + 2], y = g[d + 3],
|
|
397
|
-
p[d] =
|
|
396
|
+
const v = g[d], m = g[d + 1], E = g[d + 2], y = g[d + 3], T = l + (v + 0.5) * (u - l), w = f + (m + 0.5) * (A - f);
|
|
397
|
+
p[d] = T, p[d + 1] = w, p[d + 2] = E, p[d + 3] = y;
|
|
398
398
|
}
|
|
399
|
-
r.bindBuffer(r.ARRAY_BUFFER, this.
|
|
399
|
+
r.bindBuffer(r.ARRAY_BUFFER, this.As), r.bufferData(r.ARRAY_BUFFER, p, r.DYNAMIC_DRAW), r.enableVertexAttribArray(0), r.vertexAttribPointer(0, 2, r.FLOAT, !1, 16, 0), r.drawArrays(r.TRIANGLES, 0, 6), r.disableVertexAttribArray(0), r.bindBuffer(r.ARRAY_BUFFER, null);
|
|
400
400
|
}
|
|
401
401
|
D() {
|
|
402
|
-
this.A.deleteBuffer(this.
|
|
402
|
+
this.A.deleteBuffer(this.As);
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
var
|
|
406
|
-
const
|
|
405
|
+
var b = ((n) => (n.RECTANGLE = "rectangle", n.LINE = "line", n.ELLIPSE = "ellipse", n.ARC = "arc", n.TRIANGLE = "triangle", n.BEZIER_CURVE = "bezier_curve", n))(b || {});
|
|
406
|
+
const Vt = { rectangle: 2, line: 2, ellipse: 2, triangle: 2, arc: 3, bezier_curve: 4 };
|
|
407
407
|
class Zt {
|
|
408
408
|
constructor(t) {
|
|
409
409
|
a(this, "A");
|
|
410
|
-
a(this, "
|
|
410
|
+
a(this, "Cs", /* @__PURE__ */ new Map());
|
|
411
411
|
this.A = t;
|
|
412
412
|
}
|
|
413
|
-
|
|
413
|
+
Ms(t, e, i, s) {
|
|
414
414
|
const r = this.A;
|
|
415
|
-
let o = this.
|
|
416
|
-
o || (o = /* @__PURE__ */ new Map(), this.
|
|
415
|
+
let o = this.Cs.get(t);
|
|
416
|
+
o || (o = /* @__PURE__ */ new Map(), this.Cs.set(t, o));
|
|
417
417
|
let h = o.get(e) || null;
|
|
418
418
|
if (!h) {
|
|
419
419
|
h = r.createVertexArray(), o.set(e, h), r.bindVertexArray(h), r.bindBuffer(r.ARRAY_BUFFER, s);
|
|
420
420
|
const c = r.getAttribLocation(t, "A0");
|
|
421
|
-
c !== -1 && ut(r, c, i.vs.
|
|
421
|
+
c !== -1 && ut(r, c, i.gs.vs.size, i.ds, i.gs.vs.offset, 0, r.FLOAT, !1);
|
|
422
422
|
const l = r.getAttribLocation(t, "A1");
|
|
423
|
-
l !== -1 && ut(r, l, i.
|
|
423
|
+
l !== -1 && ut(r, l, i.gs._s.size, i.ds, i.gs._s.offset, 0, r.FLOAT, !1);
|
|
424
424
|
}
|
|
425
425
|
r.bindVertexArray(h);
|
|
426
426
|
}
|
|
427
|
-
|
|
427
|
+
Fs() {
|
|
428
428
|
this.A.bindVertexArray(null);
|
|
429
429
|
}
|
|
430
430
|
D() {
|
|
431
|
-
for (const [, t] of this.
|
|
431
|
+
for (const [, t] of this.Cs) for (const [, e] of t) e && this.A.deleteVertexArray(e);
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
const
|
|
435
|
-
static
|
|
436
|
-
const s = e || new Float32Array(
|
|
434
|
+
const N = class N {
|
|
435
|
+
static $s(t, e, i = 0) {
|
|
436
|
+
const s = e || new Float32Array(N.FLOATS_PER_INSTANCE);
|
|
437
437
|
let r = i;
|
|
438
|
-
s[r++] = t.
|
|
439
|
-
const o = t.
|
|
438
|
+
s[r++] = t.vs[0], s[r++] = t.vs[1], s[r++] = t.Ts[0], s[r++] = t.Ts[1], s[r++] = t.Ht[0], s[r++] = t.Ht[1], s[r++] = t.Ht[2], s[r++] = t.Bt[0], s[r++] = t.Bt[1], s[r++] = t.Bt[2], s[r++] = t.Bt[3], s[r++] = t.Gt[0], s[r++] = t.Gt[1], s[r++] = t.Gt[2], s[r++] = t.Gt[3], s[r++] = t.Ps[0], s[r++] = t.Ps[1], s[r++] = t.Ps[2], s[r++] = t.Tt;
|
|
439
|
+
const o = t.Es;
|
|
440
440
|
s[r++] = (o == null ? void 0 : o[0]) ?? 0, s[r++] = (o == null ? void 0 : o[1]) ?? 0, s[r++] = (o == null ? void 0 : o[2]) ?? 0;
|
|
441
|
-
const h = t.
|
|
441
|
+
const h = t.Rs;
|
|
442
442
|
s[r++] = (h == null ? void 0 : h[0]) ?? 0, s[r++] = (h == null ? void 0 : h[1]) ?? 0, s[r++] = (h == null ? void 0 : h[2]) ?? 0;
|
|
443
|
-
const c = t.
|
|
444
|
-
return g ? (s[r++] = (f == null ? void 0 : f[0]) ?? 0, s[r++] = (f == null ? void 0 : f[1]) ?? 0, s[r++] = (A == null ? void 0 : A[0]) ?? 0, s[r++] = (A == null ? void 0 : A[1]) ?? 0, s[r++] = l[0], s[r++] = l[1], s[r++] = u[0], s[r++] = u[1]) : !g && !!c ? (s[r++] = c[0], s[r++] = c[1], s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0) : (s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0), s[r++] = t.
|
|
443
|
+
const c = t.Ss, l = t.Us, u = t.ks, f = t.zs, A = t.Is, g = !(!l || !u);
|
|
444
|
+
return g ? (s[r++] = (f == null ? void 0 : f[0]) ?? 0, s[r++] = (f == null ? void 0 : f[1]) ?? 0, s[r++] = (A == null ? void 0 : A[0]) ?? 0, s[r++] = (A == null ? void 0 : A[1]) ?? 0, s[r++] = l[0], s[r++] = l[1], s[r++] = u[0], s[r++] = u[1]) : !g && !!c ? (s[r++] = c[0], s[r++] = c[1], s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0) : (s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0), s[r++] = t.Ls ?? 0, s[r++] = t.Os ?? 0, s[r++] = t.Ds ?? 0, s;
|
|
445
445
|
}
|
|
446
|
-
static
|
|
447
|
-
const i = t.length *
|
|
446
|
+
static Hs(t, e) {
|
|
447
|
+
const i = t.length * N.FLOATS_PER_INSTANCE, s = e || new Float32Array(i);
|
|
448
448
|
for (let r = 0; r < t.length; r++) {
|
|
449
|
-
const o = r *
|
|
450
|
-
|
|
449
|
+
const o = r * N.FLOATS_PER_INSTANCE;
|
|
450
|
+
N.$s(t[r], s, o);
|
|
451
451
|
}
|
|
452
452
|
return s;
|
|
453
453
|
}
|
|
454
454
|
};
|
|
455
|
-
a(
|
|
456
|
-
let
|
|
457
|
-
const
|
|
455
|
+
a(N, "BYTES_PER_INSTANCE", 144), a(N, "FLOATS_PER_INSTANCE", 36);
|
|
456
|
+
let U = N;
|
|
457
|
+
const P = class P {
|
|
458
458
|
};
|
|
459
|
-
a(
|
|
460
|
-
let
|
|
459
|
+
a(P, "STRIDE", U.BYTES_PER_INSTANCE), a(P, "ATTRIBUTES", { A2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 0, divisor: 1 }, A3: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 8, divisor: 1 }, A4: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 16, divisor: 1 }, A5: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 28, divisor: 1 }, A6: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 44, divisor: 1 }, A7: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 60, divisor: 1 }, A8: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 76, divisor: 1 }, A9: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 88, divisor: 1 }, Aa: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 100, divisor: 1 }, Ab: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 116, divisor: 1 }, Ac: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 132, divisor: 1 } });
|
|
460
|
+
let V = P;
|
|
461
461
|
class jt {
|
|
462
462
|
constructor(t = 1e3, e = 1.5) {
|
|
463
|
+
a(this, "Bs");
|
|
464
|
+
a(this, "Gs");
|
|
463
465
|
a(this, "Ns");
|
|
464
|
-
a(this, "Xs");
|
|
465
|
-
a(this, "Ys");
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
this.
|
|
469
|
-
|
|
470
|
-
|
|
466
|
+
a(this, "Xs", 0);
|
|
467
|
+
a(this, "Ys", 0);
|
|
468
|
+
this.Gs = t, this.Ns = e;
|
|
469
|
+
const i = t * U.FLOATS_PER_INSTANCE;
|
|
470
|
+
this.Bs = new Float32Array(i);
|
|
471
|
+
}
|
|
472
|
+
Ks(t) {
|
|
473
|
+
if (t <= this.Gs) return;
|
|
474
|
+
const e = Math.ceil(t * this.Ns), i = this.Gs;
|
|
475
|
+
this.Gs = e;
|
|
476
|
+
const s = e * U.FLOATS_PER_INSTANCE, r = new Float32Array(s), o = i * U.FLOATS_PER_INSTANCE;
|
|
477
|
+
r.set(this.Bs.subarray(0, Math.min(o, this.Xs))), this.Bs = r;
|
|
478
|
+
}
|
|
479
|
+
Ws() {
|
|
480
|
+
return { buffer: this.Bs, offset: this.Xs };
|
|
471
481
|
}
|
|
472
482
|
Zs(t) {
|
|
473
|
-
|
|
474
|
-
const e = Math.ceil(t * this.Ys), i = this.Xs;
|
|
475
|
-
this.Xs = e;
|
|
476
|
-
const s = e * S.FLOATS_PER_INSTANCE, r = new Float32Array(s), o = i * S.FLOATS_PER_INSTANCE;
|
|
477
|
-
r.set(this.Ns.subarray(0, Math.min(o, this.Ks))), this.Ns = r;
|
|
483
|
+
this.Xs += t, this.Ys++;
|
|
478
484
|
}
|
|
479
485
|
js() {
|
|
480
|
-
|
|
486
|
+
this.Xs = 0, this.Ys = 0;
|
|
481
487
|
}
|
|
482
|
-
Vs(t) {
|
|
483
|
-
this.
|
|
488
|
+
Vs(t = 0, e) {
|
|
489
|
+
return this.Bs.subarray(t, e ?? this.Xs);
|
|
484
490
|
}
|
|
485
|
-
qs() {
|
|
486
|
-
|
|
491
|
+
get qs() {
|
|
492
|
+
return this.Ys;
|
|
487
493
|
}
|
|
488
|
-
Qs(
|
|
489
|
-
return this.
|
|
494
|
+
get Qs() {
|
|
495
|
+
return this.Gs;
|
|
490
496
|
}
|
|
491
497
|
get Js() {
|
|
492
|
-
return this.Ws;
|
|
493
|
-
}
|
|
494
|
-
get ti() {
|
|
495
498
|
return this.Xs;
|
|
496
499
|
}
|
|
497
|
-
get
|
|
498
|
-
return this.
|
|
499
|
-
}
|
|
500
|
-
get ii() {
|
|
501
|
-
return this.Ws === 0;
|
|
500
|
+
get te() {
|
|
501
|
+
return this.Ys === 0;
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
class
|
|
504
|
+
class kt {
|
|
505
505
|
constructor(t) {
|
|
506
|
-
a(this, "
|
|
507
|
-
this.
|
|
506
|
+
a(this, "Bs");
|
|
507
|
+
this.Bs = t;
|
|
508
508
|
}
|
|
509
|
-
|
|
510
|
-
this.
|
|
511
|
-
const { buffer: e, offset: i } = this.
|
|
509
|
+
se(t) {
|
|
510
|
+
this.Bs.Ks(this.Bs.qs + 1);
|
|
511
|
+
const { buffer: e, offset: i } = this.Bs.Ws();
|
|
512
512
|
e[i + 0] = t.x, e[i + 1] = t.y, e[i + 2] = t.width, e[i + 3] = t.height, e[i + 4] = t.char0, e[i + 5] = t.char1, e[i + 6] = t.char2, e[i + 7] = t.r1, e[i + 8] = t.g1, e[i + 9] = t.b1, e[i + 10] = t.a1, e[i + 11] = t.r2, e[i + 12] = t.g2, e[i + 13] = t.b2, e[i + 14] = t.a2, e[i + 15] = t.invert, e[i + 16] = t.flipX, e[i + 17] = t.flipY, e[i + 18] = t.charRot, e[i + 19] = t.translationX, e[i + 20] = t.translationY, e[i + 21] = t.translationZ, e[i + 22] = t.rotationX, e[i + 23] = t.rotationY, e[i + 24] = t.rotationZ;
|
|
513
513
|
const s = t.curveParams0, r = t.curveParams1;
|
|
514
|
-
return e[i + 25] = s[0], e[i + 26] = s[1], e[i + 27] = s[2], e[i + 28] = s[3], e[i + 29] = r[0], e[i + 30] = r[1], e[i + 31] = r[2], e[i + 32] = r[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.
|
|
514
|
+
return e[i + 25] = s[0], e[i + 26] = s[1], e[i + 27] = s[2], e[i + 28] = s[3], e[i + 29] = r[0], e[i + 30] = r[1], e[i + 31] = r[2], e[i + 32] = r[3], e[i + 33] = t.depth, e[i + 34] = t.baseZ, e[i + 35] = t.geometryType, this.Bs.Zs(U.FLOATS_PER_INSTANCE), this.Bs.qs - 1;
|
|
515
515
|
}
|
|
516
|
-
get
|
|
517
|
-
return this.
|
|
516
|
+
get qs() {
|
|
517
|
+
return this.Bs.qs;
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
|
-
class
|
|
520
|
+
class qt {
|
|
521
521
|
constructor(t, e = 1e3) {
|
|
522
522
|
a(this, "A");
|
|
523
|
-
a(this, "
|
|
524
|
-
a(this, "
|
|
525
|
-
a(this, "
|
|
526
|
-
this.A = t, this.
|
|
523
|
+
a(this, "ee", null);
|
|
524
|
+
a(this, "ie", 0);
|
|
525
|
+
a(this, "re", /* @__PURE__ */ new Map());
|
|
526
|
+
this.A = t, this.ne(e);
|
|
527
527
|
}
|
|
528
|
-
|
|
528
|
+
ne(t) {
|
|
529
529
|
const e = this.A;
|
|
530
|
-
this.
|
|
531
|
-
const i = t *
|
|
532
|
-
|
|
530
|
+
this.ee && e.deleteBuffer(this.ee), this.ee = e.createBuffer();
|
|
531
|
+
const i = t * U.BYTES_PER_INSTANCE;
|
|
532
|
+
Ft(e, e.ARRAY_BUFFER, this.ee, i, e.DYNAMIC_DRAW), this.ie = t;
|
|
533
533
|
}
|
|
534
|
-
|
|
535
|
-
this.
|
|
534
|
+
oe(t) {
|
|
535
|
+
this.ne(t);
|
|
536
536
|
}
|
|
537
|
-
get
|
|
538
|
-
return this.
|
|
537
|
+
get Qs() {
|
|
538
|
+
return this.ie;
|
|
539
539
|
}
|
|
540
|
-
|
|
540
|
+
he(t, e) {
|
|
541
541
|
if (e === 0) return;
|
|
542
542
|
const i = this.A;
|
|
543
|
-
i.bindBuffer(i.ARRAY_BUFFER, this.
|
|
544
|
-
const s = e *
|
|
543
|
+
i.bindBuffer(i.ARRAY_BUFFER, this.ee);
|
|
544
|
+
const s = e * U.FLOATS_PER_INSTANCE;
|
|
545
545
|
i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, s);
|
|
546
546
|
}
|
|
547
|
-
|
|
548
|
-
let e = this.
|
|
547
|
+
ae(t) {
|
|
548
|
+
let e = this.re.get(t);
|
|
549
549
|
if (!e) {
|
|
550
550
|
e = /* @__PURE__ */ new Map();
|
|
551
551
|
const i = this.A;
|
|
552
|
-
for (const s in
|
|
552
|
+
for (const s in V.ATTRIBUTES) {
|
|
553
553
|
const r = i.getAttribLocation(t, s);
|
|
554
554
|
r !== -1 && e.set(s, r);
|
|
555
555
|
}
|
|
556
|
-
this.
|
|
556
|
+
this.re.set(t, e);
|
|
557
557
|
}
|
|
558
558
|
return e;
|
|
559
559
|
}
|
|
560
|
-
|
|
561
|
-
const e = this.A, i = t.
|
|
560
|
+
ce(t) {
|
|
561
|
+
const e = this.A, i = t.O, s = this.ae(i);
|
|
562
562
|
for (const [r, o] of s) {
|
|
563
|
-
const h =
|
|
563
|
+
const h = V.ATTRIBUTES[r];
|
|
564
564
|
h && ut(e, o, h.size, h.stride, h.offset, h.divisor, h.type, h.normalized);
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
|
|
568
|
-
const e = this.A, i = this.
|
|
567
|
+
le(t) {
|
|
568
|
+
const e = this.A, i = this.ae(t.O);
|
|
569
569
|
for (const [s, r] of i)
|
|
570
|
-
|
|
570
|
+
V.ATTRIBUTES[s] && (e.disableVertexAttribArray(r), e.vertexAttribDivisor(r, 0));
|
|
571
571
|
}
|
|
572
572
|
D() {
|
|
573
|
-
this.
|
|
573
|
+
this.ee && (this.A.deleteBuffer(this.ee), this.ee = null), this.re.clear();
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
|
-
class
|
|
576
|
+
class Qt {
|
|
577
577
|
constructor(t, e = 1e3, i = 1.5) {
|
|
578
578
|
a(this, "A");
|
|
579
|
-
a(this, "
|
|
580
|
-
a(this, "
|
|
581
|
-
a(this, "
|
|
582
|
-
this.A = t, this.
|
|
579
|
+
a(this, "Bs");
|
|
580
|
+
a(this, "ue");
|
|
581
|
+
a(this, "fe");
|
|
582
|
+
this.A = t, this.Bs = new jt(e, i), this.ue = new kt(this.Bs), this.fe = new qt(t, e);
|
|
583
583
|
}
|
|
584
|
-
|
|
584
|
+
de(t) {
|
|
585
585
|
var s, r, o, h, c, l, u, f, A, g;
|
|
586
586
|
const e = [0, 0, 0, 0], i = [0, 0, 0, 0];
|
|
587
|
-
return t.
|
|
587
|
+
return t.Us && t.ks ? (e[0] = ((s = t.zs) == null ? void 0 : s[0]) ?? 0, e[1] = ((r = t.zs) == null ? void 0 : r[1]) ?? 0, e[2] = ((o = t.Is) == null ? void 0 : o[0]) ?? 0, e[3] = ((h = t.Is) == null ? void 0 : h[1]) ?? 0, i[0] = t.Us[0], i[1] = t.Us[1], i[2] = t.ks[0], i[3] = t.ks[1]) : t.Ss && (e[0] = t.Ss[0], e[1] = t.Ss[1]), this.se({ x: t.vs[0], y: t.vs[1], width: t.Ts[0], height: t.Ts[1], char0: t.Ht[0], char1: t.Ht[1], char2: t.Ht[2], r1: t.Bt[0], g1: t.Bt[1], b1: t.Bt[2], a1: t.Bt[3], r2: t.Gt[0], g2: t.Gt[1], b2: t.Gt[2], a2: t.Gt[3], invert: t.Ps[0], flipX: t.Ps[1], flipY: t.Ps[2], charRot: t.Tt, translationX: ((c = t.Es) == null ? void 0 : c[0]) ?? 0, translationY: ((l = t.Es) == null ? void 0 : l[1]) ?? 0, translationZ: ((u = t.Es) == null ? void 0 : u[2]) ?? 0, rotationX: ((f = t.Rs) == null ? void 0 : f[0]) ?? 0, rotationY: ((A = t.Rs) == null ? void 0 : A[1]) ?? 0, rotationZ: ((g = t.Rs) == null ? void 0 : g[2]) ?? 0, curveParams0: e, curveParams1: i, depth: t.Ls || 0, baseZ: t.Os || 0, geometryType: t.Ds || 0 });
|
|
588
588
|
}
|
|
589
|
-
|
|
590
|
-
const e = this.
|
|
591
|
-
return this.
|
|
589
|
+
se(t) {
|
|
590
|
+
const e = this.ue.se(t);
|
|
591
|
+
return this.Bs.Qs > this.fe.Qs && this.fe.oe(this.Bs.Qs), e;
|
|
592
592
|
}
|
|
593
|
-
get
|
|
594
|
-
return this.
|
|
593
|
+
get pe() {
|
|
594
|
+
return this.Bs.qs;
|
|
595
595
|
}
|
|
596
|
-
get
|
|
597
|
-
return this.
|
|
596
|
+
get te() {
|
|
597
|
+
return this.Bs.te;
|
|
598
598
|
}
|
|
599
|
-
|
|
600
|
-
this.
|
|
599
|
+
ge() {
|
|
600
|
+
this.Bs.js();
|
|
601
601
|
}
|
|
602
|
-
|
|
603
|
-
const e = this.
|
|
602
|
+
ce(t) {
|
|
603
|
+
const e = this.Bs.qs;
|
|
604
604
|
if (e === 0) return;
|
|
605
|
-
const i = this.
|
|
606
|
-
this.
|
|
605
|
+
const i = this.Bs.Vs();
|
|
606
|
+
this.fe.he(i, e), this.fe.ce(t);
|
|
607
607
|
}
|
|
608
|
-
|
|
609
|
-
this.
|
|
608
|
+
le(t) {
|
|
609
|
+
this.fe.le(t);
|
|
610
610
|
}
|
|
611
|
-
|
|
612
|
-
const i = this.
|
|
611
|
+
bs(t, e) {
|
|
612
|
+
const i = this.Bs.qs;
|
|
613
613
|
i !== 0 && this.A.drawArraysInstanced(t, 0, e, i);
|
|
614
614
|
}
|
|
615
615
|
D() {
|
|
616
|
-
this.
|
|
616
|
+
this.fe.D();
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
class
|
|
619
|
+
class O {
|
|
620
620
|
constructor(t, e, i, s) {
|
|
621
621
|
a(this, "A");
|
|
622
|
-
a(this, "
|
|
623
|
-
a(this, "
|
|
624
|
-
a(this, "
|
|
625
|
-
a(this, "
|
|
626
|
-
this.A = t, this.
|
|
622
|
+
a(this, "ve");
|
|
623
|
+
a(this, "me");
|
|
624
|
+
a(this, "_e");
|
|
625
|
+
a(this, "Ae", null);
|
|
626
|
+
this.A = t, this.ve = e, this.me = i, this._e = s;
|
|
627
627
|
const r = this.A.createBuffer();
|
|
628
|
-
|
|
628
|
+
Ft(this.A, this.A.ARRAY_BUFFER, r, this._e.ye, this.A.STATIC_DRAW), this.Ae = r;
|
|
629
629
|
}
|
|
630
630
|
get type() {
|
|
631
|
-
return this.
|
|
631
|
+
return this.me;
|
|
632
632
|
}
|
|
633
633
|
get unitGeometry() {
|
|
634
|
-
return this.
|
|
634
|
+
return this._e;
|
|
635
635
|
}
|
|
636
636
|
get unitBuffer() {
|
|
637
|
-
return this.
|
|
637
|
+
return this.Ae;
|
|
638
638
|
}
|
|
639
639
|
get batch() {
|
|
640
|
-
return this.
|
|
640
|
+
return this.ve;
|
|
641
641
|
}
|
|
642
|
-
|
|
643
|
-
this.
|
|
642
|
+
we() {
|
|
643
|
+
this.ve.ge();
|
|
644
644
|
}
|
|
645
|
-
|
|
646
|
-
return !this.
|
|
645
|
+
be() {
|
|
646
|
+
return !this.ve.te;
|
|
647
647
|
}
|
|
648
648
|
D() {
|
|
649
|
-
this.
|
|
649
|
+
this.ve.D(), this.A.deleteBuffer(this.Ae);
|
|
650
650
|
}
|
|
651
|
-
|
|
652
|
-
return this.
|
|
651
|
+
Ce(t, e, i) {
|
|
652
|
+
return this.ve.de(t);
|
|
653
653
|
}
|
|
654
|
-
|
|
655
|
-
const h = r.
|
|
654
|
+
xe(t, e, i, s, r, o) {
|
|
655
|
+
const h = r.zt ?? 0, c = r.It ?? 0, l = r.Lt ?? 0, u = r.At ?? 0, f = r.yt ?? 0, A = r.wt ?? 0, g = [0, 0, 0, 0], p = [0, 0, 0, 0];
|
|
656
656
|
o && (o.bezStartX !== void 0 && o.bezStartY !== void 0 && o.bezEndX !== void 0 && o.bezEndY !== void 0 ? (g[0] = o.cp1x ?? 0, g[1] = o.cp1y ?? 0, g[2] = o.cp2x ?? 0, g[3] = o.cp2y ?? 0, p[0] = o.bezStartX ?? 0, p[1] = o.bezStartY ?? 0, p[2] = o.bezEndX ?? 0, p[3] = o.bezEndY ?? 0) : o.arcStart === void 0 && o.arcStop === void 0 || (g[0] = o.arcStart ?? 0, g[1] = o.arcStop ?? 0));
|
|
657
|
-
const d = { x: t, y: e, width: i, height: s, char0: r.
|
|
658
|
-
return this.
|
|
657
|
+
const d = { x: t, y: e, width: i, height: s, char0: r.Ht[0], char1: r.Ht[1], char2: r.Ht[2], r1: r.Bt[0], g1: r.Bt[1], b1: r.Bt[2], a1: r.Bt[3], r2: r.Gt[0], g2: r.Gt[1], b2: r.Gt[2], a2: r.Gt[3], invert: r.$t ? 1 : 0, flipX: r.Ot ? 1 : 0, flipY: r.Dt ? 1 : 0, charRot: r.Tt, translationX: h, translationY: c, translationZ: l, rotationX: u, rotationY: f, rotationZ: A, curveParams0: g, curveParams1: p, depth: (o == null ? void 0 : o.depth) ?? 0, baseZ: (o == null ? void 0 : o.baseZ) ?? 0, geometryType: Vt[this.me] ?? 0 };
|
|
658
|
+
return this.ve.se(d);
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
|
-
const Jt = {
|
|
661
|
+
const Jt = { ye: ft, Me: 6, ...X }, $t = { ye: new Float32Array([0, -0.5, 0, 0, 1, -0.5, 1, 0, 0, 0.5, 0, 1, 0, 0.5, 0, 1, 1, -0.5, 1, 0, 1, 0.5, 1, 1]), Me: 6, ...X }, te = { ye: function(n = 32) {
|
|
662
662
|
const t = [], e = 2 * Math.PI / n;
|
|
663
663
|
for (let i = 0; i < n; i++) {
|
|
664
664
|
const s = i * e, r = (i + 1) % n * e, o = Math.cos(s), h = Math.sin(s), c = 0.5 * (o + 1), l = 0.5 * (h + 1), u = Math.cos(r), f = Math.sin(r), A = 0.5 * (u + 1), g = 0.5 * (f + 1);
|
|
665
665
|
t.push(0, 0, 0.5, 0.5, o, h, c, l, u, f, A, g);
|
|
666
666
|
}
|
|
667
667
|
return new Float32Array(t);
|
|
668
|
-
}(32),
|
|
669
|
-
let ee = {
|
|
668
|
+
}(32), Me: 96, ...X };
|
|
669
|
+
let ee = { ye: function(n) {
|
|
670
670
|
const t = [];
|
|
671
671
|
for (let e = 0; e < n; e++) {
|
|
672
672
|
const i = e / n, s = (e + 1) / n;
|
|
673
673
|
t.push(i, 0, i, 0, i, 1, i, 1, s, 1, s, 1);
|
|
674
674
|
}
|
|
675
675
|
return new Float32Array(t);
|
|
676
|
-
}(32),
|
|
677
|
-
const ie = {
|
|
676
|
+
}(32), Me: 96, ...X };
|
|
677
|
+
const ie = { ye: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Me: 3, ...X }, re = { ye: function(n = 16) {
|
|
678
678
|
const t = [];
|
|
679
679
|
for (let e = 0; e < n; e++) {
|
|
680
680
|
const i = e / n, s = (e + 1) / n;
|
|
681
681
|
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);
|
|
682
682
|
}
|
|
683
683
|
return new Float32Array(t);
|
|
684
|
-
}(16),
|
|
684
|
+
}(16), Me: 96, ...X }, se = { [b.RECTANGLE]: class extends O {
|
|
685
685
|
constructor(n, t) {
|
|
686
|
-
super(n, t,
|
|
686
|
+
super(n, t, b.RECTANGLE, Jt);
|
|
687
687
|
}
|
|
688
|
-
|
|
689
|
-
return this
|
|
688
|
+
de(n, t) {
|
|
689
|
+
return this.xe(0, 0, n.width, n.height, t);
|
|
690
690
|
}
|
|
691
|
-
}, [
|
|
691
|
+
}, [b.LINE]: class extends O {
|
|
692
692
|
constructor(n, t) {
|
|
693
|
-
super(n, t,
|
|
693
|
+
super(n, t, b.LINE, $t);
|
|
694
694
|
}
|
|
695
|
-
|
|
696
|
-
const e = n.x2 - n.x1, i = n.y2 - n.y1, s = Math.hypot(e, i), r = Math.atan2(i, e), o = t.
|
|
697
|
-
return this
|
|
695
|
+
de(n, t) {
|
|
696
|
+
const e = n.x2 - n.x1, i = n.y2 - n.y1, s = Math.hypot(e, i), r = Math.atan2(i, e), o = t.kt || 1, h = n.x1 + e / 2 - s / 2, c = n.y1 + i / 2, l = { ...t, wt: (t.wt || 0) + r };
|
|
697
|
+
return this.xe(h, c, s, o, l);
|
|
698
698
|
}
|
|
699
|
-
}, [
|
|
699
|
+
}, [b.ELLIPSE]: class extends O {
|
|
700
700
|
constructor(n, t) {
|
|
701
|
-
super(n, t,
|
|
701
|
+
super(n, t, b.ELLIPSE, te);
|
|
702
702
|
}
|
|
703
|
-
|
|
704
|
-
return this
|
|
703
|
+
de(n, t) {
|
|
704
|
+
return this.xe(0, 0, n.width, n.height, t);
|
|
705
705
|
}
|
|
706
|
-
}, [
|
|
706
|
+
}, [b.ARC]: class extends O {
|
|
707
707
|
constructor(n, t) {
|
|
708
|
-
super(n, t,
|
|
708
|
+
super(n, t, b.ARC, ee);
|
|
709
709
|
}
|
|
710
|
-
|
|
710
|
+
de(n, t) {
|
|
711
711
|
const e = n.start * Math.PI / 180, i = n.stop * Math.PI / 180;
|
|
712
|
-
return this
|
|
712
|
+
return this.xe(0, 0, n.width, n.height, t, { arcStart: e, arcStop: i });
|
|
713
713
|
}
|
|
714
|
-
}, [
|
|
714
|
+
}, [b.TRIANGLE]: class extends O {
|
|
715
715
|
constructor(n, t) {
|
|
716
|
-
super(n, t,
|
|
716
|
+
super(n, t, b.TRIANGLE, ie);
|
|
717
717
|
}
|
|
718
|
-
|
|
718
|
+
de(n, t) {
|
|
719
719
|
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, o = Math.max(n.y1, n.y2, n.y3) - s;
|
|
720
|
-
return this
|
|
720
|
+
return this.xe(e, s, r, o, t);
|
|
721
721
|
}
|
|
722
|
-
}, [
|
|
722
|
+
}, [b.BEZIER_CURVE]: class extends O {
|
|
723
723
|
constructor(n, t) {
|
|
724
|
-
super(n, t,
|
|
724
|
+
super(n, t, b.BEZIER_CURVE, re);
|
|
725
725
|
}
|
|
726
|
-
|
|
727
|
-
return this
|
|
726
|
+
de(n, t) {
|
|
727
|
+
return this.xe(0, 0, 1, t.kt || 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 });
|
|
728
728
|
}
|
|
729
729
|
} };
|
|
730
730
|
class ne {
|
|
731
731
|
constructor(t) {
|
|
732
732
|
a(this, "A");
|
|
733
|
-
a(this, "
|
|
734
|
-
a(this, "
|
|
735
|
-
this.A = t, this
|
|
736
|
-
for (const e of Object.values(
|
|
737
|
-
const i = new
|
|
738
|
-
this.
|
|
733
|
+
a(this, "Fe");
|
|
734
|
+
a(this, "$e");
|
|
735
|
+
this.A = t, this.$e = new Zt(t), this.Fe = /* @__PURE__ */ new Map();
|
|
736
|
+
for (const e of Object.values(b)) {
|
|
737
|
+
const i = new Qt(t), s = new se[e](t, i);
|
|
738
|
+
this.Fe.set(e, s);
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
-
|
|
742
|
-
const e = this.
|
|
743
|
-
for (const i of e) this.
|
|
741
|
+
Te(t) {
|
|
742
|
+
const e = this.Pe(t);
|
|
743
|
+
for (const i of e) this.Ee(i);
|
|
744
744
|
}
|
|
745
|
-
|
|
745
|
+
Pe(t) {
|
|
746
746
|
const e = [];
|
|
747
747
|
let i = null, s = null, r = null;
|
|
748
748
|
for (const o of t) s !== o.material || r !== o.type ? (i && i.length > 0 && e.push({ material: s, type: r, commands: i }), i = [o], s = o.material, r = o.type) : i.push(o);
|
|
749
749
|
return i && i.length > 0 && e.push({ material: s, type: r, commands: i }), e;
|
|
750
750
|
}
|
|
751
|
-
|
|
752
|
-
const { material: e, type: i, commands: s } = t, r = this.
|
|
753
|
-
e.shader.
|
|
751
|
+
Ee(t) {
|
|
752
|
+
const { material: e, type: i, commands: s } = t, r = this.Fe.get(i);
|
|
753
|
+
e.shader.U(), e.shader.I(e.uniforms);
|
|
754
754
|
const o = Ct(this.A), h = s.length > 0 && s[0].state.Et;
|
|
755
|
-
e.shader.I({
|
|
756
|
-
for (const c of s) r.
|
|
757
|
-
if (r.
|
|
755
|
+
e.shader.I({ Uh: o[2] / o[3], Ua: [o[2], o[3]], Ub: 1, Uc: h ? 1 : 0 }), r.we();
|
|
756
|
+
for (const c of s) r.de(c.params, c.state);
|
|
757
|
+
if (r.be()) {
|
|
758
758
|
const c = r.unitGeometry, l = r.unitBuffer;
|
|
759
759
|
try {
|
|
760
|
-
this.
|
|
760
|
+
this.$e.Ms(e.shader.O, i + "", c, l), r.batch.ce(e.shader), r.batch.bs(c.ps, c.Me);
|
|
761
761
|
} finally {
|
|
762
|
-
r.batch.
|
|
762
|
+
r.batch.le(e.shader), this.$e.Fs(), r.we();
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
766
|
D() {
|
|
767
|
-
for (const t of this.
|
|
768
|
-
this.
|
|
767
|
+
for (const t of this.Fe.values()) t.D();
|
|
768
|
+
this.Fe.clear(), this.$e.D();
|
|
769
769
|
}
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function Dt(n) {
|
|
772
772
|
let t = 0;
|
|
773
773
|
for (let e = 0; e < n.length; e++)
|
|
774
774
|
t = (t << 5) - t + n.charCodeAt(e), t &= t;
|
|
775
775
|
return t;
|
|
776
776
|
}
|
|
777
777
|
function Et(n) {
|
|
778
|
-
return
|
|
778
|
+
return Dt(n + "");
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function z(n, t) {
|
|
781
781
|
return (n << 5) - n + t;
|
|
782
782
|
}
|
|
783
783
|
class he {
|
|
784
784
|
constructor(t) {
|
|
785
785
|
a(this, "A");
|
|
786
|
-
a(this, "
|
|
787
|
-
a(this, "
|
|
788
|
-
a(this, "
|
|
789
|
-
a(this, "
|
|
790
|
-
this.A = t, this.
|
|
791
|
-
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;void main(){int A=int(v_glyphFlags.r>0.5?1:0);int B=int(v_glyphFlags.g>0.5?1:0);int C=int(v_glyphFlags.b>0.5?1:0);float D=float(A|(B<<1)|(C<<2))/255.;o_character=vec4(v_glyphIndex.xy,D,clamp(v_glyphFlags.a,0.,1.));o_primaryColor=vec4(v_glyphColor.rgb,v_glyphColor.a);o_secondaryColor=vec4(v_cellColor.rgb,v_cellColor.a);}`), this.
|
|
786
|
+
a(this, "Re", 0);
|
|
787
|
+
a(this, "Se");
|
|
788
|
+
a(this, "ke");
|
|
789
|
+
a(this, "ze", /* @__PURE__ */ new Map());
|
|
790
|
+
this.A = t, this.Se = new j(t, it, `#version 300 es
|
|
791
|
+
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;void main(){int A=int(v_glyphFlags.r>0.5?1:0);int B=int(v_glyphFlags.g>0.5?1:0);int C=int(v_glyphFlags.b>0.5?1:0);float D=float(A|(B<<1)|(C<<2))/255.;o_character=vec4(v_glyphIndex.xy,D,clamp(v_glyphFlags.a,0.,1.));o_primaryColor=vec4(v_glyphColor.rgb,v_glyphColor.a);o_secondaryColor=vec4(v_cellColor.rgb,v_cellColor.a);}`), this.ke = { id: this.Re++, shader: this.Se, uniforms: Object.freeze({}), hash: this.Ie(this.Se, {}), isBuiltIn: !0 };
|
|
792
792
|
}
|
|
793
|
-
get
|
|
794
|
-
return this.
|
|
793
|
+
get Le() {
|
|
794
|
+
return this.ke;
|
|
795
795
|
}
|
|
796
796
|
ut(t, e = {}, i = !1) {
|
|
797
|
-
const s = this.
|
|
797
|
+
const s = this.Ie(t, e), r = this.ze.get(s);
|
|
798
798
|
if (r) return r;
|
|
799
|
-
const o = { id: this.
|
|
800
|
-
return this.
|
|
799
|
+
const o = { id: this.Re++, shader: t, uniforms: Object.freeze({ ...e }), hash: s, isBuiltIn: i };
|
|
800
|
+
return this.ze.set(s, o), o;
|
|
801
801
|
}
|
|
802
|
-
|
|
803
|
-
return { id: this.
|
|
802
|
+
Oe(t, e = {}) {
|
|
803
|
+
return { id: this.Re++, shader: t, uniforms: Object.freeze({ ...e }), hash: 0, isBuiltIn: !1 };
|
|
804
804
|
}
|
|
805
|
-
|
|
806
|
-
const i = Et(t.
|
|
805
|
+
Ie(t, e) {
|
|
806
|
+
const i = Et(t.O), s = function(r, o) {
|
|
807
807
|
let h = 0;
|
|
808
808
|
const c = Object.keys(r).sort();
|
|
809
|
-
for (const l of c) h =
|
|
809
|
+
for (const l of c) h = z(h, Dt(l)), h = z(h, o(r[l]));
|
|
810
810
|
return h;
|
|
811
|
-
}(e, this.
|
|
812
|
-
return
|
|
811
|
+
}(e, this.De.bind(this));
|
|
812
|
+
return z(i, s);
|
|
813
813
|
}
|
|
814
|
-
|
|
814
|
+
De(t) {
|
|
815
815
|
return typeof t == "number" || typeof t == "boolean" ? function(e) {
|
|
816
816
|
return typeof e == "boolean" ? e ? 1 : 0 : Math.floor(e);
|
|
817
817
|
}(t) : Array.isArray(t) ? function(e) {
|
|
818
818
|
let i = 0;
|
|
819
819
|
const s = Array.isArray(e[0]) ? e.flat() : e;
|
|
820
|
-
for (const r of s) i =
|
|
820
|
+
for (const r of s) i = z(i, typeof r == "number" ? r : 0);
|
|
821
821
|
return i;
|
|
822
822
|
}(t) : t instanceof Float32Array || t instanceof Int32Array ? function(e) {
|
|
823
823
|
let i = 0;
|
|
824
824
|
const s = Math.min(e.length, 16);
|
|
825
|
-
for (let r = 0; r < s; r++) i =
|
|
825
|
+
for (let r = 0; r < s; r++) i = z(i, e[r]);
|
|
826
826
|
return i;
|
|
827
827
|
}(t) : t instanceof WebGLTexture ? Et(t) : 0;
|
|
828
828
|
}
|
|
829
829
|
D() {
|
|
830
|
-
this.
|
|
830
|
+
this.Se != this.Se && this.Se.D(), this.Se.D(), this.ze.clear();
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
833
|
class oe {
|
|
834
834
|
constructor() {
|
|
835
|
-
a(this, "
|
|
836
|
-
a(this, "
|
|
837
|
-
a(this, "
|
|
835
|
+
a(this, "He", []);
|
|
836
|
+
a(this, "Be", 1);
|
|
837
|
+
a(this, "Ts", 0);
|
|
838
838
|
}
|
|
839
|
-
|
|
840
|
-
if (this.
|
|
841
|
-
const s = { id: this.
|
|
842
|
-
this.
|
|
839
|
+
Ge(t, e) {
|
|
840
|
+
if (this.Ts >= this.He.length) {
|
|
841
|
+
const s = { id: this.Be++, type: t, params: {}, state: rt.Ut(), material: e };
|
|
842
|
+
this.He.push(s);
|
|
843
843
|
}
|
|
844
|
-
const i = this.
|
|
845
|
-
return i.id = this.
|
|
844
|
+
const i = this.He[this.Ts];
|
|
845
|
+
return i.id = this.Be++, i.type = t, i.material = e, this.Ts++, i;
|
|
846
846
|
}
|
|
847
|
-
|
|
848
|
-
const s = this.
|
|
849
|
-
return r.width = t.width, r.height = t.height, e.
|
|
847
|
+
Ne(t, e, i) {
|
|
848
|
+
const s = this.Ge(b.RECTANGLE, i), r = s.params;
|
|
849
|
+
return r.width = t.width, r.height = t.height, e.Yt(s.state), s.id;
|
|
850
850
|
}
|
|
851
|
-
|
|
852
|
-
const s = this.
|
|
853
|
-
return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, e.
|
|
851
|
+
Xe(t, e, i) {
|
|
852
|
+
const s = this.Ge(b.LINE, i), r = s.params;
|
|
853
|
+
return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, e.Yt(s.state), s.id;
|
|
854
854
|
}
|
|
855
|
-
|
|
856
|
-
const s = this.
|
|
857
|
-
return r.width = t.width, r.height = t.height, r.startAngle = t.startAngle, r.endAngle = t.endAngle, r.segments = t.segments, e.
|
|
855
|
+
Ye(t, e, i) {
|
|
856
|
+
const s = this.Ge(b.ELLIPSE, i), r = s.params;
|
|
857
|
+
return r.width = t.width, r.height = t.height, r.startAngle = t.startAngle, r.endAngle = t.endAngle, r.segments = t.segments, e.Yt(s.state), s.id;
|
|
858
858
|
}
|
|
859
|
-
|
|
860
|
-
const s = this.
|
|
861
|
-
return r.width = t.width, r.height = t.height, r.start = t.start, r.stop = t.stop, e.
|
|
859
|
+
Ke(t, e, i) {
|
|
860
|
+
const s = this.Ge(b.ARC, i), r = s.params;
|
|
861
|
+
return r.width = t.width, r.height = t.height, r.start = t.start, r.stop = t.stop, e.Yt(s.state), s.id;
|
|
862
862
|
}
|
|
863
|
-
|
|
864
|
-
const s = this.
|
|
865
|
-
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.
|
|
863
|
+
We(t, e, i) {
|
|
864
|
+
const s = this.Ge(b.TRIANGLE, i), r = s.params;
|
|
865
|
+
return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.x3 = t.x3, r.y3 = t.y3, e.Yt(s.state), s.id;
|
|
866
866
|
}
|
|
867
|
-
|
|
868
|
-
const s = this.
|
|
869
|
-
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.
|
|
867
|
+
Ze(t, e, i) {
|
|
868
|
+
const s = this.Ge(b.BEZIER_CURVE, i), r = s.params;
|
|
869
|
+
return r.x1 = t.x1, r.y1 = t.y1, r.cp1x = t.cp1x, r.cp1y = t.cp1y, r.cp2x = t.cp2x, r.cp2y = t.cp2y, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, r.segments = t.segments, e.Yt(s.state), s.id;
|
|
870
870
|
}
|
|
871
|
-
|
|
872
|
-
this.
|
|
871
|
+
ge() {
|
|
872
|
+
this.Ts = 0;
|
|
873
873
|
}
|
|
874
874
|
[Symbol.iterator]() {
|
|
875
875
|
let t = 0;
|
|
876
|
-
const e = this.
|
|
876
|
+
const e = this.Ts, i = this.He;
|
|
877
877
|
return { next: () => t < e ? { value: i[t++], done: !1 } : { value: void 0, done: !0 } };
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
880
|
class ae {
|
|
881
881
|
constructor(t) {
|
|
882
882
|
a(this, "A");
|
|
883
|
-
a(this, "
|
|
884
|
-
a(this, "
|
|
883
|
+
a(this, "je", null);
|
|
884
|
+
a(this, "Ve");
|
|
885
885
|
a(this, "ft");
|
|
886
|
-
a(this, "
|
|
887
|
-
a(this, "
|
|
888
|
-
a(this, "
|
|
889
|
-
a(this, "
|
|
890
|
-
a(this, "
|
|
891
|
-
a(this, "
|
|
892
|
-
a(this, "
|
|
893
|
-
a(this, "
|
|
894
|
-
a(this, "
|
|
895
|
-
this.A = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.
|
|
886
|
+
a(this, "qe");
|
|
887
|
+
a(this, "Qe");
|
|
888
|
+
a(this, "Je");
|
|
889
|
+
a(this, "ti", null);
|
|
890
|
+
a(this, "si", {});
|
|
891
|
+
a(this, "ei", []);
|
|
892
|
+
a(this, "ii", []);
|
|
893
|
+
a(this, "ri", null);
|
|
894
|
+
a(this, "ni", [0, 0, 0, 0]);
|
|
895
|
+
this.A = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.qe = new rt(), this.ft = new he(t), this.Qe = new oe(), this.Ve = new ne(t), this.Je = new Kt(t);
|
|
896
896
|
const e = [0, 0, t.canvas.width, t.canvas.height];
|
|
897
|
-
nt(t, e), this.
|
|
897
|
+
nt(t, e), this.ei.push(null), this.ii.push(e), this.ri = null, this.ni = e;
|
|
898
898
|
}
|
|
899
|
-
|
|
900
|
-
this.
|
|
899
|
+
et() {
|
|
900
|
+
this.ei.push(this.ri), this.ii.push([...this.ni]);
|
|
901
901
|
}
|
|
902
902
|
ht() {
|
|
903
|
-
return { framebuffer: this.
|
|
903
|
+
return { framebuffer: this.ei.pop() ?? null, viewport: this.ii.pop() ?? [0, 0, this.A.canvas.width, this.A.canvas.height] };
|
|
904
904
|
}
|
|
905
|
-
|
|
905
|
+
it(t, e, i) {
|
|
906
906
|
const s = this.A;
|
|
907
|
-
this.
|
|
907
|
+
this.ri !== t && (s.bindFramebuffer(s.FRAMEBUFFER, t), this.ri = t);
|
|
908
908
|
const r = [0, 0, e, i];
|
|
909
|
-
this.
|
|
909
|
+
this.ni[0] === r[0] && this.ni[1] === r[1] && this.ni[2] === r[2] && this.ni[3] === r[3] || (s.viewport(...r), nt(s, r), this.ni = r);
|
|
910
910
|
}
|
|
911
|
-
|
|
912
|
-
this.
|
|
911
|
+
oi(t) {
|
|
912
|
+
this.je !== t && (this.je = t, t.U());
|
|
913
913
|
}
|
|
914
|
-
|
|
914
|
+
hi(t, e) {
|
|
915
915
|
return new j(this.A, t, e);
|
|
916
916
|
}
|
|
917
|
-
|
|
918
|
-
this.
|
|
917
|
+
ai(t) {
|
|
918
|
+
this.ti = t, t && (this.si = {});
|
|
919
919
|
}
|
|
920
|
-
|
|
921
|
-
this.
|
|
920
|
+
L(t, e) {
|
|
921
|
+
this.si[t] = e;
|
|
922
922
|
}
|
|
923
|
-
|
|
924
|
-
Object.assign(this.
|
|
923
|
+
ci(t) {
|
|
924
|
+
Object.assign(this.si, t);
|
|
925
925
|
}
|
|
926
|
-
|
|
926
|
+
li(t) {
|
|
927
927
|
return new j(this.A, it, t);
|
|
928
928
|
}
|
|
929
|
-
|
|
930
|
-
this.
|
|
929
|
+
ui(t, e, i) {
|
|
930
|
+
this.Qe.Ne({ width: e ?? t.width, height: i ?? t.height }, this.qe, t.ct());
|
|
931
931
|
}
|
|
932
|
-
|
|
933
|
-
this.
|
|
932
|
+
fi(t, e, i, s) {
|
|
933
|
+
this.Je.bs(t, e, i, s);
|
|
934
934
|
}
|
|
935
|
-
|
|
936
|
-
if (this.
|
|
937
|
-
const i = this.ft.
|
|
938
|
-
this.
|
|
939
|
-
} else this.
|
|
935
|
+
di(t, e) {
|
|
936
|
+
if (this.ti) {
|
|
937
|
+
const i = this.ft.Oe(this.ti, this.si);
|
|
938
|
+
this.Qe.Ne({ width: t, height: e }, this.qe, i), this.ti = null, this.si = {};
|
|
939
|
+
} else this.Qe.Ne({ width: t, height: e }, this.qe, this.ft.Le);
|
|
940
940
|
}
|
|
941
|
-
|
|
942
|
-
this.
|
|
941
|
+
pi(t, e, i, s) {
|
|
942
|
+
this.Qe.Xe({ x1: t, y1: e, x2: i, y2: s }, this.qe, this.ft.Le);
|
|
943
943
|
}
|
|
944
|
-
|
|
945
|
-
this.
|
|
944
|
+
gi(t, e) {
|
|
945
|
+
this.Qe.Ye({ width: t, height: e }, this.qe, this.ft.Le);
|
|
946
946
|
}
|
|
947
|
-
|
|
948
|
-
this.
|
|
947
|
+
mi(t, e, i, s, r, o) {
|
|
948
|
+
this.Qe.We({ x1: t, y1: e, x2: i, y2: s, x3: r, y3: o }, this.qe, this.ft.Le);
|
|
949
949
|
}
|
|
950
|
-
|
|
951
|
-
this.
|
|
950
|
+
_i(t, e, i, s, r, o, h, c) {
|
|
951
|
+
this.Qe.Ze({ x1: t, y1: e, cp1x: i, cp1y: s, cp2x: r, cp2y: o, x2: h, y2: c }, this.qe, this.ft.Le);
|
|
952
952
|
}
|
|
953
|
-
|
|
954
|
-
this.
|
|
953
|
+
Ai(t, e, i, s) {
|
|
954
|
+
this.Qe.Ke({ width: t, height: e, start: i, stop: s }, this.qe, this.ft.Le);
|
|
955
955
|
}
|
|
956
|
-
|
|
956
|
+
yi(t, e, i = 1, s = {}) {
|
|
957
957
|
return new et(this.A, t, e, i, s, this);
|
|
958
958
|
}
|
|
959
|
-
|
|
960
|
-
this.
|
|
961
|
-
const [r, o, h, c] = this.
|
|
962
|
-
this.
|
|
959
|
+
wi(t, e = t, i = t, s = 255) {
|
|
960
|
+
this.qe.us(t, e ?? t, i ?? t, s);
|
|
961
|
+
const [r, o, h, c] = this.qe.canvasBackgroundColor;
|
|
962
|
+
this.ge(r, o, h, c);
|
|
963
963
|
}
|
|
964
|
-
|
|
964
|
+
ge(t = 0, e = 0, i = 0, s = 0) {
|
|
965
965
|
this.A.clearColor(t, e, i, s), this.A.clear(this.A.COLOR_BUFFER_BIT);
|
|
966
966
|
}
|
|
967
|
-
|
|
967
|
+
bi() {
|
|
968
968
|
const t = [0, 0, this.A.canvas.width, this.A.canvas.height];
|
|
969
|
-
this.A.viewport(...t), nt(this.A, t), this.
|
|
969
|
+
this.A.viewport(...t), nt(this.A, t), this.ni = t, this.ii.length > 0 && (this.ii[0] = t);
|
|
970
970
|
}
|
|
971
971
|
ot() {
|
|
972
|
-
const t = this.
|
|
973
|
-
this.
|
|
972
|
+
const t = this.Qe;
|
|
973
|
+
this.Ve.Te(t), t.ge();
|
|
974
974
|
}
|
|
975
975
|
D() {
|
|
976
|
-
this.ft.D(), this.
|
|
976
|
+
this.ft.D(), this.Ve.D(), this.Je.D();
|
|
977
977
|
}
|
|
978
978
|
get context() {
|
|
979
979
|
return this.A;
|
|
980
980
|
}
|
|
981
981
|
get state() {
|
|
982
|
-
return this.
|
|
982
|
+
return this.qe;
|
|
983
983
|
}
|
|
984
984
|
get materialManager() {
|
|
985
985
|
return this.ft;
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
|
-
const
|
|
988
|
+
const R = { readShort: (n, t) => (R.t.uint16[0] = n[t] << 8 | n[t + 1], R.t.int16[0]), readUshort: (n, t) => n[t] << 8 | n[t + 1], readUshorts(n, t, e) {
|
|
989
989
|
const i = [];
|
|
990
|
-
for (let s = 0; s < e; s++) i.push(
|
|
990
|
+
for (let s = 0; s < e; s++) i.push(R.readUshort(n, t + 2 * s));
|
|
991
991
|
return i;
|
|
992
992
|
}, readUint(n, t) {
|
|
993
|
-
const e =
|
|
994
|
-
return e[3] = n[t], e[2] = n[t + 1], e[1] = n[t + 2], e[0] = n[t + 3],
|
|
993
|
+
const e = R.t.uint8;
|
|
994
|
+
return e[3] = n[t], e[2] = n[t + 1], e[1] = n[t + 2], e[0] = n[t + 3], R.t.uint32[0];
|
|
995
995
|
}, readASCII(n, t, e) {
|
|
996
996
|
let i = "";
|
|
997
997
|
for (let s = 0; s < e; s++) i += String.fromCharCode(n[t + s]);
|
|
@@ -1000,10 +1000,10 @@ const P = { readShort: (n, t) => (P.t.uint16[0] = n[t] << 8 | n[t + 1], P.t.int1
|
|
|
1000
1000
|
const n = new ArrayBuffer(8);
|
|
1001
1001
|
return { uint8: new Uint8Array(n), int16: new Int16Array(n), uint16: new Uint16Array(n), uint32: new Uint32Array(n) };
|
|
1002
1002
|
})() };
|
|
1003
|
-
function
|
|
1003
|
+
function q(n) {
|
|
1004
1004
|
return n + 3 & -4;
|
|
1005
1005
|
}
|
|
1006
|
-
function
|
|
1006
|
+
function Q(n, t, e) {
|
|
1007
1007
|
n[t] = e >>> 8 & 255, n[t + 1] = 255 & e;
|
|
1008
1008
|
}
|
|
1009
1009
|
function L(n, t, e) {
|
|
@@ -1015,7 +1015,7 @@ function ce(n, t, e) {
|
|
|
1015
1015
|
function ht(n, t, e) {
|
|
1016
1016
|
const i = t + e;
|
|
1017
1017
|
let s = 0;
|
|
1018
|
-
const r =
|
|
1018
|
+
const r = R.t;
|
|
1019
1019
|
for (let o = t; o < i; o += 4) r.uint8[3] = n[o] || 0, r.uint8[2] = n[o + 1] || 0, r.uint8[1] = n[o + 2] || 0, r.uint8[0] = n[o + 3] || 0, s = s + (r.uint32[0] >>> 0) >>> 0;
|
|
1020
1020
|
return s >>> 0;
|
|
1021
1021
|
}
|
|
@@ -1111,27 +1111,27 @@ function fe(n) {
|
|
|
1111
1111
|
g = K(d), p = K(Array(32).fill(5));
|
|
1112
1112
|
} else {
|
|
1113
1113
|
const d = r.readBits(5) + 257, v = r.readBits(5) + 1, m = r.readBits(4) + 4, E = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], y = Array(19).fill(0);
|
|
1114
|
-
for (let
|
|
1115
|
-
const
|
|
1114
|
+
for (let F = 0; F < m; F++) y[E[F]] = r.readBits(3);
|
|
1115
|
+
const T = K(y), w = [];
|
|
1116
1116
|
for (; w.length < d + v; ) {
|
|
1117
|
-
const
|
|
1118
|
-
if (
|
|
1119
|
-
else if (
|
|
1120
|
-
const
|
|
1121
|
-
for (let
|
|
1122
|
-
} else if (
|
|
1123
|
-
const
|
|
1124
|
-
for (let
|
|
1117
|
+
const F = ot(r, T);
|
|
1118
|
+
if (F <= 15) w.push(F);
|
|
1119
|
+
else if (F === 16) {
|
|
1120
|
+
const S = r.readBits(2) + 3, D = w[w.length - 1] || 0;
|
|
1121
|
+
for (let k = 0; k < S; k++) w.push(D);
|
|
1122
|
+
} else if (F === 17) {
|
|
1123
|
+
const S = r.readBits(3) + 3;
|
|
1124
|
+
for (let D = 0; D < S; D++) w.push(0);
|
|
1125
1125
|
} else {
|
|
1126
|
-
if (
|
|
1126
|
+
if (F !== 18) throw Error("Invalid code length symbol");
|
|
1127
1127
|
{
|
|
1128
|
-
const
|
|
1129
|
-
for (let
|
|
1128
|
+
const S = r.readBits(7) + 11;
|
|
1129
|
+
for (let D = 0; D < S; D++) w.push(0);
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
1132
1132
|
}
|
|
1133
|
-
const x = w.slice(0, d),
|
|
1134
|
-
g = K(x), p = K(
|
|
1133
|
+
const x = w.slice(0, d), M = w.slice(d, d + v);
|
|
1134
|
+
g = K(x), p = K(M);
|
|
1135
1135
|
}
|
|
1136
1136
|
for (; ; ) {
|
|
1137
1137
|
const d = ot(r, g);
|
|
@@ -1145,12 +1145,12 @@ function fe(n) {
|
|
|
1145
1145
|
E && (m += r.readBits(E));
|
|
1146
1146
|
const y = ot(r, p);
|
|
1147
1147
|
if (y >= 30) throw Error("Invalid distance symbol");
|
|
1148
|
-
let
|
|
1148
|
+
let T = l[y];
|
|
1149
1149
|
const w = u[y];
|
|
1150
|
-
w && (
|
|
1151
|
-
const x = o.length -
|
|
1150
|
+
w && (T += r.readBits(w));
|
|
1151
|
+
const x = o.length - T;
|
|
1152
1152
|
if (x < 0) throw Error("Invalid distance");
|
|
1153
|
-
for (let
|
|
1153
|
+
for (let M = 0; M < m; M++) o.push(o[x + M] || 0);
|
|
1154
1154
|
} else if (d === 286 || d === 287) throw Error("Reserved length symbol");
|
|
1155
1155
|
}
|
|
1156
1156
|
}
|
|
@@ -1160,13 +1160,13 @@ function fe(n) {
|
|
|
1160
1160
|
}(new le(n.subarray(i)), s), new Uint8Array(s);
|
|
1161
1161
|
}
|
|
1162
1162
|
function de(n) {
|
|
1163
|
-
const t =
|
|
1163
|
+
const t = R, e = new Uint8Array(n);
|
|
1164
1164
|
if (t.readASCII(e, 0, 4) !== "wOFF") throw Error("Invalid WOFF signature");
|
|
1165
1165
|
const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), o = [];
|
|
1166
1166
|
let h = 44;
|
|
1167
1167
|
for (let m = 0; m < s; m++) {
|
|
1168
|
-
const E = t.readASCII(e, h, 4), y = t.readUint(e, h + 4),
|
|
1169
|
-
o.push({ tag: E, offset: y, compLength:
|
|
1168
|
+
const E = t.readASCII(e, h, 4), y = t.readUint(e, h + 4), T = t.readUint(e, h + 8), w = t.readUint(e, h + 12), x = t.readUint(e, h + 16);
|
|
1169
|
+
o.push({ tag: E, offset: y, compLength: T, origLength: w, checksum: x }), h += 20;
|
|
1170
1170
|
}
|
|
1171
1171
|
for (const m of o) {
|
|
1172
1172
|
const E = new Uint8Array(e.buffer, m.offset, m.compLength);
|
|
@@ -1182,18 +1182,18 @@ function de(n) {
|
|
|
1182
1182
|
const f = 16 * l, A = 16 * c - f;
|
|
1183
1183
|
let g = 12 + 16 * c;
|
|
1184
1184
|
const p = {};
|
|
1185
|
-
for (const m of o) p[m.tag] = g, g =
|
|
1185
|
+
for (const m of o) p[m.tag] = g, g = q(g + m.data.length);
|
|
1186
1186
|
const d = new Uint8Array(Math.max(r || 0, g));
|
|
1187
|
-
L(d, 0, i),
|
|
1187
|
+
L(d, 0, i), Q(d, 4, c), Q(d, 6, f), Q(d, 8, u), Q(d, 10, A);
|
|
1188
1188
|
let v = 12;
|
|
1189
1189
|
for (const m of o) {
|
|
1190
1190
|
ce(d, v, m.tag), v += 4;
|
|
1191
1191
|
let E = m.data;
|
|
1192
1192
|
if (m.tag === "head" && E.length >= 12) {
|
|
1193
1193
|
const y = new Uint8Array(E);
|
|
1194
|
-
L(y, 8, 0), L(d, v, ht(y, 0,
|
|
1194
|
+
L(y, 8, 0), L(d, v, ht(y, 0, q(y.length))), v += 4;
|
|
1195
1195
|
} else
|
|
1196
|
-
L(d, v, ht(E, 0,
|
|
1196
|
+
L(d, v, ht(E, 0, q(E.length))), v += 4;
|
|
1197
1197
|
L(d, v, p[m.tag]), v += 4, L(d, v, m.data.length), v += 4;
|
|
1198
1198
|
}
|
|
1199
1199
|
for (const m of o) {
|
|
@@ -1201,11 +1201,11 @@ function de(n) {
|
|
|
1201
1201
|
d.set(m.data, E);
|
|
1202
1202
|
}
|
|
1203
1203
|
if (o.find((m) => m.tag === "head")) {
|
|
1204
|
-
const m = p.head, E = function(y,
|
|
1205
|
-
const w =
|
|
1204
|
+
const m = p.head, E = function(y, T) {
|
|
1205
|
+
const w = T + 8, x = [y[w], y[w + 1], y[w + 2], y[w + 3]];
|
|
1206
1206
|
L(y, w, 0);
|
|
1207
|
-
const
|
|
1208
|
-
return y[w] = x[0], y[w + 1] = x[1], y[w + 2] = x[2], y[w + 3] = x[3],
|
|
1207
|
+
const M = 2981146554 - (ht(y, 0, q(y.length)) >>> 0) >>> 0;
|
|
1208
|
+
return y[w] = x[0], y[w + 1] = x[1], y[w + 2] = x[2], y[w + 3] = x[3], M >>> 0;
|
|
1209
1209
|
}(d, m);
|
|
1210
1210
|
L(d, m + 8, E);
|
|
1211
1211
|
}
|
|
@@ -1214,7 +1214,7 @@ function de(n) {
|
|
|
1214
1214
|
const ge = { parseTab(n, t, e) {
|
|
1215
1215
|
const i = { tables: [], ids: {}, off: t };
|
|
1216
1216
|
n = new Uint8Array(n.buffer, t, e), t = 0;
|
|
1217
|
-
const s =
|
|
1217
|
+
const s = R, r = s.readUshort, o = r(n, t += 2);
|
|
1218
1218
|
t += 2;
|
|
1219
1219
|
const h = [];
|
|
1220
1220
|
for (let c = 0; c < o; c++) {
|
|
@@ -1234,14 +1234,14 @@ const ge = { parseTab(n, t, e) {
|
|
|
1234
1234
|
}
|
|
1235
1235
|
return i;
|
|
1236
1236
|
}, parse4(n, t) {
|
|
1237
|
-
const e =
|
|
1237
|
+
const e = R, i = e.readUshort, s = e.readUshorts, r = t, o = i(n, t += 2);
|
|
1238
1238
|
t += 2;
|
|
1239
1239
|
const h = i(n, t += 2) >>> 1, c = { format: 4, searchRange: i(n, t += 2), entrySelector: 0, rangeShift: 0, endCount: [], startCount: [], idDelta: [], idRangeOffset: [], glyphIdArray: [] };
|
|
1240
1240
|
t += 2, c.entrySelector = i(n, t), t += 2, c.rangeShift = i(n, t), t += 2, c.endCount = s(n, t, h), t += 2 * h, t += 2, c.startCount = s(n, t, h), t += 2 * h;
|
|
1241
1241
|
for (let l = 0; l < h; l++) c.idDelta.push(e.readShort(n, t)), t += 2;
|
|
1242
1242
|
return c.idRangeOffset = s(n, t, h), t += 2 * h, c.glyphIdArray = s(n, t, r + o - t >> 1), c;
|
|
1243
1243
|
}, parse12(n, t) {
|
|
1244
|
-
const e =
|
|
1244
|
+
const e = R.readUint;
|
|
1245
1245
|
e(n, t += 4), e(n, t += 4);
|
|
1246
1246
|
const i = e(n, t += 4);
|
|
1247
1247
|
t += 4;
|
|
@@ -1249,7 +1249,7 @@ const ge = { parseTab(n, t, e) {
|
|
|
1249
1249
|
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);
|
|
1250
1250
|
return { format: 12, groups: s };
|
|
1251
1251
|
} }, Ae = { parseTab(n, t, e) {
|
|
1252
|
-
const i =
|
|
1252
|
+
const i = R;
|
|
1253
1253
|
t += 18;
|
|
1254
1254
|
const s = i.readUshort(n, t);
|
|
1255
1255
|
t += 2, t += 16;
|
|
@@ -1262,7 +1262,7 @@ const ge = { parseTab(n, t, e) {
|
|
|
1262
1262
|
const c = i.readShort(n, t);
|
|
1263
1263
|
return t += 2, t += 6, { unitsPerEm: s, xMin: r, yMin: o, xMax: h, yMax: c, indexToLocFormat: i.readShort(n, t) };
|
|
1264
1264
|
} }, pe = { parseTab(n, t, e) {
|
|
1265
|
-
const i =
|
|
1265
|
+
const i = R;
|
|
1266
1266
|
t += 4;
|
|
1267
1267
|
const s = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], r = {};
|
|
1268
1268
|
for (let o = 0; o < s.length; o++) {
|
|
@@ -1271,16 +1271,16 @@ const ge = { parseTab(n, t, e) {
|
|
|
1271
1271
|
}
|
|
1272
1272
|
return r;
|
|
1273
1273
|
} }, me = { parseTab(n, t, e, i) {
|
|
1274
|
-
const s =
|
|
1274
|
+
const s = R, r = [], o = [], h = i.maxp.numGlyphs, c = i.hhea.numberOfHMetrics;
|
|
1275
1275
|
let l = 0, u = 0, f = 0;
|
|
1276
1276
|
for (; f < c; ) l = s.readUshort(n, t + (f << 2)), u = s.readShort(n, t + (f << 2) + 2), r.push(l), o.push(u), f++;
|
|
1277
1277
|
for (; f < h; ) r.push(l), o.push(u), f++;
|
|
1278
1278
|
return { aWidth: r, lsBearing: o };
|
|
1279
1279
|
} }, wt = { cmap: ge, head: Ae, hhea: pe, maxp: { parseTab(n, t, e) {
|
|
1280
|
-
const i =
|
|
1280
|
+
const i = R;
|
|
1281
1281
|
return i.readUint(n, t), t += 4, { numGlyphs: i.readUshort(n, t) };
|
|
1282
1282
|
} }, hmtx: me, loca: { parseTab(n, t, e, i) {
|
|
1283
|
-
const s =
|
|
1283
|
+
const s = R, r = [], o = i.head.indexToLocFormat, h = i.maxp.numGlyphs + 1;
|
|
1284
1284
|
if (o === 0) for (let c = 0; c < h; c++) r.push(s.readUshort(n, t + (c << 1)) << 1);
|
|
1285
1285
|
else if (o === 1) for (let c = 0; c < h; c++) r.push(s.readUint(n, t + (c << 2)));
|
|
1286
1286
|
return r;
|
|
@@ -1288,10 +1288,10 @@ const ge = { parseTab(n, t, e) {
|
|
|
1288
1288
|
const s = [], r = i.maxp.numGlyphs;
|
|
1289
1289
|
for (let o = 0; o < r; o++) s.push(null);
|
|
1290
1290
|
return s;
|
|
1291
|
-
},
|
|
1292
|
-
const e =
|
|
1291
|
+
}, Ci(n, t) {
|
|
1292
|
+
const e = R, i = n.xi, s = n.loca;
|
|
1293
1293
|
if (s[t] === s[t + 1]) return null;
|
|
1294
|
-
const r =
|
|
1294
|
+
const r = _.findTable(i, "glyf", n.Mi);
|
|
1295
1295
|
if (!r) return null;
|
|
1296
1296
|
let o = r[0] + s[t];
|
|
1297
1297
|
const h = {};
|
|
@@ -1326,12 +1326,12 @@ const ge = { parseTab(n, t, e) {
|
|
|
1326
1326
|
for (let A = 0; A < l; A++) u += h.xs[A], f += h.ys[A], h.xs[A] = u, h.ys[A] = f;
|
|
1327
1327
|
} else h.parts = [], h.endPts = [], h.flags = [], h.xs = [], h.ys = [];
|
|
1328
1328
|
return h;
|
|
1329
|
-
} } },
|
|
1329
|
+
} } }, _ = { parse(n) {
|
|
1330
1330
|
const t = new Uint8Array(n);
|
|
1331
|
-
|
|
1332
|
-
const e = new Uint8Array(n), i = wt, s = {}, r = {
|
|
1331
|
+
R.readASCII(t, 0, 4) === "wOFF" && (n = de(n));
|
|
1332
|
+
const e = new Uint8Array(n), i = wt, s = {}, r = { xi: e, Fi: 0, Mi: 0 };
|
|
1333
1333
|
for (const o in i) {
|
|
1334
|
-
const h = o, c =
|
|
1334
|
+
const h = o, c = _.findTable(e, h, 0);
|
|
1335
1335
|
if (c) {
|
|
1336
1336
|
const [l, u] = c;
|
|
1337
1337
|
let f = s[l];
|
|
@@ -1340,7 +1340,7 @@ const ge = { parseTab(n, t, e) {
|
|
|
1340
1340
|
}
|
|
1341
1341
|
return [r];
|
|
1342
1342
|
}, findTable(n, t, e) {
|
|
1343
|
-
const i =
|
|
1343
|
+
const i = R, s = i.readUshort(n, e + 4);
|
|
1344
1344
|
let r = e + 12;
|
|
1345
1345
|
for (let o = 0; o < s; o++) {
|
|
1346
1346
|
const h = i.readASCII(n, r, 4);
|
|
@@ -1350,29 +1350,29 @@ const ge = { parseTab(n, t, e) {
|
|
|
1350
1350
|
r += 16;
|
|
1351
1351
|
}
|
|
1352
1352
|
return null;
|
|
1353
|
-
}, T: wt, B:
|
|
1353
|
+
}, T: wt, B: R };
|
|
1354
1354
|
class ve {
|
|
1355
|
-
|
|
1355
|
+
$i(t) {
|
|
1356
1356
|
var i;
|
|
1357
1357
|
const e = [];
|
|
1358
1358
|
return (i = t.cmap) != null && i.tables ? (t.cmap.tables.forEach((s) => {
|
|
1359
1359
|
if (s.format === 4) {
|
|
1360
|
-
const r = this.
|
|
1360
|
+
const r = this.Ti(s);
|
|
1361
1361
|
e.push(...r);
|
|
1362
1362
|
} else if (s.format === 12) {
|
|
1363
|
-
const r = this.
|
|
1363
|
+
const r = this.Pi(s);
|
|
1364
1364
|
e.push(...r);
|
|
1365
1365
|
}
|
|
1366
1366
|
}), [...new Set(e)]) : [];
|
|
1367
1367
|
}
|
|
1368
|
-
|
|
1368
|
+
Ti(t) {
|
|
1369
1369
|
const e = [];
|
|
1370
1370
|
if (!(t.startCount && t.endCount && t.idRangeOffset && t.idDelta)) return e;
|
|
1371
1371
|
for (let i = 0; i < t.startCount.length; i++) {
|
|
1372
1372
|
const s = t.startCount[i], r = t.endCount[i];
|
|
1373
1373
|
if (s !== 65535 || r !== 65535) {
|
|
1374
1374
|
for (let o = s; o <= r; o++)
|
|
1375
|
-
if (this.
|
|
1375
|
+
if (this.Ei(t, o, i) > 0) try {
|
|
1376
1376
|
const h = String.fromCodePoint(o);
|
|
1377
1377
|
e.push(h);
|
|
1378
1378
|
} catch {
|
|
@@ -1381,7 +1381,7 @@ class ve {
|
|
|
1381
1381
|
}
|
|
1382
1382
|
return e;
|
|
1383
1383
|
}
|
|
1384
|
-
|
|
1384
|
+
Pi(t) {
|
|
1385
1385
|
const e = [];
|
|
1386
1386
|
if (!t.groups) return e;
|
|
1387
1387
|
for (let i = 0; i < t.groups.length; i += 3) {
|
|
@@ -1395,7 +1395,7 @@ class ve {
|
|
|
1395
1395
|
}
|
|
1396
1396
|
return e;
|
|
1397
1397
|
}
|
|
1398
|
-
|
|
1398
|
+
Ei(t, e, i) {
|
|
1399
1399
|
if (t.idRangeOffset[i] === 0) return e + t.idDelta[i] & 65535;
|
|
1400
1400
|
{
|
|
1401
1401
|
const s = t.idRangeOffset[i] / 2 + (e - t.startCount[i]) - (t.startCount.length - i);
|
|
@@ -1409,37 +1409,37 @@ class ve {
|
|
|
1409
1409
|
}
|
|
1410
1410
|
class gt {
|
|
1411
1411
|
constructor() {
|
|
1412
|
-
a(this, "
|
|
1413
|
-
a(this, "
|
|
1412
|
+
a(this, "Ri", /* @__PURE__ */ new Map());
|
|
1413
|
+
a(this, "Si", /* @__PURE__ */ new Map());
|
|
1414
1414
|
}
|
|
1415
|
-
|
|
1416
|
-
const i = `${this.
|
|
1417
|
-
if (this.
|
|
1415
|
+
Ui(t, e) {
|
|
1416
|
+
const i = `${this.ki(t)}_${e}`;
|
|
1417
|
+
if (this.Ri.has(i)) return this.Ri.get(i);
|
|
1418
1418
|
const s = t.cmap;
|
|
1419
|
-
if (!s || !s.tables) return this.
|
|
1419
|
+
if (!s || !s.tables) return this.Ri.set(i, 0), 0;
|
|
1420
1420
|
let r = 0;
|
|
1421
|
-
for (const o of s.tables) if (o.format === 4 ? r = this.
|
|
1422
|
-
return this.
|
|
1421
|
+
for (const o of s.tables) if (o.format === 4 ? r = this.zi(e, o) : o.format === 12 && (r = this.Ii(e, o)), r > 0) break;
|
|
1422
|
+
return this.Ri.set(i, r), r;
|
|
1423
1423
|
}
|
|
1424
|
-
|
|
1424
|
+
Li(t, e) {
|
|
1425
1425
|
const i = e.codePointAt(0);
|
|
1426
|
-
return i === void 0 ? 0 : this.
|
|
1426
|
+
return i === void 0 ? 0 : this.Ui(t, i);
|
|
1427
1427
|
}
|
|
1428
|
-
|
|
1428
|
+
Oi(t, e) {
|
|
1429
1429
|
const i = t.hmtx;
|
|
1430
1430
|
return i && i.aWidth && i.aWidth.length !== 0 ? e < i.aWidth.length ? i.aWidth[e] : i.aWidth[i.aWidth.length - 1] : 0;
|
|
1431
1431
|
}
|
|
1432
|
-
|
|
1432
|
+
Di(t, e) {
|
|
1433
1433
|
const i = e / t.head.unitsPerEm, s = t.hhea.ascender * i, r = t.hhea.descender * i, o = t.hhea.lineGap * i;
|
|
1434
1434
|
return { ascender: s, descender: r, lineGap: o, lineHeight: s - r + o, unitsPerEm: t.head.unitsPerEm, scale: i };
|
|
1435
1435
|
}
|
|
1436
|
-
|
|
1437
|
-
this.
|
|
1436
|
+
Hi() {
|
|
1437
|
+
this.Ri.clear(), this.Si.clear();
|
|
1438
1438
|
}
|
|
1439
|
-
|
|
1440
|
-
return `${t
|
|
1439
|
+
ki(t) {
|
|
1440
|
+
return `${t.Mi}_${t.xi.length}`;
|
|
1441
1441
|
}
|
|
1442
|
-
|
|
1442
|
+
zi(t, e) {
|
|
1443
1443
|
const i = e.endCount.length;
|
|
1444
1444
|
let s = -1;
|
|
1445
1445
|
for (let r = 0; r < i; r++) if (t <= e.endCount[r]) {
|
|
@@ -1457,7 +1457,7 @@ class gt {
|
|
|
1457
1457
|
}
|
|
1458
1458
|
return 0;
|
|
1459
1459
|
}
|
|
1460
|
-
|
|
1460
|
+
Ii(t, e) {
|
|
1461
1461
|
const i = e.groups.length / 3;
|
|
1462
1462
|
for (let s = 0; s < i; s++) {
|
|
1463
1463
|
const r = e.groups[3 * s], o = e.groups[3 * s + 1], h = e.groups[3 * s + 2];
|
|
@@ -1468,202 +1468,202 @@ class gt {
|
|
|
1468
1468
|
}
|
|
1469
1469
|
class ye {
|
|
1470
1470
|
constructor(t) {
|
|
1471
|
-
a(this, "
|
|
1472
|
-
a(this, "
|
|
1471
|
+
a(this, "Bi");
|
|
1472
|
+
a(this, "Gi");
|
|
1473
1473
|
a(this, "W");
|
|
1474
|
-
a(this, "
|
|
1475
|
-
this.W = t, this.
|
|
1474
|
+
a(this, "Ni");
|
|
1475
|
+
this.W = t, this.Ni = new gt(), this.Bi = document.createElement("canvas"), this.Gi = this.Bi.getContext("2d", { willReadFrequently: !0, alpha: !0 });
|
|
1476
1476
|
}
|
|
1477
|
-
|
|
1477
|
+
Xi(t, e, i, s) {
|
|
1478
1478
|
const r = t.length, o = Math.ceil(Math.sqrt(r)), h = Math.ceil(r / o), c = e.width * o, l = e.height * h;
|
|
1479
|
-
this.
|
|
1480
|
-
const u = this.W.
|
|
1481
|
-
return u.st(this.
|
|
1479
|
+
this.Yi(c, l), this.Ki(t, e, o, i, s);
|
|
1480
|
+
const u = this.W.yi(c, l, 1, { filter: "nearest" });
|
|
1481
|
+
return u.st(this.Bi), { framebuffer: u, columns: o, rows: h };
|
|
1482
1482
|
}
|
|
1483
|
-
|
|
1484
|
-
this.
|
|
1483
|
+
Yi(t, e) {
|
|
1484
|
+
this.Bi.width = t, this.Bi.height = e, this.Bi.style.width = t + "px", this.Bi.style.height = e + "px", this.Gi.imageSmoothingEnabled = !1, this.Bi.style.imageRendering = "pixelated", this.Gi.clearRect(0, 0, t, e), this.Gi.textBaseline = "top", this.Gi.textAlign = "left", this.Gi.fillStyle = "white";
|
|
1485
1485
|
}
|
|
1486
|
-
|
|
1486
|
+
Ki(t, e, i, s, r) {
|
|
1487
1487
|
const o = s / r.head.unitsPerEm;
|
|
1488
1488
|
for (let h = 0; h < t.length; h++) {
|
|
1489
|
-
const c = h % i, l = Math.floor(h / i), u = t[h].character, f = this.
|
|
1489
|
+
const c = h % i, l = Math.floor(h / i), u = t[h].character, f = this.Wi(r, u);
|
|
1490
1490
|
if (!f) continue;
|
|
1491
|
-
const A = u.codePointAt(0) || 0, g = this.
|
|
1492
|
-
this.
|
|
1491
|
+
const A = u.codePointAt(0) || 0, g = this.Ni.Ui(r, A), p = this.Ni.Oi(r, g) * o, d = c * e.width, v = l * e.height, m = d + 0.5 * e.width, E = v + 0.5 * e.height, y = Math.round(m - 0.5 * e.width), T = Math.round(E - 0.5 * s), w = y + 0.5 * (e.width - p), x = T + r.hhea.ascender * o;
|
|
1492
|
+
this.Zi(f, w, x, o);
|
|
1493
1493
|
}
|
|
1494
1494
|
}
|
|
1495
|
-
|
|
1496
|
-
const i = e.codePointAt(0) || 0, s = this.
|
|
1497
|
-
return s === 0 ? null :
|
|
1495
|
+
Wi(t, e) {
|
|
1496
|
+
const i = e.codePointAt(0) || 0, s = this.Ni.Ui(t, i);
|
|
1497
|
+
return s === 0 ? null : _.T.glyf.Ci(t, s);
|
|
1498
1498
|
}
|
|
1499
|
-
|
|
1499
|
+
Zi(t, e, i, s) {
|
|
1500
1500
|
if (!t || !t.xs || t.noc === 0) return;
|
|
1501
1501
|
let { xs: r, ys: o, endPts: h, flags: c } = t;
|
|
1502
1502
|
if (!(r && o && h && c)) return;
|
|
1503
|
-
this.
|
|
1503
|
+
this.Gi.beginPath();
|
|
1504
1504
|
let l = 0;
|
|
1505
1505
|
for (let u = 0; u < h.length; u++) {
|
|
1506
1506
|
const f = h[u];
|
|
1507
1507
|
if (!(f < l)) {
|
|
1508
1508
|
if (f >= l) {
|
|
1509
1509
|
const A = e + r[l] * s, g = i - o[l] * s;
|
|
1510
|
-
this.
|
|
1510
|
+
this.Gi.moveTo(A, g);
|
|
1511
1511
|
let p = l + 1;
|
|
1512
1512
|
for (; p <= f; )
|
|
1513
1513
|
if (1 & c[p]) {
|
|
1514
1514
|
const d = e + r[p] * s, v = i - o[p] * s;
|
|
1515
|
-
this.
|
|
1515
|
+
this.Gi.lineTo(d, v), p++;
|
|
1516
1516
|
} else {
|
|
1517
1517
|
const d = e + r[p] * s, v = i - o[p] * s;
|
|
1518
1518
|
if (p + 1 > f) {
|
|
1519
1519
|
const E = e + r[l] * s, y = i - o[l] * s;
|
|
1520
|
-
if (1 & c[l]) this.
|
|
1520
|
+
if (1 & c[l]) this.Gi.quadraticCurveTo(d, v, E, y);
|
|
1521
1521
|
else {
|
|
1522
|
-
const
|
|
1523
|
-
this.
|
|
1522
|
+
const T = (d + E) / 2, w = (v + y) / 2;
|
|
1523
|
+
this.Gi.quadraticCurveTo(d, v, T, w);
|
|
1524
1524
|
}
|
|
1525
1525
|
break;
|
|
1526
1526
|
}
|
|
1527
1527
|
const m = p + 1;
|
|
1528
1528
|
if (1 & c[m]) {
|
|
1529
1529
|
const E = e + r[m] * s, y = i - o[m] * s;
|
|
1530
|
-
this.
|
|
1530
|
+
this.Gi.quadraticCurveTo(d, v, E, y), p = m + 1;
|
|
1531
1531
|
} else {
|
|
1532
1532
|
const E = (d + (e + r[m] * s)) / 2, y = (v + (i - o[m] * s)) / 2;
|
|
1533
|
-
this.
|
|
1533
|
+
this.Gi.quadraticCurveTo(d, v, E, y), p = m;
|
|
1534
1534
|
}
|
|
1535
1535
|
}
|
|
1536
|
-
this.
|
|
1536
|
+
this.Gi.closePath();
|
|
1537
1537
|
}
|
|
1538
1538
|
l = f + 1;
|
|
1539
1539
|
}
|
|
1540
1540
|
}
|
|
1541
|
-
this.
|
|
1541
|
+
this.Gi.fill();
|
|
1542
1542
|
}
|
|
1543
1543
|
}
|
|
1544
1544
|
class Ee {
|
|
1545
1545
|
constructor() {
|
|
1546
|
-
a(this, "
|
|
1547
|
-
this.
|
|
1546
|
+
a(this, "ji");
|
|
1547
|
+
this.ji = new gt();
|
|
1548
1548
|
}
|
|
1549
|
-
|
|
1549
|
+
Vi(t, e, i) {
|
|
1550
1550
|
let s = 0;
|
|
1551
|
-
const r = this.
|
|
1551
|
+
const r = this.ji.Di(i, e), o = r.lineHeight;
|
|
1552
1552
|
for (const h of t) {
|
|
1553
|
-
const c = this.
|
|
1553
|
+
const c = this.ji.Li(i, h);
|
|
1554
1554
|
if (c === 0) continue;
|
|
1555
|
-
const l = this.
|
|
1555
|
+
const l = this.ji.Oi(i, c) * r.scale;
|
|
1556
1556
|
s = Math.max(s, l);
|
|
1557
1557
|
}
|
|
1558
1558
|
return { width: Math.ceil(s), height: Math.ceil(o) };
|
|
1559
1559
|
}
|
|
1560
|
-
|
|
1561
|
-
this.
|
|
1560
|
+
Hi() {
|
|
1561
|
+
this.ji.Hi();
|
|
1562
1562
|
}
|
|
1563
1563
|
}
|
|
1564
1564
|
class we {
|
|
1565
1565
|
constructor() {
|
|
1566
|
-
a(this, "
|
|
1567
|
-
this.
|
|
1566
|
+
a(this, "Ni");
|
|
1567
|
+
this.Ni = new gt();
|
|
1568
1568
|
}
|
|
1569
1569
|
createCharacterObjects(t, e) {
|
|
1570
1570
|
return t.map((i, s) => {
|
|
1571
|
-
const r = i.codePointAt(0) || 0, o = this.
|
|
1571
|
+
const r = i.codePointAt(0) || 0, o = this.qi(s);
|
|
1572
1572
|
let h = 0;
|
|
1573
1573
|
if (e.hmtx && e.hmtx.aWidth) {
|
|
1574
|
-
const c = this.
|
|
1574
|
+
const c = this.Ni.Ui(e, r);
|
|
1575
1575
|
c > 0 && e.hmtx.aWidth[c] !== void 0 && (h = e.hmtx.aWidth[c]);
|
|
1576
1576
|
}
|
|
1577
1577
|
return { character: i, unicode: r, color: o, advanceWidth: h };
|
|
1578
1578
|
});
|
|
1579
1579
|
}
|
|
1580
|
-
|
|
1580
|
+
qi(t) {
|
|
1581
1581
|
return [t % 256 / 255, Math.floor(t / 256) % 256 / 255, 0];
|
|
1582
1582
|
}
|
|
1583
|
-
|
|
1583
|
+
Qi(t, e) {
|
|
1584
1584
|
if (!Z.m(typeof t == "string", "Character must be a string.", { method: "getCharacterColor", providedValue: t })) return [0, 0, 0];
|
|
1585
1585
|
const i = e.find((s) => s.character === t);
|
|
1586
1586
|
return i ? i.color : [0, 0, 0];
|
|
1587
1587
|
}
|
|
1588
|
-
|
|
1589
|
-
return Z.m(typeof t == "string" && t.length > 0, "Characters must be a string with at least one character.", { method: "getCharacterColors", providedValue: t }) ? Array.from(t).map((i) => this.
|
|
1588
|
+
Ji(t, e) {
|
|
1589
|
+
return Z.m(typeof t == "string" && t.length > 0, "Characters must be a string with at least one character.", { method: "getCharacterColors", providedValue: t }) ? Array.from(t).map((i) => this.Qi(i, e) || [0, 0, 0]) : [[0, 0, 0]];
|
|
1590
1590
|
}
|
|
1591
1591
|
}
|
|
1592
1592
|
class At {
|
|
1593
1593
|
constructor(t, e = 16) {
|
|
1594
|
+
a(this, "tr");
|
|
1595
|
+
a(this, "sr", []);
|
|
1594
1596
|
a(this, "er");
|
|
1595
|
-
a(this, "
|
|
1596
|
-
a(this, "
|
|
1597
|
-
a(this, "
|
|
1598
|
-
a(this, "
|
|
1599
|
-
a(this, "
|
|
1600
|
-
a(this, "
|
|
1597
|
+
a(this, "ir", 16);
|
|
1598
|
+
a(this, "rr", 0);
|
|
1599
|
+
a(this, "nr", 0);
|
|
1600
|
+
a(this, "hr", { width: 0, height: 0 });
|
|
1601
|
+
a(this, "ar");
|
|
1602
|
+
a(this, "cr", /* @__PURE__ */ new Map());
|
|
1603
|
+
a(this, "lr");
|
|
1601
1604
|
a(this, "ur");
|
|
1602
|
-
a(this, "dr"
|
|
1605
|
+
a(this, "dr");
|
|
1603
1606
|
a(this, "pr");
|
|
1604
|
-
|
|
1605
|
-
a(this, "vr");
|
|
1606
|
-
a(this, "mr");
|
|
1607
|
-
this.hr = e, this.pr = new ve(), this.gr = new ye(t), this.vr = new Ee(), this.mr = new we();
|
|
1607
|
+
this.ir = e, this.lr = new ve(), this.ur = new ye(t), this.dr = new Ee(), this.pr = new we();
|
|
1608
1608
|
}
|
|
1609
|
-
async
|
|
1609
|
+
async gr(t) {
|
|
1610
1610
|
let e;
|
|
1611
1611
|
if (t) {
|
|
1612
1612
|
const i = await fetch(t);
|
|
1613
|
-
if (!i.ok) throw new
|
|
1613
|
+
if (!i.ok) throw new B(`Failed to load font file: ${i.status} ${i.statusText}`);
|
|
1614
1614
|
e = await i.arrayBuffer();
|
|
1615
1615
|
} else
|
|
1616
1616
|
e = await (await fetch("data:font/woff;base64,d09GRgABAAAAABbwAAoAAAAAfywAAQABAAAAAAAAAAAAAAAAAAAAAAAAAABjbWFwAAAA9AAAAbsAAAkgIO8lSWdseWYAAAKwAAAOfgAAaLS4ctN0aGVhZAAAETAAAAAsAAAAOCi8/PVoaGVhAAARXAAAABkAAAAkCwEFAmhtdHgAABF4AAAAhQAABAQEAIOAbG9jYQAAEgAAAAKUAAAECAAy54BtYXhwAAAUlAAAABgAAAAgASIAgm5hbWUAABSsAAAB5wAAA6RWz85KT1MvMgAAFpQAAABFAAAAYM+QEyRwb3N0AAAW3AAAABQAAAAgAGkANHja7dRPSFRRFMfx38wdXblw4cJC7M0bz60gWlULGUFctWgR0UIQQkmDyn27kpAQaaEO2jhWJuafiQFtcDJtSqGhiFZtot5x3jzEVQQhlRJcOb0khiRc1+J94R64uw8cOADCAJT/avwZAiIpRCK3/P999KAS9biOSUxhBhlksYjnWMFrvME7vMca1vEF37ANAwkNqYRKqkk1rdLqscqpVVVQryzbils3rJnocHTWPmgfso/ap+0OuysWjlXHogQKUxVVUw3VUh010DE6QXHqph7qpT66TQmaoAxlaZnyVKC39FHHdbNu0e36or6kr4r4TgsTu75HmEcOy76vUPaVsIFNbOHHX74F3/fyD9+A7ztg1//2de76rH18Z8u+AXqwx/dBN5Z9XfqKiKzLqqzIC8nLkixKThZkXuZkVh7KuNyTuzImKRmVO1KxU7ETMtvmu/lqPptPxjOuKXo3vcveYQ+l2lKlO+Im3H632z3vnis+KaaLKc7zM87yHGc4zdM8zkke5H6+xp3cwRe4jVv5DLdwE5/ik3ycj3Cdk3eWnKfOmDPqJJ3hX9sOCvpPC65QcIWCgv5pPwGY9ak7AHja3V07ryQ5FT62axjQaDWsVmiCFQJpA4QINiAgICDYgICAgICAgICAgICAgIAA//AuF9Xlsn2etqv67iIY6apv3+6yj31e33nYA95FiD4uAAHeA7jyLzoA2Paf/Lp/Dun5W8x/Be/AxyCfO79fnj+e25/ZZzlewcM+3wIhwpfwE/Sc9e8YDyLU1ycF5XUD+to+L98O/An8VKQj0lnOtYdM776OJ71fTVC8//N1rLKDGsXl863OjSl5/iyIUu0HjJ+d+uO3rX3rXd33d/DjfR0/h6/n1iK5kWf36Hf2AxpVa6zU7ZLTnt3Q3wN7+tK6MVcBjUP/3vj56diHuT3YxVbKSvl9FdJHeFE4jfmJn2DSSOS9fuJ27SH7umuoL3oLWGOLxh3f2b8bnn/5Ql8n5SEYFD33q/0lKXxwjQfDOZtGgyEz+W8X5txl2zVb9MXO2S8HfD3ncbHousP6WPV2i/R7C+c06HK5ye/lfdl3Bj5Q2qitaLYhgLQWZY+fr/65A9Ly1r10jI783HOffJWZJ6ee8uuB0nmMXeSqWvRz5Dx/tiWf7H0OF+1DuK7vhy4ffP8An/doofqbQNXTqmlNT1c0v4/Eqpy29eBMLHty0PKZoCMW6VqRlDXNwvbD4RW2MYfyjNdXV3LaJuEdKgXcHvX2nHiz27RxHmC9w/qn0AbS+mJbSeX8pO1zlbbogPK7zJxAs3iFtrV8W/LHsHVZvxJ6Rlt7gum1nvjpnHNO4gFJqaoBWOKFVwKqAangorb2j5KKvG5N31O1ownZdhcZH7FuT9nznoxRv4ylrbfvzA9D88GO8uGDtgN0/1O09ntFlv3YhbIf/ml3/dPGqvi6rCMw6jNd53PM07BnK2eCJXmnzxrruI8ObOuxmZ/dxbd5nS77U7I/xaMdLm5/DXzuLLcwXlOLIVQ0an722pou6raGnpp/QYiwR0V5nwDL0Gk/f2TSUalIGOkSvfNAcVNCesV9a2q675FtsVAk4c5GPEfZT27XVqT9PmpxXtVn0577KO3MGrkXs+xKkHZk6EMUS440uO01t+Ark8yGYYjtsleqoPQksLuF0kOd/7TtbZ3XvNalNRNLqK+90fEDTAfy1FWWOBcT9fkTmrExe+viDNccYF+JqHeIbyBtlYxhStbmSc8DSX9/rICoXkkGSMfEJR7QsYAjNlhgn6iNS7T0AtakNnvaJ+W1TeQdeIxHaHtXaMtU+GP3CL5v+2RqHfc5JC6k9DJ6HhFaHHfu9Lc1Z5HlB5JWNOc8NupiUSlpa/7NIx0W0Ra10YcOVWnDfqhodmgI1CM5nrJS1DYKlMmyeAmoZaLrQnmNSRxAV7qZ0u0sr2Q8WbzUrRivE200nZ+x371Yj+idQH+bsOAFD16woZXuheBJI85UYyA+Ht17bJsTKLHHG+tuQpJX/AGX4eu2lq+vh8gQPgaLUpk1h7fcb1SJ4LEnGb+rdUHRHw96riVV36L5EgdqHNByqCTy82hnkrSSk3k5KTNWnJZ/buTlOvQngiceAkd4OHPz0K+tdOmGUYwJht2kcuBEntSRPOmZfyc40tFqD40IQeb2goGZvKIVzW4G5DMcQ4qOY3zVRzpmo1sMg+U1VemumtLofjFeCcxqJIUnM2vJuQeCHiOOwx4ss7pF6u+PtXxmZApbjCti22JtA+hVxUw7z6Xs2sSzMkeklSLPfwalYkjjt/0bHye4gKkXeaig5MpILVRiAd1vCrtP5Aj5uaN2PF1zxrE7koOgaY2PPL9FkccCKlprUZGr+zr0tw56iCvwGBTs+MFFxVbWeTaCQTj2WCBM1NnoWNxOBpBZU8f00hPsFDr+15wPevNsJG4IN+OGwKyWzKnW8S/GDUHZOd+44SsvbDvCuhYUTQSaQSFeWtoR4Xc833VimVzRvgm58QwZFQTthQ+awgQTeuVI7gLrF638Yixi+ot4RVZ5niDPFxBediyXNj++jUWDgkU3Zc96fDKwv4iiylyA4nalMkLX9C1hf24DNNkZyNDkflOPF4BqwdYbv1vLG9VX03W96PVKiCq+A01i5utY2d9YfSMP0qvQ7eFQUHSKvNfpCl21nqNafqf1UQksqfVe1PEPPNiJpY81iZoP119ZTUHojdpseMYqec5zr/2Jgo695rmycZWzSgOpXzMpbFrHu1Zmq/xA8pX3cgEQZU1/YzaexuQbXIoxF9THdaEzz9VaE5fgNVIPR/sIS8fQyipam9JXqHdOtPEIRllqzP7Ewh9063Z2IYH+GiLNUPFXJIcEM4RYc7bEkjwQL4/1fx+aHL8/62Of5vo3y+p92QX2fh18zrNFcPX9sfZAdBDZu8vxCM4clX31Qr9RrLPkDDDau8v8LZRar2N8lSOj1NGsLJeBZam1TIuwpzwepL3CJAvyANsPnj3BAzsD3a5X6ydEaZUSs50b7g2JrYcyG2lRL+xl+jD+Gfod33w82P0FTuYREa3c70CRS82XCtxIueJHXuIMB6tMt+x7lf7m5U4tyK9L3smuLrxqDxYPI30rYzk2h2NzgPXqAvPrQdqUxvdWF2zVwDrHCq0RoI0Hcrzcn9D8BMxYEMszZBzooqa/jsTxSeTthXTm9FC2n+pYEh8uVqyL9436quMD6pnK7njZM6msy4uYsunVquBSi4clVn8gblYc96TFyF04ll2oqCB300cDIbPxrZoqXZ1DHWvNh2irrNxstSaZYa2VB333tOr9mRcx7ETmXKmSFz6GkidstKjZFE8qIX26eG8KoS/b9uij9GFOiwFIVj5NyErT8rZGstdmD4lc4/xaNevd1uwOPCLX7Ems2TTc81MrUVmzyqdOr1v1PCPat9jmQfUYJEEbzNCSse4DevSYCIXal+bDCC3I2+EeTFKd7ltnFNN0sGLIfRcGfSWKD0BPANWTQIqcNtsaAON/1A/BeywPGhybs2ZEA1sH9FbgDMpTQx5L5k4fN/RR8lBHvif2ftB7oa8isVdrdWDxp/Hp6N8MsdUgqdS0M12EZrhC7TpJZZLZOZelRdeDUyffq3s6xPhztK4Xd9h6f4pIieNu4lI/jEN1XEMjbafK6lry/jkOYedyVMyp2vaHGlM8zBjCkdi28NdrNldgLa/a0orYtN6OwoMh7vPAsxb9eNTDrOdJBWuXsb6En8Evb5yTrJw1Y1XTHnmCFNtPkhHnuN+8QwHGi3JUJf4zeaTJsBpFdnik5V4fZq510ifEHMf7M55f2fteR1DJ73gzf4vyO42Or3Z5mZcWdlY6wb3sRvd0olKfGeaCWm5yGEtDwzLH6yPS95wmcVb2BBrYzig5tGb7Bvb5fkyfvW2nRhlxF3cyz8qGOF//eVLXq7P4oQTop9UASTKPr91h1zu5wu753DbqtXUO8pOT6wzdnQfWn2X3Csr5ktxP4FUmlBHHPThBO0mQ6wTFVxbM5mPCeXWP7ha4YDf8BdvAeaGd/XntlgHlW2eMFAR2CBPYAQzPrGeVy1ieYCOQdtpXGZyss4F2rkr5W8tJh06NTd/HGi+1vbiPN6JTeSfP5k0ihAhRQwgad9wQ1dhoKAntU87DfZy/K8SuEsPg82VQRU5xUGU+ZVrp8SMYtOHiwFC+Z1jLG2dqRuhAw01cZ2qeXBk/ROjaAS1TIuKHVp+Fi5YMrHqqahlY3YbJ0E/N2uUTq/0Cvt717Vfwa/gNfAO/hd/B7+EP8Ef4E/wZ/gJ/hb/B3+Ef8E/4F/z7nla+5T+Afp1wHdQRH/F/+/lF6VrSbuP4v/18VHMVmm7q6TX/Czha0mxJrf+YyNyOfRcYeKSap3+b8UufB8GnJSdec6Iu+toF6nHkaeZxvJ5h4PVgj3ILMz5teArdxnr8/PPoCXqiuvR91zoh2pvS8b0SqUD1FLPubHPaK9Q5lU+GzwI3PgfCOsB9NORgqm5OqfVxLMd1L9+A/s2s+0/0a93MTd3NNRHapruGQLnhZTSzpBMuYFNaz7N5RffPo/MnV2zac3wfRX6Vng0As1cTmE5M38U0eS+H0rvZxXtg6460jlQTZ3Snxw+pO9TKz+mOB5vffTs6umGj+UjMb3/QKfndvlP47UsVAO9Drzo11h+T/rF09Po0st98jHsKh31Ruj2UnbYWLuEd/pM9wOwpZ+KqccfWNZsc4F6c3jtf2ou7Ca6akqXRPThzsadua+/4hq7vgmn6uqux6bXw6AjnLMJbXMM5Ixwi8mR2rc3AOfg2nrs4zZlnDFaChbCtk/bwilwMfBxc0iMYy0MX40x2o/ft9D2Znn9Kl+3MO90HUb747jnzjpyCKVeTuij6DllsctyiUzXN0dgE9We1yK54WBffFqtew9TXpbYfy7dILWH/SXxmqeg4zlvRsZfIbuFnic0SHfRtfj4vsaVq532jl/QpYBykzpe/jec7n1uOmhuETi2xzM5vfy01xQC0vkp6PiKpDd07x6qcUc719K0A1YZjpvLivftqNpzxV/tDtXPTWFrbaowzXj+czsG+nmMt/bQspzj7fnvxeeuG4O/s/Xe412VW3+5VuPT+EV97/r++14Gc3ZvQRHrXMz91IrWHZ4FnK7WOVGjJPfAO3R0BczdLKuevQd5LPVsXd/X8PK6Ll2jK0/NM7P4V1PuI51FvsEMV+KhV4T2+22IQF85a0FlLWXs/IHTOX1B5CGCeEDh6V2ZiTK+eee/dnNjOa2xXz2zndd7sq+XYEZ/Gx/exoK5PoOceWNdnef9W9KCT9EYXqkrPxuhC9GA7faMXpHef1smLTDe1qaDY1N4ozLI4fqsHlwpf+3Cu9F1E/Z4AajG3V8430/6bCdq8QQs9b4OqJyQa1+6BACWaTPI8zrROa//7QGJ19U4tHeTTtePNqu3PnVhXJFSjzZFz4eo3Ndqidi/O6J5Z7X+VsS3cYki51T35Iv+merFeuGe69cbJM3Jq1Fn4kUA5rze4o9CRs22iy5jMsYLMS8g5/wOjbDW/AAB42mNgZGBgAOIzT9tXxvPbfGVgYGEAgZokCXVkmgUizsHABFLNwAAACJYG1HjaY2BkYGBhAAEIyc7AwMiAAhgZAQHPABQAAAB42r1TwRaAIAgD88P59PRA0hxUlw578mBDQOwi0i+oDUzb7nC/xyKH8SuwHH/jSx83jnE745c1RO44G9E1WTE14AQtYvKO6PN6BXRW5EONgCazSS4VXiere+sp7F7cQeSp7Pe2YkaxN7fVFhg/8z/1hfnfaBXnZ8k7wNzp/y13+wRWwErCAAAAeNpl0ylUVVEUBuCtoiKgoiIzAjIIMj9mZBZYMsmMjwcuBhEIBoPBYDAYDAaDwWA0GAwGgsFgMBgMBoPBYDAYDAaDweBnlrX+9e6955x/2oeI//664HbEgTL4HnHwZ8Sh1/AlIm0W3kUc3oN9+BFxJBva4E3E0SvwLCIdR/qniGO98Coiw3vG04hMv5n/fj9GZBUD3iz8xx9FnMiBJxEn0+E+/IrIppNt/VQzvITfEadH4HnEmUG4BV8jchaBn7NZgCMXdy7uXGfzeMjjKZ/PfBwF9hTYU/AhotC5QtpFtIt4K7oLnyOK6RXTKP4TUcJDCe5zNXAHcJTiKOWxlEZZPeAo00U5b+XyltM9vw24KvBWyFzpTOWLiCr5qu6BPdV0qx+Cni+sAc4a3mvw1nqu/RZxsRJkrEsDWeo2wAzq8dY/iGgwpwbfGvTdaA6NOmnUb5PnpiTY00S3SXfN/DU/BustdFrMq8VagqcE/YReEjK3+t4qayuPbTTbdNH2PqJdL+06a5e33VoHjg7vHdY7cXTK2ekedPHWha+b5279ddPo1ndPPuDrkbkH3yX5e/XXy3OvzH34+sy132+//P14B/AO6GuA3qBOB3U6hH/It2Haw2Y2rI9hHV6WdcSsR6eAl1GZx3Qwpr9xcxv3PqGDCbyTvE3KM+muT+lwypkpe6bNaZqfaX6v8j7D8wyNGbwzbyNmdTMrzxxfc9bndDFn5vM8zds37x4smMeCHhf5WTKHJb0uuc/L/C7bs4zrGr2kO5m0ntRZkv8VfazIkvI9RSelg5ReUrKvOrvqHq7p4Lr5retx3fcN/5Mb+Dfs25RpE/8mji0etqzfwLHteZufmzrZobfj/K5ednna0/fe/l+Pca7seNpjYGRgYGRkaGBQYAABJgY0AAAP+ACmeNp1ksFO20AQhv8NgRJaUApSy61LDxVc4uAjNxoJReoNKdCrYy8hZb1rrTcIuPMKfaY+QM899RH6AP3tDJEKqlcefzvzz/xrywD21ScoLK9N3ktW5E3hDl6hL7zG7HvhLrMfhNfxGonwBjUnwj2uz8JbzH4R3sZbPArvIMV34T28wQ+6qG6Puz5+Civyb+EOO/4Ir6GvOsJdaLUrvI53KhXeoGYs3MOu+iq8hai+CW/jo/olvIOiA+E97HeKw/xIp8M0nYQ6O/MunpvZwmbhafv01JK/MKGee6ePB8N/JCFzN6dO+8o4bee5cbnRM+NMyKyuFqHytdHR3MXSF0ZfNQOn93rVORoNm4l64ua3NMjsdYxVfZIkeTBZZC73ZeldPfBhllSLKR0KX2ZzlzyY4BO2JmNjrdeXPtjiAIfIcQTNbz/knWKCgBoZzuDhEHEOgxkWsMyFF9Xne/1Mf8Fdo5i3dY1jDOjz/ymB0eEGp63ao2J/Q5YT8pabqOnQsGn1lvuKjoHRc05Tj4x3jCUzRZu5Wp1winvGl54jruHqjI3C0fVW3qDxuWZ/pEvNPzjhylkxrETR5fQoW09HzYDPwJMm7emm8g5Fq8nIjpWHdronLV0TjJmxXJ4nuGwnWPYcAH8BoeumrAB42mNgYmFgnMDAysDCxMDEAAIQGoiNGc6A+CwMENDAwNDNwFDwGMpliHT00WNwYFBQy4aogJCMgSCSGcJTYGAAAEBYBpIAAAB42mNgZoCANAZjIMnIgAYADecAng==")).arrayBuffer();
|
|
1617
|
-
await this.
|
|
1617
|
+
await this.vr(e), this.tr = _.parse(e)[0], await this.mr();
|
|
1618
1618
|
}
|
|
1619
|
-
|
|
1620
|
-
if (t === void 0) return this.
|
|
1621
|
-
this.
|
|
1622
|
-
const e = this.
|
|
1623
|
-
this.
|
|
1619
|
+
_r(t) {
|
|
1620
|
+
if (t === void 0) return this.ir;
|
|
1621
|
+
this.ir = t, this.hr = this.dr.Vi(this.sr.map((i) => i.character), this.ir, this.tr);
|
|
1622
|
+
const e = this.ur.Xi(this.sr, this.hr, this.ir, this.tr);
|
|
1623
|
+
this.er = e.framebuffer, this.rr = e.columns, this.nr = e.rows;
|
|
1624
1624
|
}
|
|
1625
|
-
async
|
|
1625
|
+
async Ar(t) {
|
|
1626
1626
|
try {
|
|
1627
1627
|
const e = await fetch(t);
|
|
1628
|
-
if (!e.ok) throw new
|
|
1628
|
+
if (!e.ok) throw new B(`Failed to load font file: ${e.status} ${e.statusText}`);
|
|
1629
1629
|
const i = await e.arrayBuffer();
|
|
1630
|
-
await this.
|
|
1631
|
-
const s =
|
|
1630
|
+
await this.vr(i);
|
|
1631
|
+
const s = _.parse(i);
|
|
1632
1632
|
if (!s || s.length === 0) throw Error("Failed to parse font file");
|
|
1633
|
-
this.
|
|
1633
|
+
this.tr = s[0], await this.mr();
|
|
1634
1634
|
} catch (e) {
|
|
1635
|
-
throw new
|
|
1635
|
+
throw new B("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
|
|
1636
1636
|
}
|
|
1637
1637
|
}
|
|
1638
|
-
async
|
|
1638
|
+
async vr(t) {
|
|
1639
1639
|
const e = Date.now();
|
|
1640
|
-
this.
|
|
1640
|
+
this.ar = new FontFace("CustomFont_" + e, t), await this.ar.load(), document.fonts.add(this.ar);
|
|
1641
1641
|
}
|
|
1642
|
-
async
|
|
1643
|
-
const t = this.
|
|
1644
|
-
this.
|
|
1645
|
-
const e = this.
|
|
1646
|
-
this.
|
|
1642
|
+
async mr() {
|
|
1643
|
+
const t = this.lr.$i(this.tr);
|
|
1644
|
+
this.cr.clear(), this.sr = this.pr.createCharacterObjects(t, this.tr), this.hr = this.dr.Vi(t, this.ir, this.tr);
|
|
1645
|
+
const e = this.ur.Xi(this.sr, this.hr, this.ir, this.tr);
|
|
1646
|
+
this.er = e.framebuffer, this.rr = e.columns, this.nr = e.rows;
|
|
1647
1647
|
}
|
|
1648
|
-
|
|
1649
|
-
return this.
|
|
1648
|
+
Qi(t) {
|
|
1649
|
+
return this.pr.Qi(t, this.sr);
|
|
1650
1650
|
}
|
|
1651
|
-
|
|
1652
|
-
return this.
|
|
1651
|
+
Ji(t) {
|
|
1652
|
+
return this.pr.Ji(t, this.sr);
|
|
1653
1653
|
}
|
|
1654
1654
|
getGlyphData(t) {
|
|
1655
1655
|
if (!Number.isFinite(t)) return null;
|
|
1656
|
-
const e = this.
|
|
1656
|
+
const e = this.cr.get(t);
|
|
1657
1657
|
if (e !== void 0) return e;
|
|
1658
|
-
const i = this.
|
|
1659
|
-
if (i < 0) return this.
|
|
1660
|
-
const s = this.
|
|
1661
|
-
if (!s) return this.
|
|
1658
|
+
const i = this.yr(t);
|
|
1659
|
+
if (i < 0) return this.cr.set(t, null), null;
|
|
1660
|
+
const s = this.tr.glyf;
|
|
1661
|
+
if (!s) return this.cr.set(t, null), null;
|
|
1662
1662
|
let r = s[i] ?? null;
|
|
1663
|
-
return r == null && (r =
|
|
1663
|
+
return r == null && (r = _.T.glyf.Ci(this.tr, i) ?? null, s[i] = r), this.cr.set(t, r), r;
|
|
1664
1664
|
}
|
|
1665
|
-
|
|
1666
|
-
const e = this.
|
|
1665
|
+
yr(t) {
|
|
1666
|
+
const e = this.tr.cmap;
|
|
1667
1667
|
for (const i of e.tables) if (i.format === 4) {
|
|
1668
1668
|
const s = i;
|
|
1669
1669
|
for (let r = 0; r < s.startCount.length; r++) if (t >= s.startCount[r] && t <= s.endCount[r]) {
|
|
@@ -1686,60 +1686,60 @@ class At {
|
|
|
1686
1686
|
return 0;
|
|
1687
1687
|
}
|
|
1688
1688
|
D() {
|
|
1689
|
-
this.
|
|
1689
|
+
this.er.D(), document.fonts.delete(this.ar);
|
|
1690
1690
|
}
|
|
1691
1691
|
get fontFramebuffer() {
|
|
1692
|
-
return this.
|
|
1692
|
+
return this.er;
|
|
1693
1693
|
}
|
|
1694
1694
|
get characters() {
|
|
1695
|
-
return this.
|
|
1695
|
+
return this.sr;
|
|
1696
1696
|
}
|
|
1697
1697
|
get textureColumns() {
|
|
1698
|
-
return this.
|
|
1698
|
+
return this.rr;
|
|
1699
1699
|
}
|
|
1700
1700
|
get textureRows() {
|
|
1701
|
-
return this.
|
|
1701
|
+
return this.nr;
|
|
1702
1702
|
}
|
|
1703
1703
|
get maxGlyphDimensions() {
|
|
1704
|
-
return this.
|
|
1704
|
+
return this.hr;
|
|
1705
1705
|
}
|
|
1706
1706
|
get fontSize() {
|
|
1707
|
-
return this.
|
|
1707
|
+
return this.ir;
|
|
1708
1708
|
}
|
|
1709
1709
|
get font() {
|
|
1710
|
-
return this.
|
|
1710
|
+
return this.tr;
|
|
1711
1711
|
}
|
|
1712
1712
|
}
|
|
1713
|
-
class
|
|
1713
|
+
class Pt {
|
|
1714
1714
|
constructor(t, e, i) {
|
|
1715
|
-
a(this, "
|
|
1716
|
-
a(this, "
|
|
1715
|
+
a(this, "wr");
|
|
1716
|
+
a(this, "br");
|
|
1717
1717
|
a(this, "H");
|
|
1718
1718
|
a(this, "G");
|
|
1719
|
+
a(this, "Cr");
|
|
1720
|
+
a(this, "Mr");
|
|
1721
|
+
a(this, "Fr");
|
|
1719
1722
|
a(this, "$r");
|
|
1720
1723
|
a(this, "Tr");
|
|
1721
|
-
|
|
1722
|
-
a(this, "Er");
|
|
1723
|
-
a(this, "Rr");
|
|
1724
|
-
this.Pr = t, this.Er = e, this.Rr = i, this.qs();
|
|
1724
|
+
this.Fr = t, this.$r = e, this.Tr = i, this.js();
|
|
1725
1725
|
}
|
|
1726
|
-
|
|
1727
|
-
this.
|
|
1726
|
+
js() {
|
|
1727
|
+
this.wr = Math.floor(this.Fr.width / this.$r), this.br = Math.floor(this.Fr.height / this.Tr), this.H = this.wr * this.$r, this.G = this.br * this.Tr, this.Cr = Math.floor((this.Fr.width - this.H) / 2), this.Mr = Math.floor((this.Fr.height - this.G) / 2);
|
|
1728
1728
|
}
|
|
1729
|
-
|
|
1730
|
-
this
|
|
1729
|
+
Pr(t, e) {
|
|
1730
|
+
this.$r = t, this.Tr = e, this.js();
|
|
1731
1731
|
}
|
|
1732
1732
|
get cellWidth() {
|
|
1733
|
-
return this
|
|
1733
|
+
return this.$r;
|
|
1734
1734
|
}
|
|
1735
1735
|
get cellHeight() {
|
|
1736
|
-
return this.
|
|
1736
|
+
return this.Tr;
|
|
1737
1737
|
}
|
|
1738
1738
|
get cols() {
|
|
1739
|
-
return this.
|
|
1739
|
+
return this.wr;
|
|
1740
1740
|
}
|
|
1741
1741
|
get rows() {
|
|
1742
|
-
return this.
|
|
1742
|
+
return this.br;
|
|
1743
1743
|
}
|
|
1744
1744
|
get width() {
|
|
1745
1745
|
return this.H;
|
|
@@ -1748,13 +1748,13 @@ class Mt {
|
|
|
1748
1748
|
return this.G;
|
|
1749
1749
|
}
|
|
1750
1750
|
get offsetX() {
|
|
1751
|
-
return this
|
|
1751
|
+
return this.Cr;
|
|
1752
1752
|
}
|
|
1753
1753
|
get offsetY() {
|
|
1754
|
-
return this.
|
|
1754
|
+
return this.Mr;
|
|
1755
1755
|
}
|
|
1756
1756
|
}
|
|
1757
|
-
const
|
|
1757
|
+
const Te = /^#([0-9a-f]{3,8})$/i, be = /^rgba?\(([^)]+)\)$/i;
|
|
1758
1758
|
function at(n) {
|
|
1759
1759
|
return Number.isNaN(n) ? 0 : Math.max(0, Math.min(255, n));
|
|
1760
1760
|
}
|
|
@@ -1764,12 +1764,12 @@ function xe(n) {
|
|
|
1764
1764
|
if (!t || t === "transparent") return null;
|
|
1765
1765
|
let e = null;
|
|
1766
1766
|
return t.startsWith("#") ? e = function(i) {
|
|
1767
|
-
const s =
|
|
1767
|
+
const s = Te.exec(i.trim());
|
|
1768
1768
|
if (!s) return null;
|
|
1769
1769
|
const r = s[1];
|
|
1770
1770
|
return r.length === 3 ? [parseInt(r[0] + r[0], 16), parseInt(r[1] + r[1], 16), parseInt(r[2] + r[2], 16), 255] : r.length === 4 ? [parseInt(r[0] + r[0], 16), parseInt(r[1] + r[1], 16), parseInt(r[2] + r[2], 16), parseInt(r[3] + r[3], 16)] : r.length === 6 || r.length === 8 ? [parseInt(r.slice(0, 2), 16), parseInt(r.slice(2, 4), 16), parseInt(r.slice(4, 6), 16), r.length === 8 ? parseInt(r.slice(6, 8), 16) : 255] : null;
|
|
1771
1771
|
}(t) : t.startsWith("rgb") && (e = function(i) {
|
|
1772
|
-
const s =
|
|
1772
|
+
const s = be.exec(i.trim());
|
|
1773
1773
|
if (!s) return null;
|
|
1774
1774
|
const r = s[1].split(",").map((u) => u.trim());
|
|
1775
1775
|
if (r.length < 3) return null;
|
|
@@ -1777,42 +1777,42 @@ function xe(n) {
|
|
|
1777
1777
|
return [o, h, c, Math.round(l)];
|
|
1778
1778
|
}(t)), e ? e[3] === 0 ? null : e : null;
|
|
1779
1779
|
}
|
|
1780
|
-
class
|
|
1780
|
+
class Fe {
|
|
1781
1781
|
constructor(t = {}) {
|
|
1782
|
-
a(this, "
|
|
1783
|
-
a(this, "
|
|
1784
|
-
a(this, "
|
|
1785
|
-
a(this, "
|
|
1786
|
-
this.
|
|
1782
|
+
a(this, "Fr");
|
|
1783
|
+
a(this, "Er", null);
|
|
1784
|
+
a(this, "Rr", !1);
|
|
1785
|
+
a(this, "Sr");
|
|
1786
|
+
this.Rr = t.overlay ?? !1, this.Rr && t.canvas ? (this.Er = t.canvas, this.Fr = this.Ur(), this.Sr = !0, this.kr()) : t.canvas ? (this.Fr = t.canvas, this.Sr = !1) : (this.Fr = this.zr(t.width, t.height), this.Sr = !0), this.Fr.style.imageRendering = "pixelated";
|
|
1787
1787
|
}
|
|
1788
|
-
|
|
1788
|
+
zr(t, e) {
|
|
1789
1789
|
const i = document.createElement("canvas");
|
|
1790
1790
|
return i.className = "textmodeCanvas", i.style.imageRendering = "pixelated", i.width = t || 800, i.height = e || 600, document.body.appendChild(i), i;
|
|
1791
1791
|
}
|
|
1792
|
-
|
|
1792
|
+
Ur() {
|
|
1793
1793
|
const t = document.createElement("canvas");
|
|
1794
1794
|
t.className = "textmodeCanvas", t.style.imageRendering = "pixelated";
|
|
1795
|
-
const e = this.
|
|
1795
|
+
const e = this.Er.getBoundingClientRect();
|
|
1796
1796
|
let i = Math.round(e.width), s = Math.round(e.height);
|
|
1797
|
-
if (this.
|
|
1798
|
-
const h = this.
|
|
1797
|
+
if (this.Er instanceof HTMLVideoElement) {
|
|
1798
|
+
const h = this.Er;
|
|
1799
1799
|
(i === 0 || s === 0) && h.videoWidth > 0 && h.videoHeight > 0 && (i = h.videoWidth, s = h.videoHeight);
|
|
1800
1800
|
}
|
|
1801
1801
|
t.width = i, t.height = s, t.style.position = "absolute", t.style.pointerEvents = "none";
|
|
1802
|
-
const r = window.getComputedStyle(this.
|
|
1802
|
+
const r = window.getComputedStyle(this.Er);
|
|
1803
1803
|
let o = parseInt(r.zIndex || "0", 10);
|
|
1804
1804
|
return isNaN(o) && (o = 0), t.style.zIndex = "" + (o + 1), t;
|
|
1805
1805
|
}
|
|
1806
|
-
|
|
1806
|
+
kr() {
|
|
1807
1807
|
var t;
|
|
1808
|
-
this.
|
|
1808
|
+
this.Ir(), (t = this.Er.parentNode) == null || t.insertBefore(this.Fr, this.Er.nextSibling);
|
|
1809
1809
|
}
|
|
1810
|
-
|
|
1810
|
+
Lr() {
|
|
1811
1811
|
const t = [];
|
|
1812
|
-
return this.
|
|
1812
|
+
return this.Rr && this.Er instanceof HTMLElement && (t.push(this.Er), this.Er.parentElement && t.push(this.Er.parentElement)), this.Fr.parentElement && t.push(this.Fr.parentElement), t.push(this.Fr), t.push(document.body), t.push(document.documentElement), t;
|
|
1813
1813
|
}
|
|
1814
|
-
|
|
1815
|
-
const t = this.
|
|
1814
|
+
Or() {
|
|
1815
|
+
const t = this.Lr();
|
|
1816
1816
|
for (const e of t) {
|
|
1817
1817
|
if (!e) continue;
|
|
1818
1818
|
const i = xe(window.getComputedStyle(e).backgroundColor);
|
|
@@ -1820,67 +1820,67 @@ class Re {
|
|
|
1820
1820
|
}
|
|
1821
1821
|
return [255, 255, 255, 255];
|
|
1822
1822
|
}
|
|
1823
|
-
|
|
1824
|
-
if (!this.
|
|
1825
|
-
const t = this.
|
|
1826
|
-
let e = this.
|
|
1823
|
+
Ir() {
|
|
1824
|
+
if (!this.Er) return;
|
|
1825
|
+
const t = this.Er.getBoundingClientRect();
|
|
1826
|
+
let e = this.Er.offsetParent;
|
|
1827
1827
|
if (e && e !== document.body) {
|
|
1828
1828
|
const i = e.getBoundingClientRect();
|
|
1829
|
-
this.
|
|
1830
|
-
} else this.
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
if (this.
|
|
1834
|
-
const i = this.
|
|
1835
|
-
this.
|
|
1836
|
-
} else this.
|
|
1837
|
-
}
|
|
1838
|
-
|
|
1839
|
-
const t = this.
|
|
1840
|
-
if (!t) throw new
|
|
1829
|
+
this.Fr.style.top = t.top - i.top + "px", this.Fr.style.left = t.left - i.left + "px";
|
|
1830
|
+
} else this.Fr.style.top = t.top + window.scrollY + "px", this.Fr.style.left = t.left + window.scrollX + "px";
|
|
1831
|
+
}
|
|
1832
|
+
Dr(t, e) {
|
|
1833
|
+
if (this.Rr) {
|
|
1834
|
+
const i = this.Er.getBoundingClientRect();
|
|
1835
|
+
this.Fr.width = Math.round(i.width), this.Fr.height = Math.round(i.height), this.Ir();
|
|
1836
|
+
} else this.Fr.width = t ?? this.Fr.width, this.Fr.height = e ?? this.Fr.height;
|
|
1837
|
+
}
|
|
1838
|
+
Hr() {
|
|
1839
|
+
const t = this.Fr.getContext("webgl2", { alpha: !0, premultipliedAlpha: !1, preserveDrawingBuffer: !0, antialias: !1, depth: !0, stencil: !1, powerPreference: "high-performance" });
|
|
1840
|
+
if (!t) throw new B("`textmode.js` requires WebGL2 support.");
|
|
1841
1841
|
return t;
|
|
1842
1842
|
}
|
|
1843
1843
|
D() {
|
|
1844
|
-
const t = this.
|
|
1844
|
+
const t = this.Fr.getContext("webgl") || this.Fr.getContext("webgl2");
|
|
1845
1845
|
if (t) {
|
|
1846
1846
|
const e = t.getExtension("WEBGL_lose_context");
|
|
1847
1847
|
e == null || e.loseContext();
|
|
1848
1848
|
}
|
|
1849
|
-
this.
|
|
1849
|
+
this.Sr && this.Fr.parentNode && this.Fr.parentNode.removeChild(this.Fr);
|
|
1850
1850
|
}
|
|
1851
1851
|
get canvas() {
|
|
1852
|
-
return this.
|
|
1852
|
+
return this.Fr;
|
|
1853
1853
|
}
|
|
1854
1854
|
get targetCanvas() {
|
|
1855
|
-
return this.
|
|
1855
|
+
return this.Er;
|
|
1856
1856
|
}
|
|
1857
1857
|
get width() {
|
|
1858
|
-
return this.
|
|
1858
|
+
return this.Fr.width;
|
|
1859
1859
|
}
|
|
1860
1860
|
get height() {
|
|
1861
|
-
return this.
|
|
1861
|
+
return this.Fr.height;
|
|
1862
1862
|
}
|
|
1863
1863
|
}
|
|
1864
1864
|
function J(n) {
|
|
1865
|
-
return
|
|
1865
|
+
return G(parseInt(n, 16), 0, 255);
|
|
1866
1866
|
}
|
|
1867
1867
|
class C {
|
|
1868
1868
|
constructor(t, e, i, s, r) {
|
|
1869
|
-
a(this, "
|
|
1870
|
-
a(this, "
|
|
1871
|
-
a(this, "
|
|
1869
|
+
a(this, "Br");
|
|
1870
|
+
a(this, "Gr");
|
|
1871
|
+
a(this, "Ht");
|
|
1872
1872
|
a(this, "r");
|
|
1873
1873
|
a(this, "g");
|
|
1874
1874
|
a(this, "b");
|
|
1875
1875
|
a(this, "a");
|
|
1876
|
-
this.r =
|
|
1876
|
+
this.r = G(t, 0, 255), this.g = G(e, 0, 255), this.b = G(i, 0, 255), this.a = G(s, 0, 255), this.Br = [this.r, this.g, this.b, this.a], this.Gr = [this.r / 255, this.g / 255, this.b / 255, this.a / 255], this.Ht = r ? [...r] : void 0;
|
|
1877
1877
|
}
|
|
1878
|
-
static
|
|
1879
|
-
if (C.
|
|
1878
|
+
static Nr(t, e, i, s) {
|
|
1879
|
+
if (C.Xr(t)) return t;
|
|
1880
1880
|
if (Array.isArray(t)) return function(r) {
|
|
1881
1881
|
if (r.length < 3) throw Error("Component tuples must include at least RGB values.");
|
|
1882
1882
|
const [o, h, c] = r, l = r.length === 4 ? r[3] : 255;
|
|
1883
|
-
return C.
|
|
1883
|
+
return C.Yr(o, h, c, l);
|
|
1884
1884
|
}(t);
|
|
1885
1885
|
if (typeof t == "string") {
|
|
1886
1886
|
const r = t.trim();
|
|
@@ -1892,20 +1892,20 @@ class C {
|
|
|
1892
1892
|
const u = l[0];
|
|
1893
1893
|
return !Array.isArray(u) || u.length < 3 ? null : [u[0], u[1], u[2]];
|
|
1894
1894
|
}(r, e);
|
|
1895
|
-
if (o) return C.
|
|
1895
|
+
if (o) return C.Kr(o);
|
|
1896
1896
|
}
|
|
1897
|
-
return C.
|
|
1897
|
+
return C.Wr(r);
|
|
1898
1898
|
}
|
|
1899
|
-
if (typeof t == "number") return typeof e == "number" && typeof i == "number" ? C.
|
|
1899
|
+
if (typeof t == "number") return typeof e == "number" && typeof i == "number" ? C.Yr(t, e, i, s ?? 255) : C.Zr(t);
|
|
1900
1900
|
throw Error("Unsupported color input passed to TextmodeColor.$from.");
|
|
1901
1901
|
}
|
|
1902
|
-
static
|
|
1902
|
+
static Yr(t, e, i, s = 255) {
|
|
1903
1903
|
return new C(t, e, i, s);
|
|
1904
1904
|
}
|
|
1905
|
-
static
|
|
1905
|
+
static Zr(t, e = 255) {
|
|
1906
1906
|
return new C(t, t, t, e);
|
|
1907
1907
|
}
|
|
1908
|
-
static
|
|
1908
|
+
static Wr(t) {
|
|
1909
1909
|
return new C(...function(e) {
|
|
1910
1910
|
const i = e.replace(/^#|0x/gi, ""), s = (r = i).length === 3 || r.length === 4 ? r.split("").map((o) => o + o).join("") : r;
|
|
1911
1911
|
var r;
|
|
@@ -1913,7 +1913,7 @@ class C {
|
|
|
1913
1913
|
return [J(s.slice(0, 2)), J(s.slice(2, 4)), J(s.slice(4, 6)), s.length === 8 ? J(s.slice(6, 8)) : 255];
|
|
1914
1914
|
}(t));
|
|
1915
1915
|
}
|
|
1916
|
-
static
|
|
1916
|
+
static Kr(t) {
|
|
1917
1917
|
const [e, i, s] = t;
|
|
1918
1918
|
return new C(255 * e, 255 * i, 255 * s, 255, t);
|
|
1919
1919
|
}
|
|
@@ -1921,26 +1921,26 @@ class C {
|
|
|
1921
1921
|
return [this.r, this.g, this.b];
|
|
1922
1922
|
}
|
|
1923
1923
|
get rgba() {
|
|
1924
|
-
return [...this.
|
|
1924
|
+
return [...this.Br];
|
|
1925
1925
|
}
|
|
1926
1926
|
get normalized() {
|
|
1927
|
-
return [...this.
|
|
1927
|
+
return [...this.Gr];
|
|
1928
1928
|
}
|
|
1929
1929
|
get character() {
|
|
1930
|
-
return this.
|
|
1930
|
+
return this.Ht ? [...this.Ht] : void 0;
|
|
1931
1931
|
}
|
|
1932
1932
|
withAlpha(t) {
|
|
1933
|
-
return new C(this.r, this.g, this.b, t, this.
|
|
1933
|
+
return new C(this.r, this.g, this.b, t, this.Ht);
|
|
1934
1934
|
}
|
|
1935
|
-
static
|
|
1935
|
+
static Xr(t) {
|
|
1936
1936
|
return t instanceof C;
|
|
1937
1937
|
}
|
|
1938
1938
|
}
|
|
1939
1939
|
const pt = /* @__PURE__ */ new Map();
|
|
1940
|
-
function
|
|
1940
|
+
function Re(n) {
|
|
1941
1941
|
pt.set(n.id, n);
|
|
1942
1942
|
}
|
|
1943
|
-
function
|
|
1943
|
+
function ze(n) {
|
|
1944
1944
|
pt.delete(n);
|
|
1945
1945
|
}
|
|
1946
1946
|
function Ce(n) {
|
|
@@ -1950,88 +1950,88 @@ class mt {
|
|
|
1950
1950
|
constructor(t, e, i, s, r, o, h, c) {
|
|
1951
1951
|
a(this, "A");
|
|
1952
1952
|
a(this, "W");
|
|
1953
|
-
a(this, "
|
|
1954
|
-
a(this, "
|
|
1955
|
-
a(this, "
|
|
1953
|
+
a(this, "jr");
|
|
1954
|
+
a(this, "Vr");
|
|
1955
|
+
a(this, "qr");
|
|
1956
1956
|
a(this, "H");
|
|
1957
1957
|
a(this, "G");
|
|
1958
1958
|
a(this, "Z", null);
|
|
1959
|
-
a(this, "
|
|
1960
|
-
a(this, "
|
|
1961
|
-
a(this, "
|
|
1959
|
+
a(this, "tr");
|
|
1960
|
+
a(this, "Qr", "brightness");
|
|
1961
|
+
a(this, "Jr", null);
|
|
1962
1962
|
a(this, "$t", 0);
|
|
1963
|
+
a(this, "Ot", 0);
|
|
1963
1964
|
a(this, "Dt", 0);
|
|
1964
|
-
a(this, "Ht", 0);
|
|
1965
1965
|
a(this, "Tt", 0);
|
|
1966
|
-
a(this, "
|
|
1967
|
-
a(this, "
|
|
1968
|
-
a(this, "
|
|
1969
|
-
a(this, "
|
|
1970
|
-
a(this, "
|
|
1971
|
-
a(this, "
|
|
1972
|
-
a(this, "
|
|
1973
|
-
a(this, "
|
|
1974
|
-
a(this, "
|
|
1975
|
-
a(this, "
|
|
1976
|
-
a(this, "
|
|
1977
|
-
this.A = t, this.W = e, this.
|
|
1966
|
+
a(this, "tn", "sampled");
|
|
1967
|
+
a(this, "sn", "fixed");
|
|
1968
|
+
a(this, "Bt", [1, 1, 1, 1]);
|
|
1969
|
+
a(this, "Gt", [0, 0, 0, 1]);
|
|
1970
|
+
a(this, "en", [0, 0, 0, 1]);
|
|
1971
|
+
a(this, "rn", [[0.1, 0, 0]]);
|
|
1972
|
+
a(this, "nn");
|
|
1973
|
+
a(this, "hn", null);
|
|
1974
|
+
a(this, "an", /* @__PURE__ */ new Set());
|
|
1975
|
+
a(this, "cn", [[0, 0, 0, 0]]);
|
|
1976
|
+
a(this, "ln", 0);
|
|
1977
|
+
this.A = t, this.W = e, this.jr = i, this.tr = s, this.Vr = r, this.qr = o, this.H = h, this.G = c;
|
|
1978
1978
|
}
|
|
1979
1979
|
conversionMode(t) {
|
|
1980
|
-
return this.
|
|
1980
|
+
return this.Qr = t, this.Jr = null, this.Z = null, this;
|
|
1981
1981
|
}
|
|
1982
1982
|
D() {
|
|
1983
|
-
this.A.deleteTexture(this.
|
|
1984
|
-
for (const t of this.
|
|
1985
|
-
this.
|
|
1983
|
+
this.A.deleteTexture(this.jr);
|
|
1984
|
+
for (const t of this.an) t();
|
|
1985
|
+
this.an.clear();
|
|
1986
1986
|
}
|
|
1987
|
-
|
|
1988
|
-
this.
|
|
1987
|
+
un(t) {
|
|
1988
|
+
this.an.add(t);
|
|
1989
1989
|
}
|
|
1990
1990
|
invert(t = !0) {
|
|
1991
1991
|
return this.$t = t ? 1 : 0, this.Z = null, this;
|
|
1992
1992
|
}
|
|
1993
1993
|
flipX(t = !0) {
|
|
1994
|
-
return this.
|
|
1994
|
+
return this.Ot = t ? 1 : 0, this.Z = null, this;
|
|
1995
1995
|
}
|
|
1996
1996
|
flipY(t = !0) {
|
|
1997
|
-
return this.
|
|
1997
|
+
return this.Dt = t ? 1 : 0, this.Z = null, this;
|
|
1998
1998
|
}
|
|
1999
1999
|
charRotation(t) {
|
|
2000
|
-
return this.Tt =
|
|
2000
|
+
return this.Tt = bt(t), this.Z = null, this;
|
|
2001
2001
|
}
|
|
2002
2002
|
charColorMode(t) {
|
|
2003
|
-
return this.
|
|
2003
|
+
return this.tn = t, this.Z = null, this;
|
|
2004
2004
|
}
|
|
2005
2005
|
cellColorMode(t) {
|
|
2006
|
-
return this.
|
|
2006
|
+
return this.sn = t, this.Z = null, this;
|
|
2007
2007
|
}
|
|
2008
2008
|
charColor(t, e, i, s) {
|
|
2009
|
-
return this.
|
|
2009
|
+
return this.fn(this.Bt, t, e, i, s), this.Z = null, this;
|
|
2010
2010
|
}
|
|
2011
2011
|
cellColor(t, e, i, s) {
|
|
2012
|
-
return this.
|
|
2012
|
+
return this.fn(this.Gt, t, e, i, s), this.Z = null, this;
|
|
2013
2013
|
}
|
|
2014
2014
|
background(t, e, i, s) {
|
|
2015
|
-
return this.
|
|
2015
|
+
return this.fn(this.en, t, e, i, s), this.Z = null, this;
|
|
2016
2016
|
}
|
|
2017
2017
|
colorFilter(t) {
|
|
2018
|
-
if (!t || t.length === 0) return this.
|
|
2018
|
+
if (!t || t.length === 0) return this.ln = 0, this.cn = [[0, 0, 0, 0]], this.Z = null, this;
|
|
2019
2019
|
const e = [];
|
|
2020
2020
|
for (const i of t) {
|
|
2021
2021
|
if (e.length >= 64) break;
|
|
2022
|
-
let s = C.
|
|
2022
|
+
let s = C.Nr(i);
|
|
2023
2023
|
e.push(s.normalized);
|
|
2024
2024
|
}
|
|
2025
|
-
return this.
|
|
2025
|
+
return this.cn = e, this.ln = e.length, this.Z = null, this;
|
|
2026
2026
|
}
|
|
2027
2027
|
characters(t) {
|
|
2028
|
-
return this.
|
|
2028
|
+
return this.hn = t, this.dn(t), this.Z = null, this;
|
|
2029
2029
|
}
|
|
2030
|
-
|
|
2031
|
-
this.
|
|
2030
|
+
pn(t) {
|
|
2031
|
+
this.tr = t, this.hn && this.dn(this.hn), this.Z = null;
|
|
2032
2032
|
}
|
|
2033
2033
|
get texture() {
|
|
2034
|
-
return this.
|
|
2034
|
+
return this.jr;
|
|
2035
2035
|
}
|
|
2036
2036
|
get width() {
|
|
2037
2037
|
return this.H;
|
|
@@ -2040,644 +2040,644 @@ class mt {
|
|
|
2040
2040
|
return this.G;
|
|
2041
2041
|
}
|
|
2042
2042
|
get originalWidth() {
|
|
2043
|
-
return this.
|
|
2043
|
+
return this.Vr;
|
|
2044
2044
|
}
|
|
2045
2045
|
get originalHeight() {
|
|
2046
|
-
return this.
|
|
2046
|
+
return this.qr;
|
|
2047
2047
|
}
|
|
2048
2048
|
ct() {
|
|
2049
2049
|
return this.Z || this.lt(), this.Z;
|
|
2050
2050
|
}
|
|
2051
|
-
|
|
2051
|
+
gn() {
|
|
2052
2052
|
}
|
|
2053
2053
|
lt() {
|
|
2054
|
-
this.
|
|
2055
|
-
const t = this.
|
|
2056
|
-
this.Z = this.W.materialManager.
|
|
2054
|
+
this.gn();
|
|
2055
|
+
const t = this.vn(), e = this.mn(), i = t.createShader(e), s = t.createUniforms(e);
|
|
2056
|
+
this.Z = this.W.materialManager.Oe(i, s);
|
|
2057
2057
|
}
|
|
2058
|
-
|
|
2059
|
-
const o = C.
|
|
2058
|
+
fn(t, e, i, s, r) {
|
|
2059
|
+
const o = C.Nr(e, i, s, r);
|
|
2060
2060
|
$(t, o.r, o.g, o.b, o.a);
|
|
2061
2061
|
}
|
|
2062
|
-
|
|
2063
|
-
const e = this.
|
|
2064
|
-
this.
|
|
2062
|
+
dn(t) {
|
|
2063
|
+
const e = this.nn(t).filter((i) => Array.isArray(i)).slice(0, 255);
|
|
2064
|
+
this.rn = e.length > 0 ? e : this.rn;
|
|
2065
2065
|
}
|
|
2066
2066
|
createBaseConversionUniforms() {
|
|
2067
|
-
const t = this.
|
|
2068
|
-
return {
|
|
2067
|
+
const t = this.ln > 0;
|
|
2068
|
+
return { u_image: this._n(), u_invert: !!this.$t, u_flipX: !!this.Ot, u_flipY: !!this.Dt, u_charRotation: this.Tt, u_charColorFixed: this.tn === "fixed", u_charColor: this.Bt, u_cellColorFixed: this.sn === "fixed", u_cellColor: this.Gt, u_backgroundColor: this.en, u_charCount: this.rn.length, u_charList: this.rn, u_colorFilterEnabled: t, u_colorFilterSize: t ? this.ln : 0, u_colorFilterPalette: this.cn };
|
|
2069
2069
|
}
|
|
2070
|
-
|
|
2071
|
-
if (this.
|
|
2072
|
-
const t = Ce(this.
|
|
2073
|
-
if (!t) throw Error(`[textmode.js] Conversion mode "${this.
|
|
2074
|
-
return this.
|
|
2070
|
+
vn() {
|
|
2071
|
+
if (this.Jr && this.Jr.id === this.Qr) return this.Jr;
|
|
2072
|
+
const t = Ce(this.Qr);
|
|
2073
|
+
if (!t) throw Error(`[textmode.js] Conversion mode "${this.Qr}" is not registered. If this mode is provided by an add-on, make sure its plugin is installed before loading sources.`);
|
|
2074
|
+
return this.Jr = t, t;
|
|
2075
2075
|
}
|
|
2076
|
-
|
|
2077
|
-
return { renderer: this.W, gl: this.A, font: this.
|
|
2076
|
+
mn() {
|
|
2077
|
+
return { renderer: this.W, gl: this.A, font: this.tr, source: this, gridWidth: this.H, gridHeight: this.G };
|
|
2078
2078
|
}
|
|
2079
2079
|
}
|
|
2080
|
-
class
|
|
2080
|
+
class W extends mt {
|
|
2081
2081
|
constructor(t, e, i, s, r, o, h, c) {
|
|
2082
2082
|
const l = Math.min(h / r, c / o);
|
|
2083
2083
|
super(t, e, i, s, r, o, Math.max(1, Math.floor(r * l)), Math.max(1, Math.floor(o * l)));
|
|
2084
2084
|
}
|
|
2085
|
-
static
|
|
2085
|
+
static An(t, e, i, s, r, o) {
|
|
2086
2086
|
const h = t.context, c = h.createTexture();
|
|
2087
2087
|
h.bindTexture(h.TEXTURE_2D, c), h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL, 1), tt(h, h.NEAREST, h.NEAREST, h.CLAMP_TO_EDGE, h.CLAMP_TO_EDGE), h.texImage2D(h.TEXTURE_2D, 0, h.RGBA, h.RGBA, h.UNSIGNED_BYTE, i), h.bindTexture(h.TEXTURE_2D, null);
|
|
2088
|
-
const l = i.naturalWidth ?? i.width ?? i.videoWidth ?? 0, u = i.naturalHeight ?? i.height ?? i.videoHeight ?? 0, f = new
|
|
2089
|
-
return f.
|
|
2088
|
+
const l = i.naturalWidth ?? i.width ?? i.videoWidth ?? 0, u = i.naturalHeight ?? i.height ?? i.videoHeight ?? 0, f = new W(h, t, c, e, l, u, s, r);
|
|
2089
|
+
return f.nn = o, f;
|
|
2090
2090
|
}
|
|
2091
|
-
|
|
2092
|
-
return this.
|
|
2091
|
+
_n() {
|
|
2092
|
+
return this.jr;
|
|
2093
2093
|
}
|
|
2094
2094
|
}
|
|
2095
|
-
class
|
|
2095
|
+
class Mt {
|
|
2096
2096
|
constructor(t = 60) {
|
|
2097
|
-
a(this, "
|
|
2098
|
-
a(this, "
|
|
2099
|
-
a(this, "
|
|
2100
|
-
a(this, "
|
|
2097
|
+
a(this, "yn");
|
|
2098
|
+
a(this, "wn", null);
|
|
2099
|
+
a(this, "bn", 0);
|
|
2100
|
+
a(this, "Cn", !0);
|
|
2101
|
+
a(this, "xn", 0);
|
|
2102
|
+
a(this, "Mn", 0);
|
|
2103
|
+
a(this, "Fn", []);
|
|
2104
|
+
a(this, "$n", 10);
|
|
2101
2105
|
a(this, "Tn", 0);
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
this.
|
|
2107
|
-
}
|
|
2108
|
-
kn(t) {
|
|
2109
|
-
if (!this.$n) return;
|
|
2110
|
-
this.Fn = performance.now();
|
|
2106
|
+
this.yn = 1e3 / t;
|
|
2107
|
+
}
|
|
2108
|
+
Pn(t) {
|
|
2109
|
+
if (!this.Cn) return;
|
|
2110
|
+
this.bn = performance.now();
|
|
2111
2111
|
const e = (i) => {
|
|
2112
|
-
if (!this
|
|
2113
|
-
const s = i - this.
|
|
2114
|
-
s >= this.
|
|
2112
|
+
if (!this.Cn) return void (this.wn = null);
|
|
2113
|
+
const s = i - this.bn;
|
|
2114
|
+
s >= this.yn && (t(), this.bn = i - s % this.yn), this.Cn && (this.wn = requestAnimationFrame(e));
|
|
2115
2115
|
};
|
|
2116
|
-
this.
|
|
2116
|
+
this.wn = requestAnimationFrame(e);
|
|
2117
2117
|
}
|
|
2118
|
-
|
|
2119
|
-
this.
|
|
2118
|
+
En() {
|
|
2119
|
+
this.wn && (cancelAnimationFrame(this.wn), this.wn = null);
|
|
2120
2120
|
}
|
|
2121
|
-
|
|
2122
|
-
this
|
|
2121
|
+
Rn() {
|
|
2122
|
+
this.Cn && (this.Cn = !1, this.En());
|
|
2123
2123
|
}
|
|
2124
|
-
|
|
2125
|
-
this
|
|
2124
|
+
Sn(t) {
|
|
2125
|
+
this.Cn || (this.Cn = !0, this.Pn(t));
|
|
2126
2126
|
}
|
|
2127
|
-
|
|
2128
|
-
if (t === void 0) return this.
|
|
2129
|
-
this.
|
|
2127
|
+
Un(t, e) {
|
|
2128
|
+
if (t === void 0) return this.xn;
|
|
2129
|
+
this.yn = 1e3 / t, this.Cn && e && (this.En(), this.Pn(e));
|
|
2130
2130
|
}
|
|
2131
|
-
|
|
2131
|
+
kn() {
|
|
2132
2132
|
const t = performance.now();
|
|
2133
|
-
if (this.
|
|
2134
|
-
const e = t - this.
|
|
2135
|
-
this.
|
|
2136
|
-
const i = this.
|
|
2137
|
-
this.
|
|
2133
|
+
if (this.Mn > 0) {
|
|
2134
|
+
const e = t - this.Mn;
|
|
2135
|
+
this.Fn.push(e), this.Fn.length > this.$n && this.Fn.shift();
|
|
2136
|
+
const i = this.Fn.reduce((s, r) => s + r, 0) / this.Fn.length;
|
|
2137
|
+
this.xn = 1e3 / i;
|
|
2138
2138
|
}
|
|
2139
|
-
this.
|
|
2139
|
+
this.Mn = t;
|
|
2140
2140
|
}
|
|
2141
|
-
get
|
|
2142
|
-
return this
|
|
2141
|
+
get zn() {
|
|
2142
|
+
return this.Cn;
|
|
2143
2143
|
}
|
|
2144
|
-
get
|
|
2145
|
-
return this.
|
|
2144
|
+
get In() {
|
|
2145
|
+
return this.xn;
|
|
2146
2146
|
}
|
|
2147
|
-
get
|
|
2148
|
-
return this.
|
|
2147
|
+
get Ln() {
|
|
2148
|
+
return this.Tn;
|
|
2149
2149
|
}
|
|
2150
|
-
set
|
|
2151
|
-
this.
|
|
2150
|
+
set Ln(t) {
|
|
2151
|
+
this.Tn = t;
|
|
2152
2152
|
}
|
|
2153
|
-
|
|
2154
|
-
this.
|
|
2153
|
+
On() {
|
|
2154
|
+
this.Tn++;
|
|
2155
2155
|
}
|
|
2156
2156
|
}
|
|
2157
|
-
class
|
|
2157
|
+
class Bt {
|
|
2158
2158
|
constructor(t) {
|
|
2159
|
-
a(this, "
|
|
2159
|
+
a(this, "Fr");
|
|
2160
|
+
a(this, "Dn");
|
|
2161
|
+
a(this, "Hn", { x: -1, y: -1 });
|
|
2162
|
+
a(this, "Bn", { x: -1, y: -1 });
|
|
2163
|
+
a(this, "Gn", null);
|
|
2164
|
+
a(this, "Nn", 0);
|
|
2160
2165
|
a(this, "Xn");
|
|
2161
|
-
a(this, "Yn"
|
|
2162
|
-
a(this, "Kn"
|
|
2163
|
-
a(this, "Wn"
|
|
2164
|
-
a(this, "Zn"
|
|
2166
|
+
a(this, "Yn");
|
|
2167
|
+
a(this, "Kn");
|
|
2168
|
+
a(this, "Wn");
|
|
2169
|
+
a(this, "Zn");
|
|
2165
2170
|
a(this, "jn");
|
|
2166
|
-
a(this, "Vn");
|
|
2171
|
+
a(this, "Vn", !1);
|
|
2167
2172
|
a(this, "qn");
|
|
2168
2173
|
a(this, "Qn");
|
|
2169
2174
|
a(this, "Jn");
|
|
2170
2175
|
a(this, "so");
|
|
2171
|
-
a(this, "io", !1);
|
|
2172
2176
|
a(this, "eo");
|
|
2173
|
-
|
|
2174
|
-
a(this, "no");
|
|
2175
|
-
a(this, "oo");
|
|
2176
|
-
a(this, "ho");
|
|
2177
|
-
this.Pr = t;
|
|
2177
|
+
this.Fr = t;
|
|
2178
2178
|
}
|
|
2179
|
-
|
|
2179
|
+
io(t) {
|
|
2180
2180
|
const e = performance.now() + Math.max(0, t);
|
|
2181
|
-
e > this.
|
|
2181
|
+
e > this.Nn && (this.Nn = e);
|
|
2182
2182
|
}
|
|
2183
|
-
|
|
2184
|
-
return performance.now() < this.
|
|
2183
|
+
ro() {
|
|
2184
|
+
return performance.now() < this.Nn;
|
|
2185
2185
|
}
|
|
2186
|
-
|
|
2187
|
-
const e = this.
|
|
2186
|
+
no(t) {
|
|
2187
|
+
const e = this.Fr.canvas;
|
|
2188
2188
|
e.style.cursor = t == null || t === "" ? "" : t;
|
|
2189
2189
|
}
|
|
2190
|
-
|
|
2191
|
-
this.
|
|
2192
|
-
}
|
|
2193
|
-
|
|
2194
|
-
if (this.
|
|
2195
|
-
const t = this.
|
|
2196
|
-
this.
|
|
2197
|
-
this.
|
|
2198
|
-
}, this.
|
|
2199
|
-
this.
|
|
2200
|
-
}, this.
|
|
2201
|
-
this.
|
|
2202
|
-
}, this.
|
|
2203
|
-
this.
|
|
2204
|
-
}, this.
|
|
2205
|
-
this.
|
|
2206
|
-
}, this.
|
|
2207
|
-
this.
|
|
2208
|
-
}, t.addEventListener("mousemove", this.
|
|
2209
|
-
}
|
|
2210
|
-
|
|
2211
|
-
if (!this.
|
|
2212
|
-
const t = this.
|
|
2213
|
-
t.removeEventListener("mousemove", this.
|
|
2214
|
-
}
|
|
2215
|
-
|
|
2216
|
-
if (this.
|
|
2217
|
-
if (this.
|
|
2218
|
-
const t = new MouseEvent("mousemove", { clientX: this.
|
|
2219
|
-
this.
|
|
2220
|
-
} else this.
|
|
2190
|
+
gr(t) {
|
|
2191
|
+
this.Dn = t, this.oo();
|
|
2192
|
+
}
|
|
2193
|
+
ho() {
|
|
2194
|
+
if (this.Vn) return;
|
|
2195
|
+
const t = this.Fr.canvas;
|
|
2196
|
+
this.Xn = (e) => {
|
|
2197
|
+
this.ao(e), this.co(e);
|
|
2198
|
+
}, this.Yn = () => {
|
|
2199
|
+
this.Bn = { ...this.Hn }, this.Hn.x = -1, this.Hn.y = -1, this.Gn = null;
|
|
2200
|
+
}, this.Kn = (e) => {
|
|
2201
|
+
this.ao(e), this.lo(e);
|
|
2202
|
+
}, this.Wn = (e) => {
|
|
2203
|
+
this.ao(e), this.uo(e);
|
|
2204
|
+
}, this.Zn = (e) => {
|
|
2205
|
+
this.ao(e), this.fo(e);
|
|
2206
|
+
}, this.jn = (e) => {
|
|
2207
|
+
this.ao(e), this.do(e);
|
|
2208
|
+
}, t.addEventListener("mousemove", this.Xn, { passive: !0 }), t.addEventListener("mouseleave", this.Yn, { passive: !0 }), t.addEventListener("mousedown", this.Kn, { passive: !0 }), t.addEventListener("mouseup", this.Wn, { passive: !0 }), t.addEventListener("click", this.Zn, { passive: !0 }), t.addEventListener("wheel", this.jn, { passive: !1 }), this.Vn = !0;
|
|
2209
|
+
}
|
|
2210
|
+
po() {
|
|
2211
|
+
if (!this.Vn) return;
|
|
2212
|
+
const t = this.Fr.canvas;
|
|
2213
|
+
t.removeEventListener("mousemove", this.Xn), t.removeEventListener("mouseleave", this.Yn), t.removeEventListener("mousedown", this.Kn), t.removeEventListener("mouseup", this.Wn), t.removeEventListener("click", this.Zn), t.removeEventListener("wheel", this.jn), this.Vn = !1;
|
|
2214
|
+
}
|
|
2215
|
+
oo() {
|
|
2216
|
+
if (this.Vn) try {
|
|
2217
|
+
if (this.Gn) {
|
|
2218
|
+
const t = new MouseEvent("mousemove", { clientX: this.Gn.x, clientY: this.Gn.y, bubbles: !1, cancelable: !1 });
|
|
2219
|
+
this.ao(t);
|
|
2220
|
+
} else this.Hn.x !== -1 && this.Hn.y !== -1 && (this.Hn.x >= this.Dn.cols || this.Hn.y >= this.Dn.rows) && (this.Hn.x = -1, this.Hn.y = -1);
|
|
2221
2221
|
} catch {
|
|
2222
|
-
this.
|
|
2222
|
+
this.Hn.x = -1, this.Hn.y = -1;
|
|
2223
2223
|
}
|
|
2224
2224
|
}
|
|
2225
|
-
|
|
2226
|
-
this.
|
|
2225
|
+
vo(t) {
|
|
2226
|
+
this.qn = t;
|
|
2227
2227
|
}
|
|
2228
|
-
|
|
2229
|
-
this.
|
|
2228
|
+
mo(t) {
|
|
2229
|
+
this.Qn = t;
|
|
2230
2230
|
}
|
|
2231
|
-
|
|
2232
|
-
this.
|
|
2231
|
+
_o(t) {
|
|
2232
|
+
this.Jn = t;
|
|
2233
2233
|
}
|
|
2234
|
-
|
|
2235
|
-
this.
|
|
2234
|
+
Ao(t) {
|
|
2235
|
+
this.so = t;
|
|
2236
2236
|
}
|
|
2237
|
-
|
|
2238
|
-
this.
|
|
2237
|
+
yo(t) {
|
|
2238
|
+
this.eo = t;
|
|
2239
2239
|
}
|
|
2240
|
-
|
|
2241
|
-
return { x: this.
|
|
2240
|
+
wo() {
|
|
2241
|
+
return { x: this.Hn.x, y: this.Hn.y };
|
|
2242
2242
|
}
|
|
2243
|
-
|
|
2244
|
-
if (this.
|
|
2245
|
-
const e = { position: { ...this.
|
|
2246
|
-
this.
|
|
2243
|
+
co(t) {
|
|
2244
|
+
if (this.so && !this.ro()) {
|
|
2245
|
+
const e = { position: { ...this.Hn }, previousPosition: { ...this.Bn }, originalEvent: t };
|
|
2246
|
+
this.so(e);
|
|
2247
2247
|
}
|
|
2248
2248
|
}
|
|
2249
|
-
|
|
2250
|
-
if (this.
|
|
2251
|
-
const e = { position: { ...this.
|
|
2252
|
-
this.
|
|
2249
|
+
lo(t) {
|
|
2250
|
+
if (this.Qn && !this.ro()) {
|
|
2251
|
+
const e = { position: { ...this.Hn }, previousPosition: { ...this.Bn }, button: t.button, originalEvent: t };
|
|
2252
|
+
this.Qn(e);
|
|
2253
2253
|
}
|
|
2254
2254
|
}
|
|
2255
|
-
|
|
2256
|
-
if (this.
|
|
2257
|
-
const e = { position: { ...this.
|
|
2258
|
-
this.
|
|
2255
|
+
uo(t) {
|
|
2256
|
+
if (this.Jn && !this.ro()) {
|
|
2257
|
+
const e = { position: { ...this.Hn }, previousPosition: { ...this.Bn }, button: t.button, originalEvent: t };
|
|
2258
|
+
this.Jn(e);
|
|
2259
2259
|
}
|
|
2260
2260
|
}
|
|
2261
|
-
|
|
2262
|
-
if (this.
|
|
2263
|
-
const e = { position: { ...this.
|
|
2264
|
-
this.
|
|
2261
|
+
fo(t) {
|
|
2262
|
+
if (this.qn && !this.ro()) {
|
|
2263
|
+
const e = { position: { ...this.Hn }, previousPosition: { ...this.Bn }, button: t.button, originalEvent: t };
|
|
2264
|
+
this.qn(e);
|
|
2265
2265
|
}
|
|
2266
2266
|
}
|
|
2267
|
-
|
|
2268
|
-
if (this.
|
|
2269
|
-
const e = { position: { ...this.
|
|
2270
|
-
this.
|
|
2267
|
+
do(t) {
|
|
2268
|
+
if (this.eo && !this.ro()) {
|
|
2269
|
+
const e = { position: { ...this.Hn }, previousPosition: { ...this.Bn }, delta: { x: t.deltaX, y: t.deltaY }, originalEvent: t };
|
|
2270
|
+
this.eo(e);
|
|
2271
2271
|
}
|
|
2272
2272
|
}
|
|
2273
|
-
|
|
2274
|
-
const e = this.
|
|
2275
|
-
this.
|
|
2276
|
-
const i = e.getBoundingClientRect(), s = t.clientX - i.left, r = t.clientY - i.top, o = e.width / i.width, h = r * (e.height / i.height), c = s * o - this.
|
|
2277
|
-
u >= 0 && u < this.
|
|
2273
|
+
ao(t) {
|
|
2274
|
+
const e = this.Fr.canvas;
|
|
2275
|
+
this.Bn = { ...this.Hn }, this.Gn = { x: t.clientX, y: t.clientY };
|
|
2276
|
+
const i = e.getBoundingClientRect(), s = t.clientX - i.left, r = t.clientY - i.top, o = e.width / i.width, h = r * (e.height / i.height), c = s * o - this.Dn.offsetX, l = h - this.Dn.offsetY, u = Math.floor(c / this.Dn.cellWidth), f = Math.floor(l / this.Dn.cellHeight);
|
|
2277
|
+
u >= 0 && u < this.Dn.cols && f >= 0 && f < this.Dn.rows ? (this.Hn.x = u, this.Hn.y = f) : (this.Hn.x = -1, this.Hn.y = -1);
|
|
2278
2278
|
}
|
|
2279
2279
|
}
|
|
2280
|
-
const
|
|
2281
|
-
class
|
|
2280
|
+
const De = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Bt }, Symbol.toStringTag, { value: "Module" }));
|
|
2281
|
+
class St {
|
|
2282
2282
|
constructor() {
|
|
2283
|
-
a(this, "
|
|
2284
|
-
a(this, "
|
|
2285
|
-
a(this, "
|
|
2286
|
-
a(this, "
|
|
2287
|
-
a(this, "
|
|
2288
|
-
a(this, "
|
|
2289
|
-
a(this, "
|
|
2290
|
-
a(this, "
|
|
2291
|
-
a(this, "
|
|
2292
|
-
}
|
|
2293
|
-
|
|
2294
|
-
this.
|
|
2295
|
-
this.
|
|
2296
|
-
}, this.
|
|
2297
|
-
this.
|
|
2298
|
-
}, window.addEventListener("keydown", this.
|
|
2299
|
-
}
|
|
2300
|
-
|
|
2301
|
-
this.
|
|
2302
|
-
}
|
|
2303
|
-
|
|
2304
|
-
this
|
|
2305
|
-
}
|
|
2306
|
-
|
|
2307
|
-
this.
|
|
2308
|
-
}
|
|
2309
|
-
|
|
2310
|
-
const e = this.
|
|
2283
|
+
a(this, "bo", /* @__PURE__ */ new Map());
|
|
2284
|
+
a(this, "Co", null);
|
|
2285
|
+
a(this, "xo", null);
|
|
2286
|
+
a(this, "Mo");
|
|
2287
|
+
a(this, "Fo");
|
|
2288
|
+
a(this, "Vn", !1);
|
|
2289
|
+
a(this, "$o");
|
|
2290
|
+
a(this, "To");
|
|
2291
|
+
a(this, "Po", { 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" });
|
|
2292
|
+
}
|
|
2293
|
+
ho() {
|
|
2294
|
+
this.Vn || (this.Mo = (t) => {
|
|
2295
|
+
this.Eo(t);
|
|
2296
|
+
}, this.Fo = (t) => {
|
|
2297
|
+
this.Ro(t);
|
|
2298
|
+
}, window.addEventListener("keydown", this.Mo, { passive: !1 }), window.addEventListener("keyup", this.Fo, { passive: !1 }), this.Vn = !0);
|
|
2299
|
+
}
|
|
2300
|
+
po() {
|
|
2301
|
+
this.Vn && (window.removeEventListener("keydown", this.Mo), window.removeEventListener("keyup", this.Fo), this.Vn = !1, this.bo.clear(), this.Co = null, this.xo = null);
|
|
2302
|
+
}
|
|
2303
|
+
mo(t) {
|
|
2304
|
+
this.$o = t;
|
|
2305
|
+
}
|
|
2306
|
+
_o(t) {
|
|
2307
|
+
this.To = t;
|
|
2308
|
+
}
|
|
2309
|
+
So(t) {
|
|
2310
|
+
const e = this.Uo(t), i = this.bo.get(t) || this.bo.get(e);
|
|
2311
2311
|
return (i == null ? void 0 : i.isPressed) || !1;
|
|
2312
2312
|
}
|
|
2313
|
-
|
|
2314
|
-
return this.
|
|
2313
|
+
ko() {
|
|
2314
|
+
return this.Co;
|
|
2315
2315
|
}
|
|
2316
|
-
|
|
2317
|
-
return this.
|
|
2316
|
+
zo() {
|
|
2317
|
+
return this.xo;
|
|
2318
2318
|
}
|
|
2319
|
-
|
|
2319
|
+
Io() {
|
|
2320
2320
|
const t = [];
|
|
2321
|
-
for (const [e, i] of this
|
|
2321
|
+
for (const [e, i] of this.bo) i.isPressed && t.push(e);
|
|
2322
2322
|
return t;
|
|
2323
2323
|
}
|
|
2324
|
-
|
|
2325
|
-
return { ctrl: this.
|
|
2324
|
+
Lo() {
|
|
2325
|
+
return { ctrl: this.So("Control"), shift: this.So("Shift"), alt: this.So("Alt"), meta: this.So("Meta") };
|
|
2326
2326
|
}
|
|
2327
|
-
|
|
2328
|
-
this
|
|
2327
|
+
Oo() {
|
|
2328
|
+
this.bo.clear(), this.Co = null, this.xo = null;
|
|
2329
2329
|
}
|
|
2330
|
-
|
|
2330
|
+
Eo(t) {
|
|
2331
2331
|
const e = t.key, i = Date.now();
|
|
2332
|
-
this
|
|
2333
|
-
const s = this
|
|
2334
|
-
if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.
|
|
2332
|
+
this.bo.has(e) || this.bo.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
2333
|
+
const s = this.bo.get(e);
|
|
2334
|
+
if (!s.isPressed && (s.isPressed = !0, s.lastPressTime = i, this.Co = e, this.$o)) {
|
|
2335
2335
|
const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !0, originalEvent: t };
|
|
2336
|
-
this
|
|
2336
|
+
this.$o(r);
|
|
2337
2337
|
}
|
|
2338
2338
|
}
|
|
2339
|
-
|
|
2339
|
+
Ro(t) {
|
|
2340
2340
|
const e = t.key, i = Date.now();
|
|
2341
|
-
this
|
|
2342
|
-
const s = this
|
|
2343
|
-
if (s.isPressed = !1, s.lastReleaseTime = i, this.
|
|
2341
|
+
this.bo.has(e) || this.bo.set(e, { isPressed: !1, lastPressTime: 0, lastReleaseTime: 0 });
|
|
2342
|
+
const s = this.bo.get(e);
|
|
2343
|
+
if (s.isPressed = !1, s.lastReleaseTime = i, this.xo = e, this.To) {
|
|
2344
2344
|
const r = { key: e, keyCode: t.keyCode, ctrlKey: t.ctrlKey, shiftKey: t.shiftKey, altKey: t.altKey, metaKey: t.metaKey, isPressed: !1, originalEvent: t };
|
|
2345
|
-
this.
|
|
2345
|
+
this.To(r);
|
|
2346
2346
|
}
|
|
2347
2347
|
}
|
|
2348
|
-
|
|
2349
|
-
return this.
|
|
2348
|
+
Uo(t) {
|
|
2349
|
+
return this.Po[t] || t.toLowerCase();
|
|
2350
2350
|
}
|
|
2351
2351
|
}
|
|
2352
|
-
const
|
|
2353
|
-
class
|
|
2352
|
+
const Pe = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: St }, Symbol.toStringTag, { value: "Module" }));
|
|
2353
|
+
class Ut {
|
|
2354
2354
|
constructor(t, e) {
|
|
2355
|
-
a(this, "
|
|
2355
|
+
a(this, "Fr");
|
|
2356
|
+
a(this, "Do");
|
|
2357
|
+
a(this, "Dn");
|
|
2358
|
+
a(this, "Ho", /* @__PURE__ */ new Map());
|
|
2359
|
+
a(this, "Bo", /* @__PURE__ */ new Map());
|
|
2360
|
+
a(this, "Go", /* @__PURE__ */ new Map());
|
|
2361
|
+
a(this, "No", null);
|
|
2362
|
+
a(this, "Xo");
|
|
2356
2363
|
a(this, "Yo");
|
|
2357
|
-
a(this, "
|
|
2358
|
-
a(this, "
|
|
2359
|
-
a(this, "
|
|
2360
|
-
a(this, "
|
|
2361
|
-
a(this, "
|
|
2364
|
+
a(this, "Ko");
|
|
2365
|
+
a(this, "Wo");
|
|
2366
|
+
a(this, "Zo");
|
|
2367
|
+
a(this, "jo");
|
|
2368
|
+
a(this, "Vn", !1);
|
|
2362
2369
|
a(this, "Vo");
|
|
2363
2370
|
a(this, "qo");
|
|
2364
2371
|
a(this, "Qo");
|
|
2365
2372
|
a(this, "Jo");
|
|
2366
2373
|
a(this, "th");
|
|
2367
2374
|
a(this, "sh");
|
|
2368
|
-
a(this, "io", !1);
|
|
2369
|
-
a(this, "ih");
|
|
2370
2375
|
a(this, "eh");
|
|
2376
|
+
a(this, "ih");
|
|
2371
2377
|
a(this, "rh");
|
|
2372
2378
|
a(this, "nh");
|
|
2373
|
-
a(this, "oh");
|
|
2374
|
-
a(this, "hh");
|
|
2375
|
-
a(this, "ah");
|
|
2376
|
-
a(this, "uh");
|
|
2377
|
-
a(this, "fh");
|
|
2378
|
-
a(this, "dh");
|
|
2379
|
-
a(this, "ph",
|
|
2380
|
-
a(this, "gh",
|
|
2381
|
-
a(this, "mh",
|
|
2382
|
-
a(this, "_h",
|
|
2383
|
-
a(this, "Ah",
|
|
2384
|
-
a(this, "yh",
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
this.
|
|
2402
|
-
this
|
|
2403
|
-
}, this.
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
}, t.addEventListener("touchstart", this.Qo, { passive: !1 }), t.addEventListener("touchmove", this.Jo, { passive: !1 }), t.addEventListener("touchend", this.th, { passive: !1 }), t.addEventListener("touchcancel", this.sh, { passive: !1 }), this.io = !0;
|
|
2410
|
-
}
|
|
2411
|
-
yo() {
|
|
2412
|
-
if (!this.io) return;
|
|
2413
|
-
const t = this.Pr.canvas;
|
|
2414
|
-
t.removeEventListener("touchstart", this.Qo), t.removeEventListener("touchmove", this.Jo), t.removeEventListener("touchend", this.th), t.removeEventListener("touchcancel", this.sh), this.io = !1, this.jo = null, this.Ko.clear(), this.Wo.clear(), this.Zo.forEach((e) => {
|
|
2379
|
+
a(this, "oh", 320);
|
|
2380
|
+
a(this, "hh", 350);
|
|
2381
|
+
a(this, "ah", 10);
|
|
2382
|
+
a(this, "uh", 550);
|
|
2383
|
+
a(this, "fh", 14);
|
|
2384
|
+
a(this, "dh", 48);
|
|
2385
|
+
a(this, "ph", 650);
|
|
2386
|
+
a(this, "gh", 0.02);
|
|
2387
|
+
a(this, "mh", 2);
|
|
2388
|
+
a(this, "_h", 600);
|
|
2389
|
+
a(this, "Ah", 0);
|
|
2390
|
+
a(this, "yh", null);
|
|
2391
|
+
this.Fr = t, this.Do = e;
|
|
2392
|
+
const i = this.Fr.canvas;
|
|
2393
|
+
this.Xo = i.style.touchAction, this.Yo = i.style.userSelect, i.style.touchAction || (i.style.touchAction = "none"), i.style.userSelect || (i.style.userSelect = "none");
|
|
2394
|
+
}
|
|
2395
|
+
gr(t) {
|
|
2396
|
+
this.Dn = t, this.oo();
|
|
2397
|
+
}
|
|
2398
|
+
ho() {
|
|
2399
|
+
if (this.Vn) return;
|
|
2400
|
+
const t = this.Fr.canvas;
|
|
2401
|
+
this.Ko = (e) => {
|
|
2402
|
+
this.wh(e);
|
|
2403
|
+
}, this.Wo = (e) => {
|
|
2404
|
+
this.bh(e);
|
|
2405
|
+
}, this.Zo = (e) => {
|
|
2406
|
+
this.Ch(e);
|
|
2407
|
+
}, this.jo = (e) => {
|
|
2408
|
+
this.xh(e);
|
|
2409
|
+
}, t.addEventListener("touchstart", this.Ko, { passive: !1 }), t.addEventListener("touchmove", this.Wo, { passive: !1 }), t.addEventListener("touchend", this.Zo, { passive: !1 }), t.addEventListener("touchcancel", this.jo, { passive: !1 }), this.Vn = !0;
|
|
2410
|
+
}
|
|
2411
|
+
po() {
|
|
2412
|
+
if (!this.Vn) return;
|
|
2413
|
+
const t = this.Fr.canvas;
|
|
2414
|
+
t.removeEventListener("touchstart", this.Ko), t.removeEventListener("touchmove", this.Wo), t.removeEventListener("touchend", this.Zo), t.removeEventListener("touchcancel", this.jo), this.Vn = !1, this.No = null, this.Ho.clear(), this.Bo.clear(), this.Go.forEach((e) => {
|
|
2415
2415
|
e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
|
|
2416
|
-
}), this.
|
|
2416
|
+
}), this.Go.clear(), this.yh = null, this.Ah = 0, t.style.touchAction = this.Xo, t.style.userSelect = this.Yo;
|
|
2417
2417
|
}
|
|
2418
|
-
|
|
2419
|
-
if (!this.
|
|
2418
|
+
oo() {
|
|
2419
|
+
if (!this.Dn || this.Ho.size === 0) return;
|
|
2420
2420
|
const t = /* @__PURE__ */ new Map();
|
|
2421
|
-
for (const e of this.
|
|
2422
|
-
const i = this.
|
|
2421
|
+
for (const e of this.Ho.values()) {
|
|
2422
|
+
const i = this.Mh(e.clientX, e.clientY, e.id, e);
|
|
2423
2423
|
t.set(e.id, i);
|
|
2424
2424
|
}
|
|
2425
|
-
this.
|
|
2425
|
+
this.Ho = t;
|
|
2426
2426
|
}
|
|
2427
|
-
|
|
2428
|
-
return Array.from(this.
|
|
2427
|
+
Fh() {
|
|
2428
|
+
return Array.from(this.Ho.values()).map((t) => ({ ...t }));
|
|
2429
2429
|
}
|
|
2430
|
-
|
|
2431
|
-
this.
|
|
2430
|
+
$h(t) {
|
|
2431
|
+
this.Vo = t;
|
|
2432
2432
|
}
|
|
2433
|
-
|
|
2434
|
-
this.
|
|
2433
|
+
Ao(t) {
|
|
2434
|
+
this.qo = t;
|
|
2435
2435
|
}
|
|
2436
|
-
|
|
2437
|
-
this.
|
|
2436
|
+
Th(t) {
|
|
2437
|
+
this.Qo = t;
|
|
2438
2438
|
}
|
|
2439
|
-
|
|
2440
|
-
this.
|
|
2439
|
+
Ph(t) {
|
|
2440
|
+
this.Jo = t;
|
|
2441
2441
|
}
|
|
2442
|
-
|
|
2443
|
-
this.
|
|
2442
|
+
Eh(t) {
|
|
2443
|
+
this.th = t;
|
|
2444
2444
|
}
|
|
2445
|
-
|
|
2446
|
-
this.
|
|
2445
|
+
Rh(t) {
|
|
2446
|
+
this.sh = t;
|
|
2447
2447
|
}
|
|
2448
|
-
|
|
2449
|
-
this.
|
|
2448
|
+
Sh(t) {
|
|
2449
|
+
this.eh = t;
|
|
2450
2450
|
}
|
|
2451
|
-
|
|
2452
|
-
this.
|
|
2451
|
+
kh(t) {
|
|
2452
|
+
this.ih = t;
|
|
2453
2453
|
}
|
|
2454
|
-
|
|
2455
|
-
this.
|
|
2454
|
+
zh(t) {
|
|
2455
|
+
this.rh = t;
|
|
2456
2456
|
}
|
|
2457
|
-
|
|
2458
|
-
this.
|
|
2457
|
+
Ih(t) {
|
|
2458
|
+
this.nh = t;
|
|
2459
2459
|
}
|
|
2460
|
-
|
|
2460
|
+
wh(t) {
|
|
2461
2461
|
var s;
|
|
2462
|
-
if (!this.
|
|
2463
|
-
t.preventDefault(), (s = this.
|
|
2464
|
-
const e = performance.now(), i = this.
|
|
2462
|
+
if (!this.Dn) return;
|
|
2463
|
+
t.preventDefault(), (s = this.Do) == null || s.io(this._h);
|
|
2464
|
+
const e = performance.now(), i = this.Lh(t.changedTouches);
|
|
2465
2465
|
for (const r of i) {
|
|
2466
|
-
const o = this.
|
|
2467
|
-
o && this.
|
|
2466
|
+
const o = this.Ho.get(r.id);
|
|
2467
|
+
o && this.Bo.set(r.id, this.Oh(o)), this.Ho.set(r.id, r);
|
|
2468
2468
|
const h = { id: r.id, startPosition: r, lastPosition: r, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
|
|
2469
|
-
this.
|
|
2470
|
-
const c = this.
|
|
2471
|
-
c && (h.longPressFired = !0, this.
|
|
2472
|
-
}, this.
|
|
2469
|
+
this.eh && (h.longPressTimer = window.setTimeout(() => {
|
|
2470
|
+
const c = this.Ho.get(r.id);
|
|
2471
|
+
c && (h.longPressFired = !0, this.eh({ touch: this.Oh(c), duration: performance.now() - h.startTime, originalEvent: t }));
|
|
2472
|
+
}, this.uh)), this.Go.set(r.id, h), this.Vo && this.Vo(this.Dh(r, t, void 0, e));
|
|
2473
2473
|
}
|
|
2474
|
-
this.
|
|
2474
|
+
this.Ho.size === 2 && this.Hh();
|
|
2475
2475
|
}
|
|
2476
|
-
|
|
2476
|
+
bh(t) {
|
|
2477
2477
|
var s;
|
|
2478
|
-
if (!this.
|
|
2479
|
-
t.preventDefault(), (s = this.
|
|
2480
|
-
const e = performance.now(), i = this.
|
|
2478
|
+
if (!this.Dn) return;
|
|
2479
|
+
t.preventDefault(), (s = this.Do) == null || s.io(this._h);
|
|
2480
|
+
const e = performance.now(), i = this.Lh(t.changedTouches);
|
|
2481
2481
|
for (const r of i) {
|
|
2482
|
-
const o = this.
|
|
2483
|
-
h && this.
|
|
2484
|
-
const c = this.
|
|
2485
|
-
c && (c.lastPosition = r, c.lastTime = e, h) &&
|
|
2482
|
+
const o = this.Ho.get(r.id), h = o ? this.Oh(o) : void 0;
|
|
2483
|
+
h && this.Bo.set(r.id, h), this.Ho.set(r.id, r);
|
|
2484
|
+
const c = this.Go.get(r.id);
|
|
2485
|
+
c && (c.lastPosition = r, c.lastTime = e, h) && Y(h.clientX, h.clientY, r.clientX, r.clientY) > this.fh && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.qo && this.qo(this.Dh(r, t, h, e));
|
|
2486
2486
|
}
|
|
2487
|
-
this.
|
|
2487
|
+
this.Ho.size === 2 ? this.Bh(t) : this.No = null;
|
|
2488
2488
|
}
|
|
2489
|
-
|
|
2490
|
-
if (!this.
|
|
2489
|
+
Ch(t) {
|
|
2490
|
+
if (!this.Dn) return;
|
|
2491
2491
|
t.preventDefault();
|
|
2492
|
-
const e = performance.now(), i = this.
|
|
2492
|
+
const e = performance.now(), i = this.Lh(t.changedTouches);
|
|
2493
2493
|
for (const s of i) {
|
|
2494
|
-
const r = this.
|
|
2495
|
-
h && h.longPressTimer !== null && (window.clearTimeout(h.longPressTimer), h.longPressTimer = null), this.
|
|
2494
|
+
const r = this.Ho.get(s.id), o = r ? this.Oh(r) : void 0, h = this.Go.get(s.id);
|
|
2495
|
+
h && h.longPressTimer !== null && (window.clearTimeout(h.longPressTimer), h.longPressTimer = null), this.Qo && this.Qo(this.Dh(s, t, o, e)), h && this.Gh(h, t), this.Go.delete(s.id), this.Bo.delete(s.id), this.Ho.delete(s.id);
|
|
2496
2496
|
}
|
|
2497
|
-
this.
|
|
2497
|
+
this.Ho.size < 2 && (this.No = null);
|
|
2498
2498
|
}
|
|
2499
|
-
|
|
2500
|
-
if (!this.
|
|
2499
|
+
xh(t) {
|
|
2500
|
+
if (!this.Dn) return;
|
|
2501
2501
|
t.preventDefault();
|
|
2502
|
-
const e = performance.now(), i = this.
|
|
2502
|
+
const e = performance.now(), i = this.Lh(t.changedTouches);
|
|
2503
2503
|
for (const s of i) {
|
|
2504
|
-
const r = this.
|
|
2505
|
-
h && h.longPressTimer !== null && (window.clearTimeout(h.longPressTimer), h.longPressTimer = null), this.
|
|
2504
|
+
const r = this.Ho.get(s.id), o = r ? this.Oh(r) : void 0, h = this.Go.get(s.id);
|
|
2505
|
+
h && h.longPressTimer !== null && (window.clearTimeout(h.longPressTimer), h.longPressTimer = null), this.Jo && this.Jo(this.Dh(s, t, o, e)), this.Go.delete(s.id), this.Bo.delete(s.id), this.Ho.delete(s.id);
|
|
2506
2506
|
}
|
|
2507
|
-
this.
|
|
2507
|
+
this.Ho.size < 2 && (this.No = null);
|
|
2508
2508
|
}
|
|
2509
|
-
|
|
2509
|
+
Lh(t) {
|
|
2510
2510
|
const e = [];
|
|
2511
2511
|
for (let i = 0; i < t.length; i += 1) {
|
|
2512
2512
|
const s = t.item(i);
|
|
2513
|
-
s && e.push(this.
|
|
2513
|
+
s && e.push(this.Nh(s));
|
|
2514
2514
|
}
|
|
2515
2515
|
return e;
|
|
2516
2516
|
}
|
|
2517
|
-
|
|
2518
|
-
return this.
|
|
2517
|
+
Nh(t) {
|
|
2518
|
+
return this.Mh(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 });
|
|
2519
2519
|
}
|
|
2520
|
-
|
|
2521
|
-
const r = this.
|
|
2520
|
+
Mh(t, e, i, s) {
|
|
2521
|
+
const r = this.Fr.canvas, o = r.getBoundingClientRect(), h = t - o.left, c = e - o.top, l = r.width / o.width, u = c * (r.height / o.height), f = h * l - this.Dn.offsetX, A = u - this.Dn.offsetY, g = Math.floor(f / this.Dn.cellWidth), p = Math.floor(A / this.Dn.cellHeight), d = g >= 0 && g < this.Dn.cols && p >= 0 && p < this.Dn.rows;
|
|
2522
2522
|
return { id: i, x: d ? g : -1, y: d ? p : -1, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
|
|
2523
2523
|
}
|
|
2524
|
-
|
|
2525
|
-
const r = this.
|
|
2526
|
-
return { touch: this.
|
|
2524
|
+
Dh(t, e, i, s) {
|
|
2525
|
+
const r = this.Go.get(t.id), o = Array.from(this.Bo.values()).map((l) => this.Oh(l)), h = Array.from(this.Ho.values()).map((l) => this.Oh(l)), c = this.Lh(e.changedTouches);
|
|
2526
|
+
return { touch: this.Oh(t), previousTouch: i ? this.Oh(i) : void 0, touches: h, previousTouches: o, changedTouches: c, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
|
|
2527
2527
|
}
|
|
2528
|
-
|
|
2529
|
-
if (this.
|
|
2530
|
-
const t = Array.from(this.
|
|
2531
|
-
this.
|
|
2528
|
+
Hh() {
|
|
2529
|
+
if (this.Ho.size !== 2) return void (this.No = null);
|
|
2530
|
+
const t = Array.from(this.Ho.values()), [e, i] = t, s = Y(e.x, e.y, i.x, i.y), r = yt(e.clientX, e.clientY, i.clientX, i.clientY);
|
|
2531
|
+
this.No = { ids: [e.id, i.id], initialDistance: Math.max(s, 1e-4), initialAngle: r, lastScale: 1, lastRotation: 0 };
|
|
2532
2532
|
}
|
|
2533
|
-
|
|
2534
|
-
if (this.
|
|
2535
|
-
const [e, i] = this.
|
|
2533
|
+
Bh(t) {
|
|
2534
|
+
if (this.No || this.Hh(), !this.No) return;
|
|
2535
|
+
const [e, i] = this.No.ids, s = this.Ho.get(e), r = this.Ho.get(i);
|
|
2536
2536
|
if (!s || !r) return;
|
|
2537
|
-
const o =
|
|
2538
|
-
this.
|
|
2539
|
-
let c = yt(s.clientX, s.clientY, r.clientX, r.clientY) - this.
|
|
2537
|
+
const o = Y(s.x, s.y, r.x, r.y) / this.No.initialDistance, h = o - this.No.lastScale;
|
|
2538
|
+
this.rh && Math.abs(h) > this.gh && (this.rh({ touches: [this.Oh(s), this.Oh(r)], scale: o, deltaScale: h, center: this.Xh(s, r), originalEvent: t }), this.No.lastScale = o);
|
|
2539
|
+
let c = yt(s.clientX, s.clientY, r.clientX, r.clientY) - this.No.initialAngle;
|
|
2540
2540
|
c = (c + 180) % 360 - 180;
|
|
2541
|
-
const l = c - this.
|
|
2542
|
-
this.
|
|
2541
|
+
const l = c - this.No.lastRotation;
|
|
2542
|
+
this.nh && Math.abs(l) > this.mh && (this.nh({ touches: [this.Oh(s), this.Oh(r)], rotation: c, deltaRotation: l, center: this.Xh(s, r), originalEvent: t }), this.No.lastRotation = c);
|
|
2543
2543
|
}
|
|
2544
|
-
|
|
2545
|
-
const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.
|
|
2544
|
+
Xh(t, e) {
|
|
2545
|
+
const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.Mh(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
|
|
2546
2546
|
return { x: r.x, y: r.y };
|
|
2547
2547
|
}
|
|
2548
|
-
|
|
2549
|
-
const i = performance.now(), s = i - t.startTime, r =
|
|
2550
|
-
if (!t.longPressFired && s <= this.
|
|
2551
|
-
this.
|
|
2552
|
-
else if (!t.longPressFired && s <= this.
|
|
2548
|
+
Gh(t, e) {
|
|
2549
|
+
const i = performance.now(), s = i - t.startTime, r = Y(t.startPosition.clientX, t.startPosition.clientY, t.lastPosition.clientX, t.lastPosition.clientY);
|
|
2550
|
+
if (!t.longPressFired && s <= this.oh && r <= this.ah)
|
|
2551
|
+
this.Yh(t.lastPosition, i) && this.sh ? this.sh({ touch: this.Oh(t.lastPosition), taps: 2, originalEvent: e }) : this.th && this.th({ touch: this.Oh(t.lastPosition), taps: 1, originalEvent: e });
|
|
2552
|
+
else if (!t.longPressFired && s <= this.ph && r >= this.dh) {
|
|
2553
2553
|
const o = { x: t.lastPosition.clientX - t.startPosition.clientX, y: t.lastPosition.clientY - t.startPosition.clientY }, h = Math.max(Math.hypot(o.x, o.y), 1e-4), c = { x: o.x / h, y: o.y / h }, l = { x: o.x / s, y: o.y / s };
|
|
2554
|
-
this.
|
|
2554
|
+
this.ih && this.ih({ touch: this.Oh(t.lastPosition), direction: c, distance: h, velocity: l, originalEvent: e });
|
|
2555
2555
|
}
|
|
2556
|
-
this.
|
|
2556
|
+
this.Ah = i, this.yh = this.Oh(t.lastPosition);
|
|
2557
2557
|
}
|
|
2558
|
-
|
|
2559
|
-
return !this.
|
|
2558
|
+
Yh(t, e) {
|
|
2559
|
+
return !this.yh || e - this.Ah > this.hh ? !1 : Y(t.clientX, t.clientY, this.yh.clientX, this.yh.clientY) <= this.ah;
|
|
2560
2560
|
}
|
|
2561
|
-
|
|
2561
|
+
Oh(t) {
|
|
2562
2562
|
return { ...t };
|
|
2563
2563
|
}
|
|
2564
2564
|
}
|
|
2565
|
-
const
|
|
2565
|
+
const Me = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Ut }, Symbol.toStringTag, { value: "Module" }));
|
|
2566
2566
|
class st extends mt {
|
|
2567
2567
|
constructor(e, i, s, r, o, h, c, l, u) {
|
|
2568
2568
|
const f = h / c;
|
|
2569
2569
|
let A, g;
|
|
2570
2570
|
f > 1 ? (A = l, g = Math.round(l / f)) : (g = u, A = Math.round(u * f));
|
|
2571
2571
|
super(e, i, s, r, h, c, A, g);
|
|
2572
|
-
a(this, "
|
|
2573
|
-
a(this, "
|
|
2574
|
-
a(this, "
|
|
2575
|
-
a(this, "
|
|
2576
|
-
a(this, "
|
|
2577
|
-
a(this, "
|
|
2578
|
-
a(this, "
|
|
2579
|
-
this.
|
|
2572
|
+
a(this, "Kh");
|
|
2573
|
+
a(this, "Wh", !1);
|
|
2574
|
+
a(this, "Zh", []);
|
|
2575
|
+
a(this, "xn", null);
|
|
2576
|
+
a(this, "jh", 0);
|
|
2577
|
+
a(this, "Vh", 0);
|
|
2578
|
+
a(this, "qh", -1);
|
|
2579
|
+
this.Kh = o;
|
|
2580
2580
|
}
|
|
2581
2581
|
D() {
|
|
2582
2582
|
super.D();
|
|
2583
|
-
for (const e of this.
|
|
2584
|
-
this.
|
|
2583
|
+
for (const e of this.Zh) this.A.deleteTexture(e);
|
|
2584
|
+
this.Zh = [], this.Kh.pause(), this.Kh.src = "", this.Kh.load();
|
|
2585
2585
|
}
|
|
2586
|
-
|
|
2587
|
-
if (!this.
|
|
2586
|
+
Qh() {
|
|
2587
|
+
if (!this.Wh && this.Kh.readyState >= this.Kh.HAVE_CURRENT_DATA) {
|
|
2588
2588
|
const e = this.A;
|
|
2589
|
-
e.bindTexture(e.TEXTURE_2D, this.
|
|
2589
|
+
e.bindTexture(e.TEXTURE_2D, this.jr), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, this.Kh), e.bindTexture(e.TEXTURE_2D, null);
|
|
2590
2590
|
}
|
|
2591
2591
|
}
|
|
2592
|
-
|
|
2593
|
-
if (this.
|
|
2594
|
-
const e = this.
|
|
2595
|
-
return this.
|
|
2592
|
+
_n() {
|
|
2593
|
+
if (this.Wh && this.Zh.length > 0) {
|
|
2594
|
+
const e = this.Vh % this.Zh.length;
|
|
2595
|
+
return this.Zh[e];
|
|
2596
2596
|
}
|
|
2597
|
-
return this.
|
|
2597
|
+
return this.jr;
|
|
2598
2598
|
}
|
|
2599
2599
|
ct() {
|
|
2600
2600
|
return this.Z = null, super.ct();
|
|
2601
2601
|
}
|
|
2602
|
-
|
|
2603
|
-
this.
|
|
2602
|
+
gn() {
|
|
2603
|
+
this.Qh();
|
|
2604
2604
|
}
|
|
2605
|
-
async
|
|
2605
|
+
async Jh(e, i) {
|
|
2606
2606
|
var s;
|
|
2607
2607
|
try {
|
|
2608
2608
|
if (e <= 0) throw Error("Video preload requires a frameRate greater than 0.");
|
|
2609
|
-
const r = this.
|
|
2609
|
+
const r = this.Kh.duration;
|
|
2610
2610
|
if (!isFinite(r) || r <= 0) throw Error("Video duration is invalid, cannot preload frames.");
|
|
2611
2611
|
const o = Math.max(1, Math.ceil(r * e));
|
|
2612
|
-
if (this.
|
|
2613
|
-
await this.
|
|
2612
|
+
if (this.ta(e, o), await this.sa(e, i)) return void this.ea("captureStream", i);
|
|
2613
|
+
await this.ia(e, i), this.ea("seeking", i);
|
|
2614
2614
|
} catch (r) {
|
|
2615
2615
|
const o = r instanceof Error ? r : Error(r + "");
|
|
2616
2616
|
throw (s = i == null ? void 0 : i.onError) == null || s.call(i, o), o;
|
|
2617
2617
|
}
|
|
2618
2618
|
}
|
|
2619
|
-
|
|
2620
|
-
this.
|
|
2619
|
+
ta(e, i) {
|
|
2620
|
+
this.xn = e, this.jh = i, this.Zh = [], this.Wh = !1, this.Vh = 0, this.qh = -1;
|
|
2621
2621
|
}
|
|
2622
|
-
|
|
2622
|
+
ea(e, i) {
|
|
2623
2623
|
var s;
|
|
2624
|
-
if (this.
|
|
2625
|
-
this.
|
|
2624
|
+
if (this.Zh.length === 0) throw Error(`Video preload via ${e} completed but produced 0 frames.`);
|
|
2625
|
+
this.jh = this.Zh.length, this.Wh = !0, this.Vh = 0, this.qh = -1, this.Kh.pause(), this.Kh.currentTime = 0, i != null && i.onProgress && i.onProgress({ percent: 100, loadedFrames: this.jh, totalFrames: this.jh, strategy: e }), (s = i == null ? void 0 : i.onComplete) == null || s.call(i, { totalFrames: this.jh, strategy: e });
|
|
2626
2626
|
}
|
|
2627
|
-
|
|
2627
|
+
ra(e) {
|
|
2628
2628
|
const i = this.A, s = i.createTexture();
|
|
2629
2629
|
return i.bindTexture(i.TEXTURE_2D, s), i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, 1), tt(i, i.LINEAR, i.LINEAR, i.CLAMP_TO_EDGE, i.CLAMP_TO_EDGE), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, i.RGBA, i.UNSIGNED_BYTE, e), i.bindTexture(i.TEXTURE_2D, null), s;
|
|
2630
2630
|
}
|
|
2631
|
-
|
|
2632
|
-
if (!(i != null && i.onProgress) || this.
|
|
2633
|
-
const s = Math.min(99, Math.floor(this.
|
|
2634
|
-
r > this.
|
|
2631
|
+
na(e, i) {
|
|
2632
|
+
if (!(i != null && i.onProgress) || this.jh === 0) return;
|
|
2633
|
+
const s = Math.min(99, Math.floor(this.Zh.length / this.jh * 100)), r = 10 * Math.floor(s / 10);
|
|
2634
|
+
r > this.qh && (this.qh = r, i.onProgress({ percent: s, loadedFrames: this.Zh.length, totalFrames: this.jh, strategy: e }));
|
|
2635
2635
|
}
|
|
2636
|
-
async
|
|
2637
|
-
const s = globalThis, r = s == null ? void 0 : s.MediaStreamTrackProcessor, o = this.
|
|
2636
|
+
async sa(e, i) {
|
|
2637
|
+
const s = globalThis, r = s == null ? void 0 : s.MediaStreamTrackProcessor, o = this.Kh.captureStream;
|
|
2638
2638
|
if (typeof r != "function" || typeof o != "function") return !1;
|
|
2639
2639
|
let h, c = null;
|
|
2640
2640
|
try {
|
|
2641
|
-
const l = o.call(this.
|
|
2641
|
+
const l = o.call(this.Kh);
|
|
2642
2642
|
if (h = l.getVideoTracks()[0], !h) return l.getTracks().forEach((A) => A.stop()), !1;
|
|
2643
|
-
if (c = new r({ track: h }).readable.getReader(), this.
|
|
2644
|
-
}), this.
|
|
2643
|
+
if (c = new r({ track: h }).readable.getReader(), this.Kh.currentTime = 0, this.Kh.muted = !0, await this.Kh.play().catch(() => {
|
|
2644
|
+
}), this.Kh.paused) return !1;
|
|
2645
2645
|
const u = 1e6 / e;
|
|
2646
2646
|
let f = 0;
|
|
2647
|
-
for (; this.
|
|
2647
|
+
for (; this.Zh.length < this.jh; ) {
|
|
2648
2648
|
const A = await c.read();
|
|
2649
2649
|
if (A.done) break;
|
|
2650
2650
|
const g = A.value;
|
|
2651
2651
|
if (g) try {
|
|
2652
2652
|
const p = typeof g.timestamp == "number" ? g.timestamp : f;
|
|
2653
|
-
(this.
|
|
2653
|
+
(this.Zh.length === 0 || p >= f) && (this.Zh.push(this.ra(g)), f = p + u, this.na("captureStream", i));
|
|
2654
2654
|
} finally {
|
|
2655
2655
|
g.close();
|
|
2656
2656
|
}
|
|
2657
2657
|
}
|
|
2658
|
-
return c.releaseLock(), h.stop(), c = null, h = void 0, this.
|
|
2658
|
+
return c.releaseLock(), h.stop(), c = null, h = void 0, this.Kh.pause(), this.Kh.currentTime = 0, this.Zh.length !== 0;
|
|
2659
2659
|
} catch {
|
|
2660
|
-
return this.
|
|
2660
|
+
return this.Zh = [], this.qh = -1, !1;
|
|
2661
2661
|
} finally {
|
|
2662
2662
|
if (c) try {
|
|
2663
2663
|
await c.cancel();
|
|
2664
2664
|
} catch {
|
|
2665
2665
|
}
|
|
2666
|
-
h && h.stop(), this.
|
|
2666
|
+
h && h.stop(), this.Kh.pause(), this.Kh.currentTime = 0;
|
|
2667
2667
|
}
|
|
2668
2668
|
}
|
|
2669
|
-
async
|
|
2670
|
-
const s = 1 / e, r = this.
|
|
2669
|
+
async ia(e, i) {
|
|
2670
|
+
const s = 1 / e, r = this.jh, o = this.Kh;
|
|
2671
2671
|
o.pause();
|
|
2672
2672
|
for (let h = 0; h < r; h++) {
|
|
2673
2673
|
const c = Math.min(o.duration, h * s);
|
|
2674
|
-
await this.
|
|
2674
|
+
await this.oa(c), this.Zh.push(this.ra(o)), this.na("seeking", i);
|
|
2675
2675
|
}
|
|
2676
2676
|
o.currentTime = 0;
|
|
2677
2677
|
}
|
|
2678
|
-
|
|
2678
|
+
oa(e) {
|
|
2679
2679
|
return new Promise((i, s) => {
|
|
2680
|
-
const r = this.
|
|
2680
|
+
const r = this.Kh, o = () => {
|
|
2681
2681
|
r.removeEventListener("seeked", h), r.removeEventListener("error", c);
|
|
2682
2682
|
}, h = () => {
|
|
2683
2683
|
o(), i();
|
|
@@ -2691,16 +2691,16 @@ class st extends mt {
|
|
|
2691
2691
|
});
|
|
2692
2692
|
}
|
|
2693
2693
|
frame(e) {
|
|
2694
|
-
return this.
|
|
2694
|
+
return this.Wh && e !== void 0 && this.jh > 0 && (this.Vh = (e % this.jh + this.jh) % this.jh, this.Z = null), this;
|
|
2695
2695
|
}
|
|
2696
|
-
static async
|
|
2696
|
+
static async An(e, i, s, r, o, h, c) {
|
|
2697
2697
|
const l = e.context, u = c == null ? void 0 : c.frameRate;
|
|
2698
2698
|
let f;
|
|
2699
2699
|
typeof s == "string" ? (f = document.createElement("video"), f.crossOrigin = "anonymous", f.loop = !0, f.muted = !0, f.playsInline = !0, await new Promise((v, m) => {
|
|
2700
2700
|
f.addEventListener("loadedmetadata", () => v(), { once: !0 }), f.addEventListener("error", (E) => {
|
|
2701
|
-
var
|
|
2701
|
+
var T;
|
|
2702
2702
|
const y = E.target;
|
|
2703
|
-
m(Error("Failed to load video: " + (((
|
|
2703
|
+
m(Error("Failed to load video: " + (((T = y.error) == null ? void 0 : T.message) || "Unknown error")));
|
|
2704
2704
|
}, { once: !0 }), f.src = s;
|
|
2705
2705
|
})) : (f = s, f.readyState < f.HAVE_METADATA && await new Promise((v, m) => {
|
|
2706
2706
|
f.addEventListener("loadedmetadata", () => v(), { once: !0 }), f.addEventListener("error", (E) => {
|
|
@@ -2711,31 +2711,31 @@ class st extends mt {
|
|
|
2711
2711
|
const A = l.createTexture();
|
|
2712
2712
|
l.bindTexture(l.TEXTURE_2D, A), l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL, 1), tt(l, l.LINEAR, l.LINEAR, l.CLAMP_TO_EDGE, l.CLAMP_TO_EDGE), l.texImage2D(l.TEXTURE_2D, 0, l.RGBA, l.RGBA, l.UNSIGNED_BYTE, f), l.bindTexture(l.TEXTURE_2D, null);
|
|
2713
2713
|
const g = f.videoWidth, p = f.videoHeight, d = new st(l, e, A, i, f, g, p, r, o);
|
|
2714
|
-
return d.
|
|
2714
|
+
return d.nn = h, u && u > 0 && await d.Jh(u, c), d;
|
|
2715
2715
|
}
|
|
2716
2716
|
async play() {
|
|
2717
|
-
await this.
|
|
2717
|
+
await this.Kh.play();
|
|
2718
2718
|
}
|
|
2719
2719
|
pause() {
|
|
2720
|
-
this.
|
|
2720
|
+
this.Kh.pause();
|
|
2721
2721
|
}
|
|
2722
2722
|
stop() {
|
|
2723
|
-
this.
|
|
2723
|
+
this.Kh.pause(), this.Kh.currentTime = 0;
|
|
2724
2724
|
}
|
|
2725
2725
|
speed(e) {
|
|
2726
|
-
return this.
|
|
2726
|
+
return this.Kh.playbackRate = e, this;
|
|
2727
2727
|
}
|
|
2728
2728
|
loop(e = !0) {
|
|
2729
|
-
return this.
|
|
2729
|
+
return this.Kh.loop = e, this;
|
|
2730
2730
|
}
|
|
2731
2731
|
time(e) {
|
|
2732
|
-
return this.
|
|
2732
|
+
return this.Kh.currentTime = e, this;
|
|
2733
2733
|
}
|
|
2734
2734
|
volume(e) {
|
|
2735
|
-
return this.
|
|
2735
|
+
return this.Kh.volume = Math.max(0, Math.min(1, e)), this;
|
|
2736
2736
|
}
|
|
2737
2737
|
get texture() {
|
|
2738
|
-
return this.
|
|
2738
|
+
return this.jr;
|
|
2739
2739
|
}
|
|
2740
2740
|
get width() {
|
|
2741
2741
|
return this.H;
|
|
@@ -2744,65 +2744,65 @@ class st extends mt {
|
|
|
2744
2744
|
return this.G;
|
|
2745
2745
|
}
|
|
2746
2746
|
get originalWidth() {
|
|
2747
|
-
return this.
|
|
2747
|
+
return this.Vr;
|
|
2748
2748
|
}
|
|
2749
2749
|
get originalHeight() {
|
|
2750
|
-
return this.
|
|
2750
|
+
return this.qr;
|
|
2751
2751
|
}
|
|
2752
2752
|
get videoElement() {
|
|
2753
|
-
return this.
|
|
2753
|
+
return this.Kh;
|
|
2754
2754
|
}
|
|
2755
2755
|
get currentTime() {
|
|
2756
|
-
return this.
|
|
2756
|
+
return this.Kh.currentTime;
|
|
2757
2757
|
}
|
|
2758
2758
|
get duration() {
|
|
2759
|
-
return this.
|
|
2759
|
+
return this.Kh.duration;
|
|
2760
2760
|
}
|
|
2761
2761
|
get isPlaying() {
|
|
2762
|
-
return !this.
|
|
2762
|
+
return !this.Kh.paused && !this.Kh.ended;
|
|
2763
2763
|
}
|
|
2764
2764
|
get isPreloaded() {
|
|
2765
|
-
return this.
|
|
2765
|
+
return this.Wh;
|
|
2766
2766
|
}
|
|
2767
2767
|
get totalFrames() {
|
|
2768
|
-
return this.
|
|
2768
|
+
return this.jh;
|
|
2769
2769
|
}
|
|
2770
2770
|
get preloadFrameRate() {
|
|
2771
|
-
return this.
|
|
2771
|
+
return this.xn;
|
|
2772
2772
|
}
|
|
2773
2773
|
get currentFrameIndex() {
|
|
2774
|
-
return this.
|
|
2774
|
+
return this.Vh;
|
|
2775
2775
|
}
|
|
2776
2776
|
}
|
|
2777
|
-
const
|
|
2778
|
-
|
|
2779
|
-
if (C.
|
|
2777
|
+
const Be = (n) => class extends n {
|
|
2778
|
+
ha(t, e, i, s) {
|
|
2779
|
+
if (C.Xr(t)) return t;
|
|
2780
2780
|
if (typeof t == "number" || typeof t == "string") return this.color(t, e, i, s);
|
|
2781
2781
|
throw Error("Unsupported color input passed to color-capable method.");
|
|
2782
2782
|
}
|
|
2783
2783
|
rotate(t = 0, e = 0, i = 0) {
|
|
2784
|
-
this.W.state.
|
|
2784
|
+
this.W.state.Zt(t), this.W.state.jt(e), this.W.state.Vt(i);
|
|
2785
2785
|
}
|
|
2786
2786
|
rotateX(t) {
|
|
2787
|
-
this.W.state.
|
|
2787
|
+
this.W.state.Zt(t);
|
|
2788
2788
|
}
|
|
2789
2789
|
rotateY(t) {
|
|
2790
|
-
this.W.state.
|
|
2790
|
+
this.W.state.jt(t);
|
|
2791
2791
|
}
|
|
2792
2792
|
rotateZ(t) {
|
|
2793
|
-
this.W.state.
|
|
2793
|
+
this.W.state.Vt(t);
|
|
2794
2794
|
}
|
|
2795
2795
|
translate(t = 0, e = 0, i = 0) {
|
|
2796
|
-
this.W.state.
|
|
2796
|
+
this.W.state.qt(t, e, i);
|
|
2797
2797
|
}
|
|
2798
2798
|
translateX(t) {
|
|
2799
|
-
this.W.state.
|
|
2799
|
+
this.W.state.qt(t, 0, 0);
|
|
2800
2800
|
}
|
|
2801
2801
|
translateY(t) {
|
|
2802
|
-
this.W.state.
|
|
2802
|
+
this.W.state.qt(0, t, 0);
|
|
2803
2803
|
}
|
|
2804
2804
|
translateZ(t) {
|
|
2805
|
-
this.W.state.
|
|
2805
|
+
this.W.state.qt(0, 0, t);
|
|
2806
2806
|
}
|
|
2807
2807
|
push() {
|
|
2808
2808
|
this.W.state.rt();
|
|
@@ -2811,407 +2811,407 @@ const Ne = (n) => class extends n {
|
|
|
2811
2811
|
this.W.state.nt();
|
|
2812
2812
|
}
|
|
2813
2813
|
color(t, e, i, s) {
|
|
2814
|
-
const r = typeof t == "string" ? (o) => this.
|
|
2815
|
-
return C.
|
|
2814
|
+
const r = typeof t == "string" ? (o) => this.tr.Ji(o) : void 0;
|
|
2815
|
+
return C.Nr(t, r ?? e, i, s);
|
|
2816
2816
|
}
|
|
2817
2817
|
rect(t = 1, e = 1) {
|
|
2818
|
-
this.W.
|
|
2818
|
+
this.W.di(t, e);
|
|
2819
2819
|
}
|
|
2820
2820
|
point() {
|
|
2821
|
-
this.W.
|
|
2821
|
+
this.W.di(1, 1);
|
|
2822
2822
|
}
|
|
2823
2823
|
line(t, e, i, s) {
|
|
2824
|
-
this.W.
|
|
2824
|
+
this.W.pi(t, e, i, s);
|
|
2825
2825
|
}
|
|
2826
2826
|
lineWeight(t) {
|
|
2827
|
-
this.W.state.
|
|
2827
|
+
this.W.state.Kt(t);
|
|
2828
2828
|
}
|
|
2829
2829
|
background(t, e, i, s = 255) {
|
|
2830
|
-
const r = this.
|
|
2831
|
-
this.W.
|
|
2830
|
+
const r = this.ha(t, e, i, s);
|
|
2831
|
+
this.W.wi(r.r, r.g, r.b, r.a);
|
|
2832
2832
|
}
|
|
2833
2833
|
char(t) {
|
|
2834
|
-
if (C.
|
|
2834
|
+
if (C.Xr(t)) {
|
|
2835
2835
|
const i = t.character;
|
|
2836
|
-
return void (i && this.W.state.
|
|
2836
|
+
return void (i && this.W.state.ss(i));
|
|
2837
2837
|
}
|
|
2838
2838
|
const e = Array.from(t);
|
|
2839
2839
|
if (e.length === 0) throw Error("char() requires at least one character.");
|
|
2840
|
-
this.W.state.
|
|
2840
|
+
this.W.state.ss(this.tr.Qi(e[0]));
|
|
2841
2841
|
}
|
|
2842
2842
|
charColor(t, e, i, s) {
|
|
2843
|
-
const r = this.
|
|
2844
|
-
this.W.state.
|
|
2843
|
+
const r = this.ha(t, e, i, s);
|
|
2844
|
+
this.W.state.es(r.r, r.g, r.b, r.a);
|
|
2845
2845
|
}
|
|
2846
2846
|
cellColor(t, e, i, s) {
|
|
2847
|
-
const r = this.
|
|
2848
|
-
this.W.state.
|
|
2847
|
+
const r = this.ha(t, e, i, s);
|
|
2848
|
+
this.W.state.rs(r.r, r.g, r.b, r.a);
|
|
2849
2849
|
}
|
|
2850
2850
|
flipX(t) {
|
|
2851
|
-
this.W.state.
|
|
2851
|
+
this.W.state.ns(t);
|
|
2852
2852
|
}
|
|
2853
2853
|
flipY(t) {
|
|
2854
|
-
this.W.state.
|
|
2854
|
+
this.W.state.hs(t);
|
|
2855
2855
|
}
|
|
2856
2856
|
charRotation(t) {
|
|
2857
|
-
this.W.state.
|
|
2857
|
+
this.W.state.ls(t);
|
|
2858
2858
|
}
|
|
2859
2859
|
invert(t) {
|
|
2860
|
-
this.W.state.
|
|
2860
|
+
this.W.state.cs(t);
|
|
2861
2861
|
}
|
|
2862
2862
|
clear() {
|
|
2863
|
-
this.W.
|
|
2863
|
+
this.W.wi(0, 0, 0, 0);
|
|
2864
2864
|
}
|
|
2865
2865
|
ellipse(t, e) {
|
|
2866
|
-
this.W.
|
|
2866
|
+
this.W.gi(t / 2, e / 2);
|
|
2867
2867
|
}
|
|
2868
2868
|
triangle(t, e, i, s, r, o) {
|
|
2869
|
-
this.W.
|
|
2869
|
+
this.W.mi(t, e, i, s, r, o);
|
|
2870
2870
|
}
|
|
2871
2871
|
bezierCurve(t, e, i, s, r, o, h, c) {
|
|
2872
|
-
this.W.
|
|
2872
|
+
this.W._i(t, e, i, s, r, o, h, c);
|
|
2873
2873
|
}
|
|
2874
2874
|
arc(t, e, i, s) {
|
|
2875
|
-
this.W.
|
|
2875
|
+
this.W.Ai(t / 2, e / 2, i, s);
|
|
2876
2876
|
}
|
|
2877
2877
|
shader(t) {
|
|
2878
|
-
this.W.
|
|
2878
|
+
this.W.ai(t);
|
|
2879
2879
|
}
|
|
2880
2880
|
setUniform(t, e) {
|
|
2881
|
-
this.W.
|
|
2881
|
+
this.W.L(t, e);
|
|
2882
2882
|
}
|
|
2883
2883
|
setUniforms(t) {
|
|
2884
|
-
this.W.
|
|
2884
|
+
this.W.ci(t);
|
|
2885
2885
|
}
|
|
2886
2886
|
async createFilterShader(t) {
|
|
2887
2887
|
if (typeof t == "string" && (t.startsWith("./") || t.startsWith("../") || t.endsWith(".frag") || t.endsWith(".glsl"))) {
|
|
2888
2888
|
const e = await fetch(t);
|
|
2889
2889
|
if (!e.ok) throw Error(`Failed to load shader from ${t}: ${e.statusText}`);
|
|
2890
2890
|
const i = await e.text();
|
|
2891
|
-
return this.W.
|
|
2891
|
+
return this.W.li(i);
|
|
2892
2892
|
}
|
|
2893
|
-
return this.W.
|
|
2893
|
+
return this.W.li(t);
|
|
2894
2894
|
}
|
|
2895
2895
|
createFramebuffer(t) {
|
|
2896
|
-
return this.W.
|
|
2896
|
+
return this.W.yi(t.width ?? this.grid.cols, t.height ?? this.grid.rows, 3);
|
|
2897
2897
|
}
|
|
2898
2898
|
image(t, e, i) {
|
|
2899
|
-
this.W.
|
|
2899
|
+
this.W.ui(t, e, i);
|
|
2900
2900
|
}
|
|
2901
2901
|
ortho() {
|
|
2902
|
-
this.W.state.
|
|
2902
|
+
this.W.state.fs(!0);
|
|
2903
2903
|
}
|
|
2904
2904
|
async loadImage(t) {
|
|
2905
2905
|
if (typeof t != "string") {
|
|
2906
|
-
const r =
|
|
2907
|
-
return this.
|
|
2906
|
+
const r = W.An(this.W, this.tr, t, this.Dn.cols, this.Dn.rows, (o) => this.tr.Ji(o));
|
|
2907
|
+
return this.aa(r), r;
|
|
2908
2908
|
}
|
|
2909
2909
|
const e = t, i = await new Promise((r, o) => {
|
|
2910
2910
|
const h = new Image();
|
|
2911
2911
|
h.crossOrigin = "anonymous", h.onload = () => r(h), h.onerror = (c) => o(c), h.src = e;
|
|
2912
|
-
}), s =
|
|
2913
|
-
return this.
|
|
2912
|
+
}), s = W.An(this.W, this.tr, i, this.Dn.cols, this.Dn.rows, (r) => this.tr.Ji(r));
|
|
2913
|
+
return this.aa(s), s;
|
|
2914
2914
|
}
|
|
2915
2915
|
async loadVideo(t, e) {
|
|
2916
|
-
const i = await st.
|
|
2917
|
-
return this.
|
|
2916
|
+
const i = await st.An(this.W, this.tr, t, this.Dn.cols, this.Dn.rows, (s) => this.tr.Ji(s), e);
|
|
2917
|
+
return this.aa(i), i;
|
|
2918
2918
|
}
|
|
2919
|
-
},
|
|
2919
|
+
}, Se = (n) => class extends n {
|
|
2920
2920
|
async loadFont(t) {
|
|
2921
|
-
return this.
|
|
2922
|
-
const e = this.
|
|
2923
|
-
this.
|
|
2921
|
+
return this.tr.Ar(t).then(() => {
|
|
2922
|
+
const e = this.tr.maxGlyphDimensions;
|
|
2923
|
+
this.Dn.Pr(e.width, e.height), this.ca.resize(this.Dn.cols, this.Dn.rows), this.W.bi(), this.Do.oo(), this.la.oo(), this.ua();
|
|
2924
2924
|
});
|
|
2925
2925
|
}
|
|
2926
2926
|
fontSize(t) {
|
|
2927
|
-
if (!Z.m(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) || this.
|
|
2928
|
-
this.
|
|
2929
|
-
const e = this.
|
|
2930
|
-
this.
|
|
2927
|
+
if (!Z.m(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) || this.tr.fontSize === t) return;
|
|
2928
|
+
this.tr._r(t);
|
|
2929
|
+
const e = this.tr.maxGlyphDimensions;
|
|
2930
|
+
this.Dn.Pr(e.width, e.height), this.ca.resize(this.Dn.cols, this.Dn.rows), this.W.bi(), this.Do.oo(), this.la.oo(), this.ua();
|
|
2931
2931
|
}
|
|
2932
|
-
},
|
|
2932
|
+
}, Ue = (n) => class extends n {
|
|
2933
2933
|
get frameCount() {
|
|
2934
|
-
return this.
|
|
2934
|
+
return this.fa.Ln;
|
|
2935
2935
|
}
|
|
2936
2936
|
set frameCount(t) {
|
|
2937
|
-
this.
|
|
2937
|
+
this.fa.Ln = t;
|
|
2938
2938
|
}
|
|
2939
2939
|
frameRate(t) {
|
|
2940
|
-
return t === void 0 ? this.
|
|
2940
|
+
return t === void 0 ? this.fa.In : this.fa.Un(t, () => this.da());
|
|
2941
2941
|
}
|
|
2942
2942
|
noLoop() {
|
|
2943
|
-
this.
|
|
2943
|
+
this.fa.Rn();
|
|
2944
2944
|
}
|
|
2945
2945
|
loop() {
|
|
2946
|
-
this.
|
|
2946
|
+
this.fa.Sn(() => this.da());
|
|
2947
2947
|
}
|
|
2948
2948
|
redraw(t = 1) {
|
|
2949
|
-
if (Z.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.
|
|
2949
|
+
if (Z.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();
|
|
2950
2950
|
}
|
|
2951
2951
|
isLooping() {
|
|
2952
|
-
return this.
|
|
2952
|
+
return this.fa.zn;
|
|
2953
2953
|
}
|
|
2954
2954
|
}, Le = (n) => class extends n {
|
|
2955
2955
|
constructor(...t) {
|
|
2956
2956
|
super(...t);
|
|
2957
2957
|
}
|
|
2958
2958
|
mouseClicked(t) {
|
|
2959
|
-
this.
|
|
2959
|
+
this.Do.vo(t);
|
|
2960
2960
|
}
|
|
2961
2961
|
mousePressed(t) {
|
|
2962
|
-
this.
|
|
2962
|
+
this.Do.mo(t);
|
|
2963
2963
|
}
|
|
2964
2964
|
mouseReleased(t) {
|
|
2965
|
-
this.
|
|
2965
|
+
this.Do._o(t);
|
|
2966
2966
|
}
|
|
2967
2967
|
mouseMoved(t) {
|
|
2968
|
-
this.
|
|
2968
|
+
this.Do.Ao(t);
|
|
2969
2969
|
}
|
|
2970
2970
|
mouseScrolled(t) {
|
|
2971
|
-
this.
|
|
2971
|
+
this.Do.yo(t);
|
|
2972
2972
|
}
|
|
2973
2973
|
get mouse() {
|
|
2974
|
-
return this.
|
|
2974
|
+
return this.Do.wo();
|
|
2975
2975
|
}
|
|
2976
2976
|
cursor(t) {
|
|
2977
|
-
this.
|
|
2977
|
+
this.Do.no(t);
|
|
2978
2978
|
}
|
|
2979
|
-
},
|
|
2979
|
+
}, Ne = (n) => class extends n {
|
|
2980
2980
|
constructor(...t) {
|
|
2981
2981
|
super(...t);
|
|
2982
2982
|
}
|
|
2983
2983
|
touchStarted(t) {
|
|
2984
|
-
this.
|
|
2984
|
+
this.la.$h(t);
|
|
2985
2985
|
}
|
|
2986
2986
|
touchMoved(t) {
|
|
2987
|
-
this.
|
|
2987
|
+
this.la.Ao(t);
|
|
2988
2988
|
}
|
|
2989
2989
|
touchEnded(t) {
|
|
2990
|
-
this.
|
|
2990
|
+
this.la.Th(t);
|
|
2991
2991
|
}
|
|
2992
2992
|
touchCancelled(t) {
|
|
2993
|
-
this.
|
|
2993
|
+
this.la.Ph(t);
|
|
2994
2994
|
}
|
|
2995
2995
|
tap(t) {
|
|
2996
|
-
this.
|
|
2996
|
+
this.la.Eh(t);
|
|
2997
2997
|
}
|
|
2998
2998
|
doubleTap(t) {
|
|
2999
|
-
this.
|
|
2999
|
+
this.la.Rh(t);
|
|
3000
3000
|
}
|
|
3001
3001
|
longPress(t) {
|
|
3002
|
-
this.
|
|
3002
|
+
this.la.Sh(t);
|
|
3003
3003
|
}
|
|
3004
3004
|
swipe(t) {
|
|
3005
|
-
this.
|
|
3005
|
+
this.la.kh(t);
|
|
3006
3006
|
}
|
|
3007
3007
|
pinch(t) {
|
|
3008
|
-
this.
|
|
3008
|
+
this.la.zh(t);
|
|
3009
3009
|
}
|
|
3010
3010
|
rotateGesture(t) {
|
|
3011
|
-
this.
|
|
3011
|
+
this.la.Ih(t);
|
|
3012
3012
|
}
|
|
3013
3013
|
get touches() {
|
|
3014
|
-
return this.
|
|
3014
|
+
return this.la.Fh();
|
|
3015
3015
|
}
|
|
3016
3016
|
}, Ie = (n) => class extends n {
|
|
3017
3017
|
constructor(...t) {
|
|
3018
3018
|
super(...t);
|
|
3019
3019
|
}
|
|
3020
3020
|
keyPressed(t) {
|
|
3021
|
-
this.
|
|
3021
|
+
this.pa.mo(t);
|
|
3022
3022
|
}
|
|
3023
3023
|
keyReleased(t) {
|
|
3024
|
-
this.
|
|
3024
|
+
this.pa._o(t);
|
|
3025
3025
|
}
|
|
3026
3026
|
isKeyPressed(t) {
|
|
3027
|
-
return this.
|
|
3027
|
+
return this.pa.So(t);
|
|
3028
3028
|
}
|
|
3029
3029
|
get lastKeyPressed() {
|
|
3030
|
-
return this.
|
|
3030
|
+
return this.pa.ko();
|
|
3031
3031
|
}
|
|
3032
3032
|
get lastKeyReleased() {
|
|
3033
|
-
return this.
|
|
3033
|
+
return this.pa.zo();
|
|
3034
3034
|
}
|
|
3035
3035
|
get pressedKeys() {
|
|
3036
|
-
return this.
|
|
3036
|
+
return this.pa.Io();
|
|
3037
3037
|
}
|
|
3038
3038
|
get modifierState() {
|
|
3039
|
-
return this.
|
|
3039
|
+
return this.pa.Lo();
|
|
3040
3040
|
}
|
|
3041
3041
|
};
|
|
3042
|
-
class
|
|
3042
|
+
class Oe {
|
|
3043
3043
|
constructor(t) {
|
|
3044
|
-
a(this, "
|
|
3045
|
-
a(this, "
|
|
3046
|
-
a(this, "
|
|
3047
|
-
a(this, "
|
|
3048
|
-
a(this, "
|
|
3049
|
-
this.
|
|
3050
|
-
}
|
|
3051
|
-
async
|
|
3044
|
+
a(this, "ga");
|
|
3045
|
+
a(this, "va", /* @__PURE__ */ new Map());
|
|
3046
|
+
a(this, "ma", []);
|
|
3047
|
+
a(this, "_a", /* @__PURE__ */ new Map());
|
|
3048
|
+
a(this, "ya", /* @__PURE__ */ new Map());
|
|
3049
|
+
this.ga = t;
|
|
3050
|
+
}
|
|
3051
|
+
async wa(t) {
|
|
3052
3052
|
for (const e of t) {
|
|
3053
|
-
if (this.
|
|
3054
|
-
const i = this.
|
|
3053
|
+
if (this.va.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
|
|
3054
|
+
const i = this.ba(e.name);
|
|
3055
3055
|
try {
|
|
3056
|
-
await e.install(this.
|
|
3056
|
+
await e.install(this.ga, i);
|
|
3057
3057
|
} catch (s) {
|
|
3058
|
-
throw this.
|
|
3058
|
+
throw this.Ca(e.name), s;
|
|
3059
3059
|
}
|
|
3060
|
-
this.
|
|
3060
|
+
this.va.set(e.name, e), this.ma.push(e.name);
|
|
3061
3061
|
}
|
|
3062
3062
|
}
|
|
3063
|
-
async
|
|
3064
|
-
const e = this.
|
|
3063
|
+
async xa(t) {
|
|
3064
|
+
const e = this.va.get(t);
|
|
3065
3065
|
if (!e) return;
|
|
3066
|
-
const i = this.
|
|
3067
|
-
e.uninstall && await e.uninstall(this.
|
|
3066
|
+
const i = this.ba(t);
|
|
3067
|
+
e.uninstall && await e.uninstall(this.ga, i), this.va.delete(t), this.ma.splice(this.ma.indexOf(t), 1), this.Ca(t);
|
|
3068
3068
|
}
|
|
3069
|
-
|
|
3070
|
-
this.
|
|
3069
|
+
Ma() {
|
|
3070
|
+
this.Fa(this._a);
|
|
3071
3071
|
}
|
|
3072
|
-
|
|
3073
|
-
this.
|
|
3072
|
+
$a() {
|
|
3073
|
+
this.Fa(this.ya);
|
|
3074
3074
|
}
|
|
3075
|
-
async
|
|
3076
|
-
const t = [...this.
|
|
3077
|
-
for (const e of t) await this.
|
|
3075
|
+
async Ta() {
|
|
3076
|
+
const t = [...this.va.keys()];
|
|
3077
|
+
for (const e of t) await this.xa(e);
|
|
3078
3078
|
}
|
|
3079
|
-
|
|
3080
|
-
return { renderer: this.
|
|
3079
|
+
ba(t) {
|
|
3080
|
+
return { renderer: this.ga.W, font: this.ga.tr, grid: this.ga.Dn, canvas: this.ga.Fr, drawFramebuffer: this.ga.ca, asciiFramebuffer: this.ga.Pa, registerPreDrawHook: (e) => this.Ea(this._a, t, e), registerPostDrawHook: (e) => this.Ea(this.ya, t, e) };
|
|
3081
3081
|
}
|
|
3082
|
-
|
|
3082
|
+
Ea(t, e, i) {
|
|
3083
3083
|
const s = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
3084
3084
|
return s.add(i), t.set(e, s), () => {
|
|
3085
3085
|
const r = t.get(e);
|
|
3086
3086
|
r && (r.delete(i), r.size === 0 && t.delete(e));
|
|
3087
3087
|
};
|
|
3088
3088
|
}
|
|
3089
|
-
|
|
3090
|
-
this.
|
|
3089
|
+
Ca(t) {
|
|
3090
|
+
this._a.delete(t), this.ya.delete(t);
|
|
3091
3091
|
}
|
|
3092
|
-
|
|
3093
|
-
for (const e of this.
|
|
3092
|
+
Fa(t) {
|
|
3093
|
+
for (const e of this.ma) {
|
|
3094
3094
|
const i = t.get(e);
|
|
3095
3095
|
i && i.forEach((s) => s());
|
|
3096
3096
|
}
|
|
3097
3097
|
}
|
|
3098
3098
|
}
|
|
3099
|
-
const
|
|
3099
|
+
const Tt = `#version 300 es
|
|
3100
3100
|
in vec2 A0;in vec2 A1;out vec2 v_uv;void main(){v_uv=A1;gl_Position=vec4(A0,0.,1.);}`;
|
|
3101
3101
|
class Lt {
|
|
3102
3102
|
constructor() {
|
|
3103
|
-
a(this, "
|
|
3104
|
-
a(this, "
|
|
3105
|
-
a(this, "
|
|
3106
|
-
a(this, "
|
|
3107
|
-
a(this, "
|
|
3103
|
+
a(this, "Ra", /* @__PURE__ */ new Map());
|
|
3104
|
+
a(this, "Sa", []);
|
|
3105
|
+
a(this, "ka", 0);
|
|
3106
|
+
a(this, "za", 0);
|
|
3107
|
+
a(this, "Ia");
|
|
3108
3108
|
}
|
|
3109
|
-
get
|
|
3110
|
-
return this.
|
|
3109
|
+
get La() {
|
|
3110
|
+
return this.ka;
|
|
3111
3111
|
}
|
|
3112
|
-
get
|
|
3113
|
-
if (this.
|
|
3112
|
+
get Oa() {
|
|
3113
|
+
if (this.ka === 0) return 0;
|
|
3114
3114
|
let t = 0;
|
|
3115
|
-
for (const e of this.
|
|
3116
|
-
const i = this.
|
|
3115
|
+
for (const e of this.Sa) {
|
|
3116
|
+
const i = this.Ra.get(e);
|
|
3117
3117
|
i && (t += Math.min(1, Math.max(0, i.progress)) * i.weight);
|
|
3118
3118
|
}
|
|
3119
|
-
return Math.min(1, t / this.
|
|
3119
|
+
return Math.min(1, t / this.ka);
|
|
3120
3120
|
}
|
|
3121
|
-
|
|
3122
|
-
this.
|
|
3121
|
+
Da(t) {
|
|
3122
|
+
this.Ia = t;
|
|
3123
3123
|
}
|
|
3124
|
-
|
|
3125
|
-
const i = `phase-${this.
|
|
3126
|
-
return this.
|
|
3124
|
+
Ha(t, e = 1) {
|
|
3125
|
+
const i = `phase-${this.Sa.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
|
|
3126
|
+
return this.Ra.set(i, s), this.Sa.push(i), this.ka += s.weight, i;
|
|
3127
3127
|
}
|
|
3128
|
-
|
|
3129
|
-
const i = this.
|
|
3128
|
+
Ba(t, e) {
|
|
3129
|
+
const i = this.Ra.get(t);
|
|
3130
3130
|
if (!i) return;
|
|
3131
3131
|
i.progress = Math.max(0, Math.min(1, e)), i.status = i.progress >= 1 ? "complete" : "running";
|
|
3132
|
-
const s = this.
|
|
3133
|
-
Math.abs(s - this.
|
|
3132
|
+
const s = this.Oa;
|
|
3133
|
+
Math.abs(s - this.za) > 1e-3 && (this.za = s, this.Ia && this.Ia(s));
|
|
3134
3134
|
}
|
|
3135
|
-
|
|
3136
|
-
const e = this.
|
|
3137
|
-
e && (e.progress = 1, e.status = "complete", this.
|
|
3135
|
+
Ga(t) {
|
|
3136
|
+
const e = this.Ra.get(t);
|
|
3137
|
+
e && (e.progress = 1, e.status = "complete", this.Ba(t, 1));
|
|
3138
3138
|
}
|
|
3139
|
-
|
|
3140
|
-
const e = this.
|
|
3139
|
+
Na(t) {
|
|
3140
|
+
const e = this.Ra.get(t);
|
|
3141
3141
|
e && (e.status = "failed");
|
|
3142
3142
|
}
|
|
3143
|
-
|
|
3144
|
-
return this.
|
|
3145
|
-
const e = this.
|
|
3143
|
+
Xa() {
|
|
3144
|
+
return this.Sa.map((t) => {
|
|
3145
|
+
const e = this.Ra.get(t);
|
|
3146
3146
|
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" };
|
|
3147
3147
|
});
|
|
3148
3148
|
}
|
|
3149
3149
|
}
|
|
3150
|
-
class
|
|
3150
|
+
class Nt {
|
|
3151
3151
|
constructor(t = "active") {
|
|
3152
|
-
a(this, "
|
|
3153
|
-
a(this, "
|
|
3154
|
-
a(this, "
|
|
3155
|
-
this.
|
|
3152
|
+
a(this, "Ya");
|
|
3153
|
+
a(this, "Ka", "");
|
|
3154
|
+
a(this, "Wa", "");
|
|
3155
|
+
this.Ya = t;
|
|
3156
3156
|
}
|
|
3157
|
-
get
|
|
3158
|
-
return this.
|
|
3157
|
+
get Za() {
|
|
3158
|
+
return this.Ya;
|
|
3159
3159
|
}
|
|
3160
|
-
get
|
|
3161
|
-
return this.
|
|
3160
|
+
get ja() {
|
|
3161
|
+
return this.Ya !== "disabled";
|
|
3162
3162
|
}
|
|
3163
|
-
get
|
|
3164
|
-
return this.
|
|
3163
|
+
get Va() {
|
|
3164
|
+
return this.Ya === "active" || this.Ya === "transitioning" || this.Ya === "error";
|
|
3165
3165
|
}
|
|
3166
|
-
get
|
|
3167
|
-
return this.
|
|
3166
|
+
get qa() {
|
|
3167
|
+
return this.Ka;
|
|
3168
3168
|
}
|
|
3169
|
-
get
|
|
3170
|
-
return this.
|
|
3169
|
+
get Qa() {
|
|
3170
|
+
return this.Wa;
|
|
3171
3171
|
}
|
|
3172
|
-
|
|
3173
|
-
this.
|
|
3172
|
+
Ja() {
|
|
3173
|
+
this.Ya !== "done" && this.Ya !== "transitioning" || (this.Ya = "active");
|
|
3174
3174
|
}
|
|
3175
|
-
|
|
3176
|
-
this.
|
|
3175
|
+
tc() {
|
|
3176
|
+
this.Ya !== "disabled" && (this.Ya = "done");
|
|
3177
3177
|
}
|
|
3178
|
-
|
|
3179
|
-
this.
|
|
3178
|
+
sc() {
|
|
3179
|
+
this.Ya !== "disabled" && (this.Ya = "transitioning");
|
|
3180
3180
|
}
|
|
3181
|
-
|
|
3182
|
-
this.
|
|
3181
|
+
ec() {
|
|
3182
|
+
this.Ya === "transitioning" && (this.Ya = "done");
|
|
3183
3183
|
}
|
|
3184
|
-
|
|
3185
|
-
this.
|
|
3184
|
+
rc(t) {
|
|
3185
|
+
this.Ya !== "disabled" && (this.Ya = "error", t instanceof Error ? (this.Ka = t.message, this.Wa = t.stack || "") : (this.Ka = t, this.Wa = ""));
|
|
3186
3186
|
}
|
|
3187
|
-
|
|
3188
|
-
this.
|
|
3187
|
+
nc() {
|
|
3188
|
+
this.Ya = "disabled";
|
|
3189
3189
|
}
|
|
3190
3190
|
}
|
|
3191
3191
|
class It {
|
|
3192
3192
|
constructor(t, e) {
|
|
3193
|
-
a(this, "
|
|
3194
|
-
a(this, "
|
|
3195
|
-
a(this, "
|
|
3196
|
-
a(this, "
|
|
3197
|
-
this.
|
|
3193
|
+
a(this, "oc", 0);
|
|
3194
|
+
a(this, "hc", 1);
|
|
3195
|
+
a(this, "ac");
|
|
3196
|
+
a(this, "cc");
|
|
3197
|
+
this.ac = t, this.cc = e;
|
|
3198
3198
|
}
|
|
3199
|
-
get
|
|
3200
|
-
return this.
|
|
3199
|
+
get lc() {
|
|
3200
|
+
return this.hc;
|
|
3201
3201
|
}
|
|
3202
|
-
get
|
|
3203
|
-
return this.
|
|
3202
|
+
get uc() {
|
|
3203
|
+
return this.hc < 1;
|
|
3204
3204
|
}
|
|
3205
|
-
|
|
3206
|
-
this.
|
|
3205
|
+
Pn() {
|
|
3206
|
+
this.ac !== "none" && this.cc > 0 && (this.oc = performance.now());
|
|
3207
3207
|
}
|
|
3208
3208
|
st() {
|
|
3209
|
-
if (this.
|
|
3210
|
-
const t = performance.now() - this.
|
|
3211
|
-
return e >= 1 ? (this.
|
|
3209
|
+
if (this.ac === "none" || this.cc === 0) return this.hc = 1, !1;
|
|
3210
|
+
const t = performance.now() - this.oc, e = Math.min(1, t / this.cc);
|
|
3211
|
+
return e >= 1 ? (this.hc = 0, !0) : (this.hc = 1 - e, !1);
|
|
3212
3212
|
}
|
|
3213
|
-
|
|
3214
|
-
this.
|
|
3213
|
+
js() {
|
|
3214
|
+
this.hc = 1, this.oc = 0;
|
|
3215
3215
|
}
|
|
3216
3216
|
}
|
|
3217
3217
|
function dt(n, t) {
|
|
@@ -3223,13 +3223,13 @@ function dt(n, t) {
|
|
|
3223
3223
|
return 0.2126 * c(r) + 0.7152 * c(o) + 0.0722 * c(h);
|
|
3224
3224
|
}(t) > 0.5 ? "light" : "dark"), { mode: i, background: t, textColor: i === "light" ? "#1A1A1A" : "#F8F8F8", subtleColor: i === "light" ? "#4A4A4A" : "#C0C0C0" };
|
|
3225
3225
|
}
|
|
3226
|
-
function
|
|
3226
|
+
function Ot(n) {
|
|
3227
3227
|
return n.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
|
|
3228
3228
|
}
|
|
3229
|
-
function
|
|
3229
|
+
function Gt(n, t) {
|
|
3230
3230
|
return n.length ? n.map((e) => t.color(e)) : [t.color("#FFFFFF")];
|
|
3231
3231
|
}
|
|
3232
|
-
const
|
|
3232
|
+
const Ge = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: o, phases: h, transitionOpacity: c, isError: l, errorMessage: u }) => {
|
|
3233
3233
|
const f = "|/-\\", A = Math.floor(i / 6) % 4, g = n.color(o.textColor), p = Math.floor(255 * c), d = n.color(g.r, g.g, g.b, p);
|
|
3234
3234
|
if (n.charColor(d), n.cellColor(0, 0, 0, 0), l) {
|
|
3235
3235
|
const v = n.color(o.mode === "light" ? "#D32F2F" : "#FF6B6B", p);
|
|
@@ -3238,17 +3238,17 @@ const Ye = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
|
|
|
3238
3238
|
n.push(), n.translate(E, 0, 0);
|
|
3239
3239
|
for (const y of m) n.char(y), n.rect(1, 1), n.translateX(1);
|
|
3240
3240
|
if (n.pop(), u) {
|
|
3241
|
-
const y = n.color(o.subtleColor),
|
|
3242
|
-
n.charColor(
|
|
3243
|
-
const w = Math.floor(0.8 * t.cols), x = u.split(" "),
|
|
3244
|
-
let
|
|
3245
|
-
for (const
|
|
3246
|
-
|
|
3247
|
-
const
|
|
3248
|
-
|
|
3249
|
-
const
|
|
3250
|
-
n.push(), n.translate(
|
|
3251
|
-
for (const
|
|
3241
|
+
const y = n.color(o.subtleColor), T = n.color(y.r, y.g, y.b, p);
|
|
3242
|
+
n.charColor(T);
|
|
3243
|
+
const w = Math.floor(0.8 * t.cols), x = u.split(" "), M = [];
|
|
3244
|
+
let F = "";
|
|
3245
|
+
for (const D of x) (F + " " + D).length <= w ? F = F ? F + " " + D : D : (F && M.push(F), F = D);
|
|
3246
|
+
F && M.push(F);
|
|
3247
|
+
const S = M.slice(0, 3);
|
|
3248
|
+
M.length > 3 && (S[2] = S[2].substring(0, w - 3) + "..."), S.forEach((D, k) => {
|
|
3249
|
+
const _t = -Math.floor(D.length / 2);
|
|
3250
|
+
n.push(), n.translate(_t, 3 + k, 0);
|
|
3251
|
+
for (const Wt of D) n.char(Wt), n.rect(1, 1), n.translateX(1);
|
|
3252
3252
|
n.pop();
|
|
3253
3253
|
});
|
|
3254
3254
|
}
|
|
@@ -3257,9 +3257,9 @@ const Ye = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
|
|
|
3257
3257
|
if (n.push(), n.translate(0, 0, 0), n.char(f[A]), n.rect(1, 1), n.pop(), e > 0 || h.some((v) => v.status !== "pending")) {
|
|
3258
3258
|
const v = Math.max(6, Math.floor(0.6 * t.cols)), m = -Math.floor(v / 2), E = Math.floor(v * e), y = r.length ? r : [n.color("#FFFFFF")];
|
|
3259
3259
|
n.push(), n.translate(m, 3, 0);
|
|
3260
|
-
for (let
|
|
3261
|
-
const w =
|
|
3262
|
-
n.charColor(
|
|
3260
|
+
for (let T = 0; T < v; T++) {
|
|
3261
|
+
const w = T < E ? "*" : ".", x = y[T % y.length], M = n.color(x.r, x.g, x.b, p);
|
|
3262
|
+
n.charColor(M), n.char(w), n.rect(1, 1), n.translateX(1);
|
|
3263
3263
|
}
|
|
3264
3264
|
n.pop();
|
|
3265
3265
|
}
|
|
@@ -3271,19 +3271,19 @@ const Ye = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s,
|
|
|
3271
3271
|
for (const y of s.toUpperCase()) n.char(y), n.rect(1, 1), n.translateX(1);
|
|
3272
3272
|
n.pop();
|
|
3273
3273
|
}
|
|
3274
|
-
},
|
|
3275
|
-
class
|
|
3274
|
+
}, He = { message: "loading...", tone: "auto", transition: "fade", transitionDuration: 500 };
|
|
3275
|
+
class _e {
|
|
3276
3276
|
constructor(t, e, i) {
|
|
3277
|
-
this.
|
|
3277
|
+
this.fc = t, this.id = e, this.label = i;
|
|
3278
3278
|
}
|
|
3279
3279
|
report(t) {
|
|
3280
|
-
this.
|
|
3280
|
+
this.fc.Ba(this.id, t);
|
|
3281
3281
|
}
|
|
3282
3282
|
complete() {
|
|
3283
|
-
this.
|
|
3283
|
+
this.fc.Ga(this.id);
|
|
3284
3284
|
}
|
|
3285
3285
|
fail(t) {
|
|
3286
|
-
this.
|
|
3286
|
+
this.fc.Na(this.id);
|
|
3287
3287
|
}
|
|
3288
3288
|
async track(t) {
|
|
3289
3289
|
try {
|
|
@@ -3294,106 +3294,106 @@ class Oe {
|
|
|
3294
3294
|
}
|
|
3295
3295
|
}
|
|
3296
3296
|
}
|
|
3297
|
-
class
|
|
3297
|
+
class Ht {
|
|
3298
3298
|
constructor(t, e, i) {
|
|
3299
|
-
a(this, "
|
|
3299
|
+
a(this, "ga");
|
|
3300
3300
|
a(this, "l");
|
|
3301
|
-
a(this, "
|
|
3301
|
+
a(this, "dc");
|
|
3302
|
+
a(this, "fc");
|
|
3303
|
+
a(this, "gc");
|
|
3304
|
+
a(this, "vc");
|
|
3305
|
+
a(this, "mc");
|
|
3306
|
+
a(this, "_c");
|
|
3302
3307
|
a(this, "yc");
|
|
3303
|
-
a(this, "
|
|
3304
|
-
a(this, "Cc");
|
|
3305
|
-
a(this, "Mc");
|
|
3306
|
-
a(this, "xc");
|
|
3307
|
-
a(this, "Fc");
|
|
3308
|
-
a(this, "$c");
|
|
3308
|
+
a(this, "wc");
|
|
3309
3309
|
a(this, "W");
|
|
3310
|
-
a(this, "
|
|
3311
|
-
a(this, "
|
|
3312
|
-
a(this, "
|
|
3313
|
-
a(this, "
|
|
3314
|
-
a(this, "
|
|
3315
|
-
a(this, "
|
|
3316
|
-
a(this, "
|
|
3317
|
-
this.
|
|
3318
|
-
const s =
|
|
3319
|
-
this.
|
|
3320
|
-
r >= 0.999 && this.
|
|
3310
|
+
a(this, "bc", []);
|
|
3311
|
+
a(this, "Cc");
|
|
3312
|
+
a(this, "xc", performance.now());
|
|
3313
|
+
a(this, "Mc", 0);
|
|
3314
|
+
a(this, "Fc", !1);
|
|
3315
|
+
a(this, "$c", !1);
|
|
3316
|
+
a(this, "Rc");
|
|
3317
|
+
this.ga = t, this.l = { ...He, ...e ?? {} }, this.dc = new Nt("active"), this.fc = new Lt(), this.gc = new It(this.l.transition, this.l.transitionDuration), this.vc = new Mt(60), this.Cc = dt(this.l, i);
|
|
3318
|
+
const s = Ot(this.Cc);
|
|
3319
|
+
this.bc = Gt(s, this.ga), this.W = this.Tc(), this.fc.Da((r) => {
|
|
3320
|
+
r >= 0.999 && this.tc();
|
|
3321
3321
|
});
|
|
3322
3322
|
}
|
|
3323
|
-
async
|
|
3324
|
-
if (this
|
|
3325
|
-
const e = this.
|
|
3326
|
-
this.
|
|
3327
|
-
const s = this.
|
|
3328
|
-
this.
|
|
3323
|
+
async gr(t) {
|
|
3324
|
+
if (this.$c) return;
|
|
3325
|
+
const e = this.ga.W, i = this.ga.Fr;
|
|
3326
|
+
this.mc = new At(e, 16), await this.mc.gr(t);
|
|
3327
|
+
const s = this.mc.maxGlyphDimensions;
|
|
3328
|
+
this._c = new Pt(i.canvas, s.width, s.height), this.yc = e.yi(this._c.cols, this._c.rows, 3), this.wc = e.yi(this._c.width, this._c.height, 1), this.$c = !0;
|
|
3329
3329
|
}
|
|
3330
|
-
get
|
|
3331
|
-
return this.
|
|
3330
|
+
get Va() {
|
|
3331
|
+
return this.dc.Va && this.Fc;
|
|
3332
3332
|
}
|
|
3333
|
-
|
|
3334
|
-
this.
|
|
3333
|
+
Pn() {
|
|
3334
|
+
this.Fc || (this.Fc = !0, this.xc = performance.now(), this.Mc = 0, this.vc.Pn(() => this.Pc()));
|
|
3335
3335
|
}
|
|
3336
|
-
|
|
3337
|
-
this.
|
|
3336
|
+
En() {
|
|
3337
|
+
this.Fc && (this.Fc = !1, this.vc.En());
|
|
3338
3338
|
}
|
|
3339
|
-
|
|
3340
|
-
this
|
|
3339
|
+
Dr() {
|
|
3340
|
+
this.$c && (this._c.js(), this.yc.resize(this._c.cols, this._c.rows), this.wc.resize(this._c.width, this._c.height));
|
|
3341
3341
|
}
|
|
3342
3342
|
D() {
|
|
3343
|
-
this.
|
|
3343
|
+
this.En(), this.$c && (this.mc.D(), this.yc.D(), this.wc.D(), this.$c = !1);
|
|
3344
3344
|
}
|
|
3345
3345
|
get progress() {
|
|
3346
|
-
return this.
|
|
3346
|
+
return this.fc.Oa;
|
|
3347
3347
|
}
|
|
3348
3348
|
message(t) {
|
|
3349
3349
|
return typeof t == "string" && (this.l.message = t), this.l.message;
|
|
3350
3350
|
}
|
|
3351
3351
|
addPhase(t, e = 1) {
|
|
3352
|
-
this.
|
|
3353
|
-
const i = this.
|
|
3354
|
-
return new
|
|
3352
|
+
this.dc.Ja();
|
|
3353
|
+
const i = this.fc.Ha(t, e);
|
|
3354
|
+
return new _e(this.fc, i, t);
|
|
3355
3355
|
}
|
|
3356
|
-
|
|
3357
|
-
this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.
|
|
3356
|
+
tc() {
|
|
3357
|
+
this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.dc.sc(), this.gc.Pn()) : (this.dc.tc(), this.En(), this.Ec());
|
|
3358
3358
|
}
|
|
3359
|
-
|
|
3360
|
-
this.
|
|
3359
|
+
Ec() {
|
|
3360
|
+
this.Rc && this.Rc();
|
|
3361
3361
|
}
|
|
3362
|
-
|
|
3363
|
-
this.
|
|
3362
|
+
Sc(t) {
|
|
3363
|
+
this.Rc = t;
|
|
3364
3364
|
}
|
|
3365
3365
|
error(t) {
|
|
3366
|
-
this.
|
|
3366
|
+
this.dc.rc(t);
|
|
3367
3367
|
}
|
|
3368
|
-
|
|
3369
|
-
if (this.
|
|
3370
|
-
if (this.
|
|
3371
|
-
return this.
|
|
3372
|
-
this.
|
|
3368
|
+
Pc() {
|
|
3369
|
+
if (this.dc.Va) {
|
|
3370
|
+
if (this.Mc++, this.dc.Za === "transitioning" && this.gc.st())
|
|
3371
|
+
return this.dc.ec(), this.Ec(), void this.En();
|
|
3372
|
+
this.kc();
|
|
3373
3373
|
}
|
|
3374
3374
|
}
|
|
3375
|
-
|
|
3376
|
-
if (!this
|
|
3377
|
-
const t = this.
|
|
3378
|
-
r.state.
|
|
3375
|
+
kc() {
|
|
3376
|
+
if (!this.$c) return;
|
|
3377
|
+
const t = this.yc, e = this.mc, i = this._c, s = this.wc, r = this.ga.W, o = this.ga.Fr, h = this.ga.zc, c = this.ga.Ic;
|
|
3378
|
+
r.state.Wt(), t.begin(), this.ga.clear(), this.ga.push();
|
|
3379
3379
|
try {
|
|
3380
|
-
const l = { textmodifier: this.
|
|
3380
|
+
const l = { textmodifier: this.ga, grid: i, progress: this.progress, elapsedMs: performance.now() - this.xc, frameCount: this.Mc, message: this.l.message, palette: this.bc, theme: this.Cc, phases: this.fc.Xa(), transitionOpacity: this.gc.lc, isError: this.dc.Za === "error", errorMessage: this.dc.qa || void 0, errorDetails: this.dc.Qa || void 0 };
|
|
3381
3381
|
this.W(l);
|
|
3382
3382
|
} finally {
|
|
3383
|
-
this.
|
|
3383
|
+
this.ga.pop();
|
|
3384
3384
|
}
|
|
3385
|
-
t.end(), s.begin(), r.
|
|
3385
|
+
t.end(), s.begin(), r.oi(h), h.I({ u_characterTexture: e.fontFramebuffer, u_charsetDimensions: [e.textureColumns, e.textureRows], U0: t.textures[0], U1: t.textures[1], U2: t.textures[2], U3: [i.cols, i.rows], U4: [s.width, s.height], U5: r.state.canvasBackgroundColor }), r.fi(0, 0, o.width, o.height), s.end(), r.ge(...r.state.canvasBackgroundColor), r.oi(c), c.I({ U6: s.textures[0], U7: [s.width, s.height], U8: [i.offsetX, i.offsetY], U9: [i.width, i.height] }), r.fi(i.offsetX, i.offsetY, i.width, i.height);
|
|
3386
3386
|
}
|
|
3387
|
-
|
|
3388
|
-
this.
|
|
3387
|
+
Lc(t) {
|
|
3388
|
+
this.Cc = dt(this.l, t);
|
|
3389
3389
|
}
|
|
3390
|
-
|
|
3391
|
-
const t = this.l.renderer ||
|
|
3390
|
+
Tc() {
|
|
3391
|
+
const t = this.l.renderer || Ge;
|
|
3392
3392
|
return (e) => {
|
|
3393
|
-
t(e), this.
|
|
3393
|
+
t(e), this.Oc(e);
|
|
3394
3394
|
};
|
|
3395
3395
|
}
|
|
3396
|
-
|
|
3396
|
+
Oc(t) {
|
|
3397
3397
|
const { textmodifier: e, grid: i, frameCount: s, theme: r, transitionOpacity: o } = t, h = [116, 101, 120, 116, 109, 111, 100, 101, 46, 106, 115].map((f) => String.fromCharCode(f)).join(""), c = (i.rows + 1 >> 1) - 2, l = 2 - (i.cols + 1 >> 1), u = r.mode === "light" ? [[233, 30, 99], [156, 39, 176], [255, 111, 0]] : [[142, 249, 243], [241, 91, 181], [255, 155, 113]];
|
|
3398
3398
|
e.push(), e.translate(l, c, 0);
|
|
3399
3399
|
for (let f = 0; f < h.length; f++) {
|
|
@@ -3403,163 +3403,163 @@ class Wt {
|
|
|
3403
3403
|
e.pop();
|
|
3404
3404
|
}
|
|
3405
3405
|
}
|
|
3406
|
-
class
|
|
3406
|
+
class We extends function(e, ...i) {
|
|
3407
3407
|
return i.reduce((s, r) => r(s), e);
|
|
3408
3408
|
}(class {
|
|
3409
|
-
},
|
|
3409
|
+
}, Be, Se, Ue, Le, Ne, Ie) {
|
|
3410
3410
|
constructor(e = {}) {
|
|
3411
3411
|
super();
|
|
3412
3412
|
a(this, "W");
|
|
3413
|
-
a(this, "
|
|
3414
|
-
a(this, "
|
|
3415
|
-
a(this, "
|
|
3416
|
-
a(this, "
|
|
3417
|
-
a(this, "
|
|
3418
|
-
a(this, "
|
|
3419
|
-
a(this, "
|
|
3420
|
-
a(this, "
|
|
3421
|
-
a(this, "
|
|
3422
|
-
a(this, "
|
|
3423
|
-
a(this, "
|
|
3424
|
-
a(this, "
|
|
3425
|
-
a(this, "
|
|
3426
|
-
a(this, "
|
|
3427
|
-
a(this, "
|
|
3428
|
-
a(this, "
|
|
3429
|
-
a(this, "
|
|
3430
|
-
a(this, "
|
|
3413
|
+
a(this, "tr");
|
|
3414
|
+
a(this, "Fr");
|
|
3415
|
+
a(this, "Dn");
|
|
3416
|
+
a(this, "fa");
|
|
3417
|
+
a(this, "Do");
|
|
3418
|
+
a(this, "la");
|
|
3419
|
+
a(this, "pa");
|
|
3420
|
+
a(this, "Dc");
|
|
3421
|
+
a(this, "ca");
|
|
3422
|
+
a(this, "zc");
|
|
3423
|
+
a(this, "Pa");
|
|
3424
|
+
a(this, "Ic");
|
|
3425
|
+
a(this, "Hc");
|
|
3426
|
+
a(this, "Bc", !1);
|
|
3427
|
+
a(this, "Gc", !1);
|
|
3428
|
+
a(this, "Nc", !1);
|
|
3429
|
+
a(this, "Xc", !1);
|
|
3430
|
+
a(this, "Yc", () => {
|
|
3431
3431
|
});
|
|
3432
|
-
a(this, "
|
|
3432
|
+
a(this, "Kc", () => {
|
|
3433
3433
|
});
|
|
3434
|
-
a(this, "
|
|
3434
|
+
a(this, "Wc", () => {
|
|
3435
3435
|
});
|
|
3436
|
-
a(this, "
|
|
3437
|
-
a(this, "
|
|
3438
|
-
a(this, "
|
|
3439
|
-
a(this, "
|
|
3440
|
-
a(this, "
|
|
3441
|
-
this.
|
|
3442
|
-
this.
|
|
3443
|
-
}), this.
|
|
3444
|
-
precision highp float;uniform sampler2D
|
|
3445
|
-
}
|
|
3446
|
-
async
|
|
3447
|
-
await Promise.all([this.
|
|
3448
|
-
const i = this.
|
|
3449
|
-
this.
|
|
3450
|
-
precision highp float;uniform sampler2D
|
|
3436
|
+
a(this, "Zc");
|
|
3437
|
+
a(this, "jc");
|
|
3438
|
+
a(this, "Rr", !1);
|
|
3439
|
+
a(this, "Vc");
|
|
3440
|
+
a(this, "qc", /* @__PURE__ */ new Set());
|
|
3441
|
+
this.Hc = new Oe(this), this.Rr = e.overlay ?? !1, this.Fr = new Fe(e), this.W = new ae(this.Fr.Hr()), this.tr = new At(this.W, e.fontSize ?? 16), this.fa = new Mt(e.frameRate ?? 60), this.Dc = new Ht(this, e.loadingScreen, this.Fr.Or()), this.Dc.Sc(() => {
|
|
3442
|
+
this.fa.Ln = 0, this.Xc = !0;
|
|
3443
|
+
}), this.Do = new Bt(this.Fr), this.la = new Ut(this.Fr, this.Do), this.pa = new St(), this.zc = this.W.hi(Tt, `#version 300 es
|
|
3444
|
+
precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D U1;uniform sampler2D U2;uniform sampler2D U0;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(U1,H);vec4 J=texture(U2,H);vec4 K=texture(U0,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.Dc.Pn(), this.Qc(e);
|
|
3445
|
+
}
|
|
3446
|
+
async Qc(e) {
|
|
3447
|
+
await Promise.all([this.tr.gr(e.fontSource), this.Dc.gr(e.fontSource)]);
|
|
3448
|
+
const i = this.tr.maxGlyphDimensions;
|
|
3449
|
+
this.Dn = new Pt(this.Fr.canvas, i.width, i.height), this.Do.gr(this.Dn), this.la.gr(this.Dn), this.ca = this.W.yi(this.Dn.cols, this.Dn.rows, 3), this.Pa = this.W.yi(this.Dn.width, this.Dn.height, 1), this.Rr && (this.Vc = W.An(this.W, this.tr, this.Fr.targetCanvas, this.Dn.cols, this.Dn.rows, (s) => this.tr.Ji(s)), this.aa(this.Vc)), this.Ic = this.W.hi(Tt, `#version 300 es
|
|
3450
|
+
precision highp float;uniform sampler2D U6;uniform vec2 U7;uniform vec2 U8;uniform vec2 U9;in vec2 v_uv;out vec4 fragColor;void main(){vec2 A=gl_FragCoord.xy-U8;vec2 B=A*(U7/U9);vec2 C=(floor(B)+0.5)/U7;fragColor=texture(U6,C);}`), this.Jc(), this.fa.Pn(() => this.da()), await this.Hc.wa(e.plugins ?? []);
|
|
3451
3451
|
try {
|
|
3452
|
-
await this.
|
|
3452
|
+
await this.Yc(), this.Dc.tc();
|
|
3453
3453
|
} catch (s) {
|
|
3454
|
-
console.error("Error during setup:", s), this.
|
|
3454
|
+
console.error("Error during setup:", s), this.Dc.error(s);
|
|
3455
3455
|
}
|
|
3456
3456
|
}
|
|
3457
|
-
|
|
3458
|
-
this.
|
|
3459
|
-
this.
|
|
3460
|
-
}, window.addEventListener("resize", this.
|
|
3461
|
-
this.
|
|
3462
|
-
}), this.
|
|
3463
|
-
this.resizeCanvas(this.
|
|
3464
|
-
}), this.
|
|
3457
|
+
Jc() {
|
|
3458
|
+
this.Zc = () => {
|
|
3459
|
+
this.Rr && this.resizeCanvas(this.Fr.targetCanvas.width, this.Fr.targetCanvas.height), this.Wc();
|
|
3460
|
+
}, window.addEventListener("resize", this.Zc), this.Do.ho(), this.la.ho(), this.pa.ho(), window.addEventListener("blur", () => {
|
|
3461
|
+
this.pa.Oo();
|
|
3462
|
+
}), this.Rr && (this.jc = new ResizeObserver(() => {
|
|
3463
|
+
this.resizeCanvas(this.Fr.targetCanvas.width, this.Fr.targetCanvas.height);
|
|
3464
|
+
}), this.jc.observe(this.Fr.targetCanvas));
|
|
3465
3465
|
}
|
|
3466
|
-
|
|
3467
|
-
if (!this.
|
|
3468
|
-
this.
|
|
3466
|
+
da() {
|
|
3467
|
+
if (!this.Dc.Va && this.Xc) {
|
|
3468
|
+
this.Gc = !0;
|
|
3469
3469
|
try {
|
|
3470
|
-
this.
|
|
3470
|
+
this.fa.kn(), this.fa.On(), this.Rr && xt(this.W.context, this.Vc.texture, this.Fr.targetCanvas), this.Hc.Ma(), this.W.state.Wt(), this.ca.begin(), this.Kc(), this.ca.end(), this.Pa.begin(), this.W.oi(this.zc), this.zc.I({ u_characterTexture: this.tr.fontFramebuffer, u_charsetDimensions: [this.tr.textureColumns, this.tr.textureRows], U0: this.ca.textures[0], U1: this.ca.textures[1], U2: this.ca.textures[2], U3: [this.Dn.cols, this.Dn.rows], U4: [this.Pa.width, this.Pa.height], U5: this.W.state.canvasBackgroundColor }), this.W.fi(0, 0, this.Fr.width, this.Fr.height), this.Pa.end(), this.W.ge(...this.W.state.canvasBackgroundColor), this.W.oi(this.Ic), this.Ic.I({ U6: this.Pa.textures[0], U7: [this.Pa.width, this.Pa.height], U8: [this.Dn.offsetX, this.Dn.offsetY], U9: [this.Dn.width, this.Dn.height] }), this.W.fi(this.Dn.offsetX, this.Dn.offsetY, this.Dn.width, this.Dn.height), this.Hc.$a();
|
|
3471
3471
|
} finally {
|
|
3472
|
-
this.
|
|
3472
|
+
this.Gc = !1, this.Bc && !this.Nc && this.tl();
|
|
3473
3473
|
}
|
|
3474
3474
|
}
|
|
3475
3475
|
}
|
|
3476
3476
|
resizeCanvas(e, i) {
|
|
3477
|
-
this.
|
|
3477
|
+
this.Fr.Dr(e, i), this.Dc.Lc(this.Fr.Or()), this.Dn.js(), this.Dc.Dr(), this.ca.resize(this.Dn.cols, this.Dn.rows), this.Pa.resize(this.Dn.width, this.Dn.height), this.W.bi(), this.Do.oo(), this.la.oo(), this.da();
|
|
3478
3478
|
}
|
|
3479
3479
|
destroy() {
|
|
3480
|
-
this.
|
|
3480
|
+
this.Nc || this.Bc || (this.Bc = !0, this.fa.Rn(), this.Gc || this.tl());
|
|
3481
3481
|
}
|
|
3482
|
-
|
|
3482
|
+
tl() {
|
|
3483
3483
|
var e, i;
|
|
3484
|
-
this.
|
|
3484
|
+
this.Bc = !1, this.Dc.D(), this.Hc.Ta(), window.removeEventListener("resize", this.Zc), (e = this.jc) == null || e.disconnect(), this.Do.po(), this.la.po(), this.pa.po(), this.ca.D(), this.zc.D(), this.tr.D(), this.W.D(), this.Pa.D(), this.Ic.D(), (i = this.Vc) == null || i.D(), this.Fr.D(), this.Nc = !0;
|
|
3485
3485
|
}
|
|
3486
3486
|
setup(e) {
|
|
3487
|
-
this.
|
|
3487
|
+
this.Yc = e;
|
|
3488
3488
|
}
|
|
3489
3489
|
draw(e) {
|
|
3490
|
-
this.
|
|
3490
|
+
this.Kc = e;
|
|
3491
3491
|
}
|
|
3492
3492
|
windowResized(e) {
|
|
3493
|
-
this.
|
|
3493
|
+
this.Wc = e;
|
|
3494
3494
|
}
|
|
3495
3495
|
get grid() {
|
|
3496
|
-
return this.
|
|
3496
|
+
return this.Dn;
|
|
3497
3497
|
}
|
|
3498
3498
|
get font() {
|
|
3499
|
-
return this.
|
|
3499
|
+
return this.tr;
|
|
3500
3500
|
}
|
|
3501
3501
|
get width() {
|
|
3502
|
-
return this.
|
|
3502
|
+
return this.Fr.width;
|
|
3503
3503
|
}
|
|
3504
3504
|
get height() {
|
|
3505
|
-
return this.
|
|
3505
|
+
return this.Fr.height;
|
|
3506
3506
|
}
|
|
3507
3507
|
get canvas() {
|
|
3508
|
-
return this.
|
|
3508
|
+
return this.Fr.canvas;
|
|
3509
3509
|
}
|
|
3510
3510
|
get drawFramebuffer() {
|
|
3511
|
-
return this.
|
|
3511
|
+
return this.ca;
|
|
3512
3512
|
}
|
|
3513
3513
|
get isDisposed() {
|
|
3514
|
-
return this.
|
|
3514
|
+
return this.Nc;
|
|
3515
3515
|
}
|
|
3516
3516
|
get overlay() {
|
|
3517
|
-
return this.
|
|
3517
|
+
return this.Vc;
|
|
3518
3518
|
}
|
|
3519
3519
|
get loading() {
|
|
3520
|
-
return this.
|
|
3520
|
+
return this.Dc;
|
|
3521
3521
|
}
|
|
3522
|
-
|
|
3523
|
-
this.
|
|
3522
|
+
aa(e) {
|
|
3523
|
+
this.qc.has(e) || this.qc.add(e);
|
|
3524
3524
|
}
|
|
3525
|
-
|
|
3526
|
-
for (const e of this.
|
|
3525
|
+
ua() {
|
|
3526
|
+
for (const e of this.qc) e.pn(this.tr);
|
|
3527
3527
|
}
|
|
3528
3528
|
}
|
|
3529
3529
|
class vt {
|
|
3530
3530
|
constructor() {
|
|
3531
3531
|
}
|
|
3532
3532
|
static create(t = {}) {
|
|
3533
|
-
return new
|
|
3533
|
+
return new We(t);
|
|
3534
3534
|
}
|
|
3535
3535
|
static setErrorLevel(t) {
|
|
3536
3536
|
Z._(t);
|
|
3537
3537
|
}
|
|
3538
3538
|
static get version() {
|
|
3539
|
-
return "0.6.0-beta.
|
|
3539
|
+
return "0.6.0-beta.5";
|
|
3540
3540
|
}
|
|
3541
3541
|
}
|
|
3542
3542
|
let ct = null;
|
|
3543
|
-
const
|
|
3544
|
-
precision highp float;in vec2 v_uv;uniform sampler2D
|
|
3545
|
-
|
|
3546
|
-
const je = vt.create,
|
|
3543
|
+
const Xe = { id: "brightness", createShader: ({ gl: n }) => (ct || (ct = new j(n, it, `#version 300 es
|
|
3544
|
+
precision highp float;in vec2 v_uv;uniform sampler2D u_image;uniform bool u_invert;uniform bool u_flipX;uniform bool u_flipY;uniform float u_charRotation;uniform bool u_charColorFixed;uniform vec4 u_charColor;uniform bool u_cellColorFixed;uniform vec4 u_cellColor;uniform vec4 u_backgroundColor;uniform int u_charCount;uniform vec3 u_charList[255];uniform bool u_colorFilterEnabled;uniform int u_colorFilterSize;uniform vec4 u_colorFilterPalette[64];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;float A(vec3 B){return dot(B,vec3(0.299f,0.587f,0.114f));}float C(vec3 D,vec3 E){vec3 F=D-E;return dot(F,F);}vec4 G(vec4 H){if(!u_colorFilterEnabled||u_colorFilterSize<=0){return H;}int I=min(u_colorFilterSize,64);vec3 J=u_colorFilterPalette[0].rgb;float K=C(H.rgb,J);for(int L=1;L<64;++L){if(L>=I){break;}vec3 M=u_colorFilterPalette[L].rgb;float N=C(H.rgb,M);if(N<K){K=N;J=M;}}return vec4(J,H.a);}void main(){vec2 O=vec2(v_uv.x,1.0f-v_uv.y);vec4 H=texture(u_image,O);H=G(H);float E=A(H.rgb);vec2 P=vec2(0.);if(u_charCount>0){float Q=float(u_charCount);float R=clamp(E*(Q-1.0f),0.0f,Q-1.0f);int S=int(floor(R+0.5f));vec3 T=u_charList[S];P=T.xy;}else{P=vec2(E,0.0f);}vec4 U=u_charColorFixed?u_charColor:H;vec4 V=u_cellColorFixed?u_cellColor:H;if(H.a<0.01f){U=u_backgroundColor;V=u_backgroundColor;}else{}o_primaryColor=vec4(U.rgb,U.a);o_secondaryColor=vec4(V.rgb,V.a);int W=int(u_invert?1:0);int X=int(u_flipX?1:0);int Y=int(u_flipY?1:0);float Z=float(W|(X<<1)|(Y<<2))/255.;o_character=vec4(P,Z,clamp(u_charRotation,0.0f,1.0f));}`)), ct), createUniforms: ({ source: n }) => n.createBaseConversionUniforms() }, Ke = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhaseTracker: Lt, LoadingScreenManager: Ht, LoadingScreenStateMachine: Nt, LoadingScreenTransition: It, resolveColorInputs: Gt, resolveDefaultPalette: Ot, resolveTheme: dt }, Symbol.toStringTag, { value: "Module" })), Ve = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: At, TextmodeImage: W, TextmodeSource: mt, TextmodeVideo: st }, Symbol.toStringTag, { value: "Module" })), Ze = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: Pe, mouse: De, touch: Me }, Symbol.toStringTag, { value: "Module" }));
|
|
3545
|
+
Re(Xe);
|
|
3546
|
+
const je = vt.create, ke = vt.setErrorLevel, qe = vt.version;
|
|
3547
3547
|
export {
|
|
3548
3548
|
j as Shader,
|
|
3549
|
-
|
|
3549
|
+
Fe as TextmodeCanvas,
|
|
3550
3550
|
C as TextmodeColor,
|
|
3551
|
-
|
|
3551
|
+
zt as TextmodeErrorLevel,
|
|
3552
3552
|
et as TextmodeFramebuffer,
|
|
3553
|
-
|
|
3554
|
-
|
|
3553
|
+
Pt as TextmodeGrid,
|
|
3554
|
+
We as Textmodifier,
|
|
3555
3555
|
je as create,
|
|
3556
3556
|
Ce as getConversionStrategy,
|
|
3557
3557
|
Ze as input,
|
|
3558
|
-
|
|
3558
|
+
Ve as loadables,
|
|
3559
3559
|
Ke as loading,
|
|
3560
|
-
|
|
3561
|
-
|
|
3560
|
+
Re as registerConversionStrategy,
|
|
3561
|
+
ke as setErrorLevel,
|
|
3562
3562
|
vt as textmode,
|
|
3563
|
-
|
|
3564
|
-
|
|
3563
|
+
ze as unregisterConversionStrategy,
|
|
3564
|
+
qe as version
|
|
3565
3565
|
};
|