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