hyperframes 0.8.141 → 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 (200) hide show
  1. package/dist/{add-KH2CF4FD.js → add-Q5EYDUAY.js} +18 -17
  2. package/dist/{animatedGifPrep-QO4BSKR7.js → animatedGifPrep-H2DUQEZ3.js} +15 -15
  3. package/dist/{asset-4RDZILVJ.js → asset-C7JBYYX4.js} +4 -4
  4. package/dist/{assetCataloger-WGR4LYYN.js → assetCataloger-FRO4G6OU.js} +8 -7
  5. package/dist/{auth-WYQCOYE5.js → auth-FRWLCO36.js} +5 -4
  6. package/dist/{autoUpdate-PC5TN3NL.js → autoUpdate-E4OZXQK6.js} +2 -2
  7. package/dist/{backgroundChecks-7M3T44EP.js → backgroundChecks-FSUVHN5L.js} +3 -3
  8. package/dist/backgroundChecksWorker.js +3 -3
  9. package/dist/{batchRender-GOLLOE4V.js → batchRender-4U73BYTU.js} +11 -10
  10. package/dist/{beats-XJ7WP6QS.js → beats-U6KJWF35.js} +32 -28
  11. package/dist/{benchmark-HCGFBEZJ.js → benchmark-5ONT7V7B.js} +15 -14
  12. package/dist/{browser-VQKO2FKG.js → browser-R4DU46IE.js} +4 -4
  13. package/dist/{bundleWithLocalizedFonts-FH7PHTTX.js → bundleWithLocalizedFonts-VH55VOAL.js} +2 -2
  14. package/dist/{capture-TFZZSF6F.js → capture-26G2DPSI.js} +83 -41
  15. package/dist/{capture-XD3P3YQR.js → capture-OGQAEYKO.js} +24 -8
  16. package/dist/{catalog-4S33QWJJ.js → catalog-RKORTIUE.js} +19 -18
  17. package/dist/{catch-up-RW7YXXNT.js → catch-up-4OBERRQO.js} +5 -5
  18. package/dist/{check-XVTRRN4Y.js → check-P2XDN57S.js} +89 -85
  19. package/dist/{checkBrowser-HZXJ2EDU.js → checkBrowser-NTGJGAEA.js} +42 -42
  20. package/dist/{chunk-AVWEIOEN.js → chunk-2LBBHMKT.js} +1 -1
  21. package/dist/{chunk-E6SDW5FV.js → chunk-33RZPZ4K.js} +192 -45
  22. package/dist/{chunk-6IFXWJDX.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-6E6CM7WS.js → chunk-4M4EC7JX.js} +19 -12
  26. package/dist/{chunk-HKCNZITN.js → chunk-4OA4LDTU.js} +2 -2
  27. package/dist/{chunk-XTFJOR3K.js → chunk-4SFGME7K.js} +1 -1
  28. package/dist/{chunk-34TXESM7.js → chunk-5FISWJ37.js} +12 -4
  29. package/dist/{chunk-JYYOAKHS.js → chunk-6IIGT7BX.js} +1 -1
  30. package/dist/chunk-6TPZSTCL.js +3681 -0
  31. package/dist/{chunk-P6E4HFFU.js → chunk-6XMFEICO.js} +263 -75
  32. package/dist/{chunk-6Q6FR4KH.js → chunk-7UYBQ6NF.js} +296 -89
  33. package/dist/{chunk-BRITLL56.js → chunk-B4P5VDFQ.js} +1 -1
  34. package/dist/{chunk-U7E736AJ.js → chunk-BFDJ63J5.js} +32 -14
  35. package/dist/{chunk-WCJGTLPF.js → chunk-BHVFTYSI.js} +6 -3
  36. package/dist/{chunk-IO7ZIDRP.js → chunk-BT27OYYX.js} +53 -12
  37. package/dist/{chunk-KFH6UD26.js → chunk-BYK73CR7.js} +4 -4
  38. package/dist/{chunk-L3JSAB4L.js → chunk-CLOH4LIB.js} +3 -3
  39. package/dist/{chunk-R7UDXKI3.js → chunk-DF2BHILQ.js} +3 -3
  40. package/dist/{chunk-246MOR5U.js → chunk-DKSDVDXG.js} +175 -162
  41. package/dist/{chunk-35RSNI77.js → chunk-F26LCYRY.js} +42 -34
  42. package/dist/{chunk-5Z63TBTX.js → chunk-FH7WODJH.js} +1 -1
  43. package/dist/{chunk-NORZWWLK.js → chunk-FVYXDXEV.js} +2 -2
  44. package/dist/{chunk-YURXPGAM.js → chunk-GNBGPUJ7.js} +6 -8
  45. package/dist/{chunk-RVCWIIZ7.js → chunk-GV5R5B7Q.js} +1 -1
  46. package/dist/{chunk-GS6FE3IW.js → chunk-HC7EVDEL.js} +1 -1
  47. package/dist/{chunk-K2GOFLTX.js → chunk-HLYOEIWM.js} +14 -6
  48. package/dist/{chunk-XDSOIJC3.js → chunk-HMT2RPZU.js} +6 -6
  49. package/dist/{chunk-IKVBTDLO.js → chunk-HW4AKJ5F.js} +1 -1
  50. package/dist/{chunk-OLDDJS3S.js → chunk-I7QGQAZM.js} +8 -8
  51. package/dist/{chunk-JFKL3WAE.js → chunk-IWFLMU2N.js} +104 -19
  52. package/dist/{chunk-IHFUKJOR.js → chunk-K2FLNJVB.js} +8 -2
  53. package/dist/chunk-KJJLA674.js +121 -0
  54. package/dist/{chunk-XWVGSEUT.js → chunk-KO5QBV73.js} +1 -1
  55. package/dist/{chunk-INI3TM6I.js → chunk-KQLGTGE5.js} +3 -3
  56. package/dist/{chunk-E4BSCXMU.js → chunk-LVX6NK36.js} +3 -3
  57. package/dist/{chunk-BM5PX3DJ.js → chunk-LW6HO6U3.js} +4 -4
  58. package/dist/{chunk-OZUQF4NB.js → chunk-MQZVBHEY.js} +123 -8
  59. package/dist/{chunk-IV7EI5E2.js → chunk-N3DQEVSI.js} +2 -2
  60. package/dist/{chunk-A4KQZXZI.js → chunk-NE55C6S5.js} +4 -2
  61. package/dist/{chunk-EDYBFSPE.js → chunk-OBXQRJWQ.js} +7 -10
  62. package/dist/{chunk-RCFCZT5O.js → chunk-OSSHSIMD.js} +1 -1
  63. package/dist/chunk-P36MALQF.js +15 -0
  64. package/dist/{chunk-EKA4ZZBI.js → chunk-P7THMINS.js} +3 -3
  65. package/dist/{chunk-3NBKW2QJ.js → chunk-PAGIICKN.js} +2 -2
  66. package/dist/{chunk-O3SKIXQK.js → chunk-PJU63L6W.js} +1 -1
  67. package/dist/{chunk-RPYPW5NN.js → chunk-POLR33RB.js} +20 -13
  68. package/dist/{chunk-7M4KAPAA.js → chunk-PUGIRFPX.js} +2 -2
  69. package/dist/{chunk-7XTZVLE6.js → chunk-QFN7NVWM.js} +1 -1
  70. package/dist/{chunk-D2KNWIQ6.js → chunk-QFSCCQIR.js} +1 -1
  71. package/dist/{chunk-J5IPIQU2.js → chunk-QRKLPWEX.js} +1 -1
  72. package/dist/{chunk-N77KD7ZZ.js → chunk-QVYVUCWD.js} +1 -1
  73. package/dist/{chunk-GK4AIFIH.js → chunk-SDYDNHEE.js} +34 -3
  74. package/dist/{chunk-2NCHQUPX.js → chunk-SQLK7SJL.js} +1 -1
  75. package/dist/{chunk-PMRBLBUP.js → chunk-T42U2W2R.js} +14 -2
  76. package/dist/{chunk-Q65ZQFF2.js → chunk-TAMQYQGJ.js} +1 -1
  77. package/dist/{chunk-PXSM4HPB.js → chunk-U3X3TPBW.js} +1 -1
  78. package/dist/{chunk-3A5AAPMP.js → chunk-UICWP23D.js} +1 -1
  79. package/dist/{chunk-A7YQNIQT.js → chunk-UM2GRYM3.js} +113 -10
  80. package/dist/{chunk-TC2FBZJZ.js → chunk-VIVBA6E6.js} +2 -2
  81. package/dist/{chunk-W6HTOVHU.js → chunk-W35EKBS6.js} +2 -2
  82. package/dist/{chunk-YEIFI443.js → chunk-WPNE5NEP.js} +1 -1
  83. package/dist/{chunk-WY5OODN5.js → chunk-XONFUK3M.js} +3693 -28
  84. package/dist/{chunk-IYFKBFTW.js → chunk-Y6QL2LGO.js} +8 -5
  85. package/dist/{chunk-THXFSPLV.js → chunk-ZIRIDSDB.js} +1 -1
  86. package/dist/chunk-ZLW2V65P.js +209 -0
  87. package/dist/{chunk-4BB7V6AI.js → chunk-ZQQ3SEIE.js} +33 -32
  88. package/dist/{clean-L2E4VD57.js → clean-YHGPY33K.js} +23 -23
  89. package/dist/cli.js +57 -159
  90. package/dist/{cloud-IDUQRYLO.js → cloud-DOFI5ISR.js} +4 -4
  91. package/dist/{cloudrun-R3JXWXGG.js → cloudrun-KTZ4XDHL.js} +13 -12
  92. package/dist/commands/contrast-audit.browser.js +60 -4
  93. package/dist/commands/layout-audit.browser.js +88 -20
  94. package/dist/{compare-VYBWSP3Y.js → compare-SMMIZN2C.js} +37 -37
  95. package/dist/{compiler-ACHWOU5N.js → compiler-TEXQWW6N.js} +14 -11
  96. package/dist/{component-PYYV2V3F.js → component-B3GCNGSS.js} +5 -5
  97. package/dist/{compositions-B5GQSXH7.js → compositions-OQNZZTKF.js} +38 -34
  98. package/dist/{delete-EAX2U3WI.js → delete-EL5LVSEP.js} +6 -6
  99. package/dist/{deterministicFonts-F6WIVL2W.js → deterministicFonts-U2BIMGPG.js} +3 -3
  100. package/dist/{dist-NZSQCYOF.js → dist-5UVIRMSM.js} +7 -7
  101. package/dist/{dist-ROUDWGLO.js → dist-XN234YFQ.js} +41 -39
  102. package/dist/{doctor-PJX7MLFG.js → doctor-UOL3OI2A.js} +17 -17
  103. package/dist/{dom-IROKGVJI.js → dom-37K6YOH4.js} +2 -2
  104. package/dist/{events-SBC54MHO.js → events-K2DB2PBC.js} +2 -2
  105. package/dist/{events-YFFXKAQQ.js → events-NIZBS6S7.js} +3 -3
  106. package/dist/{feedback-UETLWREV.js → feedback-QMP4E6L7.js} +16 -15
  107. package/dist/{figma-QDSJPIRW.js → figma-2AUJRNVC.js} +3 -3
  108. package/dist/fontLocalizeCli.js +18 -18
  109. package/dist/{get-B5TS6C7H.js → get-P5NC7SRM.js} +6 -6
  110. package/dist/{gpuPolicy-LYOVBAJP.js → gpuPolicy-7N5MCE2G.js} +15 -15
  111. package/dist/{grade-compare-LBIHMAUN.js → grade-compare-HV5AFZ6P.js} +37 -37
  112. package/dist/{help-XBP6A6LT.js → help-3TSTXBLN.js} +1 -1
  113. package/dist/{history-2S42ZXKL.js → history-D65XFJ6D.js} +6 -6
  114. package/dist/hyperframe-runtime.js +25 -25
  115. package/dist/hyperframe.manifest.json +1 -1
  116. package/dist/hyperframe.runtime.iife.js +25 -25
  117. package/dist/hyperframes-player.global.js +3 -3
  118. package/dist/hyperframes-slideshow.global.js +23 -23
  119. package/dist/{info-I2VDAWT7.js → info-TXV7MLFO.js} +17 -16
  120. package/dist/{init-BGHSDODI.js → init-OSDMJZJV.js} +38 -38
  121. package/dist/{inspect-MZK5B5RP.js → inspect-RQQSAYIJ.js} +38 -38
  122. package/dist/{installer-LL4QAKFW.js → installer-CDOB32HE.js} +11 -10
  123. package/dist/{keyframes-2EBF7OSS.js → keyframes-V75Q6GRM.js} +10 -10
  124. package/dist/{lambda-XKFPAOFE.js → lambda-RODV4RCX.js} +12 -11
  125. package/dist/{layout-TP5ERKEF.js → layout-IZAI5SFC.js} +38 -38
  126. package/dist/{lint-FQ6CEI7E.js → lint-PLXOXY5R.js} +14 -14
  127. package/dist/{lintProject-LM3XZRPZ.js → lintProject-OQ6H6XBR.js} +7 -7
  128. package/dist/{list-FRNUJXZ3.js → list-BQBPNKDZ.js} +7 -7
  129. package/dist/{login-C25QU3BQ.js → login-NP6F4FHC.js} +20 -24
  130. package/dist/{logout-GJXZQKOA.js → logout-B4KS4A7S.js} +6 -6
  131. package/dist/{manager-DXB7JDHU.js → manager-GXYF4AVO.js} +2 -2
  132. package/dist/{manager-524RPYO7.js → manager-RFZNG5YT.js} +2 -2
  133. package/dist/{media-treatment-DCANGWSV.js → media-treatment-PXGMZ4A4.js} +55 -34
  134. package/dist/{models-GOD6ARB3.js → models-CEZM6XZ7.js} +17 -17
  135. package/dist/{motionShot-FSKETANX.js → motionShot-R4GHYWYM.js} +25 -25
  136. package/dist/{normalize-IGLHCWTF.js → normalize-H6KUHHEI.js} +18 -7
  137. package/dist/{normalize-audio-C2IM7OID.js → normalize-audio-MQ7NFCOV.js} +10 -6
  138. package/dist/{open-VVISXIII.js → open-AKQTGNXF.js} +5 -5
  139. package/dist/{pipeline-7YHZPYIS.js → pipeline-SYJYP2RM.js} +17 -17
  140. package/dist/{play-DSELK7G3.js → play-NBH4B7PL.js} +31 -30
  141. package/dist/{present-N72YFDKP.js → present-XAX55CFS.js} +26 -26
  142. package/dist/{preview-XTYN4NJ2.js → preview-OLANKNFA.js} +26 -26
  143. package/dist/{producer-NDCU3MHK.js → producer-Q6YNZZUJ.js} +1 -1
  144. package/dist/{projectConfig-MH4QU4AC.js → projectConfig-EM26P45P.js} +13 -12
  145. package/dist/{publication-KUSHI5MG.js → publication-OXWJZKSX.js} +8 -7
  146. package/dist/{publish-3XEEFWMF.js → publish-4VBWP2UB.js} +23 -22
  147. package/dist/{refresh-MFITBIKV.js → refresh-PVHBEABE.js} +2 -2
  148. package/dist/{remove-background-2QKJ7XOD.js → remove-background-REB7427G.js} +19 -19
  149. package/dist/{render-75E342ZU.js → render-3CVZ2SZG.js} +13 -12
  150. package/dist/{render-S73DW4KK.js → render-K25YOG3M.js} +22 -21
  151. package/dist/{render-2DVYTVLQ.js → render-TSE75QUL.js} +35 -35
  152. package/dist/{render-batch-YURBS54Q.js → render-batch-GGUOK3DS.js} +13 -12
  153. package/dist/{renderCancellation-373ASJTO.js → renderCancellation-PZRWB53I.js} +15 -15
  154. package/dist/renderSetupWorker.js +7 -7
  155. package/dist/{resolver-FE3GBZ4T.js → resolver-S5VK6UCB.js} +10 -9
  156. package/dist/{screenshotCapture-ECBTLCU6.js → screenshotCapture-TEUIWXWN.js} +53 -33
  157. package/dist/{sherpa-B2D3AGP6.js → sherpa-LVIUEAGF.js} +18 -18
  158. package/dist/skills/hyperframes-cli/references/cloud.md +1 -1
  159. package/dist/skills/hyperframes-cli/references/doctor-browser.md +24 -1
  160. package/dist/skills/media-use/references/grading.md +4 -2
  161. package/dist/skills/media-use/scripts/lib/cache.mjs +28 -14
  162. package/dist/skills/media-use/scripts/lib/cache.test.mjs +110 -0
  163. package/dist/skills/media-use/scripts/lib/duck.mjs +2 -1
  164. package/dist/skills/media-use/scripts/lib/duck.test.mjs +87 -0
  165. package/dist/skills/media-use/scripts/lib/probe.mjs +6 -1
  166. package/dist/skills/media-use/scripts/lib/probe.test.mjs +73 -0
  167. package/dist/skills/media-use/scripts/lib/words.mjs +1 -1
  168. package/dist/{skills-ICJ22CZZ.js → skills-I65FU5HD.js} +5 -5
  169. package/dist/{skillsUpdateCheck-GXZN56I5.js → skillsUpdateCheck-J57RNNIV.js} +3 -3
  170. package/dist/{slideshow-EJ4IMY6P.js → slideshow-4OJEPWNZ.js} +1 -1
  171. package/dist/{snapshot-XHKOAWF4.js → snapshot-YROOGY22.js} +42 -39
  172. package/dist/{src-I7UC3JTL.js → src-JO5JOV7Y.js} +16 -14
  173. package/dist/{src-74PFDTDX.js → src-X426BZAG.js} +17 -17
  174. package/dist/{staticProjectServer-2DGKD6TF.js → staticProjectServer-5VMBS262.js} +23 -23
  175. package/dist/{status-JA6SKQVH.js → status-LXPGSSKY.js} +6 -4
  176. package/dist/studio/assets/{hyperframes-player-5Vx2AiUz.js → hyperframes-player-BXSuksFh.js} +3 -3
  177. package/dist/studio/assets/{index-BAnh7cSQ.js → index-BgOVCqjo.js} +1 -1
  178. package/dist/studio/assets/{index-P8fgj_Xa.js → index-FgyO_5Kv.js} +1 -1
  179. package/dist/studio/assets/{index-C0thd4eM.js → index-J7jpL4pj.js} +157 -157
  180. package/dist/studio/index.html +1 -1
  181. package/dist/studio/index.js +148 -175
  182. package/dist/studio/index.js.map +1 -1
  183. package/dist/{studio-api-PROBO7JG.js → studio-api-VRBZUGAE.js} +22 -18
  184. package/dist/{studioServer-ID6UV2NE.js → studioServer-DBNKZ6I6.js} +50 -50
  185. package/dist/{synthesize-77PTU6C5.js → synthesize-C3IWDAXF.js} +2 -2
  186. package/dist/{telemetry-65LFHIWH.js → telemetry-CXAX3TO3.js} +3 -3
  187. package/dist/{timeline-6UV3JJXD.js → timeline-VQ34WH7J.js} +91 -70
  188. package/dist/{tokens-HIL4TZXI.js → tokens-62R7VFAZ.js} +4 -4
  189. package/dist/{transcribe-TIO6W3EQ.js → transcribe-7KR7IPJA.js} +18 -18
  190. package/dist/{transcribe-V7F6QDSN.js → transcribe-XOHPPL2O.js} +11 -11
  191. package/dist/{tts-TOHSPWEG.js → tts-MUV42JXT.js} +6 -6
  192. package/dist/{updateCheck-GZELANMA.js → updateCheck-POYNH3B5.js} +2 -2
  193. package/dist/{upgrade-BX3KDDZJ.js → upgrade-NBNOT7J2.js} +2 -2
  194. package/dist/{urlDownloader-R76OHFIE.js → urlDownloader-3NS63A7B.js} +14 -14
  195. package/dist/{validate-7UX4I443.js → validate-Y2QDHAEP.js} +40 -28
  196. package/dist/{video-RVGYEFQU.js → video-SJDMTSTL.js} +15 -15
  197. package/package.json +1 -1
  198. package/dist/chunk-24OWOBQH.js +0 -3656
  199. package/dist/chunk-SYKKFAUW.js +0 -3711
  200. /package/dist/{chunk-HBBJFK6I.js → chunk-APDLWWFG.js} +0 -0
@@ -14,6 +14,19 @@ import {
14
14
  c
15
15
  } from "./chunk-ZTZA4UWZ.js";
16
16
 
17
+ // src/auth/paths.ts
18
+ import { homedir } from "os";
19
+ import { join } from "path";
20
+ var CREDENTIAL_FILENAME = "credentials";
21
+ function configDir() {
22
+ const override = process.env["HEYGEN_CONFIG_DIR"];
23
+ if (override && override.length > 0) return override;
24
+ return join(homedir(), ".heygen");
25
+ }
26
+ function credentialPath() {
27
+ return join(configDir(), CREDENTIAL_FILENAME);
28
+ }
29
+
17
30
  // src/auth/errors.ts
18
31
  var AuthError = class extends Error {
19
32
  code;
@@ -70,154 +83,6 @@ function isAuthError(err) {
70
83
  return err instanceof AuthError;
71
84
  }
72
85
 
73
- // src/auth/scrub.ts
74
- var HEYGEN_KEY = /\b(hg|sk)_[A-Za-z0-9_-]{4,}/g;
75
- var HEADER_LINE = /(authorization|x-api-key)[ \t]*[:=][ \t]*[^\r\n]+/gi;
76
- var JWT = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
77
- var SECRET_FIELDS = [
78
- "access_token",
79
- "refresh_token",
80
- "code_verifier",
81
- "client_secret",
82
- "id_token",
83
- "token",
84
- "code"
85
- ];
86
- var FORM_FIELD = new RegExp(`\\b(${SECRET_FIELDS.join("|")})=[^&\\s"']+`, "gi");
87
- var JSON_FIELD = new RegExp(`("(?:${SECRET_FIELDS.join("|")})"\\s*:\\s*)"[^"]*"`, "gi");
88
- function scrubCredentials(s) {
89
- return s.replace(HEYGEN_KEY, "$1_<redacted>").replace(HEADER_LINE, "$1: <redacted>").replace(JWT, "<jwt-redacted>").replace(FORM_FIELD, "$1=<redacted>").replace(JSON_FIELD, '$1"<redacted>"');
90
- }
91
-
92
- // src/auth/client.ts
93
- var DEFAULT_BASE_URL = "https://api.heygen.com";
94
- var HEYGEN_CLI_SOURCE_HEADER = "X-HeyGen-Source";
95
- var HEYGEN_CLI_SOURCE = "cli";
96
- var HEYGEN_CLIENT_SOURCE_HEADER = "X-HeyGen-Client-Source";
97
- var HEYGEN_CLIENT_SOURCE = "hyperframes";
98
- function apiBaseUrl() {
99
- const override = process.env["HEYGEN_API_URL"];
100
- return override && override.length > 0 ? override.replace(/\/+$/, "") : DEFAULT_BASE_URL;
101
- }
102
- var AuthClient = class {
103
- base;
104
- fetchImpl;
105
- onRefresh;
106
- constructor(opts = {}) {
107
- this.base = (opts.baseUrl ?? apiBaseUrl()).replace(/\/+$/, "");
108
- this.fetchImpl = opts.fetchImpl ?? fetch;
109
- this.onRefresh = opts.onUnauthenticatedRefresh;
110
- }
111
- /**
112
- * `GET /v3/users/me`. Throws `ErrUnauthenticated` on 401, `ErrApi`
113
- * on any other non-2xx or non-JSON body.
114
- *
115
- * On OAuth 401 with a refresh hook configured, the request is
116
- * retried once after refreshing the access token. The retry's
117
- * outcome is what the caller sees — if the refresh itself fails
118
- * (REFRESH_FAILED) or the retry still 401s, the user lands on a
119
- * "please log in again" path upstream.
120
- */
121
- async getCurrentUser(credential) {
122
- const url = `${this.base}/v3/users/me`;
123
- return await this.fetchUser(url, credential, true);
124
- }
125
- // fallow-ignore-next-line complexity
126
- async fetchUser(url, credential, allowRefresh) {
127
- const headers = buildAuthHeaders(credential);
128
- const res = await this.fetchImpl(url, { method: "GET", headers });
129
- if (res.status === 401) {
130
- if (allowRefresh && credential.type === "oauth" && credential.refresh_token && this.onRefresh) {
131
- const refreshed = await this.tryRefresh(credential.refresh_token);
132
- if (refreshed) {
133
- const next = {
134
- ...credential,
135
- access_token: refreshed.access_token,
136
- ...refreshed.refresh_token ? { refresh_token: refreshed.refresh_token } : {}
137
- };
138
- return await this.fetchUser(url, next, false);
139
- }
140
- }
141
- const detail = await safeText(res);
142
- throw ErrUnauthenticated(detail || `${res.status} ${res.statusText}`);
143
- }
144
- if (!res.ok) {
145
- throw ErrApi(res.status, await safeText(res) || res.statusText);
146
- }
147
- let payload;
148
- try {
149
- payload = await res.json();
150
- } catch (err) {
151
- throw ErrApi(res.status, `non-JSON body: ${err.message}`);
152
- }
153
- return extractUserInfo(payload);
154
- }
155
- async tryRefresh(refresh_token) {
156
- if (!this.onRefresh) return null;
157
- try {
158
- return await this.onRefresh(refresh_token);
159
- } catch (err) {
160
- if (isAuthError(err) && err.code === "REFRESH_FAILED") return null;
161
- throw err;
162
- }
163
- }
164
- };
165
- function buildAuthHeaders(credential) {
166
- if (credential.type === "oauth") {
167
- return {
168
- authorization: `Bearer ${credential.access_token}`,
169
- [HEYGEN_CLI_SOURCE_HEADER]: HEYGEN_CLI_SOURCE,
170
- [HEYGEN_CLIENT_SOURCE_HEADER]: HEYGEN_CLIENT_SOURCE
171
- };
172
- }
173
- return { "x-api-key": credential.key, [HEYGEN_CLIENT_SOURCE_HEADER]: HEYGEN_CLIENT_SOURCE };
174
- }
175
- async function safeText(res) {
176
- try {
177
- const body = (await res.text()).slice(0, 500);
178
- return scrubCredentials(body);
179
- } catch {
180
- return "";
181
- }
182
- }
183
- function extractUserInfo(payload) {
184
- if (!payload || typeof payload !== "object" || Array.isArray(payload)) return {};
185
- const obj = payload;
186
- const wrapped = obj["data"];
187
- const data = wrapped && typeof wrapped === "object" && !Array.isArray(wrapped) ? wrapped : obj;
188
- return {
189
- username: pickString(data, "username"),
190
- email: pickString(data, "email"),
191
- first_name: pickString(data, "first_name"),
192
- last_name: pickString(data, "last_name"),
193
- billing_type: pickString(data, "billing_type"),
194
- wallet: pickObject(data, "wallet"),
195
- subscription: pickObject(data, "subscription"),
196
- usage_based: pickObject(data, "usage_based")
197
- };
198
- }
199
- function pickString(obj, key) {
200
- const v = obj[key];
201
- return typeof v === "string" ? v : void 0;
202
- }
203
- function pickObject(obj, key) {
204
- const v = obj[key];
205
- return v && typeof v === "object" && !Array.isArray(v) ? v : void 0;
206
- }
207
-
208
- // src/auth/paths.ts
209
- import { homedir } from "os";
210
- import { join } from "path";
211
- var CREDENTIAL_FILENAME = "credentials";
212
- function configDir() {
213
- const override = process.env["HEYGEN_CONFIG_DIR"];
214
- if (override && override.length > 0) return override;
215
- return join(homedir(), ".heygen");
216
- }
217
- function credentialPath() {
218
- return join(configDir(), CREDENTIAL_FILENAME);
219
- }
220
-
221
86
  // src/auth/store.ts
222
87
  import { promises as fs } from "fs";
223
88
  import { dirname } from "path";
@@ -451,23 +316,27 @@ function looksLikeApiKey(s) {
451
316
  }
452
317
 
453
318
  // src/auth/resolver.ts
319
+ var ENV_CREDENTIAL_VAR = {
320
+ env: "HEYGEN_API_KEY",
321
+ env_alias: "HYPERFRAMES_API_KEY",
322
+ env_oauth: "HEYGEN_ACCESS_TOKEN"
323
+ };
324
+ var envCredentialVar = (source) => source in ENV_CREDENTIAL_VAR ? ENV_CREDENTIAL_VAR[source] : void 0;
454
325
  var EXPIRY_SKEW_MS = 60 * 1e3;
455
326
  async function resolveCredential(opts = {}) {
456
327
  const now = (opts.now ?? (() => /* @__PURE__ */ new Date()))();
457
- const heygenEnv = process.env["HEYGEN_API_KEY"];
458
- if (heygenEnv && heygenEnv.length > 0) {
459
- if (!isHeaderSafe(heygenEnv)) {
460
- throw ErrInvalidStore("HEYGEN_API_KEY contains control characters");
461
- }
328
+ const heygenEnv = headerSafeEnv(ENV_CREDENTIAL_VAR.env);
329
+ if (heygenEnv) {
462
330
  return { type: "api_key", key: heygenEnv, source: "env" };
463
331
  }
464
- const hfEnv = process.env["HYPERFRAMES_API_KEY"];
465
- if (hfEnv && hfEnv.length > 0) {
466
- if (!isHeaderSafe(hfEnv)) {
467
- throw ErrInvalidStore("HYPERFRAMES_API_KEY contains control characters");
468
- }
332
+ const hfEnv = headerSafeEnv(ENV_CREDENTIAL_VAR.env_alias);
333
+ if (hfEnv) {
469
334
  return { type: "api_key", key: hfEnv, source: "env_alias" };
470
335
  }
336
+ const accessToken = headerSafeEnv(ENV_CREDENTIAL_VAR.env_oauth);
337
+ if (accessToken) {
338
+ return { type: "oauth", access_token: accessToken, source: "env_oauth", refreshable: false };
339
+ }
471
340
  const { credentials, source } = await readStore();
472
341
  if (source === "absent") throw ErrNotConfigured();
473
342
  const fileSource = source === "file_legacy" ? "file_legacy" : "file_json";
@@ -478,6 +347,13 @@ async function resolveCredential(opts = {}) {
478
347
  }
479
348
  throw credentials.oauth ? ErrLoginExpired() : ErrNotConfigured();
480
349
  }
350
+ function headerSafeEnv(name) {
351
+ const value = process.env[name];
352
+ if (value && !isHeaderSafe(value)) {
353
+ throw ErrInvalidStore(`${name} contains control characters`);
354
+ }
355
+ return value;
356
+ }
481
357
  async function tryResolveCredential(opts = {}) {
482
358
  try {
483
359
  return await resolveCredential(opts);
@@ -512,6 +388,141 @@ function parseDate(s) {
512
388
  return Number.isNaN(d.getTime()) ? void 0 : d;
513
389
  }
514
390
 
391
+ // src/auth/scrub.ts
392
+ var HEYGEN_KEY = /\b(hg|sk)_[A-Za-z0-9_-]{4,}/g;
393
+ var HEADER_LINE = /(authorization|x-api-key)[ \t]*[:=][ \t]*[^\r\n]+/gi;
394
+ var JWT = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
395
+ var SECRET_FIELDS = [
396
+ "access_token",
397
+ "refresh_token",
398
+ "code_verifier",
399
+ "client_secret",
400
+ "id_token",
401
+ "token",
402
+ "code"
403
+ ];
404
+ var FORM_FIELD = new RegExp(`\\b(${SECRET_FIELDS.join("|")})=[^&\\s"']+`, "gi");
405
+ var JSON_FIELD = new RegExp(`("(?:${SECRET_FIELDS.join("|")})"\\s*:\\s*)"[^"]*"`, "gi");
406
+ function scrubCredentials(s) {
407
+ return s.replace(HEYGEN_KEY, "$1_<redacted>").replace(HEADER_LINE, "$1: <redacted>").replace(JWT, "<jwt-redacted>").replace(FORM_FIELD, "$1=<redacted>").replace(JSON_FIELD, '$1"<redacted>"');
408
+ }
409
+
410
+ // src/auth/client.ts
411
+ var DEFAULT_BASE_URL = "https://api.heygen.com";
412
+ var HEYGEN_CLI_SOURCE_HEADER = "X-HeyGen-Source";
413
+ var HEYGEN_CLI_SOURCE = "cli";
414
+ var HEYGEN_CLIENT_SOURCE_HEADER = "X-HeyGen-Client-Source";
415
+ var HEYGEN_CLIENT_SOURCE = "hyperframes";
416
+ function apiBaseUrl() {
417
+ const override = process.env["HEYGEN_API_URL"];
418
+ return override && override.length > 0 ? override.replace(/\/+$/, "") : DEFAULT_BASE_URL;
419
+ }
420
+ var AuthClient = class {
421
+ base;
422
+ fetchImpl;
423
+ onRefresh;
424
+ constructor(opts = {}) {
425
+ this.base = (opts.baseUrl ?? apiBaseUrl()).replace(/\/+$/, "");
426
+ this.fetchImpl = opts.fetchImpl ?? fetch;
427
+ this.onRefresh = opts.onUnauthenticatedRefresh;
428
+ }
429
+ /**
430
+ * `GET /v3/users/me`. Throws `ErrUnauthenticated` on 401, `ErrApi`
431
+ * on any other non-2xx or non-JSON body.
432
+ *
433
+ * On OAuth 401 with a refresh hook configured, the request is
434
+ * retried once after refreshing the access token. The retry's
435
+ * outcome is what the caller sees — if the refresh itself fails
436
+ * (REFRESH_FAILED) or the retry still 401s, the user lands on a
437
+ * "please log in again" path upstream.
438
+ */
439
+ async getCurrentUser(credential) {
440
+ const url = `${this.base}/v3/users/me`;
441
+ return await this.fetchUser(url, credential, true);
442
+ }
443
+ // fallow-ignore-next-line complexity
444
+ async fetchUser(url, credential, allowRefresh) {
445
+ const headers = buildAuthHeaders(credential);
446
+ const res = await this.fetchImpl(url, { method: "GET", headers });
447
+ if (res.status === 401) {
448
+ if (allowRefresh && credential.type === "oauth" && credential.refresh_token && this.onRefresh) {
449
+ const refreshed = await this.tryRefresh(credential.refresh_token);
450
+ if (refreshed) {
451
+ const next = {
452
+ ...credential,
453
+ access_token: refreshed.access_token,
454
+ ...refreshed.refresh_token ? { refresh_token: refreshed.refresh_token } : {}
455
+ };
456
+ return await this.fetchUser(url, next, false);
457
+ }
458
+ }
459
+ const detail = await safeText(res);
460
+ throw ErrUnauthenticated(detail || `${res.status} ${res.statusText}`);
461
+ }
462
+ if (!res.ok) {
463
+ throw ErrApi(res.status, await safeText(res) || res.statusText);
464
+ }
465
+ let payload;
466
+ try {
467
+ payload = await res.json();
468
+ } catch (err) {
469
+ throw ErrApi(res.status, `non-JSON body: ${err.message}`);
470
+ }
471
+ return extractUserInfo(payload);
472
+ }
473
+ async tryRefresh(refresh_token) {
474
+ if (!this.onRefresh) return null;
475
+ try {
476
+ return await this.onRefresh(refresh_token);
477
+ } catch (err) {
478
+ if (isAuthError(err) && err.code === "REFRESH_FAILED") return null;
479
+ throw err;
480
+ }
481
+ }
482
+ };
483
+ function buildAuthHeaders(credential) {
484
+ if (credential.type === "oauth") {
485
+ return {
486
+ authorization: `Bearer ${credential.access_token}`,
487
+ [HEYGEN_CLI_SOURCE_HEADER]: HEYGEN_CLI_SOURCE,
488
+ [HEYGEN_CLIENT_SOURCE_HEADER]: HEYGEN_CLIENT_SOURCE
489
+ };
490
+ }
491
+ return { "x-api-key": credential.key, [HEYGEN_CLIENT_SOURCE_HEADER]: HEYGEN_CLIENT_SOURCE };
492
+ }
493
+ async function safeText(res) {
494
+ try {
495
+ const body = (await res.text()).slice(0, 500);
496
+ return scrubCredentials(body);
497
+ } catch {
498
+ return "";
499
+ }
500
+ }
501
+ function extractUserInfo(payload) {
502
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) return {};
503
+ const obj = payload;
504
+ const wrapped = obj["data"];
505
+ const data = wrapped && typeof wrapped === "object" && !Array.isArray(wrapped) ? wrapped : obj;
506
+ return {
507
+ username: pickString(data, "username"),
508
+ email: pickString(data, "email"),
509
+ first_name: pickString(data, "first_name"),
510
+ last_name: pickString(data, "last_name"),
511
+ billing_type: pickString(data, "billing_type"),
512
+ wallet: pickObject(data, "wallet"),
513
+ subscription: pickObject(data, "subscription"),
514
+ usage_based: pickObject(data, "usage_based")
515
+ };
516
+ }
517
+ function pickString(obj, key) {
518
+ const v = obj[key];
519
+ return typeof v === "string" ? v : void 0;
520
+ }
521
+ function pickObject(obj, key) {
522
+ const v = obj[key];
523
+ return v && typeof v === "object" && !Array.isArray(v) ? v : void 0;
524
+ }
525
+
515
526
  // src/auth/pkce.ts
516
527
  import { createHash, randomBytes } from "crypto";
517
528
  var VERIFIER_BYTES = 64;
@@ -1190,21 +1201,23 @@ async function safeText2(res) {
1190
1201
  }
1191
1202
 
1192
1203
  export {
1193
- isAuthError,
1194
- apiBaseUrl,
1195
- AuthClient,
1196
- buildAuthHeaders,
1197
1204
  configDir,
1198
1205
  credentialPath,
1206
+ isAuthError,
1199
1207
  readStore,
1200
1208
  writeStore,
1201
1209
  deleteStore,
1202
1210
  hasPreservedUnknownData,
1203
1211
  clearOAuth,
1204
1212
  isHeaderSafe,
1213
+ ENV_CREDENTIAL_VAR,
1214
+ envCredentialVar,
1205
1215
  resolveCredential,
1206
1216
  tryResolveCredential,
1207
1217
  isTokenExpired,
1218
+ apiBaseUrl,
1219
+ AuthClient,
1220
+ buildAuthHeaders,
1208
1221
  assertOAuthConfiguredOrExit,
1209
1222
  startAuthorizationCodeFlow,
1210
1223
  startDeviceAuthorizationFlow,
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  ensureHfIds
9
- } from "./chunk-A4KQZXZI.js";
9
+ } from "./chunk-NE55C6S5.js";
10
10
  import {
11
11
  HF_COLOR_GRADING_ATTR,
12
12
  INLINED_FILE_ATTR,
@@ -35,7 +35,7 @@ import {
35
35
  stripEmbeddedRuntimeScripts,
36
36
  styleElementsFor,
37
37
  warnUnknownEnumValues
38
- } from "./chunk-SYKKFAUW.js";
38
+ } from "./chunk-6TPZSTCL.js";
39
39
  import {
40
40
  cssVariableName
41
41
  } from "./chunk-VC76R6W2.js";
@@ -45,25 +45,32 @@ import {
45
45
  } from "./chunk-OFQWTKPW.js";
46
46
  import {
47
47
  lintHyperframeHtml
48
- } from "./chunk-WY5OODN5.js";
48
+ } from "./chunk-XONFUK3M.js";
49
49
  import {
50
- CSS_URL_RE,
51
50
  checkSubCompositionUsability,
51
+ resolveSubCompositionContent
52
+ } from "./chunk-3RM2ETQT.js";
53
+ import {
54
+ CSS_URL_RE,
55
+ decodeCssEscapes,
56
+ decodeWellFormedEscapes,
57
+ decodedUrlPath,
58
+ encodeUrlPath,
52
59
  isNonRelativeUrl,
53
- resolveSubCompositionContent,
54
60
  rewriteAssetPath,
55
61
  rewriteAssetPaths,
56
62
  rewriteCssAssetUrls,
57
- rewriteInlineStyleAssetUrls
58
- } from "./chunk-TQFG7HTI.js";
63
+ rewriteInlineStyleAssetUrls,
64
+ splitUrlSuffix
65
+ } from "./chunk-ZLW2V65P.js";
59
66
  import {
60
67
  parseHTML
61
- } from "./chunk-GK4AIFIH.js";
68
+ } from "./chunk-SDYDNHEE.js";
62
69
 
63
70
  // ../core/dist/compiler/htmlCompiler.js
64
71
  import { resolve } from "path";
65
72
  function resolveMediaSrc(src, projectDir) {
66
- return src.startsWith("http://") || src.startsWith("https://") ? src : resolve(projectDir, src);
73
+ return src.startsWith("http://") || src.startsWith("https://") ? src : resolve(projectDir, decodedUrlPath(src));
67
74
  }
68
75
  async function compileHtml(rawHtml, projectDir, probeMediaDuration) {
69
76
  const { html: staticCompiled, unresolved } = compileTimingAttrs(rawHtml);
@@ -88,6 +95,9 @@ async function compileHtml(rawHtml, projectDir, probeMediaDuration) {
88
95
  html = injectDurations(html, resolutions);
89
96
  }
90
97
  }
98
+ return clampProbedMedia(html, projectDir, probeMediaDuration);
99
+ }
100
+ async function clampProbedMedia(html, projectDir, probeMediaDuration) {
91
101
  const preResolved = extractResolvedMedia(html);
92
102
  const clampList = [];
93
103
  for (const el of preResolved) {
@@ -1870,30 +1880,35 @@ function withCommentsStripped(css, fn) {
1870
1880
  };
1871
1881
  return { result, restore };
1872
1882
  }
1883
+ function resolveRelativeUrlPath(fromDir, basePath) {
1884
+ return resolve2(fromDir, decodeWellFormedEscapes(basePath.replaceAll("\\", "/")));
1885
+ }
1873
1886
  function rebaseCssUrls(css, cssFileDir, projectDir) {
1874
1887
  const resolvedRoot = resolve2(projectDir);
1875
1888
  const resolvedDir = resolve2(cssFileDir);
1876
1889
  if (resolvedDir === resolvedRoot)
1877
1890
  return css;
1878
1891
  return css.replace(CSS_URL_RE, (full, quote, urlValue) => {
1879
- if (!urlValue || !isRelativeUrl(urlValue))
1892
+ const decoded = decodeCssEscapes(urlValue);
1893
+ if (!decoded || !isRelativeUrl(decoded))
1880
1894
  return full;
1881
- const { basePath, suffix } = splitUrlSuffix(urlValue.trim());
1895
+ const { basePath, suffix } = splitUrlSuffix(decoded);
1882
1896
  if (!basePath)
1883
1897
  return full;
1884
- const absolutePath = resolve2(resolvedDir, basePath);
1885
- const rebased = relative(resolvedRoot, absolutePath).split(sep).join("/");
1898
+ const absolutePath = resolveRelativeUrlPath(resolvedDir, basePath);
1899
+ const rebased = encodeUrlPath(relative(resolvedRoot, absolutePath).split(sep).join("/"));
1886
1900
  if (rebased === basePath)
1887
1901
  return full;
1888
- return `url(${quote || ""}${rebased}${suffix}${quote || ""})`;
1902
+ const escapedSuffix = suffix.replace(/[\s\p{Cc}"'()\\<>]/gu, (char) => `\\${char.codePointAt(0).toString(16).padStart(6, "0")}`);
1903
+ return `url(${quote || ""}${rebased}${escapedSuffix}${quote || ""})`;
1889
1904
  });
1890
1905
  }
1891
1906
  function rebaseRelativePath(urlValue, fromDir, toDir) {
1892
1907
  const { basePath, suffix } = splitUrlSuffix(urlValue.trim());
1893
1908
  if (!basePath)
1894
1909
  return urlValue;
1895
- const absolutePath = resolve2(fromDir, basePath);
1896
- const rebased = relative(resolve2(toDir), absolutePath).split(sep).join("/");
1910
+ const absolutePath = resolveRelativeUrlPath(fromDir, basePath);
1911
+ const rebased = encodeUrlPath(relative(resolve2(toDir), absolutePath).split(sep).join("/"));
1897
1912
  return appendSuffixToUrl(rebased, suffix);
1898
1913
  }
1899
1914
  function rebaseSrcsetPaths(srcsetValue, fromDir, toDir) {
@@ -1976,7 +1991,7 @@ function inlineCssFile(css, cssFileDir, projectDir, visited = /* @__PURE__ */ ne
1976
1991
  const importPath = urlPath ?? barePath;
1977
1992
  if (!importPath || !isRelativeUrl(importPath))
1978
1993
  return full;
1979
- const resolved = resolve2(cssFileDir, importPath);
1994
+ const resolved = resolve2(cssFileDir, decodedUrlPath(importPath));
1980
1995
  if (!isSafePath(projectDir, resolved))
1981
1996
  return full;
1982
1997
  if (visited.has(resolved))
@@ -2012,14 +2027,6 @@ function safeReadFileBuffer(filePath) {
2012
2027
  return null;
2013
2028
  }
2014
2029
  }
2015
- function splitUrlSuffix(urlValue) {
2016
- const queryIdx = urlValue.indexOf("?");
2017
- const hashIdx = urlValue.indexOf("#");
2018
- if (queryIdx < 0 && hashIdx < 0)
2019
- return { basePath: urlValue, suffix: "" };
2020
- const cutIdx = queryIdx < 0 ? hashIdx : hashIdx < 0 ? queryIdx : Math.min(queryIdx, hashIdx);
2021
- return { basePath: urlValue.slice(0, cutIdx), suffix: urlValue.slice(cutIdx) };
2022
- }
2023
2030
  function appendSuffixToUrl(baseUrl, suffix) {
2024
2031
  if (!suffix)
2025
2032
  return baseUrl;
@@ -2081,7 +2088,7 @@ function maybeInlineRelativeAssetUrl(urlValue, projectDir, inlineAssets) {
2081
2088
  const { basePath, suffix } = splitUrlSuffix(urlValue.trim());
2082
2089
  if (!basePath)
2083
2090
  return null;
2084
- const filePath = resolveWithinProject(projectDir, basePath);
2091
+ const filePath = resolveWithinProject(projectDir, decodeWellFormedEscapes(basePath));
2085
2092
  if (!filePath)
2086
2093
  return null;
2087
2094
  const ext = filePath.toLowerCase().match(/\.[^.]+$/)?.[0] ?? "";
@@ -2454,10 +2461,10 @@ function hoistExternalScript(src, projectDir, doc, seenSrcs, chunks, attributes)
2454
2461
  return;
2455
2462
  seenSrcs.add(src);
2456
2463
  if (!isNonRelativeUrl(src) && !isAbsolute(src) && attributes.type !== "module") {
2457
- const jsPath = resolveWithinProject(projectDir, src);
2464
+ const jsPath = resolveWithinProject(projectDir, decodedUrlPath(src));
2458
2465
  const js = jsPath ? safeReadFile(jsPath) : null;
2459
2466
  if (js != null) {
2460
- chunks.push(() => preserveLocalScriptIntegrity(doc, src, (value) => resolveWithinProject(projectDir, value)) ? "" : js);
2467
+ chunks.push(() => preserveLocalScriptIntegrity(doc, src, (value) => resolveWithinProject(projectDir, decodedUrlPath(value))) ? "" : js);
2461
2468
  return;
2462
2469
  }
2463
2470
  }
@@ -2489,6 +2496,7 @@ async function bundleProject(projectDir, options) {
2489
2496
  const resolved = resolve2(sourceDir, relativePath);
2490
2497
  return isSafePath(projectDir, resolved) ? resolved : null;
2491
2498
  };
2499
+ const resolveEntryUrl = (url) => resolveEntryPath(decodedUrlPath(url));
2492
2500
  const readSource = options?.stampHfIds ? ensureHfIds : (html) => html;
2493
2501
  noteRead(indexPath);
2494
2502
  const rawHtml = readSource(readFileSync(indexPath, "utf-8"));
@@ -2510,7 +2518,7 @@ async function bundleProject(projectDir, options) {
2510
2518
  continue;
2511
2519
  if (el.hasAttribute("disabled"))
2512
2520
  continue;
2513
- const cssPath = resolveEntryPath(href);
2521
+ const cssPath = resolveEntryUrl(href);
2514
2522
  if (!cssPath)
2515
2523
  continue;
2516
2524
  const css = safeReadFile(cssPath);
@@ -2532,7 +2540,7 @@ async function bundleProject(projectDir, options) {
2532
2540
  ])
2533
2541
  ].map((el) => {
2534
2542
  const src = el.getAttribute("src");
2535
- const path = src && isRelativeUrl(src) ? resolveEntryPath(src) : null;
2543
+ const path = src && isRelativeUrl(src) ? resolveEntryUrl(src) : null;
2536
2544
  return src ? path && safeReadFile(path) || "" : el.textContent || "";
2537
2545
  }) : [];
2538
2546
  const trackedCompositionHosts = getBundledTrackedCompositionHosts(document);
@@ -2594,10 +2602,10 @@ async function bundleProject(projectDir, options) {
2594
2602
  continue;
2595
2603
  seenCompScriptSrcs.add(extSrc);
2596
2604
  if (isRelativeUrl(extSrc) && scriptItem.type !== "module") {
2597
- const jsPath = resolveEntryPath(extSrc);
2605
+ const jsPath = resolveEntryUrl(extSrc);
2598
2606
  const js = jsPath ? safeReadFile(jsPath) : null;
2599
2607
  if (js != null) {
2600
- const chunk = () => preserveLocalScriptIntegrity(document, extSrc, resolveEntryPath) ? "" : js;
2608
+ const chunk = () => preserveLocalScriptIntegrity(document, extSrc, resolveEntryUrl) ? "" : js;
2601
2609
  pushRun(scriptRuns, scriptItem.scene, chunk);
2602
2610
  continue;
2603
2611
  }
@@ -2690,11 +2698,11 @@ async function bundleProject(projectDir, options) {
2690
2698
  const src = el.getAttribute("src");
2691
2699
  if (!src || !isRelativeUrl(src))
2692
2700
  continue;
2693
- if (preserveLocalScriptIntegrity(document, src, resolveEntryPath))
2701
+ if (preserveLocalScriptIntegrity(document, src, resolveEntryUrl))
2694
2702
  continue;
2695
2703
  if ((el.getAttribute("type") || "").trim().toLowerCase() === "module")
2696
2704
  continue;
2697
- const jsPath = resolveEntryPath(src);
2705
+ const jsPath = resolveEntryUrl(src);
2698
2706
  const js = jsPath ? safeReadFile(jsPath) : null;
2699
2707
  if (js == null)
2700
2708
  continue;
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  ensureDOMParser
9
- } from "./chunk-PFCFR3KZ.js";
9
+ } from "./chunk-442JNXRM.js";
10
10
 
11
11
  // src/utils/compositionViewport.ts
12
12
  var DEFAULT_VIEWPORT = { width: 1920, height: 1080 };
@@ -6,10 +6,10 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  getMimeType
9
- } from "./chunk-6Q6FR4KH.js";
9
+ } from "./chunk-7UYBQ6NF.js";
10
10
  import {
11
11
  injectTagsAtHeadStart
12
- } from "./chunk-SYKKFAUW.js";
12
+ } from "./chunk-6TPZSTCL.js";
13
13
 
14
14
  // src/utils/compositionServer.ts
15
15
  import { createHash } from "crypto";
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  ensureModel,
12
12
  selectProviders
13
- } from "./chunk-2NCHQUPX.js";
13
+ } from "./chunk-SQLK7SJL.js";
14
14
  import {
15
15
  findFFmpeg,
16
16
  findFFprobe,
@@ -18,8 +18,9 @@ import {
18
18
  } from "./chunk-TVCRUG2S.js";
19
19
  import {
20
20
  DEFAULT_VP9_CPU_USED,
21
+ SDR_RGB_TO_BT709_FILTER,
21
22
  renderProvenanceArgs
22
- } from "./chunk-E6SDW5FV.js";
23
+ } from "./chunk-33RZPZ4K.js";
23
24
 
24
25
  // src/background-removal/pipeline.ts
25
26
  import { spawn } from "child_process";
@@ -202,7 +203,7 @@ function inferInputKind(inputPath) {
202
203
  }
203
204
  async function probeMedia(inputPath) {
204
205
  const isImage = inferInputKind(inputPath) === "image";
205
- const engine = await import("./src-I7UC3JTL.js");
206
+ const engine = await import("./src-JO5JOV7Y.js");
206
207
  const meta = await engine.extractMediaMetadata(inputPath);
207
208
  if (isImage) {
208
209
  return { width: meta.width, height: meta.height, fps: 0, frameCount: 1 };
@@ -228,6 +229,8 @@ function buildEncoderArgs(format, width, height, fps, outputPath, quality = DEFA
228
229
  if (format === "webm") {
229
230
  return [
230
231
  ...base,
232
+ "-vf",
233
+ SDR_RGB_TO_BT709_FILTER,
231
234
  "-c:v",
232
235
  "libvpx-vp9",
233
236
  "-b:v",
@@ -244,11 +247,6 @@ function buildEncoderArgs(format, width, height, fps, outputPath, quality = DEFA
244
247
  "0",
245
248
  "-pix_fmt",
246
249
  "yuva420p",
247
- // Tag the output as BT.709 limited range so browsers use the same
248
- // YUV→RGB matrix the source video was encoded with. Without these tags
249
- // ffmpeg's default RGB→YUV conversion is BT.601, which causes a visible
250
- // color shift (red/skin tones in particular) when the matted overlay is
251
- // composited over the original mp4.
252
250
  "-colorspace",
253
251
  "bt709",
254
252
  "-color_primaries",
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  errorBox
9
- } from "./chunk-IHFUKJOR.js";
9
+ } from "./chunk-K2FLNJVB.js";
10
10
  import {
11
11
  failUsage
12
12
  } from "./chunk-PBN6GBJE.js";