textmode.js 0.1.6-beta.2 → 0.1.6-beta.3

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,12 +1,12 @@
1
1
  var iA = Object.defineProperty;
2
- var sA = (a, A, e) => A in a ? iA(a, A, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[A] = e;
3
- var o = (a, A, e) => sA(a, typeof A != "symbol" ? A + "" : A, e);
2
+ var sA = (n, A, e) => A in n ? iA(n, A, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[A] = e;
3
+ var a = (n, A, e) => sA(n, typeof A != "symbol" ? A + "" : A, e);
4
4
  class p extends Error {
5
5
  constructor(e, t, r = {}) {
6
6
  const i = p.createFormattedMessage(e, r);
7
7
  super(i);
8
- o(this, "originalError");
9
- o(this, "context");
8
+ a(this, "originalError");
9
+ a(this, "context");
10
10
  this.name = "TextmodeError", this.originalError = t, this.context = r;
11
11
  }
12
12
  /**
@@ -19,9 +19,9 @@ class p extends Error {
19
19
 
20
20
  📋 Context:`;
21
21
  for (const [i, s] of Object.entries(t)) {
22
- const n = p.formatValue(s);
22
+ const o = p.formatValue(s);
23
23
  r += `
24
- - ${i}: ${n}`;
24
+ - ${i}: ${o}`;
25
25
  }
26
26
  }
27
27
  return r += `
@@ -46,10 +46,10 @@ class p extends Error {
46
46
  return String(e);
47
47
  }
48
48
  }
49
- var nA = /* @__PURE__ */ ((a) => (a[a.SILENT = 0] = "SILENT", a[a.WARNING = 1] = "WARNING", a[a.ERROR = 2] = "ERROR", a[a.THROW = 3] = "THROW", a))(nA || {});
49
+ var oA = /* @__PURE__ */ ((n) => (n[n.SILENT = 0] = "SILENT", n[n.WARNING = 1] = "WARNING", n[n.ERROR = 2] = "ERROR", n[n.THROW = 3] = "THROW", n))(oA || {});
50
50
  const b = class b {
51
51
  constructor() {
52
- o(this, "_options", {
52
+ a(this, "_options", {
53
53
  globalLevel: 3
54
54
  /* THROW */
55
55
  });
@@ -103,19 +103,19 @@ const b = class b {
103
103
  this._options.globalLevel = A;
104
104
  }
105
105
  };
106
- o(b, "_instance", null);
107
- let V = b;
108
- const f = V.getInstance();
109
- class oA {
106
+ a(b, "_instance", null);
107
+ let k = b;
108
+ const f = k.getInstance();
109
+ class aA {
110
110
  constructor(A, e, t = e, r = {}) {
111
- o(this, "gl");
112
- o(this, "_framebuffer");
113
- o(this, "_texture");
114
- o(this, "_width");
115
- o(this, "_height");
116
- o(this, "options");
117
- o(this, "previousState", null);
118
- o(this, "_pixels", null);
111
+ a(this, "gl");
112
+ a(this, "_framebuffer");
113
+ a(this, "_texture");
114
+ a(this, "_width");
115
+ a(this, "_height");
116
+ a(this, "options");
117
+ a(this, "previousState", null);
118
+ a(this, "_pixels", null);
119
119
  this.gl = A, this._width = e, this._height = t, this.options = {
120
120
  filter: "nearest",
121
121
  wrap: "clamp",
@@ -189,16 +189,16 @@ class oA {
189
189
  get(A, e, t, r) {
190
190
  const { gl: i } = this;
191
191
  if (A === void 0 && e === void 0) {
192
- const s = new Uint8Array(this._width * this._height * 4), n = i.getParameter(i.FRAMEBUFFER_BINDING);
193
- return i.bindFramebuffer(i.FRAMEBUFFER, this._framebuffer), i.readPixels(0, 0, this._width, this._height, i.RGBA, i.UNSIGNED_BYTE, s), i.bindFramebuffer(i.FRAMEBUFFER, n), s;
192
+ const s = new Uint8Array(this._width * this._height * 4), o = i.getParameter(i.FRAMEBUFFER_BINDING);
193
+ return i.bindFramebuffer(i.FRAMEBUFFER, this._framebuffer), i.readPixels(0, 0, this._width, this._height, i.RGBA, i.UNSIGNED_BYTE, s), i.bindFramebuffer(i.FRAMEBUFFER, o), s;
194
194
  } else if (t === void 0 && r === void 0) {
195
195
  (A < 0 || e < 0 || A >= this._width || e >= this._height) && (console.warn("The x and y values passed to Framebuffer.get are outside of its range and will be clamped."), A = Math.max(0, Math.min(A, this._width - 1)), e = Math.max(0, Math.min(e, this._height - 1)));
196
- const s = new Uint8Array(4), n = i.getParameter(i.FRAMEBUFFER_BINDING);
197
- return i.bindFramebuffer(i.FRAMEBUFFER, this._framebuffer), i.readPixels(A, e, 1, 1, i.RGBA, i.UNSIGNED_BYTE, s), i.bindFramebuffer(i.FRAMEBUFFER, n), [s[0], s[1], s[2], s[3]];
196
+ const s = new Uint8Array(4), o = i.getParameter(i.FRAMEBUFFER_BINDING);
197
+ return i.bindFramebuffer(i.FRAMEBUFFER, this._framebuffer), i.readPixels(A, e, 1, 1, i.RGBA, i.UNSIGNED_BYTE, s), i.bindFramebuffer(i.FRAMEBUFFER, o), [s[0], s[1], s[2], s[3]];
198
198
  } else {
199
199
  A = Math.max(0, Math.min(A, this._width - 1)), e = Math.max(0, Math.min(e, this._height - 1)), t = Math.max(1, Math.min(t, this._width - A)), r = Math.max(1, Math.min(r, this._height - e));
200
- const s = new Uint8Array(t * r * 4), n = i.getParameter(i.FRAMEBUFFER_BINDING);
201
- return i.bindFramebuffer(i.FRAMEBUFFER, this._framebuffer), i.readPixels(A, e, t, r, i.RGBA, i.UNSIGNED_BYTE, s), i.bindFramebuffer(i.FRAMEBUFFER, n), s;
200
+ const s = new Uint8Array(t * r * 4), o = i.getParameter(i.FRAMEBUFFER_BINDING);
201
+ return i.bindFramebuffer(i.FRAMEBUFFER, this._framebuffer), i.readPixels(A, e, t, r, i.RGBA, i.UNSIGNED_BYTE, s), i.bindFramebuffer(i.FRAMEBUFFER, o), s;
202
202
  }
203
203
  }
204
204
  /**
@@ -227,28 +227,28 @@ class oA {
227
227
  }
228
228
  class K {
229
229
  constructor(A, e, t) {
230
- o(this, "gl");
231
- o(this, "x");
232
- o(this, "y");
230
+ a(this, "gl");
231
+ a(this, "x");
232
+ a(this, "y");
233
233
  this.gl = A, this.x = e, this.y = t;
234
234
  }
235
235
  }
236
236
  class y {
237
237
  constructor(A, e, t, r, i) {
238
238
  /** The WebGL rendering context */
239
- o(this, "gl");
239
+ a(this, "gl");
240
240
  /** The vertex buffer containing position and texture coordinates */
241
- o(this, "vertexBuffer");
241
+ a(this, "vertexBuffer");
242
242
  /** The number of vertices in this geometry (always 6 for two triangles) */
243
- o(this, "vertexCount", 6);
243
+ a(this, "vertexCount", 6);
244
244
  /** Bytes per vertex: depends on position format (vec2 vs vec3) */
245
- o(this, "bytesPerVertex");
245
+ a(this, "bytesPerVertex");
246
246
  this.gl = A, this.bytesPerVertex = 16;
247
- const s = A.getParameter(A.VIEWPORT), n = s[2], g = s[3], B = A.getParameter(A.FRAMEBUFFER_BINDING) !== null, h = e / n * 2 - 1, E = (e + r) / n * 2 - 1;
247
+ const s = A.getParameter(A.VIEWPORT), o = s[2], g = s[3], B = A.getParameter(A.FRAMEBUFFER_BINDING) !== null, E = e / o * 2 - 1, h = (e + r) / o * 2 - 1;
248
248
  let l, c;
249
249
  B ? (l = t / g * 2 - 1, c = (t + i) / g * 2 - 1) : (l = 1 - t / g * 2, c = 1 - (t + i) / g * 2);
250
250
  let d, u, m, D;
251
- d = h, m = E, u = l, D = c;
251
+ d = E, m = h, u = l, D = c;
252
252
  const C = this.generateVertices(d, u, m, D);
253
253
  this.vertexBuffer = A.createBuffer(), A.bindBuffer(A.ARRAY_BUFFER, this.vertexBuffer), A.bufferData(A.ARRAY_BUFFER, C, A.STATIC_DRAW);
254
254
  }
@@ -300,11 +300,11 @@ class y {
300
300
  this.gl.enableVertexAttribArray(e), this.gl.vertexAttribPointer(e, 2, this.gl.FLOAT, !1, this.bytesPerVertex, 0), this.gl.enableVertexAttribArray(t), this.gl.vertexAttribPointer(t, 2, this.gl.FLOAT, !1, this.bytesPerVertex, 8), this.gl.drawArrays(this.gl.TRIANGLES, 0, this.vertexCount), this.gl.disableVertexAttribArray(e), this.gl.disableVertexAttribArray(t);
301
301
  }
302
302
  }
303
- class aA extends K {
303
+ class nA extends K {
304
304
  constructor(e, t, r, i, s) {
305
305
  super(e, t, r);
306
- o(this, "width");
307
- o(this, "height");
306
+ a(this, "width");
307
+ a(this, "height");
308
308
  this.width = i, this.height = s;
309
309
  }
310
310
  /**
@@ -327,28 +327,28 @@ class aA extends K {
327
327
  class gA {
328
328
  constructor(A, e, t, r, i, s) {
329
329
  /** The WebGL rendering context */
330
- o(this, "gl");
330
+ a(this, "gl");
331
331
  /** The vertex buffer containing position and texture coordinates */
332
- o(this, "vertexBuffer");
332
+ a(this, "vertexBuffer");
333
333
  /** The number of vertices in this geometry (always 6 for two triangles) */
334
- o(this, "vertexCount", 6);
334
+ a(this, "vertexCount", 6);
335
335
  /** Bytes per vertex: vec2+vec2 = 16 bytes */
336
- o(this, "bytesPerVertex");
336
+ a(this, "bytesPerVertex");
337
337
  this.gl = A, this.bytesPerVertex = 16;
338
- const n = A.getParameter(A.VIEWPORT), g = n[2], B = n[3], h = A.getParameter(A.FRAMEBUFFER_BINDING) !== null, E = r - e, l = i - t, c = Math.sqrt(E * E + l * l);
338
+ const o = A.getParameter(A.VIEWPORT), g = o[2], B = o[3], E = A.getParameter(A.FRAMEBUFFER_BINDING) !== null, h = r - e, l = i - t, c = Math.sqrt(h * h + l * l);
339
339
  if (c === 0) {
340
340
  const rA = this.generateVertices(0, 0, 0, 0);
341
341
  this.vertexBuffer = A.createBuffer(), A.bindBuffer(A.ARRAY_BUFFER, this.vertexBuffer), A.bufferData(A.ARRAY_BUFFER, rA, A.STATIC_DRAW);
342
342
  return;
343
343
  }
344
- const d = E / c, m = -(l / c), D = d, C = s / 2, P = e + m * C, F = t + D * C, v = e - m * C, I = t - D * C, R = r + m * C, T = i + D * C, j = r - m * C, W = i - D * C, Z = P / g * 2 - 1, q = v / g * 2 - 1, AA = R / g * 2 - 1, eA = j / g * 2 - 1;
345
- let M, G, U, Y;
346
- h ? (M = F / B * 2 - 1, G = I / B * 2 - 1, U = T / B * 2 - 1, Y = W / B * 2 - 1) : (M = 1 - F / B * 2, G = 1 - I / B * 2, U = 1 - T / B * 2, Y = 1 - W / B * 2);
344
+ const d = h / c, m = -(l / c), D = d, C = s / 2, P = e + m * C, F = t + D * C, v = e - m * C, _ = t - D * C, R = r + m * C, T = i + D * C, j = r - m * C, X = i - D * C, Z = P / g * 2 - 1, q = v / g * 2 - 1, AA = R / g * 2 - 1, eA = j / g * 2 - 1;
345
+ let G, M, U, Y;
346
+ E ? (G = F / B * 2 - 1, M = _ / B * 2 - 1, U = T / B * 2 - 1, Y = X / B * 2 - 1) : (G = 1 - F / B * 2, M = 1 - _ / B * 2, U = 1 - T / B * 2, Y = 1 - X / B * 2);
347
347
  const tA = this.generateLineVertices(
348
348
  Z,
349
- M,
350
- q,
351
349
  G,
350
+ q,
351
+ M,
352
352
  AA,
353
353
  U,
354
354
  eA,
@@ -399,7 +399,7 @@ class gA {
399
399
  * Uses the four corners calculated based on line direction and thickness
400
400
  * @private
401
401
  */
402
- generateLineVertices(A, e, t, r, i, s, n, g) {
402
+ generateLineVertices(A, e, t, r, i, s, o, g) {
403
403
  return new Float32Array([
404
404
  A,
405
405
  e,
@@ -421,7 +421,7 @@ class gA {
421
421
  0,
422
422
  1,
423
423
  // corner2 (start - perpendicular)
424
- n,
424
+ o,
425
425
  g,
426
426
  1,
427
427
  1,
@@ -446,8 +446,8 @@ class gA {
446
446
  class BA extends K {
447
447
  constructor(e, t, r, i, s) {
448
448
  super(e, t, r);
449
- o(this, "x2");
450
- o(this, "y2");
449
+ a(this, "x2");
450
+ a(this, "y2");
451
451
  this.x2 = i, this.y2 = s;
452
452
  }
453
453
  /**
@@ -467,11 +467,11 @@ class BA extends K {
467
467
  }
468
468
  class w {
469
469
  constructor(A, e, t) {
470
- o(this, "gl");
471
- o(this, "program");
472
- o(this, "uniformLocations", /* @__PURE__ */ new Map());
473
- o(this, "attributeLocations", /* @__PURE__ */ new Map());
474
- o(this, "textureUnitCounter", 0);
470
+ a(this, "gl");
471
+ a(this, "program");
472
+ a(this, "uniformLocations", /* @__PURE__ */ new Map());
473
+ a(this, "attributeLocations", /* @__PURE__ */ new Map());
474
+ a(this, "textureUnitCounter", 0);
475
475
  this.gl = A, this.program = this.createProgram(e, t), this.cacheLocations();
476
476
  }
477
477
  createProgram(A, e) {
@@ -612,26 +612,26 @@ class w {
612
612
  this.textureUnitCounter = 0;
613
613
  }
614
614
  }
615
- var _ = "attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_uv;uniform float u_rotation;uniform vec2 u_center;uniform float u_aspectRatio;mat2 rotate2D(float angle){float s=sin(angle);float c=cos(angle);return mat2(c,-s,s,c);}void main(){v_uv=a_texCoord;vec2 pos=a_position;pos-=u_center;pos.x*=u_aspectRatio;pos=rotate2D(-u_rotation)*pos;pos.x/=u_aspectRatio;pos+=u_center;gl_Position=vec4(pos,0.0,1.0);}", hA = "precision lowp float;uniform sampler2D u_texture;varying vec2 v_uv;void main(){gl_FragColor=texture2D(u_texture,v_uv);}", EA = "precision lowp float;uniform vec4 u_color;void main(){gl_FragColor=u_color;}";
615
+ var I = "attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_uv;uniform float u_rotation;uniform vec2 u_center;uniform float u_aspectRatio;mat2 rotate2D(float angle){float s=sin(angle);float c=cos(angle);return mat2(c,-s,s,c);}void main(){v_uv=a_texCoord;vec2 pos=a_position;pos-=u_center;pos.x*=u_aspectRatio;pos=rotate2D(-u_rotation)*pos;pos.x/=u_aspectRatio;pos+=u_center;gl_Position=vec4(pos,0.0,1.0);}", EA = "precision lowp float;uniform sampler2D u_texture;varying vec2 v_uv;void main(){gl_FragColor=texture2D(u_texture,v_uv);}", hA = "precision lowp float;uniform vec4 u_color;void main(){gl_FragColor=u_color;}";
616
616
  class lA {
617
617
  constructor(A) {
618
- o(this, "gl");
619
- o(this, "imageShader");
620
- o(this, "solidColorShader");
621
- o(this, "currentShader", null);
618
+ a(this, "gl");
619
+ a(this, "imageShader");
620
+ a(this, "solidColorShader");
621
+ a(this, "currentShader", null);
622
622
  // Fill state management - default: white fill enabled
623
- o(this, "currentFillColor", [1, 1, 1, 1]);
624
- o(this, "fillMode", !0);
623
+ a(this, "currentFillColor", [1, 1, 1, 1]);
624
+ a(this, "fillMode", !0);
625
625
  // Stroke state management - default: black stroke enabled, weight 1
626
- o(this, "currentStrokeColor", [0, 0, 0, 1]);
627
- o(this, "currentStrokeWeight", 1);
628
- o(this, "strokeMode", !0);
626
+ a(this, "currentStrokeColor", [0, 0, 0, 1]);
627
+ a(this, "currentStrokeWeight", 1);
628
+ a(this, "strokeMode", !0);
629
629
  // Transformation state management
630
- o(this, "currentRotation", 0);
630
+ a(this, "currentRotation", 0);
631
631
  // in degrees
632
632
  // State stack for push/pop functionality
633
- o(this, "stateStack", []);
634
- this.gl = A, this.imageShader = new w(this.gl, _, hA), this.solidColorShader = new w(this.gl, _, EA), this.gl.enable(this.gl.BLEND), this.gl.blendEquation(this.gl.FUNC_ADD), this.gl.blendFunc(this.gl.ONE, this.gl.ONE_MINUS_SRC_ALPHA);
633
+ a(this, "stateStack", []);
634
+ this.gl = A, this.imageShader = new w(this.gl, I, EA), this.solidColorShader = new w(this.gl, I, hA), this.gl.enable(this.gl.BLEND), this.gl.blendEquation(this.gl.FUNC_ADD), this.gl.blendFunc(this.gl.ONE, this.gl.ONE_MINUS_SRC_ALPHA);
635
635
  }
636
636
  /**
637
637
  * Set the current shader
@@ -735,7 +735,7 @@ class lA {
735
735
  return new w(this.gl, A, e);
736
736
  }
737
737
  createFilterShader(A) {
738
- return new w(this.gl, _, A);
738
+ return new w(this.gl, I, A);
739
739
  }
740
740
  /**
741
741
  * Set a uniform value for the current shader
@@ -747,18 +747,18 @@ class lA {
747
747
  * Draw a rectangle with the current fill and/or stroke settings
748
748
  */
749
749
  rect(A, e, t, r) {
750
- const i = new aA(this.gl, A, e, t, r);
750
+ const i = new nA(this.gl, A, e, t, r);
751
751
  if (this.currentShader !== null) {
752
752
  if (this.currentRotation !== 0) {
753
- const { centerX: E, centerY: l, radians: c, aspectRatio: d } = this.calculateRotationParams(A, e, t, r);
754
- this.setUniform("u_rotation", c), this.setUniform("u_center", [E, l]), this.setUniform("u_aspectRatio", d);
753
+ const { centerX: h, centerY: l, radians: c, aspectRatio: d } = this.calculateRotationParams(A, e, t, r);
754
+ this.setUniform("u_rotation", c), this.setUniform("u_center", [h, l]), this.setUniform("u_aspectRatio", d);
755
755
  } else
756
756
  this.setUniform("u_rotation", 0), this.setUniform("u_center", [0, 0]), this.setUniform("u_aspectRatio", 1);
757
757
  i.renderFill(), this.currentShader = null;
758
758
  return;
759
759
  }
760
- const s = this.solidColorShader, { centerX: n, centerY: g, radians: B, aspectRatio: h } = this.calculateRotationParams(A, e, t, r);
761
- this.fillMode && (this.shader(s), this.setUniform("u_color", this.currentFillColor), this.setUniform("u_rotation", B), this.setUniform("u_center", [n, g]), this.setUniform("u_aspectRatio", h), i.renderFill()), this.strokeMode && (this.shader(s), this.setUniform("u_color", this.currentStrokeColor), this.setUniform("u_rotation", B), this.setUniform("u_center", [n, g]), this.setUniform("u_aspectRatio", h), i.renderStroke(this.currentStrokeWeight)), this.currentShader = null;
760
+ const s = this.solidColorShader, { centerX: o, centerY: g, radians: B, aspectRatio: E } = this.calculateRotationParams(A, e, t, r);
761
+ this.fillMode && (this.shader(s), this.setUniform("u_color", this.currentFillColor), this.setUniform("u_rotation", B), this.setUniform("u_center", [o, g]), this.setUniform("u_aspectRatio", E), i.renderFill()), this.strokeMode && (this.shader(s), this.setUniform("u_color", this.currentStrokeColor), this.setUniform("u_rotation", B), this.setUniform("u_center", [o, g]), this.setUniform("u_aspectRatio", E), i.renderStroke(this.currentStrokeWeight)), this.currentShader = null;
762
762
  }
763
763
  /**
764
764
  * Draw a line from (x1, y1) to (x2, y2) with the current stroke settings.
@@ -773,23 +773,23 @@ class lA {
773
773
  const i = new BA(this.gl, A, e, t, r);
774
774
  if (this.currentShader !== null) {
775
775
  if (this.currentRotation !== 0) {
776
- const u = (A + t) / 2, m = (e + r) / 2, D = Math.abs(t - A), C = Math.abs(r - e), { centerX: P, centerY: F, radians: v, aspectRatio: I } = this.calculateRotationParams(u - D / 2, m - C / 2, D, C);
777
- this.setUniform("u_rotation", v), this.setUniform("u_center", [P, F]), this.setUniform("u_aspectRatio", I);
776
+ const u = (A + t) / 2, m = (e + r) / 2, D = Math.abs(t - A), C = Math.abs(r - e), { centerX: P, centerY: F, radians: v, aspectRatio: _ } = this.calculateRotationParams(u - D / 2, m - C / 2, D, C);
777
+ this.setUniform("u_rotation", v), this.setUniform("u_center", [P, F]), this.setUniform("u_aspectRatio", _);
778
778
  } else
779
779
  this.setUniform("u_rotation", 0), this.setUniform("u_center", [0, 0]), this.setUniform("u_aspectRatio", 1);
780
780
  i.renderStroke(this.currentStrokeWeight), this.currentShader = null;
781
781
  return;
782
782
  }
783
- const s = this.solidColorShader, n = (A + t) / 2, g = (e + r) / 2, B = Math.abs(t - A), h = Math.abs(r - e), { centerX: E, centerY: l, radians: c, aspectRatio: d } = this.calculateRotationParams(n - B / 2, g - h / 2, B, h);
784
- this.shader(s), this.setUniform("u_color", this.currentStrokeColor), this.setUniform("u_rotation", c), this.setUniform("u_center", [E, l]), this.setUniform("u_aspectRatio", d), i.renderStroke(this.currentStrokeWeight), this.currentShader = null;
783
+ const s = this.solidColorShader, o = (A + t) / 2, g = (e + r) / 2, B = Math.abs(t - A), E = Math.abs(r - e), { centerX: h, centerY: l, radians: c, aspectRatio: d } = this.calculateRotationParams(o - B / 2, g - E / 2, B, E);
784
+ this.shader(s), this.setUniform("u_color", this.currentStrokeColor), this.setUniform("u_rotation", c), this.setUniform("u_center", [h, l]), this.setUniform("u_aspectRatio", d), i.renderStroke(this.currentStrokeWeight), this.currentShader = null;
785
785
  }
786
786
  /**
787
787
  * Calculate rotation parameters for built-in shaders (NDC coordinates)
788
788
  */
789
789
  calculateRotationParams(A, e, t, r) {
790
- const i = this.gl.getParameter(this.gl.VIEWPORT), s = i[2], n = i[3], g = s / n, B = this.gl.getParameter(this.gl.FRAMEBUFFER_BINDING) !== null, h = A + t / 2, E = e + r / 2, l = h / s * 2 - 1;
790
+ const i = this.gl.getParameter(this.gl.VIEWPORT), s = i[2], o = i[3], g = s / o, B = this.gl.getParameter(this.gl.FRAMEBUFFER_BINDING) !== null, E = A + t / 2, h = e + r / 2, l = E / s * 2 - 1;
791
791
  let c;
792
- B ? c = E / n * 2 - 1 : c = 1 - E / n * 2;
792
+ B ? c = h / o * 2 - 1 : c = 1 - h / o * 2;
793
793
  const d = this.currentRotation * Math.PI / 180;
794
794
  return { centerX: l, centerY: c, radians: d, aspectRatio: g };
795
795
  }
@@ -797,7 +797,7 @@ class lA {
797
797
  * Create a new framebuffer
798
798
  */
799
799
  createFramebuffer(A, e, t = {}) {
800
- return new oA(this.gl, A, e, t);
800
+ return new aA(this.gl, A, e, t);
801
801
  }
802
802
  /**
803
803
  * Fill the current framebuffer with a solid color
@@ -812,11 +812,10 @@ class lA {
812
812
  this.gl.clearColor(A, e, t, r), this.gl.clear(this.gl.COLOR_BUFFER_BIT);
813
813
  }
814
814
  /**
815
- * Ensure viewport matches canvas dimensions, optionally using custom dimensions for CSS transforms
815
+ * Ensure viewport matches canvas dimensions
816
816
  */
817
- resetViewport(A, e) {
818
- const t = A || this.gl.canvas.width, r = e || this.gl.canvas.height;
819
- this.gl.viewport(0, 0, t, r);
817
+ resetViewport() {
818
+ this.gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);
820
819
  }
821
820
  /**
822
821
  * Get the WebGL context
@@ -836,19 +835,19 @@ class lA {
836
835
  */
837
836
  image(A, e, t, r, i) {
838
837
  this.shader(this.imageShader), this.setUniform("u_texture", A.texture);
839
- const { centerX: s, centerY: n, radians: g, aspectRatio: B } = this.calculateRotationParams(
838
+ const { centerX: s, centerY: o, radians: g, aspectRatio: B } = this.calculateRotationParams(
840
839
  e,
841
840
  t,
842
841
  r ?? A.width,
843
842
  i ?? A.height
844
843
  );
845
- this.setUniform("u_rotation", g), this.setUniform("u_center", [s, n]), this.setUniform("u_aspectRatio", B), this.rect(e, t, r ?? A.width, i ?? A.height);
844
+ this.setUniform("u_rotation", g), this.setUniform("u_center", [s, o]), this.setUniform("u_aspectRatio", B), this.rect(e, t, r ?? A.width, i ?? A.height);
846
845
  }
847
846
  }
848
847
  var Q = {};
849
- Q.parse = function(a) {
850
- var A = function(i, s, n, g) {
851
- var B = Q.T, h = {
848
+ Q.parse = function(n) {
849
+ var A = function(i, s, o, g) {
850
+ var B = Q.T, E = {
852
851
  cmap: B.cmap,
853
852
  head: B.head,
854
853
  hhea: B.hhea,
@@ -856,119 +855,119 @@ Q.parse = function(a) {
856
855
  hmtx: B.hmtx,
857
856
  loca: B.loca,
858
857
  glyf: B.glyf
859
- }, E = { _data: i, _index: s, _offset: n };
860
- for (var l in h) {
861
- var c = Q.findTable(i, l, n);
858
+ }, h = { _data: i, _index: s, _offset: o };
859
+ for (var l in E) {
860
+ var c = Q.findTable(i, l, o);
862
861
  if (c) {
863
862
  var d = c[0], u = g[d];
864
- u == null && (u = h[l].parseTab(i, d, c[1], E)), E[l] = g[d] = u;
863
+ u == null && (u = E[l].parseTab(i, d, c[1], h)), h[l] = g[d] = u;
865
864
  }
866
865
  }
867
- return E;
868
- }, e = new Uint8Array(a), t = {}, r = A(e, 0, 0, t);
866
+ return h;
867
+ }, e = new Uint8Array(n), t = {}, r = A(e, 0, 0, t);
869
868
  return [r];
870
869
  };
871
- Q.findTable = function(a, A, e) {
872
- for (var t = Q.B, r = t.readUshort(a, e + 4), i = e + 12, s = 0; s < r; s++) {
873
- var n = t.readASCII(a, i, 4);
874
- t.readUint(a, i + 4);
875
- var g = t.readUint(a, i + 8), B = t.readUint(a, i + 12);
876
- if (n == A) return [g, B];
870
+ Q.findTable = function(n, A, e) {
871
+ for (var t = Q.B, r = t.readUshort(n, e + 4), i = e + 12, s = 0; s < r; s++) {
872
+ var o = t.readASCII(n, i, 4);
873
+ t.readUint(n, i + 4);
874
+ var g = t.readUint(n, i + 8), B = t.readUint(n, i + 12);
875
+ if (o == A) return [g, B];
877
876
  i += 16;
878
877
  }
879
878
  return null;
880
879
  };
881
880
  Q.T = {};
882
881
  Q.B = {
883
- readShort: function(a, A) {
882
+ readShort: function(n, A) {
884
883
  var e = Q.B.t.uint16;
885
- return e[0] = a[A] << 8 | a[A + 1], Q.B.t.int16[0];
884
+ return e[0] = n[A] << 8 | n[A + 1], Q.B.t.int16[0];
886
885
  },
887
- readUshort: function(a, A) {
888
- return a[A] << 8 | a[A + 1];
886
+ readUshort: function(n, A) {
887
+ return n[A] << 8 | n[A + 1];
889
888
  },
890
- readUshorts: function(a, A, e) {
889
+ readUshorts: function(n, A, e) {
891
890
  for (var t = [], r = 0; r < e; r++)
892
- t.push(Q.B.readUshort(a, A + r * 2));
891
+ t.push(Q.B.readUshort(n, A + r * 2));
893
892
  return t;
894
893
  },
895
- readUint: function(a, A) {
894
+ readUint: function(n, A) {
896
895
  var e = Q.B.t.uint8;
897
- return e[3] = a[A], e[2] = a[A + 1], e[1] = a[A + 2], e[0] = a[A + 3], Q.B.t.uint32[0];
896
+ return e[3] = n[A], e[2] = n[A + 1], e[1] = n[A + 2], e[0] = n[A + 3], Q.B.t.uint32[0];
898
897
  },
899
- readASCII: function(a, A, e) {
900
- for (var t = "", r = 0; r < e; r++) t += String.fromCharCode(a[A + r]);
898
+ readASCII: function(n, A, e) {
899
+ for (var t = "", r = 0; r < e; r++) t += String.fromCharCode(n[A + r]);
901
900
  return t;
902
901
  },
903
902
  // Simplified typed array buffer - only what's needed
904
903
  t: function() {
905
- var a = new ArrayBuffer(8);
904
+ var n = new ArrayBuffer(8);
906
905
  return {
907
- uint8: new Uint8Array(a),
908
- int16: new Int16Array(a),
909
- uint16: new Uint16Array(a),
910
- uint32: new Uint32Array(a)
906
+ uint8: new Uint8Array(n),
907
+ int16: new Int16Array(n),
908
+ uint16: new Uint16Array(n),
909
+ uint32: new Uint32Array(n)
911
910
  };
912
911
  }()
913
912
  };
914
913
  Q.T.cmap = {
915
- parseTab: function(a, A, e) {
914
+ parseTab: function(n, A, e) {
916
915
  var t = { tables: [], ids: {}, off: A };
917
- a = new Uint8Array(a.buffer, A, e), A = 0;
916
+ n = new Uint8Array(n.buffer, A, e), A = 0;
918
917
  var r = Q.B, i = r.readUshort, s = Q.T.cmap;
919
- i(a, A), A += 2;
920
- var n = i(a, A);
918
+ i(n, A), A += 2;
919
+ var o = i(n, A);
921
920
  A += 2;
922
- for (var g = [], B = 0; B < n; B++) {
923
- var h = i(a, A);
921
+ for (var g = [], B = 0; B < o; B++) {
922
+ var E = i(n, A);
924
923
  A += 2;
925
- var E = i(a, A);
924
+ var h = i(n, A);
926
925
  A += 2;
927
- var l = r.readUint(a, A);
926
+ var l = r.readUint(n, A);
928
927
  A += 4;
929
- var c = "p" + h + "e" + E, d = g.indexOf(l);
928
+ var c = "p" + E + "e" + h, d = g.indexOf(l);
930
929
  if (d == -1) {
931
930
  d = t.tables.length;
932
931
  var u = {};
933
932
  g.push(l);
934
- var m = u.format = i(a, l);
935
- m == 4 ? u = s.parse4(a, l, u) : m == 12 && (u = s.parse12(a, l, u)), t.tables.push(u);
933
+ var m = u.format = i(n, l);
934
+ m == 4 ? u = s.parse4(n, l, u) : m == 12 && (u = s.parse12(n, l, u)), t.tables.push(u);
936
935
  }
937
936
  t.ids[c] != null && console.log("multiple tables for one platform+encoding: " + c), t.ids[c] = d;
938
937
  }
939
938
  return t;
940
939
  },
941
- parse4: function(a, A, e) {
940
+ parse4: function(n, A, e) {
942
941
  var t = Q.B, r = t.readUshort, i = t.readUshorts, s = A;
943
942
  A += 2;
944
- var n = r(a, A);
945
- A += 2, r(a, A), A += 2;
946
- var g = r(a, A);
943
+ var o = r(n, A);
944
+ A += 2, r(n, A), A += 2;
945
+ var g = r(n, A);
947
946
  A += 2;
948
947
  var B = g >>> 1;
949
- e.searchRange = r(a, A), A += 2, e.entrySelector = r(a, A), A += 2, e.rangeShift = r(a, A), A += 2, e.endCount = i(a, A, B), A += B * 2, A += 2, e.startCount = i(a, A, B), A += B * 2, e.idDelta = [];
950
- for (var h = 0; h < B; h++)
951
- e.idDelta.push(t.readShort(a, A)), A += 2;
952
- return e.idRangeOffset = i(a, A, B), A += B * 2, e.glyphIdArray = i(a, A, s + n - A >> 1), e;
948
+ e.searchRange = r(n, A), A += 2, e.entrySelector = r(n, A), A += 2, e.rangeShift = r(n, A), A += 2, e.endCount = i(n, A, B), A += B * 2, A += 2, e.startCount = i(n, A, B), A += B * 2, e.idDelta = [];
949
+ for (var E = 0; E < B; E++)
950
+ e.idDelta.push(t.readShort(n, A)), A += 2;
951
+ return e.idRangeOffset = i(n, A, B), A += B * 2, e.glyphIdArray = i(n, A, s + o - A >> 1), e;
953
952
  },
954
- parse12: function(a, A, e) {
953
+ parse12: function(n, A, e) {
955
954
  var t = Q.B, r = t.readUint;
956
- A += 4, r(a, A), A += 4, r(a, A), A += 4;
957
- var i = r(a, A) * 3;
955
+ A += 4, r(n, A), A += 4, r(n, A), A += 4;
956
+ var i = r(n, A) * 3;
958
957
  A += 4;
959
- for (var s = e.groups = new Uint32Array(i), n = 0; n < i; n += 3)
960
- s[n] = r(a, A + (n << 2)), s[n + 1] = r(a, A + (n << 2) + 4), s[n + 2] = r(a, A + (n << 2) + 8);
958
+ for (var s = e.groups = new Uint32Array(i), o = 0; o < i; o += 3)
959
+ s[o] = r(n, A + (o << 2)), s[o + 1] = r(n, A + (o << 2) + 4), s[o + 2] = r(n, A + (o << 2) + 8);
961
960
  return e;
962
961
  }
963
962
  };
964
963
  Q.T.head = {
965
- parseTab: function(a, A, e) {
964
+ parseTab: function(n, A, e) {
966
965
  var t = Q.B, r = {};
967
- return A += 18, r.unitsPerEm = t.readUshort(a, A), A += 2, A += 16, r.xMin = t.readShort(a, A), A += 2, r.yMin = t.readShort(a, A), A += 2, r.xMax = t.readShort(a, A), A += 2, r.yMax = t.readShort(a, A), A += 2, A += 6, r.indexToLocFormat = t.readShort(a, A), r;
966
+ return A += 18, r.unitsPerEm = t.readUshort(n, A), A += 2, A += 16, r.xMin = t.readShort(n, A), A += 2, r.yMin = t.readShort(n, A), A += 2, r.xMax = t.readShort(n, A), A += 2, r.yMax = t.readShort(n, A), A += 2, A += 6, r.indexToLocFormat = t.readShort(n, A), r;
968
967
  }
969
968
  };
970
969
  Q.T.hhea = {
971
- parseTab: function(a, A, e) {
970
+ parseTab: function(n, A, e) {
972
971
  var t = Q.B, r = {};
973
972
  A += 4;
974
973
  for (var i = [
@@ -989,75 +988,75 @@ Q.T.hhea = {
989
988
  "metricDataFormat",
990
989
  "numberOfHMetrics"
991
990
  ], s = 0; s < i.length; s++) {
992
- var n = i[s], g = n == "advanceWidthMax" || n == "numberOfHMetrics" ? t.readUshort : t.readShort;
993
- r[n] = g(a, A + s * 2);
991
+ var o = i[s], g = o == "advanceWidthMax" || o == "numberOfHMetrics" ? t.readUshort : t.readShort;
992
+ r[o] = g(n, A + s * 2);
994
993
  }
995
994
  return r;
996
995
  }
997
996
  };
998
997
  Q.T.hmtx = {
999
- parseTab: function(a, A, e, t) {
1000
- for (var r = Q.B, i = [], s = [], n = t.maxp.numGlyphs, g = t.hhea.numberOfHMetrics, B = 0, h = 0, E = 0; E < g; )
1001
- B = r.readUshort(a, A + (E << 2)), h = r.readShort(a, A + (E << 2) + 2), i.push(B), s.push(h), E++;
1002
- for (; E < n; )
1003
- i.push(B), s.push(h), E++;
998
+ parseTab: function(n, A, e, t) {
999
+ for (var r = Q.B, i = [], s = [], o = t.maxp.numGlyphs, g = t.hhea.numberOfHMetrics, B = 0, E = 0, h = 0; h < g; )
1000
+ B = r.readUshort(n, A + (h << 2)), E = r.readShort(n, A + (h << 2) + 2), i.push(B), s.push(E), h++;
1001
+ for (; h < o; )
1002
+ i.push(B), s.push(E), h++;
1004
1003
  return { aWidth: i, lsBearing: s };
1005
1004
  }
1006
1005
  };
1007
1006
  Q.T.maxp = {
1008
- parseTab: function(a, A, e) {
1007
+ parseTab: function(n, A, e) {
1009
1008
  var t = Q.B, r = t.readUshort, i = {};
1010
- return t.readUint(a, A), A += 4, i.numGlyphs = r(a, A), A += 2, i;
1009
+ return t.readUint(n, A), A += 4, i.numGlyphs = r(n, A), A += 2, i;
1011
1010
  }
1012
1011
  };
1013
1012
  Q.T.loca = {
1014
- parseTab: function(a, A, e, t) {
1015
- var r = Q.B, i = [], s = t.head.indexToLocFormat, n = t.maxp.numGlyphs + 1;
1016
- if (s == 0) for (var g = 0; g < n; g++) i.push(r.readUshort(a, A + (g << 1)) << 1);
1017
- if (s == 1) for (var g = 0; g < n; g++) i.push(r.readUint(a, A + (g << 2)));
1013
+ parseTab: function(n, A, e, t) {
1014
+ var r = Q.B, i = [], s = t.head.indexToLocFormat, o = t.maxp.numGlyphs + 1;
1015
+ if (s == 0) for (var g = 0; g < o; g++) i.push(r.readUshort(n, A + (g << 1)) << 1);
1016
+ if (s == 1) for (var g = 0; g < o; g++) i.push(r.readUint(n, A + (g << 2)));
1018
1017
  return i;
1019
1018
  }
1020
1019
  };
1021
1020
  Q.T.glyf = {
1022
- parseTab: function(a, A, e, t) {
1021
+ parseTab: function(n, A, e, t) {
1023
1022
  for (var r = [], i = t.maxp.numGlyphs, s = 0; s < i; s++) r.push(null);
1024
1023
  return r;
1025
1024
  },
1026
- _parseGlyf: function(a, A) {
1027
- var e = Q.B, t = a._data, r = a.loca;
1025
+ _parseGlyf: function(n, A) {
1026
+ var e = Q.B, t = n._data, r = n.loca;
1028
1027
  if (r[A] == r[A + 1]) return null;
1029
- var i = Q.findTable(t, "glyf", a._offset)[0] + r[A], s = {};
1028
+ var i = Q.findTable(t, "glyf", n._offset)[0] + r[A], s = {};
1030
1029
  if (s.noc = e.readShort(t, i), i += 2, s.xMin = e.readShort(t, i), i += 2, s.yMin = e.readShort(t, i), i += 2, s.xMax = e.readShort(t, i), i += 2, s.yMax = e.readShort(t, i), i += 2, s.xMin >= s.xMax || s.yMin >= s.yMax) return null;
1031
1030
  if (s.noc > 0) {
1032
1031
  s.endPts = [];
1033
- for (var n = 0; n < s.noc; n++)
1032
+ for (var o = 0; o < s.noc; o++)
1034
1033
  s.endPts.push(e.readUshort(t, i)), i += 2;
1035
1034
  var g = e.readUshort(t, i);
1036
1035
  if (i += 2, t.length - i < g) return null;
1037
1036
  i += g;
1038
1037
  var B = s.endPts[s.noc - 1] + 1;
1039
1038
  s.flags = [];
1040
- for (var n = 0; n < B; n++) {
1041
- var h = t[i];
1042
- if (i++, s.flags.push(h), h & 8) {
1043
- var E = t[i];
1039
+ for (var o = 0; o < B; o++) {
1040
+ var E = t[i];
1041
+ if (i++, s.flags.push(E), E & 8) {
1042
+ var h = t[i];
1044
1043
  i++;
1045
- for (var l = 0; l < E; l++)
1046
- s.flags.push(h), n++;
1044
+ for (var l = 0; l < h; l++)
1045
+ s.flags.push(E), o++;
1047
1046
  }
1048
1047
  }
1049
1048
  s.xs = [];
1050
- for (var n = 0; n < B; n++) {
1051
- var c = (s.flags[n] & 2) != 0, d = (s.flags[n] & 16) != 0;
1049
+ for (var o = 0; o < B; o++) {
1050
+ var c = (s.flags[o] & 2) != 0, d = (s.flags[o] & 16) != 0;
1052
1051
  c ? (s.xs.push(d ? t[i] : -t[i]), i++) : d ? s.xs.push(0) : (s.xs.push(e.readShort(t, i)), i += 2);
1053
1052
  }
1054
1053
  s.ys = [];
1055
- for (var n = 0; n < B; n++) {
1056
- var c = (s.flags[n] & 4) != 0, d = (s.flags[n] & 32) != 0;
1054
+ for (var o = 0; o < B; o++) {
1055
+ var c = (s.flags[o] & 4) != 0, d = (s.flags[o] & 32) != 0;
1057
1056
  c ? (s.ys.push(d ? t[i] : -t[i]), i++) : d ? s.ys.push(0) : (s.ys.push(e.readShort(t, i)), i += 2);
1058
1057
  }
1059
- for (var u = 0, m = 0, n = 0; n < B; n++)
1060
- u += s.xs[n], m += s.ys[n], s.xs[n] = u, s.ys[n] = m;
1058
+ for (var u = 0, m = 0, o = 0; o < B; o++)
1059
+ u += s.xs[o], m += s.ys[o], s.xs[o] = u, s.ys[o] = m;
1061
1060
  } else
1062
1061
  s.parts = [];
1063
1062
  return s;
@@ -1117,9 +1116,9 @@ class cA {
1117
1116
  return e;
1118
1117
  for (let t = 0; t < A.groups.length; t += 3) {
1119
1118
  const r = A.groups[t], i = A.groups[t + 1], s = A.groups[t + 2];
1120
- for (let n = r; n <= i; n++)
1121
- if (s + (n - r) > 0) {
1122
- const B = String.fromCodePoint(n);
1119
+ for (let o = r; o <= i; o++)
1120
+ if (s + (o - r) > 0) {
1121
+ const B = String.fromCodePoint(o);
1123
1122
  e.push(B);
1124
1123
  }
1125
1124
  }
@@ -1169,9 +1168,9 @@ class uA {
1169
1168
  * @param renderer The WebGL renderer instance
1170
1169
  */
1171
1170
  constructor(A) {
1172
- o(this, "_textureCanvas");
1173
- o(this, "_textureContext");
1174
- o(this, "_renderer");
1171
+ a(this, "_textureCanvas");
1172
+ a(this, "_textureContext");
1173
+ a(this, "_renderer");
1175
1174
  this._renderer = A, this._textureCanvas = document.createElement("canvas"), this._textureContext = this._textureCanvas.getContext("2d", { willReadFrequently: !0, alpha: !1 });
1176
1175
  }
1177
1176
  /**
@@ -1183,13 +1182,13 @@ class uA {
1183
1182
  * @returns Object containing framebuffer, columns, and rows
1184
1183
  */
1185
1184
  createTextureAtlas(A, e, t, r) {
1186
- const i = A.length, s = Math.ceil(Math.sqrt(i)), n = Math.ceil(i / s), g = e.width * s, B = e.height * n;
1185
+ const i = A.length, s = Math.ceil(Math.sqrt(i)), o = Math.ceil(i / s), g = e.width * s, B = e.height * o;
1187
1186
  this._setupCanvas(g, B, t, r), this._renderCharactersToCanvas(A, e, s, t), this._applyBlackWhiteThreshold();
1188
- const h = this._renderer.createFramebuffer(g, B, { filter: "nearest" });
1189
- return h.update(this._textureCanvas), {
1190
- framebuffer: h,
1187
+ const E = this._renderer.createFramebuffer(g, B, { filter: "nearest" });
1188
+ return E.update(this._textureCanvas), {
1189
+ framebuffer: E,
1191
1190
  columns: s,
1192
- rows: n
1191
+ rows: o
1193
1192
  };
1194
1193
  }
1195
1194
  /**
@@ -1213,8 +1212,8 @@ class uA {
1213
1212
  */
1214
1213
  _renderCharactersToCanvas(A, e, t, r) {
1215
1214
  for (let i = 0; i < A.length; i++) {
1216
- const s = i % t, n = Math.floor(i / t), g = s * e.width + e.width * 0.5, B = n * e.height + e.height * 0.5, h = Math.round(g - e.width * 0.5), E = Math.round(B - r * 0.5);
1217
- this._textureContext.fillText(A[i].character, h, E);
1215
+ const s = i % t, o = Math.floor(i / t), g = s * e.width + e.width * 0.5, B = o * e.height + e.height * 0.5, E = Math.round(g - e.width * 0.5), h = Math.round(B - r * 0.5);
1216
+ this._textureContext.fillText(A[i].character, E, h);
1218
1217
  }
1219
1218
  }
1220
1219
  /**
@@ -1226,8 +1225,8 @@ class uA {
1226
1225
  _applyBlackWhiteThreshold(A = 128) {
1227
1226
  const e = this._textureContext.getImageData(0, 0, this._textureCanvas.width, this._textureCanvas.height), t = e.data;
1228
1227
  for (let r = 0; r < t.length; r += 4) {
1229
- const i = 0.299 * t[r] + 0.587 * t[r + 1] + 0.114 * t[r + 2], s = A + 32, n = i > s ? 255 : 0;
1230
- t[r] = n, t[r + 1] = n, t[r + 2] = n;
1228
+ const i = 0.299 * t[r] + 0.587 * t[r + 1] + 0.114 * t[r + 2], s = A + 32, o = i > s ? 255 : 0;
1229
+ t[r] = o, t[r + 1] = o, t[r + 2] = o;
1231
1230
  }
1232
1231
  this._textureContext.putImageData(e, 0, 0);
1233
1232
  }
@@ -1237,8 +1236,8 @@ class dA {
1237
1236
  * Creates a new MetricsCalculation instance.
1238
1237
  */
1239
1238
  constructor() {
1240
- o(this, "_tempCanvas");
1241
- o(this, "_tempContext");
1239
+ a(this, "_tempCanvas");
1240
+ a(this, "_tempContext");
1242
1241
  this._tempCanvas = document.createElement("canvas"), this._tempContext = this._tempCanvas.getContext("2d");
1243
1242
  }
1244
1243
  /**
@@ -1253,7 +1252,7 @@ class dA {
1253
1252
  this._tempContext.font = `${e}px ${t}`;
1254
1253
  let r = 0, i = 0;
1255
1254
  for (const s of A) {
1256
- const n = this._tempContext.measureText(s), g = n.width, B = n.actualBoundingBoxAscent + n.actualBoundingBoxDescent;
1255
+ const o = this._tempContext.measureText(s), g = o.width, B = o.actualBoundingBoxAscent + o.actualBoundingBoxDescent;
1257
1256
  g > 0 && (r = Math.max(r, g), i = Math.max(i, B));
1258
1257
  }
1259
1258
  return {
@@ -1272,16 +1271,16 @@ class fA {
1272
1271
  createCharacterObjects(A, e) {
1273
1272
  return A.map((t, r) => {
1274
1273
  const i = t.codePointAt(0) || 0, s = this._generateCharacterColor(r);
1275
- let n = 0;
1274
+ let o = 0;
1276
1275
  if (e.hmtx && e.hmtx.aWidth) {
1277
1276
  const g = this._getGlyphIndex(e, i);
1278
- g > 0 && e.hmtx.aWidth[g] !== void 0 && (n = e.hmtx.aWidth[g]);
1277
+ g > 0 && e.hmtx.aWidth[g] !== void 0 && (o = e.hmtx.aWidth[g]);
1279
1278
  }
1280
1279
  return {
1281
1280
  character: t,
1282
1281
  unicode: i,
1283
1282
  color: s,
1284
- advanceWidth: n
1283
+ advanceWidth: o
1285
1284
  };
1286
1285
  });
1287
1286
  }
@@ -1304,9 +1303,9 @@ class fA {
1304
1303
  {
1305
1304
  const s = r.idRangeOffset[i] / 2 + (e - r.startCount[i]) - (r.startCount.length - i);
1306
1305
  if (s >= 0 && s < r.glyphIdArray.length) {
1307
- const n = r.glyphIdArray[s];
1308
- if (n !== 0)
1309
- return n + r.idDelta[i] & 65535;
1306
+ const o = r.glyphIdArray[s];
1307
+ if (o !== 0)
1308
+ return o + r.idDelta[i] & 65535;
1310
1309
  }
1311
1310
  }
1312
1311
  }
@@ -1360,20 +1359,20 @@ class CA {
1360
1359
  * @ignore
1361
1360
  */
1362
1361
  constructor(A, e = 16) {
1363
- o(this, "_font");
1364
- o(this, "_characters", []);
1365
- o(this, "_fontFramebuffer");
1366
- o(this, "_fontSize", 16);
1367
- o(this, "_textureColumns", 0);
1368
- o(this, "_textureRows", 0);
1369
- o(this, "_maxGlyphDimensions", { width: 0, height: 0 });
1370
- o(this, "_fontFace");
1371
- o(this, "_fontFamilyName", "UrsaFont");
1362
+ a(this, "_font");
1363
+ a(this, "_characters", []);
1364
+ a(this, "_fontFramebuffer");
1365
+ a(this, "_fontSize", 16);
1366
+ a(this, "_textureColumns", 0);
1367
+ a(this, "_textureRows", 0);
1368
+ a(this, "_maxGlyphDimensions", { width: 0, height: 0 });
1369
+ a(this, "_fontFace");
1370
+ a(this, "_fontFamilyName", "UrsaFont");
1372
1371
  // Component classes
1373
- o(this, "_characterExtractor");
1374
- o(this, "_textureAtlas");
1375
- o(this, "_metricsCalculator");
1376
- o(this, "_characterColorMapper");
1372
+ a(this, "_characterExtractor");
1373
+ a(this, "_textureAtlas");
1374
+ a(this, "_metricsCalculator");
1375
+ a(this, "_characterColorMapper");
1377
1376
  this._fontSize = e, this._characterExtractor = new cA(), this._textureAtlas = new uA(A), this._metricsCalculator = new dA(), this._characterColorMapper = new fA();
1378
1377
  }
1379
1378
  /**
@@ -1538,25 +1537,25 @@ class mA {
1538
1537
  */
1539
1538
  constructor(A, e, t) {
1540
1539
  /** The number of columns in the grid. */
1541
- o(this, "_cols");
1540
+ a(this, "_cols");
1542
1541
  /** The number of rows in the grid. */
1543
- o(this, "_rows");
1542
+ a(this, "_rows");
1544
1543
  /** The total width of the grid in pixels. */
1545
- o(this, "_width");
1544
+ a(this, "_width");
1546
1545
  /** The total height of the grid in pixels. */
1547
- o(this, "_height");
1546
+ a(this, "_height");
1548
1547
  /** The offset to the outer canvas on the x-axis when centering the grid. */
1549
- o(this, "_offsetX");
1548
+ a(this, "_offsetX");
1550
1549
  /** The offset to the outer canvas on the y-axis when centering the grid. */
1551
- o(this, "_offsetY");
1550
+ a(this, "_offsetY");
1552
1551
  /** Whether the grid dimensions are fixed, or responsive based on the canvas dimensions. */
1553
- o(this, "_fixedDimensions", !1);
1552
+ a(this, "_fixedDimensions", !1);
1554
1553
  /** The canvas element used to determine the grid dimensions. */
1555
- o(this, "_canvas");
1554
+ a(this, "_canvas");
1556
1555
  /** The width of each cell in the grid. */
1557
- o(this, "_cellWidth");
1556
+ a(this, "_cellWidth");
1558
1557
  /** The height of each cell in the grid. */
1559
- o(this, "_cellHeight");
1558
+ a(this, "_cellHeight");
1560
1559
  this._canvas = A, this._cellWidth = e, this._cellHeight = t, this.reset();
1561
1560
  }
1562
1561
  /**
@@ -1565,9 +1564,8 @@ class mA {
1565
1564
  */
1566
1565
  reset() {
1567
1566
  if (!this._fixedDimensions) {
1568
- const A = this._canvas.getBoundingClientRect();
1569
- let e = Math.round(A.width), t = Math.round(A.height);
1570
- [this._cols, this._rows] = [Math.floor(e / this._cellWidth), Math.floor(t / this._cellHeight)];
1567
+ const A = this._canvas.width, e = this._canvas.height;
1568
+ [this._cols, this._rows] = [Math.floor(A / this._cellWidth), Math.floor(e / this._cellHeight)];
1571
1569
  }
1572
1570
  this._resizeGrid();
1573
1571
  }
@@ -1575,9 +1573,8 @@ class mA {
1575
1573
  * Reset the total grid width & height, and the offset to the outer canvas.
1576
1574
  */
1577
1575
  _resizeGrid() {
1578
- const A = this._canvas.getBoundingClientRect();
1579
- let e = Math.round(A.width), t = Math.round(A.height);
1580
- this._width = this._cols * this._cellWidth, this._height = this._rows * this._cellHeight, this._offsetX = Math.floor((e - this._width) / 2), this._offsetY = Math.floor((t - this._height) / 2);
1576
+ const A = this._canvas.width, e = this._canvas.height;
1577
+ this._width = this._cols * this._cellWidth, this._height = this._rows * this._cellHeight, this._offsetX = Math.floor((A - this._width) / 2), this._offsetY = Math.floor((e - this._height) / 2);
1581
1578
  }
1582
1579
  /**
1583
1580
  * Re-assign the grid cell dimensions and `reset()` the grid.
@@ -1667,11 +1664,11 @@ class mA {
1667
1664
  }
1668
1665
  class DA {
1669
1666
  constructor(A, e = !1, t = {}) {
1670
- o(this, "_canvas");
1671
- o(this, "captureSource");
1672
- o(this, "_isStandalone");
1673
- o(this, "resizeObserver");
1674
- o(this, "onTransformChange");
1667
+ a(this, "_canvas");
1668
+ a(this, "captureSource");
1669
+ a(this, "_isStandalone");
1670
+ a(this, "resizeObserver");
1671
+ a(this, "onTransformChange");
1675
1672
  this.captureSource = A, this._isStandalone = e, this._canvas = this.createCanvas(t.width, t.height), e && this.setupTransformObserver();
1676
1673
  }
1677
1674
  createCanvas(A, e) {
@@ -1681,12 +1678,12 @@ class DA {
1681
1678
  t.width = A || 800, t.height = e || 600, document.body.appendChild(t);
1682
1679
  else {
1683
1680
  const i = this.captureSource.getBoundingClientRect();
1684
- let s = Math.round(i.width), n = Math.round(i.height);
1681
+ let s = Math.round(i.width), o = Math.round(i.height);
1685
1682
  if (this.captureSource instanceof HTMLVideoElement) {
1686
- const h = this.captureSource;
1687
- (s === 0 || n === 0) && h.videoWidth > 0 && h.videoHeight > 0 && (s = h.videoWidth, n = h.videoHeight);
1683
+ const E = this.captureSource;
1684
+ (s === 0 || o === 0) && E.videoWidth > 0 && E.videoHeight > 0 && (s = E.videoWidth, o = E.videoHeight);
1688
1685
  }
1689
- t.width = s, t.height = n, t.style.position = "absolute", t.style.pointerEvents = "none";
1686
+ t.width = s, t.height = o, t.style.position = "absolute", t.style.pointerEvents = "none";
1690
1687
  const g = window.getComputedStyle(this.captureSource);
1691
1688
  let B = parseInt(g.zIndex || "0", 10);
1692
1689
  isNaN(B) && (B = 0), t.style.zIndex = (B + 1).toString(), this.positionOverlayCanvas(t), (r = this.captureSource.parentNode) == null || r.insertBefore(t, this.captureSource.nextSibling);
@@ -1736,15 +1733,7 @@ class DA {
1736
1733
  * Get the effective rendering dimensions accounting for CSS transforms
1737
1734
  */
1738
1735
  getEffectiveRenderingDimensions() {
1739
- if (!this._canvas)
1740
- return { width: 0, height: 0 };
1741
- const A = this._canvas.getBoundingClientRect(), e = Math.round(A.width), t = Math.round(A.height);
1742
- if (this._isStandalone) {
1743
- const r = this._canvas.width, i = this._canvas.height;
1744
- if (e !== r || t !== i)
1745
- return { width: e, height: t };
1746
- }
1747
- return { width: this._canvas.width, height: this._canvas.height };
1736
+ return this._canvas ? { width: this._canvas.width, height: this._canvas.height } : { width: 0, height: 0 };
1748
1737
  }
1749
1738
  /**
1750
1739
  * Check if the canvas is affected by CSS transforms
@@ -1800,15 +1789,15 @@ class x {
1800
1789
  * @ignore
1801
1790
  */
1802
1791
  constructor(A, e, t, r = {}) {
1803
- o(this, "renderer");
1804
- o(this, "fontManager");
1805
- o(this, "grid");
1806
- o(this, "_characterFramebuffer");
1807
- o(this, "_primaryColorFramebuffer");
1808
- o(this, "_secondaryColorFramebuffer");
1809
- o(this, "_rotationFramebuffer");
1810
- o(this, "_transformFramebuffer");
1811
- o(this, "_options");
1792
+ a(this, "renderer");
1793
+ a(this, "fontManager");
1794
+ a(this, "grid");
1795
+ a(this, "_characterFramebuffer");
1796
+ a(this, "_primaryColorFramebuffer");
1797
+ a(this, "_secondaryColorFramebuffer");
1798
+ a(this, "_rotationFramebuffer");
1799
+ a(this, "_transformFramebuffer");
1800
+ a(this, "_options");
1812
1801
  this.renderer = A, this.fontManager = e, this.grid = t, this._options = r, this._characterFramebuffer = this.renderer.createFramebuffer(this.grid.cols, this.grid.rows), this._primaryColorFramebuffer = this.renderer.createFramebuffer(this.grid.cols, this.grid.rows), this._secondaryColorFramebuffer = this.renderer.createFramebuffer(this.grid.cols, this.grid.rows), this._rotationFramebuffer = this.renderer.createFramebuffer(this.grid.cols, this.grid.rows), this._transformFramebuffer = this.renderer.createFramebuffer(this.grid.cols, this.grid.rows);
1813
1802
  }
1814
1803
  /**
@@ -1877,9 +1866,9 @@ class pA {
1877
1866
  */
1878
1867
  constructor(A, e) {
1879
1868
  /** The framebuffer used to store the color palette. */
1880
- o(this, "_framebuffer");
1881
- o(this, "_renderer");
1882
- o(this, "_colors");
1869
+ a(this, "_framebuffer");
1870
+ a(this, "_renderer");
1871
+ a(this, "_colors");
1883
1872
  this._renderer = A, this._colors = e;
1884
1873
  const t = Math.max(this._colors.length, 1);
1885
1874
  this._framebuffer = this._renderer.createFramebuffer(t, 1), this._updateFramebuffer();
@@ -1927,7 +1916,7 @@ class pA {
1927
1916
  class z extends x {
1928
1917
  constructor(e, t, r, i = {}) {
1929
1918
  super(e, t, r, i);
1930
- o(this, "palette");
1919
+ a(this, "palette");
1931
1920
  this.palette = new pA(this.renderer, this.fontManager.getCharacterColors(" .:-=+*%@#"));
1932
1921
  }
1933
1922
  /**
@@ -1950,10 +1939,10 @@ class z extends x {
1950
1939
  * @param a Alpha component (0-255).
1951
1940
  */
1952
1941
  characterColor(e, t, r, i = 255) {
1953
- let s, n, g, B;
1942
+ let s, o, g, B;
1954
1943
  if (typeof e == "string") {
1955
- const h = this.parseHexColor(e);
1956
- if (!h) {
1944
+ const E = this.parseHexColor(e);
1945
+ if (!E) {
1957
1946
  f.validate(
1958
1947
  !1,
1959
1948
  "Invalid hex color format. Use '#FF0000', '#F00', 'FF0000', or 'F00'.",
@@ -1961,14 +1950,14 @@ class z extends x {
1961
1950
  );
1962
1951
  return;
1963
1952
  }
1964
- [s, n, g, B] = h;
1965
- } else if (s = e, n = t !== void 0 ? t : e, g = r !== void 0 ? r : e, B = i, !f.validate(
1966
- [s, n, g, B].every((h) => h >= 0 && h <= 255),
1953
+ [s, o, g, B] = E;
1954
+ } else if (s = e, o = t !== void 0 ? t : e, g = r !== void 0 ? r : e, B = i, !f.validate(
1955
+ [s, o, g, B].every((E) => E >= 0 && E <= 255),
1967
1956
  "Character color values must be between 0 and 255",
1968
- { method: "characterColor", providedValues: { r: s, g: n, b: g, a: B } }
1957
+ { method: "characterColor", providedValues: { r: s, g: o, b: g, a: B } }
1969
1958
  ))
1970
1959
  return;
1971
- this._options.characterColor = [s / 255, n / 255, g / 255, B / 255];
1960
+ this._options.characterColor = [s / 255, o / 255, g / 255, B / 255];
1972
1961
  }
1973
1962
  /**
1974
1963
  * Sets the character color mode.
@@ -1992,10 +1981,10 @@ class z extends x {
1992
1981
  * @param a Alpha component (0-255).
1993
1982
  */
1994
1983
  cellColor(e, t, r, i = 255) {
1995
- let s, n, g, B;
1984
+ let s, o, g, B;
1996
1985
  if (typeof e == "string") {
1997
- const h = this.parseHexColor(e);
1998
- if (!h) {
1986
+ const E = this.parseHexColor(e);
1987
+ if (!E) {
1999
1988
  f.validate(
2000
1989
  !1,
2001
1990
  "Invalid hex color format. Use '#FF0000', '#F00', 'FF0000', or 'F00'.",
@@ -2003,14 +1992,14 @@ class z extends x {
2003
1992
  );
2004
1993
  return;
2005
1994
  }
2006
- [s, n, g, B] = h;
2007
- } else if (s = e, n = t !== void 0 ? t : e, g = r !== void 0 ? r : e, B = i, !f.validate(
2008
- [s, n, g, B].every((h) => h >= 0 && h <= 255),
1995
+ [s, o, g, B] = E;
1996
+ } else if (s = e, o = t !== void 0 ? t : e, g = r !== void 0 ? r : e, B = i, !f.validate(
1997
+ [s, o, g, B].every((E) => E >= 0 && E <= 255),
2009
1998
  "Cell color values must be between 0 and 255",
2010
- { method: "cellColor", providedValues: { r: s, g: n, b: g, a: B } }
1999
+ { method: "cellColor", providedValues: { r: s, g: o, b: g, a: B } }
2011
2000
  ))
2012
2001
  return;
2013
- this._options.cellColor = [s / 255, n / 255, g / 255, B / 255];
2002
+ this._options.cellColor = [s / 255, o / 255, g / 255, B / 255];
2014
2003
  }
2015
2004
  /**
2016
2005
  * Sets the cell color mode.
@@ -2086,7 +2075,7 @@ class z extends x {
2086
2075
  return [t, r, i, 255];
2087
2076
  }
2088
2077
  }
2089
- var PA = "precision lowp float;uniform sampler2D u_sketchTexture;uniform vec2 u_gridCellDimensions;uniform vec2 u_brightnessRange;varying vec2 v_uv;void main(){vec2 cellCenter=(floor(v_uv*u_gridCellDimensions)+vec2(0.5))/u_gridCellDimensions;vec4 color=texture2D(u_sketchTexture,cellCenter);float brightness=dot(color.rgb,vec3(0.299,0.587,0.114));float brightnessValue=brightness*255.0;if(brightnessValue>=u_brightnessRange.x&&brightnessValue<=u_brightnessRange.y){gl_FragColor=color;}else{gl_FragColor=vec4(0.0);}}", wA = "precision lowp float;uniform sampler2D u_sampleTexture;uniform vec4 u_fillColor;uniform bool u_useFixedColor;varying vec2 v_uv;void main(){vec4 sampleColor=texture2D(u_sampleTexture,v_uv);if(sampleColor.a>0.0){if(u_useFixedColor){gl_FragColor=u_fillColor;}else{gl_FragColor=sampleColor;}}else{gl_FragColor=vec4(0.0);}}", _A = "precision lowp float;uniform sampler2D u_sampleTexture;uniform bool u_invert;uniform bool u_flipHorizontally;uniform bool u_flipVertically;varying vec2 v_uv;void main(){vec4 sampleColor=texture2D(u_sampleTexture,v_uv);if(sampleColor.a>0.0){float invertValue=u_invert ? 1.0 : 0.0;float flipHValue=u_flipHorizontally ? 1.0 : 0.0;float flipVValue=u_flipVertically ? 1.0 : 0.0;gl_FragColor=vec4(invertValue,flipHValue,flipVValue,1.0);}else{gl_FragColor=vec4(0.0);}}", IA = "precision lowp float;uniform sampler2D u_sampleTexture;uniform vec4 u_rotationColor;varying vec2 v_uv;void main(){vec4 sampleColor=texture2D(u_sampleTexture,v_uv);if(sampleColor.a>0.0){gl_FragColor=u_rotationColor;}else{gl_FragColor=vec4(0.0);}}", vA = "precision lowp float;uniform sampler2D u_colorSampleFramebuffer;uniform sampler2D u_charPaletteTexture;uniform vec2 u_charPaletteSize;uniform vec2 u_brightnessRange;varying vec2 v_uv;void main(){vec4 color=texture2D(u_colorSampleFramebuffer,v_uv);if(color.a==0.0){gl_FragColor=vec4(0.0);return;}float brightness=dot(color.rgb,vec3(0.299,0.587,0.114))*255.0;vec2 range=u_brightnessRange;if(brightness<range.x||brightness>range.y){gl_FragColor=vec4(0.0);return;}float t=(brightness-range.x)/(range.y-range.x);float idx=clamp(floor(t*u_charPaletteSize.x),0.0,u_charPaletteSize.x-1.0);vec3 charColor=texture2D(u_charPaletteTexture,vec2((idx+0.5)/u_charPaletteSize.x,0.0)).rgb;gl_FragColor=vec4(charColor,1.0);}";
2078
+ var PA = "precision lowp float;uniform sampler2D u_sketchTexture;uniform vec2 u_gridCellDimensions;uniform vec2 u_brightnessRange;varying vec2 v_uv;void main(){vec2 cellCenter=(floor(v_uv*u_gridCellDimensions)+vec2(0.5))/u_gridCellDimensions;vec4 color=texture2D(u_sketchTexture,cellCenter);float brightness=dot(color.rgb,vec3(0.299,0.587,0.114));float brightnessValue=brightness*255.0;if(brightnessValue>=u_brightnessRange.x&&brightnessValue<=u_brightnessRange.y){gl_FragColor=color;}else{gl_FragColor=vec4(0.0);}}", wA = "precision lowp float;uniform sampler2D u_sampleTexture;uniform vec4 u_fillColor;uniform bool u_useFixedColor;varying vec2 v_uv;void main(){vec4 sampleColor=texture2D(u_sampleTexture,v_uv);if(sampleColor.a>0.0){if(u_useFixedColor){gl_FragColor=u_fillColor;}else{gl_FragColor=sampleColor;}}else{gl_FragColor=vec4(0.0);}}", IA = "precision lowp float;uniform sampler2D u_sampleTexture;uniform bool u_invert;uniform bool u_flipHorizontally;uniform bool u_flipVertically;varying vec2 v_uv;void main(){vec4 sampleColor=texture2D(u_sampleTexture,v_uv);if(sampleColor.a>0.0){float invertValue=u_invert ? 1.0 : 0.0;float flipHValue=u_flipHorizontally ? 1.0 : 0.0;float flipVValue=u_flipVertically ? 1.0 : 0.0;gl_FragColor=vec4(invertValue,flipHValue,flipVValue,1.0);}else{gl_FragColor=vec4(0.0);}}", _A = "precision lowp float;uniform sampler2D u_sampleTexture;uniform vec4 u_rotationColor;varying vec2 v_uv;void main(){vec4 sampleColor=texture2D(u_sampleTexture,v_uv);if(sampleColor.a>0.0){gl_FragColor=u_rotationColor;}else{gl_FragColor=vec4(0.0);}}", vA = "precision lowp float;uniform sampler2D u_colorSampleFramebuffer;uniform sampler2D u_charPaletteTexture;uniform vec2 u_charPaletteSize;uniform vec2 u_brightnessRange;varying vec2 v_uv;void main(){vec4 color=texture2D(u_colorSampleFramebuffer,v_uv);if(color.a==0.0){gl_FragColor=vec4(0.0);return;}float brightness=dot(color.rgb,vec3(0.299,0.587,0.114))*255.0;vec2 range=u_brightnessRange;if(brightness<range.x||brightness>range.y){gl_FragColor=vec4(0.0);return;}float t=(brightness-range.x)/(range.y-range.x);float idx=clamp(floor(t*u_charPaletteSize.x),0.0,u_charPaletteSize.x-1.0);vec3 charColor=texture2D(u_charPaletteTexture,vec2((idx+0.5)/u_charPaletteSize.x,0.0)).rgb;gl_FragColor=vec4(charColor,1.0);}";
2090
2079
  const bA = {
2091
2080
  /** Enable/disable the renderer */
2092
2081
  enabled: !0,
@@ -2113,7 +2102,7 @@ const bA = {
2113
2102
  /** Range of brightness values to map to ASCII characters */
2114
2103
  brightnessRange: [0, 255]
2115
2104
  };
2116
- class k extends z {
2105
+ class V extends z {
2117
2106
  /**
2118
2107
  * Creates a new TextmodeBrightnessConverter instance.
2119
2108
  * @param renderer Renderer instance for texture creation
@@ -2123,13 +2112,13 @@ class k extends z {
2123
2112
  */
2124
2113
  constructor(e, t, r) {
2125
2114
  super(e, t, r, { ...bA });
2126
- o(this, "sampleShader");
2127
- o(this, "colorFillShader");
2128
- o(this, "charMappingShader");
2129
- o(this, "transformFillShader");
2130
- o(this, "rotationFillShader");
2131
- o(this, "sampleFramebuffer");
2132
- this.sampleShader = new w(e.context, _, PA), this.colorFillShader = new w(e.context, _, wA), this.transformFillShader = new w(e.context, _, _A), this.rotationFillShader = new w(e.context, _, IA), this.charMappingShader = new w(e.context, _, vA), this.sampleFramebuffer = this.renderer.createFramebuffer(this.grid.cols, this.grid.rows);
2115
+ a(this, "sampleShader");
2116
+ a(this, "colorFillShader");
2117
+ a(this, "charMappingShader");
2118
+ a(this, "transformFillShader");
2119
+ a(this, "rotationFillShader");
2120
+ a(this, "sampleFramebuffer");
2121
+ this.sampleShader = new w(e.context, I, PA), this.colorFillShader = new w(e.context, I, wA), this.transformFillShader = new w(e.context, I, IA), this.rotationFillShader = new w(e.context, I, _A), this.charMappingShader = new w(e.context, I, vA), this.sampleFramebuffer = this.renderer.createFramebuffer(this.grid.cols, this.grid.rows);
2133
2122
  }
2134
2123
  convert(e) {
2135
2124
  this.sampleFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.sampleShader), this.renderer.setUniform("u_sketchTexture", e), this.renderer.setUniform("u_gridCellDimensions", [this.grid.cols, this.grid.rows]), this.renderer.setUniform("u_brightnessRange", this._options.brightnessRange), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this.sampleFramebuffer.end(), this._primaryColorFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.colorFillShader), this.renderer.setUniform("u_sampleTexture", this.sampleFramebuffer.texture), this.renderer.setUniform("u_fillColor", this._options.characterColor), this.renderer.setUniform("u_useFixedColor", this._options.characterColorMode === "fixed"), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._primaryColorFramebuffer.end(), this._secondaryColorFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.colorFillShader), this.renderer.setUniform("u_sampleTexture", this.sampleFramebuffer.texture), this.renderer.setUniform("u_fillColor", this._options.cellColor), this.renderer.setUniform("u_useFixedColor", this._options.cellColorMode === "fixed"), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._secondaryColorFramebuffer.end(), this._transformFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.transformFillShader), this.renderer.setUniform("u_sampleTexture", this.sampleFramebuffer.texture), this.renderer.setUniform("u_invert", this._options.invert), this.renderer.setUniform("u_flipHorizontally", this._options.flipHorizontally), this.renderer.setUniform("u_flipVertically", this._options.flipVertically), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._transformFramebuffer.end(), this._rotationFramebuffer.begin(), this.renderer.clear(), this.renderer.shader(this.rotationFillShader), this.renderer.setUniform("u_sampleTexture", this.sampleFramebuffer.texture), this.renderer.setUniform("u_rotationColor", this._options.rotation), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._rotationFramebuffer.end(), this._characterFramebuffer.begin(), this.renderer.clear(0, 0, 0, 0), this.renderer.shader(this.charMappingShader), this.renderer.setUniform("u_colorSampleFramebuffer", this.sampleFramebuffer.texture), this.renderer.setUniform("u_charPaletteTexture", this.palette.texture), this.renderer.setUniform("u_charPaletteSize", [this.palette.colors.length, 1]), this.renderer.setUniform("u_brightnessRange", this._options.brightnessRange), this.renderer.rect(0, 0, this.grid.cols, this.grid.rows), this._characterFramebuffer.end();
@@ -2154,7 +2143,7 @@ class k extends z {
2154
2143
  }
2155
2144
  const LA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2156
2145
  __proto__: null,
2157
- TextmodeBrightnessConverter: k,
2146
+ TextmodeBrightnessConverter: V,
2158
2147
  TextmodeConverter: x,
2159
2148
  TextmodeFeatureConverter: z
2160
2149
  }, Symbol.toStringTag, { value: "Module" }));
@@ -2168,19 +2157,19 @@ class FA {
2168
2157
  * @ignore
2169
2158
  */
2170
2159
  constructor(A, e, t) {
2171
- o(this, "renderer");
2172
- o(this, "font");
2173
- o(this, "grid");
2174
- o(this, "converters");
2175
- o(this, "_resultFramebuffer");
2176
- o(this, "_asciiShader");
2177
- o(this, "_characterFramebuffer");
2178
- o(this, "_primaryColorFramebuffer");
2179
- o(this, "_secondaryColorFramebuffer");
2180
- o(this, "_rotationFramebuffer");
2181
- o(this, "_transformFramebuffer");
2182
- this.renderer = A, this.font = e, this.grid = t, this._asciiShader = this.renderer.createShader(_, xA), this.converters = [
2183
- { name: "brightness", converter: new k(A, e, t) },
2160
+ a(this, "renderer");
2161
+ a(this, "font");
2162
+ a(this, "grid");
2163
+ a(this, "converters");
2164
+ a(this, "_resultFramebuffer");
2165
+ a(this, "_asciiShader");
2166
+ a(this, "_characterFramebuffer");
2167
+ a(this, "_primaryColorFramebuffer");
2168
+ a(this, "_secondaryColorFramebuffer");
2169
+ a(this, "_rotationFramebuffer");
2170
+ a(this, "_transformFramebuffer");
2171
+ this.renderer = A, this.font = e, this.grid = t, this._asciiShader = this.renderer.createShader(I, xA), this.converters = [
2172
+ { name: "brightness", converter: new V(A, e, t) },
2184
2173
  { name: "custom", converter: new x(A, e, t) }
2185
2174
  ], this._characterFramebuffer = this.renderer.createFramebuffer(t.cols, t.rows), this._primaryColorFramebuffer = this.renderer.createFramebuffer(t.cols, t.rows), this._secondaryColorFramebuffer = this.renderer.createFramebuffer(t.cols, t.rows), this._rotationFramebuffer = this.renderer.createFramebuffer(t.cols, t.rows), this._transformFramebuffer = this.renderer.createFramebuffer(t.cols, t.rows), this._resultFramebuffer = this.renderer.createFramebuffer(this.grid.width, this.grid.height);
2186
2175
  }
@@ -2242,7 +2231,7 @@ class FA {
2242
2231
  ))
2243
2232
  return;
2244
2233
  let t;
2245
- return e === "brightness" ? t = new k(this.renderer, this.font, this.grid) : t = new x(this.renderer, this.font, this.grid), this.converters.push({ name: A, converter: t }), t;
2234
+ return e === "brightness" ? t = new V(this.renderer, this.font, this.grid) : t = new x(this.renderer, this.font, this.grid), this.converters.push({ name: A, converter: t }), t;
2246
2235
  }
2247
2236
  /**
2248
2237
  * Removes a converter from the pipeline by name or instance.
@@ -2345,13 +2334,13 @@ class L {
2345
2334
  * @returns Object containing all pixel data arrays
2346
2335
  */
2347
2336
  extractFramebufferData(A) {
2348
- const e = A.get("brightness"), t = e == null ? void 0 : e.characterFramebuffer, r = e == null ? void 0 : e.primaryColorFramebuffer, i = e == null ? void 0 : e.secondaryColorFramebuffer, s = e == null ? void 0 : e.transformFramebuffer, n = e == null ? void 0 : e.rotationFramebuffer;
2349
- return t == null || t.loadPixels(), r == null || r.loadPixels(), i == null || i.loadPixels(), s == null || s.loadPixels(), n == null || n.loadPixels(), {
2337
+ const e = A.get("brightness"), t = e == null ? void 0 : e.characterFramebuffer, r = e == null ? void 0 : e.primaryColorFramebuffer, i = e == null ? void 0 : e.secondaryColorFramebuffer, s = e == null ? void 0 : e.transformFramebuffer, o = e == null ? void 0 : e.rotationFramebuffer;
2338
+ return t == null || t.loadPixels(), r == null || r.loadPixels(), i == null || i.loadPixels(), s == null || s.loadPixels(), o == null || o.loadPixels(), {
2350
2339
  characterPixels: (t == null ? void 0 : t.pixels) || new Uint8Array(0),
2351
2340
  primaryColorPixels: (r == null ? void 0 : r.pixels) || new Uint8Array(0),
2352
2341
  secondaryColorPixels: (i == null ? void 0 : i.pixels) || new Uint8Array(0),
2353
2342
  transformPixels: (s == null ? void 0 : s.pixels) || new Uint8Array(0),
2354
- rotationPixels: (n == null ? void 0 : n.pixels) || new Uint8Array(0)
2343
+ rotationPixels: (o == null ? void 0 : o.pixels) || new Uint8Array(0)
2355
2344
  };
2356
2345
  }
2357
2346
  /**
@@ -2446,9 +2435,9 @@ class yA extends L {
2446
2435
  * @returns Transform data object
2447
2436
  */
2448
2437
  extractTransformData(A, e, t) {
2449
- const r = A[t], i = A[t + 1], s = A[t + 2], n = r === 255, g = i === 255, B = s === 255, h = e[t], E = e[t + 1], l = h + E / 255, c = Math.round(l * 360 / 255 * 100) / 100;
2438
+ const r = A[t], i = A[t + 1], s = A[t + 2], o = r === 255, g = i === 255, B = s === 255, E = e[t], h = e[t + 1], l = E + h / 255, c = Math.round(l * 360 / 255 * 100) / 100;
2450
2439
  return {
2451
- isInverted: n,
2440
+ isInverted: o,
2452
2441
  flipHorizontal: g,
2453
2442
  flipVertical: B,
2454
2443
  rotation: c
@@ -2481,26 +2470,26 @@ class yA extends L {
2481
2470
  let r = 0;
2482
2471
  for (let i = 0; i < e.rows; i++)
2483
2472
  for (let s = 0; s < e.cols; s++) {
2484
- const n = r * 4, g = this.getCharacterIndex(
2473
+ const o = r * 4, g = this.getCharacterIndex(
2485
2474
  A.characterPixels,
2486
- n
2475
+ o
2487
2476
  );
2488
- let B = this.pixelsToRGBA(A.primaryColorPixels, n), h = this.pixelsToRGBA(A.secondaryColorPixels, n);
2489
- const E = this.extractTransformData(
2477
+ let B = this.pixelsToRGBA(A.primaryColorPixels, o), E = this.pixelsToRGBA(A.secondaryColorPixels, o);
2478
+ const h = this.extractTransformData(
2490
2479
  A.transformPixels,
2491
2480
  A.rotationPixels,
2492
- n
2481
+ o
2493
2482
  );
2494
- if (E.isInverted) {
2483
+ if (h.isInverted) {
2495
2484
  const c = B;
2496
- B = h, h = c;
2485
+ B = E, E = c;
2497
2486
  }
2498
2487
  const l = this.calculateCellPosition(s, i, e);
2499
2488
  t.push({
2500
2489
  charIndex: g,
2501
2490
  primaryColor: B,
2502
- secondaryColor: h,
2503
- transform: E,
2491
+ secondaryColor: E,
2492
+ transform: h,
2504
2493
  position: l
2505
2494
  }), r++;
2506
2495
  }
@@ -2526,9 +2515,9 @@ class TA {
2526
2515
  {
2527
2516
  const s = r.idRangeOffset[i] / 2 + (e - r.startCount[i]) - (r.startCount.length - i);
2528
2517
  if (s >= 0 && s < r.glyphIdArray.length) {
2529
- const n = r.glyphIdArray[s];
2530
- if (n !== 0)
2531
- return n + r.idDelta[i] & 65535;
2518
+ const o = r.glyphIdArray[s];
2519
+ if (o !== 0)
2520
+ return o + r.idDelta[i] & 65535;
2532
2521
  }
2533
2522
  }
2534
2523
  }
@@ -2578,34 +2567,34 @@ class TA {
2578
2567
  */
2579
2568
  glyphToSVGPath(A, e, t, r) {
2580
2569
  if (!A || !A.xs) return "";
2581
- const { xs: i, ys: s, endPts: n, flags: g } = A;
2582
- if (!i || !s || !n || !g) return "";
2583
- let B = "", h = 0;
2584
- for (let E = 0; E < n.length; E++) {
2585
- const l = n[E];
2586
- if (!(l < h)) {
2587
- if (l >= h) {
2588
- const c = e + i[h] * r, d = t - s[h] * r;
2570
+ const { xs: i, ys: s, endPts: o, flags: g } = A;
2571
+ if (!i || !s || !o || !g) return "";
2572
+ let B = "", E = 0;
2573
+ for (let h = 0; h < o.length; h++) {
2574
+ const l = o[h];
2575
+ if (!(l < E)) {
2576
+ if (l >= E) {
2577
+ const c = e + i[E] * r, d = t - s[E] * r;
2589
2578
  B += `M${c.toFixed(2)},${d.toFixed(2)}`;
2590
- let u = h + 1;
2579
+ let u = E + 1;
2591
2580
  for (; u <= l; )
2592
2581
  if ((g[u] & 1) !== 0) {
2593
2582
  const D = e + i[u] * r, C = t - s[u] * r;
2594
2583
  B += `L${D.toFixed(2)},${C.toFixed(2)}`, u++;
2595
2584
  } else {
2596
2585
  const D = e + i[u] * r, C = t - s[u] * r;
2597
- let P = u + 1 > l ? h : u + 1;
2586
+ let P = u + 1 > l ? E : u + 1;
2598
2587
  if ((g[P] & 1) !== 0) {
2599
- const v = e + i[P] * r, I = t - s[P] * r;
2600
- B += `Q${D.toFixed(2)},${C.toFixed(2)} ${v.toFixed(2)},${I.toFixed(2)}`, u = P + 1;
2588
+ const v = e + i[P] * r, _ = t - s[P] * r;
2589
+ B += `Q${D.toFixed(2)},${C.toFixed(2)} ${v.toFixed(2)},${_.toFixed(2)}`, u = P + 1;
2601
2590
  } else {
2602
- const v = e + i[P] * r, I = t - s[P] * r, R = (D + v) / 2, T = (C + I) / 2;
2591
+ const v = e + i[P] * r, _ = t - s[P] * r, R = (D + v) / 2, T = (C + _) / 2;
2603
2592
  B += `Q${D.toFixed(2)},${C.toFixed(2)} ${R.toFixed(2)},${T.toFixed(2)}`, u = P;
2604
2593
  }
2605
2594
  }
2606
2595
  B += "Z";
2607
2596
  }
2608
- h = l + 1;
2597
+ E = l + 1;
2609
2598
  }
2610
2599
  }
2611
2600
  return B;
@@ -2621,14 +2610,14 @@ class TA {
2621
2610
  */
2622
2611
  generateCharacterPath(A, e, t, r, i) {
2623
2612
  try {
2624
- const s = A.codePointAt(0) || 0, n = this.getGlyphIndex(e, s);
2625
- if (n === 0)
2613
+ const s = A.codePointAt(0) || 0, o = this.getGlyphIndex(e, s);
2614
+ if (o === 0)
2626
2615
  return this.createEmptyPath();
2627
2616
  let g = null;
2628
2617
  try {
2629
- e.glyf && e.glyf[n] !== null ? g = e.glyf[n] : Q && Q.T && Q.T.glyf && Q.T.glyf._parseGlyf && (g = Q.T.glyf._parseGlyf(e, n), e.glyf && g && (e.glyf[n] = g));
2618
+ e.glyf && e.glyf[o] !== null ? g = e.glyf[o] : Q && Q.T && Q.T.glyf && Q.T.glyf._parseGlyf && (g = Q.T.glyf._parseGlyf(e, o), e.glyf && g && (e.glyf[o] = g));
2630
2619
  } catch (B) {
2631
- console.warn(`Failed to parse glyph ${n}:`, B);
2620
+ console.warn(`Failed to parse glyph ${o}:`, B);
2632
2621
  }
2633
2622
  return g ? this.createGlyphPath(e, g, t, r, i) : this.createEmptyPath();
2634
2623
  } catch (s) {
@@ -2647,10 +2636,10 @@ class TA {
2647
2636
  * @param advanceWidth Character advance width
2648
2637
  * @returns SVG path data string or null if generation fails
2649
2638
  */
2650
- generatePositionedCharacterPath(A, e, t, r, i, s, n, g) {
2639
+ generatePositionedCharacterPath(A, e, t, r, i, s, o, g) {
2651
2640
  try {
2652
- const B = n / e.head.unitsPerEm, h = g * B, E = t + (i - h) / 2, l = r + (s + n * 0.7) / 2;
2653
- return this.generateCharacterPath(A, e, E, l, n).toSVG() || null;
2641
+ const B = o / e.head.unitsPerEm, E = g * B, h = t + (i - E) / 2, l = r + (s + o * 0.7) / 2;
2642
+ return this.generateCharacterPath(A, e, h, l, o).toSVG() || null;
2654
2643
  } catch (B) {
2655
2644
  return console.warn(`Failed to generate positioned character path for "${A}":`, B), null;
2656
2645
  }
@@ -2658,7 +2647,7 @@ class TA {
2658
2647
  }
2659
2648
  class SA {
2660
2649
  constructor() {
2661
- o(this, "pathGenerator");
2650
+ a(this, "pathGenerator");
2662
2651
  this.pathGenerator = new TA();
2663
2652
  }
2664
2653
  /**
@@ -2711,12 +2700,12 @@ class SA {
2711
2700
  * @returns Transform attribute string or empty string
2712
2701
  */
2713
2702
  generateTransformAttribute(A, e) {
2714
- const { transform: t, position: r } = A, i = r.cellX + e.cellWidth / 2, s = r.cellY + e.cellHeight / 2, n = [];
2703
+ const { transform: t, position: r } = A, i = r.cellX + e.cellWidth / 2, s = r.cellY + e.cellHeight / 2, o = [];
2715
2704
  if (t.flipHorizontal || t.flipVertical) {
2716
2705
  const g = t.flipHorizontal ? -1 : 1, B = t.flipVertical ? -1 : 1;
2717
- n.push(`translate(${i} ${s})`), n.push(`scale(${g} ${B})`), n.push(`translate(${-i} ${-s})`);
2706
+ o.push(`translate(${i} ${s})`), o.push(`scale(${g} ${B})`), o.push(`translate(${-i} ${-s})`);
2718
2707
  }
2719
- return t.rotation && n.push(`rotate(${t.rotation} ${i} ${s})`), n.length ? ` transform="${n.join(" ")}"` : "";
2708
+ return t.rotation && o.push(`rotate(${t.rotation} ${i} ${s})`), o.length ? ` transform="${o.join(" ")}"` : "";
2720
2709
  }
2721
2710
  /**
2722
2711
  * Generates background rectangle for a cell
@@ -2757,10 +2746,10 @@ class SA {
2757
2746
  );
2758
2747
  if (!s)
2759
2748
  return "";
2760
- const n = this.rgbaToColorString(A.primaryColor);
2749
+ const o = this.rgbaToColorString(A.primaryColor);
2761
2750
  return r.drawMode === "stroke" ? `
2762
- <path id="${`path-${A.charIndex}-${A.position.cellX}-${A.position.cellY}`.replace(/\./g, "-")}" d="${s}" stroke="${n}" stroke-width="${r.strokeWidth}" fill="none" />` : `
2763
- <path d="${s}" fill="${n}" />`;
2751
+ <path id="${`path-${A.charIndex}-${A.position.cellX}-${A.position.cellY}`.replace(/\./g, "-")}" d="${s}" stroke="${o}" stroke-width="${r.strokeWidth}" fill="none" />` : `
2752
+ <path d="${s}" fill="${o}" />`;
2764
2753
  }
2765
2754
  /**
2766
2755
  * Generates complete SVG content for a single cell
@@ -2773,10 +2762,10 @@ class SA {
2773
2762
  generateCellContent(A, e, t, r) {
2774
2763
  let i = "";
2775
2764
  i += this.generateCellBackground(A, e, r);
2776
- const s = this.generateTransformAttribute(A, e), n = this.generateCharacterPath(A, e, t, r);
2777
- return n && (s ? (i += `
2778
- <g${s}>`, i += n, i += `
2779
- </g>`) : i += n), i;
2765
+ const s = this.generateTransformAttribute(A, e), o = this.generateCharacterPath(A, e, t, r);
2766
+ return o && (s ? (i += `
2767
+ <g${s}>`, i += o, i += `
2768
+ </g>`) : i += o), i;
2780
2769
  }
2781
2770
  /**
2782
2771
  * Generates the complete SVG content from cell data
@@ -2834,11 +2823,11 @@ class RA extends H {
2834
2823
  this.downloadSVG(A, e || this.generateDefaultFilename());
2835
2824
  }
2836
2825
  }
2837
- class X {
2826
+ class W {
2838
2827
  constructor() {
2839
- o(this, "dataExtractor");
2840
- o(this, "contentGenerator");
2841
- o(this, "fileHandler");
2828
+ a(this, "dataExtractor");
2829
+ a(this, "contentGenerator");
2830
+ a(this, "fileHandler");
2842
2831
  this.dataExtractor = new yA(), this.contentGenerator = new SA(), this.fileHandler = new RA();
2843
2832
  }
2844
2833
  /**
@@ -2886,7 +2875,7 @@ class X {
2886
2875
  }
2887
2876
  }
2888
2877
  }
2889
- class MA extends L {
2878
+ class GA extends L {
2890
2879
  /**
2891
2880
  * Extracts character data for TXT generation
2892
2881
  * @param framebufferData Framebuffer pixel data
@@ -2896,16 +2885,16 @@ class MA extends L {
2896
2885
  * @returns 2D array of characters (rows x columns)
2897
2886
  */
2898
2887
  extractCharacterGrid(A, e, t, r = " ") {
2899
- var n;
2888
+ var o;
2900
2889
  const i = [];
2901
2890
  let s = 0;
2902
2891
  for (let g = 0; g < e.rows; g++) {
2903
2892
  const B = [];
2904
- for (let h = 0; h < e.cols; h++) {
2905
- const E = s * 4, l = this.getCharacterIndex(
2893
+ for (let E = 0; E < e.cols; E++) {
2894
+ const h = s * 4, l = this.getCharacterIndex(
2906
2895
  A.characterPixels,
2907
- E
2908
- ), c = ((n = t.characters[l]) == null ? void 0 : n.character) || r;
2896
+ h
2897
+ ), c = ((o = t.characters[l]) == null ? void 0 : o.character) || r;
2909
2898
  B.push(c), s++;
2910
2899
  }
2911
2900
  i.push(B);
@@ -2913,7 +2902,7 @@ class MA extends L {
2913
2902
  return i;
2914
2903
  }
2915
2904
  }
2916
- class GA {
2905
+ class MA {
2917
2906
  /**
2918
2907
  * Generates TXT content from a 2D character array
2919
2908
  * @param characterGrid 2D array of characters (rows x columns)
@@ -2958,10 +2947,10 @@ class UA extends H {
2958
2947
  }
2959
2948
  class $ {
2960
2949
  constructor() {
2961
- o(this, "dataExtractor");
2962
- o(this, "contentGenerator");
2963
- o(this, "fileHandler");
2964
- this.dataExtractor = new MA(), this.contentGenerator = new GA(), this.fileHandler = new UA();
2950
+ a(this, "dataExtractor");
2951
+ a(this, "contentGenerator");
2952
+ a(this, "fileHandler");
2953
+ this.dataExtractor = new GA(), this.contentGenerator = new MA(), this.fileHandler = new UA();
2965
2954
  }
2966
2955
  /**
2967
2956
  * Applies default values to TXT export options
@@ -3019,8 +3008,8 @@ class YA extends L {
3019
3008
  const r = A.canvas;
3020
3009
  if (e === 1 && t === "transparent")
3021
3010
  return r;
3022
- const i = document.createElement("canvas"), s = i.getContext("2d"), n = Math.round(r.width * e), g = Math.round(r.height * e);
3023
- return i.width = n, i.height = g, t !== "transparent" && (s.fillStyle = t, s.fillRect(0, 0, n, g)), s.imageSmoothingEnabled = !1, s.drawImage(
3011
+ const i = document.createElement("canvas"), s = i.getContext("2d"), o = Math.round(r.width * e), g = Math.round(r.height * e);
3012
+ return i.width = o, i.height = g, t !== "transparent" && (s.fillStyle = t, s.fillRect(0, 0, o, g)), s.imageSmoothingEnabled = !1, s.drawImage(
3024
3013
  r,
3025
3014
  0,
3026
3015
  0,
@@ -3028,7 +3017,7 @@ class YA extends L {
3028
3017
  r.height,
3029
3018
  0,
3030
3019
  0,
3031
- n,
3020
+ o,
3032
3021
  g
3033
3022
  ), i;
3034
3023
  }
@@ -3052,8 +3041,8 @@ class OA {
3052
3041
  */
3053
3042
  async generateImageBlob(A, e) {
3054
3043
  return new Promise((t, r) => {
3055
- const i = this.getMimeType(e.format), s = (n) => {
3056
- n ? t(n) : r(new Error(`Failed to generate ${e.format.toUpperCase()} blob`));
3044
+ const i = this.getMimeType(e.format), s = (o) => {
3045
+ o ? t(o) : r(new Error(`Failed to generate ${e.format.toUpperCase()} blob`));
3057
3046
  };
3058
3047
  e.format === "png" ? A.toBlob(s, i) : A.toBlob(s, i, e.quality);
3059
3048
  });
@@ -3085,7 +3074,7 @@ const J = {
3085
3074
  jpg: ".jpg",
3086
3075
  webp: ".webp"
3087
3076
  };
3088
- class VA extends H {
3077
+ class kA extends H {
3089
3078
  /**
3090
3079
  * Saves image content as a downloadable file
3091
3080
  * @param content The image content (data URL or blob)
@@ -3148,12 +3137,12 @@ class VA extends H {
3148
3137
  return O[A];
3149
3138
  }
3150
3139
  }
3151
- class kA {
3140
+ class VA {
3152
3141
  constructor() {
3153
- o(this, "dataExtractor");
3154
- o(this, "contentGenerator");
3155
- o(this, "fileHandler");
3156
- this.dataExtractor = new YA(), this.contentGenerator = new OA(), this.fileHandler = new VA();
3142
+ a(this, "dataExtractor");
3143
+ a(this, "contentGenerator");
3144
+ a(this, "fileHandler");
3145
+ this.dataExtractor = new YA(), this.contentGenerator = new OA(), this.fileHandler = new kA();
3157
3146
  }
3158
3147
  /**
3159
3148
  * Applies default values to image export options
@@ -3239,38 +3228,38 @@ class kA {
3239
3228
  class S {
3240
3229
  constructor(A = null, e = {}) {
3241
3230
  /** The element to capture content from (optional for standalone mode) */
3242
- o(this, "captureSource");
3231
+ a(this, "captureSource");
3243
3232
  /** Our WebGL overlay canvas manager */
3244
- o(this, "textmodeCanvas");
3233
+ a(this, "textmodeCanvas");
3245
3234
  /** Core WebGL renderer */
3246
- o(this, "_renderer");
3247
- o(this, "_canvasFramebuffer");
3248
- o(this, "_font");
3249
- o(this, "_grid");
3250
- o(this, "resizeObserver");
3235
+ a(this, "_renderer");
3236
+ a(this, "_canvasFramebuffer");
3237
+ a(this, "_font");
3238
+ a(this, "_grid");
3239
+ a(this, "resizeObserver");
3251
3240
  // Auto-rendering properties
3252
- o(this, "_mode");
3253
- o(this, "_frameRateLimit");
3254
- o(this, "animationFrameId", null);
3255
- o(this, "lastFrameTime", 0);
3256
- o(this, "frameInterval");
3257
- o(this, "_isLooping", !0);
3258
- o(this, "_frameRate", 0);
3259
- o(this, "lastRenderTime", 0);
3260
- o(this, "_frameCount", 0);
3241
+ a(this, "_mode");
3242
+ a(this, "_frameRateLimit");
3243
+ a(this, "animationFrameId", null);
3244
+ a(this, "lastFrameTime", 0);
3245
+ a(this, "frameInterval");
3246
+ a(this, "_isLooping", !0);
3247
+ a(this, "_frameRate", 0);
3248
+ a(this, "lastRenderTime", 0);
3249
+ a(this, "_frameCount", 0);
3261
3250
  // Frame rate measurement smoothing
3262
- o(this, "frameTimeHistory", []);
3263
- o(this, "frameTimeHistorySize", 10);
3264
- o(this, "_pipeline");
3265
- o(this, "_isDisposed", !1);
3251
+ a(this, "frameTimeHistory", []);
3252
+ a(this, "frameTimeHistorySize", 10);
3253
+ a(this, "_pipeline");
3254
+ a(this, "_isDisposed", !1);
3266
3255
  // Standalone canvas properties
3267
- o(this, "_standalone", !1);
3268
- o(this, "_drawCallback", () => {
3256
+ a(this, "_standalone", !1);
3257
+ a(this, "_drawCallback", () => {
3269
3258
  });
3270
- o(this, "_resizedCallback", () => {
3259
+ a(this, "_resizedCallback", () => {
3271
3260
  });
3272
- o(this, "_windowResizeListener", null);
3273
- o(this, "_printDebug", !1);
3261
+ a(this, "_windowResizeListener", null);
3262
+ a(this, "_printDebug", !1);
3274
3263
  this.captureSource = A, this._standalone = A === null, this._mode = e.renderMode ?? "auto", this._frameRateLimit = e.frameRate ?? 60, this.frameInterval = 1e3 / this._frameRateLimit;
3275
3264
  }
3276
3265
  /**
@@ -3284,11 +3273,8 @@ class S {
3284
3273
  t.textmodeCanvas = new DA(t.captureSource, t._standalone, r), t._renderer = new lA(t.textmodeCanvas.getWebGLContext());
3285
3274
  let i, s;
3286
3275
  t._standalone ? (i = e.width || 800, s = e.height || 600) : (i = t.textmodeCanvas.width || 800, s = t.textmodeCanvas.height || 600), t._canvasFramebuffer = t._renderer.createFramebuffer(i, s), t._font = new CA(t._renderer, e.fontSize ?? 16), await t._font.initialize(e.fontSource);
3287
- const n = t._font.maxGlyphDimensions;
3288
- return t._grid = new mA(t.textmodeCanvas.canvas, n.width, n.height), t._pipeline = new FA(t._renderer, t._font, t._grid), t.setupEventListeners(), t._standalone && (t.textmodeCanvas.onTransformChange = () => {
3289
- const g = t.textmodeCanvas.getEffectiveRenderingDimensions();
3290
- t._renderer.resetViewport(g.width, g.height), t._mode === "auto" && t.render();
3291
- }), t.startAutoRendering(), t;
3276
+ const o = t._font.maxGlyphDimensions;
3277
+ return t._grid = new mA(t.textmodeCanvas.canvas, o.width, o.height), t._pipeline = new FA(t._renderer, t._font, t._grid), t.setupEventListeners(), t.startAutoRendering(), t;
3292
3278
  }
3293
3279
  setupEventListeners() {
3294
3280
  this._windowResizeListener = () => {
@@ -3390,7 +3376,7 @@ class S {
3390
3376
  * ```
3391
3377
  */
3392
3378
  toSVG(A = {}) {
3393
- return new X().generateSVG(this, A);
3379
+ return new W().generateSVG(this, A);
3394
3380
  }
3395
3381
  /**
3396
3382
  * Export the current textmode rendering to an SVG file.
@@ -3414,7 +3400,7 @@ class S {
3414
3400
  * ```
3415
3401
  */
3416
3402
  saveSVG(A = {}) {
3417
- new X().saveSVG(this, A);
3403
+ new W().saveSVG(this, A);
3418
3404
  }
3419
3405
  /**
3420
3406
  * Export the current textmode rendering to an image file.
@@ -3445,7 +3431,7 @@ class S {
3445
3431
  * ```
3446
3432
  */
3447
3433
  async saveCanvas(A, e = "png", t = {}) {
3448
- await new kA().saveImage(this.textmodeCanvas, {
3434
+ await new VA().saveImage(this.textmodeCanvas, {
3449
3435
  ...t,
3450
3436
  filename: A,
3451
3437
  format: e
@@ -3529,12 +3515,7 @@ class S {
3529
3515
  }
3530
3516
  }
3531
3517
  resize() {
3532
- if (this.textmodeCanvas.resize(), this._canvasFramebuffer.resize(this.textmodeCanvas.width, this.textmodeCanvas.height), this._grid.resize(), this._pipeline.resize(), this._standalone) {
3533
- const A = this.textmodeCanvas.getEffectiveRenderingDimensions();
3534
- this._renderer.resetViewport(A.width, A.height);
3535
- } else
3536
- this._renderer.resetViewport();
3537
- this._mode !== "manual" && this.render();
3518
+ this.textmodeCanvas.resize(), this._canvasFramebuffer.resize(this.textmodeCanvas.width, this.textmodeCanvas.height), this._grid.resize(), this._pipeline.resize(), this._renderer.resetViewport(), this._mode !== "manual" && this.render();
3538
3519
  }
3539
3520
  /**
3540
3521
  * Start automatic rendering
@@ -3768,16 +3749,11 @@ class S {
3768
3749
  * ```
3769
3750
  */
3770
3751
  fontSize(A) {
3771
- if (f.validate(
3752
+ f.validate(
3772
3753
  typeof A == "number" && A > 0,
3773
3754
  "Font size must be a positive number greater than 0.",
3774
3755
  { method: "fontSize", providedValue: A }
3775
- ) && this._font.fontSize !== A)
3776
- if (this._font.setFontSize(A), this._grid.resizeCellPixelDimensions(this._font.maxGlyphDimensions.width, this._font.maxGlyphDimensions.height), this._pipeline.resize(), this._standalone) {
3777
- const e = this.textmodeCanvas.getEffectiveRenderingDimensions();
3778
- this._renderer.resetViewport(e.width, e.height);
3779
- } else
3780
- this._renderer.resetViewport();
3756
+ ) && this._font.fontSize !== A && (this._font.setFontSize(A), this._grid.resizeCellPixelDimensions(this._font.maxGlyphDimensions.width, this._font.maxGlyphDimensions.height), this._pipeline.resize(), this._renderer.resetViewport());
3781
3757
  }
3782
3758
  /**
3783
3759
  * Set a draw callback function that will be executed before each render.
@@ -3844,12 +3820,7 @@ class S {
3844
3820
  * @param height The new height of the canvas.
3845
3821
  */
3846
3822
  resizeCanvas(A, e) {
3847
- if (this.textmodeCanvas.resize(A, e), this._canvasFramebuffer.resize(this.textmodeCanvas.width, this.textmodeCanvas.height), this._grid.resize(), this._pipeline.resize(), this._standalone) {
3848
- const t = this.textmodeCanvas.getEffectiveRenderingDimensions();
3849
- this._renderer.resetViewport(t.width, t.height);
3850
- } else
3851
- this._renderer.resetViewport();
3852
- this._mode !== "manual" && this.render();
3823
+ this.textmodeCanvas.resize(A, e), this._canvasFramebuffer.resize(this.textmodeCanvas.width, this.textmodeCanvas.height), this._grid.resize(), this._pipeline.resize(), this._renderer.resetViewport(), this._mode !== "manual" && this.render();
3853
3824
  }
3854
3825
  /**
3855
3826
  * @inheritDoc TextmodeConversionPipeline.get
@@ -4460,7 +4431,7 @@ class N {
4460
4431
  * ```
4461
4432
  */
4462
4433
  static get version() {
4463
- return "0.1.6-beta.2";
4434
+ return "0.1.6-beta.3";
4464
4435
  }
4465
4436
  constructor() {
4466
4437
  throw new Error("Textmode is a static class and cannot be instantiated.");
@@ -4468,11 +4439,11 @@ class N {
4468
4439
  }
4469
4440
  const HA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4470
4441
  __proto__: null
4471
- }, Symbol.toStringTag, { value: "Module" })), NA = N.create, WA = N.setErrorLevel, XA = N.version;
4442
+ }, Symbol.toStringTag, { value: "Module" })), NA = N.create, XA = N.setErrorLevel, WA = N.version;
4472
4443
  export {
4473
4444
  DA as TextmodeCanvas,
4474
4445
  FA as TextmodeConversionPipeline,
4475
- nA as TextmodeErrorLevel,
4446
+ oA as TextmodeErrorLevel,
4476
4447
  CA as TextmodeFont,
4477
4448
  mA as TextmodeGrid,
4478
4449
  S as Textmodifier,
@@ -4480,7 +4451,7 @@ export {
4480
4451
  NA as create,
4481
4452
  N as default,
4482
4453
  HA as export,
4483
- WA as setErrorLevel,
4454
+ XA as setErrorLevel,
4484
4455
  N as textmode,
4485
- XA as version
4456
+ WA as version
4486
4457
  };