hyperframes 0.8.169 → 0.8.171

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 (181) hide show
  1. package/dist/{add-7GLP4BPM.js → add-VMMGTSGT.js} +12 -11
  2. package/dist/{animatedGifPrep-NEBEGVSO.js → animatedGifPrep-MVP5LCEM.js} +5 -5
  3. package/dist/api.js +11 -11
  4. package/dist/{asset-RORTT5HS.js → asset-ZERIT5FT.js} +2 -2
  5. package/dist/{assetCataloger-RLJ6MDGF.js → assetCataloger-RN5A2SVA.js} +5 -5
  6. package/dist/{audio-OKDGU7TY.js → audio-RQUGFWYT.js} +11 -11
  7. package/dist/{auth-QWYNCU5U.js → auth-I3FNB6N2.js} +1 -1
  8. package/dist/{autoUpdate-EDJJPWAU.js → autoUpdate-IBAS4JVK.js} +2 -2
  9. package/dist/{backgroundChecks-KQR6FGVU.js → backgroundChecks-7UQBIPQC.js} +3 -3
  10. package/dist/backgroundChecksWorker.js +3 -3
  11. package/dist/{batchRender-YKTTAIHH.js → batchRender-KWBVAUE3.js} +3 -3
  12. package/dist/{beats-I6AGLTLW.js → beats-F2GFGFCV.js} +4 -4
  13. package/dist/{benchmark-NBSV7PNB.js → benchmark-XPQYX3OX.js} +8 -8
  14. package/dist/{browser-FPEL5FGW.js → browser-QCV62F7R.js} +3 -3
  15. package/dist/{bundleWithLocalizedFonts-TYQXMNSU.js → bundleWithLocalizedFonts-42V34HJF.js} +2 -2
  16. package/dist/{capture-FXGOI23U.js → capture-OKPMCIAC.js} +8 -8
  17. package/dist/{capture-5BRJJMZB.js → capture-WE32B5UZ.js} +2 -2
  18. package/dist/{catalog-SG3ZIS45.js → catalog-2LWFMJM3.js} +12 -11
  19. package/dist/{catch-up-ETXUT6Q5.js → catch-up-OWUGMOBS.js} +4 -4
  20. package/dist/{check-KXNNIEUR.js → check-7BK6UM3M.js} +35 -34
  21. package/dist/{checkBrowser-546UMI3N.js → checkBrowser-VG745SEX.js} +32 -31
  22. package/dist/{chunk-YZRS3COO.js → chunk-4QIJFIR5.js} +1 -1
  23. package/dist/{chunk-UCNQE52B.js → chunk-4RXJG3SY.js} +197 -26
  24. package/dist/{chunk-JPN7SVWC.js → chunk-5GQB63WX.js} +7 -7
  25. package/dist/{chunk-FSX7GTBB.js → chunk-5HLJ4JMB.js} +1 -1
  26. package/dist/{chunk-FQJDV2RI.js → chunk-6I24ZSCR.js} +1 -1
  27. package/dist/chunk-6M3IPJS6.js +3803 -0
  28. package/dist/{chunk-7635SDI5.js → chunk-77QCYRQH.js} +2 -2
  29. package/dist/{chunk-TJSTGSAW.js → chunk-7FMUTGOH.js} +2 -77
  30. package/dist/{chunk-QD5VJOQK.js → chunk-7YZSOHSC.js} +3 -3
  31. package/dist/{chunk-AP5AVVAB.js → chunk-A3SQJCPU.js} +1 -1
  32. package/dist/{chunk-XK5SZNYE.js → chunk-AAYNQ7WL.js} +9 -9
  33. package/dist/{chunk-T4HL3SZH.js → chunk-AGHHZIZN.js} +1 -1
  34. package/dist/{chunk-A6K7M46D.js → chunk-AWSVUIWG.js} +1 -1
  35. package/dist/{chunk-RUYYAL3T.js → chunk-BMPNGUYD.js} +2 -2
  36. package/dist/{chunk-BNEKKUPG.js → chunk-BYFG74OA.js} +2 -2
  37. package/dist/{chunk-VCXVZRR2.js → chunk-CO6V4KXX.js} +1 -1
  38. package/dist/{chunk-5ETJPA5Z.js → chunk-CSABTZ6S.js} +9 -9
  39. package/dist/{chunk-DCG22HKT.js → chunk-D2QELIQB.js} +72 -22
  40. package/dist/{chunk-J5Z56PU3.js → chunk-EDGJ2OMH.js} +1 -1
  41. package/dist/{chunk-SJPNVLYS.js → chunk-ERJHLFPD.js} +2 -2
  42. package/dist/{chunk-P24X6CGY.js → chunk-FAORS3UR.js} +28 -13
  43. package/dist/{chunk-EEP5Y5IE.js → chunk-FE2XTCTM.js} +18 -1
  44. package/dist/{chunk-TVDXMJ43.js → chunk-GBWSBTEE.js} +1 -1
  45. package/dist/{chunk-JGYHWVXQ.js → chunk-GMJ3ILLW.js} +34 -13
  46. package/dist/{chunk-K5PU5ISL.js → chunk-GSABLXZV.js} +1 -1
  47. package/dist/{chunk-KA4LSAD5.js → chunk-GU5FLCZV.js} +1 -1
  48. package/dist/{chunk-YT6TFGIS.js → chunk-IWLOARQZ.js} +2 -2
  49. package/dist/{chunk-EFP25BUY.js → chunk-JAERN4RH.js} +1 -1
  50. package/dist/chunk-JHOCK3DG.js +27 -0
  51. package/dist/{chunk-5SQHHBAR.js → chunk-JMJTXBVF.js} +22 -12
  52. package/dist/{chunk-NKG3LTPI.js → chunk-KQCWIE76.js} +2 -2
  53. package/dist/{chunk-S6U7YLPJ.js → chunk-KUW4LWY6.js} +1 -1
  54. package/dist/{chunk-PVTHDNDZ.js → chunk-L32QQH2K.js} +1 -1
  55. package/dist/{chunk-TEFHMDVR.js → chunk-LMMFO5UV.js} +2 -2
  56. package/dist/{chunk-CESKA6VO.js → chunk-NSJLCWLG.js} +1 -1
  57. package/dist/{chunk-MCPDZWZY.js → chunk-NYCJCQNY.js} +4 -4
  58. package/dist/{chunk-2F4HJFGW.js → chunk-PAFCKH3S.js} +2 -2
  59. package/dist/{chunk-U7P2XTRY.js → chunk-PECICVTJ.js} +2 -2
  60. package/dist/{chunk-GVX2443P.js → chunk-PH3RS5X4.js} +2 -2
  61. package/dist/{chunk-Q5K73VW3.js → chunk-PXA4S6OE.js} +2 -2
  62. package/dist/{chunk-O3J7BHBU.js → chunk-QZUVPWC4.js} +1 -1
  63. package/dist/{chunk-ZFJ5RI7A.js → chunk-RSW6LGGW.js} +3 -3
  64. package/dist/{chunk-EELTMBCC.js → chunk-RTW6WSC7.js} +4 -3
  65. package/dist/{chunk-CNP6AMFM.js → chunk-SLTUINB4.js} +2 -2
  66. package/dist/{chunk-RZKQ3G6B.js → chunk-T5LGOTQR.js} +1 -1
  67. package/dist/{chunk-WAVFNZB7.js → chunk-TZ3I23TZ.js} +21 -7
  68. package/dist/{chunk-QLHXC4E6.js → chunk-UJQQITCY.js} +1 -1
  69. package/dist/{chunk-XZNHVWDD.js → chunk-UUP4KOMD.js} +4 -4
  70. package/dist/{chunk-UISU4SYG.js → chunk-V2T7FFPB.js} +1 -1
  71. package/dist/{chunk-7FHFPHEM.js → chunk-VKFYI7AQ.js} +182 -77
  72. package/dist/{chunk-QABAVWEX.js → chunk-W47D3KOB.js} +1 -1
  73. package/dist/{chunk-YLAREDAU.js → chunk-X3U6KEID.js} +1 -1
  74. package/dist/{chunk-5FWVFCQM.js → chunk-XGFYN53T.js} +2 -2
  75. package/dist/{chunk-M4N6IHCQ.js → chunk-XRQBHOBT.js} +7 -1
  76. package/dist/{chunk-XJQ6NN2L.js → chunk-ZBUGFQ7Y.js} +51 -25
  77. package/dist/{clean-ARH23EGW.js → clean-FCBNQ3W2.js} +13 -13
  78. package/dist/cli.js +53 -53
  79. package/dist/{cloud-GBY7MRZM.js → cloud-3FZBQBOM.js} +4 -4
  80. package/dist/{cloudrun-HBVA5UZB.js → cloudrun-CDFL5JBL.js} +9 -11
  81. package/dist/{compare-Z4YNESYN.js → compare-E4332OOZ.js} +26 -25
  82. package/dist/{compiler-6WJ5SVTD.js → compiler-GU5GPO5A.js} +2 -2
  83. package/dist/{component-AR4MS4R7.js → component-VKSV3OKW.js} +3 -3
  84. package/dist/{compositions-ERZVZBYW.js → compositions-GOVXHFXC.js} +9 -9
  85. package/dist/{delete-NWSW3BET.js → delete-JYZTEBLQ.js} +2 -2
  86. package/dist/{deterministicFonts-KXVO7QEL.js → deterministicFonts-RWGQPEZU.js} +2 -2
  87. package/dist/{dist-VKLSNKRZ.js → dist-IDZRZHGE.js} +2 -2
  88. package/dist/{doctor-P4QZQRCB.js → doctor-ND3FZM6S.js} +7 -7
  89. package/dist/{events-F2UVJQIC.js → events-27JU7QRQ.js} +2 -2
  90. package/dist/{events-SV46AWMI.js → events-VL2JIO4R.js} +3 -3
  91. package/dist/{feedback-XS4IK6SW.js → feedback-PKVQWCVT.js} +6 -6
  92. package/dist/{figma-DELISEUP.js → figma-FZ4T4SE3.js} +3 -3
  93. package/dist/fontLocalizeCli.js +9 -9
  94. package/dist/{get-DNGXCEFB.js → get-HUAIHWXR.js} +2 -2
  95. package/dist/{gpuPolicy-JG5PUOJP.js → gpuPolicy-QWJYZLVJ.js} +5 -5
  96. package/dist/{grade-compare-F46JWE4O.js → grade-compare-CJ2ROYD6.js} +26 -25
  97. package/dist/{help-XVEBMX3U.js → help-OJ3QDJYS.js} +1 -1
  98. package/dist/{history-NS4PKG4S.js → history-P4LA65T5.js} +7 -7
  99. package/dist/hyperframe-runtime.js +58 -57
  100. package/dist/hyperframe.manifest.json +1 -1
  101. package/dist/hyperframe.runtime.iife.js +58 -57
  102. package/dist/hyperframes-player.global.js +3 -3
  103. package/dist/{info-DJ6VNESS.js → info-QHRJW6Y3.js} +7 -7
  104. package/dist/{init-TSRTMVRN.js → init-AG6YVVJN.js} +21 -20
  105. package/dist/{inspect-VTZXXDJ4.js → inspect-TT66DYEC.js} +27 -26
  106. package/dist/{installer-3ERHU4CD.js → installer-5ZKUQBWW.js} +4 -4
  107. package/dist/{keyframes-6DN7BOYJ.js → keyframes-CJJGCW3R.js} +6 -6
  108. package/dist/{lambda-RCOIEGL6.js → lambda-3BMEOSP7.js} +10 -12
  109. package/dist/{layout-FFGRLVK4.js → layout-BSDCTMJK.js} +27 -26
  110. package/dist/{lint-MBYIDFKS.js → lint-6CL2R2FK.js} +6 -6
  111. package/dist/{list-KEZDFW5R.js → list-5VYOLEFN.js} +2 -2
  112. package/dist/{login-7ZV374QL.js → login-PNRREAOC.js} +4 -4
  113. package/dist/{media-treatment-LGWWRXAX.js → media-treatment-KHJX73WZ.js} +8 -8
  114. package/dist/{models-TC4K6UQP.js → models-INX67ETR.js} +8 -8
  115. package/dist/{motionShot-4E3RTV5O.js → motionShot-VIUXVMTV.js} +12 -12
  116. package/dist/{normalize-audio-XCGB2IQP.js → normalize-audio-T5QMN476.js} +4 -4
  117. package/dist/{open-JNNJSNTH.js → open-T57KLGFX.js} +4 -4
  118. package/dist/{parakeetRunner-S3DG4BJB.js → parakeetRunner-PCCBODBS.js} +8 -8
  119. package/dist/{pipeline-3SIYCBLU.js → pipeline-GDC7SL5N.js} +5 -5
  120. package/dist/{play-LBPOOD3V.js → play-TQWHYMAT.js} +19 -18
  121. package/dist/{present-PWEN5SDL.js → present-U5OFT6IF.js} +14 -14
  122. package/dist/{preview-IS32RLKM.js → preview-WWTDQQSB.js} +20 -16
  123. package/dist/{producer-4UUUEPPS.js → producer-23NJEJRO.js} +1 -1
  124. package/dist/{projectConfig-K347VIO3.js → projectConfig-OXNA35QN.js} +7 -6
  125. package/dist/{publication-4CQS532O.js → publication-GY3OJ6VH.js} +2 -2
  126. package/dist/{publish-OJYF37FY.js → publish-WZD4NLWM.js} +8 -7
  127. package/dist/{remove-background-HO6YL2HU.js → remove-background-Q7CQ3PJF.js} +6 -6
  128. package/dist/{render-L76SEAMC.js → render-24JWWXMA.js} +3 -3
  129. package/dist/{render-QBQYF2NC.js → render-FTVXKXSQ.js} +24 -23
  130. package/dist/{render-Q6QAXJCN.js → render-RZUU76V5.js} +8 -8
  131. package/dist/{render-batch-JLANN5Y2.js → render-batch-FCR7RX6U.js} +7 -20
  132. package/dist/renderSetupWorker.js +9 -1
  133. package/dist/{resolver-EDUM4DHG.js → resolver-4SPHOGY7.js} +5 -4
  134. package/dist/{sherpa-QEM5XYHD.js → sherpa-VMADZBF7.js} +7 -7
  135. package/dist/skills/media-use/SKILL.md +3 -3
  136. package/dist/skills/media-use/audio/references/requirements.md +7 -7
  137. package/dist/skills/media-use/audio/references/sfx.md +19 -13
  138. package/dist/skills/media-use/audio/scripts/audio.mjs +9 -9
  139. package/dist/skills/media-use/audio/scripts/audio.test.mjs +17 -10
  140. package/dist/skills/media-use/audio/scripts/lib/media-record.mjs +7 -3
  141. package/dist/skills/media-use/audio/scripts/lib/media-record.test.mjs +22 -3
  142. package/dist/skills/media-use/audio/scripts/lib/openverse.mjs +134 -0
  143. package/dist/skills/media-use/audio/scripts/lib/sfx.mjs +120 -89
  144. package/dist/skills/media-use/audio/scripts/lib/sfx.test.mjs +222 -12
  145. package/dist/skills/media-use/references/audio.md +1 -1
  146. package/dist/skills/media-use/references/resolve.md +1 -1
  147. package/dist/skills/media-use/references/setup-providers.md +13 -12
  148. package/dist/skills/media-use/scripts/lib/heygen-cli.mjs +4 -7
  149. package/dist/skills/media-use/scripts/lib/heygen-cli.test.mjs +5 -5
  150. package/dist/skills/media-use/scripts/lib/manifest.d.mts +1 -0
  151. package/dist/skills/media-use/scripts/lib/manifest.mjs +9 -6
  152. package/dist/skills/media-use/scripts/lib/openverse.mjs +134 -0
  153. package/dist/skills/media-use/scripts/lib/openverse.test.mjs +219 -0
  154. package/dist/skills/media-use/scripts/lib/registry.mjs +4 -2
  155. package/dist/skills/media-use/scripts/lib/registry.test.mjs +13 -13
  156. package/dist/skills/media-use/scripts/lib/sfx-provider.mjs +23 -13
  157. package/dist/skills/media-use/scripts/resolve.mjs +45 -55
  158. package/dist/{skills-FSZK6FIG.js → skills-7LBLAEH4.js} +5 -5
  159. package/dist/{skillsUpdateCheck-3354HXDJ.js → skillsUpdateCheck-AHK7CQUP.js} +3 -3
  160. package/dist/{snapshot-5VVMFEMM.js → snapshot-DOS6NQXM.js} +29 -28
  161. package/dist/{src-RYILCNU7.js → src-J6KABXGZ.js} +8 -8
  162. package/dist/{src-ZGMLMQ3B.js → src-VFTQPSQD.js} +4 -4
  163. package/dist/{staticProjectServer-PIVSGEAO.js → staticProjectServer-2YNWMUSU.js} +15 -14
  164. package/dist/studio/assets/{hyperframes-player-B04Yx96S.js → hyperframes-player-DohJxMIU.js} +2 -2
  165. package/dist/studio/assets/{index-D2e0J6kh.js → index-BOkm4Ooc.js} +101 -101
  166. package/dist/studio/assets/{index-D9CDX_Rr.js → index-DfwtrPPt.js} +1 -1
  167. package/dist/studio/index.html +1 -1
  168. package/dist/{studio-api-PHADR6VB.js → studio-api-NEBM56HH.js} +8 -8
  169. package/dist/{studioServer-5AVDKN5V.js → studioServer-LYDRHW7D.js} +45 -39
  170. package/dist/{telemetry-JCTHMPSB.js → telemetry-FAYON6XS.js} +3 -3
  171. package/dist/{timeline-QU2F6R2M.js → timeline-UKJ53XLC.js} +16 -16
  172. package/dist/{tokens-YYK4G36C.js → tokens-SO3ZXEFM.js} +2 -2
  173. package/dist/{transcribe-7ORH7R6O.js → transcribe-IM5UNBSH.js} +6 -6
  174. package/dist/{transcribe-PRG4FLLA.js → transcribe-PS5XSTXN.js} +12 -12
  175. package/dist/{updateCheck-NV7QNANK.js → updateCheck-ZV422M72.js} +2 -2
  176. package/dist/{upgrade-UZXN36J2.js → upgrade-GHG5FWZJ.js} +2 -2
  177. package/dist/{urlDownloader-AW57H722.js → urlDownloader-BOLOMGC7.js} +4 -4
  178. package/dist/{validate-QD53ABUM.js → validate-K4ZGXH2M.js} +20 -20
  179. package/dist/{video-VLVPYQQR.js → video-HUNOZDLT.js} +5 -5
  180. package/package.json +1 -1
  181. package/dist/chunk-BIV5HVTQ.js +0 -3803
@@ -31,7 +31,7 @@ import {
31
31
  renderFrameIdForRenderId,
32
32
  resolveAuthoredTimingWindow,
33
33
  toFps
34
- } from "./chunk-O3J7BHBU.js";
34
+ } from "./chunk-QZUVPWC4.js";
35
35
  import {
36
36
  AUDIO_GROUP_RENDER_ID_ATTR,
37
37
  COLOR_GRADING_SOURCE_HIDDEN_ATTR,
@@ -60,7 +60,7 @@ import {
60
60
  shiftRateLane,
61
61
  sourceTimeAt,
62
62
  timeAtSourceTime
63
- } from "./chunk-BIV5HVTQ.js";
63
+ } from "./chunk-6M3IPJS6.js";
64
64
  import {
65
65
  clampAudioGain,
66
66
  isAudibleVideoElement
@@ -5873,6 +5873,26 @@ async function decodeAllImages(page) {
5873
5873
  );
5874
5874
  });
5875
5875
  }
5876
+ function releasableVideoIds(options) {
5877
+ const hinted = new Set((options.videoMetadataHints ?? []).map((hint) => hint.id));
5878
+ return (options.skipReadinessVideoIds ?? []).filter((id) => hinted.has(id));
5879
+ }
5880
+ async function releaseInjectedVideoMedia(page, videoIds) {
5881
+ if (videoIds.length === 0) return;
5882
+ await page.evaluate(
5883
+ (ids) => {
5884
+ for (const id of ids) {
5885
+ const video = window.__hfMediaEl?.(id) ?? document.getElementById(id);
5886
+ if (!(video instanceof HTMLVideoElement)) continue;
5887
+ video.pause();
5888
+ for (const source of video.querySelectorAll("source")) source.remove();
5889
+ video.removeAttribute("src");
5890
+ video.load();
5891
+ }
5892
+ },
5893
+ [...videoIds]
5894
+ );
5895
+ }
5876
5896
  async function applyVideoMetadataHints(page, hints) {
5877
5897
  if (!hints || hints.length === 0) return;
5878
5898
  await page.evaluate(
@@ -6087,6 +6107,7 @@ async function initializeSession(session) {
6087
6107
  assertVfxIntact(session);
6088
6108
  recordSubTimelineWarning(session, pageReadyTimeout);
6089
6109
  await applyVideoMetadataHints(page, session.options.videoMetadataHints);
6110
+ await releaseInjectedVideoMedia(page, releasableVideoIds(session.options));
6090
6111
  logInitPhase("applyVideoMetadataHints complete");
6091
6112
  const skipVideoIds = session.options.skipReadinessVideoIds ?? [];
6092
6113
  const [videosReady] = await Promise.all([
@@ -6193,6 +6214,7 @@ async function initializeSession(session) {
6193
6214
  assertVfxIntact(session);
6194
6215
  recordSubTimelineWarning(session, pageReadyTimeout);
6195
6216
  await applyVideoMetadataHints(page, session.options.videoMetadataHints);
6217
+ await releaseInjectedVideoMedia(page, releasableVideoIds(session.options));
6196
6218
  logInitPhase("applyVideoMetadataHints complete");
6197
6219
  const bfSkipVideoIds = session.options.skipReadinessVideoIds ?? [];
6198
6220
  const [bfVideosReady] = await Promise.all([
@@ -6637,6 +6659,7 @@ async function createStaticVerificationPage(session) {
6637
6659
  knownUnregisteredIds: session.subTimelineWaitMemo.unregisteredIds
6638
6660
  });
6639
6661
  await applyVideoMetadataHints(page, session.options.videoMetadataHints);
6662
+ await releaseInjectedVideoMedia(page, releasableVideoIds(session.options));
6640
6663
  const skipVideoIds = session.options.skipReadinessVideoIds ?? [];
6641
6664
  await Promise.all([
6642
6665
  pollVideosReady(page, skipVideoIds, pageReadyTimeout),
@@ -13659,8 +13682,8 @@ async function queryElementStacking(page, nativeHdrIds) {
13659
13682
  }
13660
13683
 
13661
13684
  // ../engine/src/services/audioMixer.ts
13662
- import { closeSync as closeSync4, existsSync as existsSync10, mkdirSync as mkdirSync7, mkdtempSync as mkdtempSync6, openSync as openSync4, rmSync as rmSync7, writeFileSync as writeFileSync6 } from "fs";
13663
- import { join as join13, dirname as dirname6, isAbsolute, relative } from "path";
13685
+ import { closeSync as closeSync4, existsSync as existsSync10, mkdirSync as mkdirSync7, mkdtempSync as mkdtempSync7, openSync as openSync4, rmSync as rmSync8, writeFileSync as writeFileSync7 } from "fs";
13686
+ import { join as join14, dirname as dirname7, isAbsolute, relative } from "path";
13664
13687
 
13665
13688
  // ../engine/src/utils/notMediaPayload.ts
13666
13689
  import { createHash as createHash3 } from "crypto";
@@ -13774,6 +13797,99 @@ function clampFadesToDuration(fades, duration) {
13774
13797
  return { fadeIn: fadeIn * scale, fadeOut: fadeOut * scale };
13775
13798
  }
13776
13799
 
13800
+ // ../engine/src/services/aacEncode.ts
13801
+ import { mkdtempSync as mkdtempSync4, readFileSync as readFileSync5, rmSync as rmSync5, writeFileSync as writeFileSync4 } from "fs";
13802
+ import { dirname as dirname5, join as join11 } from "path";
13803
+ var SAMPLE_RATE = 48e3;
13804
+ var FRAME_SAMPLES = 1024;
13805
+ var MIN_SEGMENT_SECONDS = 60;
13806
+ var MAX_SEGMENTS = 8;
13807
+ var PRE_ROLL_FRAMES = 469;
13808
+ var POST_ROLL_FRAMES = 8;
13809
+ var AAC_ARGS = ["-acodec", "aac", "-b:a", "192k"];
13810
+ function aacSegmentCount(totalDuration) {
13811
+ return Math.max(1, Math.min(MAX_SEGMENTS, Math.floor(totalDuration / MIN_SEGMENT_SECONDS)));
13812
+ }
13813
+ function splitAdtsFrames(bytes) {
13814
+ const frames = [];
13815
+ for (let at = 0; at < bytes.length; ) {
13816
+ const length = (bytes[at + 3] & 3) << 11 | bytes[at + 4] << 3 | bytes[at + 5] >> 5;
13817
+ if (bytes[at] !== 255 || (bytes[at + 1] & 240) !== 240 || length < 7) {
13818
+ throw new Error(`Not an ADTS frame at byte ${at}`);
13819
+ }
13820
+ frames.push(bytes.subarray(at, at + length));
13821
+ at += length;
13822
+ }
13823
+ return frames;
13824
+ }
13825
+ function planSegments(totalDuration, count) {
13826
+ const packets = Math.ceil(Math.round(totalDuration * SAMPLE_RATE) / FRAME_SAMPLES) + 1;
13827
+ const cuts = Array.from({ length: count + 1 }, (_, k) => Math.round(k * packets / count));
13828
+ return cuts.slice(0, -1).map((cut, k) => {
13829
+ const next = cuts[k + 1];
13830
+ const firstFrame = Math.max(0, cut - PRE_ROLL_FRAMES);
13831
+ const end = k === count - 1 ? "" : `:end_sample=${(next + POST_ROLL_FRAMES) * FRAME_SAMPLES}`;
13832
+ const trim = `atrim=start_sample=${firstFrame * FRAME_SAMPLES}${end}`;
13833
+ return { trim, keepFrom: cut - firstFrame, keepTo: next - firstFrame };
13834
+ });
13835
+ }
13836
+ async function encodeAac(input, outputPath, totalDuration, { signal, timeout }) {
13837
+ const count = aacSegmentCount(totalDuration);
13838
+ if (count === 1) {
13839
+ const args = ["-i", input, "-t", String(totalDuration), ...AAC_ARGS, "-y", outputPath];
13840
+ return runFfmpeg(args, { signal, timeout });
13841
+ }
13842
+ const dir = mkdtempSync4(join11(dirname5(outputPath), ".aac-segments-"));
13843
+ try {
13844
+ const segments = planSegments(totalDuration, count).map((segment, k) => ({
13845
+ ...segment,
13846
+ path: join11(dir, `${k}.aac`)
13847
+ }));
13848
+ const results = await Promise.all(
13849
+ segments.map(
13850
+ ({ trim, path }) => runFfmpeg(["-i", input, "-af", trim, ...AAC_ARGS, "-f", "adts", "-y", path], {
13851
+ signal,
13852
+ timeout
13853
+ })
13854
+ )
13855
+ );
13856
+ const failed = results.find((result) => !result.success);
13857
+ if (failed) return failed;
13858
+ const joined = join11(dir, "joined.aac");
13859
+ const frames = segments.flatMap(({ path, keepFrom, keepTo }) => {
13860
+ const segmentFrames = splitAdtsFrames(readFileSync5(path));
13861
+ if (segmentFrames.length < keepTo) {
13862
+ throw new Error(`AAC segment ${path} has ${segmentFrames.length} frames, needs ${keepTo}`);
13863
+ }
13864
+ return segmentFrames.slice(keepFrom, keepTo);
13865
+ });
13866
+ writeFileSync4(joined, Buffer.concat(frames));
13867
+ const offset = String(-FRAME_SAMPLES / SAMPLE_RATE);
13868
+ const end = `setts=duration='if(gte((PTS+DURATION)*TB,${totalDuration}),round(${totalDuration}/TB-PTS),DURATION)'`;
13869
+ const muxed = await runFfmpeg(
13870
+ [
13871
+ "-itsoffset",
13872
+ offset,
13873
+ "-f",
13874
+ "aac",
13875
+ "-i",
13876
+ joined,
13877
+ "-c",
13878
+ "copy",
13879
+ "-bsf:a",
13880
+ end,
13881
+ "-y",
13882
+ outputPath
13883
+ ],
13884
+ { signal, timeout }
13885
+ );
13886
+ const slowest = Math.max(...results.map((result) => result.durationMs));
13887
+ return { ...muxed, durationMs: slowest + muxed.durationMs };
13888
+ } finally {
13889
+ rmSync5(dir, { recursive: true, force: true });
13890
+ }
13891
+ }
13892
+
13777
13893
  // ../engine/src/services/audioFailureDiagnostic.ts
13778
13894
  var STAGES = /* @__PURE__ */ new Set([
13779
13895
  "source",
@@ -13873,8 +13989,8 @@ function audioFailureDiagnostics(values) {
13873
13989
  }
13874
13990
 
13875
13991
  // ../engine/src/services/audioVolumeEnvelope.ts
13876
- import { mkdtempSync as mkdtempSync4, readFileSync as readFileSync5, renameSync as renameSync2, rmSync as rmSync5, writeFileSync as writeFileSync4 } from "fs";
13877
- import { dirname as dirname5, join as join11 } from "path";
13992
+ import { mkdtempSync as mkdtempSync5, readFileSync as readFileSync6, renameSync as renameSync2, rmSync as rmSync6, writeFileSync as writeFileSync5 } from "fs";
13993
+ import { dirname as dirname6, join as join12 } from "path";
13878
13994
 
13879
13995
  // ../core/dist/runtime/mediaVolumeEnvelope.js
13880
13996
  function normaliseEnvelope(keyframes, trackStart, baseVolume) {
@@ -13996,13 +14112,13 @@ function applyVolumeEnvelopeToWav(wavPath, keyframes, trackStart, baseVolume) {
13996
14112
  if (!gainAt) return false;
13997
14113
  let stagingDir;
13998
14114
  try {
13999
- const buffer = readFileSync5(wavPath);
14115
+ const buffer = readFileSync6(wavPath);
14000
14116
  const layout = parseWavLayout(buffer);
14001
14117
  if (!layout) return false;
14002
14118
  scaleSamples(buffer, layout, gainAt);
14003
- stagingDir = mkdtempSync4(join11(dirname5(wavPath), ".hf-volume-"));
14004
- const tempPath = join11(stagingDir, "audio.wav");
14005
- writeFileSync4(tempPath, buffer, { flag: "wx" });
14119
+ stagingDir = mkdtempSync5(join12(dirname6(wavPath), ".hf-volume-"));
14120
+ const tempPath = join12(stagingDir, "audio.wav");
14121
+ writeFileSync5(tempPath, buffer, { flag: "wx" });
14006
14122
  renameSync2(tempPath, wavPath);
14007
14123
  return true;
14008
14124
  } catch {
@@ -14010,7 +14126,7 @@ function applyVolumeEnvelopeToWav(wavPath, keyframes, trackStart, baseVolume) {
14010
14126
  } finally {
14011
14127
  if (stagingDir) {
14012
14128
  try {
14013
- rmSync5(stagingDir, { recursive: true, force: true });
14129
+ rmSync6(stagingDir, { recursive: true, force: true });
14014
14130
  } catch {
14015
14131
  }
14016
14132
  }
@@ -14231,17 +14347,17 @@ function chainTailSeconds(chain, automation) {
14231
14347
  import {
14232
14348
  closeSync as closeSync3,
14233
14349
  existsSync as existsSync9,
14234
- mkdtempSync as mkdtempSync5,
14350
+ mkdtempSync as mkdtempSync6,
14235
14351
  openSync as openSync3,
14236
- readFileSync as readFileSync6,
14352
+ readFileSync as readFileSync7,
14237
14353
  readSync,
14238
- rmSync as rmSync6,
14354
+ rmSync as rmSync7,
14239
14355
  statSync as statSync7,
14240
- writeFileSync as writeFileSync5,
14356
+ writeFileSync as writeFileSync6,
14241
14357
  writeSync as writeSync2
14242
14358
  } from "fs";
14243
14359
  import { tmpdir as tmpdir3 } from "os";
14244
- import { join as join12 } from "path";
14360
+ import { join as join13 } from "path";
14245
14361
  import { pathToFileURL } from "url";
14246
14362
 
14247
14363
  // ../core/dist/generated/audio-fx-runtime-inline.js
@@ -14336,7 +14452,7 @@ function readWavHeader(path) {
14336
14452
  }
14337
14453
  }
14338
14454
  function readWav(path) {
14339
- const buf = readFileSync6(path);
14455
+ const buf = readFileSync7(path);
14340
14456
  if (buf.length < 44 || buf.toString("ascii", 0, 4) !== "RIFF") {
14341
14457
  throw new AudioFxRenderError(`Not a WAV file: ${path}`);
14342
14458
  }
@@ -14399,7 +14515,7 @@ function encodeSamples(samples, float) {
14399
14515
  function writeWav(path, samples, sampleRate, channels = 1, float = false) {
14400
14516
  const body = encodeSamples(samples, float);
14401
14517
  const buf = Buffer.concat([wavHeader(body.length, sampleRate, channels, float), body]);
14402
- writeFileSync5(path, buf);
14518
+ writeFileSync6(path, buf);
14403
14519
  }
14404
14520
  function deinterleave(samples, channels) {
14405
14521
  if (channels <= 1) return [samples];
@@ -14525,7 +14641,7 @@ async function renderInSegments(openPage, inputWav, header, chain, outputWav, op
14525
14641
  );
14526
14642
  if (gainAt) applyEnvelopeToPlanes(kept, sampleRate, gainAt, seg.keepFrom);
14527
14643
  const bytes = encodeSamples(interleave(kept), float);
14528
- writeFileSync5(outFd, bytes);
14644
+ writeFileSync6(outFd, bytes);
14529
14645
  written += bytes.length;
14530
14646
  }
14531
14647
  writeSync2(outFd, wavHeader(written, sampleRate, channels, float), 0, 44, 0);
@@ -14588,7 +14704,7 @@ async function applyAudioFxChain(inputWav, chain, outputWav, options) {
14588
14704
  });
14589
14705
  }
14590
14706
  async function withFxBrowser(options, body) {
14591
- const hostDir = mkdtempSync5(join12(tmpdir3(), "hf-fx-host-"));
14707
+ const hostDir = mkdtempSync6(join13(tmpdir3(), "hf-fx-host-"));
14592
14708
  let lease = null;
14593
14709
  try {
14594
14710
  if (options.signal?.aborted) {
@@ -14603,15 +14719,15 @@ async function withFxBrowser(options, body) {
14603
14719
  `Audio FX failed for track ${options.trackId}: ${err.message}`
14604
14720
  );
14605
14721
  } finally {
14606
- rmSync6(hostDir, { recursive: true, force: true });
14722
+ rmSync7(hostDir, { recursive: true, force: true });
14607
14723
  await lease?.release().catch(() => void 0);
14608
14724
  }
14609
14725
  }
14610
14726
  async function openFxPage(browser, hostDir) {
14611
14727
  const page = await browser.newPage();
14612
14728
  try {
14613
- const hostPage = join12(hostDir, "audio-fx.html");
14614
- writeFileSync5(hostPage, "<!doctype html><meta charset=utf-8><title>audio fx</title>");
14729
+ const hostPage = join13(hostDir, "audio-fx.html");
14730
+ writeFileSync6(hostPage, "<!doctype html><meta charset=utf-8><title>audio fx</title>");
14615
14731
  await page.goto(pathToFileURL(hostPage).href, {
14616
14732
  waitUntil: "domcontentloaded"
14617
14733
  });
@@ -15049,7 +15165,7 @@ function parseAudioElements(html) {
15049
15165
  }
15050
15166
  async function extractAudioSegment(srcPath, outputPath, stage, mediaStart, duration, playbackRate = 1, signal, config) {
15051
15167
  const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
15052
- const outputDir = dirname6(outputPath);
15168
+ const outputDir = dirname7(outputPath);
15053
15169
  if (!existsSync10(outputDir)) mkdirSync7(outputDir, { recursive: true });
15054
15170
  const normalizedPlaybackRate = normalizeRateSpec(playbackRate);
15055
15171
  const sourceDuration = sourceTimeAt(normalizedPlaybackRate, duration);
@@ -15095,7 +15211,7 @@ async function extractAudioSegment(srcPath, outputPath, stage, mediaStart, durat
15095
15211
  }
15096
15212
  async function generateSilence(outputPath, duration, signal, config) {
15097
15213
  const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
15098
- const outputDir = dirname6(outputPath);
15214
+ const outputDir = dirname7(outputPath);
15099
15215
  if (!existsSync10(outputDir)) mkdirSync7(outputDir, { recursive: true });
15100
15216
  const args = [
15101
15217
  "-f",
@@ -15149,7 +15265,7 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config,
15149
15265
  failures: result2.failure ? [result2.failure] : void 0
15150
15266
  };
15151
15267
  }
15152
- const outputDir = dirname6(outputPath);
15268
+ const outputDir = dirname7(outputPath);
15153
15269
  if (!existsSync10(outputDir)) mkdirSync7(outputDir, { recursive: true });
15154
15270
  const buildFilterComplex = (ignoreAutomation, useNormalize2) => {
15155
15271
  const filterParts = [];
@@ -15166,11 +15282,11 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config,
15166
15282
  const runMix = async (ignoreAutomation, useNormalize2) => {
15167
15283
  const inputs = [];
15168
15284
  tracks.forEach((track) => inputs.push("-i", track.srcPath));
15169
- const scriptDir = mkdtempSync6(join13(outputDir, ".filter-complex-"));
15170
- const scriptPath = join13(scriptDir, "graph.txt");
15285
+ const scriptDir = mkdtempSync7(join14(outputDir, ".filter-complex-"));
15286
+ const scriptPath = join14(scriptDir, "graph.txt");
15171
15287
  const fd = openSync4(scriptPath, "wx", 384);
15172
15288
  try {
15173
- writeFileSync6(fd, buildFilterComplex(ignoreAutomation, useNormalize2));
15289
+ writeFileSync7(fd, buildFilterComplex(ignoreAutomation, useNormalize2));
15174
15290
  } finally {
15175
15291
  closeSync4(fd);
15176
15292
  }
@@ -15180,7 +15296,7 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config,
15180
15296
  scriptPath,
15181
15297
  "-map",
15182
15298
  "[out]",
15183
- ...floatWav ? ["-acodec", "pcm_f32le", "-ar", "48000"] : ["-acodec", "aac", "-b:a", "192k"],
15299
+ ...floatWav ? ["-acodec", "pcm_f32le", "-ar", "48000"] : AAC_ARGS,
15184
15300
  "-t",
15185
15301
  String(totalDuration),
15186
15302
  "-y",
@@ -15195,7 +15311,7 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config,
15195
15311
  currentArgs[currentArgs.indexOf("-filter_complex_script")] = "-/filter_complex";
15196
15312
  return await runFfmpeg(currentArgs, { signal, timeout: ffmpegProcessTimeout });
15197
15313
  } finally {
15198
- rmSync7(scriptDir, { recursive: true, force: true });
15314
+ rmSync8(scriptDir, { recursive: true, force: true });
15199
15315
  }
15200
15316
  };
15201
15317
  let useNormalize = true;
@@ -15255,7 +15371,7 @@ function groupNormalizeOptionUnsupported(stderr) {
15255
15371
  }
15256
15372
  async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal, config) {
15257
15373
  const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
15258
- const outputDir = dirname6(outputPath);
15374
+ const outputDir = dirname7(outputPath);
15259
15375
  if (!existsSync10(outputDir)) mkdirSync7(outputDir, { recursive: true });
15260
15376
  const buildInputFilters = (ignoreKeyframes) => memberTracks.map((track, i) => {
15261
15377
  const volumeFilter = buildVolumeExpression(track, ignoreKeyframes);
@@ -15273,11 +15389,11 @@ async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal,
15273
15389
  `${mixInputs}amix=inputs=${memberTracks.length}:duration=longest:dropout_transition=0[mixed];[mixed]volume=${formatFilterNumber(memberTracks.length)}[out]`
15274
15390
  );
15275
15391
  const filterComplex = [...inputFilters, mixFilter].join(";");
15276
- const scriptDir = mkdtempSync6(join13(outputDir, ".group-filter-complex-"));
15277
- const scriptPath = join13(scriptDir, "graph.txt");
15392
+ const scriptDir = mkdtempSync7(join14(outputDir, ".group-filter-complex-"));
15393
+ const scriptPath = join14(scriptDir, "graph.txt");
15278
15394
  const fd = openSync4(scriptPath, "wx", 384);
15279
15395
  try {
15280
- writeFileSync6(fd, filterComplex);
15396
+ writeFileSync7(fd, filterComplex);
15281
15397
  } finally {
15282
15398
  closeSync4(fd);
15283
15399
  }
@@ -15314,7 +15430,7 @@ async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal,
15314
15430
  currentArgs[currentArgs.indexOf("-filter_complex_script")] = "-/filter_complex";
15315
15431
  return await runFfmpeg(currentArgs, { signal, timeout: ffmpegProcessTimeout });
15316
15432
  } finally {
15317
- rmSync7(scriptDir, { recursive: true, force: true });
15433
+ rmSync8(scriptDir, { recursive: true, force: true });
15318
15434
  }
15319
15435
  };
15320
15436
  let useNormalize = true;
@@ -15338,29 +15454,18 @@ async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal,
15338
15454
  }
15339
15455
  return { success: true, degradedAutomation };
15340
15456
  }
15341
- async function mixThroughMasterBus(tracks, masterChain, outputPath, workDir, totalDuration, signal, config) {
15342
- const sumPath = join13(workDir, "master-sum.wav");
15457
+ async function mixThroughFloatSum(tracks, masterChain, outputPath, workDir, totalDuration, signal, config) {
15458
+ const sumPath = join14(workDir, "master-sum.wav");
15343
15459
  const sum = await mixAudioTracks(tracks, sumPath, totalDuration, signal, config, true);
15344
15460
  if (!sum.success) return { ...sum, outputPath };
15345
- const fx = await applyAudioFxChain(sumPath, masterChain, join13(workDir, "master-fx.wav"), {
15461
+ const encoderInput = masterChain ? (await applyAudioFxChain(sumPath, masterChain, join14(workDir, "master-fx.wav"), {
15346
15462
  trackId: "master",
15347
15463
  signal
15464
+ })).path : sumPath;
15465
+ const encoded = await encodeAac(encoderInput, outputPath, totalDuration, {
15466
+ signal,
15467
+ timeout: config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout
15348
15468
  });
15349
- const encoded = await runFfmpeg(
15350
- [
15351
- "-i",
15352
- fx.path,
15353
- "-t",
15354
- String(totalDuration),
15355
- "-acodec",
15356
- "aac",
15357
- "-b:a",
15358
- "192k",
15359
- "-y",
15360
- outputPath
15361
- ],
15362
- { signal, timeout: config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout }
15363
- );
15364
15469
  if (!encoded.success) {
15365
15470
  const failure = ffmpegFailure("mix", encoded);
15366
15471
  return {
@@ -15465,7 +15570,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
15465
15570
  }
15466
15571
  let audioSrcPath = srcPath;
15467
15572
  if (element.type === "video") {
15468
- const extractedPath = join13(workDir, `${element.id}-extracted.wav`);
15573
+ const extractedPath = join14(workDir, `${element.id}-extracted.wav`);
15469
15574
  const extractResult = await extractAudioSegment(
15470
15575
  srcPath,
15471
15576
  extractedPath,
@@ -15491,7 +15596,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
15491
15596
  }
15492
15597
  audioSrcPath = extractedPath;
15493
15598
  } else {
15494
- const trimmedPath = join13(workDir, `${element.id}-trimmed.wav`);
15599
+ const trimmedPath = join14(workDir, `${element.id}-trimmed.wav`);
15495
15600
  const prepResult = await extractAudioSegment(
15496
15601
  srcPath,
15497
15602
  trimmedPath,
@@ -15536,7 +15641,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
15536
15641
  const fxResult = await applyAudioFxChain(
15537
15642
  audioSrcPath,
15538
15643
  chain,
15539
- join13(workDir, `${element.id}-fx.wav`),
15644
+ join14(workDir, `${element.id}-fx.wav`),
15540
15645
  {
15541
15646
  trackId: element.id,
15542
15647
  signal: effectiveSignal,
@@ -15587,7 +15692,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
15587
15692
  ).catch((err) => {
15588
15693
  internalController.abort();
15589
15694
  try {
15590
- rmSync7(workDir, { recursive: true, force: true });
15695
+ rmSync8(workDir, { recursive: true, force: true });
15591
15696
  } catch {
15592
15697
  }
15593
15698
  throw err;
@@ -15612,7 +15717,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
15612
15717
  });
15613
15718
  const removeWorkDir = () => {
15614
15719
  try {
15615
- rmSync7(workDir, { recursive: true, force: true });
15720
+ rmSync8(workDir, { recursive: true, force: true });
15616
15721
  } catch {
15617
15722
  }
15618
15723
  };
@@ -15656,7 +15761,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
15656
15761
  const meta = groupMeta.get(groupId);
15657
15762
  if (!meta) continue;
15658
15763
  const pathId = safePathSegment(groupId, groupIndex);
15659
- const groupWavPath = join13(workDir, `group-${pathId}.wav`);
15764
+ const groupWavPath = join14(workDir, `group-${pathId}.wav`);
15660
15765
  try {
15661
15766
  const subMix = await mixGroupMembers(
15662
15767
  memberTracks,
@@ -15689,7 +15794,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
15689
15794
  const fxResult = await applyAudioFxChain(
15690
15795
  groupSrcPath,
15691
15796
  chain,
15692
- join13(workDir, `group-${pathId}-fx.wav`),
15797
+ join14(workDir, `group-${pathId}-fx.wav`),
15693
15798
  {
15694
15799
  trackId: groupId,
15695
15800
  signal: effectiveSignal,
@@ -15741,7 +15846,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
15741
15846
  if (failures.length > 0) return bail();
15742
15847
  let mixResult;
15743
15848
  try {
15744
- mixResult = masterChain && tracks.length > 0 ? await mixThroughMasterBus(
15849
+ mixResult = (masterChain || aacSegmentCount(totalDuration) > 1) && tracks.length > 0 ? await mixThroughFloatSum(
15745
15850
  tracks,
15746
15851
  masterChain,
15747
15852
  outputPath,
@@ -15769,21 +15874,21 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
15769
15874
  import { cpus as cpus2, freemem } from "os";
15770
15875
  import { existsSync as existsSync11, mkdirSync as mkdirSync8, readdirSync as readdirSync6 } from "fs";
15771
15876
  import { copyFile, readFile as readFile2, rename } from "fs/promises";
15772
- import { join as join15 } from "path";
15877
+ import { join as join16 } from "path";
15773
15878
  import { getHeapStatistics } from "v8";
15774
15879
 
15775
15880
  // ../engine/src/utils/psnr.ts
15776
15881
  import { execFile as execFile3 } from "child_process";
15777
15882
  import { mkdtemp, rm, writeFile } from "fs/promises";
15778
15883
  import { tmpdir as tmpdir4 } from "os";
15779
- import { join as join14 } from "path";
15884
+ import { join as join15 } from "path";
15780
15885
  import { promisify as promisify3 } from "util";
15781
15886
  async function psnrDb(a, b) {
15782
15887
  const execFileP = promisify3(execFile3);
15783
- const dir = await mkdtemp(join14(tmpdir4(), "hf-de-verify-"));
15888
+ const dir = await mkdtemp(join15(tmpdir4(), "hf-de-verify-"));
15784
15889
  try {
15785
- const pa = join14(dir, "a.jpg");
15786
- const pb = join14(dir, "b.jpg");
15890
+ const pa = join15(dir, "a.jpg");
15891
+ const pb = join15(dir, "b.jpg");
15787
15892
  await Promise.all([writeFile(pa, a), writeFile(pb, b)]);
15788
15893
  const { stderr } = await execFileP(
15789
15894
  getFfmpegBinary(),
@@ -16007,7 +16112,7 @@ function distributeFrames(totalFrames, workerCount, workDir, rangeStart = 0) {
16007
16112
  workerId: i,
16008
16113
  startFrame,
16009
16114
  endFrame,
16010
- outputDir: join15(workDir, `worker-${i}`),
16115
+ outputDir: join16(workDir, `worker-${i}`),
16011
16116
  outputFrameOffset: rangeStart
16012
16117
  });
16013
16118
  }
@@ -16021,7 +16126,7 @@ function distributeFramesInterleaved(totalFrames, workerCount, workDir, rangeSta
16021
16126
  startFrame: rangeStart + i,
16022
16127
  endFrame: rangeStart + totalFrames,
16023
16128
  frameStride: workerCount,
16024
- outputDir: join15(workDir, `worker-${i}`),
16129
+ outputDir: join16(workDir, `worker-${i}`),
16025
16130
  outputFrameOffset: rangeStart
16026
16131
  });
16027
16132
  }
@@ -16221,7 +16326,7 @@ async function verifyDiskDrawElementSamples(session, task, streaming) {
16221
16326
  for (const idx of selectVerifySampleIndicesForTask(truths.keys(), task)) {
16222
16327
  const truth = truths.get(idx);
16223
16328
  if (!truth) continue;
16224
- const framePath = join15(task.outputDir, `frame_${String(idx - offset).padStart(6, "0")}.${ext}`);
16329
+ const framePath = join16(task.outputDir, `frame_${String(idx - offset).padStart(6, "0")}.${ext}`);
16225
16330
  const db = await psnrForDiskSample(framePath, truth, task.workerId, idx);
16226
16331
  if (db === null) continue;
16227
16332
  assertDiskSampleAboveFloor(db, verifyMinDb, idx, task.workerId);
@@ -16458,8 +16563,8 @@ async function mergeWorkerFrames(workDir, tasks, outputDir) {
16458
16563
  }
16459
16564
  const files = readdirSync6(task.outputDir).filter((f) => f.startsWith("frame_") && (f.endsWith(".jpg") || f.endsWith(".png"))).sort();
16460
16565
  const copyTasks = files.map(async (file) => {
16461
- const sourcePath = join15(task.outputDir, file);
16462
- const targetPath = join15(outputDir, file);
16566
+ const sourcePath = join16(task.outputDir, file);
16567
+ const targetPath = join16(outputDir, file);
16463
16568
  try {
16464
16569
  await rename(sourcePath, targetPath);
16465
16570
  } catch {
@@ -16483,8 +16588,8 @@ function getSystemResources() {
16483
16588
  // ../engine/src/services/fileServer.ts
16484
16589
  import { Hono } from "hono";
16485
16590
  import { serve } from "@hono/node-server";
16486
- import { readFileSync as readFileSync7, openSync as openSync5, fstatSync, closeSync as closeSync5, statSync as statSync8, constants } from "fs";
16487
- import { join as join16, extname as extname3 } from "path";
16591
+ import { readFileSync as readFileSync8, openSync as openSync5, fstatSync, closeSync as closeSync5, statSync as statSync8, constants } from "fs";
16592
+ import { join as join17, extname as extname3 } from "path";
16488
16593
  var MIME_TYPES = {
16489
16594
  ".html": "text/html; charset=utf-8",
16490
16595
  ".css": "text/css; charset=utf-8",
@@ -16525,16 +16630,16 @@ function readRegularFile(filePath) {
16525
16630
  }
16526
16631
  try {
16527
16632
  if (!fstatSync(fd).isFile()) return null;
16528
- return readFileSync7(fd);
16633
+ return readFileSync8(fd);
16529
16634
  } finally {
16530
16635
  closeSync5(fd);
16531
16636
  }
16532
16637
  }
16533
16638
  function resolveContainedPaths(projectDir, compiledDir, relativePath) {
16534
- const projectPath = join16(projectDir, relativePath);
16639
+ const projectPath = join17(projectDir, relativePath);
16535
16640
  if (!isWithinProjectRoot(projectDir, projectPath)) return null;
16536
16641
  if (!compiledDir) return { projectPath, compiledPath: null };
16537
- const compiledPath = join16(compiledDir, relativePath);
16642
+ const compiledPath = join17(compiledDir, relativePath);
16538
16643
  if (!isWithinProjectRoot(compiledDir, compiledPath)) return null;
16539
16644
  return { projectPath, compiledPath };
16540
16645
  }
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  artifactDirectory,
9
9
  finishSnapshotRun
10
- } from "./chunk-JGYHWVXQ.js";
10
+ } from "./chunk-GMJ3ILLW.js";
11
11
 
12
12
  // src/utils/checkSnapshotDirectory.ts
13
13
  import { resolve } from "path";
@@ -10,7 +10,7 @@ import {
10
10
  isDevice,
11
11
  isQuality,
12
12
  render
13
- } from "./chunk-SJPNVLYS.js";
13
+ } from "./chunk-ERJHLFPD.js";
14
14
 
15
15
  // src/api/removeBackground.ts
16
16
  import { resolve } from "path";
@@ -8,14 +8,14 @@ import {
8
8
  DEFAULT_REGISTRY_URL,
9
9
  fetchItemFile,
10
10
  validRegistryItem
11
- } from "./chunk-EELTMBCC.js";
11
+ } from "./chunk-RTW6WSC7.js";
12
12
  import {
13
13
  publishRegistryFile,
14
14
  registryTargetPath
15
15
  } from "./chunk-GMECXFAN.js";
16
16
  import {
17
17
  validateVariables
18
- } from "./chunk-O3J7BHBU.js";
18
+ } from "./chunk-QZUVPWC4.js";
19
19
  import {
20
20
  realProjectRoot
21
21
  } from "./chunk-OFQWTKPW.js";
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  SYSTEM_FONT_SIZE_LIMIT,
9
9
  locateSystemFontVariants
10
- } from "./chunk-TJSTGSAW.js";
10
+ } from "./chunk-7FMUTGOH.js";
11
11
  import {
12
12
  EMBEDDED_FONT_DATA
13
13
  } from "./chunk-FI4I7CME.js";
@@ -3227,6 +3227,8 @@ function googleStylesheetFamilies(urlText) {
3227
3227
  return parsed.searchParams.getAll("family").flatMap((family) => family.split("|")).map((family) => family.split(":")[0]?.trim().toLowerCase() ?? "").filter(Boolean);
3228
3228
  }
3229
3229
  function importUrls(css) {
3230
+ if (!/@import/i.test(css))
3231
+ return [];
3230
3232
  let root;
3231
3233
  try {
3232
3234
  root = postcss.parse(css);
@@ -3483,6 +3485,8 @@ function normalizeSystemFontPrimaryFamilies(html, deterministicPrimary = "Inter"
3483
3485
  return changed ? document2.toString() : html;
3484
3486
  }
3485
3487
  function collectCssCustomProperties(css, customProperties) {
3488
+ if (!css.includes("--"))
3489
+ return;
3486
3490
  const root = parseCssRoot(css);
3487
3491
  if (!root)
3488
3492
  return;
@@ -3509,6 +3513,8 @@ function* iterateCssRootFontFamilyDeclarations(root) {
3509
3513
  yield* declarations;
3510
3514
  }
3511
3515
  function* iterateCssFontFamilyDeclarations(css) {
3516
+ if (!/font-family/i.test(css))
3517
+ return;
3512
3518
  const root = parseCssRoot(css);
3513
3519
  if (!root)
3514
3520
  return;