@algorisys/tinyfly 0.88.0 → 0.90.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,8 +1,8 @@
1
1
  import { h as U, e as _, i as O, a as W, b as N, p as H, t as V, g as z, c as B, q, F as j, s as Z, d as J } from "./dom-adapter-Cphr2HZn.js";
2
- import { D as Ce } from "./dom-adapter-Cphr2HZn.js";
3
- import { createTrack as Q, parsePath as L, ribbon as K, ribbonHeadCap as ee, mat4 as b } from "@algorisys/tinyfly";
2
+ import { D as _e } from "./dom-adapter-Cphr2HZn.js";
3
+ import { createTrack as Q, parsePath as L, ribbon as K, ribbonHeadCap as ee, mat4 as T } from "@algorisys/tinyfly";
4
4
  import { p as te, s as ie } from "./sketch-CYPUbk3Q.js";
5
- import { c as Ie, a as Ye, b as _e } from "./sketch-CYPUbk3Q.js";
5
+ import { c as Be, a as Le, b as Fe } from "./sketch-CYPUbk3Q.js";
6
6
  function oe(n) {
7
7
  const e = /* @__PURE__ */ new Map();
8
8
  for (const { name: t, element: i } of n)
@@ -11,25 +11,25 @@ function oe(n) {
11
11
  }
12
12
  function se(n, e, t = {}) {
13
13
  const i = t.duration ?? 600, o = t.easing ?? "ease-out", s = t.scale !== !1, a = t.idPrefix ?? "flip", r = [];
14
- for (const { name: c, element: l } of e) {
15
- const h = n.measurements.get(c);
14
+ for (const { name: l, element: c } of e) {
15
+ const h = n.measurements.get(l);
16
16
  if (!h) continue;
17
- const f = F(l), m = h.left + h.width / 2 - (f.left + f.width / 2), u = h.top + h.height / 2 - (f.top + f.height / 2);
17
+ const f = F(c), m = h.left + h.width / 2 - (f.left + f.width / 2), u = h.top + h.height / 2 - (f.top + f.height / 2);
18
18
  if ((m !== 0 || u !== 0) && r.push(
19
- T(`${a}-${c}-x`, c, "x", m, 0, i, o),
20
- T(`${a}-${c}-y`, c, "y", u, 0, i, o)
19
+ w(`${a}-${l}-x`, l, "x", m, 0, i, o),
20
+ w(`${a}-${l}-y`, l, "y", u, 0, i, o)
21
21
  ), s && f.width > 0 && f.height > 0) {
22
22
  const p = h.width / f.width, d = h.height / f.height;
23
- p !== 1 && r.push(T(`${a}-${c}-sx`, c, "scaleX", p, 1, i, o)), d !== 1 && r.push(T(`${a}-${c}-sy`, c, "scaleY", d, 1, i, o));
23
+ p !== 1 && r.push(w(`${a}-${l}-sx`, l, "scaleX", p, 1, i, o)), d !== 1 && r.push(w(`${a}-${l}-sy`, l, "scaleY", d, 1, i, o));
24
24
  }
25
25
  }
26
26
  return r;
27
27
  }
28
- function Me(n, e, t = {}) {
28
+ function ve(n, e, t = {}) {
29
29
  const i = oe(n);
30
30
  return e(), se(i, n, t);
31
31
  }
32
- function T(n, e, t, i, o, s, a) {
32
+ function w(n, e, t, i, o, s, a) {
33
33
  return Q({
34
34
  id: n,
35
35
  target: e,
@@ -47,17 +47,17 @@ function F(n) {
47
47
  const t = e.getBoundingClientRect();
48
48
  return { left: t.left, top: t.top, width: t.width, height: t.height };
49
49
  }
50
- function G(n, e, t = {}) {
50
+ function D(n, e, t = {}) {
51
51
  const i = t.highlight ?? "#ffffff", o = t.halfWidth ?? 0.12, s = -0.2 + n * 1.4, a = [{ offset: 0, color: e }], r = [
52
52
  { offset: s - o, color: e },
53
53
  { offset: s, color: i },
54
54
  { offset: s + o, color: e }
55
55
  ];
56
- for (const c of r)
57
- c.offset > 0 && c.offset < 1 && a.push(c);
58
- return a.push({ offset: 1, color: e }), a.sort((c, l) => c.offset - l.offset), a;
56
+ for (const l of r)
57
+ l.offset > 0 && l.offset < 1 && a.push(l);
58
+ return a.push({ offset: 1, color: e }), a.sort((l, c) => l.offset - c.offset), a;
59
59
  }
60
- const k = 12;
60
+ const g = 12;
61
61
  function x(n) {
62
62
  const e = [];
63
63
  let t, i = -1;
@@ -67,12 +67,12 @@ function x(n) {
67
67
  continue;
68
68
  }
69
69
  t = void 0;
70
- const [s, a, r, c, l, h] = o.points, f = [];
71
- for (let m = 0; m <= k; m++) {
72
- const u = m / k, p = 1 - u;
70
+ const [s, a, r, l, c, h] = o.points, f = [];
71
+ for (let m = 0; m <= g; m++) {
72
+ const u = m / g, p = 1 - u;
73
73
  f.push({
74
- x: p * p * p * o.startX + 3 * p * p * u * s + 3 * p * u * u * r + u * u * u * l,
75
- y: p * p * p * o.startY + 3 * p * p * u * a + 3 * p * u * u * c + u * u * u * h
74
+ x: p * p * p * o.startX + 3 * p * p * u * s + 3 * p * u * u * r + u * u * u * c,
75
+ y: p * p * p * o.startY + 3 * p * p * u * a + 3 * p * u * u * l + u * u * u * h
76
76
  });
77
77
  }
78
78
  e.push({ kind: "curve", points: f, length: o.length });
@@ -87,24 +87,24 @@ function ne(n, e, t, i, o = 0) {
87
87
  `M${n + s},${e} H${a - s} A${s},${s} 0 0 1 ${a},${e + s} V${r - s} A${s},${s} 0 0 1 ${a - s},${r} H${n + s} A${s},${s} 0 0 1 ${n},${r - s} V${e + s} A${s},${s} 0 0 1 ${n + s},${e} Z`
88
88
  );
89
89
  }
90
- function M(n, e, t, i) {
91
- const s = e.reduce((r, c) => r + c.length, 0) * Math.min(1, Math.max(0, t));
90
+ function S(n, e, t, i) {
91
+ const s = e.reduce((r, l) => r + l.length, 0) * Math.min(1, Math.max(0, t));
92
92
  let a = 0;
93
93
  i || n.beginPath();
94
94
  for (const r of e) {
95
- const c = r.length === 0 ? s >= a ? 1 : 0 : Math.min(1, Math.max(0, (s - a) / r.length));
95
+ const l = r.length === 0 ? s >= a ? 1 : 0 : Math.min(1, Math.max(0, (s - a) / r.length));
96
96
  if (a += r.length, i) {
97
- r.kind === "curve" ? i.curve(r.points, c) : i.line(r.points, c);
97
+ r.kind === "curve" ? i.curve(r.points, l) : i.line(r.points, l);
98
98
  continue;
99
99
  }
100
- if (c <= 0) continue;
101
- const l = te(r.points, c);
102
- n.moveTo(l[0].x, l[0].y);
103
- for (const h of l.slice(1)) n.lineTo(h.x, h.y);
100
+ if (l <= 0) continue;
101
+ const c = te(r.points, l);
102
+ n.moveTo(c[0].x, c[0].y);
103
+ for (const h of c.slice(1)) n.lineTo(h.x, h.y);
104
104
  }
105
105
  i || n.stroke();
106
106
  }
107
- function g(n, e, t) {
107
+ function A(n, e, t) {
108
108
  if (typeof OffscreenCanvas < "u") return new OffscreenCanvas(e, t);
109
109
  const i = n.canvas;
110
110
  if (i?.ownerDocument) {
@@ -117,7 +117,7 @@ function g(n, e, t) {
117
117
  return null;
118
118
  }
119
119
  }
120
- function Se(n) {
120
+ function xe(n) {
121
121
  return typeof n == "object" && n !== null && "type" in n;
122
122
  }
123
123
  class R {
@@ -184,14 +184,14 @@ class R {
184
184
  const o = this.targets.get(t);
185
185
  if (!o) continue;
186
186
  const s = this.aliases.get(t) ?? t, a = this.animationOffsets.get(s) ?? { x: 0, y: 0 };
187
- for (const [r, c] of i)
188
- if (R.OFFSET_PROPERTIES.has(r) && typeof c == "number")
189
- r === "x" || r === "motionPathX" ? a.x = c : (r === "y" || r === "motionPathY") && (a.y = c);
187
+ for (const [r, l] of i)
188
+ if (R.OFFSET_PROPERTIES.has(r) && typeof l == "number")
189
+ r === "x" || r === "motionPathX" ? a.x = l : (r === "y" || r === "motionPathY") && (a.y = l);
190
190
  else if (o.type === "custom" && o.props && (r in o.props || o.acceptsProp?.(r)))
191
- o.props[r] = c;
191
+ o.props[r] = l;
192
192
  else {
193
- const l = R.PROPERTY_MAP[r] ?? r;
194
- o[l] = c;
193
+ const c = R.PROPERTY_MAP[r] ?? r;
194
+ o[c] = l;
195
195
  }
196
196
  this.animationOffsets.set(s, a);
197
197
  }
@@ -230,10 +230,10 @@ class R {
230
230
  if ((i.x !== 0 || i.y !== 0) && e.translate(i.x, i.y), t.rotate !== void 0 || t.rotateX !== void 0 || t.rotateY !== void 0 || t.scale !== void 0 || t.scaleX !== void 0 || t.scaleY !== void 0 || t.skewX !== void 0 || t.skewY !== void 0) {
231
231
  const s = this.getPivotX(t), a = this.getPivotY(t);
232
232
  e.translate(s, a), t.rotate !== void 0 && e.rotate(t.rotate * Math.PI / 180);
233
- let r = t.scaleX ?? 1, c = t.scaleY ?? 1;
234
- if (t.rotateX !== void 0 && (c *= Math.cos(t.rotateX * Math.PI / 180)), t.rotateY !== void 0 && (r *= Math.cos(t.rotateY * Math.PI / 180)), t.scale !== void 0 ? e.scale(t.scale, t.scale) : (r !== 1 || c !== 1) && e.scale(r, c), t.skewX !== void 0 || t.skewY !== void 0) {
235
- const l = (t.skewX ?? 0) * Math.PI / 180, h = (t.skewY ?? 0) * Math.PI / 180;
236
- e.transform(1, Math.tan(h), Math.tan(l), 1, 0, 0);
233
+ let r = t.scaleX ?? 1, l = t.scaleY ?? 1;
234
+ if (t.rotateX !== void 0 && (l *= Math.cos(t.rotateX * Math.PI / 180)), t.rotateY !== void 0 && (r *= Math.cos(t.rotateY * Math.PI / 180)), t.scale !== void 0 ? e.scale(t.scale, t.scale) : (r !== 1 || l !== 1) && e.scale(r, l), t.skewX !== void 0 || t.skewY !== void 0) {
235
+ const c = (t.skewX ?? 0) * Math.PI / 180, h = (t.skewY ?? 0) * Math.PI / 180;
236
+ e.transform(1, Math.tan(h), Math.tan(c), 1, 0, 0);
237
237
  }
238
238
  e.translate(-s, -a);
239
239
  }
@@ -257,8 +257,8 @@ class R {
257
257
  for (const s of H(i, o)) {
258
258
  const a = V(s.source, s.target);
259
259
  if (!a) continue;
260
- const [r, c, l] = z(s.target, 1);
261
- e.save(), e.beginPath(), e.moveTo(r.x, r.y), e.lineTo(c.x, c.y), e.lineTo(l.x, l.y), e.closePath(), e.clip(), e.transform(...a), this.drawContent(e, t), e.restore();
260
+ const [r, l, c] = z(s.target, 1);
261
+ e.save(), e.beginPath(), e.moveTo(r.x, r.y), e.lineTo(l.x, l.y), e.lineTo(c.x, c.y), e.closePath(), e.clip(), e.transform(...a), this.drawContent(e, t), e.restore();
262
262
  }
263
263
  }
264
264
  /** A cleared offscreen canvas the size of `ctx`'s, reused frame to frame; null where none can be made. */
@@ -266,7 +266,7 @@ class R {
266
266
  const t = e.canvas?.width ?? 0, i = e.canvas?.height ?? 0;
267
267
  if (!(t > 0 && i > 0)) return null;
268
268
  if (!this.layer || this.layer.width !== t || this.layer.height !== i) {
269
- const s = g(e, t, i), a = s?.getContext("2d");
269
+ const s = A(e, t, i), a = s?.getContext("2d");
270
270
  if (this.layer = s && a ? { canvas: s, ctx: a, width: t, height: i } : null, !this.layer) return null;
271
271
  }
272
272
  const o = this.layer.ctx;
@@ -284,18 +284,18 @@ class R {
284
284
  e.save(), e.font = `${t.fontWeight ?? 400} ${s}px ${t.fontFamily ?? "sans-serif"}`;
285
285
  const a = e.measureText(t.text).width;
286
286
  e.restore();
287
- const r = t.textAlign ?? "left", c = r === "center" ? t.x - a / 2 : r === "right" ? t.x - a : t.x, l = (t.textBaseline ?? "top") === "top" ? t.y : t.y - s;
288
- i = { x: c, y: l, width: a, height: s * 1.4 };
287
+ const r = t.textAlign ?? "left", l = r === "center" ? t.x - a / 2 : r === "right" ? t.x - a : t.x, c = (t.textBaseline ?? "top") === "top" ? t.y : t.y - s;
288
+ i = { x: l, y: c, width: a, height: s * 1.4 };
289
289
  } else if (t.type === "path") {
290
290
  const s = [], a = [];
291
291
  for (const r of L(t.d).segments) {
292
292
  s.push(r.startX, r.endX), a.push(r.startY, r.endY);
293
- for (let c = 0; c + 1 < r.points.length; c += 2)
294
- s.push(r.points[c]), a.push(r.points[c + 1]);
293
+ for (let l = 0; l + 1 < r.points.length; l += 2)
294
+ s.push(r.points[l]), a.push(r.points[l + 1]);
295
295
  }
296
296
  if (s.length > 0) {
297
- const r = Math.min(...s), c = Math.min(...a);
298
- i = { x: t.x + r, y: t.y + c, width: Math.max(...s) - r, height: Math.max(...a) - c };
297
+ const r = Math.min(...s), l = Math.min(...a);
298
+ i = { x: t.x + r, y: t.y + l, width: Math.max(...s) - r, height: Math.max(...a) - l };
299
299
  }
300
300
  }
301
301
  const o = (t.lineWidth ?? 1) + 2 + 3 * Math.max(t.blur ?? 0, t.glow ?? 0, t.shadowBlur ?? 0) + Math.max(Math.abs(t.shadowX ?? 0), Math.abs(t.shadowY ?? 0));
@@ -309,8 +309,8 @@ class R {
309
309
  t.fillStyle && (e.fillStyle = this.resolveFillStyle(e, t)), t.strokeStyle && (e.strokeStyle = t.strokeStyle), t.lineWidth !== void 0 && (e.lineWidth = t.lineWidth);
310
310
  const i = B(t);
311
311
  if (i && (e.filter = i), t.clipTop !== void 0 || t.clipRight !== void 0 || t.clipBottom !== void 0 || t.clipLeft !== void 0) {
312
- const o = this.getTargetBounds(t), s = o.x + (t.clipLeft ?? 0) / 100 * o.width, a = o.x + o.width - (t.clipRight ?? 0) / 100 * o.width, r = o.y + (t.clipTop ?? 0) / 100 * o.height, c = o.y + o.height - (t.clipBottom ?? 0) / 100 * o.height;
313
- e.beginPath(), e.rect(s, r, Math.max(0, a - s), Math.max(0, c - r)), e.clip();
312
+ const o = this.getTargetBounds(t), s = o.x + (t.clipLeft ?? 0) / 100 * o.width, a = o.x + o.width - (t.clipRight ?? 0) / 100 * o.width, r = o.y + (t.clipTop ?? 0) / 100 * o.height, l = o.y + o.height - (t.clipBottom ?? 0) / 100 * o.height;
313
+ e.beginPath(), e.rect(s, r, Math.max(0, a - s), Math.max(0, l - r)), e.clip();
314
314
  }
315
315
  switch (t.type) {
316
316
  case "rect":
@@ -350,7 +350,7 @@ class R {
350
350
  * Create a canvas linear gradient from a LinearGradient definition.
351
351
  */
352
352
  createLinearGradient(e, t, i) {
353
- const o = (t.angle - 90) * (Math.PI / 180), s = i.x + i.width / 2, a = i.y + i.height / 2, r = Math.max(i.width, i.height), c = s - Math.cos(o) * r / 2, l = a - Math.sin(o) * r / 2, h = s + Math.cos(o) * r / 2, f = a + Math.sin(o) * r / 2, m = e.createLinearGradient(c, l, h, f);
353
+ const o = (t.angle - 90) * (Math.PI / 180), s = i.x + i.width / 2, a = i.y + i.height / 2, r = Math.max(i.width, i.height), l = s - Math.cos(o) * r / 2, c = a - Math.sin(o) * r / 2, h = s + Math.cos(o) * r / 2, f = a + Math.sin(o) * r / 2, m = e.createLinearGradient(l, c, h, f);
354
354
  for (const u of t.stops)
355
355
  m.addColorStop(u.offset, u.color);
356
356
  return m;
@@ -360,8 +360,8 @@ class R {
360
360
  */
361
361
  createRadialGradient(e, t, i) {
362
362
  const o = i.x + i.width * t.centerX, s = i.y + i.height * t.centerY, a = Math.max(i.width, i.height) * t.radius, r = e.createRadialGradient(o, s, 0, o, s, a);
363
- for (const c of t.stops)
364
- r.addColorStop(c.offset, c.color);
363
+ for (const l of t.stops)
364
+ r.addColorStop(l.offset, l.color);
365
365
  return r;
366
366
  }
367
367
  /**
@@ -419,7 +419,7 @@ class R {
419
419
  () => {
420
420
  e.beginPath(), t.borderRadius && t.borderRadius > 0 ? this.roundRect(e, i, o, s, a, t.borderRadius) : e.rect(i, o, s, a), e.fill();
421
421
  },
422
- (r, c) => M(e, ne(i, o, s, a, t.borderRadius), r, c)
422
+ (r, l) => S(e, ne(i, o, s, a, t.borderRadius), r, l)
423
423
  );
424
424
  }
425
425
  e.beginPath(), t.borderRadius && t.borderRadius > 0 ? this.roundRect(e, t.x, t.y, t.width, t.height, t.borderRadius) : e.rect(t.x, t.y, t.width, t.height), t.fillStyle && e.fill(), t.strokeStyle && e.stroke(), e.closePath();
@@ -458,10 +458,10 @@ class R {
458
458
  const i = t.fontSize ?? 16, o = t.fontFamily ?? "sans-serif", s = t.fontWeight ?? 400;
459
459
  if (e.font = `${s} ${i}px ${o}`, e.textAlign = t.textAlign ?? "left", e.textBaseline = t.textBaseline ?? "top", t.fillStyle) {
460
460
  if (t.shine !== void 0 && typeof t.fillStyle == "string") {
461
- const a = e.measureText(t.text).width, r = t.textAlign ?? "left", c = r === "center" ? t.x - a / 2 : r === "right" ? t.x - a : t.x, l = e.createLinearGradient(c, t.y, c + a, t.y);
462
- for (const h of G(t.shine, t.fillStyle))
463
- l.addColorStop(h.offset, h.color);
464
- e.fillStyle = l;
461
+ const a = e.measureText(t.text).width, r = t.textAlign ?? "left", l = r === "center" ? t.x - a / 2 : r === "right" ? t.x - a : t.x, c = e.createLinearGradient(l, t.y, l + a, t.y);
462
+ for (const h of D(t.shine, t.fillStyle))
463
+ c.addColorStop(h.offset, h.color);
464
+ e.fillStyle = c;
465
465
  }
466
466
  e.fillText(t.text, t.x, t.y);
467
467
  }
@@ -480,7 +480,7 @@ class R {
480
480
  e,
481
481
  t,
482
482
  void 0,
483
- (s, a) => M(e, [{ kind: "line", points: i, length: o }], s, a)
483
+ (s, a) => S(e, [{ kind: "line", points: i, length: o }], s, a)
484
484
  );
485
485
  }
486
486
  e.beginPath(), e.moveTo(t.x, t.y), e.lineTo(t.x2, t.y2), t.strokeStyle && e.stroke(), e.closePath();
@@ -496,7 +496,7 @@ class R {
496
496
  e,
497
497
  t,
498
498
  () => e.fill(i),
499
- (o, s) => M(e, x(t.d), o, s)
499
+ (o, s) => S(e, x(t.d), o, s)
500
500
  );
501
501
  t.fillStyle && e.fill(i), t.strokeStyle && e.stroke(i);
502
502
  }
@@ -506,13 +506,13 @@ class R {
506
506
  renderImage(e, t) {
507
507
  if (!t.image) return;
508
508
  t.opacity !== void 0 && (e.globalAlpha = t.opacity);
509
- const { x: i, y: o, width: s, height: a } = t, r = t.objectFit ?? "fill", c = t.borderRadius ?? 0, l = t.image, h = l.naturalWidth || l.videoWidth || l.width || s, f = l.naturalHeight || l.videoHeight || l.height || a;
509
+ const { x: i, y: o, width: s, height: a } = t, r = t.objectFit ?? "fill", l = t.borderRadius ?? 0, c = t.image, h = c.naturalWidth || c.videoWidth || c.width || s, f = c.naturalHeight || c.videoHeight || c.height || a;
510
510
  let m = i, u = o, p = s, d = a;
511
511
  if (r !== "fill" && h > 0 && f > 0) {
512
512
  const y = r === "cover" ? Math.max(s / h, a / f) : Math.min(s / h, a / f);
513
513
  p = h * y, d = f * y, m = i + (s - p) / 2, u = o + (a - d) / 2;
514
514
  }
515
- e.save(), e.beginPath(), c > 0 && typeof e.roundRect == "function" ? e.roundRect(i, o, s, a, c) : e.rect(i, o, s, a), e.clip(), e.drawImage(t.image, m, u, p, d), e.restore();
515
+ e.save(), e.beginPath(), l > 0 && typeof e.roundRect == "function" ? e.roundRect(i, o, s, a, l) : e.rect(i, o, s, a), e.clip(), e.drawImage(t.image, m, u, p, d), e.restore();
516
516
  }
517
517
  /**
518
518
  * Render a custom target by calling its draw function in local coordinates.
@@ -623,58 +623,58 @@ class R {
623
623
  function re(n, e) {
624
624
  const t = n.length / 4, i = new Float32Array(t * 3), o = Math.min(0.999, Math.max(0, e));
625
625
  for (let s = 0; s < t; s++) {
626
- const a = n[s * 4] / 255, r = n[s * 4 + 1] / 255, c = n[s * 4 + 2] / 255, l = n[s * 4 + 3] / 255, h = Math.max(a, r, c);
626
+ const a = n[s * 4] / 255, r = n[s * 4 + 1] / 255, l = n[s * 4 + 2] / 255, c = n[s * 4 + 3] / 255, h = Math.max(a, r, l);
627
627
  if (h <= o) continue;
628
- const f = (h - o) / (1 - o) * l / h;
629
- i[s * 3] = a * f, i[s * 3 + 1] = r * f, i[s * 3 + 2] = c * f;
628
+ const f = (h - o) / (1 - o) * c / h;
629
+ i[s * 3] = a * f, i[s * 3 + 1] = r * f, i[s * 3 + 2] = l * f;
630
630
  }
631
631
  return i;
632
632
  }
633
- function E(n, e, t, i, o) {
634
- const s = new Float32Array(n.length), a = o ? t : e, r = o ? e : t, c = (h, f) => (o ? h * e + f : f * e + h) * 3, l = i * 2 + 1;
633
+ function X(n, e, t, i, o) {
634
+ const s = new Float32Array(n.length), a = o ? t : e, r = o ? e : t, l = (h, f) => (o ? h * e + f : f * e + h) * 3, c = i * 2 + 1;
635
635
  for (let h = 0; h < a; h++)
636
636
  for (let f = 0; f < 3; f++) {
637
637
  let m = 0;
638
- for (let u = -i; u <= i; u++) m += n[c(h, Math.min(r - 1, Math.max(0, u))) + f];
638
+ for (let u = -i; u <= i; u++) m += n[l(h, Math.min(r - 1, Math.max(0, u))) + f];
639
639
  for (let u = 0; u < r; u++) {
640
- s[c(h, u) + f] = m / l;
641
- const p = n[c(h, Math.max(0, u - i)) + f], d = n[c(h, Math.min(r - 1, u + i + 1)) + f];
640
+ s[l(h, u) + f] = m / c;
641
+ const p = n[l(h, Math.max(0, u - i)) + f], d = n[l(h, Math.min(r - 1, u + i + 1)) + f];
642
642
  m += d - p;
643
643
  }
644
644
  }
645
645
  return s;
646
646
  }
647
- function X(n, e, t, i) {
647
+ function E(n, e, t, i) {
648
648
  const o = Math.max(1, Math.round(i / Math.sqrt(3)));
649
649
  let s = n;
650
650
  for (let a = 0; a < 3; a++)
651
- s = E(s, e, t, o, !0), s = E(s, e, t, o, !1);
651
+ s = X(s, e, t, o, !0), s = X(s, e, t, o, !1);
652
652
  return s;
653
653
  }
654
- function xe(n, e = {}) {
654
+ function Re(n, e = {}) {
655
655
  const t = n.canvas, i = t.width, o = t.height;
656
656
  if (!(i > 0 && o > 0)) return;
657
- const s = Math.max(1, Math.round(e.downsample ?? 4)), a = Math.max(1, Math.ceil(i / s)), r = Math.max(1, Math.ceil(o / s)), c = g(n, a, r), l = c?.getContext("2d");
658
- if (!c || !l) return;
659
- l.imageSmoothingEnabled = !0, l.drawImage(n.canvas, 0, 0, a, r);
660
- const h = re(l.getImageData(0, 0, a, r).data, e.threshold ?? 0.55), f = (e.radius ?? Math.max(i, o) * 0.02) / s, m = X(h, a, r, f), u = X(h, a, r, f * 3), p = e.halo ?? 0.6, d = l.createImageData(a, r);
657
+ const s = Math.max(1, Math.round(e.downsample ?? 4)), a = Math.max(1, Math.ceil(i / s)), r = Math.max(1, Math.ceil(o / s)), l = A(n, a, r), c = l?.getContext("2d");
658
+ if (!l || !c) return;
659
+ c.imageSmoothingEnabled = !0, c.drawImage(n.canvas, 0, 0, a, r);
660
+ const h = re(c.getImageData(0, 0, a, r).data, e.threshold ?? 0.55), f = (e.radius ?? Math.max(i, o) * 0.02) / s, m = E(h, a, r, f), u = E(h, a, r, f * 3), p = e.halo ?? 0.6, d = c.createImageData(a, r);
661
661
  for (let y = 0; y < a * r; y++) {
662
- for (let w = 0; w < 3; w++) d.data[y * 4 + w] = Math.round(Math.min(1, m[y * 3 + w] + u[y * 3 + w] * p) * 255);
662
+ for (let b = 0; b < 3; b++) d.data[y * 4 + b] = Math.round(Math.min(1, m[y * 3 + b] + u[y * 3 + b] * p) * 255);
663
663
  d.data[y * 4 + 3] = 255;
664
664
  }
665
- l.putImageData(d, 0, 0), n.save(), n.setTransform(1, 0, 0, 1, 0, 0), n.globalCompositeOperation = "lighter", n.globalAlpha = Math.max(0, e.strength ?? 0.9), n.imageSmoothingEnabled = !0, n.drawImage(c, 0, 0, i, o), n.restore();
665
+ c.putImageData(d, 0, 0), n.save(), n.setTransform(1, 0, 0, 1, 0, 0), n.globalCompositeOperation = "lighter", n.globalAlpha = Math.max(0, e.strength ?? 0.9), n.imageSmoothingEnabled = !0, n.drawImage(l, 0, 0, i, o), n.restore();
666
666
  }
667
- function Re(n, e, t) {
667
+ function ke(n, e, t) {
668
668
  const i = t.width ?? 6, o = t.taper ?? 1, s = t.fade ?? 1, a = t.opacity ?? 1, r = t.blend === "add";
669
669
  if (n.save(), e.length >= 2) {
670
- const l = le(e, i, o, s, a);
671
- r ? (n.globalCompositeOperation = "lighter", A(n, l, t.color)) : ce(n, l, t.color);
670
+ const c = ce(e, i, o, s, a);
671
+ r ? (n.globalCompositeOperation = "lighter", k(n, c, t.color)) : le(n, c, t.color);
672
672
  }
673
- const c = e[e.length - 1];
674
- if (t.head && c && t.head.radius > 0) {
673
+ const l = e[e.length - 1];
674
+ if (t.head && l && t.head.radius > 0) {
675
675
  r && (n.globalCompositeOperation = "lighter");
676
- const l = t.head.color ?? t.color, h = n.createRadialGradient(c.at.x, c.at.y, 0, c.at.x, c.at.y, t.head.radius);
677
- h.addColorStop(0, l), h.addColorStop(0.35, l), h.addColorStop(1, ae(n, l)), n.globalAlpha = a, n.fillStyle = h, n.beginPath(), n.arc(c.at.x, c.at.y, t.head.radius, 0, Math.PI * 2), n.fill();
676
+ const c = t.head.color ?? t.color, h = n.createRadialGradient(l.at.x, l.at.y, 0, l.at.x, l.at.y, t.head.radius);
677
+ h.addColorStop(0, c), h.addColorStop(0.35, c), h.addColorStop(1, ae(n, c)), n.globalAlpha = a, n.fillStyle = h, n.beginPath(), n.arc(l.at.x, l.at.y, t.head.radius, 0, Math.PI * 2), n.fill();
678
678
  }
679
679
  n.restore();
680
680
  }
@@ -685,44 +685,71 @@ function ae(n, e) {
685
685
  const o = /^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i.exec(t);
686
686
  return o ? `rgba(${o[1]}, ${o[2]}, ${o[3]}, 0)` : "rgba(0, 0, 0, 0)";
687
687
  }
688
- function le(n, e, t, i, o) {
689
- const s = n.map((l) => ({ x: l.at.x, y: l.at.y, width: e * (1 - t * l.age) })), a = K(s), r = ee(s) ?? void 0, c = [];
690
- for (let l = 0; l + 1 < n.length; l++) {
691
- const h = (n[l].age + n[l + 1].age) / 2, f = o * (1 - i * h);
688
+ function ce(n, e, t, i, o) {
689
+ const s = n.map((c) => ({ x: c.at.x, y: c.at.y, width: e * (1 - t * c.age) })), a = K(s), r = ee(s) ?? void 0, l = [];
690
+ for (let c = 0; c + 1 < n.length; c++) {
691
+ const h = (n[c].age + n[c + 1].age) / 2, f = o * (1 - i * h);
692
692
  if (f <= 0) continue;
693
- const m = l + 2 === n.length;
694
- c.push({ corners: [a.left[l], a.left[l + 1], a.right[l + 1], a.right[l]], alpha: f, ...m && r && { cap: r } });
693
+ const m = c + 2 === n.length;
694
+ l.push({ corners: [a.left[c], a.left[c + 1], a.right[c + 1], a.right[c]], alpha: f, ...m && r && { cap: r } });
695
695
  }
696
- return c;
696
+ return l;
697
697
  }
698
- function A(n, e, t) {
698
+ function k(n, e, t) {
699
699
  n.fillStyle = t;
700
700
  for (const i of e) {
701
701
  const [o, s, a, r] = i.corners;
702
702
  n.globalAlpha = Math.min(1, i.alpha), n.beginPath(), n.moveTo(o.x, o.y), n.lineTo(s.x, s.y), i.cap && n.arc(i.cap.x, i.cap.y, i.cap.radius, i.cap.start, i.cap.start - Math.PI, !0), n.lineTo(a.x, a.y), n.lineTo(r.x, r.y), n.closePath(), n.fill();
703
703
  }
704
704
  }
705
- function ce(n, e, t) {
705
+ function le(n, e, t) {
706
706
  const i = typeof n.getTransform == "function" ? n.getTransform() : null, o = (d) => i ? { x: i.a * d.x + i.c * d.y + i.e, y: i.b * d.x + i.d * d.y + i.f } : d, s = i ? Math.sqrt(Math.abs(i.a * i.d - i.b * i.c)) : 1, a = e.map((d) => ({
707
707
  ...d,
708
708
  corners: d.corners.map(o),
709
709
  ...d.cap && { cap: { ...d.cap, ...o(d.cap), radius: d.cap.radius * s, start: d.cap.start + (i ? Math.atan2(i.b, i.a) : 0) } }
710
710
  }));
711
- let r = 1 / 0, c = 1 / 0, l = -1 / 0, h = -1 / 0;
711
+ let r = 1 / 0, l = 1 / 0, c = -1 / 0, h = -1 / 0;
712
712
  for (const d of a) {
713
713
  const y = d.cap ? [{ x: d.cap.x - d.cap.radius, y: d.cap.y - d.cap.radius }, { x: d.cap.x + d.cap.radius, y: d.cap.y + d.cap.radius }] : [];
714
- for (const w of [...d.corners, ...y])
715
- r = Math.min(r, w.x), c = Math.min(c, w.y), l = Math.max(l, w.x), h = Math.max(h, w.y);
714
+ for (const b of [...d.corners, ...y])
715
+ r = Math.min(r, b.x), l = Math.min(l, b.y), c = Math.max(c, b.x), h = Math.max(h, b.y);
716
716
  }
717
- if (!(l > r && h > c)) return;
718
- const f = Math.floor(r) - 1, m = Math.floor(c) - 1, u = i ? g(n, Math.ceil(l) + 1 - f, Math.ceil(h) + 1 - m) : null, p = u?.getContext("2d");
717
+ if (!(c > r && h > l)) return;
718
+ const f = Math.floor(r) - 1, m = Math.floor(l) - 1, u = i ? A(n, Math.ceil(c) + 1 - f, Math.ceil(h) + 1 - m) : null, p = u?.getContext("2d");
719
719
  if (!u || !p) {
720
- A(n, e, t);
720
+ k(n, e, t);
721
721
  return;
722
722
  }
723
- p.translate(-f, -m), p.globalCompositeOperation = "lighter", A(p, a, t), n.save(), n.setTransform(1, 0, 0, 1, 0, 0), n.globalAlpha = 1, n.drawImage(u, f, m), n.restore();
723
+ p.translate(-f, -m), p.globalCompositeOperation = "lighter", k(p, a, t), n.save(), n.setTransform(1, 0, 0, 1, 0, 0), n.globalAlpha = 1, n.drawImage(u, f, m), n.restore();
724
+ }
725
+ const he = { x: 0, y: 0, scale: 1, rotate: 0, shakeX: 0, shakeY: 0, shakeRotate: 0 };
726
+ function Ae(n) {
727
+ const e = (t) => {
728
+ const i = n?.get(t);
729
+ return typeof i == "number" ? i : he[t];
730
+ };
731
+ return {
732
+ x: e("x"),
733
+ y: e("y"),
734
+ scale: e("scale"),
735
+ rotate: e("rotate"),
736
+ shakeX: e("shakeX"),
737
+ shakeY: e("shakeY"),
738
+ shakeRotate: e("shakeRotate")
739
+ };
740
+ }
741
+ function ge(n, e, t) {
742
+ const i = t.width / 2, o = t.height / 2, a = 1 + 2 * Math.max(Math.abs(e.shakeX), Math.abs(e.shakeY)) / Math.max(1, Math.min(t.width, t.height));
743
+ n.translate(i + e.x + e.shakeX, o + e.y + e.shakeY), n.rotate((e.rotate + e.shakeRotate) * Math.PI / 180), n.scale(e.scale * a, e.scale * a), n.translate(-i, -o);
724
744
  }
725
- const S = "http://www.w3.org/2000/svg", he = /* @__PURE__ */ new Set([
745
+ function Xe(n, e, t) {
746
+ const i = e.width / 2, o = e.height / 2, s = (n.rotate + n.shakeRotate) * Math.PI / 180, a = (t.x - i) * n.scale, r = (t.y - o) * n.scale;
747
+ return {
748
+ x: i + n.x + n.shakeX + a * Math.cos(s) - r * Math.sin(s),
749
+ y: o + n.y + n.shakeY + a * Math.sin(s) + r * Math.cos(s)
750
+ };
751
+ }
752
+ const v = "http://www.w3.org/2000/svg", fe = /* @__PURE__ */ new Set([
726
753
  "fill",
727
754
  "stroke",
728
755
  "d",
@@ -742,7 +769,7 @@ const S = "http://www.w3.org/2000/svg", he = /* @__PURE__ */ new Set([
742
769
  "height",
743
770
  "viewBox",
744
771
  "preserveAspectRatio"
745
- ]), C = {
772
+ ]), Y = {
746
773
  strokeWidth: "stroke-width",
747
774
  strokeLinecap: "stroke-linecap",
748
775
  strokeLinejoin: "stroke-linejoin",
@@ -753,7 +780,7 @@ const S = "http://www.w3.org/2000/svg", he = /* @__PURE__ */ new Set([
753
780
  strokeOpacity: "stroke-opacity",
754
781
  borderRadius: "rx"
755
782
  // Map CSS borderRadius to SVG rx
756
- }, fe = /* @__PURE__ */ new Set([
783
+ }, ue = /* @__PURE__ */ new Set([
757
784
  "x",
758
785
  // Position x treated as translateX
759
786
  "y",
@@ -774,8 +801,8 @@ const S = "http://www.w3.org/2000/svg", he = /* @__PURE__ */ new Set([
774
801
  "motionPathX",
775
802
  "motionPathY",
776
803
  "motionPathRotate"
777
- ]), ue = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]);
778
- class Ae {
804
+ ]), de = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]);
805
+ class Ee {
779
806
  targets = /* @__PURE__ */ new Map();
780
807
  /**
781
808
  * Register an SVG element as an animation target.
@@ -817,24 +844,24 @@ class Ae {
817
844
  const i = {};
818
845
  let o = null;
819
846
  const s = {}, a = {}, r = {};
820
- let c = !1;
821
- for (const [l, h] of t)
822
- l !== "drawOn" && (fe.has(l) ? i[l] = h : l === "quaternion" ? o = q(h) : l === "originX" || l === "originY" ? typeof h == "number" && (s[l] = h) : l === "perspective" ? typeof h == "number" && (i.perspective = h) : ue.has(l) ? typeof h == "number" && (a[l] = h) : j.has(l) ? (r[l] = h, c = !0) : l === "text" ? typeof h == "string" && Z(e, h) : l === "shine" ? typeof h == "number" && this.applyShine(e, h) : l === "opacity" ? (e.setAttribute("fill-opacity", String(h)), e.setAttribute("stroke-opacity", String(h))) : this.applyAttribute(e, l, h));
847
+ let l = !1;
848
+ for (const [c, h] of t)
849
+ c !== "drawOn" && (ue.has(c) ? i[c] = h : c === "quaternion" ? o = q(h) : c === "originX" || c === "originY" ? typeof h == "number" && (s[c] = h) : c === "perspective" ? typeof h == "number" && (i.perspective = h) : de.has(c) ? typeof h == "number" && (a[c] = h) : j.has(c) ? (r[c] = h, l = !0) : c === "text" ? typeof h == "string" && Z(e, h) : c === "shine" ? typeof h == "number" && this.applyShine(e, h) : c === "opacity" ? (e.setAttribute("fill-opacity", String(h)), e.setAttribute("stroke-opacity", String(h))) : this.applyAttribute(e, c, h));
823
850
  if (Object.keys(i).length > 0 || o) {
824
- const l = this.buildCssTransformString(i, o);
825
- e.style.transform = l, J(e);
851
+ const c = this.buildCssTransformString(i, o);
852
+ e.style.transform = c, J(e);
826
853
  }
827
854
  if (Object.keys(s).length > 0) {
828
- const l = e.style;
829
- l.transformBox = "fill-box", l.transformOrigin = `${s.originX ?? 50}% ${s.originY ?? 50}%`;
855
+ const c = e.style;
856
+ c.transformBox = "fill-box", c.transformOrigin = `${s.originX ?? 50}% ${s.originY ?? 50}%`;
830
857
  }
831
858
  if (Object.keys(a).length > 0) {
832
- const l = a.clipTop ?? 0, h = a.clipRight ?? 0, f = a.clipBottom ?? 0, m = a.clipLeft ?? 0;
833
- e.style.clipPath = `inset(${l}% ${h}% ${f}% ${m}%)`;
859
+ const c = a.clipTop ?? 0, h = a.clipRight ?? 0, f = a.clipBottom ?? 0, m = a.clipLeft ?? 0;
860
+ e.style.clipPath = `inset(${c}% ${h}% ${f}% ${m}%)`;
834
861
  }
835
- if (c) {
836
- const l = B(r);
837
- l && (e.style.filter = l);
862
+ if (l) {
863
+ const c = B(r);
864
+ c && (e.style.filter = c);
838
865
  }
839
866
  }
840
867
  /**
@@ -849,8 +876,8 @@ class Ae {
849
876
  if (a !== void 0 && i.push(`rotate(${a}deg)`), e.rotateX !== void 0 && i.push(`rotateX(${e.rotateX}deg)`), e.rotateY !== void 0 && i.push(`rotateY(${e.rotateY}deg)`), t && i.push(t), e.scale !== void 0)
850
877
  i.push(`scale(${e.scale})`);
851
878
  else if (e.scaleX !== void 0 || e.scaleY !== void 0) {
852
- const r = e.scaleX ?? 1, c = e.scaleY ?? 1;
853
- i.push(`scale(${r}, ${c})`);
879
+ const r = e.scaleX ?? 1, l = e.scaleY ?? 1;
880
+ i.push(`scale(${r}, ${l})`);
854
881
  }
855
882
  return e.skewX !== void 0 && i.push(`skewX(${e.skewX}deg)`), e.skewY !== void 0 && i.push(`skewY(${e.skewY}deg)`), i.join(" ");
856
883
  }
@@ -869,23 +896,23 @@ class Ae {
869
896
  s.dataset.shineBase || (s.dataset.shineBase = e.getAttribute("fill") || "#000000");
870
897
  const a = s.dataset.shineBase;
871
898
  let r = i.querySelector("defs");
872
- r || (r = o.createElementNS(S, "defs"), i.insertBefore(r, i.firstChild));
873
- let c = s.dataset.shineGrad, l = c ? r.querySelector(`#${c}`) : null;
874
- for (l || (c = `tinyfly-shine-${Math.random().toString(36).slice(2, 9)}`, s.dataset.shineGrad = c, l = o.createElementNS(S, "linearGradient"), l.setAttribute("id", c), r.appendChild(l)); l.firstChild; ) l.removeChild(l.firstChild);
875
- for (const h of G(t, a)) {
876
- const f = o.createElementNS(S, "stop");
877
- f.setAttribute("offset", String(h.offset)), f.setAttribute("stop-color", h.color), l.appendChild(f);
899
+ r || (r = o.createElementNS(v, "defs"), i.insertBefore(r, i.firstChild));
900
+ let l = s.dataset.shineGrad, c = l ? r.querySelector(`#${l}`) : null;
901
+ for (c || (l = `tinyfly-shine-${Math.random().toString(36).slice(2, 9)}`, s.dataset.shineGrad = l, c = o.createElementNS(v, "linearGradient"), c.setAttribute("id", l), r.appendChild(c)); c.firstChild; ) c.removeChild(c.firstChild);
902
+ for (const h of D(t, a)) {
903
+ const f = o.createElementNS(v, "stop");
904
+ f.setAttribute("offset", String(h.offset)), f.setAttribute("stop-color", h.color), c.appendChild(f);
878
905
  }
879
- e.setAttribute("fill", `url(#${c})`);
906
+ e.setAttribute("fill", `url(#${l})`);
880
907
  }
881
908
  applyAttribute(e, t, i) {
882
909
  let o = t;
883
- C[t] ? o = C[t] : he.has(t) && (o = t);
910
+ Y[t] ? o = Y[t] : fe.has(t) && (o = t);
884
911
  const s = Array.isArray(i) ? i.join(" ") : String(i);
885
912
  e.setAttribute(o, s);
886
913
  }
887
914
  }
888
- const de = `
915
+ const pe = `
889
916
  attribute vec2 a_position;
890
917
  attribute vec2 a_texCoord;
891
918
  uniform mat4 u_matrix;
@@ -895,7 +922,7 @@ void main() {
895
922
  gl_Position = u_matrix * vec4(a_position, 0.0, 1.0);
896
923
  v_texCoord = a_texCoord;
897
924
  }
898
- `, pe = `
925
+ `, me = `
899
926
  precision mediump float;
900
927
  uniform vec4 u_color;
901
928
  uniform sampler2D u_texture;
@@ -906,7 +933,7 @@ void main() {
906
933
  vec4 color = u_useTexture ? texture2D(u_texture, v_texCoord) : u_color;
907
934
  gl_FragColor = vec4(color.rgb, color.a * u_opacity);
908
935
  }
909
- `, me = /* @__PURE__ */ new Set([
936
+ `, ye = /* @__PURE__ */ new Set([
910
937
  "x",
911
938
  "y",
912
939
  "width",
@@ -927,7 +954,7 @@ void main() {
927
954
  "motionPathY",
928
955
  "motionPathRotate"
929
956
  ]);
930
- class ge {
957
+ class Ye {
931
958
  gl;
932
959
  program;
933
960
  positionBuffer;
@@ -938,7 +965,7 @@ class ge {
938
965
  basePositions = /* @__PURE__ */ new Map();
939
966
  locations;
940
967
  constructor(e) {
941
- this.gl = e, this.program = be(e, de, pe), this.locations = {
968
+ this.gl = e, this.program = we(e, pe, me), this.locations = {
942
969
  position: e.getAttribLocation(this.program, "a_position"),
943
970
  texCoord: e.getAttribLocation(this.program, "a_texCoord"),
944
971
  matrix: e.getUniformLocation(this.program, "u_matrix"),
@@ -986,7 +1013,7 @@ class ge {
986
1013
  e.rotate = o;
987
1014
  return;
988
1015
  }
989
- if (me.has(i)) {
1016
+ if (ye.has(i)) {
990
1017
  e[i] = o;
991
1018
  return;
992
1019
  }
@@ -996,20 +1023,20 @@ class ge {
996
1023
  /** Draw every registered target. */
997
1024
  render() {
998
1025
  const e = this.gl, { width: t, height: i } = e.canvas;
999
- e.viewport(0, 0, t, i), e.clearColor(0, 0, 0, 0), e.clear(e.COLOR_BUFFER_BIT), e.enable(e.BLEND), e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA), e.useProgram(this.program), Y(e, this.positionBuffer, this.locations.position), Y(e, this.texCoordBuffer, this.locations.texCoord);
1026
+ e.viewport(0, 0, t, i), e.clearColor(0, 0, 0, 0), e.clear(e.COLOR_BUFFER_BIT), e.enable(e.BLEND), e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA), e.useProgram(this.program), $(e, this.positionBuffer, this.locations.position), $(e, this.texCoordBuffer, this.locations.texCoord);
1000
1027
  for (const [o, s] of this.targets)
1001
1028
  this.drawTarget(o, s, t, i);
1002
1029
  }
1003
1030
  drawTarget(e, t, i, o) {
1004
1031
  const s = this.gl;
1005
- if (t.backfaceVisibility === "hidden" && O(D(t))) return;
1006
- const a = ye(t, i, o);
1032
+ if (t.backfaceVisibility === "hidden" && O(G(t))) return;
1033
+ const a = be(t, i, o);
1007
1034
  if (s.uniformMatrix4fv(this.locations.matrix, !1, a), s.uniform1f(this.locations.opacity, t.opacity ?? 1), t.texture)
1008
1035
  s.bindTexture(s.TEXTURE_2D, this.textureFor(e, t.texture)), s.uniform1i(this.locations.useTexture, 1), s.uniform1i(this.locations.texture, 0);
1009
1036
  else {
1010
1037
  s.uniform1i(this.locations.useTexture, 0);
1011
- const [r, c, l] = we(t.fill ?? "#ffffff");
1012
- s.uniform4f(this.locations.color, r, c, l, 1);
1038
+ const [r, l, c] = Te(t.fill ?? "#ffffff");
1039
+ s.uniform4f(this.locations.color, r, l, c, 1);
1013
1040
  }
1014
1041
  s.drawArrays(s.TRIANGLES, 0, 6);
1015
1042
  }
@@ -1024,32 +1051,32 @@ class ge {
1024
1051
  this.clearTargets(), this.gl.deleteProgram(this.program), this.gl.deleteBuffer(this.positionBuffer), this.gl.deleteBuffer(this.texCoordBuffer);
1025
1052
  }
1026
1053
  }
1027
- function ke(n, e, t) {
1028
- const i = (n.scale ?? n.scaleX ?? 1) * n.width, o = (n.scale ?? n.scaleY ?? 1) * n.height, s = (n.originX ?? 50) / 100, a = (n.originY ?? 50) / 100, r = (n.rotate ?? 0) * Math.PI / 180, c = Math.cos(r), l = Math.sin(r), h = -s, f = -a, m = c * i, u = l * i, p = -l * o, d = c * o, y = n.x + m * h + p * f, w = n.y + u * h + d * f, v = 2 / e, P = -2 / t;
1054
+ function Ce(n, e, t) {
1055
+ const i = (n.scale ?? n.scaleX ?? 1) * n.width, o = (n.scale ?? n.scaleY ?? 1) * n.height, s = (n.originX ?? 50) / 100, a = (n.originY ?? 50) / 100, r = (n.rotate ?? 0) * Math.PI / 180, l = Math.cos(r), c = Math.sin(r), h = -s, f = -a, m = l * i, u = c * i, p = -c * o, d = l * o, y = n.x + m * h + p * f, b = n.y + u * h + d * f, M = 2 / e, P = -2 / t;
1029
1056
  return new Float32Array([
1030
- m * v,
1057
+ m * M,
1031
1058
  u * P,
1032
1059
  0,
1033
- p * v,
1060
+ p * M,
1034
1061
  d * P,
1035
1062
  0,
1036
- y * v - 1,
1037
- w * P + 1,
1063
+ y * M - 1,
1064
+ b * P + 1,
1038
1065
  1
1039
1066
  ]);
1040
1067
  }
1041
- function D(n) {
1042
- const e = (n.originX ?? 50) / 100, t = (n.originY ?? 50) / 100, i = { x: n.x, y: n.y }, o = b.multiply(
1043
- b.translation([n.x, n.y, 0]),
1044
- b.multiply(b.scaling([n.width, n.height, 1]), b.translation([-e, -t, 0]))
1068
+ function G(n) {
1069
+ const e = (n.originX ?? 50) / 100, t = (n.originY ?? 50) / 100, i = { x: n.x, y: n.y }, o = T.multiply(
1070
+ T.translation([n.x, n.y, 0]),
1071
+ T.multiply(T.scaling([n.width, n.height, 1]), T.translation([-e, -t, 0]))
1045
1072
  );
1046
- return b.multiply(_(n, { x: 0, y: 0 }, i), o);
1073
+ return T.multiply(_(n, { x: 0, y: 0 }, i), o);
1047
1074
  }
1048
- function ye(n, e, t) {
1075
+ function be(n, e, t) {
1049
1076
  const i = [2 / e, 0, 0, 0, 0, -2 / t, 0, 0, 0, 0, 0, 0, -1, 1, 0, 1];
1050
- return new Float32Array(b.multiply(i, D(n)));
1077
+ return new Float32Array(T.multiply(i, G(n)));
1051
1078
  }
1052
- function we(n) {
1079
+ function Te(n) {
1053
1080
  const e = n.trim().replace("#", "");
1054
1081
  return e.length === 3 ? [
1055
1082
  Number.parseInt(e[0] + e[0], 16) / 255,
@@ -1061,14 +1088,14 @@ function we(n) {
1061
1088
  Number.parseInt(e.slice(4, 6), 16) / 255
1062
1089
  ] : [1, 1, 1];
1063
1090
  }
1064
- function be(n, e, t) {
1091
+ function we(n, e, t) {
1065
1092
  const i = n.createProgram();
1066
1093
  if (!i) throw new Error("WebGLAdapter: could not create a program");
1067
- if (n.attachShader(i, $(n, n.VERTEX_SHADER, e)), n.attachShader(i, $(n, n.FRAGMENT_SHADER, t)), n.linkProgram(i), !n.getProgramParameter(i, n.LINK_STATUS))
1094
+ if (n.attachShader(i, C(n, n.VERTEX_SHADER, e)), n.attachShader(i, C(n, n.FRAGMENT_SHADER, t)), n.linkProgram(i), !n.getProgramParameter(i, n.LINK_STATUS))
1068
1095
  throw new Error(`WebGLAdapter: program link failed — ${n.getProgramInfoLog(i)}`);
1069
1096
  return i;
1070
1097
  }
1071
- function $(n, e, t) {
1098
+ function C(n, e, t) {
1072
1099
  const i = n.createShader(e);
1073
1100
  if (!i) throw new Error("WebGLAdapter: could not create a shader");
1074
1101
  if (n.shaderSource(i, t), n.compileShader(i), !n.getShaderParameter(i, n.COMPILE_STATUS))
@@ -1080,34 +1107,38 @@ function I(n, e) {
1080
1107
  if (!t) throw new Error("WebGLAdapter: could not create a buffer");
1081
1108
  return n.bindBuffer(n.ARRAY_BUFFER, t), n.bufferData(n.ARRAY_BUFFER, new Float32Array(e), n.STATIC_DRAW), t;
1082
1109
  }
1083
- function Y(n, e, t) {
1110
+ function $(n, e, t) {
1084
1111
  t < 0 || (n.bindBuffer(n.ARRAY_BUFFER, e), n.enableVertexAttribArray(t), n.vertexAttribPointer(t, 2, n.FLOAT, !1, 0, 0));
1085
1112
  }
1086
1113
  export {
1087
1114
  R as CanvasAdapter,
1088
- Ce as DOMAdapter,
1089
- Ae as SVGAdapter,
1090
- ge as WebGLAdapter,
1091
- xe as applyBloom,
1092
- Ie as boilFrame,
1093
- X as boxBlur,
1115
+ _e as DOMAdapter,
1116
+ he as IDENTITY_CAMERA,
1117
+ Ee as SVGAdapter,
1118
+ Ye as WebGLAdapter,
1119
+ Re as applyBloom,
1120
+ ge as applyCamera,
1121
+ Be as boilFrame,
1122
+ E as boxBlur,
1094
1123
  re as brightPass,
1095
1124
  se as buildFlipTracks,
1096
- g as canvasLike,
1097
- M as drawOutline,
1098
- Re as drawTrail,
1099
- Me as flip,
1100
- Se as isGradient,
1101
- we as parseColor,
1125
+ Ae as cameraFromValues,
1126
+ Xe as cameraPoint,
1127
+ A as canvasLike,
1128
+ S as drawOutline,
1129
+ ke as drawTrail,
1130
+ ve as flip,
1131
+ xe as isGradient,
1132
+ Te as parseColor,
1102
1133
  te as partialPath,
1103
- Ye as pathLength,
1134
+ Le as pathLength,
1104
1135
  x as pathOutline,
1105
- _e as pointAlong,
1106
- ke as quadMatrix,
1107
- ye as quadMatrix3d,
1136
+ Fe as pointAlong,
1137
+ Ce as quadMatrix,
1138
+ be as quadMatrix3d,
1108
1139
  oe as recordFlipState,
1109
1140
  ne as rectOutline,
1110
1141
  Z as setTextContent,
1111
1142
  ie as sketchPen,
1112
- le as trailQuads
1143
+ ce as trailQuads
1113
1144
  };