hyperframes 0.8.142 → 0.8.143

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 (189) hide show
  1. package/dist/{add-YS2RCWEK.js → add-Q5EYDUAY.js} +18 -17
  2. package/dist/{animatedGifPrep-SAMCDT7T.js → animatedGifPrep-H2DUQEZ3.js} +15 -14
  3. package/dist/{asset-BLWC2NWB.js → asset-C7JBYYX4.js} +4 -4
  4. package/dist/{assetCataloger-FVNBBRP3.js → assetCataloger-FRO4G6OU.js} +8 -7
  5. package/dist/{auth-DRZB7OAC.js → auth-FRWLCO36.js} +1 -1
  6. package/dist/{autoUpdate-I5I3BOJK.js → autoUpdate-E4OZXQK6.js} +2 -2
  7. package/dist/{backgroundChecks-VR2QHGNY.js → backgroundChecks-FSUVHN5L.js} +3 -3
  8. package/dist/backgroundChecksWorker.js +3 -3
  9. package/dist/{batchRender-4YUHQI6X.js → batchRender-4U73BYTU.js} +11 -10
  10. package/dist/{beats-7OT7ALV3.js → beats-U6KJWF35.js} +32 -27
  11. package/dist/{benchmark-Q2XQCRTR.js → benchmark-5ONT7V7B.js} +15 -14
  12. package/dist/{browser-7VAWQQZC.js → browser-R4DU46IE.js} +4 -4
  13. package/dist/{bundleWithLocalizedFonts-DDMLLL2R.js → bundleWithLocalizedFonts-VH55VOAL.js} +2 -2
  14. package/dist/{capture-HEJS6M5A.js → capture-26G2DPSI.js} +18 -17
  15. package/dist/{capture-U7ABPKS5.js → capture-OGQAEYKO.js} +2 -2
  16. package/dist/{catalog-DVJ3XPDN.js → catalog-RKORTIUE.js} +19 -18
  17. package/dist/{catch-up-DF6AVSN2.js → catch-up-4OBERRQO.js} +5 -5
  18. package/dist/{check-KXORRWAE.js → check-P2XDN57S.js} +43 -42
  19. package/dist/{checkBrowser-J7HZJTRH.js → checkBrowser-NTGJGAEA.js} +42 -41
  20. package/dist/{chunk-EFDXGAAD.js → chunk-2LBBHMKT.js} +1 -1
  21. package/dist/{chunk-IDX52YJN.js → chunk-33RZPZ4K.js} +189 -42
  22. package/dist/{chunk-JU6Y5TTZ.js → chunk-3NE7ZYU2.js} +2 -2
  23. package/dist/{chunk-TQFG7HTI.js → chunk-3RM2ETQT.js} +0 -168
  24. package/dist/{chunk-PFCFR3KZ.js → chunk-442JNXRM.js} +1 -1
  25. package/dist/{chunk-YFT3BL7N.js → chunk-4M4EC7JX.js} +19 -12
  26. package/dist/{chunk-AM5L5YIA.js → chunk-4OA4LDTU.js} +1 -1
  27. package/dist/{chunk-LQASVU3I.js → chunk-5FISWJ37.js} +12 -4
  28. package/dist/{chunk-JYYOAKHS.js → chunk-6IIGT7BX.js} +1 -1
  29. package/dist/chunk-6TPZSTCL.js +3681 -0
  30. package/dist/{chunk-QGRFOOLE.js → chunk-6XMFEICO.js} +263 -75
  31. package/dist/{chunk-YHRZQJXH.js → chunk-7UYBQ6NF.js} +260 -67
  32. package/dist/{chunk-U7E736AJ.js → chunk-BFDJ63J5.js} +32 -14
  33. package/dist/{chunk-WCJGTLPF.js → chunk-BHVFTYSI.js} +6 -3
  34. package/dist/{chunk-B6SMSALD.js → chunk-BT27OYYX.js} +9 -9
  35. package/dist/{chunk-IXCTG2WY.js → chunk-BYK73CR7.js} +4 -4
  36. package/dist/{chunk-75JJVANE.js → chunk-CLOH4LIB.js} +3 -3
  37. package/dist/{chunk-H2X52H2N.js → chunk-DF2BHILQ.js} +3 -3
  38. package/dist/{chunk-DPHJKWP5.js → chunk-F26LCYRY.js} +42 -34
  39. package/dist/{chunk-5Z63TBTX.js → chunk-FH7WODJH.js} +1 -1
  40. package/dist/{chunk-LTGGTEMA.js → chunk-FVYXDXEV.js} +2 -2
  41. package/dist/{chunk-KYN364DU.js → chunk-GNBGPUJ7.js} +6 -8
  42. package/dist/{chunk-RVCWIIZ7.js → chunk-GV5R5B7Q.js} +1 -1
  43. package/dist/{chunk-FZK35GT4.js → chunk-HC7EVDEL.js} +1 -1
  44. package/dist/{chunk-MVTUV4TP.js → chunk-HLYOEIWM.js} +14 -6
  45. package/dist/{chunk-WSGY5CDQ.js → chunk-HMT2RPZU.js} +6 -6
  46. package/dist/{chunk-JOTLPC6S.js → chunk-HW4AKJ5F.js} +1 -1
  47. package/dist/{chunk-IMY4QQTQ.js → chunk-I7QGQAZM.js} +8 -8
  48. package/dist/{chunk-JFKL3WAE.js → chunk-IWFLMU2N.js} +104 -19
  49. package/dist/{chunk-IHFUKJOR.js → chunk-K2FLNJVB.js} +8 -2
  50. package/dist/chunk-KJJLA674.js +121 -0
  51. package/dist/{chunk-BPZVDBHY.js → chunk-KO5QBV73.js} +1 -1
  52. package/dist/{chunk-WGVOWWVK.js → chunk-KQLGTGE5.js} +3 -3
  53. package/dist/{chunk-R2JEKLDZ.js → chunk-LVX6NK36.js} +3 -3
  54. package/dist/{chunk-6UYZB4TY.js → chunk-LW6HO6U3.js} +4 -4
  55. package/dist/{chunk-OZUQF4NB.js → chunk-MQZVBHEY.js} +123 -8
  56. package/dist/{chunk-7FCDA4RH.js → chunk-N3DQEVSI.js} +2 -2
  57. package/dist/{chunk-A4KQZXZI.js → chunk-NE55C6S5.js} +4 -2
  58. package/dist/{chunk-6RAD4BCC.js → chunk-OBXQRJWQ.js} +2 -2
  59. package/dist/{chunk-LBKDQKWV.js → chunk-OSSHSIMD.js} +1 -1
  60. package/dist/{chunk-TY6XOHEM.js → chunk-P7THMINS.js} +3 -3
  61. package/dist/{chunk-HMUF7FEO.js → chunk-PAGIICKN.js} +2 -2
  62. package/dist/{chunk-OSUKETIH.js → chunk-PJU63L6W.js} +1 -1
  63. package/dist/{chunk-GYE63V4P.js → chunk-POLR33RB.js} +20 -13
  64. package/dist/{chunk-7M4KAPAA.js → chunk-PUGIRFPX.js} +2 -2
  65. package/dist/{chunk-XGMNQQTJ.js → chunk-QFN7NVWM.js} +1 -1
  66. package/dist/{chunk-D2KNWIQ6.js → chunk-QFSCCQIR.js} +1 -1
  67. package/dist/{chunk-WTMUCJ6Z.js → chunk-QRKLPWEX.js} +1 -1
  68. package/dist/{chunk-XTLBLWOV.js → chunk-QVYVUCWD.js} +1 -1
  69. package/dist/{chunk-GK4AIFIH.js → chunk-SDYDNHEE.js} +34 -3
  70. package/dist/{chunk-2NCHQUPX.js → chunk-SQLK7SJL.js} +1 -1
  71. package/dist/{chunk-PMRBLBUP.js → chunk-T42U2W2R.js} +14 -2
  72. package/dist/{chunk-QXPCARFE.js → chunk-TAMQYQGJ.js} +1 -1
  73. package/dist/{chunk-PXSM4HPB.js → chunk-U3X3TPBW.js} +1 -1
  74. package/dist/{chunk-FWRNQOLT.js → chunk-UICWP23D.js} +1 -1
  75. package/dist/{chunk-OKCR3JTO.js → chunk-UM2GRYM3.js} +13 -10
  76. package/dist/{chunk-LJAU4TPS.js → chunk-VIVBA6E6.js} +2 -2
  77. package/dist/{chunk-DZEVA7DI.js → chunk-W35EKBS6.js} +2 -2
  78. package/dist/{chunk-YEIFI443.js → chunk-WPNE5NEP.js} +1 -1
  79. package/dist/{chunk-IW2CKH6A.js → chunk-XONFUK3M.js} +48 -25
  80. package/dist/{chunk-JLKMWY2T.js → chunk-Y6QL2LGO.js} +8 -5
  81. package/dist/{chunk-THXFSPLV.js → chunk-ZIRIDSDB.js} +1 -1
  82. package/dist/chunk-ZLW2V65P.js +209 -0
  83. package/dist/{chunk-6UM3R7PP.js → chunk-ZQQ3SEIE.js} +33 -32
  84. package/dist/{clean-KTHTV5G5.js → clean-YHGPY33K.js} +23 -22
  85. package/dist/cli.js +57 -159
  86. package/dist/{cloud-ARSZWALC.js → cloud-DOFI5ISR.js} +4 -4
  87. package/dist/{cloudrun-NM7RXOCL.js → cloudrun-KTZ4XDHL.js} +13 -12
  88. package/dist/commands/contrast-audit.browser.js +60 -4
  89. package/dist/commands/layout-audit.browser.js +68 -0
  90. package/dist/{compare-CY4UO3RW.js → compare-SMMIZN2C.js} +37 -36
  91. package/dist/{compiler-VTH2D3ID.js → compiler-TEXQWW6N.js} +14 -10
  92. package/dist/{component-FRUIAXIR.js → component-B3GCNGSS.js} +5 -5
  93. package/dist/{compositions-CUSY6ZYY.js → compositions-OQNZZTKF.js} +38 -33
  94. package/dist/{delete-KT3VHP4L.js → delete-EL5LVSEP.js} +4 -4
  95. package/dist/{deterministicFonts-F6WIVL2W.js → deterministicFonts-U2BIMGPG.js} +3 -3
  96. package/dist/{dist-7SZU7MA7.js → dist-5UVIRMSM.js} +7 -6
  97. package/dist/{dist-2GC6XKRQ.js → dist-XN234YFQ.js} +41 -39
  98. package/dist/{doctor-4ROTBL5U.js → doctor-UOL3OI2A.js} +17 -16
  99. package/dist/{dom-IROKGVJI.js → dom-37K6YOH4.js} +2 -2
  100. package/dist/{events-Q5PXT5UC.js → events-K2DB2PBC.js} +2 -2
  101. package/dist/{events-QJDVMKSR.js → events-NIZBS6S7.js} +3 -3
  102. package/dist/{feedback-PQ7TWESA.js → feedback-QMP4E6L7.js} +13 -12
  103. package/dist/{figma-JN5DDBDS.js → figma-2AUJRNVC.js} +3 -3
  104. package/dist/fontLocalizeCli.js +18 -17
  105. package/dist/{get-KT6OTERO.js → get-P5NC7SRM.js} +4 -4
  106. package/dist/{gpuPolicy-LCBWVGEH.js → gpuPolicy-7N5MCE2G.js} +15 -14
  107. package/dist/{grade-compare-VS3RP73G.js → grade-compare-HV5AFZ6P.js} +37 -36
  108. package/dist/{help-AD6FIZIO.js → help-3TSTXBLN.js} +1 -1
  109. package/dist/{history-ZRWYRY7R.js → history-D65XFJ6D.js} +6 -6
  110. package/dist/hyperframe-runtime.js +25 -25
  111. package/dist/hyperframe.manifest.json +1 -1
  112. package/dist/hyperframe.runtime.iife.js +25 -25
  113. package/dist/hyperframes-player.global.js +3 -3
  114. package/dist/hyperframes-slideshow.global.js +23 -23
  115. package/dist/{info-WBBQA2AX.js → info-TXV7MLFO.js} +17 -16
  116. package/dist/{init-A2XBDFGF.js → init-OSDMJZJV.js} +38 -37
  117. package/dist/{inspect-CLTZHA5O.js → inspect-RQQSAYIJ.js} +38 -37
  118. package/dist/{installer-WQDRVXH4.js → installer-CDOB32HE.js} +11 -10
  119. package/dist/{keyframes-3FYOK6H6.js → keyframes-V75Q6GRM.js} +10 -10
  120. package/dist/{lambda-Y2PA2BGS.js → lambda-RODV4RCX.js} +12 -11
  121. package/dist/{layout-4KP5O7IJ.js → layout-IZAI5SFC.js} +38 -37
  122. package/dist/{lint-V4GRFHOJ.js → lint-PLXOXY5R.js} +14 -13
  123. package/dist/{lintProject-RG2KGAXB.js → lintProject-OQ6H6XBR.js} +7 -6
  124. package/dist/{list-OQ4VED6E.js → list-BQBPNKDZ.js} +5 -5
  125. package/dist/{login-W47NKN5S.js → login-NP6F4FHC.js} +4 -4
  126. package/dist/{manager-DXB7JDHU.js → manager-GXYF4AVO.js} +2 -2
  127. package/dist/{manager-524RPYO7.js → manager-RFZNG5YT.js} +2 -2
  128. package/dist/{media-treatment-HJYL3EME.js → media-treatment-PXGMZ4A4.js} +22 -20
  129. package/dist/{models-DYBAD2GQ.js → models-CEZM6XZ7.js} +17 -16
  130. package/dist/{motionShot-7NE2YBB3.js → motionShot-R4GHYWYM.js} +25 -24
  131. package/dist/{normalize-IGLHCWTF.js → normalize-H6KUHHEI.js} +18 -7
  132. package/dist/{normalize-audio-INKCLMS2.js → normalize-audio-MQ7NFCOV.js} +10 -6
  133. package/dist/{open-TYC5THVY.js → open-AKQTGNXF.js} +5 -5
  134. package/dist/{pipeline-EVKEPQEW.js → pipeline-SYJYP2RM.js} +17 -16
  135. package/dist/{play-QMZEM6X3.js → play-NBH4B7PL.js} +31 -29
  136. package/dist/{present-Y7IK3C4W.js → present-XAX55CFS.js} +26 -25
  137. package/dist/{preview-5OQRYE6A.js → preview-OLANKNFA.js} +26 -25
  138. package/dist/{producer-Q6G6JU7B.js → producer-Q6YNZZUJ.js} +1 -1
  139. package/dist/{projectConfig-RJN3DKDB.js → projectConfig-EM26P45P.js} +13 -12
  140. package/dist/{publication-QCPGGN3U.js → publication-OXWJZKSX.js} +8 -7
  141. package/dist/{publish-VZLFIGYY.js → publish-4VBWP2UB.js} +17 -16
  142. package/dist/{remove-background-TKOEHBA5.js → remove-background-REB7427G.js} +19 -18
  143. package/dist/{render-XTXE5CRU.js → render-3CVZ2SZG.js} +13 -12
  144. package/dist/{render-KIIIF6PS.js → render-K25YOG3M.js} +19 -18
  145. package/dist/{render-X3NFNVEQ.js → render-TSE75QUL.js} +35 -34
  146. package/dist/{render-batch-M55YZLZ5.js → render-batch-GGUOK3DS.js} +13 -12
  147. package/dist/{renderCancellation-X5BEHAZU.js → renderCancellation-PZRWB53I.js} +15 -14
  148. package/dist/renderSetupWorker.js +7 -6
  149. package/dist/{resolver-GAMXRA42.js → resolver-S5VK6UCB.js} +10 -9
  150. package/dist/{sherpa-ZYTNFHD5.js → sherpa-LVIUEAGF.js} +18 -17
  151. package/dist/skills/hyperframes-cli/references/doctor-browser.md +24 -1
  152. package/dist/skills/media-use/scripts/lib/cache.mjs +28 -14
  153. package/dist/skills/media-use/scripts/lib/cache.test.mjs +110 -0
  154. package/dist/skills/media-use/scripts/lib/duck.mjs +2 -1
  155. package/dist/skills/media-use/scripts/lib/duck.test.mjs +87 -0
  156. package/dist/skills/media-use/scripts/lib/probe.mjs +6 -1
  157. package/dist/skills/media-use/scripts/lib/probe.test.mjs +73 -0
  158. package/dist/skills/media-use/scripts/lib/words.mjs +1 -1
  159. package/dist/{skills-CZHVAD3J.js → skills-I65FU5HD.js} +5 -5
  160. package/dist/{skillsUpdateCheck-6WLLX53A.js → skillsUpdateCheck-J57RNNIV.js} +3 -3
  161. package/dist/{slideshow-EJ4IMY6P.js → slideshow-4OJEPWNZ.js} +1 -1
  162. package/dist/{snapshot-K7BTJPYQ.js → snapshot-YROOGY22.js} +42 -38
  163. package/dist/{src-3I3RH3V5.js → src-JO5JOV7Y.js} +16 -13
  164. package/dist/{src-YUW26JU5.js → src-X426BZAG.js} +17 -16
  165. package/dist/{staticProjectServer-IKCSGN2B.js → staticProjectServer-5VMBS262.js} +23 -22
  166. package/dist/studio/assets/{hyperframes-player-sAsRuV73.js → hyperframes-player-BXSuksFh.js} +3 -3
  167. package/dist/studio/assets/{index-D3Vij9t1.js → index-BgOVCqjo.js} +1 -1
  168. package/dist/studio/assets/{index-D5q2_7Gw.js → index-FgyO_5Kv.js} +1 -1
  169. package/dist/studio/assets/{index-B-wffzRH.js → index-J7jpL4pj.js} +150 -150
  170. package/dist/studio/index.html +1 -1
  171. package/dist/studio/index.js +122 -160
  172. package/dist/studio/index.js.map +1 -1
  173. package/dist/{studio-api-SQ3NXFSM.js → studio-api-VRBZUGAE.js} +22 -17
  174. package/dist/{studioServer-VVEO7XCH.js → studioServer-DBNKZ6I6.js} +50 -49
  175. package/dist/{synthesize-77PTU6C5.js → synthesize-C3IWDAXF.js} +2 -2
  176. package/dist/{telemetry-FQDKR5XA.js → telemetry-CXAX3TO3.js} +3 -3
  177. package/dist/{timeline-N6ZASFNE.js → timeline-VQ34WH7J.js} +91 -69
  178. package/dist/{tokens-2OIIBBCW.js → tokens-62R7VFAZ.js} +4 -4
  179. package/dist/{transcribe-4F6MK73N.js → transcribe-7KR7IPJA.js} +18 -17
  180. package/dist/{transcribe-7YTUCXDX.js → transcribe-XOHPPL2O.js} +11 -11
  181. package/dist/{tts-TOHSPWEG.js → tts-MUV42JXT.js} +6 -6
  182. package/dist/{updateCheck-AZ2COZFR.js → updateCheck-POYNH3B5.js} +2 -2
  183. package/dist/{upgrade-QAJEYB4X.js → upgrade-NBNOT7J2.js} +2 -2
  184. package/dist/{urlDownloader-LSMFEO3R.js → urlDownloader-3NS63A7B.js} +14 -13
  185. package/dist/{validate-GW5MDL36.js → validate-Y2QDHAEP.js} +40 -27
  186. package/dist/{video-PRNOKUK3.js → video-SJDMTSTL.js} +15 -14
  187. package/package.json +1 -1
  188. package/dist/chunk-J4UX3RS3.js +0 -3717
  189. /package/dist/{chunk-HBBJFK6I.js → chunk-APDLWWFG.js} +0 -0
@@ -26,7 +26,7 @@ import {
26
26
  renderFrameIdForRenderId,
27
27
  resolveAuthoredTimingWindow,
28
28
  toFps
29
- } from "./chunk-YFT3BL7N.js";
29
+ } from "./chunk-4M4EC7JX.js";
30
30
  import {
31
31
  AUDIO_GROUP_RENDER_ID_ATTR,
32
32
  COLOR_GRADING_SOURCE_HIDDEN_ATTR,
@@ -55,7 +55,7 @@ import {
55
55
  shiftRateLane,
56
56
  sourceTimeAt,
57
57
  timeAtSourceTime
58
- } from "./chunk-J4UX3RS3.js";
58
+ } from "./chunk-6TPZSTCL.js";
59
59
  import {
60
60
  clampAudioGain,
61
61
  isAudibleVideoElement
@@ -70,7 +70,7 @@ import {
70
70
  import {
71
71
  isWithinProjectRoot,
72
72
  resolveProjectRelativeSrc
73
- } from "./chunk-JFKL3WAE.js";
73
+ } from "./chunk-IWFLMU2N.js";
74
74
  import {
75
75
  FFMPEG_PATH_ENV,
76
76
  FFPROBE_PATH_ENV,
@@ -79,10 +79,10 @@ import {
79
79
  import {
80
80
  parseNumeric,
81
81
  parseStartExpression
82
- } from "./chunk-TQFG7HTI.js";
82
+ } from "./chunk-3RM2ETQT.js";
83
83
  import {
84
84
  parseHTML
85
- } from "./chunk-GK4AIFIH.js";
85
+ } from "./chunk-SDYDNHEE.js";
86
86
 
87
87
  // ../engine/src/config.ts
88
88
  import { tmpdir } from "os";
@@ -553,6 +553,10 @@ function applyConcreteGpuScreenshotClamp(currentForceScreenshot, resolvedGpuMode
553
553
  });
554
554
  }
555
555
 
556
+ // ../engine/src/utils/sdrCaptureColor.ts
557
+ var SDR_RGB_TO_BT709_FILTER = "scale=out_color_matrix=bt709:out_range=tv:flags=neighbor";
558
+ var SDR_CAPTURE_TO_BT709_FILTER = `scale=in_color_matrix=bt601:in_range=pc:flags=neighbor,format=gbrp,${SDR_RGB_TO_BT709_FILTER}`;
559
+
556
560
  // ../engine/src/services/browserManager.ts
557
561
  import { execSync } from "child_process";
558
562
  import { existsSync, readdirSync } from "fs";
@@ -1959,7 +1963,7 @@ function parseObjectPositionAxis(value, axis) {
1959
1963
  if (lower === "center" || lower === "") return 0.5;
1960
1964
  if (lower.endsWith("%")) {
1961
1965
  const pct = parseFloat(lower) / 100;
1962
- return Number.isFinite(pct) ? Math.max(0, Math.min(1, pct)) : 0.5;
1966
+ return Number.isFinite(pct) ? pct : 0.5;
1963
1967
  }
1964
1968
  if (axis === "x" || axis === "y") return 0.5;
1965
1969
  return 0.5;
@@ -7006,7 +7010,7 @@ async function captureFramesBatchPipelined(session, frameIndices, times) {
7006
7010
  return results;
7007
7011
  }
7008
7012
  async function discardWarmupCapture(session, frameIndex = 0, time = 0, innerCapture = captureFrameCore) {
7009
- const perfBefore = { ...session.capturePerf };
7013
+ const perfBefore = { ...session.capturePerf, frameMs: [...session.capturePerf.frameMs] };
7010
7014
  const hasDamageBefore = session.beginFrameHasDamageCount;
7011
7015
  const noDamageBefore = session.beginFrameNoDamageCount;
7012
7016
  const dedupCountBefore = session.staticDedupCount;
@@ -7661,10 +7665,6 @@ function withEvenDimensionPad(vfChain, pixelFormat, width, height) {
7661
7665
  return vfChain ? `${vfChain},${EVEN_DIMENSION_PAD}` : EVEN_DIMENSION_PAD;
7662
7666
  }
7663
7667
 
7664
- // ../engine/src/utils/sdrCaptureColor.ts
7665
- var SDR_RGB_TO_BT709_FILTER = "scale=out_color_matrix=bt709:out_range=tv:flags=neighbor";
7666
- var SDR_CAPTURE_TO_BT709_FILTER = `scale=in_color_matrix=bt601:in_range=pc:flags=neighbor,format=gbrp,${SDR_RGB_TO_BT709_FILTER}`;
7667
-
7668
7668
  // ../engine/src/utils/runFfmpeg.ts
7669
7669
  import { spawn as spawn2 } from "child_process";
7670
7670
  var FFMPEG_SIGTERM_EXIT_LINE = /^Exiting normally, received signal 15\.?\r?$/m;
@@ -7944,6 +7944,22 @@ function mediaFileIdentity(filePath) {
7944
7944
  return null;
7945
7945
  }
7946
7946
  }
7947
+ function readMetadataCache(cache, key, identity) {
7948
+ const cached = cache.get(key);
7949
+ return cached?.identity === identity ? cached.promise : void 0;
7950
+ }
7951
+ function writeMetadataCache(cache, key, identity, promise) {
7952
+ const entry = { identity, promise };
7953
+ cache.set(key, entry);
7954
+ void promise.then(
7955
+ () => {
7956
+ if (identity === null && cache.get(key) === entry) cache.delete(key);
7957
+ },
7958
+ () => {
7959
+ if (cache.get(key) === entry) cache.delete(key);
7960
+ }
7961
+ );
7962
+ }
7947
7963
  async function probeMediaOutput(filePath, signal) {
7948
7964
  let cache = mediaProbeOutputCache;
7949
7965
  if (signal) {
@@ -8126,7 +8142,8 @@ function parseFrameRate(frameRateStr) {
8126
8142
  return rounded > 0 ? rounded : 0.01;
8127
8143
  }
8128
8144
  async function extractMediaMetadata(filePath) {
8129
- const cached = videoMetadataCache.get(filePath);
8145
+ const identity = mediaFileIdentity(filePath);
8146
+ const cached = readMetadataCache(videoMetadataCache, filePath, identity);
8130
8147
  if (cached) return cached;
8131
8148
  const probePromise = (async () => {
8132
8149
  let stillImageMetaMemo;
@@ -8210,12 +8227,7 @@ async function extractMediaMetadata(filePath) {
8210
8227
  frames
8211
8228
  };
8212
8229
  })();
8213
- videoMetadataCache.set(filePath, probePromise);
8214
- probePromise.catch(() => {
8215
- if (videoMetadataCache.get(filePath) === probePromise) {
8216
- videoMetadataCache.delete(filePath);
8217
- }
8218
- });
8230
+ writeMetadataCache(videoMetadataCache, filePath, identity, probePromise);
8219
8231
  return probePromise;
8220
8232
  }
8221
8233
  function resolveStreamWindow(filePath, metadata) {
@@ -8231,12 +8243,13 @@ async function extractFinalVideoFrameTimestamp(filePath, metadata, signal) {
8231
8243
  videoStreamDurationSeconds: videoDurationSeconds,
8232
8244
  cacheKey
8233
8245
  } = resolveStreamWindow(filePath, metadata);
8246
+ const identity = mediaFileIdentity(filePath);
8234
8247
  let probeCache = finalVideoFrameTimestampCache;
8235
8248
  if (signal) {
8236
8249
  probeCache = finalVideoFrameTimestampSignalCaches.get(signal) ?? /* @__PURE__ */ new Map();
8237
8250
  finalVideoFrameTimestampSignalCaches.set(signal, probeCache);
8238
8251
  }
8239
- const cached = probeCache.get(cacheKey);
8252
+ const cached = readMetadataCache(probeCache, cacheKey, identity);
8240
8253
  if (cached) return cached;
8241
8254
  const probePromise = (async () => {
8242
8255
  if (!(videoDurationSeconds > 0) || !Number.isFinite(videoDurationSeconds)) {
@@ -8271,17 +8284,13 @@ async function extractFinalVideoFrameTimestamp(filePath, metadata, signal) {
8271
8284
  }
8272
8285
  return Math.min(Math.max(timestamp - videoStreamStartSeconds, 0), videoDurationSeconds);
8273
8286
  })();
8274
- probeCache.set(cacheKey, probePromise);
8275
- probePromise.catch(() => {
8276
- if (probeCache.get(cacheKey) === probePromise) {
8277
- probeCache.delete(cacheKey);
8278
- }
8279
- });
8287
+ writeMetadataCache(probeCache, cacheKey, identity, probePromise);
8280
8288
  return probePromise;
8281
8289
  }
8282
8290
  var extractVideoMetadata = extractMediaMetadata;
8283
8291
  async function extractAudioMetadata(filePath, options) {
8284
- const cached = options?.signal ? void 0 : audioMetadataCache.get(filePath);
8292
+ const identity = mediaFileIdentity(filePath);
8293
+ const cached = options?.signal ? void 0 : readMetadataCache(audioMetadataCache, filePath, identity);
8285
8294
  if (cached) return cached;
8286
8295
  const probePromise = (async () => {
8287
8296
  const output = await probeMediaOutput(filePath, options?.signal);
@@ -8326,12 +8335,7 @@ async function extractAudioMetadata(filePath, options) {
8326
8335
  };
8327
8336
  })();
8328
8337
  if (options?.signal) return probePromise;
8329
- audioMetadataCache.set(filePath, probePromise);
8330
- probePromise.catch(() => {
8331
- if (audioMetadataCache.get(filePath) === probePromise) {
8332
- audioMetadataCache.delete(filePath);
8333
- }
8334
- });
8338
+ writeMetadataCache(audioMetadataCache, filePath, identity, probePromise);
8335
8339
  return probePromise;
8336
8340
  }
8337
8341
  var keyframeCache = /* @__PURE__ */ new Map();
@@ -9608,6 +9612,7 @@ function isMemberGroupHidden(groupsById, el) {
9608
9612
  // ../engine/src/services/videoFrameExtractor.ts
9609
9613
  import { copyFileSync as copyFileSync2, existsSync as existsSync8, linkSync as linkSync2, mkdirSync as mkdirSync6, rmSync as rmSync4 } from "fs";
9610
9614
  import { join as join10 } from "path";
9615
+ import { cpus } from "os";
9611
9616
 
9612
9617
  // ../engine/src/services/referenceResolver.ts
9613
9618
  function findReferenceTargetEl(doc, refId) {
@@ -10782,7 +10787,7 @@ function extractedFrameIndex(file, format) {
10782
10787
  }
10783
10788
  return ordinal - 1;
10784
10789
  }
10785
- function framePathsFromDirectory(outputDir, format) {
10790
+ function framePathsFromDirectory(outputDir, format, allowGaps = false) {
10786
10791
  const suffix = `.${format}`;
10787
10792
  const indexed = /* @__PURE__ */ new Map();
10788
10793
  for (const file of readdirSync4(outputDir)) {
@@ -10795,6 +10800,7 @@ function framePathsFromDirectory(outputDir, format) {
10795
10800
  }
10796
10801
  indexed.set(index, join8(outputDir, file));
10797
10802
  }
10803
+ if (allowGaps) return new Map([...indexed].sort(([a], [b]) => a - b));
10798
10804
  const ordered = /* @__PURE__ */ new Map();
10799
10805
  for (let index = 0; index < indexed.size; index += 1) {
10800
10806
  const path = indexed.get(index);
@@ -11465,6 +11471,69 @@ function restoreSourceColourFilter(metadata) {
11465
11471
  ].filter(([, value]) => value && value !== "unknown" && value !== "reserved");
11466
11472
  return tags.length > 0 ? [`setparams=${tags.map(([key, value]) => `${key}=${value}`).join(":")}`] : [];
11467
11473
  }
11474
+ var EXTRACTION_SEGMENT_SECONDS = 120;
11475
+ function splitFrameRanges(ranges, segmentFrames) {
11476
+ const segments = [];
11477
+ for (const range of ranges) {
11478
+ for (let offset = 0; offset < range.frames; offset += segmentFrames) {
11479
+ segments.push({
11480
+ firstFrame: range.firstFrame + offset,
11481
+ frames: Math.min(segmentFrames, range.frames - offset)
11482
+ });
11483
+ }
11484
+ }
11485
+ return segments;
11486
+ }
11487
+ async function runSegmentedExtraction(job) {
11488
+ const { decodeArgs, filterAndEncodeArgs, videoPath, startTime, fps, segments } = job;
11489
+ const segmentCount = segments.length;
11490
+ const failed = new AbortController();
11491
+ const signal = job.runOptions.signal ? AbortSignal.any([job.runOptions.signal, failed.signal]) : failed.signal;
11492
+ const results = [];
11493
+ let next = 0;
11494
+ const worker = async () => {
11495
+ while (next < segmentCount && !signal.aborted) {
11496
+ const index = next++;
11497
+ const { firstFrame, frames } = segments[index];
11498
+ const result = await runFfmpeg(
11499
+ [
11500
+ ...decodeArgs,
11501
+ "-noaccurate_seek",
11502
+ "-ss",
11503
+ String(startTime + firstFrame / fps),
11504
+ "-i",
11505
+ videoPath,
11506
+ // Read one frame past the segment and keep exactly its own frames.
11507
+ "-t",
11508
+ String((frames + 1) / fps),
11509
+ "-frames:v",
11510
+ String(frames),
11511
+ "-start_number",
11512
+ String(firstFrame + 1),
11513
+ ...filterAndEncodeArgs
11514
+ ],
11515
+ { ...job.runOptions, signal }
11516
+ );
11517
+ results[index] = result;
11518
+ if (!result.success) failed.abort();
11519
+ }
11520
+ };
11521
+ const workers = Math.min(segmentCount, Math.max(1, Math.floor(cpus().length / 2)));
11522
+ await Promise.all(Array.from({ length: workers }, worker));
11523
+ const ran = results.filter(Boolean);
11524
+ const failure = ran.find((r) => !r.success && r.terminationReason !== "abort") ?? ran.find((r) => !r.success);
11525
+ if (failure) return failure;
11526
+ if (ran.length < segmentCount) {
11527
+ return {
11528
+ success: false,
11529
+ exitCode: null,
11530
+ stderr: "",
11531
+ durationMs: 0,
11532
+ terminationReason: "abort"
11533
+ };
11534
+ }
11535
+ return ran[ran.length - 1];
11536
+ }
11468
11537
  async function extractVideoFramesRange(videoPath, videoId, startTime, duration, options, signal, config, outputDirOverride) {
11469
11538
  const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
11470
11539
  const { outputDir, quality = 95 } = options;
@@ -11504,6 +11573,9 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
11504
11573
  const toneMappedToSdr = options.toneMapHdrToSdr === true && isHdr && await toneMapsWithZscale();
11505
11574
  const decodeWithVideoToolbox = isHdr && isMacOS && !toneMappedToSdr;
11506
11575
  const sampleCfrAtOutputFps = !options.finalFrameOnly && !metadata.isVFR;
11576
+ if (options.frameRanges && !sampleCfrAtOutputFps) {
11577
+ throw new Error("frameRanges extraction needs a constant-frame-rate source");
11578
+ }
11507
11579
  const args = [];
11508
11580
  if (decodeWithVideoToolbox) {
11509
11581
  args.push("-hwaccel", "videotoolbox");
@@ -11511,6 +11583,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
11511
11583
  if (codecMayHaveAlpha(metadata.videoCodec)) {
11512
11584
  args.push("-c:v", decoderForCodec(metadata.videoCodec));
11513
11585
  }
11586
+ const decodeArgs = [...args];
11514
11587
  if (options.finalFrameOnly) {
11515
11588
  args.push("-i", videoPath, "-ss", String(startTime), "-frames:v", "1");
11516
11589
  } else {
@@ -11566,8 +11639,21 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
11566
11639
  runOptions
11567
11640
  );
11568
11641
  } else {
11569
- if (vfFilters.length > 0) args.push("-vf", vfFilters.join(","));
11570
- processResult = await runFfmpeg([...args, ...encodeArgs], runOptions);
11642
+ const filterArgs = vfFilters.length > 0 ? ["-vf", vfFilters.join(",")] : [];
11643
+ const segmentFrames = Math.round(EXTRACTION_SEGMENT_SECONDS * fps);
11644
+ const totalFrames = extractionFrameCountForDuration(duration, normalizedFps, false);
11645
+ processResult = sampleCfrAtOutputFps && (options.frameRanges || totalFrames > segmentFrames) ? await runSegmentedExtraction({
11646
+ decodeArgs,
11647
+ filterAndEncodeArgs: [...filterArgs, ...encodeArgs],
11648
+ videoPath,
11649
+ startTime,
11650
+ fps,
11651
+ segments: splitFrameRanges(
11652
+ options.frameRanges ?? [{ firstFrame: 0, frames: totalFrames }],
11653
+ segmentFrames
11654
+ ),
11655
+ runOptions
11656
+ }) : await runFfmpeg([...args, ...filterArgs, ...encodeArgs], runOptions);
11571
11657
  }
11572
11658
  if (processResult.failureReason === "external_interruption") {
11573
11659
  throw new VideoSourceExtractionError(
@@ -11606,7 +11692,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
11606
11692
  diagnostic
11607
11693
  );
11608
11694
  }
11609
- const framePaths = framePathsFromDirectory(videoOutputDir, format);
11695
+ const framePaths = framePathsFromDirectory(videoOutputDir, format, !!options.frameRanges);
11610
11696
  if (framePaths.size === 0 && duration > 0) {
11611
11697
  throw new VideoSourceExtractionError(
11612
11698
  "zero_output",
@@ -11615,7 +11701,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
11615
11701
  `FFmpeg exited successfully but produced no frames (start=${startTime}, duration=${duration})`
11616
11702
  );
11617
11703
  }
11618
- if (framePaths.size > 0 && duration > 0 && !options.finalFrameOnly) {
11704
+ if (framePaths.size > 0 && duration > 0 && !options.finalFrameOnly && !options.frameRanges) {
11619
11705
  const expectedAtFps = extractionFrameCountForDuration(duration, normalizedFps, metadata.isVFR);
11620
11706
  if (expectedAtFps > 0 && framePaths.size <= expectedAtFps * 0.6) {
11621
11707
  const correctedDuration = startTime + framePaths.size / fps;
@@ -12298,6 +12384,57 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
12298
12384
  }
12299
12385
  return rehydratePublishedCache(work, cacheTarget);
12300
12386
  }
12387
+ async function deferExtraction(work) {
12388
+ if (work.finalFrameOnly || work.metadata.isVFR || work.sdrToHdrTransfer !== void 0 || work.hdrToSdrTransformKey !== void 0) {
12389
+ return null;
12390
+ }
12391
+ const expectedFrames = extractionFrameCountForDuration(
12392
+ work.videoDuration,
12393
+ configuredFps,
12394
+ false
12395
+ );
12396
+ const tailFrames = Math.min(expectedFrames, Math.ceil(fps));
12397
+ if (expectedFrames <= tailFrames) return null;
12398
+ const probeDir = join10(options.outputDir, `${work.video.id}.tail-probe`);
12399
+ try {
12400
+ const tail = await extractVideoFramesRange(
12401
+ work.videoPath,
12402
+ work.video.id,
12403
+ work.extractionMediaStart,
12404
+ work.videoDuration,
12405
+ {
12406
+ ...scopedExtractionOptions(work),
12407
+ frameRanges: [{ firstFrame: expectedFrames - tailFrames, frames: tailFrames }]
12408
+ },
12409
+ signal,
12410
+ config,
12411
+ probeDir
12412
+ );
12413
+ const totalFrames = expectedFrames - tailFrames + tail.totalFrames;
12414
+ if (totalFrames <= expectedFrames * 0.6) return null;
12415
+ const outputDir = join10(options.outputDir, work.video.id);
12416
+ mkdirSync6(outputDir, { recursive: true });
12417
+ return {
12418
+ videoId: work.video.id,
12419
+ srcPath: work.videoPath,
12420
+ outputDir,
12421
+ framePattern: `${FRAME_FILENAME_PREFIX}%05d.${work.format}`,
12422
+ fps,
12423
+ totalFrames,
12424
+ metadata: work.metadata,
12425
+ framePaths: /* @__PURE__ */ new Map(),
12426
+ deferredRange: {
12427
+ startTime: work.extractionMediaStart,
12428
+ durationSeconds: work.videoDuration,
12429
+ format: work.format
12430
+ }
12431
+ };
12432
+ } catch {
12433
+ return null;
12434
+ } finally {
12435
+ rmSync4(probeDir, { recursive: true, force: true });
12436
+ }
12437
+ }
12301
12438
  async function executeDirectMiss(miss, maxTransientRetries = options.maxTransientRetries ?? 0) {
12302
12439
  try {
12303
12440
  return { result: await extractDirectMiss(miss, maxTransientRetries) };
@@ -12422,8 +12559,17 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
12422
12559
  }
12423
12560
  }
12424
12561
  const uniqueOutcomes = /* @__PURE__ */ new Map();
12562
+ if (options.deferRangeExtraction) {
12563
+ const works = [...uniqueWorks.values()];
12564
+ const deferred = await Promise.all(works.map(deferExtraction));
12565
+ works.forEach((work, i) => {
12566
+ const result = deferred[i];
12567
+ if (result) uniqueOutcomes.set(work.dedupeKey, { result });
12568
+ });
12569
+ }
12425
12570
  const cacheMisses = [];
12426
12571
  for (const work of uniqueWorks.values()) {
12572
+ if (uniqueOutcomes.has(work.dedupeKey)) continue;
12427
12573
  const lookup = lookupCacheFor(work);
12428
12574
  if ("work" in lookup) {
12429
12575
  cacheMisses.push(lookup);
@@ -12479,7 +12625,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
12479
12625
  errors.push(item.error);
12480
12626
  } else if ("result" in item) {
12481
12627
  extracted.push(item.result);
12482
- totalFramesExtracted += item.result.totalFrames;
12628
+ if (!item.result.deferredRange) totalFramesExtracted += item.result.totalFrames;
12483
12629
  }
12484
12630
  }
12485
12631
  const sweepDue = breakdown.cacheMisses > 0 || cacheRootDir !== void 0 && gcSweepDue(cacheRootDir, GC_STALENESS_MS);
@@ -14716,7 +14862,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
14716
14862
  }
14717
14863
 
14718
14864
  // ../engine/src/services/parallelCoordinator.ts
14719
- import { cpus, freemem } from "os";
14865
+ import { cpus as cpus2, freemem } from "os";
14720
14866
  import { existsSync as existsSync11, mkdirSync as mkdirSync8, readdirSync as readdirSync6 } from "fs";
14721
14867
  import { copyFile, readFile as readFile2, rename } from "fs/promises";
14722
14868
  import { join as join15 } from "path";
@@ -14831,7 +14977,7 @@ var MIN_WORKERS = 1;
14831
14977
  var MAX_WORKER_DIAGNOSTIC_LINES = 8;
14832
14978
  var ABSOLUTE_MAX_WORKERS = 24;
14833
14979
  function defaultSafeMaxWorkers() {
14834
- return Math.max(6, Math.min(16, Math.floor(cpus().length / 8)));
14980
+ return Math.max(6, Math.min(16, Math.floor(cpus2().length / 8)));
14835
14981
  }
14836
14982
  var MIN_FRAMES_PER_WORKER = 30;
14837
14983
  function shouldDisableBrowserPoolForParallelWorker({
@@ -14876,7 +15022,7 @@ function formatWorkerFailure(result) {
14876
15022
  return `${base}; diagnostics: ${diagnostics}`;
14877
15023
  }
14878
15024
  function computeWorkerSizing(totalFrames, requested, config) {
14879
- const cpuCount = cpus().length;
15025
+ const cpuCount = cpus2().length;
14880
15026
  const totalMemoryMb = getSystemTotalMb();
14881
15027
  const heapLimitMb = Math.round(getHeapStatistics().heap_size_limit / (1024 * 1024));
14882
15028
  const heapBasedWorkers = Math.max(
@@ -15434,7 +15580,7 @@ async function mergeWorkerFrames(workDir, tasks, outputDir) {
15434
15580
  }
15435
15581
  function getSystemResources() {
15436
15582
  return {
15437
- cpuCores: cpus().length,
15583
+ cpuCores: cpus2().length,
15438
15584
  totalMemoryMB: getSystemTotalMb(),
15439
15585
  freeMemoryMB: Math.round(freemem() / (1024 * 1024)),
15440
15586
  recommendedWorkers: calculateOptimalWorkers(1e3)
@@ -15909,6 +16055,7 @@ export {
15909
16055
  resolveConfig,
15910
16056
  shouldClampToScreenshotForConcreteGpu,
15911
16057
  applyConcreteGpuScreenshotClamp,
16058
+ SDR_RGB_TO_BT709_FILTER,
15912
16059
  BrowserLeasePool,
15913
16060
  setHostHandlesSigint,
15914
16061
  resolveHeadlessShellPath,
@@ -7,10 +7,10 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  parseFeedbackRating,
9
9
  trackRenderFeedback
10
- } from "./chunk-XGMNQQTJ.js";
10
+ } from "./chunk-QFN7NVWM.js";
11
11
  import {
12
12
  shouldTrack
13
- } from "./chunk-LBKDQKWV.js";
13
+ } from "./chunk-OSSHSIMD.js";
14
14
  import {
15
15
  detectAgentRuntime
16
16
  } from "./chunk-GQJZORQP.js";
@@ -287,157 +287,6 @@ function writeClipTiming(attributes, update) {
287
287
  return readClipTiming(attributes);
288
288
  }
289
289
 
290
- // ../parsers/dist/mediaDuration.js
291
- var COMPOSITION_ATTRIBUTES2 = Object.freeze({
292
- start: "data-start",
293
- duration: "data-duration",
294
- trackIndex: "data-track-index",
295
- derivedEnd: "data-end",
296
- legacyTrack: "data-layer"
297
- });
298
- var CANONICAL_AUTHORED_TIMING_ATTRIBUTES2 = Object.freeze([
299
- COMPOSITION_ATTRIBUTES2.start,
300
- COMPOSITION_ATTRIBUTES2.duration,
301
- COMPOSITION_ATTRIBUTES2.trackIndex
302
- ]);
303
- var DERIVED_TIMING_ATTRIBUTES2 = Object.freeze([
304
- COMPOSITION_ATTRIBUTES2.derivedEnd
305
- ]);
306
- var LEGACY_TIMING_ATTRIBUTES2 = Object.freeze([
307
- COMPOSITION_ATTRIBUTES2.derivedEnd,
308
- COMPOSITION_ATTRIBUTES2.legacyTrack
309
- ]);
310
- function parseNumeric2(value) {
311
- if (value == null || value.trim() === "") return null;
312
- const parsed = Number(value);
313
- return Number.isFinite(parsed) ? parsed : null;
314
- }
315
- var nonNegative = (raw) => {
316
- const value = parseNumeric2(raw);
317
- return value !== null && value >= 0 ? value : null;
318
- };
319
- function readMediaOffsetSeconds(getAttr) {
320
- return nonNegative(getAttr("data-playback-start")) ?? nonNegative(getAttr("data-media-start")) ?? 0;
321
- }
322
- var MIN_PLAYBACK_RATE = 0.1;
323
- var MAX_PLAYBACK_RATE = 10;
324
- function clampPlaybackRate(raw) {
325
- return Number.isFinite(raw) && raw > 0 ? Math.max(MIN_PLAYBACK_RATE, Math.min(MAX_PLAYBACK_RATE, raw)) : 1;
326
- }
327
- function readPlaybackRate(getAttr, fallback = 1) {
328
- const authored = Number.parseFloat(getAttr("data-playback-rate") ?? "");
329
- return clampPlaybackRate(Number.isFinite(authored) && authored > 0 ? authored : fallback);
330
- }
331
- function readDataDurationSeconds(getAttr) {
332
- const duration = parseNumeric2(getAttr("data-duration"));
333
- return duration !== null && duration > 0 ? duration : null;
334
- }
335
- function readAuthoredDurationSeconds(getAttr, startSeconds) {
336
- const duration = readDataDurationSeconds(getAttr);
337
- if (duration !== null) return duration;
338
- const end = parseNumeric2(getAttr("data-end"));
339
- return end !== null ? end - startSeconds : null;
340
- }
341
- var DEFAULT_IMAGE_TIMELINE_DURATION_SECONDS = 3;
342
- function resolveNaturalDurationSeconds(sourceDurationSeconds, mediaStartSeconds, playbackRate) {
343
- if (!Number.isFinite(sourceDurationSeconds)) return null;
344
- const remaining = Math.max(0, sourceDurationSeconds - mediaStartSeconds);
345
- return remaining / clampPlaybackRate(playbackRate);
346
- }
347
- function resolveMediaDuration(input) {
348
- const { tag, authoredDurationSeconds, sourceDurationSeconds, mediaStartSeconds, playbackRate } = input;
349
- if (authoredDurationSeconds !== null && authoredDurationSeconds > 0) {
350
- return { seconds: authoredDurationSeconds, source: "authored" };
351
- }
352
- if (tag === "img") {
353
- return { seconds: DEFAULT_IMAGE_TIMELINE_DURATION_SECONDS, source: "default" };
354
- }
355
- if (sourceDurationSeconds === null) {
356
- return { seconds: null, source: "pending", reason: "source duration not yet probed" };
357
- }
358
- const seconds = resolveNaturalDurationSeconds(
359
- sourceDurationSeconds,
360
- mediaStartSeconds,
361
- playbackRate
362
- );
363
- if (seconds === null) {
364
- return { seconds: null, source: "pending", reason: "source reported a non-finite duration" };
365
- }
366
- return { seconds, source: "media" };
367
- }
368
-
369
- // ../parsers/dist/assets.js
370
- import { isAbsolute, relative, resolve } from "path";
371
- import { posix } from "path";
372
- var CSS_URL_RE = /\burl\(\s*(["']?)([^)"'\s](?:[^)"']*[^)"'\s])?)\1\s*\)/g;
373
- var PATH_ATTRS = ["src", "href"];
374
- function isNonRelativeUrl(val) {
375
- return !val || val.startsWith("http://") || val.startsWith("https://") || val.startsWith("//") || val.startsWith("data:") || val.startsWith("#") || val.startsWith("/");
376
- }
377
- function isPathInside(childPath, parentPath) {
378
- const absChild = resolve(childPath);
379
- const absParent = resolve(parentPath);
380
- if (absChild === absParent) return true;
381
- const rel = relative(absParent, absChild);
382
- return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
383
- }
384
- var { join, resolve: resolve2, dirname } = posix;
385
- var isAbsoluteOrSpecial = isNonRelativeUrl;
386
- function needsRewrite(val) {
387
- return val.startsWith("../") || val === "..";
388
- }
389
- function splitPathSuffix(value) {
390
- const marker = value.search(/[?#]/);
391
- return marker === -1 ? [value, ""] : [value.slice(0, marker), value.slice(marker)];
392
- }
393
- function rewriteAssetPath(compSrcPath, relativePath, assetExists) {
394
- if (isAbsoluteOrSpecial(relativePath)) return relativePath;
395
- const compDir = dirname(compSrcPath);
396
- if (!compDir || compDir === ".") return relativePath;
397
- if (!needsRewrite(relativePath)) {
398
- if (!assetExists) return relativePath;
399
- const [filePart, suffix] = splitPathSuffix(relativePath);
400
- if (!filePart) return relativePath;
401
- const sibling = resolve2("/", join(compDir, filePart)).slice(1);
402
- return assetExists(sibling) ? sibling + suffix : relativePath;
403
- }
404
- const resolved = join(compDir, relativePath);
405
- const normalized = resolve2("/", resolved).slice(1);
406
- return normalized;
407
- }
408
- function rewriteAssetPaths(elements, compSrcPath, getAttr, setAttr, assetExists) {
409
- for (const el of elements) {
410
- for (const attr of PATH_ATTRS) {
411
- const val = (getAttr(el, attr) || "").trim();
412
- const rewritten = rewriteAssetPath(compSrcPath, val, assetExists);
413
- if (rewritten !== val) {
414
- setAttr(el, attr, rewritten);
415
- }
416
- }
417
- }
418
- }
419
- function rewriteInlineStyleAssetUrls(elements, compSrcPath, getStyle, setStyle, assetExists) {
420
- const compDir = dirname(compSrcPath);
421
- if (!compDir || compDir === ".") return;
422
- for (const el of elements) {
423
- const style = getStyle(el);
424
- if (!style) continue;
425
- const rewritten = rewriteCssAssetUrls(style, compSrcPath, assetExists);
426
- if (rewritten !== style) {
427
- setStyle(el, rewritten);
428
- }
429
- }
430
- }
431
- function rewriteCssAssetUrls(cssText, compSrcPath, assetExists) {
432
- if (!cssText) return cssText;
433
- return cssText.replace(CSS_URL_RE, (full, quote, rawUrl) => {
434
- const urlValue = (rawUrl || "").trim();
435
- const rewritten = rewriteAssetPath(compSrcPath, urlValue, assetExists);
436
- if (rewritten === urlValue) return full;
437
- return `url(${quote || ""}${rewritten}${quote || ""})`;
438
- });
439
- }
440
-
441
290
  // ../parsers/dist/subCompositionValidity.js
442
291
  function resolveSubCompositionContent(html, document) {
443
292
  const template = document.querySelector("template");
@@ -987,23 +836,6 @@ export {
987
836
  parseStartExpression,
988
837
  readClipTiming,
989
838
  writeClipTiming,
990
- readMediaOffsetSeconds,
991
- MIN_PLAYBACK_RATE,
992
- MAX_PLAYBACK_RATE,
993
- clampPlaybackRate,
994
- readPlaybackRate,
995
- readDataDurationSeconds,
996
- readAuthoredDurationSeconds,
997
- resolveNaturalDurationSeconds,
998
- resolveMediaDuration,
999
- CSS_URL_RE,
1000
- PATH_ATTRS,
1001
- isNonRelativeUrl,
1002
- isPathInside,
1003
- rewriteAssetPath,
1004
- rewriteAssetPaths,
1005
- rewriteInlineStyleAssetUrls,
1006
- rewriteCssAssetUrls,
1007
839
  resolveSubCompositionContent,
1008
840
  checkSubCompositionUsability,
1009
841
  COLOR_GRADING_CONTRACT_VERSION,
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  DOMParser
9
- } from "./chunk-GK4AIFIH.js";
9
+ } from "./chunk-SDYDNHEE.js";
10
10
 
11
11
  // src/utils/dom.ts
12
12
  function ensureDOMParser() {