hyperframes 0.8.188 → 0.8.190

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 (167) hide show
  1. package/dist/{add-UORF6235.js → add-DBKN5H7H.js} +11 -11
  2. package/dist/{animatedGifPrep-23MLSEXF.js → animatedGifPrep-YVBKKLQY.js} +5 -5
  3. package/dist/api.js +13 -13
  4. package/dist/{asset-DOKDVHCW.js → asset-2OHQKUMQ.js} +2 -2
  5. package/dist/{assetCataloger-CD27MHEY.js → assetCataloger-O3QAUWIK.js} +5 -5
  6. package/dist/{audio-3NMZHNNU.js → audio-IR3JGCMM.js} +11 -11
  7. package/dist/{auth-AWKTSKGC.js → auth-J6TAJLGD.js} +1 -1
  8. package/dist/{autoUpdate-VBOI4CNU.js → autoUpdate-D7BJJUT2.js} +2 -2
  9. package/dist/{backgroundChecks-S4R454YU.js → backgroundChecks-AILHY2YZ.js} +3 -3
  10. package/dist/backgroundChecksWorker.js +3 -3
  11. package/dist/{batchRender-EGPYNDHK.js → batchRender-QZKFVWEI.js} +3 -3
  12. package/dist/{beats-YENEQUOA.js → beats-6LOEKZPB.js} +4 -4
  13. package/dist/{benchmark-THSJIQG7.js → benchmark-RJMHI3YW.js} +8 -8
  14. package/dist/{browser-BDMVQ6WJ.js → browser-Q3Q36FE3.js} +3 -3
  15. package/dist/{bundleWithLocalizedFonts-3QG722YD.js → bundleWithLocalizedFonts-RWHFMSFL.js} +2 -2
  16. package/dist/{capture-Z6BGCTK3.js → capture-2PNTGVYV.js} +8 -8
  17. package/dist/{capture-WM4XDMFX.js → capture-FO3ZZCT4.js} +2 -2
  18. package/dist/{captureCompositionFrame-EMHSAIBZ.js → captureCompositionFrame-WTMLWVEJ.js} +11 -11
  19. package/dist/{catalog-7TV6UNCG.js → catalog-LUZYPUYT.js} +11 -11
  20. package/dist/{catch-up-63IUDZRW.js → catch-up-TUTLUTFP.js} +4 -4
  21. package/dist/{check-7RHZL4DV.js → check-K2TBTJZS.js} +34 -33
  22. package/dist/{checkBrowser-PF56CT5X.js → checkBrowser-JT7CXDT6.js} +29 -30
  23. package/dist/{chunk-I7C5GUEQ.js → chunk-2FFOLLU2.js} +3 -3
  24. package/dist/{chunk-OKSYDQHY.js → chunk-3QLT727N.js} +3 -3
  25. package/dist/{chunk-NFHRGHCJ.js → chunk-45U3KY7Z.js} +4 -4
  26. package/dist/{chunk-MJKUCR3C.js → chunk-56IDMP37.js} +2 -2
  27. package/dist/{chunk-YV4WT7CJ.js → chunk-56IOFIYB.js} +12 -1
  28. package/dist/{chunk-HKUZCSNZ.js → chunk-6HYHHMX3.js} +2 -2
  29. package/dist/{chunk-46VJ2UAV.js → chunk-76ITJYXX.js} +5 -5
  30. package/dist/{chunk-YZ73IPW2.js → chunk-7JHTNUF2.js} +2 -2
  31. package/dist/{chunk-2WUDFZCR.js → chunk-A5YHWTSP.js} +2 -2
  32. package/dist/{chunk-HPQSUPR7.js → chunk-AYFF3GX6.js} +1 -1
  33. package/dist/{chunk-W2KGJHUL.js → chunk-B7JFAXDP.js} +2 -2
  34. package/dist/{chunk-LWYZN7HS.js → chunk-BT64TTSE.js} +219 -79
  35. package/dist/{chunk-ZIRIDSDB.js → chunk-BWPY64WA.js} +1 -1
  36. package/dist/{chunk-MTPPEEYZ.js → chunk-CWVSJA52.js} +16 -8
  37. package/dist/{chunk-BWEZDN6U.js → chunk-CWYS2UNQ.js} +1 -1
  38. package/dist/chunk-DIV37NUE.js +3896 -0
  39. package/dist/{chunk-DA4TQFSF.js → chunk-DRTIIAIZ.js} +1 -1
  40. package/dist/{chunk-IJYR4TTA.js → chunk-DX7VEUBO.js} +1 -1
  41. package/dist/{chunk-V6NM4KL3.js → chunk-E7DXKMKU.js} +2 -2
  42. package/dist/{chunk-LWY3PFJ7.js → chunk-EPOYPP36.js} +2 -2
  43. package/dist/{chunk-BU4HRISA.js → chunk-EQF6TVWB.js} +91 -24
  44. package/dist/{chunk-KDBPZOXK.js → chunk-EU5HTY3E.js} +11 -11
  45. package/dist/{chunk-KY7375C4.js → chunk-EUUHVDMN.js} +1 -1
  46. package/dist/{chunk-6HYPEIH7.js → chunk-F6DNM676.js} +2 -2
  47. package/dist/{chunk-2DHCCBCN.js → chunk-FANFO5HI.js} +9 -9
  48. package/dist/{chunk-FWVILDOZ.js → chunk-FUHI34T4.js} +3 -3
  49. package/dist/{chunk-GYBPAKBM.js → chunk-FVD44EQX.js} +53 -31
  50. package/dist/{chunk-MXXX6WVC.js → chunk-GGVGOY6M.js} +1 -1
  51. package/dist/{chunk-XPVN4R66.js → chunk-HJZ5CPZA.js} +31 -7
  52. package/dist/{chunk-NMOTNNP2.js → chunk-IARWN467.js} +1 -1
  53. package/dist/{chunk-OJOZXWLC.js → chunk-JB7LML5B.js} +3 -3
  54. package/dist/{chunk-UF6RCYA5.js → chunk-JLSXXMRU.js} +1 -1
  55. package/dist/{chunk-JYC53CW4.js → chunk-K4664CDS.js} +97 -30
  56. package/dist/{chunk-T3OXKSRG.js → chunk-KNQQZRB2.js} +2 -2
  57. package/dist/{chunk-L243NE72.js → chunk-KUMUK6QS.js} +7 -7
  58. package/dist/{chunk-6HZ7TSJJ.js → chunk-L34DPWY4.js} +15 -11
  59. package/dist/{chunk-YCW345M4.js → chunk-OAPYPSEB.js} +357 -211
  60. package/dist/{chunk-6Q5CFUAP.js → chunk-OOAVKK2W.js} +1 -1
  61. package/dist/{chunk-FSTLXRIN.js → chunk-OTQXYTQZ.js} +1 -1
  62. package/dist/{chunk-44QWRPGE.js → chunk-R4QASDTN.js} +2 -2
  63. package/dist/{chunk-NFLZNSUZ.js → chunk-RBGNU7VD.js} +1 -1
  64. package/dist/{chunk-5DPV7LU3.js → chunk-RDHEG7RX.js} +2 -2
  65. package/dist/{chunk-FOLMMQF3.js → chunk-S2IEO6TH.js} +13 -13
  66. package/dist/{chunk-6OWNUXTU.js → chunk-S7C6EM7N.js} +1 -1
  67. package/dist/{chunk-KWSEIVR6.js → chunk-STJ2ANMF.js} +1 -1
  68. package/dist/{chunk-DLFAVRF3.js → chunk-SUSSMCWL.js} +1 -1
  69. package/dist/{chunk-U6RXZNZE.js → chunk-TMBUBLZB.js} +55 -23
  70. package/dist/{chunk-SMF6YAUL.js → chunk-TSQAPPRS.js} +1 -1
  71. package/dist/{chunk-PMXR3IUH.js → chunk-TTZTGXKG.js} +1 -1
  72. package/dist/{chunk-DG4ME554.js → chunk-UZ7RJDEC.js} +1 -1
  73. package/dist/{chunk-X556BGL7.js → chunk-WBUO6WH6.js} +1 -1
  74. package/dist/{chunk-IA2IDJAG.js → chunk-WCT6KGGT.js} +1 -1
  75. package/dist/{chunk-57XL23DE.js → chunk-WLG4OYH7.js} +1 -1
  76. package/dist/{chunk-JWRT2IXO.js → chunk-XBGEWNGQ.js} +1 -1
  77. package/dist/{chunk-B2P4JRUJ.js → chunk-XNLYMHX2.js} +1 -1
  78. package/dist/{chunk-PQLFJYGP.js → chunk-Y5L5I4US.js} +5 -5
  79. package/dist/{chunk-5OZI55AC.js → chunk-YT5VLUHM.js} +1 -1
  80. package/dist/{chunk-FH7WODJH.js → chunk-ZFFKWHXN.js} +8 -0
  81. package/dist/{clean-43O47OTN.js → clean-UVTWBPXK.js} +14 -14
  82. package/dist/cli.js +53 -53
  83. package/dist/{cloud-ZFWKFFSU.js → cloud-M42IPKFD.js} +4 -4
  84. package/dist/{cloudrun-XBBESKEU.js → cloudrun-CTNX64R6.js} +4 -4
  85. package/dist/{compare-OW4ELTFZ.js → compare-MQI7TG5M.js} +26 -26
  86. package/dist/{compiler-23MT6CX6.js → compiler-EJE3HLCS.js} +2 -2
  87. package/dist/{component-SDV7LWH6.js → component-QSYOSFVV.js} +3 -3
  88. package/dist/{compositions-DI5QZCEK.js → compositions-ITDFE7K4.js} +9 -9
  89. package/dist/{delete-QY2NSQ2G.js → delete-NTGTENKJ.js} +2 -2
  90. package/dist/{deploy-MJVC4EFY.js → deploy-AOJOXEYX.js} +1 -1
  91. package/dist/{dist-RFTGYT26.js → dist-NHW2JQCA.js} +4 -2
  92. package/dist/{doctor-7ZOECPHR.js → doctor-Q6DAYVSQ.js} +9 -9
  93. package/dist/{events-XVQQGECC.js → events-BQIBYPCF.js} +2 -2
  94. package/dist/{events-WIX4JM2K.js → events-PV3CDO4A.js} +3 -3
  95. package/dist/{feedback-GBYBR6UO.js → feedback-BZH26JQE.js} +6 -6
  96. package/dist/{ffmpeg-QGQBYMO3.js → ffmpeg-KU7RNT3U.js} +5 -5
  97. package/dist/{figma-2CMKUGJQ.js → figma-PBGZUEIL.js} +3 -3
  98. package/dist/fontLocalizeCli.js +7 -7
  99. package/dist/{get-RWCNUOHU.js → get-MM2JZ5ET.js} +2 -2
  100. package/dist/{gpuPolicy-UGWSN32D.js → gpuPolicy-DQE2CD5T.js} +5 -5
  101. package/dist/{grade-compare-J2MX7HZL.js → grade-compare-YTDQ7YXW.js} +27 -27
  102. package/dist/{help-SH3ID7MV.js → help-M4B2DN7E.js} +1 -1
  103. package/dist/{history-C7V5QH7J.js → history-ZW4UYKAJ.js} +7 -7
  104. package/dist/hyperframe.manifest.json +1 -1
  105. package/dist/hyperframe.runtime.iife.js +62 -62
  106. package/dist/hyperframes-player.global.js +3 -3
  107. package/dist/{info-ZN3JJ3IN.js → info-L7LQAXLK.js} +7 -7
  108. package/dist/{init-KRNGSRNH.js → init-HTSQ535A.js} +25 -25
  109. package/dist/{inspect-AYDZXTX7.js → inspect-EWF2THRR.js} +27 -27
  110. package/dist/{installer-N6AIK6XQ.js → installer-PQKH2S7C.js} +4 -4
  111. package/dist/{keyframes-2RFUCEDK.js → keyframes-X2QKJ4DP.js} +6 -6
  112. package/dist/{lambda-VW3CF6EE.js → lambda-BURM66GP.js} +6 -6
  113. package/dist/{layout-OE64APE7.js → layout-3Z3SJGZZ.js} +27 -27
  114. package/dist/{lint-UXJTX5WS.js → lint-OMNZ2K5J.js} +6 -6
  115. package/dist/{list-KOL6JPZJ.js → list-5ZSQEH6N.js} +2 -2
  116. package/dist/{login-MAQXOPDG.js → login-YNCQPHLA.js} +4 -4
  117. package/dist/{manager-3LZKRK7P.js → manager-N6XXRQN3.js} +6 -6
  118. package/dist/{media-treatment-COLSXXQJ.js → media-treatment-EOKBRJPY.js} +11 -11
  119. package/dist/{models-XXWMGOD7.js → models-6T4CCKUV.js} +9 -9
  120. package/dist/{motionShot-RECBNTBZ.js → motionShot-KXKMYZ3A.js} +16 -16
  121. package/dist/{normalize-audio-LKVGHZWR.js → normalize-audio-VWB7RHHA.js} +4 -4
  122. package/dist/{open-UEQVSRKH.js → open-32SQCNUP.js} +11 -11
  123. package/dist/{parakeetRunner-QVPCZ36U.js → parakeetRunner-BXW2WX6Q.js} +10 -10
  124. package/dist/{pipeline-5VSMQBKW.js → pipeline-V5ONFRCY.js} +6 -6
  125. package/dist/{play-MNEABYN4.js → play-BBL262JE.js} +17 -17
  126. package/dist/{preflight-ONJ74DWQ.js → preflight-LCNGQFNY.js} +6 -6
  127. package/dist/{present-GQ24GTYX.js → present-RY4HO4ZQ.js} +13 -13
  128. package/dist/{preview-ALL7O4RG.js → preview-BLLPCCLG.js} +16 -16
  129. package/dist/{producer-43L2UDF6.js → producer-QG4AQ35S.js} +1 -1
  130. package/dist/{projectConfig-VJXUXK7U.js → projectConfig-LN3NR5OM.js} +6 -6
  131. package/dist/{publication-L6E5NTFV.js → publication-TXMCS4KM.js} +2 -2
  132. package/dist/{publish-LCLBJEPR.js → publish-57VURD7Z.js} +7 -7
  133. package/dist/{remove-background-PDL4KPR4.js → remove-background-VEWVIO3A.js} +7 -7
  134. package/dist/{render-OPCRLZVL.js → render-4E7QDVOI.js} +12 -12
  135. package/dist/{render-7HVKJ7T4.js → render-SP7WAUB4.js} +5 -5
  136. package/dist/{render-J33ZHR6I.js → render-XMN3NJIQ.js} +27 -27
  137. package/dist/{render-batch-ZHHIGXU3.js → render-batch-7ULP5RIJ.js} +5 -5
  138. package/dist/{resolver-KNNIMMBM.js → resolver-D3XERO6U.js} +4 -4
  139. package/dist/{sherpa-GI62H3H5.js → sherpa-5B5G426W.js} +9 -9
  140. package/dist/skills/hyperframes/references/motion.md +1 -1
  141. package/dist/{skills-IUTD6VQO.js → skills-RXHRF7O7.js} +5 -5
  142. package/dist/{skillsUpdateCheck-XZE7MJG6.js → skillsUpdateCheck-JOTDZJAE.js} +3 -3
  143. package/dist/{snapshot-XEXTHLZP.js → snapshot-DN4MP4VN.js} +31 -31
  144. package/dist/{src-6STRGCDC.js → src-W6Y5ZYRQ.js} +6 -6
  145. package/dist/{src-ZPIV4PGX.js → src-XSDYRKLG.js} +6 -4
  146. package/dist/{staticProjectServer-HJLT7MHE.js → staticProjectServer-JMFGTPMX.js} +15 -13
  147. package/dist/studio/assets/{hyperframes-player-DwWIKKZG.js → hyperframes-player-0HXJPmYC.js} +1 -1
  148. package/dist/studio/assets/{index-CESvLzz0.css → index-B3vk3hfU.css} +1 -1
  149. package/dist/studio/assets/{index-M8lEpS0Q.js → index-BYw97F07.js} +127 -127
  150. package/dist/studio/assets/{index-Cjwz7_13.js → index-DsSfhjUS.js} +1 -1
  151. package/dist/studio/index.html +2 -2
  152. package/dist/{studio-api-OBHEB5ND.js → studio-api-SZ4OMFPN.js} +7 -7
  153. package/dist/{studioServer-KRIZFYML.js → studioServer-LWO33H7D.js} +44 -44
  154. package/dist/{telemetry-N5OOVBCP.js → telemetry-K3AFDKOP.js} +3 -3
  155. package/dist/{timeline-YUFH65OG.js → timeline-NYQOAQDH.js} +15 -15
  156. package/dist/{tokens-K4VYLSWJ.js → tokens-K7YWUVOK.js} +2 -2
  157. package/dist/{transcribe-GMQXKDYN.js → transcribe-ANPUQDZD.js} +8 -8
  158. package/dist/{transcribe-CY4CVO54.js → transcribe-QAUMODXM.js} +14 -14
  159. package/dist/{updateCheck-2625RXK4.js → updateCheck-RNR4HMDI.js} +2 -2
  160. package/dist/{upgrade-6ZY5MSBQ.js → upgrade-MKUGZZPA.js} +2 -2
  161. package/dist/{urlDownloader-PVJWG7V3.js → urlDownloader-5USPXLCS.js} +4 -4
  162. package/dist/{validate-XSRHEE7E.js → validate-OJHPDLC5.js} +21 -21
  163. package/dist/{video-MBFHC54F.js → video-BCKRR6LU.js} +5 -5
  164. package/dist/warmCheck.js +34 -35
  165. package/package.json +1 -1
  166. package/dist/chunk-BPX7LZG6.js +0 -3896
  167. package/dist/chunk-KANNRHY7.js +0 -53
@@ -13,7 +13,7 @@ import {
13
13
  formatPreviewProxyBox,
14
14
  hdrToSdrToneMapFilter,
15
15
  parseFirstFrameColour
16
- } from "./chunk-YV4WT7CJ.js";
16
+ } from "./chunk-56IOFIYB.js";
17
17
  import {
18
18
  decodeAuthoredAttribute,
19
19
  scanHtmlOpeningTags
@@ -36,7 +36,7 @@ import {
36
36
  rewriteAssetPath
37
37
  } from "./chunk-BSQ7XANM.js";
38
38
 
39
- // ../studio-server/dist/chunk-OVOXGASQ.js
39
+ // ../studio-server/dist/chunk-XMNHDWQI.js
40
40
  import { statSync } from "fs";
41
41
  import { sep } from "path";
42
42
  import { execFile } from "child_process";
@@ -139,7 +139,7 @@ async function probeMediaMetadata(filePath, runner = execFileRunner) {
139
139
  "-v",
140
140
  "error",
141
141
  "-show_entries",
142
- "stream=codec_type,codec_name,profile,pix_fmt,color_space,color_transfer,color_primaries,bits_per_raw_sample:stream_disposition=attached_pic:stream_tags=alpha_mode",
142
+ "stream=codec_type,codec_name,profile,pix_fmt,color_space,color_transfer,color_primaries,bits_per_raw_sample:stream_disposition=attached_pic:stream_tags=alpha_mode:format=duration",
143
143
  "-of",
144
144
  "json",
145
145
  "--",
@@ -163,6 +163,8 @@ async function probeMediaMetadata(filePath, runner = execFileRunner) {
163
163
  if (kind === "video") {
164
164
  metadata.hasAudio = (parsed.streams ?? []).some((item) => item.codec_type === "audio");
165
165
  metadata.hasAlpha = stream !== void 0 && videoStreamHasAlpha(stream);
166
+ const duration = Number(parsed.format?.duration);
167
+ if (Number.isFinite(duration) && duration > 0) metadata.durationSeconds = duration;
166
168
  }
167
169
  return metadata;
168
170
  } catch {
@@ -338,13 +340,23 @@ async function scanProjectMediaCodecMap(projectDir, htmlSources, options = {}) {
338
340
  return map;
339
341
  }
340
342
 
341
- // ../studio-server/dist/chunk-25IT6FMR.js
343
+ // ../studio-server/dist/chunk-N2HH4SGD.js
342
344
  import { spawn } from "child_process";
343
345
  import { createHash, randomUUID } from "crypto";
344
- import { existsSync as existsSync2, renameSync, statSync as statSync2, unlinkSync as unlinkSync2, utimesSync } from "fs";
345
- import { basename, dirname, isAbsolute, join as join2, relative, resolve, sep as sep2 } from "path";
346
+ import {
347
+ existsSync as existsSync2,
348
+ mkdtempSync,
349
+ renameSync,
350
+ rmSync,
351
+ statSync as statSync2,
352
+ unlinkSync as unlinkSync2,
353
+ utimesSync,
354
+ writeFileSync
355
+ } from "fs";
356
+ import { tmpdir } from "os";
357
+ import { basename, dirname, extname as extname2, isAbsolute, join as join2, relative, resolve, sep as sep2 } from "path";
346
358
  import { existsSync, readdirSync, statSync as statSync3, unlinkSync } from "fs";
347
- import { extname as extname2, join } from "path";
359
+ import { extname as extname3, join } from "path";
348
360
  var DEFAULT_MAX_BYTES = 10 * 1024 * 1024 * 1024;
349
361
  var DEFAULT_STALE_TEMP_MS = 60 * 60 * 1e3;
350
362
  var DEFAULT_MIN_SWEEP_INTERVAL_MS = 5 * 60 * 1e3;
@@ -352,7 +364,9 @@ var PROXY_EXTENSIONS = new Set(
352
364
  Object.values(PROXY_VARIANT_CONFIG).map(({ extension }) => extension)
353
365
  );
354
366
  var TRANSCODER_PROXY_NAME = /^[0-9a-f]{64}\.\w+$/;
355
- var TRANSCODER_TEMP_NAME = /^\.tmp-[0-9a-f-]{36}-[0-9a-f]{64}\.\w+$/;
367
+ var TRANSCODER_TEMP_NAME = /^\.tmp-[0-9a-f-]{36}-(?:\.part-[0-9a-f]{64}-\d+|[0-9a-f]{64})\.\w+$/;
368
+ var TRANSCODER_PIECE_NAME = /^\.part-([0-9a-f]{64})-\d+(\.\w+)$/;
369
+ var STALE_PIECE_MS = 60 * 60 * 1e3;
356
370
  var lastSweepAt = /* @__PURE__ */ new Map();
357
371
  function positiveEnvNumber(name, fallback) {
358
372
  const parsed = Number(process.env[name]);
@@ -375,6 +389,15 @@ function shouldSkipSweep(cacheDir, now, minSweepIntervalMs) {
375
389
  lastSweepAt.set(cacheDir, now);
376
390
  return false;
377
391
  }
392
+ function isLeftoverName(name) {
393
+ return TRANSCODER_TEMP_NAME.test(name) || TRANSCODER_PIECE_NAME.test(name);
394
+ }
395
+ function leftoverIsDead(cacheDir, name, modifiedAt, protectedPaths, now, staleTempMs) {
396
+ const piece = TRANSCODER_PIECE_NAME.exec(name);
397
+ if (!piece) return now - modifiedAt >= staleTempMs;
398
+ const copyIsRunning = protectedPaths.has(join(cacheDir, `${piece[1]}${piece[2]}`));
399
+ return !copyIsRunning && now - modifiedAt >= STALE_PIECE_MS;
400
+ }
378
401
  function readCacheInventory(cacheDir, protectedPaths, now, staleTempMs) {
379
402
  const entries = [];
380
403
  const staleTemps = [];
@@ -388,9 +411,11 @@ function readCacheInventory(cacheDir, protectedPaths, now, staleTempMs) {
388
411
  modifiedAt: stat.mtimeMs,
389
412
  protected: protectedPaths.has(path)
390
413
  };
391
- if (TRANSCODER_TEMP_NAME.test(dirent.name)) {
392
- if (now - stat.mtimeMs >= staleTempMs) staleTemps.push(entry);
393
- } else if (TRANSCODER_PROXY_NAME.test(dirent.name) && PROXY_EXTENSIONS.has(extname2(dirent.name))) {
414
+ if (isLeftoverName(dirent.name)) {
415
+ if (leftoverIsDead(cacheDir, dirent.name, stat.mtimeMs, protectedPaths, now, staleTempMs)) {
416
+ staleTemps.push(entry);
417
+ }
418
+ } else if (TRANSCODER_PROXY_NAME.test(dirent.name) && PROXY_EXTENSIONS.has(extname3(dirent.name))) {
394
419
  entries.push(entry);
395
420
  }
396
421
  }
@@ -452,11 +477,15 @@ var MAX_CONCURRENT_TRANSCODES = boundedEnvInteger("HYPERFRAMES_PROXY_MAX_CONCURR
452
477
  var MAX_QUEUED_TRANSCODES = boundedEnvInteger("HYPERFRAMES_PROXY_MAX_QUEUE", 8, 0, 256);
453
478
  var STDERR_TAIL_MAX_CHARS = 4e3;
454
479
  var TRANSCODE_TIMEOUT_MS = 15 * 60 * 1e3;
480
+ var PROXY_CHUNK_SECONDS = 60;
481
+ var CHUNK_PREFIX = ".part-";
482
+ var CONCAT_TIMEOUT_MS = 2 * 60 * 1e3;
455
483
  var FAILURE_CACHE_TTL_MS = 60 * 1e3;
456
484
  var PROXY_PENDING_RETRY_AFTER_SECONDS = 2;
457
485
  var ENVIRONMENT_FAILURE_TTL_MS = 5 * PROXY_PENDING_RETRY_AFTER_SECONDS * 1e3;
458
486
  var MAX_FAILURE_CACHE_ENTRIES = 128;
459
487
  var DEFAULT_PROXY_WAIT_TIMEOUT_MS = 2 * 60 * 1e3;
488
+ var UNTOUCHED_TEMP_IS_DEAD_MS = 10 * 60 * 1e3;
460
489
  var ProxyTranscodeError = class extends Error {
461
490
  exitCode;
462
491
  stderrTail;
@@ -624,9 +653,9 @@ var inFlight = /* @__PURE__ */ new Map();
624
653
  function forget(job) {
625
654
  if (inFlight.get(job.cachePath)?.job === job) inFlight.delete(job.cachePath);
626
655
  }
627
- function maintainProxyCache(cacheDir) {
656
+ function maintainProxyCache(cacheDir, staleTempMs) {
628
657
  try {
629
- cleanupProxyCache(cacheDir, { protectedPaths: new Set(inFlight.keys()) });
658
+ cleanupProxyCache(cacheDir, { protectedPaths: new Set(inFlight.keys()), staleTempMs });
630
659
  } catch (error) {
631
660
  console.warn(
632
661
  `[media-proxy] cache cleanup failed: ${error instanceof Error ? error.message : String(error)}`
@@ -688,83 +717,173 @@ function stderrReason(stderrTail) {
688
717
  const line = errorLines.at(-1) ?? lines.at(-1);
689
718
  return line ? `: ${line.replace(/[.!]+$/, "")}` : "";
690
719
  }
691
- async function runFfmpeg(sourcePath, outputPath, variant, box, signal) {
692
- const metadata = await probeMediaMetadata(sourcePath);
693
- const ffmpegPath = findFfBinary("ffmpeg", { configuredMustExist: true });
694
- if (!ffmpegPath) {
695
- throw new FfmpegUnavailableError();
720
+ function chunkRanges(durationSeconds) {
721
+ if (!durationSeconds || durationSeconds <= PROXY_CHUNK_SECONDS * 1.5) return null;
722
+ const count = Math.floor(durationSeconds / PROXY_CHUNK_SECONDS);
723
+ return Array.from({ length: count }, (_, index) => ({
724
+ startSeconds: index * PROXY_CHUNK_SECONDS,
725
+ lengthSeconds: index === count - 1 ? durationSeconds - index * PROXY_CHUNK_SECONDS : PROXY_CHUNK_SECONDS
726
+ }));
727
+ }
728
+ function ffmpegBudgetError(chunksKept, chunkCount) {
729
+ return new ProxyTranscodeError(
730
+ `ffmpeg ran out of its ${TRANSCODE_TIMEOUT_MS}ms budget with ${chunksKept}/${chunkCount} pieces done; the finished pieces are kept and the next attempt continues from them`,
731
+ null,
732
+ ""
733
+ );
734
+ }
735
+ async function encodeInChunks(ranges, chunkPrefix, tempPath, encode, concat) {
736
+ const extension = extname2(tempPath);
737
+ const deadline = Date.now() + TRANSCODE_TIMEOUT_MS;
738
+ const pieces = ranges.map((_, index) => `${chunkPrefix}${index}${extension}`);
739
+ for (const [index, range] of ranges.entries()) {
740
+ const piece = pieces[index];
741
+ if (existsSync2(piece)) continue;
742
+ const timeoutMs = deadline - Date.now();
743
+ if (timeoutMs <= 0) throw ffmpegBudgetError(index, ranges.length);
744
+ const pieceTemp = join2(dirname(piece), `.tmp-${randomUUID()}-${basename(piece)}`);
745
+ try {
746
+ await encode(pieceTemp, timeoutMs, range);
747
+ renameSync(pieceTemp, piece);
748
+ } finally {
749
+ if (existsSync2(pieceTemp)) unlinkSync2(pieceTemp);
750
+ }
696
751
  }
697
- const keepsAlpha = variant === "vp8";
752
+ const listDir = mkdtempSync(join2(tmpdir(), "hf-proxy-join-"));
753
+ try {
754
+ const listPath = join2(listDir, "pieces.txt");
755
+ writeFileSync(
756
+ listPath,
757
+ pieces.map((piece) => `file '${piece.replace(/\\/g, "/").replace(/'/g, "'\\''")}'
758
+ `).join("")
759
+ );
760
+ await concat(listPath, tempPath);
761
+ } finally {
762
+ rmSync(listDir, { recursive: true, force: true });
763
+ }
764
+ for (const piece of pieces) if (existsSync2(piece)) unlinkSync2(piece);
765
+ }
766
+ var H264_ARGS = [
767
+ "-c:v",
768
+ "libx264",
769
+ "-profile:v",
770
+ "high",
771
+ "-pix_fmt",
772
+ "yuv420p",
773
+ "-colorspace",
774
+ "bt709",
775
+ "-color_primaries",
776
+ "bt709",
777
+ "-color_trc",
778
+ "bt709",
779
+ "-crf",
780
+ "18",
781
+ "-preset",
782
+ "veryfast",
783
+ "-c:a",
784
+ "aac",
785
+ "-movflags",
786
+ "+faststart"
787
+ ];
788
+ var VP8_ARGS = [
789
+ "-c:v",
790
+ "libvpx",
791
+ "-b:v",
792
+ "0",
793
+ "-crf",
794
+ "23",
795
+ "-deadline",
796
+ "good",
797
+ "-pix_fmt",
798
+ "yuva420p",
799
+ "-colorspace",
800
+ "bt709",
801
+ "-color_primaries",
802
+ "bt709",
803
+ "-color_trc",
804
+ "bt709",
805
+ "-cpu-used",
806
+ "4",
807
+ "-auto-alt-ref",
808
+ "0",
809
+ "-metadata:s:v:0",
810
+ "alpha_mode=1",
811
+ "-ac",
812
+ "2",
813
+ "-c:a",
814
+ "libopus"
815
+ ];
816
+ async function buildVideoFilter(ffmpegPath, sourcePath, metadata, keepsAlpha, box) {
698
817
  const { hdrTransfer } = metadata.color;
699
818
  const toneMap = (hdrTransfer === "pq" || hdrTransfer === "hlg") && !keepsAlpha;
700
819
  if (toneMap) await ensureHdrFilters(ffmpegPath);
701
820
  const firstFrame = toneMap ? await probeFirstFrameColour(sourcePath) : {};
702
821
  const evenScale = proxyScaleFilter(box);
703
822
  const pixelFormat = keepsAlpha ? "yuva420p" : "yuv420p";
704
- const videoFilter = toneMap ? [
823
+ return toneMap ? [
705
824
  hdrToSdrToneMapFilter(metadata.color, firstFrame),
706
825
  `${evenScale}:out_color_matrix=bt709:out_range=tv`,
707
826
  `format=${pixelFormat}`
708
827
  ].join(",") : [evenScale, `format=${pixelFormat}`].join(",");
828
+ }
829
+ async function runFfmpeg(sourcePath, outputPath, chunkPrefix, variant, box, signal) {
830
+ const metadata = await probeMediaMetadata(sourcePath);
831
+ const ffmpegPath = findFfBinary("ffmpeg", { configuredMustExist: true });
832
+ if (!ffmpegPath) {
833
+ throw new FfmpegUnavailableError();
834
+ }
835
+ const keepsAlpha = variant === "vp8";
836
+ const videoFilter = await buildVideoFilter(ffmpegPath, sourcePath, metadata, keepsAlpha, box);
837
+ const alphaDecoder = keepsAlpha ? alphaDecoderFor(metadata.color.codecName) : null;
838
+ const decoderArgs = alphaDecoder ? ["-c:v", alphaDecoder] : [];
839
+ const encode = (target, timeoutMs, range) => spawnFfmpeg(
840
+ ffmpegPath,
841
+ [
842
+ "-y",
843
+ ...range ? ["-ss", String(range.startSeconds)] : [],
844
+ ...decoderArgs,
845
+ "-i",
846
+ sourcePath,
847
+ ...range ? ["-t", String(range.lengthSeconds)] : [],
848
+ "-vf",
849
+ videoFilter,
850
+ ...variant === "vp8" ? VP8_ARGS : H264_ARGS,
851
+ target
852
+ ],
853
+ timeoutMs,
854
+ signal
855
+ );
856
+ const ranges = chunkRanges(metadata.durationSeconds);
857
+ if (!ranges) return encode(outputPath, TRANSCODE_TIMEOUT_MS);
858
+ await encodeInChunks(
859
+ ranges,
860
+ chunkPrefix,
861
+ outputPath,
862
+ encode,
863
+ (listPath, target) => spawnFfmpeg(ffmpegPath, concatArgs(listPath, target, variant), CONCAT_TIMEOUT_MS, signal)
864
+ );
865
+ }
866
+ function concatArgs(listPath, target, variant) {
867
+ return [
868
+ "-y",
869
+ "-f",
870
+ "concat",
871
+ "-safe",
872
+ "0",
873
+ "-i",
874
+ listPath,
875
+ "-c",
876
+ "copy",
877
+ ...variant === "h264" ? ["-movflags", "+faststart"] : [],
878
+ target
879
+ ];
880
+ }
881
+ function spawnFfmpeg(ffmpegPath, args, timeoutMs, signal) {
709
882
  return new Promise((resolvePromise, reject) => {
710
- const alphaDecoder = keepsAlpha ? alphaDecoderFor(metadata.color.codecName) : null;
711
- const decoderArgs = alphaDecoder ? ["-c:v", alphaDecoder] : [];
712
- const commonArgs = ["-y", ...decoderArgs, "-i", sourcePath, "-vf", videoFilter];
713
- const h264Args = [
714
- "-c:v",
715
- "libx264",
716
- "-profile:v",
717
- "high",
718
- "-pix_fmt",
719
- "yuv420p",
720
- "-colorspace",
721
- "bt709",
722
- "-color_primaries",
723
- "bt709",
724
- "-color_trc",
725
- "bt709",
726
- "-crf",
727
- "18",
728
- "-preset",
729
- "veryfast",
730
- "-c:a",
731
- "aac",
732
- "-movflags",
733
- "+faststart"
734
- ];
735
- const vp8Args = [
736
- "-c:v",
737
- "libvpx",
738
- "-b:v",
739
- "0",
740
- "-crf",
741
- "23",
742
- "-deadline",
743
- "good",
744
- "-pix_fmt",
745
- "yuva420p",
746
- "-colorspace",
747
- "bt709",
748
- "-color_primaries",
749
- "bt709",
750
- "-color_trc",
751
- "bt709",
752
- "-cpu-used",
753
- "4",
754
- "-auto-alt-ref",
755
- "0",
756
- "-metadata:s:v:0",
757
- "alpha_mode=1",
758
- "-ac",
759
- "2",
760
- "-c:a",
761
- "libopus"
762
- ];
763
- const args = [...commonArgs, ...variant === "vp8" ? vp8Args : h264Args, outputPath];
764
883
  signal.throwIfAborted();
765
884
  const proc = spawn(ffmpegPath, args, {
766
885
  stdio: ["ignore", "ignore", "pipe"],
767
- timeout: TRANSCODE_TIMEOUT_MS,
886
+ timeout: timeoutMs,
768
887
  killSignal: "SIGKILL",
769
888
  signal,
770
889
  windowsHide: true
@@ -783,7 +902,7 @@ async function runFfmpeg(sourcePath, outputPath, variant, box, signal) {
783
902
  } else if (signal2) {
784
903
  reject(
785
904
  new ProxyTranscodeError(
786
- `ffmpeg killed by ${signal2} (timeout ${TRANSCODE_TIMEOUT_MS}ms or external kill)`,
905
+ `ffmpeg killed by ${signal2} (timeout ${timeoutMs}ms or external kill)`,
787
906
  null,
788
907
  stderrTail
789
908
  )
@@ -808,7 +927,18 @@ async function transcodeToCache(job, projectDir, absoluteSourcePath, cachePath,
808
927
  mkdirWithinProject(projectDir, cacheDir);
809
928
  const tempPath = join2(cacheDir, `.tmp-${randomUUID()}-${basename(cachePath)}`);
810
929
  try {
811
- await runFfmpeg(absoluteSourcePath, tempPath, variant, box, job.abandoned.signal);
930
+ const chunkPrefix = join2(
931
+ cacheDir,
932
+ `${CHUNK_PREFIX}${basename(cachePath, extname2(cachePath))}-`
933
+ );
934
+ await runFfmpeg(
935
+ absoluteSourcePath,
936
+ tempPath,
937
+ chunkPrefix,
938
+ variant,
939
+ box,
940
+ job.abandoned.signal
941
+ );
812
942
  renameSync(tempPath, cachePath);
813
943
  maintainProxyCache(cacheDir);
814
944
  return cachePath;
@@ -876,13 +1006,23 @@ async function resolveProxy(projectDir, absoluteSourcePath, variant = "h264", bo
876
1006
  }
877
1007
  async function resolveProxies(projectDir, sources, onSettled = () => {
878
1008
  }) {
1009
+ const first = sources[0];
1010
+ if (first) {
1011
+ maintainProxyCache(
1012
+ dirname(getProxyCachePath(projectDir, first.sourcePath, first.variant)),
1013
+ Math.min(
1014
+ Number(process.env.HYPERFRAMES_PROXY_CACHE_STALE_TEMP_MS) || UNTOUCHED_TEMP_IS_DEAD_MS,
1015
+ UNTOUCHED_TEMP_IS_DEAD_MS
1016
+ )
1017
+ );
1018
+ }
879
1019
  const results = [];
880
1020
  let next = 0;
881
1021
  const worker = async () => {
882
1022
  for (let index = next++; index < sources.length; index = next++) {
883
- const { sourcePath, variant } = sources[index];
1023
+ const { sourcePath, variant, box } = sources[index];
884
1024
  results[index] = await waitForProxy(
885
- resolveProxy(projectDir, sourcePath, variant),
1025
+ resolveProxy(projectDir, sourcePath, variant, box),
886
1026
  TRANSCODE_TIMEOUT_MS
887
1027
  ).then(
888
1028
  (value) => ({ status: "fulfilled", value }),
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  findCompositionDimensions
9
- } from "./chunk-FH7WODJH.js";
9
+ } from "./chunk-ZFFKWHXN.js";
10
10
  import {
11
11
  c
12
12
  } from "./chunk-ZTZA4UWZ.js";
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  readCompositionFps
9
- } from "./chunk-B2P4JRUJ.js";
9
+ } from "./chunk-XNLYMHX2.js";
10
10
  import {
11
11
  errorBox
12
12
  } from "./chunk-K2FLNJVB.js";
@@ -16,10 +16,10 @@ import {
16
16
  import {
17
17
  DEFAULT_CONFIG,
18
18
  resolvePageNavigationTimeout
19
- } from "./chunk-YCW345M4.js";
19
+ } from "./chunk-OAPYPSEB.js";
20
20
  import {
21
21
  parseFps
22
- } from "./chunk-YV4WT7CJ.js";
22
+ } from "./chunk-56IOFIYB.js";
23
23
 
24
24
  // src/browser/windowsCrash.ts
25
25
  var STATUS_STACK_BUFFER_OVERRUN_DEC = "3221225595";
@@ -43,8 +43,8 @@ function windowsChromeCrashRemediation(errorMessage) {
43
43
  }
44
44
 
45
45
  // src/utils/renderArgs.ts
46
- import { readFileSync } from "fs";
47
- import { resolve, sep } from "path";
46
+ import { readFileSync, realpathSync } from "fs";
47
+ import { isAbsolute, relative, resolve, sep } from "path";
48
48
  var MIN_PAGE_NAVIGATION_TIMEOUT_MS = 1;
49
49
  var MAX_PAGE_NAVIGATION_TIMEOUT_SECONDS = 86400;
50
50
  function parseBrowserTimeoutMsArg(raw) {
@@ -113,12 +113,13 @@ function normalizeCompositionEntryArg(raw) {
113
113
  function hasExplicitCompositionArg(raw) {
114
114
  return normalizeCompositionEntryArg(raw) !== void 0;
115
115
  }
116
- function parseCompositionEntryArg(raw, projectDir, stat) {
116
+ function parseCompositionEntryArg(raw, projectDir, stat, real = realpathOrSame) {
117
117
  const trimmed = normalizeCompositionEntryArg(raw);
118
118
  if (!trimmed) return { ok: true, value: void 0 };
119
119
  const absProjectDir = resolve(projectDir);
120
120
  const entryPath = resolve(absProjectDir, trimmed);
121
- if (entryPath !== absProjectDir && !entryPath.startsWith(absProjectDir + sep)) {
121
+ const relativeEntry = [absProjectDir, real(absProjectDir)].flatMap((root) => [entryPath, real(entryPath)].map((path) => relative(root, path))).find((rel) => rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel));
122
+ if (relativeEntry === void 0) {
122
123
  return { ok: false, error: { kind: "outside-project", entryFile: trimmed } };
123
124
  }
124
125
  let entryStat;
@@ -130,7 +131,14 @@ function parseCompositionEntryArg(raw, projectDir, stat) {
130
131
  if (!entryStat.isFile()) {
131
132
  return { ok: false, error: { kind: "not-a-file", entryFile: trimmed } };
132
133
  }
133
- return { ok: true, value: trimmed };
134
+ return { ok: true, value: relativeEntry.split(sep).join("/") };
135
+ }
136
+ function realpathOrSame(path) {
137
+ try {
138
+ return realpathSync(path);
139
+ } catch {
140
+ return path;
141
+ }
134
142
  }
135
143
  function compositionEntryErrorMessage(error) {
136
144
  switch (error.kind) {
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  shouldTrack
9
- } from "./chunk-PMXR3IUH.js";
9
+ } from "./chunk-TTZTGXKG.js";
10
10
 
11
11
  // src/telemetry/renderObservability.ts
12
12
  function renderObservabilityTelemetryPayload(observability) {