hyperframes 0.9.15 → 0.9.17

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 (284) hide show
  1. package/README.md +12 -2
  2. package/dist/{add-S3QTEUUZ.js → add-VZQBLSRT.js} +16 -15
  3. package/dist/{agentPromptGenerator-7FNPHUHJ.js → agentPromptGenerator-TGXEQHN3.js} +7 -9
  4. package/dist/{animatedGifPrep-NFT2NCNX.js → animatedGifPrep-25YV72PG.js} +7 -9
  5. package/dist/api.js +37 -38
  6. package/dist/{appHistory-BCWH6XYH.js → appHistory-WXJ4STHX.js} +2 -1
  7. package/dist/{asset-2BBOP7JZ.js → asset-UNDSQLEP.js} +2 -2
  8. package/dist/{assetCataloger-IY3XEIOP.js → assetCataloger-7RUWILYE.js} +9 -11
  9. package/dist/{audio-QJUSICGQ.js → audio-5O25WHIY.js} +22 -23
  10. package/dist/{auth-VDFPA4VH.js → auth-6JG6SMSP.js} +4 -4
  11. package/dist/{autoUpdate-XUQK5WGH.js → autoUpdate-YIRRNQ6V.js} +25 -16
  12. package/dist/{avatars-KCRRY6FB.js → avatars-YE2WC2TM.js} +16 -17
  13. package/dist/{backgroundChecks-QAR4J3EA.js → backgroundChecks-A7TYPXRD.js} +5 -4
  14. package/dist/backgroundChecksWorker.js +5 -4
  15. package/dist/{batchRender-IHSCRPWL.js → batchRender-EX5TDMP3.js} +5 -4
  16. package/dist/{beats-KHLBORQV.js → beats-F3AZFVZG.js} +11 -12
  17. package/dist/{benchmark-7OK27YVS.js → benchmark-ZBLLJL5C.js} +11 -11
  18. package/dist/{billing-CZWTUT4T.js → billing-MUTW7EEI.js} +80 -37
  19. package/dist/{browser-R4ZG7RVY.js → browser-BRIP2ZMX.js} +8 -7
  20. package/dist/{bundleWithLocalizedFonts-F3TAMJ2J.js → bundleWithLocalizedFonts-F557ZVFL.js} +1 -1
  21. package/dist/{capture-2TL7VL2K.js → capture-6TRISPA2.js} +17 -19
  22. package/dist/{capture-LRBDPPKP.js → capture-GSJVFS7R.js} +3 -3
  23. package/dist/{captureCompositionFrame-2XH2Z4RY.js → captureCompositionFrame-YRZVOCTO.js} +13 -15
  24. package/dist/{catalog-PTVMH3GV.js → catalog-5HJJNBFM.js} +24 -22
  25. package/dist/{catch-up-WRIIXOZE.js → catch-up-AQ5TFCAH.js} +9 -7
  26. package/dist/{check-XHB7IC3B.js → check-TYBSHODD.js} +46 -47
  27. package/dist/{checkAudio-LETXIMCO.js → checkAudio-LDSIWNQL.js} +10 -12
  28. package/dist/{checkBrowser-YHD3NILB.js → checkBrowser-7CFHX4VU.js} +37 -38
  29. package/dist/{chunk-6QP3ZSJN.js → chunk-2UJSYHED.js} +1 -1
  30. package/dist/{chunk-5G5YR4P3.js → chunk-3IMHFJDG.js} +30 -19
  31. package/dist/{chunk-US4BCRYB.js → chunk-3L2POG2J.js} +23 -1
  32. package/dist/{chunk-QBDOEJX2.js → chunk-426GU4YI.js} +1007 -643
  33. package/dist/{chunk-72K35GRP.js → chunk-4R63FXGU.js} +15 -5
  34. package/dist/{chunk-Q3IYSP4G.js → chunk-4TW62PDH.js} +17 -8
  35. package/dist/{chunk-44HJCTWN.js → chunk-64RLXCUT.js} +6 -3
  36. package/dist/{chunk-OO6AETRF.js → chunk-6DX4URUB.js} +1 -1
  37. package/dist/{chunk-AWV4F5TS.js → chunk-6OBCXHIF.js} +4 -4
  38. package/dist/{chunk-X5FSMQEJ.js → chunk-6RPKPL22.js} +1 -1
  39. package/dist/{chunk-7YCF2F5M.js → chunk-77E2UIIR.js} +1 -1
  40. package/dist/{chunk-QNE3NJO5.js → chunk-7BJQ4R4F.js} +3 -3
  41. package/dist/{chunk-UXS7VE75.js → chunk-7PZLR2JZ.js} +1 -1
  42. package/dist/{chunk-7WAEV3OM.js → chunk-AII4BFKZ.js} +2 -2
  43. package/dist/{chunk-EWAPC74T.js → chunk-ATTDG6NR.js} +1 -1
  44. package/dist/{chunk-UWZ2OIWM.js → chunk-AZO2YY3U.js} +1 -1
  45. package/dist/{chunk-QK4HTIXK.js → chunk-BIY3M2WW.js} +11 -11
  46. package/dist/{chunk-IL5CYE3O.js → chunk-C67RYYGK.js} +5 -5
  47. package/dist/{chunk-KIGPWWIE.js → chunk-C6MYVPHX.js} +1 -1
  48. package/dist/{chunk-CKEOCCMK.js → chunk-CMQZP52Y.js} +22 -18
  49. package/dist/{chunk-V5UBOBEG.js → chunk-CXSJ6H5Q.js} +3 -3
  50. package/dist/{chunk-YEE4A3IV.js → chunk-DEI35LJT.js} +2 -2
  51. package/dist/{chunk-XD7LQWTU.js → chunk-DLTSPBI7.js} +2 -2
  52. package/dist/{chunk-OMOBWXJL.js → chunk-DVKZ55DS.js} +2 -2
  53. package/dist/{chunk-UCQ7ZF47.js → chunk-E5FLGIV3.js} +2 -2
  54. package/dist/{chunk-UWB44MM4.js → chunk-ENJ3M6OM.js} +2 -2
  55. package/dist/{chunk-EOCFNE53.js → chunk-ENVFGBRD.js} +1 -1
  56. package/dist/chunk-EXA6R6SW.js +24 -0
  57. package/dist/{chunk-TNTQ7H24.js → chunk-GDQQ4U3L.js} +75 -9
  58. package/dist/{chunk-XQ26I3PL.js → chunk-GKLZMLX3.js} +4 -2
  59. package/dist/{chunk-KJSCMUST.js → chunk-GQORIM44.js} +14 -14
  60. package/dist/chunk-GR2E54E6.js +31 -0
  61. package/dist/{chunk-WM7JSUK2.js → chunk-HUCRKZ6J.js} +7 -7
  62. package/dist/{chunk-DJTC4NK7.js → chunk-HUZ3GL3F.js} +87 -5
  63. package/dist/{chunk-RL5VZ4Y2.js → chunk-I4BH3ASB.js} +1 -1
  64. package/dist/{chunk-76GLTXI5.js → chunk-IIXZLGSI.js} +5 -5
  65. package/dist/chunk-IN3ZKLLQ.js +59 -0
  66. package/dist/{chunk-Q5QMH5QA.js → chunk-IQL7NJSE.js} +1 -1
  67. package/dist/{chunk-BY7PZB6H.js → chunk-J3QW55W5.js} +2 -2
  68. package/dist/{chunk-WE6SM4HJ.js → chunk-JEPV6WOW.js} +2 -2
  69. package/dist/{chunk-766MOTIZ.js → chunk-JOQR4AP6.js} +5 -1
  70. package/dist/{chunk-JMUHTEAS.js → chunk-JSCY2GUB.js} +42 -27
  71. package/dist/{chunk-PMVFBCE5.js → chunk-JU2XCDW5.js} +2 -2
  72. package/dist/{chunk-AKE744C5.js → chunk-JWORQ5WQ.js} +5 -1
  73. package/dist/{chunk-NB2AEFNM.js → chunk-KE6NXX45.js} +62 -19
  74. package/dist/{chunk-LQ74BSBR.js → chunk-KEZSFOSN.js} +2 -2
  75. package/dist/{chunk-MB2NPHAS.js → chunk-KVANP54U.js} +1 -1
  76. package/dist/{chunk-ZFZXGZTX.js → chunk-L24NAUBS.js} +1 -1
  77. package/dist/{chunk-DCLZEI2C.js → chunk-L3HCPZZT.js} +32 -33
  78. package/dist/{chunk-BRHSN2TH.js → chunk-L5EM7KAY.js} +2 -2
  79. package/dist/{chunk-422TEJIX.js → chunk-LHQZYLVO.js} +7 -7
  80. package/dist/{chunk-BVAPHHMQ.js → chunk-LP7B3JLC.js} +4 -2
  81. package/dist/{chunk-MYQ4NH3E.js → chunk-LV3MNSL7.js} +1 -1
  82. package/dist/{chunk-IODESAJT.js → chunk-LV7BDQ5X.js} +1 -1
  83. package/dist/{chunk-FBQKUBMD.js → chunk-M4HDVKHG.js} +2 -2
  84. package/dist/{chunk-XRKQJADF.js → chunk-M6F4HXMW.js} +3 -3
  85. package/dist/{chunk-6KZAQHWH.js → chunk-M6FS7TNN.js} +3 -3
  86. package/dist/{chunk-TABWG4IT.js → chunk-M7VAMZQW.js} +18 -11
  87. package/dist/{chunk-P77AJDIN.js → chunk-MB7VK7MW.js} +3 -3
  88. package/dist/{chunk-76AJS2LI.js → chunk-MDZANX4P.js} +9 -3
  89. package/dist/{chunk-RLPTQF5E.js → chunk-MJFEHOGJ.js} +2 -2
  90. package/dist/{chunk-XLNV66JK.js → chunk-MLBH6KJL.js} +1 -1
  91. package/dist/{chunk-ZFDKOTN4.js → chunk-MZI62LS2.js} +45 -27
  92. package/dist/{chunk-RXFKSZN2.js → chunk-N6E2T3JY.js} +1 -1
  93. package/dist/{chunk-SUFHFBNO.js → chunk-N6YQHI3Z.js} +2 -2
  94. package/dist/{chunk-5UT3R43E.js → chunk-NL4RCLQF.js} +1 -1
  95. package/dist/{chunk-ATRSQXUV.js → chunk-NMQWKWV4.js} +71 -18
  96. package/dist/{chunk-XWFPP6LC.js → chunk-NO2YYTAK.js} +2 -2
  97. package/dist/{chunk-TRA75UKG.js → chunk-NQZQZY4B.js} +3 -3
  98. package/dist/{chunk-CZ5NNJ6H.js → chunk-NTMMUK6Q.js} +115 -69
  99. package/dist/{chunk-Z6AERD5Q.js → chunk-NV7IMBP7.js} +1 -1
  100. package/dist/{chunk-D3B76FBE.js → chunk-O6757ZOW.js} +5 -5
  101. package/dist/{chunk-OWZAG6N4.js → chunk-O7SPZE7M.js} +1 -1
  102. package/dist/{chunk-MRJRAAB2.js → chunk-OE347X32.js} +3 -3
  103. package/dist/{chunk-3YIOLQ2Y.js → chunk-OKPASJ5P.js} +5 -5
  104. package/dist/{chunk-GPLINKEE.js → chunk-OYNHNQ3E.js} +7 -7
  105. package/dist/{chunk-CHRHMT6W.js → chunk-OYXGIP35.js} +6 -6
  106. package/dist/{chunk-MT2Z5YBM.js → chunk-P7DCQJ6N.js} +1 -1
  107. package/dist/{chunk-6P2ZRIKN.js → chunk-PHJNYHGA.js} +1 -1
  108. package/dist/{chunk-4VYPICIA.js → chunk-PJEXCOCR.js} +12 -4
  109. package/dist/{chunk-6KQHLLKI.js → chunk-PVDBALBI.js} +7 -7
  110. package/dist/{chunk-SIAPGZ4S.js → chunk-QR7666XO.js} +4 -4
  111. package/dist/{chunk-HXQO2Q6T.js → chunk-RPLMK4WC.js} +1 -1
  112. package/dist/{chunk-HQOJ5ZBI.js → chunk-SKOBUO2F.js} +3 -3
  113. package/dist/{chunk-HCTHKNMZ.js → chunk-SVPRFL7O.js} +1 -1
  114. package/dist/{chunk-SM4DG7SR.js → chunk-SZLKWUHN.js} +3 -3
  115. package/dist/{chunk-SUCTCDDY.js → chunk-TBXNHLRL.js} +8 -5
  116. package/dist/{chunk-B3CSMKM7.js → chunk-TJUJJYJC.js} +1 -1
  117. package/dist/{chunk-HNZ2FZIB.js → chunk-TTCNUS5M.js} +3 -3
  118. package/dist/{chunk-AQZZLJY7.js → chunk-UE2RAXA7.js} +2 -2
  119. package/dist/{chunk-CIWX5UKC.js → chunk-UQXBGFKU.js} +14 -5
  120. package/dist/{chunk-XLPCBE2Q.js → chunk-US2SO6O4.js} +1 -1
  121. package/dist/{chunk-G7XKDDWE.js → chunk-UURC7DFD.js} +1 -1
  122. package/dist/{chunk-FU5TXQAN.js → chunk-UYMUPV7Q.js} +11 -11
  123. package/dist/chunk-VBEP277H.js +5035 -0
  124. package/dist/{chunk-AVOYOW2Y.js → chunk-VFGKM45X.js} +1 -1
  125. package/dist/{chunk-5UXMG5CM.js → chunk-VMWRWUDV.js} +1 -1
  126. package/dist/{chunk-2VYQ62PP.js → chunk-VR7E3QEQ.js} +9 -3
  127. package/dist/{chunk-DTWIC6JZ.js → chunk-VTQ6LSSX.js} +2 -2
  128. package/dist/{chunk-N4KVW3ZI.js → chunk-WEW22B4F.js} +4 -4
  129. package/dist/{chunk-7X3UDKJK.js → chunk-WMRHEI4N.js} +2 -2
  130. package/dist/{chunk-G4L4JU4I.js → chunk-WODNT4NL.js} +2 -2
  131. package/dist/{chunk-W7ITBVJE.js → chunk-X2TDLUIK.js} +16 -21
  132. package/dist/{chunk-4VOK4IOF.js → chunk-XBJNA2O5.js} +26 -9
  133. package/dist/{chunk-6CXFFUL5.js → chunk-XCF72IZY.js} +2 -2
  134. package/dist/{chunk-TMAFZJAP.js → chunk-XZRMB5Q7.js} +8 -8
  135. package/dist/{chunk-3CHUQRFX.js → chunk-ZAJSIWIC.js} +1 -1
  136. package/dist/{chunk-4W5NIHYU.js → chunk-ZMG7COPL.js} +1 -1
  137. package/dist/{chunk-V2BRRTED.js → chunk-ZO74SCFC.js} +16 -9
  138. package/dist/{clean-F7Y2JBO5.js → clean-RCXP7VIE.js} +22 -23
  139. package/dist/cli.js +81 -72
  140. package/dist/{cloud-RFM3PYTR.js → cloud-D3WTNTF2.js} +5 -4
  141. package/dist/{cloud-SQSYDRCJ.js → cloud-UMR6YM53.js} +4 -4
  142. package/dist/{cloudrun-3NSTX3CE.js → cloudrun-WNFJ6HDK.js} +10 -8
  143. package/dist/commands/contrast-audit.browser.js +50 -14
  144. package/dist/commands/motion-signature.browser.js +8 -1
  145. package/dist/{compare-J2K3SBGQ.js → compare-4DOTZFJB.js} +36 -37
  146. package/dist/{compiler-DMRQ44TO.js → compiler-QZAK3CQM.js} +3 -4
  147. package/dist/{component-FDWARSYD.js → component-JUNJ3HR5.js} +3 -3
  148. package/dist/{compositions-CVCE2GJN.js → compositions-Y4TVCT6A.js} +15 -17
  149. package/dist/{contactSheet-RJTY6IIV.js → contactSheet-RWRMLRZI.js} +3 -3
  150. package/dist/{curve-C7MZIWFU.js → curve-MRBPVFJR.js} +13 -14
  151. package/dist/{cuts-PN574VHO.js → cuts-FEQBTLCK.js} +14 -15
  152. package/dist/{delete-V6U3W4CS.js → delete-IZIO5BPH.js} +9 -8
  153. package/dist/{deploy-R33MSCVV.js → deploy-LYSMVVKT.js} +2 -2
  154. package/dist/{describeProject-ARFPRWDZ.js → describeProject-37HOCRQS.js} +8 -10
  155. package/dist/{deterministicFonts-HY5GWGQQ.js → deterministicFonts-DQDB47K3.js} +2 -2
  156. package/dist/{diff-QFMI6N6P.js → diff-JLJZ7CWH.js} +41 -42
  157. package/dist/{dist-BYY3JRG2.js → dist-LIQVRDQQ.js} +11 -13
  158. package/dist/{dist-XVVBUFOD.js → dist-RSKVXBET.js} +12 -3
  159. package/dist/{dist-TI44VPHO.js → dist-URQMS2HM.js} +5 -4
  160. package/dist/docs/examples.md +4 -0
  161. package/dist/{doctor-CREGMXCV.js → doctor-YXP5OQZJ.js} +15 -16
  162. package/dist/{energy-7G2AX2CC.js → energy-E2MNVLQG.js} +14 -15
  163. package/dist/{events-LF3JDEMV.js → events-7KJUZ6JN.js} +6 -5
  164. package/dist/{events-ISILMISS.js → events-AUFOARC3.js} +5 -4
  165. package/dist/{events-Y47D7LCD.js → events-IQMZODOM.js} +16 -17
  166. package/dist/{extract-NXHUAZJQ.js → extract-MNRKSTVS.js} +15 -16
  167. package/dist/{face-52FKXAW6.js → face-PLFENYM6.js} +14 -15
  168. package/dist/{feedback-LDYDOVKP.js → feedback-PMTFDXYG.js} +16 -13
  169. package/dist/{ffmpeg-4YTCWYMO.js → ffmpeg-6NPH4Y32.js} +7 -9
  170. package/dist/{figma-K3XDEK3K.js → figma-VRGLERFC.js} +3 -3
  171. package/dist/fontLocalizeCli.js +11 -13
  172. package/dist/{frames-ZR3SBSEJ.js → frames-IJODIWMC.js} +16 -17
  173. package/dist/{generate-DDFMXJZV.js → generate-QGD5W7C2.js} +28 -29
  174. package/dist/{get-YLVWTD7K.js → get-JRHXJ3XB.js} +9 -8
  175. package/dist/{gpuPolicy-5L45UYI4.js → gpuPolicy-ZUQPIKA6.js} +7 -9
  176. package/dist/{grade-compare-U22AZXLQ.js → grade-compare-PBNOHUTC.js} +36 -37
  177. package/dist/{heifImagePrep-E5UHLK7F.js → heifImagePrep-IHGRDGIQ.js} +8 -10
  178. package/dist/{help-6UBS7VEC.js → help-TSKN5WKM.js} +1 -1
  179. package/dist/{history-NQ57D6BT.js → history-CKYGYGIT.js} +12 -11
  180. package/dist/hyperframe.manifest.json +1 -1
  181. package/dist/hyperframe.runtime.iife.js +68 -68
  182. package/dist/hyperframes-player.global.js +3 -3
  183. package/dist/{info-VMAWCCR7.js → info-MJVDLEVI.js} +42 -14
  184. package/dist/{init-E3E5O4BO.js → init-DOL2FWBB.js} +78 -44
  185. package/dist/{ink-JP2JIJ7O.js → ink-O6QSMSKC.js} +14 -15
  186. package/dist/{inspect-PB7AQSWP.js → inspect-PC3SZZOR.js} +35 -36
  187. package/dist/{installer-DXVPAZI5.js → installer-HMGKE36F.js} +5 -5
  188. package/dist/{keyframes-WU52W4WC.js → keyframes-7XC3AC4V.js} +9 -8
  189. package/dist/{lambda-EPKOKH3F.js → lambda-3FAGLEU5.js} +11 -13
  190. package/dist/{layout-QYDZ3OWK.js → layout-VHTDCWFW.js} +35 -36
  191. package/dist/{lint-HA2BXUCU.js → lint-IC6NER4M.js} +18 -12
  192. package/dist/{lintProject-Z2TEXMY4.js → lintProject-6TML32JZ.js} +1 -2
  193. package/dist/{list-P4PHY54O.js → list-I35ERZHZ.js} +9 -8
  194. package/dist/{localPage-GJQ2KHOH.js → localPage-FDNKKTXH.js} +7 -9
  195. package/dist/{login-FZ224A3F.js → login-6K6LXYCK.js} +8 -7
  196. package/dist/{logout-YACQMRZN.js → logout-EQ2HJDL4.js} +4 -3
  197. package/dist/{look-OMZ2QZO5.js → look-MUM6FFJS.js} +14 -15
  198. package/dist/{manager-PFURXZN7.js → manager-C555E5U3.js} +8 -10
  199. package/dist/{manager-5V4O7DY3.js → manager-MKDNQ5KZ.js} +2 -2
  200. package/dist/{measure-5UEQ3Z35.js → measure-HIFTI44U.js} +11 -11
  201. package/dist/{media-treatment-TD6MD2AQ.js → media-treatment-DI3C7GLC.js} +16 -17
  202. package/dist/{media-use-WM7OZFIU.js → media-use-DA5QVW4C.js} +6 -5
  203. package/dist/{models-RWXD6PFC.js → models-GDXFVABP.js} +11 -13
  204. package/dist/{motionShot-VI4JADFG.js → motionShot-UTGGCPYH.js} +17 -19
  205. package/dist/{normalize-audio-BS27PUKV.js → normalize-audio-YS3YILNJ.js} +23 -13
  206. package/dist/{open-UMB23DN6.js → open-4PKI3YVG.js} +17 -16
  207. package/dist/{parakeetRunner-2QB5ZG35.js → parakeetRunner-EC4KUGKK.js} +13 -15
  208. package/dist/{pipeline-3P5DX3DB.js → pipeline-L3ZWWTXS.js} +11 -13
  209. package/dist/{play-CF73RCMH.js → play-I3NXVJST.js} +25 -26
  210. package/dist/{preflight-JQS3EL4O.js → preflight-G2AVNYY7.js} +9 -11
  211. package/dist/{present-RPBRZSP2.js → present-RUJ3YKSR.js} +20 -21
  212. package/dist/{preview-XT5SK5IE.js → preview-M2T36DYH.js} +29 -28
  213. package/dist/{probe-OPBECP2X.js → probe-OASNPT5T.js} +14 -15
  214. package/dist/{producer-YY7LXKRQ.js → producer-YEHQIQ3O.js} +1 -1
  215. package/dist/{projectConfig-JA6XEBSL.js → projectConfig-LBMTOOJX.js} +8 -8
  216. package/dist/{publication-EOYYVFJS.js → publication-O2M6ZZNY.js} +2 -3
  217. package/dist/{publish-TPBXTYN2.js → publish-PMGCGIVE.js} +17 -17
  218. package/dist/{refresh-L5C2HPMC.js → refresh-ARZZRKMP.js} +4 -3
  219. package/dist/{remove-background-DMV2HTVF.js → remove-background-DFDEZEXM.js} +12 -14
  220. package/dist/{render-P5745VYG.js → render-PJMQH4EQ.js} +5 -6
  221. package/dist/{render-RXQUFM2X.js → render-SVP72X6C.js} +63 -45
  222. package/dist/{render-WQQ7ZPS5.js → render-U3NYKVOA.js} +33 -34
  223. package/dist/{render-batch-I6OHT72Q.js → render-batch-EUT4DTQZ.js} +5 -6
  224. package/dist/renderSetupWorker.js +6 -4
  225. package/dist/{resolver-CMFVVODA.js → resolver-H6U77U4P.js} +6 -6
  226. package/dist/{reverse-5CNVGBVP.js → reverse-IRAAQ6T7.js} +1 -1
  227. package/dist/{run-65M6ECM2.js → run-WZP6HXIH.js} +7 -6
  228. package/dist/{screenshotCapture-HTGXPA7D.js → screenshotCapture-2QYWSWGP.js} +36 -4
  229. package/dist/{sherpa-BPJWQXFB.js → sherpa-DO75VQI4.js} +12 -14
  230. package/dist/skills/hyperframes/SKILL.md +1 -1
  231. package/dist/skills/hyperframes/references/format.md +1 -1
  232. package/dist/skills/hyperframes/references/path-tracing.md +36 -0
  233. package/dist/skills/hyperframes/references/runtimes.md +1 -1
  234. package/dist/skills/hyperframes/references/storyboard.md +1 -1
  235. package/dist/skills/hyperframes/references/types/3d.md +1 -1
  236. package/dist/skills/hyperframes-cli/SKILL.md +3 -1
  237. package/dist/skills/media-use/SKILL.md +1 -1
  238. package/dist/skills/media-use/references/media-treatments.md +1 -1
  239. package/dist/skills/media-use/references/setup-providers.md +1 -1
  240. package/dist/skills/media-use/scripts/lib/local-media-search.mjs +6 -2
  241. package/dist/skills/media-use/scripts/lib/local-media-search.test.mjs +23 -0
  242. package/dist/skills/media-use/scripts/lib/telemetry.mjs +6 -1
  243. package/dist/skills/media-use/scripts/lib/telemetry.test.mjs +34 -0
  244. package/dist/{skills-2Z2E7TX7.js → skills-7GNBYIEM.js} +10 -9
  245. package/dist/{skillsUpdateCheck-TQHSQ26D.js → skillsUpdateCheck-3X5WU4YB.js} +5 -4
  246. package/dist/{snapshot-NR3BZVZK.js → snapshot-7XX5FCQC.js} +82 -75
  247. package/dist/{src-LIR2WBQL.js → src-OUHQBPJL.js} +10 -12
  248. package/dist/{src-VZIS3GRG.js → src-R2QH27BL.js} +8 -8
  249. package/dist/{start-FDWHVOMC.js → start-SD4CCZFP.js} +44 -30
  250. package/dist/{staticProjectServer-L5O2GBZH.js → staticProjectServer-3DQIE2ZT.js} +20 -22
  251. package/dist/{status-SMFFS6LS.js → status-HUVATV7S.js} +20 -17
  252. package/dist/studio/assets/{hyperframes-player-bkb0-LEY.js → hyperframes-player-CL-Qh_Bx.js} +1 -1
  253. package/dist/studio/assets/{index-RUPGNyct.css → index-CNZk2EFC.css} +1 -1
  254. package/dist/studio/assets/{index-DfsIam9M.js → index-DkiYRx1f.js} +137 -137
  255. package/dist/studio/assets/{index-D5zessN9.js → index-DyvmaiBB.js} +1 -1
  256. package/dist/studio/index.html +2 -2
  257. package/dist/{studio-api-VLBZZ4IB.js → studio-api-776ZTVLU.js} +11 -13
  258. package/dist/{studioSelectionClient-FA6XPVIL.js → studioSelectionClient-W2S3H2VO.js} +3 -1
  259. package/dist/{studioServer-CP5HGR3W.js → studioServer-A3LGBU4W.js} +60 -62
  260. package/dist/{sync-NBM7J3IT.js → sync-5BBHBAZ6.js} +14 -15
  261. package/dist/{synthesize-S3FF5KXC.js → synthesize-GX74JPPZ.js} +2 -2
  262. package/dist/{telemetry-B5OJHH2C.js → telemetry-7ETKP7HP.js} +6 -5
  263. package/dist/{telemetry-5WZGQCKA.js → telemetry-IXOTZW4E.js} +2 -1
  264. package/dist/{templates-PQZCZZUG.js → templates-RH674B5Q.js} +17 -16
  265. package/dist/{timeline-X27NA7UH.js → timeline-DEZAVAFR.js} +42 -28
  266. package/dist/{tokens-XS2LOTWB.js → tokens-2UHFZABD.js} +2 -2
  267. package/dist/{transcribe-YPWD4E63.js → transcribe-EZEUKBI3.js} +10 -12
  268. package/dist/{transcribe-7M33PLAV.js → transcribe-NZBJVCSZ.js} +30 -31
  269. package/dist/{tts-QRQEYR3Q.js → tts-QW53FBKW.js} +3 -3
  270. package/dist/{update-BRTUI6AI.js → update-YXZI2ICU.js} +11 -10
  271. package/dist/{updateCheck-IW37C7XV.js → updateCheck-GJMC7GXZ.js} +4 -3
  272. package/dist/{upgrade-7EF5SHLD.js → upgrade-E3QK3G3D.js} +5 -4
  273. package/dist/{upload-HMRWGZIO.js → upload-YQMBLKH5.js} +3 -1
  274. package/dist/{urlDownloader-L6HYQHNK.js → urlDownloader-KYFYU6AG.js} +6 -8
  275. package/dist/{validate-PQJBBBBK.js → validate-HD224PCX.js} +28 -29
  276. package/dist/{video-DO6SLUPI.js → video-3NIYVUPF.js} +9 -11
  277. package/dist/{voices-VP5LLP5V.js → voices-G2YC3Y7U.js} +25 -26
  278. package/dist/warmCheck.js +47 -48
  279. package/dist/warmCheckClient.js +2 -2
  280. package/package.json +1 -1
  281. package/dist/chunk-AFYIYW5D.js +0 -5035
  282. package/dist/chunk-CZGHFATT.js +0 -31
  283. package/dist/chunk-IVIVAE6U.js +0 -29
  284. package/dist/chunk-MEJH7VEA.js +0 -63
@@ -11,17 +11,17 @@ import {
11
11
  iterateFontFamilyDeclarations,
12
12
  normalizeSystemFontPrimaryFamilies,
13
13
  resolveFontFamilyDeclarationFamilies
14
- } from "./chunk-EOCFNE53.js";
14
+ } from "./chunk-ENVFGBRD.js";
15
15
  import {
16
16
  Semaphore,
17
17
  prepareHeifImageInputs,
18
18
  withMediaProbeSlot
19
- } from "./chunk-PMVFBCE5.js";
19
+ } from "./chunk-JU2XCDW5.js";
20
20
  import {
21
21
  EncoderInterruptedError,
22
22
  encoderFailureError,
23
23
  prepareAnimatedGifInputs
24
- } from "./chunk-FBQKUBMD.js";
24
+ } from "./chunk-M4HDVKHG.js";
25
25
  import {
26
26
  openRangeEnd,
27
27
  parseEncoderOptions
@@ -92,6 +92,7 @@ import {
92
92
  deriveBeginFrameProbeTimeTicks,
93
93
  describeFfmpegFailure,
94
94
  detectTransfer,
95
+ displaySize,
95
96
  distributeFrames,
96
97
  distributeFramesInterleaved,
97
98
  downloadToTemp,
@@ -185,7 +186,7 @@ import {
185
186
  videoAudioId,
186
187
  videoStartOnMediaTimeline,
187
188
  writeCapturedFrame
188
- } from "./chunk-ATRSQXUV.js";
189
+ } from "./chunk-NMQWKWV4.js";
189
190
  import {
190
191
  assignBundledRuntimeCompositionIds,
191
192
  emitMountedModuleScripts,
@@ -197,7 +198,7 @@ import {
197
198
  parsesAsScript,
198
199
  prepareFlattenedInnerRoot,
199
200
  stripSdrPngColourTags
200
- } from "./chunk-Q3IYSP4G.js";
201
+ } from "./chunk-4TW62PDH.js";
201
202
  import {
202
203
  collectScratchLeftovers,
203
204
  removeScratch,
@@ -211,16 +212,14 @@ import {
211
212
  fpsToFfmpegArg,
212
213
  fpsToNumber,
213
214
  gifClearsAfterLeavingFrameInPlace,
215
+ gsapCdnDist,
214
216
  isDistributedFps,
217
+ normalizeGsapBaseUrl,
215
218
  parseFps,
216
219
  parseVfxChain,
217
220
  resolveAuthoredTimingWindow,
218
221
  toFps
219
- } from "./chunk-DJTC4NK7.js";
220
- import {
221
- gsapCdnDist,
222
- normalizeGsapBaseUrl
223
- } from "./chunk-MEJH7VEA.js";
222
+ } from "./chunk-HUZ3GL3F.js";
224
223
  import {
225
224
  COMPOSITION_SOURCE_URL,
226
225
  HF_COLOR_GRADING_ATTR,
@@ -255,7 +254,7 @@ import {
255
254
  sourceTimeAt,
256
255
  styleElementsFor,
257
256
  timeAtSourceTime
258
- } from "./chunk-AFYIYW5D.js";
257
+ } from "./chunk-VBEP277H.js";
259
258
  import {
260
259
  TRANSITIONS,
261
260
  convertTransfer,
@@ -271,7 +270,7 @@ import {
271
270
  import {
272
271
  lintHyperframeHtml,
273
272
  resolveReferencedStart
274
- } from "./chunk-CZ5NNJ6H.js";
273
+ } from "./chunk-NTMMUK6Q.js";
275
274
  import {
276
275
  isUnresolvedAssetPlaceholder,
277
276
  readProjectFile,
@@ -317,17 +316,17 @@ import {
317
316
 
318
317
  // ../producer/src/services/renderOrchestrator.ts
319
318
  import {
320
- existsSync as existsSync18,
321
- mkdirSync as mkdirSync8,
322
- readdirSync as readdirSync5,
323
- rmSync as rmSync8,
324
- statSync as statSync6,
325
- writeFileSync as writeFileSync5,
319
+ existsSync as existsSync19,
320
+ mkdirSync as mkdirSync10,
321
+ readdirSync as readdirSync6,
322
+ rmSync as rmSync10,
323
+ statSync as statSync7,
324
+ writeFileSync as writeFileSync6,
326
325
  copyFileSync as copyFileSync3,
327
326
  appendFileSync
328
327
  } from "fs";
329
328
  import { tmpdir as tmpdir2 } from "os";
330
- import { join as join26, dirname as dirname10, resolve as resolve6 } from "path";
329
+ import { join as join29, dirname as dirname11, resolve as resolve6 } from "path";
331
330
  import { totalmem as totalmem2 } from "os";
332
331
  import { randomUUID } from "crypto";
333
332
  import { fileURLToPath as fileURLToPath4 } from "url";
@@ -4025,42 +4024,47 @@ function createDrainFrameGuard(args) {
4025
4024
  sizes.push(buf.length);
4026
4025
  if (sizes.length > 60) sizes.shift();
4027
4026
  }
4028
- const truth = session.deVerifyFrames?.get(idx);
4029
- if (truth) {
4030
- let db;
4031
- try {
4032
- db = await psnrDb(buf, truth);
4033
- } catch (err) {
4034
- log.warn("[Render] drawElement self-verify sample skipped (psnr infrastructure)", {
4035
- frame: idx,
4036
- error: err instanceof Error ? err.message : String(err)
4037
- });
4038
- return buf;
4039
- }
4040
- if (db < verifyMinDb) {
4041
- const dumpDir = await mkdtemp(join9(tmpdir(), "hf-de-verify-fail-")).catch(() => null);
4042
- if (dumpDir) {
4043
- await Promise.all([
4044
- writeFile(join9(dumpDir, `frame-${idx}-de.jpg`), buf),
4045
- writeFile(join9(dumpDir, `frame-${idx}-truth.jpg`), truth)
4046
- ]).catch(() => {
4047
- });
4048
- }
4049
- throw new DrawElementVerificationError(
4050
- `drawElement self-verify failed at frame ${idx}: ${db.toFixed(1)}dB < ${verifyMinDb}dB vs pre-injection screenshot${dumpDir ? ` (pair: ${dumpDir})` : ""}`,
4051
- { kind: "psnr", frameIndex: idx, failedDb: db, verifyThresholdDb: verifyMinDb }
4052
- );
4053
- }
4054
- stats.verifyChecked += 1;
4055
- stats.verifyMinDb = stats.verifyMinDb === void 0 ? db : Math.min(stats.verifyMinDb, db);
4056
- log.info("[Render] drawElement self-verify passed", {
4057
- frame: idx,
4058
- psnrDb: db === Infinity ? "inf" : Number(db.toFixed(1))
4059
- });
4060
- }
4027
+ await verifyDrawElementSample(session, idx, buf, { log, stats, verifyMinDb });
4061
4028
  return buf;
4062
4029
  };
4063
4030
  }
4031
+ async function verifyDrawElementSample(session, idx, buf, ctx) {
4032
+ const { log, stats, verifyMinDb } = ctx;
4033
+ const truth = session.deVerifyFrames?.get(idx);
4034
+ if (!truth) return;
4035
+ let db;
4036
+ try {
4037
+ db = await psnrDb(buf, truth);
4038
+ } catch (err) {
4039
+ log.warn("[Render] drawElement self-verify sample skipped (psnr infrastructure)", {
4040
+ frame: idx,
4041
+ error: err instanceof Error ? err.message : String(err)
4042
+ });
4043
+ return;
4044
+ }
4045
+ if (db < verifyMinDb) {
4046
+ const dumpDir = await mkdtemp(join9(tmpdir(), "hf-de-verify-fail-")).catch(() => null);
4047
+ if (dumpDir) {
4048
+ await Promise.all([
4049
+ writeFile(join9(dumpDir, `frame-${idx}-de.jpg`), buf),
4050
+ writeFile(join9(dumpDir, `frame-${idx}-truth.jpg`), truth)
4051
+ ]).catch(() => {
4052
+ });
4053
+ }
4054
+ throw new DrawElementVerificationError(
4055
+ `drawElement self-verify failed at frame ${idx}: ${db.toFixed(1)}dB < ${verifyMinDb}dB vs pre-injection screenshot${dumpDir ? ` (pair: ${dumpDir})` : ""}`,
4056
+ { kind: "psnr", frameIndex: idx, failedDb: db, verifyThresholdDb: verifyMinDb }
4057
+ );
4058
+ }
4059
+ if (stats) {
4060
+ stats.verifyChecked += 1;
4061
+ stats.verifyMinDb = stats.verifyMinDb === void 0 ? db : Math.min(stats.verifyMinDb, db);
4062
+ }
4063
+ log.info("[Render] drawElement self-verify passed", {
4064
+ frame: idx,
4065
+ psnrDb: db === Infinity ? "inf" : Number(db.toFixed(1))
4066
+ });
4067
+ }
4064
4068
  async function runWorkerEncodePipelineLoop(session, totalFrames, job, currentEncoder, reorderBuffer, assertNotAborted, onProgress, log, stats, abortSignal, resume, risk) {
4065
4069
  let prev = null;
4066
4070
  const frameTime = (i) => i * job.config.fps.den / job.config.fps.num;
@@ -4524,6 +4528,7 @@ async function runCaptureStreamingStage(input) {
4524
4528
  );
4525
4529
  } else {
4526
4530
  const stallTimeoutMs = resolveCaptureStallTimeoutMs();
4531
+ const verifyMinDb = resolveDeVerifyMinDb();
4527
4532
  let lastProgressAt = Date.now();
4528
4533
  for (let i = resume.from; i < totalFrames; i++) {
4529
4534
  assertNotAborted();
@@ -4540,6 +4545,7 @@ async function runCaptureStreamingStage(input) {
4540
4545
  { session, frameIndex: i, totalFrames, stallTimeoutMs: budget },
4541
4546
  abortSignal
4542
4547
  );
4548
+ await verifyDrawElementSample(session, i, buffer, { log, verifyMinDb });
4543
4549
  await reorderBuffer.waitForFrame(i);
4544
4550
  ensureFrameWritten(await currentEncoder.writeFrame(buffer), i, currentEncoder);
4545
4551
  reorderBuffer.advanceTo(i + 1);
@@ -4648,6 +4654,10 @@ async function captureSegmentFrames(ctx, segment, encoder) {
4648
4654
  },
4649
4655
  ctx.abortSignal
4650
4656
  );
4657
+ await verifyDrawElementSample(ctx.session, i, buffer, {
4658
+ log: ctx.log,
4659
+ verifyMinDb: ctx.verifyMinDb
4660
+ });
4651
4661
  ensureFrameWritten(await encoder.writeFrame(buffer), i, encoder);
4652
4662
  ctx.job.framesRendered = i + 1;
4653
4663
  lastProgressAt = Date.now();
@@ -4662,6 +4672,25 @@ async function captureSegmentFrames(ctx, segment, encoder) {
4662
4672
  }
4663
4673
  }
4664
4674
  async function captureSegment(ctx, segment) {
4675
+ const { frames } = ctx;
4676
+ if (!frames) return captureSegmentToEncoder(ctx, segment);
4677
+ try {
4678
+ reportFrameProgress(
4679
+ ctx.job,
4680
+ `Reading video for segment ${segment.index + 1}/${ctx.segmentCount}`,
4681
+ Math.round(25 + segment.startFrame / ctx.totalFrames * 55),
4682
+ ctx.onProgress,
4683
+ segment.startFrame,
4684
+ ctx.totalFrames
4685
+ );
4686
+ await frames.prepare(segment);
4687
+ ctx.assertNotAborted();
4688
+ return await captureSegmentToEncoder(ctx, segment);
4689
+ } finally {
4690
+ frames.release();
4691
+ }
4692
+ }
4693
+ async function captureSegmentToEncoder(ctx, segment) {
4665
4694
  const segmentPath = segmentOutputPath(ctx.segmentDir, segment.index);
4666
4695
  let encoder;
4667
4696
  try {
@@ -4714,16 +4743,16 @@ var DEFAULT_DEPS = {
4714
4743
  function defaultSessionFactory(input) {
4715
4744
  let probeSession = input.probeSession;
4716
4745
  return {
4717
- create: async () => {
4746
+ create: async (injector = input.createRenderVideoFrameInjector) => {
4718
4747
  const probeCannotCaptureEveryFrame = Boolean(probeSession?.deRiskFrames?.size);
4719
4748
  if (probeSession && probeCannotCaptureEveryFrame) {
4720
4749
  await closeCaptureSession(probeSession).catch(() => {
4721
4750
  });
4722
4751
  probeSession = null;
4723
4752
  }
4724
- const session = probeSession ?? await openSegmentedSession(input);
4753
+ const session = probeSession ?? await openSegmentedSession(input, injector);
4725
4754
  if (probeSession) {
4726
- openSegmentedSessionReuse(input, probeSession);
4755
+ openSegmentedSessionReuse(input, probeSession, injector);
4727
4756
  probeSession = null;
4728
4757
  }
4729
4758
  try {
@@ -4738,12 +4767,12 @@ function defaultSessionFactory(input) {
4738
4767
  }
4739
4768
  };
4740
4769
  }
4741
- function openSegmentedSessionReuse(input, session) {
4742
- prepareCaptureSessionForReuse(session, input.framesDir, input.createRenderVideoFrameInjector());
4770
+ function openSegmentedSessionReuse(input, session, injector) {
4771
+ prepareCaptureSessionForReuse(session, input.framesDir, injector());
4743
4772
  }
4744
- async function openSegmentedSession(input) {
4773
+ async function openSegmentedSession(input, injector) {
4745
4774
  const captureCfg = input.cfg.forceScreenshot === input.plan.forceScreenshot ? input.cfg : { ...input.cfg, forceScreenshot: input.plan.forceScreenshot };
4746
- const videoInjector = input.createRenderVideoFrameInjector();
4775
+ const videoInjector = injector();
4747
4776
  const captureOptions = { ...input.buildCaptureOptions(), deFrameFallback: false };
4748
4777
  const ownBrowser = shouldDisableBrowserPoolForParallelWorker({
4749
4778
  parallel: (input.workerCount ?? 1) > 1
@@ -4756,6 +4785,19 @@ async function openSegmentedSession(input) {
4756
4785
  ownBrowser ? { ...captureCfg, enableBrowserPool: false } : captureCfg
4757
4786
  );
4758
4787
  }
4788
+ function removeJoinedSegments(run, segmentPaths) {
4789
+ if (!run.input.segmentVideoFrames || run.input.job.config.keepSegments === true) return;
4790
+ for (const path of segmentPaths) {
4791
+ try {
4792
+ run.deps.removeFile(path);
4793
+ } catch (err) {
4794
+ run.input.log.warn("[Render] could not remove a joined segment file", {
4795
+ path,
4796
+ error: err instanceof Error ? err.message : String(err)
4797
+ });
4798
+ }
4799
+ }
4800
+ }
4759
4801
  async function concatSegments(concat, segmentPaths, videoOnlyPath, abortSignal, cfg) {
4760
4802
  const result = await concat(segmentPaths, videoOnlyPath, abortSignal, cfg);
4761
4803
  if (result.success) return;
@@ -4767,12 +4809,14 @@ async function concatSegments(concat, segmentPaths, videoOnlyPath, abortSignal,
4767
4809
  async function createSegmentWorker(run, id) {
4768
4810
  const { input, deps } = run;
4769
4811
  const factory = input.sessionFactoryForWorker?.(id) ?? run.sessionFactory;
4812
+ const frames = input.segmentVideoFrames?.forWorker();
4770
4813
  return {
4771
4814
  id,
4772
4815
  factory,
4773
4816
  sessionSegments: 0,
4774
4817
  ctx: {
4775
- session: await factory.create(),
4818
+ session: await factory.create(frames && (() => frames.hook)),
4819
+ frames,
4776
4820
  job: input.job,
4777
4821
  cfg: input.cfg,
4778
4822
  totalFrames: input.totalFrames,
@@ -4783,6 +4827,8 @@ async function createSegmentWorker(run, id) {
4783
4827
  spawnEncoder: deps.spawnEncoder,
4784
4828
  captureFrame: deps.captureFrame,
4785
4829
  stallTimeoutMs: resolveCaptureStallTimeoutMs(),
4830
+ log: input.log,
4831
+ verifyMinDb: resolveDeVerifyMinDb(),
4786
4832
  abortSignal: input.abortSignal,
4787
4833
  assertNotAborted: input.assertNotAborted,
4788
4834
  onProgress: input.onProgress,
@@ -4802,7 +4848,8 @@ async function recycleWorkerSession(run, worker, why) {
4802
4848
  run.input.dedupPerfs.push(getCapturePerfSummary(worker.ctx.session));
4803
4849
  const memory = worker.ctx.session.chromeMemory?.stats();
4804
4850
  await run.deps.closeSession(worker.ctx.session);
4805
- worker.ctx.session = await worker.factory.create();
4851
+ const { frames } = worker.ctx;
4852
+ worker.ctx.session = await worker.factory.create(frames && (() => frames.hook));
4806
4853
  worker.sessionSegments = 0;
4807
4854
  if (why === "cadence") run.totals.browserRecycles += 1;
4808
4855
  run.input.log.info(`[Render] segment browser recycled (${why})`, {
@@ -4870,6 +4917,7 @@ async function concatResumedRun(run, segmentPaths) {
4870
4917
  input.abortSignal,
4871
4918
  input.cfg
4872
4919
  );
4920
+ removeJoinedSegments(run, segmentPaths);
4873
4921
  return {
4874
4922
  success: true,
4875
4923
  encodeMs: 0,
@@ -4944,6 +4992,7 @@ async function runCaptureSegmentedStage(input) {
4944
4992
  input.abortSignal,
4945
4993
  input.cfg
4946
4994
  );
4995
+ removeJoinedSegments(run, segmentPaths);
4947
4996
  return {
4948
4997
  success: true,
4949
4998
  encodeMs: run.totals.encodeMs,
@@ -5366,10 +5415,264 @@ function checkPageNeverReady(input) {
5366
5415
  return new PageNeverReadyError(error);
5367
5416
  }
5368
5417
 
5418
+ // ../producer/src/services/render/deferredVideoFrames.ts
5419
+ import { mkdirSync as mkdirSync4, rmSync as rmSync7 } from "fs";
5420
+ import { dirname as dirname5, join as join12 } from "path";
5421
+ function contiguousRuns(sortedIndexes) {
5422
+ const runs2 = [];
5423
+ for (const index of sortedIndexes) {
5424
+ const last = runs2[runs2.length - 1];
5425
+ if (last && last.firstFrame + last.frames === index) last.frames++;
5426
+ else runs2.push({ firstFrame: index, frames: 1 });
5427
+ }
5428
+ return runs2;
5429
+ }
5430
+ function shownDeferredFrameIndexes(source, frames, fps) {
5431
+ const shown = /* @__PURE__ */ new Map();
5432
+ const deferred = source.extracted.filter((video) => video.deferredRange);
5433
+ if (deferred.length === 0) return shown;
5434
+ const table = createFrameLookupTable(
5435
+ source.videos,
5436
+ deferred.map((video) => ({
5437
+ ...video,
5438
+ outputDir: "",
5439
+ framePaths: new Map(Array.from({ length: video.totalFrames }, (_, i) => [i, String(i)]))
5440
+ })),
5441
+ resolveRenderFpsConfig(fps).value
5442
+ );
5443
+ for (const frame of frames) {
5444
+ const globalTime = frame * fps.den / fps.num;
5445
+ for (const [videoId, payload] of table.getActiveFramePayloads(globalTime)) {
5446
+ const indexes = shown.get(videoId) ?? /* @__PURE__ */ new Set();
5447
+ indexes.add(payload.frameIndex);
5448
+ shown.set(videoId, indexes);
5449
+ }
5450
+ }
5451
+ return shown;
5452
+ }
5453
+ async function extractDeferredFrames(input) {
5454
+ const deferred = input.extracted.filter((video) => video.deferredRange);
5455
+ if (deferred.length === 0) return [];
5456
+ const shown = shownDeferredFrameIndexes(input, input.frames, input.fps);
5457
+ return Promise.all(
5458
+ deferred.map(async (video) => {
5459
+ const outputDir = join12(input.outputRoot, video.videoId);
5460
+ const indexes = [...shown.get(video.videoId) ?? []].sort((a, b) => a - b);
5461
+ if (indexes.length === 0) {
5462
+ return { ...video, outputDir, framePaths: /* @__PURE__ */ new Map(), ownedByLookup: false };
5463
+ }
5464
+ const range = video.deferredRange;
5465
+ const extracted = await extractVideoFramesRange(
5466
+ input.sourceOf(video),
5467
+ video.videoId,
5468
+ range.startTime,
5469
+ range.durationSeconds,
5470
+ {
5471
+ fps: input.fps,
5472
+ outputDir: input.outputRoot,
5473
+ format: range.format,
5474
+ frameRanges: contiguousRuns(indexes),
5475
+ shownBox: input.shownBoxes?.get(video.videoId)
5476
+ },
5477
+ input.signal,
5478
+ input.cfg
5479
+ );
5480
+ const missing = indexes.find((index) => !extracted.framePaths.has(index));
5481
+ if (missing !== void 0) throw input.onMissingFrame(video, missing);
5482
+ return { ...video, outputDir, framePaths: extracted.framePaths, ownedByLookup: false };
5483
+ })
5484
+ );
5485
+ }
5486
+ async function extractAllDeferredFrames(extracted, input) {
5487
+ const framesTotal = extracted.reduce(
5488
+ (sum2, video) => sum2 + (video.deferredRange ? video.totalFrames : 0),
5489
+ 0
5490
+ );
5491
+ let framesDone = 0;
5492
+ for (const video of extracted) {
5493
+ const range = video.deferredRange;
5494
+ if (!range) continue;
5495
+ const { result: filled } = await runVideoExtractionWithRetry(
5496
+ () => extractVideoFramesRange(
5497
+ input.sourceOf?.(video) ?? video.srcPath,
5498
+ video.videoId,
5499
+ range.startTime,
5500
+ range.durationSeconds,
5501
+ { fps: input.fps, outputDir: dirname5(video.outputDir), format: range.format },
5502
+ input.signal,
5503
+ input.cfg
5504
+ ),
5505
+ {
5506
+ signal: input.signal,
5507
+ maxTransientRetries: input.maxTransientRetries,
5508
+ onRetry: () => {
5509
+ rmSync7(video.outputDir, { recursive: true, force: true });
5510
+ mkdirSync4(video.outputDir, { recursive: true });
5511
+ }
5512
+ }
5513
+ );
5514
+ if (filled.framePaths.size < video.totalFrames) {
5515
+ throw new Error(
5516
+ `[Render] video ${JSON.stringify(video.videoId)} has ${filled.framePaths.size} frames; it was expected to have ${video.totalFrames} frames.`
5517
+ );
5518
+ }
5519
+ video.framePaths = filled.framePaths;
5520
+ delete video.deferredRange;
5521
+ framesDone += video.totalFrames;
5522
+ input.onProgress?.(framesDone, framesTotal);
5523
+ }
5524
+ }
5525
+
5526
+ // ../producer/src/services/render/segmentVideoFrames.ts
5527
+ import { mkdirSync as mkdirSync5, rmSync as rmSync8 } from "fs";
5528
+ import { join as join13 } from "path";
5529
+ function segmentFramesDir(rootDir, index) {
5530
+ return join13(rootDir, "segment-frames", `segment_${String(index).padStart(5, "0")}`);
5531
+ }
5532
+ function createSegmentVideoFrames(input) {
5533
+ const extractFrames = input.extractFrames ?? extractDeferredFrames;
5534
+ const sourceOf = input.sourceOf ?? ((video) => video.srcPath);
5535
+ const fullyExtracted = input.extracted.filter((video) => !video.deferredRange);
5536
+ const tableFor = async (frames, dir) => {
5537
+ const sliced = await extractFrames({
5538
+ videos: input.videos,
5539
+ extracted: input.extracted,
5540
+ frames,
5541
+ fps: input.fps,
5542
+ outputRoot: dir,
5543
+ cfg: input.cfg,
5544
+ signal: input.abortSignal,
5545
+ sourceOf,
5546
+ onMissingFrame: (video, index) => new Error(
5547
+ `[Render] video ${JSON.stringify(video.videoId)} has no frame ${index}; it was expected to have ${video.totalFrames} frames.`
5548
+ )
5549
+ });
5550
+ return createFrameLookupTable(
5551
+ input.videos,
5552
+ [...fullyExtracted, ...sliced],
5553
+ resolveRenderFpsConfig(input.fps).value
5554
+ );
5555
+ };
5556
+ const injectorFor = async (frames, dir) => createVideoFrameInjector(await tableFor(frames, dir), input.injectorOptions);
5557
+ let onDemandCalls = 0;
5558
+ const onDemandHook = () => Object.assign(
5559
+ async (page, time, heldVideoTime) => {
5560
+ const dir = join13(
5561
+ input.rootDir,
5562
+ "segment-frames",
5563
+ `on-demand_${String(onDemandCalls++).padStart(5, "0")}`
5564
+ );
5565
+ try {
5566
+ const frames = [time, heldVideoTime].filter((t) => t !== void 0).map((t) => Math.round(t * input.fps.num / input.fps.den));
5567
+ const injector = await injectorFor(frames, dir);
5568
+ await injector?.(page, time, heldVideoTime);
5569
+ } finally {
5570
+ rmSync8(dir, { recursive: true, force: true });
5571
+ }
5572
+ },
5573
+ { fresh: onDemandHook }
5574
+ );
5575
+ return {
5576
+ async forFrames(frames, name) {
5577
+ const dir = join13(input.rootDir, "segment-frames", name);
5578
+ const release = () => rmSync8(dir, { recursive: true, force: true });
5579
+ try {
5580
+ release();
5581
+ mkdirSync5(dir, { recursive: true });
5582
+ const table = await tableFor([...frames], dir);
5583
+ return { injector: () => createVideoFrameInjector(table, input.injectorOptions), release };
5584
+ } catch (error) {
5585
+ release();
5586
+ throw error;
5587
+ }
5588
+ },
5589
+ forWorker() {
5590
+ let injector = null;
5591
+ let folder = null;
5592
+ const onDemand = onDemandHook();
5593
+ const release = () => {
5594
+ injector = null;
5595
+ if (folder) rmSync8(folder, { recursive: true, force: true });
5596
+ folder = null;
5597
+ };
5598
+ return {
5599
+ hook: Object.assign(
5600
+ (page, time, heldVideoTime) => (injector ?? onDemand)(page, time, heldVideoTime),
5601
+ { fresh: onDemandHook }
5602
+ ),
5603
+ release,
5604
+ async prepare(segment) {
5605
+ release();
5606
+ const dir = segmentFramesDir(input.rootDir, segment.index);
5607
+ folder = dir;
5608
+ try {
5609
+ rmSync8(dir, { recursive: true, force: true });
5610
+ mkdirSync5(dir, { recursive: true });
5611
+ injector = await injectorFor(
5612
+ Array.from(
5613
+ { length: segment.endFrame - segment.startFrame },
5614
+ (_, i) => segment.startFrame + i
5615
+ ),
5616
+ dir
5617
+ );
5618
+ } catch (error) {
5619
+ release();
5620
+ throw error;
5621
+ }
5622
+ }
5623
+ };
5624
+ }
5625
+ };
5626
+ }
5627
+
5628
+ // ../producer/src/services/render/videoFrameWindow.ts
5629
+ import { readdirSync as readdirSync3, statSync as statSync4 } from "fs";
5630
+ import { join as join14 } from "path";
5631
+ function shouldWindowVideoFrames(args) {
5632
+ return args.segmented && args.env.HF_VIDEO_FRAME_WINDOW?.trim().toLowerCase() === "true";
5633
+ }
5634
+ function directoryBytes(path) {
5635
+ let bytes = 0;
5636
+ let entries;
5637
+ try {
5638
+ entries = readdirSync3(path, { withFileTypes: true });
5639
+ } catch {
5640
+ return 0;
5641
+ }
5642
+ for (const entry of entries) {
5643
+ const child2 = join14(path, entry.name);
5644
+ try {
5645
+ bytes += entry.isDirectory() ? directoryBytes(child2) : statSync4(child2).size;
5646
+ } catch {
5647
+ }
5648
+ }
5649
+ return bytes;
5650
+ }
5651
+ function trackSegmentFramePeak(frames, rootDir, onPeak) {
5652
+ let peak = 0;
5653
+ return {
5654
+ forFrames: (frameIndexes, name) => frames.forFrames(frameIndexes, name),
5655
+ forWorker() {
5656
+ const worker = frames.forWorker();
5657
+ return {
5658
+ ...worker,
5659
+ async prepare(segment) {
5660
+ await worker.prepare(segment);
5661
+ const held = directoryBytes(join14(rootDir, "segment-frames"));
5662
+ if (held > peak) {
5663
+ peak = held;
5664
+ onPeak(peak);
5665
+ }
5666
+ }
5667
+ };
5668
+ }
5669
+ };
5670
+ }
5671
+
5369
5672
  // ../producer/src/services/render/segmentManifest.ts
5370
5673
  import { createHash as createHash2 } from "crypto";
5371
- import { existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync4, statSync as statSync4, writeFileSync as writeFileSync3 } from "fs";
5372
- import { join as join12 } from "path";
5674
+ import { existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync4, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
5675
+ import { join as join15 } from "path";
5373
5676
  var MANIFEST_FILENAME = "segments.json";
5374
5677
  function computeSegmentPlanHash(input) {
5375
5678
  const ordered = [
@@ -5396,7 +5699,7 @@ function computeSegmentPlanHash(input) {
5396
5699
  return createHash2("sha256").update(ordered.join(" ")).digest("hex").slice(0, 16);
5397
5700
  }
5398
5701
  function segmentDirFor(projectRendersDir, planHash) {
5399
- return join12(projectRendersDir, ".hf-segments", planHash);
5702
+ return join15(projectRendersDir, ".hf-segments", planHash);
5400
5703
  }
5401
5704
  function hasNumber(value, key) {
5402
5705
  return key in value && typeof Reflect.get(value, key) === "number";
@@ -5414,7 +5717,7 @@ function isManifest(value) {
5414
5717
  return Reflect.get(value, "version") === 1 && hasString(value, "planHash") && hasNumber(value, "totalFrames") && hasNumber(value, "segmentFrames") && Array.isArray(completed) && completed.every(isEntry);
5415
5718
  }
5416
5719
  function readSegmentManifest(segmentDir) {
5417
- const path = join12(segmentDir, MANIFEST_FILENAME);
5720
+ const path = join15(segmentDir, MANIFEST_FILENAME);
5418
5721
  if (!existsSync7(path)) return null;
5419
5722
  try {
5420
5723
  const parsed = JSON.parse(readFileSync4(path, "utf-8"));
@@ -5424,10 +5727,10 @@ function readSegmentManifest(segmentDir) {
5424
5727
  }
5425
5728
  }
5426
5729
  function writeSegmentManifest(segmentDir, manifest) {
5427
- mkdirSync4(segmentDir, { recursive: true });
5428
- const tmp = join12(segmentDir, `${MANIFEST_FILENAME}.${process.pid}.tmp`);
5730
+ mkdirSync6(segmentDir, { recursive: true });
5731
+ const tmp = join15(segmentDir, `${MANIFEST_FILENAME}.${process.pid}.tmp`);
5429
5732
  writeFileSync3(tmp, JSON.stringify(manifest, null, 2), "utf-8");
5430
- renameWithRetry(tmp, join12(segmentDir, MANIFEST_FILENAME));
5733
+ renameWithRetry(tmp, join15(segmentDir, MANIFEST_FILENAME));
5431
5734
  }
5432
5735
  async function probeSegmentFrameCount(path, probe) {
5433
5736
  try {
@@ -5445,7 +5748,7 @@ async function validateCompletedSegments(manifest, expectedHash, probeFrames) {
5445
5748
  if (manifest.planHash !== expectedHash) return ok;
5446
5749
  for (const entry of manifest.completed) {
5447
5750
  if (!existsSync7(entry.path)) continue;
5448
- const size = statSync4(entry.path).size;
5751
+ const size = statSync5(entry.path).size;
5449
5752
  if (size <= 0 || size !== entry.bytes) continue;
5450
5753
  const frames = await probeFrames(entry.path);
5451
5754
  if (frames !== entry.endFrame - entry.startFrame) continue;
@@ -5967,7 +6270,7 @@ function computeVideoFrameCoverage(videos, extracted, fps) {
5967
6270
  for (const video of videos) {
5968
6271
  const entry = byId.get(video.id);
5969
6272
  const expectedFrames = expectedFramesForVideo(video, entry, fps);
5970
- const capturedFrames = entry ? entry.framePaths.size : 0;
6273
+ const capturedFrames = entry ? entry.deferredRange ? entry.totalFrames : entry.framePaths.size : 0;
5971
6274
  const ratio = expectedFrames === 0 ? 1 : capturedFrames / expectedFrames;
5972
6275
  reports.push({
5973
6276
  videoId: video.id,
@@ -6002,12 +6305,13 @@ function countAuthoredTimedClips(html) {
6002
6305
  }
6003
6306
 
6004
6307
  // ../producer/src/services/render/stages/compileStage.ts
6005
- import { join as join14 } from "path";
6308
+ import { existsSync as existsSync10, writeFileSync as writeFileSync4 } from "fs";
6309
+ import { join as join17 } from "path";
6006
6310
 
6007
6311
  // ../producer/src/services/htmlCompiler.ts
6008
6312
  import { createHash as createHash4 } from "crypto";
6009
- import { createReadStream as createReadStream2, existsSync as existsSync9, mkdirSync as mkdirSync5, readFileSync as readFileSync5 } from "fs";
6010
- import { join as join13, dirname as dirname5, resolve as resolve5, basename as basename4, relative as relative2 } from "path";
6313
+ import { createReadStream as createReadStream2, existsSync as existsSync9, mkdirSync as mkdirSync7, readFileSync as readFileSync5 } from "fs";
6314
+ import { join as join16, dirname as dirname6, resolve as resolve5, basename as basename4, relative as relative2 } from "path";
6011
6315
 
6012
6316
  // ../producer/src/services/renderMediaCollector.ts
6013
6317
  function resolveHostEnd(host, hostStart) {
@@ -6150,7 +6454,7 @@ function placeAudio(audio, window2) {
6150
6454
  }
6151
6455
 
6152
6456
  // ../core/dist/generated/position-edits-render-inline.js
6153
- var POSITION_EDITS_RENDER_IIFE = '"use strict";(()=>{function x(){return globalThis}function T(e,t){if(typeof window>"u")return;let o=x(),r=o.__hf?.onSwallowed;if(r)try{r({label:e,error:t})}catch(s){}(o.__hfDebug||o.__HYPERFRAMES_DEBUG)&&console.debug(`[hyperframes] ${e} swallowed:`,t)}var P=null;function R(e,t){if(P)try{P({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch(o){T("runtime.analytics.site1",o)}}var I="http://www.w3.org/1999/xhtml";function N(e){return e!=null&&e.nodeType===1}function _(e){return N(e)&&(e.namespaceURI===I||e.namespaceURI==="http://www.w3.org/2000/svg")}var y="data-hf-edit-base-x",w="data-hf-edit-base-y",m="data-hf-edit-original-translate",k=e=>{let t=parseFloat(e??"");return Number.isFinite(t)?t:0},C=e=>{let t=[],o=0,r="";for(let s of e.trim())s==="("&&(o+=1),s===")"&&(o=Math.max(0,o-1)),/\\s/.test(s)&&o===0?(r&&t.push(r),r=""):r+=s;return r&&t.push(r),t},$=/^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)px$/,E=(e,t)=>$.test(e)&&$.test(t)?`${parseFloat(e)+parseFloat(t)}px`:`calc(${e} + ${t})`,O=(e,t,o)=>{if(!e||e==="none")return`${t} ${o}`;let[r,s,a]=C(e);if(r===void 0)return`${t} ${o}`;if(s===void 0)return`${E(r,t)} ${o}`;let i=a===void 0?"":` ${a}`;return`${E(r,t)} ${E(s,o)}${i}`},j=e=>{try{e.ownerDocument.defaultView?.gsap?.getProperty?.(e,"x")}catch{}},V=e=>{let t=e.style.getPropertyValue("translate").trim();if(t)return t==="none"?"":t;try{let o=e.ownerDocument.defaultView,r=o?o.getComputedStyle(e).getPropertyValue("translate").trim():"";return r==="none"?"":r}catch{return""}},b=new WeakMap;function B(e,t){let o=b.get(e);if(!t?.force&&o!==void 0&&e.style.getPropertyValue("translate")!==o){R("position_edit_fold_skipped",{hfId:e.getAttribute("data-hf-id")});return}let r=k(e.getAttribute("data-x"))-k(e.getAttribute(y)),s=k(e.getAttribute("data-y"))-k(e.getAttribute(w));e.hasAttribute(m)||e.setAttribute(m,V(e)),o===void 0&&j(e);let a=e.getAttribute(m)??"",i=O(a,`${r}px`,`${s}px`);e.style.setProperty("translate",i),b.set(e,e.style.getPropertyValue("translate"))}function S(e,t){let o=e.querySelectorAll(`[${m}]:not([${y}]):not([${w}])`);for(let a=0;a<o.length;a++){let i=o[a];if(i===void 0||!_(i))continue;let g=i.getAttribute(m)??"";g===""?i.style.removeProperty("translate"):i.style.setProperty("translate",g),i.removeAttribute(m),b.delete(i)}let r=e.querySelectorAll(`[${y}], [${w}]`),s=0;for(let a=0;a<r.length;a++){let i=r[a];i===void 0||!_(i)||(B(i,t),s+=1)}return s}var L="__hfPositionEditsSeekReapplyWrapped",D=new WeakSet,F=new WeakMap,H=new WeakMap;function M(e){let t=e,o=()=>{try{S(t.document)}catch{}},r=n=>typeof n=="function"&&(D.has(n)||!!n[L]),s=n=>{D.add(n);try{Object.defineProperty(n,L,{value:!0})}catch{}},a=n=>{if(typeof n!="function"||r(n))return n;let l=function(...u){let d=n.apply(this,u);return o(),d};return s(l),l},i=(n,l)=>{let u=F.get(n);if(u?.has(l))return!0;let d=Object.getOwnPropertyDescriptor(n,l);if(d?.configurable===!1){let c=n[l];return typeof c=="function"&&(n[l]=a(c),o()),!1}let p=n[l],f=d?.set;return Object.defineProperty(n,l,{configurable:!0,enumerable:d?.enumerable??!0,get:()=>p,set:c=>{p=a(c),f?.call(n,c)}}),p=a(p),u??(u=new Set),u.add(l),F.set(n,u),o(),!0},g=(n,l)=>{let u=H.get(t),d=Object.getOwnPropertyDescriptor(t,n);if(!u?.has(n)){if(d?.configurable===!1){let c=t[n];return c?i(c,l):!1}let f=t[n];Object.defineProperty(t,n,{configurable:!0,enumerable:d?.enumerable??!0,get:()=>f,set:c=>{f=c,f&&i(f,l)}}),u??(u=new Set),u.add(n),H.set(t,u)}let p=t[n];return p?i(p,l):!1},h=()=>{let n=g("__hf","seek"),l=g("__player","renderSeek");return n&&l};if(h())return;let v=120,A=t.setInterval(()=>{if(h()){t.clearInterval(A);return}v-=1,v<=0&&t.clearInterval(A)},50)}function W(){document.querySelector(`[${y}], [${w}]`)&&(S(document),M(window))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",W,{once:!0}):W();})();\n';
6457
+ var POSITION_EDITS_RENDER_IIFE = '"use strict";(()=>{function x(){return globalThis}function R(e,t){if(typeof window>"u")return;let o=x(),r=o.__hf?.onSwallowed;if(r)try{r({label:e,error:t})}catch(s){}(o.__hfDebug||o.__HYPERFRAMES_DEBUG)&&console.debug(`[hyperframes] ${e} swallowed:`,t)}var T=null;function P(e,t){if(T)try{T({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch(o){R("runtime.analytics.site1",o)}}var I="http://www.w3.org/1999/xhtml";function N(e){return e!=null&&e.nodeType===1}function k(e){return N(e)&&(e.namespaceURI===I||e.namespaceURI==="http://www.w3.org/2000/svg")}var w="data-hf-edit-base-x",y="data-hf-edit-base-y",m="data-hf-edit-original-translate",_=e=>{let t=parseFloat(e??"");return Number.isFinite(t)?t:0},C=e=>{let t=[],o=0,r="";for(let s of e.trim())s==="("&&(o+=1),s===")"&&(o=Math.max(0,o-1)),/\\s/.test(s)&&o===0?(r&&t.push(r),r=""):r+=s;return r&&t.push(r),t},$=/^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)px$/,E=(e,t)=>$.test(e)&&$.test(t)?`${parseFloat(e)+parseFloat(t)}px`:`calc(${e} + ${t})`,O=(e,t,o)=>{if(!e||e==="none")return`${t} ${o}`;let[r,s,a]=C(e);if(r===void 0)return`${t} ${o}`;if(s===void 0)return`${E(r,t)} ${o}`;let i=a===void 0?"":` ${a}`;return`${E(r,t)} ${E(s,o)}${i}`},j=e=>{try{e.ownerDocument.defaultView?.gsap?.getProperty?.(e,"x")}catch{}},B=e=>{let t=e.style.getPropertyValue("translate").trim();if(t)return t==="none"?"":t;try{let o=e.ownerDocument.defaultView,r=o?o.getComputedStyle(e).getPropertyValue("translate").trim():"";return r==="none"?"":r}catch{return""}},b=new WeakMap;function V(e,t){let o=b.get(e);if(!t?.force&&o!==void 0&&e.style.getPropertyValue("translate")!==o){P("position_edit_fold_skipped",{hfId:e.getAttribute("data-hf-id")});return}let r=_(e.getAttribute("data-x"))-_(e.getAttribute(w)),s=_(e.getAttribute("data-y"))-_(e.getAttribute(y));e.hasAttribute(m)||e.setAttribute(m,B(e)),o===void 0&&j(e);let a=e.getAttribute(m)??"",i=O(a,`${r}px`,`${s}px`);e.style.setProperty("translate",i),b.set(e,e.style.getPropertyValue("translate"))}function h(e,t){let o=e.querySelectorAll(`[${m}]:not([${w}]):not([${y}])`);for(let a=0;a<o.length;a++){let i=o[a];if(i===void 0||!k(i))continue;let g=i.getAttribute(m)??"";g===""?i.style.removeProperty("translate"):i.style.setProperty("translate",g),i.removeAttribute(m),b.delete(i)}let r=e.querySelectorAll(`[${w}], [${y}]`),s=0;for(let a=0;a<r.length;a++){let i=r[a];i===void 0||!k(i)||(V(i,t),s+=1)}return s}var L="__hfPositionEditsSeekReapplyWrapped",D=new WeakSet,F=new WeakMap,H=new WeakMap;function W(e){let t=e,o=()=>{try{h(t.document)}catch{}},r=n=>typeof n=="function"&&(D.has(n)||!!n[L]),s=n=>{D.add(n);try{Object.defineProperty(n,L,{value:!0})}catch{}},a=n=>{if(typeof n!="function"||r(n))return n;let l=function(...u){let d=n.apply(this,u);return o(),d};return s(l),l},i=(n,l)=>{let u=F.get(n);if(u?.has(l))return!0;let d=Object.getOwnPropertyDescriptor(n,l);if(d?.configurable===!1){let c=n[l];return typeof c=="function"&&(n[l]=a(c),o()),!1}let p=n[l],f=d?.set;return Object.defineProperty(n,l,{configurable:!0,enumerable:d?.enumerable??!0,get:()=>p,set:c=>{p=a(c),f?.call(n,c)}}),p=a(p),u??(u=new Set),u.add(l),F.set(n,u),o(),!0},g=(n,l)=>{let u=H.get(t),d=Object.getOwnPropertyDescriptor(t,n);if(!u?.has(n)){if(d?.configurable===!1){let c=t[n];return c?i(c,l):!1}let f=t[n];Object.defineProperty(t,n,{configurable:!0,enumerable:d?.enumerable??!0,get:()=>f,set:c=>{f=c,f&&i(f,l)}}),u??(u=new Set),u.add(n),H.set(t,u)}let p=t[n];return p?i(p,l):!1},S=()=>{let n=g("__hf","seek"),l=g("__player","renderSeek");return n&&l};if(S())return;let v=120,A=t.setInterval(()=>{if(S()){t.clearInterval(A);return}v-=1,v<=0&&t.clearInterval(A)},50)}function M(){document.querySelector(`[${w}], [${y}]`)&&(h(document),W(window))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",M,{once:!0}):M();})();\n';
6154
6458
  function getPositionEditsRenderScript() {
6155
6459
  return POSITION_EDITS_RENDER_IIFE;
6156
6460
  }
@@ -6463,8 +6767,8 @@ function detectShaderTransitionUsage(html) {
6463
6767
  async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, downloadDir, tagName, elementIdentity, log, urlByAbsentLocalPath, probes) {
6464
6768
  let filePath = src;
6465
6769
  if (isHttpUrl(src)) {
6466
- const remoteDir = join13(downloadDir, REMOTE_MEDIA_SUBDIR);
6467
- if (!existsSync9(remoteDir)) mkdirSync5(remoteDir, { recursive: true });
6770
+ const remoteDir = join16(downloadDir, REMOTE_MEDIA_SUBDIR);
6771
+ if (!existsSync9(remoteDir)) mkdirSync7(remoteDir, { recursive: true });
6468
6772
  try {
6469
6773
  filePath = await downloadToTemp(src, remoteDir, void 0, void 0, void 0, {
6470
6774
  onTelemetry: logRemoteDownloadTelemetry
@@ -6474,7 +6778,7 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, down
6474
6778
  }
6475
6779
  } else {
6476
6780
  filePath = decodedUrlPath(src);
6477
- if (!filePath.startsWith("/")) filePath = join13(baseDir, filePath);
6781
+ if (!filePath.startsWith("/")) filePath = join16(baseDir, filePath);
6478
6782
  filePath = urlByAbsentLocalPath?.get(filePath) ?? filePath;
6479
6783
  }
6480
6784
  if (!isHttpUrl(filePath) && !existsSync9(filePath)) {
@@ -6635,7 +6939,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
6635
6939
  workItems.map(async (item) => {
6636
6940
  const { html: compiledSub } = await compileHtmlFile(
6637
6941
  rewriteUnresolvableGsapToCdn(item.rawSubHtml, projectDir, item.srcPath),
6638
- dirname5(item.filePath),
6942
+ dirname6(item.filePath),
6639
6943
  downloadDir,
6640
6944
  void 0,
6641
6945
  urlByAbsentLocalPath,
@@ -7065,7 +7369,7 @@ var REMOTE_SOURCE_TAG_RE = /<source\b[^>]*?\bsrc\s*=\s*["'](https?:\/\/[^"']+)["
7065
7369
  var REMOTE_IMG_TAG_RE = /<img\b[^>]*?(?<![\w-])src\s*=\s*["'](https?:\/\/[^"']+)["'][^>]*>/gi;
7066
7370
  async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLabel, extraRewrite) {
7067
7371
  if (urlSet.size === 0) return { html, remoteMediaAssets: /* @__PURE__ */ new Map() };
7068
- if (!existsSync9(remoteDir)) mkdirSync5(remoteDir, { recursive: true });
7372
+ if (!existsSync9(remoteDir)) mkdirSync7(remoteDir, { recursive: true });
7069
7373
  const urlToLocal = /* @__PURE__ */ new Map();
7070
7374
  await Promise.all(
7071
7375
  [...urlSet].map(async (url) => {
@@ -7112,7 +7416,7 @@ async function localizeRemoteMediaSources(html, downloadDir) {
7112
7416
  return downloadAndRewriteUrls(
7113
7417
  urlSet,
7114
7418
  html,
7115
- join13(downloadDir, REMOTE_MEDIA_SUBDIR),
7419
+ join16(downloadDir, REMOTE_MEDIA_SUBDIR),
7116
7420
  "Remote media download failed",
7117
7421
  "Localized remote media source(s)"
7118
7422
  );
@@ -7127,7 +7431,7 @@ async function localizeRemoteImageSources(html, downloadDir) {
7127
7431
  return downloadAndRewriteUrls(
7128
7432
  urlSet,
7129
7433
  html,
7130
- join13(downloadDir, REMOTE_MEDIA_SUBDIR),
7434
+ join16(downloadDir, REMOTE_MEDIA_SUBDIR),
7131
7435
  "Remote image download failed",
7132
7436
  "Localized remote image source(s)"
7133
7437
  );
@@ -7143,7 +7447,7 @@ async function localizeRemoteBackgroundImages(html, downloadDir) {
7143
7447
  return downloadAndRewriteUrls(
7144
7448
  urlSet,
7145
7449
  html,
7146
- join13(downloadDir, REMOTE_MEDIA_SUBDIR),
7450
+ join16(downloadDir, REMOTE_MEDIA_SUBDIR),
7147
7451
  "Remote background-image download failed",
7148
7452
  "Localized remote background-image(s)",
7149
7453
  // Quoted url('..')/url("..") are rewritten by downloadAndRewriteUrls' default
@@ -7253,7 +7557,7 @@ function projectStylesheetFontFamilies(html, projectDir) {
7253
7557
  const family = /font-family\s*:\s*([^;}]+)/i.exec(face)?.[1]?.trim().replace(/^['"]|['"]$/g, "");
7254
7558
  const shipsFile = [...face.matchAll(LOCAL_FONTFACE_URL_RE)].some(([, url = ""]) => {
7255
7559
  const path = decodedUrlPath(url);
7256
- const file = path.startsWith("/") ? resolve5(projectDir, `.${path}`) : resolve5(dirname5(sheet), path);
7560
+ const file = path.startsWith("/") ? resolve5(projectDir, `.${path}`) : resolve5(dirname6(sheet), path);
7257
7561
  return isPathInside2(file, projectDir) && existsSync9(file);
7258
7562
  });
7259
7563
  if (family && shipsFile) families.push(family);
@@ -7298,7 +7602,7 @@ function localizeFontFaceUrls(html, downloadDir) {
7298
7602
  return downloadAndRewriteUrls(
7299
7603
  collectFontFaceUrls(html),
7300
7604
  html,
7301
- join13(downloadDir, REMOTE_MEDIA_SUBDIR),
7605
+ join16(downloadDir, REMOTE_MEDIA_SUBDIR),
7302
7606
  "Remote font download failed",
7303
7607
  "Localized remote font face(s)",
7304
7608
  (h, url, relPath) => h.replaceAll(`url(${url})`, `url("${relPath}")`)
@@ -7324,7 +7628,7 @@ async function readLocalFont(absPath) {
7324
7628
  return { kind: "inline", buffer: Buffer.concat(chunks, totalBytes) };
7325
7629
  }
7326
7630
  async function embedLocalFontFaces(html, projectDir) {
7327
- const { fontToDataUri: toDataUri } = await import("./deterministicFonts-HY5GWGQQ.js");
7631
+ const { fontToDataUri: toDataUri } = await import("./deterministicFonts-DQDB47K3.js");
7328
7632
  const styleBlockRe = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
7329
7633
  const fontFaceRe = /@font-face\s*\{([^}]*)\}/gi;
7330
7634
  let result = html;
@@ -7970,11 +8274,36 @@ function adaptAspectAgnosticResolution(requested, aspectAgnostic, width, height,
7970
8274
  });
7971
8275
  return flipped;
7972
8276
  }
8277
+ function resolveEntryHtmlPath(input) {
8278
+ const { projectDir, workDir, entryFile, log } = input;
8279
+ const htmlPath = join17(projectDir, entryFile);
8280
+ const rawEntry = readTextFile(htmlPath);
8281
+ if (entryFile === "index.html" || !isTemplateEntry(rawEntry)) return htmlPath;
8282
+ const projectIndexPath = join17(projectDir, "index.html");
8283
+ if (!existsSync10(projectIndexPath)) {
8284
+ throw new Error(
8285
+ `Template entry file "${entryFile}" requires a project index.html to extract its render shell.`
8286
+ );
8287
+ }
8288
+ const standaloneHtml = extractStandaloneEntryFromIndex(
8289
+ readTextFile(projectIndexPath),
8290
+ entryFile,
8291
+ rawEntry
8292
+ );
8293
+ if (!standaloneHtml) {
8294
+ throw new Error(
8295
+ `Entry file "${entryFile}" is not mounted from index.html via data-composition-src, so it cannot be rendered independently.`
8296
+ );
8297
+ }
8298
+ const wrapperPath = join17(workDir, "standalone-entry.html");
8299
+ writeFileSync4(wrapperPath, standaloneHtml, "utf-8");
8300
+ log.info("Extracted standalone entry from index.html host context", { entryFile });
8301
+ return wrapperPath;
8302
+ }
7973
8303
  async function runCompileStage(input) {
7974
8304
  const {
7975
8305
  projectDir,
7976
8306
  workDir,
7977
- htmlPath,
7978
8307
  entryFile,
7979
8308
  job,
7980
8309
  cfg,
@@ -7985,8 +8314,9 @@ async function runCompileStage(input) {
7985
8314
  allowSystemFontCapture,
7986
8315
  abortSignal
7987
8316
  } = input;
8317
+ const htmlPath = resolveEntryHtmlPath({ projectDir, workDir, entryFile, log });
7988
8318
  const compileStart = Date.now();
7989
- const compiled = await compileForRender(projectDir, htmlPath, join14(workDir, "downloads"), {
8319
+ const compiled = await compileForRender(projectDir, htmlPath, join17(workDir, "downloads"), {
7990
8320
  log,
7991
8321
  failClosedFontFetch: failClosedFontFetch === true,
7992
8322
  allowSystemFontCapture,
@@ -7994,7 +8324,7 @@ async function runCompileStage(input) {
7994
8324
  variables: input.variables,
7995
8325
  urlByAbsentLocalPath: input.urlByAbsentLocalPath,
7996
8326
  pageMotionBlur: input.pageMotionBlur,
7997
- animatedGifCacheDir: cfg.extractCacheDir ? join14(cfg.extractCacheDir, "animated-gif") : void 0,
8327
+ animatedGifCacheDir: cfg.extractCacheDir ? join17(cfg.extractCacheDir, "animated-gif") : void 0,
7998
8328
  ffmpegProcessTimeout: cfg.ffmpegProcessTimeout
7999
8329
  });
8000
8330
  assertNotAborted();
@@ -8051,7 +8381,7 @@ async function runCompileStage(input) {
8051
8381
  };
8052
8382
  await preflightCompositionAssetMediaTypes({
8053
8383
  projectDir,
8054
- compiledDir: join14(workDir, "compiled"),
8384
+ compiledDir: join17(workDir, "compiled"),
8055
8385
  composition,
8056
8386
  signal: abortSignal
8057
8387
  });
@@ -8097,7 +8427,7 @@ async function runCompileStage(input) {
8097
8427
 
8098
8428
  // ../producer/src/services/render/stages/probeStage.ts
8099
8429
  import { createHash as createHash5 } from "crypto";
8100
- import { basename as basename5, join as join15 } from "path";
8430
+ import { basename as basename5, join as join18 } from "path";
8101
8431
 
8102
8432
  // ../producer/src/services/render/stages/probeFailures.ts
8103
8433
  var NETWORK_FAILURE_PATTERN = /404|ERR_NAME_NOT_RESOLVED|ERR_CONNECTION_REFUSED|net::ERR_/i;
@@ -8282,7 +8612,7 @@ async function runProbeStage(input) {
8282
8612
  });
8283
8613
  fileServer = await createFileServer({
8284
8614
  projectDir,
8285
- compiledDir: join15(workDir, "compiled"),
8615
+ compiledDir: join18(workDir, "compiled"),
8286
8616
  port: 0,
8287
8617
  preHeadScripts: [VIRTUAL_TIME_SHIM],
8288
8618
  fps: job.config.fps
@@ -8312,7 +8642,7 @@ async function runProbeStage(input) {
8312
8642
  log.info("Creating capture session...", { attempt, maxAttempts: PROBE_MAX_ATTEMPTS });
8313
8643
  probeSession = await createCaptureSession(
8314
8644
  fileServer.url,
8315
- join15(workDir, "probe"),
8645
+ join18(workDir, "probe"),
8316
8646
  captureOpts,
8317
8647
  null,
8318
8648
  probeCfg
@@ -8397,7 +8727,7 @@ async function runProbeStage(input) {
8397
8727
  });
8398
8728
  probeSession = await createCaptureSession(
8399
8729
  fileServer.url,
8400
- join15(workDir, "probe-screenshot"),
8730
+ join18(workDir, "probe-screenshot"),
8401
8731
  captureOpts,
8402
8732
  null,
8403
8733
  { ...probeCfg, forceScreenshot: true }
@@ -8435,7 +8765,7 @@ async function runProbeStage(input) {
8435
8765
  compiled,
8436
8766
  resolutions,
8437
8767
  projectDir,
8438
- join15(workDir, "downloads")
8768
+ join18(workDir, "downloads")
8439
8769
  );
8440
8770
  assertNotAborted();
8441
8771
  composition.videos = compiled.videos;
@@ -8626,7 +8956,7 @@ async function runProbeStage(input) {
8626
8956
  }
8627
8957
  await preflightCompositionAssetMediaTypes({
8628
8958
  projectDir,
8629
- compiledDir: join15(workDir, "compiled"),
8959
+ compiledDir: join18(workDir, "compiled"),
8630
8960
  composition,
8631
8961
  signal: abortSignal
8632
8962
  });
@@ -8783,8 +9113,8 @@ function validateDistributedDuration(input) {
8783
9113
  }
8784
9114
 
8785
9115
  // ../producer/src/services/render/stages/extractVideosStage.ts
8786
- import { existsSync as existsSync10 } from "fs";
8787
- import { join as join16 } from "path";
9116
+ import { existsSync as existsSync11 } from "fs";
9117
+ import { join as join19 } from "path";
8788
9118
 
8789
9119
  // ../producer/src/services/render/extractionFailureMetadata.ts
8790
9120
  function stringOrEmpty(value) {
@@ -9040,7 +9370,7 @@ async function runExtractVideosStage(input) {
9040
9370
  const probeFailures = await Promise.all(
9041
9371
  composition.videos.map(async (v) => {
9042
9372
  const videoPath = resolveProjectRelativeSrc(v.src, projectDir, compiledDir);
9043
- if (!existsSync10(videoPath)) return null;
9373
+ if (!existsSync11(videoPath)) return null;
9044
9374
  try {
9045
9375
  const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata(videoPath), retries: 0 } : await runVideoExtractionWithRetry(() => extractMediaMetadata(videoPath), {
9046
9376
  signal: abortSignal,
@@ -9078,7 +9408,7 @@ async function runExtractVideosStage(input) {
9078
9408
  const probed = await Promise.all(
9079
9409
  composition.images.map(async (img) => {
9080
9410
  const imgPath = resolveProjectRelativeSrc(img.src, projectDir, compiledDir);
9081
- if (!existsSync10(imgPath)) return null;
9411
+ if (!existsSync11(imgPath)) return null;
9082
9412
  const colorSpace = await probeColorSpaceSafely(imgPath, log);
9083
9413
  if (isHdrColorSpace(colorSpace)) {
9084
9414
  nativeHdrImageIds.add(img.id);
@@ -9112,14 +9442,14 @@ async function runExtractVideosStage(input) {
9112
9442
  // because short boundary counts can differ by one frame.
9113
9443
  {
9114
9444
  fps: job.config.fps,
9115
- outputDir: join16(compiledDir, "__hyperframes_video_frames"),
9445
+ outputDir: join19(compiledDir, "__hyperframes_video_frames"),
9116
9446
  format: job.config.videoFrameFormat ?? "auto",
9117
9447
  toneMapHdrToSdr: rendersSdrOnly(job.config, composition),
9118
9448
  timelineEnd: composition.duration,
9119
9449
  maxTransientRetries: extractionPolicy.maxTransientRetries,
9120
9450
  collectProbeFailures: extractionPolicy.failureMode === "enforce",
9121
9451
  deferRangeExtraction,
9122
- contentKeyedDirs: [join16(compiledDir, REMOTE_MEDIA_SUBDIR)],
9452
+ contentKeyedDirs: [join19(compiledDir, REMOTE_MEDIA_SUBDIR)],
9123
9453
  urlByAbsentLocalPath,
9124
9454
  onProgress: ({ planned = 0, done = 0 }) => {
9125
9455
  framesPlanned += planned;
@@ -9198,7 +9528,7 @@ async function appendVideoAudioFromProbe(input) {
9198
9528
  videos.map(async (video) => {
9199
9529
  const path = isHttpUrl(video.src) ? video.src : resolveProjectRelativeSrc(video.src, projectDir, compiledDir);
9200
9530
  const readFrom = urlByAbsentLocalPath?.get(path) ?? path;
9201
- if (!isHttpUrl(readFrom) && !existsSync10(readFrom)) return null;
9531
+ if (!isHttpUrl(readFrom) && !existsSync11(readFrom)) return null;
9202
9532
  const metadata = await extractMediaMetadata(readFrom);
9203
9533
  const window2 = await resolveFinalFrameExtractionWindow(
9204
9534
  readFrom,
@@ -9218,7 +9548,7 @@ async function appendVideoAudioFromProbe(input) {
9218
9548
  }
9219
9549
 
9220
9550
  // ../producer/src/services/render/videoLayerPassthroughPlan.ts
9221
- import { existsSync as existsSync11 } from "fs";
9551
+ import { existsSync as existsSync12 } from "fs";
9222
9552
  var SAMPLES = 9;
9223
9553
  function inspectVideoLayout(id, w, h, time) {
9224
9554
  window.__hf?.seek?.(time);
@@ -9280,7 +9610,7 @@ async function planVideoLayerPassthrough(input) {
9280
9610
  const { video } = q;
9281
9611
  if (isHttpUrl(video.src)) return { reason: "remote_source" };
9282
9612
  const path = resolveProjectRelativeSrc(video.src, input.projectDir, input.compiledDir);
9283
- if (!existsSync11(path)) return { reason: "source_missing" };
9613
+ if (!existsSync12(path)) return { reason: "source_missing" };
9284
9614
  const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
9285
9615
  if ("reason" in layout) return layout;
9286
9616
  const layer = await buildVideoLayerInput(
@@ -9295,17 +9625,17 @@ async function planVideoLayerPassthrough(input) {
9295
9625
  }
9296
9626
 
9297
9627
  // ../producer/src/services/render/stages/audioStage.ts
9298
- import { existsSync as existsSync13 } from "fs";
9299
- import { join as join19 } from "path";
9628
+ import { existsSync as existsSync14 } from "fs";
9629
+ import { join as join22 } from "path";
9300
9630
 
9301
9631
  // ../producer/src/services/render/audioDeliveryLimit.ts
9302
- import { existsSync as existsSync12 } from "fs";
9303
- import { dirname as dirname7, join as join18 } from "path";
9632
+ import { existsSync as existsSync13 } from "fs";
9633
+ import { dirname as dirname8, join as join21 } from "path";
9304
9634
 
9305
9635
  // ../producer/src/services/render/audioPadTrim.ts
9306
9636
  import { spawn } from "child_process";
9307
9637
  import { mkdtempSync as mkdtempSync3 } from "fs";
9308
- import { dirname as dirname6, join as join17 } from "path";
9638
+ import { dirname as dirname7, join as join20 } from "path";
9309
9639
 
9310
9640
  // ../producer/src/services/render/audioTruePeak.ts
9311
9641
  var toDbfs = (token) => token.toLowerCase() === "-inf" ? Number.NEGATIVE_INFINITY : Number(token);
@@ -9565,7 +9895,7 @@ async function constrainAacTruePeak(input) {
9565
9895
  }
9566
9896
  async function cutSource(input, scratchDir, attenuationDb) {
9567
9897
  if (!input.sourcePath || !input.rewriteSource) return true;
9568
- const cutPath = join17(scratchDir, "source.wav");
9898
+ const cutPath = join20(scratchDir, "source.wav");
9569
9899
  try {
9570
9900
  const result = await input.rewriteSource(input.sourcePath, cutPath, gainFilter(attenuationDb));
9571
9901
  if (!result.success) throw new Error(result.error);
@@ -9579,8 +9909,8 @@ async function cutSource(input, scratchDir, attenuationDb) {
9579
9909
  async function enforceAacTruePeak(input) {
9580
9910
  let scratchDir;
9581
9911
  try {
9582
- scratchDir = mkdtempSync3(join17(dirname6(input.audioPath), ".true-peak-"));
9583
- const correctedPath = join17(scratchDir, "audio.m4a");
9912
+ scratchDir = mkdtempSync3(join20(dirname7(input.audioPath), ".true-peak-"));
9913
+ const correctedPath = join20(scratchDir, "audio.m4a");
9584
9914
  const measurements = [];
9585
9915
  let attenuationDb = 0;
9586
9916
  let sourcePeakDbfs;
@@ -9771,31 +10101,57 @@ async function runFfprobeJson(args, signal) {
9771
10101
  }
9772
10102
 
9773
10103
  // ../producer/src/services/render/audioDeliveryLimit.ts
9774
- var LIMIT_CEILING_DBTP = AAC_DELIVERY_TRUE_PEAK_DBFS - 2;
9775
- var LIMIT_CHAIN = {
10104
+ var LIMIT_PASSES = 3;
10105
+ var LOWEST_CEILING_DBTP = AAC_DELIVERY_TRUE_PEAK_DBFS - 2;
10106
+ var PASS_HEADROOM_DB = 0.05;
10107
+ var limitChain = (ceiling) => ({
9776
10108
  version: 1,
9777
- nodes: [{ type: "truepeak", id: "delivery", params: { ceiling: LIMIT_CEILING_DBTP } }]
9778
- };
10109
+ nodes: [{ type: "truepeak", id: "delivery", params: { ceiling } }]
10110
+ });
9779
10111
  async function limitDeliveryPeaks(input, deps = {
9780
10112
  measure: measureTruePeakDbfs,
9781
10113
  applyChain: applyAudioFxChain,
9782
10114
  encode: encodeAac,
9783
10115
  rename: renameWithRetry,
9784
- sourceExists: existsSync12
10116
+ sourceExists: existsSync13
9785
10117
  }) {
9786
10118
  const { audioPath, sourcePath, signal, timeoutMs } = input;
9787
10119
  if (!deps.sourceExists(sourcePath)) return { success: true };
9788
10120
  const peak = await deps.measure(audioPath, { timeoutMs, signal });
9789
10121
  if (peak <= AAC_DELIVERY_TRUE_PEAK_DBFS) return { success: true };
9790
- const limitedPath = join18(dirname7(sourcePath), "audio-source-limited.wav");
10122
+ const alternating = ["a", "b"].map(
10123
+ (k) => join21(dirname8(sourcePath), `audio-source-limited-${k}.wav`)
10124
+ );
10125
+ let encodedFrom;
10126
+ let ceiling = AAC_DELIVERY_TRUE_PEAK_DBFS;
10127
+ for (let pass = 0; pass < LIMIT_PASSES; pass++) {
10128
+ const limitedPath = alternating[pass % 2];
10129
+ const result = await limitPass(input, deps, ceiling, limitedPath);
10130
+ if ("encodeFailure" in result) return result.encodeFailure;
10131
+ if ("limitFailed" in result) break;
10132
+ encodedFrom = limitedPath;
10133
+ if (result.peak <= AAC_DELIVERY_TRUE_PEAK_DBFS || ceiling <= LOWEST_CEILING_DBTP) break;
10134
+ ceiling = Math.max(
10135
+ ceiling - (result.peak - AAC_DELIVERY_TRUE_PEAK_DBFS) - PASS_HEADROOM_DB,
10136
+ LOWEST_CEILING_DBTP
10137
+ );
10138
+ }
10139
+ if (encodedFrom) deps.rename(encodedFrom, sourcePath, { copyFallback: true });
10140
+ return { success: true };
10141
+ }
10142
+ async function limitPass(input, deps, ceiling, limitedPath) {
10143
+ const { audioPath, sourcePath, signal, timeoutMs } = input;
9791
10144
  try {
9792
- await deps.applyChain(sourcePath, LIMIT_CHAIN, limitedPath, { trackId: "delivery", signal });
10145
+ await deps.applyChain(sourcePath, limitChain(ceiling), limitedPath, {
10146
+ trackId: "delivery",
10147
+ signal
10148
+ });
9793
10149
  } catch (error) {
9794
10150
  if (signal?.aborted) throw error;
9795
10151
  input.warn?.("[audio] true-peak limit failed, the whole-mix cut applies", {
9796
10152
  error: error instanceof Error ? error.message : String(error)
9797
10153
  });
9798
- return { success: true };
10154
+ return { limitFailed: true };
9799
10155
  }
9800
10156
  const encoded = await deps.encode(limitedPath, audioPath, input.targetDurationSeconds, {
9801
10157
  signal,
@@ -9803,13 +10159,14 @@ async function limitDeliveryPeaks(input, deps = {
9803
10159
  });
9804
10160
  if (!encoded.success) {
9805
10161
  return {
9806
- success: false,
9807
- error: `[audioDeliveryLimit] ${describeFfmpegFailure(encoded, timeoutMs)}`,
9808
- failureReason: encoded.failureReason
10162
+ encodeFailure: {
10163
+ success: false,
10164
+ error: `[audioDeliveryLimit] ${describeFfmpegFailure(encoded, timeoutMs)}`,
10165
+ failureReason: encoded.failureReason
10166
+ }
9809
10167
  };
9810
10168
  }
9811
- deps.rename(limitedPath, sourcePath, { copyFallback: true });
9812
- return { success: true };
10169
+ return { peak: await deps.measure(audioPath, { timeoutMs, signal }) };
9813
10170
  }
9814
10171
 
9815
10172
  // ../producer/src/services/render/stages/audioStage.ts
@@ -9835,7 +10192,7 @@ function runAudioStage(input) {
9835
10192
  }
9836
10193
  async function runAudioStageScoped(input) {
9837
10194
  const stageStart = Date.now();
9838
- const pcmSourcePath = join19(input.workDir, "audio-source.wav");
10195
+ const pcmSourcePath = join22(input.workDir, "audio-source.wav");
9839
10196
  const duration = input.totalFrames * input.fps.den / input.fps.num;
9840
10197
  let deliverySourcePath;
9841
10198
  try {
@@ -9851,7 +10208,7 @@ async function runAudioStageScoped(input) {
9851
10208
  );
9852
10209
  audioLoweredDb = guard.loweredDb;
9853
10210
  input.log?.info("[audio] phases", { ...result.audioPhaseMs, guard: Date.now() - guardStart });
9854
- if (input.keepDeliverySource && !guard.sourceStale && existsSync13(pcmSourcePath)) {
10211
+ if (input.keepDeliverySource && !guard.sourceStale && existsSync14(pcmSourcePath)) {
9855
10212
  deliverySourcePath = pcmSourcePath;
9856
10213
  }
9857
10214
  }
@@ -9900,7 +10257,7 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
9900
10257
  assertNotAborted,
9901
10258
  log
9902
10259
  } = input;
9903
- const audioOutputPath = join19(workDir, MIXED_AUDIO_FILENAME);
10260
+ const audioOutputPath = join22(workDir, MIXED_AUDIO_FILENAME);
9904
10261
  let hasAudio = false;
9905
10262
  let audioError;
9906
10263
  let audioFailures;
@@ -9911,7 +10268,7 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
9911
10268
  audioResult = await processCompositionAudio(
9912
10269
  audios,
9913
10270
  projectDir,
9914
- join19(workDir, "audio-work"),
10271
+ join22(workDir, "audio-work"),
9915
10272
  audioOutputPath,
9916
10273
  duration,
9917
10274
  abortSignal,
@@ -9979,8 +10336,8 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
9979
10336
  }
9980
10337
 
9981
10338
  // ../producer/src/services/render/stages/captureStage.ts
9982
- import { existsSync as existsSync14, readdirSync as readdirSync3, statfsSync as statfsSync2 } from "fs";
9983
- import { join as join20 } from "path";
10339
+ import { existsSync as existsSync15, readdirSync as readdirSync4, statfsSync as statfsSync2 } from "fs";
10340
+ import { join as join23 } from "path";
9984
10341
  function shouldAllowAdaptiveCaptureRetry(workerCount, _explicitlyConfigured) {
9985
10342
  return workerCount > 1;
9986
10343
  }
@@ -10036,16 +10393,16 @@ function diskCaptureShortfallError(needBytes, freeBytes, framesDir, basis, remed
10036
10393
  }
10037
10394
  function measureCaptureFrameBytes(workDir, framesDir) {
10038
10395
  let total = sampleDirectoryBytes(framesDir);
10039
- if (!existsSync14(workDir)) return total;
10040
- for (const attempt of readdirSync3(workDir)) {
10396
+ if (!existsSync15(workDir)) return total;
10397
+ for (const attempt of readdirSync4(workDir)) {
10041
10398
  if (/^retry-\d+-batch-\d+-worker-\d+$/.test(attempt)) {
10042
- total += sampleDirectoryBytes(join20(workDir, attempt));
10399
+ total += sampleDirectoryBytes(join23(workDir, attempt));
10043
10400
  continue;
10044
10401
  }
10045
10402
  if (!/^capture-attempt-\d+$/.test(attempt)) continue;
10046
- const attemptDir = join20(workDir, attempt);
10047
- for (const name of readdirSync3(attemptDir)) {
10048
- if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(join20(attemptDir, name));
10403
+ const attemptDir = join23(workDir, attempt);
10404
+ for (const name of readdirSync4(attemptDir)) {
10405
+ if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(join23(attemptDir, name));
10049
10406
  }
10050
10407
  }
10051
10408
  return total;
@@ -10339,8 +10696,8 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
10339
10696
  }
10340
10697
 
10341
10698
  // ../producer/src/services/render/stages/captureHdrStage.ts
10342
- import { existsSync as existsSync16, mkdirSync as mkdirSync6 } from "fs";
10343
- import { join as join24 } from "path";
10699
+ import { existsSync as existsSync17, mkdirSync as mkdirSync8 } from "fs";
10700
+ import { join as join27 } from "path";
10344
10701
 
10345
10702
  // ../producer/src/services/hdrImageTransferCache.ts
10346
10703
  var DEFAULT_MAX_BYTES = 200 * 1024 * 1024;
@@ -10402,7 +10759,7 @@ function createHdrImageTransferCache(options = {}) {
10402
10759
  }
10403
10760
 
10404
10761
  // ../producer/src/services/render/stages/captureHdrSequentialLoop.ts
10405
- import { join as join21 } from "path";
10762
+ import { join as join24 } from "path";
10406
10763
  async function runSequentialLayeredFrameLoop(input) {
10407
10764
  const {
10408
10765
  job,
@@ -10523,7 +10880,7 @@ async function runSequentialLayeredFrameLoop(input) {
10523
10880
  );
10524
10881
  if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
10525
10882
  writeFileExclusiveSync(
10526
- join21(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
10883
+ join24(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
10527
10884
  normalCanvas
10528
10885
  );
10529
10886
  }
@@ -10555,14 +10912,14 @@ async function runSequentialLayeredFrameLoop(input) {
10555
10912
  }
10556
10913
 
10557
10914
  // ../producer/src/services/render/stages/captureHdrHybridLoop.ts
10558
- import { join as join23 } from "path";
10915
+ import { join as join26 } from "path";
10559
10916
 
10560
10917
  // ../producer/src/services/shaderTransitionWorkerPool.ts
10561
10918
  import { Worker } from "worker_threads";
10562
10919
  import { fileURLToPath as fileURLToPath3, pathToFileURL } from "url";
10563
- import { dirname as dirname8, join as join22 } from "path";
10920
+ import { dirname as dirname9, join as join25 } from "path";
10564
10921
  import { createRequire } from "module";
10565
- import { existsSync as existsSync15 } from "fs";
10922
+ import { existsSync as existsSync16 } from "fs";
10566
10923
  import { cpus as cpus2 } from "os";
10567
10924
  function resolveWorkerEntry(explicit) {
10568
10925
  if (explicit && explicit.length > 0) {
@@ -10573,10 +10930,10 @@ function resolveWorkerEntry(explicit) {
10573
10930
  const isTs = override.endsWith(".ts");
10574
10931
  return { path: override, isTs };
10575
10932
  }
10576
- const moduleDir = dirname8(fileURLToPath3(import.meta.url));
10577
- const jsPath = join22(moduleDir, "shaderTransitionWorker.js");
10578
- if (existsSync15(jsPath)) return { path: jsPath, isTs: false };
10579
- const tsPath = join22(moduleDir, "shaderTransitionWorker.ts");
10933
+ const moduleDir = dirname9(fileURLToPath3(import.meta.url));
10934
+ const jsPath = join25(moduleDir, "shaderTransitionWorker.js");
10935
+ if (existsSync16(jsPath)) return { path: jsPath, isTs: false };
10936
+ const tsPath = join25(moduleDir, "shaderTransitionWorker.ts");
10580
10937
  return { path: tsPath, isTs: true };
10581
10938
  }
10582
10939
  function buildExecArgv(entryIsTs) {
@@ -10944,7 +11301,7 @@ async function runHybridLayeredFrameLoop(input) {
10944
11301
  );
10945
11302
  if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
10946
11303
  writeFileExclusiveSync(
10947
- join23(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
11304
+ join26(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
10948
11305
  canvas
10949
11306
  );
10950
11307
  }
@@ -11135,9 +11492,9 @@ async function runCaptureHdrStage(input) {
11135
11492
  if (hdrVideoFrameSources.has(v.id)) hdrVideoEndTimes.set(v.id, v.end);
11136
11493
  }
11137
11494
  const debugDumpEnabled = process.env.KEEP_TEMP === "1";
11138
- const debugDumpDir = debugDumpEnabled ? join24(framesDir, "debug-composite") : null;
11139
- if (debugDumpDir && !existsSync16(debugDumpDir)) {
11140
- mkdirSync6(debugDumpDir, { recursive: true });
11495
+ const debugDumpDir = debugDumpEnabled ? join27(framesDir, "debug-composite") : null;
11496
+ if (debugDumpDir && !existsSync17(debugDumpDir)) {
11497
+ mkdirSync8(debugDumpDir, { recursive: true });
11141
11498
  }
11142
11499
  const compositeTransfer = resolveCompositeTransfer(hasHdrContent, effectiveHdr);
11143
11500
  const hdrTargetTransfer = compositeTransfer === "srgb" ? void 0 : compositeTransfer;
@@ -11293,16 +11650,16 @@ async function runCaptureHdrStage(input) {
11293
11650
  // ../producer/src/services/render/stages/encodeStage.ts
11294
11651
  import {
11295
11652
  copyFileSync as copyFileSync2,
11296
- existsSync as existsSync17,
11297
- mkdirSync as mkdirSync7,
11298
- readdirSync as readdirSync4,
11653
+ existsSync as existsSync18,
11654
+ mkdirSync as mkdirSync9,
11655
+ readdirSync as readdirSync5,
11299
11656
  readFileSync as readFileSync6,
11300
- rmSync as rmSync7,
11301
- statSync as statSync5,
11302
- writeFileSync as writeFileSync4
11657
+ rmSync as rmSync9,
11658
+ statSync as statSync6,
11659
+ writeFileSync as writeFileSync5
11303
11660
  } from "fs";
11304
11661
  import { readFile as readFile2 } from "fs/promises";
11305
- import { dirname as dirname9, join as join25 } from "path";
11662
+ import { dirname as dirname10, join as join28 } from "path";
11306
11663
 
11307
11664
  // ../producer/src/services/render/stages/gifEncodeArgs.ts
11308
11665
  function fpsToFfmpegArg2(fps) {
@@ -11380,12 +11737,12 @@ async function reencodeWithClearedWholeFrames(argsInput, run, startTime) {
11380
11737
  const error = "[FFmpeg] GIF output could not be parsed to clear its frames";
11381
11738
  return gifEncodeFailure(startTime, outputPath, error);
11382
11739
  }
11383
- writeFileSync4(outputPath, gif);
11740
+ writeFileSync5(outputPath, gif);
11384
11741
  return null;
11385
11742
  }
11386
11743
  async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
11387
11744
  const startTime = Date.now();
11388
- const files = readdirSync4(framesDir).filter((file) => file.match(/\.(jpg|jpeg|png)$/i));
11745
+ const files = readdirSync5(framesDir).filter((file) => file.match(/\.(jpg|jpeg|png)$/i));
11389
11746
  const frameCount = files.length;
11390
11747
  if (frameCount === 0) {
11391
11748
  return gifEncodeFailure(startTime, outputPath, "[FFmpeg] No frame files found in directory");
@@ -11412,7 +11769,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
11412
11769
  const failure = await reencodeWithClearedWholeFrames(argsInput, run, startTime);
11413
11770
  if (failure) return failure;
11414
11771
  }
11415
- const fileSize = existsSync17(outputPath) ? statSync5(outputPath).size : 0;
11772
+ const fileSize = existsSync18(outputPath) ? statSync6(outputPath).size : 0;
11416
11773
  return {
11417
11774
  success: true,
11418
11775
  outputPath,
@@ -11421,7 +11778,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
11421
11778
  fileSize
11422
11779
  };
11423
11780
  } finally {
11424
- rmSync7(input.palettePath, { force: true });
11781
+ rmSync9(input.palettePath, { force: true });
11425
11782
  }
11426
11783
  }
11427
11784
  function startEncodeProgress(job, stage, onProgress) {
@@ -11498,7 +11855,7 @@ function encodeWhileCapturing(input, totalFrames) {
11498
11855
  await new Promise((resolve11) => wake = resolve11);
11499
11856
  }
11500
11857
  if (signal.aborted) return;
11501
- const mergedPath = join25(input.framesDir, formatCaptureFrameName(next, "jpg"));
11858
+ const mergedPath = join28(input.framesDir, formatCaptureFrameName(next, "jpg"));
11502
11859
  const frame = await readLandedFrame(landed.get(next), mergedPath);
11503
11860
  landed.delete(next);
11504
11861
  if (!await stream.writeFrame(frame)) {
@@ -11573,19 +11930,19 @@ async function runEncodeStage(input) {
11573
11930
  const stage5Start = Date.now();
11574
11931
  if (isPngSequence) {
11575
11932
  const encoded = startEncodeProgress(job, "Writing PNG sequence", onProgress);
11576
- if (!existsSync17(outputPath)) mkdirSync7(outputPath, { recursive: true });
11577
- const captured = readdirSync4(framesDir).filter((name) => name.endsWith(".png")).sort();
11933
+ if (!existsSync18(outputPath)) mkdirSync9(outputPath, { recursive: true });
11934
+ const captured = readdirSync5(framesDir).filter((name) => name.endsWith(".png")).sort();
11578
11935
  if (captured.length === 0) {
11579
11936
  throw new Error(
11580
11937
  `[Render] png-sequence output requested but no PNGs were captured to ${framesDir}`
11581
11938
  );
11582
11939
  }
11583
11940
  captured.forEach((name, i) => {
11584
- const dst = join25(outputPath, formatExportFrameName(i, "png"));
11585
- copyFileSync2(join25(framesDir, name), dst);
11941
+ const dst = join28(outputPath, formatExportFrameName(i, "png"));
11942
+ copyFileSync2(join28(framesDir, name), dst);
11586
11943
  });
11587
- if (hasAudio && audioOutputPath && existsSync17(audioOutputPath)) {
11588
- copyFileSync2(audioOutputPath, join25(outputPath, MIXED_AUDIO_FILENAME));
11944
+ if (hasAudio && audioOutputPath && existsSync18(audioOutputPath)) {
11945
+ copyFileSync2(audioOutputPath, join28(outputPath, MIXED_AUDIO_FILENAME));
11589
11946
  log.info(
11590
11947
  `[Render] png-sequence: ${MIXED_AUDIO_FILENAME} sidecar written to ${outputPath}/${MIXED_AUDIO_FILENAME}`
11591
11948
  );
@@ -11605,7 +11962,7 @@ async function runEncodeStage(input) {
11605
11962
  const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
11606
11963
  fps: job.config.fps,
11607
11964
  loop,
11608
- palettePath: join25(dirname9(videoOnlyPath), "gif-palette.png"),
11965
+ palettePath: join28(dirname10(videoOnlyPath), "gif-palette.png"),
11609
11966
  preserveAlpha: needsAlpha,
11610
11967
  signal: abortSignal,
11611
11968
  timeout: engineCfg.ffmpegEncodeTimeout
@@ -11810,14 +12167,14 @@ function sampleDirectoryBytes(dir) {
11810
12167
  if (!current) continue;
11811
12168
  let entries = [];
11812
12169
  try {
11813
- entries = readdirSync5(current);
12170
+ entries = readdirSync6(current);
11814
12171
  } catch {
11815
12172
  continue;
11816
12173
  }
11817
12174
  for (const name of entries) {
11818
- const full = join26(current, name);
12175
+ const full = join29(current, name);
11819
12176
  try {
11820
- const st = statSync6(full);
12177
+ const st = statSync7(full);
11821
12178
  if (st.isDirectory()) {
11822
12179
  stack.push(full);
11823
12180
  } else if (st.isFile()) {
@@ -11965,18 +12322,14 @@ function hasUsableVideoDimensions(metadata) {
11965
12322
  return Number.isFinite(metadata.width) && Number.isFinite(metadata.height) && metadata.width > 0 && metadata.height > 0;
11966
12323
  }
11967
12324
  function collectVideoMetadataHints(extractedVideos) {
11968
- return extractedVideos.filter((video) => hasUsableVideoDimensions(video.metadata)).map((video) => ({
11969
- id: video.videoId,
11970
- width: video.metadata.width,
11971
- height: video.metadata.height
11972
- })).sort((a, b) => a.id.localeCompare(b.id));
12325
+ return extractedVideos.filter((video) => hasUsableVideoDimensions(video.metadata)).map((video) => ({ id: video.videoId, ...displaySize(video.metadata) })).sort((a, b) => a.id.localeCompare(b.id));
11973
12326
  }
11974
12327
  function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
11975
12328
  const ranges = [];
11976
12329
  let rangeStart = null;
11977
12330
  for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
11978
- const framePath = join26(framesDir, formatCaptureFrameName(frameIndex, frameExt));
11979
- const missing = !existsSync18(framePath) || statSync6(framePath).size <= 8;
12331
+ const framePath = join29(framesDir, formatCaptureFrameName(frameIndex, frameExt));
12332
+ const missing = !existsSync19(framePath) || statSync7(framePath).size <= 8;
11980
12333
  if (missing && rangeStart === null) {
11981
12334
  rangeStart = frameIndex;
11982
12335
  } else if (!missing && rangeStart !== null) {
@@ -11992,7 +12345,7 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
11992
12345
  function buildMissingFrameRetryBatches(ranges, maxWorkers, workDir, attempt, rangeStart = 0, stride = 1) {
11993
12346
  const workersPerBatch = Math.max(1, Math.floor(maxWorkers));
11994
12347
  const batches = [];
11995
- const outputDirFor = (batchIndex, workerId) => join26(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`);
12348
+ const outputDirFor = (batchIndex, workerId) => join29(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`);
11996
12349
  if (stride > 1) {
11997
12350
  const spans = /* @__PURE__ */ new Map();
11998
12351
  for (const range of ranges) {
@@ -12052,8 +12405,8 @@ function getNextRetryWorkerCount(currentWorkers) {
12052
12405
  return Math.max(1, Math.floor(currentWorkers / 2));
12053
12406
  }
12054
12407
  function resolveRenderWorkDirPrefix(outputPath, jobId, platform2 = process.platform, systemTempDir = tmpdir2()) {
12055
- if (platform2 === "win32" || platform2 === "darwin") return join26(systemTempDir, "hf-render-");
12056
- return join26(dirname10(outputPath), `work-${jobId}-`);
12408
+ if (platform2 === "win32" || platform2 === "darwin") return join29(systemTempDir, "hf-render-");
12409
+ return join29(dirname11(outputPath), `work-${jobId}-`);
12057
12410
  }
12058
12411
  var MAX_TRANSIENT_CAPTURE_RETRIES = 1;
12059
12412
  function isTransientCaptureRetryEligible(failureKind, missing, retriesUsed) {
@@ -12100,8 +12453,8 @@ The composition is too large for the available memory. To reduce memory pressure
12100
12453
  function countCapturedFrames(totalFrames, framesDir, frameExt) {
12101
12454
  let captured = 0;
12102
12455
  for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
12103
- const framePath = join26(framesDir, formatCaptureFrameName(frameIndex, frameExt));
12104
- if (existsSync18(framePath)) captured++;
12456
+ const framePath = join29(framesDir, formatCaptureFrameName(frameIndex, frameExt));
12457
+ if (existsSync19(framePath)) captured++;
12105
12458
  }
12106
12459
  return captured;
12107
12460
  }
@@ -12126,7 +12479,7 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
12126
12479
  reason: attempt === 0 ? "initial" : pendingTransientRetry ? "transient-retry" : "retry"
12127
12480
  });
12128
12481
  pendingTransientRetry = false;
12129
- const attemptWorkDir = join26(options.workDir, `capture-attempt-${attempt}`);
12482
+ const attemptWorkDir = join29(options.workDir, `capture-attempt-${attempt}`);
12130
12483
  const batches = missingRanges ? buildMissingFrameRetryBatches(
12131
12484
  missingRanges,
12132
12485
  currentWorkers,
@@ -12758,19 +13111,19 @@ function deVerifyFallbackTelemetry(err) {
12758
13111
  };
12759
13112
  }
12760
13113
  function resolveRenderDebugDir() {
12761
- const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve6(process.env.PRODUCER_RENDERS_DIR, "..") : resolve6(dirname10(fileURLToPath4(import.meta.url)), "../..");
12762
- return join26(producerRoot, ".debug");
13114
+ const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve6(process.env.PRODUCER_RENDERS_DIR, "..") : resolve6(dirname11(fileURLToPath4(import.meta.url)), "../..");
13115
+ return join29(producerRoot, ".debug");
12763
13116
  }
12764
13117
  async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
12765
13118
  validateHlsRenderConfig(job.config);
12766
13119
  validateDeliveryEncoderConfig(job.config);
12767
13120
  const debugDir = resolveRenderDebugDir();
12768
- const outputDir = dirname10(outputPath);
12769
- if (!existsSync18(outputDir)) mkdirSync8(outputDir, { recursive: true });
12770
- const workDir = job.config.debug ? join26(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
13121
+ const outputDir = dirname11(outputPath);
13122
+ if (!existsSync19(outputDir)) mkdirSync10(outputDir, { recursive: true });
13123
+ const workDir = job.config.debug ? join29(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
12771
13124
  const pipelineStart = Date.now();
12772
13125
  const baseLog = job.config.logger ?? defaultLogger;
12773
- const logPath = job.config.debug ? join26(workDir, "render.log") : null;
13126
+ const logPath = job.config.debug ? join29(workDir, "render.log") : null;
12774
13127
  const execution = new RenderExecutionContext({
12775
13128
  request: { renderJobId: job.id, projectDir, outputPath },
12776
13129
  logger: logPath ? createRenderFileLogger(logPath, baseLog) : baseLog,
@@ -12784,7 +13137,7 @@ async function executeRenderJob(job, projectDir, outputPath, progressSink, abort
12784
13137
  log.info("KEEP_TEMP=1, leaving workDir on disk for inspection", { workDir });
12785
13138
  return;
12786
13139
  }
12787
- rmSync8(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
13140
+ rmSync10(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
12788
13141
  });
12789
13142
  try {
12790
13143
  await executeRenderPipeline({
@@ -12832,7 +13185,7 @@ async function executeRenderPipeline(input) {
12832
13185
  imageDecodeFailures: 0
12833
13186
  };
12834
13187
  let hdrPerf;
12835
- const perfOutputPath = join26(workDir, "perf-summary.json");
13188
+ const perfOutputPath = join29(workDir, "perf-summary.json");
12836
13189
  const cfg = { ...job.config.producerConfig ?? resolveConfig() };
12837
13190
  const observability = new RenderObservabilityRecorder({
12838
13191
  pipelineStartMs: pipelineStart,
@@ -12908,7 +13261,7 @@ async function executeRenderPipeline(input) {
12908
13261
  job.startedAt = /* @__PURE__ */ new Date();
12909
13262
  assertNotAborted();
12910
13263
  assertConfiguredFfmpegBinariesExist();
12911
- if (!existsSync18(workDir)) mkdirSync8(workDir, { recursive: true });
13264
+ if (!existsSync19(workDir)) mkdirSync10(workDir, { recursive: true });
12912
13265
  if (job.config.debug) {
12913
13266
  log.info("[Render] Debug artifacts enabled", { workDir, logPath });
12914
13267
  }
@@ -12937,36 +13290,11 @@ async function executeRenderPipeline(input) {
12937
13290
  requestedWorkers: job.config.workers ?? "auto"
12938
13291
  });
12939
13292
  const entryFile = job.config.entryFile || "index.html";
12940
- let htmlPath = join26(projectDir, entryFile);
12941
- if (!existsSync18(htmlPath)) {
13293
+ const htmlPath = join29(projectDir, entryFile);
13294
+ if (!existsSync19(htmlPath)) {
12942
13295
  throw new Error(`Entry file not found: ${htmlPath}`);
12943
13296
  }
12944
13297
  assertNotAborted();
12945
- const rawEntry = readTextFile(htmlPath);
12946
- if (entryFile !== "index.html" && isTemplateEntry(rawEntry)) {
12947
- const wrapperPath = join26(workDir, "standalone-entry.html");
12948
- const projectIndexPath = join26(projectDir, "index.html");
12949
- if (!existsSync18(projectIndexPath)) {
12950
- throw new Error(
12951
- `Template entry file "${entryFile}" requires a project index.html to extract its render shell.`
12952
- );
12953
- }
12954
- const standaloneHtml = extractStandaloneEntryFromIndex(
12955
- readTextFile(projectIndexPath),
12956
- entryFile,
12957
- rawEntry
12958
- );
12959
- if (!standaloneHtml) {
12960
- throw new Error(
12961
- `Entry file "${entryFile}" is not mounted from index.html via data-composition-src, so it cannot be rendered independently.`
12962
- );
12963
- }
12964
- writeFileSync5(wrapperPath, standaloneHtml, "utf-8");
12965
- htmlPath = wrapperPath;
12966
- log.info("Extracted standalone entry from index.html host context", {
12967
- entryFile
12968
- });
12969
- }
12970
13298
  const stage1Start = Date.now();
12971
13299
  updateJobStatus(job, "preprocessing", "Compiling composition", 5, onProgress, {
12972
13300
  code: "compile"
@@ -12978,7 +13306,6 @@ async function executeRenderPipeline(input) {
12978
13306
  () => runCompileStage({
12979
13307
  projectDir,
12980
13308
  workDir,
12981
- htmlPath,
12982
13309
  entryFile,
12983
13310
  job,
12984
13311
  cfg,
@@ -13140,7 +13467,7 @@ async function executeRenderPipeline(input) {
13140
13467
  canvas: { width, height },
13141
13468
  page: probeSession.page,
13142
13469
  projectDir,
13143
- compiledDir: join26(workDir, "compiled")
13470
+ compiledDir: join29(workDir, "compiled")
13144
13471
  });
13145
13472
  if (videoLayerPlan.videoId === void 0) {
13146
13473
  log.info(`[Render] Video layer passthrough off: ${videoLayerPlan.reason}`);
@@ -13158,7 +13485,22 @@ async function executeRenderPipeline(input) {
13158
13485
  updateJobStatus(job, "preprocessing", "Extracting video frames", 10, onProgress, {
13159
13486
  code: "extract_video"
13160
13487
  });
13161
- const compiledDir = join26(workDir, "compiled");
13488
+ const compiledDir = join29(workDir, "compiled");
13489
+ const segmentsCapture = (layeredOrEffectRoute) => shouldSegmentCapture({
13490
+ env: process.env,
13491
+ durationSeconds: probeResult.duration,
13492
+ outputFormat,
13493
+ layeredOrEffectRoute,
13494
+ streamingOk: shouldUseStreamingEncode(cfg, outputFormat, 1, probeResult.duration)
13495
+ });
13496
+ const segmentedForWindow = segmentsCapture(compiled.hasShaderTransitions);
13497
+ const windowVideoFrames = job.config.motionBlur === void 0 && shouldWindowVideoFrames({ env: process.env, segmented: segmentedForWindow });
13498
+ if (!windowVideoFrames && shouldWindowVideoFrames({ env: process.env, segmented: true })) {
13499
+ const reason = job.config.motionBlur !== void 0 ? "motion blur" : outputFormat !== "mp4" && outputFormat !== "mov" ? `${outputFormat} output` : "capture is not segmented";
13500
+ log.info("[Render] HF_VIDEO_FRAME_WINDOW is set but this render extracts every frame", {
13501
+ reason
13502
+ });
13503
+ }
13162
13504
  const extractResult = await observeRenderStage(
13163
13505
  observability,
13164
13506
  "video_extract",
@@ -13175,6 +13517,7 @@ async function executeRenderPipeline(input) {
13175
13517
  assertNotAborted,
13176
13518
  // Local staging can use links; distributed plan() alone requires real copies.
13177
13519
  materializeSymlinks: false,
13520
+ deferRangeExtraction: windowVideoFrames ? true : void 0,
13178
13521
  onProgress
13179
13522
  })
13180
13523
  );
@@ -13271,7 +13614,7 @@ async function executeRenderPipeline(input) {
13271
13614
  try {
13272
13615
  fileServer = await createFileServer({
13273
13616
  projectDir,
13274
- compiledDir: join26(workDir, "compiled"),
13617
+ compiledDir: join29(workDir, "compiled"),
13275
13618
  port: 0,
13276
13619
  preHeadScripts: [VIRTUAL_TIME_SHIM],
13277
13620
  fps: job.config.fps
@@ -13289,8 +13632,8 @@ async function executeRenderPipeline(input) {
13289
13632
  if (!activeFileServer) {
13290
13633
  throw new Error("File server failed to initialize before frame capture");
13291
13634
  }
13292
- const framesDir = join26(workDir, "captured-frames");
13293
- if (!existsSync18(framesDir)) mkdirSync8(framesDir, { recursive: true });
13635
+ const framesDir = join29(workDir, "captured-frames");
13636
+ if (!existsSync19(framesDir)) mkdirSync10(framesDir, { recursive: true });
13294
13637
  updateJobStatus(job, "rendering", "Checking browser GPU", 25, onProgress, {
13295
13638
  code: "start_browsers"
13296
13639
  });
@@ -13368,7 +13711,55 @@ async function executeRenderPipeline(input) {
13368
13711
  });
13369
13712
  const buildPrepCaptureOptions = () => stopPrepSessionOnScriptFailure(buildCaptureOptions());
13370
13713
  const buildWorkerCaptureOptions = () => withScriptFailureStop(buildCaptureOptions(), job, log);
13714
+ let videoFrameWindow = windowVideoFrames && (extractionResult?.extracted.some((video) => video.deferredRange) ?? false);
13715
+ if (windowVideoFrames) {
13716
+ const extracted = extractionResult?.extracted ?? [];
13717
+ log.info("[Render] Video frame window", {
13718
+ windowed: extracted.filter((video) => video.deferredRange).length,
13719
+ fullyExtracted: extracted.filter((video) => !video.deferredRange).length
13720
+ });
13721
+ }
13722
+ const buildSegmentVideoFrames = () => trackSegmentFramePeak(
13723
+ createSegmentVideoFrames({
13724
+ videos: composition.videos,
13725
+ extracted: extractionResult?.extracted ?? [],
13726
+ fps: job.config.fps,
13727
+ rootDir: workDir,
13728
+ cfg,
13729
+ injectorOptions: frameCacheOptions(cfg, workerCount),
13730
+ abortSignal: executionSignal
13731
+ }),
13732
+ workDir,
13733
+ (bytes) => updateCaptureObservability({ videoFrameWindowPeakBytes: bytes })
13734
+ );
13371
13735
  const createRenderVideoFrameInjector = () => createVideoFrameInjector(frameLookup, frameCacheOptions(cfg, workerCount));
13736
+ const extractDeferredVideoFrames = async () => {
13737
+ videoFrameWindow = false;
13738
+ updateCaptureObservability({ videoFrameWindow: "off" });
13739
+ const extracted = extractionResult?.extracted ?? [];
13740
+ const videoCount = extracted.filter((video) => video.deferredRange).length;
13741
+ const startedAt = Date.now();
13742
+ log.info("[Render] Extracting the frames of the videos a window would have held back", {
13743
+ videoCount
13744
+ });
13745
+ await observeRenderStage(
13746
+ observability,
13747
+ "video_extract_deferred",
13748
+ { videoCount },
13749
+ () => extractAllDeferredFrames(extracted, {
13750
+ fps: job.config.fps,
13751
+ cfg,
13752
+ signal: executionSignal,
13753
+ maxTransientRetries: resolveVideoExtractionPolicy().maxTransientRetries,
13754
+ onProgress: (done, total) => reportExtractProgress(job, done, total, onProgress)
13755
+ })
13756
+ );
13757
+ assertNotAborted();
13758
+ log.info("[Render] Extracted the deferred video frames", {
13759
+ videoCount,
13760
+ elapsedMs: Date.now() - startedAt
13761
+ });
13762
+ };
13372
13763
  let captureCalibration;
13373
13764
  const htmlInCanvasDetected = compiled.renderModeHints.reasons.some(
13374
13765
  (r) => r.code === "htmlInCanvas"
@@ -13534,32 +13925,41 @@ async function executeRenderPipeline(input) {
13534
13925
  updateJobStatus(job, "rendering", "Measuring capture speed", 25, onProgress, {
13535
13926
  code: "start_browsers"
13536
13927
  });
13537
- const outcome = await observeRenderStage(
13538
- observability,
13539
- "capture_calibration",
13540
- captureStageObservationData({
13541
- forceScreenshot: captureForceScreenshot,
13542
- // Override the default `capturing` — calibration writes probe
13543
- // frames only, not `job.framesRendered`, so heartbeats reporting
13544
- // `framesCompleted: 0` misread as broken. Field signal
13545
- // ts=1784019503.
13546
- stagePhase: "calibrating"
13547
- }),
13548
- () => runCaptureCalibration({
13549
- cfg: calibrationCaptureConfig(cfg),
13550
- fileServer: activeFileServer,
13551
- workDir,
13552
- log,
13553
- job,
13554
- totalFrames,
13555
- forceScreenshot: captureForceScreenshot,
13556
- probeSession,
13557
- buildCaptureOptions: buildPrepCaptureOptions,
13558
- createRenderVideoFrameInjector,
13559
- assertNotAborted
13560
- }),
13561
- { heartbeatMessage: "browser calibrating (frames not started)" }
13562
- );
13928
+ const calibrationFrames = videoFrameWindow ? await buildSegmentVideoFrames().forFrames(
13929
+ selectCaptureCalibrationFrames(totalFrames),
13930
+ "calibration"
13931
+ ) : void 0;
13932
+ let outcome;
13933
+ try {
13934
+ outcome = await observeRenderStage(
13935
+ observability,
13936
+ "capture_calibration",
13937
+ captureStageObservationData({
13938
+ forceScreenshot: captureForceScreenshot,
13939
+ // Override the default `capturing` — calibration writes probe
13940
+ // frames only, not `job.framesRendered`, so heartbeats reporting
13941
+ // `framesCompleted: 0` misread as broken. Field signal
13942
+ // ts=1784019503.
13943
+ stagePhase: "calibrating"
13944
+ }),
13945
+ () => runCaptureCalibration({
13946
+ cfg: calibrationCaptureConfig(cfg),
13947
+ fileServer: activeFileServer,
13948
+ workDir,
13949
+ log,
13950
+ job,
13951
+ totalFrames,
13952
+ forceScreenshot: captureForceScreenshot,
13953
+ probeSession,
13954
+ buildCaptureOptions: buildPrepCaptureOptions,
13955
+ createRenderVideoFrameInjector: calibrationFrames ? calibrationFrames.injector : createRenderVideoFrameInjector,
13956
+ assertNotAborted
13957
+ }),
13958
+ { heartbeatMessage: "browser calibrating (frames not started)" }
13959
+ );
13960
+ } finally {
13961
+ calibrationFrames?.release();
13962
+ }
13563
13963
  captureCalibration = outcome.calibration;
13564
13964
  calibrationEvaluateTimedOut = outcome.calibrationEvaluateTimedOut;
13565
13965
  captureForceScreenshot = outcome.forceScreenshot;
@@ -13791,7 +14191,7 @@ async function executeRenderPipeline(input) {
13791
14191
  hls: ".mp4"
13792
14192
  };
13793
14193
  const videoExt = FORMAT_EXT[outputFormat] ?? ".mp4";
13794
- const videoOnlyPath = join26(workDir, `video-only${videoExt}`);
14194
+ const videoOnlyPath = join29(workDir, `video-only${videoExt}`);
13795
14195
  const usePageSideCompositingForTransitions = (cfg.enablePageSideCompositing || isGif) && compiled.hasShaderTransitions && !hasHdrContent && outputSupportsPageSideShaderCompositing(outputFormat);
13796
14196
  if (usePageSideCompositingForTransitions) {
13797
14197
  activeFileServer.addPreHeadScript(HF_PAGE_SIDE_COMPOSITING_STUB);
@@ -13892,13 +14292,7 @@ async function executeRenderPipeline(input) {
13892
14292
  // excluded routes are the ones whose concat-copy or capture loop the
13893
14293
  // segment contract does not cover (webm VP9 concat is fragile, HDR and
13894
14294
  // shader transitions run their own compositor).
13895
- useSegmentedCapture: shouldSegmentCapture({
13896
- env: process.env,
13897
- durationSeconds: job.duration,
13898
- outputFormat,
13899
- layeredOrEffectRoute: hasHdrContent || compiled.hasShaderTransitions,
13900
- streamingOk: shouldUseStreamingEncode(cfg, outputFormat, 1, job.duration)
13901
- }),
14295
+ useSegmentedCapture: segmentsCapture(hasHdrContent || compiled.hasShaderTransitions),
13902
14296
  useLayeredComposite,
13903
14297
  usePageSideCompositing: usePageSideCompositingForTransitions,
13904
14298
  hasHdrContent,
@@ -13938,10 +14332,14 @@ async function executeRenderPipeline(input) {
13938
14332
  deWorkerInversion,
13939
14333
  deParallelRouter
13940
14334
  });
14335
+ if (videoFrameWindow && capturePlan.kind !== "sdr_segmented")
14336
+ await extractDeferredVideoFrames();
14337
+ updateCaptureObservability({ videoFrameWindow: videoFrameWindow ? "on" : "off" });
13941
14338
  observability.checkpoint("capture_strategy", "resolved", {
13942
14339
  plan: capturePlan.kind,
13943
14340
  workerCount: capturePlan.workerCount,
13944
14341
  forceScreenshot: capturePlan.forceScreenshot,
14342
+ videoFrameWindow: videoFrameWindow ? "on" : "off",
13945
14343
  captureBeyondViewport: resolvedCaptureBeyondViewport ?? null,
13946
14344
  useStreamingEncode: capturePlan.kind === "sdr_streaming",
13947
14345
  useLayeredComposite: capturePlan.kind === "hdr_layered",
@@ -14079,7 +14477,7 @@ async function executeRenderPipeline(input) {
14079
14477
  pageMotionBlur: job.config.pageMotionBlur,
14080
14478
  captureQuality: captureOptions.quality
14081
14479
  });
14082
- const segmentDir = segmentDirFor(join26(projectDir, "renders"), segmentPlanHash);
14480
+ const segmentDir = segmentDirFor(join29(projectDir, "renders"), segmentPlanHash);
14083
14481
  let completedSegments = /* @__PURE__ */ new Set();
14084
14482
  if (job.config.resumeSegments === true) {
14085
14483
  const existing = readSegmentManifest(segmentDir);
@@ -14094,10 +14492,10 @@ async function executeRenderPipeline(input) {
14094
14492
  });
14095
14493
  }
14096
14494
  if (completedSegments.size === 0) {
14097
- rmSync8(segmentDir, { recursive: true, force: true });
14495
+ rmSync10(segmentDir, { recursive: true, force: true });
14098
14496
  }
14099
14497
  } else {
14100
- rmSync8(segmentDir, { recursive: true, force: true });
14498
+ rmSync10(segmentDir, { recursive: true, force: true });
14101
14499
  }
14102
14500
  const emptySegmentManifest = () => ({
14103
14501
  version: 1,
@@ -14147,6 +14545,7 @@ async function executeRenderPipeline(input) {
14147
14545
  },
14148
14546
  buildCaptureOptions: buildWorkerCaptureOptions,
14149
14547
  createRenderVideoFrameInjector,
14548
+ segmentVideoFrames: videoFrameWindow ? buildSegmentVideoFrames() : void 0,
14150
14549
  abortSignal: executionSignal,
14151
14550
  assertNotAborted,
14152
14551
  onProgress,
@@ -14198,7 +14597,7 @@ async function executeRenderPipeline(input) {
14198
14597
  probeSession = null;
14199
14598
  await closeOrphanedProbeForRetry(orphaned, closeCaptureSession, log, "segmented");
14200
14599
  }
14201
- rmSync8(segmentDir, { recursive: true, force: true });
14600
+ rmSync10(segmentDir, { recursive: true, force: true });
14202
14601
  completedSegments = /* @__PURE__ */ new Set();
14203
14602
  segmentManifest = emptySegmentManifest();
14204
14603
  dedupPerfs.length = 0;
@@ -14237,11 +14636,12 @@ async function executeRenderPipeline(input) {
14237
14636
  );
14238
14637
  updateCaptureObservability({ segmentRetries: segmentedRes.segmentRetries });
14239
14638
  if (job.config.keepSegments !== true) {
14240
- rmSync8(segmentDir, { recursive: true, force: true });
14639
+ rmSync10(segmentDir, { recursive: true, force: true });
14241
14640
  }
14242
14641
  } else {
14243
14642
  capturePlan = replanAfterFailure(capturePlan, { kind: "streaming_unavailable" });
14244
14643
  syncCapturePlan();
14644
+ if (videoFrameWindow) await extractDeferredVideoFrames();
14245
14645
  probeSession = null;
14246
14646
  observability.checkpoint(
14247
14647
  "capture_segmented",
@@ -14512,8 +14912,8 @@ async function executeRenderPipeline(input) {
14512
14912
  "capture_disk",
14513
14913
  "drawElement capture failed; retrying with a fresh screenshot session"
14514
14914
  );
14515
- rmSync8(framesDir, { recursive: true, force: true });
14516
- mkdirSync8(framesDir, { recursive: true });
14915
+ rmSync10(framesDir, { recursive: true, force: true });
14916
+ mkdirSync10(framesDir, { recursive: true });
14517
14917
  resetCaptureAttemptProgress(job);
14518
14918
  dedupPerfs.length = 0;
14519
14919
  cfg.useDrawElement = false;
@@ -14618,7 +15018,7 @@ async function executeRenderPipeline(input) {
14618
15018
  })
14619
15019
  );
14620
15020
  const totalElapsed = Date.now() - pipelineStart;
14621
- const tmpPeakBytes = existsSync18(workDir) ? sampleDirectoryBytes(workDir) : 0;
15021
+ const tmpPeakBytes = existsSync19(workDir) ? sampleDirectoryBytes(workDir) : 0;
14622
15022
  recordTransientRetryObservability();
14623
15023
  observability.checkpoint("pipeline", "artifact validated", { totalElapsedMs: totalElapsed });
14624
15024
  const observabilitySummary = observability.summary({
@@ -14690,7 +15090,7 @@ async function executeRenderPipeline(input) {
14690
15090
  job.perfSummary = perfSummary;
14691
15091
  if (job.config.debug) {
14692
15092
  try {
14693
- writeFileSync5(perfOutputPath, JSON.stringify(perfSummary, null, 2), "utf-8");
15093
+ writeFileSync6(perfOutputPath, JSON.stringify(perfSummary, null, 2), "utf-8");
14694
15094
  } catch (err) {
14695
15095
  log.debug("Failed to write perf summary", {
14696
15096
  perfOutputPath,
@@ -14699,8 +15099,8 @@ async function executeRenderPipeline(input) {
14699
15099
  }
14700
15100
  }
14701
15101
  if (job.config.debug) {
14702
- if (!isPngSequence && !isHls && existsSync18(stagedOutputPath)) {
14703
- const debugOutput = join26(workDir, `output${videoExt}`);
15102
+ if (!isPngSequence && !isHls && existsSync19(stagedOutputPath)) {
15103
+ const debugOutput = join29(workDir, `output${videoExt}`);
14704
15104
  copyFileSync3(stagedOutputPath, debugOutput);
14705
15105
  }
14706
15106
  }
@@ -14810,14 +15210,14 @@ async function executeRenderPipeline(input) {
14810
15210
  }
14811
15211
 
14812
15212
  // ../producer/src/services/distributed/renderSpan.ts
14813
- import { mkdirSync as mkdirSync16, mkdtempSync as mkdtempSync7, readFileSync as readFileSync12, rmSync as rmSync14 } from "fs";
14814
- import { join as join40 } from "path";
15213
+ import { mkdirSync as mkdirSync18, mkdtempSync as mkdtempSync7, readFileSync as readFileSync12, rmSync as rmSync16 } from "fs";
15214
+ import { join as join43 } from "path";
14815
15215
  import { tmpdir as tmpdir4 } from "os";
14816
15216
 
14817
15217
  // ../producer/src/services/distributed/mp4Stitch.ts
14818
- import { createReadStream as createReadStream3, createWriteStream, mkdirSync as mkdirSync9, mkdtempSync as mkdtempSync4, rmSync as rmSync9 } from "fs";
15218
+ import { createReadStream as createReadStream3, createWriteStream, mkdirSync as mkdirSync11, mkdtempSync as mkdtempSync4, rmSync as rmSync11 } from "fs";
14819
15219
  import { open } from "fs/promises";
14820
- import { dirname as dirname11, join as join27 } from "path";
15220
+ import { dirname as dirname12, join as join30 } from "path";
14821
15221
  import { finished, pipeline } from "stream/promises";
14822
15222
  function boxAt(src, off, at, limit) {
14823
15223
  let size = src.readUInt32BE(off);
@@ -15181,18 +15581,18 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
15181
15581
  const sourcePaths = audioPath ? [audioPath, ...chunkPaths] : chunkPaths;
15182
15582
  const layouts = await Promise.all(sourcePaths.map((path) => readMp4Layout(fileRange(path))));
15183
15583
  const header = audioPath ? buildStitchedHeader(layouts.slice(1), layouts[0]) : buildStitchedHeader(layouts);
15184
- mkdirSync9(dirname11(outputPath), { recursive: true });
15584
+ mkdirSync11(dirname12(outputPath), { recursive: true });
15185
15585
  const workDir = mkdtempSync4(`${outputPath}.stitch-`);
15186
- const out = createWriteStream(join27(workDir, "out.mp4"));
15586
+ const out = createWriteStream(join30(workDir, "out.mp4"));
15187
15587
  try {
15188
15588
  out.write(header);
15189
15589
  for (const [i, path] of sourcePaths.entries()) await copyPayload(path, layouts[i], i, out);
15190
15590
  out.end();
15191
15591
  await finished(out);
15192
- renameWithRetry(join27(workDir, "out.mp4"), outputPath);
15592
+ renameWithRetry(join30(workDir, "out.mp4"), outputPath);
15193
15593
  } finally {
15194
15594
  out.destroy();
15195
- rmSync9(workDir, { recursive: true, force: true });
15595
+ rmSync11(workDir, { recursive: true, force: true });
15196
15596
  }
15197
15597
  }
15198
15598
 
@@ -15200,25 +15600,25 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
15200
15600
  import {
15201
15601
  copyFileSync as copyFileSync4,
15202
15602
  cpSync as cpSync2,
15203
- existsSync as existsSync23,
15603
+ existsSync as existsSync24,
15204
15604
  linkSync,
15205
- mkdirSync as mkdirSync12,
15206
- rmSync as rmSync10,
15207
- writeFileSync as writeFileSync8
15605
+ mkdirSync as mkdirSync14,
15606
+ rmSync as rmSync12,
15607
+ writeFileSync as writeFileSync9
15208
15608
  } from "fs";
15209
- import { extname as extname6, isAbsolute as isAbsolute2, join as join35, relative as relative5, sep as sep2 } from "path";
15609
+ import { extname as extname6, isAbsolute as isAbsolute2, join as join38, relative as relative5, sep as sep2 } from "path";
15210
15610
 
15211
15611
  // ../producer/src/services/distributed/planFrameCost.ts
15212
- import { join as join30 } from "path";
15612
+ import { join as join33 } from "path";
15213
15613
 
15214
15614
  // ../producer/src/services/distributed/chunkFrames.ts
15215
- import { existsSync as existsSync20, readdirSync as readdirSync6 } from "fs";
15216
- import { extname as extname4, join as join29 } from "path";
15615
+ import { existsSync as existsSync21, readdirSync as readdirSync7 } from "fs";
15616
+ import { extname as extname4, join as join32 } from "path";
15217
15617
 
15218
15618
  // ../producer/src/services/distributed/shared.ts
15219
15619
  import { execFile as execFileCallback } from "child_process";
15220
- import { dirname as dirname12, join as join28 } from "path";
15221
- import { existsSync as existsSync19, readFileSync as readFileSync7 } from "fs";
15620
+ import { dirname as dirname13, join as join31 } from "path";
15621
+ import { existsSync as existsSync20, readFileSync as readFileSync7 } from "fs";
15222
15622
  import { fileURLToPath as fileURLToPath5 } from "url";
15223
15623
  import { promisify as promisify2 } from "util";
15224
15624
  var PLAN_VIDEOS_META_RELATIVE_PATH = "meta/videos.json";
@@ -15229,8 +15629,8 @@ function isPlanAudioArtifactPath(path) {
15229
15629
  }
15230
15630
  function resolvePlanAudioPath(planDir) {
15231
15631
  for (const name of [PLAN_AUDIO_RELATIVE_PATH, PLAN_AUDIO_LEGACY_RELATIVE_PATH]) {
15232
- const candidate = join28(planDir, name);
15233
- if (existsSync19(candidate)) return candidate;
15632
+ const candidate = join31(planDir, name);
15633
+ if (existsSync20(candidate)) return candidate;
15234
15634
  }
15235
15635
  return null;
15236
15636
  }
@@ -15487,11 +15887,11 @@ function buildSyntheticRenderJob(input) {
15487
15887
  var cachedProducerVersion = null;
15488
15888
  function readProducerVersion() {
15489
15889
  if (cachedProducerVersion !== null) return cachedProducerVersion;
15490
- const startDir = dirname12(fileURLToPath5(import.meta.url));
15890
+ const startDir = dirname13(fileURLToPath5(import.meta.url));
15491
15891
  let current = startDir;
15492
15892
  for (let i = 0; i < 10; i++) {
15493
- const candidate = join28(current, "package.json");
15494
- if (existsSync19(candidate)) {
15893
+ const candidate = join31(current, "package.json");
15894
+ if (existsSync20(candidate)) {
15495
15895
  try {
15496
15896
  const pkg = JSON.parse(readFileSync7(candidate, "utf-8"));
15497
15897
  if (pkg.name === "@hyperframes/producer" && typeof pkg.version === "string") {
@@ -15501,7 +15901,7 @@ function readProducerVersion() {
15501
15901
  } catch {
15502
15902
  }
15503
15903
  }
15504
- const parent = dirname12(current);
15904
+ const parent = dirname13(current);
15505
15905
  if (parent === current) break;
15506
15906
  current = parent;
15507
15907
  }
@@ -15544,14 +15944,14 @@ function frameNumberFromFileName(name) {
15544
15944
  function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v1") {
15545
15945
  const result = [];
15546
15946
  for (const v of videos) {
15547
- const outputDir = join29(planDir, "video-frames", v.videoId);
15548
- if (!existsSync20(outputDir)) {
15947
+ const outputDir = join32(planDir, "video-frames", v.videoId);
15948
+ if (!existsSync21(outputDir)) {
15549
15949
  throw new Error(
15550
15950
  `[renderChunk] planDir missing extracted video frames for ${JSON.stringify(v.videoId)}: ${outputDir} not present. plan() should have written frames here; the planDir is malformed.`
15551
15951
  );
15552
15952
  }
15553
15953
  const ext = (extname4(v.framePattern) || ".jpg").toLowerCase();
15554
- const frames = readdirSync6(outputDir).filter((name) => name.toLowerCase().endsWith(ext)).sort((left, right) => {
15954
+ const frames = readdirSync7(outputDir).filter((name) => name.toLowerCase().endsWith(ext)).sort((left, right) => {
15555
15955
  const leftNumber = frameNumberFromFileName(left);
15556
15956
  const rightNumber = frameNumberFromFileName(right);
15557
15957
  if (leftNumber === null || rightNumber === null) return left.localeCompare(right);
@@ -15563,7 +15963,7 @@ function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v
15563
15963
  if (!frameName) continue;
15564
15964
  const frameNumber = indexMode === "sparse-v2" ? frameNumberFromFileName(frameName) : null;
15565
15965
  const frameIndex = frameNumber === null ? i : frameNumber - 1;
15566
- framePaths.set(frameIndex, join29(outputDir, frameName));
15966
+ framePaths.set(frameIndex, join32(outputDir, frameName));
15567
15967
  }
15568
15968
  result.push({
15569
15969
  videoId: v.videoId,
@@ -15580,15 +15980,6 @@ function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v
15580
15980
  }
15581
15981
  return result;
15582
15982
  }
15583
- function contiguousRuns(sortedIndexes) {
15584
- const runs2 = [];
15585
- for (const index of sortedIndexes) {
15586
- const last = runs2[runs2.length - 1];
15587
- if (last && last.firstFrame + last.frames === index) last.frames++;
15588
- else runs2.push({ firstFrame: index, frames: 1 });
15589
- }
15590
- return runs2;
15591
- }
15592
15983
  function buildChunkCaptureOptions(input) {
15593
15984
  const { dimensions, encoder } = input;
15594
15985
  const videoCaptureBeyondViewport = resolveVideoCaptureBeyondViewport(input.videoCount);
@@ -15611,28 +16002,19 @@ function buildChunkCaptureOptions(input) {
15611
16002
  requiresWebGpu: compositionRequiresWebGpu(input.html)
15612
16003
  };
15613
16004
  }
15614
- function shownDeferredFrameIndexes(planVideos, frames, fps) {
15615
- const shown = /* @__PURE__ */ new Map();
15616
- const deferred = planVideos.extracted.filter((video) => video.deferredRange);
15617
- if (deferred.length === 0) return shown;
15618
- const table = createFrameLookupTable(
15619
- planVideos.videos,
15620
- deferred.map((video) => ({
15621
- ...video,
15622
- outputDir: "",
15623
- framePaths: new Map(Array.from({ length: video.totalFrames }, (_, i) => [i, String(i)]))
15624
- })),
15625
- resolveRenderFpsConfig(fps).value
16005
+ function planExtractedFrames(planVideos) {
16006
+ return planVideos.extracted.map((video) => ({
16007
+ ...video,
16008
+ outputDir: "",
16009
+ framePaths: /* @__PURE__ */ new Map()
16010
+ }));
16011
+ }
16012
+ function shownPlanFrameIndexes(planVideos, frames, fps) {
16013
+ return shownDeferredFrameIndexes(
16014
+ { videos: planVideos.videos, extracted: planExtractedFrames(planVideos) },
16015
+ frames,
16016
+ fps
15626
16017
  );
15627
- for (const frame of frames) {
15628
- const globalTime = frame * fps.den / fps.num;
15629
- for (const [videoId, payload] of table.getActiveFramePayloads(globalTime)) {
15630
- const indexes = shown.get(videoId) ?? /* @__PURE__ */ new Set();
15631
- indexes.add(payload.frameIndex);
15632
- shown.set(videoId, indexes);
15633
- }
15634
- }
15635
- return shown;
15636
16018
  }
15637
16019
  async function extractDeferredVideoFramesForChunk(input) {
15638
16020
  const deferred = input.planVideos.extracted.filter((video) => video.deferredRange);
@@ -15649,49 +16031,32 @@ async function extractDeferredVideoFramesForChunk(input) {
15649
16031
  url: remoteSources[path].split("?")[0]
15650
16032
  });
15651
16033
  }
15652
- if (deferred.length === 0) return [];
15653
- const shown = shownDeferredFrameIndexes(input.planVideos, input.frames, input.fps);
15654
- return Promise.all(
15655
- deferred.map(async (video) => {
15656
- const outputDir = join29(input.outputRoot, video.videoId);
15657
- const indexes = [...shown.get(video.videoId) ?? []].sort((a, b) => a - b);
15658
- if (indexes.length === 0) {
15659
- return { ...video, outputDir, framePaths: /* @__PURE__ */ new Map(), ownedByLookup: false };
15660
- }
15661
- const range = video.deferredRange;
16034
+ const planned = new Map(input.planVideos.extracted.map((video) => [video.videoId, video]));
16035
+ return extractDeferredFrames({
16036
+ videos: input.planVideos.videos,
16037
+ extracted: planExtractedFrames(input.planVideos),
16038
+ frames: input.frames,
16039
+ fps: input.fps,
16040
+ outputRoot: input.outputRoot,
16041
+ cfg: input.cfg,
16042
+ shownBoxes: input.shownBoxes,
16043
+ sourceOf: (video) => {
16044
+ const range = planned.get(video.videoId).deferredRange;
15662
16045
  const remoteUrl = remoteSources[range.sourcePath];
15663
- const sourcePath = remoteUrl ?? join29(input.planDir, ...range.sourcePath.split("/"));
15664
- if (remoteUrl === void 0 && !existsSync20(sourcePath)) {
16046
+ const sourcePath = remoteUrl ?? join32(input.planDir, ...range.sourcePath.split("/"));
16047
+ if (remoteUrl === void 0 && !existsSync21(sourcePath)) {
15665
16048
  throw new RenderChunkValidationError(
15666
16049
  MISSING_PLAN_ARTIFACT,
15667
16050
  `[renderChunk] planDir is missing the source for video ${JSON.stringify(video.videoId)}: ${range.sourcePath}`
15668
16051
  );
15669
16052
  }
15670
- const extracted = await extractVideoFramesRange(
15671
- sourcePath,
15672
- video.videoId,
15673
- range.startTime,
15674
- range.durationSeconds,
15675
- {
15676
- fps: input.fps,
15677
- outputDir: input.outputRoot,
15678
- format: range.format,
15679
- frameRanges: contiguousRuns(indexes),
15680
- shownBox: input.shownBoxes?.get(video.videoId)
15681
- },
15682
- void 0,
15683
- input.cfg
15684
- );
15685
- const missing = indexes.find((index) => !extracted.framePaths.has(index));
15686
- if (missing !== void 0) {
15687
- throw new RenderChunkValidationError(
15688
- INVALID_VIDEO_METADATA,
15689
- `[renderChunk] video ${JSON.stringify(video.videoId)} has no frame ${missing}; the plan expected ${video.totalFrames} frames from ${range.sourcePath}.`
15690
- );
15691
- }
15692
- return { ...video, outputDir, framePaths: extracted.framePaths, ownedByLookup: false };
15693
- })
15694
- );
16053
+ return sourcePath;
16054
+ },
16055
+ onMissingFrame: (video, index) => new RenderChunkValidationError(
16056
+ INVALID_VIDEO_METADATA,
16057
+ `[renderChunk] video ${JSON.stringify(video.videoId)} has no frame ${index}; the plan expected ${video.totalFrames} frames from ${planned.get(video.videoId).deferredRange.sourcePath}.`
16058
+ )
16059
+ });
15695
16060
  }
15696
16061
 
15697
16062
  // ../producer/src/services/distributed/planFrameCost.ts
@@ -15709,12 +16074,12 @@ async function measurePlanSecondsPerFrame(input) {
15709
16074
  planVideos,
15710
16075
  frames: sampled,
15711
16076
  fps: fpsRatio,
15712
- outputRoot: join30(workDir, "frame-cost-video-frames"),
16077
+ outputRoot: join33(workDir, "frame-cost-video-frames"),
15713
16078
  cfg: input.cfg
15714
16079
  })
15715
16080
  ];
15716
16081
  const lookup = extracted.length > 0 ? createFrameLookupTable(planVideos.videos, extracted, resolveRenderFpsConfig(fpsRatio).value) : null;
15717
- const compiledDir = join30(planDir, "compiled");
16082
+ const compiledDir = join33(planDir, "compiled");
15718
16083
  const fileServer = await createFileServer({
15719
16084
  projectDir: compiledDir,
15720
16085
  compiledDir,
@@ -15726,7 +16091,7 @@ async function measurePlanSecondsPerFrame(input) {
15726
16091
  try {
15727
16092
  session = await createCaptureSession(
15728
16093
  fileServer.url,
15729
- join30(workDir, "frame-cost"),
16094
+ join33(workDir, "frame-cost"),
15730
16095
  buildChunkCaptureOptions({
15731
16096
  dimensions: { ...input, fpsNum: fps, fpsDen: 1 },
15732
16097
  encoder: input,
@@ -15822,21 +16187,21 @@ function buildWeightedChunkSlices(weights, chunkCount, minFrames, maxFrames) {
15822
16187
  }
15823
16188
 
15824
16189
  // ../producer/src/services/render/planReferenceBackground.ts
15825
- import { join as join31 } from "path";
16190
+ import { join as join34 } from "path";
15826
16191
  async function readPlanReferenceBackground(input) {
15827
16192
  let server;
15828
16193
  let session;
15829
16194
  try {
15830
16195
  server = await createFileServer({
15831
16196
  projectDir: input.projectDir,
15832
- compiledDir: join31(input.workDir, "compiled"),
16197
+ compiledDir: join34(input.workDir, "compiled"),
15833
16198
  port: 0,
15834
16199
  preHeadScripts: [VIRTUAL_TIME_SHIM],
15835
16200
  fps: input.options.fps
15836
16201
  });
15837
16202
  session = await createCaptureSession(
15838
16203
  server.url,
15839
- join31(input.workDir, "reference"),
16204
+ join34(input.workDir, "reference"),
15840
16205
  {
15841
16206
  ...input.options,
15842
16207
  requiresWebGpu: false
@@ -15872,8 +16237,8 @@ async function readPlanReferenceBackground(input) {
15872
16237
  }
15873
16238
 
15874
16239
  // ../producer/src/services/render/stages/freezePlan.ts
15875
- import { existsSync as existsSync21, mkdirSync as mkdirSync10, readFileSync as readFileSync8, readdirSync as readdirSync7, writeFileSync as writeFileSync6 } from "fs";
15876
- import { join as join32, relative as relative3, resolve as resolve7 } from "path";
16240
+ import { existsSync as existsSync22, mkdirSync as mkdirSync12, readFileSync as readFileSync8, readdirSync as readdirSync8, writeFileSync as writeFileSync7 } from "fs";
16241
+ import { join as join35, relative as relative3, resolve as resolve7 } from "path";
15877
16242
 
15878
16243
  // ../producer/src/services/distributed/planProtocol.ts
15879
16244
  var PLAN_SCHEMA_VERSION = 1;
@@ -16062,7 +16427,7 @@ function planFileSha256(absolutePath, digests) {
16062
16427
  return sha256;
16063
16428
  }
16064
16429
  async function prehashPlanFiles(dir, digests) {
16065
- if (!existsSync21(dir)) return;
16430
+ if (!existsSync22(dir)) return;
16066
16431
  for (const { absolutePath } of listPlanFiles(dir)) {
16067
16432
  if (!digests.has(absolutePath)) digests.set(absolutePath, await sha256FileAsync(absolutePath));
16068
16433
  }
@@ -16085,9 +16450,9 @@ function listPlanFiles(planDir) {
16085
16450
  const results = [];
16086
16451
  const rootResolved = resolve7(planDir);
16087
16452
  function walk(dir) {
16088
- const entries = readdirSync7(dir, { withFileTypes: true });
16453
+ const entries = readdirSync8(dir, { withFileTypes: true });
16089
16454
  for (const entry of entries) {
16090
- const full = join32(dir, entry.name);
16455
+ const full = join35(dir, entry.name);
16091
16456
  if (entry.isDirectory()) {
16092
16457
  walk(full);
16093
16458
  } else if (entry.isFile()) {
@@ -16128,19 +16493,19 @@ var PLAN_REMOTE_FILES_RELATIVE_PATH = "meta/remote-files.json";
16128
16493
  function writePlanRemoteFiles(planDir, files) {
16129
16494
  if (files.length === 0) return;
16130
16495
  const sorted = [...files].sort((a, b) => a.path < b.path ? -1 : 1);
16131
- writeFileSync6(join32(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH), JSON.stringify(sorted), "utf-8");
16496
+ writeFileSync7(join35(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH), JSON.stringify(sorted), "utf-8");
16132
16497
  }
16133
16498
  function readPlanRemoteFiles(planDir) {
16134
- const path = join32(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH);
16135
- return existsSync21(path) ? JSON.parse(readFileSync8(path, "utf-8")) : [];
16499
+ const path = join35(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH);
16500
+ return existsSync22(path) ? JSON.parse(readFileSync8(path, "utf-8")) : [];
16136
16501
  }
16137
16502
  function recomputePlanHashFromPlanDir(planDir, digests) {
16138
- const planJsonPath = join32(planDir, "plan.json");
16139
- const encoderJsonPath = join32(planDir, "meta", "encoder.json");
16140
- if (!existsSync21(planJsonPath)) {
16503
+ const planJsonPath = join35(planDir, "plan.json");
16504
+ const encoderJsonPath = join35(planDir, "meta", "encoder.json");
16505
+ if (!existsSync22(planJsonPath)) {
16141
16506
  throw new Error(`[freezePlan] plan.json missing: ${planJsonPath}`);
16142
16507
  }
16143
- if (!existsSync21(encoderJsonPath)) {
16508
+ if (!existsSync22(encoderJsonPath)) {
16144
16509
  throw new Error(`[freezePlan] meta/encoder.json missing: ${encoderJsonPath}`);
16145
16510
  }
16146
16511
  const planJson = JSON.parse(readFileSync8(planJsonPath, "utf-8"));
@@ -16170,21 +16535,21 @@ async function freezePlan(input) {
16170
16535
  hasAudio,
16171
16536
  digests
16172
16537
  } = input;
16173
- if (!existsSync21(planDir)) {
16538
+ if (!existsSync22(planDir)) {
16174
16539
  throw new Error(`[freezePlan] planDir does not exist: ${planDir}`);
16175
16540
  }
16176
- const metaDir = join32(planDir, "meta");
16177
- if (!existsSync21(metaDir)) mkdirSync10(metaDir, { recursive: true });
16178
- writeFileSync6(
16179
- join32(metaDir, "composition.json"),
16541
+ const metaDir = join35(planDir, "meta");
16542
+ if (!existsSync22(metaDir)) mkdirSync12(metaDir, { recursive: true });
16543
+ writeFileSync7(
16544
+ join35(metaDir, "composition.json"),
16180
16545
  `${JSON.stringify(composition, null, 2)}
16181
16546
  `,
16182
16547
  "utf-8"
16183
16548
  );
16184
16549
  const encoderForCanonical = stripUndefined(encoder);
16185
16550
  const encoderConfigCanonicalJson = canonicalJsonStringify(encoderForCanonical);
16186
- writeFileSync6(join32(metaDir, "encoder.json"), encoderConfigCanonicalJson, "utf-8");
16187
- writeFileSync6(join32(metaDir, "chunks.json"), `${JSON.stringify(chunks, null, 2)}
16551
+ writeFileSync7(join35(metaDir, "encoder.json"), encoderConfigCanonicalJson, "utf-8");
16552
+ writeFileSync7(join35(metaDir, "chunks.json"), `${JSON.stringify(chunks, null, 2)}
16188
16553
  `, "utf-8");
16189
16554
  const { compositionHtml, assets } = collectPlanAssetShas(planDir, digests);
16190
16555
  const planHash = computePlanHash({
@@ -16209,8 +16574,8 @@ async function freezePlan(input) {
16209
16574
  duration: durationSeconds,
16210
16575
  hasAudio
16211
16576
  };
16212
- const planJsonPath = join32(planDir, "plan.json");
16213
- writeFileSync6(planJsonPath, `${JSON.stringify(planJson, null, 2)}
16577
+ const planJsonPath = join35(planDir, "plan.json");
16578
+ writeFileSync7(planJsonPath, `${JSON.stringify(planJson, null, 2)}
16214
16579
  `, "utf-8");
16215
16580
  return { planJsonPath, planHash };
16216
16581
  }
@@ -16251,9 +16616,9 @@ function applyRuntimeEnvSnapshot(snapshot, env = process.env) {
16251
16616
  }
16252
16617
 
16253
16618
  // ../producer/src/services/distributed/chunkAudio.ts
16254
- import { closeSync as closeSync5, existsSync as existsSync22, ftruncateSync, mkdirSync as mkdirSync11, openSync as openSync5, readFileSync as readFileSync9 } from "fs";
16255
- import { writeFileSync as writeFileSync7, writeSync } from "fs";
16256
- import { join as join33 } from "path";
16619
+ import { closeSync as closeSync5, existsSync as existsSync23, ftruncateSync, mkdirSync as mkdirSync13, openSync as openSync5, readFileSync as readFileSync9 } from "fs";
16620
+ import { writeFileSync as writeFileSync8, writeSync } from "fs";
16621
+ import { join as join36 } from "path";
16257
16622
  function audioCutForChunk(grid, chunks, index, fps) {
16258
16623
  const firstPacketAt = (frame) => Math.min(
16259
16624
  grid.packetCount,
@@ -16340,7 +16705,7 @@ async function writeChunkAudioSlices(input) {
16340
16705
  });
16341
16706
  const bytes = readFileSync9(input.audioPath);
16342
16707
  const layout = { sizeBytes: bytes.length, payloadStart, payloadEnd, partStarts: {} };
16343
- mkdirSync11(join33(input.planDir, SLICE_DIR), { recursive: true });
16708
+ mkdirSync13(join36(input.planDir, SLICE_DIR), { recursive: true });
16344
16709
  input.chunks.forEach((_, index) => {
16345
16710
  const cut = audioCutForChunk(grid, input.chunks, index, input.fps);
16346
16711
  if (!cut) return;
@@ -16348,17 +16713,17 @@ async function writeChunkAudioSlices(input) {
16348
16713
  const start = offsets[cut.firstPacket];
16349
16714
  layout.partStarts[index] = start;
16350
16715
  const end = offsets[last] + track.sizes[last];
16351
- writeFileSync7(join33(input.planDir, chunkAudioSlicePath(index)), bytes.subarray(start, end));
16716
+ writeFileSync8(join36(input.planDir, chunkAudioSlicePath(index)), bytes.subarray(start, end));
16352
16717
  });
16353
16718
  const frame = [bytes.subarray(0, payloadStart), bytes.subarray(payloadEnd)];
16354
- writeFileSync7(join33(input.planDir, SLICE_FRAME), Buffer.concat(frame));
16355
- writeFileSync7(join33(input.planDir, SLICE_LAYOUT), JSON.stringify(layout));
16719
+ writeFileSync8(join36(input.planDir, SLICE_FRAME), Buffer.concat(frame));
16720
+ writeFileSync8(join36(input.planDir, SLICE_LAYOUT), JSON.stringify(layout));
16356
16721
  }
16357
16722
  function chunkAudioSource(planDir, chunkIndex, scratchPath) {
16358
- const layoutPath = join33(planDir, SLICE_LAYOUT);
16359
- if (!existsSync22(layoutPath)) return resolvePlanAudioPath(planDir);
16723
+ const layoutPath = join36(planDir, SLICE_LAYOUT);
16724
+ if (!existsSync23(layoutPath)) return resolvePlanAudioPath(planDir);
16360
16725
  const layout = JSON.parse(readFileSync9(layoutPath, "utf-8"));
16361
- const frame = readFileSync9(join33(planDir, SLICE_FRAME));
16726
+ const frame = readFileSync9(join36(planDir, SLICE_FRAME));
16362
16727
  const fd = openSync5(scratchPath, "w");
16363
16728
  try {
16364
16729
  writeSync(fd, frame, 0, layout.payloadStart, 0);
@@ -16371,7 +16736,7 @@ function chunkAudioSource(planDir, chunkIndex, scratchPath) {
16371
16736
  );
16372
16737
  const start = layout.partStarts[chunkIndex];
16373
16738
  if (start !== void 0) {
16374
- const part = readFileSync9(join33(planDir, chunkAudioSlicePath(chunkIndex)));
16739
+ const part = readFileSync9(join36(planDir, chunkAudioSlicePath(chunkIndex)));
16375
16740
  writeSync(fd, part, 0, part.length, start);
16376
16741
  }
16377
16742
  ftruncateSync(fd, layout.sizeBytes);
@@ -16426,8 +16791,8 @@ async function muxChunkWithAudio(input) {
16426
16791
 
16427
16792
  // ../producer/src/services/distributed/planSize.ts
16428
16793
  import { createHash as createHash7 } from "crypto";
16429
- import { lstatSync as lstatSync2, readdirSync as readdirSync8 } from "fs";
16430
- import { extname as extname5, join as join34, relative as relative4 } from "path";
16794
+ import { lstatSync as lstatSync2, readdirSync as readdirSync9 } from "fs";
16795
+ import { extname as extname5, join as join37, relative as relative4 } from "path";
16431
16796
  var MAX_TOP_COMPONENTS = 10;
16432
16797
  var SOURCE_MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
16433
16798
  ".aac",
@@ -16534,12 +16899,12 @@ function recordFile(result, components, rootDir, rootKind, filePath) {
16534
16899
  function walkRegularFiles(dir, visit) {
16535
16900
  let entries;
16536
16901
  try {
16537
- entries = readdirSync8(dir, { withFileTypes: true });
16902
+ entries = readdirSync9(dir, { withFileTypes: true });
16538
16903
  } catch {
16539
16904
  return;
16540
16905
  }
16541
16906
  for (const entry of entries) {
16542
- const full = join34(dir, entry.name);
16907
+ const full = join37(dir, entry.name);
16543
16908
  if (entry.isDirectory()) {
16544
16909
  walkRegularFiles(full, visit);
16545
16910
  } else if (entry.isFile()) {
@@ -16751,13 +17116,13 @@ function assertPositiveInteger2(name, value) {
16751
17116
  }
16752
17117
  var FREEZE_OWNED_PLAN_FILES = [
16753
17118
  "plan.json",
16754
- join35("meta", "composition.json"),
16755
- join35("meta", "encoder.json"),
16756
- join35("meta", "chunks.json")
17119
+ join38("meta", "composition.json"),
17120
+ join38("meta", "encoder.json"),
17121
+ join38("meta", "chunks.json")
16757
17122
  ];
16758
17123
  function removeFreezeOwnedPlanFiles(planDir) {
16759
17124
  for (const relativePath of FREEZE_OWNED_PLAN_FILES) {
16760
- rmSync10(join35(planDir, relativePath), { force: true });
17125
+ rmSync12(join38(planDir, relativePath), { force: true });
16761
17126
  }
16762
17127
  }
16763
17128
  function buildChunkSlices(totalFrames, chunkCount, effectiveChunkSize) {
@@ -16912,19 +17277,19 @@ function createVideoSourceShipper(input) {
16912
17277
  const known = shipped.get(srcPath);
16913
17278
  if (known) return known;
16914
17279
  const stagedRel = pathInside(input.workVideoFramesDir, srcPath);
16915
- const current = stagedRel === null ? srcPath : join35(input.planDir, "video-frames", stagedRel);
17280
+ const current = stagedRel === null ? srcPath : join38(input.planDir, "video-frames", stagedRel);
16916
17281
  let result = null;
16917
17282
  for (const root of stagedRel === null ? [input.workCompiledDir, input.projectDir] : []) {
16918
17283
  const rel = pathInside(root, srcPath);
16919
- if (rel !== null && (existsSync23(join35(input.planDir, "compiled", rel)) || input.isRemote(srcPath))) {
17284
+ if (rel !== null && (existsSync24(join38(input.planDir, "compiled", rel)) || input.isRemote(srcPath))) {
16920
17285
  result = ["compiled", ...rel.split(sep2)].join("/");
16921
17286
  break;
16922
17287
  }
16923
17288
  }
16924
17289
  if (result === null) {
16925
17290
  result = `video-sources/${shipped.size}${extname6(current)}`;
16926
- const destination = join35(input.planDir, ...result.split("/"));
16927
- mkdirSync12(join35(input.planDir, "video-sources"), { recursive: true });
17291
+ const destination = join38(input.planDir, ...result.split("/"));
17292
+ mkdirSync14(join38(input.planDir, "video-sources"), { recursive: true });
16928
17293
  try {
16929
17294
  linkSync(current, destination);
16930
17295
  } catch {
@@ -16944,7 +17309,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
16944
17309
  useGpu: false,
16945
17310
  browserGpuMode: "software"
16946
17311
  });
16947
- if (!existsSync23(planDir)) mkdirSync12(planDir, { recursive: true });
17312
+ if (!existsSync24(planDir)) mkdirSync14(planDir, { recursive: true });
16948
17313
  const log = config.logger ?? defaultLogger;
16949
17314
  const sizeLimitBytes = options.executionPlanSizeLimitBytes ?? config.planDirSizeLimitBytes ?? PLAN_DIR_SIZE_LIMIT_BYTES;
16950
17315
  const abortSignal = config.abortSignal;
@@ -16973,15 +17338,15 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
16973
17338
  variables: config.variables
16974
17339
  });
16975
17340
  const entryFile = config.entryFile ?? "index.html";
16976
- const htmlPath = join35(projectDir, entryFile);
16977
- if (!existsSync23(htmlPath)) {
17341
+ const htmlPath = join38(projectDir, entryFile);
17342
+ if (!existsSync24(htmlPath)) {
16978
17343
  throw new Error(`[plan] entry file not found: ${htmlPath}`);
16979
17344
  }
16980
- const workDir = join35(planDir, ".plan-work");
16981
- rmSync10(workDir, { recursive: true, force: true });
16982
- mkdirSync12(workDir, { recursive: true });
16983
- const compiledDir = join35(workDir, "compiled");
16984
- mkdirSync12(compiledDir, { recursive: true });
17345
+ const workDir = join38(planDir, ".plan-work");
17346
+ rmSync12(workDir, { recursive: true, force: true });
17347
+ mkdirSync14(workDir, { recursive: true });
17348
+ const compiledDir = join38(workDir, "compiled");
17349
+ mkdirSync14(compiledDir, { recursive: true });
16985
17350
  let stageStarted = Date.now();
16986
17351
  cpSync2(projectDir, compiledDir, {
16987
17352
  recursive: true,
@@ -16994,10 +17359,10 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
16994
17359
  }
16995
17360
  });
16996
17361
  logPlanStage(log, "copy", stageStarted);
16997
- const finalCompiledDir = join35(planDir, "compiled");
17362
+ const finalCompiledDir = join38(planDir, "compiled");
16998
17363
  const needsAlpha = outputNeedsAlpha(config.format);
16999
17364
  const remoteFiles = Object.entries(options.remoteFiles ?? {});
17000
- const remoteLocalPath = (rel) => join35(projectDir, ...rel.split("/"));
17365
+ const remoteLocalPath = (rel) => join38(projectDir, ...rel.split("/"));
17001
17366
  for (const [, file] of remoteFiles) {
17002
17367
  declareContentAddressedUrl(file.url, file.sha256);
17003
17368
  if (file.probeFactsUrl) declareProbeFactsUrl(file.url, file.probeFactsUrl);
@@ -17018,7 +17383,6 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
17018
17383
  urlByAbsentLocalPath,
17019
17384
  projectDir,
17020
17385
  workDir,
17021
- htmlPath,
17022
17386
  entryFile,
17023
17387
  job,
17024
17388
  cfg,
@@ -17094,7 +17458,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
17094
17458
  if (probeResult.fileServer) closeFileServerSafely(probeResult.fileServer, "plan", log);
17095
17459
  if (probeResult.probeSession) {
17096
17460
  try {
17097
- const { closeCaptureSession: closeCaptureSession2 } = await import("./src-VZIS3GRG.js");
17461
+ const { closeCaptureSession: closeCaptureSession2 } = await import("./src-R2QH27BL.js");
17098
17462
  await closeCaptureSession2(probeResult.probeSession);
17099
17463
  } catch (err) {
17100
17464
  log.warn("[plan] probe session close failed", {
@@ -17201,17 +17565,17 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
17201
17565
  let stageStarted = Date.now();
17202
17566
  const extractResult = await extractPlanVideos(c, options.deferVideoExtraction);
17203
17567
  logPlanStage(log, "extract", stageStarted);
17204
- const stagedVideoFrames = join35(compiledDir, "__hyperframes_video_frames");
17205
- const videoFramesDst = join35(planDir, "video-frames");
17206
- if (existsSync23(videoFramesDst)) rmSync10(videoFramesDst, { recursive: true, force: true });
17207
- const videoSourcesDir = join35(planDir, "video-sources");
17208
- rmSync10(videoSourcesDir, { recursive: true, force: true });
17209
- if (existsSync23(stagedVideoFrames)) {
17568
+ const stagedVideoFrames = join38(compiledDir, "__hyperframes_video_frames");
17569
+ const videoFramesDst = join38(planDir, "video-frames");
17570
+ if (existsSync24(videoFramesDst)) rmSync12(videoFramesDst, { recursive: true, force: true });
17571
+ const videoSourcesDir = join38(planDir, "video-sources");
17572
+ rmSync12(videoSourcesDir, { recursive: true, force: true });
17573
+ if (existsSync24(stagedVideoFrames)) {
17210
17574
  renameWithRetry(stagedVideoFrames, videoFramesDst);
17211
17575
  } else {
17212
- mkdirSync12(videoFramesDst, { recursive: true });
17576
+ mkdirSync14(videoFramesDst, { recursive: true });
17213
17577
  }
17214
- if (existsSync23(finalCompiledDir)) rmSync10(finalCompiledDir, { recursive: true, force: true });
17578
+ if (existsSync24(finalCompiledDir)) rmSync12(finalCompiledDir, { recursive: true, force: true });
17215
17579
  renameWithRetry(compiledDir, finalCompiledDir);
17216
17580
  const shipVideoSource = createVideoSourceShipper({
17217
17581
  planDir,
@@ -17241,7 +17605,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
17241
17605
  };
17242
17606
  })
17243
17607
  });
17244
- mkdirSync12(join35(planDir, "meta"), { recursive: true });
17608
+ mkdirSync14(join38(planDir, "meta"), { recursive: true });
17245
17609
  writePlanRemoteFiles(
17246
17610
  planDir,
17247
17611
  remoteFiles.map(([rel, { sha256, sizeBytes }]) => ({
@@ -17250,8 +17614,8 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
17250
17614
  sizeBytes
17251
17615
  }))
17252
17616
  );
17253
- writeFileSync8(
17254
- join35(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
17617
+ writeFileSync9(
17618
+ join38(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
17255
17619
  JSON.stringify(planVideosJson, null, 2),
17256
17620
  "utf-8"
17257
17621
  );
@@ -17330,11 +17694,11 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
17330
17694
  if (audioResult?.audioError) {
17331
17695
  applyDistributedAudioWarningPolicy(job, audioResult.audioError, audioResult.audioFailures, log);
17332
17696
  }
17333
- const planAudioPath = join35(planDir, PLAN_AUDIO_RELATIVE_PATH);
17334
- if (audioResult?.hasAudio && existsSync23(audioResult.audioOutputPath)) {
17697
+ const planAudioPath = join38(planDir, PLAN_AUDIO_RELATIVE_PATH);
17698
+ if (audioResult?.hasAudio && existsSync24(audioResult.audioOutputPath)) {
17335
17699
  renameWithRetry(audioResult.audioOutputPath, planAudioPath);
17336
17700
  }
17337
- if (chunksCarryAudio && existsSync23(planAudioPath)) {
17701
+ if (chunksCarryAudio && existsSync24(planAudioPath)) {
17338
17702
  if (options.sliceChunkAudio) {
17339
17703
  stageStarted = Date.now();
17340
17704
  await writeChunkAudioSlices({
@@ -17380,7 +17744,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
17380
17744
  format: config.format
17381
17745
  };
17382
17746
  try {
17383
- rmSync10(workDir, { recursive: true, force: true });
17747
+ rmSync12(workDir, { recursive: true, force: true });
17384
17748
  } catch (err) {
17385
17749
  log.warn("[plan] failed to remove temp work dir", {
17386
17750
  workDir,
@@ -17452,38 +17816,38 @@ async function plan(projectDir, config, planDir, options = {}) {
17452
17816
 
17453
17817
  // ../producer/src/services/distributed/renderChunk.ts
17454
17818
  import { randomBytes } from "crypto";
17455
- import { existsSync as existsSync26, mkdirSync as mkdirSync15, readFileSync as readFileSync11, readdirSync as readdirSync10, rmSync as rmSync13, writeFileSync as writeFileSync11 } from "fs";
17819
+ import { existsSync as existsSync27, mkdirSync as mkdirSync17, readFileSync as readFileSync11, readdirSync as readdirSync11, rmSync as rmSync15, writeFileSync as writeFileSync12 } from "fs";
17456
17820
  import { cpus as cpus3 } from "os";
17457
- import { join as join39 } from "path";
17821
+ import { join as join42 } from "path";
17458
17822
 
17459
17823
  // ../producer/src/services/distributed/planV2.ts
17460
17824
  import {
17461
17825
  copyFileSync as copyFileSync6,
17462
- existsSync as existsSync25,
17826
+ existsSync as existsSync26,
17463
17827
  lstatSync as lstatSync3,
17464
- mkdirSync as mkdirSync14,
17828
+ mkdirSync as mkdirSync16,
17465
17829
  mkdtempSync as mkdtempSync6,
17466
17830
  readFileSync as readFileSync10,
17467
- readdirSync as readdirSync9,
17468
- rmSync as rmSync12,
17469
- statSync as statSync8,
17470
- writeFileSync as writeFileSync10
17831
+ readdirSync as readdirSync10,
17832
+ rmSync as rmSync14,
17833
+ statSync as statSync9,
17834
+ writeFileSync as writeFileSync11
17471
17835
  } from "fs";
17472
17836
  import { tmpdir as tmpdir3 } from "os";
17473
- import { dirname as dirname14, isAbsolute as isAbsolute3, join as join38, relative as relative6, resolve as resolve8, sep as sep3 } from "path";
17837
+ import { dirname as dirname15, isAbsolute as isAbsolute3, join as join41, relative as relative6, resolve as resolve8, sep as sep3 } from "path";
17474
17838
 
17475
17839
  // ../producer/src/services/distributed/planV2Publisher.ts
17476
17840
  import {
17477
17841
  copyFileSync as copyFileSync5,
17478
- existsSync as existsSync24,
17842
+ existsSync as existsSync25,
17479
17843
  linkSync as linkSync2,
17480
- mkdirSync as mkdirSync13,
17844
+ mkdirSync as mkdirSync15,
17481
17845
  mkdtempSync as mkdtempSync5,
17482
- rmSync as rmSync11,
17483
- statSync as statSync7,
17484
- writeFileSync as writeFileSync9
17846
+ rmSync as rmSync13,
17847
+ statSync as statSync8,
17848
+ writeFileSync as writeFileSync10
17485
17849
  } from "fs";
17486
- import { dirname as dirname13, join as join37 } from "path";
17850
+ import { dirname as dirname14, join as join40 } from "path";
17487
17851
 
17488
17852
  // ../producer/src/services/distributed/planV2Errors.ts
17489
17853
  var PLAN_V2_INTEGRITY_UNRECOVERABLE = "PLAN_V2_INTEGRITY_UNRECOVERABLE";
@@ -17498,7 +17862,7 @@ var PlanV2IntegrityError = class extends Error {
17498
17862
  };
17499
17863
 
17500
17864
  // ../producer/src/services/distributed/planV2Layout.ts
17501
- import { join as join36 } from "path";
17865
+ import { join as join39 } from "path";
17502
17866
  var SHA256_PATTERN = /^[0-9a-f]{64}$/;
17503
17867
  function assertPlanV2Sha256(value, field) {
17504
17868
  if (typeof value !== "string" || !SHA256_PATTERN.test(value)) {
@@ -17508,7 +17872,7 @@ function assertPlanV2Sha256(value, field) {
17508
17872
  }
17509
17873
  function planV2BlobPath(root, sha256) {
17510
17874
  const digest = assertPlanV2Sha256(sha256, "artifact sha256");
17511
- return join36(root, "artifacts", "sha256", digest.slice(0, 2), digest);
17875
+ return join39(root, "artifacts", "sha256", digest.slice(0, 2), digest);
17512
17876
  }
17513
17877
 
17514
17878
  // ../producer/src/services/distributed/planV2Publisher.ts
@@ -17543,27 +17907,27 @@ var LocalPlanV2ArtifactPublisher = class {
17543
17907
  #linkFile;
17544
17908
  #committed = false;
17545
17909
  constructor(destinationDir, options = {}) {
17546
- if (existsSync24(destinationDir)) {
17910
+ if (existsSync25(destinationDir)) {
17547
17911
  throw new PlanV2IntegrityError(`output directory already exists: ${destinationDir}`);
17548
17912
  }
17549
17913
  this.destinationDir = destinationDir;
17550
17914
  this.#linkFile = options.linkFile ?? linkSync2;
17551
- mkdirSync13(dirname13(destinationDir), { recursive: true });
17552
- this.temporaryDir = mkdtempSync5(join37(dirname13(destinationDir), ".plan-v2-publish-"));
17915
+ mkdirSync15(dirname14(destinationDir), { recursive: true });
17916
+ this.temporaryDir = mkdtempSync5(join40(dirname14(destinationDir), ".plan-v2-publish-"));
17553
17917
  }
17554
17918
  async putBlob(blob) {
17555
17919
  const digest = assertPlanV2Sha256(blob.sha256, "published blob sha256");
17556
- const sourceSize = statSync7(blob.sourcePath).size;
17920
+ const sourceSize = statSync8(blob.sourcePath).size;
17557
17921
  if (sourceSize !== blob.sizeBytes) {
17558
17922
  throw new PlanV2IntegrityError(
17559
17923
  `published blob size changed for ${digest}: expected ${blob.sizeBytes}, got ${sourceSize}`
17560
17924
  );
17561
17925
  }
17562
17926
  const destinationPath = planV2BlobPath(this.temporaryDir, digest);
17563
- if (existsSync24(destinationPath)) return;
17564
- mkdirSync13(dirname13(destinationPath), { recursive: true });
17565
- const stagingDir = mkdtempSync5(join37(dirname13(destinationPath), ".plan-v2-blob-"));
17566
- const temporaryPath = join37(stagingDir, "blob");
17927
+ if (existsSync25(destinationPath)) return;
17928
+ mkdirSync15(dirname14(destinationPath), { recursive: true });
17929
+ const stagingDir = mkdtempSync5(join40(dirname14(destinationPath), ".plan-v2-blob-"));
17930
+ const temporaryPath = join40(stagingDir, "blob");
17567
17931
  try {
17568
17932
  try {
17569
17933
  this.#linkFile(blob.sourcePath, temporaryPath);
@@ -17573,24 +17937,24 @@ var LocalPlanV2ArtifactPublisher = class {
17573
17937
  }
17574
17938
  renameWithRetry(temporaryPath, destinationPath);
17575
17939
  } finally {
17576
- rmSync11(stagingDir, { recursive: true, force: true });
17940
+ rmSync13(stagingDir, { recursive: true, force: true });
17577
17941
  }
17578
17942
  }
17579
17943
  async commitManifest(manifestBytes) {
17580
17944
  for (const digest of new Set(manifestDigests(manifestBytes))) {
17581
- if (!existsSync24(planV2BlobPath(this.temporaryDir, digest))) {
17945
+ if (!existsSync25(planV2BlobPath(this.temporaryDir, digest))) {
17582
17946
  throw new PlanV2IntegrityError(
17583
17947
  `cannot commit manifest before referenced blob is durable: ${digest}`
17584
17948
  );
17585
17949
  }
17586
17950
  }
17587
- writeFileSync9(join37(this.temporaryDir, "plan.json"), manifestBytes, "utf-8");
17951
+ writeFileSync10(join40(this.temporaryDir, "plan.json"), manifestBytes, "utf-8");
17588
17952
  renameWithRetry(this.temporaryDir, this.destinationDir);
17589
17953
  this.#committed = true;
17590
17954
  }
17591
17955
  async abort() {
17592
17956
  if (!this.#committed) {
17593
- rmSync11(this.temporaryDir, { recursive: true, force: true });
17957
+ rmSync13(this.temporaryDir, { recursive: true, force: true });
17594
17958
  }
17595
17959
  }
17596
17960
  };
@@ -17628,8 +17992,8 @@ function listFiles(root) {
17628
17992
  const files = [];
17629
17993
  const rootResolved = resolve8(root);
17630
17994
  function walk(dir) {
17631
- for (const entry of readdirSync9(dir, { withFileTypes: true })) {
17632
- const absolutePath = join38(dir, entry.name);
17995
+ for (const entry of readdirSync10(dir, { withFileTypes: true })) {
17996
+ const absolutePath = join41(dir, entry.name);
17633
17997
  if (entry.isDirectory()) {
17634
17998
  walk(absolutePath);
17635
17999
  } else if (entry.isFile()) {
@@ -17656,13 +18020,13 @@ function assertValidExtractionCacheCompleteSentinel(path) {
17656
18020
  }
17657
18021
  }
17658
18022
  function validateExtractionCacheCompleteSentinels(executionPlanDir) {
17659
- const videoRoot = join38(executionPlanDir, "video-frames");
17660
- if (!existsSync25(videoRoot)) return;
17661
- for (const videoEntry of readdirSync9(videoRoot, { withFileTypes: true })) {
18023
+ const videoRoot = join41(executionPlanDir, "video-frames");
18024
+ if (!existsSync26(videoRoot)) return;
18025
+ for (const videoEntry of readdirSync10(videoRoot, { withFileTypes: true })) {
17662
18026
  if (!videoEntry.isDirectory()) continue;
17663
- const videoDir = join38(videoRoot, videoEntry.name);
17664
- if (readdirSync9(videoDir).includes(EXTRACTION_CACHE_COMPLETE_SENTINEL)) {
17665
- const sentinelPath = join38(videoDir, EXTRACTION_CACHE_COMPLETE_SENTINEL);
18027
+ const videoDir = join41(videoRoot, videoEntry.name);
18028
+ if (readdirSync10(videoDir).includes(EXTRACTION_CACHE_COMPLETE_SENTINEL)) {
18029
+ const sentinelPath = join41(videoDir, EXTRACTION_CACHE_COMPLETE_SENTINEL);
17666
18030
  assertValidExtractionCacheCompleteSentinel(sentinelPath);
17667
18031
  }
17668
18032
  }
@@ -17709,15 +18073,15 @@ function listVideoFramePaths(executionPlanDir, videos) {
17709
18073
  if (video.deferredRange) {
17710
18074
  const framePaths2 = /* @__PURE__ */ new Map();
17711
18075
  for (let index = 0; index < video.totalFrames; index++) {
17712
- framePaths2.set(index, join38(outputDir, String(index)));
18076
+ framePaths2.set(index, join41(outputDir, String(index)));
17713
18077
  }
17714
18078
  return { ...video, outputDir, framePaths: framePaths2, ownedByLookup: false };
17715
18079
  }
17716
- const frameNames = readdirSync9(outputDir).sort();
18080
+ const frameNames = readdirSync10(outputDir).sort();
17717
18081
  const framePaths = /* @__PURE__ */ new Map();
17718
18082
  for (const frameName of frameNames) {
17719
18083
  if (frameName === EXTRACTION_CACHE_COMPLETE_SENTINEL) {
17720
- assertValidExtractionCacheCompleteSentinel(join38(outputDir, frameName));
18084
+ assertValidExtractionCacheCompleteSentinel(join41(outputDir, frameName));
17721
18085
  continue;
17722
18086
  }
17723
18087
  const match = /(\d+)(?=\.[^.]+$)/.exec(frameName);
@@ -17736,7 +18100,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
17736
18100
  `duplicate extracted frame index ${frameIndex} in ${outputDir}`
17737
18101
  );
17738
18102
  }
17739
- framePaths.set(frameIndex, join38(outputDir, frameName));
18103
+ framePaths.set(frameIndex, join41(outputDir, frameName));
17740
18104
  }
17741
18105
  return {
17742
18106
  ...video,
@@ -17757,11 +18121,11 @@ function parsePlanVideosJson2(value) {
17757
18121
  }
17758
18122
  }
17759
18123
  function materializeExtractedVideoDirectories(planDir) {
17760
- const videosPath = join38(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
17761
- if (!existsSync25(videosPath)) return;
18124
+ const videosPath = join41(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
18125
+ if (!existsSync26(videosPath)) return;
17762
18126
  const videos = parsePlanVideosJson2(readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH));
17763
18127
  for (const video of videos.extracted) {
17764
- mkdirSync14(resolveExtractedVideoOutputDir(planDir, video.videoId), { recursive: true });
18128
+ mkdirSync16(resolveExtractedVideoOutputDir(planDir, video.videoId), { recursive: true });
17765
18129
  }
17766
18130
  }
17767
18131
  function parseChunkSlices(value) {
@@ -17791,13 +18155,13 @@ function parseChunkSlices(value) {
17791
18155
  });
17792
18156
  }
17793
18157
  function buildVideoChunkDependencies(executionPlanDir, dimensions) {
17794
- const videoRoot = join38(executionPlanDir, "video-frames");
17795
- const hasExtractedFrames = existsSync25(videoRoot) && listFiles(videoRoot).length > 0;
17796
- const videosPath = join38(executionPlanDir, PLAN_VIDEOS_META_RELATIVE_PATH);
17797
- if (!existsSync25(videosPath)) {
18158
+ const videoRoot = join41(executionPlanDir, "video-frames");
18159
+ const hasExtractedFrames = existsSync26(videoRoot) && listFiles(videoRoot).length > 0;
18160
+ const videosPath = join41(executionPlanDir, PLAN_VIDEOS_META_RELATIVE_PATH);
18161
+ if (!existsSync26(videosPath)) {
17798
18162
  return hasExtractedFrames ? { mode: "full-source-pack", dependencies: null } : { mode: "exact-rendered-frames", dependencies: /* @__PURE__ */ new Map() };
17799
18163
  }
17800
- const chunksPath = join38(executionPlanDir, "meta", "chunks.json");
18164
+ const chunksPath = join41(executionPlanDir, "meta", "chunks.json");
17801
18165
  const videos = readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH);
17802
18166
  const chunks = readJsonFile(chunksPath, "meta/chunks.json");
17803
18167
  const parsedVideos = parsePlanVideosJson2(videos);
@@ -17851,22 +18215,22 @@ function computeManifestHash(manifest) {
17851
18215
  return sha256Hex(`${PLAN_V2_HASH_PREFIX}${canonicalJsonStringify(manifestPayload(manifest))}`);
17852
18216
  }
17853
18217
  function writeBlob(sourcePath, destinationPath) {
17854
- if (existsSync25(destinationPath)) return;
17855
- mkdirSync14(dirname14(destinationPath), { recursive: true });
17856
- const temporaryDir = mkdtempSync6(join38(dirname14(destinationPath), ".plan-v2-blob-"));
17857
- const temporaryPath = join38(temporaryDir, "blob");
18218
+ if (existsSync26(destinationPath)) return;
18219
+ mkdirSync16(dirname15(destinationPath), { recursive: true });
18220
+ const temporaryDir = mkdtempSync6(join41(dirname15(destinationPath), ".plan-v2-blob-"));
18221
+ const temporaryPath = join41(temporaryDir, "blob");
17858
18222
  try {
17859
18223
  copyFileSync6(sourcePath, temporaryPath);
17860
18224
  renameWithRetry(temporaryPath, destinationPath);
17861
18225
  } finally {
17862
- rmSync12(temporaryDir, { recursive: true, force: true });
18226
+ rmSync14(temporaryDir, { recursive: true, force: true });
17863
18227
  }
17864
18228
  }
17865
18229
  function publishBlobFor(absolutePath, digests) {
17866
18230
  return {
17867
18231
  sourcePath: absolutePath,
17868
18232
  sha256: planFileSha256(absolutePath, digests),
17869
- sizeBytes: statSync8(absolutePath).size
18233
+ sizeBytes: statSync9(absolutePath).size
17870
18234
  };
17871
18235
  }
17872
18236
  async function putBlobs(publisher, blobs) {
@@ -17890,8 +18254,8 @@ async function putTasks(tasks) {
17890
18254
  if (failure) throw failure.reason;
17891
18255
  }
17892
18256
  function buildPlanV2Publication(executionPlanDir, digests) {
17893
- const executionPlanPath = join38(executionPlanDir, "plan.json");
17894
- if (!existsSync25(executionPlanPath)) {
18257
+ const executionPlanPath = join41(executionPlanDir, "plan.json");
18258
+ if (!existsSync26(executionPlanPath)) {
17895
18259
  throw new PlanV2IntegrityError(`execution plan is missing plan.json: ${executionPlanPath}`);
17896
18260
  }
17897
18261
  const executionPlanValue = readJsonFile(executionPlanPath, "execution plan.json");
@@ -17918,7 +18282,7 @@ function buildPlanV2Publication(executionPlanDir, digests) {
17918
18282
  }
17919
18283
  validateExtractionCacheCompleteSentinels(executionPlanDir);
17920
18284
  const videoDependencyPlan = buildVideoChunkDependencies(executionPlanDir, dimensions);
17921
- const encoder = readJsonFile(join38(executionPlanDir, "meta", "encoder.json"), "meta/encoder.json");
18285
+ const encoder = readJsonFile(join41(executionPlanDir, "meta", "encoder.json"), "meta/encoder.json");
17922
18286
  const files = listFiles(executionPlanDir);
17923
18287
  const chunkAudio = !isRecord3(encoder) || encoder.chunksCarryAudio !== true ? "none" : files.some((file) => chunkAudioSliceTarget(file.path) !== null) ? "sliced" : "whole";
17924
18288
  for (const file of files) {
@@ -17971,28 +18335,28 @@ function buildPlanV2Publication(executionPlanDir, digests) {
17971
18335
  };
17972
18336
  }
17973
18337
  function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
17974
- if (existsSync25(planV2Dir)) {
18338
+ if (existsSync26(planV2Dir)) {
17975
18339
  throw new PlanV2IntegrityError(`output directory already exists: ${planV2Dir}`);
17976
18340
  }
17977
18341
  const publication = buildPlanV2Publication(executionPlanDir);
17978
18342
  if (publication.storedBlobs.length > 0) {
17979
18343
  throw new PlanV2IntegrityError("a local plan v2 directory cannot reference remote files");
17980
18344
  }
17981
- mkdirSync14(dirname14(planV2Dir), { recursive: true });
17982
- const tempDir = mkdtempSync6(join38(dirname14(planV2Dir), ".plan-v2-build-"));
18345
+ mkdirSync16(dirname15(planV2Dir), { recursive: true });
18346
+ const tempDir = mkdtempSync6(join41(dirname15(planV2Dir), ".plan-v2-build-"));
17983
18347
  try {
17984
18348
  for (const blob of publication.blobs) {
17985
18349
  writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
17986
18350
  }
17987
- writeFileSync10(
17988
- join38(tempDir, "plan.json"),
18351
+ writeFileSync11(
18352
+ join41(tempDir, "plan.json"),
17989
18353
  canonicalJsonStringify(publication.manifest),
17990
18354
  "utf-8"
17991
18355
  );
17992
18356
  renameWithRetry(tempDir, planV2Dir);
17993
18357
  return resultFromManifest(planV2Dir, publication.manifest);
17994
18358
  } catch (error) {
17995
- rmSync12(tempDir, { recursive: true, force: true });
18359
+ rmSync14(tempDir, { recursive: true, force: true });
17996
18360
  throw error;
17997
18361
  }
17998
18362
  }
@@ -18026,7 +18390,7 @@ async function publishExecutionPlan(executionPlanDir, publisher, { digests, log
18026
18390
  }
18027
18391
  }
18028
18392
  async function planV2WithPublisher(projectDir, config, publisher, options = {}) {
18029
- const stagingRoot = mkdtempSync6(join38(options.stagingParentDir ?? tmpdir3(), ".execution-plan-"));
18393
+ const stagingRoot = mkdtempSync6(join41(options.stagingParentDir ?? tmpdir3(), ".execution-plan-"));
18030
18394
  const digests = /* @__PURE__ */ new Map();
18031
18395
  try {
18032
18396
  await buildLocalExecutionPlan(projectDir, config, stagingRoot, {
@@ -18037,7 +18401,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
18037
18401
  // artifactTargets ships every compiled/ file to all chunks, so each is in the manifest.
18038
18402
  whileAudioMixes: () => putBlobs(
18039
18403
  publisher,
18040
- listFiles(join38(stagingRoot, "compiled")).map(
18404
+ listFiles(join41(stagingRoot, "compiled")).map(
18041
18405
  (file) => publishBlobFor(file.absolutePath, digests)
18042
18406
  )
18043
18407
  ),
@@ -18053,16 +18417,16 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
18053
18417
  }
18054
18418
  throw error;
18055
18419
  } finally {
18056
- rmSync12(stagingRoot, { recursive: true, force: true });
18420
+ rmSync14(stagingRoot, { recursive: true, force: true });
18057
18421
  }
18058
18422
  }
18059
18423
  async function planV2(projectDir, config, planV2Dir) {
18060
- if (existsSync25(planV2Dir)) {
18424
+ if (existsSync26(planV2Dir)) {
18061
18425
  throw new PlanV2IntegrityError(`output directory already exists: ${planV2Dir}`);
18062
18426
  }
18063
18427
  const publisher = new LocalPlanV2ArtifactPublisher(planV2Dir);
18064
18428
  const manifest = await planV2WithPublisher(projectDir, config, publisher, {
18065
- stagingParentDir: dirname14(planV2Dir)
18429
+ stagingParentDir: dirname15(planV2Dir)
18066
18430
  });
18067
18431
  return resultFromManifest(planV2Dir, manifest);
18068
18432
  }
@@ -18074,7 +18438,7 @@ function resultFromManifest(planV2Dir, manifest) {
18074
18438
  isRecord3(executionPlan) ? executionPlan[REFERENCE_BACKGROUND_FIELD] : void 0
18075
18439
  ),
18076
18440
  planDir: planV2Dir,
18077
- manifestPath: join38(planV2Dir, "plan.json"),
18441
+ manifestPath: join41(planV2Dir, "plan.json"),
18078
18442
  planProtocol: PLAN_PROTOCOL_V2,
18079
18443
  planHash: manifest.planHash,
18080
18444
  sourcePlanV1Hash: getPlanV2ExecutionPlanHash(manifest),
@@ -18210,8 +18574,8 @@ function parsePlanV2Manifest(value) {
18210
18574
  return parsed;
18211
18575
  }
18212
18576
  function readPlanV2Manifest(planV2Dir) {
18213
- const manifestPath = join38(planV2Dir, "plan.json");
18214
- if (!existsSync25(manifestPath)) {
18577
+ const manifestPath = join41(planV2Dir, "plan.json");
18578
+ if (!existsSync26(manifestPath)) {
18215
18579
  throw new PlanV2IntegrityError(`missing v2 manifest: ${manifestPath}`);
18216
18580
  }
18217
18581
  const value = readJsonFile(manifestPath, "v2 manifest");
@@ -18230,10 +18594,10 @@ function listPlanV2ArtifactsForTarget(manifest, target) {
18230
18594
  }
18231
18595
  function verifyBlob(planV2Dir, artifact) {
18232
18596
  const sourcePath = planV2BlobPath(planV2Dir, artifact.sha256);
18233
- if (!existsSync25(sourcePath)) {
18597
+ if (!existsSync26(sourcePath)) {
18234
18598
  throw new PlanV2IntegrityError(`missing content-addressed artifact ${artifact.sha256}`);
18235
18599
  }
18236
- const stats = statSync8(sourcePath);
18600
+ const stats = statSync9(sourcePath);
18237
18601
  if (!stats.isFile() || stats.size !== artifact.sizeBytes) {
18238
18602
  throw new PlanV2IntegrityError(`artifact size mismatch for ${artifact.path}`);
18239
18603
  }
@@ -18243,7 +18607,7 @@ function verifyBlob(planV2Dir, artifact) {
18243
18607
  return sourcePath;
18244
18608
  }
18245
18609
  function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}) {
18246
- if (existsSync25(destinationDir)) {
18610
+ if (existsSync26(destinationDir)) {
18247
18611
  throw new PlanV2IntegrityError(`materialization destination already exists: ${destinationDir}`);
18248
18612
  }
18249
18613
  const manifest = readPlanV2Manifest(planV2Dir);
@@ -18255,17 +18619,17 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
18255
18619
  artifact,
18256
18620
  sourcePath: verifyBlob(planV2Dir, artifact)
18257
18621
  }));
18258
- mkdirSync14(dirname14(destinationDir), { recursive: true });
18259
- const tempDir = mkdtempSync6(join38(dirname14(destinationDir), ".plan-v2-materialize-"));
18622
+ mkdirSync16(dirname15(destinationDir), { recursive: true });
18623
+ const tempDir = mkdtempSync6(join41(dirname15(destinationDir), ".plan-v2-materialize-"));
18260
18624
  try {
18261
18625
  for (const { artifact, sourcePath } of verified) {
18262
- const destinationPath = join38(tempDir, ...artifact.path.split("/"));
18263
- mkdirSync14(dirname14(destinationPath), { recursive: true });
18626
+ const destinationPath = join41(tempDir, ...artifact.path.split("/"));
18627
+ mkdirSync16(dirname15(destinationPath), { recursive: true });
18264
18628
  copyFileSync6(sourcePath, destinationPath);
18265
18629
  }
18266
18630
  if (target.role === "chunk") materializeExtractedVideoDirectories(tempDir);
18267
- writeFileSync10(
18268
- join38(tempDir, PLAN_V2_MATERIALIZATION_MARKER),
18631
+ writeFileSync11(
18632
+ join41(tempDir, PLAN_V2_MATERIALIZATION_MARKER),
18269
18633
  canonicalJsonStringify({
18270
18634
  manifest,
18271
18635
  target,
@@ -18275,7 +18639,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
18275
18639
  );
18276
18640
  renameWithRetry(tempDir, destinationDir);
18277
18641
  } catch (error) {
18278
- rmSync12(tempDir, { recursive: true, force: true });
18642
+ rmSync14(tempDir, { recursive: true, force: true });
18279
18643
  throw error;
18280
18644
  }
18281
18645
  return {
@@ -18288,7 +18652,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
18288
18652
  // Join the artifact's OWN name, not the current constant: a plan written
18289
18653
  // before the container change carries the legacy name, and materializing it
18290
18654
  // under the new one would point at a file that was never written.
18291
- audioPath: target.role === "assembler" ? audioArtifact ? join38(destinationDir, audioArtifact.path) : null : null
18655
+ audioPath: target.role === "assembler" ? audioArtifact ? join41(destinationDir, audioArtifact.path) : null : null
18292
18656
  };
18293
18657
  }
18294
18658
  function assertRemoteSources(remoteSources, artifacts) {
@@ -18307,8 +18671,8 @@ function validatePlanV2MaterializedTarget(planDir, expectedTarget) {
18307
18671
  return readValidatedPlanV2Materialization(planDir, expectedTarget)?.manifest ?? null;
18308
18672
  }
18309
18673
  function readValidatedPlanV2Materialization(planDir, expectedTarget) {
18310
- const markerPath = join38(planDir, PLAN_V2_MATERIALIZATION_MARKER);
18311
- if (!existsSync25(markerPath)) return null;
18674
+ const markerPath = join41(planDir, PLAN_V2_MATERIALIZATION_MARKER);
18675
+ if (!existsSync26(markerPath)) return null;
18312
18676
  const marker = readJsonFile(markerPath, "materialization marker");
18313
18677
  if (!isRecord3(marker) || !isRecord3(marker.manifest) || !isRecord3(marker.target)) {
18314
18678
  throw new PlanV2IntegrityError("malformed materialization marker");
@@ -18325,8 +18689,8 @@ function readValidatedPlanV2Materialization(planDir, expectedTarget) {
18325
18689
  assertRemoteSources(remoteSources, required);
18326
18690
  for (const artifact of required) {
18327
18691
  if (Object.hasOwn(remoteSources, artifact.path)) continue;
18328
- const path = join38(planDir, ...artifact.path.split("/"));
18329
- if (!existsSync25(path) || statSync8(path).size !== artifact.sizeBytes) {
18692
+ const path = join41(planDir, ...artifact.path.split("/"));
18693
+ if (!existsSync26(path) || statSync9(path).size !== artifact.sizeBytes) {
18330
18694
  throw new PlanV2IntegrityError(
18331
18695
  `materialized artifact missing or truncated: ${artifact.path}`
18332
18696
  );
@@ -18443,9 +18807,9 @@ async function beginFrameSessionNeedsScreenshotFallback(session, probe = probeBe
18443
18807
  }
18444
18808
  function hashChunkOutput(outputPath, kind) {
18445
18809
  if (kind === "file") return sha256Hex(readFileSync11(outputPath));
18446
- const entries = readdirSync10(outputPath).filter((name) => /\.(png|jpg|jpeg)$/i.test(name)).sort();
18810
+ const entries = readdirSync11(outputPath).filter((name) => /\.(png|jpg|jpeg)$/i.test(name)).sort();
18447
18811
  const lines = entries.map(
18448
- (name) => `${name}\0${sha256Hex(readFileSync11(join39(outputPath, name)))}`
18812
+ (name) => `${name}\0${sha256Hex(readFileSync11(join42(outputPath, name)))}`
18449
18813
  );
18450
18814
  return sha256Hex(lines.join("\0"));
18451
18815
  }
@@ -18462,10 +18826,10 @@ function resolveLockedVp9CpuUsed(lockedEncoder) {
18462
18826
  async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18463
18827
  const start = Date.now();
18464
18828
  const log = defaultLogger;
18465
- const planJsonPath = join39(planDir, "plan.json");
18466
- const encoderJsonPath = join39(planDir, "meta", "encoder.json");
18467
- const chunksJsonPath = join39(planDir, "meta", "chunks.json");
18468
- if (!existsSync26(planJsonPath)) {
18829
+ const planJsonPath = join42(planDir, "plan.json");
18830
+ const encoderJsonPath = join42(planDir, "meta", "encoder.json");
18831
+ const chunksJsonPath = join42(planDir, "meta", "chunks.json");
18832
+ if (!existsSync27(planJsonPath)) {
18469
18833
  throw new RenderChunkValidationError(
18470
18834
  MISSING_PLAN_ARTIFACT,
18471
18835
  `[renderChunk] planDir is missing required artifact: ${planJsonPath}`
@@ -18481,7 +18845,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18481
18845
  const v2Manifest = v2Materialization?.manifest ?? null;
18482
18846
  const remoteSources = v2Materialization?.remoteSources ?? {};
18483
18847
  for (const required of [encoderJsonPath, chunksJsonPath]) {
18484
- if (!existsSync26(required)) {
18848
+ if (!existsSync27(required)) {
18485
18849
  throw new RenderChunkValidationError(
18486
18850
  MISSING_PLAN_ARTIFACT,
18487
18851
  `[renderChunk] planDir is missing required artifact: ${required}`
@@ -18490,9 +18854,9 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18490
18854
  }
18491
18855
  const encoder = JSON.parse(readFileSync11(encoderJsonPath, "utf-8"));
18492
18856
  const chunks = JSON.parse(readFileSync11(chunksJsonPath, "utf-8"));
18493
- const videosJsonPath = join39(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
18857
+ const videosJsonPath = join42(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
18494
18858
  let planVideos = null;
18495
- if (existsSync26(videosJsonPath)) {
18859
+ if (existsSync27(videosJsonPath)) {
18496
18860
  try {
18497
18861
  planVideos = validatePlanVideosForChunk(JSON.parse(readFileSync11(videosJsonPath, "utf-8")));
18498
18862
  } catch (err) {
@@ -18522,8 +18886,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18522
18886
  }
18523
18887
  const range = resolveChunkFrameRange(slice, chunkIndex, options?.frameRange);
18524
18888
  const framesInChunk = range.endFrame - range.startFrame;
18525
- const compiledDir = join39(planDir, "compiled");
18526
- if (!existsSync26(compiledDir)) {
18889
+ const compiledDir = join42(planDir, "compiled");
18890
+ if (!existsSync27(compiledDir)) {
18527
18891
  throw new RenderChunkValidationError(
18528
18892
  MISSING_PLAN_ARTIFACT,
18529
18893
  `[renderChunk] planDir missing compiled/ directory: ${compiledDir}`
@@ -18579,14 +18943,14 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18579
18943
  forceScreenshotExplicitlyOptedOut: !encoder.forceScreenshot
18580
18944
  };
18581
18945
  const workDir = `${outputChunkPath}.work.${process.pid}.${randomBytes(4).toString("hex")}`;
18582
- mkdirSync15(workDir, { recursive: true });
18583
- const framesDir = join39(workDir, "captured-frames");
18584
- mkdirSync15(framesDir, { recursive: true });
18946
+ mkdirSync17(workDir, { recursive: true });
18947
+ const framesDir = join42(workDir, "captured-frames");
18948
+ mkdirSync17(framesDir, { recursive: true });
18585
18949
  const videoFramesDir = `${workDir}.video-frames`;
18586
18950
  const chunkFrameNumbers = Array.from({ length: framesInChunk }, (_, i) => range.startFrame + i);
18587
18951
  const chunkFps = { num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen };
18588
18952
  const deferredVideos = planVideos?.extracted.filter((video) => video.deferredRange) ?? [];
18589
- const shownFrames = planVideos ? shownDeferredFrameIndexes(planVideos, chunkFrameNumbers, chunkFps) : /* @__PURE__ */ new Map();
18953
+ const shownFrames = planVideos ? shownPlanFrameIndexes(planVideos, chunkFrameNumbers, chunkFps) : /* @__PURE__ */ new Map();
18590
18954
  const remoteVideoIds = new Set(
18591
18955
  planVideos?.extracted.filter(
18592
18956
  (video) => video.deferredRange && Object.hasOwn(remoteSources, video.deferredRange.sourcePath)
@@ -18605,7 +18969,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18605
18969
  dimensions: plan2.dimensions,
18606
18970
  encoder,
18607
18971
  videoCount: planVideos?.videos.length ?? 0,
18608
- html: readFileSync11(join39(compiledDir, "index.html"), "utf-8"),
18972
+ html: readFileSync11(join42(compiledDir, "index.html"), "utf-8"),
18609
18973
  // The plan ships a deferred source only to chunks that show it; don't wait on the rest.
18610
18974
  skipReadinessVideoIds: deferredVideos.filter(
18611
18975
  (video) => !shownFrames.get(video.videoId)?.size || remoteVideoIds.has(video.videoId)
@@ -18773,10 +19137,10 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18773
19137
  const effectiveBitrate = encoder.crf != null ? void 0 : encoder.bitrate;
18774
19138
  const videoOnlyPath = encoder.chunksCarryAudio ? `${outputChunkPath}.video.mp4` : outputChunkPath;
18775
19139
  if (isPngSequence) {
18776
- if (!existsSync26(outputChunkPath)) mkdirSync15(outputChunkPath, { recursive: true });
19140
+ if (!existsSync27(outputChunkPath)) mkdirSync17(outputChunkPath, { recursive: true });
18777
19141
  } else {
18778
- const outDir = join39(outputChunkPath, "..");
18779
- if (!existsSync26(outDir)) mkdirSync15(outDir, { recursive: true });
19142
+ const outDir = join42(outputChunkPath, "..");
19143
+ if (!existsSync27(outDir)) mkdirSync17(outDir, { recursive: true });
18780
19144
  }
18781
19145
  const encodeInput = {
18782
19146
  job,
@@ -18892,9 +19256,9 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18892
19256
  return observedChunkCaptureMode(capturePerfs);
18893
19257
  },
18894
19258
  resetForScreenshotRetry: () => {
18895
- rmSync13(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
19259
+ rmSync15(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
18896
19260
  boxesMeasured();
18897
- mkdirSync15(framesDir, { recursive: true });
19261
+ mkdirSync17(framesDir, { recursive: true });
18898
19262
  capturePerfs.length = 0;
18899
19263
  captureAttempts.length = 0;
18900
19264
  job.framesRendered = 0;
@@ -18938,8 +19302,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18938
19302
  fps: { num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen },
18939
19303
  timeoutMs: cfg.ffmpegProcessTimeout
18940
19304
  });
18941
- rmSync13(videoOnlyPath, { force: true });
18942
- rmSync13(audioScratchPath, { force: true });
19305
+ rmSync15(videoOnlyPath, { force: true });
19306
+ rmSync15(audioScratchPath, { force: true });
18943
19307
  }
18944
19308
  encodeStageMs = Date.now() - encodeStarted;
18945
19309
  } finally {
@@ -18986,11 +19350,11 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18986
19350
  producerVersion: plan2.producerVersion,
18987
19351
  ffmpegVersion
18988
19352
  };
18989
- writeFileSync11(perfPath, `${JSON.stringify(perfPayload, null, 2)}
19353
+ writeFileSync12(perfPath, `${JSON.stringify(perfPayload, null, 2)}
18990
19354
  `, "utf-8");
18991
19355
  try {
18992
- rmSync13(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
18993
- rmSync13(videoFramesDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
19356
+ rmSync15(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
19357
+ rmSync15(videoFramesDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
18994
19358
  } catch (err) {
18995
19359
  log.warn("[renderChunk] failed to remove work dir", {
18996
19360
  workDir,
@@ -19049,11 +19413,11 @@ async function renderSpan(projectDir, config, span, outputPath) {
19049
19413
  if (config.cfr === true) {
19050
19414
  throw new RenderSpanUnsupportedError("--start/--end cannot be combined with a cfr re-encode.");
19051
19415
  }
19052
- const workDir = mkdtempSync7(join40(tmpdir4(), "hf-render-span-"));
19416
+ const workDir = mkdtempSync7(join43(tmpdir4(), "hf-render-span-"));
19053
19417
  try {
19054
- const planDir = join40(workDir, "plan");
19055
- const partsDir = join40(workDir, "parts");
19056
- mkdirSync16(partsDir, { recursive: true });
19418
+ const planDir = join43(workDir, "plan");
19419
+ const partsDir = join43(workDir, "parts");
19420
+ mkdirSync18(partsDir, { recursive: true });
19057
19421
  const planned = await plan(
19058
19422
  projectDir,
19059
19423
  { ...config, rejectOnSystemFonts: false, failClosedFontFetch: false },
@@ -19067,7 +19431,7 @@ async function renderSpan(projectDir, config, span, outputPath) {
19067
19431
  planned.totalFrames
19068
19432
  );
19069
19433
  const slices = JSON.parse(
19070
- readFileSync12(join40(planDir, "meta", "chunks.json"), "utf-8")
19434
+ readFileSync12(join43(planDir, "meta", "chunks.json"), "utf-8")
19071
19435
  );
19072
19436
  const parts = [];
19073
19437
  for (const slice of slices) {
@@ -19077,7 +19441,7 @@ async function renderSpan(projectDir, config, span, outputPath) {
19077
19441
  };
19078
19442
  if (range.endFrame <= range.startFrame) continue;
19079
19443
  throwIfAborted(config.abortSignal);
19080
- const part = join40(partsDir, `part-${String(parts.length).padStart(4, "0")}.mp4`);
19444
+ const part = join43(partsDir, `part-${String(parts.length).padStart(4, "0")}.mp4`);
19081
19445
  await renderChunk(planDir, slice.index, part, { frameRange: range });
19082
19446
  parts.push(part);
19083
19447
  }
@@ -19090,7 +19454,7 @@ async function renderSpan(projectDir, config, span, outputPath) {
19090
19454
  framesEncoded: endFrame - startFrame
19091
19455
  };
19092
19456
  } finally {
19093
- rmSync14(workDir, { recursive: true, force: true });
19457
+ rmSync16(workDir, { recursive: true, force: true });
19094
19458
  }
19095
19459
  }
19096
19460
 
@@ -19636,15 +20000,15 @@ function renderRequestFromDistributedConfig(input) {
19636
20000
 
19637
20001
  // ../producer/src/server.ts
19638
20002
  import {
19639
- existsSync as existsSync29,
19640
- mkdirSync as mkdirSync17,
19641
- statSync as statSync10,
20003
+ existsSync as existsSync30,
20004
+ mkdirSync as mkdirSync19,
20005
+ statSync as statSync11,
19642
20006
  mkdtempSync as mkdtempSync8,
19643
- writeFileSync as writeFileSync12,
19644
- rmSync as rmSync15,
20007
+ writeFileSync as writeFileSync13,
20008
+ rmSync as rmSync17,
19645
20009
  createReadStream as createReadStream5
19646
20010
  } from "fs";
19647
- import { resolve as resolve10, dirname as dirname16, join as join43 } from "path";
20011
+ import { resolve as resolve10, dirname as dirname17, join as join46 } from "path";
19648
20012
  import { tmpdir as tmpdir5 } from "os";
19649
20013
  import { parseArgs } from "util";
19650
20014
  import crypto from "crypto";
@@ -19654,15 +20018,15 @@ import { serve as serve2 } from "@hono/node-server";
19654
20018
 
19655
20019
  // ../producer/src/services/hyperframeLint.ts
19656
20020
  import {
19657
- existsSync as existsSync27,
20021
+ existsSync as existsSync28,
19658
20022
  readFileSync as readFileSync13,
19659
- statSync as statSync9,
20023
+ statSync as statSync10,
19660
20024
  openSync as openSync6,
19661
20025
  fstatSync as fstatSync3,
19662
20026
  closeSync as closeSync6,
19663
20027
  constants as constants3
19664
20028
  } from "fs";
19665
- import { resolve as resolve9, join as join41, relative as relative7, isAbsolute as isAbsolute4, sep as sep4 } from "path";
20029
+ import { resolve as resolve9, join as join44, relative as relative7, isAbsolute as isAbsolute4, sep as sep4 } from "path";
19666
20030
  function isStringRecord(value) {
19667
20031
  if (!value || typeof value !== "object" || Array.isArray(value)) {
19668
20032
  return false;
@@ -19695,7 +20059,7 @@ function readEntryHtml(filePath) {
19695
20059
  } catch (error) {
19696
20060
  if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
19697
20061
  return null;
19698
- if (!statSync9(filePath, { throwIfNoEntry: false })?.isFile()) return null;
20062
+ if (!statSync10(filePath, { throwIfNoEntry: false })?.isFile()) return null;
19699
20063
  throw error;
19700
20064
  }
19701
20065
  try {
@@ -19707,7 +20071,7 @@ function readEntryHtml(filePath) {
19707
20071
  }
19708
20072
  function readProjectEntryFile(projectDir, preferredEntryFile) {
19709
20073
  const absProjectDir = resolve9(projectDir);
19710
- if (!existsSync27(absProjectDir) || !statSync9(absProjectDir).isDirectory()) {
20074
+ if (!existsSync28(absProjectDir) || !statSync10(absProjectDir).isDirectory()) {
19711
20075
  return { error: `Project directory not found: ${absProjectDir}` };
19712
20076
  }
19713
20077
  const entryCandidates = [preferredEntryFile, "index.html", "src/index.html"].filter(
@@ -19729,7 +20093,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile) {
19729
20093
  }
19730
20094
  }
19731
20095
  return {
19732
- error: `No HTML entry file found in project directory: ${join41(absProjectDir, preferredEntryFile || "index.html")}`
20096
+ error: `No HTML entry file found in project directory: ${join44(absProjectDir, preferredEntryFile || "index.html")}`
19733
20097
  };
19734
20098
  }
19735
20099
  function prepareHyperframeLintBody(body) {
@@ -19775,8 +20139,8 @@ async function runHyperframeLint(prepared) {
19775
20139
  // ../producer/src/services/healthWorker.ts
19776
20140
  import { Worker as Worker2 } from "worker_threads";
19777
20141
  import { fileURLToPath as fileURLToPath6 } from "url";
19778
- import { dirname as dirname15, join as join42 } from "path";
19779
- import { existsSync as existsSync28 } from "fs";
20142
+ import { dirname as dirname16, join as join45 } from "path";
20143
+ import { existsSync as existsSync29 } from "fs";
19780
20144
  var DEFAULT_HEALTH_PORT = 9848;
19781
20145
  async function startHealthWorker(options = {}) {
19782
20146
  const log = options.logger ?? defaultLogger2();
@@ -19850,10 +20214,10 @@ function defaultLogger2() {
19850
20214
  };
19851
20215
  }
19852
20216
  function resolveWorkerEntry2() {
19853
- const here = dirname15(fileURLToPath6(import.meta.url));
19854
- const candidates = [join42(here, "healthWorkerThread.js"), join42(here, "healthWorkerThread.ts")];
20217
+ const here = dirname16(fileURLToPath6(import.meta.url));
20218
+ const candidates = [join45(here, "healthWorkerThread.js"), join45(here, "healthWorkerThread.ts")];
19855
20219
  for (const candidate of candidates) {
19856
- if (existsSync28(candidate)) return candidate;
20220
+ if (existsSync29(candidate)) return candidate;
19857
20221
  }
19858
20222
  return void 0;
19859
20223
  }
@@ -19992,8 +20356,8 @@ function buildRenderJobConfig(input, outputPath, log) {
19992
20356
  function resolvePreparedRenderOutput(prepared, rendersDir, log) {
19993
20357
  const { input, cleanupProjectDir } = prepared;
19994
20358
  const absoluteOutputPath = resolveOutputPath(input.projectDir, input.outputPath, rendersDir, log);
19995
- const outputDir = dirname16(absoluteOutputPath);
19996
- if (!existsSync29(outputDir)) mkdirSync17(outputDir, { recursive: true });
20359
+ const outputDir = dirname17(absoluteOutputPath);
20360
+ if (!existsSync30(outputDir)) mkdirSync19(outputDir, { recursive: true });
19997
20361
  return { input, cleanupProjectDir, absoluteOutputPath };
19998
20362
  }
19999
20363
  function validateRenderOverrides(body) {
@@ -20034,11 +20398,11 @@ function prepareProjectDirectory(projectDir, options) {
20034
20398
  const candidate = nonEmptyString(projectDir);
20035
20399
  if (!candidate) return null;
20036
20400
  const absProjectDir = resolve10(candidate);
20037
- if (!existsSync29(absProjectDir) || !statSync10(absProjectDir).isDirectory()) {
20401
+ if (!existsSync30(absProjectDir) || !statSync11(absProjectDir).isDirectory()) {
20038
20402
  return { error: `Project directory not found: ${absProjectDir}` };
20039
20403
  }
20040
20404
  const entry = options.entryFile || "index.html";
20041
- if (!existsSync29(resolve10(absProjectDir, entry))) {
20405
+ if (!existsSync30(resolve10(absProjectDir, entry))) {
20042
20406
  return { error: `Entry file "${entry}" not found in project directory: ${absProjectDir}` };
20043
20407
  }
20044
20408
  return { prepared: { input: { projectDir: absProjectDir, ...options } } };
@@ -20059,8 +20423,8 @@ async function resolveInlineRenderHtml(body) {
20059
20423
  }
20060
20424
  function materializeInlineProject(html, options) {
20061
20425
  const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR || tmpdir5();
20062
- const tempProjectDir = mkdtempSync8(join43(tempRoot, "producer-project-"));
20063
- writeFileSync12(join43(tempProjectDir, "index.html"), html, "utf-8");
20426
+ const tempProjectDir = mkdtempSync8(join46(tempRoot, "producer-project-"));
20427
+ writeFileSync13(join46(tempProjectDir, "index.html"), html, "utf-8");
20064
20428
  return {
20065
20429
  prepared: {
20066
20430
  input: { projectDir: tempProjectDir, ...options },
@@ -20121,7 +20485,7 @@ function createArtifactStore(ttlMs) {
20121
20485
  function cleanupTempDir(dir, log) {
20122
20486
  if (!dir) return;
20123
20487
  try {
20124
- rmSync15(dir, { recursive: true, force: true });
20488
+ rmSync17(dir, { recursive: true, force: true });
20125
20489
  } catch (error) {
20126
20490
  log.warn("Failed to cleanup temp project dir", {
20127
20491
  cleanupProjectDir: dir,
@@ -20130,7 +20494,7 @@ function cleanupTempDir(dir, log) {
20130
20494
  }
20131
20495
  }
20132
20496
  function outputFileSize(path) {
20133
- return existsSync29(path) ? statSync10(path).size : 0;
20497
+ return existsSync30(path) ? statSync11(path).size : 0;
20134
20498
  }
20135
20499
  function createBlockingProgressReporter(log, requestId) {
20136
20500
  let lastLoggedPct = -10;
@@ -20434,11 +20798,11 @@ function createRenderHandlers(options = {}) {
20434
20798
  if (!artifact) {
20435
20799
  return c.json({ success: false, error: "Output artifact not found or expired" }, 404);
20436
20800
  }
20437
- if (!existsSync29(artifact.path)) {
20801
+ if (!existsSync30(artifact.path)) {
20438
20802
  store.delete(token);
20439
20803
  return c.json({ success: false, error: "Output artifact file missing" }, 404);
20440
20804
  }
20441
- const stats = statSync10(artifact.path);
20805
+ const stats = statSync11(artifact.path);
20442
20806
  return new Response(createReadStream5(artifact.path), {
20443
20807
  headers: {
20444
20808
  "content-type": "video/mp4",
@@ -20481,7 +20845,7 @@ function startServer(options = {}) {
20481
20845
  });
20482
20846
  async function shutdown(signal) {
20483
20847
  log.info(`Received ${signal}, shutting down`);
20484
- const { drainBrowserPool } = await import("./src-VZIS3GRG.js");
20848
+ const { drainBrowserPool } = await import("./src-R2QH27BL.js");
20485
20849
  await drainBrowserPool().catch(() => {
20486
20850
  });
20487
20851
  const handle = await Promise.race([
@@ -20517,23 +20881,23 @@ if (isPublicServerEntry) {
20517
20881
  }
20518
20882
 
20519
20883
  // ../producer/src/services/distributed/planV2Execution.ts
20520
- import { mkdtempSync as mkdtempSync10, rmSync as rmSync17 } from "fs";
20884
+ import { mkdtempSync as mkdtempSync10, rmSync as rmSync19 } from "fs";
20521
20885
  import { tmpdir as tmpdir6 } from "os";
20522
- import { join as join45 } from "path";
20886
+ import { join as join48 } from "path";
20523
20887
 
20524
20888
  // ../producer/src/services/distributed/assemble.ts
20525
20889
  import {
20526
20890
  cpSync as cpSync3,
20527
- existsSync as existsSync30,
20528
- mkdirSync as mkdirSync18,
20891
+ existsSync as existsSync31,
20892
+ mkdirSync as mkdirSync20,
20529
20893
  mkdtempSync as mkdtempSync9,
20530
20894
  readFileSync as readFileSync14,
20531
- readdirSync as readdirSync11,
20532
- rmSync as rmSync16,
20533
- statSync as statSync11,
20534
- writeFileSync as writeFileSync13
20895
+ readdirSync as readdirSync12,
20896
+ rmSync as rmSync18,
20897
+ statSync as statSync12,
20898
+ writeFileSync as writeFileSync14
20535
20899
  } from "fs";
20536
- import { dirname as dirname17, join as join44 } from "path";
20900
+ import { dirname as dirname18, join as join47 } from "path";
20537
20901
  function cfrRateControlArgs(locked) {
20538
20902
  const preset = getEncoderPreset(locked.quality ?? "standard", "mp4");
20539
20903
  if (locked.crf == null && locked.bitrate) {
@@ -20561,13 +20925,13 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
20561
20925
  outputPath,
20562
20926
  durationMs: Date.now() - start,
20563
20927
  framesEncoded: plan2.totalFrames,
20564
- fileSize: statSync11(outputPath).size
20928
+ fileSize: statSync12(outputPath).size
20565
20929
  };
20566
20930
  }
20567
20931
  const format = plan2.dimensions.format;
20568
20932
  const cfrEncoder = cfr ? readCfrEncoder(planDir, format) : null;
20569
- if (!existsSync30(dirname17(outputPath))) {
20570
- mkdirSync18(dirname17(outputPath), { recursive: true });
20933
+ if (!existsSync31(dirname18(outputPath))) {
20934
+ mkdirSync20(dirname18(outputPath), { recursive: true });
20571
20935
  }
20572
20936
  const workDir = mkdtempSync9(`${outputPath}.assemble-work-`);
20573
20937
  const fps = { num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen };
@@ -20589,8 +20953,8 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
20589
20953
  };
20590
20954
  try {
20591
20955
  const videoSources = cfrEncoder ? [await reencodeCfr(ctx, chunkPaths, cfrEncoder)] : chunkPaths;
20592
- const finalPath = join44(workDir, `output.${format}`);
20593
- const audio = audioPath !== null && existsSync30(audioPath) ? audioPath : null;
20956
+ const finalPath = join47(workDir, `output.${format}`);
20957
+ const audio = audioPath !== null && existsSync31(audioPath) ? audioPath : null;
20594
20958
  await writeJoined(ctx, videoSources, audio, finalPath);
20595
20959
  renameWithRetry(finalPath, outputPath);
20596
20960
  log.info("[assemble] stage timings", {
@@ -20600,7 +20964,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
20600
20964
  });
20601
20965
  } finally {
20602
20966
  try {
20603
- rmSync16(workDir, { recursive: true, force: true });
20967
+ rmSync18(workDir, { recursive: true, force: true });
20604
20968
  } catch (err) {
20605
20969
  log.warn("[assemble] failed to remove work dir", {
20606
20970
  workDir,
@@ -20608,7 +20972,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
20608
20972
  });
20609
20973
  }
20610
20974
  }
20611
- const fileSize = existsSync30(outputPath) ? statSync11(outputPath).size : 0;
20975
+ const fileSize = existsSync31(outputPath) ? statSync12(outputPath).size : 0;
20612
20976
  return {
20613
20977
  ...referenceBackgroundResult(plan2[REFERENCE_BACKGROUND_FIELD]),
20614
20978
  outputPath,
@@ -20618,15 +20982,15 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
20618
20982
  };
20619
20983
  }
20620
20984
  function readAssemblePlan(planDir, chunkPaths) {
20621
- const planJsonPath = join44(planDir, "plan.json");
20622
- const chunksJsonPath = join44(planDir, "meta", "chunks.json");
20623
- if (!existsSync30(planJsonPath)) {
20985
+ const planJsonPath = join47(planDir, "plan.json");
20986
+ const chunksJsonPath = join47(planDir, "meta", "chunks.json");
20987
+ if (!existsSync31(planJsonPath)) {
20624
20988
  throw new Error(`[assemble] planDir missing plan.json: ${planJsonPath}`);
20625
20989
  }
20626
20990
  const plan2 = JSON.parse(readFileSync14(planJsonPath, "utf-8"));
20627
20991
  readPlanProtocolV1(plan2, DISTRIBUTED_RENDER_CAPABILITIES.roles.assembler);
20628
20992
  validatePlanV2MaterializedTarget(planDir, { role: "assembler" });
20629
- if (!existsSync30(chunksJsonPath)) {
20993
+ if (!existsSync31(chunksJsonPath)) {
20630
20994
  throw new Error(`[assemble] planDir missing meta/chunks.json: ${chunksJsonPath}`);
20631
20995
  }
20632
20996
  const chunks = JSON.parse(readFileSync14(chunksJsonPath, "utf-8"));
@@ -20641,7 +21005,7 @@ function readAssemblePlan(planDir, chunkPaths) {
20641
21005
  }
20642
21006
  }
20643
21007
  for (const path of chunkPaths.flat()) {
20644
- if (!existsSync30(path)) {
21008
+ if (!existsSync31(path)) {
20645
21009
  throw new Error(`[assemble] chunk path does not exist: ${path}`);
20646
21010
  }
20647
21011
  }
@@ -20670,7 +21034,7 @@ function cfrEncodeArgs(inputArgs, encoder, fpsArg) {
20670
21034
  return args;
20671
21035
  }
20672
21036
  async function reencodeCfr(ctx, chunkPaths, encoder) {
20673
- const cfrOutputPath = join44(ctx.workDir, `cfr.${ctx.format}`);
21037
+ const cfrOutputPath = join47(ctx.workDir, `cfr.${ctx.format}`);
20674
21038
  const cfrArgs = cfrEncodeArgs(videoInputArgs(ctx, chunkPaths), encoder, ctx.fpsArg);
20675
21039
  appendRenderProvenanceArgs(cfrArgs, cfrOutputPath);
20676
21040
  cfrArgs.push("-y", cfrOutputPath);
@@ -20697,7 +21061,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
20697
21061
  );
20698
21062
  return;
20699
21063
  }
20700
- const paddedAudioPath = join44(ctx.workDir, "audio-padded.m4a");
21064
+ const paddedAudioPath = join47(ctx.workDir, "audio-padded.m4a");
20701
21065
  const padTrimResult = await ctx.timed(
20702
21066
  "audioMs",
20703
21067
  () => padOrTrimAudioToVideoFrameCount({
@@ -20737,9 +21101,9 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
20737
21101
  }
20738
21102
  }
20739
21103
  function concatDemuxerInput(chunkPaths, workDir, fpsArg) {
20740
- const listPath = join44(workDir, "concat-list.txt");
21104
+ const listPath = join47(workDir, "concat-list.txt");
20741
21105
  const body = chunkPaths.map((path) => `file '${path.replace(/'/g, "'\\''")}'`).join("\n");
20742
- writeFileSync13(listPath, `${body}
21106
+ writeFileSync14(listPath, `${body}
20743
21107
  `, "utf-8");
20744
21108
  return ["-r", fpsArg, "-f", "concat", "-safe", "0", "-i", listPath];
20745
21109
  }
@@ -20775,12 +21139,12 @@ function stitchesSeparateAudio(planDir) {
20775
21139
  return lockedAudio(planDir).separateAudio === true;
20776
21140
  }
20777
21141
  function planFormat(planDir) {
20778
- const plan2 = JSON.parse(readFileSync14(join44(planDir, "plan.json"), "utf-8"));
21142
+ const plan2 = JSON.parse(readFileSync14(join47(planDir, "plan.json"), "utf-8"));
20779
21143
  return plan2.dimensions.format;
20780
21144
  }
20781
21145
  function lockedAudio(planDir) {
20782
- const encoderJsonPath = join44(planDir, "meta", "encoder.json");
20783
- if (!existsSync30(encoderJsonPath)) return {};
21146
+ const encoderJsonPath = join47(planDir, "meta", "encoder.json");
21147
+ if (!existsSync31(encoderJsonPath)) return {};
20784
21148
  return JSON.parse(readFileSync14(encoderJsonPath, "utf-8"));
20785
21149
  }
20786
21150
  function readCfrEncoder(planDir, format) {
@@ -20789,8 +21153,8 @@ function readCfrEncoder(planDir, format) {
20789
21153
  `[assemble] cfr=true is only supported for format="mp4" (got "${format}"). Stream-copy paths for webm and mov already produce exact avg_frame_rate; cfr re-encode is not needed.`
20790
21154
  );
20791
21155
  }
20792
- const encoderJsonPath = join44(planDir, "meta", "encoder.json");
20793
- if (!existsSync30(encoderJsonPath)) {
21156
+ const encoderJsonPath = join47(planDir, "meta", "encoder.json");
21157
+ if (!existsSync31(encoderJsonPath)) {
20794
21158
  throw new Error(`[assemble] planDir missing meta/encoder.json: ${encoderJsonPath}`);
20795
21159
  }
20796
21160
  const encoderJson = JSON.parse(readFileSync14(encoderJsonPath, "utf-8"));
@@ -20802,22 +21166,22 @@ function readCfrEncoder(planDir, format) {
20802
21166
  return encoderJson;
20803
21167
  }
20804
21168
  function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, startTimeMs) {
20805
- if (existsSync30(outputPath)) rmSync16(outputPath, { recursive: true, force: true });
20806
- mkdirSync18(outputPath, { recursive: true });
21169
+ if (existsSync31(outputPath)) rmSync18(outputPath, { recursive: true, force: true });
21170
+ mkdirSync20(outputPath, { recursive: true });
20807
21171
  let globalIdx = 0;
20808
21172
  for (const chunkDir of chunkPaths) {
20809
- if (!statSync11(chunkDir).isDirectory()) {
21173
+ if (!statSync12(chunkDir).isDirectory()) {
20810
21174
  throw new Error(
20811
21175
  `[assemble] png-sequence chunk must be a directory: ${chunkDir} (got a file)`
20812
21176
  );
20813
21177
  }
20814
- const frames = readdirSync11(chunkDir).filter((name) => name.endsWith(".png")).sort();
21178
+ const frames = readdirSync12(chunkDir).filter((name) => name.endsWith(".png")).sort();
20815
21179
  if (frames.length === 0) {
20816
21180
  throw new Error(`[assemble] png-sequence chunk has no frames: ${chunkDir}`);
20817
21181
  }
20818
21182
  for (const frame of frames) {
20819
- const dst = join44(outputPath, formatExportFrameName(globalIdx, "png"));
20820
- cpSync3(join44(chunkDir, frame), dst);
21183
+ const dst = join47(outputPath, formatExportFrameName(globalIdx, "png"));
21184
+ cpSync3(join47(chunkDir, frame), dst);
20821
21185
  globalIdx += 1;
20822
21186
  }
20823
21187
  }
@@ -20826,14 +21190,14 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
20826
21190
  `[assemble] png-sequence frame count mismatch: merged ${globalIdx} frames vs plan.totalFrames=${totalFrames}. Using on-disk count.`
20827
21191
  );
20828
21192
  }
20829
- if (audioPath !== null && existsSync30(audioPath)) {
20830
- const sidecar = join44(outputPath, MIXED_AUDIO_FILENAME);
21193
+ if (audioPath !== null && existsSync31(audioPath)) {
21194
+ const sidecar = join47(outputPath, MIXED_AUDIO_FILENAME);
20831
21195
  cpSync3(audioPath, sidecar);
20832
21196
  }
20833
21197
  let fileSize = 0;
20834
- for (const name of readdirSync11(outputPath)) {
21198
+ for (const name of readdirSync12(outputPath)) {
20835
21199
  try {
20836
- fileSize += statSync11(join44(outputPath, name)).size;
21200
+ fileSize += statSync12(join47(outputPath, name)).size;
20837
21201
  } catch {
20838
21202
  }
20839
21203
  }
@@ -20847,18 +21211,18 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
20847
21211
 
20848
21212
  // ../producer/src/services/distributed/planV2Execution.ts
20849
21213
  async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
20850
- const workRoot = mkdtempSync10(join45(tmpdir6(), "hf-plan-v2-chunk-"));
20851
- const materializedPlanDir = join45(workRoot, "plan");
21214
+ const workRoot = mkdtempSync10(join48(tmpdir6(), "hf-plan-v2-chunk-"));
21215
+ const materializedPlanDir = join48(workRoot, "plan");
20852
21216
  try {
20853
21217
  materializePlanV2Target(planV2Dir, { role: "chunk", chunkIndex }, materializedPlanDir);
20854
21218
  return await renderChunk(materializedPlanDir, chunkIndex, outputChunkPath, options);
20855
21219
  } finally {
20856
- rmSync17(workRoot, { recursive: true, force: true });
21220
+ rmSync19(workRoot, { recursive: true, force: true });
20857
21221
  }
20858
21222
  }
20859
21223
  async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
20860
- const workRoot = mkdtempSync10(join45(tmpdir6(), "hf-plan-v2-assembler-"));
20861
- const materializedPlanDir = join45(workRoot, "plan");
21224
+ const workRoot = mkdtempSync10(join48(tmpdir6(), "hf-plan-v2-assembler-"));
21225
+ const materializedPlanDir = join48(workRoot, "plan");
20862
21226
  try {
20863
21227
  const materialized = materializePlanV2Target(
20864
21228
  planV2Dir,
@@ -20873,14 +21237,14 @@ async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
20873
21237
  options
20874
21238
  );
20875
21239
  } finally {
20876
- rmSync17(workRoot, { recursive: true, force: true });
21240
+ rmSync19(workRoot, { recursive: true, force: true });
20877
21241
  }
20878
21242
  }
20879
21243
 
20880
21244
  // ../producer/src/services/distributed/projectHash.ts
20881
- import { closeSync as closeSync7, openSync as openSync7, readdirSync as readdirSync12, readSync as readSync5, realpathSync as realpathSync2, statSync as statSync12 } from "fs";
21245
+ import { closeSync as closeSync7, openSync as openSync7, readdirSync as readdirSync13, readSync as readSync5, realpathSync as realpathSync2, statSync as statSync13 } from "fs";
20882
21246
  import { createHash as createHash8 } from "crypto";
20883
- import { join as join46 } from "path";
21247
+ import { join as join49 } from "path";
20884
21248
  var READ_CHUNK_BYTES = 256 * 1024;
20885
21249
 
20886
21250
  // ../producer/src/services/distributed/audioSidecar.ts
@@ -20888,7 +21252,7 @@ import { extname as extname7 } from "path";
20888
21252
  var AUDIO_SIDECAR_MIN_BYTES = 32 * 1024 * 1024;
20889
21253
 
20890
21254
  // ../producer/src/services/distributed/probeFacts.ts
20891
- import { writeFileSync as writeFileSync14 } from "fs";
21255
+ import { writeFileSync as writeFileSync15 } from "fs";
20892
21256
  import { extname as extname8 } from "path";
20893
21257
 
20894
21258
  export {