pixi-effects 0.49.0 → 0.50.1

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 (83) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +9 -8
  3. package/ai/CHAT.md +1 -1
  4. package/ai/chat-template.html +11 -5
  5. package/ai/tools/check.mjs +6 -6
  6. package/dist/3d.cjs +18 -13
  7. package/dist/3d.cjs.map +1 -1
  8. package/dist/3d.d.cts +3 -1
  9. package/dist/3d.d.ts +3 -1
  10. package/dist/3d.js +10 -5
  11. package/dist/3d.js.map +1 -1
  12. package/dist/Composition-5SBIDTBB.cjs +17 -0
  13. package/dist/{Composition-464AWDV6.cjs.map → Composition-5SBIDTBB.cjs.map} +1 -1
  14. package/dist/Composition-7D6ERUVY.js +8 -0
  15. package/dist/{Composition-5U63LMPX.js.map → Composition-7D6ERUVY.js.map} +1 -1
  16. package/dist/Controller.d.cts +2 -2
  17. package/dist/Controller.d.ts +2 -2
  18. package/dist/{Movie-BxB7bauG.d.cts → Movie-DogzDBuW.d.cts} +20 -5
  19. package/dist/{Movie-6EWOz6Yw.d.ts → Movie-Y7iHg2V8.d.ts} +20 -5
  20. package/dist/{Spans-DUR2W5EH.cjs → Spans-OBNYI6LJ.cjs} +12 -11
  21. package/dist/Spans-OBNYI6LJ.cjs.map +1 -0
  22. package/dist/{Spans-W5VJRMGC.js → Spans-WRQPIDPO.js} +7 -6
  23. package/dist/Spans-WRQPIDPO.js.map +1 -0
  24. package/dist/{blendModes-NC76DNVX.cjs → blendModes-2IDILRN6.cjs} +5 -5
  25. package/dist/{blendModes-NC76DNVX.cjs.map → blendModes-2IDILRN6.cjs.map} +1 -1
  26. package/dist/{blendModes-ZOBLPSR3.js → blendModes-4QH44GOL.js} +4 -4
  27. package/dist/{blendModes-ZOBLPSR3.js.map → blendModes-4QH44GOL.js.map} +1 -1
  28. package/dist/{chunk-PBMDZT2T.js → chunk-24MVJFW4.js} +40 -74
  29. package/dist/chunk-24MVJFW4.js.map +1 -0
  30. package/dist/{chunk-GUDLIAIG.cjs → chunk-2DC6TRJI.cjs} +83 -117
  31. package/dist/chunk-2DC6TRJI.cjs.map +1 -0
  32. package/dist/{chunk-BSFWVTSR.cjs → chunk-2VMLNKHT.cjs} +92 -92
  33. package/dist/{chunk-BSFWVTSR.cjs.map → chunk-2VMLNKHT.cjs.map} +1 -1
  34. package/dist/{chunk-ABWRISRK.cjs → chunk-3FCDRLW3.cjs} +4 -3
  35. package/dist/chunk-3FCDRLW3.cjs.map +1 -0
  36. package/dist/{chunk-MXACRKAN.js → chunk-C2HL5236.js} +4 -4
  37. package/dist/{chunk-MXACRKAN.js.map → chunk-C2HL5236.js.map} +1 -1
  38. package/dist/{chunk-5YNME6AH.cjs → chunk-GXGIISFS.cjs} +5 -5
  39. package/dist/{chunk-5YNME6AH.cjs.map → chunk-GXGIISFS.cjs.map} +1 -1
  40. package/dist/{chunk-H363KMJR.js → chunk-J4ZP76IL.js} +4 -3
  41. package/dist/chunk-J4ZP76IL.js.map +1 -0
  42. package/dist/{chunk-33USHRV5.cjs → chunk-NXMNBFHM.cjs} +567 -39
  43. package/dist/chunk-NXMNBFHM.cjs.map +1 -0
  44. package/dist/{chunk-USUUAYTE.js → chunk-OI75LGIB.js} +5 -5
  45. package/dist/{chunk-USUUAYTE.js.map → chunk-OI75LGIB.js.map} +1 -1
  46. package/dist/{chunk-DOGY3EAW.js → chunk-SC7EWGHB.js} +543 -17
  47. package/dist/chunk-SC7EWGHB.js.map +1 -0
  48. package/dist/index.cjs +39 -39
  49. package/dist/index.d.cts +3 -3
  50. package/dist/index.d.ts +3 -3
  51. package/dist/index.js +5 -5
  52. package/dist/loader.css +1 -1
  53. package/dist/present.cjs +5 -5
  54. package/dist/present.d.cts +2 -2
  55. package/dist/present.d.ts +2 -2
  56. package/dist/present.js +5 -5
  57. package/dist/three.cjs +15 -9
  58. package/dist/three.cjs.map +1 -1
  59. package/dist/three.d.cts +5 -1
  60. package/dist/three.d.ts +5 -1
  61. package/dist/three.js +10 -4
  62. package/dist/three.js.map +1 -1
  63. package/dist/{types-kt7DQKfO.d.cts → types-BZngm4nT.d.cts} +48 -5
  64. package/dist/{types-kt7DQKfO.d.ts → types-BZngm4nT.d.ts} +48 -5
  65. package/docs/api.md +14 -1
  66. package/docs/dsl.md +39 -3
  67. package/llms-full.txt +107 -6
  68. package/package.json +1 -1
  69. package/skills/pixi-effects/SKILL.md +4 -2
  70. package/skills/pixi-effects/reference/cheatsheet.md +2 -0
  71. package/skills/pixi-effects/reference/pitfalls.md +6 -0
  72. package/skills/pixi-effects/reference/recipes.md +42 -0
  73. package/skills/pixi-effects/template.html +15 -8
  74. package/dist/Composition-464AWDV6.cjs +0 -16
  75. package/dist/Composition-5U63LMPX.js +0 -7
  76. package/dist/Spans-DUR2W5EH.cjs.map +0 -1
  77. package/dist/Spans-W5VJRMGC.js.map +0 -1
  78. package/dist/chunk-33USHRV5.cjs.map +0 -1
  79. package/dist/chunk-ABWRISRK.cjs.map +0 -1
  80. package/dist/chunk-DOGY3EAW.js.map +0 -1
  81. package/dist/chunk-GUDLIAIG.cjs.map +0 -1
  82. package/dist/chunk-H363KMJR.js.map +0 -1
  83. package/dist/chunk-PBMDZT2T.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkBSFWVTSR_cjs = require('./chunk-BSFWVTSR.cjs');
3
+ var chunk2VMLNKHT_cjs = require('./chunk-2VMLNKHT.cjs');
4
+ var chunkNXMNBFHM_cjs = require('./chunk-NXMNBFHM.cjs');
4
5
  var chunkVQXZ2NOI_cjs = require('./chunk-VQXZ2NOI.cjs');
5
- var chunk33USHRV5_cjs = require('./chunk-33USHRV5.cjs');
6
6
  var chunkZAHCGFGC_cjs = require('./chunk-ZAHCGFGC.cjs');
7
- var chunk5YNME6AH_cjs = require('./chunk-5YNME6AH.cjs');
8
- var chunkABWRISRK_cjs = require('./chunk-ABWRISRK.cjs');
7
+ var chunkGXGIISFS_cjs = require('./chunk-GXGIISFS.cjs');
8
+ var chunk3FCDRLW3_cjs = require('./chunk-3FCDRLW3.cjs');
9
9
  var chunkDOLTCXCL_cjs = require('./chunk-DOLTCXCL.cjs');
10
10
  var pixi_js = require('pixi.js');
11
11
 
@@ -24,63 +24,6 @@ function sharedGpuOf(renderer) {
24
24
  }
25
25
  };
26
26
  }
27
- var registered = false;
28
- function ensureLoadersRegistered(audioContext) {
29
- if (registered) return;
30
- registered = true;
31
- pixi_js.extensions.add({
32
- extension: { type: pixi_js.ExtensionType.LoadParser, name: "pixi-effects-audio" },
33
- test: (url) => /\.(mp3|wav|ogg)$/i.test(url),
34
- async load(url) {
35
- const res = await fetch(url);
36
- if (!res.ok) throw new Error(`pixi-effects: failed to load ${url}: ${res.statusText}`);
37
- const buffer = await res.arrayBuffer();
38
- const audioBuffer = await audioContext.decodeAudioData(buffer);
39
- return { audioBuffer, duration: audioBuffer.duration };
40
- }
41
- });
42
- pixi_js.extensions.add({
43
- extension: { type: pixi_js.ExtensionType.LoadParser, name: "pixi-effects-video", priority: 1 },
44
- test: (url) => /\.(mp4|webm|mov|mkv)$/i.test(url),
45
- async load(url) {
46
- const [M, blob] = await Promise.all([chunkVQXZ2NOI_cjs.loadMediabunny(), fetch(url).then((r) => r.blob())]);
47
- const { Input, BlobSource, ALL_FORMATS, Output, WavOutputFormat, BufferTarget, Conversion, VideoSampleSink } = M;
48
- const input = new Input({ source: new BlobSource(blob), formats: ALL_FORMATS });
49
- const videoTrack = await input.getPrimaryVideoTrack();
50
- if (!videoTrack || !await videoTrack.canDecode()) {
51
- throw new Error("pixi-effects: video track cannot be decoded");
52
- }
53
- const audioTrack = await input.getPrimaryAudioTrack();
54
- const videoDuration = await videoTrack.computeDuration();
55
- const audioDuration = audioTrack ? await audioTrack.computeDuration() : 0;
56
- let audioBuffer = null;
57
- if (audioTrack) {
58
- try {
59
- const out = new Output({ format: new WavOutputFormat(), target: new BufferTarget() });
60
- const conv = await Conversion.init({ input, output: out, video: { discard: true } });
61
- await conv.execute();
62
- audioBuffer = await audioContext.decodeAudioData(out.target.buffer);
63
- } catch (e) {
64
- console.warn("pixi-effects: audio extraction failed:", e);
65
- }
66
- }
67
- return {
68
- videoTrack,
69
- audioBuffer,
70
- videoDuration,
71
- audioDuration,
72
- duration: Math.max(videoDuration, audioDuration),
73
- sink: new VideoSampleSink(videoTrack)
74
- };
75
- }
76
- });
77
- }
78
- async function loadAssetBundle(assets, audioContext, onProgress) {
79
- ensureLoadersRegistered(audioContext);
80
- const bundle = assets.map((a) => ({ alias: a.name, src: a.src }));
81
- pixi_js.Assets.addBundle("pixi-effects", bundle);
82
- return await pixi_js.Assets.loadBundle("pixi-effects", onProgress);
83
- }
84
27
 
85
28
  // src/core/AudioMixer.ts
86
29
  async function mixdown(audios, totalDuration, sampleRate = 44100, pace) {
@@ -1268,8 +1211,8 @@ function expandTransitions(spec) {
1268
1211
  }
1269
1212
  const transitions = out.transitions;
1270
1213
  const sequences = out.sequences ?? [];
1271
- const remap = out.duration !== void 0 ? chunk33USHRV5_cjs.timeRemapOf(out) : null;
1272
- const parentDuration = remap ? chunk33USHRV5_cjs.contentLength(remap, out.duration) : out.duration ?? Infinity;
1214
+ const remap = out.duration !== void 0 ? chunkNXMNBFHM_cjs.timeRemapOf(out) : null;
1215
+ const parentDuration = remap ? chunkNXMNBFHM_cjs.contentLength(remap, out.duration) : out.duration ?? Infinity;
1273
1216
  const compW = out.width;
1274
1217
  const compH = out.height;
1275
1218
  const threeDByName = new Set(sequences.filter((s) => s.name && s.threeD).map((s) => s.name));
@@ -1337,16 +1280,16 @@ function expandTransitions(spec) {
1337
1280
  if (toUses > 1) {
1338
1281
  throw new Error(`pixi-effects: ${tag} sequence "${t.to}" is used as \`to\` in more than one transition`);
1339
1282
  }
1340
- const tStart = chunk33USHRV5_cjs.resolveAt(t.at, parentDuration);
1283
+ const tStart = chunkNXMNBFHM_cjs.resolveAt(t.at, parentDuration);
1341
1284
  const tEnd = tStart + t.duration;
1342
1285
  const fromSeq = fromEntry.seq;
1343
- const fromStart = chunk33USHRV5_cjs.resolveAt(fromSeq.at, parentDuration);
1286
+ const fromStart = chunkNXMNBFHM_cjs.resolveAt(fromSeq.at, parentDuration);
1344
1287
  const fromEnd = fromStart + (fromSeq.duration ?? parentDuration);
1345
1288
  if (tStart < fromStart - EPS || tEnd > fromEnd + EPS) {
1346
1289
  throw new Error(`pixi-effects: ${tag} window [${tStart}, ${tEnd}] is not covered by \`from\` "${t.from}" (lives [${fromStart}, ${fromEnd}], so it ends at ${fromEnd})`);
1347
1290
  }
1348
1291
  const toSeq = toEntry.seq;
1349
- const toStart = chunk33USHRV5_cjs.resolveAt(toSeq.at, parentDuration);
1292
+ const toStart = chunkNXMNBFHM_cjs.resolveAt(toSeq.at, parentDuration);
1350
1293
  const toEnd = toStart + (toSeq.duration ?? parentDuration);
1351
1294
  if (tStart < toStart - EPS || tEnd > toEnd + EPS) {
1352
1295
  throw new Error(`pixi-effects: ${tag} window [${tStart}, ${tEnd}] is not covered by \`to\` "${t.to}" (lives [${toStart}, ${toEnd}], so it starts at ${toStart})`);
@@ -1406,7 +1349,7 @@ function wrapAsFullComposition(seq, compW, compH) {
1406
1349
  delete inner.at;
1407
1350
  delete inner.duration;
1408
1351
  const m = inner.mask;
1409
- const carriesMatte = m !== void 0 && chunkBSFWVTSR_cjs.maskSourceOf(m).kind === "refs";
1352
+ const carriesMatte = m !== void 0 && chunk2VMLNKHT_cjs.maskSourceOf(m).kind === "refs";
1410
1353
  if (carriesMatte) delete inner.mask;
1411
1354
  return {
1412
1355
  ...carriesMatte ? { mask: m } : {},
@@ -1671,14 +1614,14 @@ function canvasReport(root) {
1671
1614
  const length = seq.duration ?? 0;
1672
1615
  const moments = [0.15, 0.4, 0.65, 0.9].map((f) => Math.round(f * length * 1e3) / 1e3);
1673
1616
  const { differs, drawMs, threw } = seq.checkDeterminism(moments);
1674
- const name = chunkABWRISRK_cjs.describeLayer(seq.spec);
1617
+ const name = chunk3FCDRLW3_cjs.describeLayer(seq.spec);
1675
1618
  const type = seq.spec.type;
1676
- const kind = type === "three" ? "three" : type === "scene3d" ? "scene3d" : "canvas";
1619
+ const kind = type === "three" ? "three" : type === "scene3d" ? "scene3d" : type === "scene2d" ? "scene2d" : "canvas";
1677
1620
  const drawn = kind === "canvas" ? "draw threw" : "update or render threw";
1678
- const problem = threw.length ? `${name} could not draw at ${threw.map((t) => `${t} s`).join(", ")} (its ${drawn}, or the layer failed to build): ${kind === "canvas" ? "it shows a magenta checkerboard there; the warning above says why" : "the warning above says why"}, so the layer cannot be called deterministic` : differs.length ? `${name} does not draw the same picture for the same time (checked at ${differs.map(describeDiff).join(", ")}; drawn in two orders after one draw that was thrown away): ` + (kind === "three" ? "usually its update uses Math.random, Date.now, a clock, or state that builds up from call to call: a mixer advanced with mixer.update(dt) is one (pose a clip with mixer.setTime(t), or threeGltf(url).pose(t)), and so is a value moved by the time since the last call. A skinned model of your own (not loaded by threeGltf) that moves and casts a shadow does it too: three culls a skinned mesh by a bounding sphere that does not follow it, so set mesh.frustumCulled = false. Set every object from t, so playback, a seek and an export agree" : kind === "scene3d" ? "usually its update keeps state from call to call (a value moved by the time since the last call), uses Math.random or a clock, or a model's player or a particle system runs on its own clock (pose a clip with model.player.getState(name).gotoAndStop(t)), or a MotionBlurEffect reads the camera of the frame drawn before. Set every object from t, so playback, a seek and an export agree" : "usually its draw uses Math.random, Date.now or state that outlives the call (a value it keeps from the last call), so playback, a seek and an export would not agree: use info.random() (seeded) and derive everything from t. If it uses none of these, look at the canvases it draws from: make sprites and masks with info.canvas(w, h) (not document.createElement) and draw them into the picture before the strokes that depend on them") : "";
1621
+ const problem = threw.length ? `${name} could not draw at ${threw.map((t) => `${t} s`).join(", ")} (its ${drawn}, or the layer failed to build): ${kind === "canvas" ? "it shows a magenta checkerboard there; the warning above says why" : "the warning above says why"}, so the layer cannot be called deterministic` : differs.length ? `${name} does not draw the same picture for the same time (checked at ${differs.map(describeDiff).join(", ")}; drawn in two orders after one draw that was thrown away): ` + (kind === "three" ? "usually its update uses Math.random, Date.now, a clock, or state that builds up from call to call: a mixer advanced with mixer.update(dt) is one (pose a clip with mixer.setTime(t), or threeGltf(url).pose(t)), and so is a value moved by the time since the last call. A skinned model of your own (not loaded by threeGltf) that moves and casts a shadow does it too: three culls a skinned mesh by a bounding sphere that does not follow it, so set mesh.frustumCulled = false. Set every object from t, so playback, a seek and an export agree" : kind === "scene3d" ? "usually its update keeps state from call to call (a value moved by the time since the last call), uses Math.random or a clock, or a model's player or a particle system runs on its own clock (pose a clip with model.player.getState(name).gotoAndStop(t)), or a MotionBlurEffect reads the camera of the frame drawn before. Set every object from t, so playback, a seek and an export agree" : kind === "scene2d" ? "usually its update keeps state from call to call (a value moved by the time since the last call, a position added to instead of set), uses Math.random or a clock, or something runs on PixiJS's ticker (a Ticker.shared.add of your own, a video texture). Set every object from t, so playback, a seek and an export agree" : "usually its draw uses Math.random, Date.now or state that outlives the call (a value it keeps from the last call), so playback, a seek and an export would not agree: use info.random() (seeded) and derive everything from t. If it uses none of these, look at the canvases it draws from: make sprites and masks with info.canvas(w, h) (not document.createElement) and draw them into the picture before the strokes that depend on them") : "";
1679
1622
  out.push({ name: seq.spec.name ?? name, moments, drawMs, ok: !differs.length && !threw.length, problem, kind });
1680
1623
  }
1681
- if (seq instanceof chunkBSFWVTSR_cjs.CompositionSequence) walk3(seq);
1624
+ if (seq instanceof chunk2VMLNKHT_cjs.CompositionSequence) walk3(seq);
1682
1625
  };
1683
1626
  const walk3 = (comp) => {
1684
1627
  for (const { seq } of comp.layers()) {
@@ -1730,8 +1673,8 @@ function motionOf(keyframes, local, lives, keys = (k) => GEOMETRY.has(k)) {
1730
1673
  let length = 0;
1731
1674
  if (typeof kf.duration === "number") length = kf.duration;
1732
1675
  else if (kf.duration === "auto") {
1733
- const sp = chunk33USHRV5_cjs.parseSpring(kf.ease);
1734
- length = sp ? Math.round(chunk33USHRV5_cjs.springDuration(sp) * 1e3) / 1e3 : 0.5;
1676
+ const sp = chunkNXMNBFHM_cjs.parseSpring(kf.ease);
1677
+ length = sp ? Math.round(chunkNXMNBFHM_cjs.springDuration(sp) * 1e3) / 1e3 : 0.5;
1735
1678
  }
1736
1679
  if (!(length > 0)) continue;
1737
1680
  const kat = kf.at ?? 0;
@@ -1811,7 +1754,7 @@ function inspectScene(root, frame, time, canvas, opts = {}) {
1811
1754
  if (motion.ever) hasMotion.add(info);
1812
1755
  let shown = bounds ? clip(bounds, view) : null;
1813
1756
  const maskTarget = seq.maskSequence?.target;
1814
- const maskSrc = chunkBSFWVTSR_cjs.maskSourceOf(seq.spec.mask);
1757
+ const maskSrc = chunk2VMLNKHT_cjs.maskSourceOf(seq.spec.mask);
1815
1758
  if (shown && maskTarget && !(maskSrc.kind === "inline" && maskSrc.invert)) {
1816
1759
  const m = maskTarget.getBounds();
1817
1760
  shown = clip(shown, { x: m.x, y: m.y, width: m.width, height: m.height });
@@ -1820,7 +1763,7 @@ function inspectScene(root, frame, time, canvas, opts = {}) {
1820
1763
  const group = parentScene ?? (name !== void 0 && blending.has(name) ? name : void 0);
1821
1764
  if (group) scene.set(info, group);
1822
1765
  if (zero || seq.showsNothingYet) scaledToNothing.add(info);
1823
- if (seq instanceof chunkBSFWVTSR_cjs.CompositionSequence) walk3(seq, prefix + label + "/", insideThreeD || threeD, visible, group, motion, zero, parentAlpha * alpha);
1766
+ if (seq instanceof chunk2VMLNKHT_cjs.CompositionSequence) walk3(seq, prefix + label + "/", insideThreeD || threeD, visible, group, motion, zero, parentAlpha * alpha);
1824
1767
  });
1825
1768
  };
1826
1769
  walk3(root, "", false, true);
@@ -1992,12 +1935,12 @@ function pickScene(root, x, y, opts = {}, deps = {}) {
1992
1935
  const alive = (threeD ? d.visible : (t?.renderable ?? true) && t?.visible !== false) && carriers.every((c) => c.target?.renderable ?? true);
1993
1936
  const visible = parentVisible && alive && alpha > 0;
1994
1937
  if (!visible) {
1995
- if (seq instanceof chunkBSFWVTSR_cjs.CompositionSequence && !threeD && parentVisible && alpha > 0 && t?.visible === false && (t?.renderable ?? true) && carriers.every((c) => c.target?.renderable ?? true)) hiddenSources.set(seq, path);
1938
+ if (seq instanceof chunk2VMLNKHT_cjs.CompositionSequence && !threeD && parentVisible && alpha > 0 && t?.visible === false && (t?.renderable ?? true) && carriers.every((c) => c.target?.renderable ?? true)) hiddenSources.set(seq, path);
1996
1939
  return;
1997
1940
  }
1998
- const isComposition = seq instanceof chunkBSFWVTSR_cjs.CompositionSequence;
1941
+ const isComposition = seq instanceof chunk2VMLNKHT_cjs.CompositionSequence;
1999
1942
  if (isComposition && !threeD) {
2000
- const gm = seq.maskSequence?.target, gs = chunkBSFWVTSR_cjs.maskSourceOf(seq.spec.mask);
1943
+ const gm = seq.maskSequence?.target, gs = chunk2VMLNKHT_cjs.maskSourceOf(seq.spec.mask);
2001
1944
  if (gm && gs.kind === "inline" && !gs.invert && !inMask(gm, at)) return;
2002
1945
  walk3(seq, path + "/", visible, at, orderBase, via);
2003
1946
  return;
@@ -2011,7 +1954,14 @@ function pickScene(root, x, y, opts = {}, deps = {}) {
2011
1954
  }
2012
1955
  const point = at;
2013
1956
  let hit = null;
2014
- if (threeD) {
1957
+ const scene2d = seq.pick2d;
1958
+ if (typeof scene2d === "function" && !threeD) {
1959
+ const found2 = scene2d.call(seq, point);
1960
+ if (found2) {
1961
+ const s2 = seq;
1962
+ hit = { name, path, type: seq.spec.type, kind: "scene2d", point, scene2d: { object: found2.object, node: found2.node, point: found2.point, grab: () => ({ move: s2.dragFrom(found2.node, point) }) } };
1963
+ }
1964
+ } else if (threeD) {
2015
1965
  if (quad && pointInQuad(quad, d.toLocal(point).x, d.toLocal(point).y)) hit = { name, path, type: seq.spec.type, kind: "card", point };
2016
1966
  } else {
2017
1967
  const local = d.toLocal(point);
@@ -2054,7 +2004,7 @@ function pickScene(root, x, y, opts = {}, deps = {}) {
2054
2004
  }
2055
2005
  if (!hit) return;
2056
2006
  const maskTarget = seq.maskSequence?.target;
2057
- const maskSrc = chunkBSFWVTSR_cjs.maskSourceOf(seq.spec.mask);
2007
+ const maskSrc = chunk2VMLNKHT_cjs.maskSourceOf(seq.spec.mask);
2058
2008
  if (maskTarget && !(maskSrc.kind === "inline" && maskSrc.invert) && !(maskSrc.kind === "inline" ? inMask(maskTarget, point) : inside(maskTarget.getBounds(), point))) return;
2059
2009
  found.push({ hit: via ? { ...hit, point: { x, y }, via } : hit, order: orderBase ? [...orderBase, ...orderOf(d)] : orderOf(d) });
2060
2010
  });
@@ -2064,7 +2014,7 @@ function pickScene(root, x, y, opts = {}, deps = {}) {
2064
2014
  const path = hiddenSources.get(f.source);
2065
2015
  if (path === void 0) continue;
2066
2016
  const g = f.source.target.toGlobal({ x: f.at.x * f.source.intrinsicWidth, y: f.at.y * f.source.intrinsicHeight });
2067
- const sm = f.source.maskSequence?.target, ss = chunkBSFWVTSR_cjs.maskSourceOf(f.source.spec.mask);
2017
+ const sm = f.source.maskSequence?.target, ss = chunk2VMLNKHT_cjs.maskSourceOf(f.source.spec.mask);
2068
2018
  if (sm && ss.kind === "inline" && !ss.invert && !inMask(sm, g)) continue;
2069
2019
  walk3(f.source, path + "/", true, g, f.order, f.via);
2070
2020
  }
@@ -2100,7 +2050,7 @@ function walk(root, visit) {
2100
2050
  visit(seq);
2101
2051
  const mask = seq.maskSequence;
2102
2052
  if (mask) visit(mask);
2103
- if (seq instanceof chunkBSFWVTSR_cjs.CompositionSequence) walk(seq, visit);
2053
+ if (seq instanceof chunk2VMLNKHT_cjs.CompositionSequence) walk(seq, visit);
2104
2054
  }
2105
2055
  }
2106
2056
  function reusePoolOf(old) {
@@ -2110,12 +2060,26 @@ function reusePoolOf(old) {
2110
2060
  const key = seq.reuseKey();
2111
2061
  if (key !== null) free.set(key, [...free.get(key) ?? [], seq]);
2112
2062
  });
2113
- return { claim: (key) => free.get(key)?.shift() ?? null };
2063
+ const borrowers = [];
2064
+ return {
2065
+ claim: (key, by) => {
2066
+ const d = free.get(key)?.shift() ?? null;
2067
+ if (d && by) borrowers.push(by);
2068
+ return d;
2069
+ },
2070
+ borrowers
2071
+ };
2114
2072
  }
2115
- function commitReuse(root) {
2116
- walk(root, (seq) => {
2117
- if (borrower(seq)) seq.commitReuse();
2118
- });
2073
+ function commitReuse(root, pool) {
2074
+ const done = /* @__PURE__ */ new Set();
2075
+ const commit = (seq) => {
2076
+ if (!done.has(seq) && borrower(seq)) {
2077
+ done.add(seq);
2078
+ seq.commitReuse();
2079
+ }
2080
+ };
2081
+ walk(root, commit);
2082
+ for (const seq of pool?.borrowers ?? []) commit(seq);
2119
2083
  }
2120
2084
 
2121
2085
  // src/core/hover.ts
@@ -2201,7 +2165,7 @@ var round = (n) => Math.round(n * 1e6) / 1e6;
2201
2165
  var family = (name) => name.replace(/\d+/g, "#");
2202
2166
  function detailOf(seq) {
2203
2167
  const s = seq.spec;
2204
- const spans = chunk33USHRV5_cjs.spansMeta.get(seq.spec)?.preview;
2168
+ const spans = chunkNXMNBFHM_cjs.spansMeta.get(seq.spec)?.preview;
2205
2169
  if (spans) return spans.length > 60 ? spans.slice(0, 57) + "\u2026" : spans;
2206
2170
  if (typeof s.text === "string") return s.text.length > 60 ? s.text.slice(0, 57) + "\u2026" : s.text;
2207
2171
  if (typeof s.asset === "string") return `asset \u201C${s.asset}\u201D`;
@@ -2217,10 +2181,10 @@ function walk2(comp, parentStart, parentEnd, depth, prefix, rows, transitions, l
2217
2181
  const start = parentStart + (seq.at ?? 0);
2218
2182
  const end = Math.min(parentEnd, seq.duration !== void 0 ? start + seq.duration : parentEnd);
2219
2183
  const span = end - start;
2220
- const keys = (seq.spec.keyframes ?? []).map((kf) => round(start + chunk33USHRV5_cjs.resolveAt(kf.at, span))).sort((a, b) => a - b).slice(0, MAX_KEYS);
2184
+ const keys = (seq.spec.keyframes ?? []).map((kf) => round(start + chunkNXMNBFHM_cjs.resolveAt(kf.at, span))).sort((a, b) => a - b).slice(0, MAX_KEYS);
2221
2185
  const row = { path: prefix + name, name, type: seq.spec.type, depth, start: round(start), end: round(end), keys, detail: detailOf(seq), ...local ? { local } : {} };
2222
2186
  const inner = [];
2223
- const isComp = seq instanceof chunkBSFWVTSR_cjs.CompositionSequence;
2187
+ const isComp = seq instanceof chunk2VMLNKHT_cjs.CompositionSequence;
2224
2188
  if (isComp) {
2225
2189
  const label = seq.remapLabel();
2226
2190
  walk2(seq, label ? 0 : start, label ? seq.contentSpan : end, depth + 1, prefix + name + "/", inner, transitions, label ? `${name} ${label}` : local);
@@ -2379,7 +2343,7 @@ function sheetLayout(n, columns, cellW, srcW, srcH, labelH) {
2379
2343
  }
2380
2344
 
2381
2345
  // src/core/vars.ts
2382
- var RESERVED_NAMES = ["w", "h", "W", "H", "GW", "GH", "t", "d", "T", "contain", "cover", "value", ...chunk33USHRV5_cjs.EXPRESSION_NAMES];
2346
+ var RESERVED_NAMES = ["w", "h", "W", "H", "GW", "GH", "t", "d", "T", "contain", "cover", "value", ...chunkNXMNBFHM_cjs.EXPRESSION_NAMES];
2383
2347
  var NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
2384
2348
  var isPlain = (v) => !!v && typeof v === "object" && (Object.getPrototypeOf(v) === Object.prototype || Object.getPrototypeOf(v) === null);
2385
2349
  function normalizeVars(raw, where, warn = (m) => console.warn(m)) {
@@ -2923,8 +2887,8 @@ var Movie = class {
2923
2887
  this.stops = normalizeStops(applyVars(options.composition, this._vars)?.stops, this.duration, this.frameRate);
2924
2888
  this._posterFrame = poster.frame;
2925
2889
  this.background = options.background ?? "#000000";
2926
- this.timeline = chunk33USHRV5_cjs.createTimeline({ paused: true, defaults: { ease: "none" } });
2927
- chunk33USHRV5_cjs.lengthen(this.timeline, this.duration);
2890
+ this.timeline = chunkNXMNBFHM_cjs.createTimeline({ paused: true, defaults: { ease: "none" } });
2891
+ chunkNXMNBFHM_cjs.lengthen(this.timeline, this.duration);
2928
2892
  const baseAppOptions = {
2929
2893
  width: this.width,
2930
2894
  height: this.height,
@@ -2960,7 +2924,7 @@ var Movie = class {
2960
2924
  const assetCount = (options.assets ?? []).length;
2961
2925
  lp.begin("assets", assetCount);
2962
2926
  let assetsSeen = 0;
2963
- await loadAssetBundle(options.assets ?? [], audioContext, (p) => {
2927
+ await chunkNXMNBFHM_cjs.loadAssetBundle(options.assets ?? [], audioContext, (p) => {
2964
2928
  const n = Math.round(p * assetCount);
2965
2929
  if (n > assetsSeen) {
2966
2930
  lp.tick(n - assetsSeen);
@@ -3024,8 +2988,8 @@ var Movie = class {
3024
2988
  height: sizeWins ? height : spec.height ?? height,
3025
2989
  duration: spec.duration ?? this.duration
3026
2990
  } : void 0;
3027
- await chunk33USHRV5_cjs.ensureFilterLibrary(seededComposition);
3028
- if (chunk5YNME6AH_cjs.usesAdvancedBlend(seededComposition)) await chunk5YNME6AH_cjs.enableAdvancedBlend(this.app.renderer);
2991
+ await chunkNXMNBFHM_cjs.ensureFilterLibrary(seededComposition);
2992
+ if (chunkGXGIISFS_cjs.usesAdvancedBlend(seededComposition)) await chunkGXGIISFS_cjs.enableAdvancedBlend(this.app.renderer);
3029
2993
  const userComposition = seededComposition ? expandTransitions(seededComposition) : void 0;
3030
2994
  const rootSeqSpec = {
3031
2995
  type: "composition",
@@ -3035,7 +2999,7 @@ var Movie = class {
3035
2999
  ...userComposition
3036
3000
  };
3037
3001
  if (userComposition) carryTransitionWindows(userComposition, rootSeqSpec);
3038
- const sequence = new chunkBSFWVTSR_cjs.CompositionSequence(rootSeqSpec, null, rootShape);
3002
+ const sequence = new chunk2VMLNKHT_cjs.CompositionSequence(rootSeqSpec, null, rootShape);
3039
3003
  lp?.begin("build", countLayers(rootSeqSpec));
3040
3004
  try {
3041
3005
  await sequence.build();
@@ -3143,6 +3107,7 @@ var Movie = class {
3143
3107
  if (!root || !app) throw new Error("pixi-effects: movie.rebuild() needs a ready movie \u2014 await movie.init(...) first");
3144
3108
  const who = `movie.${reason === "vars" ? "setVars" : "rebuild"}()`;
3145
3109
  let sequence = null;
3110
+ let reusePool = null;
3146
3111
  const alive = () => {
3147
3112
  if (this._initState !== "ready") throw new Error("pixi-effects: the movie was destroyed while it was being rebuilt");
3148
3113
  };
@@ -3172,10 +3137,11 @@ var Movie = class {
3172
3137
  if (change.composition !== void 0) for (const w of lintVars(change.composition, vars)) console.warn(w);
3173
3138
  changed = changed || sizeChanged || change.composition !== void 0 || reason === "rebuild";
3174
3139
  if (!changed) return { reason, ms: 0, audio: "none", frame: this.currentFrame, playing: this.isPlaying, unchanged: true };
3175
- sequence = await this._construct(composition, vars, width, height, void 0, this._resized || sizeChanged, reusePoolOf(this._rootSequence));
3140
+ reusePool = reusePoolOf(this._rootSequence);
3141
+ sequence = await this._construct(composition, vars, width, height, void 0, this._resized || sizeChanged, reusePool);
3176
3142
  alive();
3177
- const timeline = chunk33USHRV5_cjs.createTimeline({ paused: true, defaults: { ease: "none" } });
3178
- chunk33USHRV5_cjs.lengthen(timeline, this.duration);
3143
+ const timeline = chunkNXMNBFHM_cjs.createTimeline({ paused: true, defaults: { ease: "none" } });
3144
+ chunkNXMNBFHM_cjs.lengthen(timeline, this.duration);
3179
3145
  sequence.bindTimeline(timeline);
3180
3146
  const hadSound = this.audioBuffer !== null;
3181
3147
  const audio = await this._mixSound(sequence, this._ensureAudioContext());
@@ -3212,7 +3178,7 @@ var Movie = class {
3212
3178
  if (old?.target) root.removeChild(old.target);
3213
3179
  if (sequence.target) root.addChild(sequence.target);
3214
3180
  this._rootSequence = sequence;
3215
- commitReuse(sequence);
3181
+ commitReuse(sequence, reusePool);
3216
3182
  this.timeline = timeline;
3217
3183
  this._timeFilters = collectTimeFilters(sequence);
3218
3184
  const loud = quietUnbind();
@@ -3974,7 +3940,7 @@ function countLayers(spec) {
3974
3940
  n += 1 + countLayers(s);
3975
3941
  const spans = s.spans;
3976
3942
  if (Array.isArray(spans)) n += spans.length;
3977
- const src = chunkBSFWVTSR_cjs.maskSourceOf(mask);
3943
+ const src = chunk2VMLNKHT_cjs.maskSourceOf(mask);
3978
3944
  if (src.kind === "inline") n += 1 + countLayers(src.spec);
3979
3945
  }
3980
3946
  return n;
@@ -4063,8 +4029,8 @@ function splitVertical(text, style, ts, right, top, align, by) {
4063
4029
 
4064
4030
  // src/presets/_ease.ts
4065
4031
  function parseEase2(name) {
4066
- chunk33USHRV5_cjs.checkEase(name, "a preset");
4067
- return chunk33USHRV5_cjs.parseEase(name);
4032
+ chunkNXMNBFHM_cjs.checkEase(name, "a preset");
4033
+ return chunkNXMNBFHM_cjs.parseEase(name);
4068
4034
  }
4069
4035
 
4070
4036
  // src/presets/kenBurns.ts
@@ -4199,17 +4165,17 @@ function orbit(opts) {
4199
4165
  throw new Error("pixi-effects: orbit() cannot combine `radius` with `dollyZoom` \u2014 the radius follows the animated fov");
4200
4166
  }
4201
4167
  const [cx, cy] = opts.center ?? [width / 2, height / 2];
4202
- const fixedR = opts.radius ?? chunk33USHRV5_cjs.homeDistance(height, fov ?? chunk33USHRV5_cjs.DEFAULT_FOV);
4168
+ const fixedR = opts.radius ?? chunkNXMNBFHM_cjs.homeDistance(height, fov ?? chunkNXMNBFHM_cjs.DEFAULT_FOV);
4203
4169
  const start = opts.start ?? -degrees / 2;
4204
4170
  const steps = Math.max(1, Math.round(duration * stepsPerSecond));
4205
4171
  const easeFn = parseEase2(ease);
4206
4172
  const dollyEase = dolly ? parseEase2(dolly.ease ?? ease) : null;
4207
4173
  const pos = (i) => {
4208
4174
  const p = i / steps;
4209
- const a = (start + degrees * easeFn(p)) * chunk33USHRV5_cjs.DEG;
4175
+ const a = (start + degrees * easeFn(p)) * chunkNXMNBFHM_cjs.DEG;
4210
4176
  if (!dolly) return { x: cx + fixedR * Math.sin(a), z: fixedR * Math.cos(a) };
4211
4177
  const f = dolly.from + (dolly.to - dolly.from) * dollyEase(p);
4212
- const R = chunk33USHRV5_cjs.homeDistance(height, f);
4178
+ const R = chunkNXMNBFHM_cjs.homeDistance(height, f);
4213
4179
  return { x: cx + R * Math.sin(a), z: R * Math.cos(a), fov: f };
4214
4180
  };
4215
4181
  const keyframes = [];
@@ -4264,7 +4230,7 @@ function particles(opts) {
4264
4230
  const round2 = (v) => Math.round(v * 1e6) / 1e6;
4265
4231
  const out = [];
4266
4232
  for (let i = 0; i < count; i++) {
4267
- const r = chunk33USHRV5_cjs.random(seed * 1000003 + i * 7919 + 17);
4233
+ const r = chunkNXMNBFHM_cjs.random(seed * 1000003 + i * 7919 + 17);
4268
4234
  const pick = ([a2, b]) => a2 + r() * (b - a2);
4269
4235
  const born = at + r() * emit;
4270
4236
  const lifetime = pick(life);
@@ -4277,7 +4243,7 @@ function particles(opts) {
4277
4243
  const turn = spin ? pick(spin) : 0;
4278
4244
  const startAngle = spin ? r() * 360 : 0;
4279
4245
  const swayAmp = sway?.amp ?? 0, swayFreq = sway?.freq ?? 1;
4280
- const n0 = sway ? chunk33USHRV5_cjs.noise(0, seed * 1000003 + i) : 0;
4246
+ const n0 = sway ? chunkNXMNBFHM_cjs.noise(0, seed * 1000003 + i) : 0;
4281
4247
  const at_ = (t) => {
4282
4248
  const axis = (p0, v0, acc) => {
4283
4249
  if (drag > 0) {
@@ -4286,7 +4252,7 @@ function particles(opts) {
4286
4252
  }
4287
4253
  return p0 + v0 * t + 0.5 * acc * t * t;
4288
4254
  };
4289
- const sw = sway ? swayAmp * (chunk33USHRV5_cjs.noise(t * swayFreq, seed * 1000003 + i) - n0) : 0;
4255
+ const sw = sway ? swayAmp * (chunkNXMNBFHM_cjs.noise(t * swayFreq, seed * 1000003 + i) - n0) : 0;
4290
4256
  return { x: axis(x0, vx, wind) + sw, y: axis(y0, vy, gravity) };
4291
4257
  };
4292
4258
  const kfs = [];
@@ -4348,7 +4314,7 @@ function followPath(opts) {
4348
4314
  if (steps > MAX_STEPS) throw new Error(`followPath(): ${steps} samples is too many (max ${MAX_STEPS}); lower frameRate or duration`);
4349
4315
  const segments = [];
4350
4316
  let total = 0;
4351
- for (const line of chunk33USHRV5_cjs.flattenSvgPath(d)) {
4317
+ for (const line of chunkNXMNBFHM_cjs.flattenSvgPath(d)) {
4352
4318
  const p = line.closed ? [...line.pts, line.pts[0], line.pts[1]] : line.pts;
4353
4319
  for (let i = 2; i < p.length; i += 2) {
4354
4320
  const len = Math.hypot(p[i] - p[i - 2], p[i + 1] - p[i - 1]);
@@ -4401,7 +4367,7 @@ function followPath(opts) {
4401
4367
  // src/core/pathSample.ts
4402
4368
  function samplePath(d) {
4403
4369
  if (typeof d !== "string" || d.trim() === "") throw new Error('samplePath(): d must be SVG path data, e.g. "M 40 300 C 200 20 400 20 560 300"');
4404
- const lines = chunk33USHRV5_cjs.flattenSvgPath(d);
4370
+ const lines = chunkNXMNBFHM_cjs.flattenSvgPath(d);
4405
4371
  const segments = [];
4406
4372
  let length = 0;
4407
4373
  for (const line of lines) {
@@ -4432,7 +4398,7 @@ function samplePath(d) {
4432
4398
  return { x: g.x0 + (g.x1 - g.x0) * t, y: g.y0 + (g.y1 - g.y0) * t, angle: Math.atan2(g.y1 - g.y0, g.x1 - g.x0) };
4433
4399
  },
4434
4400
  trim(start = 0, end = 1) {
4435
- return chunk33USHRV5_cjs.trimPolylines(lines, start, end).map((l) => l.closed ? [...l.pts, l.pts[0], l.pts[1]] : l.pts);
4401
+ return chunkNXMNBFHM_cjs.trimPolylines(lines, start, end).map((l) => l.closed ? [...l.pts, l.pts[0], l.pts[1]] : l.pts);
4436
4402
  }
4437
4403
  };
4438
4404
  }
@@ -4543,7 +4509,7 @@ function distances(n, from, grid, seed) {
4543
4509
  if (n === 0) return [];
4544
4510
  if (from === "random") {
4545
4511
  const order = Array.from({ length: n }, (_, i) => i);
4546
- const r = chunk33USHRV5_cjs.random(seed);
4512
+ const r = chunkNXMNBFHM_cjs.random(seed);
4547
4513
  for (let i = n - 1; i > 0; i--) {
4548
4514
  const j = Math.floor(r() * (i + 1));
4549
4515
  [order[i], order[j]] = [order[j], order[i]];
@@ -4605,7 +4571,7 @@ function wiggle(opts) {
4605
4571
  to[n] = p.around;
4606
4572
  return;
4607
4573
  }
4608
- const off = (chunk33USHRV5_cjs.rand(seed * 7919 + pi * 104729 + s * 31 + 1) * 2 - 1) * p.amp;
4574
+ const off = (chunkNXMNBFHM_cjs.rand(seed * 7919 + pi * 104729 + s * 31 + 1) * 2 - 1) * p.amp;
4609
4575
  to[n] = typeof p.around === "number" ? p.around + off : `(${p.around}) ${off < 0 ? "-" : "+"} ${Math.abs(off)}`;
4610
4576
  });
4611
4577
  out.push({ at: at + s * stepLen, to, duration: stepLen, ease });
@@ -5076,5 +5042,5 @@ exports.splitText = splitText;
5076
5042
  exports.stagger = stagger;
5077
5043
  exports.wiggle = wiggle;
5078
5044
  exports.withFade = withFade;
5079
- //# sourceMappingURL=chunk-GUDLIAIG.cjs.map
5080
- //# sourceMappingURL=chunk-GUDLIAIG.cjs.map
5045
+ //# sourceMappingURL=chunk-2DC6TRJI.cjs.map
5046
+ //# sourceMappingURL=chunk-2DC6TRJI.cjs.map