@bendyline/squisq-react 2.12.27 → 2.12.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,17 @@
1
1
  import {
2
- MermaidDiagram
3
- } from "./chunk-A65WPCGZ.js";
2
+ MermaidDiagram,
3
+ applyMediaLevel,
4
+ isCaptureDrivenVideo,
5
+ mediaCropStyle,
6
+ recipeLevelAt,
7
+ useCutTimeMap,
8
+ useSkipCuts
9
+ } from "./chunk-FXAKS6KU.js";
4
10
  import {
11
+ ProcessedAudioContext,
5
12
  useMediaUrl,
6
13
  useResourcePolicy
7
- } from "./chunk-OTYJ4MRH.js";
14
+ } from "./chunk-ZKMBIWAA.js";
8
15
 
9
16
  // src/utils/animationUtils.ts
10
17
  import {
@@ -706,7 +713,7 @@ function RichTextLayer({ layer, viewport, blockTime, textScale = 1 }) {
706
713
  const target = event.target;
707
714
  if (target?.closest?.("[data-squisq-table-scroll]")) event.stopPropagation();
708
715
  };
709
- const scopedCss = `.${cls}{margin:0}.${cls} p{margin:0 0 .4em}.${cls} h1,.${cls} h2,.${cls} h3,.${cls} h4,.${cls} h5,.${cls} h6{margin:0 0 .3em;line-height:1.2}.${cls} ul,.${cls} ol{margin:0 0 .7em;padding-left:1.2em;list-style-position:${listStylePosition}}.${cls} li{margin:0}.${cls} li[data-squisq-build-item]{list-style:none}.${cls} [data-squisq-build-row]{display:flex;gap:.35em}.${cls} [data-squisq-build-row]>span{flex:0 0 1.4em;text-align:right;margin-left:-1.75em}.${cls} [data-squisq-build-row]>div{min-width:0;flex:1}.${cls} li>p{display:inline;margin:0}.${cls} [data-squisq-table-scroll]{width:100%;max-height:20em;margin:.35em 0;overflow:auto;overscroll-behavior:contain;box-sizing:border-box}.${cls} table{width:100%;min-width:48em;margin:0;border-collapse:separate;border-spacing:0;table-layout:fixed;font-size:.76em;line-height:1.2}.${cls} th,.${cls} td{box-sizing:border-box;padding:.28em .45em;border:1px solid rgba(127,127,127,.55);border-color:color-mix(in srgb,currentColor 32%,transparent);vertical-align:top;white-space:normal;overflow-wrap:anywhere}.${cls} th{position:sticky;top:0;z-index:1;background:rgba(127,127,127,.16);background:color-mix(in srgb,currentColor 12%,transparent);font-weight:600}.${cls} tbody tr:nth-child(even){background:rgba(127,127,127,.07);background:color-mix(in srgb,currentColor 5%,transparent)}.${cls} *:first-child{margin-top:0}.${cls} *:last-child{margin-bottom:0}.${cls} a{color:inherit;text-decoration:underline}`;
716
+ const scopedCss = `.${cls}{margin:0}.${cls} p{margin:0 0 .4em}.${cls} h1,.${cls} h2,.${cls} h3,.${cls} h4,.${cls} h5,.${cls} h6{margin:0 0 .3em;line-height:1.2}.${cls} ul,.${cls} ol{margin:0 0 .7em;padding-left:1.2em;list-style-position:${listStylePosition}}.${cls} li{margin:0}.${cls} li[data-squisq-build-item]{list-style:none}.${cls} li[data-squisq-task]{list-style:none}.${cls} [data-squisq-build-row]{display:flex;gap:.35em}.${cls} [data-squisq-build-row]>span{flex:0 0 1.4em;text-align:right;margin-left:-1.75em}.${cls} [data-squisq-build-row]>div{min-width:0;flex:1}.${cls} li>p{display:inline;margin:0}.${cls} [data-squisq-table-scroll]{width:100%;max-height:20em;margin:.35em 0;overflow:auto;overscroll-behavior:contain;box-sizing:border-box}.${cls} table{width:100%;min-width:48em;margin:0;border-collapse:separate;border-spacing:0;table-layout:fixed;font-size:.76em;line-height:1.2}.${cls} th,.${cls} td{box-sizing:border-box;padding:.28em .45em;border:1px solid rgba(127,127,127,.55);border-color:color-mix(in srgb,currentColor 32%,transparent);vertical-align:top;white-space:normal;overflow-wrap:anywhere}.${cls} th{position:sticky;top:0;z-index:1;background:rgba(127,127,127,.16);background:color-mix(in srgb,currentColor 12%,transparent);font-weight:600}.${cls} tbody tr:nth-child(even){background:rgba(127,127,127,.07);background:color-mix(in srgb,currentColor 5%,transparent)}.${cls} *:first-child{margin-top:0}.${cls} *:last-child{margin-bottom:0}.${cls} a{color:inherit;text-decoration:underline}`;
710
717
  return /* @__PURE__ */ jsx3(
711
718
  "g",
712
719
  {
@@ -1460,254 +1467,14 @@ function MapLayer({ layer, basePath, viewport, blockTime }) {
1460
1467
  }
1461
1468
 
1462
1469
  // src/layers/VideoLayer.tsx
1463
- import { useRef as useRef2, useEffect as useEffect2 } from "react";
1464
-
1465
- // src/docPlayer/renderReadiness.ts
1466
- var DEFAULT_VIDEO_FRAME_TIMEOUT_MS = 2e3;
1467
- var VIDEO_FRAME_READINESS_POLL_MS = 16;
1468
- var VIDEO_TIME_TOLERANCE_SECONDS = 0.01;
1469
- var MAX_SEQUENTIAL_CAPTURE_STEP_SECONDS = 0.5;
1470
- var SEQUENTIAL_CAPTURE_PLAYBACK_RATE = 1;
1471
- function isCaptureDrivenVideo(video) {
1472
- return video.dataset.captureSequential === "true" || video.dataset.captureDecoded === "true";
1473
- }
1474
- function formatMediaTime(time) {
1475
- return Number.isFinite(time) ? `${time.toFixed(3)}s` : String(time);
1476
- }
1477
- function reachableMediaTime(video, targetTime) {
1478
- const duration = video.duration;
1479
- if (!Number.isFinite(duration)) return targetTime;
1480
- return Math.max(0, Math.min(targetTime, duration));
1481
- }
1482
- function isAtReachableMediaTime(video, targetTime) {
1483
- return Math.abs(video.currentTime - reachableMediaTime(video, targetTime)) <= VIDEO_TIME_TOLERANCE_SECONDS;
1484
- }
1485
- function isVisiblyPresented(video) {
1486
- if (!video.isConnected) return false;
1487
- const view = video.ownerDocument.defaultView;
1488
- if (!view) return false;
1489
- for (let element = video; element; element = element.parentElement) {
1490
- const style = view.getComputedStyle(element);
1491
- if (style.display === "none" || style.visibility === "hidden" || style.visibility === "collapse" || Number.parseFloat(style.opacity || "1") <= 0) {
1492
- return false;
1493
- }
1494
- }
1495
- return true;
1496
- }
1497
- function createCaptureWatchdog(ownerDocument, timeoutMs, expire) {
1498
- let timeout = null;
1499
- const clear = () => {
1500
- if (timeout === null) return;
1501
- clearTimeout(timeout);
1502
- timeout = null;
1503
- };
1504
- return {
1505
- arm: () => {
1506
- clear();
1507
- if (ownerDocument.visibilityState !== "visible") return;
1508
- timeout = setTimeout(expire, timeoutMs);
1509
- },
1510
- clear
1511
- };
1512
- }
1513
- function seekVideoByAssignment(video, targetTime, timeoutMs = DEFAULT_VIDEO_FRAME_TIMEOUT_MS) {
1514
- video.pause();
1515
- return new Promise((resolve, reject) => {
1516
- let settled = false;
1517
- let videoFrameRequest = null;
1518
- const ownerDocument = video.ownerDocument;
1519
- const isInactive = () => ownerDocument.visibilityState !== "visible";
1520
- const cleanup = () => {
1521
- watchdog.clear();
1522
- clearInterval(readinessPoll);
1523
- video.removeEventListener("seeked", handleMediaReady);
1524
- video.removeEventListener("loadeddata", handleMediaReady);
1525
- video.removeEventListener("canplay", handleMediaReady);
1526
- ownerDocument.removeEventListener("visibilitychange", handleVisibilityChange);
1527
- if (videoFrameRequest !== null && typeof video.cancelVideoFrameCallback === "function") {
1528
- video.cancelVideoFrameCallback(videoFrameRequest);
1529
- }
1530
- };
1531
- const finish = () => {
1532
- if (settled) return;
1533
- settled = true;
1534
- cleanup();
1535
- resolve();
1536
- };
1537
- const fail = () => {
1538
- if (settled) return;
1539
- settled = true;
1540
- cleanup();
1541
- reject(
1542
- new Error(
1543
- `Video frame did not become ready at ${formatMediaTime(targetTime)} within ${timeoutMs}ms (currentTime=${formatMediaTime(video.currentTime)}, reachableTime=${formatMediaTime(reachableMediaTime(video, targetTime))}, duration=${formatMediaTime(video.duration)}, readyState=${video.readyState}, seeking=${String(video.seeking)}, visible=${String(isVisiblyPresented(video))}).`
1544
- )
1545
- );
1546
- };
1547
- const requestPresentedFrame = () => {
1548
- if (settled || video.seeking || video.readyState < HTMLMediaElement.HAVE_CURRENT_DATA || !isAtReachableMediaTime(video, targetTime)) {
1549
- return;
1550
- }
1551
- if (typeof video.requestVideoFrameCallback !== "function" || !isVisiblyPresented(video)) {
1552
- finish();
1553
- return;
1554
- }
1555
- if (videoFrameRequest !== null) return;
1556
- videoFrameRequest = video.requestVideoFrameCallback(() => {
1557
- videoFrameRequest = null;
1558
- finish();
1559
- });
1560
- };
1561
- function handleMediaReady() {
1562
- requestPresentedFrame();
1563
- }
1564
- const watchdog = createCaptureWatchdog(ownerDocument, timeoutMs, fail);
1565
- const assignTargetTime = () => {
1566
- try {
1567
- video.currentTime = reachableMediaTime(video, targetTime);
1568
- queueMicrotask(requestPresentedFrame);
1569
- return true;
1570
- } catch (error) {
1571
- settled = true;
1572
- cleanup();
1573
- reject(error);
1574
- return false;
1575
- }
1576
- };
1577
- function handleVisibilityChange() {
1578
- if (settled) return;
1579
- if (isInactive()) {
1580
- watchdog.clear();
1581
- return;
1582
- }
1583
- requestPresentedFrame();
1584
- if (settled) return;
1585
- if (!video.seeking && !isAtReachableMediaTime(video, targetTime) && !assignTargetTime()) {
1586
- return;
1587
- }
1588
- watchdog.arm();
1589
- }
1590
- const readinessPoll = setInterval(requestPresentedFrame, VIDEO_FRAME_READINESS_POLL_MS);
1591
- video.addEventListener("seeked", handleMediaReady);
1592
- video.addEventListener("loadeddata", handleMediaReady);
1593
- video.addEventListener("canplay", handleMediaReady);
1594
- ownerDocument.addEventListener("visibilitychange", handleVisibilityChange);
1595
- watchdog.arm();
1596
- assignTargetTime();
1597
- });
1598
- }
1599
- function advanceSequentialCaptureVideo(video, targetTime, timeoutMs) {
1600
- return new Promise((resolve, reject) => {
1601
- let settled = false;
1602
- const ownerDocument = video.ownerDocument;
1603
- const isInactive = () => ownerDocument.visibilityState !== "visible";
1604
- const cleanup = () => {
1605
- watchdog.clear();
1606
- clearInterval(readinessPoll);
1607
- video.removeEventListener("timeupdate", check);
1608
- video.removeEventListener("loadeddata", check);
1609
- video.removeEventListener("canplay", check);
1610
- video.removeEventListener("error", fail);
1611
- ownerDocument.removeEventListener("visibilitychange", handleVisibilityChange);
1612
- };
1613
- const finish = () => {
1614
- if (!settled) {
1615
- settled = true;
1616
- cleanup();
1617
- resolve();
1618
- }
1619
- };
1620
- const fallbackToSeek = () => {
1621
- if (settled) return;
1622
- settled = true;
1623
- video.pause();
1624
- cleanup();
1625
- void seekVideoByAssignment(video, targetTime, timeoutMs).then(resolve, reject);
1626
- };
1627
- const fail = () => {
1628
- if (settled) return;
1629
- settled = true;
1630
- video.pause();
1631
- cleanup();
1632
- reject(
1633
- new Error(
1634
- `Video frame did not advance to ${formatMediaTime(targetTime)} within ${timeoutMs}ms (currentTime=${formatMediaTime(video.currentTime)}, readyState=${video.readyState}).`
1635
- )
1636
- );
1637
- };
1638
- function check() {
1639
- if (video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA && video.currentTime >= reachableMediaTime(video, targetTime)) {
1640
- video.pause();
1641
- finish();
1642
- }
1643
- }
1644
- const handlePlaybackFailure = () => {
1645
- if (settled || isInactive()) return;
1646
- fallbackToSeek();
1647
- };
1648
- const startPlayback = () => {
1649
- if (settled || isInactive()) return;
1650
- try {
1651
- video.playbackRate = SEQUENTIAL_CAPTURE_PLAYBACK_RATE;
1652
- if (video.paused) {
1653
- void video.play().catch(handlePlaybackFailure);
1654
- }
1655
- } catch {
1656
- handlePlaybackFailure();
1657
- }
1658
- };
1659
- const watchdog = createCaptureWatchdog(ownerDocument, timeoutMs, fail);
1660
- const pauseWhileInactive = () => {
1661
- video.pause();
1662
- watchdog.clear();
1663
- };
1664
- const resumeWhenActive = () => {
1665
- if (settled || isInactive()) return;
1666
- check();
1667
- if (settled) return;
1668
- startPlayback();
1669
- watchdog.arm();
1670
- };
1671
- function handleVisibilityChange() {
1672
- if (ownerDocument.visibilityState !== "visible") {
1673
- pauseWhileInactive();
1674
- return;
1675
- }
1676
- resumeWhenActive();
1677
- }
1678
- const readinessPoll = setInterval(check, VIDEO_FRAME_READINESS_POLL_MS);
1679
- video.addEventListener("timeupdate", check);
1680
- video.addEventListener("loadeddata", check);
1681
- video.addEventListener("canplay", check);
1682
- video.addEventListener("error", fail, { once: true });
1683
- ownerDocument.addEventListener("visibilitychange", handleVisibilityChange);
1684
- resumeWhenActive();
1685
- });
1686
- }
1687
- function seekVideoToFrame(video, targetTime, timeoutMs = DEFAULT_VIDEO_FRAME_TIMEOUT_MS) {
1688
- if (video.readyState >= HTMLMediaElement.HAVE_METADATA && video.videoWidth <= 0 && video.videoHeight <= 0) {
1689
- video.pause();
1690
- return Promise.resolve();
1691
- }
1692
- const reachableTargetTime = reachableMediaTime(video, targetTime);
1693
- const step = reachableTargetTime - video.currentTime;
1694
- if (video.dataset.captureSequential === "true") {
1695
- if (video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA && step <= VIDEO_TIME_TOLERANCE_SECONDS) {
1696
- if (step < -VIDEO_TIME_TOLERANCE_SECONDS) video.pause();
1697
- return Promise.resolve();
1698
- }
1699
- if (step > 0 && step <= MAX_SEQUENTIAL_CAPTURE_STEP_SECONDS && video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA) {
1700
- return advanceSequentialCaptureVideo(video, targetTime, timeoutMs);
1701
- }
1702
- }
1703
- video.pause();
1704
- const alreadyReady = !video.seeking && video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA && isAtReachableMediaTime(video, targetTime);
1705
- if (alreadyReady) return Promise.resolve();
1706
- return seekVideoByAssignment(video, targetTime, timeoutMs);
1707
- }
1708
-
1709
- // src/layers/VideoLayer.tsx
1710
- import { jsx as jsx7 } from "react/jsx-runtime";
1470
+ import { useContext, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2 } from "react";
1471
+ import {
1472
+ createMediaTimeMap,
1473
+ hasRenderableFx,
1474
+ serializeMediaCrop,
1475
+ serializeMediaCuts
1476
+ } from "@bendyline/squisq/mediaEdit";
1477
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1711
1478
  var VIDEO_SYNC_DRIFT_SECONDS = 0.2;
1712
1479
  function VideoLayer({
1713
1480
  layer,
@@ -1719,11 +1486,24 @@ function VideoLayer({
1719
1486
  mode = "timed"
1720
1487
  }) {
1721
1488
  const { content, position } = layer;
1489
+ const edits = content.edits;
1722
1490
  const videoRef = useRef2(null);
1491
+ const audioRef = useRef2(null);
1723
1492
  const hasStartedRef = useRef2(false);
1724
1493
  const isPlayer = mode === "player";
1725
1494
  const startAt = content.startAt ?? 0;
1726
1495
  const gated = blockTime < startAt;
1496
+ const cutsKey = content.cuts?.length ? serializeMediaCuts(content.cuts) : "";
1497
+ const timeMap = useCutTimeMap(content.cuts, content.clipStart);
1498
+ const playedDuration = useMemo2(
1499
+ () => createMediaTimeMap({
1500
+ clipStart: content.clipStart,
1501
+ clipEnd: content.clipEnd,
1502
+ cuts: content.cuts
1503
+ }).playedDuration,
1504
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- cutsKey stands for content.cuts
1505
+ [content.clipStart, content.clipEnd, cutsKey]
1506
+ );
1727
1507
  const x = resolveValue(position.x, viewport.width);
1728
1508
  const y = resolveValue(position.y, viewport.height);
1729
1509
  const width = position.width ? resolveValue(position.width, viewport.width) : viewport.width;
@@ -1734,6 +1514,22 @@ function VideoLayer({
1734
1514
  const src = useMediaUrl(content.src, basePath);
1735
1515
  const resolvedPoster = useMediaUrl(content.posterSrc || "", basePath);
1736
1516
  const posterSrc = content.posterSrc ? resolvedPoster : void 0;
1517
+ const processedAudio = useContext(ProcessedAudioContext);
1518
+ const processedPath = useMemo2(() => {
1519
+ if (isPlayer || !processedAudio || !hasRenderableFx(edits?.fx)) return "";
1520
+ const clip = {
1521
+ id: layer.id,
1522
+ src: content.src,
1523
+ kind: "video",
1524
+ startAt: 0,
1525
+ anchor: "block",
1526
+ edits
1527
+ };
1528
+ return processedAudio(clip) ?? "";
1529
+ }, [isPlayer, processedAudio, edits, layer.id, content.src]);
1530
+ const resolvedProcessed = useMediaUrl(processedPath, basePath);
1531
+ const processedUrl = processedPath ? resolvedProcessed : "";
1532
+ const companion = processedUrl !== "";
1737
1533
  useEffect2(() => {
1738
1534
  const video = videoRef.current;
1739
1535
  if (!video) return;
@@ -1759,65 +1555,118 @@ function VideoLayer({
1759
1555
  video.pause();
1760
1556
  };
1761
1557
  }, [src, content.clipStart, content.clipEnd, isPlayer]);
1558
+ useEffect2(() => {
1559
+ const audio = audioRef.current;
1560
+ if (!audio || !companion) return;
1561
+ audio.currentTime = content.clipStart;
1562
+ return () => audio.pause();
1563
+ }, [companion, processedUrl, content.clipStart]);
1762
1564
  useEffect2(() => {
1763
1565
  const video = videoRef.current;
1764
1566
  if (!video || !hasStartedRef.current || isPlayer) return;
1765
- const targetTime = gated ? content.clipStart : Math.min(content.clipEnd, content.clipStart + Math.max(0, blockTime - startAt));
1567
+ const audio = companion ? audioRef.current : null;
1568
+ const played = Math.max(0, blockTime - startAt);
1569
+ const targetTime = gated ? content.clipStart : Math.min(
1570
+ content.clipEnd,
1571
+ timeMap ? timeMap.playedToSource(played) : content.clipStart + played
1572
+ );
1766
1573
  if (!isCaptureDrivenVideo(video) && Math.abs(video.currentTime - targetTime) > VIDEO_SYNC_DRIFT_SECONDS) {
1767
1574
  video.currentTime = targetTime;
1768
1575
  }
1576
+ if (audio && Math.abs(audio.currentTime - targetTime) > VIDEO_SYNC_DRIFT_SECONDS) {
1577
+ audio.currentTime = targetTime;
1578
+ }
1769
1579
  if (gated) {
1770
1580
  video.pause();
1581
+ audio?.pause();
1771
1582
  return;
1772
1583
  }
1773
1584
  if (targetTime >= content.clipEnd) {
1774
1585
  video.pause();
1586
+ audio?.pause();
1775
1587
  return;
1776
1588
  }
1777
1589
  if (isPlaying) {
1778
- const playPromise = video.play();
1779
- if (playPromise) {
1780
- playPromise.catch(() => {
1590
+ for (const element of [video, audio]) {
1591
+ const playPromise = element?.play();
1592
+ if (playPromise) playPromise.catch(() => {
1781
1593
  });
1782
1594
  }
1783
1595
  } else if (!isCaptureDrivenVideo(video)) {
1784
1596
  video.pause();
1597
+ audio?.pause();
1785
1598
  }
1786
- }, [isPlaying, gated, blockTime, startAt, src, content.clipStart, content.clipEnd, isPlayer]);
1787
- return /* @__PURE__ */ jsx7("g", { className: "block-layer block-layer--video", "data-layer-id": layer.id, children: /* @__PURE__ */ jsx7("foreignObject", { x: finalX, y: finalY, width, height, children: /* @__PURE__ */ jsx7(
1788
- "video",
1789
- {
1790
- ref: videoRef,
1791
- src,
1792
- poster: posterSrc,
1793
- muted,
1794
- playsInline: true,
1795
- ...isPlayer ? {
1796
- controls: true,
1797
- preload: "metadata",
1798
- "aria-label": content.alt || void 0,
1799
- // A drag on the seek bar scrubs the clip rather than swiping slides.
1800
- "data-no-swipe": ""
1801
- } : {
1599
+ }, [
1600
+ isPlaying,
1601
+ gated,
1602
+ blockTime,
1603
+ startAt,
1604
+ src,
1605
+ content.clipStart,
1606
+ content.clipEnd,
1607
+ isPlayer,
1608
+ timeMap,
1609
+ companion,
1610
+ processedUrl
1611
+ ]);
1612
+ useSkipCuts(videoRef, timeMap, src);
1613
+ useSkipCuts(audioRef, companion ? timeMap : null, processedUrl);
1614
+ const hasLevel = Boolean(edits?.gain || edits?.fadeIn || edits?.fadeOut);
1615
+ const level = !hasLevel ? 1 : isPlayer ? recipeLevelAt({ gain: edits?.gain }, 0, Number.POSITIVE_INFINITY) : recipeLevelAt(edits ?? {}, Math.max(0, blockTime - startAt), playedDuration);
1616
+ useEffect2(() => {
1617
+ if (!hasLevel) return;
1618
+ const heard = companion ? audioRef.current : videoRef.current;
1619
+ if (heard) applyMediaLevel(heard, level);
1620
+ }, [hasLevel, level, companion, src, processedUrl]);
1621
+ return /* @__PURE__ */ jsx7("g", { className: "block-layer block-layer--video", "data-layer-id": layer.id, children: /* @__PURE__ */ jsxs6("foreignObject", { x: finalX, y: finalY, width, height, children: [
1622
+ /* @__PURE__ */ jsx7(
1623
+ "video",
1624
+ {
1625
+ ref: videoRef,
1626
+ src,
1627
+ poster: posterSrc,
1628
+ muted: muted || companion,
1629
+ playsInline: true,
1630
+ "data-crop": edits?.crop ? serializeMediaCrop(edits.crop) : void 0,
1631
+ ...isPlayer ? {
1632
+ controls: true,
1633
+ preload: "metadata",
1634
+ "aria-label": content.alt || void 0,
1635
+ // A drag on the seek bar scrubs the clip rather than swiping slides.
1636
+ "data-no-swipe": ""
1637
+ } : {
1638
+ preload: "auto",
1639
+ "data-clip-start": content.clipStart,
1640
+ "data-clip-end": content.clipEnd,
1641
+ "data-start-at": startAt,
1642
+ "data-cuts": cutsKey || void 0
1643
+ },
1644
+ style: {
1645
+ width: `${width}px`,
1646
+ height: `${height}px`,
1647
+ objectFit: content.fit || "cover",
1648
+ objectPosition: "center",
1649
+ display: "block",
1650
+ pointerEvents: isPlayer ? void 0 : "none",
1651
+ ...mediaCropStyle(edits?.crop)
1652
+ }
1653
+ }
1654
+ ),
1655
+ companion && /* @__PURE__ */ jsx7(
1656
+ "audio",
1657
+ {
1658
+ ref: audioRef,
1659
+ src: processedUrl,
1802
1660
  preload: "auto",
1803
- "data-clip-start": content.clipStart,
1804
- "data-clip-end": content.clipEnd,
1805
- "data-start-at": startAt
1806
- },
1807
- style: {
1808
- width: `${width}px`,
1809
- height: `${height}px`,
1810
- objectFit: content.fit || "cover",
1811
- objectPosition: "center",
1812
- display: "block",
1813
- pointerEvents: isPlayer ? void 0 : "none"
1661
+ muted,
1662
+ "data-processed-audio": ""
1814
1663
  }
1815
- }
1816
- ) }) });
1664
+ )
1665
+ ] }) });
1817
1666
  }
1818
1667
 
1819
1668
  // src/layers/TableLayer.tsx
1820
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1669
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1821
1670
  function TableLayer({
1822
1671
  block,
1823
1672
  layer,
@@ -1846,7 +1695,7 @@ function TableLayer({
1846
1695
  const verticalCellPadding = style.fontSize * 0.6;
1847
1696
  const horizontalCellPadding = style.fontSize * 0.75;
1848
1697
  const cellWrap = content.wrap ? { whiteSpace: "pre-line", overflowWrap: "break-word", verticalAlign: "top" } : { whiteSpace: "nowrap" };
1849
- const nativeTable = /* @__PURE__ */ jsxs6(
1698
+ const nativeTable = /* @__PURE__ */ jsxs7(
1850
1699
  "table",
1851
1700
  {
1852
1701
  style: {
@@ -1951,7 +1800,7 @@ function TableLayer({
1951
1800
 
1952
1801
  // src/layers/TreeLayer.tsx
1953
1802
  import { useState as useState3 } from "react";
1954
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1803
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1955
1804
  function faClass(token, fallback) {
1956
1805
  const name = token && token.trim() ? token.trim() : fallback;
1957
1806
  const colon = name.indexOf(":");
@@ -2027,8 +1876,8 @@ function TreeRow({
2027
1876
  const [collapsed, setCollapsed] = useState3(false);
2028
1877
  const isDir = item.isDir || hasChildren;
2029
1878
  const iconCls = isDir ? faClass(style.folderIcon, collapsed ? "folder" : "folder-open") : faClass(style.fileIcon, "file");
2030
- return /* @__PURE__ */ jsxs7("li", { style: { position: "relative" }, children: [
2031
- /* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "baseline", gap: "8px", padding: "1px 0" }, children: [
1879
+ return /* @__PURE__ */ jsxs8("li", { style: { position: "relative" }, children: [
1880
+ /* @__PURE__ */ jsxs8("div", { style: { display: "flex", alignItems: "baseline", gap: "8px", padding: "1px 0" }, children: [
2032
1881
  hasChildren ? /* @__PURE__ */ jsx9(
2033
1882
  "button",
2034
1883
  {
@@ -2129,9 +1978,9 @@ function MermaidLayer({ layer, viewport, blockTime, theme }) {
2129
1978
  }
2130
1979
 
2131
1980
  // src/layers/SvgLayer.tsx
2132
- import { useMemo as useMemo2 } from "react";
1981
+ import { useMemo as useMemo3 } from "react";
2133
1982
  import { parseSvgIsland, svgIslandDataUrl } from "@bendyline/squisq/markdown";
2134
- import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
1983
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2135
1984
  function SvgLayer({ layer, viewport, blockTime, isStatic = false }) {
2136
1985
  const { position, content, animation } = layer;
2137
1986
  const width = resolveValue(position.width ?? viewport.width, viewport.width);
@@ -2139,11 +1988,11 @@ function SvgLayer({ layer, viewport, blockTime, isStatic = false }) {
2139
1988
  const offset = getAnchorOffset(position.anchor, width, height);
2140
1989
  const x = resolveValue(position.x, viewport.width) + offset.x;
2141
1990
  const y = resolveValue(position.y, viewport.height) + offset.y;
2142
- const result = useMemo2(
1991
+ const result = useMemo3(
2143
1992
  () => parseSvgIsland(content.source, { static: isStatic }),
2144
1993
  [content.source, isStatic]
2145
1994
  );
2146
- const href = useMemo2(
1995
+ const href = useMemo3(
2147
1996
  () => result.ok ? svgIslandDataUrl(result.island, { color: content.color }) : null,
2148
1997
  [result, content.color]
2149
1998
  );
@@ -2168,7 +2017,7 @@ function SvgLayer({ layer, viewport, blockTime, isStatic = false }) {
2168
2017
  "aria-label": label,
2169
2018
  style: { pointerEvents: "none" }
2170
2019
  }
2171
- ) : /* @__PURE__ */ jsxs8("g", { role: "img", "aria-label": "SVG that could not be rendered", children: [
2020
+ ) : /* @__PURE__ */ jsxs9("g", { role: "img", "aria-label": "SVG that could not be rendered", children: [
2172
2021
  /* @__PURE__ */ jsx11(
2173
2022
  "rect",
2174
2023
  {
@@ -2203,8 +2052,6 @@ function SvgLayer({ layer, viewport, blockTime, isStatic = false }) {
2203
2052
  }
2204
2053
 
2205
2054
  export {
2206
- isCaptureDrivenVideo,
2207
- seekVideoToFrame,
2208
2055
  getAnimationStyle,
2209
2056
  getTransitionClass,
2210
2057
  resolveValue,