textmode.js 0.2.0-beta.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  var Z = Object.defineProperty;
2
2
  var K = (E, A, t) => A in E ? Z(E, A, { enumerable: !0, configurable: !0, writable: !0, value: t }) : E[A] = t;
3
- var o = (E, A, t) => K(E, typeof A != "symbol" ? A + "" : A, t);
3
+ var n = (E, A, t) => K(E, typeof A != "symbol" ? A + "" : A, t);
4
4
  class m extends Error {
5
5
  constructor(A, t = {}) {
6
6
  super(m.A(A, t)), this.name = "TextmodeError";
@@ -36,7 +36,7 @@ class m extends Error {
36
36
  var q = ((E) => (E[E.SILENT = 0] = "SILENT", E[E.WARNING = 1] = "WARNING", E[E.ERROR = 2] = "ERROR", E[E.THROW = 3] = "THROW", E))(q || {});
37
37
  const v = class v {
38
38
  constructor() {
39
- o(this, "C", { globalLevel: 3 });
39
+ n(this, "C", { globalLevel: 3 });
40
40
  }
41
41
  static D() {
42
42
  return v.o || (v.o = new v()), v.o;
@@ -61,9 +61,9 @@ const v = class v {
61
61
  this.C.globalLevel = A;
62
62
  }
63
63
  };
64
- o(v, "o", null);
65
- let F = v;
66
- const _ = F.D(), V = /* @__PURE__ */ new WeakMap();
64
+ n(v, "o", null);
65
+ let S = v;
66
+ const _ = S.D(), V = /* @__PURE__ */ new WeakMap();
67
67
  function G(E, A) {
68
68
  V.set(E, A);
69
69
  }
@@ -72,16 +72,16 @@ function R(E) {
72
72
  }
73
73
  class U {
74
74
  constructor(A, t, e = t, s = 1, r = {}) {
75
- o(this, "I");
76
- o(this, "p");
77
- o(this, "C");
78
- o(this, "_", null);
79
- o(this, "m");
80
- o(this, "v");
81
- o(this, "G", []);
82
- o(this, "$");
83
- o(this, "M", null);
84
- o(this, "Y", []);
75
+ n(this, "I");
76
+ n(this, "p");
77
+ n(this, "C");
78
+ n(this, "_", null);
79
+ n(this, "m");
80
+ n(this, "v");
81
+ n(this, "G", []);
82
+ n(this, "$");
83
+ n(this, "M", null);
84
+ n(this, "Y", []);
85
85
  this.I = t, this.p = e, this.C = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", ...r }, this.m = A, this.$ = Math.min(Math.max(1, s), 8);
86
86
  const i = A.getParameter(A.MAX_DRAW_BUFFERS), B = A.getParameter(A.MAX_COLOR_ATTACHMENTS);
87
87
  this.$ = Math.min(this.$, i, B), this.v = A.createFramebuffer(), this.R(), this.S(), this.Y = Array(this.$).fill(null);
@@ -125,12 +125,12 @@ class U {
125
125
  if (e) return e;
126
126
  const s = this.I, r = this.p, i = new Uint8Array(s * r * 4), B = t.getParameter(t.READ_FRAMEBUFFER_BINDING);
127
127
  t.bindFramebuffer(t.READ_FRAMEBUFFER, this.v), t.readBuffer(t.COLOR_ATTACHMENT0 + A), t.readPixels(0, 0, s, r, t.RGBA, t.UNSIGNED_BYTE, i), t.bindFramebuffer(t.READ_FRAMEBUFFER, B);
128
- const n = 4 * s, Q = new Uint8Array(i.length);
128
+ const Q = 4 * s, o = new Uint8Array(i.length);
129
129
  for (let h = 0; h < r; h++) {
130
- const a = (r - 1 - h) * n, g = h * n;
131
- Q.set(i.subarray(a, a + n), g);
130
+ const a = (r - 1 - h) * Q, g = h * Q;
131
+ o.set(i.subarray(a, a + Q), g);
132
132
  }
133
- return this.Y[A] = Q, Q;
133
+ return this.Y[A] = o, o;
134
134
  }
135
135
  L() {
136
136
  for (let A = 0; A < this.$; A++) this.U(A);
@@ -182,12 +182,12 @@ class U {
182
182
  }
183
183
  class z {
184
184
  constructor(A, t, e) {
185
- o(this, "m");
186
- o(this, "J");
187
- o(this, "V", /* @__PURE__ */ new Map());
188
- o(this, "K", /* @__PURE__ */ new Map());
189
- o(this, "Z", 0);
190
- o(this, "j");
185
+ n(this, "m");
186
+ n(this, "J");
187
+ n(this, "V", /* @__PURE__ */ new Map());
188
+ n(this, "K", /* @__PURE__ */ new Map());
189
+ n(this, "Z", 0);
190
+ n(this, "j");
191
191
  this.m = A, this.J = this.X(t, e), this.j = A.getParameter(A.MAX_TEXTURE_IMAGE_UNITS), this.N();
192
192
  }
193
193
  N() {
@@ -269,19 +269,19 @@ class z {
269
269
  }
270
270
  class AA {
271
271
  constructor() {
272
- o(this, "rA", 1);
273
- o(this, "EA", 0);
274
- o(this, "nA", 0);
275
- o(this, "oA", 0);
276
- o(this, "gA", [0, 0, 0]);
277
- o(this, "aA", [1, 1, 1, 1]);
278
- o(this, "hA", [0, 0, 0, 1]);
279
- o(this, "cA", !1);
280
- o(this, "CA", !1);
281
- o(this, "DA", !1);
282
- o(this, "lA", [0, 0]);
283
- o(this, "PA", [0, 0, 0, 1]);
284
- o(this, "uA", []);
272
+ n(this, "rA", 1);
273
+ n(this, "EA", 0);
274
+ n(this, "nA", 0);
275
+ n(this, "oA", 0);
276
+ n(this, "gA", [0, 0, 0]);
277
+ n(this, "aA", [1, 1, 1, 1]);
278
+ n(this, "hA", [0, 0, 0, 1]);
279
+ n(this, "cA", !1);
280
+ n(this, "CA", !1);
281
+ n(this, "DA", !1);
282
+ n(this, "lA", [0, 0]);
283
+ n(this, "PA", [0, 0, 0, 1]);
284
+ n(this, "uA", []);
285
285
  }
286
286
  IA() {
287
287
  this.uA.push({ lineWeight: this.rA, rotationX: this.EA, rotationY: this.nA, rotationZ: this.oA, charRotation: [...this.lA], flipHorizontally: this.cA, flipVertically: this.CA, invert: this.DA, character: [...this.gA], charColor: [...this.aA], cellColor: [...this.hA] });
@@ -344,25 +344,25 @@ var L = `#version 300 es
344
344
  in vec2 a_position;in vec2 a_texCoord;in vec2 a_instancePosition;in vec2 a_instanceSize;in vec3 a_instanceCharacter;in vec4 a_instancePrimaryColor;in vec4 a_instanceSecondaryColor;in vec2 a_instanceRotation;in vec3 a_instanceTransform;in vec3 a_instanceGlobalRotation;in vec2 a_instanceRotationCenter;in vec2 a_instanceBezierCP1;in vec2 a_instanceBezierCP2;in vec2 a_instanceBezierStart;in vec2 a_instanceBezierEnd;in vec2 a_instanceArcAngles;uniform float u_aspectRatio;uniform vec2 u_viewportSize;out vec2 v_uv;out vec3 v_character;out vec4 v_primaryColor;out vec4 v_secondaryColor;out vec2 v_rotation;out vec3 v_transform;mat3 rotateX(float a){float s=sin(a),c=cos(a);return mat3(1,0,0,0,c,-s,0,s,c);}mat3 rotateY(float a){float s=sin(a),c=cos(a);return mat3(c,0,s,0,1,0,-s,0,c);}mat3 rotateZ(float a){float s=sin(a),c=cos(a);return mat3(c,-s,0,s,c,0,0,0,1);}vec2 evaluateBezier(float t,vec2 p0,vec2 p1,vec2 p2,vec2 p3){float u=1.-t,u2=u*u,t2=t*t;return u2*u*p0+3.*u2*t*p1+3.*u*t2*p2+t2*t*p3;}vec2 evaluateBezierDerivative(float t,vec2 p0,vec2 p1,vec2 p2,vec2 p3){float u=1.-t,u2=u*u,t2=t*t;return-3.*u2*p0+3.*u2*p1-6.*u*t*p1+6.*u*t*p2-3.*t2*p2+3.*t2*p3;}void main(){v_uv=a_texCoord;v_character=a_instanceCharacter;v_primaryColor=a_instancePrimaryColor;v_secondaryColor=a_instanceSecondaryColor;v_rotation=a_instanceRotation;v_transform=a_instanceTransform;vec2 worldPosition;bool isBezier=length(a_instanceBezierCP1)+length(a_instanceBezierCP2)+length(a_instanceBezierStart)+length(a_instanceBezierEnd)>0.;bool isArc=a_instanceArcAngles.x!=0.||a_instanceArcAngles.y!=0.;if(isBezier){float t=a_position.x;vec2 curvePoint=evaluateBezier(t,a_instanceBezierStart,a_instanceBezierCP1,a_instanceBezierCP2,a_instanceBezierEnd);vec2 tangent=evaluateBezierDerivative(t,a_instanceBezierStart,a_instanceBezierCP1,a_instanceBezierCP2,a_instanceBezierEnd);float tLen=length(tangent);tangent=tLen>0.?tangent/tLen:vec2(1,0);worldPosition=curvePoint+vec2(-tangent.y,tangent.x)*a_position.y*a_instanceSize.y;}else if(isArc){float s=a_instanceArcAngles.x,e=a_instanceArcAngles.y;s=mod(s,6.28318530718);if(s<0.)s+=6.28318530718;e=mod(e,6.28318530718);if(e<0.)e+=6.28318530718;float d=s-e;if(d<=0.)d+=6.28318530718;float angle=s-a_position.x*d;vec2 local=vec2(cos(angle),sin(angle))*a_position.y;worldPosition=local*a_instanceSize*.5+a_instanceSize*.5+a_instancePosition;}else{worldPosition=a_position*a_instanceSize+a_instancePosition;}vec2 ndc=(worldPosition/u_viewportSize)*2.-1.;ndc.y=-ndc.y;if(length(a_instanceGlobalRotation)>0.){vec3 pos3D=vec3(ndc-a_instanceRotationCenter,0);pos3D.x*=u_aspectRatio;if(a_instanceGlobalRotation.x!=0.)pos3D=rotateX(-a_instanceGlobalRotation.x)*pos3D;if(a_instanceGlobalRotation.y!=0.)pos3D=rotateY(-a_instanceGlobalRotation.y)*pos3D;if(a_instanceGlobalRotation.z!=0.)pos3D=rotateZ(-a_instanceGlobalRotation.z)*pos3D;pos3D.x/=u_aspectRatio;ndc=pos3D.xy+a_instanceRotationCenter;}gl_Position=vec4(ndc,0,1);}`, D = ((E) => (E.RECTANGLE = "rectangle", E.LINE = "line", E.ELLIPSE = "ellipse", E.ARC = "arc", E.TRIANGLE = "triangle", E.BEZIER_CURVE = "bezier_curve", E.CUSTOM = "custom", E))(D || {});
345
345
  class tA {
346
346
  constructor(A) {
347
- o(this, "m");
348
- o(this, "RA", /* @__PURE__ */ new Map());
347
+ n(this, "m");
348
+ n(this, "RA", /* @__PURE__ */ new Map());
349
349
  this.m = A;
350
350
  }
351
- TA(A, t, e, s) {
351
+ SA(A, t, e, s) {
352
352
  const r = this.m;
353
353
  let i = this.RA.get(A);
354
354
  i || (i = /* @__PURE__ */ new Map(), this.RA.set(A, i));
355
355
  let B = i.get(t) || null;
356
356
  if (!B) {
357
357
  B = r.createVertexArray(), i.set(t, B), r.bindVertexArray(B), r.bindBuffer(r.ARRAY_BUFFER, s);
358
- const n = r.getAttribLocation(A, "a_position");
359
- n !== -1 && (r.enableVertexAttribArray(n), r.vertexAttribPointer(n, e.attributes.position.size, r.FLOAT, !1, e.stride, e.attributes.position.offset), r.vertexAttribDivisor(n, 0));
360
- const Q = r.getAttribLocation(A, "a_texCoord");
361
- Q !== -1 && (r.enableVertexAttribArray(Q), r.vertexAttribPointer(Q, e.attributes.texCoord.size, r.FLOAT, !1, e.stride, e.attributes.texCoord.offset), r.vertexAttribDivisor(Q, 0));
358
+ const Q = r.getAttribLocation(A, "a_position");
359
+ Q !== -1 && (r.enableVertexAttribArray(Q), r.vertexAttribPointer(Q, e.attributes.position.size, r.FLOAT, !1, e.stride, e.attributes.position.offset), r.vertexAttribDivisor(Q, 0));
360
+ const o = r.getAttribLocation(A, "a_texCoord");
361
+ o !== -1 && (r.enableVertexAttribArray(o), r.vertexAttribPointer(o, e.attributes.texCoord.size, r.FLOAT, !1, e.stride, e.attributes.texCoord.offset), r.vertexAttribDivisor(o, 0));
362
362
  }
363
363
  r.bindVertexArray(B);
364
364
  }
365
- SA() {
365
+ TA() {
366
366
  this.m.bindVertexArray(null);
367
367
  }
368
368
  W() {
@@ -373,55 +373,55 @@ class tA {
373
373
  }
374
374
  class eA {
375
375
  constructor(A) {
376
- o(this, "FA");
377
- o(this, "m");
378
- o(this, "OA", null);
379
- o(this, "UA", null);
380
- o(this, "LA", null);
376
+ n(this, "FA");
377
+ n(this, "m");
378
+ n(this, "OA", null);
379
+ n(this, "UA", null);
380
+ n(this, "LA", null);
381
381
  this.m = A, this.FA = new tA(A);
382
382
  }
383
383
  kA(A, t, e) {
384
384
  const { shader: s } = A, r = R(this.m) || this.m.getParameter(this.m.VIEWPORT), i = { u_aspectRatio: r[2] / r[3], u_viewportSize: [r[2], r[3]] }, B = {};
385
385
  for (const [a, g] of Object.entries(i)) s.sA(a) && (B[a] = g);
386
386
  Object.keys(B).length > 0 && s.eA(B);
387
- const n = (a) => {
387
+ const Q = (a) => {
388
388
  if (!a || !a.HA()) return;
389
389
  const g = a.unitGeometry, l = a.unitBuffer;
390
390
  try {
391
- this.FA.TA(s.QA, a.type + "", g, l), a.batch.WA(s), a.batch.JA(g.primitiveType, g.vertexCount);
391
+ this.FA.SA(s.QA, a.type + "", g, l), a.batch.WA(s), a.batch.JA(g.primitiveType, g.vertexCount);
392
392
  } finally {
393
- a.batch.VA(s), this.FA.SA(), a.KA();
393
+ a.batch.VA(s), this.FA.TA(), a.KA();
394
394
  }
395
395
  };
396
- let Q = null, h = null;
396
+ let o = null, h = null;
397
397
  for (const a of t) {
398
398
  if (a.type === D.CUSTOM) {
399
- h && (n(h), Q = null, h = null), this.ZA(A, a.params, a.state, e.get(D.RECTANGLE) || null);
399
+ h && (Q(h), o = null, h = null), this.ZA(A, a.params, a.state, e.get(D.RECTANGLE) || null);
400
400
  continue;
401
401
  }
402
- Q !== null && a.type !== Q && (n(h), Q = null, h = null);
402
+ o !== null && a.type !== o && (Q(h), o = null, h = null);
403
403
  let g = h;
404
- g && a.type === Q || (g = e.get(a.type) || null, h = g, Q = a.type), g && g.jA(a.params, a.state);
404
+ g && a.type === o || (g = e.get(a.type) || null, h = g, o = a.type), g && g.jA(a.params, a.state);
405
405
  }
406
- n(h);
406
+ Q(h);
407
407
  }
408
408
  ZA(A, t, e, s) {
409
409
  if (!s) return;
410
- const { x: r, y: i, width: B, height: n, shader: Q, uniforms: h } = t, a = this.m;
411
- Q.AA(), s.KA();
412
- const g = this.XA(Math.max(1, Math.floor(B)), Math.max(1, Math.floor(n)));
413
- g.k(), Q.AA(), h && Object.keys(h).length && Q.eA(h);
410
+ const { x: r, y: i, width: B, height: Q, shader: o, uniforms: h } = t, a = this.m;
411
+ o.AA(), s.KA();
412
+ const g = this.XA(Math.max(1, Math.floor(B)), Math.max(1, Math.floor(Q)));
413
+ g.k(), o.AA(), h && Object.keys(h).length && o.eA(h);
414
414
  {
415
415
  const u = R(a) || a.getParameter(a.VIEWPORT);
416
- Q.sA("u_aspectRatio") && Q.BA("u_aspectRatio", u[2] / u[3]), Q.sA("u_viewportSize") && Q.BA("u_viewportSize", [u[2], u[3]]);
416
+ o.sA("u_aspectRatio") && o.BA("u_aspectRatio", u[2] / u[3]), o.sA("u_viewportSize") && o.BA("u_viewportSize", [u[2], u[3]]);
417
417
  }
418
418
  const l = { ...e, rotationX: 0, rotationY: 0, rotationZ: 0 };
419
419
  if (s.jA({ x: 0, y: 0, width: g.width, height: g.height }, l), s.HA()) {
420
420
  const u = s.unitGeometry, M = s.unitBuffer;
421
421
  try {
422
- this.FA.TA(Q.QA, s.type + "", u, M), s.batch.WA(Q), s.batch.JA(u.primitiveType, u.vertexCount);
422
+ this.FA.SA(o.QA, s.type + "", u, M), s.batch.WA(o), s.batch.JA(u.primitiveType, u.vertexCount);
423
423
  } finally {
424
- s.batch.VA(Q), this.FA.SA(), s.KA();
424
+ s.batch.VA(o), this.FA.TA(), s.KA();
425
425
  }
426
426
  }
427
427
  g.H();
@@ -429,13 +429,13 @@ class eA {
429
429
  c.AA(), c.eA({ u_src0: g.textures[0], u_src1: g.textures[1], u_src2: g.textures[2], u_src3: g.textures[3], u_src4: g.textures[4], u_srcSize: [g.width, g.height] });
430
430
  const C = R(a) || a.getParameter(a.VIEWPORT);
431
431
  c.sA("u_aspectRatio") && c.BA("u_aspectRatio", C[2] / C[3]), c.sA("u_viewportSize") && c.BA("u_viewportSize", [C[2], C[3]]);
432
- const d = Math.floor(r), I = Math.floor(i), w = Math.max(1, Math.floor(B)), p = Math.max(1, Math.floor(n));
432
+ const d = Math.floor(r), I = Math.floor(i), w = Math.max(1, Math.floor(B)), p = Math.max(1, Math.floor(Q));
433
433
  if (s.jA({ x: d, y: I, width: w, height: p }, e), s.HA()) {
434
434
  const u = s.unitGeometry, M = s.unitBuffer;
435
435
  try {
436
- this.FA.TA(c.QA, s.type + "", u, M), s.batch.WA(c), s.batch.JA(u.primitiveType, u.vertexCount);
436
+ this.FA.SA(c.QA, s.type + "", u, M), s.batch.WA(c), s.batch.JA(u.primitiveType, u.vertexCount);
437
437
  } finally {
438
- s.batch.VA(c), this.FA.SA(), s.KA();
438
+ s.batch.VA(c), this.FA.TA(), s.KA();
439
439
  }
440
440
  }
441
441
  A.shader.AA();
@@ -450,9 +450,9 @@ precision highp float;in vec2 v_uv;uniform sampler2D u_src0;uniform sampler2D u_
450
450
  }
451
451
  class sA {
452
452
  constructor() {
453
- o(this, "qA", []);
454
- o(this, "At", 1);
455
- o(this, "tt", 0);
453
+ n(this, "qA", []);
454
+ n(this, "At", 1);
455
+ n(this, "tt", 0);
456
456
  }
457
457
  et(A) {
458
458
  if (this.tt >= this.qA.length) {
@@ -490,8 +490,8 @@ class sA {
490
490
  return i.params.x = A, i.params.y = t, i.params.width = e, i.params.height = s, r.dA(i.state), i.id;
491
491
  }
492
492
  st(A, t, e, s, r, i, B) {
493
- const n = this.et(D.CUSTOM);
494
- return n.params.x = A, n.params.y = t, n.params.width = e, n.params.height = s, n.params.shader = r, n.params.uniforms = i, B.dA(n.state), n.id;
493
+ const Q = this.et(D.CUSTOM);
494
+ return Q.params.x = A, Q.params.y = t, Q.params.width = e, Q.params.height = s, Q.params.shader = r, Q.params.uniforms = i, B.dA(Q.state), Q.id;
495
495
  }
496
496
  it(A, t, e, s, r, i) {
497
497
  const B = this.et(D.LINE);
@@ -502,16 +502,16 @@ class sA {
502
502
  return i.params.x = A, i.params.y = t, i.params.width = e, i.params.height = s, r.dA(i.state), i.id;
503
503
  }
504
504
  rt(A, t, e, s, r, i, B) {
505
- const n = this.et(D.ARC);
506
- return n.params.x = A, n.params.y = t, n.params.width = e, n.params.height = s, n.params.start = r, n.params.stop = i, B.dA(n.state), n.id;
505
+ const Q = this.et(D.ARC);
506
+ return Q.params.x = A, Q.params.y = t, Q.params.width = e, Q.params.height = s, Q.params.start = r, Q.params.stop = i, B.dA(Q.state), Q.id;
507
507
  }
508
508
  Et(A, t, e, s, r, i, B) {
509
- const n = this.et(D.TRIANGLE);
510
- return n.params.x1 = A, n.params.y1 = t, n.params.x2 = e, n.params.y2 = s, n.params.x3 = r, n.params.y3 = i, B.dA(n.state), n.id;
509
+ const Q = this.et(D.TRIANGLE);
510
+ return Q.params.x1 = A, Q.params.y1 = t, Q.params.x2 = e, Q.params.y2 = s, Q.params.x3 = r, Q.params.y3 = i, B.dA(Q.state), Q.id;
511
511
  }
512
- nt(A, t, e, s, r, i, B, n, Q, h) {
512
+ nt(A, t, e, s, r, i, B, Q, o, h) {
513
513
  const a = this.et(D.BEZIER_CURVE);
514
- return a.params.x1 = A, a.params.y1 = t, a.params.cp1x = e, a.params.cp1y = s, a.params.cp2x = r, a.params.cp2y = i, a.params.x2 = B, a.params.y2 = n, a.params.thickness = Q, h.dA(a.state), a.id;
514
+ return a.params.x1 = A, a.params.y1 = t, a.params.cp1x = e, a.params.cp1y = s, a.params.cp2x = r, a.params.cp2y = i, a.params.x2 = B, a.params.y2 = Q, a.params.thickness = o, h.dA(a.state), a.id;
515
515
  }
516
516
  get length() {
517
517
  return this.tt;
@@ -530,10 +530,10 @@ class sA {
530
530
  }
531
531
  const x = class x {
532
532
  static gt(A, t, e = 0) {
533
- var i, B, n, Q, h, a, g, l, c, C;
533
+ var i, B, Q, o, h, a, g, l, c, C;
534
534
  const s = t || new Float32Array(x.FLOATS_PER_INSTANCE);
535
535
  let r = e;
536
- return s[r++] = A.position[0], s[r++] = A.position[1], s[r++] = A.size[0], s[r++] = A.size[1], s[r++] = A.character[0], s[r++] = A.character[1], s[r++] = A.character[2], s[r++] = A.primaryColor[0], s[r++] = A.primaryColor[1], s[r++] = A.primaryColor[2], s[r++] = A.primaryColor[3], s[r++] = A.secondaryColor[0], s[r++] = A.secondaryColor[1], s[r++] = A.secondaryColor[2], s[r++] = A.secondaryColor[3], s[r++] = A.rotation[0], s[r++] = A.rotation[1], s[r++] = A.transform[0], s[r++] = A.transform[1], s[r++] = A.transform[2], s[r++] = A.globalRotationX, s[r++] = A.globalRotationY, s[r++] = A.globalRotationZ, s[r++] = A.rotationCenter[0], s[r++] = A.rotationCenter[1], s[r++] = ((i = A.arcAngles) == null ? void 0 : i[0]) || 0, s[r++] = ((B = A.arcAngles) == null ? void 0 : B[1]) || 0, s[r++] = ((n = A.bezierControlPoint1) == null ? void 0 : n[0]) || 0, s[r++] = ((Q = A.bezierControlPoint1) == null ? void 0 : Q[1]) || 0, s[r++] = ((h = A.bezierControlPoint2) == null ? void 0 : h[0]) || 0, s[r++] = ((a = A.bezierControlPoint2) == null ? void 0 : a[1]) || 0, s[r++] = ((g = A.bezierStartPoint) == null ? void 0 : g[0]) || 0, s[r++] = ((l = A.bezierStartPoint) == null ? void 0 : l[1]) || 0, s[r++] = ((c = A.bezierEndPoint) == null ? void 0 : c[0]) || 0, s[r++] = ((C = A.bezierEndPoint) == null ? void 0 : C[1]) || 0, s;
536
+ return s[r++] = A.position[0], s[r++] = A.position[1], s[r++] = A.size[0], s[r++] = A.size[1], s[r++] = A.character[0], s[r++] = A.character[1], s[r++] = A.character[2], s[r++] = A.primaryColor[0], s[r++] = A.primaryColor[1], s[r++] = A.primaryColor[2], s[r++] = A.primaryColor[3], s[r++] = A.secondaryColor[0], s[r++] = A.secondaryColor[1], s[r++] = A.secondaryColor[2], s[r++] = A.secondaryColor[3], s[r++] = A.rotation[0], s[r++] = A.rotation[1], s[r++] = A.transform[0], s[r++] = A.transform[1], s[r++] = A.transform[2], s[r++] = A.globalRotationX, s[r++] = A.globalRotationY, s[r++] = A.globalRotationZ, s[r++] = A.rotationCenter[0], s[r++] = A.rotationCenter[1], s[r++] = ((i = A.arcAngles) == null ? void 0 : i[0]) || 0, s[r++] = ((B = A.arcAngles) == null ? void 0 : B[1]) || 0, s[r++] = ((Q = A.bezierControlPoint1) == null ? void 0 : Q[0]) || 0, s[r++] = ((o = A.bezierControlPoint1) == null ? void 0 : o[1]) || 0, s[r++] = ((h = A.bezierControlPoint2) == null ? void 0 : h[0]) || 0, s[r++] = ((a = A.bezierControlPoint2) == null ? void 0 : a[1]) || 0, s[r++] = ((g = A.bezierStartPoint) == null ? void 0 : g[0]) || 0, s[r++] = ((l = A.bezierStartPoint) == null ? void 0 : l[1]) || 0, s[r++] = ((c = A.bezierEndPoint) == null ? void 0 : c[0]) || 0, s[r++] = ((C = A.bezierEndPoint) == null ? void 0 : C[1]) || 0, s;
537
537
  }
538
538
  static ht(A) {
539
539
  const t = A.length * x.FLOATS_PER_INSTANCE, e = new Float32Array(t);
@@ -544,23 +544,23 @@ const x = class x {
544
544
  return e;
545
545
  }
546
546
  };
547
- o(x, "BYTES_PER_INSTANCE", 140), o(x, "FLOATS_PER_INSTANCE", 35);
547
+ n(x, "BYTES_PER_INSTANCE", 140), n(x, "FLOATS_PER_INSTANCE", 35);
548
548
  let b = x;
549
549
  const P = class P {
550
550
  };
551
- o(P, "STRIDE", b.BYTES_PER_INSTANCE), o(P, "ATTRIBUTES", { a_instancePosition: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 0, divisor: 1 }, a_instanceSize: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 8, divisor: 1 }, a_instanceCharacter: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 16, divisor: 1 }, a_instancePrimaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 28, divisor: 1 }, a_instanceSecondaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 44, divisor: 1 }, a_instanceRotation: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 60, divisor: 1 }, a_instanceTransform: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 68, divisor: 1 }, a_instanceGlobalRotation: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 80, divisor: 1 }, a_instanceRotationCenter: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 92, divisor: 1 }, a_instanceArcAngles: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 100, divisor: 1 }, a_instanceBezierCP1: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 108, divisor: 1 }, a_instanceBezierCP2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 116, divisor: 1 }, a_instanceBezierStart: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 124, divisor: 1 }, a_instanceBezierEnd: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 132, divisor: 1 } });
551
+ n(P, "STRIDE", b.BYTES_PER_INSTANCE), n(P, "ATTRIBUTES", { a_instancePosition: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 0, divisor: 1 }, a_instanceSize: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 8, divisor: 1 }, a_instanceCharacter: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 16, divisor: 1 }, a_instancePrimaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 28, divisor: 1 }, a_instanceSecondaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 44, divisor: 1 }, a_instanceRotation: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 60, divisor: 1 }, a_instanceTransform: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 68, divisor: 1 }, a_instanceGlobalRotation: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 80, divisor: 1 }, a_instanceRotationCenter: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 92, divisor: 1 }, a_instanceArcAngles: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 100, divisor: 1 }, a_instanceBezierCP1: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 108, divisor: 1 }, a_instanceBezierCP2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 116, divisor: 1 }, a_instanceBezierStart: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 124, divisor: 1 }, a_instanceBezierEnd: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: P.STRIDE, offset: 132, divisor: 1 } });
552
552
  let Y = P;
553
553
  class rA {
554
554
  constructor(A, t = 1e3, e = 1.5) {
555
- o(this, "m");
556
- o(this, "ct", []);
557
- o(this, "Ct");
558
- o(this, "Dt");
559
- o(this, "lt", null);
560
- o(this, "Pt", !0);
561
- o(this, "ut", 0);
562
- o(this, "It", /* @__PURE__ */ new Map());
563
- o(this, "wt", null);
555
+ n(this, "m");
556
+ n(this, "ct", []);
557
+ n(this, "Ct");
558
+ n(this, "Dt");
559
+ n(this, "lt", null);
560
+ n(this, "Pt", !0);
561
+ n(this, "ut", 0);
562
+ n(this, "It", /* @__PURE__ */ new Map());
563
+ n(this, "wt", null);
564
564
  this.m = A, this.Ct = t, this.Dt = e, this.ft();
565
565
  }
566
566
  jA(A) {
@@ -632,11 +632,11 @@ class rA {
632
632
  }
633
633
  class T {
634
634
  constructor(A, t, e, s) {
635
- o(this, "m");
636
- o(this, "xt");
637
- o(this, "yt");
638
- o(this, "bt");
639
- o(this, "Gt", null);
635
+ n(this, "m");
636
+ n(this, "xt");
637
+ n(this, "yt");
638
+ n(this, "bt");
639
+ n(this, "Gt", null);
640
640
  this.m = A, this.xt = t, this.yt = e, this.bt = s;
641
641
  const r = this.m.createBuffer();
642
642
  if (!r) throw Error("Failed to create unit geometry buffer");
@@ -676,8 +676,8 @@ class T {
676
676
  A.rotationCenter = [s.nx, s.ny];
677
677
  }
678
678
  Mt(A, t, e, s, r, i, B) {
679
- const n = R(this.m) || [0, 0, this.m.canvas.width, this.m.canvas.height], Q = n[2], h = n[3];
680
- return { centerX: (A + e / 2) / Q * 2 - 1, centerY: 1 - (t + s / 2) / h * 2, radiansX: -r * Math.PI / 180, radiansY: -i * Math.PI / 180, radiansZ: -B * Math.PI / 180, aspectRatio: Q / h };
679
+ const Q = R(this.m) || [0, 0, this.m.canvas.width, this.m.canvas.height], o = Q[2], h = Q[3];
680
+ return { centerX: (A + e / 2) / o * 2 - 1, centerY: 1 - (t + s / 2) / h * 2, radiansX: -r * Math.PI / 180, radiansY: -i * Math.PI / 180, radiansZ: -B * Math.PI / 180, aspectRatio: o / h };
681
681
  }
682
682
  }
683
683
  const iA = { vertices: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1]), vertexCount: 6, primitiveType: WebGL2RenderingContext.TRIANGLES, stride: 16, attributes: { position: { size: 2, offset: 0 }, texCoord: { size: 2, offset: 8 } } };
@@ -691,26 +691,26 @@ class BA extends T {
691
691
  }
692
692
  }
693
693
  const EA = { vertices: 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]), vertexCount: 6, primitiveType: WebGL2RenderingContext.TRIANGLES, stride: 16, attributes: { position: { size: 2, offset: 0 }, texCoord: { size: 2, offset: 8 } } };
694
- class nA extends T {
694
+ class QA extends T {
695
695
  constructor(A, t) {
696
696
  super(A, t, D.LINE, EA);
697
697
  }
698
698
  jA(A, t) {
699
- const e = A.x2 - A.x1, s = A.y2 - A.y1, r = Math.hypot(e, s), i = Math.atan2(s, e), B = A.thickness || t.lineWeight || 1, n = A.x1 + e / 2, Q = A.y1 + s / 2, h = n - r / 2, a = Q, g = { character: t.character, charColor: t.charColor, bgColor: t.bgColor, charRotation: t.charRotation, flipHorizontally: t.flipHorizontally, flipVertically: t.flipVertically, invert: t.invert, rotationX: t.rotationX || 0, rotationY: t.rotationY || 0, rotationZ: (t.rotationZ || 0) + 180 * i / Math.PI, lineWeight: B }, l = this.$t(h, a, r, B, g);
700
- return this.zt(l, n, Q), this.xt.jA(l);
699
+ const e = A.x2 - A.x1, s = A.y2 - A.y1, r = Math.hypot(e, s), i = Math.atan2(s, e), B = A.thickness || t.lineWeight || 1, Q = A.x1 + e / 2, o = A.y1 + s / 2, h = Q - r / 2, a = o, g = { character: t.character, charColor: t.charColor, bgColor: t.bgColor, charRotation: t.charRotation, flipHorizontally: t.flipHorizontally, flipVertically: t.flipVertically, invert: t.invert, rotationX: t.rotationX || 0, rotationY: t.rotationY || 0, rotationZ: (t.rotationZ || 0) + 180 * i / Math.PI, lineWeight: B }, l = this.$t(h, a, r, B, g);
700
+ return this.zt(l, Q, o), this.xt.jA(l);
701
701
  }
702
702
  }
703
- const oA = { vertices: function(E = 32) {
703
+ const nA = { vertices: function(E = 32) {
704
704
  const A = [], t = 2 * Math.PI / E;
705
705
  for (let e = 0; e < E; e++) {
706
- const s = e * t, r = (e + 1) % E * t, i = Math.cos(s), B = Math.sin(s), n = 0.5 * (i + 1), Q = 0.5 * (B + 1), h = Math.cos(r), a = Math.sin(r), g = 0.5 * (h + 1), l = 0.5 * (a + 1);
707
- A.push(0, 0, 0.5, 0.5, i, B, n, Q, h, a, g, l);
706
+ const s = e * t, r = (e + 1) % E * t, i = Math.cos(s), B = Math.sin(s), Q = 0.5 * (i + 1), o = 0.5 * (B + 1), h = Math.cos(r), a = Math.sin(r), g = 0.5 * (h + 1), l = 0.5 * (a + 1);
707
+ A.push(0, 0, 0.5, 0.5, i, B, Q, o, h, a, g, l);
708
708
  }
709
709
  return new Float32Array(A);
710
710
  }(32), vertexCount: 96, primitiveType: WebGL2RenderingContext.TRIANGLES, stride: 16, attributes: { position: { size: 2, offset: 0 }, texCoord: { size: 2, offset: 8 } } };
711
- class QA extends T {
711
+ class oA extends T {
712
712
  constructor(A, t) {
713
- super(A, t, D.ELLIPSE, oA);
713
+ super(A, t, D.ELLIPSE, nA);
714
714
  }
715
715
  jA(A, t) {
716
716
  const e = this.$t(A.x, A.y, A.width, A.height, t);
@@ -740,8 +740,8 @@ class cA extends T {
740
740
  super(A, t, D.TRIANGLE, hA);
741
741
  }
742
742
  jA(A, t) {
743
- const e = Math.min(A.x1, A.x2, A.x3), s = Math.max(A.x1, A.x2, A.x3), r = Math.min(A.y1, A.y2, A.y3), i = s - e, B = Math.max(A.y1, A.y2, A.y3) - r, n = this.$t(e, r, i, B, t), Q = e + 0.5 * i, h = r + B * (1 / 3);
744
- return this.zt(n, Q, h), this.xt.jA(n);
743
+ const e = Math.min(A.x1, A.x2, A.x3), s = Math.max(A.x1, A.x2, A.x3), r = Math.min(A.y1, A.y2, A.y3), i = s - e, B = Math.max(A.y1, A.y2, A.y3) - r, Q = this.$t(e, r, i, B, t), o = e + 0.5 * i, h = r + B * (1 / 3);
744
+ return this.zt(Q, o, h), this.xt.jA(Q);
745
745
  }
746
746
  }
747
747
  function k(E, A, t, e, s) {
@@ -767,22 +767,22 @@ class CA extends T {
767
767
  }
768
768
  class DA {
769
769
  constructor(A) {
770
- o(this, "m");
771
- o(this, "Rt", null);
772
- o(this, "Tt", null);
773
- o(this, "St", {});
774
- o(this, "Ft", null);
775
- o(this, "Ot", /* @__PURE__ */ new Map());
776
- o(this, "Ut");
777
- o(this, "Lt");
778
- o(this, "kt");
770
+ n(this, "m");
771
+ n(this, "Rt", null);
772
+ n(this, "St", null);
773
+ n(this, "Tt", {});
774
+ n(this, "Ft", null);
775
+ n(this, "Ot", /* @__PURE__ */ new Map());
776
+ n(this, "Ut");
777
+ n(this, "Lt");
778
+ n(this, "kt");
779
779
  this.m = A, this.kt = new AA(), this.Ut = new eA(A), this.Lt = new sA(), this.Ft = A.createBuffer(), G(this.m, [0, 0, this.m.canvas.width, this.m.canvas.height]);
780
780
  }
781
781
  Ht(A) {
782
782
  let t = this.Ot.get(A);
783
783
  if (t) return t;
784
784
  const e = new rA(this.m);
785
- return t = (0, { [D.RECTANGLE]: () => new BA(this.m, e), [D.LINE]: () => new nA(this.m, e), [D.ELLIPSE]: () => new QA(this.m, e), [D.ARC]: () => new gA(this.m, e), [D.TRIANGLE]: () => new cA(this.m, e), [D.BEZIER_CURVE]: () => new CA(this.m, e) }[A])(), this.Ot.set(A, t), t;
785
+ return t = (0, { [D.RECTANGLE]: () => new BA(this.m, e), [D.LINE]: () => new QA(this.m, e), [D.ELLIPSE]: () => new oA(this.m, e), [D.ARC]: () => new gA(this.m, e), [D.TRIANGLE]: () => new cA(this.m, e), [D.BEZIER_CURVE]: () => new CA(this.m, e) }[A])(), this.Ot.set(A, t), t;
786
786
  }
787
787
  Wt(A) {
788
788
  this.Rt !== A && (this.Rt = A, A.AA());
@@ -791,26 +791,26 @@ class DA {
791
791
  return new z(this.m, A, t);
792
792
  }
793
793
  Vt(A) {
794
- this.Tt = A, A && (this.St = {});
794
+ this.St = A, A && (this.Tt = {});
795
795
  }
796
796
  Kt(A, t) {
797
- this.St[A] = t;
797
+ this.Tt[A] = t;
798
798
  }
799
799
  Zt(A) {
800
- Object.assign(this.St, A);
800
+ Object.assign(this.Tt, A);
801
801
  }
802
802
  jt(A) {
803
803
  return new z(this.m, L, A);
804
804
  }
805
805
  Xt(A, t, e, s) {
806
806
  var C;
807
- const r = this.m, i = r.canvas.width, B = r.canvas.height, n = A / i * 2 - 1, Q = (A + e) / i * 2 - 1, h = 1 - t / B * 2, a = 1 - (t + s) / B * 2, g = new Float32Array([n, a, Q, a, n, h, Q, a, Q, h, n, h]);
807
+ const r = this.m, i = r.canvas.width, B = r.canvas.height, Q = A / i * 2 - 1, o = (A + e) / i * 2 - 1, h = 1 - t / B * 2, a = 1 - (t + s) / B * 2, g = new Float32Array([Q, a, o, a, Q, h, o, a, o, h, Q, h]);
808
808
  r.bindBuffer(r.ARRAY_BUFFER, this.Ft), r.bufferData(r.ARRAY_BUFFER, g, r.DYNAMIC_DRAW);
809
809
  const l = ((C = this.Rt) == null ? void 0 : C.QA) || r.getParameter(r.CURRENT_PROGRAM), c = l ? r.getAttribLocation(l, "a_position") : -1;
810
810
  c !== -1 && (r.enableVertexAttribArray(c), r.vertexAttribPointer(c, 2, r.FLOAT, !1, 8, 0)), r.drawArrays(r.TRIANGLES, 0, 6), c !== -1 && r.disableVertexAttribArray(c);
811
811
  }
812
812
  Nt(A, t, e, s) {
813
- this.Tt ? (this.Lt.st(A, t, e, s, this.Tt, { ...this.St }, this.kt), this.Tt = null, this.St = {}) : this.Lt.Bt(A, t, e, s, this.kt);
813
+ this.St ? (this.Lt.st(A, t, e, s, this.St, { ...this.Tt }, this.kt), this.St = null, this.Tt = {}) : this.Lt.Bt(A, t, e, s, this.kt);
814
814
  }
815
815
  qt(A, t, e, s) {
816
816
  this.Lt.it(A, t, e, s, this.kt.lineWeight, this.kt);
@@ -821,9 +821,9 @@ class DA {
821
821
  te(A, t, e, s, r, i) {
822
822
  this.Lt.Et(A, t, e, s, r, i, this.kt);
823
823
  }
824
- ee(A, t, e, s, r, i, B, n) {
825
- const Q = this.kt.lineWeight;
826
- this.Lt.nt(A, t, e, s, r, i, B, n, Q, this.kt);
824
+ ee(A, t, e, s, r, i, B, Q) {
825
+ const o = this.kt.lineWeight;
826
+ this.Lt.nt(A, t, e, s, r, i, B, Q, o, this.kt);
827
827
  }
828
828
  Be(A, t, e = 1, s = {}) {
829
829
  return new U(this.m, A, t, e, s);
@@ -879,12 +879,12 @@ const f = { readShort: (E, A) => (f.t.uint16[0] = E[A] << 8 | E[A + 1], f.t.int1
879
879
  const s = f, r = s.readUshort, i = r(E, A += 2);
880
880
  A += 2;
881
881
  const B = [];
882
- for (let n = 0; n < i; n++) {
883
- const Q = r(E, A), h = r(E, A += 2);
882
+ for (let Q = 0; Q < i; Q++) {
883
+ const o = r(E, A), h = r(E, A += 2);
884
884
  A += 2;
885
885
  const a = s.readUint(E, A);
886
886
  A += 4;
887
- const g = `p${Q}e${h}`;
887
+ const g = `p${o}e${h}`;
888
888
  let l = B.indexOf(a);
889
889
  if (l === -1) {
890
890
  let c;
@@ -898,10 +898,10 @@ const f = { readShort: (E, A) => (f.t.uint16[0] = E[A] << 8 | E[A + 1], f.t.int1
898
898
  }, parse4(E, A) {
899
899
  const t = f, e = t.readUshort, s = t.readUshorts, r = A, i = e(E, A += 2);
900
900
  A += 2;
901
- const B = e(E, A += 2) >>> 1, n = { format: 4, searchRange: e(E, A += 2), entrySelector: 0, rangeShift: 0, endCount: [], startCount: [], idDelta: [], idRangeOffset: [], glyphIdArray: [] };
902
- A += 2, n.entrySelector = e(E, A), A += 2, n.rangeShift = e(E, A), A += 2, n.endCount = s(E, A, B), A += 2 * B, A += 2, n.startCount = s(E, A, B), A += 2 * B;
903
- for (let Q = 0; Q < B; Q++) n.idDelta.push(t.readShort(E, A)), A += 2;
904
- return n.idRangeOffset = s(E, A, B), A += 2 * B, n.glyphIdArray = s(E, A, r + i - A >> 1), n;
901
+ const B = e(E, A += 2) >>> 1, Q = { format: 4, searchRange: e(E, A += 2), entrySelector: 0, rangeShift: 0, endCount: [], startCount: [], idDelta: [], idRangeOffset: [], glyphIdArray: [] };
902
+ A += 2, Q.entrySelector = e(E, A), A += 2, Q.rangeShift = e(E, A), A += 2, Q.endCount = s(E, A, B), A += 2 * B, A += 2, Q.startCount = s(E, A, B), A += 2 * B;
903
+ for (let o = 0; o < B; o++) Q.idDelta.push(t.readShort(E, A)), A += 2;
904
+ return Q.idRangeOffset = s(E, A, B), A += 2 * B, Q.glyphIdArray = s(E, A, r + i - A >> 1), Q;
905
905
  }, parse12(E, A) {
906
906
  const t = f.readUint;
907
907
  t(E, A += 4), t(E, A += 4);
@@ -921,30 +921,30 @@ const f = { readShort: (E, A) => (f.t.uint16[0] = E[A] << 8 | E[A + 1], f.t.int1
921
921
  A += 2;
922
922
  const B = e.readShort(E, A);
923
923
  A += 2;
924
- const n = e.readShort(E, A);
925
- return A += 2, A += 6, { unitsPerEm: s, xMin: r, yMin: i, xMax: B, yMax: n, indexToLocFormat: e.readShort(E, A) };
924
+ const Q = e.readShort(E, A);
925
+ return A += 2, A += 6, { unitsPerEm: s, xMin: r, yMin: i, xMax: B, yMax: Q, indexToLocFormat: e.readShort(E, A) };
926
926
  } }, IA = { parseTab(E, A, t) {
927
927
  const e = f;
928
928
  A += 4;
929
929
  const s = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], r = {};
930
930
  for (let i = 0; i < s.length; i++) {
931
- const B = s[i], n = B === "advanceWidthMax" || B === "numberOfHMetrics" ? e.readUshort : e.readShort;
932
- r[B] = n(E, A + 2 * i);
931
+ const B = s[i], Q = B === "advanceWidthMax" || B === "numberOfHMetrics" ? e.readUshort : e.readShort;
932
+ r[B] = Q(E, A + 2 * i);
933
933
  }
934
934
  return r;
935
935
  } }, fA = { parseTab(E, A, t, e) {
936
- const s = f, r = [], i = [], B = e.maxp.numGlyphs, n = e.hhea.numberOfHMetrics;
937
- let Q = 0, h = 0, a = 0;
938
- for (; a < n; ) Q = s.readUshort(E, A + (a << 2)), h = s.readShort(E, A + (a << 2) + 2), r.push(Q), i.push(h), a++;
939
- for (; a < B; ) r.push(Q), i.push(h), a++;
936
+ const s = f, r = [], i = [], B = e.maxp.numGlyphs, Q = e.hhea.numberOfHMetrics;
937
+ let o = 0, h = 0, a = 0;
938
+ for (; a < Q; ) o = s.readUshort(E, A + (a << 2)), h = s.readShort(E, A + (a << 2) + 2), r.push(o), i.push(h), a++;
939
+ for (; a < B; ) r.push(o), i.push(h), a++;
940
940
  return { aWidth: r, lsBearing: i };
941
941
  } }, N = { cmap: uA, head: PA, hhea: IA, maxp: { parseTab(E, A, t) {
942
942
  const e = f;
943
943
  return e.readUint(E, A), A += 4, { numGlyphs: e.readUshort(E, A) };
944
944
  } }, hmtx: fA, loca: { parseTab(E, A, t, e) {
945
945
  const s = f, r = [], i = e.head.indexToLocFormat, B = e.maxp.numGlyphs + 1;
946
- if (i === 0) for (let n = 0; n < B; n++) r.push(s.readUshort(E, A + (n << 1)) << 1);
947
- else if (i === 1) for (let n = 0; n < B; n++) r.push(s.readUint(E, A + (n << 2)));
946
+ if (i === 0) for (let Q = 0; Q < B; Q++) r.push(s.readUshort(E, A + (Q << 1)) << 1);
947
+ else if (i === 1) for (let Q = 0; Q < B; Q++) r.push(s.readUint(E, A + (Q << 2)));
948
948
  return r;
949
949
  } }, glyf: { parseTab(E, A, t, e) {
950
950
  const s = [], r = e.maxp.numGlyphs;
@@ -961,12 +961,12 @@ const f = { readShort: (E, A) => (f.t.uint16[0] = E[A] << 8 | E[A + 1], f.t.int1
961
961
  if (B.noc > 0) {
962
962
  B.endPts = [];
963
963
  for (let g = 0; g < B.noc; g++) B.endPts.push(t.readUshort(e, i)), i += 2;
964
- const n = t.readUshort(e, i);
965
- if (i += 2, e.length - i < n) return null;
966
- i += n;
967
- const Q = B.endPts[B.noc - 1] + 1;
964
+ const Q = t.readUshort(e, i);
965
+ if (i += 2, e.length - i < Q) return null;
966
+ i += Q;
967
+ const o = B.endPts[B.noc - 1] + 1;
968
968
  B.flags = [];
969
- for (let g = 0; g < Q; g++) {
969
+ for (let g = 0; g < o; g++) {
970
970
  const l = e[i];
971
971
  if (i++, B.flags.push(l), 8 & l) {
972
972
  const c = e[i];
@@ -975,27 +975,27 @@ const f = { readShort: (E, A) => (f.t.uint16[0] = E[A] << 8 | E[A + 1], f.t.int1
975
975
  }
976
976
  }
977
977
  B.xs = [];
978
- for (let g = 0; g < Q; g++) {
978
+ for (let g = 0; g < o; g++) {
979
979
  const l = B.flags[g], c = !!(16 & l);
980
980
  2 & l ? (B.xs.push(c ? e[i] : -e[i]), i++) : c ? B.xs.push(0) : (B.xs.push(t.readShort(e, i)), i += 2);
981
981
  }
982
982
  B.ys = [];
983
- for (let g = 0; g < Q; g++) {
983
+ for (let g = 0; g < o; g++) {
984
984
  const l = B.flags[g], c = !!(32 & l);
985
985
  4 & l ? (B.ys.push(c ? e[i] : -e[i]), i++) : c ? B.ys.push(0) : (B.ys.push(t.readShort(e, i)), i += 2);
986
986
  }
987
987
  let h = 0, a = 0;
988
- for (let g = 0; g < Q; g++) h += B.xs[g], a += B.ys[g], B.xs[g] = h, B.ys[g] = a;
988
+ for (let g = 0; g < o; g++) h += B.xs[g], a += B.ys[g], B.xs[g] = h, B.ys[g] = a;
989
989
  } else B.parts = [], B.endPts = [], B.flags = [], B.xs = [], B.ys = [];
990
990
  return B;
991
991
  } } }, y = { parse: (E) => [((A, t, e, s) => {
992
992
  const r = N, i = { ne: A, ge: t, oe: e };
993
993
  for (const B in r) {
994
- const n = B, Q = y.findTable(A, n, e);
995
- if (Q) {
996
- const [h, a] = Q;
994
+ const Q = B, o = y.findTable(A, Q, e);
995
+ if (o) {
996
+ const [h, a] = o;
997
997
  let g = s[h];
998
- g == null && (g = r[n].parseTab(A, h, a, i), s[h] = g), i[n] = g;
998
+ g == null && (g = r[Q].parseTab(A, h, a, i), s[h] = g), i[Q] = g;
999
999
  }
1000
1000
  }
1001
1001
  return i;
@@ -1005,16 +1005,16 @@ const f = { readShort: (E, A) => (f.t.uint16[0] = E[A] << 8 | E[A + 1], f.t.int1
1005
1005
  for (let i = 0; i < s; i++) {
1006
1006
  const B = e.readASCII(E, r, 4);
1007
1007
  e.readUint(E, r + 4);
1008
- const n = e.readUint(E, r + 8), Q = e.readUint(E, r + 12);
1009
- if (B === A) return [n, Q];
1008
+ const Q = e.readUint(E, r + 8), o = e.readUint(E, r + 12);
1009
+ if (B === A) return [Q, o];
1010
1010
  r += 16;
1011
1011
  }
1012
1012
  return null;
1013
1013
  }, T: N, B: f };
1014
- class S {
1014
+ class F {
1015
1015
  constructor() {
1016
- o(this, "ae", /* @__PURE__ */ new Map());
1017
- o(this, "he", /* @__PURE__ */ new Map());
1016
+ n(this, "ae", /* @__PURE__ */ new Map());
1017
+ n(this, "he", /* @__PURE__ */ new Map());
1018
1018
  }
1019
1019
  ce(A, t) {
1020
1020
  const e = `${this.Ce(A)}_${t}`;
@@ -1072,7 +1072,7 @@ class S {
1072
1072
  }
1073
1073
  class dA {
1074
1074
  constructor(A) {
1075
- o(this, "fe");
1075
+ n(this, "fe");
1076
1076
  this.fe = A;
1077
1077
  }
1078
1078
  de(A) {
@@ -1124,8 +1124,8 @@ class dA {
1124
1124
  const s = A.groups[e], r = A.groups[e + 1], i = A.groups[e + 2];
1125
1125
  for (let B = s; B <= r; B++)
1126
1126
  if (i + (B - s) > 0) try {
1127
- const n = String.fromCodePoint(B);
1128
- t.push(n);
1127
+ const Q = String.fromCodePoint(B);
1128
+ t.push(Q);
1129
1129
  } catch {
1130
1130
  }
1131
1131
  }
@@ -1149,8 +1149,8 @@ class dA {
1149
1149
  }
1150
1150
  class wA {
1151
1151
  constructor() {
1152
- o(this, "$e");
1153
- const A = new S();
1152
+ n(this, "$e");
1153
+ const A = new F();
1154
1154
  this.$e = new dA(A);
1155
1155
  }
1156
1156
  extractCharacters(A) {
@@ -1168,27 +1168,27 @@ class wA {
1168
1168
  }
1169
1169
  class mA {
1170
1170
  constructor(A) {
1171
- o(this, "Me");
1172
- o(this, "Ye");
1173
- o(this, "ze");
1174
- o(this, "Re");
1175
- this.ze = A, this.Re = new S(), this.Me = document.createElement("canvas"), this.Ye = this.Me.getContext("2d", { willReadFrequently: !0, alpha: !1 });
1171
+ n(this, "Me");
1172
+ n(this, "Ye");
1173
+ n(this, "ze");
1174
+ n(this, "Re");
1175
+ this.ze = A, this.Re = new F(), this.Me = document.createElement("canvas"), this.Ye = this.Me.getContext("2d", { willReadFrequently: !0, alpha: !1 });
1176
1176
  }
1177
1177
  createTextureAtlas(A, t, e, s) {
1178
- const r = A.length, i = Math.ceil(Math.sqrt(r)), B = Math.ceil(r / i), n = t.width * i, Q = t.height * B, h = typeof s == "object" ? s : null;
1179
- this.Te(n, Q), this.Se(A, t, i, e, h);
1180
- const a = this.ze.Be(n, Q, 1, { filter: "nearest" });
1178
+ const r = A.length, i = Math.ceil(Math.sqrt(r)), B = Math.ceil(r / i), Q = t.width * i, o = t.height * B, h = typeof s == "object" ? s : null;
1179
+ this.Se(Q, o), this.Te(A, t, i, e, h);
1180
+ const a = this.ze.Be(Q, o, 1, { filter: "nearest" });
1181
1181
  return a.F(this.Me), { framebuffer: a, columns: i, rows: B };
1182
1182
  }
1183
- Te(A, t) {
1183
+ Se(A, t) {
1184
1184
  this.Me.width = A, this.Me.height = t, this.Me.style.width = A + "px", this.Me.style.height = A + "px", this.Ye.imageSmoothingEnabled = !1, this.Me.style.imageRendering = "pixelated", this.Ye.fillStyle = "black", this.Ye.fillRect(0, 0, A, t), this.Ye.textBaseline = "top", this.Ye.textAlign = "left", this.Ye.fillStyle = "white";
1185
1185
  }
1186
- Se(A, t, e, s, r) {
1186
+ Te(A, t, e, s, r) {
1187
1187
  const i = s / r.head.unitsPerEm;
1188
1188
  for (let B = 0; B < A.length; B++) {
1189
- const n = B % e, Q = Math.floor(B / e), h = A[B].character, a = this.Fe(r, h);
1189
+ const Q = B % e, o = Math.floor(B / e), h = A[B].character, a = this.Fe(r, h);
1190
1190
  if (!a) continue;
1191
- const g = h.codePointAt(0) || 0, l = this.Re.ce(r, g), c = this.Oe(r, l) * i, C = n * t.width, d = Q * t.height, I = C + 0.5 * t.width, w = d + 0.5 * t.height, p = Math.round(I - 0.5 * t.width), u = Math.round(w - 0.5 * s), M = p + 0.5 * (t.width - c), j = u + r.hhea.ascender * i;
1191
+ const g = h.codePointAt(0) || 0, l = this.Re.ce(r, g), c = this.Oe(r, l) * i, C = Q * t.width, d = o * t.height, I = C + 0.5 * t.width, w = d + 0.5 * t.height, p = Math.round(I - 0.5 * t.width), u = Math.round(w - 0.5 * s), M = p + 0.5 * (t.width - c), j = u + r.hhea.ascender * i;
1192
1192
  this.Ue(a, M, j, i);
1193
1193
  }
1194
1194
  }
@@ -1208,25 +1208,25 @@ class mA {
1208
1208
  }
1209
1209
  Ue(A, t, e, s) {
1210
1210
  if (!A || !A.xs || A.noc === 0) return;
1211
- const { xs: r, ys: i, endPts: B, flags: n } = A;
1212
- if (!(r && i && B && n)) return;
1211
+ const { xs: r, ys: i, endPts: B, flags: Q } = A;
1212
+ if (!(r && i && B && Q)) return;
1213
1213
  this.Ye.beginPath();
1214
- let Q = 0;
1214
+ let o = 0;
1215
1215
  for (let h = 0; h < B.length; h++) {
1216
1216
  const a = B[h];
1217
- if (!(a < Q)) {
1218
- if (a >= Q) {
1219
- const g = t + r[Q] * s, l = e - i[Q] * s;
1217
+ if (!(a < o)) {
1218
+ if (a >= o) {
1219
+ const g = t + r[o] * s, l = e - i[o] * s;
1220
1220
  this.Ye.moveTo(g, l);
1221
- let c = Q + 1;
1221
+ let c = o + 1;
1222
1222
  for (; c <= a; )
1223
- if (1 & n[c]) {
1223
+ if (1 & Q[c]) {
1224
1224
  const C = t + r[c] * s, d = e - i[c] * s;
1225
1225
  this.Ye.lineTo(C, d), c++;
1226
1226
  } else {
1227
1227
  const C = t + r[c] * s, d = e - i[c] * s;
1228
- let I = c + 1 > a ? Q : c + 1;
1229
- if (1 & n[I]) {
1228
+ let I = c + 1 > a ? o : c + 1;
1229
+ if (1 & Q[I]) {
1230
1230
  const w = t + r[I] * s, p = e - i[I] * s;
1231
1231
  this.Ye.quadraticCurveTo(C, d, w, p), c = I + 1;
1232
1232
  } else {
@@ -1236,7 +1236,7 @@ class mA {
1236
1236
  }
1237
1237
  this.Ye.closePath();
1238
1238
  }
1239
- Q = a + 1;
1239
+ o = a + 1;
1240
1240
  }
1241
1241
  }
1242
1242
  this.Ye.fill();
@@ -1244,17 +1244,17 @@ class mA {
1244
1244
  }
1245
1245
  class pA {
1246
1246
  constructor() {
1247
- o(this, "fe");
1248
- this.fe = new S();
1247
+ n(this, "fe");
1248
+ this.fe = new F();
1249
1249
  }
1250
1250
  calculateMaxGlyphDimensions(A, t, e) {
1251
1251
  let s = 0;
1252
1252
  const r = this.fe.Ie(e, t), i = r.lineHeight;
1253
1253
  for (const B of A) {
1254
- const n = this.fe.Pe(e, B);
1255
- if (n === 0) continue;
1256
- const Q = this.fe.ue(e, n) * r.scale;
1257
- s = Math.max(s, Q);
1254
+ const Q = this.fe.Pe(e, B);
1255
+ if (Q === 0) continue;
1256
+ const o = this.fe.ue(e, Q) * r.scale;
1257
+ s = Math.max(s, o);
1258
1258
  }
1259
1259
  return { width: Math.ceil(s), height: Math.ceil(i) };
1260
1260
  }
@@ -1271,16 +1271,16 @@ class pA {
1271
1271
  }
1272
1272
  class yA {
1273
1273
  constructor() {
1274
- o(this, "Re");
1275
- this.Re = new S();
1274
+ n(this, "Re");
1275
+ this.Re = new F();
1276
1276
  }
1277
1277
  createCharacterObjects(A, t) {
1278
1278
  return A.map((e, s) => {
1279
1279
  const r = e.codePointAt(0) || 0, i = this.Le(s);
1280
1280
  let B = 0;
1281
1281
  if (t.hmtx && t.hmtx.aWidth) {
1282
- const n = this.Re.ce(t, r);
1283
- n > 0 && t.hmtx.aWidth[n] !== void 0 && (B = t.hmtx.aWidth[n]);
1282
+ const Q = this.Re.ce(t, r);
1283
+ Q > 0 && t.hmtx.aWidth[Q] !== void 0 && (B = t.hmtx.aWidth[Q]);
1284
1284
  }
1285
1285
  return { character: e, unicode: r, color: i, advanceWidth: B };
1286
1286
  });
@@ -1299,18 +1299,18 @@ class yA {
1299
1299
  }
1300
1300
  class xA {
1301
1301
  constructor(A, t = 16) {
1302
- o(this, "We");
1303
- o(this, "Je", []);
1304
- o(this, "Ve");
1305
- o(this, "Ke", 16);
1306
- o(this, "Ze", 0);
1307
- o(this, "je", 0);
1308
- o(this, "Xe", { width: 0, height: 0 });
1309
- o(this, "Ne");
1310
- o(this, "qe");
1311
- o(this, "AB");
1312
- o(this, "tB");
1313
- o(this, "eB");
1302
+ n(this, "We");
1303
+ n(this, "Je", []);
1304
+ n(this, "Ve");
1305
+ n(this, "Ke", 16);
1306
+ n(this, "Ze", 0);
1307
+ n(this, "je", 0);
1308
+ n(this, "Xe", { width: 0, height: 0 });
1309
+ n(this, "Ne");
1310
+ n(this, "qe");
1311
+ n(this, "AB");
1312
+ n(this, "tB");
1313
+ n(this, "eB");
1314
1314
  this.Ke = t, this.qe = new wA(), this.AB = new mA(A), this.tB = new pA(), this.eB = new yA();
1315
1315
  }
1316
1316
  async BB(A) {
@@ -1386,15 +1386,15 @@ class xA {
1386
1386
  }
1387
1387
  class vA {
1388
1388
  constructor(A, t, e) {
1389
- o(this, "EB");
1390
- o(this, "nB");
1391
- o(this, "I");
1392
- o(this, "p");
1393
- o(this, "oB");
1394
- o(this, "gB");
1395
- o(this, "aB");
1396
- o(this, "hB");
1397
- o(this, "cB");
1389
+ n(this, "EB");
1390
+ n(this, "nB");
1391
+ n(this, "I");
1392
+ n(this, "p");
1393
+ n(this, "oB");
1394
+ n(this, "gB");
1395
+ n(this, "aB");
1396
+ n(this, "hB");
1397
+ n(this, "cB");
1398
1398
  this.aB = A, this.hB = t, this.cB = e, this.fA();
1399
1399
  }
1400
1400
  fA() {
@@ -1430,9 +1430,9 @@ class vA {
1430
1430
  }
1431
1431
  class bA {
1432
1432
  constructor(A = {}) {
1433
- o(this, "aB");
1434
- o(this, "DB");
1435
- o(this, "lB");
1433
+ n(this, "aB");
1434
+ n(this, "DB");
1435
+ n(this, "lB");
1436
1436
  A.canvas ? (this.aB = A.canvas, this.lB = !1) : (this.aB = this.PB(A.width, A.height), this.lB = !0), this.aB.style.imageRendering = "pixelated";
1437
1437
  }
1438
1438
  PB(A, t) {
@@ -1468,16 +1468,16 @@ class bA {
1468
1468
  }
1469
1469
  class RA {
1470
1470
  constructor(A = 60) {
1471
- o(this, "IB");
1472
- o(this, "wB");
1473
- o(this, "fB", null);
1474
- o(this, "dB", 0);
1475
- o(this, "pB", !0);
1476
- o(this, "_B", 0);
1477
- o(this, "mB", 0);
1478
- o(this, "vB", []);
1479
- o(this, "xB", 10);
1480
- o(this, "yB", 0);
1471
+ n(this, "IB");
1472
+ n(this, "wB");
1473
+ n(this, "fB", null);
1474
+ n(this, "dB", 0);
1475
+ n(this, "pB", !0);
1476
+ n(this, "_B", 0);
1477
+ n(this, "mB", 0);
1478
+ n(this, "vB", []);
1479
+ n(this, "xB", 10);
1480
+ n(this, "yB", 0);
1481
1481
  this.IB = A, this.wB = 1e3 / A;
1482
1482
  }
1483
1483
  start(A) {
@@ -1596,8 +1596,8 @@ const TA = (E) => class extends E {
1596
1596
  triangle(A, t, e, s, r, i) {
1597
1597
  this.ze.te(A, t, e, s, r, i);
1598
1598
  }
1599
- bezierCurve(A, t, e, s, r, i, B, n) {
1600
- this.ze.ee(A, t, e, s, r, i, B, n);
1599
+ bezierCurve(A, t, e, s, r, i, B, Q) {
1600
+ this.ze.ee(A, t, e, s, r, i, B, Q);
1601
1601
  }
1602
1602
  arc(A, t, e, s, r, i) {
1603
1603
  this.ze.se(A, t, e, s, r, i);
@@ -1646,17 +1646,17 @@ class W {
1646
1646
  const A = /* @__PURE__ */ new Date();
1647
1647
  return { date: A.toISOString().split("T")[0], time: A.toTimeString().split(" ")[0].replace(/:/g, "-") };
1648
1648
  }
1649
- TB(A) {
1649
+ SB(A) {
1650
1650
  return A.replace(/[<>:"/\\|?*]/g, "_").replace(/\s+/g, "_").replace(/_{2,}/g, "_").replace(/^_+|_+$/g, "").substring(0, 255);
1651
1651
  }
1652
- SB() {
1652
+ TB() {
1653
1653
  return "textmode-export-" + this.zB();
1654
1654
  }
1655
1655
  }
1656
1656
  class MA extends O {
1657
1657
  FB(A, t, e) {
1658
- const s = A[e] === 255, r = A[e + 1] === 255, i = A[e + 2] === 255, B = t[e], n = t[e + 1];
1659
- return { isInverted: s, flipHorizontal: r, flipVertical: i, rotation: Math.round(360 * (B + n / 255) / 255 * 100) / 100 };
1658
+ const s = A[e] === 255, r = A[e + 1] === 255, i = A[e + 2] === 255, B = t[e], Q = t[e + 1];
1659
+ return { isInverted: s, flipHorizontal: r, flipVertical: i, rotation: Math.round(360 * (B + Q / 255) / 255 * 100) / 100 };
1660
1660
  }
1661
1661
  OB(A, t, e) {
1662
1662
  return { x: A, y: t, cellX: A * e.cellWidth, cellY: t * e.cellHeight };
@@ -1665,15 +1665,15 @@ class MA extends O {
1665
1665
  const e = [];
1666
1666
  let s = 0;
1667
1667
  for (let r = 0; r < t.rows; r++) for (let i = 0; i < t.cols; i++) {
1668
- const B = 4 * s, n = this.GB(A.characterPixels, B);
1669
- let Q = this.$B(A.primaryColorPixels, B), h = this.$B(A.secondaryColorPixels, B);
1668
+ const B = 4 * s, Q = this.GB(A.characterPixels, B);
1669
+ let o = this.$B(A.primaryColorPixels, B), h = this.$B(A.secondaryColorPixels, B);
1670
1670
  const a = this.FB(A.transformPixels, A.rotationPixels, B);
1671
1671
  if (a.isInverted) {
1672
- const l = Q;
1673
- Q = h, h = l;
1672
+ const l = o;
1673
+ o = h, h = l;
1674
1674
  }
1675
1675
  const g = this.OB(i, r, t);
1676
- e.push({ charIndex: n, primaryColor: Q, secondaryColor: h, transform: a, position: g }), s++;
1676
+ e.push({ charIndex: Q, primaryColor: o, secondaryColor: h, transform: a, position: g }), s++;
1677
1677
  }
1678
1678
  return e;
1679
1679
  }
@@ -1688,16 +1688,16 @@ class _A {
1688
1688
  {
1689
1689
  const B = r.idRangeOffset[i] / 2 + (t - r.startCount[i]) - (r.startCount.length - i);
1690
1690
  if (B >= 0 && B < r.glyphIdArray.length) {
1691
- const n = r.glyphIdArray[B];
1692
- if (n !== 0) return n + r.idDelta[i] & 65535;
1691
+ const Q = r.glyphIdArray[B];
1692
+ if (Q !== 0) return Q + r.idDelta[i] & 65535;
1693
1693
  }
1694
1694
  }
1695
1695
  }
1696
1696
  } else if (s.format === 12) {
1697
1697
  const r = s;
1698
1698
  for (let i = 0; i < r.groups.length; i += 3) {
1699
- const B = r.groups[i], n = r.groups[i + 1], Q = r.groups[i + 2];
1700
- if (t >= B && t <= n) return Q + (t - B);
1699
+ const B = r.groups[i], Q = r.groups[i + 1], o = r.groups[i + 2];
1700
+ if (t >= B && t <= Q) return o + (t - B);
1701
1701
  }
1702
1702
  }
1703
1703
  return 0;
@@ -1708,51 +1708,51 @@ class _A {
1708
1708
  }
1709
1709
  HB(A, t, e, s) {
1710
1710
  if (!A || !A.xs) return "";
1711
- const { xs: r, ys: i, endPts: B, flags: n } = A;
1712
- if (!(r && i && B && n)) return "";
1713
- let Q = "", h = 0;
1711
+ const { xs: r, ys: i, endPts: B, flags: Q } = A;
1712
+ if (!(r && i && B && Q)) return "";
1713
+ let o = "", h = 0;
1714
1714
  for (let a = 0; a < B.length; a++) {
1715
1715
  const g = B[a];
1716
1716
  if (!(g < h)) {
1717
1717
  if (g >= h) {
1718
1718
  const l = t + r[h] * s, c = e - i[h] * s;
1719
- Q += `M${l.toFixed(2)},${c.toFixed(2)}`;
1719
+ o += `M${l.toFixed(2)},${c.toFixed(2)}`;
1720
1720
  let C = h + 1;
1721
1721
  for (; C <= g; )
1722
- if (1 & n[C]) {
1722
+ if (1 & Q[C]) {
1723
1723
  const d = t + r[C] * s, I = e - i[C] * s;
1724
- Q += `L${d.toFixed(2)},${I.toFixed(2)}`, C++;
1724
+ o += `L${d.toFixed(2)},${I.toFixed(2)}`, C++;
1725
1725
  } else {
1726
1726
  const d = t + r[C] * s, I = e - i[C] * s;
1727
1727
  let w = C + 1 > g ? h : C + 1;
1728
- if (1 & n[w]) {
1728
+ if (1 & Q[w]) {
1729
1729
  const p = t + r[w] * s, u = e - i[w] * s;
1730
- Q += `Q${d.toFixed(2)},${I.toFixed(2)} ${p.toFixed(2)},${u.toFixed(2)}`, C = w + 1;
1730
+ o += `Q${d.toFixed(2)},${I.toFixed(2)} ${p.toFixed(2)},${u.toFixed(2)}`, C = w + 1;
1731
1731
  } else {
1732
1732
  const p = (d + (t + r[w] * s)) / 2, u = (I + (e - i[w] * s)) / 2;
1733
- Q += `Q${d.toFixed(2)},${I.toFixed(2)} ${p.toFixed(2)},${u.toFixed(2)}`, C = w;
1733
+ o += `Q${d.toFixed(2)},${I.toFixed(2)} ${p.toFixed(2)},${u.toFixed(2)}`, C = w;
1734
1734
  }
1735
1735
  }
1736
- Q += "Z";
1736
+ o += "Z";
1737
1737
  }
1738
1738
  h = g + 1;
1739
1739
  }
1740
1740
  }
1741
- return Q;
1741
+ return o;
1742
1742
  }
1743
1743
  WB(A, t, e, s, r) {
1744
1744
  const i = A.codePointAt(0) || 0, B = this.LB(t, i);
1745
- let n = null;
1746
- return t.glyf && t.glyf[B] !== null ? n = t.glyf[B] : (n = y.T.glyf.Ee(t, B), t.glyf[B] = n), this.kB(t, n, e, s, r);
1745
+ let Q = null;
1746
+ return t.glyf && t.glyf[B] !== null ? Q = t.glyf[B] : (Q = y.T.glyf.Ee(t, B), t.glyf[B] = Q), this.kB(t, Q, e, s, r);
1747
1747
  }
1748
- JB(A, t, e, s, r, i, B, n) {
1749
- const Q = e + (r - n * (B / t.head.unitsPerEm)) / 2, h = s + (i + 0.7 * B) / 2;
1750
- return this.WB(A, t, Q, h, B).toSVG() || null;
1748
+ JB(A, t, e, s, r, i, B, Q) {
1749
+ const o = e + (r - Q * (B / t.head.unitsPerEm)) / 2, h = s + (i + 0.7 * B) / 2;
1750
+ return this.WB(A, t, o, h, B).toSVG() || null;
1751
1751
  }
1752
1752
  }
1753
1753
  class GA {
1754
1754
  constructor() {
1755
- o(this, "VB");
1755
+ n(this, "VB");
1756
1756
  this.VB = new _A();
1757
1757
  }
1758
1758
  KB(A) {
@@ -1780,8 +1780,8 @@ class GA {
1780
1780
  NB(A, t) {
1781
1781
  const { transform: e, position: s } = A, r = s.cellX + t.cellWidth / 2, i = s.cellY + t.cellHeight / 2, B = [];
1782
1782
  if (e.flipHorizontal || e.flipVertical) {
1783
- const n = e.flipHorizontal ? -1 : 1, Q = e.flipVertical ? -1 : 1;
1784
- B.push(`translate(${r} ${i})`), B.push(`scale(${n} ${Q})`), B.push(`translate(${-r} ${-i})`);
1783
+ const Q = e.flipHorizontal ? -1 : 1, o = e.flipVertical ? -1 : 1;
1784
+ B.push(`translate(${r} ${i})`), B.push(`scale(${Q} ${o})`), B.push(`translate(${-r} ${-i})`);
1785
1785
  }
1786
1786
  return e.rotation && B.push(`rotate(${e.rotation} ${r} ${i})`), B.length ? ` transform="${B.join(" ")}"` : "";
1787
1787
  }
@@ -1827,21 +1827,21 @@ class YA extends W {
1827
1827
  return this.MB(A, "image/svg+xml;charset=utf-8");
1828
1828
  }
1829
1829
  ss(A, t) {
1830
- this.YB(A, this.TB(t) + ".svg", "image/svg+xml;charset=utf-8");
1830
+ this.YB(A, this.SB(t) + ".svg", "image/svg+xml;charset=utf-8");
1831
1831
  }
1832
1832
  Qs(A, t) {
1833
- this.ss(A, t || this.SB());
1833
+ this.ss(A, t || this.TB());
1834
1834
  }
1835
1835
  }
1836
1836
  class H {
1837
1837
  constructor() {
1838
- o(this, "rs");
1839
- o(this, "Es");
1840
- o(this, "ns");
1838
+ n(this, "rs");
1839
+ n(this, "Es");
1840
+ n(this, "ns");
1841
1841
  this.rs = new MA(), this.Es = new GA(), this.ns = new YA();
1842
1842
  }
1843
1843
  gs(A) {
1844
- return { includeBackgroundRectangles: A.includeBackgroundRectangles ?? !0, drawMode: A.drawMode ?? "fill", strokeWidth: A.strokeWidth ?? 1, backgroundColor: A.backgroundColor ?? [0, 0, 0, 0], filename: A.filename || this.ns.SB() };
1844
+ return { includeBackgroundRectangles: A.includeBackgroundRectangles ?? !0, drawMode: A.drawMode ?? "fill", strokeWidth: A.strokeWidth ?? 1, backgroundColor: A.backgroundColor ?? [0, 0, 0, 0], filename: A.filename || this.ns.TB() };
1845
1845
  }
1846
1846
  hs(A, t = {}) {
1847
1847
  const e = this.rs.UB(this.rs.bB(A.pipeline), A.grid), s = this.Es.ts(e, A.grid, A.font, this.gs(t));
@@ -1851,23 +1851,23 @@ class H {
1851
1851
  this.ns.Qs(this.hs(A, t), t.filename);
1852
1852
  }
1853
1853
  }
1854
- class SA extends O {
1854
+ class FA extends O {
1855
1855
  cs(A, t, e, s = " ") {
1856
1856
  var B;
1857
1857
  const r = [];
1858
1858
  let i = 0;
1859
- for (let n = 0; n < t.rows; n++) {
1860
- const Q = [];
1859
+ for (let Q = 0; Q < t.rows; Q++) {
1860
+ const o = [];
1861
1861
  for (let h = 0; h < t.cols; h++) {
1862
1862
  const a = 4 * i, g = this.GB(A.characterPixels, a), l = ((B = e.characters[g]) == null ? void 0 : B.character) || s;
1863
- Q.push(l), i++;
1863
+ o.push(l), i++;
1864
1864
  }
1865
- r.push(Q);
1865
+ r.push(o);
1866
1866
  }
1867
1867
  return r;
1868
1868
  }
1869
1869
  }
1870
- class FA {
1870
+ class SA {
1871
1871
  Cs(A, t) {
1872
1872
  const e = [];
1873
1873
  for (const r of A) {
@@ -1886,19 +1886,19 @@ class zA extends W {
1886
1886
  this.YB(A, e, "text/plain;charset=utf-8");
1887
1887
  }
1888
1888
  ls(A) {
1889
- let t = this.TB(A);
1890
- return t === ".txt" || t.length <= 4 ? this.SB() : t;
1889
+ let t = this.SB(A);
1890
+ return t === ".txt" || t.length <= 4 ? this.TB() : t;
1891
1891
  }
1892
1892
  }
1893
1893
  class X {
1894
1894
  constructor() {
1895
- o(this, "rs");
1896
- o(this, "Es");
1897
- o(this, "ns");
1898
- this.rs = new SA(), this.Es = new FA(), this.ns = new zA();
1895
+ n(this, "rs");
1896
+ n(this, "Es");
1897
+ n(this, "ns");
1898
+ this.rs = new FA(), this.Es = new SA(), this.ns = new zA();
1899
1899
  }
1900
1900
  gs(A) {
1901
- return { preserveTrailingSpaces: A.preserveTrailingSpaces ?? !1, lineEnding: A.lineEnding ?? "lf", emptyCharacter: A.emptyCharacter ?? " ", filename: A.filename || this.ns.SB() };
1901
+ return { preserveTrailingSpaces: A.preserveTrailingSpaces ?? !1, lineEnding: A.lineEnding ?? "lf", emptyCharacter: A.emptyCharacter ?? " ", filename: A.filename || this.ns.TB() };
1902
1902
  }
1903
1903
  Ps(A, t = {}) {
1904
1904
  const e = this.gs(t), s = this.rs.cs(this.rs.bB(A.pipeline), A.grid, A.font, e.emptyCharacter);
@@ -1912,8 +1912,8 @@ class UA extends O {
1912
1912
  us(A, t = 1, e = "transparent") {
1913
1913
  const s = A.canvas;
1914
1914
  if (t === 1 && e === "transparent") return s;
1915
- const r = document.createElement("canvas"), i = r.getContext("2d"), B = Math.round(s.width * t), n = Math.round(s.height * t);
1916
- return r.width = B, r.height = n, e !== "transparent" && (i.fillStyle = e, i.fillRect(0, 0, B, n)), i.imageSmoothingEnabled = !1, i.drawImage(s, 0, 0, s.width, s.height, 0, 0, B, n), r;
1915
+ const r = document.createElement("canvas"), i = r.getContext("2d"), B = Math.round(s.width * t), Q = Math.round(s.height * t);
1916
+ return r.width = B, r.height = Q, e !== "transparent" && (i.fillStyle = e, i.fillRect(0, 0, B, Q)), i.imageSmoothingEnabled = !1, i.drawImage(s, 0, 0, s.width, s.height, 0, 0, B, Q), r;
1917
1917
  }
1918
1918
  }
1919
1919
  class LA {
@@ -1945,7 +1945,7 @@ class LA {
1945
1945
  const OA = { png: "image/png", jpg: "image/jpeg", webp: "image/webp" }, J = { png: ".png", jpg: ".jpg", webp: ".webp" };
1946
1946
  class WA extends W {
1947
1947
  ds(A, t, e) {
1948
- this.ps(A, this.TB(t) + J[e]);
1948
+ this.ps(A, this.SB(t) + J[e]);
1949
1949
  }
1950
1950
  ps(A, t) {
1951
1951
  const e = URL.createObjectURL(A);
@@ -1962,13 +1962,13 @@ class WA extends W {
1962
1962
  }
1963
1963
  class $A {
1964
1964
  constructor() {
1965
- o(this, "rs");
1966
- o(this, "Es");
1967
- o(this, "ns");
1965
+ n(this, "rs");
1966
+ n(this, "Es");
1967
+ n(this, "ns");
1968
1968
  this.rs = new UA(), this.Es = new LA(), this.ns = new WA();
1969
1969
  }
1970
1970
  gs(A) {
1971
- return { format: A.format ?? "png", quality: A.quality ?? 1, scale: A.scale ?? 1, backgroundColor: A.backgroundColor ?? "transparent", filename: A.filename || this.ns.SB() };
1971
+ return { format: A.format ?? "png", quality: A.quality ?? 1, scale: A.scale ?? 1, backgroundColor: A.backgroundColor ?? "transparent", filename: A.filename || this.ns.TB() };
1972
1972
  }
1973
1973
  vs(A) {
1974
1974
  if (!this.ns._s(A.format)) throw Error(`Saving '${A.format}' files is not supported`);
@@ -2045,14 +2045,14 @@ const kA = (E) => class extends E {
2045
2045
  };
2046
2046
  class XA {
2047
2047
  constructor() {
2048
- o(this, "ze");
2049
- o(this, "We");
2050
- o(this, "aB");
2051
- o(this, "Ms");
2052
- o(this, "Ys");
2053
- o(this, "Gs");
2054
- o(this, "$s");
2055
- o(this, "Rs");
2048
+ n(this, "ze");
2049
+ n(this, "We");
2050
+ n(this, "aB");
2051
+ n(this, "Ms");
2052
+ n(this, "Ys");
2053
+ n(this, "Gs");
2054
+ n(this, "$s");
2055
+ n(this, "Rs");
2056
2056
  }
2057
2057
  zs() {
2058
2058
  }
@@ -2062,21 +2062,21 @@ class JA extends function(t, ...e) {
2062
2062
  }(XA, TA, kA, NA, HA) {
2063
2063
  constructor(t = {}) {
2064
2064
  super();
2065
- o(this, "Ts", !1);
2066
- o(this, "Ss", () => {
2065
+ n(this, "Ss", !1);
2066
+ n(this, "Ts", () => {
2067
2067
  });
2068
- o(this, "Fs", () => {
2068
+ n(this, "Fs", () => {
2069
2069
  });
2070
- o(this, "Os", () => {
2070
+ n(this, "Os", () => {
2071
2071
  });
2072
- o(this, "Us");
2072
+ n(this, "Us");
2073
2073
  this.aB = new bA(t), this.ze = new DA(this.aB.uB()), this.We = new xA(this.ze, t.fontSize ?? 16), this.Ys = new RA(t.frameRate ?? 60), this.Gs = this.ze.Jt(L, `#version 300 es
2074
2074
  precision highp float;in vec2 v_uv;in vec3 v_character;in vec4 v_primaryColor;in vec4 v_secondaryColor;in vec2 v_rotation;in vec3 v_transform;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 o_rotation;layout(location=4)out vec4 o_transform;void main(){o_character=vec4(v_character,1.0);o_primaryColor=v_primaryColor;o_secondaryColor=v_secondaryColor;o_rotation=vec4(v_rotation,0.0,1.0);o_transform=vec4(v_transform,1.0);}`), this.Rs = this.ze.Jt("attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_uv;void main(){v_uv=a_texCoord;gl_Position=vec4(a_position,0.0,1.0);}", "precision mediump float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D u_primaryColorTexture;uniform sampler2D u_secondaryColorTexture;uniform sampler2D u_transformTexture;uniform sampler2D u_asciiCharacterTexture;uniform sampler2D u_rotationTexture;uniform vec2 u_gridCellDimensions;uniform vec2 u_gridPixelDimensions;uniform vec2 u_gridOffsetPixels;mat2 rotate2D(float angle){float s=sin(angle);float c=cos(angle);return mat2(c,-s,s,c);}void main(){vec2 adjustedCoord=(gl_FragCoord.xy-u_gridOffsetPixels)/u_gridPixelDimensions;vec2 gridCoord=adjustedCoord*u_gridCellDimensions;vec2 cellCoord=floor(gridCoord);vec2 charIndexTexCoord=(cellCoord+0.5)/u_gridCellDimensions;vec4 primaryColor=texture2D(u_primaryColorTexture,charIndexTexCoord);vec4 secondaryColor=texture2D(u_secondaryColorTexture,charIndexTexCoord);vec4 transformColor=texture2D(u_transformTexture,charIndexTexCoord);bool isInverted=transformColor.r>0.5;bool flipHorizontal=transformColor.g>0.5;bool flipVertical=transformColor.b>0.5;vec4 encodedIndexVec=texture2D(u_asciiCharacterTexture,charIndexTexCoord);int charIndex=int(encodedIndexVec.r*255.0+0.5)+int(encodedIndexVec.g*255.0+0.5)*256;int charCol=int(mod(float(charIndex),u_charsetDimensions.x));int charRow=charIndex/int(u_charsetDimensions.x);float flippedRow=(u_charsetDimensions.y-1.0)-float(charRow);vec2 charCoord=vec2(float(charCol),flippedRow)/u_charsetDimensions;vec4 rotationColor=texture2D(u_rotationTexture,charIndexTexCoord);float scaledAngle=rotationColor.r*255.0+rotationColor.g;float rotationAngle=-(scaledAngle*360.0/255.0)*0.017453292;vec2 fractionalPart=fract(gridCoord)-0.5;if(flipHorizontal)fractionalPart.x=-fractionalPart.x;if(flipVertical)fractionalPart.y=-fractionalPart.y;fractionalPart=rotate2D(rotationAngle)*fractionalPart+0.5;vec2 cellSize=1.0/u_charsetDimensions;vec2 texCoord=charCoord+fractionalPart*cellSize;vec2 cellMax=charCoord+cellSize;if(any(lessThan(texCoord,charCoord))||any(greaterThan(texCoord,cellMax))){gl_FragColor=isInverted ? primaryColor : secondaryColor;return;}vec4 charTexel=texture2D(u_characterTexture,texCoord);if(isInverted)charTexel.rgb=1.0-charTexel.rgb;gl_FragColor=mix(secondaryColor,primaryColor,charTexel);}"), this.Ls(t);
2075
2075
  }
2076
2076
  async Ls(t) {
2077
2077
  await this.We.BB(t.fontSource);
2078
2078
  const e = this.We.maxGlyphDimensions;
2079
- this.Ms = new vA(this.aB.canvas, e.width, e.height), this.$s = this.ze.Be(this.Ms.cols, this.Ms.rows, 5), this.ks(), this.Ss(), this.Ys.start(() => this.zs());
2079
+ this.Ms = new vA(this.aB.canvas, e.width, e.height), this.$s = this.ze.Be(this.Ms.cols, this.Ms.rows, 5), this.ks(), this.Ts(), this.Ys.start(() => this.zs());
2080
2080
  }
2081
2081
  ks() {
2082
2082
  this.Us = () => {
@@ -2084,13 +2084,13 @@ precision highp float;in vec2 v_uv;in vec3 v_character;in vec4 v_primaryColor;in
2084
2084
  }, window.addEventListener("resize", this.Us);
2085
2085
  }
2086
2086
  zs() {
2087
- if (this.Ys.measureFrameRate(), this.Ys.incrementFrame(), this.Ts) return;
2087
+ if (this.Ys.measureFrameRate(), this.Ys.incrementFrame(), this.Ss) return;
2088
2088
  this.$s.k(), this.ze.Wt(this.Gs), this.Fs(), this.ze.re(this.Gs), this.$s.H();
2089
2089
  const t = this.ze.state.canvasBackgroundColor;
2090
2090
  this.ze.ot(t[0], t[1], t[2], t[3]), this.ze.Wt(this.Rs), this.Rs.eA({ u_characterTexture: this.We.fontFramebuffer, u_charsetDimensions: [this.We.textureColumns, this.We.textureRows], u_asciiCharacterTexture: this.$s.textures[0], u_primaryColorTexture: this.$s.textures[1], u_secondaryColorTexture: this.$s.textures[2], u_transformTexture: this.$s.textures[4], u_rotationTexture: this.$s.textures[3], u_gridCellDimensions: [this.Ms.cols, this.Ms.rows], u_gridPixelDimensions: [this.Ms.width, this.Ms.height], u_gridOffsetPixels: [this.Ms.offsetX, this.Ms.offsetY], u_aspectRatio: this.Ms.width / this.Ms.height }), this.ze.Xt(this.Ms.offsetX, this.Ms.offsetY, this.Ms.width, this.Ms.height);
2091
2091
  }
2092
2092
  setup(t) {
2093
- this.Ss = t;
2093
+ this.Ts = t;
2094
2094
  }
2095
2095
  draw(t) {
2096
2096
  this.Fs = t;
@@ -2102,7 +2102,7 @@ precision highp float;in vec2 v_uv;in vec3 v_character;in vec4 v_primaryColor;in
2102
2102
  this.aB.O(t, e), this.Ms.fA(), this.$s.O(this.Ms.cols, this.Ms.rows), this.ze.Qe(), this.zs();
2103
2103
  }
2104
2104
  destroy() {
2105
- this.Ts || (this.Ys.stop(), window.removeEventListener("resize", this.Us), this.We.W(), this.ze.W(), this.Ts = !0);
2105
+ this.Ss || (this.Ys.stop(), window.removeEventListener("resize", this.Us), this.We.W(), this.ze.W(), this.Ss = !0);
2106
2106
  }
2107
2107
  get grid() {
2108
2108
  return this.Ms;
@@ -2120,7 +2120,7 @@ precision highp float;in vec2 v_uv;in vec3 v_character;in vec4 v_primaryColor;in
2120
2120
  return this.aB.canvas;
2121
2121
  }
2122
2122
  get isDisposed() {
2123
- return this.Ts;
2123
+ return this.Ss;
2124
2124
  }
2125
2125
  get drawFramebuffer() {
2126
2126
  return this.$s;
@@ -2128,7 +2128,6 @@ precision highp float;in vec2 v_uv;in vec3 v_character;in vec4 v_primaryColor;in
2128
2128
  }
2129
2129
  class $ {
2130
2130
  constructor() {
2131
- throw new m("Textmode is a static class and cannot be instantiated.");
2132
2131
  }
2133
2132
  static create(A = {}) {
2134
2133
  return new JA(A);
@@ -2137,7 +2136,7 @@ class $ {
2137
2136
  _.u(A);
2138
2137
  }
2139
2138
  static get version() {
2140
- return "0.2.0-beta.4";
2139
+ return "0.2.0";
2141
2140
  }
2142
2141
  }
2143
2142
  const jA = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), ZA = $.create, KA = $.setErrorLevel, qA = $.version;