@algorisys/tinyfly 0.87.0 → 0.89.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.
Files changed (34) hide show
  1. package/README.md +6 -4
  2. package/lib/addons/adapters.js +370 -310
  3. package/lib/addons/characters.js +1878 -1449
  4. package/lib/addons/load-scene-CQvcFWGJ.js +331 -0
  5. package/lib/addons/scene-3d.js +299 -215
  6. package/lib/browser/tinyfly-scene-3d.iife.js +2 -2
  7. package/lib/browser/tinyfly.iife.js +4 -4
  8. package/lib/browser/tinyfly.js +4395 -3858
  9. package/lib/browser/tinyfly.umd.js +4 -4
  10. package/lib/engine/tinyfly-engine.js +155 -106
  11. package/lib/engine/tinyfly-engine.umd.cjs +2 -2
  12. package/lib/headless/headless.js +8 -4
  13. package/lib/types/adapters/canvas/index.d.ts +1 -0
  14. package/lib/types/adapters/canvas/trail.d.ts +57 -0
  15. package/lib/types/browser/index.d.ts +2 -0
  16. package/lib/types/characters/acting/act-tracks.d.ts +28 -0
  17. package/lib/types/characters/acting/acting.d.ts +187 -0
  18. package/lib/types/characters/acting/effects.d.ts +65 -0
  19. package/lib/types/characters/acting/gags.d.ts +54 -0
  20. package/lib/types/characters/acting/index.d.ts +10 -0
  21. package/lib/types/characters/acting/rigs.d.ts +9 -0
  22. package/lib/types/characters/character.d.ts +7 -0
  23. package/lib/types/characters/index.d.ts +1 -0
  24. package/lib/types/characters/stick-figure.d.ts +7 -0
  25. package/lib/types/engine/core/clock.d.ts +7 -0
  26. package/lib/types/engine/path/index.d.ts +2 -0
  27. package/lib/types/engine/path/trail.d.ts +79 -0
  28. package/lib/types/headless/video-scene.d.ts +9 -0
  29. package/lib/types/scene-3d/resolve-scene.d.ts +6 -0
  30. package/lib/types/scene-3d/scene-3d-adapter.d.ts +9 -1
  31. package/lib/types/scene-3d/scene-types.d.ts +40 -1
  32. package/lib/types/scene-3d/strokes.d.ts +30 -0
  33. package/package.json +1 -1
  34. package/lib/addons/load-scene-vp14_Jj-.js +0 -324
@@ -1,115 +1,115 @@
1
- import { h as D, e as C, i as I, a as U, b as W, p as N, t as H, g as V, c as O, q, F as z, s as j, d as Z } from "./dom-adapter-Cphr2HZn.js";
2
- import { D as xe } from "./dom-adapter-Cphr2HZn.js";
3
- import { createTrack as J, parsePath as B, mat4 as T } from "@algorisys/tinyfly";
4
- import { p as K, s as Q } from "./sketch-CYPUbk3Q.js";
5
- import { c as Ae, a as ke, b as Ee } from "./sketch-CYPUbk3Q.js";
6
- function ee(r) {
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";
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";
6
+ function oe(n) {
7
7
  const e = /* @__PURE__ */ new Map();
8
- for (const { name: t, element: i } of r)
9
- e.set(t, g(i));
8
+ for (const { name: t, element: i } of n)
9
+ e.set(t, F(i));
10
10
  return { measurements: e };
11
11
  }
12
- function te(r, e, t = {}) {
13
- const i = t.duration ?? 600, s = t.easing ?? "ease-out", o = t.scale !== !1, a = t.idPrefix ?? "flip", n = [];
12
+ function se(n, e, t = {}) {
13
+ const i = t.duration ?? 600, o = t.easing ?? "ease-out", s = t.scale !== !1, a = t.idPrefix ?? "flip", r = [];
14
14
  for (const { name: c, element: l } of e) {
15
- const h = r.measurements.get(c);
15
+ const h = n.measurements.get(c);
16
16
  if (!h) continue;
17
- const f = g(l), p = h.left + h.width / 2 - (f.left + f.width / 2), u = h.top + h.height / 2 - (f.top + f.height / 2);
18
- if ((p !== 0 || u !== 0) && n.push(
19
- v(`${a}-${c}-x`, c, "x", p, 0, i, s),
20
- v(`${a}-${c}-y`, c, "y", u, 0, i, s)
21
- ), o && f.width > 0 && f.height > 0) {
22
- const d = h.width / f.width, m = h.height / f.height;
23
- d !== 1 && n.push(v(`${a}-${c}-sx`, c, "scaleX", d, 1, i, s)), m !== 1 && n.push(v(`${a}-${c}-sy`, c, "scaleY", m, 1, i, s));
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);
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)
21
+ ), s && f.width > 0 && f.height > 0) {
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));
24
24
  }
25
25
  }
26
- return n;
26
+ return r;
27
27
  }
28
- function ye(r, e, t = {}) {
29
- const i = ee(r);
30
- return e(), te(i, r, t);
28
+ function Me(n, e, t = {}) {
29
+ const i = oe(n);
30
+ return e(), se(i, n, t);
31
31
  }
32
- function v(r, e, t, i, s, o, a) {
33
- return J({
34
- id: r,
32
+ function T(n, e, t, i, o, s, a) {
33
+ return Q({
34
+ id: n,
35
35
  target: e,
36
36
  property: t,
37
37
  keyframes: [
38
38
  { time: 0, value: i },
39
- { time: o, value: s, easing: a }
39
+ { time: s, value: o, easing: a }
40
40
  ]
41
41
  });
42
42
  }
43
- function g(r) {
44
- const e = r;
43
+ function F(n) {
44
+ const e = n;
45
45
  if (typeof e.getBoundingClientRect != "function")
46
46
  return { left: 0, top: 0, width: 0, height: 0 };
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 L(r, e, t = {}) {
51
- const i = t.highlight ?? "#ffffff", s = t.halfWidth ?? 0.12, o = -0.2 + r * 1.4, a = [{ offset: 0, color: e }], n = [
52
- { offset: o - s, color: e },
53
- { offset: o, color: i },
54
- { offset: o + s, color: e }
50
+ function G(n, e, t = {}) {
51
+ const i = t.highlight ?? "#ffffff", o = t.halfWidth ?? 0.12, s = -0.2 + n * 1.4, a = [{ offset: 0, color: e }], r = [
52
+ { offset: s - o, color: e },
53
+ { offset: s, color: i },
54
+ { offset: s + o, color: e }
55
55
  ];
56
- for (const c of n)
56
+ for (const c of r)
57
57
  c.offset > 0 && c.offset < 1 && a.push(c);
58
58
  return a.push({ offset: 1, color: e }), a.sort((c, l) => c.offset - l.offset), a;
59
59
  }
60
- const A = 12;
61
- function x(r) {
60
+ const k = 12;
61
+ function x(n) {
62
62
  const e = [];
63
63
  let t, i = -1;
64
- for (const s of B(r).segments) {
65
- if (s.type === "L") {
66
- (!t || i !== s.subpath) && (t = { kind: "line", points: [{ x: s.startX, y: s.startY }], length: 0 }, i = s.subpath, e.push(t)), t.points.push({ x: s.endX, y: s.endY }), t.length += s.length;
64
+ for (const o of L(n).segments) {
65
+ if (o.type === "L") {
66
+ (!t || i !== o.subpath) && (t = { kind: "line", points: [{ x: o.startX, y: o.startY }], length: 0 }, i = o.subpath, e.push(t)), t.points.push({ x: o.endX, y: o.endY }), t.length += o.length;
67
67
  continue;
68
68
  }
69
69
  t = void 0;
70
- const [o, a, n, c, l, h] = s.points, f = [];
71
- for (let p = 0; p <= A; p++) {
72
- const u = p / A, d = 1 - u;
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;
73
73
  f.push({
74
- x: d * d * d * s.startX + 3 * d * d * u * o + 3 * d * u * u * n + u * u * u * l,
75
- y: d * d * d * s.startY + 3 * d * d * u * a + 3 * d * 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 * l,
75
+ y: p * p * p * o.startY + 3 * p * p * u * a + 3 * p * u * u * c + u * u * u * h
76
76
  });
77
77
  }
78
- e.push({ kind: "curve", points: f, length: s.length });
78
+ e.push({ kind: "curve", points: f, length: o.length });
79
79
  }
80
80
  return e;
81
81
  }
82
- function ie(r, e, t, i, s = 0) {
83
- const o = Math.max(0, Math.min(s, t / 2, i / 2));
84
- if (o === 0) return x(`M${r},${e} H${r + t} V${e + i} H${r} Z`);
85
- const a = r + t, n = e + i;
82
+ function ne(n, e, t, i, o = 0) {
83
+ const s = Math.max(0, Math.min(o, t / 2, i / 2));
84
+ if (s === 0) return x(`M${n},${e} H${n + t} V${e + i} H${n} Z`);
85
+ const a = n + t, r = e + i;
86
86
  return x(
87
- `M${r + o},${e} H${a - o} A${o},${o} 0 0 1 ${a},${e + o} V${n - o} A${o},${o} 0 0 1 ${a - o},${n} H${r + o} A${o},${o} 0 0 1 ${r},${n - o} V${e + o} A${o},${o} 0 0 1 ${r + o},${e} Z`
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 S(r, e, t, i) {
91
- const o = e.reduce((n, c) => n + c.length, 0) * Math.min(1, Math.max(0, t));
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));
92
92
  let a = 0;
93
- i || r.beginPath();
94
- for (const n of e) {
95
- const c = n.length === 0 ? o >= a ? 1 : 0 : Math.min(1, Math.max(0, (o - a) / n.length));
96
- if (a += n.length, i) {
97
- n.kind === "curve" ? i.curve(n.points, c) : i.line(n.points, c);
93
+ i || n.beginPath();
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));
96
+ if (a += r.length, i) {
97
+ r.kind === "curve" ? i.curve(r.points, c) : i.line(r.points, c);
98
98
  continue;
99
99
  }
100
100
  if (c <= 0) continue;
101
- const l = K(n.points, c);
102
- r.moveTo(l[0].x, l[0].y);
103
- for (const h of l.slice(1)) r.lineTo(h.x, h.y);
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);
104
104
  }
105
- i || r.stroke();
105
+ i || n.stroke();
106
106
  }
107
- function F(r, e, t) {
107
+ function g(n, e, t) {
108
108
  if (typeof OffscreenCanvas < "u") return new OffscreenCanvas(e, t);
109
- const i = r.canvas;
109
+ const i = n.canvas;
110
110
  if (i?.ownerDocument) {
111
- const s = i.ownerDocument.createElement("canvas");
112
- return s.width = e, s.height = t, s;
111
+ const o = i.ownerDocument.createElement("canvas");
112
+ return o.width = e, o.height = t, o;
113
113
  }
114
114
  try {
115
115
  return i?.constructor ? new i.constructor(e, t) : null;
@@ -117,8 +117,8 @@ function F(r, e, t) {
117
117
  return null;
118
118
  }
119
119
  }
120
- function we(r) {
121
- return typeof r == "object" && r !== null && "type" in r;
120
+ function Se(n) {
121
+ return typeof n == "object" && n !== null && "type" in n;
122
122
  }
123
123
  class R {
124
124
  targets = /* @__PURE__ */ new Map();
@@ -181,19 +181,19 @@ class R {
181
181
  applyState(e) {
182
182
  this.time = e.currentTime;
183
183
  for (const [t, i] of e.values) {
184
- const s = this.targets.get(t);
185
- if (!s) continue;
186
- const o = this.aliases.get(t) ?? t, a = this.animationOffsets.get(o) ?? { x: 0, y: 0 };
187
- for (const [n, c] of i)
188
- if (R.OFFSET_PROPERTIES.has(n) && typeof c == "number")
189
- n === "x" || n === "motionPathX" ? a.x = c : (n === "y" || n === "motionPathY") && (a.y = c);
190
- else if (s.type === "custom" && s.props && (n in s.props || s.acceptsProp?.(n)))
191
- s.props[n] = c;
184
+ const o = this.targets.get(t);
185
+ if (!o) continue;
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);
190
+ else if (o.type === "custom" && o.props && (r in o.props || o.acceptsProp?.(r)))
191
+ o.props[r] = c;
192
192
  else {
193
- const l = R.PROPERTY_MAP[n] ?? n;
194
- s[l] = c;
193
+ const l = R.PROPERTY_MAP[r] ?? r;
194
+ o[l] = c;
195
195
  }
196
- this.animationOffsets.set(o, a);
196
+ this.animationOffsets.set(s, a);
197
197
  }
198
198
  }
199
199
  /**
@@ -210,32 +210,32 @@ class R {
210
210
  for (const t of this.targetOrder) {
211
211
  const i = this.targets.get(t);
212
212
  if (!i) continue;
213
- const s = this.animationOffsets.get(t) ?? { x: 0, y: 0 };
214
- this.renderTarget(e, i, s);
213
+ const o = this.animationOffsets.get(t) ?? { x: 0, y: 0 };
214
+ this.renderTarget(e, i, o);
215
215
  }
216
216
  }
217
217
  /**
218
218
  * Render a single target.
219
219
  */
220
220
  renderTarget(e, t, i) {
221
- if (e.save(), t.opacity !== void 0 && (e.globalAlpha = t.opacity), D(t)) {
222
- const o = C(t, i, { x: this.getPivotX(t), y: this.getPivotY(t) });
223
- if (t.backfaceVisibility === "hidden" && I(o)) {
221
+ if (e.save(), t.opacity !== void 0 && (e.globalAlpha = t.opacity), U(t)) {
222
+ const s = _(t, i, { x: this.getPivotX(t), y: this.getPivotY(t) });
223
+ if (t.backfaceVisibility === "hidden" && O(s)) {
224
224
  e.restore();
225
225
  return;
226
226
  }
227
- U(o) ? (e.transform(...W(o)), this.drawContent(e, t)) : this.drawInPerspective(e, t, o), e.restore();
227
+ W(s) ? (e.transform(...N(s)), this.drawContent(e, t)) : this.drawInPerspective(e, t, s), e.restore();
228
228
  return;
229
229
  }
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
- const o = this.getPivotX(t), a = this.getPivotY(t);
232
- e.translate(o, a), t.rotate !== void 0 && e.rotate(t.rotate * Math.PI / 180);
233
- let n = 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 && (n *= Math.cos(t.rotateY * Math.PI / 180)), t.scale !== void 0 ? e.scale(t.scale, t.scale) : (n !== 1 || c !== 1) && e.scale(n, c), t.skewX !== void 0 || t.skewY !== void 0) {
231
+ const s = this.getPivotX(t), a = this.getPivotY(t);
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
235
  const l = (t.skewX ?? 0) * Math.PI / 180, h = (t.skewY ?? 0) * Math.PI / 180;
236
236
  e.transform(1, Math.tan(h), Math.tan(l), 1, 0, 0);
237
237
  }
238
- e.translate(-o, -a);
238
+ e.translate(-s, -a);
239
239
  }
240
240
  this.drawContent(e, t), e.restore();
241
241
  }
@@ -245,20 +245,20 @@ class R {
245
245
  * there. The triangles overlap by a pixel so no anti-aliased seam shows.
246
246
  */
247
247
  drawInPerspective(e, t, i) {
248
- const o = e.globalAlpha < 1 ? this.perspectiveLayer(e) : null;
249
- if (o) {
250
- o.ctx.setTransform(e.getTransform()), this.drawMesh(o.ctx, t, i), e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.drawImage(o.canvas, 0, 0), e.restore();
248
+ const s = e.globalAlpha < 1 ? this.perspectiveLayer(e) : null;
249
+ if (s) {
250
+ s.ctx.setTransform(e.getTransform()), this.drawMesh(s.ctx, t, i), e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.drawImage(s.canvas, 0, 0), e.restore();
251
251
  return;
252
252
  }
253
253
  this.drawMesh(e, t, i);
254
254
  }
255
255
  drawMesh(e, t, i) {
256
- const s = this.contentBounds(e, t);
257
- for (const o of N(i, s)) {
258
- const a = H(o.source, o.target);
256
+ const o = this.contentBounds(e, t);
257
+ for (const s of H(i, o)) {
258
+ const a = V(s.source, s.target);
259
259
  if (!a) continue;
260
- const [n, c, l] = V(o.target, 1);
261
- e.save(), e.beginPath(), e.moveTo(n.x, n.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, 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();
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,11 +266,11 @@ 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 o = F(e, t, i), a = o?.getContext("2d");
270
- if (this.layer = o && a ? { canvas: o, ctx: a, width: t, height: i } : null, !this.layer) return null;
269
+ const s = g(e, t, i), a = s?.getContext("2d");
270
+ if (this.layer = s && a ? { canvas: s, ctx: a, width: t, height: i } : null, !this.layer) return null;
271
271
  }
272
- const s = this.layer.ctx;
273
- return s.setTransform(1, 0, 0, 1, 0, 0), s.globalAlpha = 1, s.clearRect(0, 0, t, i), this.layer;
272
+ const o = this.layer.ctx;
273
+ return o.setTransform(1, 0, 0, 1, 0, 0), o.globalAlpha = 1, o.clearRect(0, 0, t, i), this.layer;
274
274
  }
275
275
  /**
276
276
  * Everything a target paints, generously: its box, measured text, a path's
@@ -280,26 +280,26 @@ class R {
280
280
  contentBounds(e, t) {
281
281
  let i = this.getTargetBounds(t);
282
282
  if (t.type === "text") {
283
- const o = t.fontSize ?? 16;
284
- e.save(), e.font = `${t.fontWeight ?? 400} ${o}px ${t.fontFamily ?? "sans-serif"}`;
283
+ const s = t.fontSize ?? 16;
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 n = t.textAlign ?? "left", c = n === "center" ? t.x - a / 2 : n === "right" ? t.x - a : t.x, l = (t.textBaseline ?? "top") === "top" ? t.y : t.y - o;
288
- i = { x: c, y: l, width: a, height: o * 1.4 };
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 };
289
289
  } else if (t.type === "path") {
290
- const o = [], a = [];
291
- for (const n of B(t.d).segments) {
292
- o.push(n.startX, n.endX), a.push(n.startY, n.endY);
293
- for (let c = 0; c + 1 < n.points.length; c += 2)
294
- o.push(n.points[c]), a.push(n.points[c + 1]);
290
+ const s = [], a = [];
291
+ for (const r of L(t.d).segments) {
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]);
295
295
  }
296
- if (o.length > 0) {
297
- const n = Math.min(...o), c = Math.min(...a);
298
- i = { x: t.x + n, y: t.y + c, width: Math.max(...o) - n, height: Math.max(...a) - c };
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 };
299
299
  }
300
300
  }
301
- const s = (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));
302
- return { x: i.x - s, y: i.y - s, width: i.width + 2 * s, height: i.height + 2 * s };
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));
302
+ return { x: i.x - o, y: i.y - o, width: i.width + 2 * o, height: i.height + 2 * o };
303
303
  }
304
304
  /**
305
305
  * Paint a target in the current transform: its fill and stroke styles,
@@ -307,10 +307,10 @@ class R {
307
307
  */
308
308
  drawContent(e, t) {
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
- const i = O(t);
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 s = this.getTargetBounds(t), o = s.x + (t.clipLeft ?? 0) / 100 * s.width, a = s.x + s.width - (t.clipRight ?? 0) / 100 * s.width, n = s.y + (t.clipTop ?? 0) / 100 * s.height, c = s.y + s.height - (t.clipBottom ?? 0) / 100 * s.height;
313
- e.beginPath(), e.rect(o, n, Math.max(0, a - o), Math.max(0, c - n)), 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, 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();
314
314
  }
315
315
  switch (t.type) {
316
316
  case "rect":
@@ -343,26 +343,26 @@ class R {
343
343
  const i = t.fillStyle;
344
344
  if (!i) return "transparent";
345
345
  if (typeof i == "string") return i;
346
- const s = this.getTargetBounds(t);
347
- return i.type === "linear" ? this.createLinearGradient(e, i, s) : this.createRadialGradient(e, i, s);
346
+ const o = this.getTargetBounds(t);
347
+ return i.type === "linear" ? this.createLinearGradient(e, i, o) : this.createRadialGradient(e, i, o);
348
348
  }
349
349
  /**
350
350
  * Create a canvas linear gradient from a LinearGradient definition.
351
351
  */
352
352
  createLinearGradient(e, t, i) {
353
- const s = (t.angle - 90) * (Math.PI / 180), o = i.x + i.width / 2, a = i.y + i.height / 2, n = Math.max(i.width, i.height), c = o - Math.cos(s) * n / 2, l = a - Math.sin(s) * n / 2, h = o + Math.cos(s) * n / 2, f = a + Math.sin(s) * n / 2, p = 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), 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);
354
354
  for (const u of t.stops)
355
- p.addColorStop(u.offset, u.color);
356
- return p;
355
+ m.addColorStop(u.offset, u.color);
356
+ return m;
357
357
  }
358
358
  /**
359
359
  * Create a canvas radial gradient from a RadialGradient definition.
360
360
  */
361
361
  createRadialGradient(e, t, i) {
362
- const s = i.x + i.width * t.centerX, o = i.y + i.height * t.centerY, a = Math.max(i.width, i.height) * t.radius, n = e.createRadialGradient(s, o, 0, s, o, a);
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
363
  for (const c of t.stops)
364
- n.addColorStop(c.offset, c.color);
365
- return n;
364
+ r.addColorStop(c.offset, c.color);
365
+ return r;
366
366
  }
367
367
  /**
368
368
  * Get target bounding box for gradient calculations.
@@ -401,25 +401,25 @@ class R {
401
401
  * Draw a shape outline-first: the fill (clean) once the outline is complete,
402
402
  * then the outline up to `drawOn`, in pencil strokes when sketched.
403
403
  */
404
- renderOutlined(e, t, i, s) {
405
- const o = Math.min(1, Math.max(0, t.drawOn ?? 1));
406
- if (i && t.fillStyle && o >= 1 && i(), !t.strokeStyle || o <= 0) return;
407
- const a = t.sketch ? Q(e, t.sketch, this.time) : void 0;
408
- a && (e.lineCap = t.lineCap ?? "round", e.lineJoin = t.lineJoin ?? "round"), s(o, a);
404
+ renderOutlined(e, t, i, o) {
405
+ const s = Math.min(1, Math.max(0, t.drawOn ?? 1));
406
+ if (i && t.fillStyle && s >= 1 && i(), !t.strokeStyle || s <= 0) return;
407
+ const a = t.sketch ? ie(e, t.sketch, this.time) : void 0;
408
+ a && (e.lineCap = t.lineCap ?? "round", e.lineJoin = t.lineJoin ?? "round"), o(s, a);
409
409
  }
410
410
  /**
411
411
  * Render a rectangle.
412
412
  */
413
413
  renderRect(e, t) {
414
414
  if (this.drawsOutline(t)) {
415
- const { x: i, y: s, width: o, height: a } = t;
415
+ const { x: i, y: o, width: s, height: a } = t;
416
416
  return this.renderOutlined(
417
417
  e,
418
418
  t,
419
419
  () => {
420
- e.beginPath(), t.borderRadius && t.borderRadius > 0 ? this.roundRect(e, i, s, o, a, t.borderRadius) : e.rect(i, s, o, a), e.fill();
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
- (n, c) => S(e, ie(i, s, o, a, t.borderRadius), n, c)
422
+ (r, c) => M(e, ne(i, o, s, a, t.borderRadius), r, c)
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();
@@ -427,25 +427,25 @@ class R {
427
427
  /**
428
428
  * Draw a rounded rectangle path.
429
429
  */
430
- roundRect(e, t, i, s, o, a) {
431
- const n = Math.min(a, s / 2, o / 2);
432
- e.moveTo(t + n, i), e.lineTo(t + s - n, i), e.arcTo(t + s, i, t + s, i + n, n), e.lineTo(t + s, i + o - n), e.arcTo(t + s, i + o, t + s - n, i + o, n), e.lineTo(t + n, i + o), e.arcTo(t, i + o, t, i + o - n, n), e.lineTo(t, i + n), e.arcTo(t, i, t + n, i, n);
430
+ roundRect(e, t, i, o, s, a) {
431
+ const r = Math.min(a, o / 2, s / 2);
432
+ e.moveTo(t + r, i), e.lineTo(t + o - r, i), e.arcTo(t + o, i, t + o, i + r, r), e.lineTo(t + o, i + s - r), e.arcTo(t + o, i + s, t + o - r, i + s, r), e.lineTo(t + r, i + s), e.arcTo(t, i + s, t, i + s - r, r), e.lineTo(t, i + r), e.arcTo(t, i, t + r, i, r);
433
433
  }
434
434
  /**
435
435
  * Render a circle.
436
436
  */
437
437
  renderCircle(e, t) {
438
438
  if (this.drawsOutline(t)) {
439
- const { x: i, y: s, radius: o } = t;
439
+ const { x: i, y: o, radius: s } = t;
440
440
  return this.renderOutlined(
441
441
  e,
442
442
  t,
443
443
  () => {
444
- e.beginPath(), e.arc(i, s, o, 0, Math.PI * 2), e.fill();
444
+ e.beginPath(), e.arc(i, o, s, 0, Math.PI * 2), e.fill();
445
445
  },
446
- (a, n) => {
447
- if (n) return n.circle(i, s, o, a);
448
- e.beginPath(), e.arc(i, s, o, -Math.PI / 2, -Math.PI / 2 + Math.PI * 2 * a), e.stroke();
446
+ (a, r) => {
447
+ if (r) return r.circle(i, o, s, a);
448
+ e.beginPath(), e.arc(i, o, s, -Math.PI / 2, -Math.PI / 2 + Math.PI * 2 * a), e.stroke();
449
449
  }
450
450
  );
451
451
  }
@@ -455,11 +455,11 @@ class R {
455
455
  * Render text.
456
456
  */
457
457
  renderText(e, t) {
458
- const i = t.fontSize ?? 16, s = t.fontFamily ?? "sans-serif", o = t.fontWeight ?? 400;
459
- if (e.font = `${o} ${i}px ${s}`, e.textAlign = t.textAlign ?? "left", e.textBaseline = t.textBaseline ?? "top", t.fillStyle) {
458
+ const i = t.fontSize ?? 16, o = t.fontFamily ?? "sans-serif", s = t.fontWeight ?? 400;
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, n = t.textAlign ?? "left", c = n === "center" ? t.x - a / 2 : n === "right" ? t.x - a : t.x, l = e.createLinearGradient(c, t.y, c + a, t.y);
462
- for (const h of L(t.shine, t.fillStyle))
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
463
  l.addColorStop(h.offset, h.color);
464
464
  e.fillStyle = l;
465
465
  }
@@ -475,12 +475,12 @@ class R {
475
475
  const i = [
476
476
  { x: t.x, y: t.y },
477
477
  { x: t.x2, y: t.y2 }
478
- ], s = Math.hypot(t.x2 - t.x, t.y2 - t.y);
478
+ ], o = Math.hypot(t.x2 - t.x, t.y2 - t.y);
479
479
  return this.renderOutlined(
480
480
  e,
481
481
  t,
482
482
  void 0,
483
- (o, a) => S(e, [{ kind: "line", points: i, length: s }], o, a)
483
+ (s, a) => M(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
- (s, o) => S(e, x(t.d), s, o)
499
+ (o, s) => M(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: s, width: o, height: a } = t, n = t.objectFit ?? "fill", c = t.borderRadius ?? 0, l = t.image, h = l.naturalWidth || l.videoWidth || l.width || o, f = l.naturalHeight || l.videoHeight || l.height || a;
510
- let p = i, u = s, d = o, m = a;
511
- if (n !== "fill" && h > 0 && f > 0) {
512
- const y = n === "cover" ? Math.max(o / h, a / f) : Math.min(o / h, a / f);
513
- d = h * y, m = f * y, p = i + (o - d) / 2, u = s + (a - m) / 2;
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;
510
+ let m = i, u = o, p = s, d = a;
511
+ if (r !== "fill" && h > 0 && f > 0) {
512
+ const y = r === "cover" ? Math.max(s / h, a / f) : Math.min(s / h, a / f);
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, s, o, a, c) : e.rect(i, s, o, a), e.clip(), e.drawImage(t.image, p, u, d, m), e.restore();
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();
516
516
  }
517
517
  /**
518
518
  * Render a custom target by calling its draw function in local coordinates.
@@ -615,56 +615,114 @@ class R {
615
615
  */
616
616
  static loadImage(e) {
617
617
  return new Promise((t, i) => {
618
- const s = new Image();
619
- s.onload = () => t(s), s.onerror = i, s.src = e;
618
+ const o = new Image();
619
+ o.onload = () => t(o), o.onerror = i, o.src = e;
620
620
  });
621
621
  }
622
622
  }
623
- function se(r, e) {
624
- const t = r.length / 4, i = new Float32Array(t * 3), s = Math.min(0.999, Math.max(0, e));
625
- for (let o = 0; o < t; o++) {
626
- const a = r[o * 4] / 255, n = r[o * 4 + 1] / 255, c = r[o * 4 + 2] / 255, l = r[o * 4 + 3] / 255, h = Math.max(a, n, c);
627
- if (h <= s) continue;
628
- const f = (h - s) / (1 - s) * l / h;
629
- i[o * 3] = a * f, i[o * 3 + 1] = n * f, i[o * 3 + 2] = c * f;
623
+ function re(n, e) {
624
+ const t = n.length / 4, i = new Float32Array(t * 3), o = Math.min(0.999, Math.max(0, e));
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);
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;
630
630
  }
631
631
  return i;
632
632
  }
633
- function k(r, e, t, i, s) {
634
- const o = new Float32Array(r.length), a = s ? t : e, n = s ? e : t, c = (h, f) => (s ? h * e + f : f * e + h) * 3, l = i * 2 + 1;
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;
635
635
  for (let h = 0; h < a; h++)
636
636
  for (let f = 0; f < 3; f++) {
637
- let p = 0;
638
- for (let u = -i; u <= i; u++) p += r[c(h, Math.min(n - 1, Math.max(0, u))) + f];
639
- for (let u = 0; u < n; u++) {
640
- o[c(h, u) + f] = p / l;
641
- const d = r[c(h, Math.max(0, u - i)) + f], m = r[c(h, Math.min(n - 1, u + i + 1)) + f];
642
- p += m - d;
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];
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];
642
+ m += d - p;
643
643
  }
644
644
  }
645
- return o;
645
+ return s;
646
646
  }
647
- function E(r, e, t, i) {
648
- const s = Math.max(1, Math.round(i / Math.sqrt(3)));
649
- let o = r;
647
+ function X(n, e, t, i) {
648
+ const o = Math.max(1, Math.round(i / Math.sqrt(3)));
649
+ let s = n;
650
650
  for (let a = 0; a < 3; a++)
651
- o = k(o, e, t, s, !0), o = k(o, e, t, s, !1);
652
- return o;
651
+ s = E(s, e, t, o, !0), s = E(s, e, t, o, !1);
652
+ return s;
653
653
  }
654
- function Te(r, e = {}) {
655
- const t = r.canvas, i = t.width, s = t.height;
656
- if (!(i > 0 && s > 0)) return;
657
- const o = Math.max(1, Math.round(e.downsample ?? 4)), a = Math.max(1, Math.ceil(i / o)), n = Math.max(1, Math.ceil(s / o)), c = F(r, a, n), l = c?.getContext("2d");
654
+ function xe(n, e = {}) {
655
+ const t = n.canvas, i = t.width, o = t.height;
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
658
  if (!c || !l) return;
659
- l.imageSmoothingEnabled = !0, l.drawImage(r.canvas, 0, 0, a, n);
660
- const h = se(l.getImageData(0, 0, a, n).data, e.threshold ?? 0.55), f = (e.radius ?? Math.max(i, s) * 0.02) / o, p = E(h, a, n, f), u = E(h, a, n, f * 3), d = e.halo ?? 0.6, m = l.createImageData(a, n);
661
- for (let y = 0; y < a * n; y++) {
662
- for (let w = 0; w < 3; w++) m.data[y * 4 + w] = Math.round(Math.min(1, p[y * 3 + w] + u[y * 3 + w] * d) * 255);
663
- m.data[y * 4 + 3] = 255;
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);
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);
663
+ d.data[y * 4 + 3] = 255;
664
664
  }
665
- l.putImageData(m, 0, 0), r.save(), r.setTransform(1, 0, 0, 1, 0, 0), r.globalCompositeOperation = "lighter", r.globalAlpha = Math.max(0, e.strength ?? 0.9), r.imageSmoothingEnabled = !0, r.drawImage(c, 0, 0, i, s), r.restore();
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();
666
666
  }
667
- const M = "http://www.w3.org/2000/svg", oe = /* @__PURE__ */ new Set([
667
+ function Re(n, e, t) {
668
+ const i = t.width ?? 6, o = t.taper ?? 1, s = t.fade ?? 1, a = t.opacity ?? 1, r = t.blend === "add";
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);
672
+ }
673
+ const c = e[e.length - 1];
674
+ if (t.head && c && t.head.radius > 0) {
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();
678
+ }
679
+ n.restore();
680
+ }
681
+ function ae(n, e) {
682
+ n.fillStyle = e;
683
+ const t = String(n.fillStyle), i = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i.exec(t);
684
+ if (i) return `rgba(${parseInt(i[1], 16)}, ${parseInt(i[2], 16)}, ${parseInt(i[3], 16)}, 0)`;
685
+ const o = /^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i.exec(t);
686
+ return o ? `rgba(${o[1]}, ${o[2]}, ${o[3]}, 0)` : "rgba(0, 0, 0, 0)";
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);
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 } });
695
+ }
696
+ return c;
697
+ }
698
+ function A(n, e, t) {
699
+ n.fillStyle = t;
700
+ for (const i of e) {
701
+ const [o, s, a, r] = i.corners;
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
+ }
704
+ }
705
+ function ce(n, e, t) {
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
+ ...d,
708
+ corners: d.corners.map(o),
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
+ }));
711
+ let r = 1 / 0, c = 1 / 0, l = -1 / 0, h = -1 / 0;
712
+ for (const d of a) {
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);
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");
719
+ if (!u || !p) {
720
+ A(n, e, t);
721
+ return;
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();
724
+ }
725
+ const S = "http://www.w3.org/2000/svg", he = /* @__PURE__ */ new Set([
668
726
  "fill",
669
727
  "stroke",
670
728
  "d",
@@ -684,7 +742,7 @@ const M = "http://www.w3.org/2000/svg", oe = /* @__PURE__ */ new Set([
684
742
  "height",
685
743
  "viewBox",
686
744
  "preserveAspectRatio"
687
- ]), X = {
745
+ ]), C = {
688
746
  strokeWidth: "stroke-width",
689
747
  strokeLinecap: "stroke-linecap",
690
748
  strokeLinejoin: "stroke-linejoin",
@@ -695,7 +753,7 @@ const M = "http://www.w3.org/2000/svg", oe = /* @__PURE__ */ new Set([
695
753
  strokeOpacity: "stroke-opacity",
696
754
  borderRadius: "rx"
697
755
  // Map CSS borderRadius to SVG rx
698
- }, ne = /* @__PURE__ */ new Set([
756
+ }, fe = /* @__PURE__ */ new Set([
699
757
  "x",
700
758
  // Position x treated as translateX
701
759
  "y",
@@ -716,8 +774,8 @@ const M = "http://www.w3.org/2000/svg", oe = /* @__PURE__ */ new Set([
716
774
  "motionPathX",
717
775
  "motionPathY",
718
776
  "motionPathRotate"
719
- ]), re = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]);
720
- class ve {
777
+ ]), ue = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]);
778
+ class Ae {
721
779
  targets = /* @__PURE__ */ new Map();
722
780
  /**
723
781
  * Register an SVG element as an animation target.
@@ -748,8 +806,8 @@ class ve {
748
806
  */
749
807
  applyState(e) {
750
808
  for (const [t, i] of e.values) {
751
- const s = this.targets.get(t);
752
- s && this.applyProperties(s, i);
809
+ const o = this.targets.get(t);
810
+ o && this.applyProperties(o, i);
753
811
  }
754
812
  }
755
813
  /**
@@ -757,25 +815,25 @@ class ve {
757
815
  */
758
816
  applyProperties(e, t) {
759
817
  const i = {};
760
- let s = null;
761
- const o = {}, a = {}, n = {};
818
+ let o = null;
819
+ const s = {}, a = {}, r = {};
762
820
  let c = !1;
763
821
  for (const [l, h] of t)
764
- l !== "drawOn" && (ne.has(l) ? i[l] = h : l === "quaternion" ? s = q(h) : l === "originX" || l === "originY" ? typeof h == "number" && (o[l] = h) : l === "perspective" ? typeof h == "number" && (i.perspective = h) : re.has(l) ? typeof h == "number" && (a[l] = h) : z.has(l) ? (n[l] = h, c = !0) : l === "text" ? typeof h == "string" && j(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));
765
- if (Object.keys(i).length > 0 || s) {
766
- const l = this.buildCssTransformString(i, s);
767
- e.style.transform = l, Z(e);
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));
823
+ if (Object.keys(i).length > 0 || o) {
824
+ const l = this.buildCssTransformString(i, o);
825
+ e.style.transform = l, J(e);
768
826
  }
769
- if (Object.keys(o).length > 0) {
827
+ if (Object.keys(s).length > 0) {
770
828
  const l = e.style;
771
- l.transformBox = "fill-box", l.transformOrigin = `${o.originX ?? 50}% ${o.originY ?? 50}%`;
829
+ l.transformBox = "fill-box", l.transformOrigin = `${s.originX ?? 50}% ${s.originY ?? 50}%`;
772
830
  }
773
831
  if (Object.keys(a).length > 0) {
774
- const l = a.clipTop ?? 0, h = a.clipRight ?? 0, f = a.clipBottom ?? 0, p = a.clipLeft ?? 0;
775
- e.style.clipPath = `inset(${l}% ${h}% ${f}% ${p}%)`;
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}%)`;
776
834
  }
777
835
  if (c) {
778
- const l = O(n);
836
+ const l = B(r);
779
837
  l && (e.style.filter = l);
780
838
  }
781
839
  }
@@ -785,14 +843,14 @@ class ve {
785
843
  buildCssTransformString(e, t = null) {
786
844
  const i = [];
787
845
  e.perspective !== void 0 && e.perspective > 0 && i.push(`perspective(${e.perspective}px)`);
788
- const s = e.motionPathX ?? e.x ?? e.translateX, o = e.motionPathY ?? e.y ?? e.translateY;
789
- e.z !== void 0 ? i.push(`translate3d(${s ?? 0}px, ${o ?? 0}px, ${e.z}px)`) : (s !== void 0 || o !== void 0) && i.push(`translate(${s ?? 0}px, ${o ?? 0}px)`);
846
+ const o = e.motionPathX ?? e.x ?? e.translateX, s = e.motionPathY ?? e.y ?? e.translateY;
847
+ e.z !== void 0 ? i.push(`translate3d(${o ?? 0}px, ${s ?? 0}px, ${e.z}px)`) : (o !== void 0 || s !== void 0) && i.push(`translate(${o ?? 0}px, ${s ?? 0}px)`);
790
848
  const a = e.motionPathRotate ?? e.rotate ?? e.rotateZ;
791
849
  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)
792
850
  i.push(`scale(${e.scale})`);
793
851
  else if (e.scaleX !== void 0 || e.scaleY !== void 0) {
794
- const n = e.scaleX ?? 1, c = e.scaleY ?? 1;
795
- i.push(`scale(${n}, ${c})`);
852
+ const r = e.scaleX ?? 1, c = e.scaleY ?? 1;
853
+ i.push(`scale(${r}, ${c})`);
796
854
  }
797
855
  return e.skewX !== void 0 && i.push(`skewX(${e.skewX}deg)`), e.skewY !== void 0 && i.push(`skewY(${e.skewY}deg)`), i.join(" ");
798
856
  }
@@ -805,29 +863,29 @@ class ve {
805
863
  * gradient lives in the owner SVG's <defs> and is reused across frames.
806
864
  */
807
865
  applyShine(e, t) {
808
- const i = e.ownerSVGElement, s = e.ownerDocument;
809
- if (!i || !s) return;
810
- const o = e;
811
- o.dataset.shineBase || (o.dataset.shineBase = e.getAttribute("fill") || "#000000");
812
- const a = o.dataset.shineBase;
813
- let n = i.querySelector("defs");
814
- n || (n = s.createElementNS(M, "defs"), i.insertBefore(n, i.firstChild));
815
- let c = o.dataset.shineGrad, l = c ? n.querySelector(`#${c}`) : null;
816
- for (l || (c = `tinyfly-shine-${Math.random().toString(36).slice(2, 9)}`, o.dataset.shineGrad = c, l = s.createElementNS(M, "linearGradient"), l.setAttribute("id", c), n.appendChild(l)); l.firstChild; ) l.removeChild(l.firstChild);
817
- for (const h of L(t, a)) {
818
- const f = s.createElementNS(M, "stop");
866
+ const i = e.ownerSVGElement, o = e.ownerDocument;
867
+ if (!i || !o) return;
868
+ const s = e;
869
+ s.dataset.shineBase || (s.dataset.shineBase = e.getAttribute("fill") || "#000000");
870
+ const a = s.dataset.shineBase;
871
+ 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");
819
877
  f.setAttribute("offset", String(h.offset)), f.setAttribute("stop-color", h.color), l.appendChild(f);
820
878
  }
821
879
  e.setAttribute("fill", `url(#${c})`);
822
880
  }
823
881
  applyAttribute(e, t, i) {
824
- let s = t;
825
- X[t] ? s = X[t] : oe.has(t) && (s = t);
826
- const o = Array.isArray(i) ? i.join(" ") : String(i);
827
- e.setAttribute(s, o);
882
+ let o = t;
883
+ C[t] ? o = C[t] : he.has(t) && (o = t);
884
+ const s = Array.isArray(i) ? i.join(" ") : String(i);
885
+ e.setAttribute(o, s);
828
886
  }
829
887
  }
830
- const ae = `
888
+ const de = `
831
889
  attribute vec2 a_position;
832
890
  attribute vec2 a_texCoord;
833
891
  uniform mat4 u_matrix;
@@ -837,7 +895,7 @@ void main() {
837
895
  gl_Position = u_matrix * vec4(a_position, 0.0, 1.0);
838
896
  v_texCoord = a_texCoord;
839
897
  }
840
- `, ce = `
898
+ `, pe = `
841
899
  precision mediump float;
842
900
  uniform vec4 u_color;
843
901
  uniform sampler2D u_texture;
@@ -848,7 +906,7 @@ void main() {
848
906
  vec4 color = u_useTexture ? texture2D(u_texture, v_texCoord) : u_color;
849
907
  gl_FragColor = vec4(color.rgb, color.a * u_opacity);
850
908
  }
851
- `, le = /* @__PURE__ */ new Set([
909
+ `, me = /* @__PURE__ */ new Set([
852
910
  "x",
853
911
  "y",
854
912
  "width",
@@ -869,7 +927,7 @@ void main() {
869
927
  "motionPathY",
870
928
  "motionPathRotate"
871
929
  ]);
872
- class be {
930
+ class ge {
873
931
  gl;
874
932
  program;
875
933
  positionBuffer;
@@ -880,7 +938,7 @@ class be {
880
938
  basePositions = /* @__PURE__ */ new Map();
881
939
  locations;
882
940
  constructor(e) {
883
- this.gl = e, this.program = ue(e, ae, ce), this.locations = {
941
+ this.gl = e, this.program = be(e, de, pe), this.locations = {
884
942
  position: e.getAttribLocation(this.program, "a_position"),
885
943
  texCoord: e.getAttribLocation(this.program, "a_texCoord"),
886
944
  matrix: e.getUniformLocation(this.program, "u_matrix"),
@@ -888,7 +946,7 @@ class be {
888
946
  texture: e.getUniformLocation(this.program, "u_texture"),
889
947
  useTexture: e.getUniformLocation(this.program, "u_useTexture"),
890
948
  opacity: e.getUniformLocation(this.program, "u_opacity")
891
- }, this.positionBuffer = Y(e, [0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]), this.texCoordBuffer = Y(e, [0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]);
949
+ }, this.positionBuffer = I(e, [0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]), this.texCoordBuffer = I(e, [0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]);
892
950
  }
893
951
  registerTarget(e, t) {
894
952
  this.targets.set(e, t), this.basePositions.set(e, { x: t.x, y: t.y });
@@ -907,92 +965,92 @@ class be {
907
965
  /** Apply engine state to the registered targets. */
908
966
  applyState(e) {
909
967
  for (const [t, i] of e.values) {
910
- const s = this.targets.get(t);
911
- if (!s) continue;
912
- const o = this.basePositions.get(t) ?? { x: 0, y: 0 };
913
- for (const [a, n] of i)
914
- this.applyProperty(s, o, a, n);
968
+ const o = this.targets.get(t);
969
+ if (!o) continue;
970
+ const s = this.basePositions.get(t) ?? { x: 0, y: 0 };
971
+ for (const [a, r] of i)
972
+ this.applyProperty(o, s, a, r);
915
973
  }
916
974
  }
917
- applyProperty(e, t, i, s) {
918
- if (typeof s == "number") {
975
+ applyProperty(e, t, i, o) {
976
+ if (typeof o == "number") {
919
977
  if (i === "x" || i === "motionPathX") {
920
- e.x = t.x + s;
978
+ e.x = t.x + o;
921
979
  return;
922
980
  }
923
981
  if (i === "y" || i === "motionPathY") {
924
- e.y = t.y + s;
982
+ e.y = t.y + o;
925
983
  return;
926
984
  }
927
985
  if (i === "rotateZ" || i === "motionPathRotate") {
928
- e.rotate = s;
986
+ e.rotate = o;
929
987
  return;
930
988
  }
931
- if (le.has(i)) {
932
- e[i] = s;
989
+ if (me.has(i)) {
990
+ e[i] = o;
933
991
  return;
934
992
  }
935
993
  }
936
- typeof s == "string" && i === "fill" && (e.fill = s), i === "quaternion" && Array.isArray(s) && (e.quaternion = s);
994
+ typeof o == "string" && i === "fill" && (e.fill = o), i === "quaternion" && Array.isArray(o) && (e.quaternion = o);
937
995
  }
938
996
  /** Draw every registered target. */
939
997
  render() {
940
998
  const e = this.gl, { width: t, height: i } = e.canvas;
941
- 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);
942
- for (const [s, o] of this.targets)
943
- this.drawTarget(s, o, t, i);
944
- }
945
- drawTarget(e, t, i, s) {
946
- const o = this.gl;
947
- if (t.backfaceVisibility === "hidden" && I(G(t))) return;
948
- const a = he(t, i, s);
949
- if (o.uniformMatrix4fv(this.locations.matrix, !1, a), o.uniform1f(this.locations.opacity, t.opacity ?? 1), t.texture)
950
- o.bindTexture(o.TEXTURE_2D, this.textureFor(e, t.texture)), o.uniform1i(this.locations.useTexture, 1), o.uniform1i(this.locations.texture, 0);
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);
1000
+ for (const [o, s] of this.targets)
1001
+ this.drawTarget(o, s, t, i);
1002
+ }
1003
+ drawTarget(e, t, i, o) {
1004
+ const s = this.gl;
1005
+ if (t.backfaceVisibility === "hidden" && O(D(t))) return;
1006
+ const a = ye(t, i, o);
1007
+ if (s.uniformMatrix4fv(this.locations.matrix, !1, a), s.uniform1f(this.locations.opacity, t.opacity ?? 1), t.texture)
1008
+ s.bindTexture(s.TEXTURE_2D, this.textureFor(e, t.texture)), s.uniform1i(this.locations.useTexture, 1), s.uniform1i(this.locations.texture, 0);
951
1009
  else {
952
- o.uniform1i(this.locations.useTexture, 0);
953
- const [n, c, l] = fe(t.fill ?? "#ffffff");
954
- o.uniform4f(this.locations.color, n, c, l, 1);
1010
+ 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);
955
1013
  }
956
- o.drawArrays(o.TRIANGLES, 0, 6);
1014
+ s.drawArrays(s.TRIANGLES, 0, 6);
957
1015
  }
958
1016
  textureFor(e, t) {
959
1017
  const i = this.textures.get(e);
960
1018
  if (i) return i;
961
- const s = this.gl, o = s.createTexture();
962
- return s.bindTexture(s.TEXTURE_2D, o), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_S, s.CLAMP_TO_EDGE), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_T, s.CLAMP_TO_EDGE), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MIN_FILTER, s.LINEAR), s.texImage2D(s.TEXTURE_2D, 0, s.RGBA, s.RGBA, s.UNSIGNED_BYTE, t), this.textures.set(e, o), o;
1019
+ const o = this.gl, s = o.createTexture();
1020
+ return o.bindTexture(o.TEXTURE_2D, s), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_WRAP_S, o.CLAMP_TO_EDGE), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_WRAP_T, o.CLAMP_TO_EDGE), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_MIN_FILTER, o.LINEAR), o.texImage2D(o.TEXTURE_2D, 0, o.RGBA, o.RGBA, o.UNSIGNED_BYTE, t), this.textures.set(e, s), s;
963
1021
  }
964
1022
  /** Release GL resources. */
965
1023
  destroy() {
966
1024
  this.clearTargets(), this.gl.deleteProgram(this.program), this.gl.deleteBuffer(this.positionBuffer), this.gl.deleteBuffer(this.texCoordBuffer);
967
1025
  }
968
1026
  }
969
- function Pe(r, e, t) {
970
- const i = (r.scale ?? r.scaleX ?? 1) * r.width, s = (r.scale ?? r.scaleY ?? 1) * r.height, o = (r.originX ?? 50) / 100, a = (r.originY ?? 50) / 100, n = (r.rotate ?? 0) * Math.PI / 180, c = Math.cos(n), l = Math.sin(n), h = -o, f = -a, p = c * i, u = l * i, d = -l * s, m = c * s, y = r.x + p * h + d * f, w = r.y + u * h + m * f, b = 2 / e, P = -2 / t;
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;
971
1029
  return new Float32Array([
972
- p * b,
1030
+ m * v,
973
1031
  u * P,
974
1032
  0,
975
- d * b,
976
- m * P,
1033
+ p * v,
1034
+ d * P,
977
1035
  0,
978
- y * b - 1,
1036
+ y * v - 1,
979
1037
  w * P + 1,
980
1038
  1
981
1039
  ]);
982
1040
  }
983
- function G(r) {
984
- const e = (r.originX ?? 50) / 100, t = (r.originY ?? 50) / 100, i = { x: r.x, y: r.y }, s = T.multiply(
985
- T.translation([r.x, r.y, 0]),
986
- T.multiply(T.scaling([r.width, r.height, 1]), T.translation([-e, -t, 0]))
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]))
987
1045
  );
988
- return T.multiply(C(r, { x: 0, y: 0 }, i), s);
1046
+ return b.multiply(_(n, { x: 0, y: 0 }, i), o);
989
1047
  }
990
- function he(r, e, t) {
1048
+ function ye(n, e, t) {
991
1049
  const i = [2 / e, 0, 0, 0, 0, -2 / t, 0, 0, 0, 0, 0, 0, -1, 1, 0, 1];
992
- return new Float32Array(T.multiply(i, G(r)));
1050
+ return new Float32Array(b.multiply(i, D(n)));
993
1051
  }
994
- function fe(r) {
995
- const e = r.trim().replace("#", "");
1052
+ function we(n) {
1053
+ const e = n.trim().replace("#", "");
996
1054
  return e.length === 3 ? [
997
1055
  Number.parseInt(e[0] + e[0], 16) / 255,
998
1056
  Number.parseInt(e[1] + e[1], 16) / 255,
@@ -1003,51 +1061,53 @@ function fe(r) {
1003
1061
  Number.parseInt(e.slice(4, 6), 16) / 255
1004
1062
  ] : [1, 1, 1];
1005
1063
  }
1006
- function ue(r, e, t) {
1007
- const i = r.createProgram();
1064
+ function be(n, e, t) {
1065
+ const i = n.createProgram();
1008
1066
  if (!i) throw new Error("WebGLAdapter: could not create a program");
1009
- if (r.attachShader(i, _(r, r.VERTEX_SHADER, e)), r.attachShader(i, _(r, r.FRAGMENT_SHADER, t)), r.linkProgram(i), !r.getProgramParameter(i, r.LINK_STATUS))
1010
- throw new Error(`WebGLAdapter: program link failed — ${r.getProgramInfoLog(i)}`);
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))
1068
+ throw new Error(`WebGLAdapter: program link failed — ${n.getProgramInfoLog(i)}`);
1011
1069
  return i;
1012
1070
  }
1013
- function _(r, e, t) {
1014
- const i = r.createShader(e);
1071
+ function $(n, e, t) {
1072
+ const i = n.createShader(e);
1015
1073
  if (!i) throw new Error("WebGLAdapter: could not create a shader");
1016
- if (r.shaderSource(i, t), r.compileShader(i), !r.getShaderParameter(i, r.COMPILE_STATUS))
1017
- throw new Error(`WebGLAdapter: shader compile failed — ${r.getShaderInfoLog(i)}`);
1074
+ if (n.shaderSource(i, t), n.compileShader(i), !n.getShaderParameter(i, n.COMPILE_STATUS))
1075
+ throw new Error(`WebGLAdapter: shader compile failed — ${n.getShaderInfoLog(i)}`);
1018
1076
  return i;
1019
1077
  }
1020
- function Y(r, e) {
1021
- const t = r.createBuffer();
1078
+ function I(n, e) {
1079
+ const t = n.createBuffer();
1022
1080
  if (!t) throw new Error("WebGLAdapter: could not create a buffer");
1023
- return r.bindBuffer(r.ARRAY_BUFFER, t), r.bufferData(r.ARRAY_BUFFER, new Float32Array(e), r.STATIC_DRAW), t;
1081
+ return n.bindBuffer(n.ARRAY_BUFFER, t), n.bufferData(n.ARRAY_BUFFER, new Float32Array(e), n.STATIC_DRAW), t;
1024
1082
  }
1025
- function $(r, e, t) {
1026
- t < 0 || (r.bindBuffer(r.ARRAY_BUFFER, e), r.enableVertexAttribArray(t), r.vertexAttribPointer(t, 2, r.FLOAT, !1, 0, 0));
1083
+ function Y(n, e, t) {
1084
+ t < 0 || (n.bindBuffer(n.ARRAY_BUFFER, e), n.enableVertexAttribArray(t), n.vertexAttribPointer(t, 2, n.FLOAT, !1, 0, 0));
1027
1085
  }
1028
1086
  export {
1029
1087
  R as CanvasAdapter,
1030
- xe as DOMAdapter,
1031
- ve as SVGAdapter,
1032
- be as WebGLAdapter,
1033
- Te as applyBloom,
1034
- Ae as boilFrame,
1035
- E as boxBlur,
1036
- se as brightPass,
1037
- te as buildFlipTracks,
1038
- F as canvasLike,
1039
- S as drawOutline,
1040
- ye as flip,
1041
- we as isGradient,
1042
- fe as parseColor,
1043
- K as partialPath,
1044
- ke as pathLength,
1088
+ Ce as DOMAdapter,
1089
+ Ae as SVGAdapter,
1090
+ ge as WebGLAdapter,
1091
+ xe as applyBloom,
1092
+ Ie as boilFrame,
1093
+ X as boxBlur,
1094
+ re as brightPass,
1095
+ 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,
1102
+ te as partialPath,
1103
+ Ye as pathLength,
1045
1104
  x as pathOutline,
1046
- Ee as pointAlong,
1047
- Pe as quadMatrix,
1048
- he as quadMatrix3d,
1049
- ee as recordFlipState,
1050
- ie as rectOutline,
1051
- j as setTextContent,
1052
- Q as sketchPen
1105
+ _e as pointAlong,
1106
+ ke as quadMatrix,
1107
+ ye as quadMatrix3d,
1108
+ oe as recordFlipState,
1109
+ ne as rectOutline,
1110
+ Z as setTextContent,
1111
+ ie as sketchPen,
1112
+ le as trailQuads
1053
1113
  };