hyperframes 0.8.183 → 0.8.184

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 (168) hide show
  1. package/dist/{add-HW3ZGR36.js → add-5ZTD3MUZ.js} +11 -11
  2. package/dist/{animatedGifPrep-EPLN37ZN.js → animatedGifPrep-AGASIWVA.js} +6 -5
  3. package/dist/api.js +14 -13
  4. package/dist/{asset-TOASKL3Z.js → asset-LSTEMPIB.js} +2 -2
  5. package/dist/{assetCataloger-PZN5HYG2.js → assetCataloger-BKBMNL3A.js} +6 -5
  6. package/dist/{audio-F5OIQVJO.js → audio-KGK44XE4.js} +13 -12
  7. package/dist/{auth-YVQLRS3T.js → auth-MJWKYK77.js} +1 -1
  8. package/dist/{autoUpdate-EG4ZFW4D.js → autoUpdate-2GGDKYR2.js} +2 -2
  9. package/dist/{backgroundChecks-WINNQVR2.js → backgroundChecks-7GRX5VQY.js} +3 -3
  10. package/dist/backgroundChecksWorker.js +3 -3
  11. package/dist/{batchRender-PASZTMEE.js → batchRender-BCV2LELR.js} +3 -3
  12. package/dist/{beats-KGIOEBLW.js → beats-7BCFRBAL.js} +4 -4
  13. package/dist/{benchmark-ZNY2L7HN.js → benchmark-2R6CN5MQ.js} +8 -8
  14. package/dist/{browser-REAO7RU4.js → browser-6AFGOI7G.js} +3 -3
  15. package/dist/{bundleWithLocalizedFonts-OAYLYC4W.js → bundleWithLocalizedFonts-2EGPA5ZO.js} +2 -2
  16. package/dist/{capture-IK6GWQDD.js → capture-HA2UHLIU.js} +2 -2
  17. package/dist/{capture-WOSF276U.js → capture-HOIAW6MO.js} +9 -8
  18. package/dist/{captureCompositionFrame-DDZNKYRE.js → captureCompositionFrame-4236FVWJ.js} +10 -9
  19. package/dist/{catalog-AKTXS7OJ.js → catalog-A6CZAWW4.js} +11 -11
  20. package/dist/{catch-up-O3VZMPVE.js → catch-up-TNA4DJOA.js} +4 -4
  21. package/dist/{check-6E46NIWI.js → check-5E5U2EQZ.js} +30 -29
  22. package/dist/{checkBrowser-UNZHQFNH.js → checkBrowser-FNINXBMZ.js} +27 -26
  23. package/dist/{chunk-5MBLWFLM.js → chunk-2PVE4WS2.js} +1 -1
  24. package/dist/{chunk-TOHA5NAU.js → chunk-2ULXZ4PG.js} +10 -10
  25. package/dist/{chunk-GAGMLVCV.js → chunk-2XA7KXQO.js} +2 -2
  26. package/dist/{chunk-4UFJWRHG.js → chunk-3MDJIWOV.js} +174 -62
  27. package/dist/{chunk-NZ3BE2QE.js → chunk-3QVMJ7GX.js} +7 -7
  28. package/dist/{chunk-3Q47QC46.js → chunk-3TXNNBI2.js} +1 -1
  29. package/dist/{chunk-Z4R35NJS.js → chunk-4KKKBEP3.js} +3 -3
  30. package/dist/{chunk-RZXUQR42.js → chunk-4N4P3ZWL.js} +2 -2
  31. package/dist/{chunk-J4L5TPLS.js → chunk-5UDRPPN2.js} +48 -6
  32. package/dist/{chunk-XJHKJXT4.js → chunk-74JMKLVU.js} +1 -1
  33. package/dist/{chunk-OH56PXFH.js → chunk-7HJALUIO.js} +1 -1
  34. package/dist/{chunk-BP4VNTZL.js → chunk-7MB2ZAQF.js} +1 -1
  35. package/dist/{chunk-HLBODNGW.js → chunk-7NRI7HYX.js} +1 -1
  36. package/dist/{chunk-ANR6WOC3.js → chunk-ABZYYUUH.js} +1 -1
  37. package/dist/{chunk-VH5KESLX.js → chunk-BCHSTE7U.js} +1 -1
  38. package/dist/{chunk-KRFAX5JK.js → chunk-CXABAXB3.js} +1 -1
  39. package/dist/{chunk-LBWRQ4XA.js → chunk-DWUGKEHR.js} +1 -1
  40. package/dist/{chunk-MIZDJVPZ.js → chunk-E32ZQ2WO.js} +1 -1
  41. package/dist/{chunk-CAHTO62O.js → chunk-EM7C7H7S.js} +7 -7
  42. package/dist/{chunk-B2SZZFWW.js → chunk-ES426XRJ.js} +3 -3
  43. package/dist/{chunk-O7N3A7PE.js → chunk-FGJEUV4S.js} +1 -1
  44. package/dist/{chunk-Q6UYKWBG.js → chunk-GDEV42FA.js} +14 -14
  45. package/dist/{chunk-TXGZZKDF.js → chunk-HR23IKLZ.js} +2 -2
  46. package/dist/{chunk-XOVHO3TT.js → chunk-ICJEAFPD.js} +7 -7
  47. package/dist/{chunk-4FQKS7BJ.js → chunk-IWTNTUPQ.js} +4 -4
  48. package/dist/chunk-IZCW2NKT.js +29 -0
  49. package/dist/{chunk-X3IA5RYH.js → chunk-J36JVBLR.js} +9 -2
  50. package/dist/{chunk-VFBAKPRC.js → chunk-J3QM7AHP.js} +1 -1
  51. package/dist/{chunk-ITSLKUQM.js → chunk-JB6ARMQS.js} +1 -1
  52. package/dist/{chunk-DLC2FICN.js → chunk-JIUTXKWA.js} +1 -1
  53. package/dist/{chunk-GTE5WZAM.js → chunk-KN46TGHV.js} +1 -1
  54. package/dist/{chunk-VDJO4DJ7.js → chunk-LLC4CS6I.js} +2 -2
  55. package/dist/{chunk-TJB4GAV6.js → chunk-LRGYPXHF.js} +1 -1
  56. package/dist/{chunk-CGK4XZ2J.js → chunk-MFAETWIF.js} +1 -1
  57. package/dist/{chunk-QGOYNPQT.js → chunk-OLZENUPI.js} +47 -4
  58. package/dist/{chunk-K2Z5DZBS.js → chunk-PFYWVUHA.js} +1 -1
  59. package/dist/{chunk-F6WHPHLF.js → chunk-PSKEKWVU.js} +1 -1
  60. package/dist/{chunk-3OLIGYWN.js → chunk-Q33P4EAC.js} +2 -2
  61. package/dist/{chunk-CJYAJ3QM.js → chunk-QL2PNIXC.js} +9 -9
  62. package/dist/{chunk-IC2WYONA.js → chunk-R2BFTECP.js} +3 -3
  63. package/dist/chunk-R2SQBPMH.js +3805 -0
  64. package/dist/{chunk-73LTCCZI.js → chunk-RGXVEYHI.js} +15 -15
  65. package/dist/{chunk-SAQYJLI6.js → chunk-SAX7HQ5E.js} +1 -1
  66. package/dist/{chunk-GPE3WWTO.js → chunk-SN7KI5JA.js} +13 -10
  67. package/dist/{chunk-ATMDOUNN.js → chunk-TE427YID.js} +2 -2
  68. package/dist/{chunk-VAK7A2N6.js → chunk-UJKUB2LH.js} +10 -10
  69. package/dist/{chunk-DEORFAWP.js → chunk-UKOTVJFV.js} +1 -1
  70. package/dist/{chunk-ZFO3A3QL.js → chunk-UNNXFKVG.js} +2 -2
  71. package/dist/{chunk-UNOSCGBG.js → chunk-VDM3FEDP.js} +1 -1
  72. package/dist/{chunk-QX4GGPMY.js → chunk-VNVQGDPC.js} +1 -1
  73. package/dist/{chunk-3BA2GP4H.js → chunk-WHPN2TIT.js} +5 -5
  74. package/dist/{chunk-XR5BSEUF.js → chunk-WTFUDNW2.js} +3 -3
  75. package/dist/{chunk-U5YVWG5W.js → chunk-X3CG5YQA.js} +3 -3
  76. package/dist/{chunk-XAQDR5Y5.js → chunk-XGHHVYC7.js} +94 -32
  77. package/dist/{chunk-WT4PYV2J.js → chunk-YALM6XN4.js} +200 -53
  78. package/dist/{chunk-R6OV4J4K.js → chunk-YOZPQCSR.js} +3 -3
  79. package/dist/{chunk-COTLNID2.js → chunk-YWHCXIMD.js} +5 -5
  80. package/dist/{chunk-5OGDBU4G.js → chunk-YWNJTZGN.js} +2 -2
  81. package/dist/{chunk-AKFADCMS.js → chunk-ZOCHDXDG.js} +1 -1
  82. package/dist/{chunk-EVAQPW6O.js → chunk-ZRHO6YMM.js} +2 -2
  83. package/dist/{clean-WNEIVBF3.js → clean-HGASSMWI.js} +14 -13
  84. package/dist/cli.js +53 -53
  85. package/dist/{cloud-6GSSDCJL.js → cloud-JPDVNXHN.js} +4 -4
  86. package/dist/{cloudrun-4NEJRE4T.js → cloudrun-AMMGSDRP.js} +4 -4
  87. package/dist/{compare-2JWQ5ABA.js → compare-LHHVHUN3.js} +24 -23
  88. package/dist/{compiler-27KQD7KW.js → compiler-Q3N6QXMT.js} +2 -2
  89. package/dist/{component-HCRET3MH.js → component-D72J32Q7.js} +3 -3
  90. package/dist/{compositions-HTSQ6SUJ.js → compositions-UQRJ5ROG.js} +10 -9
  91. package/dist/{delete-GHQ5UYM7.js → delete-P42VIDDA.js} +3 -3
  92. package/dist/{deploy-I3Z3NAVA.js → deploy-WZTH57O4.js} +1 -1
  93. package/dist/{deterministicFonts-JFLSSKRB.js → deterministicFonts-VQ5UBMXY.js} +1 -1
  94. package/dist/{dist-WRDLWRMS.js → dist-DYS24AMA.js} +2 -2
  95. package/dist/{doctor-UGFVQZHI.js → doctor-KEJIG2SK.js} +10 -9
  96. package/dist/{events-YS4OVX3I.js → events-CYKSNR7N.js} +2 -2
  97. package/dist/{events-BLJGWMNP.js → events-UZXFQPMT.js} +3 -3
  98. package/dist/{feedback-AZ3SJ5HF.js → feedback-LXNQF7CA.js} +7 -7
  99. package/dist/{ffmpeg-2AECXG7V.js → ffmpeg-BYHON577.js} +6 -5
  100. package/dist/{figma-DRYIJQHV.js → figma-EIQ35PS6.js} +3 -3
  101. package/dist/fontLocalizeCli.js +9 -8
  102. package/dist/{get-DDEAOFPB.js → get-CC2YL7QO.js} +3 -3
  103. package/dist/{gpuPolicy-UDJT2MQK.js → gpuPolicy-VFSACUQV.js} +6 -5
  104. package/dist/{grade-compare-LJKK5NSY.js → grade-compare-TUQL7IV2.js} +25 -24
  105. package/dist/{help-TQBGYOID.js → help-ROROO5K6.js} +1 -1
  106. package/dist/{history-5TOOCF2Y.js → history-PNELYLXX.js} +6 -6
  107. package/dist/hyperframe.manifest.json +1 -1
  108. package/dist/hyperframe.runtime.iife.js +59 -59
  109. package/dist/hyperframes-player.global.js +1 -1
  110. package/dist/{info-ENI5MP4W.js → info-4FZTH6AS.js} +7 -7
  111. package/dist/{init-JXPXWV3G.js → init-I43GHHVP.js} +26 -25
  112. package/dist/{inspect-WZNYQ5AB.js → inspect-IT4TYIZ3.js} +25 -24
  113. package/dist/{installer-3SGRBLJW.js → installer-CWOJVK5K.js} +4 -4
  114. package/dist/{keyframes-HEOC4CT4.js → keyframes-3FBOGVD4.js} +6 -6
  115. package/dist/{lambda-2VHQ4AL2.js → lambda-H3V32I7M.js} +6 -6
  116. package/dist/{layout-7WEUNO6T.js → layout-BZ5LYJ5C.js} +25 -24
  117. package/dist/{lint-5YMAF3L7.js → lint-ZTNSGP2S.js} +6 -6
  118. package/dist/{list-BIE3X7CO.js → list-XM4GWJYY.js} +3 -3
  119. package/dist/{login-YDIGJWCG.js → login-H6HYKMWX.js} +4 -4
  120. package/dist/{manager-D2UV6RDQ.js → manager-TWVDSJXO.js} +7 -6
  121. package/dist/{media-treatment-FSKHPMWA.js → media-treatment-N7MY5NXB.js} +12 -11
  122. package/dist/{models-COEK6LXG.js → models-WEMIMYBD.js} +10 -9
  123. package/dist/{motionShot-HYZ2ZGJQ.js → motionShot-RHICTVPU.js} +13 -12
  124. package/dist/{normalize-audio-UXR6WQ7Q.js → normalize-audio-ZFUZCJE3.js} +4 -4
  125. package/dist/{open-OFT2GIDG.js → open-IBJ4FL3G.js} +11 -11
  126. package/dist/{parakeetRunner-4NZ3QXS3.js → parakeetRunner-XXO4WSLR.js} +11 -10
  127. package/dist/{pipeline-ZKE54JMG.js → pipeline-6ML3LUVK.js} +7 -6
  128. package/dist/{play-2VG77FT6.js → play-RV4NAVF5.js} +17 -16
  129. package/dist/{preflight-QTWDIM5C.js → preflight-R3DEFMLA.js} +7 -6
  130. package/dist/{present-OONXQLJG.js → present-5TBJGE6B.js} +13 -12
  131. package/dist/{preview-6RZJFU76.js → preview-FLKZ5CXJ.js} +23 -22
  132. package/dist/{producer-6YM3UH3B.js → producer-7XYSPVKH.js} +1 -1
  133. package/dist/{projectConfig-YMW4P2X6.js → projectConfig-TBU2VWZX.js} +6 -6
  134. package/dist/{publication-SEINUAPZ.js → publication-CWWUJYJ5.js} +2 -2
  135. package/dist/{publish-KZBTBWFO.js → publish-FSNE4FEB.js} +9 -8
  136. package/dist/{remove-background-BIQNMIR7.js → remove-background-MDFWRWCT.js} +8 -7
  137. package/dist/render-DBGQZAZT.js +1516 -0
  138. package/dist/{render-FIH37HJA.js → render-F4JQ553X.js} +27 -26
  139. package/dist/{render-LW76HOMJ.js → render-LWZKXCLY.js} +3 -3
  140. package/dist/{render-batch-POLEEYD4.js → render-batch-PU7NMLIJ.js} +3 -3
  141. package/dist/{resolver-O2SED3XB.js → resolver-RUBGFXPC.js} +4 -4
  142. package/dist/{sherpa-HTFFFTVQ.js → sherpa-X2TBNO6P.js} +10 -9
  143. package/dist/{skills-J6MBGS5O.js → skills-WHKMWO2D.js} +5 -5
  144. package/dist/{skillsUpdateCheck-ZAXNLBF3.js → skillsUpdateCheck-XQGZGJJG.js} +3 -3
  145. package/dist/{snapshot-TL7TTFS6.js → snapshot-M4NUUSNU.js} +28 -27
  146. package/dist/{src-EL6HGIS4.js → src-4UYM2K3S.js} +5 -4
  147. package/dist/{src-Z5H5N5T4.js → src-6MSC62U2.js} +11 -7
  148. package/dist/{staticProjectServer-EO7X7RAY.js → staticProjectServer-ERDTFP45.js} +13 -12
  149. package/dist/studio/assets/{hyperframes-player-hz_VqxBZ.js → hyperframes-player-DEncBxR7.js} +1 -1
  150. package/dist/studio/assets/{index-S1ceEagc.js → index-BABXr78Q.js} +4 -4
  151. package/dist/studio/assets/{index-CV_ojgp5.js → index-Cc22mgvY.js} +1 -1
  152. package/dist/studio/index.html +1 -1
  153. package/dist/{studio-api-CUZDC5B3.js → studio-api-SAKD3VKC.js} +7 -6
  154. package/dist/{studioServer-EZPRV43Y.js → studioServer-IRI7EVOM.js} +43 -42
  155. package/dist/{telemetry-LFUVHARP.js → telemetry-F4XADVAF.js} +3 -3
  156. package/dist/{timeline-GSH743JE.js → timeline-5I444RRE.js} +15 -14
  157. package/dist/{tokens-3ZMPSH7B.js → tokens-LRRYM35A.js} +2 -2
  158. package/dist/{transcribe-4SHNDPWW.js → transcribe-44XDFNVU.js} +15 -14
  159. package/dist/{transcribe-TV7JBZQS.js → transcribe-WHYHWAB2.js} +9 -8
  160. package/dist/{updateCheck-W7FTFOQF.js → updateCheck-7CPH3CAZ.js} +2 -2
  161. package/dist/{upgrade-7YYYNAPF.js → upgrade-WW4GQ2RI.js} +2 -2
  162. package/dist/{urlDownloader-PQSUS2CP.js → urlDownloader-OHLLP45A.js} +5 -4
  163. package/dist/{validate-GCHAEVXM.js → validate-VNCDH2LW.js} +19 -18
  164. package/dist/{video-KGN7NJS5.js → video-5OHTLL2D.js} +6 -5
  165. package/dist/warmCheck.js +32 -31
  166. package/package.json +1 -1
  167. package/dist/chunk-GMNHAOMJ.js +0 -3805
  168. package/dist/render-65K3K6SD.js +0 -719
@@ -4,6 +4,10 @@ import { dirname as __hf_dirname } from "node:path";
4
4
  var require = __hf_createRequire(import.meta.url);
5
5
  var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
+ import {
8
+ alphaDecoderFor,
9
+ videoStreamHasAlpha
10
+ } from "./chunk-IZCW2NKT.js";
7
11
  import {
8
12
  DISTRIBUTED_FPS,
9
13
  MEDIA_VISUAL_STYLE_PROPERTIES,
@@ -22,7 +26,7 @@ import {
22
26
  renderFrameIdForRenderId,
23
27
  resolveAuthoredTimingWindow,
24
28
  toFps
25
- } from "./chunk-VFBAKPRC.js";
29
+ } from "./chunk-J3QM7AHP.js";
26
30
  import {
27
31
  AUDIO_GROUP_RENDER_ID_ATTR,
28
32
  COLOR_GRADING_SOURCE_HIDDEN_ATTR,
@@ -52,7 +56,7 @@ import {
52
56
  shiftRateLane,
53
57
  sourceTimeAt,
54
58
  timeAtSourceTime
55
- } from "./chunk-GMNHAOMJ.js";
59
+ } from "./chunk-R2SQBPMH.js";
56
60
  import {
57
61
  clampAudioGain,
58
62
  isAudibleVideoElement
@@ -8509,9 +8513,6 @@ function extractPngMetadataFromBuffer(buf) {
8509
8513
  }
8510
8514
  return width > 0 && height > 0 ? { width, height, colorSpace: colorSpaceFromCicp } : null;
8511
8515
  }
8512
- function pixelFormatHasAlpha(pixelFormat) {
8513
- return /^(?:yuva|rgba|argb|bgra|abgr|gbrap|ya|ayuv)/i.test(pixelFormat);
8514
- }
8515
8516
  function extractStillImageMetadata(filePath) {
8516
8517
  try {
8517
8518
  return extractPngMetadataFromBuffer(readFileSync(filePath));
@@ -8596,8 +8597,7 @@ async function extractMediaMetadata(filePath) {
8596
8597
  };
8597
8598
  const colorSpace = merged.colorTransfer || merged.colorPrimaries || merged.colorSpace ? merged : null;
8598
8599
  const pixelFormat = videoStream.pix_fmt || "";
8599
- const alphaMode = readTagCI(videoStream.tags, "alpha_mode");
8600
- const hasAlpha = pixelFormatHasAlpha(pixelFormat) || alphaMode === "1";
8600
+ const hasAlpha = videoStreamHasAlpha(videoStream);
8601
8601
  const containerDuration = output?.format.duration ? parseFloat(output.format.duration) : 0;
8602
8602
  const streamDuration = videoStream.duration ? parseFloat(videoStream.duration) : 0;
8603
8603
  const parsedStreamStart = videoStream.start_time ? parseFloat(videoStream.start_time) : 0;
@@ -12396,10 +12396,7 @@ function codecMayHaveAlpha(codec) {
12396
12396
  return ALPHA_CAPABLE_CODECS.has((codec ?? "").toLowerCase());
12397
12397
  }
12398
12398
  function decoderForCodec(codec) {
12399
- const c = (codec ?? "").toLowerCase();
12400
- if (c === "vp9") return "libvpx-vp9";
12401
- if (c === "vp8") return "libvpx";
12402
- return c;
12399
+ return alphaDecoderFor(codec) ?? (codec ?? "").toLowerCase();
12403
12400
  }
12404
12401
  function resolveFrameFormat(metadata, requested) {
12405
12402
  if (metadata.hasAlpha || codecMayHaveAlpha(metadata.videoCodec)) return "png";
@@ -16424,6 +16421,7 @@ async function captureFrameRange(session, task, captureOptions, signal, onFrameC
16424
16421
  if (signal?.aborted) throw new Error("Parallel worker cancelled");
16425
16422
  const time = i * captureOptions.fps.den / captureOptions.fps.num;
16426
16423
  const fileFrameIdx = i - outputOffset;
16424
+ let landedFrame;
16427
16425
  if (onFrameBuffer) {
16428
16426
  const { buffer } = await runCaptureOperation(
16429
16427
  "frame_capture",
@@ -16432,14 +16430,15 @@ async function captureFrameRange(session, task, captureOptions, signal, onFrameC
16432
16430
  );
16433
16431
  await onFrameBuffer(i, buffer, session);
16434
16432
  } else {
16435
- await runCaptureOperation(
16433
+ const { path } = await runCaptureOperation(
16436
16434
  "frame_capture",
16437
16435
  i,
16438
16436
  () => captureFrame(session, fileFrameIdx, time)
16439
16437
  );
16438
+ landedFrame = { index: fileFrameIdx, path };
16440
16439
  }
16441
16440
  framesCaptured++;
16442
- if (onFrameCaptured) onFrameCaptured(task.workerId, i);
16441
+ if (onFrameCaptured) onFrameCaptured(task.workerId, i, landedFrame);
16443
16442
  }
16444
16443
  return framesCaptured;
16445
16444
  }
@@ -16660,7 +16659,7 @@ async function executeParallelCapture(serverUrl, workDir, tasks, captureOptions,
16660
16659
  const workerProgress = /* @__PURE__ */ new Map();
16661
16660
  const workerPhases = /* @__PURE__ */ new Map();
16662
16661
  for (const task of tasks) workerProgress.set(task.workerId, 0);
16663
- const onFrameCaptured = (workerId, _frameIndex) => {
16662
+ const onFrameCaptured = (workerId, _frameIndex, landedFrame) => {
16664
16663
  const current = workerProgress.get(workerId) || 0;
16665
16664
  workerProgress.set(workerId, current + 1);
16666
16665
  if (onProgress) {
@@ -16669,7 +16668,8 @@ async function executeParallelCapture(serverUrl, workDir, tasks, captureOptions,
16669
16668
  totalFrames,
16670
16669
  capturedFrames,
16671
16670
  activeWorkers: tasks.length,
16672
- workerProgress: new Map(workerProgress)
16671
+ workerProgress: new Map(workerProgress),
16672
+ ...landedFrame && { landedFrame }
16673
16673
  });
16674
16674
  }
16675
16675
  };
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-WQ6ZXHFQ.js";
10
10
  import {
11
11
  findFFmpeg
12
- } from "./chunk-OH56PXFH.js";
12
+ } from "./chunk-7HJALUIO.js";
13
13
  import {
14
14
  stoppableExecFile
15
15
  } from "./chunk-HU2SPFNG.js";
@@ -4,12 +4,16 @@ import { dirname as __hf_dirname } from "node:path";
4
4
  var require = __hf_createRequire(import.meta.url);
5
5
  var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
+ import {
8
+ alphaDecoderFor,
9
+ videoStreamHasAlpha
10
+ } from "./chunk-IZCW2NKT.js";
7
11
  import {
8
12
  firstFrameColourArgs,
9
13
  formatPreviewProxyBox,
10
14
  hdrToSdrToneMapFilter,
11
15
  parseFirstFrameColour
12
- } from "./chunk-VFBAKPRC.js";
16
+ } from "./chunk-J3QM7AHP.js";
13
17
  import {
14
18
  decodeAuthoredAttribute,
15
19
  scanHtmlOpeningTags
@@ -32,7 +36,7 @@ import {
32
36
  rewriteAssetPath
33
37
  } from "./chunk-BSQ7XANM.js";
34
38
 
35
- // ../studio-server/dist/chunk-E3VGIAMJ.js
39
+ // ../studio-server/dist/chunk-OVOXGASQ.js
36
40
  import { statSync } from "fs";
37
41
  import { sep } from "path";
38
42
  import { execFile } from "child_process";
@@ -91,10 +95,6 @@ function colorLabel(input) {
91
95
  }
92
96
  return "SDR/unknown";
93
97
  }
94
- var ALPHA_PIX_FMT_RE = /^(?:yuva|rgba|argb|bgra|abgr|gbrap|ya)/;
95
- function pixelFormatHasAlpha(pixFmt) {
96
- return pixFmt !== void 0 && ALPHA_PIX_FMT_RE.test(pixFmt.toLowerCase());
97
- }
98
98
  function classifyMediaColor(stream) {
99
99
  const colorPrimaries = lower(stream?.color_primaries);
100
100
  const colorSpace = lower(stream?.color_space);
@@ -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",
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",
143
143
  "-of",
144
144
  "json",
145
145
  "--",
@@ -162,6 +162,7 @@ async function probeMediaMetadata(filePath, runner = execFileRunner) {
162
162
  const metadata = { kind, color: classifyMediaColor(stream) };
163
163
  if (kind === "video") {
164
164
  metadata.hasAudio = (parsed.streams ?? []).some((item) => item.codec_type === "audio");
165
+ metadata.hasAlpha = stream !== void 0 && videoStreamHasAlpha(stream);
165
166
  }
166
167
  return metadata;
167
168
  } catch {
@@ -249,7 +250,7 @@ async function probeCodecFacts(filePath, runner) {
249
250
  if (metadata.kind !== "video") return null;
250
251
  const codecName = metadata.color.codecName;
251
252
  if (!codecName) return null;
252
- return codecFactsFor(codecName, pixelFormatHasAlpha(metadata.color.pixelFormat));
253
+ return codecFactsFor(codecName, metadata.hasAlpha === true);
253
254
  }
254
255
  function createMediaCodecProbeCache() {
255
256
  return /* @__PURE__ */ new Map();
@@ -337,7 +338,7 @@ async function scanProjectMediaCodecMap(projectDir, htmlSources, options = {}) {
337
338
  return map;
338
339
  }
339
340
 
340
- // ../studio-server/dist/chunk-D5RQMNZQ.js
341
+ // ../studio-server/dist/chunk-25IT6FMR.js
341
342
  import { spawn } from "child_process";
342
343
  import { createHash, randomUUID } from "crypto";
343
344
  import { existsSync as existsSync2, renameSync, statSync as statSync2, unlinkSync as unlinkSync2, utimesSync } from "fs";
@@ -706,7 +707,9 @@ async function runFfmpeg(sourcePath, outputPath, variant, box, signal) {
706
707
  `format=${pixelFormat}`
707
708
  ].join(",") : [evenScale, `format=${pixelFormat}`].join(",");
708
709
  return new Promise((resolvePromise, reject) => {
709
- const commonArgs = ["-y", "-i", sourcePath, "-vf", videoFilter];
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];
710
713
  const h264Args = [
711
714
  "-c:v",
712
715
  "libx264",
@@ -8,10 +8,10 @@ import {
8
8
  DEFAULT_VP9_CPU_USED,
9
9
  isHttpUrl,
10
10
  runFfmpeg
11
- } from "./chunk-73LTCCZI.js";
11
+ } from "./chunk-RGXVEYHI.js";
12
12
  import {
13
13
  parseAnimatedGifMetadata
14
- } from "./chunk-VFBAKPRC.js";
14
+ } from "./chunk-J3QM7AHP.js";
15
15
  import {
16
16
  parseHTML
17
17
  } from "./chunk-SDYDNHEE.js";
@@ -6,23 +6,23 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  resolveProject
9
- } from "./chunk-TJB4GAV6.js";
9
+ } from "./chunk-LRGYPXHF.js";
10
10
  import {
11
11
  installPageFunctionGuard,
12
12
  resolveCliChromeGpuMode,
13
13
  seekCompositionTimeline,
14
14
  waitForRuntimeReady
15
- } from "./chunk-XOVHO3TT.js";
15
+ } from "./chunk-ICJEAFPD.js";
16
16
  import {
17
17
  resolveCompositionViewportFromHtml
18
18
  } from "./chunk-FH7WODJH.js";
19
19
  import {
20
20
  launchManagedBrowser,
21
21
  resolveManagedGpuMode
22
- } from "./chunk-GTE5WZAM.js";
22
+ } from "./chunk-KN46TGHV.js";
23
23
  import {
24
24
  pageNavigationTimeoutMs
25
- } from "./chunk-B2SZZFWW.js";
25
+ } from "./chunk-ES426XRJ.js";
26
26
  import {
27
27
  defineCommand
28
28
  } from "./chunk-S3S4TGEH.js";
@@ -39,7 +39,7 @@ import {
39
39
  import {
40
40
  printDeprecationNotice,
41
41
  withMeta
42
- } from "./chunk-ANR6WOC3.js";
42
+ } from "./chunk-ABZYYUUH.js";
43
43
  import {
44
44
  normalizeErrorMessage
45
45
  } from "./chunk-KNU5COPB.js";
@@ -227,7 +227,7 @@ function extractCompositionErrorsFromLint(lintResult) {
227
227
  async function localizeRemoteAssets(html) {
228
228
  let dir;
229
229
  try {
230
- const { loadProducer } = await import("./producer-6YM3UH3B.js");
230
+ const { loadProducer } = await import("./producer-7XYSPVKH.js");
231
231
  const { localizeRemoteMediaSources, localizeRemoteImageSources, localizeRemoteFontFaces } = await loadProducer();
232
232
  dir = mkdtempSync(join(tmpdir(), "hf-validate-assets-"));
233
233
  const assetDir = dir;
@@ -248,9 +248,9 @@ async function localizeRemoteAssets(html) {
248
248
  }
249
249
  async function validateInBrowser(project, opts) {
250
250
  const projectDir = project.dir;
251
- const { bundleToSingleHtml } = await import("./compiler-27KQD7KW.js");
251
+ const { bundleToSingleHtml } = await import("./compiler-Q3N6QXMT.js");
252
252
  const { ensureBrowser } = await import("./manager-UHWEKPXC.js");
253
- const { serveStaticProjectHtml } = await import("./staticProjectServer-EO7X7RAY.js");
253
+ const { serveStaticProjectHtml } = await import("./staticProjectServer-ERDTFP45.js");
254
254
  const { lintProject } = await import("./lintProject-C2ONSH2U.js");
255
255
  const lintResult = await lintProject(projectDir);
256
256
  const compositionErrors = extractCompositionErrorsFromLint(lintResult);
@@ -272,9 +272,9 @@ async function validateInBrowser(project, opts) {
272
272
  try {
273
273
  const browser = await ensureBrowser();
274
274
  const puppeteer = await import("puppeteer-core");
275
- const { buildChromeArgs, analyzeClipMediaFit } = await import("./src-EL6HGIS4.js");
275
+ const { buildChromeArgs, analyzeClipMediaFit } = await import("./src-4UYM2K3S.js");
276
276
  const requestedGpuMode = resolveCliChromeGpuMode();
277
- const { assertWebGpuAdapterAvailable, compositionRequiresWebGpu, resolveLocalWebGpu } = await import("./gpuPolicy-UDJT2MQK.js");
277
+ const { assertWebGpuAdapterAvailable, compositionRequiresWebGpu, resolveLocalWebGpu } = await import("./gpuPolicy-VFSACUQV.js");
278
278
  const resolvedGpuMode = await resolveManagedGpuMode(requestedGpuMode, browser.executablePath);
279
279
  const requiresWebGpu = compositionRequiresWebGpu(html);
280
280
  const { gpuConfig, softwareWebGpu } = resolveLocalWebGpu(resolvedGpuMode, requiresWebGpu);
@@ -37,7 +37,7 @@ import {
37
37
  } from "./chunk-XUXGIA7H.js";
38
38
  import {
39
39
  VERSION
40
- } from "./chunk-RZXUQR42.js";
40
+ } from "./chunk-4N4P3ZWL.js";
41
41
 
42
42
  // src/telemetry/transport.ts
43
43
  import { spawn } from "child_process";
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  resolveConfig,
9
9
  usesSoftwareWebGpu
10
- } from "./chunk-73LTCCZI.js";
10
+ } from "./chunk-RGXVEYHI.js";
11
11
 
12
12
  // src/browser/gpuPolicy.ts
13
13
  function resolveLocalBrowserGpuMode(browserGpuArg, envMode = process.env.PRODUCER_BROWSER_GPU_MODE) {
@@ -17,7 +17,7 @@ function resolveLocalBrowserGpuMode(browserGpuArg, envMode = process.env.PRODUCE
17
17
  return "auto";
18
18
  }
19
19
  async function resolveCaptureBrowserGpuMode(requestedMode, chromePath, probeLifecycle) {
20
- const { resolveBrowserGpuMode } = await import("./src-EL6HGIS4.js");
20
+ const { resolveBrowserGpuMode } = await import("./src-4UYM2K3S.js");
21
21
  return resolveBrowserGpuMode(requestedMode, { chromePath, probeLifecycle });
22
22
  }
23
23
  function resolveLocalWebGpu(browserGpuMode, requiresWebGpu) {
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  withOwner
9
- } from "./chunk-O7N3A7PE.js";
9
+ } from "./chunk-FGJEUV4S.js";
10
10
  import {
11
11
  HistoryBusyError,
12
12
  beginArtifactCapture
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  setHostHandlesSigint
9
- } from "./chunk-73LTCCZI.js";
9
+ } from "./chunk-RGXVEYHI.js";
10
10
  import {
11
11
  processAncestorSnapshot,
12
12
  processIdentity,
@@ -6,26 +6,26 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  parakeetRunner
9
- } from "./chunk-HLBODNGW.js";
9
+ } from "./chunk-7NRI7HYX.js";
10
10
  import {
11
11
  DecodeCancelled,
12
12
  prepareSherpaWav,
13
13
  sherpaUnsupportedReason,
14
14
  transcribeWithSherpa
15
- } from "./chunk-IC2WYONA.js";
15
+ } from "./chunk-R2BFTECP.js";
16
16
  import {
17
17
  initialModelForLanguage,
18
18
  transcribe
19
- } from "./chunk-U5YVWG5W.js";
19
+ } from "./chunk-X3CG5YQA.js";
20
20
  import {
21
21
  createRenderCancellationScope,
22
22
  stoppedByCancelSignal
23
- } from "./chunk-QX4GGPMY.js";
23
+ } from "./chunk-VNVQGDPC.js";
24
24
  import {
25
25
  DEFAULT_MODEL,
26
26
  findWhisper,
27
27
  isWhisperUnavailable
28
- } from "./chunk-SAQYJLI6.js";
28
+ } from "./chunk-SAX7HQ5E.js";
29
29
  import {
30
30
  formatSrt,
31
31
  formatVtt,
@@ -15,13 +15,13 @@ import {
15
15
  findFFmpeg,
16
16
  findFFprobe,
17
17
  getFFmpegInstallHint
18
- } from "./chunk-OH56PXFH.js";
18
+ } from "./chunk-7HJALUIO.js";
19
19
  import {
20
20
  DEFAULT_VP9_CPU_USED,
21
21
  SDR_RGB_TO_BT709_FILTER,
22
22
  SDR_RGB_TO_TAGGED_BT709_FILTER,
23
23
  renderProvenanceArgs
24
- } from "./chunk-73LTCCZI.js";
24
+ } from "./chunk-RGXVEYHI.js";
25
25
 
26
26
  // src/background-removal/pipeline.ts
27
27
  import { spawn } from "child_process";
@@ -262,7 +262,7 @@ function inferInputKind(inputPath) {
262
262
  }
263
263
  async function probeMedia(inputPath) {
264
264
  const isImage = inferInputKind(inputPath) === "image";
265
- const engine = await import("./src-EL6HGIS4.js");
265
+ const engine = await import("./src-4UYM2K3S.js");
266
266
  const meta = await engine.extractMediaMetadata(inputPath);
267
267
  if (isImage) {
268
268
  return { width: meta.width, height: meta.height, fps: 0, frameCount: 1 };
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  stoppedByCancelSignal
9
- } from "./chunk-QX4GGPMY.js";
9
+ } from "./chunk-VNVQGDPC.js";
10
10
  import {
11
11
  DEFAULT_MODEL,
12
12
  ensureModel,
@@ -14,12 +14,12 @@ import {
14
14
  hasFFmpeg,
15
15
  pinnedWhisperModel,
16
16
  sha256File
17
- } from "./chunk-SAQYJLI6.js";
17
+ } from "./chunk-SAX7HQ5E.js";
18
18
  import {
19
19
  findFFmpeg,
20
20
  findFFprobe,
21
21
  getFFmpegInstallHint
22
- } from "./chunk-OH56PXFH.js";
22
+ } from "./chunk-7HJALUIO.js";
23
23
  import {
24
24
  findWavChunk
25
25
  } from "./chunk-UOFAE5RF.js";
@@ -107,7 +107,15 @@ function writeTeamProject(projectDir, team) {
107
107
 
108
108
  // src/utils/publishProject.ts
109
109
  import { basename, dirname, join as join2, posix, relative, resolve as resolve2 } from "path";
110
- import { existsSync as existsSync2, readdirSync, readFileSync as readFileSync2, statSync } from "fs";
110
+ import {
111
+ closeSync,
112
+ existsSync as existsSync2,
113
+ fstatSync,
114
+ openSync,
115
+ readdirSync,
116
+ readFileSync as readFileSync2,
117
+ statSync
118
+ } from "fs";
111
119
  import AdmZip from "adm-zip";
112
120
  import ignore from "ignore";
113
121
  var IGNORED_DIRS = /* @__PURE__ */ new Set([".git", "node_modules", "dist", ".next", "coverage"]);
@@ -182,18 +190,19 @@ function getUploadHeaders(data, uploadUrl, contentType, archiveByteLength) {
182
190
  }
183
191
  }
184
192
  }
185
- if (!Object.keys(headers).some((key) => key.toLowerCase() === "content-type")) {
186
- headers["content-type"] = contentType;
187
- }
188
- const signedHeaders = new URL(uploadUrl).searchParams.get("X-Amz-SignedHeaders");
189
- if (signedHeaders?.split(";").includes("x-amz-server-side-encryption") && !Object.keys(headers).some((key) => key.toLowerCase() === "x-amz-server-side-encryption")) {
190
- headers["x-amz-server-side-encryption"] = "AES256";
193
+ setHeaderIfAbsent(headers, "content-type", contentType);
194
+ const signedHeaders = new URL(uploadUrl).searchParams.get("X-Amz-SignedHeaders")?.split(";") ?? [];
195
+ if (signedHeaders.includes("x-amz-server-side-encryption")) {
196
+ setHeaderIfAbsent(headers, "x-amz-server-side-encryption", "AES256");
191
197
  }
192
- if (signedHeaders?.split(";").includes("content-length") && !Object.keys(headers).some((key) => key.toLowerCase() === "content-length")) {
193
- headers["content-length"] = String(archiveByteLength);
198
+ if (signedHeaders.includes("content-length")) {
199
+ setHeaderIfAbsent(headers, "content-length", String(archiveByteLength));
194
200
  }
195
201
  return headers;
196
202
  }
203
+ function setHeaderIfAbsent(headers, name, value) {
204
+ if (!Object.keys(headers).some((key) => key.toLowerCase() === name)) headers[name] = value;
205
+ }
197
206
  async function readJson(response) {
198
207
  return response.clone().json().catch(() => null);
199
208
  }
@@ -330,6 +339,43 @@ function collectProjectFiles(rootDir, currentDir, paths, matcher) {
330
339
  }
331
340
  }
332
341
  var EXT_ASSETS_PREFIX = "_ext";
342
+ var TEXT_FILE_EXTS = /\.(html?|css|m?js|cjs|json|svg|xml|txt)$/i;
343
+ function stagedSize(file) {
344
+ return Buffer.isBuffer(file) ? file.byteLength : file.size;
345
+ }
346
+ function assertSame(file, now) {
347
+ if (now?.size !== file.size || now.mtimeMs !== file.mtimeMs) {
348
+ throw new Error(`${file.absPath} changed on disk while it was being prepared. Run it again.`);
349
+ }
350
+ }
351
+ function assertUnchanged(file) {
352
+ assertSame(file, statSync(file.absPath, { throwIfNoEntry: false }));
353
+ }
354
+ function readChecked(path, check) {
355
+ const fd = openSync(path, "r");
356
+ try {
357
+ check(fstatSync(fd));
358
+ const bytes = readFileSync2(fd);
359
+ check(fstatSync(fd));
360
+ return bytes;
361
+ } finally {
362
+ closeSync(fd);
363
+ }
364
+ }
365
+ function readStaged(file) {
366
+ if (Buffer.isBuffer(file)) return file;
367
+ return readChecked(file.absPath, (stat) => assertSame(file, stat));
368
+ }
369
+ function stageFile(absPath, onDiskMinBytes) {
370
+ const fd = openSync(absPath, "r");
371
+ try {
372
+ const { size, mtimeMs } = fstatSync(fd);
373
+ if (size < onDiskMinBytes || TEXT_FILE_EXTS.test(absPath)) return readFileSync2(fd);
374
+ return { absPath, size, mtimeMs };
375
+ } finally {
376
+ closeSync(fd);
377
+ }
378
+ }
333
379
  function addExternalAsset(ctx, absPath) {
334
380
  const existing = ctx.externalMap.get(absPath);
335
381
  if (existing) return existing;
@@ -343,7 +389,7 @@ function addExternalAsset(ctx, absPath) {
343
389
  while (ctx.usedArchivePaths.has(`${base}_${i}${ext}`)) i++;
344
390
  archivePath = `${base}_${i}${ext}`;
345
391
  }
346
- ctx.fileContents.set(archivePath, readFileSync2(absPath));
392
+ ctx.fileContents.set(archivePath, stageFile(absPath, ctx.onDiskMinBytes));
347
393
  ctx.externalMap.set(absPath, archivePath);
348
394
  ctx.usedArchivePaths.add(archivePath);
349
395
  return archivePath;
@@ -359,13 +405,16 @@ function tryResolveExternal(ctx, rawPath, referrerAbsDir) {
359
405
  }
360
406
  return addExternalAsset(ctx, absPath);
361
407
  }
362
- function rewriteCssUrls(ctx, css, referrerAbsDir, entryPath) {
408
+ function referenceFrom(entryPath, target) {
409
+ return isNonRelativeUrl(target) ? target : posix.relative(posix.dirname(entryPath), target);
410
+ }
411
+ function rewriteCssUrls(css, referrerAbsDir, entryPath, resolveTarget) {
363
412
  let modified = false;
364
413
  const rewritten = css.replace(CSS_URL_RE, (full, quote, rawUrl) => {
365
- const archivePath = tryResolveExternal(ctx, (rawUrl || "").trim(), referrerAbsDir);
366
- if (!archivePath) return full;
414
+ const target = resolveTarget((rawUrl || "").trim(), referrerAbsDir);
415
+ if (!target) return full;
367
416
  modified = true;
368
- return `url(${quote || ""}${posix.relative(posix.dirname(entryPath), archivePath)}${quote || ""})`;
417
+ return `url(${quote || ""}${referenceFrom(entryPath, target)}${quote || ""})`;
369
418
  });
370
419
  return { css: rewritten, modified };
371
420
  }
@@ -377,20 +426,20 @@ function rewriteHtmlAttributes(document, referrerAbsDir, entryPath, resolveTarge
377
426
  for (const attr of attrs) {
378
427
  const val = (el.getAttribute(attr) || "").trim();
379
428
  if (!val) continue;
380
- const archivePath = resolveTarget(val, referrerAbsDir);
381
- if (!archivePath) continue;
382
- el.setAttribute(attr, posix.relative(posix.dirname(entryPath), archivePath));
429
+ const target = resolveTarget(val, referrerAbsDir);
430
+ if (!target) continue;
431
+ el.setAttribute(attr, referenceFrom(entryPath, target));
383
432
  modified = true;
384
433
  }
385
434
  }
386
435
  return modified;
387
436
  }
388
- function rewriteStyleBlocks(ctx, document, referrerAbsDir, entryPath) {
437
+ function rewriteStyleBlocks(document, referrerAbsDir, entryPath, resolveTarget) {
389
438
  let modified = false;
390
439
  for (const styleEl of document.querySelectorAll("style")) {
391
440
  const css = styleEl.textContent || "";
392
441
  if (!css.includes("url(")) continue;
393
- const result = rewriteCssUrls(ctx, css, referrerAbsDir, entryPath);
442
+ const result = rewriteCssUrls(css, referrerAbsDir, entryPath, resolveTarget);
394
443
  if (result.modified) {
395
444
  styleEl.textContent = result.css;
396
445
  modified = true;
@@ -399,7 +448,7 @@ function rewriteStyleBlocks(ctx, document, referrerAbsDir, entryPath) {
399
448
  for (const el of document.querySelectorAll("[style]")) {
400
449
  const style = el.getAttribute("style") || "";
401
450
  if (!style.includes("url(")) continue;
402
- const result = rewriteCssUrls(ctx, style, referrerAbsDir, entryPath);
451
+ const result = rewriteCssUrls(style, referrerAbsDir, entryPath, resolveTarget);
403
452
  if (result.modified) {
404
453
  el.setAttribute("style", result.css);
405
454
  modified = true;
@@ -410,13 +459,9 @@ function rewriteStyleBlocks(ctx, document, referrerAbsDir, entryPath) {
410
459
  function localizeHtmlEntry(ctx, entryPath, content) {
411
460
  const referrerAbsDir = resolve2(ctx.absProjectDir, dirname(entryPath));
412
461
  const { document } = parseHTML(content.toString("utf-8"));
413
- const attrsChanged = rewriteHtmlAttributes(
414
- document,
415
- referrerAbsDir,
416
- entryPath,
417
- (val, dir) => tryResolveExternal(ctx, val, dir)
418
- );
419
- const stylesChanged = rewriteStyleBlocks(ctx, document, referrerAbsDir, entryPath);
462
+ const resolveTarget = (val, dir) => tryResolveExternal(ctx, val, dir);
463
+ const attrsChanged = rewriteHtmlAttributes(document, referrerAbsDir, entryPath, resolveTarget);
464
+ const stylesChanged = rewriteStyleBlocks(document, referrerAbsDir, entryPath, resolveTarget);
420
465
  if (attrsChanged || stylesChanged) {
421
466
  ctx.fileContents.set(entryPath, Buffer.from(document.toString(), "utf-8"));
422
467
  }
@@ -425,20 +470,26 @@ function localizeCssEntry(ctx, entryPath, content) {
425
470
  const referrerAbsDir = resolve2(ctx.absProjectDir, dirname(entryPath));
426
471
  const css = content.toString("utf-8");
427
472
  if (!css.includes("url(")) return;
428
- const result = rewriteCssUrls(ctx, css, referrerAbsDir, entryPath);
473
+ const result = rewriteCssUrls(
474
+ css,
475
+ referrerAbsDir,
476
+ entryPath,
477
+ (val, dir) => tryResolveExternal(ctx, val, dir)
478
+ );
429
479
  if (result.modified) {
430
480
  ctx.fileContents.set(entryPath, Buffer.from(result.css, "utf-8"));
431
481
  }
432
482
  }
433
- function localizeExternalAssets(absProjectDir, fileContents) {
483
+ function localizeExternalAssets(absProjectDir, fileContents, onDiskMinBytes = Infinity) {
434
484
  const ctx = {
435
485
  absProjectDir,
436
486
  fileContents,
487
+ onDiskMinBytes,
437
488
  externalMap: /* @__PURE__ */ new Map(),
438
489
  usedArchivePaths: /* @__PURE__ */ new Set()
439
490
  };
440
491
  for (const [entryPath, content] of [...fileContents.entries()]) {
441
- if (entryPath.startsWith(EXT_ASSETS_PREFIX + "/")) continue;
492
+ if (entryPath.startsWith(EXT_ASSETS_PREFIX + "/") || !Buffer.isBuffer(content)) continue;
442
493
  if (entryPath.endsWith(".html") || entryPath.endsWith(".htm")) {
443
494
  localizeHtmlEntry(ctx, entryPath, content);
444
495
  } else if (entryPath.endsWith(".css")) {
@@ -448,6 +499,9 @@ function localizeExternalAssets(absProjectDir, fileContents) {
448
499
  return ctx.externalMap.size;
449
500
  }
450
501
  function buildPublishFileMap(projectDir) {
502
+ return stagePublishFiles(projectDir, Infinity);
503
+ }
504
+ function stagePublishFiles(projectDir, onDiskMinBytes) {
451
505
  const absProjectDir = resolve2(projectDir);
452
506
  const filePaths = [];
453
507
  collectProjectFiles(absProjectDir, absProjectDir, filePaths, createProjectIgnore(absProjectDir));
@@ -458,9 +512,9 @@ function buildPublishFileMap(projectDir) {
458
512
  }
459
513
  const fileContents = /* @__PURE__ */ new Map();
460
514
  for (const filePath of filePaths) {
461
- fileContents.set(filePath, readFileSync2(join2(absProjectDir, filePath)));
515
+ fileContents.set(filePath, stageFile(join2(absProjectDir, filePath), onDiskMinBytes));
462
516
  }
463
- localizeExternalAssets(absProjectDir, fileContents);
517
+ localizeExternalAssets(absProjectDir, fileContents, onDiskMinBytes);
464
518
  return fileContents;
465
519
  }
466
520
  var ARCHIVE_ENTRY_TIME = new Date(1980, 0, 1, 0, 0, 0, 0);
@@ -637,8 +691,16 @@ export {
637
691
  readTeamProject,
638
692
  writeTeamProject,
639
693
  resolvePublishCredential,
694
+ TEXT_FILE_EXTS,
695
+ stagedSize,
696
+ assertUnchanged,
697
+ readChecked,
698
+ readStaged,
699
+ rewriteCssUrls,
640
700
  rewriteHtmlAttributes,
701
+ rewriteStyleBlocks,
641
702
  buildPublishFileMap,
703
+ stagePublishFiles,
642
704
  zipPublishFileMap,
643
705
  getPublishApiBaseUrl,
644
706
  publishProjectArchive