hyperframes 0.8.205 → 0.8.207

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 (221) hide show
  1. package/bin/hyperframes.mjs +1 -0
  2. package/dist/{add-BA4AU262.js → add-LXFWHBE3.js} +19 -18
  3. package/dist/{agentPromptGenerator-KYO5MKTW.js → agentPromptGenerator-D2E62ZP5.js} +1 -1
  4. package/dist/{animatedGifPrep-UNUCFGLQ.js → animatedGifPrep-VBPJZKFT.js} +21 -15
  5. package/dist/api.js +31 -31
  6. package/dist/{appHistory-QVCSAOI4.js → appHistory-HIBH6XZW.js} +3 -1
  7. package/dist/{asset-KCDVTNC3.js → asset-JX4RW3GO.js} +2 -2
  8. package/dist/{assetCataloger-5FCVQ3N6.js → assetCataloger-JKKOPBCF.js} +15 -14
  9. package/dist/{audio-KDBPEHRS.js → audio-OXQ3L6DW.js} +24 -24
  10. package/dist/{auth-IMPBZZXJ.js → auth-JAL7P7ZA.js} +1 -1
  11. package/dist/{autoUpdate-YE2RKCAG.js → autoUpdate-MRI2AICE.js} +2 -2
  12. package/dist/{backgroundChecks-OWY2UFSR.js → backgroundChecks-ORR46PBY.js} +3 -3
  13. package/dist/backgroundChecksWorker.js +3 -3
  14. package/dist/{batchRender-AN4HWKET.js → batchRender-IFZYPGIW.js} +9 -9
  15. package/dist/{beats-VTQJ4JH6.js → beats-UDLOEW6U.js} +21 -21
  16. package/dist/{benchmark-PBEWHJ5K.js → benchmark-VTVDNKSO.js} +14 -14
  17. package/dist/{browser-E7ANEHNU.js → browser-QJC4BL2Y.js} +6 -6
  18. package/dist/{bundleWithLocalizedFonts-I3BWMRSP.js → bundleWithLocalizedFonts-Z2JTBNDS.js} +2 -2
  19. package/dist/{capture-MP7R72WU.js → capture-2P4JERSX.js} +14 -3
  20. package/dist/{capture-XODFC4S4.js → capture-GLM2ACPM.js} +81 -41
  21. package/dist/{captureCompositionFrame-2OYGVDI3.js → captureCompositionFrame-A2A5MGQB.js} +19 -19
  22. package/dist/{captureFile-LYOJOUIE.js → captureFile-RPUEOZO6.js} +1 -1
  23. package/dist/{catalog-ORVCCEQR.js → catalog-5ZLVUQVJ.js} +25 -24
  24. package/dist/{catch-up-SYAQOXTT.js → catch-up-FRMVYJHZ.js} +5 -5
  25. package/dist/{check-6SQR6SSA.js → check-WVY7SM7C.js} +50 -48
  26. package/dist/checkAudio-PLEQY3SZ.js +201 -0
  27. package/dist/{checkBrowser-HOTD3CDE.js → checkBrowser-XSZUA2DQ.js} +42 -41
  28. package/dist/{chunk-JFNB4CMI.js → chunk-526VSRZ4.js} +20 -8
  29. package/dist/{chunk-DQBY7FRR.js → chunk-543U46OR.js} +4 -1
  30. package/dist/{chunk-CUGADCIV.js → chunk-5KBMYSF2.js} +54 -15
  31. package/dist/{chunk-2ST4WAFY.js → chunk-5PCALX6G.js} +13 -1
  32. package/dist/{chunk-TZ7MTRVJ.js → chunk-5PYRU5DT.js} +13 -13
  33. package/dist/{chunk-AYH5ANVS.js → chunk-5YHQBCWH.js} +52 -3
  34. package/dist/{chunk-KBZSMKKD.js → chunk-63DP5CB2.js} +29 -3
  35. package/dist/{chunk-GLBEBBS2.js → chunk-6IYIS2U7.js} +2 -2
  36. package/dist/{chunk-GSTFETKE.js → chunk-6KCFVLO6.js} +5 -5
  37. package/dist/{chunk-EXRHI43B.js → chunk-6KOHY5EP.js} +10 -9
  38. package/dist/{chunk-CU76YDPX.js → chunk-6Z7XDUUJ.js} +1 -1
  39. package/dist/{chunk-XNAIYEKD.js → chunk-7PJ3AJB2.js} +1 -1
  40. package/dist/{chunk-6GAYBX5C.js → chunk-7RWUY3BJ.js} +64 -62
  41. package/dist/{chunk-3CISA3OS.js → chunk-AF3L5JJX.js} +1 -1
  42. package/dist/chunk-BDJIQZN2.js +4830 -0
  43. package/dist/{chunk-75WNFDRU.js → chunk-C53ZNJDZ.js} +4 -4
  44. package/dist/{chunk-GBQCTZON.js → chunk-CVZO6TFE.js} +13 -43
  45. package/dist/{chunk-RQDVTUVD.js → chunk-DJQZ7DEH.js} +15 -15
  46. package/dist/{chunk-KAIQPYCM.js → chunk-DML6BD4K.js} +2 -2
  47. package/dist/{chunk-BTYT3RT3.js → chunk-EG3B2VWK.js} +2 -2
  48. package/dist/{chunk-OB7QARSN.js → chunk-EGRIVMCQ.js} +1 -1
  49. package/dist/{chunk-V4K4BSCM.js → chunk-EHFZEKQM.js} +57 -5
  50. package/dist/{chunk-H4MSJ2NZ.js → chunk-FEO7YW7V.js} +8 -8
  51. package/dist/{chunk-FNBEYIZH.js → chunk-FVAI7AHF.js} +13 -12
  52. package/dist/{chunk-PLGGKTCB.js → chunk-GXUONASF.js} +13 -20
  53. package/dist/{chunk-L6N2TLXR.js → chunk-H3LQ5X6Q.js} +84 -79
  54. package/dist/{chunk-MVXOY5RC.js → chunk-HA3V4XAF.js} +6 -6
  55. package/dist/{chunk-WB55EQNJ.js → chunk-HM7SUIQD.js} +38 -9
  56. package/dist/{chunk-G445Y3YG.js → chunk-HVOTYAS4.js} +15 -7
  57. package/dist/{chunk-IKYXXIMP.js → chunk-I2TDHVFV.js} +3 -3
  58. package/dist/{chunk-3N4T6I3O.js → chunk-I3TYUQLB.js} +1 -1
  59. package/dist/{chunk-AECL3B23.js → chunk-IBZHSU2J.js} +1 -1
  60. package/dist/{chunk-2FEOM3ZT.js → chunk-ID766OZB.js} +12 -12
  61. package/dist/{chunk-4UIEQIF4.js → chunk-IK4JY2LI.js} +2 -2
  62. package/dist/{chunk-C4LV6L4Q.js → chunk-IW5P4KK7.js} +3 -3
  63. package/dist/{chunk-N7VQD4WB.js → chunk-IYZT62UR.js} +1 -1
  64. package/dist/chunk-JKE24AG7.js +62 -0
  65. package/dist/chunk-JLCAHJUO.js +91 -0
  66. package/dist/{chunk-EUFBE5BW.js → chunk-JLGVBK5M.js} +1 -1
  67. package/dist/{chunk-6NC4KBS2.js → chunk-JQ32262N.js} +1 -1
  68. package/dist/{chunk-J2E3VVOS.js → chunk-KDHHPJOG.js} +4 -4
  69. package/dist/{chunk-A42PDANH.js → chunk-LCCYYTEK.js} +1 -1
  70. package/dist/{chunk-T2UR3T4L.js → chunk-LK6KPVX2.js} +263 -74
  71. package/dist/{chunk-RWOWD3PW.js → chunk-LPI7HX4G.js} +2 -2
  72. package/dist/{chunk-UR6BAPOD.js → chunk-LXP6XWJL.js} +2 -2
  73. package/dist/{chunk-4RPCYGZG.js → chunk-MAUGXKSI.js} +4 -4
  74. package/dist/{chunk-AII6P2TC.js → chunk-MMJAHBH2.js} +1 -1
  75. package/dist/{chunk-LFGJWOVA.js → chunk-MNNK7RV5.js} +11 -8
  76. package/dist/{chunk-26OI2B2X.js → chunk-MSHL6CF2.js} +1 -1
  77. package/dist/{chunk-SVVAUJPL.js → chunk-NHA4NRBE.js} +136 -25
  78. package/dist/{chunk-5F6B6KMK.js → chunk-NHL5CMO2.js} +18 -3
  79. package/dist/{chunk-NF6KI46X.js → chunk-NJNC2DQV.js} +31 -28
  80. package/dist/{chunk-I7IXUCKL.js → chunk-NSC5A4IR.js} +1 -1
  81. package/dist/{chunk-MRF4AMKD.js → chunk-NWGXTUYS.js} +32 -10
  82. package/dist/{chunk-57I5KNTL.js → chunk-PL36HK3U.js} +3 -3
  83. package/dist/{chunk-TOEIJ4WF.js → chunk-PUIG6DHT.js} +5 -5
  84. package/dist/{chunk-BA7MQJXG.js → chunk-QE4WRS3N.js} +3 -3
  85. package/dist/{chunk-7V7OUKTU.js → chunk-QTWXVOZI.js} +1 -1
  86. package/dist/{chunk-V2XXV2EH.js → chunk-QZ2JQ6O4.js} +6 -6
  87. package/dist/{chunk-BHOGXIBO.js → chunk-RPZNQV6D.js} +58 -826
  88. package/dist/{chunk-2BGOB2QK.js → chunk-SE2MXV2N.js} +136 -25
  89. package/dist/{chunk-HADQPG7O.js → chunk-SXOD5J7T.js} +2 -2
  90. package/dist/{chunk-32R2AFZ3.js → chunk-T4JGFCXU.js} +3 -3
  91. package/dist/chunk-TQBQYO4L.js +55 -0
  92. package/dist/{chunk-ZSUWGNIT.js → chunk-TSTONNOD.js} +2 -2
  93. package/dist/chunk-TSYRN646.js +84 -0
  94. package/dist/{chunk-BZ727KLT.js → chunk-U32PA6DI.js} +1 -1
  95. package/dist/{chunk-5PVPGWMH.js → chunk-UAT2UMTP.js} +1 -1
  96. package/dist/{chunk-TGS33LDU.js → chunk-UKM3JYNB.js} +5 -71
  97. package/dist/{chunk-UEOGIZ3Q.js → chunk-UUOIH4RW.js} +3 -3
  98. package/dist/{chunk-MASFRPCB.js → chunk-UYPWH7PH.js} +10 -10
  99. package/dist/{chunk-LSQM3NBR.js → chunk-VAVDAOUA.js} +1 -1
  100. package/dist/chunk-VBPNCOD7.js +355 -0
  101. package/dist/{chunk-HQ3CFNHL.js → chunk-VH4PNYOS.js} +1 -1
  102. package/dist/{chunk-IXXVS2Z4.js → chunk-VQB7G5BM.js} +1 -1
  103. package/dist/{chunk-FLREUEHW.js → chunk-W4DMQZL5.js} +1 -1
  104. package/dist/{chunk-RXATE6FZ.js → chunk-WC4MTXGN.js} +22 -0
  105. package/dist/{chunk-F2ASNL2K.js → chunk-WL263XM2.js} +1 -1
  106. package/dist/{chunk-ZB6SCA4J.js → chunk-XAGBSYIQ.js} +9 -2
  107. package/dist/{chunk-LQUMMPGK.js → chunk-XKW4Z7BU.js} +1 -1
  108. package/dist/chunk-XMRA7CQG.js +22 -0
  109. package/dist/{chunk-6YYFNGCS.js → chunk-XULJBZ7K.js} +7 -4
  110. package/dist/chunk-YJK6HOL5.js +29 -0
  111. package/dist/{chunk-KVNXEAVT.js → chunk-ZCJ5EGLU.js} +30 -10
  112. package/dist/{chunk-ERUINDRT.js → chunk-ZF3R2IPC.js} +184 -183
  113. package/dist/{chunk-AECSY5LT.js → chunk-ZYGIDXAK.js} +569 -378
  114. package/dist/{clean-BW7NHQS5.js → clean-TL3IPJDN.js} +28 -28
  115. package/dist/cli.js +55 -55
  116. package/dist/{cloud-TZVXTWZO.js → cloud-EYMRPJNY.js} +4 -4
  117. package/dist/{cloudrun-KRIETALO.js → cloudrun-TOJ36NLX.js} +11 -11
  118. package/dist/commands/layout-audit.browser.js +3 -15
  119. package/dist/{compare-WYWHJ4CR.js → compare-MP5EOW4D.js} +40 -40
  120. package/dist/{compiler-ANIPXLJ7.js → compiler-NOPVLJ2S.js} +15 -15
  121. package/dist/{component-CY7DCX56.js → component-ASACDCZK.js} +3 -3
  122. package/dist/{compositions-5YEB24E3.js → compositions-WKNZJY34.js} +19 -19
  123. package/dist/{contactSheet-5APX35L3.js → contactSheet-YOBPATEM.js} +2 -2
  124. package/dist/{delete-6642PDON.js → delete-DQTFHP3G.js} +2 -2
  125. package/dist/{deploy-NZP6TZLS.js → deploy-HHCFOUFM.js} +4 -4
  126. package/dist/{deterministicFonts-HQYCUUAL.js → deterministicFonts-LKAGUNE5.js} +3 -3
  127. package/dist/{dist-V2BGP46S.js → dist-L4Z4ZEYW.js} +7 -4
  128. package/dist/{dist-DGFC75NC.js → dist-NQEYA4ZX.js} +44 -36
  129. package/dist/docs/rendering.md +3 -0
  130. package/dist/{doctor-ZW4A2FS3.js → doctor-JDM65CP7.js} +20 -20
  131. package/dist/{events-NJU4VFDA.js → events-MBRNA3UF.js} +3 -3
  132. package/dist/{events-XRCHY2F6.js → events-RKRHRLJD.js} +2 -2
  133. package/dist/{feedback-NQLSZMES.js → feedback-LZWIWV5J.js} +17 -17
  134. package/dist/{ffmpeg-RYDQLG3G.js → ffmpeg-4PZKSIGE.js} +15 -15
  135. package/dist/{figma-TJAMP2CI.js → figma-QFNYUT3F.js} +3 -3
  136. package/dist/fontLocalizeCli.js +20 -18
  137. package/dist/{get-RRZ3O26X.js → get-2B5ENJOH.js} +2 -2
  138. package/dist/{gpuPolicy-4WLHUUS3.js → gpuPolicy-E5FB2GFR.js} +13 -13
  139. package/dist/{grade-compare-P7PE3NAA.js → grade-compare-4GUAPJHE.js} +40 -40
  140. package/dist/{gsapParser-IEUSLYDJ.js → gsapParser-3H7ON3DO.js} +1 -1
  141. package/dist/{gsapParserAcorn-LZJKCFQI.js → gsapParserAcorn-5YD4N6HQ.js} +2 -2
  142. package/dist/hangReport.js +47 -0
  143. package/dist/heifImagePrep-C2RYIEER.js +53 -0
  144. package/dist/{help-6RELRVIW.js → help-XGDAXV67.js} +1 -1
  145. package/dist/{history-GIIDYND3.js → history-WNFF6HGU.js} +108 -60
  146. package/dist/hyperframe.manifest.json +1 -1
  147. package/dist/hyperframe.runtime.iife.js +75 -68
  148. package/dist/hyperframes-player.global.js +3 -3
  149. package/dist/hyperframes-slideshow.global.js +16 -16
  150. package/dist/{info-LBUA2DXE.js → info-BR2LKGJD.js} +16 -16
  151. package/dist/{init-QUPXBONY.js → init-P6UWPUY3.js} +59 -58
  152. package/dist/{inspect-CL42DJZ4.js → inspect-MSRPF7ZO.js} +40 -39
  153. package/dist/inspection.js +4 -4
  154. package/dist/{installer-VR7XDLR3.js → installer-MPUQS3ZX.js} +10 -10
  155. package/dist/{keyframes-LELLROMA.js → keyframes-J6K66QTO.js} +11 -11
  156. package/dist/{lambda-I6KFXWOO.js → lambda-LJ2OSWFJ.js} +32 -13
  157. package/dist/{layout-NR6SNRZE.js → layout-CDY65XGA.js} +40 -39
  158. package/dist/{lint-DYEMSEQR.js → lint-CAUNBGPX.js} +13 -10
  159. package/dist/{lintProject-EA4NPL2X.js → lintProject-ZTSX3AWT.js} +7 -4
  160. package/dist/{list-RDURYO5U.js → list-33BYQNRZ.js} +2 -2
  161. package/dist/{login-VKLET5OL.js → login-5QMRKOHK.js} +4 -4
  162. package/dist/{manager-IYT3THJN.js → manager-3JOHHPVR.js} +17 -17
  163. package/dist/{manager-7TSUZKXU.js → manager-RMYSZ3KI.js} +7 -3
  164. package/dist/{media-treatment-I4AFEQZ3.js → media-treatment-4WP22CFN.js} +23 -23
  165. package/dist/{models-LLPVGC2E.js → models-HPWCHAZX.js} +28 -28
  166. package/dist/{motionShot-6A6HH6IK.js → motionShot-I7GDIROQ.js} +23 -23
  167. package/dist/{normalize-audio-KVQJBYLT.js → normalize-audio-VTMXPSC7.js} +14 -14
  168. package/dist/{open-J4ZT4X3C.js → open-SAO7OQTT.js} +19 -19
  169. package/dist/{parakeetRunner-FLUCIDIZ.js → parakeetRunner-ZYPBIA73.js} +25 -25
  170. package/dist/{pipeline-RRVLGALQ.js → pipeline-VNBMR6QU.js} +16 -16
  171. package/dist/{play-QGJSXUVM.js → play-7VI6A7KN.js} +42 -32
  172. package/dist/{preflight-SP2ZERBE.js → preflight-VWV7L45J.js} +17 -17
  173. package/dist/{present-UR4YBHMX.js → present-CSJGYOFF.js} +37 -27
  174. package/dist/{preview-6ENCRU4C.js → preview-B246ZTVO.js} +60 -45
  175. package/dist/{producer-OMHZRY6A.js → producer-WJLFDVQJ.js} +1 -1
  176. package/dist/{projectConfig-NGS7GJ47.js → projectConfig-OMR46ZWQ.js} +14 -13
  177. package/dist/{publication-6NYQA22Y.js → publication-AA7NNYET.js} +8 -8
  178. package/dist/{publish-E6RE5VHB.js → publish-TJ4QVVSP.js} +18 -17
  179. package/dist/{remove-background-66PQRA7R.js → remove-background-LQ2V7W7N.js} +20 -20
  180. package/dist/{render-ZLRJUFMX.js → render-AWEEPG3F.js} +39 -37
  181. package/dist/{render-SBAZWXPO.js → render-E5QJG74D.js} +14 -11
  182. package/dist/{render-IMSGS6BD.js → render-JLTNZ36U.js} +83 -51
  183. package/dist/{render-batch-MO7LYZSP.js → render-batch-U4T4VSCM.js} +14 -11
  184. package/dist/renderSetupWorker.js +11 -8
  185. package/dist/{resolver-QMBVTAKT.js → resolver-GXCTUKPV.js} +10 -10
  186. package/dist/{screenshotCapture-I5EDCITF.js → screenshotCapture-X6OKIXCB.js} +1 -1
  187. package/dist/{sherpa-JZRDL3OE.js → sherpa-4VZWVHWZ.js} +24 -24
  188. package/dist/skills/hyperframes-cli/references/init-and-scaffold.md +1 -0
  189. package/dist/skills/hyperframes-cli/references/lambda.md +3 -0
  190. package/dist/skills/hyperframes-cli/references/preview-render.md +3 -0
  191. package/dist/{skills-YBTEWFYS.js → skills-WUKR7SUE.js} +8 -8
  192. package/dist/{skillsUpdateCheck-Z4HTDZJN.js → skillsUpdateCheck-YXRBY3JC.js} +3 -3
  193. package/dist/{snapshot-5F5UV6H5.js → snapshot-Q7S2FTNG.js} +143 -77
  194. package/dist/{src-WWXYV2TS.js → src-CLAALR5W.js} +26 -19
  195. package/dist/{src-UTW3F2PM.js → src-ZOXUSGAP.js} +24 -12
  196. package/dist/{staticProjectServer-UHZ63C5O.js → staticProjectServer-DQ7PIDPA.js} +26 -26
  197. package/dist/studio/assets/hyperframes-player-Cm5aBiKq.js +478 -0
  198. package/dist/studio/assets/{index-dy6GQJn4.js → index-BF9YeBnC.js} +142 -142
  199. package/dist/studio/assets/{index-C8hp9Y7c.js → index-BrqAmMRt.js} +1 -1
  200. package/dist/studio/index.html +1 -1
  201. package/dist/{studio-api-BHZ3PHL2.js → studio-api-NUE227JM.js} +18 -18
  202. package/dist/{studioSelectionClient-IUUPKUHZ.js → studioSelectionClient-D6VMGTKQ.js} +1 -1
  203. package/dist/{studioServer-AFUXWRB5.js → studioServer-HVOKP4VI.js} +81 -70
  204. package/dist/{synthesize-PKTB5ATG.js → synthesize-QZHRXGRY.js} +30 -8
  205. package/dist/{telemetry-UYKOT4OJ.js → telemetry-2Y5JXLDB.js} +3 -3
  206. package/dist/{timeline-K5NLEMH4.js → timeline-WOQGXFRV.js} +28 -28
  207. package/dist/{tokens-FCOSWE2O.js → tokens-T3OHTWUC.js} +2 -2
  208. package/dist/{transcribe-SIFMTW5W.js → transcribe-4U74P5TG.js} +22 -22
  209. package/dist/{transcribe-K2QTXDQR.js → transcribe-JZ3BO546.js} +32 -32
  210. package/dist/{tts-5I2AJNLM.js → tts-AY4JO5NQ.js} +2 -2
  211. package/dist/{updateCheck-JZ6TBZVE.js → updateCheck-6EUAGAM4.js} +2 -2
  212. package/dist/{upgrade-TUPAJXQQ.js → upgrade-55K6F4MP.js} +2 -2
  213. package/dist/upstreamProxy-W5FWAT5Z.js +17 -0
  214. package/dist/{urlDownloader-L4775QID.js → urlDownloader-47JMOLNN.js} +12 -12
  215. package/dist/{validate-4HVVMEBV.js → validate-QBJ3SBS4.js} +32 -32
  216. package/dist/{video-4OGPF3IE.js → video-3ZAUNAR3.js} +17 -15
  217. package/dist/warmCheck.js +50 -48
  218. package/package.json +2 -1
  219. package/dist/chunk-4YYJOFKS.js +0 -28
  220. package/dist/chunk-ZUQZP6QD.js +0 -3986
  221. package/dist/studio/assets/hyperframes-player-DzdSmJdB.js +0 -478
@@ -5,18 +5,29 @@ var require = __hf_createRequire(import.meta.url);
5
5
  var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
+ AUTHORED_SOURCE_BEGIN,
9
+ AUTHORED_SOURCE_END,
8
10
  HF_AUDIO_FX_ATTR,
9
11
  HF_COLOR_GRADING_ATTR,
10
12
  INLINED_FILE_ATTR,
11
13
  RUNTIME_BOOTSTRAP_ATTR,
14
+ SCENE_FONTS_ATTR,
15
+ SCENE_NO_SWAP_ATTR,
16
+ SCENE_PARTS_META,
17
+ SCENE_PART_ATTR,
12
18
  assignMediaRenderIds,
19
+ buildVariablesByCompScript,
13
20
  clampDurations,
14
21
  compileTimingAttrs,
15
22
  compositionStyle,
16
23
  countPageRoot,
24
+ createCompositionCssScoper,
17
25
  cssStyleMergeKey,
26
+ dedupeFontFaceRules,
18
27
  deferScriptsUntilFonts,
19
28
  enumerateNestedCompositionHosts,
29
+ escapeCssAttributeValue,
30
+ escapeCssIdentifier,
20
31
  escapeInlineScriptSource,
21
32
  executableScripts,
22
33
  extractResolvedMedia,
@@ -24,6 +35,7 @@ import {
24
35
  getHyperframeRuntimeScript,
25
36
  hasSameLink,
26
37
  headStyleRuns,
38
+ hoistFontFaceRules,
27
39
  injectDurations,
28
40
  injectTagsAtHeadStart,
29
41
  inlineScriptRuns,
@@ -31,16 +43,23 @@ import {
31
43
  isAlwaysAppliedStyle,
32
44
  isJavaScriptType,
33
45
  isTemplateEntry,
46
+ parseAttributeSelector,
34
47
  parseHTMLContent,
35
48
  parseHostVariableValues,
36
49
  planCompositionAssembly,
37
50
  readDeclaredDefaults,
51
+ replaceSelectorAttributeTokens,
52
+ replaceSelectorIdTokens,
38
53
  rewriteSrcsetUrls,
54
+ scopeCssToComposition,
55
+ scopedModulePrelude,
39
56
  shouldClampResolvedMediaDuration,
40
57
  stripEmbeddedRuntimeScripts,
41
58
  styleElementsFor,
42
- warnUnknownEnumValues
43
- } from "./chunk-ZUQZP6QD.js";
59
+ warnUnknownEnumValues,
60
+ wrapInlineScriptWithErrorBoundary,
61
+ wrapScopedCompositionScript
62
+ } from "./chunk-BDJIQZN2.js";
44
63
  import {
45
64
  cssVariableName
46
65
  } from "./chunk-VC76R6W2.js";
@@ -50,7 +69,7 @@ import {
50
69
  } from "./chunk-OFQWTKPW.js";
51
70
  import {
52
71
  lintHyperframeHtml
53
- } from "./chunk-KVNXEAVT.js";
72
+ } from "./chunk-ZCJ5EGLU.js";
54
73
  import {
55
74
  CSS_URL_RE,
56
75
  checkSubCompositionUsability,
@@ -65,7 +84,7 @@ import {
65
84
  rewriteCssAssetUrls,
66
85
  rewriteInlineStyleAssetUrls,
67
86
  splitUrlSuffix
68
- } from "./chunk-2BGOB2QK.js";
87
+ } from "./chunk-SE2MXV2N.js";
69
88
  import {
70
89
  parseHTML
71
90
  } from "./chunk-GWTIFRF5.js";
@@ -126,11 +145,33 @@ async function clampProbedMedia(html, projectDir, probeMediaDuration) {
126
145
  // ../core/dist/compiler/htmlBundler.js
127
146
  import { createHash } from "crypto";
128
147
 
129
- // ../core/dist/sceneParts.js
130
- var SCENE_PART_ATTR = "data-hf-scene";
131
- var SCENE_PARTS_META = "hf-scene-parts";
132
- var SCENE_FONTS_ATTR = "data-hf-scene-fonts";
133
- var SCENE_NO_SWAP_ATTR = "data-hf-scene-no-swap";
148
+ // ../core/dist/compiler/pngColourTags.js
149
+ var PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
150
+ var PNG_SIGNATURE_BYTES = PNG_SIGNATURE.length;
151
+ var CHUNK_OVERHEAD_BYTES = 12;
152
+ var REMOVED_CHUNKS = /* @__PURE__ */ new Set(["cICP", "gAMA", "cHRM"]);
153
+ var HDR_CICP_TRANSFERS = /* @__PURE__ */ new Set([16, 18]);
154
+ function stripSdrPngColourTags(png) {
155
+ const bytes = Buffer.from(png.buffer, png.byteOffset, png.byteLength);
156
+ if (!bytes.subarray(0, PNG_SIGNATURE_BYTES).equals(PNG_SIGNATURE))
157
+ return null;
158
+ const kept = [bytes.subarray(0, PNG_SIGNATURE_BYTES)];
159
+ let removed = false;
160
+ for (let at = PNG_SIGNATURE_BYTES; at + CHUNK_OVERHEAD_BYTES <= bytes.length; ) {
161
+ const end = at + CHUNK_OVERHEAD_BYTES + bytes.readUInt32BE(at);
162
+ if (end > bytes.length)
163
+ return null;
164
+ const type = bytes.toString("latin1", at + 4, at + 8);
165
+ if (type === "cICP" && HDR_CICP_TRANSFERS.has(bytes[at + 9] ?? 0))
166
+ return null;
167
+ if (REMOVED_CHUNKS.has(type))
168
+ removed = true;
169
+ else
170
+ kept.push(bytes.subarray(at, end));
171
+ at = end;
172
+ }
173
+ return removed ? Buffer.concat(kept) : null;
174
+ }
134
175
 
135
176
  // ../core/dist/compiler/externalScripts.js
136
177
  function readExternalScriptAttributes(el) {
@@ -356,815 +397,6 @@ function extractStandaloneEntryFromIndex(indexHtml, entryFile, entryHtml) {
356
397
  return document.toString();
357
398
  }
358
399
 
359
- // ../core/dist/generated/svg-selector-aliases-inline.js
360
- var SVG_SELECTOR_ALIASES_IIFE = '"use strict";(()=>{function I(e){return e?/[\\w-]/.test(e)||e.charCodeAt(0)>=128:!1}function _(e){return e===" "||e===" "||e===`\n`||e==="\\r"||e==="\\f"}var j=/^[0-9a-fA-F]{1,6}/;function G(e){let n=e>=55296&&e<=57343;return e===0||e>1114111||n?65533:e}function $(e,n){return e[n]==="\\r"&&e[n+1]===`\n`?n+2:_(e[n])?n+1:n}function R(e,n){let t=e[n+1];if(t===void 0||/[\\n\\r\\f]/.test(t))return null;let i=j.exec(e.slice(n+1,n+7));if(!i)return{value:t,end:n+2};let o=G(Number.parseInt(i[0],16));return{value:String.fromCodePoint(o),end:$(e,n+1+i[0].length)}}function H(e,n){let t=o=>I(o)&&!/[0-9-]/.test(o),i=o=>e[o]==="\\\\"&&R(e,o)!==null;return e[n]==="-"?e[n+1]==="-"||t(e[n+1])||i(n+1):t(e[n])||i(n)}function y(e,n){let t=n;for(;e.startsWith("/*",t);){let i=e.indexOf("*/",t+2);t=i<0?e.length:i+2}return t}function A(e,n){let t=y(e,n);for(;_(e[t]);)t=y(e,t+1);return t}function h(e,n){if(!H(e,n))return null;let t=n,i="";for(;t<e.length;){let o=e[t];if(o==="\\\\"){let a=R(e,t);if(!a)break;i+=a.value,t=a.end;continue}if(!I(o))break;i+=o,t+=1}return t===n?null:{value:i,end:t}}var C=45;function T(e){return e>=48&&e<=57}function z(e){return e>=128||e===C||e===95||T(e)||e>=65&&e<=90||e>=97&&e<=122}function J(e,n){let t=e.charCodeAt(n);return t>=1&&t<=31||t===127?!0:T(t)?n===0||n===1&&e.charCodeAt(0)===C:!1}function k(e){let n="";for(let t=0;t<e.length;t+=1){let i=e.charCodeAt(t),o=e[t];i===0?n+="\\uFFFD":J(e,t)?n+=`\\\\${i.toString(16)} `:t===0&&e.length===1&&i===C?n+=`\\\\${o}`:z(i)?n+=o:n+=`\\\\${o}`}return n}var W=/\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/|\\\\(?:[0-9a-fA-F]{1,6}(?:\\r\\n|[ \\t\\r\\n\\f])?|[\\s\\S])|"(?:[^"\\\\]|\\\\[\\s\\S])*"|\'(?:[^\'\\\\]|\\\\[\\s\\S])*\'|\\[(?:\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/|\\\\[\\s\\S]|"(?:[^"\\\\]|\\\\[\\s\\S])*"|\'(?:[^\'\\\\]|\\\\[\\s\\S])*\'|[^\\]"\'\\\\/]|\\/(?!\\*))*\\]/g;function Q(e){let n=new Array(e.length).fill(!0);for(let t of e.matchAll(W)){let i=t.index;n.fill(!1,i,i+t[0].length)}return n}function q(e,n,t){if(n.length===0||!e.includes("#"))return e;let i=new Set(n),o=Q(e),a="",u=0;for(;u<e.length;){let d=o[u]&&e[u]==="#"?h(e,u+1):null;d&&i.has(d.value)?(a+=t(d.value),u=d.end):(a+=e[u],u+=1)}return a}function X(e){let n="";for(let t=0;t<e.length;t+=1){if(e[t]==="\\\\"){let i=e[t+1];if(i!==void 0&&/[\\n\\r\\f]/.test(i)){t=$(e,t+1)-1;continue}let o=R(e,t);if(o){n+=o.value,t=o.end-1;continue}}n+=e[t]}return n}function N(e){return Array.from(e,n=>{let t=n.charCodeAt(0);return t===0?"\\uFFFD":t<32||t===127?`\\\\${t.toString(16)} `:n===\'"\'||n==="\\\\"?`\\\\${n}`:n}).join("")}function Y(e,n){return e?{kind:"any"}:n===void 0?{kind:"none"}:{kind:"named",prefix:n}}function Z(e,n){return e[n]==="|"&&e[n+1]!=="="}function B(e,n){let t=e[n]==="*",i=t?{value:"*",end:n+1}:h(e,n),o=y(e,i?.end??n);if(!Z(e,o))return t?null:i?{token:i,namespace:{kind:"none"}}:null;let a=h(e,y(e,o+1));return a?{token:a,namespace:Y(t,i?.value)}:null}function K(e){if(e[0]!=="[")return null;let n=A(e,1),t=B(e,n);if(!t)return null;let{token:i,namespace:o}=t;return{name:i.value,rawName:e.slice(n,i.end),namespace:o,end:i.end}}function ee(e,n){let t=/^(?:"((?:\\\\[\\s\\S]|[^"\\\\])*)"|\'((?:\\\\[\\s\\S]|[^\'\\\\])*)\')/.exec(e.slice(n));return t?{value:X(t[1]??t[2]),end:n+t[0].length}:h(e,n)}function ne(e,n){let t=A(e,n),i=h(e,t);if(i){if(!/^[is]$/i.test(i.value))return null;t=A(e,i.end)}return e[t]!=="]"||t!==e.length-1?null:{flag:i?.value}}function F(e){let n=K(e);if(!n)return null;let t=A(e,n.end),o=["=","~=","|=","^=","$=","*="].find(d=>e.startsWith(d,t));if(!o)return null;let a=ee(e,A(e,t+o.length));if(!a)return null;let u=ne(e,a.end);return u?{name:n.name,rawName:n.rawName,namespace:n.namespace,operator:o,value:a.value,flag:u.flag}:null}function E(e,n){return e.replace(W,t=>t.startsWith("[")?n(t):t)}var re="data-hf-svg-reference-aliases";function O(e,n,t,i){let o={"=":(s,r)=>s===r,"~=":(s,r)=>s.split(/[ \\t\\r\\n\\f]+/).includes(r),"|=":(s,r)=>s===r||s.startsWith(r+"-"),"^=":(s,r)=>s.startsWith(r),"$=":(s,r)=>s.endsWith(r),"*=":(s,r)=>s.includes(r)},a=(s,r,l)=>!r&&l!=="="&&l!=="|="?!1:o[l](s,r),u=s=>s.replace(/[A-Z]/g,r=>r.toLowerCase()),d=s=>{let r=F(s);if(!r)return s;let{name:l,rawName:g,namespace:m,operator:b,value:D,flag:w}=r;if(m.kind==="named"!=(i!==void 0))return s;let x=w?.toLowerCase()==="i"?u:S=>S,L=u(l),P=t.filter(S=>{let V=m.kind==="none"?S.name:S.localName,U=m.kind==="named"?i.get(m.prefix):null;return(m.kind==="any"||S.namespaceURI===U)&&u(V)===L}),v=new Set([s]);for(let S of P)a(x(S.before),x(D),b)&&v.add(`[${g}="${N(S.after)}"${w?` ${w}`:""}]`);return v.size===1?s:`:is(${[...v].join(", ")})`};if(i)return E(e,d);let p=new Map(n.map(({id:s,replacement:r})=>[s,r])),f=new Map;for(let s of t){if(s.name!=="id"||s.before===s.after||p.has(s.before))continue;let r=f.get(s.before);r||(r=new Set([`#${k(s.before)}`]),f.set(s.before,r)),r.add(`#${k(s.after)}`)}for(let[s,r]of f)p.set(s,`:is(${[...r].join(", ")})`);let c=q(e,[...p.keys()],s=>p.get(s));return E(c,d)}function se(e,n,t=!0){let i=[],a=(t?[...e.querySelectorAll(`[${n}]`)]:[]).map(d=>d.getAttribute(n)),u=e.getAttribute?.(n);u&&a.unshift(u);for(let d of a){let p;try{p=JSON.parse(d)}catch{continue}if(!Array.isArray(p))continue;let f=p;for(let c of f){if(!ie(c))continue;let{name:s,localName:r,namespaceURI:l,before:g,after:m}=c;i.push({name:s,localName:r,namespaceURI:l,before:g,after:m})}}return i}function ie(e){if(!e||typeof e!="object")return!1;let{name:n,localName:t,namespaceURI:i,before:o,after:a}=e;return typeof n=="string"&&typeof t=="string"&&(i===null||typeof i=="string")&&typeof o=="string"&&typeof a=="string"}function oe(e){let n=[],t=[],i=!1,o,a=new WeakMap,u=(f,c)=>{for(let s of f){if("selectorText"in s){let r=s,l=a.get(r),g=r.selectorText,m=l?.applied===g?l.authored:g,b=O(m,[],t,c);b!==g&&(r.selectorText=b),b===m?a.delete(r):a.set(r,{authored:m,applied:r.selectorText})}"cssRules"in s&&u(s.cssRules,c)}},d=()=>{if(t.length)for(let f of e.document.styleSheets){let c;try{c=f.cssRules}catch{continue}let s=new Map;for(let r of c){if(!("namespaceURI"in r))continue;let{prefix:l,namespaceURI:g}=r;l&&s.set(l,g||null)}s.size&&u(c,s)}},p={rewrite:(f,c=[])=>{if(typeof f!="string"||!f.includes("#")&&!f.includes("["))return f;let s=O(f,c.length?[...c,...n]:n,t);if(s!==f){if(!o){let r=e.document.createElement("div");o=r.matches.bind(r)}o(f)}return s},refresh(){t=se(e.document,re).filter(r=>r.before!==r.after);let f=new Set(t.filter(r=>r.name==="id").map(r=>r.before)),c=new Set;n=[];for(let r of e.document.querySelectorAll("[data-hf-authored-id][id]")){let l=r.getAttribute("data-hf-authored-id");if(!l||l===r.id||c.has(l)||f.has(l))continue;c.add(l);let g=N(l);n.push({id:l,replacement:`:is(#${k(l)}, [data-hf-authored-id="${g}"])`})}if(d(),i||!n.length&&!t.length)return;let s=e.Element.prototype;s.querySelector=new Proxy(s.querySelector,{apply(r,l,g){return Reflect.apply(r,l,[p.rewrite(g[0])])}}),s.querySelectorAll=new Proxy(s.querySelectorAll,{apply(r,l,g){return Reflect.apply(r,l,[p.rewrite(g[0])])}}),i=!0}};e.__hfSvgSelectorAliases=p,p.refresh()}function M(){let e=window;e.__hfSvgSelectorAliases||oe(e)}M();})();\n';
361
- function getSvgSelectorAliasesScript() {
362
- return SVG_SELECTOR_ALIASES_IIFE;
363
- }
364
-
365
- // ../core/dist/compiler/compositionScoping.js
366
- import postcss from "postcss";
367
-
368
- // ../core/dist/compiler/selectorIdTokens.js
369
- function isNameChar(char) {
370
- if (!char)
371
- return false;
372
- return /[\w-]/.test(char) || char.charCodeAt(0) >= 128;
373
- }
374
- function isCssWhitespace(char) {
375
- return char === " " || char === " " || char === "\n" || char === "\r" || char === "\f";
376
- }
377
- var HEX_ESCAPE_RE = /^[0-9a-fA-F]{1,6}/;
378
- function sanitizeCodePoint(codePoint) {
379
- const isSurrogate = codePoint >= 55296 && codePoint <= 57343;
380
- return codePoint === 0 || codePoint > 1114111 || isSurrogate ? 65533 : codePoint;
381
- }
382
- function skipEscapeWhitespace(text, index) {
383
- if (text[index] === "\r" && text[index + 1] === "\n")
384
- return index + 2;
385
- return isCssWhitespace(text[index]) ? index + 1 : index;
386
- }
387
- function consumeCssEscape(text, index) {
388
- const next = text[index + 1];
389
- if (next === void 0 || /[\n\r\f]/.test(next))
390
- return null;
391
- const hex = HEX_ESCAPE_RE.exec(text.slice(index + 1, index + 7));
392
- if (!hex)
393
- return { value: next, end: index + 2 };
394
- const codePoint = sanitizeCodePoint(Number.parseInt(hex[0], 16));
395
- return {
396
- value: String.fromCodePoint(codePoint),
397
- end: skipEscapeWhitespace(text, index + 1 + hex[0].length)
398
- };
399
- }
400
- function startsCssIdentifier(text, start) {
401
- const isStart = (char) => isNameChar(char) && !/[0-9-]/.test(char);
402
- const escape = (index) => text[index] === "\\" && consumeCssEscape(text, index) !== null;
403
- if (text[start] === "-")
404
- return text[start + 1] === "-" || isStart(text[start + 1]) || escape(start + 1);
405
- return isStart(text[start]) || escape(start);
406
- }
407
- function skipCssComments(text, start) {
408
- let index = start;
409
- while (text.startsWith("/*", index)) {
410
- const end = text.indexOf("*/", index + 2);
411
- index = end < 0 ? text.length : end + 2;
412
- }
413
- return index;
414
- }
415
- function skipCssTrivia(text, start) {
416
- let index = skipCssComments(text, start);
417
- while (isCssWhitespace(text[index]))
418
- index = skipCssComments(text, index + 1);
419
- return index;
420
- }
421
- function decodeCssIdentifierAt(text, start) {
422
- if (!startsCssIdentifier(text, start))
423
- return null;
424
- let index = start;
425
- let value = "";
426
- while (index < text.length) {
427
- const char = text[index];
428
- if (char === "\\") {
429
- const escape = consumeCssEscape(text, index);
430
- if (!escape)
431
- break;
432
- value += escape.value;
433
- index = escape.end;
434
- continue;
435
- }
436
- if (!isNameChar(char))
437
- break;
438
- value += char;
439
- index += 1;
440
- }
441
- return index === start ? null : { value, end: index };
442
- }
443
- var CODE_UNIT_HYPHEN = 45;
444
- function isDigitCodeUnit(codeUnit) {
445
- return codeUnit >= 48 && codeUnit <= 57;
446
- }
447
- function isPlainNameCodeUnit(codeUnit) {
448
- return codeUnit >= 128 || codeUnit === CODE_UNIT_HYPHEN || codeUnit === 95 || isDigitCodeUnit(codeUnit) || codeUnit >= 65 && codeUnit <= 90 || codeUnit >= 97 && codeUnit <= 122;
449
- }
450
- function needsHexEscape(value, index) {
451
- const codeUnit = value.charCodeAt(index);
452
- if (codeUnit >= 1 && codeUnit <= 31 || codeUnit === 127)
453
- return true;
454
- if (!isDigitCodeUnit(codeUnit))
455
- return false;
456
- return index === 0 || index === 1 && value.charCodeAt(0) === CODE_UNIT_HYPHEN;
457
- }
458
- function escapeCssIdentifier(value) {
459
- let result = "";
460
- for (let index = 0; index < value.length; index += 1) {
461
- const codeUnit = value.charCodeAt(index);
462
- const char = value[index];
463
- if (codeUnit === 0)
464
- result += "\uFFFD";
465
- else if (needsHexEscape(value, index))
466
- result += `\\${codeUnit.toString(16)} `;
467
- else if (index === 0 && value.length === 1 && codeUnit === CODE_UNIT_HYPHEN)
468
- result += `\\${char}`;
469
- else if (isPlainNameCodeUnit(codeUnit))
470
- result += char;
471
- else
472
- result += `\\${char}`;
473
- }
474
- return result;
475
- }
476
- var GUARDED_SELECTOR_SEGMENT_RE = /\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:[0-9a-fA-F]{1,6}(?:\r\n|[ \t\r\n\f])?|[\s\S])|"(?:[^"\\]|\\[\s\S])*"|'(?:[^'\\]|\\[\s\S])*'|\[(?:\/\*(?:[^*]|\*(?!\/))*\*\/|\\[\s\S]|"(?:[^"\\]|\\[\s\S])*"|'(?:[^'\\]|\\[\s\S])*'|[^\]"'\\/]|\/(?!\*))*\]/g;
477
- function markUnguardedOffsets(selector) {
478
- const mask = new Array(selector.length).fill(true);
479
- for (const match of selector.matchAll(GUARDED_SELECTOR_SEGMENT_RE)) {
480
- const start = match.index;
481
- mask.fill(false, start, start + match[0].length);
482
- }
483
- return mask;
484
- }
485
- function replaceSelectorIdTokens(selector, candidateIds, resolveReplacement) {
486
- if (candidateIds.length === 0 || !selector.includes("#"))
487
- return selector;
488
- const candidates = new Set(candidateIds);
489
- const unguarded = markUnguardedOffsets(selector);
490
- let result = "";
491
- let index = 0;
492
- while (index < selector.length) {
493
- const token = unguarded[index] && selector[index] === "#" ? decodeCssIdentifierAt(selector, index + 1) : null;
494
- if (token && candidates.has(token.value)) {
495
- result += resolveReplacement(token.value);
496
- index = token.end;
497
- } else {
498
- result += selector[index];
499
- index += 1;
500
- }
501
- }
502
- return result;
503
- }
504
- function decodeCssString(value) {
505
- let result = "";
506
- for (let index = 0; index < value.length; index += 1) {
507
- if (value[index] === "\\") {
508
- const next = value[index + 1];
509
- if (next !== void 0 && /[\n\r\f]/.test(next)) {
510
- index = skipEscapeWhitespace(value, index + 1) - 1;
511
- continue;
512
- }
513
- const escaped = consumeCssEscape(value, index);
514
- if (escaped) {
515
- result += escaped.value;
516
- index = escaped.end - 1;
517
- continue;
518
- }
519
- }
520
- result += value[index];
521
- }
522
- return result;
523
- }
524
- function escapeCssAttributeValue(value) {
525
- return Array.from(value, (char) => {
526
- const code = char.charCodeAt(0);
527
- if (code === 0)
528
- return "\uFFFD";
529
- if (code < 32 || code === 127)
530
- return `\\${code.toString(16)} `;
531
- return char === '"' || char === "\\" ? `\\${char}` : char;
532
- }).join("");
533
- }
534
- function attributeNamespace(wildcard, prefix) {
535
- if (wildcard)
536
- return { kind: "any" };
537
- return prefix === void 0 ? { kind: "none" } : { kind: "named", prefix };
538
- }
539
- function isNamespaceSeparator(text, offset) {
540
- return text[offset] === "|" && text[offset + 1] !== "=";
541
- }
542
- function readQualifiedAttributeName(text, start) {
543
- const wildcard = text[start] === "*";
544
- const first = wildcard ? { value: "*", end: start + 1 } : decodeCssIdentifierAt(text, start);
545
- const separator = skipCssComments(text, first?.end ?? start);
546
- if (!isNamespaceSeparator(text, separator)) {
547
- if (wildcard)
548
- return null;
549
- return first ? { token: first, namespace: { kind: "none" } } : null;
550
- }
551
- const token = decodeCssIdentifierAt(text, skipCssComments(text, separator + 1));
552
- if (!token)
553
- return null;
554
- return { token, namespace: attributeNamespace(wildcard, first?.value) };
555
- }
556
- function readAttributeName(predicate) {
557
- if (predicate[0] !== "[")
558
- return null;
559
- const start = skipCssTrivia(predicate, 1);
560
- const qualified = readQualifiedAttributeName(predicate, start);
561
- if (!qualified)
562
- return null;
563
- const { token, namespace } = qualified;
564
- return {
565
- name: token.value,
566
- rawName: predicate.slice(start, token.end),
567
- namespace,
568
- end: token.end
569
- };
570
- }
571
- function readAttributeValue(predicate, start) {
572
- const quoted = /^(?:"((?:\\[\s\S]|[^"\\])*)"|'((?:\\[\s\S]|[^'\\])*)')/.exec(predicate.slice(start));
573
- if (quoted)
574
- return { value: decodeCssString(quoted[1] ?? quoted[2]), end: start + quoted[0].length };
575
- return decodeCssIdentifierAt(predicate, start);
576
- }
577
- function readAttributeEnding(predicate, start) {
578
- let offset = skipCssTrivia(predicate, start);
579
- const token = decodeCssIdentifierAt(predicate, offset);
580
- if (token) {
581
- if (!/^[is]$/i.test(token.value))
582
- return null;
583
- offset = skipCssTrivia(predicate, token.end);
584
- }
585
- if (predicate[offset] !== "]" || offset !== predicate.length - 1)
586
- return null;
587
- return { flag: token?.value };
588
- }
589
- function parseAttributeSelector(predicate) {
590
- const name = readAttributeName(predicate);
591
- if (!name)
592
- return null;
593
- const offset = skipCssTrivia(predicate, name.end);
594
- const operators = ["=", "~=", "|=", "^=", "$=", "*="];
595
- const operator = operators.find((candidate) => predicate.startsWith(candidate, offset));
596
- if (!operator)
597
- return null;
598
- const value = readAttributeValue(predicate, skipCssTrivia(predicate, offset + operator.length));
599
- if (!value)
600
- return null;
601
- const ending = readAttributeEnding(predicate, value.end);
602
- if (!ending)
603
- return null;
604
- return {
605
- name: name.name,
606
- rawName: name.rawName,
607
- namespace: name.namespace,
608
- operator,
609
- value: value.value,
610
- flag: ending.flag
611
- };
612
- }
613
- function replaceSelectorAttributeTokens(selector, rewrite) {
614
- return selector.replace(GUARDED_SELECTOR_SEGMENT_RE, (segment) => segment.startsWith("[") ? rewrite(segment) : segment);
615
- }
616
-
617
- // ../core/dist/compiler/compositionScoping.js
618
- var AUTHORED_ROOT_ID_ATTR = "data-hf-authored-id";
619
- var INNER_ROOT_ATTR = "data-hf-inner-root";
620
- function escapeRegExp(value) {
621
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
622
- }
623
- function escapeCssAttributeValue2(value) {
624
- return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
625
- }
626
- function getAuthoredRootIdSelectorForms(authoredRootId) {
627
- const trimmed = authoredRootId.trim();
628
- if (!trimmed)
629
- return [];
630
- return Array.from(/* @__PURE__ */ new Set([trimmed, escapeCssIdentifier(trimmed)])).filter(Boolean);
631
- }
632
- function replaceAuthoredRootIdSelectors(selector, authoredRootId, replacement) {
633
- const forms = getAuthoredRootIdSelectorForms(authoredRootId);
634
- return replaceSelectorIdTokens(selector, forms, () => replacement);
635
- }
636
- function normalizeAuthoredRootIdSelector(selector, authoredRootId) {
637
- const trimmed = authoredRootId?.trim();
638
- if (!trimmed)
639
- return selector;
640
- return replaceAuthoredRootIdSelectors(selector, trimmed, `[${AUTHORED_ROOT_ID_ATTR}="${escapeCssAttributeValue2(trimmed)}"]`);
641
- }
642
- function compositionBoxSelector(scope) {
643
- return `${scope}:not(:has([${INNER_ROOT_ATTR}])), ${scope} > [${INNER_ROOT_ATTR}]`;
644
- }
645
- function scopeSelector(selector, scope, compositionId, authoredRootId, compoundAuthoredRoot, scopeRootSelectors) {
646
- const selectorWithoutAuthoredRootId = normalizeAuthoredRootIdSelector(selector, authoredRootId);
647
- const selectorWithoutRootTiming = normalizeCompositionRootSelector(selectorWithoutAuthoredRootId, scope, compositionId);
648
- const trimmed = selectorWithoutRootTiming.trim();
649
- if (!trimmed)
650
- return selector;
651
- if (trimmed === "*")
652
- return selector;
653
- if (/^(html|body|:root)$/i.test(trimmed)) {
654
- return scopeRootSelectors ? compositionBoxSelector(scope) : selector;
655
- }
656
- const compositionIdPattern = new RegExp(`\\[\\s*data-composition-id\\s*[\\^\\*\\$]?=\\s*(["'])${escapeRegExp(compositionId)}\\1\\s*\\]`, "g");
657
- if (compositionIdPattern.test(trimmed)) {
658
- const isRootBoxSelector = trimmed.replace(compositionIdPattern, "").trim() === "";
659
- if (isRootBoxSelector) {
660
- return compositionBoxSelector(scope);
661
- }
662
- return selectorWithoutRootTiming.replace(compositionIdPattern, scope);
663
- }
664
- const leading = selectorWithoutRootTiming.match(/^\s*/)?.[0] ?? "";
665
- const trailing = selectorWithoutRootTiming.match(/\s*$/)?.[0] ?? "";
666
- if (compoundAuthoredRoot) {
667
- const authoredRootAttr = authoredRootId ? `[${AUTHORED_ROOT_ID_ATTR}="${escapeCssAttributeValue2(authoredRootId)}"]` : null;
668
- if (authoredRootAttr && trimmed.startsWith(authoredRootAttr)) {
669
- const rest = trimmed.slice(authoredRootAttr.length);
670
- return `${leading}${scope}${authoredRootAttr}${rest}${trailing}`;
671
- }
672
- }
673
- return `${leading}${scope} ${trimmed}${trailing}`;
674
- }
675
- function normalizeCompositionRootSelector(selector, scope, compositionId) {
676
- const quotedCompId = escapeRegExp(compositionId);
677
- const compAttr = String.raw`\[\s*data-composition-id\s*=\s*(?:"${quotedCompId}"|'${quotedCompId}')\s*\]`;
678
- const timingAttr = String.raw`\s*\[\s*data-(?:start|duration)\s*=\s*(?:"[^"]*"|'[^']*')\s*\]`;
679
- return selector.replace(new RegExp(`${compAttr}(?:${timingAttr})+`, "g"), scope).replace(new RegExp(`(?:${timingAttr})+${compAttr}`, "g"), scope);
680
- }
681
- var GLOBAL_AT_RULES = /* @__PURE__ */ new Set(["keyframes", "-webkit-keyframes", "font-face"]);
682
- function isAtRuleNode(node) {
683
- return node?.type === "atrule";
684
- }
685
- function isInsideGlobalAtRule(rule) {
686
- let current = rule.parent;
687
- while (current) {
688
- if (isAtRuleNode(current) && GLOBAL_AT_RULES.has(current.name.toLowerCase())) {
689
- return true;
690
- }
691
- current = current.parent;
692
- }
693
- return false;
694
- }
695
- function isNestedInsideAnotherRule(rule) {
696
- let current = rule.parent;
697
- while (current) {
698
- if (current.type === "rule")
699
- return true;
700
- current = current.parent;
701
- }
702
- return false;
703
- }
704
- function scopeCssToComposition(css, compositionId, scopeSelectorOverride, authoredRootId, options) {
705
- const trimmedCompositionId = compositionId.trim();
706
- if (!css || !trimmedCompositionId)
707
- return css;
708
- const scope = scopeSelectorOverride || `[data-composition-id="${escapeCssAttributeValue2(trimmedCompositionId)}"]`;
709
- const root = parseCss(css);
710
- return root ? scopeParsedCss(root, scope, trimmedCompositionId, authoredRootId, options) : "";
711
- }
712
- function parseCss(css) {
713
- try {
714
- return postcss.parse(css);
715
- } catch {
716
- return null;
717
- }
718
- }
719
- function forEachScopedRule(root, visit) {
720
- root.walkRules((rule) => {
721
- if (isInsideGlobalAtRule(rule))
722
- return;
723
- if (isNestedInsideAnotherRule(rule))
724
- return;
725
- visit(rule);
726
- });
727
- }
728
- function scopeParsedCss(root, scope, compositionId, authoredRootId, options) {
729
- forEachScopedRule(root, (rule) => {
730
- rule.selectors = rule.selectors.map((selector) => scopeSelector(selector, scope, compositionId, authoredRootId, options?.compoundAuthoredRoot, options?.scopeRootSelectors));
731
- });
732
- return root.toResult({ map: false }).css;
733
- }
734
- var PLACEHOLDER_ID = "hf-scope-placeholder";
735
- var PLACEHOLDER_SCOPE = `[data-composition-id="${PLACEHOLDER_ID}"]`;
736
- var PLAIN_ID = /^[\w.:-]+$/;
737
- var PLAIN_SCOPE = /^\[data-composition-id="([\w.:-]+)"\]$/;
738
- function createCompositionCssScoper() {
739
- const templates = /* @__PURE__ */ new Map();
740
- return (css, compositionId, scopeSelectorOverride, authoredRootId, options) => {
741
- const trimmedId = compositionId.trim();
742
- const scope = scopeSelectorOverride ?? "";
743
- const scopeId = PLAIN_SCOPE.exec(scope)?.[1];
744
- if (!scopeId || scopeId === trimmedId || !PLAIN_ID.test(trimmedId) || trimmedId === PLACEHOLDER_ID)
745
- return scopeCssToComposition(css, compositionId, scopeSelectorOverride, authoredRootId, options);
746
- const key = JSON.stringify([
747
- trimmedId,
748
- authoredRootId ?? null,
749
- Boolean(options?.compoundAuthoredRoot),
750
- Boolean(options?.scopeRootSelectors),
751
- css
752
- ]);
753
- let template = templates.get(key);
754
- if (template === void 0) {
755
- template = scopeTemplate(css, trimmedId, authoredRootId, options);
756
- templates.set(key, template);
757
- }
758
- return template === null ? scopeCssToComposition(css, compositionId, scopeSelectorOverride, authoredRootId, options) : template.split(PLACEHOLDER_SCOPE).join(scope);
759
- };
760
- }
761
- function scopeTemplate(css, compositionId, authoredRootId, options) {
762
- if (css.includes(PLACEHOLDER_SCOPE))
763
- return null;
764
- if (!css)
765
- return css;
766
- const root = parseCss(css);
767
- if (!root)
768
- return "";
769
- let rawSelector = false;
770
- forEachScopedRule(root, (rule) => {
771
- rawSelector ||= Boolean(rule.raws.selector);
772
- });
773
- return rawSelector ? null : scopeParsedCss(root, PLACEHOLDER_SCOPE, compositionId, authoredRootId, options);
774
- }
775
- function isFontFaceAtRule(node) {
776
- return node.type === "atrule" && node.name.toLowerCase() === "font-face";
777
- }
778
- function fontFaceKey(atRule) {
779
- const decls = [];
780
- atRule.walkDecls((decl) => {
781
- const value = decl.value.replace(/("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')|\s+/g, (_m, str) => str ?? " ");
782
- decls.push(`${decl.prop.trim().toLowerCase()}:${value.trim()}${decl.important ? "!important" : ""}`);
783
- });
784
- return decls.join(";");
785
- }
786
- var dedupeFontFaceRules = (styleTexts) => dropFontFaces(styleTexts);
787
- function hoistFontFaceRules(styleTexts) {
788
- const faces = [];
789
- return { styles: dropFontFaces(styleTexts, faces), faces };
790
- }
791
- function dropFontFaces(styleTexts, hoisted) {
792
- const seen = /* @__PURE__ */ new Set();
793
- return [...styleTexts].reverse().map((css) => {
794
- if (!css || !/@font-face/i.test(css))
795
- return css;
796
- let root;
797
- try {
798
- root = postcss.parse(css);
799
- } catch {
800
- return css;
801
- }
802
- let changed = false;
803
- for (const node of [...root.nodes ?? []].reverse()) {
804
- if (!isFontFaceAtRule(node))
805
- continue;
806
- const key = fontFaceKey(node);
807
- if (!seen.has(key)) {
808
- seen.add(key);
809
- if (!hoisted)
810
- continue;
811
- hoisted.unshift(node.toString());
812
- }
813
- node.remove();
814
- changed = true;
815
- }
816
- return changed ? root.toResult({ map: false }).css : css;
817
- }).reverse();
818
- }
819
- function jsonScriptLiteral(value) {
820
- return JSON.stringify(value).replace(/</g, "\\u003c");
821
- }
822
- var SCOPED_HYPERFRAMES_EXPRESSION = `!__hfBaseHyperframes
823
- ? __hfBaseHyperframes
824
- : Object.assign({}, __hfBaseHyperframes, {
825
- assetUrl: function(path) {
826
- var page = window.document.baseURI;
827
- return new URL(path, __hfCompositionSrc ? new URL(__hfCompositionSrc, page) : page).href;
828
- },
829
- getVariables: function() {
830
- var byComp = window.__hfVariablesByComp;
831
- var scoped = byComp && __hfTimelineCompId ? byComp[__hfTimelineCompId] : null;
832
- return scoped ? Object.assign({}, scoped) : {};
833
- },
834
- })`;
835
- function scopedModulePrelude(timelineCompositionId, compositionSrc) {
836
- return `const __hyperframes = (function(__hfBaseHyperframes, __hfTimelineCompId, __hfCompositionSrc) {
837
- return ${SCOPED_HYPERFRAMES_EXPRESSION};
838
- })(window.__hyperframes, ${jsonScriptLiteral(timelineCompositionId)}, ${jsonScriptLiteral(compositionSrc?.trim() || null)});
839
- ${wrapScopedCompositionScript("", timelineCompositionId)}
840
- `;
841
- }
842
- function wrapScopedCompositionScript(source, compositionId, errorLabel = "[HyperFrames] composition script error:", scopeSelectorOverride, timelineCompositionId = compositionId, authoredRootId, compositionSrc) {
843
- const compositionIdLiteral = jsonScriptLiteral(compositionId);
844
- const timelineCompositionIdLiteral = jsonScriptLiteral(timelineCompositionId);
845
- const errorLabelLiteral = jsonScriptLiteral(errorLabel);
846
- const escapedCompositionId = escapeRegExp(compositionId);
847
- const authoredRootIdLiteral = jsonScriptLiteral(authoredRootId?.trim() || null);
848
- const scopeSelectorLiteral = jsonScriptLiteral(scopeSelectorOverride ?? null);
849
- const rootSelectorPatternLiteral = jsonScriptLiteral(String.raw`\[\s*data-composition-id\s*=\s*(?:"${escapedCompositionId}"|'${escapedCompositionId}')\s*\]`);
850
- const timingSelectorPatternLiteral = jsonScriptLiteral(String.raw`\s*\[\s*data-(?:start|duration)\s*=\s*(?:"[^"]*"|'[^']*')\s*\]`);
851
- const aliasInstallerOutsideAuthoredStrictness = `(function(){ ${getSvgSelectorAliasesScript()} })();`;
852
- return `(function(){
853
- ${aliasInstallerOutsideAuthoredStrictness}
854
- var __hfCompId = ${compositionIdLiteral};
855
- var __hfTimelineCompId = ${timelineCompositionIdLiteral};
856
- var __hfErrorLabel = ${errorLabelLiteral};
857
- var __hfAuthoredRootId = ${authoredRootIdLiteral};
858
- var __hfCompositionSrc = ${jsonScriptLiteral(compositionSrc?.trim() || null)};
859
- var __hfAuthoredRootAttr = ${jsonScriptLiteral(AUTHORED_ROOT_ID_ATTR)};
860
- var __hfEscapeAttr = function(value) {
861
- return (value + "").replace(/\\\\/g, "\\\\\\\\").replace(/"/g, "\\\\\\"");
862
- };
863
- var __hfRootSelector = ${scopeSelectorLiteral} || (__hfCompId
864
- ? '[data-composition-id="' + __hfEscapeAttr(__hfCompId) + '"]'
865
- : "");
866
- var __hfRoot = null;
867
- var __hfRootSelectorPattern = ${rootSelectorPatternLiteral};
868
- var __hfTimingSelectorPattern = ${timingSelectorPatternLiteral};
869
- var __hfAuthoredRootSelector = __hfAuthoredRootId
870
- ? "[" + __hfAuthoredRootAttr + '="' + __hfEscapeAttr(__hfAuthoredRootId) + '"]'
871
- : "";
872
- var __hfAuthoredRootEntries = __hfAuthoredRootSelector
873
- ? [{ id: __hfAuthoredRootId, replacement: __hfAuthoredRootSelector }]
874
- : [];
875
- var __hfNormalizeSelector = function(selector) {
876
- if (!__hfCompId || typeof selector !== "string") return selector;
877
- var normalized = selector
878
- .replace(new RegExp(__hfRootSelectorPattern + '(?:' + __hfTimingSelectorPattern + ')+', 'g'), __hfRootSelector)
879
- .replace(new RegExp('(?:' + __hfTimingSelectorPattern + ')+' + __hfRootSelectorPattern, 'g'), __hfRootSelector);
880
- return window.__hfSvgSelectorAliases.rewrite(normalized, __hfAuthoredRootEntries);
881
- };
882
- var __hfFindRoot = function() {
883
- if (!__hfRoot && __hfRootSelector) {
884
- __hfRoot = window.document.querySelector(__hfRootSelector);
885
- }
886
- return __hfRoot;
887
- };
888
- var __hfContains = function(node) {
889
- var root = __hfFindRoot();
890
- return !root || node === root || root.contains(node);
891
- };
892
- var __hfQueryAll = function(selector) {
893
- var root = __hfFindRoot();
894
- if (!root || typeof selector !== "string") {
895
- return window.document.querySelectorAll(selector);
896
- }
897
- return Array.prototype.filter.call(window.document.querySelectorAll(__hfNormalizeSelector(selector)), function(node) {
898
- return __hfContains(node);
899
- });
900
- };
901
- var __hfQueryOne = function(selector) {
902
- var matches = __hfQueryAll(selector);
903
- return matches[0] || null;
904
- };
905
- var __hfGetElementById = function(id) {
906
- var found = window.document.getElementById(id);
907
- if (found && __hfContains(found)) return found;
908
- var root = __hfFindRoot();
909
- if (!root) return found || null;
910
- var idValue = id + "";
911
- if (__hfAuthoredRootId && __hfAuthoredRootId === idValue && root.getAttribute && root.getAttribute(__hfAuthoredRootAttr) === idValue) {
912
- return root;
913
- }
914
- if (root.id === idValue) return root;
915
- if (typeof root.querySelector !== "function") return null;
916
- try {
917
- var authoredRootMatch = root.querySelector('[' + __hfAuthoredRootAttr + '="' + __hfEscapeAttr(idValue) + '"]');
918
- if (authoredRootMatch) return authoredRootMatch;
919
- } catch {}
920
- if (typeof CSS !== "undefined" && CSS && typeof CSS.escape === "function") {
921
- try {
922
- return root.querySelector("#" + CSS.escape(idValue)) || null;
923
- } catch {}
924
- }
925
- try {
926
- return root.querySelector('[id="' + __hfEscapeAttr(idValue) + '"]') || null;
927
- } catch {}
928
- return null;
929
- };
930
- var __hfScopedDocument = typeof Proxy === "function"
931
- ? new Proxy(window.document, {
932
- get: function(target, prop, receiver) {
933
- if (prop === "querySelector") return __hfQueryOne;
934
- if (prop === "querySelectorAll") return __hfQueryAll;
935
- if (prop === "getElementById") return __hfGetElementById;
936
- var value = Reflect.get(target, prop, target);
937
- return typeof value === "function" ? value.bind(target) : value;
938
- },
939
- })
940
- : window.document;
941
- var __hfTimelineRegistryProxy = null;
942
- var __hfGetTimelineRegistry = function() {
943
- window.__timelines = window.__timelines || {};
944
- if (!__hfCompId || __hfCompId === __hfTimelineCompId || typeof Proxy !== "function") {
945
- return window.__timelines;
946
- }
947
- if (!__hfTimelineRegistryProxy) {
948
- __hfTimelineRegistryProxy = new Proxy(window.__timelines, {
949
- get: function(target, prop, receiver) {
950
- if (prop !== __hfCompId) {
951
- return Reflect.get(target, prop, target);
952
- }
953
- var runtimeValue = Reflect.get(target, __hfTimelineCompId, target);
954
- return runtimeValue === undefined ? Reflect.get(target, prop, target) : runtimeValue;
955
- },
956
- set: function(target, prop, value, receiver) {
957
- if (prop !== __hfCompId) {
958
- return Reflect.set(target, prop, value, target);
959
- }
960
- // The authored node remains in the compiled DOM when its local id
961
- // differs from the runtime mount id, so readiness legitimately sees
962
- // both compositions. Publish the same timeline under both identities,
963
- // unless another mount of the same file already owns the authored one.
964
- var authoredValue = Reflect.get(target, __hfCompId, target);
965
- var ownsAuthored =
966
- authoredValue === undefined ||
967
- authoredValue === Reflect.get(target, __hfTimelineCompId, target);
968
- var runtimeSet = Reflect.set(target, __hfTimelineCompId, value, target);
969
- if (!ownsAuthored) return runtimeSet;
970
- return Reflect.set(target, __hfCompId, value, target) && runtimeSet;
971
- },
972
- });
973
- }
974
- return __hfTimelineRegistryProxy;
975
- };
976
- var __hfScopedWindow = typeof Proxy === "function"
977
- ? new Proxy(window, {
978
- get: function(target, prop, receiver) {
979
- if (prop === "__timelines") return __hfGetTimelineRegistry();
980
- // Inside a sub-composition, __hyperframes is passed as a bare script
981
- // param bound to the SCOPED variant (per-comp getVariables). But
982
- // authors routinely write the documented window.__hyperframes.
983
- // getVariables() form, which would otherwise fall through to the host
984
- // page's base __hyperframes and return the WRONG (or empty) variables
985
- // for this instance. Route it to the scoped variant too so both
986
- // spellings resolve to this composition's own variables.
987
- // (__hfScopedHyperframes is a hoisted var assigned below, before any
988
- // sub-comp script -- the only code that reads this -- runs.)
989
- if (prop === "__hyperframes") return __hfScopedHyperframes;
990
- // Native window methods must stay bound to the real window. Handed
991
- // back unbound, "this" at call time is this Proxy and Chrome rejects
992
- // it with "Illegal invocation", which broke window.addEventListener,
993
- // setTimeout, matchMedia and getComputedStyle inside every
994
- // sub-composition -- including the window.addEventListener("hf-seek",
995
- // ...) form the Three.js and TypeGPU adapters document. The sibling
996
- // document and gsap proxies here already bind.
997
- //
998
- // Only bind non-constructors. Function.prototype.bind drops static
999
- // members, so binding a class exposed on window (window.Texts and
1000
- // friends) would silently strip its statics. Built-in methods have
1001
- // no .prototype; classes and constructor functions do.
1002
- var value = Reflect.get(target, prop, target);
1003
- return typeof value === "function" && value.prototype === undefined
1004
- ? value.bind(target)
1005
- : value;
1006
- },
1007
- set: function(target, prop, value, receiver) {
1008
- if (prop === "__timelines") {
1009
- // Common authoring boilerplate assigns the registry back to
1010
- // itself (window.__timelines = window.__timelines || {}). The
1011
- // getter above returns our proxy; do not replace the canonical
1012
- // registry with that proxy or later wrappers will stack proxies.
1013
- if (value === __hfTimelineRegistryProxy) return true;
1014
- target.__timelines = value || {};
1015
- __hfTimelineRegistryProxy = null;
1016
- return true;
1017
- }
1018
- return Reflect.set(target, prop, value, target);
1019
- },
1020
- })
1021
- : window;
1022
- var __hfResolveGsapTarget = function(target) {
1023
- if (typeof target !== "string" && !Array.isArray(target)) return target;
1024
- var resolved = typeof target === "string" ? __hfQueryAll(target) : target.reduce(function(resolved, item) {
1025
- if (typeof item === "string") {
1026
- return resolved.concat(Array.prototype.slice.call(__hfQueryAll(item)));
1027
- }
1028
- resolved.push(item);
1029
- return resolved;
1030
- }, []);
1031
- if (!resolved.length) {
1032
- // GSAP warns "GSAP target " + targets + " not found"; a bare empty match list prints an
1033
- // empty name. Keep the authored selector as the text while still targeting nothing here.
1034
- var originalTarget = String(target);
1035
- resolved = [];
1036
- resolved.toString = function() { return originalTarget; };
1037
- }
1038
- return resolved;
1039
- };
1040
- var __hfScopeTimeline = function(timeline) {
1041
- if (!timeline || timeline.__hfScopedCompositionRoot === __hfFindRoot()) return timeline;
1042
- ["to", "from", "fromTo", "set"].forEach(function(method) {
1043
- var original = timeline[method];
1044
- if (typeof original !== "function") return;
1045
- timeline[method] = function(target) {
1046
- var args = Array.prototype.slice.call(arguments);
1047
- args[0] = __hfResolveGsapTarget(target);
1048
- return original.apply(timeline, args);
1049
- };
1050
- });
1051
- try {
1052
- Object.defineProperty(timeline, "__hfScopedCompositionRoot", {
1053
- value: __hfFindRoot(),
1054
- configurable: true,
1055
- });
1056
- } catch {
1057
- // Best-effort: timelines coming from user code may have a frozen target
1058
- // or a non-extensible defineProperty path. Swallow \u2014 the scoped root
1059
- // is an enrichment, not a correctness invariant for playback.
1060
- }
1061
- return timeline;
1062
- };
1063
- var __hfBaseGsap = typeof gsap === "undefined" ? window.gsap : gsap;
1064
- var __hfScopedGsap = !__hfBaseGsap || typeof Proxy !== "function"
1065
- ? __hfBaseGsap
1066
- : new Proxy(__hfBaseGsap, {
1067
- get: function(target, prop, receiver) {
1068
- if (prop === "timeline") {
1069
- return function() {
1070
- return __hfScopeTimeline(target.timeline.apply(target, arguments));
1071
- };
1072
- }
1073
- if (prop === "to" || prop === "from" || prop === "fromTo" || prop === "set") {
1074
- return function(firstArg) {
1075
- var args = Array.prototype.slice.call(arguments);
1076
- args[0] = __hfResolveGsapTarget(firstArg);
1077
- return target[prop].apply(target, args);
1078
- };
1079
- }
1080
- if (prop === "utils" && target.utils && typeof Proxy === "function") {
1081
- return new Proxy(target.utils, {
1082
- get: function(utilsTarget, utilsProp, utilsReceiver) {
1083
- if (utilsProp === "toArray") {
1084
- return function(firstArg) {
1085
- var args = Array.prototype.slice.call(arguments);
1086
- args[0] = __hfResolveGsapTarget(firstArg);
1087
- return utilsTarget.toArray.apply(utilsTarget, args);
1088
- };
1089
- }
1090
- if (utilsProp === "selector") {
1091
- return function(base) {
1092
- var baseEl = typeof base === "string" ? __hfQueryOne(base) : base;
1093
- var root = baseEl || __hfFindRoot();
1094
- return function(selector) {
1095
- if (!root || typeof selector !== "string") return [];
1096
- return Array.prototype.filter.call(
1097
- window.document.querySelectorAll(__hfNormalizeSelector(selector)),
1098
- function(node) {
1099
- return node === root || (typeof root.contains === "function" && root.contains(node));
1100
- },
1101
- );
1102
- };
1103
- };
1104
- }
1105
- var value = Reflect.get(utilsTarget, utilsProp, utilsTarget);
1106
- return typeof value === "function" ? value.bind(utilsTarget) : value;
1107
- },
1108
- });
1109
- }
1110
- var value = Reflect.get(target, prop, target);
1111
- return typeof value === "function" ? value.bind(target) : value;
1112
- },
1113
- });
1114
- var __hfBaseHyperframes = window.__hyperframes;
1115
- var __hfScopedHyperframes = ${SCOPED_HYPERFRAMES_EXPRESSION};
1116
- var __hfRun = function() {
1117
- var report = window.__hfScriptState;
1118
- if (typeof report === "function") report("start", __hfCompositionSrc || "index.html");
1119
- try {
1120
- (function(document, gsap, window, __hyperframes) {
1121
- ${source.replace(/<\/(script)/gi, "<\\/$1")}
1122
- }).call(window, __hfScopedDocument, __hfScopedGsap, __hfScopedWindow, __hfScopedHyperframes);
1123
- } catch (_err) {
1124
- console.error(__hfErrorLabel, __hfCompId, _err);
1125
- } finally {
1126
- if (typeof report === "function") report("finish", __hfCompositionSrc || "index.html");
1127
- }
1128
- };
1129
- // What the script started on the global gsap timeline, by any route, for a scene swap to revert.
1130
- // Only a page with a scene manifest can swap; elsewhere the first script stores null and none records.
1131
- var __hfRecordAnimations = function(run) {
1132
- if (window.__hfSceneAnimations === undefined) {
1133
- window.__hfSceneAnimations = window.document.querySelector(${jsonScriptLiteral(`meta[name="${SCENE_PARTS_META}"]`)})
1134
- ? {}
1135
- : null;
1136
- }
1137
- var byComp = window.__hfSceneAnimations;
1138
- var globalTimeline = __hfBaseGsap && __hfBaseGsap.globalTimeline;
1139
- if (!byComp || !globalTimeline || !__hfTimelineCompId) return run();
1140
- var before = globalTimeline.getChildren(false);
1141
- // A set completes as it is made and would leave the timeline before the diff below.
1142
- var autoRemove = globalTimeline.autoRemoveChildren;
1143
- globalTimeline.autoRemoveChildren = false;
1144
- run();
1145
- globalTimeline.autoRemoveChildren = autoRemove;
1146
- var recorded = (byComp[__hfTimelineCompId] = byComp[__hfTimelineCompId] || []);
1147
- globalTimeline.getChildren(false).forEach(function(animation) {
1148
- if (before.indexOf(animation) >= 0) return;
1149
- recorded.push(animation);
1150
- // Dropped as the timeline drops a finished tween (it keeps a paused one); moved back, a tween re-adds itself.
1151
- if (autoRemove && !animation.getChildren && animation.totalProgress() === 1) globalTimeline.remove(animation);
1152
- });
1153
- };
1154
- __hfFindRoot();
1155
- __hfRecordAnimations(__hfRun);
1156
- })();`;
1157
- }
1158
- function wrapInlineScriptWithErrorBoundary(source, errorLabel) {
1159
- return `(function(){ try { Function(${jsonScriptLiteral(source)}).call(window); } catch (_err) { console.error(${jsonScriptLiteral(errorLabel)}, _err); } })();`;
1160
- }
1161
- function buildVariablesByCompScript(variablesByComp) {
1162
- if (!variablesByComp || Object.keys(variablesByComp).length === 0)
1163
- return null;
1164
- const json = jsonScriptLiteral(variablesByComp);
1165
- return `window.__hfVariablesByComp = Object.assign({}, window.__hfVariablesByComp || {}, ${json});`;
1166
- }
1167
-
1168
400
  // ../core/dist/compiler/staticGuard.js
1169
401
  async function validateHyperframeHtmlContract(html) {
1170
402
  const result = await lintHyperframeHtml(html);
@@ -1278,7 +510,7 @@ function isSvgReferenceAlias(entry) {
1278
510
  }
1279
511
 
1280
512
  // ../core/dist/compiler/svgIdNamespacing.js
1281
- import postcss2 from "postcss";
513
+ import postcss from "postcss";
1282
514
  var ID_ATTR = "id";
1283
515
  var SVG_AUTHORED_ID_ATTR = "data-hf-authored-id";
1284
516
  var URL_HASH_REF_RE = /(url\(\s*)(["']?)#([^"')\s]+)\2(\s*\))/gi;
@@ -1566,7 +798,7 @@ function rewriteSvgIdReferencesInCss(css, idMap, references = []) {
1566
798
  return css;
1567
799
  let root;
1568
800
  try {
1569
- root = postcss2.parse(css);
801
+ root = postcss.parse(css);
1570
802
  } catch {
1571
803
  return css;
1572
804
  }
@@ -1881,7 +1113,9 @@ function inlineSubCompositions(document, hosts, options) {
1881
1113
  console.warn(`[HyperFrames] ${src}: import map is not valid JSON, so it is skipped.`);
1882
1114
  } else if (type === "module" && !externalSrc) {
1883
1115
  const prelude = scriptCompositionId ? scopedModulePrelude(runtimeCompId || scopeCompId || scriptCompositionId, src) : "";
1884
- moduleScripts.push(prelude + (scriptEl.textContent || ""));
1116
+ moduleScripts.push(`${prelude}${AUTHORED_SOURCE_BEGIN}
1117
+ ${scriptEl.textContent || ""}
1118
+ ${AUTHORED_SOURCE_END}`);
1885
1119
  } else if (externalSrc) {
1886
1120
  if (!externalScriptSrcs.includes(externalSrc)) {
1887
1121
  externalScriptSrcs.push(externalSrc);
@@ -2486,7 +1720,8 @@ function createAssetInliner(resolveProjectPath, inlineAssets) {
2486
1720
  const byteLength = safeStatSize(filePath);
2487
1721
  if (byteLength !== null && byteLength > MAX_INLINE_ASSET_BYTES)
2488
1722
  return { tooLarge: byteLength };
2489
- const content = safeReadFileBuffer(filePath);
1723
+ const read = safeReadFileBuffer(filePath);
1724
+ const content = read && mimeType === "image/png" ? stripSdrPngColourTags(read) ?? read : read;
2490
1725
  return {
2491
1726
  dataUrl: content === null ? null : `data:${mimeType};base64,${content.toString("base64")}`
2492
1727
  };
@@ -3564,14 +2799,11 @@ function addScenePartsManifest(html, ignore = []) {
3564
2799
 
3565
2800
  export {
3566
2801
  compileHtml,
2802
+ stripSdrPngColourTags,
3567
2803
  ensureExternalScriptTag,
3568
2804
  emitMountedModuleScripts,
3569
2805
  FLATTENED_INNER_ROOT_STRIP_ATTRS,
3570
2806
  extractStandaloneEntryFromIndex,
3571
- scopeCssToComposition,
3572
- dedupeFontFaceRules,
3573
- wrapScopedCompositionScript,
3574
- buildVariablesByCompScript,
3575
2807
  validateHyperframeHtmlContract,
3576
2808
  ensureExternalLinkTag,
3577
2809
  inlineSubCompositions,