textmode.js 0.7.0 → 0.7.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -60
- package/dist/textmode.esm.js +819 -814
- package/dist/textmode.umd.js +15 -16
- package/dist/types/textmode/layers/Layer2DCompositor.d.ts +19 -7
- package/dist/types/textmode/layers/TextmodeLayer.d.ts +3 -0
- package/dist/types/textmode/layers/interfaces/ITextmodeLayer.d.ts +32 -0
- package/dist/types/textmode/layers/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/textmode.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Qt = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var a = (n, t, e) =>
|
|
2
|
+
var qt = (n, t, e) => t in n ? Qt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var a = (n, t, e) => qt(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
class U extends Error {
|
|
5
5
|
constructor(t, e = {}) {
|
|
6
6
|
super(U.i(t, e)), this.name = "TextmodeError";
|
|
@@ -27,7 +27,7 @@ ${"↓".repeat(24)}
|
|
|
27
27
|
return t + "";
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
var
|
|
30
|
+
var Jt = ((n) => (n[n.SILENT = 0] = "SILENT", n[n.WARNING = 1] = "WARNING", n[n.ERROR = 2] = "ERROR", n[n.THROW = 3] = "THROW", n))(Jt || {});
|
|
31
31
|
const B = class B {
|
|
32
32
|
constructor() {
|
|
33
33
|
a(this, "l", { globalLevel: 3 });
|
|
@@ -57,8 +57,8 @@ const B = class B {
|
|
|
57
57
|
};
|
|
58
58
|
a(B, "o", null);
|
|
59
59
|
let lt = B;
|
|
60
|
-
const
|
|
61
|
-
class
|
|
60
|
+
const vt = lt.u();
|
|
61
|
+
class H {
|
|
62
62
|
constructor(t, e, i) {
|
|
63
63
|
a(this, "A");
|
|
64
64
|
a(this, "C");
|
|
@@ -115,7 +115,7 @@ class W {
|
|
|
115
115
|
const u = this.H(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 j) {
|
|
119
119
|
const u = this.H(t);
|
|
120
120
|
return o.uniform1i(i, u), o.activeTexture(o.TEXTURE0 + u), void o.bindTexture(o.TEXTURE_2D, e.textures[0]);
|
|
121
121
|
}
|
|
@@ -149,13 +149,13 @@ function Et(n, t, e, i) {
|
|
|
149
149
|
function z(n, t, e, i) {
|
|
150
150
|
return Math.hypot(e - n, i - t);
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function Z(n, t, e) {
|
|
153
153
|
return Math.min(Math.max(n, t), e);
|
|
154
154
|
}
|
|
155
155
|
function Tt(n) {
|
|
156
156
|
return (n % 360 + 360) % 360 / 360;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function Rt(n, t, e) {
|
|
159
159
|
n.bindTexture(n.TEXTURE_2D, t), n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, 1), n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, e), n.bindTexture(n.TEXTURE_2D, null);
|
|
160
160
|
}
|
|
161
161
|
function et(n, t, e, i, s) {
|
|
@@ -164,11 +164,11 @@ function et(n, t, e, i, s) {
|
|
|
164
164
|
function ut(n, t, e, i, s, r = 0, h = WebGL2RenderingContext.FLOAT, o = !1) {
|
|
165
165
|
n.enableVertexAttribArray(t), n.vertexAttribPointer(t, e, h, o, i, s), n.vertexAttribDivisor(t, r);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function Ft(n, t, e, i, s) {
|
|
168
168
|
n.bindBuffer(t, e), n.bufferData(t, i, s), n.bindBuffer(t, null);
|
|
169
169
|
}
|
|
170
170
|
const it = `#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
|
|
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 Us;uniform float Ut;uniform float Uu;out vec2 v_uv;out vec3 v_glyphIndex;out vec4 v_glyphColor;out vec4 v_cellColor;out vec4 v_glyphFlags;out vec3 v_worldPosition;out vec3 v_normal;out float v_geometryType;const float A=6.28318530718f;const int B=2;const int C=3;const int D=4;vec2 E(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float M=L*K;float N=F*F;float O=N*F;return M*G+3.0f*L*F*H+3.0f*K*N*I+O*J;}vec2 P(float F,vec2 G,vec2 H,vec2 I,vec2 J){float K=1.0f-F;float L=K*K;float N=F*F;return-3.0f*L*G+3.0f*(L-2.0f*K*F)*H+3.0f*(2.0f*K*F-N)*I+3.0f*N*J;}vec3 Q(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x,R.y*T-R.z*U,R.y*U+R.z*T);}vec3 V(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T+R.z*U,R.y,-R.x*U+R.z*T);}vec3 W(vec3 R,float S){float T=cos(S);float U=sin(S);return vec3(R.x*T-R.y*U,R.x*U+R.y*T,R.z);}vec3 X(vec3 R,vec3 Y){vec3 Z=R;if(Y.z!=0.0f){Z=W(Z,Y.z);}if(Y.y!=0.0f){Z=V(Z,Y.y);}if(Y.x!=0.0f){Z=Q(Z,Y.x);}return Z;}void main(){v_uv=A1;v_glyphIndex=A4;v_glyphColor=A5;v_cellColor=A6;v_glyphFlags=A7;vec4 a=Aa;vec4 b=Ab;vec2 c=A3;vec2 d=A2;float e=Ac.x;float f=Ac.y;int g=int(Ac.z);vec2 h=d;vec2 i=h+c*0.5f;float j=f+e*0.5f;vec3 k=vec3(i,j);vec3 l;if(g==D){float F=clamp(A0.x,0.0f,1.0f);vec2 G=b.xy;vec2 H=a.xy;vec2 I=a.zw;vec2 J=b.zw;vec2 m=E(F,G,H,I,J);vec2 n=P(F,G,H,I,J);float o=length(n);vec2 p=o>0.0f?n/o:vec2(1.0f,0.0f);vec2 q=vec2(-p.y,p.x);vec2 r=m;vec2 s=r+q*A0.y*c.y;l=vec3(s,f);}else if(g==C){float t=mod(a.x,A);if(t<0.0f){t+=A;}float u=mod(a.y,A);if(u<0.0f){u+=A;}float v=t-u;if(v<=0.0f){v+=A;}float S=t-A0.x*v;vec2 w=vec2(cos(S),sin(S))*A0.y;vec2 s=w*c+h;l=vec3(s,f);}else if(g==B){vec2 s=A0.xy*c+h;l=vec3(s,f);}vec3 x=X(l,A9);vec3 y=x+A8;vec3 z=vec3(0.0f,0.0f,1.0f);v_worldPosition=y;v_normal=z;v_geometryType=float(g);vec2 AA=(y.xy/Us)*2.0f;AA.y=-AA.y;float AB=y.z/Us.y;float AC=clamp(-AB*Ut,-0.99f,0.99f);if(Uu>0.5f){gl_Position=vec4(AA,AC,1.0f);}else{float AD=0.5f;float AE=1.0f/(1.0f-AB*AD);AA*=AE;gl_Position=vec4(AA,AC,1.0f);}}`, O = class O {
|
|
172
172
|
constructor(t, e, i = e, s = 1, r = {}, h) {
|
|
173
173
|
a(this, "N");
|
|
174
174
|
a(this, "X");
|
|
@@ -176,19 +176,19 @@ in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in
|
|
|
176
176
|
a(this, "A");
|
|
177
177
|
a(this, "Y");
|
|
178
178
|
a(this, "j", []);
|
|
179
|
-
a(this, "
|
|
180
|
-
a(this, "
|
|
179
|
+
a(this, "W", null);
|
|
180
|
+
a(this, "K");
|
|
181
181
|
a(this, "Z");
|
|
182
182
|
a(this, "q", null);
|
|
183
183
|
a(this, "V", /* @__PURE__ */ new Map());
|
|
184
|
-
this.N = e, this.X = i, this.A = t, this.
|
|
185
|
-
precision highp float;in vec2 v_uv;uniform sampler2D
|
|
184
|
+
this.N = e, this.X = i, this.A = t, this.K = Z(s, 1, 8), this.Z = h, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...r }, O.J || (O.J = new H(t, it, `#version 300 es
|
|
185
|
+
precision highp float;in vec2 v_uv;uniform sampler2D U5;uniform sampler2D U6;uniform sampler2D U7;uniform sampler2D U8;uniform vec2 U9;uniform bool Ua;uniform bool Ub;uniform bool Uc;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*U9;vec2 D=(floor(C)+0.5f)/U9;vec4 E=texture(U5,D);vec4 F=Ua?texture(U6,D):vec4(0.);if(Ua&&F.a==0.){discard;}vec4 G=Ub?texture(U7,D):vec4(0.);vec4 H=Uc?texture(U8,D):vec4(0.);o_character=E;o_primaryColor=F;o_secondaryColor=G;A=H;}`));
|
|
186
186
|
const o = t.getParameter(t.MAX_DRAW_BUFFERS), c = t.getParameter(t.MAX_COLOR_ATTACHMENTS);
|
|
187
|
-
this.
|
|
187
|
+
this.K = Math.min(this.K, o, c), this.Y = t.createFramebuffer(), this.tt(), this.st(), this.l.depth && this.it();
|
|
188
188
|
}
|
|
189
189
|
tt() {
|
|
190
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, h = t.RGBA;
|
|
191
|
-
for (let o = 0; o < this.
|
|
191
|
+
for (let o = 0; o < this.K; o++) {
|
|
192
192
|
const c = t.createTexture();
|
|
193
193
|
t.bindTexture(t.TEXTURE_2D, c), et(t, e, e, i, i), t.texImage2D(t.TEXTURE_2D, 0, r, this.N, this.X, 0, h, s, null), this.j.push(c);
|
|
194
194
|
}
|
|
@@ -196,10 +196,10 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uc;uniform sampler2D Ud;uni
|
|
|
196
196
|
}
|
|
197
197
|
st() {
|
|
198
198
|
const t = this.A;
|
|
199
|
-
if (t.bindFramebuffer(t.FRAMEBUFFER, this.Y), this.
|
|
199
|
+
if (t.bindFramebuffer(t.FRAMEBUFFER, this.Y), this.K === 1) t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, this.j[0], 0);
|
|
200
200
|
else {
|
|
201
201
|
const e = [];
|
|
202
|
-
for (let i = 0; i < this.
|
|
202
|
+
for (let i = 0; i < this.K; i++) {
|
|
203
203
|
const s = t.COLOR_ATTACHMENT0 + i;
|
|
204
204
|
t.framebufferTexture2D(t.FRAMEBUFFER, s, t.TEXTURE_2D, this.j[i], 0), e.push(s);
|
|
205
205
|
}
|
|
@@ -209,16 +209,16 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uc;uniform sampler2D Ud;uni
|
|
|
209
209
|
}
|
|
210
210
|
it() {
|
|
211
211
|
const t = this.A;
|
|
212
|
-
this.
|
|
212
|
+
this.W = t.createRenderbuffer(), t.bindRenderbuffer(t.RENDERBUFFER, this.W), t.renderbufferStorage(t.RENDERBUFFER, t.DEPTH_COMPONENT24, this.N, this.X), t.bindFramebuffer(t.FRAMEBUFFER, this.Y), t.framebufferRenderbuffer(t.FRAMEBUFFER, t.DEPTH_ATTACHMENT, t.RENDERBUFFER, this.W), t.bindFramebuffer(t.FRAMEBUFFER, null), t.bindRenderbuffer(t.RENDERBUFFER, null);
|
|
213
213
|
}
|
|
214
214
|
et(t) {
|
|
215
|
-
|
|
215
|
+
Rt(this.A, this.j[0], t);
|
|
216
216
|
}
|
|
217
217
|
resize(t, e) {
|
|
218
218
|
this.N = t, this.X = e, this.V.clear();
|
|
219
219
|
const i = this.A, s = this.l.type === "float" ? i.FLOAT : i.UNSIGNED_BYTE, r = s === i.FLOAT ? i.RGBA32F : i.RGBA8, h = i.RGBA;
|
|
220
220
|
for (const o of this.j) i.bindTexture(i.TEXTURE_2D, o), i.texImage2D(i.TEXTURE_2D, 0, r, this.N, this.X, 0, h, s, null);
|
|
221
|
-
i.bindTexture(i.TEXTURE_2D, null), this.
|
|
221
|
+
i.bindTexture(i.TEXTURE_2D, null), this.W && (i.bindRenderbuffer(i.RENDERBUFFER, this.W), i.renderbufferStorage(i.RENDERBUFFER, i.DEPTH_COMPONENT24, this.N, this.X), i.bindRenderbuffer(i.RENDERBUFFER, null));
|
|
222
222
|
}
|
|
223
223
|
readPixels(t) {
|
|
224
224
|
const e = this.V.get(t);
|
|
@@ -227,14 +227,14 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uc;uniform sampler2D Ud;uni
|
|
|
227
227
|
i.bindFramebuffer(i.READ_FRAMEBUFFER, this.Y), i.readBuffer(i.COLOR_ATTACHMENT0 + t), i.readPixels(0, 0, s, r, i.RGBA, i.UNSIGNED_BYTE, h), i.bindFramebuffer(i.READ_FRAMEBUFFER, o);
|
|
228
228
|
const c = 4 * s, l = new Uint8Array(h.length);
|
|
229
229
|
for (let u = 0; u < r; u++) {
|
|
230
|
-
const f = (r - 1 - u) * c,
|
|
231
|
-
l.set(h.subarray(f, f + c),
|
|
230
|
+
const f = (r - 1 - u) * c, d = u * c;
|
|
231
|
+
l.set(h.subarray(f, f + c), d);
|
|
232
232
|
}
|
|
233
233
|
return this.V.set(t, l), l;
|
|
234
234
|
}
|
|
235
235
|
begin() {
|
|
236
236
|
const t = this.A;
|
|
237
|
-
this.V.clear(), this.Z.rt(), this.Z.nt(this.Y, this.N, this.X, this.
|
|
237
|
+
this.V.clear(), this.Z.rt(), this.Z.nt(this.Y, this.N, this.X, this.K), this.l.depth && t.clear(t.DEPTH_BUFFER_BIT), this.Z.state.ht();
|
|
238
238
|
}
|
|
239
239
|
end() {
|
|
240
240
|
this.Z.state.ot(), this.Z.ct(), this.Z.lt();
|
|
@@ -244,14 +244,14 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uc;uniform sampler2D Ud;uni
|
|
|
244
244
|
}
|
|
245
245
|
ft() {
|
|
246
246
|
if (!this.Z) return;
|
|
247
|
-
const t = this.
|
|
247
|
+
const t = this.K > 1, e = this.K > 2, i = this.K > 3, s = { U5: this.j[0], U6: t ? this.j[1] : this.j[0], U7: e ? this.j[2] : this.j[0], U8: i ? this.j[3] : this.j[0], U9: [this.N, this.X], Ua: t, Ub: e, Uc: i }, r = O.J;
|
|
248
248
|
this.q = this.Z.vt.dt(r, s, !0);
|
|
249
249
|
}
|
|
250
250
|
gt() {
|
|
251
251
|
const t = this.A;
|
|
252
252
|
t.deleteFramebuffer(this.Y);
|
|
253
253
|
for (const e of this.j) t.deleteTexture(e);
|
|
254
|
-
this.
|
|
254
|
+
this.W && t.deleteRenderbuffer(this.W);
|
|
255
255
|
}
|
|
256
256
|
get width() {
|
|
257
257
|
return this.N;
|
|
@@ -263,17 +263,17 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uc;uniform sampler2D Ud;uni
|
|
|
263
263
|
return this.j;
|
|
264
264
|
}
|
|
265
265
|
get attachmentCount() {
|
|
266
|
-
return this.
|
|
266
|
+
return this.K;
|
|
267
267
|
}
|
|
268
268
|
};
|
|
269
|
-
a(
|
|
270
|
-
let
|
|
271
|
-
const
|
|
269
|
+
a(O, "J", null);
|
|
270
|
+
let j = O;
|
|
271
|
+
const Ct = /* @__PURE__ */ new WeakMap();
|
|
272
272
|
function nt(n, t) {
|
|
273
|
-
|
|
273
|
+
Ct.set(n, t);
|
|
274
274
|
}
|
|
275
275
|
function Pt(n) {
|
|
276
|
-
return
|
|
276
|
+
return Ct.get(n);
|
|
277
277
|
}
|
|
278
278
|
function tt(n, t, e, i, s = 255) {
|
|
279
279
|
n[0] = t / 255, n[1] = (e ?? t) / 255, n[2] = (i ?? t) / 255, n[3] = s / 255;
|
|
@@ -283,8 +283,8 @@ class st {
|
|
|
283
283
|
a(this, "_t", 1);
|
|
284
284
|
a(this, "yt", 0);
|
|
285
285
|
a(this, "At", 0);
|
|
286
|
-
a(this, "wt", 0);
|
|
287
286
|
a(this, "bt", 0);
|
|
287
|
+
a(this, "wt", 0);
|
|
288
288
|
a(this, "Ct", 0);
|
|
289
289
|
a(this, "xt", 0);
|
|
290
290
|
a(this, "Mt", [0, 0, 0]);
|
|
@@ -300,13 +300,13 @@ class st {
|
|
|
300
300
|
a(this, "Dt", []);
|
|
301
301
|
}
|
|
302
302
|
static Lt() {
|
|
303
|
-
return { Ot: 1, It: 0, Bt: 0, Ht: 0,
|
|
303
|
+
return { Ot: 1, It: 0, Bt: 0, Ht: 0, wt: 0, Ct: 0, xt: 0, Et: 0, Gt: !1, Qt: !1, Rt: !1, kt: !1, Nt: [0, 0, 0], Xt: [1, 1, 1, 1], Yt: [0, 0, 0, 1] };
|
|
304
304
|
}
|
|
305
305
|
jt(t) {
|
|
306
|
-
t.Ot = this._t, t.It = this.yt, t.Bt = this.At, t.Ht = this.
|
|
306
|
+
t.Ot = this._t, t.It = this.yt, t.Bt = this.At, t.Ht = this.bt, t.wt = this.wt, t.Ct = this.Ct, t.xt = this.xt, t.Gt = this.$t, t.Qt = this.Tt, t.Rt = this.Rt, t.Et = this.Et, t.kt = this.kt, t.Nt[0] = this.Mt[0], t.Nt[1] = this.Mt[1], t.Nt[2] = this.Mt[2], t.Xt[0] = this.Ft[0], t.Xt[1] = this.Ft[1], t.Xt[2] = this.Ft[2], t.Xt[3] = this.Ft[3], t.Yt[0] = this.Pt[0], t.Yt[1] = this.Pt[1], t.Yt[2] = this.Pt[2], t.Yt[3] = this.Pt[3];
|
|
307
307
|
}
|
|
308
|
-
|
|
309
|
-
this._t = t.Ot, this.yt = t.It, this.At = t.Bt, this.
|
|
308
|
+
Wt(t) {
|
|
309
|
+
this._t = t.Ot, this.yt = t.It, this.At = t.Bt, this.bt = t.Ht, this.wt = t.wt, this.Ct = t.Ct, this.xt = t.xt, this.$t = t.Gt, this.Tt = t.Qt, this.Rt = t.Rt, this.Et = t.Et, this.kt = t.kt, this.Mt[0] = t.Nt[0], this.Mt[1] = t.Nt[1], this.Mt[2] = t.Nt[2], this.Ft[0] = t.Xt[0], this.Ft[1] = t.Xt[1], this.Ft[2] = t.Xt[2], this.Ft[3] = t.Xt[3], this.Pt[0] = t.Yt[0], this.Pt[1] = t.Yt[1], this.Pt[2] = t.Yt[2], this.Pt[3] = t.Yt[3];
|
|
310
310
|
}
|
|
311
311
|
ht() {
|
|
312
312
|
let t = this.Dt.pop();
|
|
@@ -314,19 +314,19 @@ class st {
|
|
|
314
314
|
}
|
|
315
315
|
ot() {
|
|
316
316
|
const t = this.zt.pop();
|
|
317
|
-
t ? (this.
|
|
317
|
+
t ? (this.Wt(t), this.Dt.push(t)) : console.warn("pop() called without matching push()");
|
|
318
318
|
}
|
|
319
|
-
|
|
319
|
+
Kt(t) {
|
|
320
320
|
this.jt(t);
|
|
321
321
|
}
|
|
322
322
|
Zt(t) {
|
|
323
323
|
this._t = Math.abs(t);
|
|
324
324
|
}
|
|
325
325
|
qt() {
|
|
326
|
-
this.yt = 0, this.At = 0, this.
|
|
326
|
+
this.yt = 0, this.At = 0, this.bt = 0, this.wt = 0, this.Ct = 0, this.xt = 0, this.kt = !1;
|
|
327
327
|
}
|
|
328
328
|
Vt(t) {
|
|
329
|
-
t !== 0 && (this.
|
|
329
|
+
t !== 0 && (this.wt += t * Math.PI / 180);
|
|
330
330
|
}
|
|
331
331
|
Jt(t) {
|
|
332
332
|
t !== 0 && (this.Ct += t * Math.PI / 180);
|
|
@@ -335,7 +335,7 @@ class st {
|
|
|
335
335
|
t !== 0 && (this.xt += t * Math.PI / 180);
|
|
336
336
|
}
|
|
337
337
|
ss(t = 0, e = 0, i = 0) {
|
|
338
|
-
t === 0 && e === 0 && i === 0 || (this.yt += t, this.At += e, this.
|
|
338
|
+
t === 0 && e === 0 && i === 0 || (this.yt += t, this.At += e, this.bt += i);
|
|
339
339
|
}
|
|
340
340
|
es(t) {
|
|
341
341
|
this.ss(t, 0, 0);
|
|
@@ -380,7 +380,7 @@ class st {
|
|
|
380
380
|
return this.kt;
|
|
381
381
|
}
|
|
382
382
|
get rotationX() {
|
|
383
|
-
return this.
|
|
383
|
+
return this.wt;
|
|
384
384
|
}
|
|
385
385
|
get rotationY() {
|
|
386
386
|
return this.Ct;
|
|
@@ -389,8 +389,8 @@ class st {
|
|
|
389
389
|
return this.xt;
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
const ft = new Float32Array([-0.5, -0.5, 0, 0, 0.5, -0.5, 1, 0, -0.5, 0.5, 0, 1, -0.5, 0.5, 0, 1, 0.5, -0.5, 1, 0, 0.5, 0.5, 1, 1]), Y = { _s: 16, As: WebGL2RenderingContext.TRIANGLES,
|
|
393
|
-
class
|
|
392
|
+
const ft = new Float32Array([-0.5, -0.5, 0, 0, 0.5, -0.5, 1, 0, -0.5, 0.5, 0, 1, -0.5, 0.5, 0, 1, 0.5, -0.5, 1, 0, 0.5, 0.5, 1, 1]), Y = { _s: 16, As: WebGL2RenderingContext.TRIANGLES, bs: { ws: { size: 2, offset: 0 }, Cs: { size: 2, offset: 8 } } };
|
|
393
|
+
class $t {
|
|
394
394
|
constructor(t) {
|
|
395
395
|
a(this, "A");
|
|
396
396
|
a(this, "Ms");
|
|
@@ -398,20 +398,20 @@ class Jt {
|
|
|
398
398
|
this.A = t, this.Ms = t.createBuffer(), this.Fs = new Float32Array(ft.length);
|
|
399
399
|
}
|
|
400
400
|
Ps(t, e, i, s) {
|
|
401
|
-
const r = this.A, h = Pt(this.A), o = h[2], c = h[3], l = t / o * 2 - 1, u = (t + i) / o * 2 - 1, f = 1 - (e + s) / c * 2,
|
|
402
|
-
for (let v = 0; v <
|
|
403
|
-
const A =
|
|
404
|
-
|
|
401
|
+
const r = this.A, h = Pt(this.A), o = h[2], c = h[3], l = t / o * 2 - 1, u = (t + i) / o * 2 - 1, f = 1 - (e + s) / c * 2, d = 1 - e / c * 2, g = ft, m = this.Fs;
|
|
402
|
+
for (let v = 0; v < g.length; v += 4) {
|
|
403
|
+
const A = g[v], p = g[v + 1], y = g[v + 2], E = g[v + 3], b = l + (A + 0.5) * (u - l), x = f + (p + 0.5) * (d - f);
|
|
404
|
+
m[v] = b, m[v + 1] = x, m[v + 2] = y, m[v + 3] = E;
|
|
405
405
|
}
|
|
406
|
-
r.bindBuffer(r.ARRAY_BUFFER, this.Ms), r.bufferData(r.ARRAY_BUFFER,
|
|
406
|
+
r.bindBuffer(r.ARRAY_BUFFER, this.Ms), 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
|
gt() {
|
|
409
409
|
this.A.deleteBuffer(this.Ms);
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
var
|
|
413
|
-
const
|
|
414
|
-
class
|
|
412
|
+
var w = ((n) => (n.RECTANGLE = "rectangle", n.LINE = "line", n.ELLIPSE = "ellipse", n.ARC = "arc", n.TRIANGLE = "triangle", n.BEZIER_CURVE = "bezier_curve", n))(w || {});
|
|
413
|
+
const te = { rectangle: 2, line: 2, ellipse: 2, triangle: 2, arc: 3, bezier_curve: 4 };
|
|
414
|
+
class ee {
|
|
415
415
|
constructor(t) {
|
|
416
416
|
a(this, "A");
|
|
417
417
|
a(this, "$s", /* @__PURE__ */ new Map());
|
|
@@ -425,9 +425,9 @@ class te {
|
|
|
425
425
|
if (!o) {
|
|
426
426
|
o = r.createVertexArray(), h.set(e, o), r.bindVertexArray(o), r.bindBuffer(r.ARRAY_BUFFER, s);
|
|
427
427
|
const c = r.getAttribLocation(t, "A0");
|
|
428
|
-
c !== -1 && ut(r, c, i.ws.
|
|
428
|
+
c !== -1 && ut(r, c, i.bs.ws.size, i._s, i.bs.ws.offset, 0, r.FLOAT, !1);
|
|
429
429
|
const l = r.getAttribLocation(t, "A1");
|
|
430
|
-
l !== -1 && ut(r, l, i.
|
|
430
|
+
l !== -1 && ut(r, l, i.bs.Cs.size, i._s, i.bs.Cs.offset, 0, r.FLOAT, !1);
|
|
431
431
|
}
|
|
432
432
|
r.bindVertexArray(o);
|
|
433
433
|
}
|
|
@@ -438,62 +438,62 @@ class te {
|
|
|
438
438
|
for (const [, t] of this.$s) for (const [, e] of t) e && this.A.deleteVertexArray(e);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
const
|
|
441
|
+
const _ = class _ {
|
|
442
442
|
static Es(t, e, i = 0) {
|
|
443
|
-
const s = e || new Float32Array(
|
|
443
|
+
const s = e || new Float32Array(_.FLOATS_PER_INSTANCE);
|
|
444
444
|
let r = i;
|
|
445
|
-
s[r++] = t.
|
|
445
|
+
s[r++] = t.ws[0], s[r++] = t.ws[1], s[r++] = t.Ss[0], s[r++] = t.Ss[1], s[r++] = t.Nt[0], s[r++] = t.Nt[1], s[r++] = t.Nt[2], s[r++] = t.Xt[0], s[r++] = t.Xt[1], s[r++] = t.Xt[2], s[r++] = t.Xt[3], s[r++] = t.Yt[0], s[r++] = t.Yt[1], s[r++] = t.Yt[2], s[r++] = t.Yt[3], s[r++] = t.ks[0], s[r++] = t.ks[1], s[r++] = t.ks[2], s[r++] = t.Et;
|
|
446
446
|
const h = t.zs;
|
|
447
447
|
s[r++] = (h == null ? void 0 : h[0]) ?? 0, s[r++] = (h == null ? void 0 : h[1]) ?? 0, s[r++] = (h == null ? void 0 : h[2]) ?? 0;
|
|
448
448
|
const o = t.Ds;
|
|
449
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
|
-
const c = t.Ls, l = t.Os, u = t.Is, f = t.Bs,
|
|
451
|
-
return
|
|
450
|
+
const c = t.Ls, l = t.Os, u = t.Is, f = t.Bs, d = t.Hs, g = !(!l || !u);
|
|
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++] = l[0], s[r++] = l[1], s[r++] = u[0], s[r++] = u[1]) : !g && !!c ? (s[r++] = c[0], s[r++] = c[1], s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0) : (s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0, s[r++] = 0), s[r++] = t.Gs ?? 0, s[r++] = t.Qs ?? 0, s[r++] = t.Ns ?? 0, s;
|
|
452
452
|
}
|
|
453
453
|
static Xs(t, e) {
|
|
454
|
-
const i = t.length *
|
|
454
|
+
const i = t.length * _.FLOATS_PER_INSTANCE, s = e || new Float32Array(i);
|
|
455
455
|
for (let r = 0; r < t.length; r++) {
|
|
456
|
-
const h = r *
|
|
457
|
-
|
|
456
|
+
const h = r * _.FLOATS_PER_INSTANCE;
|
|
457
|
+
_.Es(t[r], s, h);
|
|
458
458
|
}
|
|
459
459
|
return s;
|
|
460
460
|
}
|
|
461
461
|
};
|
|
462
|
-
a(
|
|
463
|
-
let
|
|
462
|
+
a(_, "BYTES_PER_INSTANCE", 144), a(_, "FLOATS_PER_INSTANCE", 36);
|
|
463
|
+
let D = _;
|
|
464
464
|
const P = class P {
|
|
465
465
|
};
|
|
466
|
-
a(P, "STRIDE",
|
|
466
|
+
a(P, "STRIDE", D.BYTES_PER_INSTANCE), a(P, "ATTRIBUTES", { A2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 0, divisor: 1 }, A3: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 8, divisor: 1 }, A4: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 16, divisor: 1 }, A5: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 28, divisor: 1 }, A6: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 44, divisor: 1 }, A7: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 60, divisor: 1 }, A8: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 76, divisor: 1 }, A9: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 88, divisor: 1 }, Aa: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 100, divisor: 1 }, Ab: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 116, divisor: 1 }, Ac: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 132, divisor: 1 } });
|
|
467
467
|
let k = P;
|
|
468
|
-
class
|
|
468
|
+
class ie {
|
|
469
469
|
constructor(t = 1e3, e = 1.5) {
|
|
470
470
|
a(this, "Ys");
|
|
471
471
|
a(this, "js");
|
|
472
|
-
a(this, "
|
|
473
|
-
a(this, "
|
|
472
|
+
a(this, "Ws");
|
|
473
|
+
a(this, "Ks", 0);
|
|
474
474
|
a(this, "Zs", 0);
|
|
475
|
-
this.js = t, this.
|
|
476
|
-
const i = t *
|
|
475
|
+
this.js = t, this.Ws = e;
|
|
476
|
+
const i = t * D.FLOATS_PER_INSTANCE;
|
|
477
477
|
this.Ys = new Float32Array(i);
|
|
478
478
|
}
|
|
479
479
|
qs(t) {
|
|
480
480
|
if (t <= this.js) return;
|
|
481
|
-
const e = Math.ceil(t * this.
|
|
481
|
+
const e = Math.ceil(t * this.Ws), i = this.js;
|
|
482
482
|
this.js = e;
|
|
483
|
-
const s = e *
|
|
484
|
-
r.set(this.Ys.subarray(0, Math.min(h, this.
|
|
483
|
+
const s = e * D.FLOATS_PER_INSTANCE, r = new Float32Array(s), h = i * D.FLOATS_PER_INSTANCE;
|
|
484
|
+
r.set(this.Ys.subarray(0, Math.min(h, this.Ks))), this.Ys = r;
|
|
485
485
|
}
|
|
486
486
|
Vs() {
|
|
487
|
-
return { buffer: this.Ys, offset: this.
|
|
487
|
+
return { buffer: this.Ys, offset: this.Ks };
|
|
488
488
|
}
|
|
489
489
|
Js(t) {
|
|
490
|
-
this.
|
|
490
|
+
this.Ks += t, this.Zs++;
|
|
491
491
|
}
|
|
492
492
|
ti() {
|
|
493
|
-
this.
|
|
493
|
+
this.Ks = 0, this.Zs = 0;
|
|
494
494
|
}
|
|
495
495
|
si(t = 0, e) {
|
|
496
|
-
return this.Ys.subarray(t, e ?? this.
|
|
496
|
+
return this.Ys.subarray(t, e ?? this.Ks);
|
|
497
497
|
}
|
|
498
498
|
get ii() {
|
|
499
499
|
return this.Zs;
|
|
@@ -502,13 +502,13 @@ class ee {
|
|
|
502
502
|
return this.js;
|
|
503
503
|
}
|
|
504
504
|
get ri() {
|
|
505
|
-
return this.
|
|
505
|
+
return this.Ks;
|
|
506
506
|
}
|
|
507
507
|
get ni() {
|
|
508
508
|
return this.Zs === 0;
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
class
|
|
511
|
+
class se {
|
|
512
512
|
constructor(t) {
|
|
513
513
|
a(this, "Ys");
|
|
514
514
|
this.Ys = t;
|
|
@@ -518,13 +518,13 @@ class ie {
|
|
|
518
518
|
const { buffer: e, offset: i } = this.Ys.Vs();
|
|
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
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.Ys.Js(
|
|
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.Ys.Js(D.FLOATS_PER_INSTANCE), this.Ys.ii - 1;
|
|
522
522
|
}
|
|
523
523
|
get ii() {
|
|
524
524
|
return this.Ys.ii;
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
|
-
class
|
|
527
|
+
class re {
|
|
528
528
|
constructor(t, e = 1e3) {
|
|
529
529
|
a(this, "A");
|
|
530
530
|
a(this, "oi", null);
|
|
@@ -535,8 +535,8 @@ class se {
|
|
|
535
535
|
li(t) {
|
|
536
536
|
const e = this.A;
|
|
537
537
|
this.oi && e.deleteBuffer(this.oi), this.oi = e.createBuffer();
|
|
538
|
-
const i = t *
|
|
539
|
-
|
|
538
|
+
const i = t * D.BYTES_PER_INSTANCE;
|
|
539
|
+
Ft(e, e.ARRAY_BUFFER, this.oi, i, e.DYNAMIC_DRAW), this.ai = t;
|
|
540
540
|
}
|
|
541
541
|
ui(t) {
|
|
542
542
|
this.li(t);
|
|
@@ -548,7 +548,7 @@ class se {
|
|
|
548
548
|
if (e === 0) return;
|
|
549
549
|
const i = this.A;
|
|
550
550
|
i.bindBuffer(i.ARRAY_BUFFER, this.oi);
|
|
551
|
-
const s = e *
|
|
551
|
+
const s = e * D.FLOATS_PER_INSTANCE;
|
|
552
552
|
i.bufferSubData(i.ARRAY_BUFFER, 0, t, 0, s);
|
|
553
553
|
}
|
|
554
554
|
di(t) {
|
|
@@ -580,18 +580,18 @@ class se {
|
|
|
580
580
|
this.oi && (this.A.deleteBuffer(this.oi), this.oi = null), this.ci.clear();
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
|
-
class
|
|
583
|
+
class ne {
|
|
584
584
|
constructor(t, e = 1e3, i = 1.5) {
|
|
585
585
|
a(this, "A");
|
|
586
586
|
a(this, "Ys");
|
|
587
587
|
a(this, "mi");
|
|
588
588
|
a(this, "_i");
|
|
589
|
-
this.A = t, this.Ys = new
|
|
589
|
+
this.A = t, this.Ys = new ie(e, i), this.mi = new se(this.Ys), this._i = new re(t, e);
|
|
590
590
|
}
|
|
591
591
|
yi(t) {
|
|
592
|
-
var s, r, h, o, c, l, u, f,
|
|
592
|
+
var s, r, h, o, c, l, u, f, d, g;
|
|
593
593
|
const e = [0, 0, 0, 0], i = [0, 0, 0, 0];
|
|
594
|
-
return t.Os && t.Is ? (e[0] = ((s = t.Bs) == null ? void 0 : s[0]) ?? 0, e[1] = ((r = t.Bs) == null ? void 0 : r[1]) ?? 0, e[2] = ((h = t.Hs) == null ? void 0 : h[0]) ?? 0, e[3] = ((o = t.Hs) == null ? void 0 : o[1]) ?? 0, i[0] = t.Os[0], i[1] = t.Os[1], i[2] = t.Is[0], i[3] = t.Is[1]) : t.Ls && (e[0] = t.Ls[0], e[1] = t.Ls[1]), this.hi({ x: t.
|
|
594
|
+
return t.Os && t.Is ? (e[0] = ((s = t.Bs) == null ? void 0 : s[0]) ?? 0, e[1] = ((r = t.Bs) == null ? void 0 : r[1]) ?? 0, e[2] = ((h = t.Hs) == null ? void 0 : h[0]) ?? 0, e[3] = ((o = t.Hs) == null ? void 0 : o[1]) ?? 0, i[0] = t.Os[0], i[1] = t.Os[1], i[2] = t.Is[0], i[3] = t.Is[1]) : t.Ls && (e[0] = t.Ls[0], e[1] = t.Ls[1]), this.hi({ x: t.ws[0], y: t.ws[1], width: t.Ss[0], height: t.Ss[1], char0: t.Nt[0], char1: t.Nt[1], char2: t.Nt[2], r1: t.Xt[0], g1: t.Xt[1], b1: t.Xt[2], a1: t.Xt[3], r2: t.Yt[0], g2: t.Yt[1], b2: t.Yt[2], a2: t.Yt[3], invert: t.ks[0], flipX: t.ks[1], flipY: t.ks[2], charRot: t.Et, translationX: ((c = t.zs) == null ? void 0 : c[0]) ?? 0, translationY: ((l = t.zs) == null ? void 0 : l[1]) ?? 0, translationZ: ((u = t.zs) == null ? void 0 : u[2]) ?? 0, rotationX: ((f = t.Ds) == null ? void 0 : f[0]) ?? 0, rotationY: ((d = t.Ds) == null ? void 0 : d[1]) ?? 0, rotationZ: ((g = t.Ds) == null ? void 0 : g[2]) ?? 0, curveParams0: e, curveParams1: i, depth: t.Gs || 0, baseZ: t.Qs || 0, geometryType: t.Ns || 0 });
|
|
595
595
|
}
|
|
596
596
|
hi(t) {
|
|
597
597
|
const e = this.mi.hi(t);
|
|
@@ -603,7 +603,7 @@ class re {
|
|
|
603
603
|
get ni() {
|
|
604
604
|
return this.Ys.ni;
|
|
605
605
|
}
|
|
606
|
-
|
|
606
|
+
bi() {
|
|
607
607
|
this.Ys.ti();
|
|
608
608
|
}
|
|
609
609
|
pi(t) {
|
|
@@ -623,16 +623,16 @@ class re {
|
|
|
623
623
|
this._i.gt();
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
class
|
|
626
|
+
class X {
|
|
627
627
|
constructor(t, e, i, s) {
|
|
628
628
|
a(this, "A");
|
|
629
|
-
a(this, "
|
|
629
|
+
a(this, "wi");
|
|
630
630
|
a(this, "Ci");
|
|
631
631
|
a(this, "xi");
|
|
632
632
|
a(this, "Mi", null);
|
|
633
|
-
this.A = t, this.
|
|
633
|
+
this.A = t, this.wi = e, this.Ci = i, this.xi = s;
|
|
634
634
|
const r = this.A.createBuffer();
|
|
635
|
-
|
|
635
|
+
Ft(this.A, this.A.ARRAY_BUFFER, r, this.xi.Fi, this.A.STATIC_DRAW), this.Mi = r;
|
|
636
636
|
}
|
|
637
637
|
get type() {
|
|
638
638
|
return this.Ci;
|
|
@@ -644,36 +644,36 @@ class _ {
|
|
|
644
644
|
return this.Mi;
|
|
645
645
|
}
|
|
646
646
|
get batch() {
|
|
647
|
-
return this.
|
|
647
|
+
return this.wi;
|
|
648
648
|
}
|
|
649
649
|
Pi() {
|
|
650
|
-
this.bi
|
|
650
|
+
this.wi.bi();
|
|
651
651
|
}
|
|
652
652
|
$i() {
|
|
653
|
-
return !this.
|
|
653
|
+
return !this.wi.ni;
|
|
654
654
|
}
|
|
655
655
|
gt() {
|
|
656
|
-
this.
|
|
656
|
+
this.wi.gt(), this.A.deleteBuffer(this.Mi);
|
|
657
657
|
}
|
|
658
658
|
Ti(t, e, i) {
|
|
659
|
-
return this.
|
|
659
|
+
return this.wi.yi(t);
|
|
660
660
|
}
|
|
661
661
|
Ri(t, e, i, s, r, h) {
|
|
662
|
-
const o = r.It ?? 0, c = r.Bt ?? 0, l = r.Ht ?? 0, u = r.
|
|
663
|
-
h && (h.bezStartX !== void 0 && h.bezStartY !== void 0 && h.bezEndX !== void 0 && h.bezEndY !== void 0 ? (
|
|
664
|
-
const v = { x: t, y: e, width: i, height: s, char0: r.Nt[0], char1: r.Nt[1], char2: r.Nt[2], r1: r.Xt[0], g1: r.Xt[1], b1: r.Xt[2], a1: r.Xt[3], r2: r.Yt[0], g2: r.Yt[1], b2: r.Yt[2], a2: r.Yt[3], invert: r.Rt ? 1 : 0, flipX: r.Gt ? 1 : 0, flipY: r.Qt ? 1 : 0, charRot: r.Et, translationX: o, translationY: c, translationZ: l, rotationX: u, rotationY: f, rotationZ:
|
|
665
|
-
return this.
|
|
662
|
+
const o = r.It ?? 0, c = r.Bt ?? 0, l = r.Ht ?? 0, u = r.wt ?? 0, f = r.Ct ?? 0, d = r.xt ?? 0, g = [0, 0, 0, 0], m = [0, 0, 0, 0];
|
|
663
|
+
h && (h.bezStartX !== void 0 && h.bezStartY !== void 0 && h.bezEndX !== void 0 && h.bezEndY !== void 0 ? (g[0] = h.cp1x ?? 0, g[1] = h.cp1y ?? 0, g[2] = h.cp2x ?? 0, g[3] = h.cp2y ?? 0, m[0] = h.bezStartX ?? 0, m[1] = h.bezStartY ?? 0, m[2] = h.bezEndX ?? 0, m[3] = h.bezEndY ?? 0) : h.arcStart === void 0 && h.arcStop === void 0 || (g[0] = h.arcStart ?? 0, g[1] = h.arcStop ?? 0));
|
|
664
|
+
const v = { x: t, y: e, width: i, height: s, char0: r.Nt[0], char1: r.Nt[1], char2: r.Nt[2], r1: r.Xt[0], g1: r.Xt[1], b1: r.Xt[2], a1: r.Xt[3], r2: r.Yt[0], g2: r.Yt[1], b2: r.Yt[2], a2: r.Yt[3], invert: r.Rt ? 1 : 0, flipX: r.Gt ? 1 : 0, flipY: r.Qt ? 1 : 0, charRot: r.Et, translationX: o, translationY: c, translationZ: l, rotationX: u, rotationY: f, rotationZ: d, curveParams0: g, curveParams1: m, depth: (h == null ? void 0 : h.depth) ?? 0, baseZ: (h == null ? void 0 : h.baseZ) ?? 0, geometryType: te[this.Ci] ?? 0 };
|
|
665
|
+
return this.wi.hi(v);
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
|
-
const
|
|
668
|
+
const he = { Fi: ft, Ei: 6, ...Y }, oe = { Fi: 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]), Ei: 6, ...Y }, ae = { Fi: function(n = 32) {
|
|
669
669
|
const t = [], e = 2 * Math.PI / n;
|
|
670
670
|
for (let i = 0; i < n; i++) {
|
|
671
|
-
const s = i * e, r = (i + 1) % n * e, h = Math.cos(s), o = Math.sin(s), c = 0.5 * (h + 1), l = 0.5 * (o + 1), u = Math.cos(r), f = Math.sin(r),
|
|
672
|
-
t.push(0, 0, 0.5, 0.5, h, o, c, l, u, f,
|
|
671
|
+
const s = i * e, r = (i + 1) % n * e, h = Math.cos(s), o = Math.sin(s), c = 0.5 * (h + 1), l = 0.5 * (o + 1), u = Math.cos(r), f = Math.sin(r), d = 0.5 * (u + 1), g = 0.5 * (f + 1);
|
|
672
|
+
t.push(0, 0, 0.5, 0.5, h, o, c, l, u, f, d, g);
|
|
673
673
|
}
|
|
674
674
|
return new Float32Array(t);
|
|
675
675
|
}(32), Ei: 96, ...Y };
|
|
676
|
-
let
|
|
676
|
+
let ce = { Fi: function(n) {
|
|
677
677
|
const t = [];
|
|
678
678
|
for (let e = 0; e < n; e++) {
|
|
679
679
|
const i = e / n, s = (e + 1) / n;
|
|
@@ -681,67 +681,67 @@ let ae = { Fi: function(n) {
|
|
|
681
681
|
}
|
|
682
682
|
return new Float32Array(t);
|
|
683
683
|
}(32), Ei: 96, ...Y };
|
|
684
|
-
const
|
|
684
|
+
const le = { Fi: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Ei: 3, ...Y }, ue = { Fi: function(n = 16) {
|
|
685
685
|
const t = [];
|
|
686
686
|
for (let e = 0; e < n; e++) {
|
|
687
687
|
const i = e / n, s = (e + 1) / n;
|
|
688
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), Ei: 96, ...Y },
|
|
691
|
+
}(16), Ei: 96, ...Y }, fe = { [w.RECTANGLE]: class extends X {
|
|
692
692
|
constructor(n, t) {
|
|
693
|
-
super(n, t,
|
|
693
|
+
super(n, t, w.RECTANGLE, he);
|
|
694
694
|
}
|
|
695
695
|
yi(n, t) {
|
|
696
696
|
return this.Ri(0, 0, n.width, n.height, t);
|
|
697
697
|
}
|
|
698
|
-
}, [
|
|
698
|
+
}, [w.LINE]: class extends X {
|
|
699
699
|
constructor(n, t) {
|
|
700
|
-
super(n, t,
|
|
700
|
+
super(n, t, w.LINE, oe);
|
|
701
701
|
}
|
|
702
702
|
yi(n, t) {
|
|
703
703
|
const e = n.x2 - n.x1, i = n.y2 - n.y1, s = Math.hypot(e, i), r = Math.atan2(i, e), h = t.Ot || 1, o = n.x1 + e / 2 - s / 2, c = n.y1 + i / 2, l = { ...t, xt: (t.xt || 0) + r };
|
|
704
704
|
return this.Ri(o, c, s, h, l);
|
|
705
705
|
}
|
|
706
|
-
}, [
|
|
706
|
+
}, [w.ELLIPSE]: class extends X {
|
|
707
707
|
constructor(n, t) {
|
|
708
|
-
super(n, t,
|
|
708
|
+
super(n, t, w.ELLIPSE, ae);
|
|
709
709
|
}
|
|
710
710
|
yi(n, t) {
|
|
711
711
|
return this.Ri(0, 0, n.width, n.height, t);
|
|
712
712
|
}
|
|
713
|
-
}, [
|
|
713
|
+
}, [w.ARC]: class extends X {
|
|
714
714
|
constructor(n, t) {
|
|
715
|
-
super(n, t,
|
|
715
|
+
super(n, t, w.ARC, ce);
|
|
716
716
|
}
|
|
717
717
|
yi(n, t) {
|
|
718
718
|
const e = n.start * Math.PI / 180, i = n.stop * Math.PI / 180;
|
|
719
719
|
return this.Ri(0, 0, n.width, n.height, t, { arcStart: e, arcStop: i });
|
|
720
720
|
}
|
|
721
|
-
}, [
|
|
721
|
+
}, [w.TRIANGLE]: class extends X {
|
|
722
722
|
constructor(n, t) {
|
|
723
|
-
super(n, t,
|
|
723
|
+
super(n, t, w.TRIANGLE, le);
|
|
724
724
|
}
|
|
725
725
|
yi(n, t) {
|
|
726
726
|
const e = Math.min(n.x1, n.x2, n.x3), i = Math.max(n.x1, n.x2, n.x3), s = Math.min(n.y1, n.y2, n.y3), r = i - e, h = Math.max(n.y1, n.y2, n.y3) - s;
|
|
727
727
|
return this.Ri(e, s, r, h, t);
|
|
728
728
|
}
|
|
729
|
-
}, [
|
|
729
|
+
}, [w.BEZIER_CURVE]: class extends X {
|
|
730
730
|
constructor(n, t) {
|
|
731
|
-
super(n, t,
|
|
731
|
+
super(n, t, w.BEZIER_CURVE, ue);
|
|
732
732
|
}
|
|
733
733
|
yi(n, t) {
|
|
734
734
|
return this.Ri(0, 0, 1, t.Ot || 1, t, { cp1x: n.cp1x, cp1y: n.cp1y, cp2x: n.cp2x, cp2y: n.cp2y, bezStartX: n.x1, bezStartY: n.y1, bezEndX: n.x2, bezEndY: n.y2 });
|
|
735
735
|
}
|
|
736
736
|
} };
|
|
737
|
-
class
|
|
737
|
+
class de {
|
|
738
738
|
constructor(t) {
|
|
739
739
|
a(this, "A");
|
|
740
740
|
a(this, "Si");
|
|
741
741
|
a(this, "ki");
|
|
742
|
-
this.A = t, this.ki = new
|
|
743
|
-
for (const e of Object.values(
|
|
744
|
-
const i = new
|
|
742
|
+
this.A = t, this.ki = new ee(t), this.Si = /* @__PURE__ */ new Map();
|
|
743
|
+
for (const e of Object.values(w)) {
|
|
744
|
+
const i = new ne(t), s = new fe[e](t, i);
|
|
745
745
|
this.Si.set(e, s);
|
|
746
746
|
}
|
|
747
747
|
}
|
|
@@ -759,7 +759,7 @@ class fe {
|
|
|
759
759
|
const { material: e, type: i, commands: s } = t, r = this.Si.get(i);
|
|
760
760
|
e.shader.D(), e.shader.O(e.uniforms);
|
|
761
761
|
const h = Pt(this.A), o = s.length > 0 && s[0].state.kt;
|
|
762
|
-
e.shader.O({
|
|
762
|
+
e.shader.O({ Uv: h[2] / h[3], Us: [h[2], h[3]], Ut: 1, Uu: o ? 1 : 0 }), r.Pi();
|
|
763
763
|
for (const c of s) r.yi(c.params, c.state);
|
|
764
764
|
if (r.$i()) {
|
|
765
765
|
const c = r.unitGeometry, l = r.unitBuffer;
|
|
@@ -782,23 +782,23 @@ function Mt(n) {
|
|
|
782
782
|
return t;
|
|
783
783
|
}
|
|
784
784
|
const yt = /* @__PURE__ */ new WeakMap();
|
|
785
|
-
let
|
|
786
|
-
function
|
|
785
|
+
let ge = 1;
|
|
786
|
+
function xt(n) {
|
|
787
787
|
if (n == null) return 0;
|
|
788
788
|
if (typeof n != "object" && typeof n != "function") return Mt(n + "");
|
|
789
789
|
let t = yt.get(n);
|
|
790
|
-
return t || (t =
|
|
790
|
+
return t || (t = ge++, yt.set(n, t)), t;
|
|
791
791
|
}
|
|
792
|
-
function
|
|
792
|
+
function G(n, t) {
|
|
793
793
|
return (n << 5) - n + t;
|
|
794
794
|
}
|
|
795
|
-
class
|
|
795
|
+
class ve {
|
|
796
796
|
constructor(t) {
|
|
797
797
|
a(this, "Oi", 0);
|
|
798
798
|
a(this, "Ii");
|
|
799
799
|
a(this, "Bi");
|
|
800
800
|
a(this, "Hi", /* @__PURE__ */ new Map());
|
|
801
|
-
this.Ii = new
|
|
801
|
+
this.Ii = new H(t, it, `#version 300 es
|
|
802
802
|
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.Bi = { id: this.Oi++, shader: this.Ii, uniforms: Object.freeze({}), hash: this.Gi(this.Ii, {}), isBuiltIn: !0 };
|
|
803
803
|
}
|
|
804
804
|
get Qi() {
|
|
@@ -814,13 +814,13 @@ precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellCo
|
|
|
814
814
|
return { id: this.Oi++, shader: t, uniforms: Object.freeze({ ...e }), hash: 0, isBuiltIn: !1 };
|
|
815
815
|
}
|
|
816
816
|
Gi(t, e) {
|
|
817
|
-
const i =
|
|
817
|
+
const i = xt(t.G), s = function(r, h) {
|
|
818
818
|
let o = 0;
|
|
819
819
|
const c = Object.keys(r).sort();
|
|
820
|
-
for (const l of c) o =
|
|
820
|
+
for (const l of c) o = G(o, Mt(l)), o = G(o, h(r[l]));
|
|
821
821
|
return o;
|
|
822
822
|
}(e, this.Xi.bind(this));
|
|
823
|
-
return
|
|
823
|
+
return G(i, s);
|
|
824
824
|
}
|
|
825
825
|
Xi(t) {
|
|
826
826
|
return typeof t == "number" || typeof t == "boolean" ? function(e) {
|
|
@@ -828,14 +828,14 @@ precision highp float;in vec3 v_glyphIndex;in vec4 v_glyphColor;in vec4 v_cellCo
|
|
|
828
828
|
}(t) : Array.isArray(t) ? function(e) {
|
|
829
829
|
let i = 0;
|
|
830
830
|
const s = Array.isArray(e[0]) ? e.flat() : e;
|
|
831
|
-
for (const r of s) i =
|
|
831
|
+
for (const r of s) i = G(i, typeof r == "number" ? r : 0);
|
|
832
832
|
return i;
|
|
833
833
|
}(t) : t instanceof Float32Array || t instanceof Int32Array ? function(e) {
|
|
834
834
|
let i = 0;
|
|
835
835
|
const s = Math.min(e.length, 16);
|
|
836
|
-
for (let r = 0; r < s; r++) i =
|
|
836
|
+
for (let r = 0; r < s; r++) i = G(i, e[r]);
|
|
837
837
|
return i;
|
|
838
|
-
}(t) : t instanceof WebGLTexture ?
|
|
838
|
+
}(t) : t instanceof WebGLTexture ? xt(t) : 0;
|
|
839
839
|
}
|
|
840
840
|
gt() {
|
|
841
841
|
this.Ii != this.Ii && this.Ii.dispose(), this.Ii.dispose(), this.Hi.clear();
|
|
@@ -847,7 +847,7 @@ class me {
|
|
|
847
847
|
a(this, "ji", 1);
|
|
848
848
|
a(this, "Ss", 0);
|
|
849
849
|
}
|
|
850
|
-
|
|
850
|
+
Wi(t, e) {
|
|
851
851
|
if (this.Ss >= this.Yi.length) {
|
|
852
852
|
const s = { id: this.ji++, type: t, params: {}, state: st.Lt(), material: e };
|
|
853
853
|
this.Yi.push(s);
|
|
@@ -855,31 +855,31 @@ class me {
|
|
|
855
855
|
const i = this.Yi[this.Ss];
|
|
856
856
|
return i.id = this.ji++, i.type = t, i.material = e, this.Ss++, i;
|
|
857
857
|
}
|
|
858
|
-
|
|
859
|
-
const s = this.
|
|
860
|
-
return r.width = t.width, r.height = t.height, e.
|
|
858
|
+
Ki(t, e, i) {
|
|
859
|
+
const s = this.Wi(w.RECTANGLE, i), r = s.params;
|
|
860
|
+
return r.width = t.width, r.height = t.height, e.Kt(s.state), s.id;
|
|
861
861
|
}
|
|
862
862
|
Zi(t, e, i) {
|
|
863
|
-
const s = this.
|
|
864
|
-
return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, e.
|
|
863
|
+
const s = this.Wi(w.LINE, i), r = s.params;
|
|
864
|
+
return r.x1 = t.x1, r.y1 = t.y1, r.x2 = t.x2, r.y2 = t.y2, r.thickness = t.thickness, e.Kt(s.state), s.id;
|
|
865
865
|
}
|
|
866
866
|
qi(t, e, i) {
|
|
867
|
-
const s = this.
|
|
868
|
-
return r.width = t.width, r.height = t.height, r.startAngle = t.startAngle, r.endAngle = t.endAngle, r.segments = t.segments, e.
|
|
867
|
+
const s = this.Wi(w.ELLIPSE, i), r = s.params;
|
|
868
|
+
return r.width = t.width, r.height = t.height, r.startAngle = t.startAngle, r.endAngle = t.endAngle, r.segments = t.segments, e.Kt(s.state), s.id;
|
|
869
869
|
}
|
|
870
870
|
Vi(t, e, i) {
|
|
871
|
-
const s = this.
|
|
872
|
-
return r.width = t.width, r.height = t.height, r.start = t.start, r.stop = t.stop, e.
|
|
871
|
+
const s = this.Wi(w.ARC, i), r = s.params;
|
|
872
|
+
return r.width = t.width, r.height = t.height, r.start = t.start, r.stop = t.stop, e.Kt(s.state), s.id;
|
|
873
873
|
}
|
|
874
874
|
Ji(t, e, i) {
|
|
875
|
-
const s = this.
|
|
876
|
-
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.
|
|
875
|
+
const s = this.Wi(w.TRIANGLE, i), r = s.params;
|
|
876
|
+
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.Kt(s.state), s.id;
|
|
877
877
|
}
|
|
878
878
|
te(t, e, i) {
|
|
879
|
-
const s = this.
|
|
880
|
-
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.
|
|
879
|
+
const s = this.Wi(w.BEZIER_CURVE, i), r = s.params;
|
|
880
|
+
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.Kt(s.state), s.id;
|
|
881
881
|
}
|
|
882
|
-
|
|
882
|
+
bi() {
|
|
883
883
|
this.Ss = 0;
|
|
884
884
|
}
|
|
885
885
|
[Symbol.iterator]() {
|
|
@@ -888,7 +888,7 @@ class me {
|
|
|
888
888
|
return { next: () => t < e ? { value: i[t++], done: !1 } : { value: void 0, done: !0 } };
|
|
889
889
|
}
|
|
890
890
|
}
|
|
891
|
-
class
|
|
891
|
+
class pe {
|
|
892
892
|
constructor(t) {
|
|
893
893
|
a(this, "A");
|
|
894
894
|
a(this, "se", null);
|
|
@@ -905,7 +905,7 @@ class ve {
|
|
|
905
905
|
a(this, "ue", null);
|
|
906
906
|
a(this, "fe", [0, 0, 0, 0]);
|
|
907
907
|
a(this, "de", 1);
|
|
908
|
-
this.A = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.ee = new st(), this.vt = new
|
|
908
|
+
this.A = t, t.enable(t.DEPTH_TEST), t.depthFunc(t.LEQUAL), t.clearDepth(1), t.depthMask(!0), t.disable(t.CULL_FACE), this.ee = new st(), this.vt = new ve(t), this.re = new me(), this.ie = new de(t), this.ne = new $t(t);
|
|
909
909
|
const e = [0, 0, t.canvas.width, t.canvas.height];
|
|
910
910
|
nt(t, e), this.ae.push(null), this.ce.push(e), this.le.push(1), this.ue = null, this.fe = e, this.de = 1;
|
|
911
911
|
}
|
|
@@ -926,7 +926,7 @@ class ve {
|
|
|
926
926
|
this.se !== t && (this.se = t, t.D());
|
|
927
927
|
}
|
|
928
928
|
pe(t, e) {
|
|
929
|
-
return new
|
|
929
|
+
return new H(this.A, t, e);
|
|
930
930
|
}
|
|
931
931
|
ge(t) {
|
|
932
932
|
this.he = t, t && (this.oe = {});
|
|
@@ -938,21 +938,21 @@ class ve {
|
|
|
938
938
|
Object.assign(this.oe, t);
|
|
939
939
|
}
|
|
940
940
|
_e(t) {
|
|
941
|
-
return new
|
|
941
|
+
return new H(this.A, it, t);
|
|
942
942
|
}
|
|
943
943
|
ye(t, e, i) {
|
|
944
|
-
this.re.
|
|
944
|
+
this.re.Ki({ width: e ?? t.width, height: i ?? t.height }, this.ee, t.ut());
|
|
945
945
|
}
|
|
946
946
|
Ae(t, e, i, s) {
|
|
947
947
|
this.ne.Ps(t, e, i, s);
|
|
948
948
|
}
|
|
949
|
-
|
|
949
|
+
be(t, e) {
|
|
950
950
|
if (this.he) {
|
|
951
951
|
const i = this.vt.Ni(this.he, this.oe);
|
|
952
|
-
this.re.
|
|
953
|
-
} else this.re.
|
|
952
|
+
this.re.Ki({ width: t, height: e }, this.ee, i), this.he = null, this.oe = {};
|
|
953
|
+
} else this.re.Ki({ width: t, height: e }, this.ee, this.vt.Qi);
|
|
954
954
|
}
|
|
955
|
-
|
|
955
|
+
we(t, e, i, s) {
|
|
956
956
|
this.re.Zi({ x1: t, y1: e, x2: i, y2: s }, this.ee, this.vt.Qi);
|
|
957
957
|
}
|
|
958
958
|
Ce(t, e) {
|
|
@@ -968,14 +968,14 @@ class ve {
|
|
|
968
968
|
this.re.Vi({ width: t, height: e, start: i, stop: s }, this.ee, this.vt.Qi);
|
|
969
969
|
}
|
|
970
970
|
Pe(t, e, i = 1, s = {}) {
|
|
971
|
-
return new
|
|
971
|
+
return new j(this.A, t, e, i, s, this);
|
|
972
972
|
}
|
|
973
973
|
$e(t, e = t, i = t, s = 255) {
|
|
974
974
|
this.ee.ps(t, e ?? t, i ?? t, s);
|
|
975
975
|
const [r, h, o, c] = this.ee.canvasBackgroundColor;
|
|
976
976
|
this.Te(r, h, o, c, !1);
|
|
977
977
|
}
|
|
978
|
-
|
|
978
|
+
bi(t = 0, e = 0, i = 0, s = 0) {
|
|
979
979
|
this.Te(t, e, i, s, !0);
|
|
980
980
|
}
|
|
981
981
|
Te(t, e, i, s, r) {
|
|
@@ -992,7 +992,7 @@ class ve {
|
|
|
992
992
|
}
|
|
993
993
|
ct() {
|
|
994
994
|
const t = this.re;
|
|
995
|
-
this.ie.zi(t), t.
|
|
995
|
+
this.ie.zi(t), t.bi(), this.se = null;
|
|
996
996
|
}
|
|
997
997
|
gt() {
|
|
998
998
|
this.vt.gt(), this.ie.gt(), this.ne.gt();
|
|
@@ -1007,13 +1007,13 @@ class ve {
|
|
|
1007
1007
|
return this.vt;
|
|
1008
1008
|
}
|
|
1009
1009
|
}
|
|
1010
|
-
const
|
|
1010
|
+
const R = { readShort: (n, t) => (R.t.uint16[0] = n[t] << 8 | n[t + 1], R.t.int16[0]), readUshort: (n, t) => n[t] << 8 | n[t + 1], readUshorts(n, t, e) {
|
|
1011
1011
|
const i = [];
|
|
1012
|
-
for (let s = 0; s < e; s++) i.push(
|
|
1012
|
+
for (let s = 0; s < e; s++) i.push(R.readUshort(n, t + 2 * s));
|
|
1013
1013
|
return i;
|
|
1014
1014
|
}, readUint(n, t) {
|
|
1015
|
-
const e =
|
|
1016
|
-
return e[3] = n[t], e[2] = n[t + 1], e[1] = n[t + 2], e[0] = n[t + 3],
|
|
1015
|
+
const e = R.t.uint8;
|
|
1016
|
+
return e[3] = n[t], e[2] = n[t + 1], e[1] = n[t + 2], e[0] = n[t + 3], R.t.uint32[0];
|
|
1017
1017
|
}, readASCII(n, t, e) {
|
|
1018
1018
|
let i = "";
|
|
1019
1019
|
for (let s = 0; s < e; s++) i += String.fromCharCode(n[t + s]);
|
|
@@ -1028,20 +1028,20 @@ function q(n) {
|
|
|
1028
1028
|
function J(n, t, e) {
|
|
1029
1029
|
n[t] = e >>> 8 & 255, n[t + 1] = 255 & e;
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1031
|
+
function L(n, t, e) {
|
|
1032
1032
|
n[t] = e >>> 24 & 255, n[t + 1] = e >>> 16 & 255, n[t + 2] = e >>> 8 & 255, n[t + 3] = 255 & e;
|
|
1033
1033
|
}
|
|
1034
|
-
function
|
|
1034
|
+
function Ae(n, t, e) {
|
|
1035
1035
|
for (let i = 0; i < e.length; i++) n[t + i] = 255 & e.charCodeAt(i);
|
|
1036
1036
|
}
|
|
1037
1037
|
function ht(n, t, e) {
|
|
1038
1038
|
const i = t + e;
|
|
1039
1039
|
let s = 0;
|
|
1040
|
-
const r =
|
|
1040
|
+
const r = R.t;
|
|
1041
1041
|
for (let h = t; h < i; h += 4) r.uint8[3] = n[h] || 0, r.uint8[2] = n[h + 1] || 0, r.uint8[1] = n[h + 2] || 0, r.uint8[0] = n[h + 3] || 0, s = s + (r.uint32[0] >>> 0) >>> 0;
|
|
1042
1042
|
return s >>> 0;
|
|
1043
1043
|
}
|
|
1044
|
-
class
|
|
1044
|
+
class Ee {
|
|
1045
1045
|
constructor(t) {
|
|
1046
1046
|
a(this, "b");
|
|
1047
1047
|
a(this, "p", 0);
|
|
@@ -1064,7 +1064,7 @@ class Ae {
|
|
|
1064
1064
|
return this.p;
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
|
-
function
|
|
1067
|
+
function V(n) {
|
|
1068
1068
|
let t = 32, e = 0;
|
|
1069
1069
|
for (const o of n) o && (o < t && (t = o), o > e && (e = o));
|
|
1070
1070
|
if (e === 0) return { min: 0, max: 0, table: /* @__PURE__ */ new Map() };
|
|
@@ -1080,7 +1080,7 @@ function G(n) {
|
|
|
1080
1080
|
if (!c) continue;
|
|
1081
1081
|
const l = s[c]++;
|
|
1082
1082
|
let u = h.get(c);
|
|
1083
|
-
u || (u = [], h.set(c, u)), u[
|
|
1083
|
+
u || (u = [], h.set(c, u)), u[ye(l, c)] = o;
|
|
1084
1084
|
}
|
|
1085
1085
|
return { min: t, max: e, table: h };
|
|
1086
1086
|
}
|
|
@@ -1096,12 +1096,12 @@ function ot(n, t) {
|
|
|
1096
1096
|
}
|
|
1097
1097
|
throw Error("Invalid Huffman code");
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1099
|
+
function ye(n, t) {
|
|
1100
1100
|
let e = 0;
|
|
1101
1101
|
for (let i = 0; i < t; i++) e = e << 1 | 1 & n, n >>>= 1;
|
|
1102
1102
|
return e >>> 0;
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1104
|
+
function xe(n) {
|
|
1105
1105
|
if (n.length < 2) throw Error("ZLIB data too short");
|
|
1106
1106
|
const t = n[0], e = n[1];
|
|
1107
1107
|
if ((15 & t) != 8) throw Error("Unsupported ZLIB compression method");
|
|
@@ -1114,49 +1114,49 @@ function ye(n) {
|
|
|
1114
1114
|
let f = 0;
|
|
1115
1115
|
for (; !f; ) {
|
|
1116
1116
|
f = r.readBits(1);
|
|
1117
|
-
const
|
|
1118
|
-
if (
|
|
1117
|
+
const d = r.readBits(2);
|
|
1118
|
+
if (d === 0) {
|
|
1119
1119
|
r.alignToByte();
|
|
1120
|
-
const
|
|
1121
|
-
if ((65535 & (65535 ^
|
|
1122
|
-
for (let
|
|
1120
|
+
const g = r.readBits(16);
|
|
1121
|
+
if ((65535 & (65535 ^ g)) !== r.readBits(16)) throw Error("DEFLATE uncompressed LEN/NLEN mismatch");
|
|
1122
|
+
for (let m = 0; m < g; m++) h.push(r.readBits(8));
|
|
1123
1123
|
} else {
|
|
1124
|
-
if (
|
|
1124
|
+
if (d !== 1 && d !== 2) throw Error("Unsupported DEFLATE type");
|
|
1125
1125
|
{
|
|
1126
|
-
let
|
|
1127
|
-
if (
|
|
1126
|
+
let g, m;
|
|
1127
|
+
if (d === 1) {
|
|
1128
1128
|
const v = Array(288).fill(0);
|
|
1129
1129
|
for (let A = 0; A <= 143; A++) v[A] = 8;
|
|
1130
1130
|
for (let A = 144; A <= 255; A++) v[A] = 9;
|
|
1131
1131
|
for (let A = 256; A <= 279; A++) v[A] = 7;
|
|
1132
1132
|
for (let A = 280; A <= 287; A++) v[A] = 8;
|
|
1133
|
-
|
|
1133
|
+
g = V(v), m = V(Array(32).fill(5));
|
|
1134
1134
|
} else {
|
|
1135
1135
|
const v = r.readBits(5) + 257, A = r.readBits(5) + 1, p = r.readBits(4) + 4, y = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], E = Array(19).fill(0);
|
|
1136
1136
|
for (let T = 0; T < p; T++) E[y[T]] = r.readBits(3);
|
|
1137
|
-
const
|
|
1138
|
-
for (;
|
|
1139
|
-
const T = ot(r,
|
|
1140
|
-
if (T <= 15)
|
|
1137
|
+
const b = V(E), x = [];
|
|
1138
|
+
for (; x.length < v + A; ) {
|
|
1139
|
+
const T = ot(r, b);
|
|
1140
|
+
if (T <= 15) x.push(T);
|
|
1141
1141
|
else if (T === 16) {
|
|
1142
|
-
const S = r.readBits(2) + 3,
|
|
1143
|
-
for (let
|
|
1142
|
+
const S = r.readBits(2) + 3, C = x[x.length - 1] || 0;
|
|
1143
|
+
for (let Q = 0; Q < S; Q++) x.push(C);
|
|
1144
1144
|
} else if (T === 17) {
|
|
1145
1145
|
const S = r.readBits(3) + 3;
|
|
1146
|
-
for (let
|
|
1146
|
+
for (let C = 0; C < S; C++) x.push(0);
|
|
1147
1147
|
} else {
|
|
1148
1148
|
if (T !== 18) throw Error("Invalid code length symbol");
|
|
1149
1149
|
{
|
|
1150
1150
|
const S = r.readBits(7) + 11;
|
|
1151
|
-
for (let
|
|
1151
|
+
for (let C = 0; C < S; C++) x.push(0);
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
1154
|
}
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1155
|
+
const F = x.slice(0, v), N = x.slice(v, v + A);
|
|
1156
|
+
g = V(F), m = V(N);
|
|
1157
1157
|
}
|
|
1158
1158
|
for (; ; ) {
|
|
1159
|
-
const v = ot(r,
|
|
1159
|
+
const v = ot(r, g);
|
|
1160
1160
|
if (v < 256) h.push(v);
|
|
1161
1161
|
else {
|
|
1162
1162
|
if (v === 256) break;
|
|
@@ -1165,35 +1165,35 @@ function ye(n) {
|
|
|
1165
1165
|
let p = o[A];
|
|
1166
1166
|
const y = c[A];
|
|
1167
1167
|
y && (p += r.readBits(y));
|
|
1168
|
-
const E = ot(r,
|
|
1168
|
+
const E = ot(r, m);
|
|
1169
1169
|
if (E >= 30) throw Error("Invalid distance symbol");
|
|
1170
|
-
let
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1173
|
-
const
|
|
1174
|
-
if (
|
|
1175
|
-
for (let N = 0; N < p; N++) h.push(h[
|
|
1170
|
+
let b = l[E];
|
|
1171
|
+
const x = u[E];
|
|
1172
|
+
x && (b += r.readBits(x));
|
|
1173
|
+
const F = h.length - b;
|
|
1174
|
+
if (F < 0) throw Error("Invalid distance");
|
|
1175
|
+
for (let N = 0; N < p; N++) h.push(h[F + N] || 0);
|
|
1176
1176
|
} else if (v === 286 || v === 287) throw Error("Reserved length symbol");
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
1179
1179
|
}
|
|
1180
1180
|
}
|
|
1181
1181
|
}
|
|
1182
|
-
}(new
|
|
1182
|
+
}(new Ee(n.subarray(i)), s), new Uint8Array(s);
|
|
1183
1183
|
}
|
|
1184
1184
|
function we(n) {
|
|
1185
|
-
const t =
|
|
1185
|
+
const t = R, e = new Uint8Array(n);
|
|
1186
1186
|
if (t.readASCII(e, 0, 4) !== "wOFF") throw Error("Invalid WOFF signature");
|
|
1187
1187
|
const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), h = [];
|
|
1188
1188
|
let o = 44;
|
|
1189
1189
|
for (let p = 0; p < s; p++) {
|
|
1190
|
-
const y = t.readASCII(e, o, 4), E = t.readUint(e, o + 4),
|
|
1191
|
-
h.push({ tag: y, offset: E, compLength:
|
|
1190
|
+
const y = t.readASCII(e, o, 4), E = t.readUint(e, o + 4), b = t.readUint(e, o + 8), x = t.readUint(e, o + 12), F = t.readUint(e, o + 16);
|
|
1191
|
+
h.push({ tag: y, offset: E, compLength: b, origLength: x, checksum: F }), o += 20;
|
|
1192
1192
|
}
|
|
1193
1193
|
for (const p of h) {
|
|
1194
1194
|
const y = new Uint8Array(e.buffer, p.offset, p.compLength);
|
|
1195
1195
|
if (p.compLength === p.origLength) p.data = new Uint8Array(y);
|
|
1196
|
-
else if (p.data =
|
|
1196
|
+
else if (p.data = xe(y), p.data.length !== p.origLength) if (p.data.length < p.origLength) {
|
|
1197
1197
|
const E = new Uint8Array(p.origLength);
|
|
1198
1198
|
E.set(p.data), p.data = E;
|
|
1199
1199
|
} else p.data = p.data.subarray(0, p.origLength);
|
|
@@ -1201,42 +1201,42 @@ function we(n) {
|
|
|
1201
1201
|
const c = s;
|
|
1202
1202
|
let l = 1, u = 0;
|
|
1203
1203
|
for (; l << 1 <= c; ) l <<= 1, u++;
|
|
1204
|
-
const f = 16 * l,
|
|
1205
|
-
let
|
|
1206
|
-
const
|
|
1207
|
-
for (const p of h)
|
|
1208
|
-
const v = new Uint8Array(Math.max(r || 0,
|
|
1209
|
-
|
|
1204
|
+
const f = 16 * l, d = 16 * c - f;
|
|
1205
|
+
let g = 12 + 16 * c;
|
|
1206
|
+
const m = {};
|
|
1207
|
+
for (const p of h) m[p.tag] = g, g = q(g + p.data.length);
|
|
1208
|
+
const v = new Uint8Array(Math.max(r || 0, g));
|
|
1209
|
+
L(v, 0, i), J(v, 4, c), J(v, 6, f), J(v, 8, u), J(v, 10, d);
|
|
1210
1210
|
let A = 12;
|
|
1211
1211
|
for (const p of h) {
|
|
1212
|
-
|
|
1212
|
+
Ae(v, A, p.tag), A += 4;
|
|
1213
1213
|
let y = p.data;
|
|
1214
1214
|
if (p.tag === "head" && y.length >= 12) {
|
|
1215
1215
|
const E = new Uint8Array(y);
|
|
1216
|
-
|
|
1216
|
+
L(E, 8, 0), L(v, A, ht(E, 0, q(E.length))), A += 4;
|
|
1217
1217
|
} else
|
|
1218
|
-
|
|
1219
|
-
|
|
1218
|
+
L(v, A, ht(y, 0, q(y.length))), A += 4;
|
|
1219
|
+
L(v, A, m[p.tag]), A += 4, L(v, A, p.data.length), A += 4;
|
|
1220
1220
|
}
|
|
1221
1221
|
for (const p of h) {
|
|
1222
|
-
const y =
|
|
1222
|
+
const y = m[p.tag];
|
|
1223
1223
|
v.set(p.data, y);
|
|
1224
1224
|
}
|
|
1225
1225
|
if (h.find((p) => p.tag === "head")) {
|
|
1226
|
-
const p =
|
|
1227
|
-
const
|
|
1228
|
-
|
|
1226
|
+
const p = m.head, y = function(E, b) {
|
|
1227
|
+
const x = b + 8, F = [E[x], E[x + 1], E[x + 2], E[x + 3]];
|
|
1228
|
+
L(E, x, 0);
|
|
1229
1229
|
const N = 2981146554 - (ht(E, 0, q(E.length)) >>> 0) >>> 0;
|
|
1230
|
-
return E[
|
|
1230
|
+
return E[x] = F[0], E[x + 1] = F[1], E[x + 2] = F[2], E[x + 3] = F[3], N >>> 0;
|
|
1231
1231
|
}(v, p);
|
|
1232
|
-
|
|
1232
|
+
L(v, p + 8, y);
|
|
1233
1233
|
}
|
|
1234
1234
|
return v.buffer;
|
|
1235
1235
|
}
|
|
1236
1236
|
const be = { parseTab(n, t, e) {
|
|
1237
1237
|
const i = { tables: [], ids: {}, off: t };
|
|
1238
1238
|
n = new Uint8Array(n.buffer, t, e), t = 0;
|
|
1239
|
-
const s =
|
|
1239
|
+
const s = R, r = s.readUshort, h = r(n, t += 2);
|
|
1240
1240
|
t += 2;
|
|
1241
1241
|
const o = [];
|
|
1242
1242
|
for (let c = 0; c < h; c++) {
|
|
@@ -1244,34 +1244,34 @@ const be = { parseTab(n, t, e) {
|
|
|
1244
1244
|
t += 2;
|
|
1245
1245
|
const f = s.readUint(n, t);
|
|
1246
1246
|
t += 4;
|
|
1247
|
-
const
|
|
1248
|
-
let
|
|
1249
|
-
if (
|
|
1250
|
-
let
|
|
1251
|
-
|
|
1247
|
+
const d = `p${l}e${u}`;
|
|
1248
|
+
let g = o.indexOf(f);
|
|
1249
|
+
if (g === -1) {
|
|
1250
|
+
let m;
|
|
1251
|
+
g = i.tables.length, o.push(f);
|
|
1252
1252
|
const v = r(n, f);
|
|
1253
|
-
|
|
1253
|
+
m = v === 4 ? this.parse4(n, f) : v === 12 ? this.parse12(n, f) : { format: v }, i.tables.push(m);
|
|
1254
1254
|
}
|
|
1255
|
-
i.ids[
|
|
1255
|
+
i.ids[d] = g;
|
|
1256
1256
|
}
|
|
1257
1257
|
return i;
|
|
1258
1258
|
}, parse4(n, t) {
|
|
1259
|
-
const e =
|
|
1259
|
+
const e = R, i = e.readUshort, s = e.readUshorts, r = t, h = i(n, t += 2);
|
|
1260
1260
|
t += 2;
|
|
1261
1261
|
const o = i(n, t += 2) >>> 1, c = { format: 4, searchRange: i(n, t += 2), entrySelector: 0, rangeShift: 0, endCount: [], startCount: [], idDelta: [], idRangeOffset: [], glyphIdArray: [] };
|
|
1262
1262
|
t += 2, c.entrySelector = i(n, t), t += 2, c.rangeShift = i(n, t), t += 2, c.endCount = s(n, t, o), t += 2 * o, t += 2, c.startCount = s(n, t, o), t += 2 * o;
|
|
1263
1263
|
for (let l = 0; l < o; l++) c.idDelta.push(e.readShort(n, t)), t += 2;
|
|
1264
1264
|
return c.idRangeOffset = s(n, t, o), t += 2 * o, c.glyphIdArray = s(n, t, r + h - t >> 1), c;
|
|
1265
1265
|
}, parse12(n, t) {
|
|
1266
|
-
const e =
|
|
1266
|
+
const e = R.readUint;
|
|
1267
1267
|
e(n, t += 4), e(n, t += 4);
|
|
1268
1268
|
const i = e(n, t += 4);
|
|
1269
1269
|
t += 4;
|
|
1270
1270
|
const s = new Uint32Array(3 * i);
|
|
1271
1271
|
for (let r = 0; r < 3 * i; r += 3) s[r] = e(n, t + (r << 2)), s[r + 1] = e(n, t + (r << 2) + 4), s[r + 2] = e(n, t + (r << 2) + 8);
|
|
1272
1272
|
return { format: 12, groups: s };
|
|
1273
|
-
} },
|
|
1274
|
-
const i =
|
|
1273
|
+
} }, Te = { parseTab(n, t, e) {
|
|
1274
|
+
const i = R;
|
|
1275
1275
|
t += 18;
|
|
1276
1276
|
const s = i.readUshort(n, t);
|
|
1277
1277
|
t += 2, t += 16;
|
|
@@ -1283,8 +1283,8 @@ const be = { parseTab(n, t, e) {
|
|
|
1283
1283
|
t += 2;
|
|
1284
1284
|
const c = i.readShort(n, t);
|
|
1285
1285
|
return t += 2, t += 6, { unitsPerEm: s, xMin: r, yMin: h, xMax: o, yMax: c, indexToLocFormat: i.readShort(n, t) };
|
|
1286
|
-
} },
|
|
1287
|
-
const i =
|
|
1286
|
+
} }, Re = { parseTab(n, t, e) {
|
|
1287
|
+
const i = R;
|
|
1288
1288
|
t += 4;
|
|
1289
1289
|
const s = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], r = {};
|
|
1290
1290
|
for (let h = 0; h < s.length; h++) {
|
|
@@ -1292,17 +1292,17 @@ const be = { parseTab(n, t, e) {
|
|
|
1292
1292
|
r[o] = c(n, t + 2 * h);
|
|
1293
1293
|
}
|
|
1294
1294
|
return r;
|
|
1295
|
-
} },
|
|
1296
|
-
const s =
|
|
1295
|
+
} }, Fe = { parseTab(n, t, e, i) {
|
|
1296
|
+
const s = R, r = [], h = [], o = i.maxp.numGlyphs, c = i.hhea.numberOfHMetrics;
|
|
1297
1297
|
let l = 0, u = 0, f = 0;
|
|
1298
1298
|
for (; f < c; ) l = s.readUshort(n, t + (f << 2)), u = s.readShort(n, t + (f << 2) + 2), r.push(l), h.push(u), f++;
|
|
1299
1299
|
for (; f < o; ) r.push(l), h.push(u), f++;
|
|
1300
1300
|
return { aWidth: r, lsBearing: h };
|
|
1301
|
-
} },
|
|
1302
|
-
const i =
|
|
1301
|
+
} }, wt = { cmap: be, head: Te, hhea: Re, maxp: { parseTab(n, t, e) {
|
|
1302
|
+
const i = R;
|
|
1303
1303
|
return i.readUint(n, t), t += 4, { numGlyphs: i.readUshort(n, t) };
|
|
1304
|
-
} }, hmtx:
|
|
1305
|
-
const s =
|
|
1304
|
+
} }, hmtx: Fe, loca: { parseTab(n, t, e, i) {
|
|
1305
|
+
const s = R, r = [], h = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
|
|
1306
1306
|
if (h === 0) for (let c = 0; c < o; c++) r.push(s.readUshort(n, t + (c << 1)) << 1);
|
|
1307
1307
|
else if (h === 1) for (let c = 0; c < o; c++) r.push(s.readUint(n, t + (c << 2)));
|
|
1308
1308
|
return r;
|
|
@@ -1311,49 +1311,49 @@ const be = { parseTab(n, t, e) {
|
|
|
1311
1311
|
for (let h = 0; h < r; h++) s.push(null);
|
|
1312
1312
|
return s;
|
|
1313
1313
|
}, Ee(n, t) {
|
|
1314
|
-
const e =
|
|
1314
|
+
const e = R, i = n.Se, s = n.loca;
|
|
1315
1315
|
if (s[t] === s[t + 1]) return null;
|
|
1316
|
-
const r =
|
|
1316
|
+
const r = W.findTable(i, "glyf", n.ke);
|
|
1317
1317
|
if (!r) return null;
|
|
1318
1318
|
let h = r[0] + s[t];
|
|
1319
1319
|
const o = {};
|
|
1320
1320
|
if (o.noc = e.readShort(i, h), h += 2, o.xMin = e.readShort(i, h), h += 2, o.yMin = e.readShort(i, h), h += 2, o.xMax = e.readShort(i, h), h += 2, o.yMax = e.readShort(i, h), h += 2, o.xMin >= o.xMax || o.yMin >= o.yMax) return null;
|
|
1321
1321
|
if (o.noc > 0) {
|
|
1322
1322
|
o.endPts = [];
|
|
1323
|
-
for (let
|
|
1323
|
+
for (let d = 0; d < o.noc; d++) o.endPts.push(e.readUshort(i, h)), h += 2;
|
|
1324
1324
|
const c = e.readUshort(i, h);
|
|
1325
1325
|
if (h += 2, i.length - h < c) return null;
|
|
1326
1326
|
h += c;
|
|
1327
1327
|
const l = o.endPts[o.noc - 1] + 1;
|
|
1328
1328
|
o.flags = [];
|
|
1329
|
-
for (let
|
|
1330
|
-
const
|
|
1331
|
-
if (h++, o.flags.push(
|
|
1332
|
-
const
|
|
1329
|
+
for (let d = 0; d < l; d++) {
|
|
1330
|
+
const g = i[h];
|
|
1331
|
+
if (h++, o.flags.push(g), 8 & g) {
|
|
1332
|
+
const m = i[h];
|
|
1333
1333
|
h++;
|
|
1334
|
-
for (let v = 0; v <
|
|
1334
|
+
for (let v = 0; v < m; v++) o.flags.push(g), d++;
|
|
1335
1335
|
}
|
|
1336
1336
|
}
|
|
1337
1337
|
o.xs = [];
|
|
1338
|
-
for (let
|
|
1339
|
-
const
|
|
1340
|
-
2 &
|
|
1338
|
+
for (let d = 0; d < l; d++) {
|
|
1339
|
+
const g = o.flags[d], m = !!(16 & g);
|
|
1340
|
+
2 & g ? (o.xs.push(m ? i[h] : -i[h]), h++) : m ? o.xs.push(0) : (o.xs.push(e.readShort(i, h)), h += 2);
|
|
1341
1341
|
}
|
|
1342
1342
|
o.ys = [];
|
|
1343
|
-
for (let
|
|
1344
|
-
const
|
|
1345
|
-
4 &
|
|
1343
|
+
for (let d = 0; d < l; d++) {
|
|
1344
|
+
const g = o.flags[d], m = !!(32 & g);
|
|
1345
|
+
4 & g ? (o.ys.push(m ? i[h] : -i[h]), h++) : m ? o.ys.push(0) : (o.ys.push(e.readShort(i, h)), h += 2);
|
|
1346
1346
|
}
|
|
1347
1347
|
let u = 0, f = 0;
|
|
1348
|
-
for (let
|
|
1348
|
+
for (let d = 0; d < l; d++) u += o.xs[d], f += o.ys[d], o.xs[d] = u, o.ys[d] = f;
|
|
1349
1349
|
} else o.parts = [], o.endPts = [], o.flags = [], o.xs = [], o.ys = [];
|
|
1350
1350
|
return o;
|
|
1351
|
-
} } },
|
|
1351
|
+
} } }, W = { parse(n) {
|
|
1352
1352
|
const t = new Uint8Array(n);
|
|
1353
|
-
|
|
1354
|
-
const e = new Uint8Array(n), i =
|
|
1353
|
+
R.readASCII(t, 0, 4) === "wOFF" && (n = we(n));
|
|
1354
|
+
const e = new Uint8Array(n), i = wt, s = {}, r = { Se: e, ze: 0, ke: 0 };
|
|
1355
1355
|
for (const h in i) {
|
|
1356
|
-
const o = h, c =
|
|
1356
|
+
const o = h, c = W.findTable(e, o, 0);
|
|
1357
1357
|
if (c) {
|
|
1358
1358
|
const [l, u] = c;
|
|
1359
1359
|
let f = s[l];
|
|
@@ -1362,7 +1362,7 @@ const be = { parseTab(n, t, e) {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
return [r];
|
|
1364
1364
|
}, findTable(n, t, e) {
|
|
1365
|
-
const i =
|
|
1365
|
+
const i = R, s = i.readUshort(n, e + 4);
|
|
1366
1366
|
let r = e + 12;
|
|
1367
1367
|
for (let h = 0; h < s; h++) {
|
|
1368
1368
|
const o = i.readASCII(n, r, 4);
|
|
@@ -1372,8 +1372,8 @@ const be = { parseTab(n, t, e) {
|
|
|
1372
1372
|
r += 16;
|
|
1373
1373
|
}
|
|
1374
1374
|
return null;
|
|
1375
|
-
}, T:
|
|
1376
|
-
class
|
|
1375
|
+
}, T: wt, B: R };
|
|
1376
|
+
class Ce {
|
|
1377
1377
|
De(t) {
|
|
1378
1378
|
var i;
|
|
1379
1379
|
const e = [];
|
|
@@ -1429,7 +1429,7 @@ class Re {
|
|
|
1429
1429
|
return 0;
|
|
1430
1430
|
}
|
|
1431
1431
|
}
|
|
1432
|
-
class
|
|
1432
|
+
class Pe {
|
|
1433
1433
|
constructor(t) {
|
|
1434
1434
|
a(this, "Be");
|
|
1435
1435
|
a(this, "He");
|
|
@@ -1450,7 +1450,7 @@ class Fe {
|
|
|
1450
1450
|
for (let o = 0; o < t.length; o++) {
|
|
1451
1451
|
const c = o % i, l = Math.floor(o / i), u = t[o].glyphData;
|
|
1452
1452
|
if (!u) continue;
|
|
1453
|
-
const f = u.advanceWidth * h,
|
|
1453
|
+
const f = u.advanceWidth * h, d = c * e.width, g = l * e.height, m = d + 0.5 * e.width, v = g + 0.5 * e.height, A = Math.round(m - 0.5 * e.width), p = Math.round(v - 0.5 * s), y = A + 0.5 * (e.width - f), E = p + r.hhea.ascender * h;
|
|
1454
1454
|
this.Xe(u, y, E, h);
|
|
1455
1455
|
}
|
|
1456
1456
|
}
|
|
@@ -1464,31 +1464,31 @@ class Fe {
|
|
|
1464
1464
|
const f = o[u];
|
|
1465
1465
|
if (!(f < l)) {
|
|
1466
1466
|
if (f >= l) {
|
|
1467
|
-
const
|
|
1468
|
-
this.He.moveTo(
|
|
1469
|
-
let
|
|
1470
|
-
for (;
|
|
1471
|
-
if (1 & c[
|
|
1472
|
-
const v = e + r[
|
|
1473
|
-
this.He.lineTo(v, A),
|
|
1467
|
+
const d = e + r[l] * s, g = i - h[l] * s;
|
|
1468
|
+
this.He.moveTo(d, g);
|
|
1469
|
+
let m = l + 1;
|
|
1470
|
+
for (; m <= f; )
|
|
1471
|
+
if (1 & c[m]) {
|
|
1472
|
+
const v = e + r[m] * s, A = i - h[m] * s;
|
|
1473
|
+
this.He.lineTo(v, A), m++;
|
|
1474
1474
|
} else {
|
|
1475
|
-
const v = e + r[
|
|
1476
|
-
if (
|
|
1475
|
+
const v = e + r[m] * s, A = i - h[m] * s;
|
|
1476
|
+
if (m + 1 > f) {
|
|
1477
1477
|
const y = e + r[l] * s, E = i - h[l] * s;
|
|
1478
1478
|
if (1 & c[l]) this.He.quadraticCurveTo(v, A, y, E);
|
|
1479
1479
|
else {
|
|
1480
|
-
const
|
|
1481
|
-
this.He.quadraticCurveTo(v, A,
|
|
1480
|
+
const b = (v + y) / 2, x = (A + E) / 2;
|
|
1481
|
+
this.He.quadraticCurveTo(v, A, b, x);
|
|
1482
1482
|
}
|
|
1483
1483
|
break;
|
|
1484
1484
|
}
|
|
1485
|
-
const p =
|
|
1485
|
+
const p = m + 1;
|
|
1486
1486
|
if (1 & c[p]) {
|
|
1487
1487
|
const y = e + r[p] * s, E = i - h[p] * s;
|
|
1488
|
-
this.He.quadraticCurveTo(v, A, y, E),
|
|
1488
|
+
this.He.quadraticCurveTo(v, A, y, E), m = p + 1;
|
|
1489
1489
|
} else {
|
|
1490
1490
|
const y = (v + (e + r[p] * s)) / 2, E = (A + (i - h[p] * s)) / 2;
|
|
1491
|
-
this.He.quadraticCurveTo(v, A, y, E),
|
|
1491
|
+
this.He.quadraticCurveTo(v, A, y, E), m = p;
|
|
1492
1492
|
}
|
|
1493
1493
|
}
|
|
1494
1494
|
this.He.closePath();
|
|
@@ -1504,10 +1504,10 @@ class Nt {
|
|
|
1504
1504
|
const i = t.cmap;
|
|
1505
1505
|
if (!i || !i.tables) return 0;
|
|
1506
1506
|
let s = 0;
|
|
1507
|
-
for (const r of i.tables) if (r.format === 4 ? s = this.je(e, r) : r.format === 12 && (s = this.
|
|
1507
|
+
for (const r of i.tables) if (r.format === 4 ? s = this.je(e, r) : r.format === 12 && (s = this.We(e, r)), s > 0) break;
|
|
1508
1508
|
return s;
|
|
1509
1509
|
}
|
|
1510
|
-
|
|
1510
|
+
Ke(t, e) {
|
|
1511
1511
|
const i = e.codePointAt(0);
|
|
1512
1512
|
return i === void 0 ? 0 : this.Ye(t, i);
|
|
1513
1513
|
}
|
|
@@ -1537,7 +1537,7 @@ class Nt {
|
|
|
1537
1537
|
}
|
|
1538
1538
|
return 0;
|
|
1539
1539
|
}
|
|
1540
|
-
|
|
1540
|
+
We(t, e) {
|
|
1541
1541
|
const i = e.groups.length / 3;
|
|
1542
1542
|
for (let s = 0; s < i; s++) {
|
|
1543
1543
|
const r = e.groups[3 * s], h = e.groups[3 * s + 1], o = e.groups[3 * s + 2];
|
|
@@ -1546,7 +1546,7 @@ class Nt {
|
|
|
1546
1546
|
return 0;
|
|
1547
1547
|
}
|
|
1548
1548
|
}
|
|
1549
|
-
class
|
|
1549
|
+
class Me {
|
|
1550
1550
|
constructor() {
|
|
1551
1551
|
a(this, "Ve");
|
|
1552
1552
|
this.Ve = new Nt();
|
|
@@ -1555,7 +1555,7 @@ class Pe {
|
|
|
1555
1555
|
let s = 0;
|
|
1556
1556
|
const r = this.Ve.qe(i, e), h = r.lineHeight;
|
|
1557
1557
|
for (const o of t) {
|
|
1558
|
-
const c = this.Ve.
|
|
1558
|
+
const c = this.Ve.Ke(i, o);
|
|
1559
1559
|
if (c === 0) continue;
|
|
1560
1560
|
const l = this.Ve.Ze(i, c) * r.scale;
|
|
1561
1561
|
s = Math.max(s, l);
|
|
@@ -1563,7 +1563,7 @@ class Pe {
|
|
|
1563
1563
|
return { width: Math.ceil(s), height: Math.ceil(h) };
|
|
1564
1564
|
}
|
|
1565
1565
|
}
|
|
1566
|
-
class
|
|
1566
|
+
class Ne {
|
|
1567
1567
|
constructor() {
|
|
1568
1568
|
a(this, "tr");
|
|
1569
1569
|
this.tr = new Nt();
|
|
@@ -1583,11 +1583,11 @@ class Me {
|
|
|
1583
1583
|
if (s === 0) return null;
|
|
1584
1584
|
let r = 0;
|
|
1585
1585
|
t.hmtx && t.hmtx.aWidth && s > 0 && t.hmtx.aWidth[s] !== void 0 && (r = t.hmtx.aWidth[s]);
|
|
1586
|
-
const h =
|
|
1586
|
+
const h = W.T.glyf.Ee(t, s);
|
|
1587
1587
|
return h ? { ...h, advanceWidth: r } : null;
|
|
1588
1588
|
}
|
|
1589
1589
|
}
|
|
1590
|
-
class
|
|
1590
|
+
class mt {
|
|
1591
1591
|
constructor(t, e = 16) {
|
|
1592
1592
|
a(this, "rr");
|
|
1593
1593
|
a(this, "nr", []);
|
|
@@ -1602,7 +1602,7 @@ class vt {
|
|
|
1602
1602
|
a(this, "gr");
|
|
1603
1603
|
a(this, "mr");
|
|
1604
1604
|
a(this, "_r");
|
|
1605
|
-
this.cr = e, this.pr = new
|
|
1605
|
+
this.cr = e, this.pr = new Ce(), this.gr = new Pe(t), this.mr = new Me(), this._r = new Ne();
|
|
1606
1606
|
}
|
|
1607
1607
|
async yr(t) {
|
|
1608
1608
|
let e;
|
|
@@ -1612,9 +1612,9 @@ class vt {
|
|
|
1612
1612
|
e = await i.arrayBuffer();
|
|
1613
1613
|
} else
|
|
1614
1614
|
e = await (await fetch("data:font/woff;base64,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")).arrayBuffer();
|
|
1615
|
-
await this.Ar(e), this.rr =
|
|
1615
|
+
await this.Ar(e), this.rr = W.parse(e)[0], await this.br();
|
|
1616
1616
|
}
|
|
1617
|
-
|
|
1617
|
+
wr(t) {
|
|
1618
1618
|
if (t === void 0) return this.cr;
|
|
1619
1619
|
this.cr = t, this.dr = this.mr.Je(this.nr.map((i) => i.character), this.cr, this.rr);
|
|
1620
1620
|
const e = this.gr.Ge(this.nr, this.dr, this.cr, this.rr);
|
|
@@ -1626,9 +1626,9 @@ class vt {
|
|
|
1626
1626
|
if (!e.ok) throw new U(`Failed to load font file: ${e.status} ${e.statusText}`);
|
|
1627
1627
|
const i = await e.arrayBuffer();
|
|
1628
1628
|
await this.Ar(i);
|
|
1629
|
-
const s =
|
|
1629
|
+
const s = W.parse(i);
|
|
1630
1630
|
if (!s || s.length === 0) throw Error("Failed to parse font file");
|
|
1631
|
-
this.rr = s[0], await this.
|
|
1631
|
+
this.rr = s[0], await this.br();
|
|
1632
1632
|
} catch (e) {
|
|
1633
1633
|
throw new U("Failed to load font: " + (e instanceof Error ? e.message : "Unknown error"), e);
|
|
1634
1634
|
}
|
|
@@ -1637,7 +1637,7 @@ class vt {
|
|
|
1637
1637
|
const e = Date.now();
|
|
1638
1638
|
this.vr = new FontFace("CustomFont_" + e, t), await this.vr.load(), document.fonts.add(this.vr);
|
|
1639
1639
|
}
|
|
1640
|
-
async
|
|
1640
|
+
async br() {
|
|
1641
1641
|
const t = this.pr.De(this.rr), { array: e, map: i } = this._r.sr(t, this.rr);
|
|
1642
1642
|
this.nr = e, this.hr = i, this.dr = this.mr.Je(t, this.cr, this.rr);
|
|
1643
1643
|
const s = this.gr.Ge(this.nr, this.dr, this.cr, this.rr);
|
|
@@ -1725,17 +1725,17 @@ class Ut {
|
|
|
1725
1725
|
return this.Rr;
|
|
1726
1726
|
}
|
|
1727
1727
|
}
|
|
1728
|
-
const
|
|
1728
|
+
const Ue = /^rgba?\(([^)]+)\)$/i;
|
|
1729
1729
|
function at(n) {
|
|
1730
1730
|
return Number.isNaN(n) ? 0 : Math.max(0, Math.min(255, n));
|
|
1731
1731
|
}
|
|
1732
|
-
function
|
|
1732
|
+
function Se(n) {
|
|
1733
1733
|
if (!n) return null;
|
|
1734
1734
|
const t = n.trim().toLowerCase();
|
|
1735
1735
|
if (!t) return null;
|
|
1736
1736
|
let e = null;
|
|
1737
1737
|
return t.startsWith("rgb") && (e = function(i) {
|
|
1738
|
-
const s =
|
|
1738
|
+
const s = Ue.exec(i.trim());
|
|
1739
1739
|
if (!s) return null;
|
|
1740
1740
|
const r = s[1].split(",").map((u) => u.trim());
|
|
1741
1741
|
if (r.length < 3) return null;
|
|
@@ -1743,7 +1743,7 @@ function Ue(n) {
|
|
|
1743
1743
|
return [h, o, c, Math.round(l)];
|
|
1744
1744
|
}(t)), e ? e[3] === 0 ? null : e : null;
|
|
1745
1745
|
}
|
|
1746
|
-
class
|
|
1746
|
+
class De {
|
|
1747
1747
|
constructor(t = {}) {
|
|
1748
1748
|
a(this, "Er");
|
|
1749
1749
|
a(this, "Dr", null);
|
|
@@ -1781,7 +1781,7 @@ class Se {
|
|
|
1781
1781
|
const t = this.Qr();
|
|
1782
1782
|
for (const e of t) {
|
|
1783
1783
|
if (!e) continue;
|
|
1784
|
-
const i =
|
|
1784
|
+
const i = Se(window.getComputedStyle(e).backgroundColor);
|
|
1785
1785
|
if (i) return i;
|
|
1786
1786
|
}
|
|
1787
1787
|
return [255, 255, 255, 255];
|
|
@@ -1828,19 +1828,19 @@ class Se {
|
|
|
1828
1828
|
}
|
|
1829
1829
|
}
|
|
1830
1830
|
function $(n) {
|
|
1831
|
-
return
|
|
1831
|
+
return Z(parseInt(n, 16), 0, 255);
|
|
1832
1832
|
}
|
|
1833
1833
|
class M {
|
|
1834
1834
|
constructor(t, e, i, s) {
|
|
1835
1835
|
a(this, "jr");
|
|
1836
|
-
a(this, "
|
|
1836
|
+
a(this, "Wr");
|
|
1837
1837
|
a(this, "r");
|
|
1838
1838
|
a(this, "g");
|
|
1839
1839
|
a(this, "b");
|
|
1840
1840
|
a(this, "a");
|
|
1841
|
-
this.r =
|
|
1841
|
+
this.r = Z(t, 0, 255), this.g = Z(e, 0, 255), this.b = Z(i, 0, 255), this.a = Z(s, 0, 255), this.jr = [this.r, this.g, this.b, this.a], this.Wr = [this.r / 255, this.g / 255, this.b / 255, this.a / 255];
|
|
1842
1842
|
}
|
|
1843
|
-
static
|
|
1843
|
+
static Kr(t, e, i, s) {
|
|
1844
1844
|
if (M.Zr(t)) return t;
|
|
1845
1845
|
if (Array.isArray(t)) {
|
|
1846
1846
|
if (t.length < 3) throw Error("Component tuples must include at least RGB values.");
|
|
@@ -1876,7 +1876,7 @@ class M {
|
|
|
1876
1876
|
return [...this.jr];
|
|
1877
1877
|
}
|
|
1878
1878
|
get normalized() {
|
|
1879
|
-
return [...this.
|
|
1879
|
+
return [...this.Wr];
|
|
1880
1880
|
}
|
|
1881
1881
|
withAlpha(t) {
|
|
1882
1882
|
return new M(this.r, this.g, this.b, t);
|
|
@@ -1889,10 +1889,10 @@ const pt = /* @__PURE__ */ new Map();
|
|
|
1889
1889
|
function Le(n) {
|
|
1890
1890
|
pt.set(n.id, n);
|
|
1891
1891
|
}
|
|
1892
|
-
function
|
|
1892
|
+
function $e(n) {
|
|
1893
1893
|
pt.delete(n);
|
|
1894
1894
|
}
|
|
1895
|
-
function
|
|
1895
|
+
function _e(n) {
|
|
1896
1896
|
return pt.get(n);
|
|
1897
1897
|
}
|
|
1898
1898
|
class St {
|
|
@@ -1967,7 +1967,7 @@ class St {
|
|
|
1967
1967
|
const e = [];
|
|
1968
1968
|
for (const i of t) {
|
|
1969
1969
|
if (e.length >= 64) break;
|
|
1970
|
-
let s = M.
|
|
1970
|
+
let s = M.Kr(i);
|
|
1971
1971
|
e.push(s.normalized);
|
|
1972
1972
|
}
|
|
1973
1973
|
return this.dn = e, this.vn = e.length, this.q = null, this;
|
|
@@ -2000,11 +2000,11 @@ class St {
|
|
|
2000
2000
|
}
|
|
2001
2001
|
ft() {
|
|
2002
2002
|
this.yn();
|
|
2003
|
-
const t = this.An(), e = this.
|
|
2003
|
+
const t = this.An(), e = this.bn(), i = t.createShader(e), s = t.createUniforms(e);
|
|
2004
2004
|
this.q = this.Z.materialManager.Ni(i, s);
|
|
2005
2005
|
}
|
|
2006
2006
|
gn(t, e, i, s, r) {
|
|
2007
|
-
const h = M.
|
|
2007
|
+
const h = M.Kr(e, i, s, r);
|
|
2008
2008
|
tt(t, h.r, h.g, h.b, h.a);
|
|
2009
2009
|
}
|
|
2010
2010
|
mn(t) {
|
|
@@ -2013,15 +2013,15 @@ class St {
|
|
|
2013
2013
|
}
|
|
2014
2014
|
createBaseConversionUniforms() {
|
|
2015
2015
|
const t = this.vn > 0;
|
|
2016
|
-
return { u_image: this.
|
|
2016
|
+
return { u_image: this.wn(), u_invert: !!this.Rt, u_flipX: !!this.Gt, u_flipY: !!this.Qt, u_charRotation: this.Et, u_charColorFixed: this.hn === "fixed", u_charColor: this.Xt, u_cellColorFixed: this.an === "fixed", u_cellColor: this.Yt, u_backgroundColor: this.cn, u_charCount: this.ln.length, u_charList: this.ln, u_colorFilterEnabled: t, u_colorFilterSize: t ? this.vn : 0, u_colorFilterPalette: this.dn };
|
|
2017
2017
|
}
|
|
2018
2018
|
An() {
|
|
2019
2019
|
if (this.nn && this.nn.id === this.rn) return this.nn;
|
|
2020
|
-
const t =
|
|
2020
|
+
const t = _e(this.rn);
|
|
2021
2021
|
if (!t) throw Error(`[textmode.js] Conversion mode "${this.rn}" is not registered. If this mode is provided by an add-on, make sure its plugin is installed before loading sources.`);
|
|
2022
2022
|
return this.nn = t, t;
|
|
2023
2023
|
}
|
|
2024
|
-
|
|
2024
|
+
bn() {
|
|
2025
2025
|
return { renderer: this.Z, gl: this.A, font: this.rr, source: this, gridWidth: this.N, gridHeight: this.X };
|
|
2026
2026
|
}
|
|
2027
2027
|
}
|
|
@@ -2036,11 +2036,11 @@ class I extends St {
|
|
|
2036
2036
|
const c = i.naturalWidth ?? i.width ?? i.videoWidth ?? 0, l = i.naturalHeight ?? i.height ?? i.videoHeight ?? 0;
|
|
2037
2037
|
return new I(h, t, o, e, c, l, s, r);
|
|
2038
2038
|
}
|
|
2039
|
-
|
|
2039
|
+
wn() {
|
|
2040
2040
|
return this.tn;
|
|
2041
2041
|
}
|
|
2042
2042
|
}
|
|
2043
|
-
class
|
|
2043
|
+
class Dt {
|
|
2044
2044
|
constructor(t = 60) {
|
|
2045
2045
|
a(this, "xn");
|
|
2046
2046
|
a(this, "Mn", null);
|
|
@@ -2102,15 +2102,15 @@ class Lt {
|
|
|
2102
2102
|
this.Sn++;
|
|
2103
2103
|
}
|
|
2104
2104
|
}
|
|
2105
|
-
class
|
|
2105
|
+
class Lt {
|
|
2106
2106
|
constructor(t) {
|
|
2107
2107
|
a(this, "Er");
|
|
2108
2108
|
a(this, "Nn");
|
|
2109
2109
|
a(this, "Xn", { x: -1, y: -1 });
|
|
2110
2110
|
a(this, "Yn", { x: -1, y: -1 });
|
|
2111
2111
|
a(this, "jn", null);
|
|
2112
|
-
a(this, "
|
|
2113
|
-
a(this, "
|
|
2112
|
+
a(this, "Wn", 0);
|
|
2113
|
+
a(this, "Kn");
|
|
2114
2114
|
a(this, "Zn");
|
|
2115
2115
|
a(this, "qn");
|
|
2116
2116
|
a(this, "Vn");
|
|
@@ -2126,10 +2126,10 @@ class Dt {
|
|
|
2126
2126
|
}
|
|
2127
2127
|
oh(t) {
|
|
2128
2128
|
const e = performance.now() + Math.max(0, t);
|
|
2129
|
-
e > this.
|
|
2129
|
+
e > this.Wn && (this.Wn = e);
|
|
2130
2130
|
}
|
|
2131
2131
|
ah() {
|
|
2132
|
-
return performance.now() < this.
|
|
2132
|
+
return performance.now() < this.Wn;
|
|
2133
2133
|
}
|
|
2134
2134
|
uh(t) {
|
|
2135
2135
|
const e = this.Er.canvas;
|
|
@@ -2141,7 +2141,7 @@ class Dt {
|
|
|
2141
2141
|
dh() {
|
|
2142
2142
|
if (this.sh) return;
|
|
2143
2143
|
const t = this.Er.canvas;
|
|
2144
|
-
this.
|
|
2144
|
+
this.Kn = (e) => {
|
|
2145
2145
|
this.ph(e), this.gh(e);
|
|
2146
2146
|
}, this.Zn = () => {
|
|
2147
2147
|
this.Yn = { ...this.Xn }, this.Xn.x = -1, this.Xn.y = -1, this.jn = null;
|
|
@@ -2153,12 +2153,12 @@ class Dt {
|
|
|
2153
2153
|
this.ph(e), this.yh(e);
|
|
2154
2154
|
}, this.th = (e) => {
|
|
2155
2155
|
this.ph(e), this.Ah(e);
|
|
2156
|
-
}, t.addEventListener("mousemove", this.
|
|
2156
|
+
}, t.addEventListener("mousemove", this.Kn, { passive: !0 }), t.addEventListener("mouseleave", this.Zn, { passive: !0 }), t.addEventListener("mousedown", this.qn, { passive: !0 }), t.addEventListener("mouseup", this.Vn, { passive: !0 }), t.addEventListener("click", this.Jn, { passive: !0 }), t.addEventListener("wheel", this.th, { passive: !1 }), this.sh = !0;
|
|
2157
2157
|
}
|
|
2158
|
-
|
|
2158
|
+
bh() {
|
|
2159
2159
|
if (!this.sh) return;
|
|
2160
2160
|
const t = this.Er.canvas;
|
|
2161
|
-
t.removeEventListener("mousemove", this.
|
|
2161
|
+
t.removeEventListener("mousemove", this.Kn), t.removeEventListener("mouseleave", this.Zn), t.removeEventListener("mousedown", this.qn), t.removeEventListener("mouseup", this.Vn), t.removeEventListener("click", this.Jn), t.removeEventListener("wheel", this.th), this.sh = !1;
|
|
2162
2162
|
}
|
|
2163
2163
|
fh() {
|
|
2164
2164
|
if (this.sh) try {
|
|
@@ -2170,7 +2170,7 @@ class Dt {
|
|
|
2170
2170
|
this.Xn.x = -1, this.Xn.y = -1;
|
|
2171
2171
|
}
|
|
2172
2172
|
}
|
|
2173
|
-
|
|
2173
|
+
wh(t) {
|
|
2174
2174
|
this.ih = t;
|
|
2175
2175
|
}
|
|
2176
2176
|
Ch(t) {
|
|
@@ -2225,8 +2225,8 @@ class Dt {
|
|
|
2225
2225
|
u >= 0 && u < this.Nn.cols && f >= 0 && f < this.Nn.rows ? (this.Xn.x = u, this.Xn.y = f) : (this.Xn.x = -1, this.Xn.y = -1);
|
|
2226
2226
|
}
|
|
2227
2227
|
}
|
|
2228
|
-
const
|
|
2229
|
-
class
|
|
2228
|
+
const Be = Object.freeze(Object.defineProperty({ __proto__: null, MouseManager: Lt }, Symbol.toStringTag, { value: "Module" }));
|
|
2229
|
+
class _t {
|
|
2230
2230
|
constructor() {
|
|
2231
2231
|
a(this, "$h", /* @__PURE__ */ new Map());
|
|
2232
2232
|
a(this, "Th", null);
|
|
@@ -2245,7 +2245,7 @@ class Zt {
|
|
|
2245
2245
|
this.Oh(t);
|
|
2246
2246
|
}, window.addEventListener("keydown", this.Eh, { passive: !1 }), window.addEventListener("keyup", this.Sh, { passive: !1 }), this.sh = !0);
|
|
2247
2247
|
}
|
|
2248
|
-
|
|
2248
|
+
bh() {
|
|
2249
2249
|
this.sh && (window.removeEventListener("keydown", this.Eh), window.removeEventListener("keyup", this.Sh), this.sh = !1, this.$h.clear(), this.Th = null, this.Rh = null);
|
|
2250
2250
|
}
|
|
2251
2251
|
Ch(t) {
|
|
@@ -2297,15 +2297,15 @@ class Zt {
|
|
|
2297
2297
|
return this.Dh[t] || t.toLowerCase();
|
|
2298
2298
|
}
|
|
2299
2299
|
}
|
|
2300
|
-
const
|
|
2300
|
+
const Xe = Object.freeze(Object.defineProperty({ __proto__: null, KeyboardManager: _t }, Symbol.toStringTag, { value: "Module" }));
|
|
2301
2301
|
class Bt {
|
|
2302
2302
|
constructor(t, e) {
|
|
2303
2303
|
a(this, "Er");
|
|
2304
2304
|
a(this, "Yh");
|
|
2305
2305
|
a(this, "Nn");
|
|
2306
2306
|
a(this, "jh", /* @__PURE__ */ new Map());
|
|
2307
|
-
a(this, "Kh", /* @__PURE__ */ new Map());
|
|
2308
2307
|
a(this, "Wh", /* @__PURE__ */ new Map());
|
|
2308
|
+
a(this, "Kh", /* @__PURE__ */ new Map());
|
|
2309
2309
|
a(this, "Zh", null);
|
|
2310
2310
|
a(this, "qh");
|
|
2311
2311
|
a(this, "Vh");
|
|
@@ -2330,8 +2330,8 @@ class Bt {
|
|
|
2330
2330
|
a(this, "_o", 550);
|
|
2331
2331
|
a(this, "yo", 14);
|
|
2332
2332
|
a(this, "Ao", 48);
|
|
2333
|
-
a(this, "
|
|
2334
|
-
a(this, "
|
|
2333
|
+
a(this, "bo", 650);
|
|
2334
|
+
a(this, "wo", 0.02);
|
|
2335
2335
|
a(this, "Co", 2);
|
|
2336
2336
|
a(this, "xo", 600);
|
|
2337
2337
|
a(this, "Mo", 0);
|
|
@@ -2356,12 +2356,12 @@ class Bt {
|
|
|
2356
2356
|
this.Ro(e);
|
|
2357
2357
|
}, t.addEventListener("touchstart", this.Jh, { passive: !1 }), t.addEventListener("touchmove", this.so, { passive: !1 }), t.addEventListener("touchend", this.io, { passive: !1 }), t.addEventListener("touchcancel", this.eo, { passive: !1 }), this.sh = !0;
|
|
2358
2358
|
}
|
|
2359
|
-
|
|
2359
|
+
bh() {
|
|
2360
2360
|
if (!this.sh) return;
|
|
2361
2361
|
const t = this.Er.canvas;
|
|
2362
|
-
t.removeEventListener("touchstart", this.Jh), t.removeEventListener("touchmove", this.so), t.removeEventListener("touchend", this.io), t.removeEventListener("touchcancel", this.eo), this.sh = !1, this.Zh = null, this.jh.clear(), this.
|
|
2362
|
+
t.removeEventListener("touchstart", this.Jh), t.removeEventListener("touchmove", this.so), t.removeEventListener("touchend", this.io), t.removeEventListener("touchcancel", this.eo), this.sh = !1, this.Zh = null, this.jh.clear(), this.Wh.clear(), this.Kh.forEach((e) => {
|
|
2363
2363
|
e.longPressTimer !== null && window.clearTimeout(e.longPressTimer);
|
|
2364
|
-
}), this.
|
|
2364
|
+
}), this.Kh.clear(), this.Fo = null, this.Mo = 0, t.style.touchAction = this.qh, t.style.userSelect = this.Vh;
|
|
2365
2365
|
}
|
|
2366
2366
|
fh() {
|
|
2367
2367
|
if (!this.Nn || this.jh.size === 0) return;
|
|
@@ -2412,12 +2412,12 @@ class Bt {
|
|
|
2412
2412
|
const e = performance.now(), i = this.Qo(t.changedTouches);
|
|
2413
2413
|
for (const r of i) {
|
|
2414
2414
|
const h = this.jh.get(r.id);
|
|
2415
|
-
h && this.
|
|
2415
|
+
h && this.Wh.set(r.id, this.No(h)), this.jh.set(r.id, r);
|
|
2416
2416
|
const o = { id: r.id, startPosition: r, lastPosition: r, startTime: e, lastTime: e, longPressTimer: null, longPressFired: !1 };
|
|
2417
2417
|
this.lo && (o.longPressTimer = window.setTimeout(() => {
|
|
2418
2418
|
const c = this.jh.get(r.id);
|
|
2419
2419
|
c && (o.longPressFired = !0, this.lo({ touch: this.No(c), duration: performance.now() - o.startTime, originalEvent: t }));
|
|
2420
|
-
}, this._o)), this.
|
|
2420
|
+
}, this._o)), this.Kh.set(r.id, o), this.ro && this.ro(this.Xo(r, t, void 0, e));
|
|
2421
2421
|
}
|
|
2422
2422
|
this.jh.size === 2 && this.Yo();
|
|
2423
2423
|
}
|
|
@@ -2428,8 +2428,8 @@ class Bt {
|
|
|
2428
2428
|
const e = performance.now(), i = this.Qo(t.changedTouches);
|
|
2429
2429
|
for (const r of i) {
|
|
2430
2430
|
const h = this.jh.get(r.id), o = h ? this.No(h) : void 0;
|
|
2431
|
-
o && this.
|
|
2432
|
-
const c = this.
|
|
2431
|
+
o && this.Wh.set(r.id, o), this.jh.set(r.id, r);
|
|
2432
|
+
const c = this.Kh.get(r.id);
|
|
2433
2433
|
c && (c.lastPosition = r, c.lastTime = e, o) && z(o.clientX, o.clientY, r.clientX, r.clientY) > this.yo && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.no && this.no(this.Xo(r, t, o, e));
|
|
2434
2434
|
}
|
|
2435
2435
|
this.jh.size === 2 ? this.jo(t) : this.Zh = null;
|
|
@@ -2439,8 +2439,8 @@ class Bt {
|
|
|
2439
2439
|
t.preventDefault();
|
|
2440
2440
|
const e = performance.now(), i = this.Qo(t.changedTouches);
|
|
2441
2441
|
for (const s of i) {
|
|
2442
|
-
const r = this.jh.get(s.id), h = r ? this.No(r) : void 0, o = this.
|
|
2443
|
-
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.ho && this.ho(this.Xo(s, t, h, e)), o && this.
|
|
2442
|
+
const r = this.jh.get(s.id), h = r ? this.No(r) : void 0, o = this.Kh.get(s.id);
|
|
2443
|
+
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.ho && this.ho(this.Xo(s, t, h, e)), o && this.Wo(o, t), this.Kh.delete(s.id), this.Wh.delete(s.id), this.jh.delete(s.id);
|
|
2444
2444
|
}
|
|
2445
2445
|
this.jh.size < 2 && (this.Zh = null);
|
|
2446
2446
|
}
|
|
@@ -2449,8 +2449,8 @@ class Bt {
|
|
|
2449
2449
|
t.preventDefault();
|
|
2450
2450
|
const e = performance.now(), i = this.Qo(t.changedTouches);
|
|
2451
2451
|
for (const s of i) {
|
|
2452
|
-
const r = this.jh.get(s.id), h = r ? this.No(r) : void 0, o = this.
|
|
2453
|
-
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.oo && this.oo(this.Xo(s, t, h, e)), this.
|
|
2452
|
+
const r = this.jh.get(s.id), h = r ? this.No(r) : void 0, o = this.Kh.get(s.id);
|
|
2453
|
+
o && o.longPressTimer !== null && (window.clearTimeout(o.longPressTimer), o.longPressTimer = null), this.oo && this.oo(this.Xo(s, t, h, e)), this.Kh.delete(s.id), this.Wh.delete(s.id), this.jh.delete(s.id);
|
|
2454
2454
|
}
|
|
2455
2455
|
this.jh.size < 2 && (this.Zh = null);
|
|
2456
2456
|
}
|
|
@@ -2458,19 +2458,19 @@ class Bt {
|
|
|
2458
2458
|
const e = [];
|
|
2459
2459
|
for (let i = 0; i < t.length; i += 1) {
|
|
2460
2460
|
const s = t.item(i);
|
|
2461
|
-
s && e.push(this.
|
|
2461
|
+
s && e.push(this.Ko(s));
|
|
2462
2462
|
}
|
|
2463
2463
|
return e;
|
|
2464
2464
|
}
|
|
2465
|
-
|
|
2465
|
+
Ko(t) {
|
|
2466
2466
|
return this.Eo(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 });
|
|
2467
2467
|
}
|
|
2468
2468
|
Eo(t, e, i, s) {
|
|
2469
|
-
const r = this.Er.canvas, h = r.getBoundingClientRect(), o = t - h.left, c = e - h.top, l = r.width / h.width, u = c * (r.height / h.height), f = o * l - this.Nn.offsetX,
|
|
2470
|
-
return { id: i, x: v ?
|
|
2469
|
+
const r = this.Er.canvas, h = r.getBoundingClientRect(), o = t - h.left, c = e - h.top, l = r.width / h.width, u = c * (r.height / h.height), f = o * l - this.Nn.offsetX, d = u - this.Nn.offsetY, g = Math.floor(f / this.Nn.cellWidth), m = Math.floor(d / this.Nn.cellHeight), v = g >= 0 && g < this.Nn.cols && m >= 0 && m < this.Nn.rows;
|
|
2470
|
+
return { id: i, x: v ? g : -1, y: v ? m : -1, clientX: t, clientY: e, pressure: s.pressure, radiusX: s.radiusX, radiusY: s.radiusY, rotationAngle: s.rotationAngle };
|
|
2471
2471
|
}
|
|
2472
2472
|
Xo(t, e, i, s) {
|
|
2473
|
-
const r = this.
|
|
2473
|
+
const r = this.Kh.get(t.id), h = Array.from(this.Wh.values()).map((l) => this.No(l)), o = Array.from(this.jh.values()).map((l) => this.No(l)), c = this.Qo(e.changedTouches);
|
|
2474
2474
|
return { touch: this.No(t), previousTouch: i ? this.No(i) : void 0, touches: o, previousTouches: h, changedTouches: c, deltaTime: r ? s - r.lastTime : 0, originalEvent: e };
|
|
2475
2475
|
}
|
|
2476
2476
|
Yo() {
|
|
@@ -2483,7 +2483,7 @@ class Bt {
|
|
|
2483
2483
|
const [e, i] = this.Zh.ids, s = this.jh.get(e), r = this.jh.get(i);
|
|
2484
2484
|
if (!s || !r) return;
|
|
2485
2485
|
const h = z(s.x, s.y, r.x, r.y) / this.Zh.initialDistance, o = h - this.Zh.lastScale;
|
|
2486
|
-
this.fo && Math.abs(o) > this.
|
|
2486
|
+
this.fo && Math.abs(o) > this.wo && (this.fo({ touches: [this.No(s), this.No(r)], scale: h, deltaScale: o, center: this.Zo(s, r), originalEvent: t }), this.Zh.lastScale = h);
|
|
2487
2487
|
let c = Et(s.clientX, s.clientY, r.clientX, r.clientY) - this.Zh.initialAngle;
|
|
2488
2488
|
c = (c + 180) % 360 - 180;
|
|
2489
2489
|
const l = c - this.Zh.lastRotation;
|
|
@@ -2493,11 +2493,11 @@ class Bt {
|
|
|
2493
2493
|
const i = (t.clientX + e.clientX) / 2, s = (t.clientY + e.clientY) / 2, r = this.Eo(i, s, -1, { id: -1, x: -1, y: -1, clientX: i, clientY: s });
|
|
2494
2494
|
return { x: r.x, y: r.y };
|
|
2495
2495
|
}
|
|
2496
|
-
|
|
2496
|
+
Wo(t, e) {
|
|
2497
2497
|
const i = performance.now(), s = i - t.startTime, r = z(t.startPosition.clientX, t.startPosition.clientY, t.lastPosition.clientX, t.lastPosition.clientY);
|
|
2498
2498
|
if (!t.longPressFired && s <= this.vo && r <= this.mo)
|
|
2499
2499
|
this.qo(t.lastPosition, i) && this.co ? this.co({ touch: this.No(t.lastPosition), taps: 2, originalEvent: e }) : this.ao && this.ao({ touch: this.No(t.lastPosition), taps: 1, originalEvent: e });
|
|
2500
|
-
else if (!t.longPressFired && s <= this.
|
|
2500
|
+
else if (!t.longPressFired && s <= this.bo && r >= this.Ao) {
|
|
2501
2501
|
const h = { x: t.lastPosition.clientX - t.startPosition.clientX, y: t.lastPosition.clientY - t.startPosition.clientY }, o = Math.max(Math.hypot(h.x, h.y), 1e-4), c = { x: h.x / o, y: h.y / o }, l = { x: h.x / s, y: h.y / s };
|
|
2502
2502
|
this.uo && this.uo({ touch: this.No(t.lastPosition), direction: c, distance: o, velocity: l, originalEvent: e });
|
|
2503
2503
|
}
|
|
@@ -2510,7 +2510,7 @@ class Bt {
|
|
|
2510
2510
|
return { ...t };
|
|
2511
2511
|
}
|
|
2512
2512
|
}
|
|
2513
|
-
const
|
|
2513
|
+
const Ze = Object.freeze(Object.defineProperty({ __proto__: null, TouchManager: Bt }, Symbol.toStringTag, { value: "Module" }));
|
|
2514
2514
|
class Oe {
|
|
2515
2515
|
constructor(t, e) {
|
|
2516
2516
|
a(this, "A");
|
|
@@ -2581,12 +2581,12 @@ class Oe {
|
|
|
2581
2581
|
for (; this.sa.length < this.Jo; ) {
|
|
2582
2582
|
const f = await o.read();
|
|
2583
2583
|
if (f.done) break;
|
|
2584
|
-
const
|
|
2585
|
-
if (
|
|
2586
|
-
const
|
|
2587
|
-
(this.sa.length === 0 ||
|
|
2584
|
+
const d = f.value;
|
|
2585
|
+
if (d) try {
|
|
2586
|
+
const g = typeof d.timestamp == "number" ? d.timestamp : u;
|
|
2587
|
+
(this.sa.length === 0 || g >= u) && (this.sa.push(this.aa(d)), u = g + l, this.ca("captureStream", e));
|
|
2588
2588
|
} finally {
|
|
2589
|
-
|
|
2589
|
+
d.close();
|
|
2590
2590
|
}
|
|
2591
2591
|
}
|
|
2592
2592
|
return o.releaseLock(), h.stop(), o = null, h = void 0, this.Vo.pause(), this.Vo.currentTime = 0, this.sa.length !== 0;
|
|
@@ -2631,9 +2631,9 @@ class Oe {
|
|
|
2631
2631
|
class rt extends St {
|
|
2632
2632
|
constructor(e, i, s, r, h, o, c, l, u) {
|
|
2633
2633
|
const f = o / c;
|
|
2634
|
-
let
|
|
2635
|
-
f > 1 ? (
|
|
2636
|
-
super(e, i, s, r, o, c,
|
|
2634
|
+
let d, g;
|
|
2635
|
+
f > 1 ? (d = l, g = Math.round(l / f)) : (g = u, d = Math.round(u * f));
|
|
2636
|
+
super(e, i, s, r, o, c, d, g);
|
|
2637
2637
|
a(this, "Vo");
|
|
2638
2638
|
a(this, "ua", 0);
|
|
2639
2639
|
a(this, "fa", null);
|
|
@@ -2650,7 +2650,7 @@ class rt extends St {
|
|
|
2650
2650
|
i.bindTexture(i.TEXTURE_2D, this.tn), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, i.RGBA, i.UNSIGNED_BYTE, this.Vo), i.bindTexture(i.TEXTURE_2D, null);
|
|
2651
2651
|
}
|
|
2652
2652
|
}
|
|
2653
|
-
|
|
2653
|
+
wn() {
|
|
2654
2654
|
var i, s;
|
|
2655
2655
|
const e = (i = this.fa) == null ? void 0 : i.textures;
|
|
2656
2656
|
return e && e.length > 0 && ((s = this.fa) != null && s.isPreloaded) ? e[this.ua % e.length] : this.tn;
|
|
@@ -2678,8 +2678,8 @@ class rt extends St {
|
|
|
2678
2678
|
});
|
|
2679
2679
|
const f = c.createTexture();
|
|
2680
2680
|
c.bindTexture(c.TEXTURE_2D, f), c.pixelStorei(c.UNPACK_FLIP_Y_WEBGL, 1), et(c, c.LINEAR, c.LINEAR, c.CLAMP_TO_EDGE, c.CLAMP_TO_EDGE), c.texImage2D(c.TEXTURE_2D, 0, c.RGBA, c.RGBA, c.UNSIGNED_BYTE, u), c.bindTexture(c.TEXTURE_2D, null);
|
|
2681
|
-
const
|
|
2682
|
-
return l && l > 0 && (
|
|
2681
|
+
const d = u.videoWidth, g = u.videoHeight, m = new rt(c, e, f, i, u, d, g, r, h);
|
|
2682
|
+
return l && l > 0 && (m.fa = new Oe(c, u), await m.fa.preload(l, o), m.ua = 0), m;
|
|
2683
2683
|
}
|
|
2684
2684
|
async play() {
|
|
2685
2685
|
await this.Vo.play();
|
|
@@ -2734,7 +2734,7 @@ class rt extends St {
|
|
|
2734
2734
|
return ((e = this.fa) == null ? void 0 : e.totalFrames) ?? 0;
|
|
2735
2735
|
}
|
|
2736
2736
|
}
|
|
2737
|
-
const
|
|
2737
|
+
const Ie = (n) => class extends n {
|
|
2738
2738
|
va(t, e, i, s) {
|
|
2739
2739
|
if (M.Zr(t)) return t;
|
|
2740
2740
|
if (typeof t == "number" || typeof t == "string") return this.color(t, e, i, s);
|
|
@@ -2771,16 +2771,16 @@ const Xe = (n) => class extends n {
|
|
|
2771
2771
|
this.Z.state.ot();
|
|
2772
2772
|
}
|
|
2773
2773
|
color(t, e, i, s) {
|
|
2774
|
-
return M.
|
|
2774
|
+
return M.Kr(t, e, i, s);
|
|
2775
2775
|
}
|
|
2776
2776
|
rect(t = 1, e = 1) {
|
|
2777
|
-
this.Z.
|
|
2777
|
+
this.Z.be(t, e);
|
|
2778
2778
|
}
|
|
2779
2779
|
point() {
|
|
2780
|
-
this.Z.
|
|
2780
|
+
this.Z.be(1, 1);
|
|
2781
2781
|
}
|
|
2782
2782
|
line(t, e, i, s) {
|
|
2783
|
-
this.Z.
|
|
2783
|
+
this.Z.we(t, e, i, s);
|
|
2784
2784
|
}
|
|
2785
2785
|
lineWeight(t) {
|
|
2786
2786
|
this.Z.state.Zt(t);
|
|
@@ -2815,7 +2815,7 @@ const Xe = (n) => class extends n {
|
|
|
2815
2815
|
this.Z.state.ds(t);
|
|
2816
2816
|
}
|
|
2817
2817
|
clear() {
|
|
2818
|
-
this.Z.
|
|
2818
|
+
this.Z.bi(0, 0, 0, 0);
|
|
2819
2819
|
}
|
|
2820
2820
|
ellipse(t, e) {
|
|
2821
2821
|
this.Z.Ce(t / 2, e / 2);
|
|
@@ -2851,7 +2851,7 @@ const Xe = (n) => class extends n {
|
|
|
2851
2851
|
return this.Z.Pe(t.width ?? this.grid.cols, t.height ?? this.grid.rows, t.attachments ?? 3);
|
|
2852
2852
|
}
|
|
2853
2853
|
image(t, e, i) {
|
|
2854
|
-
this.Z.ye(t, e, i), t instanceof
|
|
2854
|
+
this.Z.ye(t, e, i), t instanceof j && this.Z.ct();
|
|
2855
2855
|
}
|
|
2856
2856
|
ortho() {
|
|
2857
2857
|
this.Z.state.gs(!0);
|
|
@@ -2871,48 +2871,48 @@ const Xe = (n) => class extends n {
|
|
|
2871
2871
|
const i = await rt.Cn(this.Z, this.rr, t, this.Nn.cols, this.Nn.rows, e);
|
|
2872
2872
|
return this.pa(i), i;
|
|
2873
2873
|
}
|
|
2874
|
-
},
|
|
2874
|
+
}, Ye = (n) => class extends n {
|
|
2875
2875
|
async loadFont(t) {
|
|
2876
2876
|
return this.rr.Cr(t).then(() => {
|
|
2877
2877
|
const e = this.rr.maxGlyphDimensions;
|
|
2878
|
-
this.Nn.zr(e.width, e.height), this.ga.resize(this.Nn.cols, this.Nn.rows), this.Z.Re(), this.Yh.fh(), this.
|
|
2879
|
-
for (const i of this.
|
|
2878
|
+
this.Nn.zr(e.width, e.height), this.ga.resize(this.Nn.cols, this.Nn.rows), this.ma.Xr(), this.Z.Re(), this.Yh.fh(), this._a.fh();
|
|
2879
|
+
for (const i of this.ya) i._n(this.rr);
|
|
2880
2880
|
});
|
|
2881
2881
|
}
|
|
2882
2882
|
fontSize(t) {
|
|
2883
|
-
if (!
|
|
2884
|
-
this.rr.
|
|
2883
|
+
if (!vt.m(typeof t == "number" && t > 0, "Font size must be a positive number greater than 0.", { method: "fontSize", providedValue: t }) || this.rr.fontSize === t) return;
|
|
2884
|
+
this.rr.wr(t);
|
|
2885
2885
|
const e = this.rr.maxGlyphDimensions;
|
|
2886
|
-
this.Nn.zr(e.width, e.height), this.ga.resize(this.Nn.cols, this.Nn.rows), this.Z.Re(), this.Yh.fh(), this.
|
|
2886
|
+
this.Nn.zr(e.width, e.height), this.ga.resize(this.Nn.cols, this.Nn.rows), this.ma.Xr(), this.Z.Re(), this.Yh.fh(), this._a.fh();
|
|
2887
2887
|
}
|
|
2888
|
-
},
|
|
2888
|
+
}, ze = (n) => class extends n {
|
|
2889
2889
|
get frameCount() {
|
|
2890
|
-
return this.
|
|
2890
|
+
return this.ba.Gn;
|
|
2891
2891
|
}
|
|
2892
2892
|
set frameCount(t) {
|
|
2893
|
-
this.
|
|
2893
|
+
this.ba.Gn = t;
|
|
2894
2894
|
}
|
|
2895
2895
|
frameRate(t) {
|
|
2896
|
-
return t === void 0 ? this.
|
|
2896
|
+
return t === void 0 ? this.ba.Hn : this.ba.On(t, () => this.wa());
|
|
2897
2897
|
}
|
|
2898
2898
|
noLoop() {
|
|
2899
|
-
this.
|
|
2899
|
+
this.ba.Dn();
|
|
2900
2900
|
}
|
|
2901
2901
|
loop() {
|
|
2902
|
-
this.
|
|
2902
|
+
this.ba.Ln(() => this.wa());
|
|
2903
2903
|
}
|
|
2904
2904
|
redraw(t = 1) {
|
|
2905
|
-
if (
|
|
2905
|
+
if (vt.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.wa();
|
|
2906
2906
|
}
|
|
2907
2907
|
isLooping() {
|
|
2908
|
-
return this.
|
|
2908
|
+
return this.ba.Bn;
|
|
2909
2909
|
}
|
|
2910
|
-
},
|
|
2910
|
+
}, Ge = (n) => class extends n {
|
|
2911
2911
|
constructor(...t) {
|
|
2912
2912
|
super(...t);
|
|
2913
2913
|
}
|
|
2914
2914
|
mouseClicked(t) {
|
|
2915
|
-
this.Yh.
|
|
2915
|
+
this.Yh.wh(t);
|
|
2916
2916
|
}
|
|
2917
2917
|
mousePressed(t) {
|
|
2918
2918
|
this.Yh.Ch(t);
|
|
@@ -2937,237 +2937,238 @@ const Xe = (n) => class extends n {
|
|
|
2937
2937
|
super(...t);
|
|
2938
2938
|
}
|
|
2939
2939
|
touchStarted(t) {
|
|
2940
|
-
this.
|
|
2940
|
+
this._a.ko(t);
|
|
2941
2941
|
}
|
|
2942
2942
|
touchMoved(t) {
|
|
2943
|
-
this.
|
|
2943
|
+
this._a.Mh(t);
|
|
2944
2944
|
}
|
|
2945
2945
|
touchEnded(t) {
|
|
2946
|
-
this.
|
|
2946
|
+
this._a.zo(t);
|
|
2947
2947
|
}
|
|
2948
2948
|
touchCancelled(t) {
|
|
2949
|
-
this.
|
|
2949
|
+
this._a.Do(t);
|
|
2950
2950
|
}
|
|
2951
2951
|
tap(t) {
|
|
2952
|
-
this.
|
|
2952
|
+
this._a.Lo(t);
|
|
2953
2953
|
}
|
|
2954
2954
|
doubleTap(t) {
|
|
2955
|
-
this.
|
|
2955
|
+
this._a.Oo(t);
|
|
2956
2956
|
}
|
|
2957
2957
|
longPress(t) {
|
|
2958
|
-
this.
|
|
2958
|
+
this._a.Io(t);
|
|
2959
2959
|
}
|
|
2960
2960
|
swipe(t) {
|
|
2961
|
-
this.
|
|
2961
|
+
this._a.Bo(t);
|
|
2962
2962
|
}
|
|
2963
2963
|
pinch(t) {
|
|
2964
|
-
this.
|
|
2964
|
+
this._a.Ho(t);
|
|
2965
2965
|
}
|
|
2966
2966
|
rotateGesture(t) {
|
|
2967
|
-
this.
|
|
2967
|
+
this._a.Go(t);
|
|
2968
2968
|
}
|
|
2969
2969
|
get touches() {
|
|
2970
|
-
return this.
|
|
2970
|
+
return this._a.So();
|
|
2971
2971
|
}
|
|
2972
|
-
},
|
|
2972
|
+
}, ke = (n) => class extends n {
|
|
2973
2973
|
constructor(...t) {
|
|
2974
2974
|
super(...t);
|
|
2975
2975
|
}
|
|
2976
2976
|
keyPressed(t) {
|
|
2977
|
-
this.
|
|
2977
|
+
this.Ca.Ch(t);
|
|
2978
2978
|
}
|
|
2979
2979
|
keyReleased(t) {
|
|
2980
|
-
this.
|
|
2980
|
+
this.Ca.xh(t);
|
|
2981
2981
|
}
|
|
2982
2982
|
isKeyPressed(t) {
|
|
2983
|
-
return this.
|
|
2983
|
+
return this.Ca.Ih(t);
|
|
2984
2984
|
}
|
|
2985
2985
|
get lastKeyPressed() {
|
|
2986
|
-
return this.
|
|
2986
|
+
return this.Ca.Hh();
|
|
2987
2987
|
}
|
|
2988
2988
|
get lastKeyReleased() {
|
|
2989
|
-
return this.
|
|
2989
|
+
return this.Ca.Gh();
|
|
2990
2990
|
}
|
|
2991
2991
|
get pressedKeys() {
|
|
2992
|
-
return this.
|
|
2992
|
+
return this.Ca.Qh();
|
|
2993
2993
|
}
|
|
2994
2994
|
get modifierState() {
|
|
2995
|
-
return this.
|
|
2995
|
+
return this.Ca.Nh();
|
|
2996
2996
|
}
|
|
2997
2997
|
};
|
|
2998
|
-
class
|
|
2998
|
+
class He {
|
|
2999
2999
|
constructor(t) {
|
|
3000
|
-
a(this, "
|
|
3001
|
-
a(this, "
|
|
3002
|
-
a(this, "
|
|
3003
|
-
a(this, "Fa", /* @__PURE__ */ new Map());
|
|
3000
|
+
a(this, "xa");
|
|
3001
|
+
a(this, "Ma", /* @__PURE__ */ new Map());
|
|
3002
|
+
a(this, "Fa", []);
|
|
3004
3003
|
a(this, "Pa", /* @__PURE__ */ new Map());
|
|
3005
|
-
this
|
|
3004
|
+
a(this, "$a", /* @__PURE__ */ new Map());
|
|
3005
|
+
this.xa = t;
|
|
3006
3006
|
}
|
|
3007
|
-
async
|
|
3007
|
+
async Ta(t) {
|
|
3008
3008
|
for (const e of t) {
|
|
3009
|
-
if (this.
|
|
3010
|
-
const i = this.
|
|
3009
|
+
if (this.Ma.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
|
|
3010
|
+
const i = this.Ra(e.name);
|
|
3011
3011
|
try {
|
|
3012
|
-
await e.install(this.
|
|
3012
|
+
await e.install(this.xa, i);
|
|
3013
3013
|
} catch (s) {
|
|
3014
|
-
throw this.
|
|
3014
|
+
throw this.Ea(e.name), s;
|
|
3015
3015
|
}
|
|
3016
|
-
this.
|
|
3016
|
+
this.Ma.set(e.name, e), this.Fa.push(e.name);
|
|
3017
3017
|
}
|
|
3018
3018
|
}
|
|
3019
|
-
async
|
|
3020
|
-
const e = this.
|
|
3019
|
+
async Sa(t) {
|
|
3020
|
+
const e = this.Ma.get(t);
|
|
3021
3021
|
if (!e) return;
|
|
3022
|
-
const i = this.
|
|
3023
|
-
e.uninstall && await e.uninstall(this.
|
|
3022
|
+
const i = this.Ra(t);
|
|
3023
|
+
e.uninstall && await e.uninstall(this.xa, i), this.Ma.delete(t), this.Fa.splice(this.Fa.indexOf(t), 1), this.Ea(t);
|
|
3024
3024
|
}
|
|
3025
|
-
|
|
3026
|
-
this.
|
|
3025
|
+
ka() {
|
|
3026
|
+
this.za(this.Pa);
|
|
3027
3027
|
}
|
|
3028
|
-
|
|
3029
|
-
this.
|
|
3028
|
+
Da() {
|
|
3029
|
+
this.za(this.$a);
|
|
3030
3030
|
}
|
|
3031
|
-
async
|
|
3032
|
-
const t = [...this.
|
|
3033
|
-
for (const e of t) await this.
|
|
3031
|
+
async La() {
|
|
3032
|
+
const t = [...this.Ma.keys()];
|
|
3033
|
+
for (const e of t) await this.Sa(e);
|
|
3034
3034
|
}
|
|
3035
|
-
|
|
3036
|
-
return { renderer: this.
|
|
3035
|
+
Ra(t) {
|
|
3036
|
+
return { renderer: this.xa.Z, font: this.xa.rr, grid: this.xa.Nn, canvas: this.xa.Er, drawFramebuffer: this.xa.ga, asciiFramebuffer: this.xa.Oa, registerPreDrawHook: (e) => this.Ia(this.Pa, t, e), registerPostDrawHook: (e) => this.Ia(this.$a, t, e) };
|
|
3037
3037
|
}
|
|
3038
|
-
|
|
3038
|
+
Ia(t, e, i) {
|
|
3039
3039
|
const s = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
3040
3040
|
return s.add(i), t.set(e, s), () => {
|
|
3041
3041
|
const r = t.get(e);
|
|
3042
3042
|
r && (r.delete(i), r.size === 0 && t.delete(e));
|
|
3043
3043
|
};
|
|
3044
3044
|
}
|
|
3045
|
-
|
|
3046
|
-
this.
|
|
3045
|
+
Ea(t) {
|
|
3046
|
+
this.Pa.delete(t), this.$a.delete(t);
|
|
3047
3047
|
}
|
|
3048
|
-
|
|
3049
|
-
for (const e of this.
|
|
3048
|
+
za(t) {
|
|
3049
|
+
for (const e of this.Fa) {
|
|
3050
3050
|
const i = t.get(e);
|
|
3051
3051
|
i && i.forEach((s) => s());
|
|
3052
3052
|
}
|
|
3053
3053
|
}
|
|
3054
3054
|
}
|
|
3055
|
-
const
|
|
3056
|
-
in vec2 A0;in vec2 A1;out vec2 v_uv;void main(){v_uv=A1;gl_Position=vec4(A0,0.,1.);}
|
|
3057
|
-
|
|
3055
|
+
const K = `#version 300 es
|
|
3056
|
+
in vec2 A0;in vec2 A1;out vec2 v_uv;void main(){v_uv=A1;gl_Position=vec4(A0,0.,1.);}`, Xt = `#version 300 es
|
|
3057
|
+
precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`;
|
|
3058
|
+
class Zt {
|
|
3058
3059
|
constructor() {
|
|
3059
|
-
a(this, "
|
|
3060
|
-
a(this, "
|
|
3061
|
-
a(this, "Ha", 0);
|
|
3060
|
+
a(this, "Ba", /* @__PURE__ */ new Map());
|
|
3061
|
+
a(this, "Ha", []);
|
|
3062
3062
|
a(this, "Ga", 0);
|
|
3063
|
-
a(this, "Qa");
|
|
3064
|
-
|
|
3065
|
-
get Na() {
|
|
3066
|
-
return this.Ha;
|
|
3063
|
+
a(this, "Qa", 0);
|
|
3064
|
+
a(this, "Na");
|
|
3067
3065
|
}
|
|
3068
3066
|
get Xa() {
|
|
3069
|
-
|
|
3067
|
+
return this.Ga;
|
|
3068
|
+
}
|
|
3069
|
+
get Ya() {
|
|
3070
|
+
if (this.Ga === 0) return 0;
|
|
3070
3071
|
let t = 0;
|
|
3071
|
-
for (const e of this.
|
|
3072
|
-
const i = this.
|
|
3072
|
+
for (const e of this.Ha) {
|
|
3073
|
+
const i = this.Ba.get(e);
|
|
3073
3074
|
i && (t += Math.min(1, Math.max(0, i.progress)) * i.weight);
|
|
3074
3075
|
}
|
|
3075
|
-
return Math.min(1, t / this.
|
|
3076
|
+
return Math.min(1, t / this.Ga);
|
|
3076
3077
|
}
|
|
3077
|
-
|
|
3078
|
-
this.
|
|
3078
|
+
ja(t) {
|
|
3079
|
+
this.Na = t;
|
|
3079
3080
|
}
|
|
3080
|
-
|
|
3081
|
-
const i = `phase-${this.
|
|
3082
|
-
return this.
|
|
3081
|
+
Wa(t, e = 1) {
|
|
3082
|
+
const i = `phase-${this.Ha.length + 1}-${Date.now()}`, s = { id: i, label: t, weight: Math.max(1e-3, e), progress: 0, status: "running" };
|
|
3083
|
+
return this.Ba.set(i, s), this.Ha.push(i), this.Ga += s.weight, i;
|
|
3083
3084
|
}
|
|
3084
3085
|
Ka(t, e) {
|
|
3085
|
-
const i = this.
|
|
3086
|
+
const i = this.Ba.get(t);
|
|
3086
3087
|
if (!i) return;
|
|
3087
3088
|
i.progress = Math.max(0, Math.min(1, e)), i.status = i.progress >= 1 ? "complete" : "running";
|
|
3088
|
-
const s = this.
|
|
3089
|
-
Math.abs(s - this.
|
|
3089
|
+
const s = this.Ya;
|
|
3090
|
+
Math.abs(s - this.Qa) > 1e-3 && (this.Qa = s, this.Na && this.Na(s));
|
|
3090
3091
|
}
|
|
3091
|
-
|
|
3092
|
-
const e = this.
|
|
3092
|
+
Za(t) {
|
|
3093
|
+
const e = this.Ba.get(t);
|
|
3093
3094
|
e && (e.progress = 1, e.status = "complete", this.Ka(t, 1));
|
|
3094
3095
|
}
|
|
3095
|
-
|
|
3096
|
-
const e = this.
|
|
3096
|
+
qa(t) {
|
|
3097
|
+
const e = this.Ba.get(t);
|
|
3097
3098
|
e && (e.status = "failed");
|
|
3098
3099
|
}
|
|
3099
|
-
|
|
3100
|
-
return this.
|
|
3101
|
-
const e = this.
|
|
3100
|
+
Va() {
|
|
3101
|
+
return this.Ha.map((t) => {
|
|
3102
|
+
const e = this.Ba.get(t);
|
|
3102
3103
|
return e ? { id: e.id, label: e.label, weight: e.weight, progress: e.progress, status: e.status } : { id: t, label: t, weight: 1, progress: 0, status: "pending" };
|
|
3103
3104
|
});
|
|
3104
3105
|
}
|
|
3105
3106
|
}
|
|
3106
3107
|
class Ot {
|
|
3107
3108
|
constructor(t = "active") {
|
|
3108
|
-
a(this, "
|
|
3109
|
-
a(this, "Ja", "");
|
|
3109
|
+
a(this, "Ja");
|
|
3110
3110
|
a(this, "tc", "");
|
|
3111
|
-
this
|
|
3112
|
-
|
|
3113
|
-
get sc() {
|
|
3114
|
-
return this.Va;
|
|
3111
|
+
a(this, "sc", "");
|
|
3112
|
+
this.Ja = t;
|
|
3115
3113
|
}
|
|
3116
3114
|
get ec() {
|
|
3117
|
-
return this.
|
|
3115
|
+
return this.Ja;
|
|
3118
3116
|
}
|
|
3119
3117
|
get rc() {
|
|
3120
|
-
return this.
|
|
3118
|
+
return this.Ja !== "disabled";
|
|
3121
3119
|
}
|
|
3122
3120
|
get nc() {
|
|
3123
|
-
return this.Ja;
|
|
3121
|
+
return this.Ja === "active" || this.Ja === "transitioning" || this.Ja === "error";
|
|
3124
3122
|
}
|
|
3125
3123
|
get hc() {
|
|
3126
3124
|
return this.tc;
|
|
3127
3125
|
}
|
|
3128
|
-
oc() {
|
|
3129
|
-
|
|
3126
|
+
get oc() {
|
|
3127
|
+
return this.sc;
|
|
3130
3128
|
}
|
|
3131
3129
|
ac() {
|
|
3132
|
-
this.
|
|
3130
|
+
this.Ja !== "done" && this.Ja !== "transitioning" || (this.Ja = "active");
|
|
3133
3131
|
}
|
|
3134
3132
|
cc() {
|
|
3135
|
-
this.
|
|
3133
|
+
this.Ja !== "disabled" && (this.Ja = "done");
|
|
3136
3134
|
}
|
|
3137
3135
|
lc() {
|
|
3138
|
-
this.
|
|
3136
|
+
this.Ja !== "disabled" && (this.Ja = "transitioning");
|
|
3137
|
+
}
|
|
3138
|
+
uc() {
|
|
3139
|
+
this.Ja === "transitioning" && (this.Ja = "done");
|
|
3139
3140
|
}
|
|
3140
|
-
|
|
3141
|
-
this.
|
|
3141
|
+
fc(t) {
|
|
3142
|
+
this.Ja !== "disabled" && (this.Ja = "error", t instanceof Error ? (this.tc = t.message, this.sc = t.stack || "") : (this.tc = t, this.sc = ""));
|
|
3142
3143
|
}
|
|
3143
|
-
|
|
3144
|
-
this.
|
|
3144
|
+
dc() {
|
|
3145
|
+
this.Ja = "disabled";
|
|
3145
3146
|
}
|
|
3146
3147
|
}
|
|
3147
|
-
class
|
|
3148
|
+
class It {
|
|
3148
3149
|
constructor(t, e) {
|
|
3149
|
-
a(this, "
|
|
3150
|
-
a(this, "
|
|
3151
|
-
a(this, "gc");
|
|
3150
|
+
a(this, "vc", 0);
|
|
3151
|
+
a(this, "gc", 1);
|
|
3152
3152
|
a(this, "mc");
|
|
3153
|
-
this
|
|
3154
|
-
|
|
3155
|
-
get _c() {
|
|
3156
|
-
return this.vc;
|
|
3153
|
+
a(this, "_c");
|
|
3154
|
+
this.mc = t, this._c = e;
|
|
3157
3155
|
}
|
|
3158
3156
|
get yc() {
|
|
3159
|
-
return this.
|
|
3157
|
+
return this.gc;
|
|
3158
|
+
}
|
|
3159
|
+
get bc() {
|
|
3160
|
+
return this.gc < 1;
|
|
3160
3161
|
}
|
|
3161
3162
|
kn() {
|
|
3162
|
-
this.
|
|
3163
|
+
this.mc !== "none" && this._c > 0 && (this.vc = performance.now());
|
|
3163
3164
|
}
|
|
3164
3165
|
et() {
|
|
3165
|
-
if (this.
|
|
3166
|
-
const t = performance.now() - this.
|
|
3167
|
-
return e >= 1 ? (this.
|
|
3166
|
+
if (this.mc === "none" || this._c === 0) return this.gc = 1, !1;
|
|
3167
|
+
const t = performance.now() - this.vc, e = Math.min(1, t / this._c);
|
|
3168
|
+
return e >= 1 ? (this.gc = 0, !0) : (this.gc = 1 - e, !1);
|
|
3168
3169
|
}
|
|
3169
3170
|
ti() {
|
|
3170
|
-
this.
|
|
3171
|
+
this.gc = 1, this.vc = 0;
|
|
3171
3172
|
}
|
|
3172
3173
|
}
|
|
3173
3174
|
function dt(n, t) {
|
|
@@ -3179,56 +3180,56 @@ function dt(n, t) {
|
|
|
3179
3180
|
return 0.2126 * c(r) + 0.7152 * c(h) + 0.0722 * c(o);
|
|
3180
3181
|
}(t) > 0.5 ? "light" : "dark"), { mode: i, background: t, textColor: i === "light" ? "#1A1A1A" : "#F8F8F8", subtleColor: i === "light" ? "#4A4A4A" : "#C0C0C0" };
|
|
3181
3182
|
}
|
|
3182
|
-
function
|
|
3183
|
+
function Yt(n) {
|
|
3183
3184
|
return n.mode === "light" ? ["#E91E63", "#9C27B0", "#FF6F00"] : ["#8EF9F3", "#F15BB5", "#FF9B71"];
|
|
3184
3185
|
}
|
|
3185
|
-
function
|
|
3186
|
+
function zt(n, t) {
|
|
3186
3187
|
return n.length ? n.map((e) => t.color(e)) : [t.color("#FFFFFF")];
|
|
3187
3188
|
}
|
|
3188
|
-
const
|
|
3189
|
-
const f = "|/-\\",
|
|
3189
|
+
const je = ({ textmodifier: n, grid: t, progress: e, frameCount: i, message: s, palette: r, theme: h, phases: o, transitionOpacity: c, isError: l, errorMessage: u }) => {
|
|
3190
|
+
const f = "|/-\\", d = Math.floor(i / 6) % 4, g = n.color(h.textColor), m = Math.floor(255 * c), v = n.color(g.r, g.g, g.b, m);
|
|
3190
3191
|
if (n.charColor(v), n.cellColor(0, 0, 0, 0), l) {
|
|
3191
|
-
const A = n.color(h.mode === "light" ? "#D32F2F" : "#FF6B6B",
|
|
3192
|
+
const A = n.color(h.mode === "light" ? "#D32F2F" : "#FF6B6B", m);
|
|
3192
3193
|
n.charColor(A), n.push(), n.translate(0, -2, 0), n.char("X"), n.rect(1, 1), n.pop();
|
|
3193
3194
|
const p = "SETUP ERROR", y = -Math.floor(p.length / 2);
|
|
3194
3195
|
n.push(), n.translate(y, 0, 0);
|
|
3195
3196
|
for (const E of p) n.char(E), n.rect(1, 1), n.translateX(1);
|
|
3196
3197
|
if (n.pop(), u) {
|
|
3197
|
-
const E = n.color(h.subtleColor),
|
|
3198
|
-
n.charColor(
|
|
3199
|
-
const
|
|
3198
|
+
const E = n.color(h.subtleColor), b = n.color(E.r, E.g, E.b, m);
|
|
3199
|
+
n.charColor(b);
|
|
3200
|
+
const x = Math.floor(0.8 * t.cols), F = u.split(" "), N = [];
|
|
3200
3201
|
let T = "";
|
|
3201
|
-
for (const
|
|
3202
|
+
for (const C of F) (T + " " + C).length <= x ? T = T ? T + " " + C : C : (T && N.push(T), T = C);
|
|
3202
3203
|
T && N.push(T);
|
|
3203
3204
|
const S = N.slice(0, 3);
|
|
3204
|
-
N.length > 3 && (S[2] = S[2].substring(0,
|
|
3205
|
-
const
|
|
3206
|
-
n.push(), n.translate(
|
|
3207
|
-
for (const
|
|
3205
|
+
N.length > 3 && (S[2] = S[2].substring(0, x - 3) + "..."), S.forEach((C, Q) => {
|
|
3206
|
+
const Wt = -Math.floor(C.length / 2);
|
|
3207
|
+
n.push(), n.translate(Wt, 3 + Q, 0);
|
|
3208
|
+
for (const Kt of C) n.char(Kt), n.rect(1, 1), n.translateX(1);
|
|
3208
3209
|
n.pop();
|
|
3209
3210
|
});
|
|
3210
3211
|
}
|
|
3211
3212
|
return;
|
|
3212
3213
|
}
|
|
3213
|
-
if (n.push(), n.translate(0, 0, 0), n.char(f[
|
|
3214
|
+
if (n.push(), n.translate(0, 0, 0), n.char(f[d]), n.rect(1, 1), n.pop(), e > 0 || o.some((A) => A.status !== "pending")) {
|
|
3214
3215
|
const A = Math.max(6, Math.floor(0.6 * t.cols)), p = -Math.floor(A / 2), y = Math.floor(A * e), E = r.length ? r : [n.color("#FFFFFF")];
|
|
3215
3216
|
n.push(), n.translate(p, 3, 0);
|
|
3216
|
-
for (let
|
|
3217
|
-
const
|
|
3218
|
-
n.charColor(N), n.char(
|
|
3217
|
+
for (let b = 0; b < A; b++) {
|
|
3218
|
+
const x = b < y ? "*" : ".", F = E[b % E.length], N = n.color(F.r, F.g, F.b, m);
|
|
3219
|
+
n.charColor(N), n.char(x), n.rect(1, 1), n.translateX(1);
|
|
3219
3220
|
}
|
|
3220
3221
|
n.pop();
|
|
3221
3222
|
}
|
|
3222
3223
|
if (s) {
|
|
3223
|
-
const A = n.color(h.subtleColor), p = n.color(A.r, A.g, A.b,
|
|
3224
|
+
const A = n.color(h.subtleColor), p = n.color(A.r, A.g, A.b, m);
|
|
3224
3225
|
n.charColor(p);
|
|
3225
3226
|
const y = -Math.floor(s.length / 2);
|
|
3226
3227
|
n.push(), n.translate(y, 5, 0);
|
|
3227
3228
|
for (const E of s) n.char(E), n.rect(1, 1), n.translateX(1);
|
|
3228
3229
|
n.pop();
|
|
3229
3230
|
}
|
|
3230
|
-
},
|
|
3231
|
-
class
|
|
3231
|
+
}, We = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
|
|
3232
|
+
class Ke {
|
|
3232
3233
|
constructor(t, e, i) {
|
|
3233
3234
|
this.wc = t, this.id = e, this.label = i;
|
|
3234
3235
|
}
|
|
@@ -3236,10 +3237,10 @@ class je {
|
|
|
3236
3237
|
this.wc.Ka(this.id, t);
|
|
3237
3238
|
}
|
|
3238
3239
|
complete() {
|
|
3239
|
-
this.wc.
|
|
3240
|
+
this.wc.Za(this.id);
|
|
3240
3241
|
}
|
|
3241
3242
|
fail(t) {
|
|
3242
|
-
this.wc.
|
|
3243
|
+
this.wc.qa(this.id);
|
|
3243
3244
|
}
|
|
3244
3245
|
async track(t) {
|
|
3245
3246
|
try {
|
|
@@ -3250,340 +3251,346 @@ class je {
|
|
|
3250
3251
|
}
|
|
3251
3252
|
}
|
|
3252
3253
|
}
|
|
3253
|
-
class
|
|
3254
|
+
class Gt {
|
|
3254
3255
|
constructor(t, e, i) {
|
|
3255
|
-
a(this, "
|
|
3256
|
+
a(this, "xa");
|
|
3256
3257
|
a(this, "l");
|
|
3257
|
-
a(this, "bc");
|
|
3258
|
-
a(this, "wc");
|
|
3259
3258
|
a(this, "Cc");
|
|
3259
|
+
a(this, "wc");
|
|
3260
3260
|
a(this, "xc");
|
|
3261
3261
|
a(this, "Mc");
|
|
3262
3262
|
a(this, "Fc");
|
|
3263
3263
|
a(this, "Pc");
|
|
3264
3264
|
a(this, "$c");
|
|
3265
|
+
a(this, "Tc");
|
|
3265
3266
|
a(this, "Z");
|
|
3266
|
-
a(this, "
|
|
3267
|
-
a(this, "
|
|
3268
|
-
a(this, "
|
|
3269
|
-
a(this, "
|
|
3270
|
-
a(this, "kc", !1);
|
|
3267
|
+
a(this, "Rc", []);
|
|
3268
|
+
a(this, "Ec");
|
|
3269
|
+
a(this, "Sc", performance.now());
|
|
3270
|
+
a(this, "kc", 0);
|
|
3271
3271
|
a(this, "zc", !1);
|
|
3272
|
-
a(this, "
|
|
3273
|
-
this
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3272
|
+
a(this, "Dc", !1);
|
|
3273
|
+
a(this, "Bc");
|
|
3274
|
+
this.xa = t, this.l = { ...We, ...e ?? {} }, this.Cc = new Ot("active"), this.wc = new Zt(), this.xc = new It(this.l.transition, this.l.transitionDuration), this.Mc = new Dt(60), this.Ec = dt(this.l, i);
|
|
3275
|
+
const s = Yt(this.Ec);
|
|
3276
|
+
this.Rc = zt(s, this.xa), this.Z = this.Lc(), this.wc.ja((r) => {
|
|
3277
|
+
r >= 0.999 && this.cc();
|
|
3277
3278
|
});
|
|
3278
3279
|
}
|
|
3279
3280
|
async yr(t) {
|
|
3280
|
-
if (this.
|
|
3281
|
-
const e = this.
|
|
3282
|
-
this.
|
|
3283
|
-
const s = this.
|
|
3284
|
-
this.
|
|
3281
|
+
if (this.Dc) return;
|
|
3282
|
+
const e = this.xa.Z, i = this.xa.Er;
|
|
3283
|
+
this.Fc = new mt(e, 16), await this.Fc.yr(t);
|
|
3284
|
+
const s = this.Fc.maxGlyphDimensions;
|
|
3285
|
+
this.Pc = new Ut(i.canvas, s.width, s.height), this.$c = e.Pe(this.Pc.cols, this.Pc.rows, 3), this.Tc = e.Pe(this.Pc.width, this.Pc.height, 1), this.Dc = !0;
|
|
3285
3286
|
}
|
|
3286
|
-
get
|
|
3287
|
-
return this.
|
|
3287
|
+
get nc() {
|
|
3288
|
+
return this.Cc.nc && this.zc;
|
|
3288
3289
|
}
|
|
3289
3290
|
kn() {
|
|
3290
|
-
this.
|
|
3291
|
+
this.zc || (this.zc = !0, this.Sc = performance.now(), this.kc = 0, this.Mc.kn(() => this.Oc()));
|
|
3291
3292
|
}
|
|
3292
3293
|
zn() {
|
|
3293
|
-
this.
|
|
3294
|
+
this.zc && (this.zc = !1, this.Mc.zn());
|
|
3294
3295
|
}
|
|
3295
3296
|
Xr() {
|
|
3296
|
-
this.
|
|
3297
|
+
this.Dc && (this.Pc.ti(), this.$c.resize(this.Pc.cols, this.Pc.rows), this.Tc.resize(this.Pc.width, this.Pc.height));
|
|
3297
3298
|
}
|
|
3298
3299
|
gt() {
|
|
3299
|
-
this.zn(), this.
|
|
3300
|
+
this.zn(), this.Dc && (this.Fc.gt(), this.$c.gt(), this.Tc.gt(), this.Dc = !1);
|
|
3300
3301
|
}
|
|
3301
3302
|
get progress() {
|
|
3302
|
-
return this.wc.
|
|
3303
|
+
return this.wc.Ya;
|
|
3303
3304
|
}
|
|
3304
3305
|
message(t) {
|
|
3305
3306
|
return typeof t == "string" && (this.l.message = t), this.l.message;
|
|
3306
3307
|
}
|
|
3307
3308
|
addPhase(t, e = 1) {
|
|
3308
|
-
this.
|
|
3309
|
-
const i = this.wc.
|
|
3310
|
-
return new
|
|
3309
|
+
this.Cc.ac();
|
|
3310
|
+
const i = this.wc.Wa(t, e);
|
|
3311
|
+
return new Ke(this.wc, i, t);
|
|
3311
3312
|
}
|
|
3312
|
-
|
|
3313
|
-
this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.
|
|
3313
|
+
cc() {
|
|
3314
|
+
this.l.transition !== "none" && this.l.transitionDuration > 0 ? (this.Cc.lc(), this.xc.kn()) : (this.Cc.cc(), this.zn(), this.Ic());
|
|
3314
3315
|
}
|
|
3315
|
-
|
|
3316
|
-
this.
|
|
3316
|
+
Ic() {
|
|
3317
|
+
this.Bc && this.Bc();
|
|
3317
3318
|
}
|
|
3318
|
-
|
|
3319
|
-
this.
|
|
3319
|
+
Hc(t) {
|
|
3320
|
+
this.Bc = t;
|
|
3320
3321
|
}
|
|
3321
3322
|
error(t) {
|
|
3322
|
-
this.
|
|
3323
|
+
this.Cc.fc(t);
|
|
3323
3324
|
}
|
|
3324
|
-
|
|
3325
|
-
if (this.
|
|
3326
|
-
if (this.
|
|
3327
|
-
return this.
|
|
3328
|
-
this.
|
|
3325
|
+
Oc() {
|
|
3326
|
+
if (this.Cc.nc) {
|
|
3327
|
+
if (this.kc++, this.Cc.ec === "transitioning" && this.xc.et())
|
|
3328
|
+
return this.Cc.uc(), this.Ic(), void this.zn();
|
|
3329
|
+
this.Gc();
|
|
3329
3330
|
}
|
|
3330
3331
|
}
|
|
3331
|
-
|
|
3332
|
-
if (!this.
|
|
3333
|
-
const t = this
|
|
3334
|
-
r.state.qt(), t.begin(), this.
|
|
3332
|
+
Gc() {
|
|
3333
|
+
if (!this.Dc) return;
|
|
3334
|
+
const t = this.$c, e = this.Fc, i = this.Pc, s = this.Tc, r = this.xa.Z, h = this.xa.Er, o = this.xa.Qc, c = this.xa.Nc;
|
|
3335
|
+
r.state.qt(), t.begin(), this.xa.clear(), this.xa.push();
|
|
3335
3336
|
try {
|
|
3336
|
-
const l = { textmodifier: this.
|
|
3337
|
+
const l = { textmodifier: this.xa, grid: i, progress: this.progress, elapsedMs: performance.now() - this.Sc, frameCount: this.kc, message: this.l.message, palette: this.Rc, theme: this.Ec, phases: this.wc.Va(), transitionOpacity: this.xc.yc, isError: this.Cc.ec === "error", errorMessage: this.Cc.hc || void 0, errorDetails: this.Cc.oc || void 0 };
|
|
3337
3338
|
this.Z(l);
|
|
3338
3339
|
} finally {
|
|
3339
|
-
this.
|
|
3340
|
+
this.xa.pop();
|
|
3340
3341
|
}
|
|
3341
|
-
t.end(), s.begin(), r.ve(o), o.O({ u_characterTexture: e.fontFramebuffer, u_charsetDimensions: [e.textureColumns, e.textureRows],
|
|
3342
|
+
t.end(), s.begin(), r.ve(o), o.O({ u_characterTexture: e.fontFramebuffer, u_charsetDimensions: [e.textureColumns, e.textureRows], Ud: t.textures[0], Ue: t.textures[1], Uf: t.textures[2], Ug: [i.cols, i.rows], Uh: [s.width, s.height], Ui: r.state.canvasBackgroundColor }), r.Ae(0, 0, h.width, h.height), s.end(), r.bi(...r.state.canvasBackgroundColor), r.ve(c), c.O({ u_texture: s.textures[0] }), r.Ae(i.offsetX, i.offsetY, i.width, i.height);
|
|
3342
3343
|
}
|
|
3343
|
-
|
|
3344
|
-
this.
|
|
3344
|
+
Xc(t) {
|
|
3345
|
+
this.Ec = dt(this.l, t);
|
|
3345
3346
|
}
|
|
3346
|
-
|
|
3347
|
-
const t = this.l.renderer ||
|
|
3347
|
+
Lc() {
|
|
3348
|
+
const t = this.l.renderer || je;
|
|
3348
3349
|
return (e) => {
|
|
3349
|
-
t(e), this.
|
|
3350
|
+
t(e), this.Yc(e);
|
|
3350
3351
|
};
|
|
3351
3352
|
}
|
|
3352
|
-
|
|
3353
|
+
Yc(t) {
|
|
3353
3354
|
const { textmodifier: e, grid: i, frameCount: s, theme: r, transitionOpacity: h } = t, o = [116, 101, 120, 116, 109, 111, 100, 101, 46, 106, 115].map((f) => String.fromCharCode(f)).join(""), c = (i.rows + 1 >> 1) - 2, l = 2 - (i.cols + 1 >> 1), u = r.mode === "light" ? [[233, 30, 99], [156, 39, 176], [255, 111, 0]] : [[142, 249, 243], [241, 91, 181], [255, 155, 113]];
|
|
3354
3355
|
e.push(), e.translate(l, c, 0);
|
|
3355
3356
|
for (let f = 0; f < o.length; f++) {
|
|
3356
|
-
const
|
|
3357
|
-
e.charColor(y), e.char(
|
|
3357
|
+
const d = o[f], g = Math.floor(0.1 * s + 0.5 * f) % u.length, [m, v, A] = u[g], p = Math.floor(255 * h), y = e.color(m, v, A, p);
|
|
3358
|
+
e.charColor(y), e.char(d), e.point(), e.translateX(1);
|
|
3358
3359
|
}
|
|
3359
3360
|
e.pop();
|
|
3360
3361
|
}
|
|
3361
3362
|
}
|
|
3362
3363
|
class gt {
|
|
3363
3364
|
constructor(t = {}) {
|
|
3364
|
-
a(this, "Yc");
|
|
3365
|
-
a(this, "_c");
|
|
3366
3365
|
a(this, "jc");
|
|
3367
|
-
a(this, "
|
|
3366
|
+
a(this, "yc");
|
|
3368
3367
|
a(this, "Wc");
|
|
3368
|
+
a(this, "Kc");
|
|
3369
3369
|
a(this, "Zc");
|
|
3370
3370
|
a(this, "qc");
|
|
3371
3371
|
a(this, "Vc");
|
|
3372
3372
|
a(this, "Jc");
|
|
3373
|
-
a(this, "tl"
|
|
3374
|
-
a(this, "sl"
|
|
3375
|
-
a(this, "il",
|
|
3376
|
-
a(this, "el",
|
|
3377
|
-
this
|
|
3373
|
+
a(this, "tl");
|
|
3374
|
+
a(this, "sl");
|
|
3375
|
+
a(this, "il", null);
|
|
3376
|
+
a(this, "el", !1);
|
|
3377
|
+
a(this, "rl", !0);
|
|
3378
|
+
a(this, "nl", []);
|
|
3379
|
+
this.jc = t.visible ?? !0, this.yc = Math.min(1, Math.max(0, t.opacity ?? 1)), this.Wc = t.blendMode ?? "normal", this.Kc = Math.round(t.offsetX ?? 0), this.Zc = Math.round(t.offsetY ?? 0), this.qc = t.rotation ?? 0;
|
|
3378
3380
|
}
|
|
3379
|
-
|
|
3380
|
-
return this.
|
|
3381
|
+
hl() {
|
|
3382
|
+
return this.il !== null;
|
|
3381
3383
|
}
|
|
3382
|
-
|
|
3383
|
-
const t = this.
|
|
3384
|
-
return this.
|
|
3384
|
+
ol() {
|
|
3385
|
+
const t = this.nl;
|
|
3386
|
+
return this.nl = [], t;
|
|
3385
3387
|
}
|
|
3386
|
-
|
|
3387
|
-
this.
|
|
3388
|
+
al(t) {
|
|
3389
|
+
this.il && this.il.call(t);
|
|
3388
3390
|
}
|
|
3389
3391
|
draw(t) {
|
|
3390
|
-
this.
|
|
3392
|
+
this.il = t;
|
|
3391
3393
|
}
|
|
3392
3394
|
show() {
|
|
3393
|
-
this.
|
|
3395
|
+
this.jc = !0;
|
|
3394
3396
|
}
|
|
3395
3397
|
hide() {
|
|
3396
|
-
this.
|
|
3398
|
+
this.jc = !1;
|
|
3397
3399
|
}
|
|
3398
3400
|
opacity(t) {
|
|
3399
|
-
if (t === void 0) return this.
|
|
3400
|
-
this.
|
|
3401
|
+
if (t === void 0) return this.yc;
|
|
3402
|
+
this.yc = Math.min(1, Math.max(0, t));
|
|
3401
3403
|
}
|
|
3402
3404
|
blendMode(t) {
|
|
3403
|
-
if (t === void 0) return this.
|
|
3404
|
-
this.
|
|
3405
|
+
if (t === void 0) return this.Wc;
|
|
3406
|
+
this.Wc = t;
|
|
3405
3407
|
}
|
|
3406
3408
|
offset(t, e = 0) {
|
|
3407
|
-
if (t === void 0) return { x: this.Kc, y: this.
|
|
3408
|
-
this.Kc = Math.round(t), this.
|
|
3409
|
+
if (t === void 0) return { x: this.Kc, y: this.Zc };
|
|
3410
|
+
this.Kc = Math.round(t), this.Zc = Math.round(e);
|
|
3411
|
+
}
|
|
3412
|
+
rotateZ(t) {
|
|
3413
|
+
if (t === void 0) return this.qc;
|
|
3414
|
+
this.qc = t;
|
|
3409
3415
|
}
|
|
3410
3416
|
filter(t, e) {
|
|
3411
|
-
this.
|
|
3417
|
+
this.nl.push({ name: t, params: e });
|
|
3412
3418
|
}
|
|
3413
|
-
|
|
3414
|
-
this.
|
|
3419
|
+
cl(t) {
|
|
3420
|
+
this.Vc = t, this.ll(t.grid);
|
|
3415
3421
|
}
|
|
3416
3422
|
wa(t, e) {
|
|
3417
|
-
if (!this.
|
|
3418
|
-
const i = this.
|
|
3419
|
-
this.
|
|
3420
|
-
const s = this.
|
|
3421
|
-
r.begin(), i.ve(e), e.O({ u_characterTexture: this.
|
|
3423
|
+
if (!this.jc || !this.il) return void (this.el = !1);
|
|
3424
|
+
const i = this.Vc.renderer;
|
|
3425
|
+
this.nl = [], this.Jc.begin(), i.state.qt(), this.il.call(t), this.Jc.end();
|
|
3426
|
+
const s = this.nl.length > 0, r = s ? this.sl : this.tl;
|
|
3427
|
+
r.begin(), i.ve(e), e.O({ u_characterTexture: this.Vc.font.fontFramebuffer, u_charsetDimensions: [this.Vc.font.textureColumns, this.Vc.font.textureRows], Ud: this.Jc.textures[0], Ue: this.Jc.textures[1], Uf: this.Jc.textures[2], Ug: [this.Vc.grid.cols, this.Vc.grid.rows], Uh: [r.width, r.height], Ui: [0, 0, 0, 0] }), i.Ae(0, 0, this.Vc.grid.width, this.Vc.grid.height), r.end(), s && this.Vc.filterManager.ul(this.sl.textures[0], this.tl, this.nl, this.tl.width, this.tl.height, this.Vc.layerPingPongBuffers), this.el = !0;
|
|
3422
3428
|
}
|
|
3423
3429
|
Xr(t) {
|
|
3424
3430
|
var e;
|
|
3425
|
-
this.
|
|
3431
|
+
this.Vc && (this.Vc = { ...this.Vc, grid: t }), this.Jc && this.tl && (this.Jc.resize(t.cols, t.rows), this.tl.resize(t.width, t.height), (e = this.sl) == null || e.resize(t.width, t.height));
|
|
3426
3432
|
}
|
|
3427
3433
|
gt() {
|
|
3428
3434
|
var t, e, i;
|
|
3429
|
-
this.
|
|
3435
|
+
this.rl && ((t = this.Jc) == null || t.gt(), (e = this.tl) == null || e.gt(), (i = this.sl) == null || i.gt());
|
|
3430
3436
|
}
|
|
3431
3437
|
get texture() {
|
|
3432
3438
|
var t;
|
|
3433
|
-
return (t = this.
|
|
3439
|
+
return (t = this.tl) == null ? void 0 : t.textures[0];
|
|
3434
3440
|
}
|
|
3435
3441
|
get width() {
|
|
3436
|
-
return this.
|
|
3442
|
+
return this.tl ? this.tl.width : 0;
|
|
3437
3443
|
}
|
|
3438
3444
|
get height() {
|
|
3439
|
-
return this.
|
|
3445
|
+
return this.tl ? this.tl.height : 0;
|
|
3440
3446
|
}
|
|
3441
|
-
get
|
|
3442
|
-
return this.
|
|
3447
|
+
get fl() {
|
|
3448
|
+
return this.el;
|
|
3443
3449
|
}
|
|
3444
3450
|
get drawFramebuffer() {
|
|
3445
|
-
return this.
|
|
3451
|
+
return this.Jc;
|
|
3446
3452
|
}
|
|
3447
|
-
|
|
3448
|
-
this.
|
|
3453
|
+
ll(t) {
|
|
3454
|
+
this.Vc && (this.Jc = this.Vc.externalDrawFramebuffer ?? this.Vc.createFramebuffer(t.cols, t.rows, 4), this.tl = this.Vc.externalAsciiFramebuffer ?? this.Vc.createFramebuffer(t.width, t.height, 1), this.Vc.externalAsciiFramebuffer || (this.sl = this.Vc.createFramebuffer(t.width, t.height, 1)), this.rl = !this.Vc.externalDrawFramebuffer && !this.Vc.externalAsciiFramebuffer, this.el = !1);
|
|
3449
3455
|
}
|
|
3450
3456
|
}
|
|
3451
|
-
const
|
|
3457
|
+
const bt = { 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 };
|
|
3452
3458
|
class Vt {
|
|
3453
3459
|
constructor(t) {
|
|
3454
3460
|
a(this, "Z");
|
|
3455
|
-
a(this, "
|
|
3456
|
-
a(this, "
|
|
3457
|
-
a(this, "
|
|
3458
|
-
this.Z = t, this.
|
|
3459
|
-
precision highp float;uniform sampler2D
|
|
3461
|
+
a(this, "dl");
|
|
3462
|
+
a(this, "vl", null);
|
|
3463
|
+
a(this, "pl", 0);
|
|
3464
|
+
this.Z = t, this.dl = t.pe(K, `#version 300 es
|
|
3465
|
+
precision highp float;uniform sampler2D Uj;uniform sampler2D Uk;uniform vec2 Ul;uniform vec2 Um;uniform vec2 Un;uniform float Uo;uniform vec2 Up;uniform float Uq;uniform int Ur;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-Up;vec2 j=Um*0.5;vec2 k=i-j;float l=cos(-Uq);float m=sin(-Uq);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(Ur,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`);
|
|
3460
3466
|
}
|
|
3461
|
-
yr(t) {
|
|
3462
|
-
this.
|
|
3467
|
+
yr(t, e) {
|
|
3468
|
+
this.vl || (this.vl = [this.Z.Pe(t, e, 1), this.Z.Pe(t, e, 1)]);
|
|
3463
3469
|
}
|
|
3464
|
-
|
|
3465
|
-
const
|
|
3466
|
-
|
|
3467
|
-
const
|
|
3468
|
-
|
|
3469
|
-
for (const
|
|
3470
|
-
this.
|
|
3470
|
+
ml(t) {
|
|
3471
|
+
const e = this.Z.context, { baseTexture: i, targetFramebuffer: s, backgroundColor: r, baseLayer: h, layers: o, canvasWidth: c, canvasHeight: l, gridWidth: u, gridHeight: f, baseOffsetX: d, baseOffsetY: g } = t, m = e.isEnabled(e.DEPTH_TEST), v = e.getParameter(e.DEPTH_WRITEMASK);
|
|
3472
|
+
m && e.disable(e.DEPTH_TEST), v && e.depthMask(!1);
|
|
3473
|
+
const A = this.vl[0], p = this.vl[1];
|
|
3474
|
+
A.begin(), this.Z.bi(...r), A.end(), p.begin(), this.Z.bi(0, 0, 0, 0), p.end(), this.pl = 0, h.jc && this._l(i, c, l, u, f, h.yc, d + h.Kc, g + h.Zc, h.qc, "normal", e);
|
|
3475
|
+
for (const y of o) y.jc && y.fl && this._l(y.texture, c, l, y.width, y.height, y.yc, d + y.Kc, g + y.Zc, y.qc, y.Wc, e);
|
|
3476
|
+
this.yl(s, c, l, e), e.depthMask(v), m && e.enable(e.DEPTH_TEST);
|
|
3471
3477
|
}
|
|
3472
|
-
|
|
3473
|
-
const
|
|
3474
|
-
|
|
3478
|
+
_l(t, e, i, s, r, h, o, c, l, u, f) {
|
|
3479
|
+
const d = this.vl[this.pl], g = this.pl === 0 ? 1 : 0, m = this.vl[g], v = l * (Math.PI / 180);
|
|
3480
|
+
m.begin(), f.disable(f.BLEND), this.Z.ve(this.dl), this.dl.O({ Uj: t, Uk: d.textures[0], Ul: [e, i], Um: [s, r], Un: [o, c], Uo: h, Up: [0, 0], Uq: v, Ur: bt[u] }), this.Z.Ae(0, 0, d.width, d.height), m.end(), this.pl = g;
|
|
3475
3481
|
}
|
|
3476
|
-
|
|
3477
|
-
const r = this.
|
|
3478
|
-
t.begin(), s.disable(s.BLEND), this.Z.ve(this.
|
|
3482
|
+
yl(t, e, i, s) {
|
|
3483
|
+
const r = this.vl[this.pl];
|
|
3484
|
+
t.begin(), s.disable(s.BLEND), this.Z.ve(this.dl), this.dl.O({ Uj: r.textures[0], Uk: r.textures[0], Ul: [e, i], Um: [r.width, r.height], Un: [0, 0], Uo: 1, Up: [0, 0], Uq: 0, Ur: bt.normal }), this.Z.Ae(0, 0, e, i), t.end();
|
|
3479
3485
|
}
|
|
3480
|
-
Xr(t) {
|
|
3481
|
-
this.
|
|
3486
|
+
Xr(t, e) {
|
|
3487
|
+
this.vl && (this.vl[0].resize(t, e), this.vl[1].resize(t, e));
|
|
3482
3488
|
}
|
|
3483
3489
|
gt() {
|
|
3484
|
-
this.
|
|
3490
|
+
this.dl.dispose(), this.vl && (this.vl[0].gt(), this.vl[1].gt(), this.vl = null);
|
|
3485
3491
|
}
|
|
3486
3492
|
}
|
|
3487
|
-
class
|
|
3493
|
+
class kt {
|
|
3488
3494
|
constructor(t) {
|
|
3489
|
-
a(this, "
|
|
3495
|
+
a(this, "xa");
|
|
3490
3496
|
a(this, "Z");
|
|
3491
|
-
a(this, "
|
|
3492
|
-
a(this, "yl");
|
|
3493
|
-
a(this, "Al", []);
|
|
3494
|
-
a(this, "wl", []);
|
|
3497
|
+
a(this, "Al");
|
|
3495
3498
|
a(this, "bl");
|
|
3496
|
-
a(this, "
|
|
3499
|
+
a(this, "wl", []);
|
|
3500
|
+
a(this, "Cl", []);
|
|
3497
3501
|
a(this, "xl");
|
|
3498
3502
|
a(this, "Ml");
|
|
3499
|
-
a(this, "Fl"
|
|
3500
|
-
|
|
3503
|
+
a(this, "Fl");
|
|
3504
|
+
a(this, "Pl");
|
|
3505
|
+
a(this, "$l", !1);
|
|
3506
|
+
this.xa = t, this.Z = t.Z, this.Al = t.Qc, this.bl = new Vt(this.Z), this.xl = new gt({ visible: !0, opacity: 1 });
|
|
3501
3507
|
}
|
|
3502
3508
|
add(t = {}) {
|
|
3503
3509
|
const e = new gt(t);
|
|
3504
|
-
return this
|
|
3510
|
+
return this.$l ? (this.Tl(e), this.Cl.push(e)) : this.wl.push(e), e;
|
|
3505
3511
|
}
|
|
3506
3512
|
remove(t) {
|
|
3507
|
-
this
|
|
3513
|
+
this.Rl(this.Cl, t) || this.Rl(this.wl, t);
|
|
3508
3514
|
}
|
|
3509
3515
|
move(t, e) {
|
|
3510
|
-
this.
|
|
3516
|
+
this.El(this.Cl, t, e) || this.El(this.wl, t, e);
|
|
3511
3517
|
}
|
|
3512
3518
|
swap(t, e) {
|
|
3513
|
-
t !== e && (this.
|
|
3519
|
+
t !== e && (this.Sl(this.Cl, t, e) || this.Sl(this.wl, t, e));
|
|
3514
3520
|
}
|
|
3515
3521
|
yr() {
|
|
3516
|
-
if (this
|
|
3517
|
-
const t = this.
|
|
3518
|
-
this.
|
|
3519
|
-
for (const e of this.
|
|
3520
|
-
this.
|
|
3522
|
+
if (this.$l) return;
|
|
3523
|
+
const t = this.xa.Nn;
|
|
3524
|
+
this.Ml = this.Z.Pe(t.width, t.height, 1), this.Fl = this.Z.Pe(t.width, t.height, 1), this.Pl = [this.Z.Pe(t.width, t.height, 1, { depth: !1 }), this.Z.Pe(t.width, t.height, 1, { depth: !1 })], this.kl(), this.bl.yr(this.xa.Er.width, this.xa.Er.height);
|
|
3525
|
+
for (const e of this.wl) this.Tl(e), this.Cl.push(e);
|
|
3526
|
+
this.wl.length = 0, this.$l = !0;
|
|
3521
3527
|
}
|
|
3522
|
-
|
|
3523
|
-
const i = this.
|
|
3524
|
-
c.begin(), this.Z.ve(this.
|
|
3528
|
+
zl(t, e) {
|
|
3529
|
+
const i = this.xa.Nn, s = this.xa.font, r = this.xa.ga, h = this.xl.ol(), o = h.length > 0, c = o ? this.Fl : this.Ml;
|
|
3530
|
+
c.begin(), this.Z.ve(this.Al), this.Al.O({ u_characterTexture: s.fontFramebuffer, u_charsetDimensions: [s.textureColumns, s.textureRows], Ud: r.textures[0], Ue: r.textures[1], Uf: r.textures[2], Ug: [i.cols, i.rows], Uh: [c.width, c.height], Ui: this.Z.state.canvasBackgroundColor }), this.Z.Ae(0, 0, i.width, i.height), c.end(), o && this.xa.Dl.ul(this.Fl.textures[0], this.Ml, h, this.Ml.width, this.Ml.height, this.Pl), this.Ll(), this.Ol(t, e);
|
|
3525
3531
|
}
|
|
3526
|
-
|
|
3527
|
-
if (this.
|
|
3532
|
+
Ll() {
|
|
3533
|
+
if (this.Cl.length !== 0) for (const t of this.Cl) t.wa(this.xa, this.Al);
|
|
3528
3534
|
}
|
|
3529
|
-
|
|
3530
|
-
|
|
3535
|
+
Ol(t, e) {
|
|
3536
|
+
const i = this.xa.Nn, s = this.xa.Er;
|
|
3537
|
+
this.bl.ml({ baseTexture: this.Ml.textures[0], targetFramebuffer: t, backgroundColor: e, baseLayer: this.xl, layers: this.Cl, canvasWidth: s.width, canvasHeight: s.height, gridWidth: i.width, gridHeight: i.height, baseOffsetX: i.offsetX, baseOffsetY: i.offsetY });
|
|
3531
3538
|
}
|
|
3532
3539
|
Xr() {
|
|
3533
|
-
if (!this
|
|
3534
|
-
const t = this.
|
|
3535
|
-
this.
|
|
3536
|
-
for (const e of this.
|
|
3537
|
-
this.
|
|
3540
|
+
if (!this.$l) return;
|
|
3541
|
+
const t = this.xa.Nn;
|
|
3542
|
+
this.Ml.resize(t.width, t.height), this.Fl.resize(t.width, t.height), this.xl.Xr(t), this.Pl && (this.Pl[0].resize(t.width, t.height), this.Pl[1].resize(t.width, t.height));
|
|
3543
|
+
for (const e of this.Cl) e.Xr(t);
|
|
3544
|
+
this.bl.Xr(this.xa.Er.width, this.xa.Er.height);
|
|
3538
3545
|
}
|
|
3539
3546
|
gt() {
|
|
3540
3547
|
var t, e, i, s;
|
|
3548
|
+
for (const r of this.Cl) r.gt();
|
|
3541
3549
|
for (const r of this.wl) r.gt();
|
|
3542
|
-
|
|
3543
|
-
this.wl.length = 0, this.Al.length = 0, this.bl.gt(), (t = this.Cl) == null || t.gt(), (e = this.xl) == null || e.gt(), (i = this.Ml) == null || i[0].gt(), (s = this.Ml) == null || s[1].gt(), this.yl.gt();
|
|
3550
|
+
this.Cl.length = 0, this.wl.length = 0, this.xl.gt(), (t = this.Ml) == null || t.gt(), (e = this.Fl) == null || e.gt(), (i = this.Pl) == null || i[0].gt(), (s = this.Pl) == null || s[1].gt(), this.bl.gt();
|
|
3544
3551
|
}
|
|
3545
3552
|
get all() {
|
|
3546
|
-
return this.
|
|
3553
|
+
return this.Cl;
|
|
3547
3554
|
}
|
|
3548
3555
|
get base() {
|
|
3549
|
-
return this.
|
|
3556
|
+
return this.xl;
|
|
3550
3557
|
}
|
|
3551
|
-
|
|
3552
|
-
const e = { renderer: this.Z, grid: this.
|
|
3553
|
-
t.
|
|
3558
|
+
Tl(t) {
|
|
3559
|
+
const e = { renderer: this.Z, grid: this.xa.Nn, font: this.xa.font, filterManager: this.xa.Dl, layerPingPongBuffers: this.Pl, createFramebuffer: (i, s, r = 1) => this.Z.Pe(i, s, r) };
|
|
3560
|
+
t.cl(e);
|
|
3554
3561
|
}
|
|
3555
|
-
|
|
3556
|
-
const t = { renderer: this.Z, grid: this.
|
|
3557
|
-
this.
|
|
3562
|
+
kl() {
|
|
3563
|
+
const t = { renderer: this.Z, grid: this.xa.Nn, font: this.xa.font, filterManager: this.xa.Dl, layerPingPongBuffers: this.Pl, createFramebuffer: (e, i, s = 1) => this.Z.Pe(e, i, s), externalDrawFramebuffer: this.xa.ga, externalAsciiFramebuffer: this.Ml };
|
|
3564
|
+
this.xl.cl(t);
|
|
3558
3565
|
}
|
|
3559
|
-
|
|
3566
|
+
Rl(t, e) {
|
|
3560
3567
|
const i = t.indexOf(e);
|
|
3561
3568
|
if (i === -1) return !1;
|
|
3562
3569
|
const [s] = t.splice(i, 1);
|
|
3563
3570
|
return s.gt(), !0;
|
|
3564
3571
|
}
|
|
3565
|
-
|
|
3572
|
+
El(t, e, i) {
|
|
3566
3573
|
const s = t.indexOf(e);
|
|
3567
3574
|
if (s === -1) return !1;
|
|
3568
3575
|
t.splice(s, 1);
|
|
3569
3576
|
const r = Math.max(0, Math.min(t.length, i));
|
|
3570
3577
|
return t.splice(r, 0, e), !0;
|
|
3571
3578
|
}
|
|
3572
|
-
|
|
3579
|
+
Sl(t, e, i) {
|
|
3573
3580
|
const s = t.indexOf(e);
|
|
3574
3581
|
if (s === -1) return !1;
|
|
3575
3582
|
const r = t.indexOf(i);
|
|
3576
3583
|
return r !== -1 && (t[s] = i, t[r] = e, !0);
|
|
3577
3584
|
}
|
|
3578
3585
|
}
|
|
3579
|
-
class
|
|
3586
|
+
class Ht {
|
|
3580
3587
|
constructor(t) {
|
|
3581
3588
|
a(this, "Z");
|
|
3582
|
-
a(this, "
|
|
3583
|
-
a(this, "
|
|
3584
|
-
this.Z = t, this.
|
|
3589
|
+
a(this, "Il", /* @__PURE__ */ new Map());
|
|
3590
|
+
a(this, "Bl", /* @__PURE__ */ new Map());
|
|
3591
|
+
this.Z = t, this.Hl();
|
|
3585
3592
|
}
|
|
3586
|
-
async
|
|
3593
|
+
async Gl(t, e, i = {}) {
|
|
3587
3594
|
const s = Object.entries(i), r = s.length > 0 ? s[0][1][0] : null;
|
|
3588
3595
|
let h;
|
|
3589
3596
|
if (typeof e == "string") {
|
|
@@ -3593,200 +3600,198 @@ class kt {
|
|
|
3593
3600
|
if (!l.ok) throw Error(`Failed to load shader from ${e}: ${l.statusText}`);
|
|
3594
3601
|
c = await l.text();
|
|
3595
3602
|
}
|
|
3596
|
-
h = this.Z.pe(
|
|
3597
|
-
} else h = e, this.
|
|
3603
|
+
h = this.Z.pe(K, c), this.Bl.set(t, h);
|
|
3604
|
+
} else h = e, this.Bl.set(t, h);
|
|
3598
3605
|
const o = { id: t, createShader: () => h, createUniforms: (c, l) => {
|
|
3599
3606
|
const u = { u_resolution: [l.width, l.height] };
|
|
3600
|
-
for (const [f, [
|
|
3601
|
-
let
|
|
3602
|
-
c != null && (typeof c == "number" &&
|
|
3607
|
+
for (const [f, [d, g]] of s) {
|
|
3608
|
+
let m = g;
|
|
3609
|
+
c != null && (typeof c == "number" && d === r ? m = c : typeof c == "object" && d in c && (m = c[d] ?? g)), u[f] = m;
|
|
3603
3610
|
}
|
|
3604
3611
|
return u;
|
|
3605
3612
|
} };
|
|
3606
|
-
this.
|
|
3613
|
+
this.Il.set(t, o);
|
|
3607
3614
|
}
|
|
3608
|
-
|
|
3609
|
-
const e = this.
|
|
3610
|
-
return e && (e.dispose(), this.
|
|
3615
|
+
Ql(t) {
|
|
3616
|
+
const e = this.Bl.get(t);
|
|
3617
|
+
return e && (e.dispose(), this.Bl.delete(t)), this.Il.delete(t);
|
|
3611
3618
|
}
|
|
3612
|
-
|
|
3613
|
-
return this.
|
|
3619
|
+
Nl(t) {
|
|
3620
|
+
return this.Il.get(t);
|
|
3614
3621
|
}
|
|
3615
3622
|
gt() {
|
|
3616
|
-
for (const t of this.
|
|
3617
|
-
this.
|
|
3623
|
+
for (const t of this.Bl.values()) t.dispose();
|
|
3624
|
+
this.Bl.clear(), this.Il.clear();
|
|
3618
3625
|
}
|
|
3619
|
-
|
|
3620
|
-
this.
|
|
3621
|
-
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.
|
|
3622
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3623
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3624
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3626
|
+
Hl() {
|
|
3627
|
+
this.Gl("invert", `#version 300 es
|
|
3628
|
+
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.Gl("grayscale", `#version 300 es
|
|
3629
|
+
precision highp float;uniform sampler2D u_texture;uniform float U1;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),U1);fragColor=vec4(C,A.a);}`, { U1: ["amount", 1] }), this.Gl("sepia", `#version 300 es
|
|
3630
|
+
precision highp float;uniform sampler2D u_texture;uniform float U1;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,U1);fragColor=vec4(C,A.a);}`, { U1: ["amount", 1] }), this.Gl("threshold", `#version 300 es
|
|
3631
|
+
precision highp float;uniform sampler2D u_texture;uniform float U2;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(U2,B);fragColor=vec4(vec3(C),A.a);}`, { U2: ["threshold", 0.5] });
|
|
3625
3632
|
}
|
|
3626
3633
|
}
|
|
3627
|
-
class
|
|
3634
|
+
class jt {
|
|
3628
3635
|
constructor(t) {
|
|
3629
3636
|
a(this, "Z");
|
|
3630
|
-
a(this, "
|
|
3637
|
+
a(this, "Bl", /* @__PURE__ */ new Map());
|
|
3631
3638
|
a(this, "J");
|
|
3632
|
-
a(this, "
|
|
3633
|
-
a(this, "
|
|
3634
|
-
a(this, "
|
|
3635
|
-
this.Z = t, this.
|
|
3636
|
-
precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`);
|
|
3639
|
+
a(this, "vl");
|
|
3640
|
+
a(this, "Dc", !1);
|
|
3641
|
+
a(this, "Xl");
|
|
3642
|
+
this.Z = t, this.Xl = new Ht(this.Z), this.J = t.pe(K, Xt);
|
|
3637
3643
|
}
|
|
3638
3644
|
async register(t, e, i = {}) {
|
|
3639
|
-
await this.
|
|
3645
|
+
await this.Xl.Gl(t, e, i);
|
|
3640
3646
|
}
|
|
3641
3647
|
unregister(t) {
|
|
3642
|
-
return this.Ql
|
|
3648
|
+
return this.Xl.Ql(t) ?? !1;
|
|
3643
3649
|
}
|
|
3644
3650
|
has(t) {
|
|
3645
|
-
return this.
|
|
3651
|
+
return this.Xl.Nl(t) !== void 0;
|
|
3646
3652
|
}
|
|
3647
3653
|
yr(t, e) {
|
|
3648
|
-
this.
|
|
3654
|
+
this.Dc || (this.vl = [this.Z.Pe(t, e, 1, { depth: !1 }), this.Z.Pe(t, e, 1, { depth: !1 })], this.Dc = !0);
|
|
3649
3655
|
}
|
|
3650
|
-
|
|
3651
|
-
this.
|
|
3656
|
+
Yl(t, e, i, s, r) {
|
|
3657
|
+
this.vl[0].width === s && this.vl[0].height === r || (this.vl[0].resize(s, r), this.vl[1].resize(s, r)), this.ul(t, e, i, s, r, this.vl);
|
|
3652
3658
|
}
|
|
3653
|
-
|
|
3654
|
-
if (i.length === 0) return void this.
|
|
3659
|
+
ul(t, e, i, s, r, h) {
|
|
3660
|
+
if (i.length === 0) return void this.jl(t, e, s, r);
|
|
3655
3661
|
const o = this.Z.context, c = o.isEnabled(o.BLEND);
|
|
3656
|
-
o.disable(o.BLEND), this.
|
|
3662
|
+
o.disable(o.BLEND), this.jl(t, h[0], s, r);
|
|
3657
3663
|
let l = 0;
|
|
3658
3664
|
for (let u = 0; u < i.length; u++) {
|
|
3659
|
-
const f = i[u],
|
|
3660
|
-
this.
|
|
3665
|
+
const f = i[u], d = u === i.length - 1, g = l === 0 ? 1 : 0, m = d ? e : h[g];
|
|
3666
|
+
this.Wl(f, h[l], m, s, r), d || (l = g);
|
|
3661
3667
|
}
|
|
3662
3668
|
c && o.enable(o.BLEND);
|
|
3663
3669
|
}
|
|
3664
|
-
|
|
3665
|
-
const h = this.
|
|
3666
|
-
if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.
|
|
3667
|
-
const o = this.
|
|
3670
|
+
Wl(t, e, i, s, r) {
|
|
3671
|
+
const h = this.Xl.Nl(t.name);
|
|
3672
|
+
if (!h) return console.warn(`[textmode.js] Unknown filter: "${t.name}". Skipping.`), void this.jl(e.textures[0], i, s, r);
|
|
3673
|
+
const o = this.Kl(t.name, h, s, r), c = { renderer: this.Z, gl: this.Z.context, width: s, height: r };
|
|
3668
3674
|
i.begin(), this.Z.ve(o), o.O({ u_texture: e.textures[0] });
|
|
3669
3675
|
const l = h.createUniforms(t.params, c);
|
|
3670
3676
|
o.O(l), this.Z.Ae(0, 0, s, r), i.end();
|
|
3671
3677
|
}
|
|
3672
|
-
|
|
3673
|
-
let r = this.
|
|
3678
|
+
Kl(t, e, i, s) {
|
|
3679
|
+
let r = this.Bl.get(t);
|
|
3674
3680
|
if (!r && e) {
|
|
3675
3681
|
const h = { renderer: this.Z, gl: this.Z.context, width: i, height: s };
|
|
3676
|
-
r = e.createShader(h), this.
|
|
3682
|
+
r = e.createShader(h), this.Bl.set(t, r);
|
|
3677
3683
|
}
|
|
3678
3684
|
return r;
|
|
3679
3685
|
}
|
|
3680
|
-
|
|
3686
|
+
jl(t, e, i, s) {
|
|
3681
3687
|
e.begin(), this.Z.ve(this.J), this.J.O({ u_texture: t, u_resolution: [i, s] }), this.Z.Ae(0, 0, i, s), e.end();
|
|
3682
3688
|
}
|
|
3683
3689
|
Xr(t, e) {
|
|
3684
|
-
this.
|
|
3690
|
+
this.vl && (this.vl[0].resize(t, e), this.vl[1].resize(t, e));
|
|
3685
3691
|
}
|
|
3686
3692
|
gt() {
|
|
3687
|
-
for (const t of this.
|
|
3688
|
-
this.
|
|
3693
|
+
for (const t of this.Bl.values()) t.dispose();
|
|
3694
|
+
this.Bl.clear(), this.J.dispose(), this.Xl.gt(), this.vl && (this.vl[0].gt(), this.vl[1].gt()), this.Dc = !1;
|
|
3689
3695
|
}
|
|
3690
3696
|
}
|
|
3691
|
-
const
|
|
3697
|
+
const ti = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: Ht, TextmodeFilterManager: jt }, Symbol.toStringTag, { value: "Module" }));
|
|
3692
3698
|
class Qe extends function(e, ...i) {
|
|
3693
3699
|
return i.reduce((s, r) => r(s), e);
|
|
3694
3700
|
}(class {
|
|
3695
|
-
},
|
|
3701
|
+
}, Ie, Ye, ze, Ge, Ve, ke) {
|
|
3696
3702
|
constructor(e = {}) {
|
|
3697
3703
|
super();
|
|
3698
3704
|
a(this, "Z");
|
|
3699
3705
|
a(this, "rr");
|
|
3700
3706
|
a(this, "Er");
|
|
3701
3707
|
a(this, "Nn");
|
|
3702
|
-
a(this, "ya");
|
|
3703
|
-
a(this, "Yh");
|
|
3704
|
-
a(this, "ma");
|
|
3705
3708
|
a(this, "ba");
|
|
3706
|
-
a(this, "
|
|
3709
|
+
a(this, "Yh");
|
|
3710
|
+
a(this, "_a");
|
|
3711
|
+
a(this, "Ca");
|
|
3712
|
+
a(this, "Zl");
|
|
3707
3713
|
a(this, "ga");
|
|
3708
|
-
a(this, "Gc");
|
|
3709
|
-
a(this, "La");
|
|
3710
3714
|
a(this, "Qc");
|
|
3711
|
-
a(this, "
|
|
3712
|
-
a(this, "
|
|
3713
|
-
a(this, "
|
|
3714
|
-
a(this, "
|
|
3715
|
+
a(this, "Oa");
|
|
3716
|
+
a(this, "Nc");
|
|
3717
|
+
a(this, "ma");
|
|
3718
|
+
a(this, "Dl");
|
|
3719
|
+
a(this, "ql", []);
|
|
3715
3720
|
a(this, "Vl");
|
|
3716
3721
|
a(this, "Jl");
|
|
3717
|
-
a(this, "tu"
|
|
3722
|
+
a(this, "tu");
|
|
3718
3723
|
a(this, "su", !1);
|
|
3719
3724
|
a(this, "iu", !1);
|
|
3720
3725
|
a(this, "eu", !1);
|
|
3721
|
-
a(this, "ru",
|
|
3726
|
+
a(this, "ru", !1);
|
|
3727
|
+
a(this, "nu", () => {
|
|
3722
3728
|
});
|
|
3723
|
-
a(this, "
|
|
3729
|
+
a(this, "il", () => {
|
|
3724
3730
|
});
|
|
3725
|
-
a(this, "
|
|
3731
|
+
a(this, "hu", () => {
|
|
3726
3732
|
});
|
|
3727
|
-
a(this, "hu");
|
|
3728
3733
|
a(this, "ou");
|
|
3729
|
-
a(this, "Lr", !1);
|
|
3730
3734
|
a(this, "au");
|
|
3731
|
-
a(this, "
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3735
|
+
a(this, "Lr", !1);
|
|
3736
|
+
a(this, "cu");
|
|
3737
|
+
a(this, "ya", /* @__PURE__ */ new Set());
|
|
3738
|
+
this.tu = new He(this), this.Lr = e.overlay ?? !1, this.Er = new De(e), this.Z = new pe(this.Er.Yr()), this.rr = new mt(this.Z, e.fontSize ?? 16), this.ba = new Dt(e.frameRate ?? 60), this.Zl = new Gt(this, e.loadingScreen, this.Er.Nr()), this.Zl.Hc(() => {
|
|
3739
|
+
this.ba.Gn = 0, this.ru = !0;
|
|
3740
|
+
}), this.Yh = new Lt(this.Er), this._a = new Bt(this.Er, this.Yh), this.Ca = new _t(), this.Qc = this.Z.pe(K, `#version 300 es
|
|
3741
|
+
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);}`), this.ma = new kt(this), this.Dl = new jt(this.Z), this.Zl.kn(), this.lu(e);
|
|
3742
|
+
}
|
|
3743
|
+
async lu(e) {
|
|
3744
|
+
await Promise.all([this.rr.yr(e.fontSource), this.Zl.yr(e.fontSource)]);
|
|
3739
3745
|
const i = this.rr.maxGlyphDimensions;
|
|
3740
|
-
this.Nn = new Ut(this.Er.canvas, i.width, i.height), this.Yh.yr(this.Nn), this.
|
|
3741
|
-
precision highp float;uniform sampler2D U0;uniform vec2 U1;uniform vec2 U2;uniform vec2 U3;in vec2 v_uv;out vec4 fragColor;void main(){vec2 A=gl_FragCoord.xy-U2;vec2 B=A*(U1/U3);vec2 C=(floor(B)+0.5)/U1;fragColor=texture(U0,C);}`), this.lu(), this.ya.kn(() => this.wa()), await this.Jl.$a(e.plugins ?? []);
|
|
3746
|
+
this.Nn = new Ut(this.Er.canvas, i.width, i.height), this.Yh.yr(this.Nn), this._a.yr(this.Nn), this.ga = this.Z.Pe(this.Nn.cols, this.Nn.rows, 3), this.Oa = this.Z.Pe(this.Nn.width, this.Nn.height, 1), this.Vl = this.Z.Pe(this.Er.width, this.Er.height, 1), this.Jl = this.Z.Pe(this.Er.width, this.Er.height, 1), this.Dl.yr(this.Er.width, this.Er.height), this.ma.yr(), this.Lr && (this.cu = I.Cn(this.Z, this.rr, this.Er.targetCanvas, this.Nn.cols, this.Nn.rows), this.pa(this.cu)), this.Nc = this.Z.pe(K, Xt), this.uu(), this.ba.kn(() => this.wa()), await this.tu.Ta(e.plugins ?? []);
|
|
3742
3747
|
try {
|
|
3743
|
-
await this.
|
|
3748
|
+
await this.nu(), this.Zl.cc();
|
|
3744
3749
|
} catch (s) {
|
|
3745
|
-
console.error("Error during setup:", s), this.
|
|
3750
|
+
console.error("Error during setup:", s), this.Zl.error(s);
|
|
3746
3751
|
}
|
|
3747
3752
|
}
|
|
3748
|
-
|
|
3749
|
-
this.
|
|
3750
|
-
this.Lr && this.resizeCanvas(this.Er.targetCanvas.width, this.Er.targetCanvas.height), this.
|
|
3751
|
-
}, window.addEventListener("resize", this.
|
|
3752
|
-
this.
|
|
3753
|
-
}), this.Lr && (this.
|
|
3753
|
+
uu() {
|
|
3754
|
+
this.ou = () => {
|
|
3755
|
+
this.Lr && this.resizeCanvas(this.Er.targetCanvas.width, this.Er.targetCanvas.height), this.hu();
|
|
3756
|
+
}, window.addEventListener("resize", this.ou), this.Yh.dh(), this._a.dh(), this.Ca.dh(), window.addEventListener("blur", () => {
|
|
3757
|
+
this.Ca.Xh();
|
|
3758
|
+
}), this.Lr && (this.au = new ResizeObserver(() => {
|
|
3754
3759
|
this.resizeCanvas(this.Er.targetCanvas.width, this.Er.targetCanvas.height);
|
|
3755
|
-
}), this.
|
|
3760
|
+
}), this.au.observe(this.Er.targetCanvas));
|
|
3756
3761
|
}
|
|
3757
3762
|
wa() {
|
|
3758
|
-
if (!this.
|
|
3759
|
-
this.
|
|
3763
|
+
if (!this.Zl.nc && this.ru) {
|
|
3764
|
+
this.iu = !0;
|
|
3760
3765
|
try {
|
|
3761
|
-
this.
|
|
3766
|
+
this.ba.In(), this.ba.Qn(), this.Lr && Rt(this.Z.context, this.cu.texture, this.Er.targetCanvas), this.tu.ka(), this.Z.state.qt(), this.ga.begin(), this.ma.base.hl() ? this.ma.base.al(this) : this.il(), this.ga.end();
|
|
3762
3767
|
const e = [...this.Z.state.canvasBackgroundColor];
|
|
3763
|
-
this.
|
|
3764
|
-
let i = this.
|
|
3765
|
-
this.
|
|
3768
|
+
this.ma.zl(this.Vl, e);
|
|
3769
|
+
let i = this.Vl.textures[0];
|
|
3770
|
+
this.ql.length > 0 && (this.Dl.Yl(this.Vl.textures[0], this.Jl, this.ql, this.Er.width, this.Er.height), i = this.Jl.textures[0], this.ql = []), this.Z.bi(0, 0, 0, 0), this.Z.ve(this.Nc), this.Nc.O({ u_texture: i }), this.Z.Ae(0, 0, this.Er.width, this.Er.height), this.tu.Da();
|
|
3766
3771
|
} finally {
|
|
3767
|
-
this.
|
|
3772
|
+
this.iu = !1, this.su && !this.eu && this.fu();
|
|
3768
3773
|
}
|
|
3769
3774
|
}
|
|
3770
3775
|
}
|
|
3771
3776
|
resizeCanvas(e, i) {
|
|
3772
3777
|
var s, r, h, o;
|
|
3773
|
-
this.Er.Xr(e, i), this.
|
|
3778
|
+
this.Er.Xr(e, i), this.Zl.Xc(this.Er.Nr()), this.Nn.ti(), this.Zl.Xr(), this.ga.resize(this.Nn.cols, this.Nn.rows), this.Oa.resize(this.Nn.width, this.Nn.height), (s = this.Vl) == null || s.resize(this.Er.width, this.Er.height), (r = this.Jl) == null || r.resize(this.Er.width, this.Er.height), (h = this.Dl) == null || h.Xr(this.Er.width, this.Er.height), (o = this.ma) == null || o.Xr(), this.Z.Re(), this.Yh.fh(), this._a.fh(), this.wa();
|
|
3774
3779
|
}
|
|
3775
3780
|
destroy() {
|
|
3776
|
-
this.
|
|
3781
|
+
this.eu || this.su || (this.su = !0, this.ba.Dn(), this.iu || this.fu());
|
|
3777
3782
|
}
|
|
3778
|
-
|
|
3783
|
+
fu() {
|
|
3779
3784
|
var e, i, s, r, h, o;
|
|
3780
|
-
this.
|
|
3785
|
+
this.su = !1, this.Zl.gt(), this.tu.La(), window.removeEventListener("resize", this.ou), (e = this.au) == null || e.disconnect(), this.Yh.bh(), this._a.bh(), this.Ca.bh(), this.ga.gt(), this.Qc.dispose(), (i = this.ma) == null || i.gt(), (s = this.Dl) == null || s.gt(), (r = this.Vl) == null || r.gt(), (h = this.Jl) == null || h.gt(), this.rr.gt(), this.Z.gt(), this.Oa.gt(), this.Nc.dispose(), (o = this.cu) == null || o.gt(), this.Er.gt(), this.eu = !0;
|
|
3781
3786
|
}
|
|
3782
3787
|
setup(e) {
|
|
3783
|
-
this.
|
|
3788
|
+
this.nu = e;
|
|
3784
3789
|
}
|
|
3785
3790
|
draw(e) {
|
|
3786
|
-
this.
|
|
3791
|
+
this.il = e;
|
|
3787
3792
|
}
|
|
3788
3793
|
windowResized(e) {
|
|
3789
|
-
this.
|
|
3794
|
+
this.hu = e;
|
|
3790
3795
|
}
|
|
3791
3796
|
get grid() {
|
|
3792
3797
|
return this.Nn;
|
|
@@ -3807,25 +3812,25 @@ precision highp float;uniform sampler2D U0;uniform vec2 U1;uniform vec2 U2;unifo
|
|
|
3807
3812
|
return this.ga;
|
|
3808
3813
|
}
|
|
3809
3814
|
get isDisposed() {
|
|
3810
|
-
return this.
|
|
3815
|
+
return this.eu;
|
|
3811
3816
|
}
|
|
3812
3817
|
get overlay() {
|
|
3813
|
-
return this.
|
|
3818
|
+
return this.cu;
|
|
3814
3819
|
}
|
|
3815
3820
|
get loading() {
|
|
3816
|
-
return this.
|
|
3821
|
+
return this.Zl;
|
|
3817
3822
|
}
|
|
3818
3823
|
get layers() {
|
|
3819
|
-
return this.
|
|
3824
|
+
return this.ma;
|
|
3820
3825
|
}
|
|
3821
3826
|
get filters() {
|
|
3822
|
-
return this.
|
|
3827
|
+
return this.Dl;
|
|
3823
3828
|
}
|
|
3824
3829
|
filter(e, i) {
|
|
3825
|
-
this.
|
|
3830
|
+
this.ql.push({ name: e, params: i });
|
|
3826
3831
|
}
|
|
3827
3832
|
pa(e) {
|
|
3828
|
-
this.
|
|
3833
|
+
this.ya.has(e) || this.ya.add(e);
|
|
3829
3834
|
}
|
|
3830
3835
|
}
|
|
3831
3836
|
class At {
|
|
@@ -3835,34 +3840,34 @@ class At {
|
|
|
3835
3840
|
return new Qe(t);
|
|
3836
3841
|
}
|
|
3837
3842
|
static setErrorLevel(t) {
|
|
3838
|
-
|
|
3843
|
+
vt._(t);
|
|
3839
3844
|
}
|
|
3840
3845
|
static get version() {
|
|
3841
|
-
return "0.7.
|
|
3846
|
+
return "0.7.1-beta.2";
|
|
3842
3847
|
}
|
|
3843
3848
|
}
|
|
3844
3849
|
let ct = null;
|
|
3845
|
-
const
|
|
3846
|
-
precision highp float;in vec2 v_uv;uniform sampler2D u_image;uniform bool u_invert;uniform bool u_flipX;uniform bool u_flipY;uniform float u_charRotation;uniform bool u_charColorFixed;uniform vec4 u_charColor;uniform bool u_cellColorFixed;uniform vec4 u_cellColor;uniform vec4 u_backgroundColor;uniform int u_charCount;uniform vec3 u_charList[255];uniform bool u_colorFilterEnabled;uniform int u_colorFilterSize;uniform vec4 u_colorFilterPalette[64];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;float B(vec3 C){return dot(C,vec3(0.299f,0.587f,0.114f));}float D(vec3 E,vec3 F){vec3 G=E-F;return dot(G,G);}vec4 H(vec4 I){if(!u_colorFilterEnabled||u_colorFilterSize<=0){return I;}int J=min(u_colorFilterSize,64);vec3 K=u_colorFilterPalette[0].rgb;float L=D(I.rgb,K);for(int M=1;M<64;++M){if(M>=J){break;}vec3 N=u_colorFilterPalette[M].rgb;float O=D(I.rgb,N);if(O<L){L=O;K=N;}}return vec4(K,I.a);}void main(){vec2 P=vec2(v_uv.x,1.0f-v_uv.y);vec4 I=texture(u_image,P);I=H(I);float F=B(I.rgb);vec2 Q=vec2(0.);if(u_charCount>0){float R=float(u_charCount);float S=clamp(F*(R-1.0f),0.0f,R-1.0f);int T=int(floor(S+0.5f));vec3 U=u_charList[T];Q=U.xy;}else{Q=vec2(0.0f,0.0f);}vec4 V=u_charColorFixed?u_charColor:I;vec4 W=u_cellColorFixed?u_cellColor:I;if(I.a<0.01f){discard;}o_primaryColor=vec4(V.rgb,V.a);o_secondaryColor=vec4(W.rgb,W.a);A=vec4(0.);int X=int(u_invert?1:0);int Y=int(u_flipX?1:0);int Z=int(u_flipY?1:0);float a=float(X|(Y<<1)|(Z<<2))/255.;o_character=vec4(Q,a,clamp(u_charRotation,0.0f,1.0f));}`)), ct), createUniforms: ({ source: n }) => n.createBaseConversionUniforms() },
|
|
3847
|
-
Le(
|
|
3848
|
-
const
|
|
3850
|
+
const qe = { id: "brightness", createShader: ({ gl: n }) => (ct || (ct = new H(n, it, `#version 300 es
|
|
3851
|
+
precision highp float;in vec2 v_uv;uniform sampler2D u_image;uniform bool u_invert;uniform bool u_flipX;uniform bool u_flipY;uniform float u_charRotation;uniform bool u_charColorFixed;uniform vec4 u_charColor;uniform bool u_cellColorFixed;uniform vec4 u_cellColor;uniform vec4 u_backgroundColor;uniform int u_charCount;uniform vec3 u_charList[255];uniform bool u_colorFilterEnabled;uniform int u_colorFilterSize;uniform vec4 u_colorFilterPalette[64];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;float B(vec3 C){return dot(C,vec3(0.299f,0.587f,0.114f));}float D(vec3 E,vec3 F){vec3 G=E-F;return dot(G,G);}vec4 H(vec4 I){if(!u_colorFilterEnabled||u_colorFilterSize<=0){return I;}int J=min(u_colorFilterSize,64);vec3 K=u_colorFilterPalette[0].rgb;float L=D(I.rgb,K);for(int M=1;M<64;++M){if(M>=J){break;}vec3 N=u_colorFilterPalette[M].rgb;float O=D(I.rgb,N);if(O<L){L=O;K=N;}}return vec4(K,I.a);}void main(){vec2 P=vec2(v_uv.x,1.0f-v_uv.y);vec4 I=texture(u_image,P);I=H(I);float F=B(I.rgb);vec2 Q=vec2(0.);if(u_charCount>0){float R=float(u_charCount);float S=clamp(F*(R-1.0f),0.0f,R-1.0f);int T=int(floor(S+0.5f));vec3 U=u_charList[T];Q=U.xy;}else{Q=vec2(0.0f,0.0f);}vec4 V=u_charColorFixed?u_charColor:I;vec4 W=u_cellColorFixed?u_cellColor:I;if(I.a<0.01f){discard;}o_primaryColor=vec4(V.rgb,V.a);o_secondaryColor=vec4(W.rgb,W.a);A=vec4(0.);int X=int(u_invert?1:0);int Y=int(u_flipX?1:0);int Z=int(u_flipY?1:0);float a=float(X|(Y<<1)|(Z<<2))/255.;o_character=vec4(Q,a,clamp(u_charRotation,0.0f,1.0f));}`)), ct), createUniforms: ({ source: n }) => n.createBaseConversionUniforms() }, ei = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhaseTracker: Zt, LoadingScreenManager: Gt, LoadingScreenStateMachine: Ot, LoadingScreenTransition: It, resolveColorInputs: zt, resolveDefaultPalette: Yt, resolveTheme: dt }, Symbol.toStringTag, { value: "Module" })), ii = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: mt, TextmodeImage: I, TextmodeVideo: rt }, Symbol.toStringTag, { value: "Module" })), si = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: Xe, mouse: Be, touch: Ze }, Symbol.toStringTag, { value: "Module" })), ri = Object.freeze(Object.defineProperty({ __proto__: null, LayerCompositor: Vt, TextmodeLayer: gt, TextmodeLayerManager: kt }, Symbol.toStringTag, { value: "Module" }));
|
|
3852
|
+
Le(qe);
|
|
3853
|
+
const ni = At.create, hi = At.setErrorLevel, oi = At.version;
|
|
3849
3854
|
export {
|
|
3850
|
-
|
|
3855
|
+
De as TextmodeCanvas,
|
|
3851
3856
|
M as TextmodeColor,
|
|
3852
|
-
|
|
3853
|
-
|
|
3857
|
+
Jt as TextmodeErrorLevel,
|
|
3858
|
+
j as TextmodeFramebuffer,
|
|
3854
3859
|
Ut as TextmodeGrid,
|
|
3855
3860
|
Qe as Textmodifier,
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3861
|
+
ni as create,
|
|
3862
|
+
ti as filters,
|
|
3863
|
+
_e as getConversionStrategy,
|
|
3864
|
+
si as input,
|
|
3865
|
+
ri as layering,
|
|
3866
|
+
ii as loadables,
|
|
3867
|
+
ei as loading,
|
|
3863
3868
|
Le as registerConversionStrategy,
|
|
3864
|
-
|
|
3869
|
+
hi as setErrorLevel,
|
|
3865
3870
|
At as textmode,
|
|
3866
|
-
|
|
3867
|
-
|
|
3871
|
+
$e as unregisterConversionStrategy,
|
|
3872
|
+
oi as version
|
|
3868
3873
|
};
|