hyperframes 0.8.198 → 0.8.200

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 (176) hide show
  1. package/dist/{add-KEYBYC4P.js → add-MFJDOJHQ.js} +14 -14
  2. package/dist/{animatedGifPrep-Z5BJNWKN.js → animatedGifPrep-WBZ2VVP6.js} +7 -7
  3. package/dist/api.js +15 -15
  4. package/dist/{asset-I4SWXLQ6.js → asset-PTAQLOR6.js} +2 -2
  5. package/dist/{assetCataloger-FBZ36VTV.js → assetCataloger-N3UGZ2RC.js} +7 -7
  6. package/dist/{audio-I4Z5PT7P.js → audio-CPHWRLC4.js} +15 -15
  7. package/dist/{auth-CKN546QV.js → auth-ZWOJIYK7.js} +2 -2
  8. package/dist/{autoUpdate-AKOIVDJZ.js → autoUpdate-DO74673A.js} +3 -3
  9. package/dist/{backgroundChecks-5BJIAXAC.js → backgroundChecks-HOAN7YB6.js} +4 -4
  10. package/dist/backgroundChecksWorker.js +4 -4
  11. package/dist/{batchRender-QY2RN3J2.js → batchRender-AZFHTPSV.js} +3 -3
  12. package/dist/{beats-UEGEBTZ6.js → beats-JRMM6JQQ.js} +11 -11
  13. package/dist/{benchmark-BNGEOBEM.js → benchmark-2PEQUV7H.js} +11 -11
  14. package/dist/{browser-DL2STX2A.js → browser-2D6IHFO6.js} +7 -7
  15. package/dist/{bundleWithLocalizedFonts-ULZJ7GHE.js → bundleWithLocalizedFonts-ERB43NFP.js} +2 -2
  16. package/dist/{capture-DHYANXXU.js → capture-3ODEX55X.js} +2 -2
  17. package/dist/{capture-UNI6ZOPZ.js → capture-WNC2DWF7.js} +11 -11
  18. package/dist/{captureCompositionFrame-PS5KDJXF.js → captureCompositionFrame-JXXTHR7J.js} +12 -12
  19. package/dist/{catalog-UF3CDKXY.js → catalog-MHTRTKSY.js} +14 -14
  20. package/dist/{catch-up-DIESQDJZ.js → catch-up-XNDRKMKL.js} +7 -7
  21. package/dist/{check-WZ6L42CH.js → check-7IB355TM.js} +36 -36
  22. package/dist/{checkBrowser-7J6VC7D6.js → checkBrowser-E3ZCTAGY.js} +31 -31
  23. package/dist/{chunk-PKQ3GBDU.js → chunk-2LKHE32Z.js} +6 -6
  24. package/dist/{chunk-MFDZK3X5.js → chunk-32V3VHMK.js} +66 -10
  25. package/dist/{chunk-C6WBKEOI.js → chunk-3XXSRN36.js} +2 -2
  26. package/dist/{chunk-WA6HZFDD.js → chunk-3YGSZSEN.js} +2 -2
  27. package/dist/{chunk-AFQ777YP.js → chunk-4UPGPCMB.js} +1 -1
  28. package/dist/{chunk-HVF7K2T3.js → chunk-4VZAIVZQ.js} +1 -1
  29. package/dist/{chunk-ESJYD4AE.js → chunk-57Y5X4VU.js} +5 -5
  30. package/dist/{chunk-2CGWIIPE.js → chunk-5ULL3P6S.js} +2 -2
  31. package/dist/{chunk-6WZ6HNK2.js → chunk-63JJFXAD.js} +10 -8
  32. package/dist/{chunk-4V2OO56A.js → chunk-63S4VUOL.js} +2 -2
  33. package/dist/{chunk-256C5DYC.js → chunk-733CEBPF.js} +5 -5
  34. package/dist/{chunk-F2ZAINSR.js → chunk-7D7V3UDI.js} +1 -1
  35. package/dist/{chunk-GHO33VCP.js → chunk-7LRVGYKZ.js} +2 -2
  36. package/dist/{chunk-O3KFO66O.js → chunk-7NWSVRFE.js} +1 -1
  37. package/dist/{chunk-WY67Q2QY.js → chunk-7WV27W7R.js} +5 -3
  38. package/dist/{chunk-GJA6QSSQ.js → chunk-ACH5ZR7X.js} +3 -3
  39. package/dist/{chunk-6BTMNV3R.js → chunk-BERGVZKN.js} +1 -1
  40. package/dist/{chunk-DZWTK3HJ.js → chunk-BIZPUWBG.js} +1 -1
  41. package/dist/{chunk-T6AGUTZJ.js → chunk-BQA3X7TI.js} +3 -32
  42. package/dist/{chunk-U66P7HPN.js → chunk-D35MPIGJ.js} +14 -14
  43. package/dist/{chunk-Y2I7KT2R.js → chunk-DRTUJVLE.js} +107 -44
  44. package/dist/{chunk-YP5XWK7M.js → chunk-FTD5QXGF.js} +1 -1
  45. package/dist/{chunk-FXDYR644.js → chunk-FTUKOLLB.js} +1 -1
  46. package/dist/{chunk-4WDOTQDY.js → chunk-FZ3R5XOH.js} +1 -1
  47. package/dist/{chunk-YEVU5W5G.js → chunk-G7RKSAKS.js} +29 -4
  48. package/dist/{chunk-7W7F3KBH.js → chunk-GR2G5L2O.js} +2 -2
  49. package/dist/{chunk-7FT7E7OU.js → chunk-GYSPF5ZT.js} +17 -17
  50. package/dist/{chunk-BPU22WKT.js → chunk-H2X4TQVK.js} +7 -7
  51. package/dist/{chunk-FCY375PD.js → chunk-HBRPELT6.js} +3 -3
  52. package/dist/{chunk-6NSH5EAO.js → chunk-HN6TP4D2.js} +1 -1
  53. package/dist/{chunk-7OFK6XMH.js → chunk-HXHSGDU6.js} +7 -7
  54. package/dist/{chunk-O2CO6QNK.js → chunk-I4VEFPZE.js} +1 -1
  55. package/dist/{chunk-DFL4XSQZ.js → chunk-I6A2B3IJ.js} +3 -3
  56. package/dist/{chunk-YUODO5H2.js → chunk-IC6BO4GU.js} +25 -2
  57. package/dist/{chunk-2FT5WJPY.js → chunk-ISN6BAZX.js} +1 -1
  58. package/dist/{chunk-JSLQZKXA.js → chunk-IW4LKYDY.js} +2 -2
  59. package/dist/{chunk-56ZYGITX.js → chunk-JBQNDHRT.js} +1 -1
  60. package/dist/{chunk-O2SA7HOG.js → chunk-KPUTRG54.js} +2 -2
  61. package/dist/{chunk-JBTNMFFR.js → chunk-KVFSXCN6.js} +1 -1
  62. package/dist/{chunk-EUZB3ZV3.js → chunk-ML4IULLQ.js} +10 -10
  63. package/dist/{chunk-ORNE2BC4.js → chunk-NC3TVM27.js} +5 -5
  64. package/dist/{chunk-4UAUXH77.js → chunk-OE7AUN6G.js} +759 -454
  65. package/dist/{chunk-N4NKPFKQ.js → chunk-OMXXJSCK.js} +54 -16
  66. package/dist/{chunk-NDBOBZRL.js → chunk-OYVVDYM6.js} +10 -10
  67. package/dist/{chunk-P3ZZD4SK.js → chunk-PFFR4NQV.js} +3 -3
  68. package/dist/{chunk-6NLPPKBO.js → chunk-PSX5SF2N.js} +36 -0
  69. package/dist/chunk-PW22CDII.js +3901 -0
  70. package/dist/{chunk-XIYNIHGQ.js → chunk-Q5IJYX7X.js} +2 -2
  71. package/dist/{chunk-GQVTTWZF.js → chunk-QDK7XCOB.js} +1 -1
  72. package/dist/{chunk-5I74DQPC.js → chunk-QP4UWICL.js} +3 -3
  73. package/dist/{chunk-UMCU32QC.js → chunk-QYQY5ACN.js} +1 -1
  74. package/dist/{chunk-F2K72QNO.js → chunk-RFQ6BIRL.js} +1 -1
  75. package/dist/{chunk-OU6YITCR.js → chunk-TDF2O2RM.js} +2 -2
  76. package/dist/{chunk-ISZK5IJM.js → chunk-TOC6E65N.js} +1 -1
  77. package/dist/{chunk-MMJ3L4XQ.js → chunk-TTFHBTXQ.js} +1 -1
  78. package/dist/{chunk-UBOBOWWB.js → chunk-TUVNQA5B.js} +3 -3
  79. package/dist/{chunk-W2LGJSEN.js → chunk-UIOZIIB7.js} +33 -3
  80. package/dist/{chunk-ZSO7UVC5.js → chunk-UUFY6A7I.js} +354 -82
  81. package/dist/{chunk-JTTWK6IM.js → chunk-VFLBOKDI.js} +3 -3
  82. package/dist/{chunk-TXJKDBUB.js → chunk-WAG4AX5C.js} +1 -1
  83. package/dist/{chunk-HBPFY3KU.js → chunk-XV7ZNBVY.js} +3 -3
  84. package/dist/{chunk-UUG3DETI.js → chunk-ZFBET3PD.js} +1 -1
  85. package/dist/{clean-2W5OGTMI.js → clean-BOYUTBAU.js} +18 -18
  86. package/dist/cli.js +54 -54
  87. package/dist/{cloud-AJK5OLJM.js → cloud-3O2MEZO4.js} +4 -4
  88. package/dist/{cloudrun-HAAYNZWP.js → cloudrun-MCTN22O6.js} +4 -4
  89. package/dist/{compare-KRY3JTXM.js → compare-A57RHCPB.js} +28 -28
  90. package/dist/{compiler-47QXFQF4.js → compiler-LVNWLZCX.js} +3 -3
  91. package/dist/{component-XQR75LCM.js → component-MIJC3LWO.js} +3 -3
  92. package/dist/{compositions-QJZQZJFB.js → compositions-OUNZAEC3.js} +13 -13
  93. package/dist/{delete-PPOMPFZG.js → delete-X6Q3S3SL.js} +3 -3
  94. package/dist/{deploy-IKVAHO42.js → deploy-XXMIXGUF.js} +1 -1
  95. package/dist/{dist-JBRYL3MH.js → dist-2UO4RVFN.js} +4 -2
  96. package/dist/{dist-XPD7X6JB.js → dist-ONHJ6ZDA.js} +1 -1
  97. package/dist/{doctor-TM2B4PLJ.js → doctor-ASSDEPCO.js} +14 -14
  98. package/dist/{events-UFQAFJ7A.js → events-4ULC5VUK.js} +5 -5
  99. package/dist/{events-QERYXJVB.js → events-DVWSV3TQ.js} +6 -6
  100. package/dist/{feedback-X6GA5Z2Y.js → feedback-OB3NJPNF.js} +9 -9
  101. package/dist/{ffmpeg-G6RMIP5K.js → ffmpeg-JH3JXES2.js} +7 -7
  102. package/dist/{figma-WAM4RJUC.js → figma-GV4OGXC2.js} +3 -3
  103. package/dist/fontLocalizeCli.js +9 -9
  104. package/dist/{get-7TO44JK3.js → get-FLMCUJGR.js} +3 -3
  105. package/dist/{gpuPolicy-IMLRNUEJ.js → gpuPolicy-RZ2OUY4M.js} +7 -7
  106. package/dist/{grade-compare-TCUAQKW4.js → grade-compare-O62JAOA7.js} +29 -29
  107. package/dist/{help-GSPNIWE2.js → help-6POZ4GNV.js} +1 -1
  108. package/dist/{history-SFC4KDFT.js → history-72ZIF5WR.js} +9 -9
  109. package/dist/hyperframe.manifest.json +1 -1
  110. package/dist/hyperframe.runtime.iife.js +65 -62
  111. package/dist/hyperframes-player.global.js +3 -3
  112. package/dist/{info-YBSWR4VE.js → info-GGIFZ5CT.js} +10 -10
  113. package/dist/{init-RJCZWSTH.js → init-QYRN6HG2.js} +29 -29
  114. package/dist/{inspect-R6C5Q7WI.js → inspect-KSL4YVIU.js} +29 -29
  115. package/dist/{installer-BJQSDYHE.js → installer-ENQCLSJQ.js} +4 -4
  116. package/dist/{keyframes-UJOV3QTF.js → keyframes-6PNLGKOO.js} +9 -9
  117. package/dist/{lambda-645URVF4.js → lambda-3RFOOJV6.js} +6 -6
  118. package/dist/{layout-MPGHNIY6.js → layout-3XFC6N3L.js} +29 -29
  119. package/dist/{lint-BWYP7H5P.js → lint-5XGLCTV5.js} +10 -10
  120. package/dist/{lintProject-Q4ZVEF3G.js → lintProject-FKPKSU6M.js} +1 -1
  121. package/dist/{list-YBOALPIY.js → list-B76BTLOM.js} +3 -3
  122. package/dist/{login-Z3JYXJKB.js → login-MNXS7GEL.js} +4 -4
  123. package/dist/{manager-COSJVRAE.js → manager-BWU4U7DV.js} +3 -3
  124. package/dist/{manager-CCRWUMQO.js → manager-QZZVJV7Z.js} +8 -8
  125. package/dist/{media-treatment-4P54XYM7.js → media-treatment-J3OWRCBF.js} +15 -15
  126. package/dist/{models-3LIZKQPH.js → models-MCDUTV54.js} +11 -11
  127. package/dist/{motionShot-22NRFNLM.js → motionShot-RWEH3VWI.js} +16 -16
  128. package/dist/{normalize-audio-C6JTJBZE.js → normalize-audio-N7VRZODX.js} +7 -7
  129. package/dist/{open-5KOE2UWD.js → open-ROUFAVKD.js} +14 -14
  130. package/dist/{parakeetRunner-67JLWWPE.js → parakeetRunner-PTVV5M44.js} +12 -12
  131. package/dist/{pipeline-QZQRLXSV.js → pipeline-HN5KMORF.js} +8 -8
  132. package/dist/{play-ID4KS6LH.js → play-AO7AF4Y4.js} +20 -20
  133. package/dist/{preflight-DVW7XWEO.js → preflight-ARNDDFGX.js} +10 -10
  134. package/dist/{present-CDJCTLFJ.js → present-FBPKUC5R.js} +16 -16
  135. package/dist/{preview-KDMHWG3L.js → preview-35X5G426.js} +20 -20
  136. package/dist/{producer-QPUWC6S3.js → producer-FVGPLR5E.js} +1 -1
  137. package/dist/{projectConfig-VMVZXMC6.js → projectConfig-SRUJLOHL.js} +6 -6
  138. package/dist/{publication-VBXDWVC7.js → publication-XH2BRL3V.js} +2 -2
  139. package/dist/{publish-XDNOVFIZ.js → publish-RI4ZQZNT.js} +8 -8
  140. package/dist/{remove-background-OQUEVC4I.js → remove-background-J22P5JFW.js} +9 -9
  141. package/dist/{render-L5DUPSDJ.js → render-2EZQT4IS.js} +16 -16
  142. package/dist/{render-MMEZAOL7.js → render-IJUKJILU.js} +123 -42
  143. package/dist/{render-2MVVITHT.js → render-UXYZN6D2.js} +5 -5
  144. package/dist/{render-batch-EZRFUUHG.js → render-batch-X34UZ442.js} +5 -5
  145. package/dist/renderSetupWorker.js +4 -4
  146. package/dist/{resolver-E6OFNCLG.js → resolver-UUEIRLMY.js} +4 -4
  147. package/dist/{sherpa-MQUVKCRX.js → sherpa-FI4VNAFT.js} +11 -11
  148. package/dist/skills/media-use/references/mixing.md +1 -0
  149. package/dist/{skills-Y7AATMSQ.js → skills-LGKXQFW7.js} +8 -8
  150. package/dist/{skillsUpdateCheck-K7DSQJGU.js → skillsUpdateCheck-NDPKSX3H.js} +4 -4
  151. package/dist/{snapshot-DZWLAQAW.js → snapshot-JM6427YW.js} +33 -33
  152. package/dist/{src-RRTSNZLM.js → src-26NBARTO.js} +8 -8
  153. package/dist/{src-7FSQZKIY.js → src-WEECPY6E.js} +6 -6
  154. package/dist/{staticProjectServer-J2IXFINI.js → staticProjectServer-I5WGMJOV.js} +14 -14
  155. package/dist/{status-H5WLKQDS.js → status-SCCC7A6N.js} +2 -2
  156. package/dist/studio/assets/{hyperframes-player-DDoxfTBd.js → hyperframes-player-LmRUJE8q.js} +1 -1
  157. package/dist/studio/assets/{index-BAKWbo0z.js → index-BmTWk8xf.js} +108 -108
  158. package/dist/studio/assets/{index-D9WoRF2S.js → index-CKNiEwbW.js} +1 -1
  159. package/dist/studio/index.html +1 -1
  160. package/dist/{studio-api-7BNDWZG5.js → studio-api-N774Q4NO.js} +7 -7
  161. package/dist/{studioServer-FBRUE3XK.js → studioServer-KZIM5UBJ.js} +49 -49
  162. package/dist/{system-7F3UEHQT.js → system-HV7PYIXE.js} +4 -3
  163. package/dist/{telemetry-4K6CPMNT.js → telemetry-IHU4HL3R.js} +1 -1
  164. package/dist/{telemetry-OOQVUJGL.js → telemetry-JIETM7WP.js} +6 -6
  165. package/dist/{timeline-U6MIU6JP.js → timeline-JJ6JG7GQ.js} +18 -18
  166. package/dist/{tokens-3ZPX6WKB.js → tokens-VOIMSCGX.js} +2 -2
  167. package/dist/{transcribe-QDBXRADM.js → transcribe-2V23EQHD.js} +18 -18
  168. package/dist/{transcribe-VPGQV5TG.js → transcribe-7BDHDQVP.js} +10 -10
  169. package/dist/{updateCheck-MN3QTSGM.js → updateCheck-7B7L3UWO.js} +3 -3
  170. package/dist/{upgrade-4FVRTMU5.js → upgrade-TUA2QZTY.js} +3 -3
  171. package/dist/{urlDownloader-UTVBU5IQ.js → urlDownloader-CGV6EYL7.js} +6 -6
  172. package/dist/{validate-NN43T4XX.js → validate-JLCXEI2U.js} +23 -23
  173. package/dist/{video-VQ67QXES.js → video-TI3EOA2D.js} +7 -7
  174. package/dist/warmCheck.js +36 -36
  175. package/package.json +1 -1
  176. package/dist/chunk-UYBXHV7R.js +0 -3901
@@ -14,6 +14,7 @@ import {
14
14
  MEDIA_VISUAL_STYLE_PROPERTIES,
15
15
  RENDER_FRAME_ID_PREFIX,
16
16
  RENDER_FRAME_ID_SUFFIX,
17
+ SCENE_CALLBACK_ERROR_PREFIX,
17
18
  exportClipWindow,
18
19
  firstFrameColourArgs,
19
20
  fpsToFfmpegArg,
@@ -27,7 +28,7 @@ import {
27
28
  renderFrameIdForRenderId,
28
29
  resolveAuthoredTimingWindow,
29
30
  toFps
30
- } from "./chunk-YEVU5W5G.js";
31
+ } from "./chunk-G7RKSAKS.js";
31
32
  import {
32
33
  AUDIO_GROUP_RENDER_ID_ATTR,
33
34
  COLOR_GRADING_SOURCE_HIDDEN_ATTR,
@@ -64,7 +65,7 @@ import {
64
65
  sourceTimeAt,
65
66
  timeAtSourceTime,
66
67
  volumeSegmentSampleCount
67
- } from "./chunk-UYBXHV7R.js";
68
+ } from "./chunk-PW22CDII.js";
68
69
  import {
69
70
  clampAudioGain,
70
71
  clipGain,
@@ -87,7 +88,7 @@ import {
87
88
  } from "./chunk-4UMPIPCQ.js";
88
89
  import {
89
90
  resolveReferencedStart
90
- } from "./chunk-YUODO5H2.js";
91
+ } from "./chunk-IC6BO4GU.js";
91
92
  import {
92
93
  FFMPEG_PATH_ENV,
93
94
  FFPROBE_PATH_ENV,
@@ -107,9 +108,10 @@ import {
107
108
  LOW_MEMORY_TOTAL_MB_THRESHOLD,
108
109
  describeWslGpuAccess,
109
110
  detectWsl,
111
+ getAvailableMemoryMb,
110
112
  getSystemTotalMb,
111
113
  isLowMemorySystem
112
- } from "./chunk-W2LGJSEN.js";
114
+ } from "./chunk-UIOZIIB7.js";
113
115
 
114
116
  // ../engine/src/config.ts
115
117
  import { tmpdir } from "os";
@@ -4507,29 +4509,60 @@ async function initThreeDProjection(page) {
4507
4509
  return { ok: false, groups: 0, quads: 0, reason: e instanceof Error ? e.message : String(e) };
4508
4510
  }
4509
4511
  }
4510
- async function detectCssEffectRisk(page) {
4512
+ async function scanCssEffects(page, collect) {
4511
4513
  try {
4512
- return await page.evaluate(() => {
4514
+ return await page.evaluate((collectAll) => {
4513
4515
  const root = document.querySelector("[data-composition-id]");
4514
- if (!root) return null;
4516
+ if (!root) return { reason: null, bounded: true, callbackFrom: null };
4517
+ let reason = null;
4518
+ let bounded = true;
4519
+ const targets = /* @__PURE__ */ new Set();
4520
+ const hit = (name, els) => {
4521
+ reason = reason ?? name;
4522
+ if (els && els.length > 0) for (const el of Array.from(els)) targets.add(el);
4523
+ else bounded = false;
4524
+ return !collectAll;
4525
+ };
4515
4526
  const scanComputed = () => {
4516
4527
  const els = [root, ...Array.from(root.querySelectorAll("*"))];
4517
4528
  for (const el of els) {
4518
4529
  const cs = getComputedStyle(el);
4519
4530
  const bf = cs.backdropFilter || cs.webkitBackdropFilter || "";
4520
- if (bf && bf !== "none") return "backdrop-filter";
4531
+ if (bf && bf !== "none" && hit("backdrop-filter", [el])) return true;
4521
4532
  const f = cs.filter || "";
4522
- if (f && f !== "none" && f.indexOf("blur(") !== -1) return "filter:blur";
4523
- if (f && f !== "none" && f.indexOf("drop-shadow(") !== -1) return "filter:drop-shadow";
4533
+ if (f && f !== "none" && f.indexOf("blur(") !== -1 && hit("filter:blur", [el])) {
4534
+ return true;
4535
+ }
4536
+ if (f && f !== "none" && f.indexOf("drop-shadow(") !== -1 && hit("filter:drop-shadow", [el])) {
4537
+ return true;
4538
+ }
4524
4539
  const mbm = cs.mixBlendMode || "";
4525
- if (mbm && mbm !== "normal") return "mix-blend-mode";
4540
+ if (mbm && mbm !== "normal" && hit("mix-blend-mode", [el])) return true;
4526
4541
  const an = cs.animationName || "";
4527
4542
  const ad = cs.animationDuration || "0s";
4528
- if (an && an !== "none" && ad !== "0s" && parseFloat(ad) > 0) return "css-animation";
4543
+ if (an && an !== "none" && ad !== "0s" && parseFloat(ad) > 0 && hit("css-animation", null)) {
4544
+ return true;
4545
+ }
4529
4546
  }
4530
- return null;
4547
+ return false;
4531
4548
  };
4532
4549
  const scanStyleSheets = () => {
4550
+ const ruleTargets = (rule) => {
4551
+ const selector = rule.selectorText;
4552
+ if (!selector) return [];
4553
+ try {
4554
+ return Array.from(
4555
+ root.querySelectorAll(
4556
+ selector.replace(
4557
+ /::?(before|after|first-line|first-letter|marker|placeholder|selection|backdrop)/g,
4558
+ ""
4559
+ )
4560
+ )
4561
+ );
4562
+ } catch {
4563
+ return [];
4564
+ }
4565
+ };
4533
4566
  for (const sheet of Array.from(document.styleSheets)) {
4534
4567
  let rules = null;
4535
4568
  try {
@@ -4539,52 +4572,151 @@ async function detectCssEffectRisk(page) {
4539
4572
  }
4540
4573
  for (const rule of Array.from(rules ?? [])) {
4541
4574
  const txt = rule.cssText || "";
4542
- if (/backdrop-filter\s*:\s*(?!none)/i.test(txt)) return "backdrop-filter";
4543
- if (/(?:^|[^-])filter\s*:[^;{}]*blur\(/i.test(txt)) return "filter:blur";
4544
- if (/(?:^|[^-])filter\s*:[^;{}]*drop-shadow\(/i.test(txt)) {
4545
- return "filter:drop-shadow";
4546
- }
4547
- if (/mix-blend-mode\s*:\s*(?!normal)/i.test(txt)) return "mix-blend-mode";
4575
+ let name = null;
4576
+ if (/backdrop-filter\s*:\s*(?!none)/i.test(txt)) name = "backdrop-filter";
4577
+ else if (/(?:^|[^-])filter\s*:[^;{}]*blur\(/i.test(txt)) name = "filter:blur";
4578
+ else if (/(?:^|[^-])filter\s*:[^;{}]*drop-shadow\(/i.test(txt)) {
4579
+ name = "filter:drop-shadow";
4580
+ } else if (/mix-blend-mode\s*:\s*(?!normal)/i.test(txt)) name = "mix-blend-mode";
4581
+ if (name && hit(name, ruleTargets(rule))) return true;
4548
4582
  }
4549
4583
  }
4550
- return null;
4584
+ return false;
4551
4585
  };
4552
4586
  const scanTweenVars = () => {
4553
4587
  const walk = (tl) => {
4554
- if (typeof tl.getChildren !== "function") return null;
4588
+ if (typeof tl.getChildren !== "function") return false;
4555
4589
  for (const c of tl.getChildren(false, true, true)) {
4556
- const sub = walk(c);
4557
- if (sub) return sub;
4590
+ if (walk(c)) return true;
4558
4591
  const vars = c.vars || {};
4559
4592
  for (const k of Object.keys(vars)) {
4560
4593
  const kl = k.toLowerCase();
4561
- if (kl.includes("blend")) return "mix-blend-mode";
4562
- if (kl.includes("backdrop")) return "backdrop-filter";
4563
- if (kl === "filter" && /blur\(/i.test(String(vars[k] ?? ""))) return "filter:blur";
4564
- if (kl === "filter" && /drop-shadow\(/i.test(String(vars[k] ?? ""))) {
4565
- return "filter:drop-shadow";
4594
+ let name = null;
4595
+ if (kl.includes("blend")) name = "mix-blend-mode";
4596
+ else if (kl.includes("backdrop")) name = "backdrop-filter";
4597
+ else if (kl === "filter" && /blur\(/i.test(String(vars[k] ?? ""))) {
4598
+ name = "filter:blur";
4599
+ } else if (kl === "filter" && /drop-shadow\(/i.test(String(vars[k] ?? ""))) {
4600
+ name = "filter:drop-shadow";
4566
4601
  }
4602
+ if (!name) continue;
4603
+ const els = (typeof c.targets === "function" ? c.targets() : []).filter(
4604
+ (t) => t instanceof Element
4605
+ );
4606
+ if (hit(name, els)) return true;
4567
4607
  }
4568
4608
  }
4569
- return null;
4609
+ return false;
4570
4610
  };
4571
4611
  const tls = window.__timelines || {};
4572
4612
  for (const tl of Object.values(tls)) {
4573
- const r = walk(tl);
4574
- if (r) return r;
4613
+ if (walk(tl)) return true;
4575
4614
  }
4576
- return null;
4615
+ return false;
4577
4616
  };
4578
4617
  const scanWebgl = () => {
4579
4618
  const aw = window;
4580
4619
  const accel = (aw.__hf_accel_canvases ?? []).filter((c) => root.contains(c));
4581
- return accel.length > 0 ? "webgl-context" : null;
4620
+ return accel.length > 0 && hit("webgl-context", null);
4582
4621
  };
4583
- return scanComputed() || scanStyleSheets() || scanTweenVars() || scanWebgl();
4584
- });
4622
+ for (const scan of [scanComputed, scanStyleSheets, scanTweenVars, scanWebgl]) {
4623
+ if (scan()) break;
4624
+ }
4625
+ const calls = ["onStart", "onUpdate", "onComplete", "onRepeat", "onReverseComplete"];
4626
+ const firstCallback = (node, offset) => {
4627
+ const start = offset + (typeof node.startTime === "function" ? node.startTime() : 0);
4628
+ let first = calls.some((k) => typeof node.vars?.[k] === "function") ? start : Infinity;
4629
+ if (typeof node.getChildren === "function") {
4630
+ for (const child of node.getChildren(false, true, true)) {
4631
+ first = Math.min(first, firstCallback(child, start));
4632
+ }
4633
+ }
4634
+ return first;
4635
+ };
4636
+ const timelines = window.__timelines;
4637
+ const callbackStart = reason ? Math.min(Infinity, ...Object.values(timelines ?? {}).map((tl) => firstCallback(tl, 0))) : Infinity;
4638
+ window.__hfCssFxTargets = [...targets];
4639
+ return {
4640
+ reason,
4641
+ bounded,
4642
+ callbackFrom: Number.isFinite(callbackStart) ? callbackStart : null
4643
+ };
4644
+ }, collect);
4585
4645
  } catch {
4586
- return null;
4646
+ return { reason: null, bounded: true, callbackFrom: null };
4647
+ }
4648
+ }
4649
+
4650
+ // ../engine/src/services/riskFrames.ts
4651
+ var SCAN_CHUNK_FRAMES = 240;
4652
+ var MAX_RISK_FRAME_FRACTION = 0.6;
4653
+ var RISK_RENDER_ADDED_BYTES = 1e9;
4654
+ var RISK_RENDER_HEADROOM_BYTES = 15e8;
4655
+ var PIXELS_1080P = 1920 * 1080;
4656
+ var RISK_RANGE_HYSTERESIS_FRAMES = 12;
4657
+ async function scanCssEffectLiveFrames(page, fps, totalFrames, maxFrames) {
4658
+ const live = /* @__PURE__ */ new Set();
4659
+ for (let from = 0; from < totalFrames; from += SCAN_CHUNK_FRAMES) {
4660
+ const times = [];
4661
+ for (let f = from; f < Math.min(totalFrames, from + SCAN_CHUNK_FRAMES); f++) {
4662
+ times.push(quantizeTimeToFrame(f / fps, fps));
4663
+ }
4664
+ const hits = await page.evaluate(async (ts) => {
4665
+ const w = window;
4666
+ const targets = w.__hfCssFxTargets ?? [];
4667
+ const paints = (el) => getComputedStyle(el).visibility !== "hidden" || Array.from(el.querySelectorAll("*")).some(
4668
+ (d) => getComputedStyle(d).visibility === "visible"
4669
+ );
4670
+ const shows = (el) => {
4671
+ for (let n = el; n; n = n.parentElement) {
4672
+ const cs = getComputedStyle(n);
4673
+ if (cs.display === "none" || Number(cs.opacity) === 0) return false;
4674
+ }
4675
+ return paints(el);
4676
+ };
4677
+ const out = [];
4678
+ for (let i = 0; i < ts.length; i++) {
4679
+ w.__hf?.seek?.(ts[i]);
4680
+ await w.__hfWaitForSeekCompletion?.();
4681
+ if (targets.some(shows)) out.push(i);
4682
+ }
4683
+ return out;
4684
+ }, times);
4685
+ for (const i of hits) live.add(from + i);
4686
+ if (live.size > maxFrames) break;
4687
+ }
4688
+ return live.size > maxFrames ? null : live;
4689
+ }
4690
+ function planRiskFrames(frames, totalFrames) {
4691
+ const sorted = [...new Set(frames)].sort((a, b) => a - b);
4692
+ const plan = /* @__PURE__ */ new Set();
4693
+ let rangeStart = -1;
4694
+ let rangeEnd = -1;
4695
+ const flush = () => {
4696
+ for (let f = Math.max(0, rangeStart - 1); f <= Math.min(totalFrames - 1, rangeEnd + 1); f++) {
4697
+ plan.add(f);
4698
+ }
4699
+ };
4700
+ for (const f of sorted) {
4701
+ if (rangeStart >= 0 && f - rangeEnd <= RISK_RANGE_HYSTERESIS_FRAMES) {
4702
+ rangeEnd = f;
4703
+ continue;
4704
+ }
4705
+ if (rangeStart >= 0) flush();
4706
+ rangeStart = f;
4707
+ rangeEnd = f;
4587
4708
  }
4709
+ if (rangeStart >= 0) flush();
4710
+ return plan.size > totalFrames * MAX_RISK_FRAME_FRACTION ? null : plan;
4711
+ }
4712
+ function withFramesAfterCallback(live, callbackFrom, fps, totalFrames) {
4713
+ if (callbackFrom === null) return live;
4714
+ for (let f = Math.max(0, Math.floor(callbackFrom * fps) - 1); f < totalFrames; f++) live.add(f);
4715
+ return live;
4716
+ }
4717
+ function riskSessionFits(availableMb, outputPixels) {
4718
+ const rss = RISK_RENDER_ADDED_BYTES * Math.max(1, outputPixels / PIXELS_1080P);
4719
+ return availableMb * 1024 * 1024 - rss >= RISK_RENDER_HEADROOM_BYTES;
4588
4720
  }
4589
4721
 
4590
4722
  // ../engine/src/utils/psnrFilterAvailability.ts
@@ -5333,16 +5465,31 @@ async function initDrawElementOrTransparentBackground(session, page, logInitPhas
5333
5465
  );
5334
5466
  await routeToFallback();
5335
5467
  } else {
5468
+ const perFrame = session.options.deFrameFallback === true && drawElementWorkerEncodeEligible(session, transparent) && !forceDE;
5469
+ const riskFrames = /* @__PURE__ */ new Set();
5470
+ const riskReasons = [];
5471
+ let cssFrames = 0;
5472
+ const routeWholeRender = async (reason, trigger, message) => {
5473
+ session.deGateReason = reason;
5474
+ session.deFallbackTrigger = trigger;
5475
+ console.log(
5476
+ `[engine] fast capture falls back to ${session.launchCaptureMode} capture: ${message}`
5477
+ );
5478
+ await routeToFallback();
5479
+ };
5336
5480
  if (!forceDE && process.env.HF_FAST_CAPTURE_CSSFX !== "true") {
5337
- const cssFx = await detectCssEffectRisk(page);
5481
+ const cssFx = (await scanCssEffects(page, false)).reason;
5338
5482
  if (cssFx) {
5339
- session.deGateReason = `css_effect:${(cssFx.split(":")[0] ?? "").replace(/[^a-z-]/gi, "")}`;
5340
- session.deFallbackTrigger = cssFx;
5341
- console.log(
5342
- `[engine] fast capture falls back to ${session.launchCaptureMode} capture: ${cssFx} detected (drawElementImage cannot reproduce it; see fast-capture-limitations.md)`
5343
- );
5344
- await routeToFallback();
5345
- return;
5483
+ const gateReason = `css_effect:${(cssFx.split(":")[0] ?? "").replace(/[^a-z-]/gi, "")}`;
5484
+ const gateMessage = `${cssFx} detected (drawElementImage cannot reproduce it; see fast-capture-limitations.md)`;
5485
+ cssFrames = perFrame ? await renderFrameCount(session, page) : 0;
5486
+ const live = cssFrames > 0 ? await cssEffectRiskFrames(session, cssFrames) : null;
5487
+ if (!live) {
5488
+ await routeWholeRender(gateReason, cssFx, gateMessage);
5489
+ return;
5490
+ }
5491
+ for (const f of live) riskFrames.add(f);
5492
+ riskReasons.push(cssFx);
5346
5493
  }
5347
5494
  }
5348
5495
  if (!forceDE && process.env.HF_FAST_CAPTURE_INTERVAL_SS !== "false") {
@@ -5354,14 +5501,43 @@ async function initDrawElementOrTransparentBackground(session, page, logInitPhas
5354
5501
  `timeline at-risk predictor: ${atRisk.size}/${totalFrames} frames (${Math.round(atRiskFraction * 100)}%)`
5355
5502
  );
5356
5503
  if (atRisk.size > 0 && atRiskFraction > fractionFloor) {
5357
- session.deGateReason = "at_risk_timeline";
5358
- session.deFallbackTrigger = "at_risk_timeline";
5359
- console.log(
5360
- `[engine] fast capture falls back to ${session.launchCaptureMode} capture: ${atRisk.size}/${totalFrames} frames animate a compositor-incompatible prop (blend/3D/clip/mask); drawElementImage drops these mid-animation (deterministic timeline gate; see fast-capture-limitations.md Lim 7)`
5504
+ if (perFrame) {
5505
+ for (const f of atRisk) riskFrames.add(f);
5506
+ riskReasons.push("at_risk_timeline");
5507
+ } else {
5508
+ await routeWholeRender(
5509
+ "at_risk_timeline",
5510
+ "at_risk_timeline",
5511
+ `${atRisk.size}/${totalFrames} frames animate a compositor-incompatible prop (blend/3D/clip/mask); drawElementImage drops these mid-animation (deterministic timeline gate; see fast-capture-limitations.md Lim 7)`
5512
+ );
5513
+ return;
5514
+ }
5515
+ }
5516
+ }
5517
+ if (riskFrames.size > 0) {
5518
+ const total = cssFrames > 0 ? cssFrames : await renderFrameCount(session, page);
5519
+ const plan = total > 0 ? planRiskFrames(riskFrames, total) : null;
5520
+ if (!plan) {
5521
+ await routeWholeRender(
5522
+ "risk_frames",
5523
+ riskReasons.join("+"),
5524
+ `${riskFrames.size}/${total} frames need screenshot capture (${riskReasons.join(", ")}), too many to keep fast capture for the rest`
5361
5525
  );
5362
- await routeToFallback();
5363
5526
  return;
5364
5527
  }
5528
+ if (!riskSessionFits(getAvailableMemoryMb(), session.options.width * session.options.height)) {
5529
+ await routeWholeRender(
5530
+ "risk_session_memory",
5531
+ riskReasons.join("+"),
5532
+ `${plan.size} frames need screenshot capture (${riskReasons.join(", ")}) but too little memory is available for per-frame capture`
5533
+ );
5534
+ return;
5535
+ }
5536
+ session.deRiskFrames = plan;
5537
+ session.deRiskReason = riskReasons.join("+");
5538
+ logInitPhase(
5539
+ `fast capture keeps ${total - plan.size}/${total} frames; ${plan.size} frame(s) capture by screenshot (${session.deRiskReason})`
5540
+ );
5365
5541
  }
5366
5542
  const threeD = await initThreeDProjection(page);
5367
5543
  if (!forceDE && !threeD.ok) {
@@ -5379,6 +5555,7 @@ async function initDrawElementOrTransparentBackground(session, page, logInitPhas
5379
5555
  );
5380
5556
  }
5381
5557
  await armStaticDedup(session, page, logInitPhase);
5558
+ for (const f of session.deRiskFrames ?? []) session.staticFrames?.delete(f);
5382
5559
  if (!session.onBeforeCapture && !forceDE) {
5383
5560
  const hasVideos = await page.evaluate(() => document.querySelector("video") !== null);
5384
5561
  if (hasVideos) {
@@ -5393,6 +5570,52 @@ async function initDrawElementOrTransparentBackground(session, page, logInitPhas
5393
5570
  await initTransparentBackground(session.page);
5394
5571
  }
5395
5572
  }
5573
+ function drawElementWorkerEncodeEligible(session, transparent) {
5574
+ return (session.config?.enableDrawElementWorkerEncode ?? false) && !transparent && session.beginFrameTimeTicks === 0;
5575
+ }
5576
+ async function cssEffectRiskFrames(session, totalFrames) {
5577
+ let scratch = null;
5578
+ try {
5579
+ scratch = await createCaptureSession(
5580
+ session.serverUrl,
5581
+ session.outputDir,
5582
+ { ...session.options, onMemorySample: void 0 },
5583
+ null,
5584
+ {
5585
+ ...session.config,
5586
+ useDrawElement: false,
5587
+ staticFrameDedup: false,
5588
+ enableBrowserPool: false
5589
+ }
5590
+ );
5591
+ await initializeSession(scratch);
5592
+ const scan = await scanCssEffects(scratch.page, true);
5593
+ if (!scan.reason || !scan.bounded) return null;
5594
+ const fps = fpsToNumber(session.options.fps);
5595
+ const live = await scanCssEffectLiveFrames(
5596
+ scratch.page,
5597
+ fps,
5598
+ totalFrames,
5599
+ totalFrames * MAX_RISK_FRAME_FRACTION
5600
+ );
5601
+ return live && withFramesAfterCallback(live, scan.callbackFrom, fps, totalFrames);
5602
+ } catch (error) {
5603
+ console.log(
5604
+ `[engine] fast capture: effect scan failed (${error instanceof Error ? error.message : String(error)})`
5605
+ );
5606
+ return null;
5607
+ } finally {
5608
+ if (scratch) await closeCaptureSession(scratch).catch(() => {
5609
+ });
5610
+ }
5611
+ }
5612
+ async function renderFrameCount(session, page) {
5613
+ const duration = session.options.compositionDurationSeconds ?? await page.evaluate(
5614
+ () => window.__hf?.duration ?? 0
5615
+ );
5616
+ const total = Math.ceil(duration * fpsToNumber(session.options.fps));
5617
+ return isStaticDedupFrameAnalysisSafe(total) ? total : 0;
5618
+ }
5396
5619
  async function finalizeDrawElementInit(session, page, logInitPhase, opts) {
5397
5620
  const { transparent, forceDE } = opts;
5398
5621
  await decodeDynamicCssBackgroundImages(page);
@@ -5416,7 +5639,7 @@ async function finalizeDrawElementInit(session, page, logInitPhase, opts) {
5416
5639
  logInitPhase(`screenshot fallback: ${boundaryFrames.size} clip-boundary frame(s)`);
5417
5640
  }
5418
5641
  }
5419
- const workerEncodeEnabled = (session.config?.enableDrawElementWorkerEncode ?? false) && !transparent && session.beginFrameTimeTicks === 0;
5642
+ const workerEncodeEnabled = drawElementWorkerEncodeEligible(session, transparent);
5420
5643
  if (workerEncodeEnabled) {
5421
5644
  await initDrawElementWorkerEncode(page);
5422
5645
  session.workerEncodeEnabled = true;
@@ -5433,6 +5656,16 @@ async function completeDeferredDrawElementInit(session) {
5433
5656
  });
5434
5657
  session.deInitDeferred = false;
5435
5658
  }
5659
+ async function installMediaPageHooks(page, options) {
5660
+ await installMediaRenderIdBridge(page);
5661
+ if (options.skipReadinessVideoIds?.length) {
5662
+ await page.evaluateOnNewDocument(
5663
+ holdRenderFrameVideos,
5664
+ options.skipReadinessVideoIds,
5665
+ MEDIA_RENDER_ID_ATTR
5666
+ );
5667
+ }
5668
+ }
5436
5669
  async function createCaptureSession(serverUrl, outputDir, options, onBeforeCapture = null, config) {
5437
5670
  if (!existsSync3(outputDir)) mkdirSync(outputDir, { recursive: true });
5438
5671
  const headlessShell = resolveHeadlessShellPath(config);
@@ -5544,14 +5777,7 @@ async function constructCaptureSession(input) {
5544
5777
  w.__name = (fn, _name) => fn;
5545
5778
  }
5546
5779
  });
5547
- await installMediaRenderIdBridge(page);
5548
- if (options.skipReadinessVideoIds?.length) {
5549
- await page.evaluateOnNewDocument(
5550
- holdRenderFrameVideos,
5551
- options.skipReadinessVideoIds,
5552
- MEDIA_RENDER_ID_ATTR
5553
- );
5554
- }
5780
+ await installMediaPageHooks(page, options);
5555
5781
  if (useDrawElement) {
5556
5782
  await page.evaluateOnNewDocument(instrumentAcceleratedCanvases);
5557
5783
  }
@@ -6157,6 +6383,13 @@ function recordConsoleScriptError(session, error) {
6157
6383
  const message = new VfxFailureError(error).message;
6158
6384
  recordCaptureWarnings(session, [{ code: "vfx_failure", message, details: { sources: [error] } }]);
6159
6385
  }
6386
+ function loggedEarlierInRender(session, text) {
6387
+ if (!text.startsWith(SCENE_CALLBACK_ERROR_PREFIX)) return false;
6388
+ const logged = session.subTimelineWaitMemo.loggedSceneCallbackErrors ??= [];
6389
+ if (logged.includes(text)) return true;
6390
+ logged.push(text);
6391
+ return false;
6392
+ }
6160
6393
  function recordPageError(session, error) {
6161
6394
  if (error && !session.pageErrors.includes(error)) session.pageErrors.push(error);
6162
6395
  }
@@ -6199,7 +6432,9 @@ async function initializeSession(session) {
6199
6432
  const text = msg.text();
6200
6433
  const locationUrl = msg.location()?.url ?? "";
6201
6434
  const diagnostic = formatConsoleDiagnostic(type, text, locationUrl);
6202
- if (!diagnostic.suppressHostLog) console.log(diagnostic.text);
6435
+ if (!diagnostic.suppressHostLog && !loggedEarlierInRender(session, text)) {
6436
+ console.log(diagnostic.text);
6437
+ }
6203
6438
  appendBrowserDiagnostic(session, diagnostic.text);
6204
6439
  const scriptFailure = classifyConsoleScriptFailure(type, text);
6205
6440
  if (scriptFailure) recordScriptLoadFailure(session, scriptFailure);
@@ -6814,6 +7049,7 @@ async function createStaticVerificationPage(session) {
6814
7049
  w.__name = (fn, _name) => fn;
6815
7050
  }
6816
7051
  });
7052
+ await installMediaPageHooks(page, session.options);
6817
7053
  if (session.options.variables && Object.keys(session.options.variables).length > 0) {
6818
7054
  const variablesJson = JSON.stringify(session.options.variables);
6819
7055
  await page.evaluateOnNewDocument((json) => {
@@ -7171,6 +7407,14 @@ async function redrawDrawElementFrame(session, frameIndex, time, seekOptions, he
7171
7407
  true
7172
7408
  );
7173
7409
  }
7410
+ function assertNotRiskFrame(session, frameIndex) {
7411
+ if (session.deRiskFrames?.has(frameIndex)) {
7412
+ throw new DrawElementCaptureError(
7413
+ frameIndex,
7414
+ "frame needs screenshot capture, which this capture path cannot hand over"
7415
+ );
7416
+ }
7417
+ }
7174
7418
  async function captureFrameSurface(session, frameIndex, time, seekOptions, heldVideoTime) {
7175
7419
  const { page, options } = session;
7176
7420
  const { quantizedTime, seekMs, beforeCaptureMs } = await prepareFrameForCapture(
@@ -7208,6 +7452,7 @@ async function captureFrameSurface(session, frameIndex, time, seekOptions, heldV
7208
7452
  "boundary screenshot requested on an injected canvas page"
7209
7453
  );
7210
7454
  } else if (session.captureMode === "drawelement") {
7455
+ assertNotRiskFrame(session, frameIndex);
7211
7456
  if (session.beginFrameTimeTicks > 0) {
7212
7457
  const client = await getCdpSession(page);
7213
7458
  await client.send("HeadlessExperimental.beginFrame", {
@@ -7453,6 +7698,7 @@ async function captureFrameToBuffer(session, frameIndex, time) {
7453
7698
  async function captureFrameToBufferPipelined(session, frameIndex, time) {
7454
7699
  const { page, options } = session;
7455
7700
  const startTime = Date.now();
7701
+ assertNotRiskFrame(session, frameIndex);
7456
7702
  if (session.staticFrames?.has(frameIndex) && session.lastEncodeResult) {
7457
7703
  const lastIdx = session.lastEncodeResultFrame ?? frameIndex - 1;
7458
7704
  let gapStatic = true;
@@ -7539,6 +7785,7 @@ async function captureFramesBatchPipelined(session, frameIndices, times) {
7539
7785
  throw new Error("[FrameCapture] Session not initialized");
7540
7786
  }
7541
7787
  assertVfxIntact(session);
7788
+ for (const frameIndex of frameIndices) assertNotRiskFrame(session, frameIndex);
7542
7789
  const startTime = Date.now();
7543
7790
  const fps = fpsToNumber(options.fps);
7544
7791
  const quantized = times.map((t) => quantizeTimeToFrame(t, fps));
@@ -7685,6 +7932,16 @@ function computeDeVerifySampleFractions(k) {
7685
7932
  if (k === 1) return [0.95];
7686
7933
  return [...Array.from({ length: k - 1 }, (_, i) => (i + 1) / k), 0.95];
7687
7934
  }
7935
+ async function seekDeVerifyTruth(page, t, suppressEvents) {
7936
+ await page.evaluate(
7937
+ (tt, suppress) => {
7938
+ const hf = window.__hf;
7939
+ if (hf && typeof hf.seek === "function") hf.seek(tt, { suppressEvents: suppress });
7940
+ },
7941
+ t,
7942
+ suppressEvents
7943
+ );
7944
+ }
7688
7945
  async function captureDeVerificationFrames(session, page, logInitPhase) {
7689
7946
  const kRaw = Number(process.env.HF_DE_VERIFY ?? session.options.deVerifySamples ?? "4");
7690
7947
  const k = Number.isFinite(kRaw) ? Math.max(0, Math.min(8, Math.floor(kRaw))) : 4;
@@ -7709,28 +7966,37 @@ async function captureDeVerificationFrames(session, page, logInitPhase) {
7709
7966
  }
7710
7967
  const boundary = await computeClipBoundaryFrames(page, fps);
7711
7968
  const fractions = computeDeVerifySampleFractions(k);
7712
- const seekTo = async (t) => {
7713
- await page.evaluate((tt) => {
7714
- const hf = window.__hf;
7715
- if (hf && typeof hf.seek === "function") hf.seek(tt, { suppressEvents: true });
7716
- }, t);
7717
- };
7718
- await seekTo(quantizeTimeToFrame(0, fps));
7719
- await pageScreenshotCapture(page, session.options);
7969
+ const truthInjector = session.onBeforeCapture?.fresh?.() ?? null;
7970
+ const disposable = session.onBeforeCapture && truthInjector === null ? null : await createStaticVerificationPage(session).catch(() => {
7971
+ logInitPhase("self-verify truth page unavailable; reading it on the render page");
7972
+ return null;
7973
+ });
7974
+ const isolated = disposable !== null;
7975
+ const truthPage = disposable ?? page;
7976
+ const injectFrames = isolated ? truthInjector ?? session.onBeforeCapture : session.onBeforeCapture;
7977
+ const seekTo = (t) => seekDeVerifyTruth(truthPage, t, !isolated);
7720
7978
  const frames = /* @__PURE__ */ new Map();
7721
- for (const f of fractions) {
7722
- let idx = Math.min(totalFrames - 1, Math.max(1, Math.round(totalFrames * f)));
7723
- let guard = 0;
7724
- while (boundary.has(idx) && guard++ < 6) idx = Math.min(totalFrames - 1, idx + 2);
7725
- if (boundary.has(idx)) continue;
7726
- if (frames.has(idx)) continue;
7727
- const t = quantizeTimeToFrame(idx / fps, fps);
7728
- await seekTo(t);
7729
- if (session.onBeforeCapture) await session.onBeforeCapture(page, t);
7730
- await pageScreenshotCapture(page, session.options);
7731
- frames.set(idx, await pageScreenshotCapture(page, session.options));
7732
- }
7733
- await seekTo(quantizeTimeToFrame(0, fps));
7979
+ try {
7980
+ await seekTo(quantizeTimeToFrame(0, fps));
7981
+ await pageScreenshotCapture(truthPage, session.options);
7982
+ for (const f of fractions) {
7983
+ let idx = Math.min(totalFrames - 1, Math.max(1, Math.round(totalFrames * f)));
7984
+ let guard = 0;
7985
+ const skip = (i) => boundary.has(i) || session.deRiskFrames?.has(i) === true;
7986
+ while (skip(idx) && guard++ < 6) idx = Math.min(totalFrames - 1, idx + 2);
7987
+ if (skip(idx)) continue;
7988
+ if (frames.has(idx)) continue;
7989
+ const t = quantizeTimeToFrame(idx / fps, fps);
7990
+ await seekTo(t);
7991
+ await injectFrames?.(truthPage, t);
7992
+ await pageScreenshotCapture(truthPage, session.options);
7993
+ frames.set(idx, await pageScreenshotCapture(truthPage, session.options));
7994
+ }
7995
+ if (!isolated) await seekTo(quantizeTimeToFrame(0, fps));
7996
+ } finally {
7997
+ if (isolated) await truthPage.close().catch(() => {
7998
+ });
7999
+ }
7734
8000
  session.deVerifyFrames = frames;
7735
8001
  logInitPhase(
7736
8002
  `drawElement self-verify armed: ${frames.size} ground-truth frame(s) @ [${[...frames.keys()].join(", ")}] of ${totalFrames}`
@@ -7800,6 +8066,7 @@ function getCapturePerfSummary(session) {
7800
8066
  deVerifyArmed: session.deVerifyFrames?.size ?? 0,
7801
8067
  deVerifyInitMs: session.deVerifyInitMs ?? 0,
7802
8068
  deBoundaryFrames: session.clipBoundaryFrames?.size ?? 0,
8069
+ deRiskFrames: session.deRiskFrames?.size ?? 0,
7803
8070
  deNcprFallbacks: ncprFallbacks,
7804
8071
  deFrameTimeouts: session.deFrameTimeouts ?? 0
7805
8072
  };
@@ -13931,7 +14198,7 @@ function createVideoFrameInjector(frameLookup, config) {
13931
14198
  touchCacheDir(cacheDir);
13932
14199
  lastCacheTouchByDir.set(cacheDir, now);
13933
14200
  }
13934
- return async (page, time, heldVideoTime) => {
14201
+ const inject = async (page, time, heldVideoTime) => {
13935
14202
  for (const cacheDir of frameLookup.frameDirs()) renewCacheLease(cacheDir);
13936
14203
  const activePayloads = frameLookup.getActiveFramePayloads(time);
13937
14204
  if (heldVideoTime !== void 0) {
@@ -13978,6 +14245,7 @@ function createVideoFrameInjector(frameLookup, config) {
13978
14245
  }
13979
14246
  }
13980
14247
  };
14248
+ return Object.assign(inject, { fresh: () => createVideoFrameInjector(frameLookup, config) });
13981
14249
  }
13982
14250
  async function hideVideoElements(page, videoIds) {
13983
14251
  await setVideoElementsVisibility(page, videoIds, false);
@@ -17453,7 +17721,11 @@ async function executeParallelCapture(serverUrl, workDir, tasks, captureOptions,
17453
17721
  captureOptions.deVerifySamples,
17454
17722
  tasks.length
17455
17723
  );
17456
- const workerCaptureOptions = deVerifySamples === captureOptions.deVerifySamples ? captureOptions : { ...captureOptions, deVerifySamples };
17724
+ const workerCaptureOptions = {
17725
+ ...captureOptions,
17726
+ deVerifySamples,
17727
+ deFrameFallback: false
17728
+ };
17457
17729
  const peerController = new AbortController();
17458
17730
  const workerSignal = signal ? AbortSignal.any([signal, peerController.signal]) : peerController.signal;
17459
17731
  const failureHandler = createPoolFailureHandler({