framefields 2.0.11 → 2.1.1

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 (564) hide show
  1. package/README.md +22 -5
  2. package/dist/audio/index.d.mts +4 -4
  3. package/dist/audio/index.mjs +13 -12
  4. package/dist/{audio-BHanw8Jb.d.mts → audio-CfBpzxn9.d.mts} +3 -3
  5. package/dist/{audio-BHanw8Jb.d.mts.map → audio-CfBpzxn9.d.mts.map} +1 -1
  6. package/dist/{audio-TAvPwzLR.mjs → audio-DJeVoE8b.mjs} +1 -1
  7. package/dist/{audio-TAvPwzLR.mjs.map → audio-DJeVoE8b.mjs.map} +1 -1
  8. package/dist/{audio-COOMNwL5.mjs → audio-GGuQ_JI0.mjs} +4 -4
  9. package/dist/{audio-COOMNwL5.mjs.map → audio-GGuQ_JI0.mjs.map} +1 -1
  10. package/dist/{chunk-GMkBE123.mjs → chunk-GBe2k3y8.mjs} +1 -4
  11. package/dist/{dist-C_hjvkdN.mjs → dist-0QGroRYZ.mjs} +1 -1
  12. package/dist/{dist-C_hjvkdN.mjs.map → dist-0QGroRYZ.mjs.map} +1 -1
  13. package/dist/{dist-BYqNNwsl.mjs → dist-BY0bIWgr.mjs} +10 -2
  14. package/dist/dist-BY0bIWgr.mjs.map +1 -0
  15. package/dist/{dist-BAVZdFEJ.mjs → dist-Bb8BoMiw.mjs} +76 -626
  16. package/dist/dist-Bb8BoMiw.mjs.map +1 -0
  17. package/dist/{dist-Cxi68OuY.mjs → dist-DkuDAIrG.mjs} +26862 -25638
  18. package/dist/dist-DkuDAIrG.mjs.map +1 -0
  19. package/dist/{dist-CbG3QxDw.mjs → dist-fjKpBYkc.mjs} +12 -27
  20. package/dist/dist-fjKpBYkc.mjs.map +1 -0
  21. package/dist/effects/index.d.mts +4 -4
  22. package/dist/effects/index.mjs +36 -34
  23. package/dist/{effects-DzbjFhyA.mjs → effects-D6wFg2FR.mjs} +3 -3
  24. package/dist/{effects-DzbjFhyA.mjs.map → effects-D6wFg2FR.mjs.map} +1 -1
  25. package/dist/fonts/index.d.mts +1 -1
  26. package/dist/fonts/index.mjs +3 -1
  27. package/dist/{fonts-C0W6TgJk.mjs → fonts-CZMYtbP7.mjs} +24 -11
  28. package/dist/fonts-CZMYtbP7.mjs.map +1 -0
  29. package/dist/gpu-DG3gI88-.mjs +215 -0
  30. package/dist/gpu-DG3gI88-.mjs.map +1 -0
  31. package/dist/{index-DRZu3ezy.d.mts → index--0vVZDPM.d.mts} +3 -3
  32. package/dist/{index-DRZu3ezy.d.mts.map → index--0vVZDPM.d.mts.map} +1 -1
  33. package/dist/{index-DnWsbbuZ.d.mts → index-BcA8rep0.d.mts} +7 -2
  34. package/dist/index-BcA8rep0.d.mts.map +1 -0
  35. package/dist/{index-DGJp1d30.d.mts → index-BzQc812z.d.mts} +3 -3
  36. package/dist/{index-DGJp1d30.d.mts.map → index-BzQc812z.d.mts.map} +1 -1
  37. package/dist/{index-DDEPvMww.d.mts → index-Cpkzy5XR.d.mts} +3452 -1675
  38. package/dist/index-Cpkzy5XR.d.mts.map +1 -0
  39. package/dist/{index-CDoTrMs1.d.mts → index-D__HdInU.d.mts} +8 -8
  40. package/dist/{index-CDoTrMs1.d.mts.map → index-D__HdInU.d.mts.map} +1 -1
  41. package/dist/{index-CYGpSVsf.d.mts → index-DpWia6iH.d.mts} +4 -11
  42. package/dist/index-DpWia6iH.d.mts.map +1 -0
  43. package/dist/{index-9B8CJowc.d.mts → index-Fciq8bcC.d.mts} +10 -2
  44. package/dist/index-Fciq8bcC.d.mts.map +1 -0
  45. package/dist/index.d.mts +29 -1842
  46. package/dist/index.d.mts.map +1 -1
  47. package/dist/index.mjs +79 -66
  48. package/dist/index.mjs.map +1 -1
  49. package/dist/preview/index.d.mts +2 -2
  50. package/dist/preview/index.mjs +12 -13
  51. package/dist/{preview-BV2C4Fk6.mjs → preview--rOXbBxl.mjs} +3 -4
  52. package/dist/preview--rOXbBxl.mjs.map +1 -0
  53. package/dist/preview-engine/audio.mjs +1 -1
  54. package/dist/preview-engine/chunk-2MZXSWVT.mjs +118 -0
  55. package/dist/preview-engine/{chunk-Y6HWYPKX.mjs → chunk-3GNP7TJH.mjs} +3 -3
  56. package/dist/preview-engine/chunk-3UPI4EPV.mjs +69 -0
  57. package/dist/preview-engine/{chunk-6JW37VJA.mjs → chunk-5AUB4Y3L.mjs} +3 -23
  58. package/dist/preview-engine/chunk-5DOD2NVY.mjs +26 -0
  59. package/dist/preview-engine/chunk-5FC7GOWW.mjs +474 -0
  60. package/dist/preview-engine/chunk-5W4AFQP7.mjs +97 -0
  61. package/dist/preview-engine/chunk-63SFBHEH.mjs +1 -0
  62. package/dist/preview-engine/{chunk-25IW7NYO.mjs → chunk-7EPDVSCL.mjs} +1 -1
  63. package/dist/preview-engine/chunk-7EPIRODI.mjs +91 -0
  64. package/dist/preview-engine/chunk-7J2FWGVD.mjs +1 -0
  65. package/dist/preview-engine/chunk-AXHB4J37.mjs +147 -0
  66. package/dist/preview-engine/chunk-AXQZX3TC.mjs +450 -0
  67. package/dist/preview-engine/chunk-B43Z3J7J.mjs +5 -0
  68. package/dist/preview-engine/chunk-BWJS6G7R.mjs +314 -0
  69. package/dist/preview-engine/{chunk-ECPP3UG6.mjs → chunk-E3HC4GRQ.mjs} +3 -23
  70. package/dist/preview-engine/{chunk-AEK5BO3J.mjs → chunk-E4RAFHZM.mjs} +1 -1
  71. package/dist/preview-engine/chunk-ENKKLU7B.mjs +22 -0
  72. package/dist/preview-engine/{chunk-IYVN2QEL.mjs → chunk-FLPSWDX4.mjs} +1 -1
  73. package/dist/preview-engine/{chunk-24DXIKXL.mjs → chunk-FPRXK2WD.mjs} +2 -2
  74. package/dist/preview-engine/chunk-FU7AIAMM.mjs +88 -0
  75. package/dist/preview-engine/{chunk-CBM7B7EW.mjs → chunk-GMGGDADT.mjs} +1 -1
  76. package/dist/preview-engine/chunk-GSFN4WCH.mjs +62 -0
  77. package/dist/preview-engine/chunk-IQC2I5A5.mjs +1 -0
  78. package/dist/preview-engine/chunk-IUPDOATX.mjs +114 -0
  79. package/dist/preview-engine/{chunk-GHMCGTJ2.mjs → chunk-J2R5R7YY.mjs} +3 -23
  80. package/dist/preview-engine/chunk-JAJOZG5P.mjs +1 -0
  81. package/dist/preview-engine/{chunk-XLFYM7KH.mjs → chunk-K773AOF3.mjs} +2 -2
  82. package/dist/preview-engine/{chunk-RJUAM52F.mjs → chunk-L3CHEZMZ.mjs} +3 -23
  83. package/dist/preview-engine/chunk-LBRVQ4GE.mjs +84 -0
  84. package/dist/preview-engine/chunk-LGVEFPOG.mjs +3 -0
  85. package/dist/preview-engine/{chunk-AMBSW6OA.mjs → chunk-NEE3KQTX.mjs} +2 -2
  86. package/dist/preview-engine/chunk-NPD6W3RP.mjs +1 -0
  87. package/dist/preview-engine/{chunk-V6VU46ZG.mjs → chunk-O2RNIQXT.mjs} +1 -1
  88. package/dist/preview-engine/{server-utils-2FAIV45N.mjs → chunk-OCX5AD23.mjs} +1 -1
  89. package/dist/preview-engine/chunk-OJ2PKBXE.mjs +40 -0
  90. package/dist/preview-engine/chunk-OKH2VU2U.mjs +97 -0
  91. package/dist/preview-engine/chunk-PAQNDZQB.mjs +83 -0
  92. package/dist/preview-engine/chunk-PEWYB6WP.mjs +43 -0
  93. package/dist/preview-engine/{chunk-MDDF2GCF.mjs → chunk-PFA427ZC.mjs} +3 -23
  94. package/dist/preview-engine/chunk-PL4IH5V4.mjs +89 -0
  95. package/dist/preview-engine/chunk-PNB3ERR3.mjs +1 -0
  96. package/dist/preview-engine/{chunk-PQD5UPHG.mjs → chunk-PR2BUYCL.mjs} +1 -1
  97. package/dist/preview-engine/{chunk-QYRDQMNB.mjs → chunk-PXT52LEH.mjs} +3 -23
  98. package/dist/preview-engine/{chunk-ZSIJB76A.mjs → chunk-Q2DPNVIA.mjs} +2 -2
  99. package/dist/preview-engine/chunk-Q4Z54DQ7.mjs +1 -0
  100. package/dist/preview-engine/{chunk-6256GQFP.mjs → chunk-QY7MHWZW.mjs} +1 -1
  101. package/dist/preview-engine/chunk-RQLMW6MA.mjs +4 -0
  102. package/dist/preview-engine/chunk-RSMO7NPN.mjs +1 -0
  103. package/dist/preview-engine/chunk-RW2F3XLQ.mjs +90 -0
  104. package/dist/preview-engine/chunk-SGPRLTNF.mjs +52 -0
  105. package/dist/preview-engine/{chunk-Y6FEU4TV.mjs → chunk-SZW5J72T.mjs} +3 -23
  106. package/dist/preview-engine/{chunk-LIHUEYI5.mjs → chunk-VO2R3DWV.mjs} +2 -2
  107. package/dist/preview-engine/{chunk-BJKH76OM.mjs → chunk-VXS5SIEC.mjs} +3 -23
  108. package/dist/preview-engine/chunk-WFGJXCZT.mjs +53 -0
  109. package/dist/preview-engine/chunk-WH5Q2NFN.mjs +32 -0
  110. package/dist/preview-engine/chunk-WSIURGP2.mjs +121 -0
  111. package/dist/preview-engine/{chunk-AWTH2WZO.mjs → chunk-WUKH7BD7.mjs} +1 -1
  112. package/dist/preview-engine/chunk-XC5WZNOY.mjs +1448 -0
  113. package/dist/preview-engine/chunk-YQZOGEPZ.mjs +186 -0
  114. package/dist/preview-engine/{chunk-D3TETPLI.mjs → chunk-ZH5MZQTZ.mjs} +1 -1
  115. package/dist/preview-engine/chunk-ZIIFTWDH.mjs +58 -0
  116. package/dist/preview-engine/{chunk-EQ4QZRXB.mjs → chunk-ZNL4W4DK.mjs} +2 -2
  117. package/dist/preview-engine/effects.mjs +1 -1
  118. package/dist/preview-engine/fonts.mjs +1 -1
  119. package/dist/preview-engine/framefields.mjs +127 -130
  120. package/dist/preview-engine/player.mjs +6 -6
  121. package/dist/preview-engine/renderers-2H7YEUTD.mjs +1 -0
  122. package/dist/preview-engine/renderers-2P6KXWEZ.mjs +1 -0
  123. package/dist/preview-engine/renderers-2SVWAB42.mjs +1 -0
  124. package/dist/preview-engine/renderers-3RC5FDWX.mjs +1 -0
  125. package/dist/preview-engine/renderers-3T7Q4SPP.mjs +1 -0
  126. package/dist/preview-engine/renderers-4DV4REGM.mjs +1 -0
  127. package/dist/preview-engine/renderers-57WDL6XN.mjs +1 -0
  128. package/dist/preview-engine/renderers-6WH7NZCC.mjs +1 -0
  129. package/dist/preview-engine/renderers-7JTNJE7M.mjs +1 -0
  130. package/dist/preview-engine/renderers-7VJN5L3Z.mjs +1 -0
  131. package/dist/preview-engine/{renderers-WLH4HRUE.mjs → renderers-A7VH3ON5.mjs} +1 -1
  132. package/dist/preview-engine/renderers-CQXQHOW2.mjs +1 -0
  133. package/dist/preview-engine/{renderers-2US2NIUG.mjs → renderers-D2EJULOJ.mjs} +3 -23
  134. package/dist/preview-engine/renderers-DXHJAMZR.mjs +1 -0
  135. package/dist/preview-engine/{renderers-W5CVDJVH.mjs → renderers-F55XFVMP.mjs} +1 -1
  136. package/dist/preview-engine/renderers-FWGMNPYB.mjs +1 -0
  137. package/dist/preview-engine/renderers-HXFRTIJD.mjs +1 -0
  138. package/dist/preview-engine/renderers-IWQ3V6AJ.mjs +1 -0
  139. package/dist/preview-engine/renderers-IXGM55XK.mjs +1 -0
  140. package/dist/preview-engine/renderers-KVHUVWSN.mjs +1 -0
  141. package/dist/preview-engine/renderers-KZWGSKRF.mjs +1 -0
  142. package/dist/preview-engine/renderers-LVDUZZ75.mjs +1 -0
  143. package/dist/preview-engine/renderers-M7R2ZJUP.mjs +1 -0
  144. package/dist/preview-engine/renderers-NWHS7N2L.mjs +1 -0
  145. package/dist/preview-engine/{renderers-CAUWP4XH.mjs → renderers-O2DZPBOJ.mjs} +3 -23
  146. package/dist/preview-engine/renderers-OT7D3BUA.mjs +1 -0
  147. package/dist/preview-engine/renderers-P4S7GL64.mjs +104 -0
  148. package/dist/preview-engine/renderers-PMOO7DLX.mjs +1 -0
  149. package/dist/preview-engine/renderers-Q4OFCMXI.mjs +1 -0
  150. package/dist/preview-engine/renderers-QCCPCH73.mjs +1 -0
  151. package/dist/preview-engine/renderers-RJO6H4FC.mjs +1 -0
  152. package/dist/preview-engine/renderers-RRXFJRGI.mjs +1 -0
  153. package/dist/preview-engine/renderers-SCJ6OKTB.mjs +1 -0
  154. package/dist/preview-engine/renderers-T4JMJXWL.mjs +1 -0
  155. package/dist/preview-engine/renderers-TAWT3ZSS.mjs +1 -0
  156. package/dist/preview-engine/{renderers-JQHUBWLL.mjs → renderers-TFZST6WW.mjs} +3 -23
  157. package/dist/preview-engine/renderers-UHTO6BQA.mjs +1 -0
  158. package/dist/preview-engine/renderers-UPKB5OLS.mjs +100 -0
  159. package/dist/preview-engine/renderers-UPTJJE5F.mjs +1 -0
  160. package/dist/preview-engine/renderers-VLMQR3DW.mjs +1 -0
  161. package/dist/preview-engine/renderers-WVTTRCVI.mjs +1 -0
  162. package/dist/preview-engine/renderers-X5PUIPU5.mjs +1 -0
  163. package/dist/preview-engine/renderers-XCMVZ2XG.mjs +35 -0
  164. package/dist/preview-engine/renderers-XHTMRXC5.mjs +1 -0
  165. package/dist/preview-engine/renderers-YDCDY3BR.mjs +1 -0
  166. package/dist/preview-engine/renderers-YECY2YFT.mjs +1 -0
  167. package/dist/preview-engine/renderers-YJNQ4B7B.mjs +1 -0
  168. package/dist/preview-engine/renderers-YMN6QXK7.mjs +1 -0
  169. package/dist/preview-engine/renderers-YZEVPHPQ.mjs +228 -0
  170. package/dist/preview-engine/renderers-Z7YQUFAY.mjs +1 -0
  171. package/dist/preview-engine/renderers-ZANPE3OK.mjs +1 -0
  172. package/dist/preview-engine/renderers-ZJTRANIX.mjs +1 -0
  173. package/dist/preview-engine/signals.mjs +1 -1
  174. package/dist/preview-engine/skia-canvas-QBXAOGPB.mjs +1 -0
  175. package/dist/{program-BmNKgzja.mjs → program-Cc5AsBHz.mjs} +93 -2335
  176. package/dist/program-Cc5AsBHz.mjs.map +1 -0
  177. package/dist/renderer/index.d.mts +2 -2
  178. package/dist/renderer/index.mjs +3 -4
  179. package/dist/renderer-1VSi7Vum.mjs +5 -0
  180. package/dist/renderer-4BlpUHQT.mjs +5 -0
  181. package/dist/{renderer-Bv21DbWy.mjs → renderer-9L0p8IT3.mjs} +3 -1
  182. package/dist/renderer-AzSX2-mZ.mjs +5 -0
  183. package/dist/renderer-B-cxK24t.mjs +5 -0
  184. package/dist/{renderer-DxTs4Iyi.mjs → renderer-B1Zn91xt.mjs} +40 -142
  185. package/dist/renderer-B1Zn91xt.mjs.map +1 -0
  186. package/dist/renderer-B5d5oM_D.mjs +5 -0
  187. package/dist/renderer-B8BdNjaN.mjs +5 -0
  188. package/dist/{renderer-Bhdf90Zq.mjs → renderer-BI5rvAyo.mjs} +51 -163
  189. package/dist/renderer-BI5rvAyo.mjs.map +1 -0
  190. package/dist/renderer-BKEfeg-4.mjs +5 -0
  191. package/dist/{renderer-CI7sG_cv.mjs → renderer-BKf1qDwL.mjs} +83 -266
  192. package/dist/renderer-BKf1qDwL.mjs.map +1 -0
  193. package/dist/renderer-BLLOkeFB.mjs +5 -0
  194. package/dist/renderer-BSitV56h.mjs +268 -0
  195. package/dist/renderer-BSitV56h.mjs.map +1 -0
  196. package/dist/renderer-BTvov1NH.mjs +5 -0
  197. package/dist/renderer-BVun05IK.mjs +5 -0
  198. package/dist/{renderer-B2ieylQ3.mjs → renderer-BWVsBB3t.mjs} +56 -167
  199. package/dist/renderer-BWVsBB3t.mjs.map +1 -0
  200. package/dist/{renderer-ChdLYS-G.mjs → renderer-BXQQxeNC.mjs} +20 -87
  201. package/dist/renderer-BXQQxeNC.mjs.map +1 -0
  202. package/dist/renderer-B_3h5nhy.mjs +5 -0
  203. package/dist/renderer-BaZjoFYK.mjs +5 -0
  204. package/dist/{renderer-CfC_aiew.mjs → renderer-BaaOR3Ao.mjs} +57 -192
  205. package/dist/renderer-BaaOR3Ao.mjs.map +1 -0
  206. package/dist/{renderer-bZU_ndxf.mjs → renderer-BajIOuZH.mjs} +2 -2
  207. package/dist/{renderer-bZU_ndxf.mjs.map → renderer-BajIOuZH.mjs.map} +1 -1
  208. package/dist/{renderer-CWTpc4ff.mjs → renderer-Bb8T5eRX.mjs} +76 -210
  209. package/dist/renderer-Bb8T5eRX.mjs.map +1 -0
  210. package/dist/{renderer-D2nCGcjv.mjs → renderer-Bc6J0iVG.mjs} +3 -3
  211. package/dist/{renderer-D2nCGcjv.mjs.map → renderer-Bc6J0iVG.mjs.map} +1 -1
  212. package/dist/renderer-BcApaCVe.mjs +5 -0
  213. package/dist/{renderer-D_1oDOCP.mjs → renderer-Bg7647VN.mjs} +14 -69
  214. package/dist/renderer-Bg7647VN.mjs.map +1 -0
  215. package/dist/{renderer-ho_jXJ0H.mjs → renderer-BhKIZDsm.mjs} +23 -117
  216. package/dist/renderer-BhKIZDsm.mjs.map +1 -0
  217. package/dist/{renderer-dncoIVdd.mjs → renderer-BhhSyHKF.mjs} +3 -1
  218. package/dist/{renderer-CXn5HAnK.mjs → renderer-Br9BOkQs.mjs} +10 -16
  219. package/dist/renderer-Br9BOkQs.mjs.map +1 -0
  220. package/dist/{renderer-BTdOMMEx.d.mts → renderer-Bs_f_App.d.mts} +2 -2
  221. package/dist/{renderer-BTdOMMEx.d.mts.map → renderer-Bs_f_App.d.mts.map} +1 -1
  222. package/dist/{renderer-DZGtBUCx.mjs → renderer-BygIYH8s.mjs} +35 -185
  223. package/dist/renderer-BygIYH8s.mjs.map +1 -0
  224. package/dist/{renderer-Bv6q84TU.mjs → renderer-C--Dqe-3.mjs} +61 -208
  225. package/dist/renderer-C--Dqe-3.mjs.map +1 -0
  226. package/dist/renderer-C14mKYCw.mjs +5 -0
  227. package/dist/{renderer-CnXW28b9.mjs → renderer-C27RfwXN.mjs} +85 -279
  228. package/dist/renderer-C27RfwXN.mjs.map +1 -0
  229. package/dist/{renderer-Dy0utCl7.mjs → renderer-C5caYAA3.mjs} +10 -17
  230. package/dist/renderer-C5caYAA3.mjs.map +1 -0
  231. package/dist/{renderer-Bfgd4N0O.mjs → renderer-C5zpaQed.mjs} +9 -16
  232. package/dist/renderer-C5zpaQed.mjs.map +1 -0
  233. package/dist/{renderer-cgxO2xN6.mjs → renderer-C7UZLOYk.mjs} +10 -17
  234. package/dist/renderer-C7UZLOYk.mjs.map +1 -0
  235. package/dist/{renderer-BJ1aTkZf.mjs → renderer-C92mwhZz.mjs} +99 -282
  236. package/dist/renderer-C92mwhZz.mjs.map +1 -0
  237. package/dist/{renderer-CepMDQ06.mjs → renderer-CAJe9eLS.mjs} +19 -106
  238. package/dist/renderer-CAJe9eLS.mjs.map +1 -0
  239. package/dist/renderer-CFqhAXkH.mjs +5 -0
  240. package/dist/renderer-CK-spD4j.mjs +5 -0
  241. package/dist/renderer-CLLzQTIk.mjs +5 -0
  242. package/dist/{renderer-CtyD_Xju.mjs → renderer-CMsjnZ0G.mjs} +59 -194
  243. package/dist/renderer-CMsjnZ0G.mjs.map +1 -0
  244. package/dist/renderer-COwa6xlF.mjs +5 -0
  245. package/dist/renderer-CQPuuoVf.mjs +6 -0
  246. package/dist/renderer-CRd-cDqZ.mjs +5 -0
  247. package/dist/renderer-CTVnQAUm.mjs +5 -0
  248. package/dist/renderer-CbiEBSGx.mjs +5 -0
  249. package/dist/renderer-Cl7PruQ1.mjs +5 -0
  250. package/dist/renderer-CmuGGUDR.mjs +5 -0
  251. package/dist/renderer-CoGP4Mvf.mjs +148 -0
  252. package/dist/renderer-CoGP4Mvf.mjs.map +1 -0
  253. package/dist/renderer-CoNRrfqx.mjs +5 -0
  254. package/dist/{renderer-BREIjsUU.mjs → renderer-CrAqu3Rg.mjs} +14 -40
  255. package/dist/renderer-CrAqu3Rg.mjs.map +1 -0
  256. package/dist/renderer-CvIGa0mE.mjs +5 -0
  257. package/dist/renderer-CwMDPv0p.mjs +5 -0
  258. package/dist/{renderer-BIIWCg_J.mjs → renderer-CydWqyf0.mjs} +11 -18
  259. package/dist/renderer-CydWqyf0.mjs.map +1 -0
  260. package/dist/{renderer-bsWnRNpJ.mjs → renderer-CzBQgGD2.mjs} +29 -98
  261. package/dist/renderer-CzBQgGD2.mjs.map +1 -0
  262. package/dist/{renderer-CdciwwMI.mjs → renderer-D0aZNkQE.mjs} +161 -457
  263. package/dist/renderer-D0aZNkQE.mjs.map +1 -0
  264. package/dist/{renderer-B8UaFNqb.mjs → renderer-D2BRlqof.mjs} +62 -209
  265. package/dist/renderer-D2BRlqof.mjs.map +1 -0
  266. package/dist/{renderer-B8-kzZdP.mjs → renderer-D2FFvxsq.mjs} +41 -140
  267. package/dist/renderer-D2FFvxsq.mjs.map +1 -0
  268. package/dist/{renderer-Ctk2zzfy.mjs → renderer-D8-zNjyz.mjs} +57 -197
  269. package/dist/renderer-D8-zNjyz.mjs.map +1 -0
  270. package/dist/{renderer-DML9qpmS.mjs → renderer-DDqwds9R.mjs} +52 -202
  271. package/dist/renderer-DDqwds9R.mjs.map +1 -0
  272. package/dist/{renderer-BSaYG8aw.mjs → renderer-DGtBOdst.mjs} +3 -1
  273. package/dist/{renderer-CzPWB0Ss.mjs → renderer-DKqG9Lek.mjs} +13 -45
  274. package/dist/renderer-DKqG9Lek.mjs.map +1 -0
  275. package/dist/renderer-DOHbhGPu.mjs +5 -0
  276. package/dist/renderer-DOmA6IKc.mjs +5 -0
  277. package/dist/{renderer-DirxsOjq.mjs → renderer-DUhXH5Tz.mjs} +80 -258
  278. package/dist/renderer-DUhXH5Tz.mjs.map +1 -0
  279. package/dist/{renderer-kwmlLQOO.mjs → renderer-DVnVnS3c.mjs} +4 -4
  280. package/dist/{renderer-kwmlLQOO.mjs.map → renderer-DVnVnS3c.mjs.map} +1 -1
  281. package/dist/{renderer-CaaOKMSd.mjs → renderer-DWEvQ-hQ.mjs} +63 -190
  282. package/dist/renderer-DWEvQ-hQ.mjs.map +1 -0
  283. package/dist/renderer-DX2qEJTL.mjs +2173 -0
  284. package/dist/renderer-DX2qEJTL.mjs.map +1 -0
  285. package/dist/{renderer-1VuQTY1Z.mjs → renderer-DX8aBDqR.mjs} +236 -96
  286. package/dist/renderer-DX8aBDqR.mjs.map +1 -0
  287. package/dist/{renderer-DEJwPRkR.mjs → renderer-DYIPWN_B.mjs} +15 -51
  288. package/dist/renderer-DYIPWN_B.mjs.map +1 -0
  289. package/dist/{renderer-Djlb4TLO.mjs → renderer-DZD2G76E.mjs} +8 -15
  290. package/dist/renderer-DZD2G76E.mjs.map +1 -0
  291. package/dist/{renderer-WSGuj_V6.mjs → renderer-Da06_9FZ.mjs} +4 -3
  292. package/dist/{renderer-WSGuj_V6.mjs.map → renderer-Da06_9FZ.mjs.map} +1 -1
  293. package/dist/{renderer-BM05sB8m.mjs → renderer-DkyXqrQ6.mjs} +11 -74
  294. package/dist/renderer-DkyXqrQ6.mjs.map +1 -0
  295. package/dist/renderer-DmCWc4JL.mjs +5 -0
  296. package/dist/{renderer-BDbTWSpP.mjs → renderer-Dno-fujw.mjs} +58 -234
  297. package/dist/renderer-Dno-fujw.mjs.map +1 -0
  298. package/dist/{renderer-D2XD4QYk.mjs → renderer-DoYdfDEA.mjs} +34 -147
  299. package/dist/renderer-DoYdfDEA.mjs.map +1 -0
  300. package/dist/{renderer-_uvdg48N.mjs → renderer-DqjITuT-.mjs} +24 -93
  301. package/dist/renderer-DqjITuT-.mjs.map +1 -0
  302. package/dist/renderer-DuuOlYIG.mjs +3 -0
  303. package/dist/{renderer-DIgsilTw.mjs → renderer-Dy-DBU0X.mjs} +5 -4
  304. package/dist/{renderer-DIgsilTw.mjs.map → renderer-Dy-DBU0X.mjs.map} +1 -1
  305. package/dist/{renderer-CpkiHRhh.mjs → renderer-DyzNM721.mjs} +17 -99
  306. package/dist/renderer-DyzNM721.mjs.map +1 -0
  307. package/dist/{renderer-C_TPMHiH.mjs → renderer-DzrM1KMN.mjs} +81 -221
  308. package/dist/renderer-DzrM1KMN.mjs.map +1 -0
  309. package/dist/{renderer-Bc04fivZ.mjs → renderer-FHyZn0em.mjs} +99 -287
  310. package/dist/renderer-FHyZn0em.mjs.map +1 -0
  311. package/dist/renderer-GSFP7v2z.mjs +3 -0
  312. package/dist/{renderer-DpGc-N3G.mjs → renderer-NXdm6HLb.mjs} +24 -104
  313. package/dist/renderer-NXdm6HLb.mjs.map +1 -0
  314. package/dist/renderer-OLaYikwi.mjs +5 -0
  315. package/dist/renderer-Q75RC5Uz.mjs +5 -0
  316. package/dist/renderer-T0LJ4Po3.mjs +5 -0
  317. package/dist/renderer-VuXt1hfq.mjs +5 -0
  318. package/dist/{renderer-BfAWZziM.mjs → renderer-_1xGBbxn.mjs} +58 -225
  319. package/dist/renderer-_1xGBbxn.mjs.map +1 -0
  320. package/dist/{renderer-B1YMwl2B.mjs → renderer-c4AorKyw.mjs} +3 -1
  321. package/dist/renderer-hY_2WLt3.mjs +5 -0
  322. package/dist/{renderer-BhZZEyFX.mjs → renderer-mp1NN5zk.mjs} +4 -4
  323. package/dist/{renderer-BhZZEyFX.mjs.map → renderer-mp1NN5zk.mjs.map} +1 -1
  324. package/dist/{renderer-D7zvPHKn.mjs → renderer-qsg-JMuN.mjs} +18 -28
  325. package/dist/renderer-qsg-JMuN.mjs.map +1 -0
  326. package/dist/{renderer-vqkKWqa5.mjs → renderer-timEC0Gl.mjs} +23 -107
  327. package/dist/renderer-timEC0Gl.mjs.map +1 -0
  328. package/dist/renderer-y4EqE06a.mjs +5 -0
  329. package/dist/{renderers-CP8CFWDs-DwQTx8S7.mjs → renderers-CP8CFWDs-CMYe4kvZ.mjs} +4 -4
  330. package/dist/{renderers-CP8CFWDs-DwQTx8S7.mjs.map → renderers-CP8CFWDs-CMYe4kvZ.mjs.map} +1 -1
  331. package/dist/signals/index.d.mts +6 -6
  332. package/dist/signals/index.mjs +8 -8
  333. package/dist/{signals-Bv1OweKd.mjs → signals-DGRs6ddH.mjs} +4 -4
  334. package/dist/{signals-Bv1OweKd.mjs.map → signals-DGRs6ddH.mjs.map} +1 -1
  335. package/package.json +55 -55
  336. package/dist/client-CwRhflHE.mjs +0 -66
  337. package/dist/client-CwRhflHE.mjs.map +0 -1
  338. package/dist/dist-BAVZdFEJ.mjs.map +0 -1
  339. package/dist/dist-BYqNNwsl.mjs.map +0 -1
  340. package/dist/dist-CbG3QxDw.mjs.map +0 -1
  341. package/dist/dist-Cxi68OuY.mjs.map +0 -1
  342. package/dist/dist-cjs--lfMLs3U.mjs +0 -66
  343. package/dist/dist-cjs--lfMLs3U.mjs.map +0 -1
  344. package/dist/dist-cjs--pxyGFw2.mjs +0 -43
  345. package/dist/dist-cjs--pxyGFw2.mjs.map +0 -1
  346. package/dist/dist-cjs-3pon9kTt.mjs +0 -6
  347. package/dist/dist-cjs-BDpO-TH_.mjs +0 -51
  348. package/dist/dist-cjs-BDpO-TH_.mjs.map +0 -1
  349. package/dist/dist-cjs-BiKQozdJ.mjs +0 -64
  350. package/dist/dist-cjs-BiKQozdJ.mjs.map +0 -1
  351. package/dist/dist-cjs-BmyyWYWv.mjs +0 -153
  352. package/dist/dist-cjs-BmyyWYWv.mjs.map +0 -1
  353. package/dist/dist-cjs-CND_ghfH.mjs +0 -98
  354. package/dist/dist-cjs-CND_ghfH.mjs.map +0 -1
  355. package/dist/dist-cjs-CQwmMllY.mjs +0 -137
  356. package/dist/dist-cjs-CQwmMllY.mjs.map +0 -1
  357. package/dist/dist-cjs-CgFzrgj8.mjs +0 -85
  358. package/dist/dist-cjs-CgFzrgj8.mjs.map +0 -1
  359. package/dist/dist-cjs-CsU2sZoX.mjs +0 -323
  360. package/dist/dist-cjs-CsU2sZoX.mjs.map +0 -1
  361. package/dist/dist-cjs-DJ8fcQEe.mjs +0 -9069
  362. package/dist/dist-cjs-DJ8fcQEe.mjs.map +0 -1
  363. package/dist/dist-cjs-DT2jJlcK.mjs +0 -181
  364. package/dist/dist-cjs-DT2jJlcK.mjs.map +0 -1
  365. package/dist/dist-cjs-DjzmP0-x.mjs +0 -1091
  366. package/dist/dist-cjs-DjzmP0-x.mjs.map +0 -1
  367. package/dist/dist-cjs-DzjrlfbE.mjs +0 -437
  368. package/dist/dist-cjs-DzjrlfbE.mjs.map +0 -1
  369. package/dist/dist-cjs-M-8QOgS_.mjs +0 -209
  370. package/dist/dist-cjs-M-8QOgS_.mjs.map +0 -1
  371. package/dist/dist-cjs-TsA8LFXC.mjs +0 -48
  372. package/dist/dist-cjs-TsA8LFXC.mjs.map +0 -1
  373. package/dist/dist-cjs-agQl9T8M.mjs +0 -5015
  374. package/dist/dist-cjs-agQl9T8M.mjs.map +0 -1
  375. package/dist/event-streams-BaNGaLxh.mjs +0 -204
  376. package/dist/event-streams-BaNGaLxh.mjs.map +0 -1
  377. package/dist/fonts-C0W6TgJk.mjs.map +0 -1
  378. package/dist/index-9B8CJowc.d.mts.map +0 -1
  379. package/dist/index-CYGpSVsf.d.mts.map +0 -1
  380. package/dist/index-DDEPvMww.d.mts.map +0 -1
  381. package/dist/index-DnWsbbuZ.d.mts.map +0 -1
  382. package/dist/package-XpCRbTOA.mjs +0 -6
  383. package/dist/package-XpCRbTOA.mjs.map +0 -1
  384. package/dist/preview-BV2C4Fk6.mjs.map +0 -1
  385. package/dist/preview-engine/chunk-36YGYLKD.mjs +0 -58
  386. package/dist/preview-engine/chunk-7O24H4YT.mjs +0 -117
  387. package/dist/preview-engine/chunk-AUFSM5KI.mjs +0 -141
  388. package/dist/preview-engine/chunk-BHFI3Y4T.mjs +0 -1
  389. package/dist/preview-engine/chunk-BQ65MU6H.mjs +0 -138
  390. package/dist/preview-engine/chunk-BWDARDO6.mjs +0 -117
  391. package/dist/preview-engine/chunk-DLXQDDIN.mjs +0 -46
  392. package/dist/preview-engine/chunk-EJGLUZMW.mjs +0 -1
  393. package/dist/preview-engine/chunk-FE6RSVKZ.mjs +0 -73
  394. package/dist/preview-engine/chunk-FGHOHCFG.mjs +0 -110
  395. package/dist/preview-engine/chunk-HPIULG7P.mjs +0 -111
  396. package/dist/preview-engine/chunk-HRIKNYPF.mjs +0 -60
  397. package/dist/preview-engine/chunk-IMV5SBQV.mjs +0 -1
  398. package/dist/preview-engine/chunk-JPXQPP6J.mjs +0 -1
  399. package/dist/preview-engine/chunk-K52S5DJX.mjs +0 -109
  400. package/dist/preview-engine/chunk-L3IEJZ5S.mjs +0 -474
  401. package/dist/preview-engine/chunk-M7NMFDJ3.mjs +0 -3
  402. package/dist/preview-engine/chunk-MJM3NFEC.mjs +0 -315
  403. package/dist/preview-engine/chunk-NFAGEP43.mjs +0 -1448
  404. package/dist/preview-engine/chunk-NRHSNPZV.mjs +0 -182
  405. package/dist/preview-engine/chunk-OWOSYNMF.mjs +0 -104
  406. package/dist/preview-engine/chunk-Q66QQI6N.mjs +0 -8
  407. package/dist/preview-engine/chunk-QGBSLNFI.mjs +0 -52
  408. package/dist/preview-engine/chunk-QM3XFEJN.mjs +0 -63
  409. package/dist/preview-engine/chunk-R3ZH7YF3.mjs +0 -89
  410. package/dist/preview-engine/chunk-R6YNSBKL.mjs +0 -108
  411. package/dist/preview-engine/chunk-S4CSX6K5.mjs +0 -610
  412. package/dist/preview-engine/chunk-SNYAHQ25.mjs +0 -186
  413. package/dist/preview-engine/chunk-SRT2OCQW.mjs +0 -1
  414. package/dist/preview-engine/chunk-SUUUYXXT.mjs +0 -1
  415. package/dist/preview-engine/chunk-T6COGNOW.mjs +0 -134
  416. package/dist/preview-engine/chunk-XFYXT76H.mjs +0 -52
  417. package/dist/preview-engine/chunk-XUM42I4R.mjs +0 -1
  418. package/dist/preview-engine/chunk-YITWSOG4.mjs +0 -103
  419. package/dist/preview-engine/chunk-ZDCA6NVT.mjs +0 -82
  420. package/dist/preview-engine/chunk-ZNGOAGAI.mjs +0 -1
  421. package/dist/preview-engine/renderers-27Q5X3U6.mjs +0 -1
  422. package/dist/preview-engine/renderers-4AHH6BHF.mjs +0 -1
  423. package/dist/preview-engine/renderers-5BV6JGTU.mjs +0 -248
  424. package/dist/preview-engine/renderers-6PRVCTYV.mjs +0 -1
  425. package/dist/preview-engine/renderers-76PQY2SO.mjs +0 -1
  426. package/dist/preview-engine/renderers-7X2W6QWX.mjs +0 -1
  427. package/dist/preview-engine/renderers-B52QT6MT.mjs +0 -55
  428. package/dist/preview-engine/renderers-BE6RVJSE.mjs +0 -1
  429. package/dist/preview-engine/renderers-BMM2BH56.mjs +0 -1
  430. package/dist/preview-engine/renderers-CHOGQHVQ.mjs +0 -1
  431. package/dist/preview-engine/renderers-CRKRWR2Y.mjs +0 -1
  432. package/dist/preview-engine/renderers-DEYDSGJX.mjs +0 -1
  433. package/dist/preview-engine/renderers-DZTNRCR7.mjs +0 -1
  434. package/dist/preview-engine/renderers-ELO3KWTK.mjs +0 -1
  435. package/dist/preview-engine/renderers-EOJMPPAQ.mjs +0 -1
  436. package/dist/preview-engine/renderers-F2KJNDWA.mjs +0 -124
  437. package/dist/preview-engine/renderers-FCV4COVB.mjs +0 -1
  438. package/dist/preview-engine/renderers-G5KQISVL.mjs +0 -1
  439. package/dist/preview-engine/renderers-GJSUN5HU.mjs +0 -1
  440. package/dist/preview-engine/renderers-GMX2ZQDG.mjs +0 -1
  441. package/dist/preview-engine/renderers-GXCRINGC.mjs +0 -1
  442. package/dist/preview-engine/renderers-IHKORHMT.mjs +0 -1
  443. package/dist/preview-engine/renderers-JA4SLMG3.mjs +0 -1
  444. package/dist/preview-engine/renderers-JLN77CFZ.mjs +0 -1
  445. package/dist/preview-engine/renderers-KBFW7B5F.mjs +0 -1
  446. package/dist/preview-engine/renderers-LJRJMFCR.mjs +0 -1
  447. package/dist/preview-engine/renderers-LPAPZ5QS.mjs +0 -1
  448. package/dist/preview-engine/renderers-NQUDQEHY.mjs +0 -1
  449. package/dist/preview-engine/renderers-NS3AIJVG.mjs +0 -1
  450. package/dist/preview-engine/renderers-NSY2SDIE.mjs +0 -1
  451. package/dist/preview-engine/renderers-PW4OJWHF.mjs +0 -120
  452. package/dist/preview-engine/renderers-PWLWOZY4.mjs +0 -1
  453. package/dist/preview-engine/renderers-Q3MD34JN.mjs +0 -1
  454. package/dist/preview-engine/renderers-RXGNA2Q7.mjs +0 -1
  455. package/dist/preview-engine/renderers-TVTQ2R74.mjs +0 -1
  456. package/dist/preview-engine/renderers-VTTGFO55.mjs +0 -1
  457. package/dist/preview-engine/renderers-W3VVM5HB.mjs +0 -1
  458. package/dist/preview-engine/renderers-WG7QBD4D.mjs +0 -1
  459. package/dist/preview-engine/renderers-WLLJFZTF.mjs +0 -1
  460. package/dist/preview-engine/renderers-WN4SYFCU.mjs +0 -1
  461. package/dist/preview-engine/renderers-WSMLLSWX.mjs +0 -1
  462. package/dist/preview-engine/renderers-XFBSGTHU.mjs +0 -1
  463. package/dist/preview-engine/renderers-XFC6ZPO5.mjs +0 -1
  464. package/dist/preview-engine/renderers-XUHRY3XH.mjs +0 -1
  465. package/dist/preview-engine/renderers-YAOB5XU6.mjs +0 -1
  466. package/dist/preview-engine/renderers-YTB4FOHT.mjs +0 -1
  467. package/dist/preview-engine/renderers-ZIMBODX6.mjs +0 -1
  468. package/dist/program-BmNKgzja.mjs.map +0 -1
  469. package/dist/renderer-1VuQTY1Z.mjs.map +0 -1
  470. package/dist/renderer-6oMSare3.mjs +0 -3
  471. package/dist/renderer-B1ComPb2.mjs +0 -3
  472. package/dist/renderer-B2XzjK0z.mjs +0 -3
  473. package/dist/renderer-B2ieylQ3.mjs.map +0 -1
  474. package/dist/renderer-B8-kzZdP.mjs.map +0 -1
  475. package/dist/renderer-B8UaFNqb.mjs.map +0 -1
  476. package/dist/renderer-BDbTWSpP.mjs.map +0 -1
  477. package/dist/renderer-BIIWCg_J.mjs.map +0 -1
  478. package/dist/renderer-BJ1aTkZf.mjs.map +0 -1
  479. package/dist/renderer-BM05sB8m.mjs.map +0 -1
  480. package/dist/renderer-BQ5Bz5D0.mjs +0 -3
  481. package/dist/renderer-BREIjsUU.mjs.map +0 -1
  482. package/dist/renderer-BTu2EVhF.mjs +0 -3
  483. package/dist/renderer-BZcn_iBl.mjs +0 -3
  484. package/dist/renderer-Bc04fivZ.mjs.map +0 -1
  485. package/dist/renderer-BfAWZziM.mjs.map +0 -1
  486. package/dist/renderer-BfJSUjPN.mjs +0 -3
  487. package/dist/renderer-Bfgd4N0O.mjs.map +0 -1
  488. package/dist/renderer-Bhdf90Zq.mjs.map +0 -1
  489. package/dist/renderer-Bp6sDMa6.mjs +0 -3
  490. package/dist/renderer-Bt7_sb_Y.mjs +0 -3
  491. package/dist/renderer-Bv6q84TU.mjs.map +0 -1
  492. package/dist/renderer-C-H680_l.mjs +0 -3
  493. package/dist/renderer-C606ZPUn.mjs +0 -3
  494. package/dist/renderer-C9jyKn1i.mjs +0 -3
  495. package/dist/renderer-CDLrNgfo.mjs +0 -3
  496. package/dist/renderer-CERfcxgv.mjs +0 -3
  497. package/dist/renderer-CG5PzNkv.mjs +0 -3
  498. package/dist/renderer-CI7sG_cv.mjs.map +0 -1
  499. package/dist/renderer-CPoIMVdk.mjs +0 -3
  500. package/dist/renderer-CQdVj2JS.mjs +0 -3
  501. package/dist/renderer-CQiTodg9.mjs +0 -337
  502. package/dist/renderer-CQiTodg9.mjs.map +0 -1
  503. package/dist/renderer-CWTpc4ff.mjs.map +0 -1
  504. package/dist/renderer-CXn5HAnK.mjs.map +0 -1
  505. package/dist/renderer-CZgB5st8.mjs +0 -3
  506. package/dist/renderer-C_TPMHiH.mjs.map +0 -1
  507. package/dist/renderer-Ca7L1EOp.mjs +0 -3
  508. package/dist/renderer-CaaOKMSd.mjs.map +0 -1
  509. package/dist/renderer-CdciwwMI.mjs.map +0 -1
  510. package/dist/renderer-CepMDQ06.mjs.map +0 -1
  511. package/dist/renderer-CfC_aiew.mjs.map +0 -1
  512. package/dist/renderer-ChdLYS-G.mjs.map +0 -1
  513. package/dist/renderer-CkykdR_D.mjs +0 -3
  514. package/dist/renderer-Cl6GkeHx.mjs +0 -3
  515. package/dist/renderer-ClcjrFyo.mjs +0 -3
  516. package/dist/renderer-CnXW28b9.mjs.map +0 -1
  517. package/dist/renderer-CpkiHRhh.mjs.map +0 -1
  518. package/dist/renderer-CtVkU_GA.mjs +0 -44
  519. package/dist/renderer-CtVkU_GA.mjs.map +0 -1
  520. package/dist/renderer-Ctk2zzfy.mjs.map +0 -1
  521. package/dist/renderer-CtyD_Xju.mjs.map +0 -1
  522. package/dist/renderer-CySUP_wk.mjs +0 -3
  523. package/dist/renderer-CzPWB0Ss.mjs.map +0 -1
  524. package/dist/renderer-D2XD4QYk.mjs.map +0 -1
  525. package/dist/renderer-D2l_Odyg.mjs +0 -3
  526. package/dist/renderer-D7zvPHKn.mjs.map +0 -1
  527. package/dist/renderer-D9NnIx7o.mjs +0 -3
  528. package/dist/renderer-DCPCYySt.mjs +0 -3
  529. package/dist/renderer-DEJwPRkR.mjs.map +0 -1
  530. package/dist/renderer-DIkpJEOZ.mjs +0 -3
  531. package/dist/renderer-DML9qpmS.mjs.map +0 -1
  532. package/dist/renderer-DNSXPkf_.mjs +0 -3
  533. package/dist/renderer-DP-CvZ_Z.mjs +0 -3
  534. package/dist/renderer-DZGtBUCx.mjs.map +0 -1
  535. package/dist/renderer-D_1oDOCP.mjs.map +0 -1
  536. package/dist/renderer-DeXb8R6h.mjs +0 -3
  537. package/dist/renderer-DezO-ZaP.mjs +0 -4
  538. package/dist/renderer-DhXe04fC.mjs +0 -3
  539. package/dist/renderer-DirxsOjq.mjs.map +0 -1
  540. package/dist/renderer-Djlb4TLO.mjs.map +0 -1
  541. package/dist/renderer-DnH3SI7w.mjs +0 -3
  542. package/dist/renderer-DpGc-N3G.mjs.map +0 -1
  543. package/dist/renderer-Dpw4oi33.mjs +0 -3
  544. package/dist/renderer-DxTs4Iyi.mjs.map +0 -1
  545. package/dist/renderer-Dy0utCl7.mjs.map +0 -1
  546. package/dist/renderer-Md-ytU0v.mjs +0 -3
  547. package/dist/renderer-RKsXlF_0.mjs +0 -23900
  548. package/dist/renderer-RKsXlF_0.mjs.map +0 -1
  549. package/dist/renderer-U-bhWO9Q.mjs +0 -3
  550. package/dist/renderer-_uvdg48N.mjs.map +0 -1
  551. package/dist/renderer-bsWnRNpJ.mjs.map +0 -1
  552. package/dist/renderer-cgxO2xN6.mjs.map +0 -1
  553. package/dist/renderer-d5-F_48R.mjs +0 -3
  554. package/dist/renderer-ho_jXJ0H.mjs.map +0 -1
  555. package/dist/renderer-vqkKWqa5.mjs.map +0 -1
  556. package/dist/renderer-zA5okHds.mjs +0 -3
  557. package/dist/signin-Db08vl-g.mjs +0 -865
  558. package/dist/signin-Db08vl-g.mjs.map +0 -1
  559. package/dist/sso-oidc-CpLz_lIu.mjs +0 -1051
  560. package/dist/sso-oidc-CpLz_lIu.mjs.map +0 -1
  561. package/dist/sts-BQefGuml.mjs +0 -6
  562. package/dist/sts-Dgl0kH-t.mjs +0 -1395
  563. package/dist/sts-Dgl0kH-t.mjs.map +0 -1
  564. /package/dist/{renderer-C2n-EHxg.mjs → renderer-B-BcgA6d.mjs} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["stack","color","d3Format","d3Pie","d3Arc","x","d3Stack","lo","hi","d","d3Area","d3Line","spec","size","color","line","spec","resolvedSource","analyzeVisionFrames","signal","color","CoreEffect"],"sources":["../src/ids.ts","../src/rich-text.ts","../src/chart.ts","../src/shapes3d.ts","../src/transitions.ts","../src/lighting.ts","../src/index.ts"],"sourcesContent":["/**\n * Default ids for nodes created without one. A counter per prefix rather than\n * a random suffix: the same composition script builds the same ids on every\n * run and in every render worker, so specs, caches and diffs stay stable.\n */\nconst counters = new Map<string, number>();\n\nexport function autoId(prefix: string): string {\n\tconst n = (counters.get(prefix) ?? 0) + 1;\n\tcounters.set(prefix, n);\n\treturn `${prefix}-auto-${n}`;\n}\n","import type { Signal, TextSpan, TextSpanMark } from \"@framefields/core\";\n\nexport type { TextSpan, TextSpanMark };\n\nexport type TextSpanItem =\n\t| string\n\t| number\n\t| boolean\n\t| Signal<unknown>\n\t| TextSpan\n\t| (string | TextSpan)[]\n\t| null\n\t| undefined;\n\n/**\n * Tagged template literal for authoring rich, multi-style text runs.\n *\n * Interpolates strings, numbers, reactive signals, and typed span modifiers\n * directly into a structured TextSpan[] array with zero runtime parsing.\n *\n * @example\n * rich`Scale ${bold(\"10x\", { fill: \"#6366f1\" })} faster with ${mark(\"120 FPS\", { bg: \"#10b98133\" })}`\n */\nexport function rich(\n\tstrings: TemplateStringsArray,\n\t...values: TextSpanItem[]\n): TextSpan[] {\n\tconst spans: TextSpan[] = [];\n\n\tfor (let i = 0; i < strings.length; i++) {\n\t\tconst str = strings[i];\n\t\tif (str) {\n\t\t\tspans.push({ text: str });\n\t\t}\n\n\t\tif (i < values.length) {\n\t\t\tconst val = values[i];\n\t\t\tif (val === null || val === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (Array.isArray(val)) {\n\t\t\t\tfor (const item of val) {\n\t\t\t\t\tif (typeof item === \"string\") {\n\t\t\t\t\t\tif (item) spans.push({ text: item });\n\t\t\t\t\t} else if (item && typeof item === \"object\" && \"text\" in item) {\n\t\t\t\t\t\tspans.push(item as TextSpan);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (typeof val === \"object\" && \"text\" in val) {\n\t\t\t\tspans.push(val as TextSpan);\n\t\t\t} else if (\n\t\t\t\ttypeof val === \"object\" &&\n\t\t\t\t\"get\" in val &&\n\t\t\t\ttypeof (val as { get: unknown }).get === \"function\"\n\t\t\t) {\n\t\t\t\tspans.push({ text: val as Signal<string> });\n\t\t\t} else {\n\t\t\t\tspans.push({ text: String(val) });\n\t\t\t}\n\t\t}\n\t}\n\n\treturn spans;\n}\n\nexport function span(\n\ttext: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\"> = {},\n): TextSpan {\n\treturn { text, ...options };\n}\n\nexport function bold(\n\ttext: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\"> = {},\n): TextSpan {\n\treturn { text, fontWeight: options.fontWeight ?? 700, ...options };\n}\n\nexport function italic(\n\ttext: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\"> = {},\n): TextSpan {\n\treturn { text, fontStyle: \"italic\", ...options };\n}\n\nexport function accent(\n\ttext: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\"> = {},\n): TextSpan {\n\treturn { text, fill: options.fill ?? \"#6366f1\", ...options };\n}\n\nexport function color(\n\ttext: string | Signal<string>,\n\tfill: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\" | \"fill\"> = {},\n): TextSpan {\n\treturn { text, fill, ...options };\n}\n\nexport function size(\n\ttext: string | Signal<string>,\n\tfontSize: number | Signal<number>,\n\toptions: Omit<TextSpan, \"text\" | \"fontSize\"> = {},\n): TextSpan {\n\treturn { text, fontSize, ...options };\n}\n\nexport interface MarkOptions extends Omit<TextSpan, \"text\" | \"mark\" | \"fill\"> {\n\tbg?: string | Signal<string>;\n\tfill?: string | Signal<string>;\n\tradius?: number;\n\tpaddingX?: number;\n\tpaddingY?: number;\n}\n\nexport function mark(\n\ttext: string | Signal<string>,\n\toptions: MarkOptions = {},\n): TextSpan {\n\tconst { bg, fill, radius, paddingX, paddingY, ...rest } = options;\n\treturn {\n\t\ttext,\n\t\tfill,\n\t\tmark: {\n\t\t\tbackground: bg ?? \"#6366f133\",\n\t\t\tborderRadius: radius ?? 4,\n\t\t\tpaddingX: paddingX ?? 6,\n\t\t\tpaddingY: paddingY ?? 2,\n\t\t},\n\t\t...rest,\n\t};\n}\n\nexport function sup(\n\ttext: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\"> = {},\n): TextSpan {\n\treturn {\n\t\ttext,\n\t\tbaselineShift: options.baselineShift ?? -8,\n\t\t...options,\n\t};\n}\n\nexport function sub(\n\ttext: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\"> = {},\n): TextSpan {\n\treturn {\n\t\ttext,\n\t\tbaselineShift: options.baselineShift ?? 6,\n\t\t...options,\n\t};\n}\n\nexport function code(\n\ttext: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\"> = {},\n): TextSpan {\n\treturn {\n\t\ttext,\n\t\tfontFamily: options.fontFamily ?? \"JetBrains Mono\",\n\t\tmark: options.mark ?? {\n\t\t\tbackground: \"#ffffff18\",\n\t\t\tborderRadius: 4,\n\t\t\tpaddingX: 6,\n\t\t\tpaddingY: 2,\n\t\t},\n\t\t...options,\n\t};\n}\n\n/**\n * Normalizes string, TextSpan[], or array of mixed strings/spans into plain text and spans.\n */\nexport function normalizeTextSpans(\n\tinput: string | TextSpan[] | (string | TextSpan)[],\n): { text: string; spans?: TextSpan[] } {\n\tif (typeof input === \"string\") {\n\t\treturn { text: input };\n\t}\n\n\tif (!Array.isArray(input)) {\n\t\treturn { text: String(input) };\n\t}\n\n\tconst spans: TextSpan[] = [];\n\tlet plainText = \"\";\n\n\tfor (const item of input) {\n\t\tif (typeof item === \"string\") {\n\t\t\tif (item) {\n\t\t\t\tspans.push({ text: item });\n\t\t\t\tplainText += item;\n\t\t\t}\n\t\t} else if (item && typeof item === \"object\" && \"text\" in item) {\n\t\t\tconst s = item as TextSpan;\n\t\t\tspans.push(s);\n\t\t\tconst piece =\n\t\t\t\ttypeof s.text === \"string\"\n\t\t\t\t\t? s.text\n\t\t\t\t\t: s.text &&\n\t\t\t\t\t\t\ttypeof s.text === \"object\" &&\n\t\t\t\t\t\t\t\"get\" in s.text &&\n\t\t\t\t\t\t\ttypeof (s.text as { get: () => unknown }).get === \"function\"\n\t\t\t\t\t\t? String((s.text as { get: () => unknown }).get())\n\t\t\t\t\t\t: String(s.text ?? \"\");\n\t\t\tplainText += piece;\n\t\t}\n\t}\n\n\treturn {\n\t\ttext: plainText,\n\t\tspans: spans.length > 0 ? spans : undefined,\n\t};\n}\n\n/**\n * Upfront parser for external CMS or subtitle strings containing basic tags\n * (<b>, <i>, <span>, <color>, <mark>, <accent>, <code>, <sup>, <sub>).\n *\n * Compiles string markup into clean TextSpan[] before entering the composition pipeline.\n */\nexport function parseMarkup(markup: string): TextSpan[] {\n\tif (!markup || !markup.includes(\"<\")) {\n\t\treturn [{ text: markup }];\n\t}\n\n\tconst spans: TextSpan[] = [];\n\tconst tagRegex = /<(\\/?[a-zA-Z0-9_-]+)([^>]*)>/g;\n\tlet lastIndex = 0;\n\n\tinterface StyleState {\n\t\ttag: string;\n\t\tstyle: Partial<TextSpan>;\n\t}\n\tconst stack: StyleState[] = [];\n\n\tconst getCurrentStyle = (): Partial<TextSpan> => {\n\t\tconst merged: Partial<TextSpan> = {};\n\t\tfor (const state of stack) {\n\t\t\tObject.assign(merged, state.style);\n\t\t}\n\t\treturn merged;\n\t};\n\n\tfor (;;) {\n\t\tconst match = tagRegex.exec(markup);\n\t\tif (!match) {\n\t\t\tbreak;\n\t\t}\n\t\tconst textBefore = markup.slice(lastIndex, match.index);\n\t\tif (textBefore) {\n\t\t\tspans.push({ text: textBefore, ...getCurrentStyle() });\n\t\t}\n\t\tlastIndex = match.index + match[0].length;\n\n\t\tconst tagName = match[1].toLowerCase();\n\t\tconst rawAttrs = match[2];\n\n\t\tif (tagName.startsWith(\"/\")) {\n\t\t\tconst closingTag = tagName.slice(1);\n\t\t\tfor (let i = stack.length - 1; i >= 0; i--) {\n\t\t\t\tif (stack[i].tag === closingTag) {\n\t\t\t\t\tstack.splice(i, 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst attrs: Record<string, string> = {};\n\t\t\tconst attrRegex = /([a-zA-Z0-9_-]+)=[\"']([^\"']*)[\"']/g;\n\t\t\tfor (;;) {\n\t\t\t\tconst attrMatch = attrRegex.exec(rawAttrs);\n\t\t\t\tif (!attrMatch) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tattrs[attrMatch[1].toLowerCase()] = attrMatch[2];\n\t\t\t}\n\n\t\t\tconst style: Partial<TextSpan> = {};\n\n\t\t\tif (tagName === \"b\" || tagName === \"strong\") {\n\t\t\t\tstyle.fontWeight = 700;\n\t\t\t\tif (attrs.color || attrs.fill) style.fill = attrs.color ?? attrs.fill;\n\t\t\t} else if (tagName === \"i\" || tagName === \"em\") {\n\t\t\t\tstyle.fontStyle = \"italic\";\n\t\t\t\tif (attrs.color || attrs.fill) style.fill = attrs.color ?? attrs.fill;\n\t\t\t} else if (tagName === \"accent\") {\n\t\t\t\tstyle.fill = \"#6366f1\";\n\t\t\t} else if (tagName === \"color\") {\n\t\t\t\tstyle.fill = attrs.value ?? attrs.hex ?? attrs.fill;\n\t\t\t} else if (tagName === \"size\") {\n\t\t\t\tconst num = parseFloat(attrs.value ?? attrs.px ?? attrs.pt ?? \"0\");\n\t\t\t\tif (num > 0) style.fontSize = num;\n\t\t\t} else if (tagName === \"mark\") {\n\t\t\t\tstyle.mark = {\n\t\t\t\t\tbackground: attrs.bg ?? attrs.background ?? \"#6366f133\",\n\t\t\t\t\tborderRadius: attrs.radius ? parseFloat(attrs.radius) : 4,\n\t\t\t\t\tpaddingX: attrs.paddingx ? parseFloat(attrs.paddingx) : 6,\n\t\t\t\t\tpaddingY: attrs.paddingy ? parseFloat(attrs.paddingy) : 2,\n\t\t\t\t};\n\t\t\t\tif (attrs.color || attrs.fill) style.fill = attrs.color ?? attrs.fill;\n\t\t\t} else if (tagName === \"sup\") {\n\t\t\t\tstyle.baselineShift = -8;\n\t\t\t} else if (tagName === \"sub\") {\n\t\t\t\tstyle.baselineShift = 6;\n\t\t\t} else if (tagName === \"code\") {\n\t\t\t\tstyle.fontFamily = \"JetBrains Mono\";\n\t\t\t\tstyle.mark = {\n\t\t\t\t\tbackground: attrs.bg ?? \"#ffffff18\",\n\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\tpaddingX: 6,\n\t\t\t\t\tpaddingY: 2,\n\t\t\t\t};\n\t\t\t} else if (tagName === \"span\") {\n\t\t\t\tif (attrs.color || attrs.fill) style.fill = attrs.color ?? attrs.fill;\n\t\t\t\tif (attrs.fontfamily) style.fontFamily = attrs.fontfamily;\n\t\t\t\tif (attrs.fontsize) style.fontSize = parseFloat(attrs.fontsize);\n\t\t\t\tif (attrs.fontweight) {\n\t\t\t\t\tconst nw = parseInt(attrs.fontweight, 10);\n\t\t\t\t\tstyle.fontWeight = Number.isNaN(nw) ? attrs.fontweight : nw;\n\t\t\t\t}\n\t\t\t\tif (attrs.fontstyle === \"italic\" || attrs.fontstyle === \"normal\") {\n\t\t\t\t\tstyle.fontStyle = attrs.fontstyle;\n\t\t\t\t}\n\t\t\t\tif (attrs.letterspacing)\n\t\t\t\t\tstyle.letterSpacing = parseFloat(attrs.letterspacing);\n\t\t\t\tif (attrs.baselineshift)\n\t\t\t\t\tstyle.baselineShift = parseFloat(attrs.baselineshift);\n\t\t\t\tif (attrs.opacity) style.opacity = parseFloat(attrs.opacity);\n\t\t\t}\n\n\t\t\tstack.push({ tag: tagName, style });\n\t\t}\n\t}\n\n\tconst remainingText = markup.slice(lastIndex);\n\tif (remainingText) {\n\t\tspans.push({ text: remainingText, ...getCurrentStyle() });\n\t}\n\n\treturn spans;\n}\n","/**\n * Charts built from ordinary layout nodes. d3 does the math (scales, ticks,\n * line/area/arc geometry, stacking); every bar, line, slice and label is a\n * regular box, shape or text node, so charts use the composition's fonts and\n * can be animated, graded and composited like any other layer.\n */\nimport {\n\ttype BoxNode,\n\tLayerAnimation,\n\ttype LayoutNode,\n} from \"@framefields/compositions/program\";\nimport { format as d3Format } from \"d3-format\";\nimport {\n\ttype ScaleBand,\n\ttype ScaleLinear,\n\ttype ScaleTime,\n\tscaleBand,\n\tscaleLinear,\n\tscaleUtc,\n} from \"d3-scale\";\nimport {\n\ttype CurveFactory,\n\tcurveLinear,\n\tcurveMonotoneX,\n\tcurveStepAfter,\n\tarc as d3Arc,\n\tarea as d3Area,\n\tline as d3Line,\n\tpie as d3Pie,\n\tstack as d3Stack,\n\tstackOffsetDiverging,\n} from \"d3-shape\";\nimport { autoId } from \"./ids.js\";\nimport { type AnimatableNode, Layer } from \"./index.js\";\n\nexport type ChartType =\n\t| \"line\"\n\t| \"area\"\n\t| \"bar\"\n\t| \"scatter\"\n\t| \"pie\"\n\t| \"donut\"\n\t| \"candlestick\";\n\nexport type ChartX = number | string | Date;\n\n/** A plain value (x is its index or `categories[i]`), an `[x, y]` pair, or `{ x, y }`. */\nexport type ChartDatum =\n\t| number\n\t| readonly [ChartX, number]\n\t| { x: ChartX; y: number };\n\nexport interface ChartCandle {\n\tx: ChartX;\n\topen: number;\n\thigh: number;\n\tlow: number;\n\tclose: number;\n}\n\n/** A pie or donut slice. */\nexport interface ChartSlice {\n\tlabel: string;\n\tvalue: number;\n\tcolor?: string;\n}\n\nexport interface ChartSeries {\n\tname?: string;\n\t/** Series type in a combined chart; defaults to the chart's `type`. */\n\ttype?: Exclude<ChartType, \"pie\" | \"donut\">;\n\tdata: readonly ChartDatum[] | readonly ChartCandle[];\n\tcolor?: string;\n\t/** Line width for line and area series. Default 3. */\n\tstrokeWidth?: number;\n\t/** Line and area interpolation. Default \"smooth\". */\n\tcurve?: \"linear\" | \"smooth\" | \"step\";\n\t/** Dot radius drawn on line points; scatter point radius. 0 hides line dots. */\n\tpointRadius?: number;\n}\n\nexport interface ChartAxisOptions {\n\t/** Show tick labels. Default true. */\n\tshow?: boolean;\n\t/** Draw grid lines across the plot. Default true for y, false for x. */\n\tgrid?: boolean;\n\tmin?: number;\n\tmax?: number;\n\t/** Approximate number of ticks. Default 5. */\n\tticks?: number;\n\t/** A d3-format specifier such as \",.0f\", \"$.2s\" or \".0%\", or a function. */\n\tformat?: string | ((value: ChartX) => string);\n}\n\nexport interface ChartAnimationOptions {\n\t/** Frame the reveal starts, relative to the chart's own start. Default 0. */\n\tstart?: number;\n\t/** Frames each element takes to animate in. Default 30. */\n\tduration?: number;\n\t/** Frames between consecutive bars, points or slices. Default spreads them over `duration`. */\n\tstagger?: number;\n\t/** Easing for bars, points and slices. Default \"power3.out\". */\n\tease?: string;\n}\n\nexport interface ChartPadding {\n\ttop?: number;\n\tright?: number;\n\tbottom?: number;\n\tleft?: number;\n}\n\nexport interface ChartOptions {\n\t/** Chart type, and the default for series without their own. Default \"line\". */\n\ttype?: ChartType;\n\twidth?: number;\n\theight?: number;\n\tseries?: readonly ChartSeries[];\n\t/** Shorthand for a single series, or the slices of a pie or donut. */\n\tdata?: readonly ChartDatum[] | readonly ChartCandle[] | readonly ChartSlice[];\n\t/** Labels for x positions when data are plain values; slice labels for pie charts. */\n\tcategories?: readonly string[];\n\t/** Stack bar and area series instead of grouping or overlapping them. */\n\tstacked?: boolean;\n\tcolors?: readonly string[];\n\txAxis?: ChartAxisOptions;\n\tyAxis?: ChartAxisOptions;\n\t/** Space around the plot for axis labels and legend. Computed when omitted. */\n\tpadding?: number | ChartPadding;\n\tfontFamily?: string;\n\t/** Axis, legend and value label size. Default 18. */\n\tfontSize?: number;\n\t/** Axis labels; when set, also the legend and value labels. */\n\ttextColor?: string;\n\tgridColor?: string;\n\tbackground?: string;\n\t/** Show the series or slice legend. Default: on for several series and for pies. */\n\tlegend?: boolean;\n\t/** Print values on bars and slices (pie values print as percentages). */\n\tvalueLabels?: boolean;\n\t/** Donut hole as a fraction of the radius. Default 0.6 for \"donut\". */\n\tinnerRadius?: number;\n\t/** Corner radius of bars and slices. Default 4. */\n\tcornerRadius?: number;\n\tupColor?: string;\n\tdownColor?: string;\n\t/** Reveal animation, or `false` for a static chart. */\n\tanimate?: false | ChartAnimationOptions;\n}\n\nexport const DEFAULT_CHART_COLORS = [\n\t\"#6366f1\",\n\t\"#22d3ee\",\n\t\"#f59e0b\",\n\t\"#ec4899\",\n\t\"#10b981\",\n\t\"#8b5cf6\",\n\t\"#f97316\",\n\t\"#3b82f6\",\n] as const;\n\ntype XScale =\n\t| ScaleBand<string>\n\t| ScaleLinear<number, number>\n\t| ScaleTime<number, number>;\n\ninterface Timing {\n\tenabled: boolean;\n\tstart: number;\n\tduration: number;\n\tstagger: number;\n\tease: string;\n}\n\ninterface Point {\n\tx: ChartX;\n\ty: number;\n}\n\ninterface Rect {\n\tx: number;\n\ty: number;\n\twidth: number;\n\theight: number;\n}\n\nconst isCandle = (d: unknown): d is ChartCandle =>\n\ttypeof d === \"object\" && d !== null && \"open\" in d && \"close\" in d;\n\nconst isSlice = (d: unknown): d is ChartSlice =>\n\ttypeof d === \"object\" && d !== null && \"label\" in d && \"value\" in d;\n\nfunction curveOf(curve: ChartSeries[\"curve\"]): CurveFactory {\n\tif (curve === \"linear\") return curveLinear;\n\tif (curve === \"step\") return curveStepAfter;\n\treturn curveMonotoneX;\n}\n\nfunction withAlpha(color: string, alpha: number): string {\n\tconst hex = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(color.trim());\n\tif (!hex) return color;\n\tlet h = hex[1];\n\tif (h.length === 3) h = [...h].map((c) => c + c).join(\"\");\n\tconst n = parseInt(h, 16);\n\treturn `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;\n}\n\nfunction fmt(\n\taxis: ChartAxisOptions | undefined,\n): ((v: ChartX) => string) | null {\n\tif (!axis?.format) return null;\n\tif (typeof axis.format === \"function\") return axis.format;\n\tconst f = d3Format(axis.format);\n\treturn (v) => (typeof v === \"number\" ? f(v) : String(v));\n}\n\nfunction round(v: number): number {\n\treturn Math.round(v * 100) / 100;\n}\n\nfunction fadeIn(t: Timing, delay = 0, duration = t.duration): LayerAnimation {\n\treturn LayerAnimation.create().fromTo(\"opacity\", 0, 1, {\n\t\tstart: t.start + delay,\n\t\tend: t.start + delay + Math.max(1, duration),\n\t\tease: \"power2.out\",\n\t});\n}\n\n/** Builds the chart as a box of absolutely positioned child nodes. */\nexport function buildChart(\n\toptions: ChartOptions,\n\tprops: Partial<BoxNode>,\n\tdefaultFontFamily: string,\n): AnimatableNode<BoxNode> {\n\tconst id = props.id ?? autoId(\"chart\");\n\tconst width =\n\t\toptions.width ?? (typeof props.width === \"number\" ? props.width : 960);\n\tconst height =\n\t\toptions.height ?? (typeof props.height === \"number\" ? props.height : 540);\n\tconst type = options.type ?? \"line\";\n\tconst fontSize = options.fontSize ?? 18;\n\tconst fontFamily = options.fontFamily ?? defaultFontFamily;\n\tconst textColor = options.textColor ?? \"#94a3b8\";\n\t// Legend and value labels read a little stronger than axis labels; with a custom\n\t// textColor (e.g. dark text on a light background) they use it as is.\n\tconst strongText = options.textColor ?? \"#e2e8f0\";\n\tconst gridColor = options.gridColor ?? \"rgba(148, 163, 184, 0.18)\";\n\tconst colors = options.colors?.length ? options.colors : DEFAULT_CHART_COLORS;\n\tconst radius = options.cornerRadius ?? 4;\n\n\tconst anim = options.animate === false ? undefined : (options.animate ?? {});\n\tconst timing: Timing = {\n\t\tenabled: anim !== undefined,\n\t\tstart: anim?.start ?? 0,\n\t\tduration: anim?.duration ?? 30,\n\t\tstagger: anim?.stagger ?? -1,\n\t\tease: anim?.ease ?? \"power3.out\",\n\t};\n\n\tconst children: LayoutNode[] = [];\n\tconst label = (\n\t\ttext: string,\n\t\trect: Rect,\n\t\talign: \"start\" | \"center\" | \"end\",\n\t\textra: { delay?: number; color?: string; weight?: number } = {},\n\t\tkey = \"\",\n\t) => {\n\t\tconst node = Layer.text(text, {\n\t\t\tid: `${id}-label-${key || children.length}`,\n\t\t\tposition: \"absolute\",\n\t\t\tx: round(rect.x),\n\t\t\ty: round(rect.y),\n\t\t\twidth: round(rect.width),\n\t\t\theight: round(rect.height),\n\t\t\tfontFamily,\n\t\t\tfontSize,\n\t\t\tfontWeight: extra.weight ?? 500,\n\t\t\tfill: extra.color ?? textColor,\n\t\t\talign,\n\t\t\tverticalAlign: \"middle\",\n\t\t});\n\t\tif (timing.enabled) node.animate(fadeIn(timing, extra.delay ?? 0));\n\t\tchildren.push(node);\n\t};\n\n\tconst lineHeight = Math.ceil(fontSize * 1.4);\n\n\tif (type === \"pie\" || type === \"donut\") {\n\t\tbuildPie();\n\t} else {\n\t\tbuildCartesian();\n\t}\n\n\t// Staggers and fractional durations land between frames; the program schema\n\t// wants whole-frame keyframes.\n\tfor (const child of children) snapKeyframes(child);\n\n\treturn Layer.box({\n\t\tbackground: options.background ?? \"transparent\",\n\t\t...props,\n\t\tid,\n\t\twidth,\n\t\theight,\n\t\tchildren,\n\t});\n\n\t// ── pie & donut ─────────────────────────────────────────────────────\n\n\tfunction buildPie(): void {\n\t\tconst slices = collectSlices();\n\t\tconst total = slices.reduce((s, d) => s + Math.max(0, d.value), 0);\n\t\tconst showLegend = options.legend ?? true;\n\t\tconst pad = resolvePadding({\n\t\t\ttop: 16,\n\t\t\tright: showLegend ? legendColumnWidth(slices.map((s) => s.label)) : 16,\n\t\t\tbottom: 16,\n\t\t\tleft: 16,\n\t\t});\n\t\tconst plot = plotRect(pad);\n\t\tconst r = Math.max(1, Math.min(plot.width, plot.height) / 2);\n\t\tconst inner = r * (options.innerRadius ?? (type === \"donut\" ? 0.6 : 0));\n\t\tconst cx = plot.x + plot.width / 2;\n\t\tconst cy = plot.y + plot.height / 2;\n\t\tconst m = 4;\n\t\tconst arcs = d3Pie<ChartSlice>()\n\t\t\t.sort(null)\n\t\t\t.value((d) => Math.max(0, d.value))\n\t\t\t.padAngle(slices.length > 1 ? 0.012 : 0)(slices);\n\t\tconst arcGen = d3Arc<(typeof arcs)[number]>()\n\t\t\t.innerRadius(inner)\n\t\t\t.outerRadius(r)\n\t\t\t.cornerRadius(Math.min(radius, (r - inner) / 2));\n\t\tconst step = staggerStep(arcs.length);\n\n\t\tarcs.forEach((a, i) => {\n\t\t\tconst d = arcGen(a);\n\t\t\tif (!d) return;\n\t\t\tconst color = slices[i].color ?? colors[i % colors.length];\n\t\t\tconst node = Layer.shape(\"path\", {\n\t\t\t\tid: `${id}-slice-${i}`,\n\t\t\t\tposition: \"absolute\",\n\t\t\t\tx: round(cx - r - m),\n\t\t\t\ty: round(cy - r - m),\n\t\t\t\twidth: round(2 * (r + m)),\n\t\t\t\theight: round(2 * (r + m)),\n\t\t\t\td: translatePath(d, r + m, r + m),\n\t\t\t\tfillColor: color,\n\t\t\t\tanchorX: 0.5,\n\t\t\t\tanchorY: 0.5,\n\t\t\t});\n\t\t\tif (timing.enabled) {\n\t\t\t\tconst s = timing.start + i * step;\n\t\t\t\tnode.animate(\n\t\t\t\t\tLayerAnimation.create()\n\t\t\t\t\t\t.fromTo(\"opacity\", 0, 1, {\n\t\t\t\t\t\t\tstart: s,\n\t\t\t\t\t\t\tend: s + timing.duration * 0.5,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.fromTo(\"scale\", 0.85, 1, {\n\t\t\t\t\t\t\tstart: s,\n\t\t\t\t\t\t\tend: s + timing.duration,\n\t\t\t\t\t\t\tease: timing.ease,\n\t\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tchildren.push(node);\n\n\t\t\tif (options.valueLabels && total > 0 && a.value > 0) {\n\t\t\t\tconst [lx, ly] = d3Arc<(typeof arcs)[number]>()\n\t\t\t\t\t.innerRadius(inner || r * 0.55)\n\t\t\t\t\t.outerRadius(r)\n\t\t\t\t\t.centroid(a);\n\t\t\t\tconst pct = `${Math.round((a.value / total) * 100)}%`;\n\t\t\t\tlabel(\n\t\t\t\t\tpct,\n\t\t\t\t\t{\n\t\t\t\t\t\tx: cx + lx - 60,\n\t\t\t\t\t\ty: cy + ly - lineHeight / 2,\n\t\t\t\t\t\twidth: 120,\n\t\t\t\t\t\theight: lineHeight,\n\t\t\t\t\t},\n\t\t\t\t\t\"center\",\n\t\t\t\t\t{\n\t\t\t\t\t\tdelay: i * step + timing.duration * 0.5,\n\t\t\t\t\t\tcolor: \"#ffffff\",\n\t\t\t\t\t\tweight: 700,\n\t\t\t\t\t},\n\t\t\t\t\t`value-${i}`,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\tif (showLegend) {\n\t\t\tlegendColumn(\n\t\t\t\tslices.map((s, i) => ({\n\t\t\t\t\tname: s.label,\n\t\t\t\t\tcolor: s.color ?? colors[i % colors.length],\n\t\t\t\t})),\n\t\t\t\t{ x: plot.x + plot.width + 24, y: plot.y, height: plot.height },\n\t\t\t);\n\t\t}\n\t}\n\n\tfunction collectSlices(): ChartSlice[] {\n\t\tconst raw = (options.data ??\n\t\t\toptions.series?.[0]?.data ??\n\t\t\t[]) as readonly unknown[];\n\t\treturn raw.map((d, i) => {\n\t\t\tif (isSlice(d)) return d;\n\t\t\tconst value =\n\t\t\t\ttypeof d === \"number\"\n\t\t\t\t\t? d\n\t\t\t\t\t: Array.isArray(d)\n\t\t\t\t\t\t? Number(d[1])\n\t\t\t\t\t\t: Number((d as Point).y);\n\t\t\tconst name =\n\t\t\t\toptions.categories?.[i] ??\n\t\t\t\t(Array.isArray(d)\n\t\t\t\t\t? String(d[0])\n\t\t\t\t\t: typeof d === \"object\" && d\n\t\t\t\t\t\t? String((d as Point).x)\n\t\t\t\t\t\t: `${i + 1}`);\n\t\t\treturn { label: name, value };\n\t\t});\n\t}\n\n\t// ── cartesian: line, area, bar, scatter, candlestick ───────────────\n\n\tfunction buildCartesian(): void {\n\t\tconst series: ChartSeries[] = options.series?.length\n\t\t\t? [...options.series]\n\t\t\t: options.data\n\t\t\t\t? [{ data: options.data as ChartSeries[\"data\"] }]\n\t\t\t\t: [];\n\t\tif (series.length === 0) return;\n\n\t\tconst typeOf = (s: ChartSeries) =>\n\t\t\ts.type ?? (type as ChartSeries[\"type\"]) ?? \"line\";\n\t\tconst colorOf = (s: ChartSeries, i: number) =>\n\t\t\ts.color ?? colors[i % colors.length];\n\n\t\t// Normalise every series to points (candles keep their OHLC values).\n\t\tconst points: Point[][] = series.map((s) =>\n\t\t\t(s.data as readonly unknown[]).map((d, i) => {\n\t\t\t\tif (isCandle(d)) return { x: d.x, y: d.close };\n\t\t\t\tif (typeof d === \"number\")\n\t\t\t\t\treturn { x: options.categories?.[i] ?? i, y: d };\n\t\t\t\tif (Array.isArray(d)) return { x: d[0] as ChartX, y: Number(d[1]) };\n\t\t\t\treturn { x: (d as Point).x, y: Number((d as Point).y) };\n\t\t\t}),\n\t\t);\n\n\t\tconst anyBand = series.some(\n\t\t\t(s) => typeOf(s) === \"bar\" || typeOf(s) === \"candlestick\",\n\t\t);\n\t\tconst allX = points.flat().map((p) => p.x);\n\t\tconst xKind: \"band\" | \"time\" | \"linear\" =\n\t\t\tanyBand || allX.some((x) => typeof x === \"string\")\n\t\t\t\t? \"band\"\n\t\t\t\t: allX.some((x) => x instanceof Date)\n\t\t\t\t\t? \"time\"\n\t\t\t\t\t: \"linear\";\n\n\t\t// Stacking for bars and areas.\n\t\tconst stackable = (s: ChartSeries) =>\n\t\t\ttypeOf(s) === \"bar\" || typeOf(s) === \"area\";\n\t\tconst stacked = !!options.stacked;\n\t\tconst categories = xKind === \"band\" ? [...new Set(allX.map(String))] : [];\n\t\tconst stackRanges = new Map<number, [number, number][]>();\n\t\tif (stacked) {\n\t\t\tconst keys = series.map((_, i) => i).filter((i) => stackable(series[i]));\n\t\t\tconst rows = categories.length\n\t\t\t\t? categories\n\t\t\t\t: [...new Set(allX.map((x) => +x))].sort((a, b) => a - b).map(String);\n\t\t\tconst table = rows.map((key) => {\n\t\t\t\tconst row: Record<string, number> = {};\n\t\t\t\tfor (const i of keys) {\n\t\t\t\t\tconst p = points[i].find(\n\t\t\t\t\t\t(pt) => String(xKind === \"band\" ? pt.x : +pt.x) === key,\n\t\t\t\t\t);\n\t\t\t\t\trow[i] = p?.y ?? 0;\n\t\t\t\t}\n\t\t\t\treturn row;\n\t\t\t});\n\t\t\tconst layers = d3Stack<Record<string, number>>()\n\t\t\t\t.keys(keys.map(String))\n\t\t\t\t.offset(stackOffsetDiverging)(table);\n\t\t\tlayers.forEach((layer) => {\n\t\t\t\tconst i = Number(layer.key);\n\t\t\t\tstackRanges.set(\n\t\t\t\t\ti,\n\t\t\t\t\tpoints[i].map((p) => {\n\t\t\t\t\t\tconst idx = rows.indexOf(String(xKind === \"band\" ? p.x : +p.x));\n\t\t\t\t\t\treturn [layer[idx][0], layer[idx][1]];\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\t// y domain\n\t\tconst yValues: number[] = [0];\n\t\tseries.forEach((s, i) => {\n\t\t\tconst range = stackRanges.get(i);\n\t\t\tif (typeOf(s) === \"candlestick\") {\n\t\t\t\tfor (const c of s.data as readonly ChartCandle[])\n\t\t\t\t\tyValues.push(c.high, c.low);\n\t\t\t} else if (range) {\n\t\t\t\tfor (const [a, b] of range) yValues.push(a, b);\n\t\t\t} else {\n\t\t\t\tfor (const p of points[i]) yValues.push(p.y);\n\t\t\t}\n\t\t});\n\t\tif (\n\t\t\tseries.every(\n\t\t\t\t(s) =>\n\t\t\t\t\ttypeOf(s) === \"candlestick\" ||\n\t\t\t\t\ttypeOf(s) === \"scatter\" ||\n\t\t\t\t\ttypeOf(s) === \"line\",\n\t\t\t)\n\t\t) {\n\t\t\t// Line, scatter and price charts don't have to include zero.\n\t\t\tyValues.shift();\n\t\t}\n\n\t\tconst yAxis = options.yAxis ?? {};\n\t\tconst xAxis = options.xAxis ?? {};\n\t\tconst yTickCount = yAxis.ticks ?? 5;\n\t\tlet lo = yAxis.min ?? Math.min(...yValues);\n\t\tlet hi = yAxis.max ?? Math.max(...yValues);\n\t\tif (!Number.isFinite(lo) || !Number.isFinite(hi)) [lo, hi] = [0, 1];\n\t\tif (lo === hi) [lo, hi] = [lo - 1, hi + 1];\n\t\tconst y = scaleLinear().domain([lo, hi]);\n\t\tif (yAxis.min === undefined || yAxis.max === undefined) y.nice(yTickCount);\n\t\tconst yFormat =\n\t\t\tfmt(yAxis) ?? ((v: ChartX) => y.tickFormat(yTickCount)(v as number));\n\t\tconst yTicks = y.ticks(yTickCount);\n\n\t\tconst legendItems = series.map((s, i) => ({\n\t\t\tname: s.name ?? `Series ${i + 1}`,\n\t\t\tcolor: colorOf(s, i),\n\t\t}));\n\t\tconst showLegend = options.legend ?? series.length > 1;\n\t\tconst showY = yAxis.show !== false;\n\t\tconst showX = xAxis.show !== false;\n\t\tconst yLabelWidth = showY\n\t\t\t? Math.max(...yTicks.map((t) => yFormat(t).length)) * fontSize * 0.7 + 20\n\t\t\t: 0;\n\t\tconst pad = resolvePadding({\n\t\t\ttop: (showLegend ? lineHeight + 20 : 0) + Math.ceil(lineHeight / 2),\n\t\t\tright: 20,\n\t\t\tbottom: showX ? lineHeight + 14 : 12,\n\t\t\tleft: Math.max(16, Math.ceil(yLabelWidth)),\n\t\t});\n\t\tconst plot = plotRect(pad);\n\t\t// Room for value labels above positive bars and below negative ones.\n\t\tconst labelRoom = lineHeight + 6;\n\t\tconst barValues = options.valueLabels\n\t\t\t? series.flatMap((s, i) =>\n\t\t\t\t\ttypeOf(s) === \"bar\" ? points[i].map((p) => p.y) : [],\n\t\t\t\t)\n\t\t\t: [];\n\t\tconst topInset = barValues.some((v) => v > 0) ? labelRoom : 0;\n\t\tconst bottomInset = barValues.some((v) => v < 0) ? labelRoom : 0;\n\t\ty.range([plot.height - bottomInset, topInset]);\n\n\t\tlet x: XScale;\n\t\tif (xKind === \"band\") {\n\t\t\tx = scaleBand<string>()\n\t\t\t\t.domain(categories)\n\t\t\t\t.range([0, plot.width])\n\t\t\t\t.paddingInner(anyBand ? 0.28 : 0)\n\t\t\t\t.paddingOuter(anyBand ? 0.14 : 0.5);\n\t\t} else if (xKind === \"time\") {\n\t\t\tconst xs = allX.map((v) => +new Date(v as Date));\n\t\t\tx = scaleUtc()\n\t\t\t\t.domain([Math.min(...xs), Math.max(...xs)])\n\t\t\t\t.range([0, plot.width]);\n\t\t} else {\n\t\t\tconst xs = allX.map(Number);\n\t\t\tx = scaleLinear()\n\t\t\t\t.domain([xAxis.min ?? Math.min(...xs), xAxis.max ?? Math.max(...xs)])\n\t\t\t\t.range([0, plot.width]);\n\t\t}\n\t\tconst xPos = (v: ChartX): number => {\n\t\t\tif (xKind === \"band\") {\n\t\t\t\tconst b = x as ScaleBand<string>;\n\t\t\t\treturn (b(String(v)) ?? 0) + b.bandwidth() / 2;\n\t\t\t}\n\t\t\tif (xKind === \"time\")\n\t\t\t\treturn (x as ScaleTime<number, number>)(new Date(v as Date));\n\t\t\treturn (x as ScaleLinear<number, number>)(Number(v));\n\t\t};\n\n\t\t// Grid and y labels.\n\t\tconst gridDelay = 0;\n\t\tif (yAxis.grid !== false) {\n\t\t\tyTicks.forEach((t, i) => {\n\t\t\t\tconst node = Layer.box({\n\t\t\t\t\tid: `${id}-ygrid-${i}`,\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\tx: plot.x,\n\t\t\t\t\ty: round(plot.y + y(t) - 0.5),\n\t\t\t\t\twidth: plot.width,\n\t\t\t\t\theight: 1,\n\t\t\t\t\tbackground: gridColor,\n\t\t\t\t});\n\t\t\t\tif (timing.enabled)\n\t\t\t\t\tnode.animate(fadeIn(timing, gridDelay, timing.duration / 2));\n\t\t\t\tchildren.push(node);\n\t\t\t});\n\t\t}\n\t\tif (showY) {\n\t\t\tyTicks.forEach((t, i) => {\n\t\t\t\tlabel(\n\t\t\t\t\tyFormat(t),\n\t\t\t\t\t{\n\t\t\t\t\t\tx: 0,\n\t\t\t\t\t\ty: plot.y + y(t) - lineHeight / 2,\n\t\t\t\t\t\twidth: plot.x - 12,\n\t\t\t\t\t\theight: lineHeight,\n\t\t\t\t\t},\n\t\t\t\t\t\"end\",\n\t\t\t\t\t{},\n\t\t\t\t\t`y-${i}`,\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\t// x labels (and optional vertical grid).\n\t\tconst xTicks: { pos: number; text: string }[] = [];\n\t\tconst xFormat = fmt(xAxis);\n\t\tif (xKind === \"band\") {\n\t\t\tconst b = x as ScaleBand<string>;\n\t\t\tconst every = Math.max(\n\t\t\t\t1,\n\t\t\t\tMath.ceil(\n\t\t\t\t\tcategories.length /\n\t\t\t\t\t\tMath.max(1, Math.floor(plot.width / (fontSize * 4))),\n\t\t\t\t),\n\t\t\t);\n\t\t\tcategories.forEach((c, i) => {\n\t\t\t\tif (i % every === 0)\n\t\t\t\t\txTicks.push({\n\t\t\t\t\t\tpos: (b(c) ?? 0) + b.bandwidth() / 2,\n\t\t\t\t\t\ttext: xFormat ? xFormat(c) : c,\n\t\t\t\t\t});\n\t\t\t});\n\t\t} else {\n\t\t\tconst s = x as ScaleLinear<number, number>;\n\t\t\tconst count =\n\t\t\t\txAxis.ticks ?? Math.max(2, Math.floor(plot.width / (fontSize * 6)));\n\t\t\tconst tf = s.tickFormat(count);\n\t\t\tfor (const t of s.ticks(count)) {\n\t\t\t\txTicks.push({\n\t\t\t\t\tpos: s(t),\n\t\t\t\t\ttext: xFormat ? xFormat(xKind === \"time\" ? new Date(t) : t) : tf(t),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tif (xAxis.grid) {\n\t\t\txTicks.forEach((t, i) => {\n\t\t\t\tconst node = Layer.box({\n\t\t\t\t\tid: `${id}-xgrid-${i}`,\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\tx: round(plot.x + t.pos - 0.5),\n\t\t\t\t\ty: plot.y,\n\t\t\t\t\twidth: 1,\n\t\t\t\t\theight: plot.height,\n\t\t\t\t\tbackground: gridColor,\n\t\t\t\t});\n\t\t\t\tif (timing.enabled)\n\t\t\t\t\tnode.animate(fadeIn(timing, gridDelay, timing.duration / 2));\n\t\t\t\tchildren.push(node);\n\t\t\t});\n\t\t}\n\t\tif (showX) {\n\t\t\tconst slot = Math.max(\n\t\t\t\tfontSize * 3,\n\t\t\t\tplot.width / Math.max(1, xTicks.length),\n\t\t\t);\n\t\t\txTicks.forEach((t, i) => {\n\t\t\t\tlabel(\n\t\t\t\t\tt.text,\n\t\t\t\t\t{\n\t\t\t\t\t\tx: plot.x + t.pos - slot / 2,\n\t\t\t\t\t\ty: plot.y + plot.height + 10,\n\t\t\t\t\t\twidth: slot,\n\t\t\t\t\t\theight: lineHeight,\n\t\t\t\t\t},\n\t\t\t\t\t\"center\",\n\t\t\t\t\t{},\n\t\t\t\t\t`x-${i}`,\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\t// Baseline at zero when it is inside the domain.\n\t\tconst [y0, y1] = y.domain();\n\t\tif (y0 <= 0 && y1 >= 0 && anyBand) {\n\t\t\tconst node = Layer.box({\n\t\t\t\tid: `${id}-zero`,\n\t\t\t\tposition: \"absolute\",\n\t\t\t\tx: plot.x,\n\t\t\t\ty: round(plot.y + y(0) - 1),\n\t\t\t\twidth: plot.width,\n\t\t\t\theight: 2,\n\t\t\t\tbackground: withAlpha(\"#94a3b8\", 0.45),\n\t\t\t});\n\t\t\tif (timing.enabled) node.animate(fadeIn(timing, 0, timing.duration / 2));\n\t\t\tchildren.push(node);\n\t\t}\n\n\t\t// Series. Bars first so lines draw on top.\n\t\tconst barSeries = series\n\t\t\t.map((_, i) => i)\n\t\t\t.filter((i) => typeOf(series[i]) === \"bar\");\n\t\tconst order = [\n\t\t\t...barSeries,\n\t\t\t...series\n\t\t\t\t.map((_, i) => i)\n\t\t\t\t.filter((i) => typeOf(series[i]) === \"candlestick\"),\n\t\t\t...series.map((_, i) => i).filter((i) => typeOf(series[i]) === \"area\"),\n\t\t\t...series.map((_, i) => i).filter((i) => typeOf(series[i]) === \"line\"),\n\t\t\t...series.map((_, i) => i).filter((i) => typeOf(series[i]) === \"scatter\"),\n\t\t];\n\n\t\tconst band = xKind === \"band\" ? (x as ScaleBand<string>) : null;\n\t\tconst bandStep = band ? staggerStep(categories.length) : 0;\n\t\tconst categoryIndex = (v: ChartX) =>\n\t\t\tband ? categories.indexOf(String(v)) : 0;\n\n\t\torder.forEach((si, rank) => {\n\t\t\tconst s = series[si];\n\t\t\tconst color = colorOf(s, si);\n\t\t\tconst kind = typeOf(s);\n\t\t\tconst pts = points[si];\n\t\t\tconst range = stackRanges.get(si);\n\n\t\t\tif (kind === \"bar\" && band) {\n\t\t\t\tconst groupSize = stacked ? 1 : barSeries.length;\n\t\t\t\tconst groupIdx = stacked ? 0 : barSeries.indexOf(si);\n\t\t\t\tconst bw = band.bandwidth() / groupSize;\n\t\t\t\tconst gap = groupSize > 1 ? Math.min(4, bw * 0.12) : 0;\n\t\t\t\tpts.forEach((p, i) => {\n\t\t\t\t\tconst [lo, hi] = range ? range[i] : [0, p.y];\n\t\t\t\t\tconst top = plot.y + y(Math.max(lo, hi));\n\t\t\t\t\tconst bottom = plot.y + y(Math.min(lo, hi));\n\t\t\t\t\tconst h = Math.max(0, bottom - top);\n\t\t\t\t\tconst bx =\n\t\t\t\t\t\tplot.x + (band(String(p.x)) ?? 0) + groupIdx * bw + gap / 2;\n\t\t\t\t\tconst grows = p.y >= 0 ? \"up\" : \"down\";\n\t\t\t\t\tconst node = Layer.box({\n\t\t\t\t\t\tid: `${id}-bar-${si}-${i}`,\n\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\tx: round(bx),\n\t\t\t\t\t\ty: round(top),\n\t\t\t\t\t\twidth: round(Math.max(1, bw - gap)),\n\t\t\t\t\t\theight: round(h),\n\t\t\t\t\t\tbackground: color,\n\t\t\t\t\t\tborderRadius: Math.min(radius, (bw - gap) / 2, h / 2),\n\t\t\t\t\t});\n\t\t\t\t\tconst delay =\n\t\t\t\t\t\tcategoryIndex(p.x) * bandStep +\n\t\t\t\t\t\t(stacked ? barSeries.indexOf(si) * timing.duration * 0.6 : 0);\n\t\t\t\t\tif (timing.enabled) {\n\t\t\t\t\t\tconst st = timing.start + delay;\n\t\t\t\t\t\tconst end = st + timing.duration;\n\t\t\t\t\t\tconst a = LayerAnimation.create().fromTo(\"height\", 0, round(h), {\n\t\t\t\t\t\t\tstart: st,\n\t\t\t\t\t\t\tend,\n\t\t\t\t\t\t\tease: timing.ease,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (grows === \"up\") {\n\t\t\t\t\t\t\ta.fromTo(\"y\", round(top + h), round(top), {\n\t\t\t\t\t\t\t\tstart: st,\n\t\t\t\t\t\t\t\tend,\n\t\t\t\t\t\t\t\tease: timing.ease,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnode.animate(a);\n\t\t\t\t\t}\n\t\t\t\t\tchildren.push(node);\n\t\t\t\t\tif (options.valueLabels) {\n\t\t\t\t\t\tconst text = yFormat(p.y);\n\t\t\t\t\t\tconst ly = grows === \"up\" ? top - lineHeight - 4 : top + h + 4;\n\t\t\t\t\t\tlabel(\n\t\t\t\t\t\t\ttext,\n\t\t\t\t\t\t\t{ x: bx - 30, y: ly, width: bw - gap + 60, height: lineHeight },\n\t\t\t\t\t\t\t\"center\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdelay: delay + timing.duration * 0.6,\n\t\t\t\t\t\t\t\tcolor: strongText,\n\t\t\t\t\t\t\t\tweight: 600,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t`value-${si}-${i}`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (kind === \"candlestick\" && band) {\n\t\t\t\tconst up = options.upColor ?? \"#22c55e\";\n\t\t\t\tconst down = options.downColor ?? \"#ef4444\";\n\t\t\t\tconst bw = band.bandwidth();\n\t\t\t\t(s.data as readonly ChartCandle[]).forEach((c, i) => {\n\t\t\t\t\tconst col = c.close >= c.open ? up : down;\n\t\t\t\t\tconst cxp = plot.x + (band(String(c.x)) ?? 0) + bw / 2;\n\t\t\t\t\tconst delay = categoryIndex(c.x) * bandStep;\n\t\t\t\t\tconst parts: [string, Rect][] = [\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"wick\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tx: cxp - Math.max(1, bw * 0.06),\n\t\t\t\t\t\t\t\ty: plot.y + y(c.high),\n\t\t\t\t\t\t\t\twidth: Math.max(2, bw * 0.12),\n\t\t\t\t\t\t\t\theight: Math.max(1, y(c.low) - y(c.high)),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"body\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tx: cxp - bw / 2,\n\t\t\t\t\t\t\t\ty: plot.y + y(Math.max(c.open, c.close)),\n\t\t\t\t\t\t\t\twidth: bw,\n\t\t\t\t\t\t\t\theight: Math.max(2, Math.abs(y(c.open) - y(c.close))),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t];\n\t\t\t\t\tfor (const [part, r] of parts) {\n\t\t\t\t\t\tconst node = Layer.box({\n\t\t\t\t\t\t\tid: `${id}-candle-${si}-${i}-${part}`,\n\t\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\t\tx: round(r.x),\n\t\t\t\t\t\t\ty: round(r.y),\n\t\t\t\t\t\t\twidth: round(r.width),\n\t\t\t\t\t\t\theight: round(r.height),\n\t\t\t\t\t\t\tbackground: col,\n\t\t\t\t\t\t\tborderRadius:\n\t\t\t\t\t\t\t\tpart === \"body\" ? Math.min(radius / 2, r.width / 2) : 0,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (timing.enabled) {\n\t\t\t\t\t\t\tconst st = timing.start + delay;\n\t\t\t\t\t\t\tconst mid = r.y + r.height / 2;\n\t\t\t\t\t\t\tnode.animate(\n\t\t\t\t\t\t\t\tLayerAnimation.create()\n\t\t\t\t\t\t\t\t\t.fromTo(\"height\", 0, round(r.height), {\n\t\t\t\t\t\t\t\t\t\tstart: st,\n\t\t\t\t\t\t\t\t\t\tend: st + timing.duration,\n\t\t\t\t\t\t\t\t\t\tease: timing.ease,\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t.fromTo(\"y\", round(mid), round(r.y), {\n\t\t\t\t\t\t\t\t\t\tstart: st,\n\t\t\t\t\t\t\t\t\t\tend: st + timing.duration,\n\t\t\t\t\t\t\t\t\t\tease: timing.ease,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchildren.push(node);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (kind === \"line\" || kind === \"area\") {\n\t\t\t\tconst sw = s.strokeWidth ?? 3;\n\t\t\t\tconst m = Math.ceil(sw * 2 + (s.pointRadius ?? 0) + 2);\n\t\t\t\tconst xy = pts.map((p, i) => ({\n\t\t\t\t\tx: xPos(p.x) + m,\n\t\t\t\t\ttop: (range ? y(range[i][1]) : y(p.y)) + m,\n\t\t\t\t\tbase:\n\t\t\t\t\t\t(range\n\t\t\t\t\t\t\t? y(range[i][0])\n\t\t\t\t\t\t\t: y(Math.max(y.domain()[0], Math.min(0, y.domain()[1])))) + m,\n\t\t\t\t}));\n\t\t\t\tconst curve = curveOf(s.curve);\n\t\t\t\tconst frame: Rect = {\n\t\t\t\t\tx: plot.x - m,\n\t\t\t\t\ty: plot.y - m,\n\t\t\t\t\twidth: plot.width + 2 * m,\n\t\t\t\t\theight: plot.height + 2 * m,\n\t\t\t\t};\n\t\t\t\tconst delay = rank * (timing.duration / 3);\n\n\t\t\t\tif (kind === \"area\") {\n\t\t\t\t\tconst d = d3Area<(typeof xy)[number]>()\n\t\t\t\t\t\t.x((p) => p.x)\n\t\t\t\t\t\t.y0((p) => p.base)\n\t\t\t\t\t\t.y1((p) => p.top)\n\t\t\t\t\t\t.curve(curve)(xy);\n\t\t\t\t\tif (d) {\n\t\t\t\t\t\tconst node = Layer.shape(\"path\", {\n\t\t\t\t\t\t\tid: `${id}-area-${si}`,\n\t\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\t\t...roundRect(frame),\n\t\t\t\t\t\t\td: roundPath(d),\n\t\t\t\t\t\t\tfillType: \"linear\",\n\t\t\t\t\t\t\tfillColor: withAlpha(color, 0.45),\n\t\t\t\t\t\t\tgradientEndColor: withAlpha(color, 0.02),\n\t\t\t\t\t\t\tgradientAngle: 90,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (timing.enabled)\n\t\t\t\t\t\t\tnode.animate(\n\t\t\t\t\t\t\t\tfadeIn(timing, delay + timing.duration * 0.4, timing.duration),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tchildren.push(node);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst d = d3Line<(typeof xy)[number]>()\n\t\t\t\t\t.x((p) => p.x)\n\t\t\t\t\t.y((p) => p.top)\n\t\t\t\t\t.curve(curve)(xy);\n\t\t\t\tif (d && sw > 0) {\n\t\t\t\t\tconst node = Layer.shape(\"path\", {\n\t\t\t\t\t\tid: `${id}-line-${si}`,\n\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\t...roundRect(frame),\n\t\t\t\t\t\td: roundPath(d),\n\t\t\t\t\t\tfillType: \"none\",\n\t\t\t\t\t\tstrokeColor: color,\n\t\t\t\t\t\tstrokeWidth: sw,\n\t\t\t\t\t\tstrokeLineCap: \"round\",\n\t\t\t\t\t\tstrokeLineJoin: \"round\",\n\t\t\t\t\t});\n\t\t\t\t\tif (timing.enabled) {\n\t\t\t\t\t\tnode.animate(\n\t\t\t\t\t\t\tLayerAnimation.create().fromTo(\"trimEnd\", 0, 1, {\n\t\t\t\t\t\t\t\tstart: timing.start + delay,\n\t\t\t\t\t\t\t\tend: timing.start + delay + timing.duration * 1.5,\n\t\t\t\t\t\t\t\tease: \"power2.inOut\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tchildren.push(node);\n\t\t\t\t}\n\n\t\t\t\tif ((s.pointRadius ?? 0) > 0) {\n\t\t\t\t\tdots(\n\t\t\t\t\t\tsi,\n\t\t\t\t\t\tpts,\n\t\t\t\t\t\tcolor,\n\t\t\t\t\t\ts.pointRadius ?? 0,\n\t\t\t\t\t\tdelay + timing.duration * 0.5,\n\t\t\t\t\t\trange,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (kind === \"scatter\") {\n\t\t\t\tdots(\n\t\t\t\t\tsi,\n\t\t\t\t\tpts,\n\t\t\t\t\tcolor,\n\t\t\t\t\ts.pointRadius ?? 6,\n\t\t\t\t\trank * (timing.duration / 3),\n\t\t\t\t\trange,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\tif (showLegend) legendRow(legendItems);\n\n\t\tfunction dots(\n\t\t\tsi: number,\n\t\t\tpts: Point[],\n\t\t\tcolor: string,\n\t\t\tr: number,\n\t\t\tbaseDelay: number,\n\t\t\trange: [number, number][] | undefined,\n\t\t): void {\n\t\t\tconst step = staggerStep(pts.length);\n\t\t\tpts.forEach((p, i) => {\n\t\t\t\tconst py = range ? y(range[i][1]) : y(p.y);\n\t\t\t\tconst node = Layer.shape(\"circle\", {\n\t\t\t\t\tid: `${id}-point-${si}-${i}`,\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\tx: round(plot.x + xPos(p.x) - r),\n\t\t\t\t\ty: round(plot.y + py - r),\n\t\t\t\t\twidth: round(r * 2),\n\t\t\t\t\theight: round(r * 2),\n\t\t\t\t\tfillColor: color,\n\t\t\t\t\tanchorX: 0.5,\n\t\t\t\t\tanchorY: 0.5,\n\t\t\t\t});\n\t\t\t\tif (timing.enabled) {\n\t\t\t\t\tconst st = timing.start + baseDelay + i * step;\n\t\t\t\t\tnode.animate(\n\t\t\t\t\t\tLayerAnimation.create()\n\t\t\t\t\t\t\t.fromTo(\"scale\", 0, 1, {\n\t\t\t\t\t\t\t\tstart: st,\n\t\t\t\t\t\t\t\tend: st + timing.duration * 0.6,\n\t\t\t\t\t\t\t\tease: \"back.out(2)\",\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.fromTo(\"opacity\", 0, 1, { start: st, end: st + 6 }),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tchildren.push(node);\n\t\t\t});\n\t\t}\n\t}\n\n\t// ── shared helpers ──────────────────────────────────────────────────\n\n\tfunction staggerStep(count: number): number {\n\t\tif (!timing.enabled || count <= 1) return 0;\n\t\tif (timing.stagger >= 0) return timing.stagger;\n\t\treturn Math.min(4, timing.duration / count);\n\t}\n\n\tfunction resolvePadding(\n\t\tauto: Required<ChartPadding>,\n\t): Required<ChartPadding> {\n\t\tconst p = options.padding;\n\t\tif (typeof p === \"number\") return { top: p, right: p, bottom: p, left: p };\n\t\treturn {\n\t\t\ttop: p?.top ?? auto.top,\n\t\t\tright: p?.right ?? auto.right,\n\t\t\tbottom: p?.bottom ?? auto.bottom,\n\t\t\tleft: p?.left ?? auto.left,\n\t\t};\n\t}\n\n\tfunction plotRect(p: Required<ChartPadding>): Rect {\n\t\treturn {\n\t\t\tx: p.left,\n\t\t\ty: p.top,\n\t\t\twidth: Math.max(1, width - p.left - p.right),\n\t\t\theight: Math.max(1, height - p.top - p.bottom),\n\t\t};\n\t}\n\n\tfunction legendColumnWidth(names: string[]): number {\n\t\tconst longest = Math.max(0, ...names.map((n) => n.length));\n\t\treturn Math.min(width * 0.4, longest * fontSize * 0.6 + fontSize + 48);\n\t}\n\n\tfunction legendColumn(\n\t\titems: { name: string; color: string }[],\n\t\tat: { x: number; y: number; height: number },\n\t): void {\n\t\tconst rowH = lineHeight + 8;\n\t\tconst top = at.y + Math.max(0, (at.height - items.length * rowH) / 2);\n\t\titems.forEach((item, i) => {\n\t\t\tlegendItem(item, at.x, top + i * rowH, i);\n\t\t});\n\t}\n\n\tfunction legendRow(items: { name: string; color: string }[]): void {\n\t\tconst widths = items.map(\n\t\t\t(it) => it.name.length * fontSize * 0.6 + fontSize + 28,\n\t\t);\n\t\tconst total = widths.reduce((a, b) => a + b, 0);\n\t\tlet cursor = Math.max(0, width - total - 20);\n\t\titems.forEach((item, i) => {\n\t\t\tlegendItem(item, cursor, 4, i);\n\t\t\tcursor += widths[i];\n\t\t});\n\t}\n\n\tfunction legendItem(\n\t\titem: { name: string; color: string },\n\t\tlx: number,\n\t\tly: number,\n\t\ti: number,\n\t): void {\n\t\tconst sw = Math.round(fontSize * 0.7);\n\t\tconst swatch = Layer.box({\n\t\t\tid: `${id}-legend-swatch-${i}`,\n\t\t\tposition: \"absolute\",\n\t\t\tx: round(lx),\n\t\t\ty: round(ly + (lineHeight - sw) / 2),\n\t\t\twidth: sw,\n\t\t\theight: sw,\n\t\t\tborderRadius: Math.round(sw / 4),\n\t\t\tbackground: item.color,\n\t\t});\n\t\tif (timing.enabled) swatch.animate(fadeIn(timing, 0, timing.duration / 2));\n\t\tchildren.push(swatch);\n\t\tlabel(\n\t\t\titem.name,\n\t\t\t{\n\t\t\t\tx: lx + sw + 8,\n\t\t\t\ty: ly,\n\t\t\t\twidth: item.name.length * fontSize * 0.6 + 12,\n\t\t\t\theight: lineHeight,\n\t\t\t},\n\t\t\t\"start\",\n\t\t\t{ color: options.textColor ?? \"#cbd5e1\" },\n\t\t\t`legend-${i}`,\n\t\t);\n\t}\n}\n\nfunction snapKeyframes(node: LayoutNode): void {\n\tfor (const track of node.animation?.tracks ?? []) {\n\t\tfor (const kf of track.keyframes ?? []) kf.frame = Math.round(kf.frame);\n\t}\n\tfor (const child of (node as { children?: LayoutNode[] }).children ?? []) {\n\t\tsnapKeyframes(child);\n\t}\n}\n\nfunction roundRect(r: Rect): Rect {\n\treturn {\n\t\tx: round(r.x),\n\t\ty: round(r.y),\n\t\twidth: round(r.width),\n\t\theight: round(r.height),\n\t};\n}\n\n/** Shortens the long float literals d3 emits. */\nfunction roundPath(d: string): string {\n\treturn d.replace(/-?\\d*\\.\\d{3,}(?:e-?\\d+)?/gi, (n) =>\n\t\tString(round(Number(n))),\n\t);\n}\n\n/** Offsets an absolute SVG path (as produced by d3-arc) by dx, dy. */\nfunction translatePath(d: string, dx: number, dy: number): string {\n\t// d3-arc emits M/L/A/Z with absolute coordinates; A has 7 params, of which\n\t// the last two are the endpoint.\n\tconst out: string[] = [];\n\tconst re = /([MLAZ])([^MLAZ]*)/gi;\n\tfor (const [, cmd, args] of d.matchAll(re)) {\n\t\tconst nums = (args.match(/-?\\d*\\.?\\d+(?:e-?\\d+)?/gi) ?? []).map(Number);\n\t\tif (cmd.toUpperCase() === \"A\") {\n\t\t\tfor (let i = 0; i + 6 < nums.length; i += 7) {\n\t\t\t\tnums[i + 5] += dx;\n\t\t\t\tnums[i + 6] += dy;\n\t\t\t}\n\t\t} else if (cmd.toUpperCase() !== \"Z\") {\n\t\t\tfor (let i = 0; i + 1 < nums.length; i += 2) {\n\t\t\t\tnums[i] += dx;\n\t\t\t\tnums[i + 1] += dy;\n\t\t\t}\n\t\t}\n\t\tout.push(cmd + nums.map(round).join(\",\"));\n\t}\n\treturn out.join(\"\");\n}\n","import type {\n\tBoxNode,\n\tLayoutNode,\n\tMaterialType,\n\tModel3DNode,\n} from \"@framefields/compositions/program\";\nimport {\n\ttype CylinderGeometryOptions,\n\tgenerateExtrudedTextGeometry,\n\tgetPrimitiveGeometry,\n\ttype Model3DData,\n\ttype PrimitiveGeometryOptions,\n\ttype RoundedBoxGeometryOptions,\n\tSlugFontCache,\n\ttype SphereGeometryOptions,\n} from \"@framefields/webgpu-renderers\";\nimport { autoId } from \"./ids.js\";\nimport { type AnimatableNode, Layer } from \"./index.js\";\n\n/** Physically based surface options every 3D builder accepts. */\nexport interface Surface3DOptions {\n\t/** Light the surface gives off: a CSS color added on top of lighting. */\n\temissive?: string;\n\t/** Emissive multiplier; above 1 glows past white and blooms. Default 1. */\n\temissiveIntensity?: number;\n\t/** Falls into a `castShadow` light's shadow map (meshes default on, flat layers off). */\n\tcastShadow?: boolean;\n}\n\nconst MATERIAL_KEYS = [\n\t\"material\",\n\t\"shininess\",\n\t\"roughness\",\n\t\"specularIntensity\",\n\t\"metallic\",\n\t\"ambientIntensity\",\n\t\"ior\",\n\t\"transmission\",\n\t\"dispersion\",\n\t\"fresnelPower\",\n\t\"envIntensity\",\n\t\"emissive\",\n\t\"emissiveIntensity\",\n\t\"castShadow\",\n] as const;\n\n/** The material and surface options that were actually given. */\nfunction materialProps(o: object): Record<string, unknown> {\n\tconst src = o as Record<string, unknown>;\n\tconst out: Record<string, unknown> = {};\n\tfor (const k of MATERIAL_KEYS) {\n\t\tif (src[k] !== undefined) out[k] = src[k];\n\t}\n\treturn out;\n}\n\nexport interface CubeFaceConfig extends Surface3DOptions {\n\tbackground?: string;\n\tborderRadius?: number;\n\tborderWidth?: number;\n\tborderColor?: string;\n\topacity?: number;\n\tmaterial?: MaterialType;\n\tshininess?: number;\n\troughness?: number;\n\tspecularIntensity?: number;\n\tmetallic?: number;\n\tambientIntensity?: number;\n\tior?: number;\n\ttransmission?: number;\n\tdispersion?: number;\n\tfresnelPower?: number;\n\tenvIntensity?: number;\n\tchildren?: LayoutNode[];\n}\n\nexport type CubeFaceInput = CubeFaceConfig | LayoutNode | string;\n\nexport interface Cube3DOptions extends Surface3DOptions {\n\tid?: string;\n\tsize: number | [number, number, number];\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\tfaces?: {\n\t\tfront?: CubeFaceInput;\n\t\tback?: CubeFaceInput;\n\t\tleft?: CubeFaceInput;\n\t\tright?: CubeFaceInput;\n\t\ttop?: CubeFaceInput;\n\t\tbottom?: CubeFaceInput;\n\t};\n\ttwoSided?: boolean;\n\tmaterial?: MaterialType;\n\tshininess?: number;\n\troughness?: number;\n\tspecularIntensity?: number;\n\tmetallic?: number;\n\tambientIntensity?: number;\n\tior?: number;\n\ttransmission?: number;\n\tdispersion?: number;\n\tfresnelPower?: number;\n\tenvIntensity?: number;\n\topacity?: number;\n}\n\nexport interface Carousel3DOptions {\n\tid?: string;\n\tradius: number;\n\titems: LayoutNode[];\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\tfaceInward?: boolean;\n\titemWidth?: number;\n\titemHeight?: number;\n\ttwoSided?: boolean;\n\topacity?: number;\n}\n\nexport interface Prism3DOptions {\n\tid?: string;\n\tsides: number;\n\tradius: number;\n\theight: number;\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\tsideConfigs?: Array<CubeFaceInput>;\n\ttwoSided?: boolean;\n\tmaterial?: MaterialType;\n\tshininess?: number;\n\troughness?: number;\n\tspecularIntensity?: number;\n\tmetallic?: number;\n\tambientIntensity?: number;\n\tior?: number;\n\ttransmission?: number;\n\tdispersion?: number;\n\tfresnelPower?: number;\n\tenvIntensity?: number;\n\topacity?: number;\n}\n\nexport interface Plane3DOptions extends Surface3DOptions {\n\tid?: string;\n\twidth: number;\n\theight: number;\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\tbackground?: string;\n\tborderRadius?: number;\n\ttwoSided?: boolean;\n\tmaterial?: MaterialType;\n\tshininess?: number;\n\troughness?: number;\n\tspecularIntensity?: number;\n\tmetallic?: number;\n\tambientIntensity?: number;\n\tior?: number;\n\ttransmission?: number;\n\tdispersion?: number;\n\tfresnelPower?: number;\n\tenvIntensity?: number;\n\topacity?: number;\n\tchildren?: LayoutNode[];\n}\n\nexport interface Grid3DOptions {\n\tid?: string;\n\twidth: number;\n\theight: number;\n\tdivisions?: number;\n\tcolor?: string;\n\t/** Line thickness in world pixels (default 2). */\n\tlineWidth?: number;\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\topacity?: number;\n}\n\nexport interface Text3DOptions extends Surface3DOptions {\n\tid?: string;\n\ttext: string;\n\tfontSize?: number;\n\tfontFamily?: string;\n\tfontWeight?: number | string;\n\tfontStyle?: string;\n\tfill?: string;\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\tscale?: number;\n\tscaleX?: number;\n\tscaleY?: number;\n\tscaleZ?: number;\n\talign?: \"start\" | \"center\" | \"end\" | \"left\" | \"right\";\n\tverticalAlign?: \"top\" | \"middle\" | \"bottom\";\n\tletterSpacing?: number;\n\tlineHeight?: number;\n\tis3D?: boolean;\n\ttwoSided?: boolean;\n\tmaterial?: MaterialType;\n\tshininess?: number;\n\troughness?: number;\n\tspecularIntensity?: number;\n\tambientIntensity?: number;\n\tmetallic?: number;\n\tior?: number;\n\ttransmission?: number;\n\tdispersion?: number;\n\tfresnelPower?: number;\n\tenvIntensity?: number;\n\topacity?: number;\n\tbackground?: string;\n\tborderRadius?: number;\n\tpadding?: number;\n\tstroke?: string;\n\tstrokeWidth?: number;\n\textrusionDepth?: number;\n\t/** @deprecated No effect: extruded text is one solid mesh, not a stack of slices. */\n\textrusionSteps?: number;\n\t/**\n\t * Extruded text only: color of the side walls. `fill` colors the letter\n\t * faces (front and back). Defaults to `fill`.\n\t */\n\tbevelColor?: string;\n}\n\nexport interface ExtrudedText3DOptions extends Text3DOptions {\n\tdepth: number;\n\t/** @deprecated No effect: extruded text is one solid mesh, not a stack of slices. */\n\tslices?: number;\n\t/** Fixed straight segments per curve; by default curves split as finely as their on-screen size needs. */\n\tcurveSegments?: number;\n\t/** Most a flattened curve strays from the outline, in on-screen px at scale 1 (default 0.1). */\n\tcurveTolerance?: number;\n}\n\n/** Node props shared by the mesh primitives (roundedBox, sphere, cylinder). */\nexport interface Primitive3DNodeOptions extends Surface3DOptions {\n\tid?: string;\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\tscale?: number;\n\tscaleX?: number;\n\tscaleY?: number;\n\tscaleZ?: number;\n\t/** Surface color baked into the mesh (default white). */\n\tcolor?: string;\n\t/**\n\t * Multiplies the surface color. It is the node's `color`, so animate it\n\t * with `.keys(\"color\", …)`; the baked surface `color` stays fixed.\n\t */\n\ttint?: string;\n\tmaterial?: MaterialType;\n\tshininess?: number;\n\troughness?: number;\n\tspecularIntensity?: number;\n\tambientIntensity?: number;\n\tmetallic?: number;\n\topacity?: number;\n\tstartFrame?: number;\n\tdurationFrames?: number;\n}\n\nexport type RoundedBox3DOptions = Primitive3DNodeOptions &\n\tOmit<RoundedBoxGeometryOptions, \"type\" | \"color\" | \"material\">;\nexport type Sphere3DOptions = Primitive3DNodeOptions &\n\tOmit<SphereGeometryOptions, \"type\" | \"color\" | \"material\">;\nexport type Cylinder3DOptions = Primitive3DNodeOptions &\n\tOmit<CylinderGeometryOptions, \"type\" | \"color\" | \"material\">;\n\n/** Mesh shading the geometry can bake in; layer materials (glass, …) apply on the node. */\nfunction meshShading(\n\tmaterial: MaterialType | undefined,\n): \"lit\" | \"unlit\" | \"toon\" | undefined {\n\treturn material === \"lit\" || material === \"unlit\" || material === \"toon\"\n\t\t? material\n\t\t: undefined;\n}\n\nfunction primitiveNode(\n\tprefix: string,\n\tgeometry: PrimitiveGeometryOptions,\n\to: Primitive3DNodeOptions,\n): AnimatableNode<Model3DNode> {\n\t// Only defined keys, so equal shapes share one cached mesh.\n\tconst spec = Object.fromEntries(\n\t\tObject.entries({\n\t\t\t...geometry,\n\t\t\tcolor: o.color,\n\t\t\tmaterial: meshShading(o.material),\n\t\t\tshininess: o.shininess,\n\t\t\troughness: o.roughness,\n\t\t\tmetallic: o.metallic,\n\t\t}).filter(([, v]) => v !== undefined),\n\t) as unknown as PrimitiveGeometryOptions;\n\treturn Layer.model({\n\t\tid: o.id ?? autoId(prefix),\n\t\tmodelData: getPrimitiveGeometry(spec),\n\t\t// What the compositor rebuilds the mesh from when modelData did not\n\t\t// survive (a spec sent as JSON).\n\t\tprimitive3d: spec,\n\t\tis3D: true,\n\t\tx: o.x ?? 0,\n\t\ty: o.y ?? 0,\n\t\tz: o.z ?? 0,\n\t\trotateX: o.rotateX ?? 0,\n\t\trotateY: o.rotateY ?? 0,\n\t\trotateZ: o.rotateZ ?? 0,\n\t\tscale: o.scale ?? 1,\n\t\tscaleX: o.scaleX ?? 1,\n\t\tscaleY: o.scaleY ?? 1,\n\t\tscaleZ: o.scaleZ ?? 1,\n\t\topacity: o.opacity ?? 1,\n\t\tcolor: o.tint,\n\t\tmaterial: o.material,\n\t\tshininess: o.shininess ?? 32,\n\t\troughness: o.roughness,\n\t\tspecularIntensity: o.specularIntensity ?? 0.5,\n\t\tambientIntensity: o.ambientIntensity ?? 1.0,\n\t\tmetallic: o.metallic,\n\t\t...materialProps({\n\t\t\temissive: o.emissive,\n\t\t\temissiveIntensity: o.emissiveIntensity,\n\t\t\tcastShadow: o.castShadow,\n\t\t}),\n\t\ttwoSided: false,\n\t\tstartFrame: o.startFrame,\n\t\tdurationFrames: o.durationFrames,\n\t});\n}\n\nexport type Shape3DContainer = AnimatableNode<BoxNode> & {\n\tfaces?: AnimatableNode<BoxNode>[];\n\titems?: LayoutNode[];\n\t[Symbol.iterator](): Iterator<LayoutNode>;\n};\n\n/**\n * Attaches the faces/items handles as non-enumerable properties, like\n * `animate`, so they stay out of `toSpec()` and schema validation.\n */\nfunction withParts<T extends object>(\n\tnode: T,\n\tparts: { faces?: LayoutNode[]; items?: LayoutNode[] },\n): T & Shape3DContainer {\n\tconst list = (parts.faces ?? parts.items ?? []) as LayoutNode[];\n\tfor (const [key, value] of Object.entries(parts)) {\n\t\tObject.defineProperty(node, key, {\n\t\t\tvalue,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\tObject.defineProperty(node, Symbol.iterator, {\n\t\tvalue: function* () {\n\t\t\tyield* list;\n\t\t},\n\t\tenumerable: false,\n\t\tconfigurable: true,\n\t});\n\treturn node as T & Shape3DContainer;\n}\n\n/** Largest initial scale of an extruded text node along its outline's axes. */\nfunction extrudedTextScale(options: ExtrudedText3DOptions): number {\n\tconst scale = options.scale ?? 1;\n\tconst s = Math.max(\n\t\tMath.abs(scale * (options.scaleX ?? 1)),\n\t\tMath.abs(scale * (options.scaleY ?? 1)),\n\t);\n\treturn s > 0 ? s : 1;\n}\n\nexport const Layer3D = {\n\t/**\n\t * Creates a true 3D volumetric cube with 6 textured or colored faces.\n\t * Returns a preserve-3d container that can be transformed in 3D camera space.\n\t */\n\tcube(options: Cube3DOptions): Shape3DContainer {\n\t\tconst size = options.size;\n\t\tconst [w, h, d] = typeof size === \"number\" ? [size, size, size] : size;\n\t\tconst twoSided = options.twoSided ?? true;\n\t\tconst defaultColors = {\n\t\t\tfront: \"#3b82f6\",\n\t\t\tback: \"#1d4ed8\",\n\t\t\tleft: \"#2563eb\",\n\t\t\tright: \"#1e40af\",\n\t\t\ttop: \"#60a5fa\",\n\t\t\tbottom: \"#172554\",\n\t\t};\n\n\t\tconst buildFace = (\n\t\t\tfaceId: string,\n\t\t\tinput: CubeFaceInput | undefined,\n\t\t\tdefaultColor: string,\n\t\t\tfaceW: number,\n\t\t\tfaceH: number,\n\t\t\tfaceProps: Partial<BoxNode>,\n\t\t): AnimatableNode<BoxNode> => {\n\t\t\tif (input && typeof input === \"object\" && \"kind\" in input) {\n\t\t\t\tconst node = input as AnimatableNode<BoxNode>;\n\t\t\t\tnode.position = \"absolute\";\n\t\t\t\tnode.is3D = true;\n\t\t\t\tnode.twoSided = twoSided;\n\t\t\t\tnode.material = node.material ?? options.material ?? \"lit\";\n\t\t\t\tnode.shininess = node.shininess ?? options.shininess ?? 32;\n\t\t\t\tnode.specularIntensity =\n\t\t\t\t\tnode.specularIntensity ?? options.specularIntensity ?? 0.5;\n\t\t\t\tif (options.roughness !== undefined && node.roughness === undefined) {\n\t\t\t\t\tnode.roughness = options.roughness;\n\t\t\t\t}\n\t\t\t\tif (options.metallic !== undefined && node.metallic === undefined) {\n\t\t\t\t\tnode.metallic = options.metallic;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\toptions.ambientIntensity !== undefined &&\n\t\t\t\t\tnode.ambientIntensity === undefined\n\t\t\t\t) {\n\t\t\t\t\tnode.ambientIntensity = options.ambientIntensity;\n\t\t\t\t}\n\t\t\t\tObject.assign(node, faceProps);\n\t\t\t\treturn node;\n\t\t\t}\n\t\t\tconst cfg: CubeFaceConfig =\n\t\t\t\ttypeof input === \"string\"\n\t\t\t\t\t? { background: input }\n\t\t\t\t\t: (input ?? { background: defaultColor });\n\n\t\t\treturn Layer.box({\n\t\t\t\tid: `${options.id ?? \"cube\"}-${faceId}`,\n\t\t\t\tposition: \"absolute\",\n\t\t\t\twidth: faceW,\n\t\t\t\theight: faceH,\n\t\t\t\tis3D: true,\n\t\t\t\ttwoSided,\n\t\t\t\tmaterial: cfg.material ?? options.material ?? \"lit\",\n\t\t\t\tshininess: cfg.shininess ?? options.shininess ?? 32,\n\t\t\t\tspecularIntensity:\n\t\t\t\t\tcfg.specularIntensity ?? options.specularIntensity ?? 0.5,\n\t\t\t\troughness: cfg.roughness ?? options.roughness,\n\t\t\t\tmetallic: cfg.metallic ?? options.metallic,\n\t\t\t\tambientIntensity:\n\t\t\t\t\tcfg.ambientIntensity ?? options.ambientIntensity ?? 1.0,\n\t\t\t\t...materialProps({\n\t\t\t\t\temissive: cfg.emissive ?? options.emissive,\n\t\t\t\t\temissiveIntensity: cfg.emissiveIntensity ?? options.emissiveIntensity,\n\t\t\t\t\tcastShadow: cfg.castShadow ?? options.castShadow,\n\t\t\t\t}),\n\t\t\t\tbackground: cfg.background ?? defaultColor,\n\t\t\t\tborderRadius: cfg.borderRadius ?? 0,\n\t\t\t\tborderWidth: cfg.borderWidth,\n\t\t\t\tborderColor: cfg.borderColor,\n\t\t\t\topacity: cfg.opacity ?? 1,\n\t\t\t\tchildren: cfg.children ?? [],\n\t\t\t\t...faceProps,\n\t\t\t});\n\t\t};\n\n\t\tconst halfW = w / 2;\n\t\tconst halfH = h / 2;\n\t\tconst halfD = d / 2;\n\n\t\tconst faces: AnimatableNode<BoxNode>[] = [\n\t\t\tbuildFace(\"front\", options.faces?.front, defaultColors.front, w, h, {\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t\tz: -halfD,\n\t\t\t\trotateX: 0,\n\t\t\t\trotateY: 0,\n\t\t\t\trotateZ: 0,\n\t\t\t}),\n\t\t\tbuildFace(\"back\", options.faces?.back, defaultColors.back, w, h, {\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t\tz: halfD,\n\t\t\t\trotateX: 0,\n\t\t\t\trotateY: 180,\n\t\t\t\trotateZ: 0,\n\t\t\t}),\n\t\t\tbuildFace(\"left\", options.faces?.left, defaultColors.left, d, h, {\n\t\t\t\tx: -halfW,\n\t\t\t\ty: 0,\n\t\t\t\tz: 0,\n\t\t\t\trotateX: 0,\n\t\t\t\trotateY: 90,\n\t\t\t\trotateZ: 0,\n\t\t\t}),\n\t\t\tbuildFace(\"right\", options.faces?.right, defaultColors.right, d, h, {\n\t\t\t\tx: halfW,\n\t\t\t\ty: 0,\n\t\t\t\tz: 0,\n\t\t\t\trotateX: 0,\n\t\t\t\trotateY: -90,\n\t\t\t\trotateZ: 0,\n\t\t\t}),\n\t\t\tbuildFace(\"top\", options.faces?.top, defaultColors.top, w, d, {\n\t\t\t\tx: 0,\n\t\t\t\ty: -halfH,\n\t\t\t\tz: 0,\n\t\t\t\trotateX: -90,\n\t\t\t\trotateY: 0,\n\t\t\t\trotateZ: 0,\n\t\t\t}),\n\t\t\tbuildFace(\"bottom\", options.faces?.bottom, defaultColors.bottom, w, d, {\n\t\t\t\tx: 0,\n\t\t\t\ty: halfH,\n\t\t\t\tz: 0,\n\t\t\t\trotateX: 90,\n\t\t\t\trotateY: 0,\n\t\t\t\trotateZ: 0,\n\t\t\t}),\n\t\t];\n\n\t\tconst container = Layer.box({\n\t\t\tid: options.id ?? autoId(\"cube\"),\n\t\t\tposition: \"absolute\",\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? 0,\n\t\t\twidth: w,\n\t\t\theight: h,\n\t\t\tis3D: true,\n\t\t\ttransformStyle: \"preserve-3d\",\n\t\t\trotateX: options.rotateX ?? 0,\n\t\t\trotateY: options.rotateY ?? 0,\n\t\t\trotateZ: options.rotateZ ?? 0,\n\t\t\topacity: options.opacity ?? 1,\n\t\t\tbackground: \"transparent\",\n\t\t\tchildren: faces,\n\t\t});\n\n\t\treturn withParts(container, { faces });\n\t},\n\n\t/**\n\t * Creates a 3D cylindrical carousel of items arranged radially around a center point.\n\t */\n\tcarousel(options: Carousel3DOptions): Shape3DContainer {\n\t\tconst { items, radius, faceInward = false, twoSided = true } = options;\n\t\tconst n = items.length;\n\t\tconst angleStep = n > 0 ? 360 / n : 0;\n\n\t\tconst transformedItems = items.map((item, idx) => {\n\t\t\t// Item 0 sits nearest the default camera (-z) and the ring runs clockwise\n\t\t\t// seen from above. A face's front normal is (-sin ry, 0, -cos ry) (the\n\t\t\t// cube's convention: rotateY 90 faces -x), so the outward normal\n\t\t\t// (sin a, 0, -cos a) needs ry = -a, and inward needs 180 - a.\n\t\t\tconst angleDeg = idx * angleStep;\n\t\t\tconst rad = (angleDeg * Math.PI) / 180;\n\t\t\tconst x = radius * Math.sin(rad);\n\t\t\tconst z = -radius * Math.cos(rad);\n\t\t\tconst ry = faceInward ? 180 - angleDeg : -angleDeg;\n\n\t\t\tconst node = item as AnimatableNode<BoxNode>;\n\t\t\tnode.position = \"absolute\";\n\t\t\tnode.is3D = true;\n\t\t\tnode.twoSided = twoSided;\n\t\t\tnode.x = x;\n\t\t\tnode.y = 0;\n\t\t\tnode.z = z;\n\t\t\tnode.rotateY = ry;\n\t\t\treturn node;\n\t\t});\n\n\t\tconst container = Layer.box({\n\t\t\tid: options.id ?? autoId(\"carousel\"),\n\t\t\tposition: \"absolute\",\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? 0,\n\t\t\twidth: (options.itemWidth ?? 200) as any,\n\t\t\theight: (options.itemHeight ?? 200) as any,\n\t\t\tis3D: true,\n\t\t\ttransformStyle: \"preserve-3d\",\n\t\t\trotateX: options.rotateX ?? 0,\n\t\t\trotateY: options.rotateY ?? 0,\n\t\t\trotateZ: options.rotateZ ?? 0,\n\t\t\topacity: options.opacity ?? 1,\n\t\t\tbackground: \"transparent\",\n\t\t\tchildren: transformedItems,\n\t\t});\n\n\t\treturn withParts(container, { items: transformedItems });\n\t},\n\n\t/**\n\t * Creates an N-sided regular polygonal 3D prism.\n\t */\n\tprism(options: Prism3DOptions): Shape3DContainer {\n\t\tconst { sides, radius, height, twoSided = true } = options;\n\t\tconst n = Math.max(3, sides);\n\t\tconst sideWidth = 2 * radius * Math.tan(Math.PI / n);\n\t\tconst angleStep = 360 / n;\n\t\tconst panels: AnimatableNode<BoxNode>[] = [];\n\n\t\tfor (let i = 0; i < n; i++) {\n\t\t\tconst angleDeg = i * angleStep;\n\t\t\tconst rad = (angleDeg * Math.PI) / 180;\n\t\t\tconst x = radius * Math.sin(rad);\n\t\t\tconst z = radius * Math.cos(rad);\n\t\t\tconst cfg = options.sideConfigs?.[i];\n\t\t\tconst color =\n\t\t\t\ttypeof cfg === \"string\"\n\t\t\t\t\t? cfg\n\t\t\t\t\t: ((cfg as { background?: string } | undefined)?.background ??\n\t\t\t\t\t\t`hsl(${(i * 360) / n}, 70%, 50%)`);\n\n\t\t\tpanels.push(\n\t\t\t\tLayer.box({\n\t\t\t\t\tid: `${options.id ?? \"prism\"}-panel-${i}`,\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\twidth: sideWidth,\n\t\t\t\t\theight,\n\t\t\t\t\tis3D: true,\n\t\t\t\t\ttwoSided,\n\t\t\t\t\tx,\n\t\t\t\t\ty: 0,\n\t\t\t\t\tz,\n\t\t\t\t\trotateY: angleDeg,\n\t\t\t\t\tbackground: color,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\tconst container = Layer.box({\n\t\t\tid: options.id ?? autoId(\"prism\"),\n\t\t\tposition: \"absolute\",\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? 0,\n\t\t\twidth: sideWidth,\n\t\t\theight,\n\t\t\tis3D: true,\n\t\t\ttransformStyle: \"preserve-3d\",\n\t\t\trotateX: options.rotateX ?? 0,\n\t\t\trotateY: options.rotateY ?? 0,\n\t\t\trotateZ: options.rotateZ ?? 0,\n\t\t\topacity: options.opacity ?? 1,\n\t\t\tbackground: \"transparent\",\n\t\t\tchildren: panels,\n\t\t});\n\n\t\treturn withParts(container, { faces: panels });\n\t},\n\n\t/**\n\t * Creates a standalone planar 3D card/quad.\n\t */\n\tplane(options: Plane3DOptions): AnimatableNode<BoxNode> {\n\t\treturn Layer.box({\n\t\t\tid: options.id ?? autoId(\"plane\"),\n\t\t\tposition: \"absolute\",\n\t\t\twidth: options.width,\n\t\t\theight: options.height,\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? 0,\n\t\t\tis3D: true,\n\t\t\ttwoSided: options.twoSided ?? true,\n\t\t\trotateX: options.rotateX ?? 0,\n\t\t\trotateY: options.rotateY ?? 0,\n\t\t\trotateZ: options.rotateZ ?? 0,\n\t\t\tbackground: options.background ?? \"#3b82f6\",\n\t\t\tborderRadius: options.borderRadius ?? 0,\n\t\t\topacity: options.opacity ?? 1,\n\t\t\t...materialProps(options),\n\t\t\tchildren: options.children ?? [],\n\t\t});\n\t},\n\n\t/**\n\t * Creates a 3D perspective ground grid: `divisions` cells per side, each\n\t * line its own unlit quad so it stays crisp at any camera distance.\n\t */\n\tgrid(options: Grid3DOptions): AnimatableNode<BoxNode> {\n\t\tconst { width, height } = options;\n\t\tconst id = options.id ?? autoId(\"grid\");\n\t\tconst divisions = Math.max(1, Math.round(options.divisions ?? 10));\n\t\tconst lineWidth = options.lineWidth ?? 2;\n\t\tconst color = options.color ?? \"rgba(59, 130, 246, 0.5)\";\n\t\tconst line = (\n\t\t\tlineId: string,\n\t\t\tx: number,\n\t\t\ty: number,\n\t\t\tw: number,\n\t\t\th: number,\n\t\t): AnimatableNode<BoxNode> =>\n\t\t\tLayer.box({\n\t\t\t\tid: `${id}-${lineId}`,\n\t\t\t\tposition: \"absolute\",\n\t\t\t\tx,\n\t\t\t\ty,\n\t\t\t\tz: 0,\n\t\t\t\twidth: w,\n\t\t\t\theight: h,\n\t\t\t\tis3D: true,\n\t\t\t\ttwoSided: true,\n\t\t\t\tmaterial: \"unlit\",\n\t\t\t\tbackground: color,\n\t\t\t});\n\t\t// Every quad is backed by a texture of its own size, so long lines are\n\t\t// split into segments that stay well inside the GPU's texture limit.\n\t\tconst MAX_SEGMENT = 4096;\n\t\tconst lines: AnimatableNode<BoxNode>[] = [];\n\t\tconst vSegments = Math.ceil(height / MAX_SEGMENT);\n\t\tconst hSegments = Math.ceil(width / MAX_SEGMENT);\n\t\tfor (let i = 0; i <= divisions; i++) {\n\t\t\tconst u = i / divisions - 0.5;\n\t\t\tfor (let k = 0; k < vSegments; k++) {\n\t\t\t\tconst len = height / vSegments;\n\t\t\t\tconst y = -height / 2 + len * (k + 0.5);\n\t\t\t\tlines.push(line(`v${i}-${k}`, u * width, y, lineWidth, len));\n\t\t\t}\n\t\t\tfor (let k = 0; k < hSegments; k++) {\n\t\t\t\tconst len = width / hSegments;\n\t\t\t\tconst x = -width / 2 + len * (k + 0.5);\n\t\t\t\tlines.push(line(`h${i}-${k}`, x, u * height, len, lineWidth));\n\t\t\t}\n\t\t}\n\t\treturn Layer.box({\n\t\t\tid,\n\t\t\tposition: \"absolute\",\n\t\t\twidth,\n\t\t\theight,\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? 0,\n\t\t\tis3D: true,\n\t\t\ttransformStyle: \"preserve-3d\",\n\t\t\trotateX: options.rotateX ?? 90,\n\t\t\trotateY: options.rotateY ?? 0,\n\t\t\trotateZ: options.rotateZ ?? 0,\n\t\t\tbackground: \"transparent\",\n\t\t\topacity: options.opacity ?? 1,\n\t\t\tchildren: lines,\n\t\t});\n\t},\n\n\t/**\n\t * Creates a standalone planar 3D text node, or solid extruded 3D text when `extrusionDepth` is set.\n\t */\n\ttext(options: Text3DOptions): AnimatableNode<LayoutNode> {\n\t\tif (options.extrusionDepth && options.extrusionDepth > 0) {\n\t\t\treturn Layer3D.extrudedText({\n\t\t\t\t...options,\n\t\t\t\tdepth: options.extrusionDepth,\n\t\t\t});\n\t\t}\n\n\t\treturn Layer.text(options.text, {\n\t\t\tid: options.id ?? autoId(\"text3d\"),\n\t\t\tposition: \"absolute\",\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? 0,\n\t\t\tis3D: true,\n\t\t\ttwoSided: options.twoSided ?? true,\n\t\t\trotateX: options.rotateX ?? 0,\n\t\t\trotateY: options.rotateY ?? 0,\n\t\t\trotateZ: options.rotateZ ?? 0,\n\t\t\tfontSize: options.fontSize ?? 48,\n\t\t\tfontFamily: options.fontFamily,\n\t\t\tfontWeight: options.fontWeight ?? \"bold\",\n\t\t\tfontStyle: options.fontStyle,\n\t\t\tfill: options.fill ?? \"#ffffff\",\n\t\t\talign: (options.align as any) ?? \"center\",\n\t\t\tverticalAlign: options.verticalAlign ?? \"middle\",\n\t\t\tletterSpacing: options.letterSpacing,\n\t\t\tlineHeight: options.lineHeight,\n\t\t\tmaterial: options.material ?? \"lit\",\n\t\t\tshininess: options.shininess ?? 64,\n\t\t\troughness: options.roughness,\n\t\t\tspecularIntensity: options.specularIntensity ?? 0.8,\n\t\t\tambientIntensity: options.ambientIntensity ?? 1.0,\n\t\t\tmetallic: options.metallic,\n\t\t\t...materialProps(options),\n\t\t\topacity: options.opacity ?? 1,\n\t\t\tbackground: options.background,\n\t\t\tborderRadius: options.borderRadius,\n\t\t\tpadding: options.padding,\n\t\t\tstroke: options.stroke,\n\t\t\tstrokeWidth: options.strokeWidth,\n\t\t});\n\t},\n\n\t/**\n\t * Creates solid extruded 3D typography: `fill` colors the letter faces,\n\t * `bevelColor` the side walls; curves are tessellated to `curveTolerance`.\n\t */\n\textrudedText(options: ExtrudedText3DOptions): Shape3DContainer {\n\t\tconst { depth, text, fill = \"#ffffff\", bevelColor } = options;\n\n\t\tlet modelData: Model3DData | undefined;\n\t\t// Tolerance is in on-screen px: a node scaled up 3x needs 3x finer geometry.\n\t\tconst curveTolerance =\n\t\t\t(options.curveTolerance ?? 0.1) / extrudedTextScale(options);\n\t\tconst parsedFont =\n\t\t\t(options.fontFamily\n\t\t\t\t? SlugFontCache.getParsed(options.fontFamily)\n\t\t\t\t: null) ??\n\t\t\tSlugFontCache.getParsed(\"Inter\") ??\n\t\t\tSlugFontCache.getParsed(\"Unbounded\") ??\n\t\t\tSlugFontCache.getFirstParsed();\n\n\t\tif (parsedFont) {\n\t\t\tconst res = generateExtrudedTextGeometry({\n\t\t\t\ttext,\n\t\t\t\t// SlugFontCache holds fontkit fonts under a narrower type.\n\t\t\t\tfont: parsedFont as unknown as Parameters<\n\t\t\t\t\ttypeof generateExtrudedTextGeometry\n\t\t\t\t>[0][\"font\"],\n\t\t\t\tfontSize: options.fontSize ?? 48,\n\t\t\t\tdepth,\n\t\t\t\tfill,\n\t\t\t\tbevelColor,\n\t\t\t\tcurveSegments: options.curveSegments,\n\t\t\t\tcurveTolerance,\n\t\t\t\talign: options.align,\n\t\t\t\tverticalAlign: options.verticalAlign,\n\t\t\t\tletterSpacing: options.letterSpacing,\n\t\t\t\t// The mesh's own shading only knows these; glass and the like are\n\t\t\t\t// layer materials, applied by the model node below.\n\t\t\t\tmaterial:\n\t\t\t\t\toptions.material === \"lit\" ||\n\t\t\t\t\toptions.material === \"unlit\" ||\n\t\t\t\t\toptions.material === \"toon\"\n\t\t\t\t\t\t? options.material\n\t\t\t\t\t\t: undefined,\n\t\t\t\tshininess: options.shininess,\n\t\t\t\troughness: options.roughness,\n\t\t\t\tmetallic: options.metallic,\n\t\t\t});\n\t\t\tmodelData = res.modelData;\n\t\t}\n\n\t\tconst modelNode = Layer.model({\n\t\t\tid: options.id ?? autoId(\"extruded-text\"),\n\t\t\tmodelData,\n\t\t\tis3D: true,\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? 0,\n\t\t\trotateX: options.rotateX ?? 0,\n\t\t\trotateY: options.rotateY ?? 0,\n\t\t\trotateZ: options.rotateZ ?? 0,\n\t\t\tscale: options.scale ?? 1,\n\t\t\tscaleX: options.scaleX ?? 1,\n\t\t\tscaleY: options.scaleY ?? 1,\n\t\t\tscaleZ: options.scaleZ ?? 1,\n\t\t\topacity: options.opacity ?? 1,\n\t\t\tmaterial: options.material,\n\t\t\tshininess: options.shininess ?? 32,\n\t\t\troughness: options.roughness,\n\t\t\tspecularIntensity: options.specularIntensity ?? 0.8,\n\t\t\tambientIntensity: options.ambientIntensity ?? 1.0,\n\t\t\tmetallic: options.metallic,\n\t\t\t...materialProps(options),\n\t\t\ttwoSided: options.twoSided ?? true,\n\t\t\t// What the compositor rebuilds the mesh from when modelData did not\n\t\t\t// survive (a spec sent as JSON): the same tolerance as here.\n\t\t\ttext3dOptions: { ...options, curveTolerance },\n\t\t});\n\n\t\treturn withParts(modelNode, {\n\t\t\tfaces: [modelNode],\n\t\t\titems: [modelNode],\n\t\t}) as unknown as Shape3DContainer;\n\t},\n\n\t/**\n\t * A solid box with rounded edges and corners, as one smooth-shaded mesh:\n\t * cards, buttons, device bodies. `taper` below 1 narrows the top (-y)\n\t * face, the shape of a keycap. Equal shapes share one GPU buffer.\n\t */\n\troundedBox(options: RoundedBox3DOptions): AnimatableNode<Model3DNode> {\n\t\treturn primitiveNode(\n\t\t\t\"rounded-box\",\n\t\t\t{\n\t\t\t\ttype: \"roundedBox\",\n\t\t\t\twidth: options.width,\n\t\t\t\theight: options.height,\n\t\t\t\tdepth: options.depth,\n\t\t\t\tradius: options.radius,\n\t\t\t\tsegments: options.segments,\n\t\t\t\ttaper: options.taper,\n\t\t\t},\n\t\t\toptions,\n\t\t);\n\t},\n\n\t/** A UV sphere mesh. */\n\tsphere(options: Sphere3DOptions): AnimatableNode<Model3DNode> {\n\t\treturn primitiveNode(\n\t\t\t\"sphere\",\n\t\t\t{ type: \"sphere\", radius: options.radius, segments: options.segments },\n\t\t\toptions,\n\t\t);\n\t},\n\n\t/** A capped cylinder, or a cone/frustum with different top and bottom radii. */\n\tcylinder(options: Cylinder3DOptions): AnimatableNode<Model3DNode> {\n\t\treturn primitiveNode(\n\t\t\t\"cylinder\",\n\t\t\t{\n\t\t\t\ttype: \"cylinder\",\n\t\t\t\tradius: options.radius,\n\t\t\t\tradiusTop: options.radiusTop,\n\t\t\t\tradiusBottom: options.radiusBottom,\n\t\t\t\theight: options.height,\n\t\t\t\tsegments: options.segments,\n\t\t\t\topenEnded: options.openEnded,\n\t\t\t},\n\t\t\toptions,\n\t\t);\n\t},\n\n\t/**\n\t * Creates a 3D model node rendered natively with WebGPU mesh shaders.\n\t */\n\tmodel(options: Partial<Model3DNode> = {}): AnimatableNode<Model3DNode> {\n\t\treturn Layer.model(options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D Wavefront OBJ model node.\n\t */\n\tobj(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.obj(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D Autodesk FBX model node with skeletal animation support.\n\t */\n\tfbx(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.fbx(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D glTF 2.0 model node.\n\t */\n\tgltf(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.gltf(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D GLB binary container model node.\n\t */\n\tglb(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.glb(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D STL CAD / 3D printing model node.\n\t */\n\tstl(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.stl(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D Stanford PLY scan model node.\n\t */\n\tply(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.ply(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D MagicaVoxel VOX model node.\n\t */\n\tvox(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.vox(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D Studio (3DS) binary model node.\n\t */\n\tthreeDS(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.threeDS(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D Object File Format (OFF) model node.\n\t */\n\toff(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.off(src, options);\n\t},\n};\n","/**\n * Scene sequencing with transitions. `Layer.sequence` lays scenes end to end\n * and overlaps neighbours by each transition's length; the transition itself\n * is plain keyframes (and, for wipes and irises, a track matte) merged into\n * the scenes, so it renders like anything else and stays editable.\n */\nimport {\n\ttype AnimationTrack,\n\ttype BoxNode,\n\tLayerAnimation,\n\ttype LayoutNode,\n} from \"@framefields/compositions/program\";\nimport { autoId } from \"./ids.js\";\nimport { type AnimatableNode, Layer } from \"./index.js\";\n\nexport type TransitionDirection = \"left\" | \"right\" | \"up\" | \"down\";\n\n/** What a transition needs to know to animate two scenes. */\ninterface TransitionContext {\n\t/** Scene size (px). */\n\twidth: number;\n\theight: number;\n\t/** Overlap length in frames. */\n\tframes: number;\n\t/** Outgoing scene: local frame where the overlap starts, and its rest position. */\n\toutStart: number;\n\toutRest: { x: number; y: number };\n\t/** Incoming scene rest position (the overlap starts at its local frame 0). */\n\tinRest: { x: number; y: number };\n}\n\ninterface TransitionParts {\n\toutgoing?: LayerAnimation;\n\tincoming?: LayerAnimation;\n\t/** A matte revealing the incoming scene (laid out like the scene, keyed from its start). */\n\tincomingMatte?: LayoutNode;\n\t/** Static props set on both scenes (e.g. motion blur for a whip). */\n\tsceneProps?: Record<string, unknown>;\n}\n\nexport interface TransitionSpec {\n\treadonly kind: string;\n\t/** Overlap between the two scenes, in frames (0 = hard cut). */\n\treadonly frames: number;\n\t/** @internal */\n\tbuild(ctx: TransitionContext): TransitionParts;\n}\n\nconst offsetFor = (dir: TransitionDirection, w: number, h: number) => {\n\tswitch (dir) {\n\t\tcase \"left\":\n\t\t\treturn { dx: -w, dy: 0 };\n\t\tcase \"right\":\n\t\t\treturn { dx: w, dy: 0 };\n\t\tcase \"up\":\n\t\t\treturn { dx: 0, dy: -h };\n\t\tdefault:\n\t\t\treturn { dx: 0, dy: h };\n\t}\n};\n\nfunction spec(\n\tkind: string,\n\tframes: number,\n\tbuild: (ctx: TransitionContext) => TransitionParts,\n): TransitionSpec {\n\treturn { kind, frames: Math.max(0, Math.round(frames)), build };\n}\n\n/**\n * Scene-to-scene transitions for `Layer.sequence`. `frames` is how long the\n * two scenes overlap; `ease` shapes the move (default \"power3.inOut\").\n */\nexport const Transition = {\n\t/** Instant cut. */\n\tcut: (): TransitionSpec => spec(\"cut\", 0, () => ({})),\n\n\t/** The incoming scene fades in over the outgoing one. */\n\tcrossfade: (frames = 15, ease = \"sine.inOut\"): TransitionSpec =>\n\t\tspec(\"crossfade\", frames, (c) => ({\n\t\t\tincoming: LayerAnimation.keys(\"opacity\", [\n\t\t\t\t[0, 0],\n\t\t\t\t[c.frames, 1, ease],\n\t\t\t]),\n\t\t})),\n\n\t/** Out to the background, then in: a dip to the composition's background color. */\n\tfadeThrough: (frames = 20, ease = \"sine.inOut\"): TransitionSpec =>\n\t\tspec(\"fadeThrough\", frames, (c) => {\n\t\t\tconst half = Math.max(1, Math.floor(c.frames / 2));\n\t\t\treturn {\n\t\t\t\toutgoing: LayerAnimation.keys(\"opacity\", [\n\t\t\t\t\t[c.outStart, 1],\n\t\t\t\t\t[c.outStart + half, 0, ease],\n\t\t\t\t]),\n\t\t\t\tincoming: LayerAnimation.keys(\"opacity\", [\n\t\t\t\t\t[0, 0],\n\t\t\t\t\t[half, 0],\n\t\t\t\t\t[c.frames, 1, ease],\n\t\t\t\t]),\n\t\t\t};\n\t\t}),\n\n\t/** Both scenes move together: the new one pushes the old one out toward `direction`. */\n\tpush: (\n\t\tdirection: TransitionDirection = \"left\",\n\t\tframes = 18,\n\t\tease = \"power3.inOut\",\n\t): TransitionSpec =>\n\t\tspec(\"push\", frames, (c) => {\n\t\t\tconst { dx, dy } = offsetFor(direction, c.width, c.height);\n\t\t\tconst out = LayerAnimation.create();\n\t\t\tconst inc = LayerAnimation.create();\n\t\t\tif (dx !== 0) {\n\t\t\t\tout.keys(\"x\", [\n\t\t\t\t\t[c.outStart, c.outRest.x],\n\t\t\t\t\t[c.outStart + c.frames, c.outRest.x + dx, ease],\n\t\t\t\t]);\n\t\t\t\tinc.keys(\"x\", [\n\t\t\t\t\t[0, c.inRest.x - dx],\n\t\t\t\t\t[c.frames, c.inRest.x, ease],\n\t\t\t\t]);\n\t\t\t} else {\n\t\t\t\tout.keys(\"y\", [\n\t\t\t\t\t[c.outStart, c.outRest.y],\n\t\t\t\t\t[c.outStart + c.frames, c.outRest.y + dy, ease],\n\t\t\t\t]);\n\t\t\t\tinc.keys(\"y\", [\n\t\t\t\t\t[0, c.inRest.y - dy],\n\t\t\t\t\t[c.frames, c.inRest.y, ease],\n\t\t\t\t]);\n\t\t\t}\n\t\t\treturn { outgoing: out, incoming: inc };\n\t\t}),\n\n\t/** The new scene slides in over the old one, which stays put and dims slightly. */\n\tslide: (\n\t\tdirection: TransitionDirection = \"left\",\n\t\tframes = 18,\n\t\tease = \"power3.out\",\n\t): TransitionSpec =>\n\t\tspec(\"slide\", frames, (c) => {\n\t\t\tconst { dx, dy } = offsetFor(direction, c.width, c.height);\n\t\t\tconst prop = dx !== 0 ? \"x\" : \"y\";\n\t\t\tconst rest = dx !== 0 ? c.inRest.x : c.inRest.y;\n\t\t\treturn {\n\t\t\t\toutgoing: LayerAnimation.keys(\"opacity\", [\n\t\t\t\t\t[c.outStart, 1],\n\t\t\t\t\t[c.outStart + c.frames, 0.6, ease],\n\t\t\t\t]),\n\t\t\t\tincoming: LayerAnimation.keys(prop, [\n\t\t\t\t\t[0, rest - (dx || dy)],\n\t\t\t\t\t[c.frames, rest, ease],\n\t\t\t\t]),\n\t\t\t};\n\t\t}),\n\n\t/** Old scene grows and fades, new one settles in from slightly small. */\n\tzoom: (frames = 18, ease = \"power2.inOut\"): TransitionSpec =>\n\t\tspec(\"zoom\", frames, (c) => ({\n\t\t\toutgoing: LayerAnimation.create()\n\t\t\t\t.keys(\"scale\", [\n\t\t\t\t\t[c.outStart, 1],\n\t\t\t\t\t[c.outStart + c.frames, 1.25, ease],\n\t\t\t\t])\n\t\t\t\t.keys(\"opacity\", [\n\t\t\t\t\t[c.outStart, 1],\n\t\t\t\t\t[c.outStart + c.frames, 0, ease],\n\t\t\t\t]),\n\t\t\tincoming: LayerAnimation.create()\n\t\t\t\t.keys(\"scale\", [\n\t\t\t\t\t[0, 0.85],\n\t\t\t\t\t[c.frames, 1, ease],\n\t\t\t\t])\n\t\t\t\t.keys(\"opacity\", [\n\t\t\t\t\t[0, 0],\n\t\t\t\t\t[c.frames, 1, ease],\n\t\t\t\t]),\n\t\t})),\n\n\t/** A fast, motion-blurred push: the camera whips to the next scene. */\n\twhip: (\n\t\tdirection: TransitionDirection = \"left\",\n\t\tframes = 10,\n\t): TransitionSpec => {\n\t\tconst push = Transition.push(direction, frames, \"expo.inOut\");\n\t\treturn spec(\"whip\", frames, (c) => ({\n\t\t\t...push.build(c),\n\t\t\tsceneProps: { motionBlurShutter: 360 },\n\t\t}));\n\t},\n\n\t/** A hard edge sweeps across, revealing the new scene. */\n\twipe: (\n\t\tdirection: TransitionDirection = \"left\",\n\t\tframes = 18,\n\t\tease = \"power2.inOut\",\n\t): TransitionSpec =>\n\t\tspec(\"wipe\", frames, (c) => {\n\t\t\t// `direction` is where the edge travels: \"left\" reveals from the right.\n\t\t\tconst { dx, dy } = offsetFor(direction, c.width, c.height);\n\t\t\tconst prop = dx !== 0 ? \"x\" : \"y\";\n\t\t\tconst rest = dx !== 0 ? c.inRest.x : c.inRest.y;\n\t\t\treturn {\n\t\t\t\tincomingMatte: Layer.box({\n\t\t\t\t\tid: autoId(\"wipe-matte\"),\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\tx: c.inRest.x,\n\t\t\t\t\ty: c.inRest.y,\n\t\t\t\t\twidth: c.width,\n\t\t\t\t\theight: c.height,\n\t\t\t\t\tbackground: \"#ffffff\",\n\t\t\t\t}).animate(\n\t\t\t\t\tLayerAnimation.keys(prop, [\n\t\t\t\t\t\t[0, rest - (dx || dy)],\n\t\t\t\t\t\t[c.frames, rest, ease],\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t};\n\t\t}),\n\n\t/** A circle opens from the center (or `at`, as fractions of the frame) to reveal the new scene. */\n\tiris: (\n\t\tframes = 20,\n\t\toptions: { at?: [number, number]; ease?: string } = {},\n\t): TransitionSpec =>\n\t\tspec(\"iris\", frames, (c) => {\n\t\t\tconst [fx, fy] = options.at ?? [0.5, 0.5];\n\t\t\tconst cx = c.inRest.x + fx * c.width;\n\t\t\tconst cy = c.inRest.y + fy * c.height;\n\t\t\t// Big enough to cover the farthest corner.\n\t\t\tconst r = Math.hypot(\n\t\t\t\tMath.max(fx, 1 - fx) * c.width,\n\t\t\t\tMath.max(fy, 1 - fy) * c.height,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tincomingMatte: Layer.shape(\"circle\", {\n\t\t\t\t\tid: autoId(\"iris-matte\"),\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\tx: cx - r,\n\t\t\t\t\ty: cy - r,\n\t\t\t\t\twidth: r * 2,\n\t\t\t\t\theight: r * 2,\n\t\t\t\t\tfillColor: \"#ffffff\",\n\t\t\t\t}).animate(\n\t\t\t\t\tLayerAnimation.keys(\"scale\", [\n\t\t\t\t\t\t[0, 0],\n\t\t\t\t\t\t[c.frames, 1, options.ease ?? \"power2.inOut\"],\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t};\n\t\t}),\n};\n\nexport interface SequenceEntry {\n\t/** A full-frame layer (usually a box holding the scene). */\n\tscene: AnimatableNode<LayoutNode> | LayoutNode;\n\t/** Frames this scene is on screen, transitions included. */\n\tduration: number;\n\t/** How this scene arrives from the previous one (default: cut). */\n\ttransition?: TransitionSpec;\n}\n\nexport interface SceneSequenceOptions {\n\tid?: string;\n\t/** Scene size used by moving transitions (default: each scene's own width/height, else 1920×1080). */\n\twidth?: number;\n\theight?: number;\n\t/** First frame of the whole sequence. Default 0. */\n\tstartFrame?: number;\n}\n\nexport type SequenceNode = AnimatableNode<BoxNode> & {\n\t/** Total length in frames: put it in the composition's duration. */\n\treadonly totalFrames: number;\n\t/** Where each scene starts (composition frames, relative to the sequence). */\n\treadonly sceneStarts: readonly number[];\n};\n\nfunction sizeOf(node: LayoutNode, axis: \"width\" | \"height\", fallback: number) {\n\tconst v = (node as unknown as Record<string, unknown>)[axis];\n\treturn typeof v === \"number\" ? v : fallback;\n}\n\n/**\n * Scenes back to back, each overlapping the previous one by its transition.\n * Scene timing is set for you (`startFrame` / `durationFrames`), so every\n * scene keys its own animation from its local frame 0.\n */\nexport function sequence(\n\tentries: SequenceEntry[],\n\toptions: SceneSequenceOptions = {},\n): SequenceNode {\n\tconst scenes: LayoutNode[] = [];\n\tconst starts: number[] = [];\n\tlet cursor = 0;\n\tentries.forEach((entry, i) => {\n\t\tconst t = i === 0 ? undefined : entry.transition;\n\t\tconst overlap = Math.min(t?.frames ?? 0, entries[i - 1]?.duration ?? 0);\n\t\tconst start = Math.max(0, cursor - overlap);\n\t\tconst duration = Math.max(1, Math.round(entry.duration));\n\t\tstarts.push(start);\n\t\tconst node = entry.scene as LayoutNode & Record<string, unknown>;\n\t\t// Scenes stack in one frame rather than flowing one under the other.\n\t\tif (node.position === undefined || node.position === \"relative\") {\n\t\t\tnode.position = \"absolute\";\n\t\t\tnode.x ??= 0;\n\t\t\tnode.y ??= 0;\n\t\t}\n\t\tnode.startFrame = start;\n\t\tnode.durationFrames = duration;\n\t\tscenes.push(node);\n\t\tcursor = start + duration;\n\t});\n\n\tentries.forEach((entry, i) => {\n\t\tif (i === 0 || !entry.transition || entry.transition.frames === 0) return;\n\t\tconst prev = scenes[i - 1] as LayoutNode & Record<string, unknown>;\n\t\tconst cur = scenes[i] as LayoutNode & Record<string, unknown>;\n\t\tconst frames = Math.min(entry.transition.frames, entries[i - 1].duration);\n\t\tconst width = options.width ?? sizeOf(cur, \"width\", 1920);\n\t\tconst height = options.height ?? sizeOf(cur, \"height\", 1080);\n\t\tconst parts = entry.transition.build({\n\t\t\twidth,\n\t\t\theight,\n\t\t\tframes,\n\t\t\toutStart: entries[i - 1].duration - frames,\n\t\t\toutRest: {\n\t\t\t\tx: typeof prev.x === \"number\" ? prev.x : 0,\n\t\t\t\ty: typeof prev.y === \"number\" ? prev.y : 0,\n\t\t\t},\n\t\t\tinRest: {\n\t\t\t\tx: typeof cur.x === \"number\" ? cur.x : 0,\n\t\t\t\ty: typeof cur.y === \"number\" ? cur.y : 0,\n\t\t\t},\n\t\t});\n\t\tconst merge = (\n\t\t\tnode: LayoutNode & Record<string, unknown>,\n\t\t\tanim?: LayerAnimation,\n\t\t) => {\n\t\t\tif (!anim) return;\n\t\t\tconst existing =\n\t\t\t\t(node.animation as { tracks?: AnimationTrack[] } | undefined)?.tracks ??\n\t\t\t\t[];\n\t\t\tnode.animation = LayerAnimation.merge(\n\t\t\t\t{ tracks: existing },\n\t\t\t\tanim,\n\t\t\t).toSpec();\n\t\t};\n\t\tmerge(prev, parts.outgoing);\n\t\tmerge(cur, parts.incoming);\n\t\tif (parts.sceneProps) {\n\t\t\tObject.assign(prev, parts.sceneProps);\n\t\t\tObject.assign(cur, parts.sceneProps);\n\t\t}\n\t\tif (parts.incomingMatte) {\n\t\t\tcur.matte = { node: parts.incomingMatte, mode: \"alpha\" };\n\t\t}\n\t});\n\n\tconst root = Layer.box({\n\t\tid: options.id ?? autoId(\"sequence\"),\n\t\tposition: \"absolute\",\n\t\tx: 0,\n\t\ty: 0,\n\t\twidth:\n\t\t\toptions.width ?? sizeOf(scenes[0] ?? ({} as LayoutNode), \"width\", 1920),\n\t\theight:\n\t\t\toptions.height ?? sizeOf(scenes[0] ?? ({} as LayoutNode), \"height\", 1080),\n\t\tstartFrame: options.startFrame ?? 0,\n\t\tdurationFrames: Math.max(1, cursor),\n\t\tchildren: scenes,\n\t});\n\tObject.defineProperty(root, \"totalFrames\", {\n\t\tvalue: cursor,\n\t\tenumerable: false,\n\t});\n\tObject.defineProperty(root, \"sceneStarts\", {\n\t\tvalue: starts,\n\t\tenumerable: false,\n\t});\n\treturn root as SequenceNode;\n}\n","import type {\n\tEnvironmentPreset,\n\tLightNode,\n\tToneMapping,\n} from \"@framefields/compositions/program\";\nimport { autoId } from \"./ids.js\";\nimport {\n\ttype AnimatableNode,\n\ttype EnvironmentOptions,\n\tLight,\n} from \"./index.js\";\n\nexport interface LightingRigOptions {\n\t/** What the lights aim at (world px). Default: the canvas center at z 0. */\n\ttarget?: [number, number, number];\n\t/** How far the lights sit from the target. Default 1600. */\n\tdistance?: number;\n\t/** Turns the whole rig (lights and environment) around the vertical axis, degrees. */\n\trotation?: number;\n\t/** Scales every light. Default 1. */\n\tintensity?: number;\n\t/** Exposure in stops. Default 0. */\n\texposure?: number;\n\ttoneMapping?: ToneMapping;\n\t/** Key light casts a soft shadow. Default true. */\n\tshadows?: boolean;\n\t/** Shadow edge blur in texels. Default 3. */\n\tshadowSoftness?: number;\n\t/** Fog fading into the background, e.g. `{ color: BG, start: 2500, end: 6000 }`. */\n\tfog?: EnvironmentOptions[\"fog\"];\n\t/** Glow around emissive surfaces and highlights: `true` or settings. */\n\tbloom?: EnvironmentOptions[\"bloom\"];\n\t/** Prefix for the rig's node ids. */\n\tid?: string;\n}\n\ninterface RigSpec {\n\tenvironment: EnvironmentPreset;\n\tenvIntensity: number;\n\t/** Light directions relative to the target, before `rotation`; y is down. */\n\tkey: { dir: [number, number, number]; color: string; intensity: number };\n\trim?: { dir: [number, number, number]; color: string; intensity: number };\n\tfill?: { dir: [number, number, number]; color: string; intensity: number };\n}\n\nconst RIGS = {\n\t/** Product photography: soft overhead key with a shadow, cool rim, studio reflections. */\n\tstudio: {\n\t\tenvironment: \"studio\",\n\t\tenvIntensity: 1,\n\t\tkey: { dir: [-0.55, -1, -0.7], color: \"#fff6ec\", intensity: 1.1 },\n\t\trim: { dir: [0.9, -0.5, 0.9], color: \"#dbe8ff\", intensity: 0.9 },\n\t},\n\t/** Bright, airy, low contrast: lifestyle and UI-on-device shots. */\n\tsoft: {\n\t\tenvironment: \"soft\",\n\t\tenvIntensity: 1,\n\t\tkey: { dir: [-0.4, -1, -0.8], color: \"#ffffff\", intensity: 1.0 },\n\t},\n\t/** Low warm sun, long shadows, cool sky fill. */\n\tsunset: {\n\t\tenvironment: \"sunset\",\n\t\tenvIntensity: 0.9,\n\t\tkey: { dir: [-1, -0.35, -0.3], color: \"#ffb27a\", intensity: 2.2 },\n\t\tfill: { dir: [0.8, -0.6, -0.4], color: \"#7f9cff\", intensity: 0.35 },\n\t},\n\t/** Moody: dark world, hard key, strong rim. Pair with emissive accents. */\n\tdramatic: {\n\t\tenvironment: \"night\",\n\t\tenvIntensity: 0.8,\n\t\tkey: { dir: [-0.8, -1, -0.35], color: \"#ffffff\", intensity: 2.4 },\n\t\trim: { dir: [0.7, -0.4, 1], color: \"#8fb4ff\", intensity: 1.8 },\n\t},\n} satisfies Record<string, RigSpec>;\n\nexport type LightingRig = keyof typeof RIGS;\n\nfunction rotateY(\n\t[x, y, z]: [number, number, number],\n\tdegrees: number,\n): [number, number, number] {\n\tconst r = (degrees * Math.PI) / 180;\n\tconst c = Math.cos(r);\n\tconst s = Math.sin(r);\n\treturn [c * x + s * z, y, -s * x + c * z];\n}\n\nfunction aim(\n\tdir: [number, number, number],\n\ttarget: [number, number, number],\n\tdistance: number,\n\trotation: number,\n): Pick<LightNode, \"x\" | \"y\" | \"z\" | \"targetX\" | \"targetY\" | \"targetZ\"> {\n\tconst [dx, dy, dz] = rotateY(dir, rotation);\n\tconst len = Math.hypot(dx, dy, dz) || 1;\n\treturn {\n\t\tx: target[0] + (dx / len) * distance,\n\t\ty: target[1] + (dy / len) * distance,\n\t\tz: target[2] + (dz / len) * distance,\n\t\ttargetX: target[0],\n\t\ttargetY: target[1],\n\t\ttargetZ: target[2],\n\t};\n}\n\nfunction rig(\n\tname: LightingRig,\n\toptions: LightingRigOptions,\n): AnimatableNode<LightNode>[] {\n\tconst spec: RigSpec = RIGS[name];\n\tconst target = options.target ?? [960, 540, 0];\n\tconst distance = options.distance ?? 1600;\n\tconst rotation = options.rotation ?? 0;\n\tconst k = options.intensity ?? 1;\n\tconst id = options.id ?? autoId(`lighting-${name}`);\n\tconst nodes: AnimatableNode<LightNode>[] = [\n\t\tLight.environment(spec.environment, {\n\t\t\tid: `${id}-environment`,\n\t\t\tintensity: spec.envIntensity * k,\n\t\t\trotation,\n\t\t\texposure: options.exposure,\n\t\t\ttoneMapping: options.toneMapping,\n\t\t\tfog: options.fog,\n\t\t\tbloom: options.bloom,\n\t\t}),\n\t\tLight.directional({\n\t\t\tid: `${id}-key`,\n\t\t\tcolor: spec.key.color,\n\t\t\tintensity: spec.key.intensity * k,\n\t\t\t...aim(spec.key.dir, target, distance, rotation),\n\t\t\tcastShadow: options.shadows ?? true,\n\t\t\tshadowSoftness: options.shadowSoftness ?? 3,\n\t\t}),\n\t];\n\tfor (const [part, light] of [\n\t\t[\"rim\", spec.rim],\n\t\t[\"fill\", spec.fill],\n\t] as const) {\n\t\tif (!light) continue;\n\t\tnodes.push(\n\t\t\tLight.directional({\n\t\t\t\tid: `${id}-${part}`,\n\t\t\t\tcolor: light.color,\n\t\t\t\tintensity: light.intensity * k,\n\t\t\t\t...aim(light.dir, target, distance, rotation),\n\t\t\t}),\n\t\t);\n\t}\n\treturn nodes;\n}\n\n/**\n * Ready-made lighting: an environment (physical shading, tone mapping) plus\n * placed key / rim / fill lights, the key casting a soft shadow. Add the\n * returned nodes to the composition: `comp.add(Lighting.studio({ target }))`.\n *\n * Tweak from there rather than starting from zero: `intensity`, `exposure`,\n * `rotation` (turns the rig), `shadowSoftness`, `fog`.\n */\nexport const Lighting = {\n\tstudio: (options: LightingRigOptions = {}) => rig(\"studio\", options),\n\tsoft: (options: LightingRigOptions = {}) => rig(\"soft\", options),\n\tsunset: (options: LightingRigOptions = {}) => rig(\"sunset\", options),\n\tdramatic: (options: LightingRigOptions = {}) => rig(\"dramatic\", options),\n};\n","export {\n\tAudioSignal,\n\ttype AudioSignalOptions,\n\tcomputed,\n\tcosineSignal,\n\ttype ExtractedAudioSignalsBundle,\n\ttype FrameSignal,\n\tSignal,\n\ttype SignalContext,\n\ttype SignalValue,\n\ttype SineSignalOptions,\n\tsignal,\n\tsignalBuilder,\n\tsignalRegistry,\n\tsineSignal,\n} from \"./signals/index.js\";\n\nimport {\n\tFontManager,\n\ttype MeasuredGlyph,\n\ttype MeasureTextOptions,\n\ttype RegisteredFont,\n\ttype RegisterFontOptions,\n\ttype TextMetrics,\n} from \"./fonts/index.js\";\nimport { autoId } from \"./ids.js\";\nimport { normalizeTextSpans, type TextSpan } from \"./rich-text.js\";\n\nexport {\n\tencodeStereoWav,\n\tmixAudioTracks,\n\tmixSfxInto,\n\ttype RenderedSfx,\n\trenderSfx,\n\ttype SfxRenderContext,\n\ttype SfxTrigger,\n\tsoftLimit,\n} from \"./audio/index.js\";\nexport {\n\taccent,\n\tbold,\n\tcode,\n\tcolor,\n\titalic,\n\ttype MarkOptions,\n\tmark,\n\tnormalizeTextSpans,\n\tparseMarkup,\n\trich,\n\tsize,\n\tspan,\n\tsub,\n\tsup,\n\ttype TextSpan,\n\ttype TextSpanItem,\n\ttype TextSpanMark,\n} from \"./rich-text.js\";\nexport {\n\tFontManager,\n\ttype MeasuredGlyph,\n\ttype MeasureTextOptions,\n\ttype RegisteredFont,\n\ttype RegisterFontOptions,\n\ttype TextMetrics,\n};\n\nexport {\n\tCannyComputePipeline,\n\ttype CannyOptions,\n\ttype ControlNetConditioningOutputs,\n\tControlNetMultiplexer,\n\ttype DeflickerOptions,\n\tDepthNormalsComputePipeline,\n\ttype DepthNormalsOptions,\n\ttype NormalRelightingOptions,\n\tOpticalFlowComputePipeline,\n\ttype OpticalFlowOptions,\n\tTemporalDeflickerPipeline,\n\ttype TensorDimensions,\n\ttype TensorFormat,\n\ttype TensorNode,\n\tTensorPipeline,\n\ttype TensorPipelineConfig,\n\ttype TensorSource,\n\ttype TensorViewExport,\n} from \"@framefields/tensor-webgpu\";\nexport {\n\tCOCO_CLASSES,\n\tCOCO17_BONES,\n\tCOCO17_KEYPOINT_NAMES,\n\tCOCO17_KEYPOINTS,\n\ttype DetectedObject,\n\ttype InstanceMask,\n\ttype Landmark3D,\n\ttype LandmarkCoordinateSignals,\n\ttype MaskTrackSignals,\n\ttype NormalizedLandmarkList,\n\ttype ObjectAnchorName,\n\ttype ObjectAnchorsSignals,\n\ttype ObjectBoundingBox,\n\ttype ObjectBoundingBoxSignals,\n\ttype ObjectCollectionSignals,\n\ttype ObjectKinematicsSignals,\n\ttype ObjectTrackSignals,\n\ttype PersonMatte,\n\ttype PinToLandmarkOptions,\n\ttype PinToObjectOptions,\n\ttype PoseLandmarkSignals,\n\ttype PoseResult,\n\tPoseSkeletonRenderer,\n\tpinNodeToLandmark,\n\tpinNodeToObject,\n\ttype SegmentationResult,\n\tSegmentationTexturePool,\n\tSpatialLandmarkTransformer,\n\tTemporalObjectTracker,\n\ttype TrackedObject,\n\tVisionBundle,\n\ttype VisionConfig,\n\tVisionNode,\n\tVisionRunner,\n\ttype VisionTask,\n\ttype VisionVariant,\n} from \"@framefields/vision\";\n\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n\ttype AnimationTrack,\n\ttype BoxNode,\n\ttype CameraNode,\n\ttype CompositorProgramConfig,\n\ttype CompositorToProgramOptions,\n\tcompositorToProgram,\n\ttype EnvironmentPreset,\n\ttype FlexNode,\n\tLayerAnimation,\n\ttype LayoutNode,\n\ttype LightNode,\n\tlintComposition,\n\ttype MatteMode,\n\ttype MediaNode,\n\ttype Model3DNode,\n\tmergeAnimationTracks,\n\ttype ShapeNode,\n\ttype TextNode,\n} from \"@framefields/compositions/program\";\nimport {\n\tappendOperation,\n\tEffect as CoreEffect,\n\tcreateVirtualMedia,\n\ttype DataType,\n\ttype FrameContext,\n\ttype MediaMetadata,\n\ttype MediaOperation,\n\ttype MediaSourceInput,\n\ttype MeshAudioDeformConfig,\n\tProgrammaticSignal,\n\ttype RenderDiagnostic,\n\ttype Signal,\n\ttype VirtualMediaData,\n} from \"@framefields/core\";\nimport {\n\tanalyzeSequence as analyzeVisionFrames,\n\ttype LandmarkCoordinateSignals,\n\ttype MaskTrackSignals,\n\ttype ObjectTrackSignals,\n\ttype PinToLandmarkOptions,\n\ttype PinToObjectOptions,\n\tpinNodeToLandmark,\n\tpinNodeToObject,\n\ttype VisionAnalysisReport,\n\tVisionBundle,\n\tVisionNode,\n\tVisionRunner,\n\ttype VisionTask,\n} from \"@framefields/vision\";\n\nexport {\n\tanalyzeSequence,\n\ttype VisionAnalysisReport,\n} from \"@framefields/vision\";\n\nimport {\n\ttype DeflickerOptions,\n\ttype NormalRelightingOptions,\n\tTensorPipeline,\n} from \"@framefields/tensor-webgpu\";\nimport { inputStore, mediaDecoderCache } from \"@framefields/webgpu-renderers\";\nimport { buildChart, type ChartOptions } from \"./chart.js\";\nimport {\n\tApplyLUT,\n\ttype ApplyLUTProps,\n\tBlur,\n\ttype BlurProps,\n\tColorBalance,\n\ttype ColorBalanceProps,\n\tColorKey,\n\ttype ColorKeyProps,\n\tCrop,\n\ttype CropProps,\n\tCurves,\n\ttype CurvesProps,\n\tCustomEffect,\n\ttype DeflickerProps,\n\tDepthOfField,\n\ttype DepthOfFieldProps,\n\teffectFactories,\n\tFilmGrain,\n\ttype FilmGrainProps,\n\tGradientMap,\n\ttype GradientMapProps,\n\tHalftoneScreen,\n\ttype HalftoneScreenProps,\n\tHighPass,\n\ttype HighPassProps,\n\tLevels,\n\ttype LevelsProps,\n\tModulate,\n\ttype ModulateProps,\n\tMotionBlur,\n\ttype MotionBlurProps,\n\tPBRGlass,\n\ttype PBRGlassProps,\n\tRelight3D,\n\ttype Relight3DProps,\n\tSelectiveColor,\n\ttype SelectiveColorProps,\n\tShadowsHighlights,\n\ttype ShadowsHighlightsProps,\n\tSSAO,\n\ttype SSAOProps,\n\tTemporalDeflicker,\n\tTileOffset,\n\ttype TileOffsetProps,\n\tUnsharpMask,\n\ttype UnsharpMaskProps,\n\tVignette,\n\ttype VignetteProps,\n\tVision,\n\ttype VisionProps,\n} from \"./effects/index.js\";\nimport {\n\ttype FrameGridOptions,\n\tHeadlessMediaRenderer,\n\trenderFrameGrid,\n\ttype VideoQaOptions,\n\ttype VideoQaReport,\n} from \"./renderer/index.js\";\nimport {\n\ttype Carousel3DOptions,\n\ttype Cube3DOptions,\n\tLayer3D,\n\ttype Plane3DOptions,\n\ttype Prism3DOptions,\n} from \"./shapes3d.js\";\nimport {\n\ttype SceneSequenceOptions,\n\ttype SequenceEntry,\n\ttype SequenceNode,\n\tsequence,\n} from \"./transitions.js\";\n\nexport interface SectionOptions {\n\treadonly id?: string;\n\treadonly position?: \"absolute\" | \"relative\";\n\treadonly source?: string | MediaNode;\n\treadonly effects?: unknown[];\n\treadonly padding?: number;\n\treadonly borderRadius?: number;\n\treadonly borderColor?: string;\n\treadonly borderWidth?: number;\n\treadonly opacity?: number | unknown;\n\treadonly blendMode?: string;\n\treadonly fit?: \"cover\" | \"contain\";\n\treadonly width?: number | unknown;\n\treadonly height?: number | unknown;\n\treadonly x?: number | unknown;\n\treadonly y?: number | unknown;\n\treadonly hideWhenLost?: boolean;\n\treadonly smoothFrames?: number;\n\treadonly children?: LayoutNode[];\n\treadonly [key: string]: unknown;\n}\n\nexport type SectionNode = AnimatableNode<BoxNode> & {\n\treadonly innerMedia: AnimatableNode<MediaNode>;\n\t// Any effect, whatever its config shape (Blur, FilmGrain, …).\n\treadonly effects: Effect<object>[];\n\taddEffect(effect: Effect<object>): SectionNode;\n\twithEffect(effect: Effect<object>): SectionNode;\n\twithEffects(effects: Effect<object>[]): SectionNode;\n};\n\nexport type TrackedRegionOptions = SectionOptions;\n\n/** Editing helpers attached to every tracked object (see decorateTrackSignals). */\nexport interface TrackEditing {\n\t/** A section of the source that follows this track */\n\tsection(\n\t\tsourceOrOptions?: string | MediaNode | SectionOptions,\n\t\toptions?: SectionOptions,\n\t): SectionNode;\n\t/** A blur confined to this track's region */\n\tblurEffect(options?: Partial<BlurProps>): Blur;\n\t/** The tracked region of `source`, cut out as a section */\n\tisolate(\n\t\tsource: string | MediaNode,\n\t\toptions?: TrackedRegionOptions,\n\t): SectionNode;\n}\n\n/** A tracked object with its editing helpers, as vision hands it out. */\nexport type EditableObjectTrack = ObjectTrackSignals & TrackEditing;\n\nfunction decorateTrackSignals<T extends ObjectTrackSignals>(\n\ttrack: T,\n\tsource?: string | MediaNode,\n): T {\n\tif (!track) return track;\n\tif (source && !track.source) {\n\t\tObject.defineProperty(track, \"source\", {\n\t\t\tvalue: source,\n\t\t\tenumerable: true,\n\t\t\twritable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\tif (typeof track.section !== \"function\") {\n\t\tObject.defineProperty(track, \"section\", {\n\t\t\tvalue: (\n\t\t\t\tsourceOrOptions?: string | MediaNode | SectionOptions,\n\t\t\t\toptions?: SectionOptions,\n\t\t\t) => {\n\t\t\t\tif (\n\t\t\t\t\ttypeof sourceOrOptions === \"object\" &&\n\t\t\t\t\tsourceOrOptions !== null &&\n\t\t\t\t\t!(\"kind\" in sourceOrOptions) &&\n\t\t\t\t\t!(\"inputHandleId\" in sourceOrOptions) &&\n\t\t\t\t\t!(\"src\" in sourceOrOptions)\n\t\t\t\t) {\n\t\t\t\t\tconst resolvedSource =\n\t\t\t\t\t\t(sourceOrOptions as SectionOptions).source ??\n\t\t\t\t\t\t(track.source as string | MediaNode | undefined) ??\n\t\t\t\t\t\tsource;\n\t\t\t\t\treturn Layer.section(\n\t\t\t\t\t\tresolvedSource as string | MediaNode,\n\t\t\t\t\t\ttrack,\n\t\t\t\t\t\tsourceOrOptions as SectionOptions,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst resolvedSource =\n\t\t\t\t\tsourceOrOptions ??\n\t\t\t\t\t(track.source as string | MediaNode | undefined) ??\n\t\t\t\t\tsource;\n\t\t\t\treturn Layer.section(\n\t\t\t\t\tresolvedSource as string | MediaNode,\n\t\t\t\t\ttrack,\n\t\t\t\t\toptions,\n\t\t\t\t);\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\tif (typeof track.blurEffect !== \"function\") {\n\t\tObject.defineProperty(track, \"blurEffect\", {\n\t\t\tvalue: (options?: Partial<BlurProps>) => new Blur({ track, ...options }),\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\tif (typeof track.isolate !== \"function\") {\n\t\tObject.defineProperty(track, \"isolate\", {\n\t\t\tvalue: (sourceArg: string | MediaNode, options?: TrackedRegionOptions) =>\n\t\t\t\tLayer.section(sourceArg, track, options),\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\treturn track;\n}\n\nconst origVisionAttach = VisionNode.attach;\nVisionNode.attach = function (\n\tsource: Parameters<typeof origVisionAttach>[0],\n\tconfig?: Parameters<typeof origVisionAttach>[1],\n\tbundleOptions?: Parameters<typeof origVisionAttach>[2],\n): ReturnType<typeof origVisionAttach> {\n\tconst bundle = origVisionAttach.call(this, source, config, bundleOptions);\n\tif (bundle?.objects) {\n\t\tconst src = source as string | MediaNode;\n\t\tconst origGet = bundle.objects.get.bind(bundle.objects);\n\t\tbundle.objects.get = (id: number) => decorateTrackSignals(origGet(id), src);\n\n\t\tconst origByCategory = bundle.objects.byCategory.bind(bundle.objects);\n\t\tbundle.objects.byCategory = (cat: string, rank?: number) =>\n\t\t\tdecorateTrackSignals(origByCategory(cat, rank), src);\n\n\t\tif (bundle.objects.primary) {\n\t\t\tdecorateTrackSignals(bundle.objects.primary, src);\n\t\t}\n\t}\n\treturn bundle;\n};\n\nexport {\n\ttype AdvancedTextAnimator,\n\tAdvancedTextAnimatorBuilder,\n\tAdvancedTextAnimatorSchema,\n\t// Text Animations & After Effects Parity\n\ttype AETextAnimator,\n\tAETextAnimatorSchema,\n\ttype AnchorGrouping,\n\tAnchorGroupingSchema,\n\ttype AnchorPreset,\n\tAnchorPresetSchema,\n\ttype AnimatableGlyphProps,\n\tAnimatableGlyphPropsSchema,\n\ttype AnimatableProp,\n\ttype AnimationTrack,\n\ttype ArcLengthLUTEntry,\n\ttype AudioSpectrumTypography,\n\tAudioSpectrumTypographySchema,\n\tapplyStaggerToChildren,\n\ttype BlockNode,\n\ttype BloomConfig,\n\tBloomConfigSchema,\n\ttype BoxNode,\n\tBoxNodeSchema,\n\tbuildPathLUT,\n\tCameraAnimation,\n\ttype CameraDoF,\n\ttype CameraLens,\n\ttype CameraNode,\n\tCameraNodeSchema,\n\ttype CameraShake,\n\ttype CarrierHandoffConfig,\n\tCarrierHandoffConfigSchema,\n\ttype CarrierState,\n\ttype ChromaticGlitchConfig,\n\tChromaticGlitchConfigSchema,\n\ttype ColorSignalOptions,\n\ttype ColorStop,\n\tColorStopSchema,\n\ttype CompositorProgramConfig,\n\tCompositorProgramSchema,\n\ttype CompositorToProgramOptions,\n\ttype CubicBezierSegment,\n\tCubicBezierSegmentSchema,\n\tcalculateSequenceTimeline,\n\tcollectNodeOps,\n\tcompositorToProgram,\n\tcomputeAnchorPivotOffset,\n\tcomputeCarrierContinuity,\n\tcomputeLayout,\n\tcomputeLayoutSync,\n\tcomputeLineLeadingDisplacement,\n\tcomputeRangeSelectorWeight,\n\tcomputeStaggerDelay,\n\ttype DynamicStrokeProperties,\n\tDynamicStrokePropertiesSchema,\n\tdeterministicWigglyNoise,\n\tdistanceToCurveParameter,\n\ttype EaseRef,\n\ttype EnhancedTextNode,\n\tEnhancedTextNodeSchema,\n\ttype EnvironmentFog,\n\tEnvironmentFogSchema,\n\ttype EnvironmentPreset,\n\tEnvironmentPresetSchema,\n\ttype ExpressionEvaluationContext,\n\ttype ExpressionSelector,\n\tExpressionSelectorSchema,\n\ttype ExtendedGlyphProperties,\n\tExtendedGlyphPropertiesSchema,\n\tellipseToCubicBeziers,\n\tevaluateAnimationAtFrame,\n\tevaluateCubicBezier,\n\tevaluateCubicBezierDerivative,\n\tevaluateExpressionSelector,\n\tevaluateMarqueeOffset,\n\tevaluateSelectorCombination,\n\tevaluateSkewMatrix,\n\tevaluateSpringProgress,\n\tevaluateTrackAtFrame,\n\tevaluateTypewriterState,\n\tevaluateVolumetricFormation,\n\ttype FlexNode,\n\tFlexNodeSchema,\n\ttype FromToOptions,\n\ttype GlyphAnchorGrouping,\n\tGlyphAnchorGroupingSchema,\n\ttype GlyphAnchorPoint,\n\tGlyphAnchorPointSchema,\n\tgenerateArcLengthLUT,\n\tgeneratePathSegments,\n\tgetScramblePool,\n\tgetShuffledOrder,\n\thoistMattes,\n\ttype Keyframe,\n\ttype KeyframeTuple,\n\ttype KineticMarqueeConfig,\n\tKineticMarqueeConfigSchema,\n\tLayerAnimation,\n\ttype LayoutNode,\n\tLayoutNodeSchema,\n\ttype LightNode,\n\tLightNodeSchema,\n\ttype LightType,\n\tLightTypeSchema,\n\ttype LineSpacingDynamics,\n\tLineSpacingDynamicsSchema,\n\ttype LongShadowConfig,\n\tLongShadowConfigSchema,\n\tlintComposition,\n\ttype MaterialType,\n\tMaterialTypeSchema,\n\ttype MatteMode,\n\tMatteModeSchema,\n\ttype MediaNode,\n\tMediaNodeSchema,\n\ttype Model3DNode,\n\tModel3DNodeSchema,\n\tmergeAnimationTracks,\n\ttype ParticleDissolveConfig,\n\tParticleDissolveConfigSchema,\n\ttype PathChainLUT,\n\ttype PathChainLUTEntry,\n\tparseSvgPathToCubicBeziers,\n\tScene,\n\ttype SceneDefinition,\n\tSceneDefinitionSchema,\n\ttype SceneOptions,\n\ttype SceneTransitionType,\n\tSceneTransitionTypeSchema,\n\ttype SelectorBasedOn,\n\tSelectorBasedOnSchema,\n\ttype SelectorMode,\n\tSelectorModeSchema,\n\ttype SelectorShape,\n\tSelectorShapeSchema,\n\ttype SelectorUnits,\n\tSelectorUnitsSchema,\n\tSequence,\n\ttype SequenceOptions,\n\ttype SequenceTimelineResult,\n\ttype ShapeNode,\n\tShapeNodeSchema,\n\ttype SignalTrackOptions,\n\ttype SkewProperties,\n\tSkewPropertiesSchema,\n\ttype Spatial3DProperties,\n\tSpatial3DPropertiesSchema,\n\ttype SpringOptions,\n\ttype SpringPhysics,\n\tSpringPhysicsSchema,\n\tsampleAudioSpectrumScale,\n\tsampleCurveGeometry,\n\tsamplePathChainGeometry,\n\ttype TextAnchorConfig,\n\tTextAnchorConfigSchema,\n\tTextAnimator,\n\tTextAnimatorBuilder,\n\tTextAnimatorSchema,\n\ttype TextCursorConfig,\n\tTextCursorConfigSchema,\n\ttype TextCursorStyle,\n\tTextCursorStyleSchema,\n\ttype TextNode,\n\tTextNodeSchema,\n\tTextPathBuilder,\n\ttype TextPathOptions,\n\tTextPathOptionsSchema,\n\ttype TextPathSource,\n\tTextPathSourceSchema,\n\ttype TextRangeSelector,\n\tTextRangeSelectorSchema,\n\ttype TextScrambleConfig,\n\tTextScrambleConfigSchema,\n\ttype TextSelector,\n\tTextSelectorSchema,\n\ttype TextSignalSelector,\n\tTextSignalSelectorSchema,\n\tTextSpanMarkSchema,\n\tTextSpanSchema,\n\ttype TextWigglySelector,\n\tTextWigglySelectorSchema,\n\ttype ToneMapping,\n\tToneMappingSchema,\n\ttype TrackSource,\n\ttype TypewriterAnimator,\n\tTypewriterAnimatorSchema,\n\ttype TypingCadence,\n\tTypingCadenceSchema,\n\ttype VariableFontAxes,\n\tVariableFontAxesSchema,\n\ttype Vec2,\n\tVec2Schema,\n\ttype VolumetricFormationConfig,\n\tVolumetricFormationConfigSchema,\n\ttype VolumetricFormationMode,\n\tVolumetricFormationModeSchema,\n\ttype WiggleOptions,\n\twaveToCubicBeziers,\n} from \"@framefields/compositions/program\";\nexport * from \"@framefields/core\";\nexport * from \"@framefields/renderers\";\nexport {\n\ttype AnimationClip3D,\n\ttype AudioLatentData,\n\tAudioLatentEngine,\n\tAudioLatentTrackCache,\n\tAudioMeshDeformPipeline,\n\ttype BlendMode,\n\ttype Bone3D,\n\tCamera3D,\n\tEffectPipeline,\n\tensureDevice,\n\tGlassPipeline,\n\ttype GPULightData,\n\tinputStore,\n\tLight3D,\n\ttype Light3DOptions,\n\ttype LoadModelOptions,\n\tloadFBX,\n\tloadModel3D,\n\tloadOBJ,\n\tlutStore,\n\ttype Material3D,\n\ttype Mesh3DData,\n\ttype Model3DData,\n\tMotionBlurPipeline,\n\ttype NodeAnimationTrack3D,\n\tPath3D,\n\tparseFBX,\n\tparseMTL,\n\tparseOBJ,\n\ttype RenderContextValue,\n\tRenderer2D,\n\tRenderer3D,\n\tShadowPipeline,\n\ttype Skeleton3D,\n\tSlugFontCache,\n\tSlugPipeline,\n\tSSAOPipeline,\n\tshaderStore,\n\ttextureCache,\n} from \"@framefields/webgpu-renderers\";\nexport {\n\ttype ChartAnimationOptions,\n\ttype ChartAxisOptions,\n\ttype ChartCandle,\n\ttype ChartDatum,\n\ttype ChartOptions,\n\ttype ChartPadding,\n\ttype ChartSeries,\n\ttype ChartSlice,\n\ttype ChartType,\n\ttype ChartX,\n\tDEFAULT_CHART_COLORS,\n} from \"./chart.js\";\nexport {\n\tApplyLUT,\n\ttype ApplyLUTProps,\n\tAudioCompressor,\n\ttype AudioCompressorProps,\n\tAudioDelay,\n\ttype AudioDelayProps,\n\tAudioFade,\n\ttype AudioFadeProps,\n\tAudioNoiseGate,\n\ttype AudioNoiseGateProps,\n\tAudioParametricEq,\n\ttype AudioParametricEqProps,\n\tAudioReverb,\n\ttype AudioReverbProps,\n\tAudioSignalExtractor,\n\ttype AudioSignalExtractorProps,\n\tBlur,\n\ttype BlurProps,\n\tCameraParallax3D,\n\ttype CameraParallax3DProps,\n\tChannelMerger,\n\ttype ChannelMergerProps,\n\tChannelSplitter,\n\ttype ChannelSplitterProps,\n\tColorBalance,\n\ttype ColorBalanceProps,\n\tColorKey,\n\ttype ColorKeyProps,\n\tCornerPin,\n\ttype CornerPinProps,\n\tCrop,\n\ttype CropProps,\n\tCurves,\n\ttype CurvesChannelPoint,\n\ttype CurvesProps,\n\tCustomEffect,\n\ttype DeflickerProps,\n\tDepthOfField,\n\ttype DepthOfFieldProps,\n\tDisplacementMap,\n\ttype DisplacementMapProps,\n\tExtractLUT,\n\ttype ExtractLUTProps,\n\teffectFactories,\n\teffectMeta,\n\tFilmGrain,\n\ttype FilmGrainProps,\n\tFlip,\n\ttype FlipProps,\n\tGradientMap,\n\ttype GradientMapProps,\n\ttype GradientMapStop,\n\ttype HalftoneDotShape,\n\ttype HalftoneMode,\n\tHalftoneScreen,\n\ttype HalftoneScreenProps,\n\tHighPass,\n\ttype HighPassProps,\n\tKenBurns,\n\ttype KenBurnsProps,\n\tLayerStyle,\n\ttype LayerStyleProps,\n\ttype LevelChannel,\n\tLevels,\n\ttype LevelsProps,\n\tLiquify,\n\ttype LiquifyProps,\n\tMaskMath,\n\ttype MaskMathProps,\n\tMeshWarp,\n\ttype MeshWarpProps,\n\tModulate,\n\ttype ModulateProps,\n\tMotionBlur,\n\ttype MotionBlurProps,\n\tNoiseGenerator,\n\ttype NoiseGeneratorProps,\n\tPaint,\n\ttype PaintProps,\n\tPatchHeal,\n\ttype PatchHealProps,\n\tPBRGlass,\n\ttype PBRGlassProps,\n\tProceduralVFX,\n\ttype ProceduralVFXProps,\n\tRefineEdge,\n\ttype RefineEdgeProps,\n\tRefractionCaustics3D,\n\ttype RefractionCaustics3DProps,\n\tRelight3D,\n\ttype Relight3DProps,\n\tResizerScaler,\n\ttype ResizerScalerProps,\n\tRotate,\n\ttype RotateProps,\n\tSelectiveColor,\n\ttype SelectiveColorAdjustment,\n\ttype SelectiveColorProps,\n\tShadowsHighlights,\n\ttype ShadowsHighlightsProps,\n\tSSAO,\n\ttype SSAOProps,\n\tStereoPanning,\n\ttype StereoPanningProps,\n\tTemporalDeflicker,\n\tTileOffset,\n\ttype TileOffsetEdgeMode,\n\ttype TileOffsetProps,\n\tUnsharpMask,\n\ttype UnsharpMaskProps,\n\tVignette,\n\ttype VignetteProps,\n\tVision,\n\ttype VisionProps,\n} from \"./effects/index.js\";\nexport {\n\tLighting,\n\ttype LightingRig,\n\ttype LightingRigOptions,\n} from \"./lighting.js\";\nexport {\n\ttype Carousel3DOptions,\n\ttype Cube3DOptions,\n\ttype CubeFaceConfig,\n\ttype CubeFaceInput,\n\ttype Cylinder3DOptions,\n\ttype ExtrudedText3DOptions,\n\ttype Grid3DOptions,\n\tLayer3D,\n\ttype Plane3DOptions,\n\ttype Primitive3DNodeOptions,\n\ttype Prism3DOptions,\n\ttype RoundedBox3DOptions,\n\ttype Shape3DContainer,\n\ttype Sphere3DOptions,\n\ttype Surface3DOptions,\n\ttype Text3DOptions,\n} from \"./shapes3d.js\";\nexport {\n\ttype SceneSequenceOptions,\n\ttype SequenceEntry,\n\ttype SequenceNode,\n\tTransition,\n\ttype TransitionDirection,\n\ttype TransitionSpec,\n} from \"./transitions.js\";\n\nexport interface CompositionOptions {\n\twidth: number;\n\theight: number;\n\tfps?: number;\n\tdurationMs?: number;\n\tdurationFrames?: number;\n\tbackgroundColor?: string;\n\tfonts?: string[];\n\tsignals?: Record<string, unknown>;\n\t/**\n\t * Smooth the edges of 3D meshes (extruded text, models) with 4x MSAA.\n\t * Default true; set false to save ~60-125 MB of GPU memory at 1080p.\n\t */\n\tantialias3d?: boolean;\n}\n\n/**\n * Fluent builder for single clips and chained visual/audio effect pipelines.\n */\nexport class Media {\n\tpublic readonly virtualMedia: VirtualMediaData;\n\n\tconstructor(source: MediaSourceInput, type: DataType = \"Video\") {\n\t\tthis.virtualMedia = createVirtualMedia(source, type);\n\t}\n\n\tstatic video(source: MediaSourceInput, meta?: Partial<MediaMetadata>): Media {\n\t\tconst m = new Media(source, \"Video\");\n\t\tif (meta) Object.assign(m.virtualMedia.metadata, meta);\n\t\treturn m;\n\t}\n\n\tstatic image(source: MediaSourceInput, meta?: Partial<MediaMetadata>): Media {\n\t\tconst m = new Media(source, \"Image\");\n\t\tif (meta) Object.assign(m.virtualMedia.metadata, meta);\n\t\treturn m;\n\t}\n\n\tstatic audio(source: MediaSourceInput, meta?: Partial<MediaMetadata>): Media {\n\t\tconst m = new Media(source, \"Audio\");\n\t\tif (meta) Object.assign(m.virtualMedia.metadata, meta);\n\t\treturn m;\n\t}\n\n\t/**\n\t * Appends any Effect instance or shader operation onto the current media AST.\n\t */\n\tpublic apply<TProps extends object>(effect: Effect<TProps>): Media;\n\tpublic apply<\n\t\tTConfig extends Record<string, unknown> = Record<string, unknown>,\n\t>(op: string, config?: TConfig): Media;\n\tpublic apply(\n\t\teffectOrOp: Effect<object> | string,\n\t\tconfig: Record<string, unknown> = {},\n\t): Media {\n\t\tlet opPayload: Record<string, unknown>;\n\t\tif (\n\t\t\teffectOrOp instanceof Effect ||\n\t\t\t(typeof effectOrOp === \"object\" &&\n\t\t\t\teffectOrOp !== null &&\n\t\t\t\t\"op\" in effectOrOp)\n\t\t) {\n\t\t\topPayload = (effectOrOp as Effect<object>).toOperation();\n\t\t} else {\n\t\t\topPayload = {\n\t\t\t\top: effectOrOp,\n\t\t\t\t...config,\n\t\t\t};\n\t\t}\n\n\t\tconst nextVM = appendOperation(this.virtualMedia, {\n\t\t\t...opPayload,\n\t\t\tdataType: this.virtualMedia.operation.dataType,\n\t\t} as MediaOperation);\n\t\treturn new Media(nextVM);\n\t}\n\n\t/**\n\t * Returns the underlying VirtualMediaData AST node ready for rendering.\n\t */\n\tpublic toVirtualMedia(): VirtualMediaData {\n\t\treturn this.virtualMedia;\n\t}\n\n\t/**\n\t * Renders a single frame from this media pipeline to a PNG Buffer.\n\t * Can render either by timestamp in milliseconds (`atMs`) or by frame index (`frame`).\n\t */\n\tpublic async renderFrame(\n\t\toptions: {\n\t\t\tatMs?: number;\n\t\t\tframe?: number;\n\t\t\tfps?: number;\n\t\t\trenderer?: HeadlessMediaRenderer;\n\t\t} = {},\n\t): Promise<Buffer> {\n\t\tconst renderer = options.renderer ?? new HeadlessMediaRenderer();\n\t\treturn renderer.renderFrame(this.virtualMedia, options);\n\t}\n\n\tget fps(): number | undefined {\n\t\treturn this.virtualMedia.metadata?.fps ?? undefined;\n\t}\n\n\tget durationMs(): number | undefined {\n\t\treturn this.virtualMedia.metadata?.durationMs ?? undefined;\n\t}\n\n\tget width(): number | undefined {\n\t\treturn this.virtualMedia.metadata?.width ?? undefined;\n\t}\n\n\tget height(): number | undefined {\n\t\treturn this.virtualMedia.metadata?.height ?? undefined;\n\t}\n\n\t/**\n\t * Renders an image grid of sequential frames across a given frame or millisecond range.\n\t * Ideal for automated visual inspection of animation motion, easing curves, and layout stability.\n\t */\n\tpublic async renderFrameGrid(\n\t\toptions: FrameGridOptions = {},\n\t): Promise<Buffer> {\n\t\treturn renderFrameGrid(this, options);\n\t}\n\n\t/**\n\t * Renders this media pipeline into an MP4/WebM video file with audio.\n\t */\n\tpublic async renderVideo(\n\t\toutputPathOrOptions: string | RenderVideoOptions = {},\n\t\toptions: RenderVideoOptions = {},\n\t): Promise<RenderVideoResult> {\n\t\tconst opts =\n\t\t\ttypeof outputPathOrOptions === \"string\"\n\t\t\t\t? { ...options, outputPath: outputPathOrOptions }\n\t\t\t\t: outputPathOrOptions;\n\t\tconst renderer = opts.renderer ?? new HeadlessMediaRenderer();\n\t\tconst result = await renderer.renderVideo(this.virtualMedia, opts);\n\t\treturn deliverToOutputPath(result, opts.outputPath);\n\t}\n}\n\n/**\n * Copies a rendered temp file to `outputPath` and drops the temp, so the\n * returned `filePath` is where the video actually lives.\n */\nasync function deliverToOutputPath(\n\tresult: RenderVideoResult,\n\toutputPath: string | undefined,\n): Promise<RenderVideoResult> {\n\tif (!outputPath) return result;\n\tconst target = path.resolve(outputPath);\n\tawait fs.mkdir(path.dirname(target), { recursive: true });\n\tawait fs.copyFile(result.filePath, target);\n\tawait result.cleanup();\n\treturn { ...result, filePath: target, cleanup: async () => {} };\n}\n\nexport interface RenderVideoOptions {\n\tcodec?: string;\n\taudioCodec?: string;\n\tquality?: string;\n\tconcurrency?: number;\n\t/**\n\t * Depth of the DMA staging ring used to overlap GPU rendering with hardware\n\t * encoding (default 2, clamped 2–8). A deeper ring hides more encoder\n\t * latency at the cost of VRAM (~8.3MB/slot at 1080p RGBA). Also settable\n\t * via `FRAMEFIELDS_RING_CAPACITY`.\n\t */\n\tringCapacity?: number;\n\toutputPath?: string;\n\trenderer?: HeadlessMediaRenderer;\n\t/**\n\t * Check the output while it renders and return the findings as `qa`:\n\t * dropped, black or frozen frames, loudness (LUFS), clipping, silence and\n\t * document warnings such as truncated animations. `true` uses defaults;\n\t * pass thresholds (e.g. `{ targetLufs: -14 }`) to tighten them.\n\t */\n\tqa?: boolean | VideoQaOptions;\n}\n\nexport interface RenderVideoResult {\n\tfilePath: string;\n\tcleanup: () => Promise<void>;\n\t/** Present when rendered with `qa`; print it with `formatQaReport` */\n\tqa?: VideoQaReport;\n}\n\nexport interface SubjectSandwichOptions {\n\treadonly source: string | MediaNode;\n\treadonly subject?: MaskTrackSignals | ObjectTrackSignals;\n\treadonly behind: readonly LayoutNode[];\n\treadonly feather?: number;\n\treadonly fit?: \"cover\" | \"contain\" | \"fill\";\n\treadonly variant?: VisionProps[\"variant\"];\n\treadonly confidence?: number;\n\treadonly keyBackground?: boolean;\n\treadonly backgroundKeyThreshold?: number;\n\treadonly muted?: boolean;\n\treadonly volume?: number;\n}\n\nexport interface SmartFramingOptions {\n\treadonly source: string | MediaNode;\n\treadonly targetAspect?: number;\n\treadonly sourceAspect?: number;\n\treadonly target: ObjectTrackSignals | MaskTrackSignals;\n\treadonly damping?: number;\n\treadonly leadHeadroom?: number;\n\treadonly fit?: \"cover\" | \"contain\" | \"fill\";\n\treadonly variant?: VisionProps[\"variant\"];\n\treadonly muted?: boolean;\n\treadonly volume?: number;\n}\n\nexport interface SubjectOutlineOptions {\n\treadonly source?: string | MediaNode;\n\treadonly color?: string;\n\treadonly width?: number;\n\treadonly blur?: number;\n\treadonly pulseSignal?: ProgrammaticSignal | Signal<number>;\n\treadonly muted?: boolean;\n\treadonly volume?: number;\n}\n\n/**\n * High-level programmatic builder for multi-layer Framefields compositions.\n */\nexport class Composition {\n\tpublic width: number;\n\tpublic height: number;\n\tpublic fps: number;\n\tpublic durationMs?: number;\n\tpublic backgroundColor: string;\n\tpublic antialias3d?: boolean;\n\tpublic fonts: string[];\n\tpublic children: LayoutNode[] = [];\n\tpublic audioTracks: MediaNode[] = [];\n\tpublic signals: Record<string, unknown> = {};\n\tprivate _frameHooks: Array<(ctx: FrameContext) => void> = [];\n\tprivate _visionConfig?: VisionProps;\n\tprivate _visionBundle?: VisionBundle;\n\tprivate _effects: unknown[] = [];\n\n\t/**\n\t * Applies a whole-composition post-processing effect or vision pipeline.\n\t */\n\tpublic apply(effect: unknown): this {\n\t\tif (effect instanceof Vision) {\n\t\t\tthis.withVision(effect);\n\t\t\treturn this;\n\t\t}\n\t\tthis._effects.push(effect);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Runs vision on the whole composition — the rendered frame (composition, blur, crop,\n\t * anything upstream) is the inference input. Models are LAZY: nothing downloads until\n\t * the first frame actually runs a task.\n\t * Returns the reactive VisionBundle (objects / masks / pose / classes signals).\n\t */\n\tpublic withVision(config: VisionProps | Vision = {}): VisionBundle {\n\t\tthis._visionBundle ??= new VisionBundle({\n\t\t\twidth: this.width,\n\t\t\theight: this.height,\n\t\t\tfps: this.fps,\n\t\t});\n\t\tconst rawConfig =\n\t\t\tconfig instanceof Vision ? (config.config as VisionProps) : config;\n\t\tthis._visionConfig = {\n\t\t\t...rawConfig,\n\t\t\tvisionBundle: this._visionBundle,\n\t\t};\n\t\treturn this._visionBundle;\n\t}\n\n\t/**\n\t * One-shot, ffmpeg-free vision analysis of a media source.\n\t *\n\t * Decodes frames through the same mediabunny pipeline the renderer uses, runs the requested\n\t * tasks lazily (only those models download), temporally tracks detections, and returns a\n\t * zod-serializable report. The decoder is released and the runner closed on completion.\n\t */\n\tpublic async analyzeVisionSequence(\n\t\tsource: string,\n\t\toptions: {\n\t\t\ttasks?: readonly VisionTask[];\n\t\t\tcategories?: readonly string[];\n\t\t\tfps?: number;\n\t\t\ttotalFrames?: number;\n\t\t\tpathStride?: number;\n\t\t\tincludeMasks?: boolean;\n\t\t\tmodelsDir?: string;\n\t\t\tbaseUrl?: string;\n\t\t\tconfidence?: number;\n\t\t\tvariant?: VisionProps[\"variant\"];\n\t\t\t/** Tracker box-association IoU. Default 0.25. */\n\t\t\tiouThreshold?: number;\n\t\t} = {},\n\t): Promise<VisionAnalysisReport> {\n\t\tconst fps = options.fps ?? this.fps;\n\t\tconst durationMs = this.durationMs ?? (await this.computeDuration());\n\t\tconst totalFrames =\n\t\t\toptions.totalFrames ?? Math.max(1, Math.round((durationMs / 1000) * fps));\n\n\t\tconst runner = VisionRunner.create({\n\t\t\tmodelsDir: options.modelsDir,\n\t\t\tbaseUrl: options.baseUrl,\n\t\t\t...(options.confidence !== undefined\n\t\t\t\t? { confidence: options.confidence }\n\t\t\t\t: {}),\n\t\t\t...(options.variant !== undefined ? { variant: options.variant } : {}),\n\t\t});\n\n\t\tconst decoder = mediaDecoderCache.getVideo(source, true);\n\t\tasync function* frameSource(): AsyncGenerator<{\n\t\t\tdata: Uint8Array;\n\t\t\twidth: number;\n\t\t\theight: number;\n\t\t}> {\n\t\t\tfor (let i = 0; i < totalFrames; i++) {\n\t\t\t\tconst frame = await decoder.getFrame(i / fps);\n\t\t\t\tif (frame?.buffer && frame.width > 0 && frame.height > 0) {\n\t\t\t\t\tyield {\n\t\t\t\t\t\tdata: frame.buffer,\n\t\t\t\t\t\twidth: frame.width,\n\t\t\t\t\t\theight: frame.height,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\treturn await analyzeVisionFrames(frameSource(), {\n\t\t\t\trunner,\n\t\t\t\tsource,\n\t\t\t\tfps,\n\t\t\t\t...(options.tasks !== undefined ? { tasks: options.tasks } : {}),\n\t\t\t\t...(options.categories !== undefined\n\t\t\t\t\t? { categories: options.categories }\n\t\t\t\t\t: {}),\n\t\t\t\t...(options.pathStride !== undefined\n\t\t\t\t\t? { pathStride: options.pathStride }\n\t\t\t\t\t: {}),\n\t\t\t\t...(options.includeMasks !== undefined\n\t\t\t\t\t? { includeMasks: options.includeMasks }\n\t\t\t\t\t: {}),\n\t\t\t\t...(options.iouThreshold !== undefined\n\t\t\t\t\t? { iouThreshold: options.iouThreshold }\n\t\t\t\t\t: {}),\n\t\t\t});\n\t\t} finally {\n\t\t\trunner.close();\n\t\t\tdecoder.destroy();\n\t\t}\n\t}\n\n\t/**\n\t * Game-engine per-frame lifecycle hook for the composition.\n\t * Invoked before rendering each frame so scripts or agents can mutate properties and signals.\n\t */\n\tpublic onRequestFrame(callback: (ctx: FrameContext) => void): this {\n\t\tthis._frameHooks.push(callback);\n\t\treturn this;\n\t}\n\n\tpublic notifyFrame(ctx: FrameContext): void {\n\t\tfor (const hook of this._frameHooks) {\n\t\t\thook(ctx);\n\t\t}\n\t}\n\n\tconstructor(options: CompositionOptions) {\n\t\tthis.width = options.width;\n\t\tthis.height = options.height;\n\t\tthis.fps = options.fps ?? 60;\n\t\tthis.durationMs =\n\t\t\toptions.durationMs ??\n\t\t\t(options.durationFrames !== undefined\n\t\t\t\t? (options.durationFrames / this.fps) * 1000\n\t\t\t\t: undefined);\n\t\tthis.backgroundColor = options.backgroundColor ?? \"#000000\";\n\t\tthis.antialias3d = options.antialias3d;\n\t\tthis.fonts = options.fonts ?? [];\n\t\tthis.signals = options.signals ?? {};\n\t}\n\n\tpublic static create(options: CompositionOptions): Composition {\n\t\treturn new Composition(options);\n\t}\n\n\tpublic addSignal(name: string, signal: unknown): this {\n\t\tthis.signals[name] = signal;\n\t\treturn this;\n\t}\n\n\tpublic add(\n\t\tlayerOrFirst:\n\t\t\t| LayoutNode\n\t\t\t| LayoutNode[]\n\t\t\t| TensorPipeline\n\t\t\t| VisionNode\n\t\t\t| { node: unknown },\n\t\t...rest: Array<\n\t\t\t| LayoutNode\n\t\t\t| LayoutNode[]\n\t\t\t| TensorPipeline\n\t\t\t| VisionNode\n\t\t\t| { node: unknown }\n\t\t\t| LayerAnimation\n\t\t\t| { tracks: AnimationTrack[] }\n\t\t>\n\t): this {\n\t\tif (layerOrFirst instanceof TensorPipeline) {\n\t\t\tthis.children.push(layerOrFirst.toNode() as unknown as LayoutNode);\n\t\t} else if (layerOrFirst instanceof VisionNode) {\n\t\t\tthis.children.push(layerOrFirst.toNode() as unknown as LayoutNode);\n\t\t} else if (\n\t\t\tlayerOrFirst &&\n\t\t\ttypeof layerOrFirst === \"object\" &&\n\t\t\t\"node\" in layerOrFirst\n\t\t) {\n\t\t\tthis.add(\n\t\t\t\t(\n\t\t\t\t\tlayerOrFirst as {\n\t\t\t\t\t\tnode: LayoutNode | TensorPipeline | { node: unknown };\n\t\t\t\t\t}\n\t\t\t\t).node as LayoutNode,\n\t\t\t\t...rest,\n\t\t\t);\n\t\t\treturn this;\n\t\t} else if (Array.isArray(layerOrFirst)) {\n\t\t\tfor (const l of layerOrFirst) {\n\t\t\t\tthis.add(l);\n\t\t\t}\n\t\t} else {\n\t\t\tconst targetNode = layerOrFirst as LayoutNode;\n\t\t\tconst animCandidate = rest[0];\n\t\t\tif (\n\t\t\t\tanimCandidate &&\n\t\t\t\t!(animCandidate instanceof TensorPipeline) &&\n\t\t\t\t!Array.isArray(animCandidate) &&\n\t\t\t\t(animCandidate instanceof LayerAnimation || \"tracks\" in animCandidate)\n\t\t\t) {\n\t\t\t\ttargetNode.animation =\n\t\t\t\t\tanimCandidate instanceof LayerAnimation\n\t\t\t\t\t\t? animCandidate.toSpec()\n\t\t\t\t\t\t: animCandidate;\n\t\t\t\tthis.children.push(targetNode);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t\tthis.children.push(targetNode);\n\t\t}\n\n\t\tfor (const item of rest) {\n\t\t\tif (item && !(item instanceof LayerAnimation) && !(\"tracks\" in item)) {\n\t\t\t\tthis.add(\n\t\t\t\t\titem as\n\t\t\t\t\t\t| LayoutNode\n\t\t\t\t\t\t| LayoutNode[]\n\t\t\t\t\t\t| TensorPipeline\n\t\t\t\t\t\t| { node: unknown },\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tpublic addAudio(track: MediaNode): this {\n\t\tthis.audioTracks.push(track);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Turnkey \"Text Behind Subject\" (\"Sandwich\") Primitive.\n\t * Lowers into:\n\t * 1. Bottom Layer: Full background video plate\n\t * 2. Middle Layer: User-supplied `behind` nodes\n\t * 3. Top Layer: Subject cutout video with continuous matte alpha registered at identical coordinates\n\t */\n\tpublic addSubjectSandwich(options: SubjectSandwichOptions): this {\n\t\tconst src =\n\t\t\ttypeof options.source === \"string\"\n\t\t\t\t? options.source\n\t\t\t\t: (options.source.inputHandleId ?? \"\");\n\t\tconst fit = options.fit ?? \"cover\";\n\t\tconst feather = options.feather ?? 4;\n\t\tconst featherVal = feather > 1 ? feather / 100 : feather;\n\t\tconst variant = options.variant ?? \"s\";\n\n\t\t// 1. Bottom Layer: Full background video plate\n\t\tconst bottomPlate = Layer.video(src, {\n\t\t\twidth: this.width,\n\t\t\theight: this.height,\n\t\t\tposition: \"absolute\",\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tfit,\n\t\t\tmuted: options.muted ?? false,\n\t\t\tvolume: options.muted ? 0 : (options.volume ?? 1),\n\t\t});\n\t\tthis.add(bottomPlate);\n\n\t\t// 2. Middle Layer: User-supplied `behind` nodes\n\t\tfor (const node of options.behind) {\n\t\t\tthis.add(node);\n\t\t}\n\n\t\t// 3. Top Layer: Subject cutout video with continuous matte alpha registered at identical coordinates\n\t\tconst topPlate = Layer.video(src, {\n\t\t\twidth: this.width,\n\t\t\theight: this.height,\n\t\t\tposition: \"absolute\",\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tfit,\n\t\t\tmuted: true,\n\t\t\tvolume: 0,\n\t\t}).withVision({\n\t\t\tmode: \"matte\",\n\t\t\tenableSegmentation: true,\n\t\t\tvariant,\n\t\t\tconfidence: options.confidence ?? 0.25,\n\t\t\tfeatherRadius: featherVal,\n\t\t\tkeyBackground: options.keyBackground ?? true,\n\t\t\tbackgroundKeyThreshold: options.backgroundKeyThreshold,\n\t\t});\n\t\tthis.add(topPlate);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Dynamic Smart Re-Framing (16:9 → 9:16 Auto-Crop).\n\t * Automatically transforms landscape footage into vertical shorts/reels by framing the\n\t * tracked subject with smooth camera physics and lead headroom.\n\t */\n\tpublic addSmartFraming(options: SmartFramingOptions): this {\n\t\tconst src =\n\t\t\ttypeof options.source === \"string\"\n\t\t\t\t? options.source\n\t\t\t\t: (options.source.inputHandleId ?? \"\");\n\t\tconst damping = Math.max(0, Math.min(0.99, options.damping ?? 0.8));\n\t\tconst headroom = options.leadHeadroom ?? 0.18;\n\t\tconst compW = this.width;\n\t\tconst compH = this.height;\n\n\t\tconst sourceAspect = options.sourceAspect ?? 16 / 9;\n\t\tconst compAspect = compW / compH;\n\n\t\t// Calculate canvas coverage dimensions to avoid black bars during pan\n\t\tconst plateWidth =\n\t\t\tcompAspect < sourceAspect ? Math.round(compH * sourceAspect) : compW;\n\t\tconst plateHeight =\n\t\t\tcompAspect < sourceAspect ? compH : Math.round(compW / sourceAspect);\n\n\t\tconst minOffsetX = compW - plateWidth; // <= 0\n\t\tconst minOffsetY = compH - plateHeight; // <= 0\n\n\t\tconst targetObj = options.target as unknown as {\n\t\t\tcenter?: {\n\t\t\t\tx?: ProgrammaticSignal;\n\t\t\t\ty?: ProgrammaticSignal;\n\t\t\t\tscreenX?: ProgrammaticSignal;\n\t\t\t\tscreenY?: ProgrammaticSignal;\n\t\t\t};\n\t\t\tbounds?: {\n\t\t\t\tx?: ProgrammaticSignal;\n\t\t\t\ty?: ProgrammaticSignal;\n\t\t\t\twidth?: ProgrammaticSignal;\n\t\t\t\theight?: ProgrammaticSignal;\n\t\t\t\tcenterX?: ProgrammaticSignal;\n\t\t\t\tcenterY?: ProgrammaticSignal;\n\t\t\t};\n\t\t};\n\n\t\tconst rawOffsetX = new ProgrammaticSignal(\n\t\t\t(ctx) => {\n\t\t\t\tif (minOffsetX >= 0) return 0;\n\t\t\t\tconst normX = targetObj.center?.x\n\t\t\t\t\t? targetObj.center.x.get(ctx)\n\t\t\t\t\t: targetObj.bounds?.centerX\n\t\t\t\t\t\t? targetObj.bounds.centerX.get(ctx) / compW\n\t\t\t\t\t\t: targetObj.center?.screenX\n\t\t\t\t\t\t\t? targetObj.center.screenX.get(ctx) / compW\n\t\t\t\t\t\t\t: 0.5;\n\t\t\t\tconst clampedNormX = Math.max(0, Math.min(1, normX));\n\t\t\t\tconst targetPx = clampedNormX * plateWidth;\n\t\t\t\tconst desired = compW / 2 - targetPx;\n\t\t\t\treturn Math.max(minOffsetX, Math.min(0, desired));\n\t\t\t},\n\t\t\t{ fps: this.fps, label: \"smart_framing_pan_x\" },\n\t\t);\n\n\t\tconst rawOffsetY = new ProgrammaticSignal(\n\t\t\t(ctx) => {\n\t\t\t\tif (minOffsetY >= 0) return 0;\n\t\t\t\tconst normY = targetObj.center?.y\n\t\t\t\t\t? targetObj.center.y.get(ctx)\n\t\t\t\t\t: targetObj.bounds?.centerY\n\t\t\t\t\t\t? targetObj.bounds.centerY.get(ctx) / compH\n\t\t\t\t\t\t: targetObj.center?.screenY\n\t\t\t\t\t\t\t? targetObj.center.screenY.get(ctx) / compH\n\t\t\t\t\t\t\t: 0.5;\n\t\t\t\tconst clampedNormY = Math.max(0, Math.min(1, normY));\n\t\t\t\tconst targetPy = clampedNormY * plateHeight;\n\t\t\t\tconst desired = compH * headroom - targetPy;\n\t\t\t\treturn Math.max(minOffsetY, Math.min(0, desired));\n\t\t\t},\n\t\t\t{ fps: this.fps, label: \"smart_framing_pan_y\" },\n\t\t);\n\n\t\t// Damped camera smoothing\n\t\tconst smoothOffsetX = new ProgrammaticSignal(\n\t\t\t(ctx) => {\n\t\t\t\tconst targetFrame = ctx.frame;\n\t\t\t\tif (targetFrame <= 0) return rawOffsetX.get(ctx);\n\t\t\t\tlet filtered = rawOffsetX.get({ ...ctx, frame: 0, time: 0 });\n\t\t\t\tconst alpha = 1.0 - damping;\n\t\t\t\tfor (let f = 1; f <= targetFrame; f++) {\n\t\t\t\t\tconst val = rawOffsetX.get({ ...ctx, frame: f, time: f / ctx.fps });\n\t\t\t\t\tfiltered = filtered + alpha * (val - filtered);\n\t\t\t\t}\n\t\t\t\treturn filtered;\n\t\t\t},\n\t\t\t{ fps: this.fps, label: \"smart_framing_smooth_x\" },\n\t\t);\n\n\t\tconst smoothOffsetY = new ProgrammaticSignal(\n\t\t\t(ctx) => {\n\t\t\t\tconst targetFrame = ctx.frame;\n\t\t\t\tif (targetFrame <= 0) return rawOffsetY.get(ctx);\n\t\t\t\tlet filtered = rawOffsetY.get({ ...ctx, frame: 0, time: 0 });\n\t\t\t\tconst alpha = 1.0 - damping;\n\t\t\t\tfor (let f = 1; f <= targetFrame; f++) {\n\t\t\t\t\tconst val = rawOffsetY.get({ ...ctx, frame: f, time: f / ctx.fps });\n\t\t\t\t\tfiltered = filtered + alpha * (val - filtered);\n\t\t\t\t}\n\t\t\t\treturn filtered;\n\t\t\t},\n\t\t\t{ fps: this.fps, label: \"smart_framing_smooth_y\" },\n\t\t);\n\n\t\tconst container = Layer.box({\n\t\t\twidth: compW,\n\t\t\theight: compH,\n\t\t\toverflow: \"hidden\",\n\t\t\tposition: \"relative\",\n\t\t});\n\n\t\tconst videoPlate = Layer.video(src, {\n\t\t\twidth: plateWidth,\n\t\t\theight: plateHeight,\n\t\t\tposition: \"absolute\",\n\t\t\tx: smoothOffsetX as unknown as number,\n\t\t\ty: smoothOffsetY as unknown as number,\n\t\t\tfit: options.fit ?? \"cover\",\n\t\t\tmuted: options.muted ?? false,\n\t\t\tvolume: options.muted ? 0 : (options.volume ?? 1),\n\t\t});\n\n\t\tif (!container.children) {\n\t\t\tcontainer.children = [];\n\t\t}\n\t\tcontainer.children.push(videoPlate);\n\t\tthis.add(container);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Subject Contour Glow & Neon Outline.\n\t * Strokes the silhouette boundary with a stylized bloom/glow and optional audio-reactive pulse.\n\t */\n\tpublic addSubjectOutline(\n\t\t_subject: MaskTrackSignals | ObjectTrackSignals,\n\t\toptions: SubjectOutlineOptions = {},\n\t): this {\n\t\tconst blur = options.blur ?? 12;\n\t\tconst compW = this.width;\n\t\tconst compH = this.height;\n\n\t\tconst pulse = options.pulseSignal;\n\t\tconst baseOpacity = pulse\n\t\t\t? new ProgrammaticSignal(\n\t\t\t\t\t(ctx) => Math.max(0, Math.min(1, Number(pulse.get(ctx)) || 0)),\n\t\t\t\t\t{ fps: this.fps, label: \"outline_pulse\" },\n\t\t\t\t)\n\t\t\t: 1.0;\n\n\t\tconst src =\n\t\t\ttypeof options.source === \"string\"\n\t\t\t\t? options.source\n\t\t\t\t: (options.source?.inputHandleId ?? \"\");\n\n\t\tconst outlineLayer = Layer.box({\n\t\t\twidth: compW,\n\t\t\theight: compH,\n\t\t\tposition: \"absolute\",\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\topacity: baseOpacity as unknown as number,\n\t\t});\n\n\t\tif (src) {\n\t\t\tconst maskVideo = Layer.video(src, {\n\t\t\t\twidth: compW,\n\t\t\t\theight: compH,\n\t\t\t\tposition: \"absolute\",\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t\tfit: \"cover\",\n\t\t\t\tmuted: true,\n\t\t\t\tvolume: 0,\n\t\t\t}).withVision({\n\t\t\t\tmode: \"mask\",\n\t\t\t\tenableSegmentation: true,\n\t\t\t});\n\t\t\tif (!outlineLayer.children) {\n\t\t\t\toutlineLayer.children = [];\n\t\t\t}\n\t\t\toutlineLayer.children.push(maskVideo);\n\t\t}\n\n\t\toutlineLayer.apply(\n\t\t\tnew Blur({\n\t\t\t\tstrength: blur,\n\t\t\t\tblurType: \"Gaussian\",\n\t\t\t}),\n\t\t);\n\n\t\tthis.add(outlineLayer);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates an isolated, styled section of the composition or underlying source plate.\n\t * Any WebGPU effects (Blur, FilmGrain, Curves, Vignette, etc.) can be applied to this section.\n\t */\n\tpublic section(\n\t\tsourceOrTargetOrOptions?:\n\t\t\t| string\n\t\t\t| MediaNode\n\t\t\t| ObjectTrackSignals\n\t\t\t| SectionOptions,\n\t\ttargetOrOptions?: ObjectTrackSignals | SectionOptions,\n\t\toptions?: SectionOptions,\n\t): SectionNode {\n\t\tlet source: string | MediaNode | undefined;\n\t\tlet target: ObjectTrackSignals | undefined;\n\t\tlet opts: SectionOptions = {};\n\n\t\tconst isFirstTrack =\n\t\t\tsourceOrTargetOrOptions !== null &&\n\t\t\ttypeof sourceOrTargetOrOptions === \"object\" &&\n\t\t\t\"bounds\" in sourceOrTargetOrOptions;\n\n\t\tconst isFirstMedia =\n\t\t\ttypeof sourceOrTargetOrOptions === \"string\" ||\n\t\t\t(sourceOrTargetOrOptions !== null &&\n\t\t\t\ttypeof sourceOrTargetOrOptions === \"object\" &&\n\t\t\t\t(\"kind\" in sourceOrTargetOrOptions ||\n\t\t\t\t\t\"src\" in sourceOrTargetOrOptions ||\n\t\t\t\t\t\"inputHandleId\" in sourceOrTargetOrOptions));\n\n\t\tif (\n\t\t\tisFirstMedia &&\n\t\t\ttargetOrOptions &&\n\t\t\ttypeof targetOrOptions === \"object\" &&\n\t\t\t\"bounds\" in targetOrOptions\n\t\t) {\n\t\t\tsource = sourceOrTargetOrOptions as string | MediaNode;\n\t\t\ttarget = targetOrOptions as ObjectTrackSignals;\n\t\t\topts = options ?? {};\n\t\t} else if (isFirstMedia && targetOrOptions) {\n\t\t\tsource = sourceOrTargetOrOptions as string | MediaNode;\n\t\t\topts = targetOrOptions as SectionOptions;\n\t\t} else if (isFirstTrack) {\n\t\t\ttarget = sourceOrTargetOrOptions as ObjectTrackSignals;\n\t\t\topts = (targetOrOptions as SectionOptions) ?? {};\n\t\t\tsource = opts.source ?? (target.source as string | MediaNode | undefined);\n\t\t} else if (\n\t\t\tsourceOrTargetOrOptions &&\n\t\t\ttypeof sourceOrTargetOrOptions === \"object\"\n\t\t) {\n\t\t\topts = sourceOrTargetOrOptions as SectionOptions;\n\t\t\tsource = opts.source;\n\t\t}\n\n\t\tif (!source) {\n\t\t\tconst mediaChild = this.children.find(\n\t\t\t\t(c) =>\n\t\t\t\t\tc.kind === \"media\" &&\n\t\t\t\t\t(c.dataType === \"Video\" || c.dataType === \"Image\"),\n\t\t\t) as MediaNode | undefined;\n\t\t\tif (mediaChild) {\n\t\t\t\tsource = mediaChild;\n\t\t\t}\n\t\t}\n\n\t\treturn Layer.section(source ?? \"\", target ?? opts, {\n\t\t\tcompositionWidth: this.width,\n\t\t\tcompositionHeight: this.height,\n\t\t\t...opts,\n\t\t});\n\t}\n\n\t/**\n\t * Creates a section and immediately adds it to the composition layout tree.\n\t */\n\tpublic addSection(\n\t\tsourceOrTargetOrOptions?:\n\t\t\t| string\n\t\t\t| MediaNode\n\t\t\t| ObjectTrackSignals\n\t\t\t| SectionOptions,\n\t\ttargetOrOptions?: ObjectTrackSignals | SectionOptions,\n\t\toptions?: SectionOptions,\n\t): SectionNode {\n\t\tconst node = this.section(\n\t\t\tsourceOrTargetOrOptions,\n\t\t\ttargetOrOptions,\n\t\t\toptions,\n\t\t);\n\t\tthis.add(node);\n\t\treturn node;\n\t}\n\n\t/**\n\t * Dynamically calculates composition duration from the longest media or animation layer.\n\t */\n\tpublic async computeDuration(): Promise<number> {\n\t\tif (this.durationMs !== undefined) return this.durationMs;\n\t\tlet maxDurationMs = 0;\n\t\tconst mediaSources: string[] = [];\n\n\t\tfor (const node of [...this.children, ...this.audioTracks]) {\n\t\t\tif (node.kind === \"media\") {\n\t\t\t\tconst src = node.inputHandleId;\n\t\t\t\tif (\n\t\t\t\t\ttypeof src === \"string\" &&\n\t\t\t\t\t(node.dataType === \"Video\" || node.dataType === \"Audio\")\n\t\t\t\t) {\n\t\t\t\t\tmediaSources.push(src);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (typeof node.durationFrames === \"number\") {\n\t\t\t\tconst start = typeof node.startFrame === \"number\" ? node.startFrame : 0;\n\t\t\t\tconst durMs = ((start + node.durationFrames) / this.fps) * 1000;\n\t\t\t\tif (durMs > maxDurationMs) maxDurationMs = durMs;\n\t\t\t}\n\t\t}\n\n\t\tfor (const src of mediaSources) {\n\t\t\ttry {\n\t\t\t\tconst input = await inputStore.acquire(src);\n\t\t\t\tconst sec = await input.computeDuration();\n\t\t\t\tif (Number.isFinite(sec) && sec > 0) {\n\t\t\t\t\tconst ms = Math.round(sec * 1000);\n\t\t\t\t\tif (ms > maxDurationMs) maxDurationMs = ms;\n\t\t\t\t}\n\t\t\t} catch (_) {}\n\t\t}\n\n\t\treturn maxDurationMs > 0 ? maxDurationMs : 5000;\n\t}\n\n\tpublic async registerFont(\n\t\toptionsOrFamilyOrSource: RegisterFontOptions | string,\n\t\tsource?: string | Uint8Array,\n\t): Promise<this> {\n\t\tconst reg = await FontManager.register(optionsOrFamilyOrSource, source);\n\t\tif (reg.filePath && !this.fonts.includes(reg.filePath)) {\n\t\t\tthis.fonts.push(reg.filePath);\n\t\t}\n\t\treturn this;\n\t}\n\n\t/** Sets the color emoji font; see {@link FontManager.registerEmojiFont}. */\n\tpublic async registerEmojiFont(source: string | Uint8Array): Promise<this> {\n\t\tawait FontManager.registerEmojiFont(source);\n\t\treturn this;\n\t}\n\n\tpublic toSpec(): CompositorProgramConfig {\n\t\tconst layoutItems: LayoutNode[] = [...this.children, ...this.audioTracks];\n\t\tconst registeredPaths = FontManager.getRegisteredFontPaths();\n\t\tconst mergedFonts = Array.from(\n\t\t\tnew Set([...this.fonts, ...registeredPaths]),\n\t\t);\n\t\treturn {\n\t\t\twidth: this.width,\n\t\t\theight: this.height,\n\t\t\tfps: this.fps,\n\t\t\tmode: \"Video\",\n\t\t\tbackgroundColor: this.backgroundColor,\n\t\t\t...(this.antialias3d !== undefined && { antialias3d: this.antialias3d }),\n\t\t\tlayout: layoutItems,\n\t\t\tfonts: mergedFonts,\n\t\t\tsignals: this.signals,\n\t\t\t...(this._effects.length > 0 && { effects: this._effects }),\n\t\t\t...(this._visionConfig && { vision: this._visionConfig }),\n\t\t\t...(this._frameHooks.length > 0 && {\n\t\t\t\tonRequestFrame: (ctx: FrameContext) => this.notifyFrame(ctx),\n\t\t\t}),\n\t\t} as unknown as CompositorProgramConfig;\n\t}\n\n\t/**\n\t * Compiles the composition into a VirtualMediaData AST ready for WebGPU rendering.\n\t */\n\tpublic toVirtualMedia(\n\t\toptions: Partial<CompositorToProgramOptions> = {},\n\t): VirtualMediaData {\n\t\treturn compositorToProgram(this.toSpec(), {\n\t\t\tisVideoMode: true,\n\t\t\tfps: this.fps,\n\t\t\tdurationMs: options.durationMs ?? this.durationMs,\n\t\t\tsignals: options.signals ?? this.signals,\n\t\t\t...(this._effects.length > 0 && { effects: this._effects }),\n\t\t\t...(this._visionConfig && { vision: this._visionConfig }),\n\t\t\t...options,\n\t\t});\n\t}\n\n\t/**\n\t * Compiles the composition into a VirtualMediaData AST with dynamically resolved duration.\n\t */\n\tpublic async toVirtualMediaAsync(\n\t\toptions: Partial<CompositorToProgramOptions> = {},\n\t): Promise<VirtualMediaData> {\n\t\tconst durationMs =\n\t\t\toptions.durationMs ?? this.durationMs ?? (await this.computeDuration());\n\t\tthis.durationMs = durationMs;\n\t\treturn compositorToProgram(this.toSpec(), {\n\t\t\tisVideoMode: true,\n\t\t\tfps: this.fps,\n\t\t\tdurationMs,\n\t\t\tsignals: options.signals ?? this.signals,\n\t\t\t...(this._effects.length > 0 && { effects: this._effects }),\n\t\t\t...(this._visionConfig && { vision: this._visionConfig }),\n\t\t\t...options,\n\t\t});\n\t}\n\n\t/**\n\t * Renders a single frame from the composition to a PNG Buffer.\n\t * Can render either by timestamp in milliseconds (`atMs`) or by frame index (`frame`).\n\t */\n\tpublic async renderFrame(\n\t\toptions: {\n\t\t\tatMs?: number;\n\t\t\tframe?: number;\n\t\t\trenderer?: HeadlessMediaRenderer;\n\t\t} = {},\n\t): Promise<Buffer> {\n\t\tif (this._frameHooks.length > 0) {\n\t\t\tconst targetFrame =\n\t\t\t\toptions.frame ??\n\t\t\t\t(options.atMs !== undefined\n\t\t\t\t\t? Math.round((options.atMs / 1000) * this.fps)\n\t\t\t\t\t: 0);\n\t\t\tthis.notifyFrame({\n\t\t\t\tframe: targetFrame,\n\t\t\t\tfps: this.fps,\n\t\t\t\ttime: this.fps > 0 ? targetFrame / this.fps : 0,\n\t\t\t\tduration: (this.durationMs ?? 0) / 1000,\n\t\t\t\tdurationMs: this.durationMs ?? 0,\n\t\t\t\tprogress:\n\t\t\t\t\tthis.durationMs && this.durationMs > 0\n\t\t\t\t\t\t? Math.max(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tMath.min(\n\t\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\t\t((targetFrame / this.fps) * 1000) / this.durationMs,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: 0,\n\t\t\t\tdeltaTime: this.fps > 0 ? 1 / this.fps : 0,\n\t\t\t});\n\t\t}\n\t\tconst renderer = options.renderer ?? new HeadlessMediaRenderer();\n\t\treturn renderer.renderFrame(this.toVirtualMedia(), {\n\t\t\tfps: this.fps,\n\t\t\t...options,\n\t\t});\n\t}\n\n\t/**\n\t * Renders an image grid of sequential frames across a given frame or millisecond range.\n\t * Ideal for automated visual inspection of animation motion, easing curves, and layout stability.\n\t */\n\tpublic async renderFrameGrid(\n\t\toptions: FrameGridOptions = {},\n\t): Promise<Buffer> {\n\t\treturn renderFrameGrid(this, options);\n\t}\n\n\t/**\n\t * Renders this composition into an MP4/WebM video file with audio.\n\t */\n\tpublic async renderVideo(\n\t\toutputPathOrOptions: string | RenderVideoOptions = {},\n\t\toptions: RenderVideoOptions = {},\n\t): Promise<RenderVideoResult> {\n\t\tconst opts =\n\t\t\ttypeof outputPathOrOptions === \"string\"\n\t\t\t\t? { ...options, outputPath: outputPathOrOptions }\n\t\t\t\t: outputPathOrOptions;\n\t\tconst renderer = opts.renderer ?? new HeadlessMediaRenderer();\n\t\tconst result = await renderer.renderVideo(this.toVirtualMedia(), opts);\n\t\tif (result.qa) {\n\t\t\t// Fold the document checks into the output checks.\n\t\t\tconst lint = this.lint();\n\t\t\tconst issues = [\n\t\t\t\t...result.qa.issues,\n\t\t\t\t...lint.map((d) => ({\n\t\t\t\t\tseverity: d.severity,\n\t\t\t\t\tcode: d.code,\n\t\t\t\t\tmessage: d.message,\n\t\t\t\t\t...(d.layerId !== undefined && { layerId: d.layerId }),\n\t\t\t\t})),\n\t\t\t];\n\t\t\tresult.qa = {\n\t\t\t\t...result.qa,\n\t\t\t\tissues,\n\t\t\t\t// Lint warnings advise; only a lint error fails the render.\n\t\t\t\tpassed:\n\t\t\t\t\tresult.qa.passed && !lint.some((d) => d.severity === \"error\"),\n\t\t\t};\n\t\t}\n\t\treturn deliverToOutputPath(result, opts.outputPath);\n\t}\n\n\t/**\n\t * Checks the document for things that render without error but not as\n\t * intended: unreadable colors or gradients (drawn transparent),\n\t * low-contrast text, layers parked off-canvas, shadows on lights that\n\t * cannot cast them, physical materials without an environment, tracks that\n\t * never change. `renderVideo({ qa })` includes these automatically.\n\t */\n\tpublic lint(): RenderDiagnostic[] {\n\t\treturn lintComposition(this.toSpec());\n\t}\n}\n\n/**\n * Layer helpers for constructing composition nodes with clean URL/path strings.\n */\n\nexport type AnimatableNode<T extends LayoutNode> = T & {\n\tglass?: Record<string, unknown>;\n\taudioDeform?: MeshAudioDeformConfig | Record<string, unknown>;\n\tcrop?: CropProps | Crop;\n\tvision?: Vision;\n\trelighting?: NormalRelightingOptions;\n\tdeflicker?: DeflickerOptions;\n\teffects?: unknown[];\n\tblurRegions?: unknown[];\n\t[key: string]: unknown;\n\tanimate(\n\t\t...anim: (\n\t\t\t| LayerAnimation\n\t\t\t| { tracks: AnimationTrack[] }\n\t\t\t| LayerAnimation[]\n\t\t)[]\n\t): AnimatableNode<T>;\n\tpinToLandmark(\n\t\ttarget:\n\t\t\t| LandmarkCoordinateSignals\n\t\t\t| {\n\t\t\t\t\tx: number;\n\t\t\t\t\ty: number;\n\t\t\t\t\tz?: number;\n\t\t\t\t\tscreenX?: number;\n\t\t\t\t\tscreenY?: number;\n\t\t\t },\n\t\toptions?: PinToLandmarkOptions,\n\t): AnimatableNode<T>;\n\tpinToObject(\n\t\ttarget:\n\t\t\t| ObjectTrackSignals\n\t\t\t| LandmarkCoordinateSignals\n\t\t\t| {\n\t\t\t\t\tx: number;\n\t\t\t\t\ty: number;\n\t\t\t\t\tz?: number;\n\t\t\t\t\tscreenX?: number;\n\t\t\t\t\tscreenY?: number;\n\t\t\t },\n\t\toptions?: PinToObjectOptions,\n\t): AnimatableNode<T>;\n\t/**\n\t * Track matte: `matte` (any layer) masks this one by its alpha or\n\t * brightness. It is laid out like a sibling (same parent) and timed with\n\t * this node; with no x/y/width/height it covers this node's box. Animate\n\t * the matte for wipes and reveals: text through a sliding box, video\n\t * inside type, an iris circle.\n\t */\n\twithMatte(matte: LayoutNode, mode?: MatteMode): AnimatableNode<T>;\n\t/** Alias of {@link withMatte}. */\n\twithMask(mask: LayoutNode, mode?: MatteMode): AnimatableNode<T>;\n\twithPbrGlass(options?: Record<string, unknown>): AnimatableNode<T>;\n\tdeformWithAudio(\n\t\tconfig?: MeshAudioDeformConfig | Record<string, unknown>,\n\t): AnimatableNode<T>;\n\twithCrop(cropConfig: CropProps | Crop): AnimatableNode<T>;\n\t/** Runs vision on this node's rendered output (see `Vision` for options and modes). */\n\twithVision(config?: VisionProps | Vision): AnimatableNode<T>;\n\twithRelighting(options?: NormalRelightingOptions): AnimatableNode<T>;\n\trelight(options?: NormalRelightingOptions): AnimatableNode<T>;\n\twithDeflicker(options?: DeflickerOptions): AnimatableNode<T>;\n\tapply(effect: unknown): AnimatableNode<T>;\n\twithEffect(effect: unknown): AnimatableNode<T>;\n\twithEffects(effects: unknown[]): AnimatableNode<T>;\n\tblurRegion(\n\t\ttrackTarget: ObjectTrackSignals,\n\t\toptions?: Partial<BlurProps>,\n\t): AnimatableNode<T>;\n\twithBlurRegion(\n\t\ttrackTarget: ObjectTrackSignals,\n\t\toptions?: Partial<BlurProps>,\n\t): AnimatableNode<T>;\n};\n\nfunction withAnimation<T extends LayoutNode>(node: T): AnimatableNode<T> {\n\tconst target = node as AnimatableNode<T>;\n\tObject.defineProperty(target, \"animate\", {\n\t\tvalue: (\n\t\t\t...anims: (\n\t\t\t\t| LayerAnimation\n\t\t\t\t| { tracks: AnimationTrack[] }\n\t\t\t\t| LayerAnimation[]\n\t\t\t)[]\n\t\t) => {\n\t\t\t// Every call layers onto what is already there: keyframe tracks on\n\t\t\t// the same prop merge (a later key wins on a shared frame).\n\t\t\tconst incoming = anims\n\t\t\t\t.flat()\n\t\t\t\t.flatMap((a) =>\n\t\t\t\t\ta instanceof LayerAnimation\n\t\t\t\t\t\t? a.tracks\n\t\t\t\t\t\t: ((a as { tracks?: AnimationTrack[] }).tracks ?? []),\n\t\t\t\t);\n\t\t\tconst existing =\n\t\t\t\t(target.animation as { tracks?: AnimationTrack[] } | undefined)\n\t\t\t\t\t?.tracks ?? [];\n\t\t\ttarget.animation = {\n\t\t\t\ttracks: mergeAnimationTracks([...existing, ...incoming]),\n\t\t\t};\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"pinToLandmark\", {\n\t\tvalue: (\n\t\t\tlandmarkTarget:\n\t\t\t\t| LandmarkCoordinateSignals\n\t\t\t\t| {\n\t\t\t\t\t\tx: number;\n\t\t\t\t\t\ty: number;\n\t\t\t\t\t\tz?: number;\n\t\t\t\t\t\tscreenX?: number;\n\t\t\t\t\t\tscreenY?: number;\n\t\t\t\t },\n\t\t\toptions?: PinToLandmarkOptions,\n\t\t) => {\n\t\t\tpinNodeToLandmark(\n\t\t\t\ttarget as unknown as { x?: unknown; y?: unknown; z?: unknown },\n\t\t\t\tlandmarkTarget,\n\t\t\t\toptions,\n\t\t\t);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"pinToObject\", {\n\t\tvalue: (\n\t\t\tobjectTarget:\n\t\t\t\t| ObjectTrackSignals\n\t\t\t\t| LandmarkCoordinateSignals\n\t\t\t\t| {\n\t\t\t\t\t\tx: number;\n\t\t\t\t\t\ty: number;\n\t\t\t\t\t\tz?: number;\n\t\t\t\t\t\tscreenX?: number;\n\t\t\t\t\t\tscreenY?: number;\n\t\t\t\t },\n\t\t\toptions?: PinToObjectOptions,\n\t\t) => {\n\t\t\tpinNodeToObject(\n\t\t\t\ttarget as unknown as {\n\t\t\t\t\tx?: unknown;\n\t\t\t\t\ty?: unknown;\n\t\t\t\t\tz?: unknown;\n\t\t\t\t\twidth?: unknown;\n\t\t\t\t\theight?: unknown;\n\t\t\t\t\topacity?: unknown;\n\t\t\t\t},\n\t\t\t\tobjectTarget,\n\t\t\t\toptions,\n\t\t\t);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tconst withMatte = (matte: LayoutNode, mode?: MatteMode) => {\n\t\ttarget.matte = { node: matte, ...(mode && { mode }) };\n\t\treturn target;\n\t};\n\tfor (const name of [\"withMatte\", \"withMask\"]) {\n\t\tObject.defineProperty(target, name, {\n\t\t\tvalue: withMatte,\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\n\tObject.defineProperty(target, \"withPbrGlass\", {\n\t\tvalue: (options?: Record<string, unknown>) => {\n\t\t\ttarget.glass = options ?? {};\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"deformWithAudio\", {\n\t\tvalue: (config?: MeshAudioDeformConfig | Record<string, unknown>) => {\n\t\t\ttarget.audioDeform = config ?? {};\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"withCrop\", {\n\t\tvalue: (cropConfig: CropProps | Crop) => {\n\t\t\ttarget.crop =\n\t\t\t\tcropConfig instanceof Crop ? cropConfig : new Crop(cropConfig);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"withVision\", {\n\t\tvalue: (config?: VisionProps | Vision) => {\n\t\t\ttarget.vision = config instanceof Vision ? config : new Vision(config);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"withRelighting\", {\n\t\tvalue: (options?: NormalRelightingOptions) => {\n\t\t\ttarget.relighting = options ?? {};\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"relight\", {\n\t\tvalue: (options?: NormalRelightingOptions) => {\n\t\t\ttarget.relighting = options ?? {};\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"withDeflicker\", {\n\t\tvalue: (options?: DeflickerOptions) => {\n\t\t\ttarget.deflicker = options ?? {};\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"apply\", {\n\t\tvalue: (effect: unknown) => {\n\t\t\tif (!target.effects) {\n\t\t\t\ttarget.effects = [];\n\t\t\t}\n\t\t\ttarget.effects.push(effect);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"withEffect\", {\n\t\tvalue: (effect: unknown) => {\n\t\t\tif (!target.effects) {\n\t\t\t\ttarget.effects = [];\n\t\t\t}\n\t\t\ttarget.effects.push(effect);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"withEffects\", {\n\t\tvalue: (effects: unknown[]) => {\n\t\t\tif (!target.effects) {\n\t\t\t\ttarget.effects = [];\n\t\t\t}\n\t\t\ttarget.effects.push(...effects);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"section\", {\n\t\tvalue: (\n\t\t\ttargetOrOptions: ObjectTrackSignals | SectionOptions = {},\n\t\t\toptions?: SectionOptions,\n\t\t) => {\n\t\t\tif (\n\t\t\t\ttargetOrOptions !== null &&\n\t\t\t\ttypeof targetOrOptions === \"object\" &&\n\t\t\t\t\"bounds\" in targetOrOptions\n\t\t\t) {\n\t\t\t\treturn Layer.section(\n\t\t\t\t\ttarget as MediaNode,\n\t\t\t\t\ttargetOrOptions as ObjectTrackSignals,\n\t\t\t\t\toptions,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn Layer.section(\n\t\t\t\ttarget as MediaNode,\n\t\t\t\ttargetOrOptions as SectionOptions,\n\t\t\t);\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"blurRegion\", {\n\t\tvalue: (trackTarget: ObjectTrackSignals, options?: Partial<BlurProps>) => {\n\t\t\tconst blur = new Blur({\n\t\t\t\ttrack: trackTarget,\n\t\t\t\tstrength: options?.strength ?? 25,\n\t\t\t\tshape: options?.shape ?? \"ellipse\",\n\t\t\t\t...options,\n\t\t\t});\n\t\t\tif (!target.effects) {\n\t\t\t\ttarget.effects = [];\n\t\t\t}\n\t\t\ttarget.effects.push(blur);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"withBlurRegion\", {\n\t\tvalue: (trackTarget: ObjectTrackSignals, options?: Partial<BlurProps>) => {\n\t\t\treturn (\n\t\t\t\ttarget as {\n\t\t\t\t\tblurRegion: (\n\t\t\t\t\t\tt: ObjectTrackSignals,\n\t\t\t\t\t\to?: Partial<BlurProps>,\n\t\t\t\t\t) => unknown;\n\t\t\t\t}\n\t\t\t).blurRegion(trackTarget, options);\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\treturn target;\n}\n\nexport const Layer = {\n\tvideo: (\n\t\tsrc: string,\n\t\toptions: Partial<MediaNode> = {},\n\t): AnimatableNode<MediaNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"video\"),\n\t\t\tkind: \"media\",\n\t\t\tinputHandleId: src,\n\t\t\tdataType: \"Video\",\n\t\t\tfit: options.fit ?? \"cover\",\n\t\t\t...options,\n\t\t}),\n\timage: (\n\t\tsrc: string,\n\t\toptions: Partial<MediaNode> = {},\n\t): AnimatableNode<MediaNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"img\"),\n\t\t\tkind: \"media\",\n\t\t\tinputHandleId: src,\n\t\t\tdataType: \"Image\",\n\t\t\tfit: options.fit ?? \"cover\",\n\t\t\t...options,\n\t\t}),\n\tsvg: (\n\t\tsrc: string,\n\t\toptions: Partial<MediaNode> = {},\n\t): AnimatableNode<MediaNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"svg\"),\n\t\t\tkind: \"media\",\n\t\t\tinputHandleId: src,\n\t\t\tdataType: \"SVG\",\n\t\t\tfit: options.fit ?? \"contain\",\n\t\t\t...options,\n\t\t}),\n\tlottie: (\n\t\tsrc: string,\n\t\toptions: Partial<MediaNode> = {},\n\t): AnimatableNode<MediaNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"lottie\"),\n\t\t\tkind: \"media\",\n\t\t\tinputHandleId: src,\n\t\t\tdataType: \"Lottie\",\n\t\t\tfit: options.fit ?? \"contain\",\n\t\t\t...options,\n\t\t}),\n\taudio: (\n\t\tsrc: string,\n\t\toptions: Partial<MediaNode> = {},\n\t): AnimatableNode<MediaNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"audio\"),\n\t\t\tkind: \"media\",\n\t\t\tinputHandleId: src,\n\t\t\tdataType: \"Audio\",\n\t\t\tvolume: options.volume ?? 1,\n\t\t\t...options,\n\t\t}),\n\ttext: (\n\t\tcontentOrOptions:\n\t\t\t| string\n\t\t\t| TextSpan[]\n\t\t\t| (string | TextSpan)[]\n\t\t\t| Partial<TextNode>,\n\t\tmaybeOptions: Partial<TextNode> = {},\n\t): AnimatableNode<TextNode> => {\n\t\tconst isArray = Array.isArray(contentOrOptions);\n\t\tconst isObj =\n\t\t\t!isArray &&\n\t\t\ttypeof contentOrOptions === \"object\" &&\n\t\t\tcontentOrOptions !== null;\n\t\tconst options = isObj\n\t\t\t? (contentOrOptions as Partial<TextNode>)\n\t\t\t: maybeOptions;\n\n\t\tlet textContent = \"\";\n\t\tlet spans: TextSpan[] | undefined = options.spans;\n\n\t\tif (isArray) {\n\t\t\tconst normalized = normalizeTextSpans(\n\t\t\t\tcontentOrOptions as (string | TextSpan)[],\n\t\t\t);\n\t\t\ttextContent = normalized.text;\n\t\t\tspans = normalized.spans;\n\t\t} else if (isObj) {\n\t\t\tif (options.spans && !options.text) {\n\t\t\t\tconst normalized = normalizeTextSpans(options.spans);\n\t\t\t\ttextContent = normalized.text;\n\t\t\t} else {\n\t\t\t\ttextContent = (options.text as string) ?? \"\";\n\t\t\t}\n\t\t} else {\n\t\t\ttextContent =\n\t\t\t\ttypeof contentOrOptions === \"string\"\n\t\t\t\t\t? contentOrOptions\n\t\t\t\t\t: String(contentOrOptions ?? \"\");\n\t\t}\n\n\t\treturn withAnimation({\n\t\t\tid: options.id ?? autoId(\"text\"),\n\t\t\tkind: \"text\",\n\t\t\tfontFamily:\n\t\t\t\toptions.fontFamily ?? FontManager.getAll()[0]?.family ?? \"Inter\",\n\t\t\tfontSize: options.fontSize ?? 48,\n\t\t\tfill: options.fill ?? \"#ffffff\",\n\t\t\t...options,\n\t\t\ttext: options.text ?? textContent,\n\t\t\tspans: options.spans ?? spans,\n\t\t});\n\t},\n\tcaption: (\n\t\tsrc: string,\n\t\toptions: Partial<MediaNode> = {},\n\t): AnimatableNode<MediaNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"caption\"),\n\t\t\tkind: \"media\",\n\t\t\tinputHandleId: src,\n\t\t\tdataType: options.dataType ?? \"Caption\",\n\t\t\tfontFamily:\n\t\t\t\toptions.fontFamily ?? FontManager.getAll()[0]?.family ?? \"Inter\",\n\t\t\tfontSize: options.fontSize ?? 48,\n\t\t\tfill: options.fill ?? \"#ffffff\",\n\t\t\t...options,\n\t\t}),\n\tshape: (\n\t\tshapeType:\n\t\t\t| \"rect\"\n\t\t\t| \"circle\"\n\t\t\t| \"ellipse\"\n\t\t\t| \"polygon\"\n\t\t\t| \"star\"\n\t\t\t| \"arrow\"\n\t\t\t| \"path\" = \"rect\",\n\t\toptions: Partial<ShapeNode> & {\n\t\t\t/** Alias of `fillColor`: a color or a CSS gradient string. */\n\t\t\tfill?: string;\n\t\t} = {},\n\t): AnimatableNode<ShapeNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"shape\"),\n\t\t\tkind: \"shape\",\n\t\t\tshapeType: options.shapeType ?? shapeType,\n\t\t\t...options,\n\t\t\t// `fill` and `fillColor` are the same thing; either may hold a\n\t\t\t// color or a CSS gradient.\n\t\t\tfillColor: options.fillColor ?? options.fill ?? \"#3b82f6\",\n\t\t}),\n\tflex: (options: Partial<FlexNode> = {}): AnimatableNode<FlexNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"flex\"),\n\t\t\tkind: \"flex\",\n\t\t\tdir: options.dir ?? \"column\",\n\t\t\tchildren: options.children ?? [],\n\t\t\t...options,\n\t\t}),\n\tbox: (options: Partial<BoxNode> = {}): AnimatableNode<BoxNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"box\"),\n\t\t\tkind: \"box\",\n\t\t\tbackground: options.background ?? \"transparent\",\n\t\t\tchildren: options.children ?? [],\n\t\t\t...options,\n\t\t}),\n\tsection: (\n\t\tsource: string | MediaNode | Composition,\n\t\ttargetOrOptions: ObjectTrackSignals | SectionOptions = {},\n\t\toptions: SectionOptions = {},\n\t): SectionNode => {\n\t\tlet realSource: string | MediaNode = source as string | MediaNode;\n\t\tif (\n\t\t\tsource &&\n\t\t\ttypeof source === \"object\" &&\n\t\t\t\"toSpec\" in source &&\n\t\t\t\"children\" in source\n\t\t) {\n\t\t\tconst compMedia = (\n\t\t\t\t((source as Composition).children || []) as LayoutNode[]\n\t\t\t).find(\n\t\t\t\t(c) =>\n\t\t\t\t\tc.kind === \"media\" &&\n\t\t\t\t\t(c.dataType === \"Video\" || c.dataType === \"Image\"),\n\t\t\t) as MediaNode | undefined;\n\t\t\tif (compMedia) {\n\t\t\t\trealSource = compMedia;\n\t\t\t}\n\t\t}\n\n\t\tconst isTracked =\n\t\t\ttargetOrOptions !== null &&\n\t\t\ttypeof targetOrOptions === \"object\" &&\n\t\t\t\"bounds\" in targetOrOptions;\n\t\tconst opts: SectionOptions = isTracked\n\t\t\t? options\n\t\t\t: (targetOrOptions as SectionOptions);\n\t\tconst target = isTracked\n\t\t\t? (targetOrOptions as ObjectTrackSignals)\n\t\t\t: undefined;\n\n\t\tconst padding = opts.padding ?? 0;\n\t\tconst src =\n\t\t\ttypeof realSource === \"string\"\n\t\t\t\t? realSource\n\t\t\t\t: (realSource?.inputHandleId ??\n\t\t\t\t\t(realSource as { src?: string })?.src ??\n\t\t\t\t\t\"\");\n\t\tconst dataType =\n\t\t\ttypeof realSource === \"object\" && realSource?.dataType\n\t\t\t\t? realSource.dataType\n\t\t\t\t: \"Video\";\n\t\tconst compW =\n\t\t\t(opts.compositionWidth as number) ??\n\t\t\t(opts.compWidth as number) ??\n\t\t\t(isTracked ? (opts.width as number) : undefined) ??\n\t\t\t1920;\n\t\tconst compH =\n\t\t\t(opts.compositionHeight as number) ??\n\t\t\t(opts.compHeight as number) ??\n\t\t\t(isTracked ? (opts.height as number) : undefined) ??\n\t\t\t1080;\n\n\t\tconst effList: Effect[] = Array.isArray(opts.effects)\n\t\t\t? ([...opts.effects] as Effect[])\n\t\t\t: opts.effects\n\t\t\t\t? [opts.effects as Effect]\n\t\t\t\t: [];\n\n\t\tconst innerX = target\n\t\t\t? target.bounds.screenX.multiply(-1).add(padding)\n\t\t\t: typeof opts.x === \"number\"\n\t\t\t\t? -opts.x\n\t\t\t\t: opts.x &&\n\t\t\t\t\t\ttypeof (opts.x as { multiply?: unknown }).multiply === \"function\"\n\t\t\t\t\t? (opts.x as { multiply: (n: number) => unknown }).multiply(-1)\n\t\t\t\t\t: 0;\n\n\t\tconst innerY = target\n\t\t\t? target.bounds.screenY.multiply(-1).add(padding)\n\t\t\t: typeof opts.y === \"number\"\n\t\t\t\t? -opts.y\n\t\t\t\t: opts.y &&\n\t\t\t\t\t\ttypeof (opts.y as { multiply?: unknown }).multiply === \"function\"\n\t\t\t\t\t? (opts.y as { multiply: (n: number) => unknown }).multiply(-1)\n\t\t\t\t\t: 0;\n\n\t\tconst innerMedia = (\n\t\t\tdataType === \"Image\"\n\t\t\t\t? Layer.image(src, {\n\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\twidth: compW,\n\t\t\t\t\t\theight: compH,\n\t\t\t\t\t\tfit: opts.fit ?? \"cover\",\n\t\t\t\t\t\tx: innerX as number,\n\t\t\t\t\t\ty: innerY as number,\n\t\t\t\t\t})\n\t\t\t\t: Layer.video(src, {\n\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\twidth: compW,\n\t\t\t\t\t\theight: compH,\n\t\t\t\t\t\tfit: opts.fit ?? \"cover\",\n\t\t\t\t\t\tx: innerX as number,\n\t\t\t\t\t\ty: innerY as number,\n\t\t\t\t\t})\n\t\t).withEffects(effList);\n\n\t\tconst boxWidth = target\n\t\t\t? target.bounds.screenWidth.add(padding * 2)\n\t\t\t: opts.width !== undefined\n\t\t\t\t? opts.width\n\t\t\t\t: compW;\n\n\t\tconst boxHeight = target\n\t\t\t? target.bounds.screenHeight.add(padding * 2)\n\t\t\t: opts.height !== undefined\n\t\t\t\t? opts.height\n\t\t\t\t: compH;\n\n\t\tconst boxChildren = [innerMedia, ...(opts.children ?? [])];\n\n\t\tconst boxId =\n\t\t\topts.id ??\n\t\t\t(target ? autoId(`section-track-${target.trackId}`) : autoId(\"section\"));\n\n\t\tlet box = Layer.box({\n\t\t\tid: boxId,\n\t\t\tposition: (opts.position as \"absolute\" | \"relative\") ?? \"absolute\",\n\t\t\twidth: boxWidth as number,\n\t\t\theight: boxHeight as number,\n\t\t\tx: target ? undefined : (opts.x as number),\n\t\t\ty: target ? undefined : (opts.y as number),\n\t\t\tborderRadius: opts.borderRadius ?? 0,\n\t\t\tborderColor: opts.borderColor,\n\t\t\tborderWidth: opts.borderWidth,\n\t\t\topacity: (opts.opacity as number) ?? 1,\n\t\t\toverflow: \"hidden\",\n\t\t\tchildren: boxChildren,\n\t\t});\n\n\t\tif (target) {\n\t\t\tbox = box.pinToObject(target, {\n\t\t\t\tanchor: \"topLeft\",\n\t\t\t\toffsetX: -padding,\n\t\t\t\toffsetY: -padding,\n\t\t\t\thideWhenLost: opts.hideWhenLost ?? true,\n\t\t\t\tsmoothFrames: opts.smoothFrames,\n\t\t\t});\n\t\t}\n\n\t\tconst sectionNode = box as SectionNode;\n\t\tObject.defineProperty(sectionNode, \"innerMedia\", {\n\t\t\tvalue: innerMedia,\n\t\t\tenumerable: true,\n\t\t\twritable: false,\n\t\t});\n\t\tObject.defineProperty(sectionNode, \"effects\", {\n\t\t\tget: () => effList,\n\t\t\tenumerable: true,\n\t\t});\n\t\tObject.defineProperty(sectionNode, \"addEffect\", {\n\t\t\tvalue: (effect: Effect) => {\n\t\t\t\teffList.push(effect);\n\t\t\t\tinnerMedia.effects = effList;\n\t\t\t\treturn sectionNode;\n\t\t\t},\n\t\t\tenumerable: true,\n\t\t\twritable: false,\n\t\t});\n\t\tObject.defineProperty(sectionNode, \"withEffect\", {\n\t\t\tvalue: (effect: Effect) => sectionNode.addEffect(effect),\n\t\t\tenumerable: true,\n\t\t\twritable: false,\n\t\t});\n\t\tObject.defineProperty(sectionNode, \"withEffects\", {\n\t\t\tvalue: (effects: Effect[]) => {\n\t\t\t\tfor (const eff of effects) {\n\t\t\t\t\tsectionNode.addEffect(eff);\n\t\t\t\t}\n\t\t\t\treturn sectionNode;\n\t\t\t},\n\t\t\tenumerable: true,\n\t\t\twritable: false,\n\t\t});\n\n\t\treturn sectionNode;\n\t},\n\ttrackedRegion: (\n\t\tsource: string | MediaNode,\n\t\ttarget: ObjectTrackSignals,\n\t\toptions: TrackedRegionOptions = {},\n\t): SectionNode => {\n\t\treturn Layer.section(source, target, options);\n\t},\n\tblurTrackedRegion: (\n\t\tsource: string | MediaNode,\n\t\ttarget: ObjectTrackSignals,\n\t\toptions: Partial<BlurProps> & {\n\t\t\tborderRadius?: number;\n\t\t\tpadding?: number;\n\t\t\tborderColor?: string;\n\t\t\tborderWidth?: number;\n\t\t} = {},\n\t): SectionNode => {\n\t\t// Section styling is not a Blur prop; keep it out of the effect config.\n\t\tconst { padding, borderRadius, borderColor, borderWidth, ...blurOptions } =\n\t\t\toptions;\n\t\treturn Layer.section(source, target, {\n\t\t\tpadding: padding ?? 8,\n\t\t\tborderRadius: borderRadius ?? 12,\n\t\t\tborderColor,\n\t\t\tborderWidth,\n\t\t\teffects: [\n\t\t\t\tnew Blur({\n\t\t\t\t\tstrength: blurOptions.strength ?? 25,\n\t\t\t\t\tblurType: blurOptions.blurType ?? \"Gaussian\",\n\t\t\t\t\t...blurOptions,\n\t\t\t\t}),\n\t\t\t],\n\t\t});\n\t},\n\t/**\n\t * A line, area, bar, scatter, candlestick, pie or donut chart. Returns a box\n\t * of ordinary nodes (bars are boxes, lines and slices are path shapes,\n\t * labels are text), so it positions, animates and composites like any layer.\n\t * `props` applies to that box: position, id, timing, effects.\n\t */\n\tchart: (\n\t\toptions: ChartOptions,\n\t\tprops: Partial<BoxNode> = {},\n\t): AnimatableNode<BoxNode> =>\n\t\tbuildChart(options, props, FontManager.getAll()[0]?.family ?? \"Inter\"),\n\tcamera: (options: Partial<CameraNode> = {}): AnimatableNode<CameraNode> =>\n\t\twithAnimation<CameraNode>({\n\t\t\tid: options.id ?? autoId(\"camera\"),\n\t\t\tkind: \"camera\",\n\t\t\tmode: options.mode ?? \"lookAt\",\n\t\t\tpitch: options.pitch ?? 0,\n\t\t\tyaw: options.yaw ?? 0,\n\t\t\troll: options.roll ?? 0,\n\t\t\t...options,\n\t\t}),\n\tlight: (options: Partial<LightNode> = {}): AnimatableNode<LightNode> =>\n\t\twithAnimation<LightNode>({\n\t\t\tid: options.id ?? autoId(\"light\"),\n\t\t\tkind: \"light\",\n\t\t\tlightType: options.lightType ?? \"point\",\n\t\t\tcolor: options.color ?? \"#ffffff\",\n\t\t\tintensity: options.intensity ?? 1.0,\n\t\t\t...options,\n\t\t}),\n\tambientLight: (\n\t\tcolor: string = \"#ffffff\",\n\t\tintensity: number = 0.5,\n\t\toptions: Partial<LightNode> = {},\n\t): AnimatableNode<LightNode> => Light.ambient(color, intensity, options),\n\t/**\n\t * Scenes back to back with transitions between them; see `Transition`.\n\t * `comp.add(Layer.sequence([{ scene: hero(), duration: 90 },\n\t * { scene: next(), duration: 120, transition: Transition.push(\"left\") }]))`.\n\t * The result's `totalFrames` is the sequence length.\n\t */\n\tsequence: (\n\t\tentries: SequenceEntry[],\n\t\toptions?: SceneSequenceOptions,\n\t): SequenceNode => sequence(entries, options),\n\t/** See {@link Light.environment}: `Layer.environment(\"studio\", { exposure: 0.3 })`. */\n\tenvironment: (\n\t\tpresetOrOptions: EnvironmentPreset | EnvironmentOptions = \"studio\",\n\t\toptions: EnvironmentOptions = {},\n\t): AnimatableNode<LightNode> => Light.environment(presetOrOptions, options),\n\tdirectionalLight: (\n\t\toptions: Partial<LightNode> = {},\n\t): AnimatableNode<LightNode> => Light.directional(options),\n\tpointLight: (options: Partial<LightNode> = {}): AnimatableNode<LightNode> =>\n\t\tLight.point(options),\n\tspotLight: (options: Partial<LightNode> = {}): AnimatableNode<LightNode> =>\n\t\tLight.spot(options),\n\tcube: (options: Cube3DOptions): AnimatableNode<BoxNode> =>\n\t\tLayer3D.cube(options),\n\tcarousel3d: (options: Carousel3DOptions): AnimatableNode<BoxNode> =>\n\t\tLayer3D.carousel(options),\n\tplane3d: (options: Plane3DOptions): AnimatableNode<BoxNode> =>\n\t\tLayer3D.plane(options),\n\tprism3d: (options: Prism3DOptions): AnimatableNode<BoxNode> =>\n\t\tLayer3D.prism(options),\n\tmodel: (options: Partial<Model3DNode> = {}): AnimatableNode<Model3DNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"model3d\"),\n\t\t\tkind: \"model3d\",\n\t\t\tis3D: options.is3D ?? true,\n\t\t\tmodelFormat: options.modelFormat ?? \"auto\",\n\t\t\tloop: options.loop ?? true,\n\t\t\tscale: options.scale ?? 1.0,\n\t\t\tscaleX: options.scaleX ?? 1.0,\n\t\t\tscaleY: options.scaleY ?? 1.0,\n\t\t\tscaleZ: options.scaleZ ?? 1.0,\n\t\t\topacity: options.opacity ?? 1.0,\n\t\t\t// material and twoSided stay unset unless given: the model's own\n\t\t\t// materials (toon, single-sided, …) decide, falling back to lit.\n\t\t\t...options,\n\t\t}),\n\tobj: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"obj\",\n\t\t\t...options,\n\t\t}),\n\tfbx: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"fbx\",\n\t\t\t...options,\n\t\t}),\n\tgltf: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"gltf\",\n\t\t\t...options,\n\t\t}),\n\tglb: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"glb\",\n\t\t\t...options,\n\t\t}),\n\tstl: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"stl\",\n\t\t\t...options,\n\t\t}),\n\tply: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"ply\",\n\t\t\t...options,\n\t\t}),\n\tvox: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"vox\",\n\t\t\t...options,\n\t\t}),\n\tthreeDS: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"3ds\",\n\t\t\t...options,\n\t\t}),\n\toff: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"off\",\n\t\t\t...options,\n\t\t}),\n};\n\n/** World settings for `Layer.environment` (see `LightNode` for every field). */\nexport type EnvironmentOptions = Partial<\n\tPick<\n\t\tLightNode,\n\t\t| \"id\"\n\t\t| \"preset\"\n\t\t| \"top\"\n\t\t| \"horizon\"\n\t\t| \"bottom\"\n\t\t| \"intensity\"\n\t\t| \"softboxes\"\n\t\t| \"rotation\"\n\t\t| \"exposure\"\n\t\t| \"toneMapping\"\n\t\t| \"fog\"\n\t\t| \"bloom\"\n\t\t| \"startFrame\"\n\t\t| \"durationFrames\"\n\t>\n>;\n\nexport const Light = {\n\t/**\n\t * The scene's world: a procedural studio environment that lights and\n\t * reflects off every surface, plus exposure, tone mapping and fog. Adding\n\t * one switches the scene to physically based shading (GGX, real\n\t * `roughness` / `metallic`, `emissive` that blooms past white).\n\t */\n\tenvironment: (\n\t\tpresetOrOptions: EnvironmentPreset | EnvironmentOptions = \"studio\",\n\t\toptions: EnvironmentOptions = {},\n\t): AnimatableNode<LightNode> => {\n\t\tconst opts =\n\t\t\ttypeof presetOrOptions === \"string\"\n\t\t\t\t? { preset: presetOrOptions, ...options }\n\t\t\t\t: { ...presetOrOptions, ...options };\n\t\treturn withAnimation({\n\t\t\tkind: \"light\",\n\t\t\tlightType: \"environment\",\n\t\t\tpreset: \"studio\",\n\t\t\tintensity: 1,\n\t\t\t...opts,\n\t\t\tid: opts.id ?? autoId(\"environment\"),\n\t\t});\n\t},\n\tambient: (\n\t\tcolor: string = \"#ffffff\",\n\t\tintensity: number = 0.5,\n\t\toptions: Partial<LightNode> = {},\n\t): AnimatableNode<LightNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"light-ambient\"),\n\t\t\tkind: \"light\",\n\t\t\tlightType: \"ambient\",\n\t\t\tcolor,\n\t\t\tintensity,\n\t\t\t...options,\n\t\t}),\n\tdirectional: (options: Partial<LightNode> = {}): AnimatableNode<LightNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"light-directional\"),\n\t\t\tkind: \"light\",\n\t\t\tlightType: \"directional\",\n\t\t\tcolor: options.color ?? \"#ffffff\",\n\t\t\tintensity: options.intensity ?? 1.0,\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? -1000,\n\t\t\tz: options.z ?? -1000,\n\t\t\ttargetX: options.targetX ?? 0,\n\t\t\ttargetY: options.targetY ?? 0,\n\t\t\ttargetZ: options.targetZ ?? 0,\n\t\t\t...options,\n\t\t}),\n\tpoint: (options: Partial<LightNode> = {}): AnimatableNode<LightNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"light-point\"),\n\t\t\tkind: \"light\",\n\t\t\tlightType: \"point\",\n\t\t\tcolor: options.color ?? \"#ffffff\",\n\t\t\tintensity: options.intensity ?? 1.0,\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? -500,\n\t\t\tradius: options.radius ?? 1000,\n\t\t\tdecay: options.decay ?? 1.0,\n\t\t\t...options,\n\t\t}),\n\tspot: (options: Partial<LightNode> = {}): AnimatableNode<LightNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"light-spot\"),\n\t\t\tkind: \"light\",\n\t\t\tlightType: \"spot\",\n\t\t\tcolor: options.color ?? \"#ffffff\",\n\t\t\tintensity: options.intensity ?? 1.0,\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? -500,\n\t\t\tz: options.z ?? -1000,\n\t\t\ttargetX: options.targetX ?? 0,\n\t\t\ttargetY: options.targetY ?? 0,\n\t\t\ttargetZ: options.targetZ ?? 0,\n\t\t\tangle: options.angle ?? 45,\n\t\t\tpenumbra: options.penumbra ?? 0.2,\n\t\t\tradius: options.radius ?? 2000,\n\t\t\tdecay: options.decay ?? 1.0,\n\t\t\t...options,\n\t\t}),\n};\n\nexport {\n\ttype PreviewCloseReason,\n\ttype PreviewOptions,\n\ttype PreviewSession,\n\ttype PreviewSource,\n\tstartPreview,\n} from \"./preview/index.js\";\nexport {\n\ttype AudioQaStats,\n\tcomputeGridLayout,\n\ttype FrameGridOptions,\n\ttype FrameGridRenderable,\n\ttype FrameSamplePoint,\n\tformatQaReport,\n\tHeadlessMediaRenderer,\n\tHeadlessWebGPURenderer,\n\ttype QaIssue,\n\ttype QaSegment,\n\trenderFrameGrid,\n\trenderSemaphore,\n\tresolveSamplePoints,\n\ttype VideoQaOptions,\n\ttype VideoQaReport,\n\ttype VideoQaStats,\n} from \"./renderer/index.js\";\n\nexport function section(\n\tsource: string | MediaNode | Composition,\n\ttargetOrOptions: ObjectTrackSignals | SectionOptions = {},\n\toptions: SectionOptions = {},\n): SectionNode {\n\treturn Layer.section(source, targetOrOptions, options);\n}\n\nexport function blurRegion(\n\tsourceOrLayer: string | AnimatableNode<MediaNode>,\n\ttarget: ObjectTrackSignals,\n\toptions: Partial<BlurProps> & {\n\t\tborderRadius?: number;\n\t\tpadding?: number;\n\t\tborderColor?: string;\n\t\tborderWidth?: number;\n\t} = {},\n): AnimatableNode<MediaNode> | AnimatableNode<BoxNode> {\n\tif (typeof sourceOrLayer === \"object\" && \"blurRegion\" in sourceOrLayer) {\n\t\treturn (sourceOrLayer as AnimatableNode<MediaNode>).blurRegion(\n\t\t\ttarget,\n\t\t\toptions,\n\t\t);\n\t}\n\treturn Layer.blurTrackedRegion(sourceOrLayer as string, target, options);\n}\n\nexport function editTrackedRegion(\n\tsource: string | MediaNode,\n\ttarget: ObjectTrackSignals,\n\toptions: TrackedRegionOptions = {},\n): SectionNode {\n\treturn Layer.section(source, target, options);\n}\n\nexport const Effect = Object.assign(CoreEffect, effectFactories, {\n\tblur: (config?: BlurProps) => new Blur(config),\n\tvignette: (config?: VignetteProps) => new Vignette(config),\n\tcolorBalance: (config?: ColorBalanceProps) => new ColorBalance(config),\n\tcolorKey: (config?: ColorKeyProps) => new ColorKey(config),\n\tlevels: (config?: LevelsProps) => new Levels(config),\n\tfilmGrain: (config?: FilmGrainProps) => new FilmGrain(config),\n\tcurves: (config?: CurvesProps) => new Curves(config),\n\tselectiveColor: (config?: SelectiveColorProps) => new SelectiveColor(config),\n\tgradientMap: (config?: GradientMapProps) => new GradientMap(config),\n\tshadowsHighlights: (config?: ShadowsHighlightsProps) =>\n\t\tnew ShadowsHighlights(config),\n\tapplyLut: (config?: ApplyLUTProps) => new ApplyLUT(config),\n\tunsharpMask: (config?: UnsharpMaskProps) => new UnsharpMask(config),\n\thighPass: (config?: HighPassProps) => new HighPass(config),\n\thalftoneScreen: (config?: HalftoneScreenProps) => new HalftoneScreen(config),\n\ttileOffset: (config?: TileOffsetProps) => new TileOffset(config),\n\tmotionBlur: (config?: MotionBlurProps) => new MotionBlur(config),\n\tssao: (config?: SSAOProps) => new SSAO(config),\n\tpbrGlass: (config?: PBRGlassProps) => new PBRGlass(config),\n\tdepthOfField: (config?: DepthOfFieldProps) => new DepthOfField(config),\n\tcrop: (config?: CropProps) => new Crop(config),\n\tvision: (config?: VisionProps) => new Vision(config),\n\trelight3d: (config?: Relight3DProps) => new Relight3D(config),\n\tmodulate: (config?: ModulateProps) => new Modulate(config),\n\tdeflicker: (config?: DeflickerProps) => new TemporalDeflicker(config),\n\tcustom: (op: string, config: Record<string, unknown> = {}) =>\n\t\tnew CustomEffect(op, config),\n});\n\nexport type Effect<TConfig extends object = Record<string, unknown>> =\n\tCoreEffect<TConfig>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,2BAAW,IAAI,KAAqB;AAE1C,SAAgB,OAAO,QAAwB;CAC9C,MAAM,KAAK,SAAS,IAAI,OAAO,IAAI,KAAK;AACxC,UAAS,IAAI,QAAQ,EAAE;AACvB,QAAO,GAAG,OAAO,QAAQ;;;;;;;;;;;;;;ACa1B,SAAgB,KACf,SACA,GAAG,QACU;CACb,MAAM,QAAoB,EAAE;AAE5B,MAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;EACxC,MAAM,MAAM,Q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Y,OAAO;CACnE,oBAAoB,WACnB,IAAI,kBAAkB,OAAO;CAC9B,WAAW,WAA2B,IAAI,SAAS,OAAO;CAC1D,cAAc,WAA8B,IAAI,YAAY,OAAO;CACnE,WAAW,WAA2B,IAAI,SAAS,OAAO;CAC1D,iBAAiB,WAAiC,IAAI,eAAe,OAAO;CAC5E,aAAa,WAA6B,IAAI,WAAW,OAAO;CAChE,aAAa,WAA6B,IAAI,WAAW,OAAO;CAChE,OAAO,WAAuB,IAAI,KAAK,OAAO;CAC9C,WAAW,WAA2B,IAAI,SAAS,OAAO;CAC1D,eAAe,WAA+B,IAAI,aAAa,OAAO;CACtE,OAAO,WAAuB,IAAI,KAAK,OAAO;CAC9C,SAAS,WAAyB,IAAI,OAAO,OAAO;CACpD,YAAY,WAA4B,IAAI,UAAU,OAAO;CAC7D,WAAW,WAA2B,IAAI,SAAS,OAAO;CAC1D,YAAY,WAA4B,IAAI,kBAAkB,OAAO;CACrE,SAAS,IAAY,SAAkC,EAAE,KACxD,IAAI,aAAa,IAAI,OAAO;CAC7B,CAAC"}
1
+ {"version":3,"file":"index.mjs","names":["stack","color","d3Format","d3Pie","d3Arc","x","d3Stack","lo","hi","d","d3Area","d3Line","spec","size","color","line","spec","resolvedSource","analyzeVisionFrames","signal","color","CoreEffect"],"sources":["../src/ids.ts","../src/rich-text.ts","../src/chart.ts","../src/shapes3d.ts","../src/transitions.ts","../src/lighting.ts","../src/index.ts"],"sourcesContent":["/**\n * Default ids for nodes created without one. A counter per prefix rather than\n * a random suffix: the same composition script builds the same ids on every\n * run and in every render worker, so specs, caches and diffs stay stable.\n */\nconst counters = new Map<string, number>();\n\nexport function autoId(prefix: string): string {\n\tconst n = (counters.get(prefix) ?? 0) + 1;\n\tcounters.set(prefix, n);\n\treturn `${prefix}-auto-${n}`;\n}\n","import type { Signal, TextSpan, TextSpanMark } from \"@framefields/core\";\n\nexport type { TextSpan, TextSpanMark };\n\nexport type TextSpanItem =\n\t| string\n\t| number\n\t| boolean\n\t| Signal<unknown>\n\t| TextSpan\n\t| (string | TextSpan)[]\n\t| null\n\t| undefined;\n\n/**\n * Tagged template literal for authoring rich, multi-style text runs.\n *\n * Interpolates strings, numbers, reactive signals, and typed span modifiers\n * directly into a structured TextSpan[] array with zero runtime parsing.\n *\n * @example\n * rich`Scale ${bold(\"10x\", { fill: \"#6366f1\" })} faster with ${mark(\"120 FPS\", { bg: \"#10b98133\" })}`\n */\nexport function rich(\n\tstrings: TemplateStringsArray,\n\t...values: TextSpanItem[]\n): TextSpan[] {\n\tconst spans: TextSpan[] = [];\n\n\tfor (let i = 0; i < strings.length; i++) {\n\t\tconst str = strings[i];\n\t\tif (str) {\n\t\t\tspans.push({ text: str });\n\t\t}\n\n\t\tif (i < values.length) {\n\t\t\tconst val = values[i];\n\t\t\tif (val === null || val === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (Array.isArray(val)) {\n\t\t\t\tfor (const item of val) {\n\t\t\t\t\tif (typeof item === \"string\") {\n\t\t\t\t\t\tif (item) spans.push({ text: item });\n\t\t\t\t\t} else if (item && typeof item === \"object\" && \"text\" in item) {\n\t\t\t\t\t\tspans.push(item as TextSpan);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (typeof val === \"object\" && \"text\" in val) {\n\t\t\t\tspans.push(val as TextSpan);\n\t\t\t} else if (\n\t\t\t\ttypeof val === \"object\" &&\n\t\t\t\t\"get\" in val &&\n\t\t\t\ttypeof (val as { get: unknown }).get === \"function\"\n\t\t\t) {\n\t\t\t\tspans.push({ text: val as Signal<string> });\n\t\t\t} else {\n\t\t\t\tspans.push({ text: String(val) });\n\t\t\t}\n\t\t}\n\t}\n\n\treturn spans;\n}\n\nexport function span(\n\ttext: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\"> = {},\n): TextSpan {\n\treturn { text, ...options };\n}\n\nexport function bold(\n\ttext: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\"> = {},\n): TextSpan {\n\treturn { text, fontWeight: options.fontWeight ?? 700, ...options };\n}\n\nexport function italic(\n\ttext: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\"> = {},\n): TextSpan {\n\treturn { text, fontStyle: \"italic\", ...options };\n}\n\nexport function accent(\n\ttext: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\"> = {},\n): TextSpan {\n\treturn { text, fill: options.fill ?? \"#6366f1\", ...options };\n}\n\nexport function color(\n\ttext: string | Signal<string>,\n\tfill: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\" | \"fill\"> = {},\n): TextSpan {\n\treturn { text, fill, ...options };\n}\n\nexport function size(\n\ttext: string | Signal<string>,\n\tfontSize: number | Signal<number>,\n\toptions: Omit<TextSpan, \"text\" | \"fontSize\"> = {},\n): TextSpan {\n\treturn { text, fontSize, ...options };\n}\n\nexport interface MarkOptions extends Omit<TextSpan, \"text\" | \"mark\" | \"fill\"> {\n\tbg?: string | Signal<string>;\n\tfill?: string | Signal<string>;\n\tradius?: number;\n\tpaddingX?: number;\n\tpaddingY?: number;\n}\n\nexport function mark(\n\ttext: string | Signal<string>,\n\toptions: MarkOptions = {},\n): TextSpan {\n\tconst { bg, fill, radius, paddingX, paddingY, ...rest } = options;\n\treturn {\n\t\ttext,\n\t\tfill,\n\t\tmark: {\n\t\t\tbackground: bg ?? \"#6366f133\",\n\t\t\tborderRadius: radius ?? 4,\n\t\t\tpaddingX: paddingX ?? 6,\n\t\t\tpaddingY: paddingY ?? 2,\n\t\t},\n\t\t...rest,\n\t};\n}\n\nexport function sup(\n\ttext: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\"> = {},\n): TextSpan {\n\treturn {\n\t\ttext,\n\t\tbaselineShift: options.baselineShift ?? -8,\n\t\t...options,\n\t};\n}\n\nexport function sub(\n\ttext: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\"> = {},\n): TextSpan {\n\treturn {\n\t\ttext,\n\t\tbaselineShift: options.baselineShift ?? 6,\n\t\t...options,\n\t};\n}\n\nexport function code(\n\ttext: string | Signal<string>,\n\toptions: Omit<TextSpan, \"text\"> = {},\n): TextSpan {\n\treturn {\n\t\ttext,\n\t\tfontFamily: options.fontFamily ?? \"JetBrains Mono\",\n\t\tmark: options.mark ?? {\n\t\t\tbackground: \"#ffffff18\",\n\t\t\tborderRadius: 4,\n\t\t\tpaddingX: 6,\n\t\t\tpaddingY: 2,\n\t\t},\n\t\t...options,\n\t};\n}\n\n/**\n * Normalizes string, TextSpan[], or array of mixed strings/spans into plain text and spans.\n */\nexport function normalizeTextSpans(\n\tinput: string | TextSpan[] | (string | TextSpan)[],\n): { text: string; spans?: TextSpan[] } {\n\tif (typeof input === \"string\") {\n\t\treturn { text: input };\n\t}\n\n\tif (!Array.isArray(input)) {\n\t\treturn { text: String(input) };\n\t}\n\n\tconst spans: TextSpan[] = [];\n\tlet plainText = \"\";\n\n\tfor (const item of input) {\n\t\tif (typeof item === \"string\") {\n\t\t\tif (item) {\n\t\t\t\tspans.push({ text: item });\n\t\t\t\tplainText += item;\n\t\t\t}\n\t\t} else if (item && typeof item === \"object\" && \"text\" in item) {\n\t\t\tconst s = item as TextSpan;\n\t\t\tspans.push(s);\n\t\t\tconst piece =\n\t\t\t\ttypeof s.text === \"string\"\n\t\t\t\t\t? s.text\n\t\t\t\t\t: s.text &&\n\t\t\t\t\t\t\ttypeof s.text === \"object\" &&\n\t\t\t\t\t\t\t\"get\" in s.text &&\n\t\t\t\t\t\t\ttypeof (s.text as { get: () => unknown }).get === \"function\"\n\t\t\t\t\t\t? String((s.text as { get: () => unknown }).get())\n\t\t\t\t\t\t: String(s.text ?? \"\");\n\t\t\tplainText += piece;\n\t\t}\n\t}\n\n\treturn {\n\t\ttext: plainText,\n\t\tspans: spans.length > 0 ? spans : undefined,\n\t};\n}\n\n/**\n * Upfront parser for external CMS or subtitle strings containing basic tags\n * (<b>, <i>, <span>, <color>, <mark>, <accent>, <code>, <sup>, <sub>).\n *\n * Compiles string markup into clean TextSpan[] before entering the composition pipeline.\n */\nexport function parseMarkup(markup: string): TextSpan[] {\n\tif (!markup || !markup.includes(\"<\")) {\n\t\treturn [{ text: markup }];\n\t}\n\n\tconst spans: TextSpan[] = [];\n\tconst tagRegex = /<(\\/?[a-zA-Z0-9_-]+)([^>]*)>/g;\n\tlet lastIndex = 0;\n\n\tinterface StyleState {\n\t\ttag: string;\n\t\tstyle: Partial<TextSpan>;\n\t}\n\tconst stack: StyleState[] = [];\n\n\tconst getCurrentStyle = (): Partial<TextSpan> => {\n\t\tconst merged: Partial<TextSpan> = {};\n\t\tfor (const state of stack) {\n\t\t\tObject.assign(merged, state.style);\n\t\t}\n\t\treturn merged;\n\t};\n\n\tfor (;;) {\n\t\tconst match = tagRegex.exec(markup);\n\t\tif (!match) {\n\t\t\tbreak;\n\t\t}\n\t\tconst textBefore = markup.slice(lastIndex, match.index);\n\t\tif (textBefore) {\n\t\t\tspans.push({ text: textBefore, ...getCurrentStyle() });\n\t\t}\n\t\tlastIndex = match.index + match[0].length;\n\n\t\tconst tagName = match[1].toLowerCase();\n\t\tconst rawAttrs = match[2];\n\n\t\tif (tagName.startsWith(\"/\")) {\n\t\t\tconst closingTag = tagName.slice(1);\n\t\t\tfor (let i = stack.length - 1; i >= 0; i--) {\n\t\t\t\tif (stack[i].tag === closingTag) {\n\t\t\t\t\tstack.splice(i, 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst attrs: Record<string, string> = {};\n\t\t\tconst attrRegex = /([a-zA-Z0-9_-]+)=[\"']([^\"']*)[\"']/g;\n\t\t\tfor (;;) {\n\t\t\t\tconst attrMatch = attrRegex.exec(rawAttrs);\n\t\t\t\tif (!attrMatch) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tattrs[attrMatch[1].toLowerCase()] = attrMatch[2];\n\t\t\t}\n\n\t\t\tconst style: Partial<TextSpan> = {};\n\n\t\t\tif (tagName === \"b\" || tagName === \"strong\") {\n\t\t\t\tstyle.fontWeight = 700;\n\t\t\t\tif (attrs.color || attrs.fill) style.fill = attrs.color ?? attrs.fill;\n\t\t\t} else if (tagName === \"i\" || tagName === \"em\") {\n\t\t\t\tstyle.fontStyle = \"italic\";\n\t\t\t\tif (attrs.color || attrs.fill) style.fill = attrs.color ?? attrs.fill;\n\t\t\t} else if (tagName === \"accent\") {\n\t\t\t\tstyle.fill = \"#6366f1\";\n\t\t\t} else if (tagName === \"color\") {\n\t\t\t\tstyle.fill = attrs.value ?? attrs.hex ?? attrs.fill;\n\t\t\t} else if (tagName === \"size\") {\n\t\t\t\tconst num = parseFloat(attrs.value ?? attrs.px ?? attrs.pt ?? \"0\");\n\t\t\t\tif (num > 0) style.fontSize = num;\n\t\t\t} else if (tagName === \"mark\") {\n\t\t\t\tstyle.mark = {\n\t\t\t\t\tbackground: attrs.bg ?? attrs.background ?? \"#6366f133\",\n\t\t\t\t\tborderRadius: attrs.radius ? parseFloat(attrs.radius) : 4,\n\t\t\t\t\tpaddingX: attrs.paddingx ? parseFloat(attrs.paddingx) : 6,\n\t\t\t\t\tpaddingY: attrs.paddingy ? parseFloat(attrs.paddingy) : 2,\n\t\t\t\t};\n\t\t\t\tif (attrs.color || attrs.fill) style.fill = attrs.color ?? attrs.fill;\n\t\t\t} else if (tagName === \"sup\") {\n\t\t\t\tstyle.baselineShift = -8;\n\t\t\t} else if (tagName === \"sub\") {\n\t\t\t\tstyle.baselineShift = 6;\n\t\t\t} else if (tagName === \"code\") {\n\t\t\t\tstyle.fontFamily = \"JetBrains Mono\";\n\t\t\t\tstyle.mark = {\n\t\t\t\t\tbackground: attrs.bg ?? \"#ffffff18\",\n\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\tpaddingX: 6,\n\t\t\t\t\tpaddingY: 2,\n\t\t\t\t};\n\t\t\t} else if (tagName === \"span\") {\n\t\t\t\tif (attrs.color || attrs.fill) style.fill = attrs.color ?? attrs.fill;\n\t\t\t\tif (attrs.fontfamily) style.fontFamily = attrs.fontfamily;\n\t\t\t\tif (attrs.fontsize) style.fontSize = parseFloat(attrs.fontsize);\n\t\t\t\tif (attrs.fontweight) {\n\t\t\t\t\tconst nw = parseInt(attrs.fontweight, 10);\n\t\t\t\t\tstyle.fontWeight = Number.isNaN(nw) ? attrs.fontweight : nw;\n\t\t\t\t}\n\t\t\t\tif (attrs.fontstyle === \"italic\" || attrs.fontstyle === \"normal\") {\n\t\t\t\t\tstyle.fontStyle = attrs.fontstyle;\n\t\t\t\t}\n\t\t\t\tif (attrs.letterspacing)\n\t\t\t\t\tstyle.letterSpacing = parseFloat(attrs.letterspacing);\n\t\t\t\tif (attrs.baselineshift)\n\t\t\t\t\tstyle.baselineShift = parseFloat(attrs.baselineshift);\n\t\t\t\tif (attrs.opacity) style.opacity = parseFloat(attrs.opacity);\n\t\t\t}\n\n\t\t\tstack.push({ tag: tagName, style });\n\t\t}\n\t}\n\n\tconst remainingText = markup.slice(lastIndex);\n\tif (remainingText) {\n\t\tspans.push({ text: remainingText, ...getCurrentStyle() });\n\t}\n\n\treturn spans;\n}\n","/**\n * Charts built from ordinary layout nodes. d3 does the math (scales, ticks,\n * line/area/arc geometry, stacking); every bar, line, slice and label is a\n * regular box, shape or text node, so charts use the composition's fonts and\n * can be animated, graded and composited like any other layer.\n */\nimport {\n\ttype BoxNode,\n\tLayerAnimation,\n\ttype LayoutNode,\n} from \"@framefields/compositions/program\";\nimport { format as d3Format } from \"d3-format\";\nimport {\n\ttype ScaleBand,\n\ttype ScaleLinear,\n\ttype ScaleTime,\n\tscaleBand,\n\tscaleLinear,\n\tscaleUtc,\n} from \"d3-scale\";\nimport {\n\ttype CurveFactory,\n\tcurveLinear,\n\tcurveMonotoneX,\n\tcurveStepAfter,\n\tarc as d3Arc,\n\tarea as d3Area,\n\tline as d3Line,\n\tpie as d3Pie,\n\tstack as d3Stack,\n\tstackOffsetDiverging,\n} from \"d3-shape\";\nimport { autoId } from \"./ids.js\";\nimport { type AnimatableNode, Layer } from \"./index.js\";\n\nexport type ChartType =\n\t| \"line\"\n\t| \"area\"\n\t| \"bar\"\n\t| \"scatter\"\n\t| \"pie\"\n\t| \"donut\"\n\t| \"candlestick\";\n\nexport type ChartX = number | string | Date;\n\n/** A plain value (x is its index or `categories[i]`), an `[x, y]` pair, or `{ x, y }`. */\nexport type ChartDatum =\n\t| number\n\t| readonly [ChartX, number]\n\t| { x: ChartX; y: number };\n\nexport interface ChartCandle {\n\tx: ChartX;\n\topen: number;\n\thigh: number;\n\tlow: number;\n\tclose: number;\n}\n\n/** A pie or donut slice. */\nexport interface ChartSlice {\n\tlabel: string;\n\tvalue: number;\n\tcolor?: string;\n}\n\nexport interface ChartSeries {\n\tname?: string;\n\t/** Series type in a combined chart; defaults to the chart's `type`. */\n\ttype?: Exclude<ChartType, \"pie\" | \"donut\">;\n\tdata: readonly ChartDatum[] | readonly ChartCandle[];\n\tcolor?: string;\n\t/** Line width for line and area series. Default 3. */\n\tstrokeWidth?: number;\n\t/** Line and area interpolation. Default \"smooth\". */\n\tcurve?: \"linear\" | \"smooth\" | \"step\";\n\t/** Dot radius drawn on line points; scatter point radius. 0 hides line dots. */\n\tpointRadius?: number;\n}\n\nexport interface ChartAxisOptions {\n\t/** Show tick labels. Default true. */\n\tshow?: boolean;\n\t/** Draw grid lines across the plot. Default true for y, false for x. */\n\tgrid?: boolean;\n\tmin?: number;\n\tmax?: number;\n\t/** Approximate number of ticks. Default 5. */\n\tticks?: number;\n\t/** A d3-format specifier such as \",.0f\", \"$.2s\" or \".0%\", or a function. */\n\tformat?: string | ((value: ChartX) => string);\n}\n\nexport interface ChartAnimationOptions {\n\t/** Frame the reveal starts, relative to the chart's own start. Default 0. */\n\tstart?: number;\n\t/** Frames each element takes to animate in. Default 30. */\n\tduration?: number;\n\t/** Frames between consecutive bars, points or slices. Default spreads them over `duration`. */\n\tstagger?: number;\n\t/** Easing for bars, points and slices. Default \"power3.out\". */\n\tease?: string;\n}\n\nexport interface ChartPadding {\n\ttop?: number;\n\tright?: number;\n\tbottom?: number;\n\tleft?: number;\n}\n\nexport interface ChartOptions {\n\t/** Chart type, and the default for series without their own. Default \"line\". */\n\ttype?: ChartType;\n\twidth?: number;\n\theight?: number;\n\tseries?: readonly ChartSeries[];\n\t/** Shorthand for a single series, or the slices of a pie or donut. */\n\tdata?: readonly ChartDatum[] | readonly ChartCandle[] | readonly ChartSlice[];\n\t/** Labels for x positions when data are plain values; slice labels for pie charts. */\n\tcategories?: readonly string[];\n\t/** Stack bar and area series instead of grouping or overlapping them. */\n\tstacked?: boolean;\n\tcolors?: readonly string[];\n\txAxis?: ChartAxisOptions;\n\tyAxis?: ChartAxisOptions;\n\t/** Space around the plot for axis labels and legend. Computed when omitted. */\n\tpadding?: number | ChartPadding;\n\tfontFamily?: string;\n\t/** Axis, legend and value label size. Default 18. */\n\tfontSize?: number;\n\t/** Axis labels; when set, also the legend and value labels. */\n\ttextColor?: string;\n\tgridColor?: string;\n\tbackground?: string;\n\t/** Show the series or slice legend. Default: on for several series and for pies. */\n\tlegend?: boolean;\n\t/** Print values on bars and slices (pie values print as percentages). */\n\tvalueLabels?: boolean;\n\t/** Donut hole as a fraction of the radius. Default 0.6 for \"donut\". */\n\tinnerRadius?: number;\n\t/** Corner radius of bars and slices. Default 4. */\n\tcornerRadius?: number;\n\tupColor?: string;\n\tdownColor?: string;\n\t/** Reveal animation, or `false` for a static chart. */\n\tanimate?: false | ChartAnimationOptions;\n}\n\nexport const DEFAULT_CHART_COLORS = [\n\t\"#6366f1\",\n\t\"#22d3ee\",\n\t\"#f59e0b\",\n\t\"#ec4899\",\n\t\"#10b981\",\n\t\"#8b5cf6\",\n\t\"#f97316\",\n\t\"#3b82f6\",\n] as const;\n\ntype XScale =\n\t| ScaleBand<string>\n\t| ScaleLinear<number, number>\n\t| ScaleTime<number, number>;\n\ninterface Timing {\n\tenabled: boolean;\n\tstart: number;\n\tduration: number;\n\tstagger: number;\n\tease: string;\n}\n\ninterface Point {\n\tx: ChartX;\n\ty: number;\n}\n\ninterface Rect {\n\tx: number;\n\ty: number;\n\twidth: number;\n\theight: number;\n}\n\nconst isCandle = (d: unknown): d is ChartCandle =>\n\ttypeof d === \"object\" && d !== null && \"open\" in d && \"close\" in d;\n\nconst isSlice = (d: unknown): d is ChartSlice =>\n\ttypeof d === \"object\" && d !== null && \"label\" in d && \"value\" in d;\n\nfunction curveOf(curve: ChartSeries[\"curve\"]): CurveFactory {\n\tif (curve === \"linear\") return curveLinear;\n\tif (curve === \"step\") return curveStepAfter;\n\treturn curveMonotoneX;\n}\n\nfunction withAlpha(color: string, alpha: number): string {\n\tconst hex = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(color.trim());\n\tif (!hex) return color;\n\tlet h = hex[1];\n\tif (h.length === 3) h = [...h].map((c) => c + c).join(\"\");\n\tconst n = parseInt(h, 16);\n\treturn `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;\n}\n\nfunction fmt(\n\taxis: ChartAxisOptions | undefined,\n): ((v: ChartX) => string) | null {\n\tif (!axis?.format) return null;\n\tif (typeof axis.format === \"function\") return axis.format;\n\tconst f = d3Format(axis.format);\n\treturn (v) => (typeof v === \"number\" ? f(v) : String(v));\n}\n\nfunction round(v: number): number {\n\treturn Math.round(v * 100) / 100;\n}\n\nfunction fadeIn(t: Timing, delay = 0, duration = t.duration): LayerAnimation {\n\treturn LayerAnimation.create().fromTo(\"opacity\", 0, 1, {\n\t\tstart: t.start + delay,\n\t\tend: t.start + delay + Math.max(1, duration),\n\t\tease: \"power2.out\",\n\t});\n}\n\n/** Builds the chart as a box of absolutely positioned child nodes. */\nexport function buildChart(\n\toptions: ChartOptions,\n\tprops: Partial<BoxNode>,\n\tdefaultFontFamily: string,\n): AnimatableNode<BoxNode> {\n\tconst id = props.id ?? autoId(\"chart\");\n\tconst width =\n\t\toptions.width ?? (typeof props.width === \"number\" ? props.width : 960);\n\tconst height =\n\t\toptions.height ?? (typeof props.height === \"number\" ? props.height : 540);\n\tconst type = options.type ?? \"line\";\n\tconst fontSize = options.fontSize ?? 18;\n\tconst fontFamily = options.fontFamily ?? defaultFontFamily;\n\tconst textColor = options.textColor ?? \"#94a3b8\";\n\t// Legend and value labels read a little stronger than axis labels; with a custom\n\t// textColor (e.g. dark text on a light background) they use it as is.\n\tconst strongText = options.textColor ?? \"#e2e8f0\";\n\tconst gridColor = options.gridColor ?? \"rgba(148, 163, 184, 0.18)\";\n\tconst colors = options.colors?.length ? options.colors : DEFAULT_CHART_COLORS;\n\tconst radius = options.cornerRadius ?? 4;\n\n\tconst anim = options.animate === false ? undefined : (options.animate ?? {});\n\tconst timing: Timing = {\n\t\tenabled: anim !== undefined,\n\t\tstart: anim?.start ?? 0,\n\t\tduration: anim?.duration ?? 30,\n\t\tstagger: anim?.stagger ?? -1,\n\t\tease: anim?.ease ?? \"power3.out\",\n\t};\n\n\tconst children: LayoutNode[] = [];\n\tconst label = (\n\t\ttext: string,\n\t\trect: Rect,\n\t\talign: \"start\" | \"center\" | \"end\",\n\t\textra: { delay?: number; color?: string; weight?: number } = {},\n\t\tkey = \"\",\n\t) => {\n\t\tconst node = Layer.text(text, {\n\t\t\tid: `${id}-label-${key || children.length}`,\n\t\t\tposition: \"absolute\",\n\t\t\tx: round(rect.x),\n\t\t\ty: round(rect.y),\n\t\t\twidth: round(rect.width),\n\t\t\theight: round(rect.height),\n\t\t\tfontFamily,\n\t\t\tfontSize,\n\t\t\tfontWeight: extra.weight ?? 500,\n\t\t\tfill: extra.color ?? textColor,\n\t\t\talign,\n\t\t\tverticalAlign: \"middle\",\n\t\t});\n\t\tif (timing.enabled) node.animate(fadeIn(timing, extra.delay ?? 0));\n\t\tchildren.push(node);\n\t};\n\n\tconst lineHeight = Math.ceil(fontSize * 1.4);\n\n\tif (type === \"pie\" || type === \"donut\") {\n\t\tbuildPie();\n\t} else {\n\t\tbuildCartesian();\n\t}\n\n\t// Staggers and fractional durations land between frames; the program schema\n\t// wants whole-frame keyframes.\n\tfor (const child of children) snapKeyframes(child);\n\n\treturn Layer.box({\n\t\tbackground: options.background ?? \"transparent\",\n\t\t...props,\n\t\tid,\n\t\twidth,\n\t\theight,\n\t\tchildren,\n\t});\n\n\t// ── pie & donut ─────────────────────────────────────────────────────\n\n\tfunction buildPie(): void {\n\t\tconst slices = collectSlices();\n\t\tconst total = slices.reduce((s, d) => s + Math.max(0, d.value), 0);\n\t\tconst showLegend = options.legend ?? true;\n\t\tconst pad = resolvePadding({\n\t\t\ttop: 16,\n\t\t\tright: showLegend ? legendColumnWidth(slices.map((s) => s.label)) : 16,\n\t\t\tbottom: 16,\n\t\t\tleft: 16,\n\t\t});\n\t\tconst plot = plotRect(pad);\n\t\tconst r = Math.max(1, Math.min(plot.width, plot.height) / 2);\n\t\tconst inner = r * (options.innerRadius ?? (type === \"donut\" ? 0.6 : 0));\n\t\tconst cx = plot.x + plot.width / 2;\n\t\tconst cy = plot.y + plot.height / 2;\n\t\tconst m = 4;\n\t\tconst arcs = d3Pie<ChartSlice>()\n\t\t\t.sort(null)\n\t\t\t.value((d) => Math.max(0, d.value))\n\t\t\t.padAngle(slices.length > 1 ? 0.012 : 0)(slices);\n\t\tconst arcGen = d3Arc<(typeof arcs)[number]>()\n\t\t\t.innerRadius(inner)\n\t\t\t.outerRadius(r)\n\t\t\t.cornerRadius(Math.min(radius, (r - inner) / 2));\n\t\tconst step = staggerStep(arcs.length);\n\n\t\tarcs.forEach((a, i) => {\n\t\t\tconst d = arcGen(a);\n\t\t\tif (!d) return;\n\t\t\tconst color = slices[i].color ?? colors[i % colors.length];\n\t\t\tconst node = Layer.shape(\"path\", {\n\t\t\t\tid: `${id}-slice-${i}`,\n\t\t\t\tposition: \"absolute\",\n\t\t\t\tx: round(cx - r - m),\n\t\t\t\ty: round(cy - r - m),\n\t\t\t\twidth: round(2 * (r + m)),\n\t\t\t\theight: round(2 * (r + m)),\n\t\t\t\td: translatePath(d, r + m, r + m),\n\t\t\t\tfillColor: color,\n\t\t\t\tanchorX: 0.5,\n\t\t\t\tanchorY: 0.5,\n\t\t\t});\n\t\t\tif (timing.enabled) {\n\t\t\t\tconst s = timing.start + i * step;\n\t\t\t\tnode.animate(\n\t\t\t\t\tLayerAnimation.create()\n\t\t\t\t\t\t.fromTo(\"opacity\", 0, 1, {\n\t\t\t\t\t\t\tstart: s,\n\t\t\t\t\t\t\tend: s + timing.duration * 0.5,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.fromTo(\"scale\", 0.85, 1, {\n\t\t\t\t\t\t\tstart: s,\n\t\t\t\t\t\t\tend: s + timing.duration,\n\t\t\t\t\t\t\tease: timing.ease,\n\t\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tchildren.push(node);\n\n\t\t\tif (options.valueLabels && total > 0 && a.value > 0) {\n\t\t\t\tconst [lx, ly] = d3Arc<(typeof arcs)[number]>()\n\t\t\t\t\t.innerRadius(inner || r * 0.55)\n\t\t\t\t\t.outerRadius(r)\n\t\t\t\t\t.centroid(a);\n\t\t\t\tconst pct = `${Math.round((a.value / total) * 100)}%`;\n\t\t\t\tlabel(\n\t\t\t\t\tpct,\n\t\t\t\t\t{\n\t\t\t\t\t\tx: cx + lx - 60,\n\t\t\t\t\t\ty: cy + ly - lineHeight / 2,\n\t\t\t\t\t\twidth: 120,\n\t\t\t\t\t\theight: lineHeight,\n\t\t\t\t\t},\n\t\t\t\t\t\"center\",\n\t\t\t\t\t{\n\t\t\t\t\t\tdelay: i * step + timing.duration * 0.5,\n\t\t\t\t\t\tcolor: \"#ffffff\",\n\t\t\t\t\t\tweight: 700,\n\t\t\t\t\t},\n\t\t\t\t\t`value-${i}`,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\tif (showLegend) {\n\t\t\tlegendColumn(\n\t\t\t\tslices.map((s, i) => ({\n\t\t\t\t\tname: s.label,\n\t\t\t\t\tcolor: s.color ?? colors[i % colors.length],\n\t\t\t\t})),\n\t\t\t\t{ x: plot.x + plot.width + 24, y: plot.y, height: plot.height },\n\t\t\t);\n\t\t}\n\t}\n\n\tfunction collectSlices(): ChartSlice[] {\n\t\tconst raw = (options.data ??\n\t\t\toptions.series?.[0]?.data ??\n\t\t\t[]) as readonly unknown[];\n\t\treturn raw.map((d, i) => {\n\t\t\tif (isSlice(d)) return d;\n\t\t\tconst value =\n\t\t\t\ttypeof d === \"number\"\n\t\t\t\t\t? d\n\t\t\t\t\t: Array.isArray(d)\n\t\t\t\t\t\t? Number(d[1])\n\t\t\t\t\t\t: Number((d as Point).y);\n\t\t\tconst name =\n\t\t\t\toptions.categories?.[i] ??\n\t\t\t\t(Array.isArray(d)\n\t\t\t\t\t? String(d[0])\n\t\t\t\t\t: typeof d === \"object\" && d\n\t\t\t\t\t\t? String((d as Point).x)\n\t\t\t\t\t\t: `${i + 1}`);\n\t\t\treturn { label: name, value };\n\t\t});\n\t}\n\n\t// ── cartesian: line, area, bar, scatter, candlestick ───────────────\n\n\tfunction buildCartesian(): void {\n\t\tconst series: ChartSeries[] = options.series?.length\n\t\t\t? [...options.series]\n\t\t\t: options.data\n\t\t\t\t? [{ data: options.data as ChartSeries[\"data\"] }]\n\t\t\t\t: [];\n\t\tif (series.length === 0) return;\n\n\t\tconst typeOf = (s: ChartSeries) =>\n\t\t\ts.type ?? (type as ChartSeries[\"type\"]) ?? \"line\";\n\t\tconst colorOf = (s: ChartSeries, i: number) =>\n\t\t\ts.color ?? colors[i % colors.length];\n\n\t\t// Normalise every series to points (candles keep their OHLC values).\n\t\tconst points: Point[][] = series.map((s) =>\n\t\t\t(s.data as readonly unknown[]).map((d, i) => {\n\t\t\t\tif (isCandle(d)) return { x: d.x, y: d.close };\n\t\t\t\tif (typeof d === \"number\")\n\t\t\t\t\treturn { x: options.categories?.[i] ?? i, y: d };\n\t\t\t\tif (Array.isArray(d)) return { x: d[0] as ChartX, y: Number(d[1]) };\n\t\t\t\treturn { x: (d as Point).x, y: Number((d as Point).y) };\n\t\t\t}),\n\t\t);\n\n\t\tconst anyBand = series.some(\n\t\t\t(s) => typeOf(s) === \"bar\" || typeOf(s) === \"candlestick\",\n\t\t);\n\t\tconst allX = points.flat().map((p) => p.x);\n\t\tconst xKind: \"band\" | \"time\" | \"linear\" =\n\t\t\tanyBand || allX.some((x) => typeof x === \"string\")\n\t\t\t\t? \"band\"\n\t\t\t\t: allX.some((x) => x instanceof Date)\n\t\t\t\t\t? \"time\"\n\t\t\t\t\t: \"linear\";\n\n\t\t// Stacking for bars and areas.\n\t\tconst stackable = (s: ChartSeries) =>\n\t\t\ttypeOf(s) === \"bar\" || typeOf(s) === \"area\";\n\t\tconst stacked = !!options.stacked;\n\t\tconst categories = xKind === \"band\" ? [...new Set(allX.map(String))] : [];\n\t\tconst stackRanges = new Map<number, [number, number][]>();\n\t\tif (stacked) {\n\t\t\tconst keys = series.map((_, i) => i).filter((i) => stackable(series[i]));\n\t\t\tconst rows = categories.length\n\t\t\t\t? categories\n\t\t\t\t: [...new Set(allX.map((x) => +x))].sort((a, b) => a - b).map(String);\n\t\t\tconst table = rows.map((key) => {\n\t\t\t\tconst row: Record<string, number> = {};\n\t\t\t\tfor (const i of keys) {\n\t\t\t\t\tconst p = points[i].find(\n\t\t\t\t\t\t(pt) => String(xKind === \"band\" ? pt.x : +pt.x) === key,\n\t\t\t\t\t);\n\t\t\t\t\trow[i] = p?.y ?? 0;\n\t\t\t\t}\n\t\t\t\treturn row;\n\t\t\t});\n\t\t\tconst layers = d3Stack<Record<string, number>>()\n\t\t\t\t.keys(keys.map(String))\n\t\t\t\t.offset(stackOffsetDiverging)(table);\n\t\t\tlayers.forEach((layer) => {\n\t\t\t\tconst i = Number(layer.key);\n\t\t\t\tstackRanges.set(\n\t\t\t\t\ti,\n\t\t\t\t\tpoints[i].map((p) => {\n\t\t\t\t\t\tconst idx = rows.indexOf(String(xKind === \"band\" ? p.x : +p.x));\n\t\t\t\t\t\treturn [layer[idx][0], layer[idx][1]];\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\t// y domain\n\t\tconst yValues: number[] = [0];\n\t\tseries.forEach((s, i) => {\n\t\t\tconst range = stackRanges.get(i);\n\t\t\tif (typeOf(s) === \"candlestick\") {\n\t\t\t\tfor (const c of s.data as readonly ChartCandle[])\n\t\t\t\t\tyValues.push(c.high, c.low);\n\t\t\t} else if (range) {\n\t\t\t\tfor (const [a, b] of range) yValues.push(a, b);\n\t\t\t} else {\n\t\t\t\tfor (const p of points[i]) yValues.push(p.y);\n\t\t\t}\n\t\t});\n\t\tif (\n\t\t\tseries.every(\n\t\t\t\t(s) =>\n\t\t\t\t\ttypeOf(s) === \"candlestick\" ||\n\t\t\t\t\ttypeOf(s) === \"scatter\" ||\n\t\t\t\t\ttypeOf(s) === \"line\",\n\t\t\t)\n\t\t) {\n\t\t\t// Line, scatter and price charts don't have to include zero.\n\t\t\tyValues.shift();\n\t\t}\n\n\t\tconst yAxis = options.yAxis ?? {};\n\t\tconst xAxis = options.xAxis ?? {};\n\t\tconst yTickCount = yAxis.ticks ?? 5;\n\t\tlet lo = yAxis.min ?? Math.min(...yValues);\n\t\tlet hi = yAxis.max ?? Math.max(...yValues);\n\t\tif (!Number.isFinite(lo) || !Number.isFinite(hi)) [lo, hi] = [0, 1];\n\t\tif (lo === hi) [lo, hi] = [lo - 1, hi + 1];\n\t\tconst y = scaleLinear().domain([lo, hi]);\n\t\tif (yAxis.min === undefined || yAxis.max === undefined) y.nice(yTickCount);\n\t\tconst yFormat =\n\t\t\tfmt(yAxis) ?? ((v: ChartX) => y.tickFormat(yTickCount)(v as number));\n\t\tconst yTicks = y.ticks(yTickCount);\n\n\t\tconst legendItems = series.map((s, i) => ({\n\t\t\tname: s.name ?? `Series ${i + 1}`,\n\t\t\tcolor: colorOf(s, i),\n\t\t}));\n\t\tconst showLegend = options.legend ?? series.length > 1;\n\t\tconst showY = yAxis.show !== false;\n\t\tconst showX = xAxis.show !== false;\n\t\tconst yLabelWidth = showY\n\t\t\t? Math.max(...yTicks.map((t) => yFormat(t).length)) * fontSize * 0.7 + 20\n\t\t\t: 0;\n\t\tconst pad = resolvePadding({\n\t\t\ttop: (showLegend ? lineHeight + 20 : 0) + Math.ceil(lineHeight / 2),\n\t\t\tright: 20,\n\t\t\tbottom: showX ? lineHeight + 14 : 12,\n\t\t\tleft: Math.max(16, Math.ceil(yLabelWidth)),\n\t\t});\n\t\tconst plot = plotRect(pad);\n\t\t// Room for value labels above positive bars and below negative ones.\n\t\tconst labelRoom = lineHeight + 6;\n\t\tconst barValues = options.valueLabels\n\t\t\t? series.flatMap((s, i) =>\n\t\t\t\t\ttypeOf(s) === \"bar\" ? points[i].map((p) => p.y) : [],\n\t\t\t\t)\n\t\t\t: [];\n\t\tconst topInset = barValues.some((v) => v > 0) ? labelRoom : 0;\n\t\tconst bottomInset = barValues.some((v) => v < 0) ? labelRoom : 0;\n\t\ty.range([plot.height - bottomInset, topInset]);\n\n\t\tlet x: XScale;\n\t\tif (xKind === \"band\") {\n\t\t\tx = scaleBand<string>()\n\t\t\t\t.domain(categories)\n\t\t\t\t.range([0, plot.width])\n\t\t\t\t.paddingInner(anyBand ? 0.28 : 0)\n\t\t\t\t.paddingOuter(anyBand ? 0.14 : 0.5);\n\t\t} else if (xKind === \"time\") {\n\t\t\tconst xs = allX.map((v) => +new Date(v as Date));\n\t\t\tx = scaleUtc()\n\t\t\t\t.domain([Math.min(...xs), Math.max(...xs)])\n\t\t\t\t.range([0, plot.width]);\n\t\t} else {\n\t\t\tconst xs = allX.map(Number);\n\t\t\tx = scaleLinear()\n\t\t\t\t.domain([xAxis.min ?? Math.min(...xs), xAxis.max ?? Math.max(...xs)])\n\t\t\t\t.range([0, plot.width]);\n\t\t}\n\t\tconst xPos = (v: ChartX): number => {\n\t\t\tif (xKind === \"band\") {\n\t\t\t\tconst b = x as ScaleBand<string>;\n\t\t\t\treturn (b(String(v)) ?? 0) + b.bandwidth() / 2;\n\t\t\t}\n\t\t\tif (xKind === \"time\")\n\t\t\t\treturn (x as ScaleTime<number, number>)(new Date(v as Date));\n\t\t\treturn (x as ScaleLinear<number, number>)(Number(v));\n\t\t};\n\n\t\t// Grid and y labels.\n\t\tconst gridDelay = 0;\n\t\tif (yAxis.grid !== false) {\n\t\t\tyTicks.forEach((t, i) => {\n\t\t\t\tconst node = Layer.box({\n\t\t\t\t\tid: `${id}-ygrid-${i}`,\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\tx: plot.x,\n\t\t\t\t\ty: round(plot.y + y(t) - 0.5),\n\t\t\t\t\twidth: plot.width,\n\t\t\t\t\theight: 1,\n\t\t\t\t\tbackground: gridColor,\n\t\t\t\t});\n\t\t\t\tif (timing.enabled)\n\t\t\t\t\tnode.animate(fadeIn(timing, gridDelay, timing.duration / 2));\n\t\t\t\tchildren.push(node);\n\t\t\t});\n\t\t}\n\t\tif (showY) {\n\t\t\tyTicks.forEach((t, i) => {\n\t\t\t\tlabel(\n\t\t\t\t\tyFormat(t),\n\t\t\t\t\t{\n\t\t\t\t\t\tx: 0,\n\t\t\t\t\t\ty: plot.y + y(t) - lineHeight / 2,\n\t\t\t\t\t\twidth: plot.x - 12,\n\t\t\t\t\t\theight: lineHeight,\n\t\t\t\t\t},\n\t\t\t\t\t\"end\",\n\t\t\t\t\t{},\n\t\t\t\t\t`y-${i}`,\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\t// x labels (and optional vertical grid).\n\t\tconst xTicks: { pos: number; text: string }[] = [];\n\t\tconst xFormat = fmt(xAxis);\n\t\tif (xKind === \"band\") {\n\t\t\tconst b = x as ScaleBand<string>;\n\t\t\tconst every = Math.max(\n\t\t\t\t1,\n\t\t\t\tMath.ceil(\n\t\t\t\t\tcategories.length /\n\t\t\t\t\t\tMath.max(1, Math.floor(plot.width / (fontSize * 4))),\n\t\t\t\t),\n\t\t\t);\n\t\t\tcategories.forEach((c, i) => {\n\t\t\t\tif (i % every === 0)\n\t\t\t\t\txTicks.push({\n\t\t\t\t\t\tpos: (b(c) ?? 0) + b.bandwidth() / 2,\n\t\t\t\t\t\ttext: xFormat ? xFormat(c) : c,\n\t\t\t\t\t});\n\t\t\t});\n\t\t} else {\n\t\t\tconst s = x as ScaleLinear<number, number>;\n\t\t\tconst count =\n\t\t\t\txAxis.ticks ?? Math.max(2, Math.floor(plot.width / (fontSize * 6)));\n\t\t\tconst tf = s.tickFormat(count);\n\t\t\tfor (const t of s.ticks(count)) {\n\t\t\t\txTicks.push({\n\t\t\t\t\tpos: s(t),\n\t\t\t\t\ttext: xFormat ? xFormat(xKind === \"time\" ? new Date(t) : t) : tf(t),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tif (xAxis.grid) {\n\t\t\txTicks.forEach((t, i) => {\n\t\t\t\tconst node = Layer.box({\n\t\t\t\t\tid: `${id}-xgrid-${i}`,\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\tx: round(plot.x + t.pos - 0.5),\n\t\t\t\t\ty: plot.y,\n\t\t\t\t\twidth: 1,\n\t\t\t\t\theight: plot.height,\n\t\t\t\t\tbackground: gridColor,\n\t\t\t\t});\n\t\t\t\tif (timing.enabled)\n\t\t\t\t\tnode.animate(fadeIn(timing, gridDelay, timing.duration / 2));\n\t\t\t\tchildren.push(node);\n\t\t\t});\n\t\t}\n\t\tif (showX) {\n\t\t\tconst slot = Math.max(\n\t\t\t\tfontSize * 3,\n\t\t\t\tplot.width / Math.max(1, xTicks.length),\n\t\t\t);\n\t\t\txTicks.forEach((t, i) => {\n\t\t\t\tlabel(\n\t\t\t\t\tt.text,\n\t\t\t\t\t{\n\t\t\t\t\t\tx: plot.x + t.pos - slot / 2,\n\t\t\t\t\t\ty: plot.y + plot.height + 10,\n\t\t\t\t\t\twidth: slot,\n\t\t\t\t\t\theight: lineHeight,\n\t\t\t\t\t},\n\t\t\t\t\t\"center\",\n\t\t\t\t\t{},\n\t\t\t\t\t`x-${i}`,\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\t// Baseline at zero when it is inside the domain.\n\t\tconst [y0, y1] = y.domain();\n\t\tif (y0 <= 0 && y1 >= 0 && anyBand) {\n\t\t\tconst node = Layer.box({\n\t\t\t\tid: `${id}-zero`,\n\t\t\t\tposition: \"absolute\",\n\t\t\t\tx: plot.x,\n\t\t\t\ty: round(plot.y + y(0) - 1),\n\t\t\t\twidth: plot.width,\n\t\t\t\theight: 2,\n\t\t\t\tbackground: withAlpha(\"#94a3b8\", 0.45),\n\t\t\t});\n\t\t\tif (timing.enabled) node.animate(fadeIn(timing, 0, timing.duration / 2));\n\t\t\tchildren.push(node);\n\t\t}\n\n\t\t// Series. Bars first so lines draw on top.\n\t\tconst barSeries = series\n\t\t\t.map((_, i) => i)\n\t\t\t.filter((i) => typeOf(series[i]) === \"bar\");\n\t\tconst order = [\n\t\t\t...barSeries,\n\t\t\t...series\n\t\t\t\t.map((_, i) => i)\n\t\t\t\t.filter((i) => typeOf(series[i]) === \"candlestick\"),\n\t\t\t...series.map((_, i) => i).filter((i) => typeOf(series[i]) === \"area\"),\n\t\t\t...series.map((_, i) => i).filter((i) => typeOf(series[i]) === \"line\"),\n\t\t\t...series.map((_, i) => i).filter((i) => typeOf(series[i]) === \"scatter\"),\n\t\t];\n\n\t\tconst band = xKind === \"band\" ? (x as ScaleBand<string>) : null;\n\t\tconst bandStep = band ? staggerStep(categories.length) : 0;\n\t\tconst categoryIndex = (v: ChartX) =>\n\t\t\tband ? categories.indexOf(String(v)) : 0;\n\n\t\torder.forEach((si, rank) => {\n\t\t\tconst s = series[si];\n\t\t\tconst color = colorOf(s, si);\n\t\t\tconst kind = typeOf(s);\n\t\t\tconst pts = points[si];\n\t\t\tconst range = stackRanges.get(si);\n\n\t\t\tif (kind === \"bar\" && band) {\n\t\t\t\tconst groupSize = stacked ? 1 : barSeries.length;\n\t\t\t\tconst groupIdx = stacked ? 0 : barSeries.indexOf(si);\n\t\t\t\tconst bw = band.bandwidth() / groupSize;\n\t\t\t\tconst gap = groupSize > 1 ? Math.min(4, bw * 0.12) : 0;\n\t\t\t\tpts.forEach((p, i) => {\n\t\t\t\t\tconst [lo, hi] = range ? range[i] : [0, p.y];\n\t\t\t\t\tconst top = plot.y + y(Math.max(lo, hi));\n\t\t\t\t\tconst bottom = plot.y + y(Math.min(lo, hi));\n\t\t\t\t\tconst h = Math.max(0, bottom - top);\n\t\t\t\t\tconst bx =\n\t\t\t\t\t\tplot.x + (band(String(p.x)) ?? 0) + groupIdx * bw + gap / 2;\n\t\t\t\t\tconst grows = p.y >= 0 ? \"up\" : \"down\";\n\t\t\t\t\tconst node = Layer.box({\n\t\t\t\t\t\tid: `${id}-bar-${si}-${i}`,\n\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\tx: round(bx),\n\t\t\t\t\t\ty: round(top),\n\t\t\t\t\t\twidth: round(Math.max(1, bw - gap)),\n\t\t\t\t\t\theight: round(h),\n\t\t\t\t\t\tbackground: color,\n\t\t\t\t\t\tborderRadius: Math.min(radius, (bw - gap) / 2, h / 2),\n\t\t\t\t\t});\n\t\t\t\t\tconst delay =\n\t\t\t\t\t\tcategoryIndex(p.x) * bandStep +\n\t\t\t\t\t\t(stacked ? barSeries.indexOf(si) * timing.duration * 0.6 : 0);\n\t\t\t\t\tif (timing.enabled) {\n\t\t\t\t\t\tconst st = timing.start + delay;\n\t\t\t\t\t\tconst end = st + timing.duration;\n\t\t\t\t\t\tconst a = LayerAnimation.create().fromTo(\"height\", 0, round(h), {\n\t\t\t\t\t\t\tstart: st,\n\t\t\t\t\t\t\tend,\n\t\t\t\t\t\t\tease: timing.ease,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (grows === \"up\") {\n\t\t\t\t\t\t\ta.fromTo(\"y\", round(top + h), round(top), {\n\t\t\t\t\t\t\t\tstart: st,\n\t\t\t\t\t\t\t\tend,\n\t\t\t\t\t\t\t\tease: timing.ease,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnode.animate(a);\n\t\t\t\t\t}\n\t\t\t\t\tchildren.push(node);\n\t\t\t\t\tif (options.valueLabels) {\n\t\t\t\t\t\tconst text = yFormat(p.y);\n\t\t\t\t\t\tconst ly = grows === \"up\" ? top - lineHeight - 4 : top + h + 4;\n\t\t\t\t\t\tlabel(\n\t\t\t\t\t\t\ttext,\n\t\t\t\t\t\t\t{ x: bx - 30, y: ly, width: bw - gap + 60, height: lineHeight },\n\t\t\t\t\t\t\t\"center\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdelay: delay + timing.duration * 0.6,\n\t\t\t\t\t\t\t\tcolor: strongText,\n\t\t\t\t\t\t\t\tweight: 600,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t`value-${si}-${i}`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (kind === \"candlestick\" && band) {\n\t\t\t\tconst up = options.upColor ?? \"#22c55e\";\n\t\t\t\tconst down = options.downColor ?? \"#ef4444\";\n\t\t\t\tconst bw = band.bandwidth();\n\t\t\t\t(s.data as readonly ChartCandle[]).forEach((c, i) => {\n\t\t\t\t\tconst col = c.close >= c.open ? up : down;\n\t\t\t\t\tconst cxp = plot.x + (band(String(c.x)) ?? 0) + bw / 2;\n\t\t\t\t\tconst delay = categoryIndex(c.x) * bandStep;\n\t\t\t\t\tconst parts: [string, Rect][] = [\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"wick\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tx: cxp - Math.max(1, bw * 0.06),\n\t\t\t\t\t\t\t\ty: plot.y + y(c.high),\n\t\t\t\t\t\t\t\twidth: Math.max(2, bw * 0.12),\n\t\t\t\t\t\t\t\theight: Math.max(1, y(c.low) - y(c.high)),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"body\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tx: cxp - bw / 2,\n\t\t\t\t\t\t\t\ty: plot.y + y(Math.max(c.open, c.close)),\n\t\t\t\t\t\t\t\twidth: bw,\n\t\t\t\t\t\t\t\theight: Math.max(2, Math.abs(y(c.open) - y(c.close))),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t];\n\t\t\t\t\tfor (const [part, r] of parts) {\n\t\t\t\t\t\tconst node = Layer.box({\n\t\t\t\t\t\t\tid: `${id}-candle-${si}-${i}-${part}`,\n\t\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\t\tx: round(r.x),\n\t\t\t\t\t\t\ty: round(r.y),\n\t\t\t\t\t\t\twidth: round(r.width),\n\t\t\t\t\t\t\theight: round(r.height),\n\t\t\t\t\t\t\tbackground: col,\n\t\t\t\t\t\t\tborderRadius:\n\t\t\t\t\t\t\t\tpart === \"body\" ? Math.min(radius / 2, r.width / 2) : 0,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (timing.enabled) {\n\t\t\t\t\t\t\tconst st = timing.start + delay;\n\t\t\t\t\t\t\tconst mid = r.y + r.height / 2;\n\t\t\t\t\t\t\tnode.animate(\n\t\t\t\t\t\t\t\tLayerAnimation.create()\n\t\t\t\t\t\t\t\t\t.fromTo(\"height\", 0, round(r.height), {\n\t\t\t\t\t\t\t\t\t\tstart: st,\n\t\t\t\t\t\t\t\t\t\tend: st + timing.duration,\n\t\t\t\t\t\t\t\t\t\tease: timing.ease,\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t.fromTo(\"y\", round(mid), round(r.y), {\n\t\t\t\t\t\t\t\t\t\tstart: st,\n\t\t\t\t\t\t\t\t\t\tend: st + timing.duration,\n\t\t\t\t\t\t\t\t\t\tease: timing.ease,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchildren.push(node);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (kind === \"line\" || kind === \"area\") {\n\t\t\t\tconst sw = s.strokeWidth ?? 3;\n\t\t\t\tconst m = Math.ceil(sw * 2 + (s.pointRadius ?? 0) + 2);\n\t\t\t\tconst xy = pts.map((p, i) => ({\n\t\t\t\t\tx: xPos(p.x) + m,\n\t\t\t\t\ttop: (range ? y(range[i][1]) : y(p.y)) + m,\n\t\t\t\t\tbase:\n\t\t\t\t\t\t(range\n\t\t\t\t\t\t\t? y(range[i][0])\n\t\t\t\t\t\t\t: y(Math.max(y.domain()[0], Math.min(0, y.domain()[1])))) + m,\n\t\t\t\t}));\n\t\t\t\tconst curve = curveOf(s.curve);\n\t\t\t\tconst frame: Rect = {\n\t\t\t\t\tx: plot.x - m,\n\t\t\t\t\ty: plot.y - m,\n\t\t\t\t\twidth: plot.width + 2 * m,\n\t\t\t\t\theight: plot.height + 2 * m,\n\t\t\t\t};\n\t\t\t\tconst delay = rank * (timing.duration / 3);\n\n\t\t\t\tif (kind === \"area\") {\n\t\t\t\t\tconst d = d3Area<(typeof xy)[number]>()\n\t\t\t\t\t\t.x((p) => p.x)\n\t\t\t\t\t\t.y0((p) => p.base)\n\t\t\t\t\t\t.y1((p) => p.top)\n\t\t\t\t\t\t.curve(curve)(xy);\n\t\t\t\t\tif (d) {\n\t\t\t\t\t\tconst node = Layer.shape(\"path\", {\n\t\t\t\t\t\t\tid: `${id}-area-${si}`,\n\t\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\t\t...roundRect(frame),\n\t\t\t\t\t\t\td: roundPath(d),\n\t\t\t\t\t\t\tfillType: \"linear\",\n\t\t\t\t\t\t\tfillColor: withAlpha(color, 0.45),\n\t\t\t\t\t\t\tgradientEndColor: withAlpha(color, 0.02),\n\t\t\t\t\t\t\tgradientAngle: 90,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (timing.enabled)\n\t\t\t\t\t\t\tnode.animate(\n\t\t\t\t\t\t\t\tfadeIn(timing, delay + timing.duration * 0.4, timing.duration),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tchildren.push(node);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst d = d3Line<(typeof xy)[number]>()\n\t\t\t\t\t.x((p) => p.x)\n\t\t\t\t\t.y((p) => p.top)\n\t\t\t\t\t.curve(curve)(xy);\n\t\t\t\tif (d && sw > 0) {\n\t\t\t\t\tconst node = Layer.shape(\"path\", {\n\t\t\t\t\t\tid: `${id}-line-${si}`,\n\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\t...roundRect(frame),\n\t\t\t\t\t\td: roundPath(d),\n\t\t\t\t\t\tfillType: \"none\",\n\t\t\t\t\t\tstrokeColor: color,\n\t\t\t\t\t\tstrokeWidth: sw,\n\t\t\t\t\t\tstrokeLineCap: \"round\",\n\t\t\t\t\t\tstrokeLineJoin: \"round\",\n\t\t\t\t\t});\n\t\t\t\t\tif (timing.enabled) {\n\t\t\t\t\t\tnode.animate(\n\t\t\t\t\t\t\tLayerAnimation.create().fromTo(\"trimEnd\", 0, 1, {\n\t\t\t\t\t\t\t\tstart: timing.start + delay,\n\t\t\t\t\t\t\t\tend: timing.start + delay + timing.duration * 1.5,\n\t\t\t\t\t\t\t\tease: \"power2.inOut\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tchildren.push(node);\n\t\t\t\t}\n\n\t\t\t\tif ((s.pointRadius ?? 0) > 0) {\n\t\t\t\t\tdots(\n\t\t\t\t\t\tsi,\n\t\t\t\t\t\tpts,\n\t\t\t\t\t\tcolor,\n\t\t\t\t\t\ts.pointRadius ?? 0,\n\t\t\t\t\t\tdelay + timing.duration * 0.5,\n\t\t\t\t\t\trange,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (kind === \"scatter\") {\n\t\t\t\tdots(\n\t\t\t\t\tsi,\n\t\t\t\t\tpts,\n\t\t\t\t\tcolor,\n\t\t\t\t\ts.pointRadius ?? 6,\n\t\t\t\t\trank * (timing.duration / 3),\n\t\t\t\t\trange,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\tif (showLegend) legendRow(legendItems);\n\n\t\tfunction dots(\n\t\t\tsi: number,\n\t\t\tpts: Point[],\n\t\t\tcolor: string,\n\t\t\tr: number,\n\t\t\tbaseDelay: number,\n\t\t\trange: [number, number][] | undefined,\n\t\t): void {\n\t\t\tconst step = staggerStep(pts.length);\n\t\t\tpts.forEach((p, i) => {\n\t\t\t\tconst py = range ? y(range[i][1]) : y(p.y);\n\t\t\t\tconst node = Layer.shape(\"circle\", {\n\t\t\t\t\tid: `${id}-point-${si}-${i}`,\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\tx: round(plot.x + xPos(p.x) - r),\n\t\t\t\t\ty: round(plot.y + py - r),\n\t\t\t\t\twidth: round(r * 2),\n\t\t\t\t\theight: round(r * 2),\n\t\t\t\t\tfillColor: color,\n\t\t\t\t\tanchorX: 0.5,\n\t\t\t\t\tanchorY: 0.5,\n\t\t\t\t});\n\t\t\t\tif (timing.enabled) {\n\t\t\t\t\tconst st = timing.start + baseDelay + i * step;\n\t\t\t\t\tnode.animate(\n\t\t\t\t\t\tLayerAnimation.create()\n\t\t\t\t\t\t\t.fromTo(\"scale\", 0, 1, {\n\t\t\t\t\t\t\t\tstart: st,\n\t\t\t\t\t\t\t\tend: st + timing.duration * 0.6,\n\t\t\t\t\t\t\t\tease: \"back.out(2)\",\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.fromTo(\"opacity\", 0, 1, { start: st, end: st + 6 }),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tchildren.push(node);\n\t\t\t});\n\t\t}\n\t}\n\n\t// ── shared helpers ──────────────────────────────────────────────────\n\n\tfunction staggerStep(count: number): number {\n\t\tif (!timing.enabled || count <= 1) return 0;\n\t\tif (timing.stagger >= 0) return timing.stagger;\n\t\treturn Math.min(4, timing.duration / count);\n\t}\n\n\tfunction resolvePadding(\n\t\tauto: Required<ChartPadding>,\n\t): Required<ChartPadding> {\n\t\tconst p = options.padding;\n\t\tif (typeof p === \"number\") return { top: p, right: p, bottom: p, left: p };\n\t\treturn {\n\t\t\ttop: p?.top ?? auto.top,\n\t\t\tright: p?.right ?? auto.right,\n\t\t\tbottom: p?.bottom ?? auto.bottom,\n\t\t\tleft: p?.left ?? auto.left,\n\t\t};\n\t}\n\n\tfunction plotRect(p: Required<ChartPadding>): Rect {\n\t\treturn {\n\t\t\tx: p.left,\n\t\t\ty: p.top,\n\t\t\twidth: Math.max(1, width - p.left - p.right),\n\t\t\theight: Math.max(1, height - p.top - p.bottom),\n\t\t};\n\t}\n\n\tfunction legendColumnWidth(names: string[]): number {\n\t\tconst longest = Math.max(0, ...names.map((n) => n.length));\n\t\treturn Math.min(width * 0.4, longest * fontSize * 0.6 + fontSize + 48);\n\t}\n\n\tfunction legendColumn(\n\t\titems: { name: string; color: string }[],\n\t\tat: { x: number; y: number; height: number },\n\t): void {\n\t\tconst rowH = lineHeight + 8;\n\t\tconst top = at.y + Math.max(0, (at.height - items.length * rowH) / 2);\n\t\titems.forEach((item, i) => {\n\t\t\tlegendItem(item, at.x, top + i * rowH, i);\n\t\t});\n\t}\n\n\tfunction legendRow(items: { name: string; color: string }[]): void {\n\t\tconst widths = items.map(\n\t\t\t(it) => it.name.length * fontSize * 0.6 + fontSize + 28,\n\t\t);\n\t\tconst total = widths.reduce((a, b) => a + b, 0);\n\t\tlet cursor = Math.max(0, width - total - 20);\n\t\titems.forEach((item, i) => {\n\t\t\tlegendItem(item, cursor, 4, i);\n\t\t\tcursor += widths[i];\n\t\t});\n\t}\n\n\tfunction legendItem(\n\t\titem: { name: string; color: string },\n\t\tlx: number,\n\t\tly: number,\n\t\ti: number,\n\t): void {\n\t\tconst sw = Math.round(fontSize * 0.7);\n\t\tconst swatch = Layer.box({\n\t\t\tid: `${id}-legend-swatch-${i}`,\n\t\t\tposition: \"absolute\",\n\t\t\tx: round(lx),\n\t\t\ty: round(ly + (lineHeight - sw) / 2),\n\t\t\twidth: sw,\n\t\t\theight: sw,\n\t\t\tborderRadius: Math.round(sw / 4),\n\t\t\tbackground: item.color,\n\t\t});\n\t\tif (timing.enabled) swatch.animate(fadeIn(timing, 0, timing.duration / 2));\n\t\tchildren.push(swatch);\n\t\tlabel(\n\t\t\titem.name,\n\t\t\t{\n\t\t\t\tx: lx + sw + 8,\n\t\t\t\ty: ly,\n\t\t\t\twidth: item.name.length * fontSize * 0.6 + 12,\n\t\t\t\theight: lineHeight,\n\t\t\t},\n\t\t\t\"start\",\n\t\t\t{ color: options.textColor ?? \"#cbd5e1\" },\n\t\t\t`legend-${i}`,\n\t\t);\n\t}\n}\n\nfunction snapKeyframes(node: LayoutNode): void {\n\tfor (const track of node.animation?.tracks ?? []) {\n\t\tfor (const kf of track.keyframes ?? []) kf.frame = Math.round(kf.frame);\n\t}\n\tfor (const child of (node as { children?: LayoutNode[] }).children ?? []) {\n\t\tsnapKeyframes(child);\n\t}\n}\n\nfunction roundRect(r: Rect): Rect {\n\treturn {\n\t\tx: round(r.x),\n\t\ty: round(r.y),\n\t\twidth: round(r.width),\n\t\theight: round(r.height),\n\t};\n}\n\n/** Shortens the long float literals d3 emits. */\nfunction roundPath(d: string): string {\n\treturn d.replace(/-?\\d*\\.\\d{3,}(?:e-?\\d+)?/gi, (n) =>\n\t\tString(round(Number(n))),\n\t);\n}\n\n/** Offsets an absolute SVG path (as produced by d3-arc) by dx, dy. */\nfunction translatePath(d: string, dx: number, dy: number): string {\n\t// d3-arc emits M/L/A/Z with absolute coordinates; A has 7 params, of which\n\t// the last two are the endpoint.\n\tconst out: string[] = [];\n\tconst re = /([MLAZ])([^MLAZ]*)/gi;\n\tfor (const [, cmd, args] of d.matchAll(re)) {\n\t\tconst nums = (args.match(/-?\\d*\\.?\\d+(?:e-?\\d+)?/gi) ?? []).map(Number);\n\t\tif (cmd.toUpperCase() === \"A\") {\n\t\t\tfor (let i = 0; i + 6 < nums.length; i += 7) {\n\t\t\t\tnums[i + 5] += dx;\n\t\t\t\tnums[i + 6] += dy;\n\t\t\t}\n\t\t} else if (cmd.toUpperCase() !== \"Z\") {\n\t\t\tfor (let i = 0; i + 1 < nums.length; i += 2) {\n\t\t\t\tnums[i] += dx;\n\t\t\t\tnums[i + 1] += dy;\n\t\t\t}\n\t\t}\n\t\tout.push(cmd + nums.map(round).join(\",\"));\n\t}\n\treturn out.join(\"\");\n}\n","import type {\n\tBoxNode,\n\tLayoutNode,\n\tMaterialType,\n\tModel3DNode,\n} from \"@framefields/compositions/program\";\nimport {\n\ttype CylinderGeometryOptions,\n\tgenerateExtrudedTextGeometry,\n\tgetPrimitiveGeometry,\n\ttype Model3DData,\n\ttype PrimitiveGeometryOptions,\n\ttype RoundedBoxGeometryOptions,\n\tSlugFontCache,\n\ttype SphereGeometryOptions,\n} from \"@framefields/webgpu-renderers\";\nimport { autoId } from \"./ids.js\";\nimport { type AnimatableNode, Layer } from \"./index.js\";\n\n/** Physically based surface options every 3D builder accepts. */\nexport interface Surface3DOptions {\n\t/** Light the surface gives off: a CSS color added on top of lighting. */\n\temissive?: string;\n\t/** Emissive multiplier; above 1 glows past white and blooms. Default 1. */\n\temissiveIntensity?: number;\n\t/** Falls into a `castShadow` light's shadow map (meshes default on, flat layers off). */\n\tcastShadow?: boolean;\n}\n\nconst MATERIAL_KEYS = [\n\t\"material\",\n\t\"shininess\",\n\t\"roughness\",\n\t\"specularIntensity\",\n\t\"metallic\",\n\t\"ambientIntensity\",\n\t\"ior\",\n\t\"transmission\",\n\t\"dispersion\",\n\t\"fresnelPower\",\n\t\"envIntensity\",\n\t\"emissive\",\n\t\"emissiveIntensity\",\n\t\"castShadow\",\n] as const;\n\n/** The material and surface options that were actually given. */\nfunction materialProps(o: object): Record<string, unknown> {\n\tconst src = o as Record<string, unknown>;\n\tconst out: Record<string, unknown> = {};\n\tfor (const k of MATERIAL_KEYS) {\n\t\tif (src[k] !== undefined) out[k] = src[k];\n\t}\n\treturn out;\n}\n\nexport interface CubeFaceConfig extends Surface3DOptions {\n\tbackground?: string;\n\tborderRadius?: number;\n\tborderWidth?: number;\n\tborderColor?: string;\n\topacity?: number;\n\tmaterial?: MaterialType;\n\tshininess?: number;\n\troughness?: number;\n\tspecularIntensity?: number;\n\tmetallic?: number;\n\tambientIntensity?: number;\n\tior?: number;\n\ttransmission?: number;\n\tdispersion?: number;\n\tfresnelPower?: number;\n\tenvIntensity?: number;\n\tchildren?: LayoutNode[];\n}\n\nexport type CubeFaceInput = CubeFaceConfig | LayoutNode | string;\n\nexport interface Cube3DOptions extends Surface3DOptions {\n\tid?: string;\n\tsize: number | [number, number, number];\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\tfaces?: {\n\t\tfront?: CubeFaceInput;\n\t\tback?: CubeFaceInput;\n\t\tleft?: CubeFaceInput;\n\t\tright?: CubeFaceInput;\n\t\ttop?: CubeFaceInput;\n\t\tbottom?: CubeFaceInput;\n\t};\n\ttwoSided?: boolean;\n\tmaterial?: MaterialType;\n\tshininess?: number;\n\troughness?: number;\n\tspecularIntensity?: number;\n\tmetallic?: number;\n\tambientIntensity?: number;\n\tior?: number;\n\ttransmission?: number;\n\tdispersion?: number;\n\tfresnelPower?: number;\n\tenvIntensity?: number;\n\topacity?: number;\n}\n\nexport interface Carousel3DOptions {\n\tid?: string;\n\tradius: number;\n\titems: LayoutNode[];\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\tfaceInward?: boolean;\n\titemWidth?: number;\n\titemHeight?: number;\n\ttwoSided?: boolean;\n\topacity?: number;\n}\n\nexport interface Prism3DOptions {\n\tid?: string;\n\tsides: number;\n\tradius: number;\n\theight: number;\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\tsideConfigs?: Array<CubeFaceInput>;\n\ttwoSided?: boolean;\n\tmaterial?: MaterialType;\n\tshininess?: number;\n\troughness?: number;\n\tspecularIntensity?: number;\n\tmetallic?: number;\n\tambientIntensity?: number;\n\tior?: number;\n\ttransmission?: number;\n\tdispersion?: number;\n\tfresnelPower?: number;\n\tenvIntensity?: number;\n\topacity?: number;\n}\n\nexport interface Plane3DOptions extends Surface3DOptions {\n\tid?: string;\n\twidth: number;\n\theight: number;\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\tbackground?: string;\n\tborderRadius?: number;\n\ttwoSided?: boolean;\n\tmaterial?: MaterialType;\n\tshininess?: number;\n\troughness?: number;\n\tspecularIntensity?: number;\n\tmetallic?: number;\n\tambientIntensity?: number;\n\tior?: number;\n\ttransmission?: number;\n\tdispersion?: number;\n\tfresnelPower?: number;\n\tenvIntensity?: number;\n\topacity?: number;\n\tchildren?: LayoutNode[];\n}\n\nexport interface Grid3DOptions {\n\tid?: string;\n\twidth: number;\n\theight: number;\n\tdivisions?: number;\n\tcolor?: string;\n\t/** Line thickness in world pixels (default 2). */\n\tlineWidth?: number;\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\topacity?: number;\n}\n\nexport interface Text3DOptions extends Surface3DOptions {\n\tid?: string;\n\ttext: string;\n\tfontSize?: number;\n\tfontFamily?: string;\n\tfontWeight?: number | string;\n\tfontStyle?: string;\n\tfill?: string;\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\tscale?: number;\n\tscaleX?: number;\n\tscaleY?: number;\n\tscaleZ?: number;\n\talign?: \"start\" | \"center\" | \"end\" | \"left\" | \"right\";\n\t/**\n\t * Base direction: \"auto\" (default) takes it from the first strong\n\t * character, so Arabic and Hebrew read right to left. \"start\"/\"end\"\n\t * alignment follows it.\n\t */\n\tdirection?: \"ltr\" | \"rtl\" | \"auto\";\n\tverticalAlign?: \"top\" | \"middle\" | \"bottom\";\n\tletterSpacing?: number;\n\tlineHeight?: number;\n\tis3D?: boolean;\n\ttwoSided?: boolean;\n\tmaterial?: MaterialType;\n\tshininess?: number;\n\troughness?: number;\n\tspecularIntensity?: number;\n\tambientIntensity?: number;\n\tmetallic?: number;\n\tior?: number;\n\ttransmission?: number;\n\tdispersion?: number;\n\tfresnelPower?: number;\n\tenvIntensity?: number;\n\topacity?: number;\n\tbackground?: string;\n\tborderRadius?: number;\n\tpadding?: number;\n\tstroke?: string;\n\tstrokeWidth?: number;\n\textrusionDepth?: number;\n\t/** @deprecated No effect: extruded text is one solid mesh, not a stack of slices. */\n\textrusionSteps?: number;\n\t/**\n\t * Extruded text only: color of the side walls. `fill` colors the letter\n\t * faces (front and back). Defaults to `fill`.\n\t */\n\tbevelColor?: string;\n}\n\nexport interface ExtrudedText3DOptions extends Text3DOptions {\n\tdepth: number;\n\t/** @deprecated No effect: extruded text is one solid mesh, not a stack of slices. */\n\tslices?: number;\n\t/** Fixed straight segments per curve; by default curves split as finely as their on-screen size needs. */\n\tcurveSegments?: number;\n\t/** Most a flattened curve strays from the outline, in on-screen px at scale 1 (default 0.1). */\n\tcurveTolerance?: number;\n}\n\n/** Node props shared by the mesh primitives (roundedBox, sphere, cylinder). */\nexport interface Primitive3DNodeOptions extends Surface3DOptions {\n\tid?: string;\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\tscale?: number;\n\tscaleX?: number;\n\tscaleY?: number;\n\tscaleZ?: number;\n\t/** Surface color baked into the mesh (default white). */\n\tcolor?: string;\n\t/**\n\t * Multiplies the surface color. It is the node's `color`, so animate it\n\t * with `.keys(\"color\", …)`; the baked surface `color` stays fixed.\n\t */\n\ttint?: string;\n\tmaterial?: MaterialType;\n\tshininess?: number;\n\troughness?: number;\n\tspecularIntensity?: number;\n\tambientIntensity?: number;\n\tmetallic?: number;\n\topacity?: number;\n\tstartFrame?: number;\n\tdurationFrames?: number;\n}\n\nexport type RoundedBox3DOptions = Primitive3DNodeOptions &\n\tOmit<RoundedBoxGeometryOptions, \"type\" | \"color\" | \"material\">;\nexport type Sphere3DOptions = Primitive3DNodeOptions &\n\tOmit<SphereGeometryOptions, \"type\" | \"color\" | \"material\">;\nexport type Cylinder3DOptions = Primitive3DNodeOptions &\n\tOmit<CylinderGeometryOptions, \"type\" | \"color\" | \"material\">;\n\n/** Mesh shading the geometry can bake in; layer materials (glass, …) apply on the node. */\nfunction meshShading(\n\tmaterial: MaterialType | undefined,\n): \"lit\" | \"unlit\" | \"toon\" | undefined {\n\treturn material === \"lit\" || material === \"unlit\" || material === \"toon\"\n\t\t? material\n\t\t: undefined;\n}\n\nfunction primitiveNode(\n\tprefix: string,\n\tgeometry: PrimitiveGeometryOptions,\n\to: Primitive3DNodeOptions,\n): AnimatableNode<Model3DNode> {\n\t// Only defined keys, so equal shapes share one cached mesh.\n\tconst spec = Object.fromEntries(\n\t\tObject.entries({\n\t\t\t...geometry,\n\t\t\tcolor: o.color,\n\t\t\tmaterial: meshShading(o.material),\n\t\t\tshininess: o.shininess,\n\t\t\troughness: o.roughness,\n\t\t\tmetallic: o.metallic,\n\t\t}).filter(([, v]) => v !== undefined),\n\t) as unknown as PrimitiveGeometryOptions;\n\treturn Layer.model({\n\t\tid: o.id ?? autoId(prefix),\n\t\tmodelData: getPrimitiveGeometry(spec),\n\t\t// What the compositor rebuilds the mesh from when modelData did not\n\t\t// survive (a spec sent as JSON).\n\t\tprimitive3d: spec,\n\t\tis3D: true,\n\t\tx: o.x ?? 0,\n\t\ty: o.y ?? 0,\n\t\tz: o.z ?? 0,\n\t\trotateX: o.rotateX ?? 0,\n\t\trotateY: o.rotateY ?? 0,\n\t\trotateZ: o.rotateZ ?? 0,\n\t\tscale: o.scale ?? 1,\n\t\tscaleX: o.scaleX ?? 1,\n\t\tscaleY: o.scaleY ?? 1,\n\t\tscaleZ: o.scaleZ ?? 1,\n\t\topacity: o.opacity ?? 1,\n\t\tcolor: o.tint,\n\t\tmaterial: o.material,\n\t\tshininess: o.shininess ?? 32,\n\t\troughness: o.roughness,\n\t\tspecularIntensity: o.specularIntensity ?? 0.5,\n\t\tambientIntensity: o.ambientIntensity ?? 1.0,\n\t\tmetallic: o.metallic,\n\t\t...materialProps({\n\t\t\temissive: o.emissive,\n\t\t\temissiveIntensity: o.emissiveIntensity,\n\t\t\tcastShadow: o.castShadow,\n\t\t}),\n\t\ttwoSided: false,\n\t\tstartFrame: o.startFrame,\n\t\tdurationFrames: o.durationFrames,\n\t});\n}\n\nexport type Shape3DContainer = AnimatableNode<BoxNode> & {\n\tfaces?: AnimatableNode<BoxNode>[];\n\titems?: LayoutNode[];\n\t[Symbol.iterator](): Iterator<LayoutNode>;\n};\n\n/**\n * Attaches the faces/items handles as non-enumerable properties, like\n * `animate`, so they stay out of `toSpec()` and schema validation.\n */\nfunction withParts<T extends object>(\n\tnode: T,\n\tparts: { faces?: LayoutNode[]; items?: LayoutNode[] },\n): T & Shape3DContainer {\n\tconst list = (parts.faces ?? parts.items ?? []) as LayoutNode[];\n\tfor (const [key, value] of Object.entries(parts)) {\n\t\tObject.defineProperty(node, key, {\n\t\t\tvalue,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\tObject.defineProperty(node, Symbol.iterator, {\n\t\tvalue: function* () {\n\t\t\tyield* list;\n\t\t},\n\t\tenumerable: false,\n\t\tconfigurable: true,\n\t});\n\treturn node as T & Shape3DContainer;\n}\n\n/** Largest initial scale of an extruded text node along its outline's axes. */\nfunction extrudedTextScale(options: ExtrudedText3DOptions): number {\n\tconst scale = options.scale ?? 1;\n\tconst s = Math.max(\n\t\tMath.abs(scale * (options.scaleX ?? 1)),\n\t\tMath.abs(scale * (options.scaleY ?? 1)),\n\t);\n\treturn s > 0 ? s : 1;\n}\n\nexport const Layer3D = {\n\t/**\n\t * Creates a true 3D volumetric cube with 6 textured or colored faces.\n\t * Returns a preserve-3d container that can be transformed in 3D camera space.\n\t */\n\tcube(options: Cube3DOptions): Shape3DContainer {\n\t\tconst size = options.size;\n\t\tconst [w, h, d] = typeof size === \"number\" ? [size, size, size] : size;\n\t\tconst twoSided = options.twoSided ?? true;\n\t\tconst defaultColors = {\n\t\t\tfront: \"#3b82f6\",\n\t\t\tback: \"#1d4ed8\",\n\t\t\tleft: \"#2563eb\",\n\t\t\tright: \"#1e40af\",\n\t\t\ttop: \"#60a5fa\",\n\t\t\tbottom: \"#172554\",\n\t\t};\n\n\t\tconst buildFace = (\n\t\t\tfaceId: string,\n\t\t\tinput: CubeFaceInput | undefined,\n\t\t\tdefaultColor: string,\n\t\t\tfaceW: number,\n\t\t\tfaceH: number,\n\t\t\tfaceProps: Partial<BoxNode>,\n\t\t): AnimatableNode<BoxNode> => {\n\t\t\tif (input && typeof input === \"object\" && \"kind\" in input) {\n\t\t\t\tconst node = input as AnimatableNode<BoxNode>;\n\t\t\t\tnode.position = \"absolute\";\n\t\t\t\tnode.is3D = true;\n\t\t\t\tnode.twoSided = twoSided;\n\t\t\t\tnode.material = node.material ?? options.material ?? \"lit\";\n\t\t\t\tnode.shininess = node.shininess ?? options.shininess ?? 32;\n\t\t\t\tnode.specularIntensity =\n\t\t\t\t\tnode.specularIntensity ?? options.specularIntensity ?? 0.5;\n\t\t\t\tif (options.roughness !== undefined && node.roughness === undefined) {\n\t\t\t\t\tnode.roughness = options.roughness;\n\t\t\t\t}\n\t\t\t\tif (options.metallic !== undefined && node.metallic === undefined) {\n\t\t\t\t\tnode.metallic = options.metallic;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\toptions.ambientIntensity !== undefined &&\n\t\t\t\t\tnode.ambientIntensity === undefined\n\t\t\t\t) {\n\t\t\t\t\tnode.ambientIntensity = options.ambientIntensity;\n\t\t\t\t}\n\t\t\t\tObject.assign(node, faceProps);\n\t\t\t\treturn node;\n\t\t\t}\n\t\t\tconst cfg: CubeFaceConfig =\n\t\t\t\ttypeof input === \"string\"\n\t\t\t\t\t? { background: input }\n\t\t\t\t\t: (input ?? { background: defaultColor });\n\n\t\t\treturn Layer.box({\n\t\t\t\tid: `${options.id ?? \"cube\"}-${faceId}`,\n\t\t\t\tposition: \"absolute\",\n\t\t\t\twidth: faceW,\n\t\t\t\theight: faceH,\n\t\t\t\tis3D: true,\n\t\t\t\ttwoSided,\n\t\t\t\tmaterial: cfg.material ?? options.material ?? \"lit\",\n\t\t\t\tshininess: cfg.shininess ?? options.shininess ?? 32,\n\t\t\t\tspecularIntensity:\n\t\t\t\t\tcfg.specularIntensity ?? options.specularIntensity ?? 0.5,\n\t\t\t\troughness: cfg.roughness ?? options.roughness,\n\t\t\t\tmetallic: cfg.metallic ?? options.metallic,\n\t\t\t\tambientIntensity:\n\t\t\t\t\tcfg.ambientIntensity ?? options.ambientIntensity ?? 1.0,\n\t\t\t\t...materialProps({\n\t\t\t\t\temissive: cfg.emissive ?? options.emissive,\n\t\t\t\t\temissiveIntensity: cfg.emissiveIntensity ?? options.emissiveIntensity,\n\t\t\t\t\tcastShadow: cfg.castShadow ?? options.castShadow,\n\t\t\t\t}),\n\t\t\t\tbackground: cfg.background ?? defaultColor,\n\t\t\t\tborderRadius: cfg.borderRadius ?? 0,\n\t\t\t\tborderWidth: cfg.borderWidth,\n\t\t\t\tborderColor: cfg.borderColor,\n\t\t\t\topacity: cfg.opacity ?? 1,\n\t\t\t\tchildren: cfg.children ?? [],\n\t\t\t\t...faceProps,\n\t\t\t});\n\t\t};\n\n\t\tconst halfW = w / 2;\n\t\tconst halfH = h / 2;\n\t\tconst halfD = d / 2;\n\n\t\tconst faces: AnimatableNode<BoxNode>[] = [\n\t\t\tbuildFace(\"front\", options.faces?.front, defaultColors.front, w, h, {\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t\tz: -halfD,\n\t\t\t\trotateX: 0,\n\t\t\t\trotateY: 0,\n\t\t\t\trotateZ: 0,\n\t\t\t}),\n\t\t\tbuildFace(\"back\", options.faces?.back, defaultColors.back, w, h, {\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t\tz: halfD,\n\t\t\t\trotateX: 0,\n\t\t\t\trotateY: 180,\n\t\t\t\trotateZ: 0,\n\t\t\t}),\n\t\t\tbuildFace(\"left\", options.faces?.left, defaultColors.left, d, h, {\n\t\t\t\tx: -halfW,\n\t\t\t\ty: 0,\n\t\t\t\tz: 0,\n\t\t\t\trotateX: 0,\n\t\t\t\trotateY: 90,\n\t\t\t\trotateZ: 0,\n\t\t\t}),\n\t\t\tbuildFace(\"right\", options.faces?.right, defaultColors.right, d, h, {\n\t\t\t\tx: halfW,\n\t\t\t\ty: 0,\n\t\t\t\tz: 0,\n\t\t\t\trotateX: 0,\n\t\t\t\trotateY: -90,\n\t\t\t\trotateZ: 0,\n\t\t\t}),\n\t\t\tbuildFace(\"top\", options.faces?.top, defaultColors.top, w, d, {\n\t\t\t\tx: 0,\n\t\t\t\ty: -halfH,\n\t\t\t\tz: 0,\n\t\t\t\trotateX: -90,\n\t\t\t\trotateY: 0,\n\t\t\t\trotateZ: 0,\n\t\t\t}),\n\t\t\tbuildFace(\"bottom\", options.faces?.bottom, defaultColors.bottom, w, d, {\n\t\t\t\tx: 0,\n\t\t\t\ty: halfH,\n\t\t\t\tz: 0,\n\t\t\t\trotateX: 90,\n\t\t\t\trotateY: 0,\n\t\t\t\trotateZ: 0,\n\t\t\t}),\n\t\t];\n\n\t\tconst container = Layer.box({\n\t\t\tid: options.id ?? autoId(\"cube\"),\n\t\t\tposition: \"absolute\",\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? 0,\n\t\t\twidth: w,\n\t\t\theight: h,\n\t\t\tis3D: true,\n\t\t\ttransformStyle: \"preserve-3d\",\n\t\t\trotateX: options.rotateX ?? 0,\n\t\t\trotateY: options.rotateY ?? 0,\n\t\t\trotateZ: options.rotateZ ?? 0,\n\t\t\topacity: options.opacity ?? 1,\n\t\t\tbackground: \"transparent\",\n\t\t\tchildren: faces,\n\t\t});\n\n\t\treturn withParts(container, { faces });\n\t},\n\n\t/**\n\t * Creates a 3D cylindrical carousel of items arranged radially around a center point.\n\t */\n\tcarousel(options: Carousel3DOptions): Shape3DContainer {\n\t\tconst { items, radius, faceInward = false, twoSided = true } = options;\n\t\tconst n = items.length;\n\t\tconst angleStep = n > 0 ? 360 / n : 0;\n\n\t\tconst transformedItems = items.map((item, idx) => {\n\t\t\t// Item 0 sits nearest the default camera (-z) and the ring runs clockwise\n\t\t\t// seen from above. A face's front normal is (-sin ry, 0, -cos ry) (the\n\t\t\t// cube's convention: rotateY 90 faces -x), so the outward normal\n\t\t\t// (sin a, 0, -cos a) needs ry = -a, and inward needs 180 - a.\n\t\t\tconst angleDeg = idx * angleStep;\n\t\t\tconst rad = (angleDeg * Math.PI) / 180;\n\t\t\tconst x = radius * Math.sin(rad);\n\t\t\tconst z = -radius * Math.cos(rad);\n\t\t\tconst ry = faceInward ? 180 - angleDeg : -angleDeg;\n\n\t\t\tconst node = item as AnimatableNode<BoxNode>;\n\t\t\tnode.position = \"absolute\";\n\t\t\tnode.is3D = true;\n\t\t\tnode.twoSided = twoSided;\n\t\t\tnode.x = x;\n\t\t\tnode.y = 0;\n\t\t\tnode.z = z;\n\t\t\tnode.rotateY = ry;\n\t\t\treturn node;\n\t\t});\n\n\t\tconst container = Layer.box({\n\t\t\tid: options.id ?? autoId(\"carousel\"),\n\t\t\tposition: \"absolute\",\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? 0,\n\t\t\twidth: (options.itemWidth ?? 200) as any,\n\t\t\theight: (options.itemHeight ?? 200) as any,\n\t\t\tis3D: true,\n\t\t\ttransformStyle: \"preserve-3d\",\n\t\t\trotateX: options.rotateX ?? 0,\n\t\t\trotateY: options.rotateY ?? 0,\n\t\t\trotateZ: options.rotateZ ?? 0,\n\t\t\topacity: options.opacity ?? 1,\n\t\t\tbackground: \"transparent\",\n\t\t\tchildren: transformedItems,\n\t\t});\n\n\t\treturn withParts(container, { items: transformedItems });\n\t},\n\n\t/**\n\t * Creates an N-sided regular polygonal 3D prism.\n\t */\n\tprism(options: Prism3DOptions): Shape3DContainer {\n\t\tconst { sides, radius, height, twoSided = true } = options;\n\t\tconst n = Math.max(3, sides);\n\t\tconst sideWidth = 2 * radius * Math.tan(Math.PI / n);\n\t\tconst angleStep = 360 / n;\n\t\tconst panels: AnimatableNode<BoxNode>[] = [];\n\n\t\tfor (let i = 0; i < n; i++) {\n\t\t\tconst angleDeg = i * angleStep;\n\t\t\tconst rad = (angleDeg * Math.PI) / 180;\n\t\t\tconst x = radius * Math.sin(rad);\n\t\t\tconst z = radius * Math.cos(rad);\n\t\t\tconst cfg = options.sideConfigs?.[i];\n\t\t\tconst color =\n\t\t\t\ttypeof cfg === \"string\"\n\t\t\t\t\t? cfg\n\t\t\t\t\t: ((cfg as { background?: string } | undefined)?.background ??\n\t\t\t\t\t\t`hsl(${(i * 360) / n}, 70%, 50%)`);\n\n\t\t\tpanels.push(\n\t\t\t\tLayer.box({\n\t\t\t\t\tid: `${options.id ?? \"prism\"}-panel-${i}`,\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\twidth: sideWidth,\n\t\t\t\t\theight,\n\t\t\t\t\tis3D: true,\n\t\t\t\t\ttwoSided,\n\t\t\t\t\tx,\n\t\t\t\t\ty: 0,\n\t\t\t\t\tz,\n\t\t\t\t\trotateY: angleDeg,\n\t\t\t\t\tbackground: color,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\tconst container = Layer.box({\n\t\t\tid: options.id ?? autoId(\"prism\"),\n\t\t\tposition: \"absolute\",\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? 0,\n\t\t\twidth: sideWidth,\n\t\t\theight,\n\t\t\tis3D: true,\n\t\t\ttransformStyle: \"preserve-3d\",\n\t\t\trotateX: options.rotateX ?? 0,\n\t\t\trotateY: options.rotateY ?? 0,\n\t\t\trotateZ: options.rotateZ ?? 0,\n\t\t\topacity: options.opacity ?? 1,\n\t\t\tbackground: \"transparent\",\n\t\t\tchildren: panels,\n\t\t});\n\n\t\treturn withParts(container, { faces: panels });\n\t},\n\n\t/**\n\t * Creates a standalone planar 3D card/quad.\n\t */\n\tplane(options: Plane3DOptions): AnimatableNode<BoxNode> {\n\t\treturn Layer.box({\n\t\t\tid: options.id ?? autoId(\"plane\"),\n\t\t\tposition: \"absolute\",\n\t\t\twidth: options.width,\n\t\t\theight: options.height,\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? 0,\n\t\t\tis3D: true,\n\t\t\ttwoSided: options.twoSided ?? true,\n\t\t\trotateX: options.rotateX ?? 0,\n\t\t\trotateY: options.rotateY ?? 0,\n\t\t\trotateZ: options.rotateZ ?? 0,\n\t\t\tbackground: options.background ?? \"#3b82f6\",\n\t\t\tborderRadius: options.borderRadius ?? 0,\n\t\t\topacity: options.opacity ?? 1,\n\t\t\t...materialProps(options),\n\t\t\tchildren: options.children ?? [],\n\t\t});\n\t},\n\n\t/**\n\t * Creates a 3D perspective ground grid: `divisions` cells per side, each\n\t * line its own unlit quad so it stays crisp at any camera distance.\n\t */\n\tgrid(options: Grid3DOptions): AnimatableNode<BoxNode> {\n\t\tconst { width, height } = options;\n\t\tconst id = options.id ?? autoId(\"grid\");\n\t\tconst divisions = Math.max(1, Math.round(options.divisions ?? 10));\n\t\tconst lineWidth = options.lineWidth ?? 2;\n\t\tconst color = options.color ?? \"rgba(59, 130, 246, 0.5)\";\n\t\tconst line = (\n\t\t\tlineId: string,\n\t\t\tx: number,\n\t\t\ty: number,\n\t\t\tw: number,\n\t\t\th: number,\n\t\t): AnimatableNode<BoxNode> =>\n\t\t\tLayer.box({\n\t\t\t\tid: `${id}-${lineId}`,\n\t\t\t\tposition: \"absolute\",\n\t\t\t\tx,\n\t\t\t\ty,\n\t\t\t\tz: 0,\n\t\t\t\twidth: w,\n\t\t\t\theight: h,\n\t\t\t\tis3D: true,\n\t\t\t\ttwoSided: true,\n\t\t\t\tmaterial: \"unlit\",\n\t\t\t\tbackground: color,\n\t\t\t});\n\t\t// Every quad is backed by a texture of its own size, so long lines are\n\t\t// split into segments that stay well inside the GPU's texture limit.\n\t\tconst MAX_SEGMENT = 4096;\n\t\tconst lines: AnimatableNode<BoxNode>[] = [];\n\t\tconst vSegments = Math.ceil(height / MAX_SEGMENT);\n\t\tconst hSegments = Math.ceil(width / MAX_SEGMENT);\n\t\tfor (let i = 0; i <= divisions; i++) {\n\t\t\tconst u = i / divisions - 0.5;\n\t\t\tfor (let k = 0; k < vSegments; k++) {\n\t\t\t\tconst len = height / vSegments;\n\t\t\t\tconst y = -height / 2 + len * (k + 0.5);\n\t\t\t\tlines.push(line(`v${i}-${k}`, u * width, y, lineWidth, len));\n\t\t\t}\n\t\t\tfor (let k = 0; k < hSegments; k++) {\n\t\t\t\tconst len = width / hSegments;\n\t\t\t\tconst x = -width / 2 + len * (k + 0.5);\n\t\t\t\tlines.push(line(`h${i}-${k}`, x, u * height, len, lineWidth));\n\t\t\t}\n\t\t}\n\t\treturn Layer.box({\n\t\t\tid,\n\t\t\tposition: \"absolute\",\n\t\t\twidth,\n\t\t\theight,\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? 0,\n\t\t\tis3D: true,\n\t\t\ttransformStyle: \"preserve-3d\",\n\t\t\trotateX: options.rotateX ?? 90,\n\t\t\trotateY: options.rotateY ?? 0,\n\t\t\trotateZ: options.rotateZ ?? 0,\n\t\t\tbackground: \"transparent\",\n\t\t\topacity: options.opacity ?? 1,\n\t\t\tchildren: lines,\n\t\t});\n\t},\n\n\t/**\n\t * Creates a standalone planar 3D text node, or solid extruded 3D text when `extrusionDepth` is set.\n\t */\n\ttext(options: Text3DOptions): AnimatableNode<LayoutNode> {\n\t\tif (options.extrusionDepth && options.extrusionDepth > 0) {\n\t\t\treturn Layer3D.extrudedText({\n\t\t\t\t...options,\n\t\t\t\tdepth: options.extrusionDepth,\n\t\t\t});\n\t\t}\n\n\t\treturn Layer.text(options.text, {\n\t\t\tid: options.id ?? autoId(\"text3d\"),\n\t\t\tposition: \"absolute\",\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? 0,\n\t\t\tis3D: true,\n\t\t\ttwoSided: options.twoSided ?? true,\n\t\t\trotateX: options.rotateX ?? 0,\n\t\t\trotateY: options.rotateY ?? 0,\n\t\t\trotateZ: options.rotateZ ?? 0,\n\t\t\tfontSize: options.fontSize ?? 48,\n\t\t\tfontFamily: options.fontFamily,\n\t\t\tfontWeight: options.fontWeight ?? \"bold\",\n\t\t\tfontStyle: options.fontStyle,\n\t\t\tfill: options.fill ?? \"#ffffff\",\n\t\t\talign: (options.align as any) ?? \"center\",\n\t\t\tdirection: options.direction,\n\t\t\tverticalAlign: options.verticalAlign ?? \"middle\",\n\t\t\tletterSpacing: options.letterSpacing,\n\t\t\tlineHeight: options.lineHeight,\n\t\t\tmaterial: options.material ?? \"lit\",\n\t\t\tshininess: options.shininess ?? 64,\n\t\t\troughness: options.roughness,\n\t\t\tspecularIntensity: options.specularIntensity ?? 0.8,\n\t\t\tambientIntensity: options.ambientIntensity ?? 1.0,\n\t\t\tmetallic: options.metallic,\n\t\t\t...materialProps(options),\n\t\t\topacity: options.opacity ?? 1,\n\t\t\tbackground: options.background,\n\t\t\tborderRadius: options.borderRadius,\n\t\t\tpadding: options.padding,\n\t\t\tstroke: options.stroke,\n\t\t\tstrokeWidth: options.strokeWidth,\n\t\t});\n\t},\n\n\t/**\n\t * Creates solid extruded 3D typography: `fill` colors the letter faces,\n\t * `bevelColor` the side walls; curves are tessellated to `curveTolerance`.\n\t */\n\textrudedText(options: ExtrudedText3DOptions): Shape3DContainer {\n\t\tconst { depth, text, fill = \"#ffffff\", bevelColor } = options;\n\n\t\tlet modelData: Model3DData | undefined;\n\t\t// Tolerance is in on-screen px: a node scaled up 3x needs 3x finer geometry.\n\t\tconst curveTolerance =\n\t\t\t(options.curveTolerance ?? 0.1) / extrudedTextScale(options);\n\t\tconst parsedFont =\n\t\t\t(options.fontFamily\n\t\t\t\t? SlugFontCache.getParsed(options.fontFamily)\n\t\t\t\t: null) ??\n\t\t\tSlugFontCache.getParsed(\"Inter\") ??\n\t\t\tSlugFontCache.getParsed(\"Unbounded\") ??\n\t\t\tSlugFontCache.getFirstParsed();\n\n\t\tif (parsedFont) {\n\t\t\tconst res = generateExtrudedTextGeometry({\n\t\t\t\ttext,\n\t\t\t\t// SlugFontCache holds fontkit fonts under a narrower type.\n\t\t\t\tfont: parsedFont as unknown as Parameters<\n\t\t\t\t\ttypeof generateExtrudedTextGeometry\n\t\t\t\t>[0][\"font\"],\n\t\t\t\tfontSize: options.fontSize ?? 48,\n\t\t\t\tdepth,\n\t\t\t\tfill,\n\t\t\t\tbevelColor,\n\t\t\t\tcurveSegments: options.curveSegments,\n\t\t\t\tcurveTolerance,\n\t\t\t\talign: options.align,\n\t\t\t\tdirection: options.direction,\n\t\t\t\tverticalAlign: options.verticalAlign,\n\t\t\t\tletterSpacing: options.letterSpacing,\n\t\t\t\t// The mesh's own shading only knows these; glass and the like are\n\t\t\t\t// layer materials, applied by the model node below.\n\t\t\t\tmaterial:\n\t\t\t\t\toptions.material === \"lit\" ||\n\t\t\t\t\toptions.material === \"unlit\" ||\n\t\t\t\t\toptions.material === \"toon\"\n\t\t\t\t\t\t? options.material\n\t\t\t\t\t\t: undefined,\n\t\t\t\tshininess: options.shininess,\n\t\t\t\troughness: options.roughness,\n\t\t\t\tmetallic: options.metallic,\n\t\t\t});\n\t\t\tmodelData = res.modelData;\n\t\t}\n\n\t\tconst modelNode = Layer.model({\n\t\t\tid: options.id ?? autoId(\"extruded-text\"),\n\t\t\tmodelData,\n\t\t\tis3D: true,\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? 0,\n\t\t\trotateX: options.rotateX ?? 0,\n\t\t\trotateY: options.rotateY ?? 0,\n\t\t\trotateZ: options.rotateZ ?? 0,\n\t\t\tscale: options.scale ?? 1,\n\t\t\tscaleX: options.scaleX ?? 1,\n\t\t\tscaleY: options.scaleY ?? 1,\n\t\t\tscaleZ: options.scaleZ ?? 1,\n\t\t\topacity: options.opacity ?? 1,\n\t\t\tmaterial: options.material,\n\t\t\tshininess: options.shininess ?? 32,\n\t\t\troughness: options.roughness,\n\t\t\tspecularIntensity: options.specularIntensity ?? 0.8,\n\t\t\tambientIntensity: options.ambientIntensity ?? 1.0,\n\t\t\tmetallic: options.metallic,\n\t\t\t...materialProps(options),\n\t\t\ttwoSided: options.twoSided ?? true,\n\t\t\t// What the compositor rebuilds the mesh from when modelData did not\n\t\t\t// survive (a spec sent as JSON): the same tolerance as here.\n\t\t\ttext3dOptions: { ...options, curveTolerance },\n\t\t});\n\n\t\treturn withParts(modelNode, {\n\t\t\tfaces: [modelNode],\n\t\t\titems: [modelNode],\n\t\t}) as unknown as Shape3DContainer;\n\t},\n\n\t/**\n\t * A solid box with rounded edges and corners, as one smooth-shaded mesh:\n\t * cards, buttons, device bodies. `taper` below 1 narrows the top (-y)\n\t * face, the shape of a keycap. Equal shapes share one GPU buffer.\n\t */\n\troundedBox(options: RoundedBox3DOptions): AnimatableNode<Model3DNode> {\n\t\treturn primitiveNode(\n\t\t\t\"rounded-box\",\n\t\t\t{\n\t\t\t\ttype: \"roundedBox\",\n\t\t\t\twidth: options.width,\n\t\t\t\theight: options.height,\n\t\t\t\tdepth: options.depth,\n\t\t\t\tradius: options.radius,\n\t\t\t\tsegments: options.segments,\n\t\t\t\ttaper: options.taper,\n\t\t\t},\n\t\t\toptions,\n\t\t);\n\t},\n\n\t/** A UV sphere mesh. */\n\tsphere(options: Sphere3DOptions): AnimatableNode<Model3DNode> {\n\t\treturn primitiveNode(\n\t\t\t\"sphere\",\n\t\t\t{ type: \"sphere\", radius: options.radius, segments: options.segments },\n\t\t\toptions,\n\t\t);\n\t},\n\n\t/** A capped cylinder, or a cone/frustum with different top and bottom radii. */\n\tcylinder(options: Cylinder3DOptions): AnimatableNode<Model3DNode> {\n\t\treturn primitiveNode(\n\t\t\t\"cylinder\",\n\t\t\t{\n\t\t\t\ttype: \"cylinder\",\n\t\t\t\tradius: options.radius,\n\t\t\t\tradiusTop: options.radiusTop,\n\t\t\t\tradiusBottom: options.radiusBottom,\n\t\t\t\theight: options.height,\n\t\t\t\tsegments: options.segments,\n\t\t\t\topenEnded: options.openEnded,\n\t\t\t},\n\t\t\toptions,\n\t\t);\n\t},\n\n\t/**\n\t * Creates a 3D model node rendered natively with WebGPU mesh shaders.\n\t */\n\tmodel(options: Partial<Model3DNode> = {}): AnimatableNode<Model3DNode> {\n\t\treturn Layer.model(options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D Wavefront OBJ model node.\n\t */\n\tobj(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.obj(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D Autodesk FBX model node with skeletal animation support.\n\t */\n\tfbx(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.fbx(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D glTF 2.0 model node.\n\t */\n\tgltf(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.gltf(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D GLB binary container model node.\n\t */\n\tglb(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.glb(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D STL CAD / 3D printing model node.\n\t */\n\tstl(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.stl(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D Stanford PLY scan model node.\n\t */\n\tply(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.ply(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D MagicaVoxel VOX model node.\n\t */\n\tvox(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.vox(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D Studio (3DS) binary model node.\n\t */\n\tthreeDS(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.threeDS(src, options);\n\t},\n\n\t/**\n\t * Convenience helper to create a 3D Object File Format (OFF) model node.\n\t */\n\toff(\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> {\n\t\treturn Layer.off(src, options);\n\t},\n};\n","/**\n * Scene sequencing with transitions. `Layer.sequence` lays scenes end to end\n * and overlaps neighbours by each transition's length; the transition itself\n * is plain keyframes (and, for wipes and irises, a track matte) merged into\n * the scenes, so it renders like anything else and stays editable.\n */\nimport {\n\ttype AnimationTrack,\n\ttype BoxNode,\n\tLayerAnimation,\n\ttype LayoutNode,\n} from \"@framefields/compositions/program\";\nimport { autoId } from \"./ids.js\";\nimport { type AnimatableNode, Layer } from \"./index.js\";\n\nexport type TransitionDirection = \"left\" | \"right\" | \"up\" | \"down\";\n\n/** What a transition needs to know to animate two scenes. */\ninterface TransitionContext {\n\t/** Scene size (px). */\n\twidth: number;\n\theight: number;\n\t/** Overlap length in frames. */\n\tframes: number;\n\t/** Outgoing scene: local frame where the overlap starts, and its rest position. */\n\toutStart: number;\n\toutRest: { x: number; y: number };\n\t/** Incoming scene rest position (the overlap starts at its local frame 0). */\n\tinRest: { x: number; y: number };\n}\n\ninterface TransitionParts {\n\toutgoing?: LayerAnimation;\n\tincoming?: LayerAnimation;\n\t/** A matte revealing the incoming scene (laid out like the scene, keyed from its start). */\n\tincomingMatte?: LayoutNode;\n\t/** Static props set on both scenes (e.g. motion blur for a whip). */\n\tsceneProps?: Record<string, unknown>;\n}\n\nexport interface TransitionSpec {\n\treadonly kind: string;\n\t/** Overlap between the two scenes, in frames (0 = hard cut). */\n\treadonly frames: number;\n\t/** @internal */\n\tbuild(ctx: TransitionContext): TransitionParts;\n}\n\nconst offsetFor = (dir: TransitionDirection, w: number, h: number) => {\n\tswitch (dir) {\n\t\tcase \"left\":\n\t\t\treturn { dx: -w, dy: 0 };\n\t\tcase \"right\":\n\t\t\treturn { dx: w, dy: 0 };\n\t\tcase \"up\":\n\t\t\treturn { dx: 0, dy: -h };\n\t\tdefault:\n\t\t\treturn { dx: 0, dy: h };\n\t}\n};\n\nfunction spec(\n\tkind: string,\n\tframes: number,\n\tbuild: (ctx: TransitionContext) => TransitionParts,\n): TransitionSpec {\n\treturn { kind, frames: Math.max(0, Math.round(frames)), build };\n}\n\n/**\n * Scene-to-scene transitions for `Layer.sequence`. `frames` is how long the\n * two scenes overlap; `ease` shapes the move (default \"power3.inOut\").\n */\nexport const Transition = {\n\t/** Instant cut. */\n\tcut: (): TransitionSpec => spec(\"cut\", 0, () => ({})),\n\n\t/** The incoming scene fades in over the outgoing one. */\n\tcrossfade: (frames = 15, ease = \"sine.inOut\"): TransitionSpec =>\n\t\tspec(\"crossfade\", frames, (c) => ({\n\t\t\tincoming: LayerAnimation.keys(\"opacity\", [\n\t\t\t\t[0, 0],\n\t\t\t\t[c.frames, 1, ease],\n\t\t\t]),\n\t\t})),\n\n\t/** Out to the background, then in: a dip to the composition's background color. */\n\tfadeThrough: (frames = 20, ease = \"sine.inOut\"): TransitionSpec =>\n\t\tspec(\"fadeThrough\", frames, (c) => {\n\t\t\tconst half = Math.max(1, Math.floor(c.frames / 2));\n\t\t\treturn {\n\t\t\t\toutgoing: LayerAnimation.keys(\"opacity\", [\n\t\t\t\t\t[c.outStart, 1],\n\t\t\t\t\t[c.outStart + half, 0, ease],\n\t\t\t\t]),\n\t\t\t\tincoming: LayerAnimation.keys(\"opacity\", [\n\t\t\t\t\t[0, 0],\n\t\t\t\t\t[half, 0],\n\t\t\t\t\t[c.frames, 1, ease],\n\t\t\t\t]),\n\t\t\t};\n\t\t}),\n\n\t/** Both scenes move together: the new one pushes the old one out toward `direction`. */\n\tpush: (\n\t\tdirection: TransitionDirection = \"left\",\n\t\tframes = 18,\n\t\tease = \"power3.inOut\",\n\t): TransitionSpec =>\n\t\tspec(\"push\", frames, (c) => {\n\t\t\tconst { dx, dy } = offsetFor(direction, c.width, c.height);\n\t\t\tconst out = LayerAnimation.create();\n\t\t\tconst inc = LayerAnimation.create();\n\t\t\tif (dx !== 0) {\n\t\t\t\tout.keys(\"x\", [\n\t\t\t\t\t[c.outStart, c.outRest.x],\n\t\t\t\t\t[c.outStart + c.frames, c.outRest.x + dx, ease],\n\t\t\t\t]);\n\t\t\t\tinc.keys(\"x\", [\n\t\t\t\t\t[0, c.inRest.x - dx],\n\t\t\t\t\t[c.frames, c.inRest.x, ease],\n\t\t\t\t]);\n\t\t\t} else {\n\t\t\t\tout.keys(\"y\", [\n\t\t\t\t\t[c.outStart, c.outRest.y],\n\t\t\t\t\t[c.outStart + c.frames, c.outRest.y + dy, ease],\n\t\t\t\t]);\n\t\t\t\tinc.keys(\"y\", [\n\t\t\t\t\t[0, c.inRest.y - dy],\n\t\t\t\t\t[c.frames, c.inRest.y, ease],\n\t\t\t\t]);\n\t\t\t}\n\t\t\treturn { outgoing: out, incoming: inc };\n\t\t}),\n\n\t/** The new scene slides in over the old one, which stays put and dims slightly. */\n\tslide: (\n\t\tdirection: TransitionDirection = \"left\",\n\t\tframes = 18,\n\t\tease = \"power3.out\",\n\t): TransitionSpec =>\n\t\tspec(\"slide\", frames, (c) => {\n\t\t\tconst { dx, dy } = offsetFor(direction, c.width, c.height);\n\t\t\tconst prop = dx !== 0 ? \"x\" : \"y\";\n\t\t\tconst rest = dx !== 0 ? c.inRest.x : c.inRest.y;\n\t\t\treturn {\n\t\t\t\toutgoing: LayerAnimation.keys(\"opacity\", [\n\t\t\t\t\t[c.outStart, 1],\n\t\t\t\t\t[c.outStart + c.frames, 0.6, ease],\n\t\t\t\t]),\n\t\t\t\tincoming: LayerAnimation.keys(prop, [\n\t\t\t\t\t[0, rest - (dx || dy)],\n\t\t\t\t\t[c.frames, rest, ease],\n\t\t\t\t]),\n\t\t\t};\n\t\t}),\n\n\t/** Old scene grows and fades, new one settles in from slightly small. */\n\tzoom: (frames = 18, ease = \"power2.inOut\"): TransitionSpec =>\n\t\tspec(\"zoom\", frames, (c) => ({\n\t\t\toutgoing: LayerAnimation.create()\n\t\t\t\t.keys(\"scale\", [\n\t\t\t\t\t[c.outStart, 1],\n\t\t\t\t\t[c.outStart + c.frames, 1.25, ease],\n\t\t\t\t])\n\t\t\t\t.keys(\"opacity\", [\n\t\t\t\t\t[c.outStart, 1],\n\t\t\t\t\t[c.outStart + c.frames, 0, ease],\n\t\t\t\t]),\n\t\t\tincoming: LayerAnimation.create()\n\t\t\t\t.keys(\"scale\", [\n\t\t\t\t\t[0, 0.85],\n\t\t\t\t\t[c.frames, 1, ease],\n\t\t\t\t])\n\t\t\t\t.keys(\"opacity\", [\n\t\t\t\t\t[0, 0],\n\t\t\t\t\t[c.frames, 1, ease],\n\t\t\t\t]),\n\t\t})),\n\n\t/** A fast, motion-blurred push: the camera whips to the next scene. */\n\twhip: (\n\t\tdirection: TransitionDirection = \"left\",\n\t\tframes = 10,\n\t): TransitionSpec => {\n\t\tconst push = Transition.push(direction, frames, \"expo.inOut\");\n\t\treturn spec(\"whip\", frames, (c) => ({\n\t\t\t...push.build(c),\n\t\t\tsceneProps: { motionBlurShutter: 360 },\n\t\t}));\n\t},\n\n\t/** A hard edge sweeps across, revealing the new scene. */\n\twipe: (\n\t\tdirection: TransitionDirection = \"left\",\n\t\tframes = 18,\n\t\tease = \"power2.inOut\",\n\t): TransitionSpec =>\n\t\tspec(\"wipe\", frames, (c) => {\n\t\t\t// `direction` is where the edge travels: \"left\" reveals from the right.\n\t\t\tconst { dx, dy } = offsetFor(direction, c.width, c.height);\n\t\t\tconst prop = dx !== 0 ? \"x\" : \"y\";\n\t\t\tconst rest = dx !== 0 ? c.inRest.x : c.inRest.y;\n\t\t\treturn {\n\t\t\t\tincomingMatte: Layer.box({\n\t\t\t\t\tid: autoId(\"wipe-matte\"),\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\tx: c.inRest.x,\n\t\t\t\t\ty: c.inRest.y,\n\t\t\t\t\twidth: c.width,\n\t\t\t\t\theight: c.height,\n\t\t\t\t\tbackground: \"#ffffff\",\n\t\t\t\t}).animate(\n\t\t\t\t\tLayerAnimation.keys(prop, [\n\t\t\t\t\t\t[0, rest - (dx || dy)],\n\t\t\t\t\t\t[c.frames, rest, ease],\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t};\n\t\t}),\n\n\t/** A circle opens from the center (or `at`, as fractions of the frame) to reveal the new scene. */\n\tiris: (\n\t\tframes = 20,\n\t\toptions: { at?: [number, number]; ease?: string } = {},\n\t): TransitionSpec =>\n\t\tspec(\"iris\", frames, (c) => {\n\t\t\tconst [fx, fy] = options.at ?? [0.5, 0.5];\n\t\t\tconst cx = c.inRest.x + fx * c.width;\n\t\t\tconst cy = c.inRest.y + fy * c.height;\n\t\t\t// Big enough to cover the farthest corner.\n\t\t\tconst r = Math.hypot(\n\t\t\t\tMath.max(fx, 1 - fx) * c.width,\n\t\t\t\tMath.max(fy, 1 - fy) * c.height,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tincomingMatte: Layer.shape(\"circle\", {\n\t\t\t\t\tid: autoId(\"iris-matte\"),\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\tx: cx - r,\n\t\t\t\t\ty: cy - r,\n\t\t\t\t\twidth: r * 2,\n\t\t\t\t\theight: r * 2,\n\t\t\t\t\tfillColor: \"#ffffff\",\n\t\t\t\t}).animate(\n\t\t\t\t\tLayerAnimation.keys(\"scale\", [\n\t\t\t\t\t\t[0, 0],\n\t\t\t\t\t\t[c.frames, 1, options.ease ?? \"power2.inOut\"],\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t};\n\t\t}),\n};\n\nexport interface SequenceEntry {\n\t/** A full-frame layer (usually a box holding the scene). */\n\tscene: AnimatableNode<LayoutNode> | LayoutNode;\n\t/** Frames this scene is on screen, transitions included. */\n\tduration: number;\n\t/** How this scene arrives from the previous one (default: cut). */\n\ttransition?: TransitionSpec;\n}\n\nexport interface SceneSequenceOptions {\n\tid?: string;\n\t/** Scene size used by moving transitions (default: each scene's own width/height, else 1920×1080). */\n\twidth?: number;\n\theight?: number;\n\t/** First frame of the whole sequence. Default 0. */\n\tstartFrame?: number;\n}\n\nexport type SequenceNode = AnimatableNode<BoxNode> & {\n\t/** Total length in frames: put it in the composition's duration. */\n\treadonly totalFrames: number;\n\t/** Where each scene starts (composition frames, relative to the sequence). */\n\treadonly sceneStarts: readonly number[];\n};\n\nfunction sizeOf(node: LayoutNode, axis: \"width\" | \"height\", fallback: number) {\n\tconst v = (node as unknown as Record<string, unknown>)[axis];\n\treturn typeof v === \"number\" ? v : fallback;\n}\n\n/**\n * Scenes back to back, each overlapping the previous one by its transition.\n * Scene timing is set for you (`startFrame` / `durationFrames`), so every\n * scene keys its own animation from its local frame 0.\n */\nexport function sequence(\n\tentries: SequenceEntry[],\n\toptions: SceneSequenceOptions = {},\n): SequenceNode {\n\tconst scenes: LayoutNode[] = [];\n\tconst starts: number[] = [];\n\tlet cursor = 0;\n\tentries.forEach((entry, i) => {\n\t\tconst t = i === 0 ? undefined : entry.transition;\n\t\tconst overlap = Math.min(t?.frames ?? 0, entries[i - 1]?.duration ?? 0);\n\t\tconst start = Math.max(0, cursor - overlap);\n\t\tconst duration = Math.max(1, Math.round(entry.duration));\n\t\tstarts.push(start);\n\t\tconst node = entry.scene as LayoutNode & Record<string, unknown>;\n\t\t// Scenes stack in one frame rather than flowing one under the other.\n\t\tif (node.position === undefined || node.position === \"relative\") {\n\t\t\tnode.position = \"absolute\";\n\t\t\tnode.x ??= 0;\n\t\t\tnode.y ??= 0;\n\t\t}\n\t\tnode.startFrame = start;\n\t\tnode.durationFrames = duration;\n\t\tscenes.push(node);\n\t\tcursor = start + duration;\n\t});\n\n\tentries.forEach((entry, i) => {\n\t\tif (i === 0 || !entry.transition || entry.transition.frames === 0) return;\n\t\tconst prev = scenes[i - 1] as LayoutNode & Record<string, unknown>;\n\t\tconst cur = scenes[i] as LayoutNode & Record<string, unknown>;\n\t\tconst frames = Math.min(entry.transition.frames, entries[i - 1].duration);\n\t\tconst width = options.width ?? sizeOf(cur, \"width\", 1920);\n\t\tconst height = options.height ?? sizeOf(cur, \"height\", 1080);\n\t\tconst parts = entry.transition.build({\n\t\t\twidth,\n\t\t\theight,\n\t\t\tframes,\n\t\t\toutStart: entries[i - 1].duration - frames,\n\t\t\toutRest: {\n\t\t\t\tx: typeof prev.x === \"number\" ? prev.x : 0,\n\t\t\t\ty: typeof prev.y === \"number\" ? prev.y : 0,\n\t\t\t},\n\t\t\tinRest: {\n\t\t\t\tx: typeof cur.x === \"number\" ? cur.x : 0,\n\t\t\t\ty: typeof cur.y === \"number\" ? cur.y : 0,\n\t\t\t},\n\t\t});\n\t\tconst merge = (\n\t\t\tnode: LayoutNode & Record<string, unknown>,\n\t\t\tanim?: LayerAnimation,\n\t\t) => {\n\t\t\tif (!anim) return;\n\t\t\tconst existing =\n\t\t\t\t(node.animation as { tracks?: AnimationTrack[] } | undefined)?.tracks ??\n\t\t\t\t[];\n\t\t\tnode.animation = LayerAnimation.merge(\n\t\t\t\t{ tracks: existing },\n\t\t\t\tanim,\n\t\t\t).toSpec();\n\t\t};\n\t\tmerge(prev, parts.outgoing);\n\t\tmerge(cur, parts.incoming);\n\t\tif (parts.sceneProps) {\n\t\t\tObject.assign(prev, parts.sceneProps);\n\t\t\tObject.assign(cur, parts.sceneProps);\n\t\t}\n\t\tif (parts.incomingMatte) {\n\t\t\tcur.matte = { node: parts.incomingMatte, mode: \"alpha\" };\n\t\t}\n\t});\n\n\tconst root = Layer.box({\n\t\tid: options.id ?? autoId(\"sequence\"),\n\t\tposition: \"absolute\",\n\t\tx: 0,\n\t\ty: 0,\n\t\twidth:\n\t\t\toptions.width ?? sizeOf(scenes[0] ?? ({} as LayoutNode), \"width\", 1920),\n\t\theight:\n\t\t\toptions.height ?? sizeOf(scenes[0] ?? ({} as LayoutNode), \"height\", 1080),\n\t\tstartFrame: options.startFrame ?? 0,\n\t\tdurationFrames: Math.max(1, cursor),\n\t\tchildren: scenes,\n\t});\n\tObject.defineProperty(root, \"totalFrames\", {\n\t\tvalue: cursor,\n\t\tenumerable: false,\n\t});\n\tObject.defineProperty(root, \"sceneStarts\", {\n\t\tvalue: starts,\n\t\tenumerable: false,\n\t});\n\treturn root as SequenceNode;\n}\n","import type {\n\tEnvironmentPreset,\n\tLightNode,\n\tToneMapping,\n} from \"@framefields/compositions/program\";\nimport { autoId } from \"./ids.js\";\nimport {\n\ttype AnimatableNode,\n\ttype EnvironmentOptions,\n\tLight,\n} from \"./index.js\";\n\nexport interface LightingRigOptions {\n\t/** What the lights aim at (world px). Default: the canvas center at z 0. */\n\ttarget?: [number, number, number];\n\t/** How far the lights sit from the target. Default 1600. */\n\tdistance?: number;\n\t/** Turns the whole rig (lights and environment) around the vertical axis, degrees. */\n\trotation?: number;\n\t/** Scales every light. Default 1. */\n\tintensity?: number;\n\t/** Exposure in stops. Default 0. */\n\texposure?: number;\n\ttoneMapping?: ToneMapping;\n\t/** Key light casts a soft shadow. Default true. */\n\tshadows?: boolean;\n\t/** Shadow edge blur in texels. Default 3. */\n\tshadowSoftness?: number;\n\t/** Fog fading into the background, e.g. `{ color: BG, start: 2500, end: 6000 }`. */\n\tfog?: EnvironmentOptions[\"fog\"];\n\t/** Glow around emissive surfaces and highlights: `true` or settings. */\n\tbloom?: EnvironmentOptions[\"bloom\"];\n\t/** Prefix for the rig's node ids. */\n\tid?: string;\n}\n\ninterface RigSpec {\n\tenvironment: EnvironmentPreset;\n\tenvIntensity: number;\n\t/** Light directions relative to the target, before `rotation`; y is down. */\n\tkey: { dir: [number, number, number]; color: string; intensity: number };\n\trim?: { dir: [number, number, number]; color: string; intensity: number };\n\tfill?: { dir: [number, number, number]; color: string; intensity: number };\n}\n\nconst RIGS = {\n\t/** Product photography: soft overhead key with a shadow, cool rim, studio reflections. */\n\tstudio: {\n\t\tenvironment: \"studio\",\n\t\tenvIntensity: 1,\n\t\tkey: { dir: [-0.55, -1, -0.7], color: \"#fff6ec\", intensity: 1.1 },\n\t\trim: { dir: [0.9, -0.5, 0.9], color: \"#dbe8ff\", intensity: 0.9 },\n\t},\n\t/** Bright, airy, low contrast: lifestyle and UI-on-device shots. */\n\tsoft: {\n\t\tenvironment: \"soft\",\n\t\tenvIntensity: 1,\n\t\tkey: { dir: [-0.4, -1, -0.8], color: \"#ffffff\", intensity: 1.0 },\n\t},\n\t/** Low warm sun, long shadows, cool sky fill. */\n\tsunset: {\n\t\tenvironment: \"sunset\",\n\t\tenvIntensity: 0.9,\n\t\tkey: { dir: [-1, -0.35, -0.3], color: \"#ffb27a\", intensity: 2.2 },\n\t\tfill: { dir: [0.8, -0.6, -0.4], color: \"#7f9cff\", intensity: 0.35 },\n\t},\n\t/** Moody: dark world, hard key, strong rim. Pair with emissive accents. */\n\tdramatic: {\n\t\tenvironment: \"night\",\n\t\tenvIntensity: 0.8,\n\t\tkey: { dir: [-0.8, -1, -0.35], color: \"#ffffff\", intensity: 2.4 },\n\t\trim: { dir: [0.7, -0.4, 1], color: \"#8fb4ff\", intensity: 1.8 },\n\t},\n} satisfies Record<string, RigSpec>;\n\nexport type LightingRig = keyof typeof RIGS;\n\nfunction rotateY(\n\t[x, y, z]: [number, number, number],\n\tdegrees: number,\n): [number, number, number] {\n\tconst r = (degrees * Math.PI) / 180;\n\tconst c = Math.cos(r);\n\tconst s = Math.sin(r);\n\treturn [c * x + s * z, y, -s * x + c * z];\n}\n\nfunction aim(\n\tdir: [number, number, number],\n\ttarget: [number, number, number],\n\tdistance: number,\n\trotation: number,\n): Pick<LightNode, \"x\" | \"y\" | \"z\" | \"targetX\" | \"targetY\" | \"targetZ\"> {\n\tconst [dx, dy, dz] = rotateY(dir, rotation);\n\tconst len = Math.hypot(dx, dy, dz) || 1;\n\treturn {\n\t\tx: target[0] + (dx / len) * distance,\n\t\ty: target[1] + (dy / len) * distance,\n\t\tz: target[2] + (dz / len) * distance,\n\t\ttargetX: target[0],\n\t\ttargetY: target[1],\n\t\ttargetZ: target[2],\n\t};\n}\n\nfunction rig(\n\tname: LightingRig,\n\toptions: LightingRigOptions,\n): AnimatableNode<LightNode>[] {\n\tconst spec: RigSpec = RIGS[name];\n\tconst target = options.target ?? [960, 540, 0];\n\tconst distance = options.distance ?? 1600;\n\tconst rotation = options.rotation ?? 0;\n\tconst k = options.intensity ?? 1;\n\tconst id = options.id ?? autoId(`lighting-${name}`);\n\tconst nodes: AnimatableNode<LightNode>[] = [\n\t\tLight.environment(spec.environment, {\n\t\t\tid: `${id}-environment`,\n\t\t\tintensity: spec.envIntensity * k,\n\t\t\trotation,\n\t\t\texposure: options.exposure,\n\t\t\ttoneMapping: options.toneMapping,\n\t\t\tfog: options.fog,\n\t\t\tbloom: options.bloom,\n\t\t}),\n\t\tLight.directional({\n\t\t\tid: `${id}-key`,\n\t\t\tcolor: spec.key.color,\n\t\t\tintensity: spec.key.intensity * k,\n\t\t\t...aim(spec.key.dir, target, distance, rotation),\n\t\t\tcastShadow: options.shadows ?? true,\n\t\t\tshadowSoftness: options.shadowSoftness ?? 3,\n\t\t}),\n\t];\n\tfor (const [part, light] of [\n\t\t[\"rim\", spec.rim],\n\t\t[\"fill\", spec.fill],\n\t] as const) {\n\t\tif (!light) continue;\n\t\tnodes.push(\n\t\t\tLight.directional({\n\t\t\t\tid: `${id}-${part}`,\n\t\t\t\tcolor: light.color,\n\t\t\t\tintensity: light.intensity * k,\n\t\t\t\t...aim(light.dir, target, distance, rotation),\n\t\t\t}),\n\t\t);\n\t}\n\treturn nodes;\n}\n\n/**\n * Ready-made lighting: an environment (physical shading, tone mapping) plus\n * placed key / rim / fill lights, the key casting a soft shadow. Add the\n * returned nodes to the composition: `comp.add(Lighting.studio({ target }))`.\n *\n * Tweak from there rather than starting from zero: `intensity`, `exposure`,\n * `rotation` (turns the rig), `shadowSoftness`, `fog`.\n */\nexport const Lighting = {\n\tstudio: (options: LightingRigOptions = {}) => rig(\"studio\", options),\n\tsoft: (options: LightingRigOptions = {}) => rig(\"soft\", options),\n\tsunset: (options: LightingRigOptions = {}) => rig(\"sunset\", options),\n\tdramatic: (options: LightingRigOptions = {}) => rig(\"dramatic\", options),\n};\n","export {\n\tAudioSignal,\n\ttype AudioSignalOptions,\n\tcomputed,\n\tcosineSignal,\n\ttype ExtractedAudioSignalsBundle,\n\ttype FrameSignal,\n\tSignal,\n\ttype SignalContext,\n\ttype SignalValue,\n\ttype SineSignalOptions,\n\tsignal,\n\tsignalBuilder,\n\tsignalRegistry,\n\tsineSignal,\n} from \"./signals/index.js\";\n\nimport {\n\tFontManager,\n\ttype MeasuredGlyph,\n\ttype MeasureTextOptions,\n\ttype RegisteredFont,\n\ttype RegisterFontOptions,\n\ttype TextMetrics,\n} from \"./fonts/index.js\";\nimport { autoId } from \"./ids.js\";\nimport { normalizeTextSpans, type TextSpan } from \"./rich-text.js\";\n\nexport {\n\tencodeStereoWav,\n\tmixAudioTracks,\n\tmixSfxInto,\n\ttype RenderedSfx,\n\trenderSfx,\n\ttype SfxRenderContext,\n\ttype SfxTrigger,\n\tsoftLimit,\n} from \"./audio/index.js\";\nexport {\n\taccent,\n\tbold,\n\tcode,\n\tcolor,\n\titalic,\n\ttype MarkOptions,\n\tmark,\n\tnormalizeTextSpans,\n\tparseMarkup,\n\trich,\n\tsize,\n\tspan,\n\tsub,\n\tsup,\n\ttype TextSpan,\n\ttype TextSpanItem,\n\ttype TextSpanMark,\n} from \"./rich-text.js\";\nexport {\n\tFontManager,\n\ttype MeasuredGlyph,\n\ttype MeasureTextOptions,\n\ttype RegisteredFont,\n\ttype RegisterFontOptions,\n\ttype TextMetrics,\n};\n\nexport {\n\tCannyComputePipeline,\n\ttype CannyOptions,\n\ttype ControlNetConditioningOutputs,\n\tControlNetMultiplexer,\n\ttype DeflickerOptions,\n\tDepthNormalsComputePipeline,\n\ttype DepthNormalsOptions,\n\ttype NormalRelightingOptions,\n\tOpticalFlowComputePipeline,\n\ttype OpticalFlowOptions,\n\tTemporalDeflickerPipeline,\n\ttype TensorDimensions,\n\ttype TensorFormat,\n\ttype TensorNode,\n\tTensorPipeline,\n\ttype TensorPipelineConfig,\n\ttype TensorSource,\n\ttype TensorViewExport,\n} from \"@framefields/tensor-webgpu\";\nexport {\n\tCOCO_CLASSES,\n\tCOCO17_BONES,\n\tCOCO17_KEYPOINT_NAMES,\n\tCOCO17_KEYPOINTS,\n\ttype DetectedObject,\n\ttype InstanceMask,\n\ttype Landmark3D,\n\ttype LandmarkCoordinateSignals,\n\ttype MaskTrackSignals,\n\ttype NormalizedLandmarkList,\n\ttype ObjectAnchorName,\n\ttype ObjectAnchorsSignals,\n\ttype ObjectBoundingBox,\n\ttype ObjectBoundingBoxSignals,\n\ttype ObjectCollectionSignals,\n\ttype ObjectKinematicsSignals,\n\ttype ObjectTrackSignals,\n\ttype PersonMatte,\n\ttype PinToLandmarkOptions,\n\ttype PinToObjectOptions,\n\ttype PoseLandmarkSignals,\n\ttype PoseResult,\n\tPoseSkeletonRenderer,\n\tpinNodeToLandmark,\n\tpinNodeToObject,\n\ttype SegmentationResult,\n\tSegmentationTexturePool,\n\tSpatialLandmarkTransformer,\n\tTemporalObjectTracker,\n\ttype TrackedObject,\n\tVisionBundle,\n\ttype VisionConfig,\n\tVisionNode,\n\tVisionRunner,\n\ttype VisionTask,\n\ttype VisionVariant,\n} from \"@framefields/vision\";\n\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n\ttype AnimationTrack,\n\ttype BoxNode,\n\ttype CameraNode,\n\ttype CompositorProgramConfig,\n\ttype CompositorToProgramOptions,\n\tcompositorToProgram,\n\ttype EnvironmentPreset,\n\ttype FlexNode,\n\tLayerAnimation,\n\ttype LayoutNode,\n\ttype LightNode,\n\tlintComposition,\n\ttype MatteMode,\n\ttype MediaNode,\n\ttype Model3DNode,\n\tmergeAnimationTracks,\n\ttype ShapeNode,\n\ttype TextNode,\n} from \"@framefields/compositions/program\";\nimport {\n\tappendOperation,\n\tEffect as CoreEffect,\n\tcreateVirtualMedia,\n\ttype DataType,\n\ttype FrameContext,\n\ttype MediaMetadata,\n\ttype MediaOperation,\n\ttype MediaSourceInput,\n\ttype MeshAudioDeformConfig,\n\tProgrammaticSignal,\n\ttype RenderDiagnostic,\n\ttype Signal,\n\ttype VirtualMediaData,\n} from \"@framefields/core\";\nimport {\n\tanalyzeSequence as analyzeVisionFrames,\n\ttype LandmarkCoordinateSignals,\n\ttype MaskTrackSignals,\n\ttype ObjectTrackSignals,\n\ttype PinToLandmarkOptions,\n\ttype PinToObjectOptions,\n\tpinNodeToLandmark,\n\tpinNodeToObject,\n\ttype VisionAnalysisReport,\n\tVisionBundle,\n\tVisionNode,\n\tVisionRunner,\n\ttype VisionTask,\n} from \"@framefields/vision\";\n\nexport {\n\tanalyzeSequence,\n\ttype VisionAnalysisReport,\n} from \"@framefields/vision\";\n\nimport {\n\ttype DeflickerOptions,\n\ttype NormalRelightingOptions,\n\tTensorPipeline,\n} from \"@framefields/tensor-webgpu\";\nimport { inputStore, mediaDecoderCache } from \"@framefields/webgpu-renderers\";\nimport { buildChart, type ChartOptions } from \"./chart.js\";\nimport {\n\tApplyLUT,\n\ttype ApplyLUTProps,\n\tBlur,\n\ttype BlurProps,\n\tColorBalance,\n\ttype ColorBalanceProps,\n\tColorKey,\n\ttype ColorKeyProps,\n\tCrop,\n\ttype CropProps,\n\tCurves,\n\ttype CurvesProps,\n\tCustomEffect,\n\ttype DeflickerProps,\n\tDepthOfField,\n\ttype DepthOfFieldProps,\n\teffectFactories,\n\tFilmGrain,\n\ttype FilmGrainProps,\n\tGradientMap,\n\ttype GradientMapProps,\n\tHalftoneScreen,\n\ttype HalftoneScreenProps,\n\tHighPass,\n\ttype HighPassProps,\n\tLevels,\n\ttype LevelsProps,\n\tModulate,\n\ttype ModulateProps,\n\tMotionBlur,\n\ttype MotionBlurProps,\n\tPBRGlass,\n\ttype PBRGlassProps,\n\tRelight3D,\n\ttype Relight3DProps,\n\tSelectiveColor,\n\ttype SelectiveColorProps,\n\tShadowsHighlights,\n\ttype ShadowsHighlightsProps,\n\tSSAO,\n\ttype SSAOProps,\n\tTemporalDeflicker,\n\tTileOffset,\n\ttype TileOffsetProps,\n\tUnsharpMask,\n\ttype UnsharpMaskProps,\n\tVignette,\n\ttype VignetteProps,\n\tVision,\n\ttype VisionProps,\n} from \"./effects/index.js\";\nimport {\n\ttype FrameGridOptions,\n\tHeadlessMediaRenderer,\n\trenderFrameGrid,\n\ttype VideoQaOptions,\n\ttype VideoQaReport,\n} from \"./renderer/index.js\";\nimport {\n\ttype Carousel3DOptions,\n\ttype Cube3DOptions,\n\tLayer3D,\n\ttype Plane3DOptions,\n\ttype Prism3DOptions,\n} from \"./shapes3d.js\";\nimport {\n\ttype SceneSequenceOptions,\n\ttype SequenceEntry,\n\ttype SequenceNode,\n\tsequence,\n} from \"./transitions.js\";\n\nexport interface SectionOptions {\n\treadonly id?: string;\n\treadonly position?: \"absolute\" | \"relative\";\n\treadonly source?: string | MediaNode;\n\treadonly effects?: unknown[];\n\treadonly padding?: number;\n\treadonly borderRadius?: number;\n\treadonly borderColor?: string;\n\treadonly borderWidth?: number;\n\treadonly opacity?: number | unknown;\n\treadonly blendMode?: string;\n\treadonly fit?: \"cover\" | \"contain\";\n\treadonly width?: number | unknown;\n\treadonly height?: number | unknown;\n\treadonly x?: number | unknown;\n\treadonly y?: number | unknown;\n\treadonly hideWhenLost?: boolean;\n\treadonly smoothFrames?: number;\n\treadonly children?: LayoutNode[];\n\treadonly [key: string]: unknown;\n}\n\nexport type SectionNode = AnimatableNode<BoxNode> & {\n\treadonly innerMedia: AnimatableNode<MediaNode>;\n\t// Any effect, whatever its config shape (Blur, FilmGrain, …).\n\treadonly effects: Effect<object>[];\n\taddEffect(effect: Effect<object>): SectionNode;\n\twithEffect(effect: Effect<object>): SectionNode;\n\twithEffects(effects: Effect<object>[]): SectionNode;\n};\n\nexport type TrackedRegionOptions = SectionOptions;\n\n/** Editing helpers attached to every tracked object (see decorateTrackSignals). */\nexport interface TrackEditing {\n\t/** A section of the source that follows this track */\n\tsection(\n\t\tsourceOrOptions?: string | MediaNode | SectionOptions,\n\t\toptions?: SectionOptions,\n\t): SectionNode;\n\t/** A blur confined to this track's region */\n\tblurEffect(options?: Partial<BlurProps>): Blur;\n\t/** The tracked region of `source`, cut out as a section */\n\tisolate(\n\t\tsource: string | MediaNode,\n\t\toptions?: TrackedRegionOptions,\n\t): SectionNode;\n}\n\n/** A tracked object with its editing helpers, as vision hands it out. */\nexport type EditableObjectTrack = ObjectTrackSignals & TrackEditing;\n\nfunction decorateTrackSignals<T extends ObjectTrackSignals>(\n\ttrack: T,\n\tsource?: string | MediaNode,\n): T {\n\tif (!track) return track;\n\tif (source && !track.source) {\n\t\tObject.defineProperty(track, \"source\", {\n\t\t\tvalue: source,\n\t\t\tenumerable: true,\n\t\t\twritable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\tif (typeof track.section !== \"function\") {\n\t\tObject.defineProperty(track, \"section\", {\n\t\t\tvalue: (\n\t\t\t\tsourceOrOptions?: string | MediaNode | SectionOptions,\n\t\t\t\toptions?: SectionOptions,\n\t\t\t) => {\n\t\t\t\tif (\n\t\t\t\t\ttypeof sourceOrOptions === \"object\" &&\n\t\t\t\t\tsourceOrOptions !== null &&\n\t\t\t\t\t!(\"kind\" in sourceOrOptions) &&\n\t\t\t\t\t!(\"inputHandleId\" in sourceOrOptions) &&\n\t\t\t\t\t!(\"src\" in sourceOrOptions)\n\t\t\t\t) {\n\t\t\t\t\tconst resolvedSource =\n\t\t\t\t\t\t(sourceOrOptions as SectionOptions).source ??\n\t\t\t\t\t\t(track.source as string | MediaNode | undefined) ??\n\t\t\t\t\t\tsource;\n\t\t\t\t\treturn Layer.section(\n\t\t\t\t\t\tresolvedSource as string | MediaNode,\n\t\t\t\t\t\ttrack,\n\t\t\t\t\t\tsourceOrOptions as SectionOptions,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst resolvedSource =\n\t\t\t\t\tsourceOrOptions ??\n\t\t\t\t\t(track.source as string | MediaNode | undefined) ??\n\t\t\t\t\tsource;\n\t\t\t\treturn Layer.section(\n\t\t\t\t\tresolvedSource as string | MediaNode,\n\t\t\t\t\ttrack,\n\t\t\t\t\toptions,\n\t\t\t\t);\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\tif (typeof track.blurEffect !== \"function\") {\n\t\tObject.defineProperty(track, \"blurEffect\", {\n\t\t\tvalue: (options?: Partial<BlurProps>) => new Blur({ track, ...options }),\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\tif (typeof track.isolate !== \"function\") {\n\t\tObject.defineProperty(track, \"isolate\", {\n\t\t\tvalue: (sourceArg: string | MediaNode, options?: TrackedRegionOptions) =>\n\t\t\t\tLayer.section(sourceArg, track, options),\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\treturn track;\n}\n\nconst origVisionAttach = VisionNode.attach;\nVisionNode.attach = function (\n\tsource: Parameters<typeof origVisionAttach>[0],\n\tconfig?: Parameters<typeof origVisionAttach>[1],\n\tbundleOptions?: Parameters<typeof origVisionAttach>[2],\n): ReturnType<typeof origVisionAttach> {\n\tconst bundle = origVisionAttach.call(this, source, config, bundleOptions);\n\tif (bundle?.objects) {\n\t\tconst src = source as string | MediaNode;\n\t\tconst origGet = bundle.objects.get.bind(bundle.objects);\n\t\tbundle.objects.get = (id: number) => decorateTrackSignals(origGet(id), src);\n\n\t\tconst origByCategory = bundle.objects.byCategory.bind(bundle.objects);\n\t\tbundle.objects.byCategory = (cat: string, rank?: number) =>\n\t\t\tdecorateTrackSignals(origByCategory(cat, rank), src);\n\n\t\tif (bundle.objects.primary) {\n\t\t\tdecorateTrackSignals(bundle.objects.primary, src);\n\t\t}\n\t}\n\treturn bundle;\n};\n\nexport {\n\ttype AdvancedTextAnimator,\n\tAdvancedTextAnimatorBuilder,\n\tAdvancedTextAnimatorSchema,\n\t// Text Animations & After Effects Parity\n\ttype AETextAnimator,\n\tAETextAnimatorSchema,\n\ttype AnchorGrouping,\n\tAnchorGroupingSchema,\n\ttype AnchorPreset,\n\tAnchorPresetSchema,\n\ttype AnimatableGlyphProps,\n\tAnimatableGlyphPropsSchema,\n\ttype AnimatableProp,\n\ttype AnimationTrack,\n\ttype ArcLengthLUTEntry,\n\ttype AudioSpectrumTypography,\n\tAudioSpectrumTypographySchema,\n\tapplyStaggerToChildren,\n\ttype BlockNode,\n\ttype BloomConfig,\n\tBloomConfigSchema,\n\ttype BoxNode,\n\tBoxNodeSchema,\n\tbuildPathLUT,\n\tCameraAnimation,\n\ttype CameraDoF,\n\ttype CameraLens,\n\ttype CameraNode,\n\tCameraNodeSchema,\n\ttype CameraShake,\n\ttype CarrierHandoffConfig,\n\tCarrierHandoffConfigSchema,\n\ttype CarrierState,\n\ttype ChromaticGlitchConfig,\n\tChromaticGlitchConfigSchema,\n\ttype ColorSignalOptions,\n\ttype ColorStop,\n\tColorStopSchema,\n\ttype CompositorProgramConfig,\n\tCompositorProgramSchema,\n\ttype CompositorToProgramOptions,\n\ttype CubicBezierSegment,\n\tCubicBezierSegmentSchema,\n\tcalculateSequenceTimeline,\n\tcollectNodeOps,\n\tcompositorToProgram,\n\tcomputeAnchorPivotOffset,\n\tcomputeCarrierContinuity,\n\tcomputeLayout,\n\tcomputeLayoutSync,\n\tcomputeLineLeadingDisplacement,\n\tcomputeRangeSelectorWeight,\n\tcomputeStaggerDelay,\n\ttype DynamicStrokeProperties,\n\tDynamicStrokePropertiesSchema,\n\tdeterministicWigglyNoise,\n\tdistanceToCurveParameter,\n\ttype EaseRef,\n\ttype EnhancedTextNode,\n\tEnhancedTextNodeSchema,\n\ttype EnvironmentFog,\n\tEnvironmentFogSchema,\n\ttype EnvironmentPreset,\n\tEnvironmentPresetSchema,\n\ttype ExpressionEvaluationContext,\n\ttype ExpressionSelector,\n\tExpressionSelectorSchema,\n\ttype ExtendedGlyphProperties,\n\tExtendedGlyphPropertiesSchema,\n\tellipseToCubicBeziers,\n\tevaluateAnimationAtFrame,\n\tevaluateCubicBezier,\n\tevaluateCubicBezierDerivative,\n\tevaluateExpressionSelector,\n\tevaluateMarqueeOffset,\n\tevaluateSelectorCombination,\n\tevaluateSkewMatrix,\n\tevaluateSpringProgress,\n\tevaluateTrackAtFrame,\n\tevaluateTypewriterState,\n\tevaluateVolumetricFormation,\n\ttype FlexNode,\n\tFlexNodeSchema,\n\ttype FromToOptions,\n\ttype GlyphAnchorGrouping,\n\tGlyphAnchorGroupingSchema,\n\ttype GlyphAnchorPoint,\n\tGlyphAnchorPointSchema,\n\tgenerateArcLengthLUT,\n\tgeneratePathSegments,\n\tgetScramblePool,\n\tgetShuffledOrder,\n\thoistMattes,\n\ttype Keyframe,\n\ttype KeyframeTuple,\n\ttype KineticMarqueeConfig,\n\tKineticMarqueeConfigSchema,\n\tLayerAnimation,\n\ttype LayoutNode,\n\tLayoutNodeSchema,\n\ttype LightNode,\n\tLightNodeSchema,\n\ttype LightType,\n\tLightTypeSchema,\n\ttype LineSpacingDynamics,\n\tLineSpacingDynamicsSchema,\n\ttype LongShadowConfig,\n\tLongShadowConfigSchema,\n\tlintComposition,\n\ttype MaterialType,\n\tMaterialTypeSchema,\n\ttype MatteMode,\n\tMatteModeSchema,\n\ttype MediaNode,\n\tMediaNodeSchema,\n\ttype Model3DNode,\n\tModel3DNodeSchema,\n\tmergeAnimationTracks,\n\ttype ParticleDissolveConfig,\n\tParticleDissolveConfigSchema,\n\ttype PathChainLUT,\n\ttype PathChainLUTEntry,\n\tparseSvgPathToCubicBeziers,\n\tScene,\n\ttype SceneDefinition,\n\tSceneDefinitionSchema,\n\ttype SceneOptions,\n\ttype SceneTransitionType,\n\tSceneTransitionTypeSchema,\n\ttype SelectorBasedOn,\n\tSelectorBasedOnSchema,\n\ttype SelectorMode,\n\tSelectorModeSchema,\n\ttype SelectorShape,\n\tSelectorShapeSchema,\n\ttype SelectorUnits,\n\tSelectorUnitsSchema,\n\tSequence,\n\ttype SequenceOptions,\n\ttype SequenceTimelineResult,\n\ttype ShapeNode,\n\tShapeNodeSchema,\n\ttype SignalTrackOptions,\n\ttype SkewProperties,\n\tSkewPropertiesSchema,\n\ttype Spatial3DProperties,\n\tSpatial3DPropertiesSchema,\n\ttype SpringOptions,\n\ttype SpringPhysics,\n\tSpringPhysicsSchema,\n\tsampleAudioSpectrumScale,\n\tsampleCurveGeometry,\n\tsamplePathChainGeometry,\n\ttype TextAnchorConfig,\n\tTextAnchorConfigSchema,\n\tTextAnimator,\n\tTextAnimatorBuilder,\n\tTextAnimatorSchema,\n\ttype TextCursorConfig,\n\tTextCursorConfigSchema,\n\ttype TextCursorStyle,\n\tTextCursorStyleSchema,\n\ttype TextNode,\n\tTextNodeSchema,\n\tTextPathBuilder,\n\ttype TextPathOptions,\n\tTextPathOptionsSchema,\n\ttype TextPathSource,\n\tTextPathSourceSchema,\n\ttype TextRangeSelector,\n\tTextRangeSelectorSchema,\n\ttype TextScrambleConfig,\n\tTextScrambleConfigSchema,\n\ttype TextSelector,\n\tTextSelectorSchema,\n\ttype TextSignalSelector,\n\tTextSignalSelectorSchema,\n\tTextSpanMarkSchema,\n\tTextSpanSchema,\n\ttype TextWigglySelector,\n\tTextWigglySelectorSchema,\n\ttype ToneMapping,\n\tToneMappingSchema,\n\ttype TrackSource,\n\ttype TypewriterAnimator,\n\tTypewriterAnimatorSchema,\n\ttype TypingCadence,\n\tTypingCadenceSchema,\n\ttype VariableFontAxes,\n\tVariableFontAxesSchema,\n\ttype Vec2,\n\tVec2Schema,\n\ttype VolumetricFormationConfig,\n\tVolumetricFormationConfigSchema,\n\ttype VolumetricFormationMode,\n\tVolumetricFormationModeSchema,\n\ttype WiggleOptions,\n\twaveToCubicBeziers,\n} from \"@framefields/compositions/program\";\nexport * from \"@framefields/core\";\nexport * from \"@framefields/renderers\";\nexport {\n\ttype AnimationClip3D,\n\ttype AudioLatentData,\n\tAudioLatentEngine,\n\tAudioLatentTrackCache,\n\tAudioMeshDeformPipeline,\n\ttype BlendMode,\n\ttype Bone3D,\n\tCamera3D,\n\tEffectPipeline,\n\tensureDevice,\n\tGlassPipeline,\n\ttype GPULightData,\n\tinputStore,\n\tLight3D,\n\ttype Light3DOptions,\n\ttype LoadModelOptions,\n\tloadFBX,\n\tloadModel3D,\n\tloadOBJ,\n\tlutStore,\n\ttype Material3D,\n\ttype Mesh3DData,\n\ttype Model3DData,\n\tMotionBlurPipeline,\n\ttype NodeAnimationTrack3D,\n\tPath3D,\n\tparseFBX,\n\tparseMTL,\n\tparseOBJ,\n\ttype RenderContextValue,\n\tRenderer2D,\n\tRenderer3D,\n\tShadowPipeline,\n\ttype Skeleton3D,\n\tSlugFontCache,\n\tSlugPipeline,\n\tSSAOPipeline,\n\tshaderStore,\n\ttextureCache,\n} from \"@framefields/webgpu-renderers\";\nexport {\n\ttype ChartAnimationOptions,\n\ttype ChartAxisOptions,\n\ttype ChartCandle,\n\ttype ChartDatum,\n\ttype ChartOptions,\n\ttype ChartPadding,\n\ttype ChartSeries,\n\ttype ChartSlice,\n\ttype ChartType,\n\ttype ChartX,\n\tDEFAULT_CHART_COLORS,\n} from \"./chart.js\";\nexport {\n\tApplyLUT,\n\ttype ApplyLUTProps,\n\tAudioCompressor,\n\ttype AudioCompressorProps,\n\tAudioDelay,\n\ttype AudioDelayProps,\n\tAudioFade,\n\ttype AudioFadeProps,\n\tAudioNoiseGate,\n\ttype AudioNoiseGateProps,\n\tAudioParametricEq,\n\ttype AudioParametricEqProps,\n\tAudioReverb,\n\ttype AudioReverbProps,\n\tAudioSignalExtractor,\n\ttype AudioSignalExtractorProps,\n\tBlur,\n\ttype BlurProps,\n\tCameraParallax3D,\n\ttype CameraParallax3DProps,\n\tChannelMerger,\n\ttype ChannelMergerProps,\n\tChannelSplitter,\n\ttype ChannelSplitterProps,\n\tColorBalance,\n\ttype ColorBalanceProps,\n\tColorKey,\n\ttype ColorKeyProps,\n\tCornerPin,\n\ttype CornerPinProps,\n\tCrop,\n\ttype CropProps,\n\tCurves,\n\ttype CurvesChannelPoint,\n\ttype CurvesProps,\n\tCustomEffect,\n\ttype DeflickerProps,\n\tDepthOfField,\n\ttype DepthOfFieldProps,\n\tDisplacementMap,\n\ttype DisplacementMapProps,\n\tExtractLUT,\n\ttype ExtractLUTProps,\n\teffectFactories,\n\teffectMeta,\n\tFilmGrain,\n\ttype FilmGrainProps,\n\tFlip,\n\ttype FlipProps,\n\tGradientMap,\n\ttype GradientMapProps,\n\ttype GradientMapStop,\n\ttype HalftoneDotShape,\n\ttype HalftoneMode,\n\tHalftoneScreen,\n\ttype HalftoneScreenProps,\n\tHighPass,\n\ttype HighPassProps,\n\tKenBurns,\n\ttype KenBurnsProps,\n\tLayerStyle,\n\ttype LayerStyleProps,\n\ttype LevelChannel,\n\tLevels,\n\ttype LevelsProps,\n\tLiquify,\n\ttype LiquifyProps,\n\tMaskMath,\n\ttype MaskMathProps,\n\tMeshWarp,\n\ttype MeshWarpProps,\n\tModulate,\n\ttype ModulateProps,\n\tMotionBlur,\n\ttype MotionBlurProps,\n\tNoiseGenerator,\n\ttype NoiseGeneratorProps,\n\tPaint,\n\ttype PaintProps,\n\tPatchHeal,\n\ttype PatchHealProps,\n\tPBRGlass,\n\ttype PBRGlassProps,\n\tProceduralVFX,\n\ttype ProceduralVFXProps,\n\tRefineEdge,\n\ttype RefineEdgeProps,\n\tRefractionCaustics3D,\n\ttype RefractionCaustics3DProps,\n\tRelight3D,\n\ttype Relight3DProps,\n\tResizerScaler,\n\ttype ResizerScalerProps,\n\tRotate,\n\ttype RotateProps,\n\tSelectiveColor,\n\ttype SelectiveColorAdjustment,\n\ttype SelectiveColorProps,\n\tShadowsHighlights,\n\ttype ShadowsHighlightsProps,\n\tSSAO,\n\ttype SSAOProps,\n\tStereoPanning,\n\ttype StereoPanningProps,\n\tTemporalDeflicker,\n\tTileOffset,\n\ttype TileOffsetEdgeMode,\n\ttype TileOffsetProps,\n\tUnsharpMask,\n\ttype UnsharpMaskProps,\n\tVignette,\n\ttype VignetteProps,\n\tVision,\n\ttype VisionProps,\n} from \"./effects/index.js\";\nexport {\n\tLighting,\n\ttype LightingRig,\n\ttype LightingRigOptions,\n} from \"./lighting.js\";\nexport {\n\ttype Carousel3DOptions,\n\ttype Cube3DOptions,\n\ttype CubeFaceConfig,\n\ttype CubeFaceInput,\n\ttype Cylinder3DOptions,\n\ttype ExtrudedText3DOptions,\n\ttype Grid3DOptions,\n\tLayer3D,\n\ttype Plane3DOptions,\n\ttype Primitive3DNodeOptions,\n\ttype Prism3DOptions,\n\ttype RoundedBox3DOptions,\n\ttype Shape3DContainer,\n\ttype Sphere3DOptions,\n\ttype Surface3DOptions,\n\ttype Text3DOptions,\n} from \"./shapes3d.js\";\nexport {\n\ttype SceneSequenceOptions,\n\ttype SequenceEntry,\n\ttype SequenceNode,\n\tTransition,\n\ttype TransitionDirection,\n\ttype TransitionSpec,\n} from \"./transitions.js\";\n\nexport interface CompositionOptions {\n\twidth: number;\n\theight: number;\n\tfps?: number;\n\tdurationMs?: number;\n\tdurationFrames?: number;\n\tbackgroundColor?: string;\n\tfonts?: string[];\n\tsignals?: Record<string, unknown>;\n\t/**\n\t * Smooth the edges of 3D meshes (extruded text, models) with 4x MSAA.\n\t * Default true; set false to save ~60-125 MB of GPU memory at 1080p.\n\t */\n\tantialias3d?: boolean;\n}\n\n/**\n * Fluent builder for single clips and chained visual/audio effect pipelines.\n */\nexport class Media {\n\tpublic readonly virtualMedia: VirtualMediaData;\n\n\tconstructor(source: MediaSourceInput, type: DataType = \"Video\") {\n\t\tthis.virtualMedia = createVirtualMedia(source, type);\n\t}\n\n\tstatic video(source: MediaSourceInput, meta?: Partial<MediaMetadata>): Media {\n\t\tconst m = new Media(source, \"Video\");\n\t\tif (meta) Object.assign(m.virtualMedia.metadata, meta);\n\t\treturn m;\n\t}\n\n\tstatic image(source: MediaSourceInput, meta?: Partial<MediaMetadata>): Media {\n\t\tconst m = new Media(source, \"Image\");\n\t\tif (meta) Object.assign(m.virtualMedia.metadata, meta);\n\t\treturn m;\n\t}\n\n\tstatic lottie(\n\t\tsource: MediaSourceInput,\n\t\tmeta?: Partial<MediaMetadata>,\n\t): Media {\n\t\tconst m = new Media(source, \"Lottie\");\n\t\tif (meta) Object.assign(m.virtualMedia.metadata, meta);\n\t\treturn m;\n\t}\n\n\tstatic audio(source: MediaSourceInput, meta?: Partial<MediaMetadata>): Media {\n\t\tconst m = new Media(source, \"Audio\");\n\t\tif (meta) Object.assign(m.virtualMedia.metadata, meta);\n\t\treturn m;\n\t}\n\n\t/**\n\t * Appends any Effect instance or shader operation onto the current media AST.\n\t */\n\tpublic apply<TProps extends object>(effect: Effect<TProps>): Media;\n\tpublic apply<\n\t\tTConfig extends Record<string, unknown> = Record<string, unknown>,\n\t>(op: string, config?: TConfig): Media;\n\tpublic apply(\n\t\teffectOrOp: Effect<object> | string,\n\t\tconfig: Record<string, unknown> = {},\n\t): Media {\n\t\tlet opPayload: Record<string, unknown>;\n\t\tif (\n\t\t\teffectOrOp instanceof Effect ||\n\t\t\t(typeof effectOrOp === \"object\" &&\n\t\t\t\teffectOrOp !== null &&\n\t\t\t\t\"op\" in effectOrOp)\n\t\t) {\n\t\t\topPayload = (effectOrOp as Effect<object>).toOperation();\n\t\t} else {\n\t\t\topPayload = {\n\t\t\t\top: effectOrOp,\n\t\t\t\t...config,\n\t\t\t};\n\t\t}\n\n\t\tconst nextVM = appendOperation(this.virtualMedia, {\n\t\t\t...opPayload,\n\t\t\tdataType: this.virtualMedia.operation.dataType,\n\t\t} as MediaOperation);\n\t\treturn new Media(nextVM);\n\t}\n\n\t/**\n\t * Returns the underlying VirtualMediaData AST node ready for rendering.\n\t */\n\tpublic toVirtualMedia(): VirtualMediaData {\n\t\treturn this.virtualMedia;\n\t}\n\n\t/**\n\t * Renders a single frame from this media pipeline to a PNG Buffer.\n\t * Can render either by timestamp in milliseconds (`atMs`) or by frame index (`frame`).\n\t */\n\tpublic async renderFrame(\n\t\toptions: {\n\t\t\tatMs?: number;\n\t\t\tframe?: number;\n\t\t\tfps?: number;\n\t\t\trenderer?: HeadlessMediaRenderer;\n\t\t} = {},\n\t): Promise<Buffer> {\n\t\tconst renderer = options.renderer ?? new HeadlessMediaRenderer();\n\t\treturn renderer.renderFrame(this.virtualMedia, options);\n\t}\n\n\tget fps(): number | undefined {\n\t\treturn this.virtualMedia.metadata?.fps ?? undefined;\n\t}\n\n\tget durationMs(): number | undefined {\n\t\treturn this.virtualMedia.metadata?.durationMs ?? undefined;\n\t}\n\n\tget width(): number | undefined {\n\t\treturn this.virtualMedia.metadata?.width ?? undefined;\n\t}\n\n\tget height(): number | undefined {\n\t\treturn this.virtualMedia.metadata?.height ?? undefined;\n\t}\n\n\t/**\n\t * Renders an image grid of sequential frames across a given frame or millisecond range.\n\t * Ideal for automated visual inspection of animation motion, easing curves, and layout stability.\n\t */\n\tpublic async renderFrameGrid(\n\t\toptions: FrameGridOptions = {},\n\t): Promise<Buffer> {\n\t\treturn renderFrameGrid(this, options);\n\t}\n\n\t/**\n\t * Renders this media pipeline into an MP4/WebM video file with audio.\n\t */\n\tpublic async renderVideo(\n\t\toutputPathOrOptions: string | RenderVideoOptions = {},\n\t\toptions: RenderVideoOptions = {},\n\t): Promise<RenderVideoResult> {\n\t\tconst opts =\n\t\t\ttypeof outputPathOrOptions === \"string\"\n\t\t\t\t? { ...options, outputPath: outputPathOrOptions }\n\t\t\t\t: outputPathOrOptions;\n\t\tconst renderer = opts.renderer ?? new HeadlessMediaRenderer();\n\t\tconst result = await renderer.renderVideo(this.virtualMedia, opts);\n\t\treturn deliverToOutputPath(result, opts.outputPath);\n\t}\n}\n\n/**\n * Copies a rendered temp file to `outputPath` and drops the temp, so the\n * returned `filePath` is where the video actually lives.\n */\nasync function deliverToOutputPath(\n\tresult: RenderVideoResult,\n\toutputPath: string | undefined,\n): Promise<RenderVideoResult> {\n\tif (!outputPath) return result;\n\tconst target = path.resolve(outputPath);\n\tawait fs.mkdir(path.dirname(target), { recursive: true });\n\tawait fs.copyFile(result.filePath, target);\n\tawait result.cleanup();\n\treturn { ...result, filePath: target, cleanup: async () => {} };\n}\n\nexport interface RenderVideoOptions {\n\tcodec?: string;\n\taudioCodec?: string;\n\tquality?: string;\n\tconcurrency?: number;\n\t/**\n\t * Depth of the DMA staging ring used to overlap GPU rendering with hardware\n\t * encoding (default 2, clamped 2–8). A deeper ring hides more encoder\n\t * latency at the cost of VRAM (~8.3MB/slot at 1080p RGBA). Also settable\n\t * via `FRAMEFIELDS_RING_CAPACITY`.\n\t */\n\tringCapacity?: number;\n\toutputPath?: string;\n\trenderer?: HeadlessMediaRenderer;\n\t/**\n\t * Check the output while it renders and return the findings as `qa`:\n\t * dropped, black or frozen frames, loudness (LUFS), clipping, silence and\n\t * document warnings such as truncated animations. `true` uses defaults;\n\t * pass thresholds (e.g. `{ targetLufs: -14 }`) to tighten them.\n\t */\n\tqa?: boolean | VideoQaOptions;\n}\n\nexport interface RenderVideoResult {\n\tfilePath: string;\n\tcleanup: () => Promise<void>;\n\t/** Present when rendered with `qa`; print it with `formatQaReport` */\n\tqa?: VideoQaReport;\n}\n\nexport interface SubjectSandwichOptions {\n\treadonly source: string | MediaNode;\n\treadonly subject?: MaskTrackSignals | ObjectTrackSignals;\n\treadonly behind: readonly LayoutNode[];\n\treadonly feather?: number;\n\treadonly fit?: \"cover\" | \"contain\" | \"fill\";\n\treadonly variant?: VisionProps[\"variant\"];\n\treadonly confidence?: number;\n\treadonly keyBackground?: boolean;\n\treadonly backgroundKeyThreshold?: number;\n\treadonly muted?: boolean;\n\treadonly volume?: number;\n}\n\nexport interface SmartFramingOptions {\n\treadonly source: string | MediaNode;\n\treadonly targetAspect?: number;\n\treadonly sourceAspect?: number;\n\treadonly target: ObjectTrackSignals | MaskTrackSignals;\n\treadonly damping?: number;\n\treadonly leadHeadroom?: number;\n\treadonly fit?: \"cover\" | \"contain\" | \"fill\";\n\treadonly variant?: VisionProps[\"variant\"];\n\treadonly muted?: boolean;\n\treadonly volume?: number;\n}\n\nexport interface SubjectOutlineOptions {\n\treadonly source?: string | MediaNode;\n\treadonly color?: string;\n\treadonly width?: number;\n\treadonly blur?: number;\n\treadonly pulseSignal?: ProgrammaticSignal | Signal<number>;\n\treadonly muted?: boolean;\n\treadonly volume?: number;\n}\n\n/**\n * High-level programmatic builder for multi-layer Framefields compositions.\n */\nexport class Composition {\n\tpublic width: number;\n\tpublic height: number;\n\tpublic fps: number;\n\tpublic durationMs?: number;\n\tpublic backgroundColor: string;\n\tpublic antialias3d?: boolean;\n\tpublic fonts: string[];\n\tpublic children: LayoutNode[] = [];\n\tpublic audioTracks: MediaNode[] = [];\n\tpublic signals: Record<string, unknown> = {};\n\tprivate _frameHooks: Array<(ctx: FrameContext) => void> = [];\n\tprivate _visionConfig?: VisionProps;\n\tprivate _visionBundle?: VisionBundle;\n\tprivate _effects: unknown[] = [];\n\n\t/**\n\t * Applies a whole-composition post-processing effect or vision pipeline.\n\t */\n\tpublic apply(effect: unknown): this {\n\t\tif (effect instanceof Vision) {\n\t\t\tthis.withVision(effect);\n\t\t\treturn this;\n\t\t}\n\t\tthis._effects.push(effect);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Runs vision on the whole composition — the rendered frame (composition, blur, crop,\n\t * anything upstream) is the inference input. Models are LAZY: nothing downloads until\n\t * the first frame actually runs a task.\n\t * Returns the reactive VisionBundle (objects / masks / pose / classes signals).\n\t */\n\tpublic withVision(config: VisionProps | Vision = {}): VisionBundle {\n\t\tthis._visionBundle ??= new VisionBundle({\n\t\t\twidth: this.width,\n\t\t\theight: this.height,\n\t\t\tfps: this.fps,\n\t\t});\n\t\tconst rawConfig =\n\t\t\tconfig instanceof Vision ? (config.config as VisionProps) : config;\n\t\tthis._visionConfig = {\n\t\t\t...rawConfig,\n\t\t\tvisionBundle: this._visionBundle,\n\t\t};\n\t\treturn this._visionBundle;\n\t}\n\n\t/**\n\t * One-shot, ffmpeg-free vision analysis of a media source.\n\t *\n\t * Decodes frames through the same mediabunny pipeline the renderer uses, runs the requested\n\t * tasks lazily (only those models download), temporally tracks detections, and returns a\n\t * zod-serializable report. The decoder is released and the runner closed on completion.\n\t */\n\tpublic async analyzeVisionSequence(\n\t\tsource: string,\n\t\toptions: {\n\t\t\ttasks?: readonly VisionTask[];\n\t\t\tcategories?: readonly string[];\n\t\t\tfps?: number;\n\t\t\ttotalFrames?: number;\n\t\t\tpathStride?: number;\n\t\t\tincludeMasks?: boolean;\n\t\t\tmodelsDir?: string;\n\t\t\tbaseUrl?: string;\n\t\t\tconfidence?: number;\n\t\t\tvariant?: VisionProps[\"variant\"];\n\t\t\t/** Tracker box-association IoU. Default 0.25. */\n\t\t\tiouThreshold?: number;\n\t\t} = {},\n\t): Promise<VisionAnalysisReport> {\n\t\tconst fps = options.fps ?? this.fps;\n\t\tconst durationMs = this.durationMs ?? (await this.computeDuration());\n\t\tconst totalFrames =\n\t\t\toptions.totalFrames ?? Math.max(1, Math.round((durationMs / 1000) * fps));\n\n\t\tconst runner = VisionRunner.create({\n\t\t\tmodelsDir: options.modelsDir,\n\t\t\tbaseUrl: options.baseUrl,\n\t\t\t...(options.confidence !== undefined\n\t\t\t\t? { confidence: options.confidence }\n\t\t\t\t: {}),\n\t\t\t...(options.variant !== undefined ? { variant: options.variant } : {}),\n\t\t});\n\n\t\tconst decoder = mediaDecoderCache.getVideo(source, true);\n\t\tasync function* frameSource(): AsyncGenerator<{\n\t\t\tdata: Uint8Array;\n\t\t\twidth: number;\n\t\t\theight: number;\n\t\t}> {\n\t\t\tfor (let i = 0; i < totalFrames; i++) {\n\t\t\t\tconst frame = await decoder.getFrame(i / fps);\n\t\t\t\tif (frame?.buffer && frame.width > 0 && frame.height > 0) {\n\t\t\t\t\tyield {\n\t\t\t\t\t\tdata: frame.buffer,\n\t\t\t\t\t\twidth: frame.width,\n\t\t\t\t\t\theight: frame.height,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\treturn await analyzeVisionFrames(frameSource(), {\n\t\t\t\trunner,\n\t\t\t\tsource,\n\t\t\t\tfps,\n\t\t\t\t...(options.tasks !== undefined ? { tasks: options.tasks } : {}),\n\t\t\t\t...(options.categories !== undefined\n\t\t\t\t\t? { categories: options.categories }\n\t\t\t\t\t: {}),\n\t\t\t\t...(options.pathStride !== undefined\n\t\t\t\t\t? { pathStride: options.pathStride }\n\t\t\t\t\t: {}),\n\t\t\t\t...(options.includeMasks !== undefined\n\t\t\t\t\t? { includeMasks: options.includeMasks }\n\t\t\t\t\t: {}),\n\t\t\t\t...(options.iouThreshold !== undefined\n\t\t\t\t\t? { iouThreshold: options.iouThreshold }\n\t\t\t\t\t: {}),\n\t\t\t});\n\t\t} finally {\n\t\t\trunner.close();\n\t\t\tdecoder.destroy();\n\t\t}\n\t}\n\n\t/**\n\t * Game-engine per-frame lifecycle hook for the composition.\n\t * Invoked before rendering each frame so scripts or agents can mutate properties and signals.\n\t */\n\tpublic onRequestFrame(callback: (ctx: FrameContext) => void): this {\n\t\tthis._frameHooks.push(callback);\n\t\treturn this;\n\t}\n\n\tpublic notifyFrame(ctx: FrameContext): void {\n\t\tfor (const hook of this._frameHooks) {\n\t\t\thook(ctx);\n\t\t}\n\t}\n\n\tconstructor(options: CompositionOptions) {\n\t\tthis.width = options.width;\n\t\tthis.height = options.height;\n\t\tthis.fps = options.fps ?? 60;\n\t\tthis.durationMs =\n\t\t\toptions.durationMs ??\n\t\t\t(options.durationFrames !== undefined\n\t\t\t\t? (options.durationFrames / this.fps) * 1000\n\t\t\t\t: undefined);\n\t\tthis.backgroundColor = options.backgroundColor ?? \"#000000\";\n\t\tthis.antialias3d = options.antialias3d;\n\t\tthis.fonts = options.fonts ?? [];\n\t\tthis.signals = options.signals ?? {};\n\t}\n\n\tpublic static create(options: CompositionOptions): Composition {\n\t\treturn new Composition(options);\n\t}\n\n\tpublic addSignal(name: string, signal: unknown): this {\n\t\tthis.signals[name] = signal;\n\t\treturn this;\n\t}\n\n\tpublic add(\n\t\tlayerOrFirst:\n\t\t\t| LayoutNode\n\t\t\t| LayoutNode[]\n\t\t\t| TensorPipeline\n\t\t\t| VisionNode\n\t\t\t| { node: unknown },\n\t\t...rest: Array<\n\t\t\t| LayoutNode\n\t\t\t| LayoutNode[]\n\t\t\t| TensorPipeline\n\t\t\t| VisionNode\n\t\t\t| { node: unknown }\n\t\t\t| LayerAnimation\n\t\t\t| { tracks: AnimationTrack[] }\n\t\t>\n\t): this {\n\t\tif (layerOrFirst instanceof TensorPipeline) {\n\t\t\tthis.children.push(layerOrFirst.toNode() as unknown as LayoutNode);\n\t\t} else if (layerOrFirst instanceof VisionNode) {\n\t\t\tthis.children.push(layerOrFirst.toNode() as unknown as LayoutNode);\n\t\t} else if (\n\t\t\tlayerOrFirst &&\n\t\t\ttypeof layerOrFirst === \"object\" &&\n\t\t\t\"node\" in layerOrFirst\n\t\t) {\n\t\t\tthis.add(\n\t\t\t\t(\n\t\t\t\t\tlayerOrFirst as {\n\t\t\t\t\t\tnode: LayoutNode | TensorPipeline | { node: unknown };\n\t\t\t\t\t}\n\t\t\t\t).node as LayoutNode,\n\t\t\t\t...rest,\n\t\t\t);\n\t\t\treturn this;\n\t\t} else if (Array.isArray(layerOrFirst)) {\n\t\t\tfor (const l of layerOrFirst) {\n\t\t\t\tthis.add(l);\n\t\t\t}\n\t\t} else {\n\t\t\tconst targetNode = layerOrFirst as LayoutNode;\n\t\t\tconst animCandidate = rest[0];\n\t\t\tif (\n\t\t\t\tanimCandidate &&\n\t\t\t\t!(animCandidate instanceof TensorPipeline) &&\n\t\t\t\t!Array.isArray(animCandidate) &&\n\t\t\t\t(animCandidate instanceof LayerAnimation || \"tracks\" in animCandidate)\n\t\t\t) {\n\t\t\t\ttargetNode.animation =\n\t\t\t\t\tanimCandidate instanceof LayerAnimation\n\t\t\t\t\t\t? animCandidate.toSpec()\n\t\t\t\t\t\t: animCandidate;\n\t\t\t\tthis.children.push(targetNode);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t\tthis.children.push(targetNode);\n\t\t}\n\n\t\tfor (const item of rest) {\n\t\t\tif (item && !(item instanceof LayerAnimation) && !(\"tracks\" in item)) {\n\t\t\t\tthis.add(\n\t\t\t\t\titem as\n\t\t\t\t\t\t| LayoutNode\n\t\t\t\t\t\t| LayoutNode[]\n\t\t\t\t\t\t| TensorPipeline\n\t\t\t\t\t\t| { node: unknown },\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tpublic addAudio(track: MediaNode): this {\n\t\tthis.audioTracks.push(track);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Turnkey \"Text Behind Subject\" (\"Sandwich\") Primitive.\n\t * Lowers into:\n\t * 1. Bottom Layer: Full background video plate\n\t * 2. Middle Layer: User-supplied `behind` nodes\n\t * 3. Top Layer: Subject cutout video with continuous matte alpha registered at identical coordinates\n\t */\n\tpublic addSubjectSandwich(options: SubjectSandwichOptions): this {\n\t\tconst src =\n\t\t\ttypeof options.source === \"string\"\n\t\t\t\t? options.source\n\t\t\t\t: (options.source.inputHandleId ?? \"\");\n\t\tconst fit = options.fit ?? \"cover\";\n\t\tconst feather = options.feather ?? 4;\n\t\tconst featherVal = feather > 1 ? feather / 100 : feather;\n\t\tconst variant = options.variant ?? \"s\";\n\n\t\t// 1. Bottom Layer: Full background video plate\n\t\tconst bottomPlate = Layer.video(src, {\n\t\t\twidth: this.width,\n\t\t\theight: this.height,\n\t\t\tposition: \"absolute\",\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tfit,\n\t\t\tmuted: options.muted ?? false,\n\t\t\tvolume: options.muted ? 0 : (options.volume ?? 1),\n\t\t});\n\t\tthis.add(bottomPlate);\n\n\t\t// 2. Middle Layer: User-supplied `behind` nodes\n\t\tfor (const node of options.behind) {\n\t\t\tthis.add(node);\n\t\t}\n\n\t\t// 3. Top Layer: Subject cutout video with continuous matte alpha registered at identical coordinates\n\t\tconst topPlate = Layer.video(src, {\n\t\t\twidth: this.width,\n\t\t\theight: this.height,\n\t\t\tposition: \"absolute\",\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tfit,\n\t\t\tmuted: true,\n\t\t\tvolume: 0,\n\t\t}).withVision({\n\t\t\tmode: \"matte\",\n\t\t\tenableSegmentation: true,\n\t\t\tvariant,\n\t\t\tconfidence: options.confidence ?? 0.25,\n\t\t\tfeatherRadius: featherVal,\n\t\t\tkeyBackground: options.keyBackground ?? true,\n\t\t\tbackgroundKeyThreshold: options.backgroundKeyThreshold,\n\t\t});\n\t\tthis.add(topPlate);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Dynamic Smart Re-Framing (16:9 → 9:16 Auto-Crop).\n\t * Automatically transforms landscape footage into vertical shorts/reels by framing the\n\t * tracked subject with smooth camera physics and lead headroom.\n\t */\n\tpublic addSmartFraming(options: SmartFramingOptions): this {\n\t\tconst src =\n\t\t\ttypeof options.source === \"string\"\n\t\t\t\t? options.source\n\t\t\t\t: (options.source.inputHandleId ?? \"\");\n\t\tconst damping = Math.max(0, Math.min(0.99, options.damping ?? 0.8));\n\t\tconst headroom = options.leadHeadroom ?? 0.18;\n\t\tconst compW = this.width;\n\t\tconst compH = this.height;\n\n\t\tconst sourceAspect = options.sourceAspect ?? 16 / 9;\n\t\tconst compAspect = compW / compH;\n\n\t\t// Calculate canvas coverage dimensions to avoid black bars during pan\n\t\tconst plateWidth =\n\t\t\tcompAspect < sourceAspect ? Math.round(compH * sourceAspect) : compW;\n\t\tconst plateHeight =\n\t\t\tcompAspect < sourceAspect ? compH : Math.round(compW / sourceAspect);\n\n\t\tconst minOffsetX = compW - plateWidth; // <= 0\n\t\tconst minOffsetY = compH - plateHeight; // <= 0\n\n\t\tconst targetObj = options.target as unknown as {\n\t\t\tcenter?: {\n\t\t\t\tx?: ProgrammaticSignal;\n\t\t\t\ty?: ProgrammaticSignal;\n\t\t\t\tscreenX?: ProgrammaticSignal;\n\t\t\t\tscreenY?: ProgrammaticSignal;\n\t\t\t};\n\t\t\tbounds?: {\n\t\t\t\tx?: ProgrammaticSignal;\n\t\t\t\ty?: ProgrammaticSignal;\n\t\t\t\twidth?: ProgrammaticSignal;\n\t\t\t\theight?: ProgrammaticSignal;\n\t\t\t\tcenterX?: ProgrammaticSignal;\n\t\t\t\tcenterY?: ProgrammaticSignal;\n\t\t\t};\n\t\t};\n\n\t\tconst rawOffsetX = new ProgrammaticSignal(\n\t\t\t(ctx) => {\n\t\t\t\tif (minOffsetX >= 0) return 0;\n\t\t\t\tconst normX = targetObj.center?.x\n\t\t\t\t\t? targetObj.center.x.get(ctx)\n\t\t\t\t\t: targetObj.bounds?.centerX\n\t\t\t\t\t\t? targetObj.bounds.centerX.get(ctx) / compW\n\t\t\t\t\t\t: targetObj.center?.screenX\n\t\t\t\t\t\t\t? targetObj.center.screenX.get(ctx) / compW\n\t\t\t\t\t\t\t: 0.5;\n\t\t\t\tconst clampedNormX = Math.max(0, Math.min(1, normX));\n\t\t\t\tconst targetPx = clampedNormX * plateWidth;\n\t\t\t\tconst desired = compW / 2 - targetPx;\n\t\t\t\treturn Math.max(minOffsetX, Math.min(0, desired));\n\t\t\t},\n\t\t\t{ fps: this.fps, label: \"smart_framing_pan_x\" },\n\t\t);\n\n\t\tconst rawOffsetY = new ProgrammaticSignal(\n\t\t\t(ctx) => {\n\t\t\t\tif (minOffsetY >= 0) return 0;\n\t\t\t\tconst normY = targetObj.center?.y\n\t\t\t\t\t? targetObj.center.y.get(ctx)\n\t\t\t\t\t: targetObj.bounds?.centerY\n\t\t\t\t\t\t? targetObj.bounds.centerY.get(ctx) / compH\n\t\t\t\t\t\t: targetObj.center?.screenY\n\t\t\t\t\t\t\t? targetObj.center.screenY.get(ctx) / compH\n\t\t\t\t\t\t\t: 0.5;\n\t\t\t\tconst clampedNormY = Math.max(0, Math.min(1, normY));\n\t\t\t\tconst targetPy = clampedNormY * plateHeight;\n\t\t\t\tconst desired = compH * headroom - targetPy;\n\t\t\t\treturn Math.max(minOffsetY, Math.min(0, desired));\n\t\t\t},\n\t\t\t{ fps: this.fps, label: \"smart_framing_pan_y\" },\n\t\t);\n\n\t\t// Damped camera smoothing\n\t\tconst smoothOffsetX = new ProgrammaticSignal(\n\t\t\t(ctx) => {\n\t\t\t\tconst targetFrame = ctx.frame;\n\t\t\t\tif (targetFrame <= 0) return rawOffsetX.get(ctx);\n\t\t\t\tlet filtered = rawOffsetX.get({ ...ctx, frame: 0, time: 0 });\n\t\t\t\tconst alpha = 1.0 - damping;\n\t\t\t\tfor (let f = 1; f <= targetFrame; f++) {\n\t\t\t\t\tconst val = rawOffsetX.get({ ...ctx, frame: f, time: f / ctx.fps });\n\t\t\t\t\tfiltered = filtered + alpha * (val - filtered);\n\t\t\t\t}\n\t\t\t\treturn filtered;\n\t\t\t},\n\t\t\t{ fps: this.fps, label: \"smart_framing_smooth_x\" },\n\t\t);\n\n\t\tconst smoothOffsetY = new ProgrammaticSignal(\n\t\t\t(ctx) => {\n\t\t\t\tconst targetFrame = ctx.frame;\n\t\t\t\tif (targetFrame <= 0) return rawOffsetY.get(ctx);\n\t\t\t\tlet filtered = rawOffsetY.get({ ...ctx, frame: 0, time: 0 });\n\t\t\t\tconst alpha = 1.0 - damping;\n\t\t\t\tfor (let f = 1; f <= targetFrame; f++) {\n\t\t\t\t\tconst val = rawOffsetY.get({ ...ctx, frame: f, time: f / ctx.fps });\n\t\t\t\t\tfiltered = filtered + alpha * (val - filtered);\n\t\t\t\t}\n\t\t\t\treturn filtered;\n\t\t\t},\n\t\t\t{ fps: this.fps, label: \"smart_framing_smooth_y\" },\n\t\t);\n\n\t\tconst container = Layer.box({\n\t\t\twidth: compW,\n\t\t\theight: compH,\n\t\t\toverflow: \"hidden\",\n\t\t\tposition: \"relative\",\n\t\t});\n\n\t\tconst videoPlate = Layer.video(src, {\n\t\t\twidth: plateWidth,\n\t\t\theight: plateHeight,\n\t\t\tposition: \"absolute\",\n\t\t\tx: smoothOffsetX as unknown as number,\n\t\t\ty: smoothOffsetY as unknown as number,\n\t\t\tfit: options.fit ?? \"cover\",\n\t\t\tmuted: options.muted ?? false,\n\t\t\tvolume: options.muted ? 0 : (options.volume ?? 1),\n\t\t});\n\n\t\tif (!container.children) {\n\t\t\tcontainer.children = [];\n\t\t}\n\t\tcontainer.children.push(videoPlate);\n\t\tthis.add(container);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Subject Contour Glow & Neon Outline.\n\t * Strokes the silhouette boundary with a stylized bloom/glow and optional audio-reactive pulse.\n\t */\n\tpublic addSubjectOutline(\n\t\t_subject: MaskTrackSignals | ObjectTrackSignals,\n\t\toptions: SubjectOutlineOptions = {},\n\t): this {\n\t\tconst blur = options.blur ?? 12;\n\t\tconst compW = this.width;\n\t\tconst compH = this.height;\n\n\t\tconst pulse = options.pulseSignal;\n\t\tconst baseOpacity = pulse\n\t\t\t? new ProgrammaticSignal(\n\t\t\t\t\t(ctx) => Math.max(0, Math.min(1, Number(pulse.get(ctx)) || 0)),\n\t\t\t\t\t{ fps: this.fps, label: \"outline_pulse\" },\n\t\t\t\t)\n\t\t\t: 1.0;\n\n\t\tconst src =\n\t\t\ttypeof options.source === \"string\"\n\t\t\t\t? options.source\n\t\t\t\t: (options.source?.inputHandleId ?? \"\");\n\n\t\tconst outlineLayer = Layer.box({\n\t\t\twidth: compW,\n\t\t\theight: compH,\n\t\t\tposition: \"absolute\",\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\topacity: baseOpacity as unknown as number,\n\t\t});\n\n\t\tif (src) {\n\t\t\tconst maskVideo = Layer.video(src, {\n\t\t\t\twidth: compW,\n\t\t\t\theight: compH,\n\t\t\t\tposition: \"absolute\",\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t\tfit: \"cover\",\n\t\t\t\tmuted: true,\n\t\t\t\tvolume: 0,\n\t\t\t}).withVision({\n\t\t\t\tmode: \"mask\",\n\t\t\t\tenableSegmentation: true,\n\t\t\t});\n\t\t\tif (!outlineLayer.children) {\n\t\t\t\toutlineLayer.children = [];\n\t\t\t}\n\t\t\toutlineLayer.children.push(maskVideo);\n\t\t}\n\n\t\toutlineLayer.apply(\n\t\t\tnew Blur({\n\t\t\t\tstrength: blur,\n\t\t\t\tblurType: \"Gaussian\",\n\t\t\t}),\n\t\t);\n\n\t\tthis.add(outlineLayer);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates an isolated, styled section of the composition or underlying source plate.\n\t * Any WebGPU effects (Blur, FilmGrain, Curves, Vignette, etc.) can be applied to this section.\n\t */\n\tpublic section(\n\t\tsourceOrTargetOrOptions?:\n\t\t\t| string\n\t\t\t| MediaNode\n\t\t\t| ObjectTrackSignals\n\t\t\t| SectionOptions,\n\t\ttargetOrOptions?: ObjectTrackSignals | SectionOptions,\n\t\toptions?: SectionOptions,\n\t): SectionNode {\n\t\tlet source: string | MediaNode | undefined;\n\t\tlet target: ObjectTrackSignals | undefined;\n\t\tlet opts: SectionOptions = {};\n\n\t\tconst isFirstTrack =\n\t\t\tsourceOrTargetOrOptions !== null &&\n\t\t\ttypeof sourceOrTargetOrOptions === \"object\" &&\n\t\t\t\"bounds\" in sourceOrTargetOrOptions;\n\n\t\tconst isFirstMedia =\n\t\t\ttypeof sourceOrTargetOrOptions === \"string\" ||\n\t\t\t(sourceOrTargetOrOptions !== null &&\n\t\t\t\ttypeof sourceOrTargetOrOptions === \"object\" &&\n\t\t\t\t(\"kind\" in sourceOrTargetOrOptions ||\n\t\t\t\t\t\"src\" in sourceOrTargetOrOptions ||\n\t\t\t\t\t\"inputHandleId\" in sourceOrTargetOrOptions));\n\n\t\tif (\n\t\t\tisFirstMedia &&\n\t\t\ttargetOrOptions &&\n\t\t\ttypeof targetOrOptions === \"object\" &&\n\t\t\t\"bounds\" in targetOrOptions\n\t\t) {\n\t\t\tsource = sourceOrTargetOrOptions as string | MediaNode;\n\t\t\ttarget = targetOrOptions as ObjectTrackSignals;\n\t\t\topts = options ?? {};\n\t\t} else if (isFirstMedia && targetOrOptions) {\n\t\t\tsource = sourceOrTargetOrOptions as string | MediaNode;\n\t\t\topts = targetOrOptions as SectionOptions;\n\t\t} else if (isFirstTrack) {\n\t\t\ttarget = sourceOrTargetOrOptions as ObjectTrackSignals;\n\t\t\topts = (targetOrOptions as SectionOptions) ?? {};\n\t\t\tsource = opts.source ?? (target.source as string | MediaNode | undefined);\n\t\t} else if (\n\t\t\tsourceOrTargetOrOptions &&\n\t\t\ttypeof sourceOrTargetOrOptions === \"object\"\n\t\t) {\n\t\t\topts = sourceOrTargetOrOptions as SectionOptions;\n\t\t\tsource = opts.source;\n\t\t}\n\n\t\tif (!source) {\n\t\t\tconst mediaChild = this.children.find(\n\t\t\t\t(c) =>\n\t\t\t\t\tc.kind === \"media\" &&\n\t\t\t\t\t(c.dataType === \"Video\" || c.dataType === \"Image\"),\n\t\t\t) as MediaNode | undefined;\n\t\t\tif (mediaChild) {\n\t\t\t\tsource = mediaChild;\n\t\t\t}\n\t\t}\n\n\t\treturn Layer.section(source ?? \"\", target ?? opts, {\n\t\t\tcompositionWidth: this.width,\n\t\t\tcompositionHeight: this.height,\n\t\t\t...opts,\n\t\t});\n\t}\n\n\t/**\n\t * Creates a section and immediately adds it to the composition layout tree.\n\t */\n\tpublic addSection(\n\t\tsourceOrTargetOrOptions?:\n\t\t\t| string\n\t\t\t| MediaNode\n\t\t\t| ObjectTrackSignals\n\t\t\t| SectionOptions,\n\t\ttargetOrOptions?: ObjectTrackSignals | SectionOptions,\n\t\toptions?: SectionOptions,\n\t): SectionNode {\n\t\tconst node = this.section(\n\t\t\tsourceOrTargetOrOptions,\n\t\t\ttargetOrOptions,\n\t\t\toptions,\n\t\t);\n\t\tthis.add(node);\n\t\treturn node;\n\t}\n\n\t/**\n\t * Dynamically calculates composition duration from the longest media or animation layer.\n\t */\n\tpublic async computeDuration(): Promise<number> {\n\t\tif (this.durationMs !== undefined) return this.durationMs;\n\t\tlet maxDurationMs = 0;\n\t\tconst mediaSources: string[] = [];\n\n\t\tfor (const node of [...this.children, ...this.audioTracks]) {\n\t\t\tif (node.kind === \"media\") {\n\t\t\t\tconst src = node.inputHandleId;\n\t\t\t\tif (\n\t\t\t\t\ttypeof src === \"string\" &&\n\t\t\t\t\t(node.dataType === \"Video\" || node.dataType === \"Audio\")\n\t\t\t\t) {\n\t\t\t\t\tmediaSources.push(src);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (typeof node.durationFrames === \"number\") {\n\t\t\t\tconst start = typeof node.startFrame === \"number\" ? node.startFrame : 0;\n\t\t\t\tconst durMs = ((start + node.durationFrames) / this.fps) * 1000;\n\t\t\t\tif (durMs > maxDurationMs) maxDurationMs = durMs;\n\t\t\t}\n\t\t}\n\n\t\tfor (const src of mediaSources) {\n\t\t\ttry {\n\t\t\t\tconst input = await inputStore.acquire(src);\n\t\t\t\tconst sec = await input.computeDuration();\n\t\t\t\tif (Number.isFinite(sec) && sec > 0) {\n\t\t\t\t\tconst ms = Math.round(sec * 1000);\n\t\t\t\t\tif (ms > maxDurationMs) maxDurationMs = ms;\n\t\t\t\t}\n\t\t\t} catch (_) {}\n\t\t}\n\n\t\treturn maxDurationMs > 0 ? maxDurationMs : 5000;\n\t}\n\n\tpublic async registerFont(\n\t\toptionsOrFamilyOrSource: RegisterFontOptions | string,\n\t\tsource?: string | Uint8Array,\n\t): Promise<this> {\n\t\tconst reg = await FontManager.register(optionsOrFamilyOrSource, source);\n\t\tif (reg.filePath && !this.fonts.includes(reg.filePath)) {\n\t\t\tthis.fonts.push(reg.filePath);\n\t\t}\n\t\treturn this;\n\t}\n\n\t/** Sets the color emoji font; see {@link FontManager.registerEmojiFont}. */\n\tpublic async registerEmojiFont(source: string | Uint8Array): Promise<this> {\n\t\tawait FontManager.registerEmojiFont(source);\n\t\treturn this;\n\t}\n\n\tpublic toSpec(): CompositorProgramConfig {\n\t\tconst layoutItems: LayoutNode[] = [...this.children, ...this.audioTracks];\n\t\tconst registeredPaths = FontManager.getRegisteredFontPaths();\n\t\tconst mergedFonts = Array.from(\n\t\t\tnew Set([...this.fonts, ...registeredPaths]),\n\t\t);\n\t\treturn {\n\t\t\twidth: this.width,\n\t\t\theight: this.height,\n\t\t\tfps: this.fps,\n\t\t\tmode: \"Video\",\n\t\t\tbackgroundColor: this.backgroundColor,\n\t\t\t...(this.antialias3d !== undefined && { antialias3d: this.antialias3d }),\n\t\t\tlayout: layoutItems,\n\t\t\tfonts: mergedFonts,\n\t\t\tsignals: this.signals,\n\t\t\t...(this._effects.length > 0 && { effects: this._effects }),\n\t\t\t...(this._visionConfig && { vision: this._visionConfig }),\n\t\t\t...(this._frameHooks.length > 0 && {\n\t\t\t\tonRequestFrame: (ctx: FrameContext) => this.notifyFrame(ctx),\n\t\t\t}),\n\t\t} as unknown as CompositorProgramConfig;\n\t}\n\n\t/**\n\t * Compiles the composition into a VirtualMediaData AST ready for WebGPU rendering.\n\t */\n\tpublic toVirtualMedia(\n\t\toptions: Partial<CompositorToProgramOptions> = {},\n\t): VirtualMediaData {\n\t\treturn compositorToProgram(this.toSpec(), {\n\t\t\tisVideoMode: true,\n\t\t\tfps: this.fps,\n\t\t\tdurationMs: options.durationMs ?? this.durationMs,\n\t\t\tsignals: options.signals ?? this.signals,\n\t\t\t...(this._effects.length > 0 && { effects: this._effects }),\n\t\t\t...(this._visionConfig && { vision: this._visionConfig }),\n\t\t\t...options,\n\t\t});\n\t}\n\n\t/**\n\t * Compiles the composition into a VirtualMediaData AST with dynamically resolved duration.\n\t */\n\tpublic async toVirtualMediaAsync(\n\t\toptions: Partial<CompositorToProgramOptions> = {},\n\t): Promise<VirtualMediaData> {\n\t\tconst durationMs =\n\t\t\toptions.durationMs ?? this.durationMs ?? (await this.computeDuration());\n\t\tthis.durationMs = durationMs;\n\t\treturn compositorToProgram(this.toSpec(), {\n\t\t\tisVideoMode: true,\n\t\t\tfps: this.fps,\n\t\t\tdurationMs,\n\t\t\tsignals: options.signals ?? this.signals,\n\t\t\t...(this._effects.length > 0 && { effects: this._effects }),\n\t\t\t...(this._visionConfig && { vision: this._visionConfig }),\n\t\t\t...options,\n\t\t});\n\t}\n\n\t/**\n\t * Renders a single frame from the composition to a PNG Buffer.\n\t * Can render either by timestamp in milliseconds (`atMs`) or by frame index (`frame`).\n\t */\n\tpublic async renderFrame(\n\t\toptions: {\n\t\t\tatMs?: number;\n\t\t\tframe?: number;\n\t\t\trenderer?: HeadlessMediaRenderer;\n\t\t} = {},\n\t): Promise<Buffer> {\n\t\tif (this._frameHooks.length > 0) {\n\t\t\tconst targetFrame =\n\t\t\t\toptions.frame ??\n\t\t\t\t(options.atMs !== undefined\n\t\t\t\t\t? Math.round((options.atMs / 1000) * this.fps)\n\t\t\t\t\t: 0);\n\t\t\tthis.notifyFrame({\n\t\t\t\tframe: targetFrame,\n\t\t\t\tfps: this.fps,\n\t\t\t\ttime: this.fps > 0 ? targetFrame / this.fps : 0,\n\t\t\t\tduration: (this.durationMs ?? 0) / 1000,\n\t\t\t\tdurationMs: this.durationMs ?? 0,\n\t\t\t\tprogress:\n\t\t\t\t\tthis.durationMs && this.durationMs > 0\n\t\t\t\t\t\t? Math.max(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tMath.min(\n\t\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\t\t((targetFrame / this.fps) * 1000) / this.durationMs,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: 0,\n\t\t\t\tdeltaTime: this.fps > 0 ? 1 / this.fps : 0,\n\t\t\t});\n\t\t}\n\t\tconst renderer = options.renderer ?? new HeadlessMediaRenderer();\n\t\treturn renderer.renderFrame(this.toVirtualMedia(), {\n\t\t\tfps: this.fps,\n\t\t\t...options,\n\t\t});\n\t}\n\n\t/**\n\t * Renders an image grid of sequential frames across a given frame or millisecond range.\n\t * Ideal for automated visual inspection of animation motion, easing curves, and layout stability.\n\t */\n\tpublic async renderFrameGrid(\n\t\toptions: FrameGridOptions = {},\n\t): Promise<Buffer> {\n\t\treturn renderFrameGrid(this, options);\n\t}\n\n\t/**\n\t * Renders this composition into an MP4/WebM video file with audio.\n\t */\n\tpublic async renderVideo(\n\t\toutputPathOrOptions: string | RenderVideoOptions = {},\n\t\toptions: RenderVideoOptions = {},\n\t): Promise<RenderVideoResult> {\n\t\tconst opts =\n\t\t\ttypeof outputPathOrOptions === \"string\"\n\t\t\t\t? { ...options, outputPath: outputPathOrOptions }\n\t\t\t\t: outputPathOrOptions;\n\t\tconst renderer = opts.renderer ?? new HeadlessMediaRenderer();\n\t\tconst result = await renderer.renderVideo(this.toVirtualMedia(), opts);\n\t\tif (result.qa) {\n\t\t\t// Fold the document checks into the output checks.\n\t\t\tconst lint = this.lint();\n\t\t\tconst issues = [\n\t\t\t\t...result.qa.issues,\n\t\t\t\t...lint.map((d) => ({\n\t\t\t\t\tseverity: d.severity,\n\t\t\t\t\tcode: d.code,\n\t\t\t\t\tmessage: d.message,\n\t\t\t\t\t...(d.layerId !== undefined && { layerId: d.layerId }),\n\t\t\t\t})),\n\t\t\t];\n\t\t\tresult.qa = {\n\t\t\t\t...result.qa,\n\t\t\t\tissues,\n\t\t\t\t// Lint warnings advise; only a lint error fails the render.\n\t\t\t\tpassed: result.qa.passed && !lint.some((d) => d.severity === \"error\"),\n\t\t\t};\n\t\t}\n\t\treturn deliverToOutputPath(result, opts.outputPath);\n\t}\n\n\t/**\n\t * Checks the document for things that render without error but not as\n\t * intended: unreadable colors or gradients (drawn transparent),\n\t * low-contrast text, layers parked off-canvas, shadows on lights that\n\t * cannot cast them, physical materials without an environment, tracks that\n\t * never change. `renderVideo({ qa })` includes these automatically.\n\t */\n\tpublic lint(): RenderDiagnostic[] {\n\t\treturn lintComposition(this.toSpec());\n\t}\n}\n\n/**\n * Layer helpers for constructing composition nodes with clean URL/path strings.\n */\n\nexport type AnimatableNode<T extends LayoutNode> = T & {\n\tglass?: Record<string, unknown>;\n\taudioDeform?: MeshAudioDeformConfig | Record<string, unknown>;\n\tcrop?: CropProps | Crop;\n\tvision?: Vision;\n\trelighting?: NormalRelightingOptions;\n\tdeflicker?: DeflickerOptions;\n\teffects?: unknown[];\n\tblurRegions?: unknown[];\n\t[key: string]: unknown;\n\tanimate(\n\t\t...anim: (\n\t\t\t| LayerAnimation\n\t\t\t| { tracks: AnimationTrack[] }\n\t\t\t| LayerAnimation[]\n\t\t)[]\n\t): AnimatableNode<T>;\n\tpinToLandmark(\n\t\ttarget:\n\t\t\t| LandmarkCoordinateSignals\n\t\t\t| {\n\t\t\t\t\tx: number;\n\t\t\t\t\ty: number;\n\t\t\t\t\tz?: number;\n\t\t\t\t\tscreenX?: number;\n\t\t\t\t\tscreenY?: number;\n\t\t\t },\n\t\toptions?: PinToLandmarkOptions,\n\t): AnimatableNode<T>;\n\tpinToObject(\n\t\ttarget:\n\t\t\t| ObjectTrackSignals\n\t\t\t| LandmarkCoordinateSignals\n\t\t\t| {\n\t\t\t\t\tx: number;\n\t\t\t\t\ty: number;\n\t\t\t\t\tz?: number;\n\t\t\t\t\tscreenX?: number;\n\t\t\t\t\tscreenY?: number;\n\t\t\t },\n\t\toptions?: PinToObjectOptions,\n\t): AnimatableNode<T>;\n\t/**\n\t * Track matte: `matte` (any layer) masks this one by its alpha or\n\t * brightness. It is laid out like a sibling (same parent) and timed with\n\t * this node; with no x/y/width/height it covers this node's box. Animate\n\t * the matte for wipes and reveals: text through a sliding box, video\n\t * inside type, an iris circle.\n\t */\n\twithMatte(matte: LayoutNode, mode?: MatteMode): AnimatableNode<T>;\n\t/** Alias of {@link withMatte}. */\n\twithMask(mask: LayoutNode, mode?: MatteMode): AnimatableNode<T>;\n\twithPbrGlass(options?: Record<string, unknown>): AnimatableNode<T>;\n\tdeformWithAudio(\n\t\tconfig?: MeshAudioDeformConfig | Record<string, unknown>,\n\t): AnimatableNode<T>;\n\twithCrop(cropConfig: CropProps | Crop): AnimatableNode<T>;\n\t/** Runs vision on this node's rendered output (see `Vision` for options and modes). */\n\twithVision(config?: VisionProps | Vision): AnimatableNode<T>;\n\twithRelighting(options?: NormalRelightingOptions): AnimatableNode<T>;\n\trelight(options?: NormalRelightingOptions): AnimatableNode<T>;\n\twithDeflicker(options?: DeflickerOptions): AnimatableNode<T>;\n\tapply(effect: unknown): AnimatableNode<T>;\n\twithEffect(effect: unknown): AnimatableNode<T>;\n\twithEffects(effects: unknown[]): AnimatableNode<T>;\n\tblurRegion(\n\t\ttrackTarget: ObjectTrackSignals,\n\t\toptions?: Partial<BlurProps>,\n\t): AnimatableNode<T>;\n\twithBlurRegion(\n\t\ttrackTarget: ObjectTrackSignals,\n\t\toptions?: Partial<BlurProps>,\n\t): AnimatableNode<T>;\n};\n\nfunction withAnimation<T extends LayoutNode>(node: T): AnimatableNode<T> {\n\tconst target = node as AnimatableNode<T>;\n\tObject.defineProperty(target, \"animate\", {\n\t\tvalue: (\n\t\t\t...anims: (\n\t\t\t\t| LayerAnimation\n\t\t\t\t| { tracks: AnimationTrack[] }\n\t\t\t\t| LayerAnimation[]\n\t\t\t)[]\n\t\t) => {\n\t\t\t// Every call layers onto what is already there: keyframe tracks on\n\t\t\t// the same prop merge (a later key wins on a shared frame).\n\t\t\tconst incoming = anims\n\t\t\t\t.flat()\n\t\t\t\t.flatMap((a) =>\n\t\t\t\t\ta instanceof LayerAnimation\n\t\t\t\t\t\t? a.tracks\n\t\t\t\t\t\t: ((a as { tracks?: AnimationTrack[] }).tracks ?? []),\n\t\t\t\t);\n\t\t\tconst existing =\n\t\t\t\t(target.animation as { tracks?: AnimationTrack[] } | undefined)\n\t\t\t\t\t?.tracks ?? [];\n\t\t\ttarget.animation = {\n\t\t\t\ttracks: mergeAnimationTracks([...existing, ...incoming]),\n\t\t\t};\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"pinToLandmark\", {\n\t\tvalue: (\n\t\t\tlandmarkTarget:\n\t\t\t\t| LandmarkCoordinateSignals\n\t\t\t\t| {\n\t\t\t\t\t\tx: number;\n\t\t\t\t\t\ty: number;\n\t\t\t\t\t\tz?: number;\n\t\t\t\t\t\tscreenX?: number;\n\t\t\t\t\t\tscreenY?: number;\n\t\t\t\t },\n\t\t\toptions?: PinToLandmarkOptions,\n\t\t) => {\n\t\t\tpinNodeToLandmark(\n\t\t\t\ttarget as unknown as { x?: unknown; y?: unknown; z?: unknown },\n\t\t\t\tlandmarkTarget,\n\t\t\t\toptions,\n\t\t\t);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"pinToObject\", {\n\t\tvalue: (\n\t\t\tobjectTarget:\n\t\t\t\t| ObjectTrackSignals\n\t\t\t\t| LandmarkCoordinateSignals\n\t\t\t\t| {\n\t\t\t\t\t\tx: number;\n\t\t\t\t\t\ty: number;\n\t\t\t\t\t\tz?: number;\n\t\t\t\t\t\tscreenX?: number;\n\t\t\t\t\t\tscreenY?: number;\n\t\t\t\t },\n\t\t\toptions?: PinToObjectOptions,\n\t\t) => {\n\t\t\tpinNodeToObject(\n\t\t\t\ttarget as unknown as {\n\t\t\t\t\tx?: unknown;\n\t\t\t\t\ty?: unknown;\n\t\t\t\t\tz?: unknown;\n\t\t\t\t\twidth?: unknown;\n\t\t\t\t\theight?: unknown;\n\t\t\t\t\topacity?: unknown;\n\t\t\t\t},\n\t\t\t\tobjectTarget,\n\t\t\t\toptions,\n\t\t\t);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tconst withMatte = (matte: LayoutNode, mode?: MatteMode) => {\n\t\ttarget.matte = { node: matte, ...(mode && { mode }) };\n\t\treturn target;\n\t};\n\tfor (const name of [\"withMatte\", \"withMask\"]) {\n\t\tObject.defineProperty(target, name, {\n\t\t\tvalue: withMatte,\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\n\tObject.defineProperty(target, \"withPbrGlass\", {\n\t\tvalue: (options?: Record<string, unknown>) => {\n\t\t\ttarget.glass = options ?? {};\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"deformWithAudio\", {\n\t\tvalue: (config?: MeshAudioDeformConfig | Record<string, unknown>) => {\n\t\t\ttarget.audioDeform = config ?? {};\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"withCrop\", {\n\t\tvalue: (cropConfig: CropProps | Crop) => {\n\t\t\ttarget.crop =\n\t\t\t\tcropConfig instanceof Crop ? cropConfig : new Crop(cropConfig);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"withVision\", {\n\t\tvalue: (config?: VisionProps | Vision) => {\n\t\t\ttarget.vision = config instanceof Vision ? config : new Vision(config);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"withRelighting\", {\n\t\tvalue: (options?: NormalRelightingOptions) => {\n\t\t\ttarget.relighting = options ?? {};\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"relight\", {\n\t\tvalue: (options?: NormalRelightingOptions) => {\n\t\t\ttarget.relighting = options ?? {};\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"withDeflicker\", {\n\t\tvalue: (options?: DeflickerOptions) => {\n\t\t\ttarget.deflicker = options ?? {};\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"apply\", {\n\t\tvalue: (effect: unknown) => {\n\t\t\tif (!target.effects) {\n\t\t\t\ttarget.effects = [];\n\t\t\t}\n\t\t\ttarget.effects.push(effect);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"withEffect\", {\n\t\tvalue: (effect: unknown) => {\n\t\t\tif (!target.effects) {\n\t\t\t\ttarget.effects = [];\n\t\t\t}\n\t\t\ttarget.effects.push(effect);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"withEffects\", {\n\t\tvalue: (effects: unknown[]) => {\n\t\t\tif (!target.effects) {\n\t\t\t\ttarget.effects = [];\n\t\t\t}\n\t\t\ttarget.effects.push(...effects);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"section\", {\n\t\tvalue: (\n\t\t\ttargetOrOptions: ObjectTrackSignals | SectionOptions = {},\n\t\t\toptions?: SectionOptions,\n\t\t) => {\n\t\t\tif (\n\t\t\t\ttargetOrOptions !== null &&\n\t\t\t\ttypeof targetOrOptions === \"object\" &&\n\t\t\t\t\"bounds\" in targetOrOptions\n\t\t\t) {\n\t\t\t\treturn Layer.section(\n\t\t\t\t\ttarget as MediaNode,\n\t\t\t\t\ttargetOrOptions as ObjectTrackSignals,\n\t\t\t\t\toptions,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn Layer.section(\n\t\t\t\ttarget as MediaNode,\n\t\t\t\ttargetOrOptions as SectionOptions,\n\t\t\t);\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"blurRegion\", {\n\t\tvalue: (trackTarget: ObjectTrackSignals, options?: Partial<BlurProps>) => {\n\t\t\tconst blur = new Blur({\n\t\t\t\ttrack: trackTarget,\n\t\t\t\tstrength: options?.strength ?? 25,\n\t\t\t\tshape: options?.shape ?? \"ellipse\",\n\t\t\t\t...options,\n\t\t\t});\n\t\t\tif (!target.effects) {\n\t\t\t\ttarget.effects = [];\n\t\t\t}\n\t\t\ttarget.effects.push(blur);\n\t\t\treturn target;\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\tObject.defineProperty(target, \"withBlurRegion\", {\n\t\tvalue: (trackTarget: ObjectTrackSignals, options?: Partial<BlurProps>) => {\n\t\t\treturn (\n\t\t\t\ttarget as {\n\t\t\t\t\tblurRegion: (\n\t\t\t\t\t\tt: ObjectTrackSignals,\n\t\t\t\t\t\to?: Partial<BlurProps>,\n\t\t\t\t\t) => unknown;\n\t\t\t\t}\n\t\t\t).blurRegion(trackTarget, options);\n\t\t},\n\t\tenumerable: false,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t});\n\n\treturn target;\n}\n\nexport const Layer = {\n\tvideo: (\n\t\tsrc: string,\n\t\toptions: Partial<MediaNode> = {},\n\t): AnimatableNode<MediaNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"video\"),\n\t\t\tkind: \"media\",\n\t\t\tinputHandleId: src,\n\t\t\tdataType: \"Video\",\n\t\t\tfit: options.fit ?? \"cover\",\n\t\t\t...options,\n\t\t}),\n\timage: (\n\t\tsrc: string,\n\t\toptions: Partial<MediaNode> = {},\n\t): AnimatableNode<MediaNode> => {\n\t\tif (typeof src === \"string\") {\n\t\t\tif (\n\t\t\t\t/\\.(json|lottie)(\\?.*)?$/i.test(src) ||\n\t\t\t\tsrc.startsWith(\"data:application/json\")\n\t\t\t) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[Layer.image] '${src}' is a Lottie vector animation, not a static image. Use Layer.lottie('${src}', options) instead.`,\n\t\t\t\t);\n\t\t\t} else if (/\\.(mp4|mov|webm|mkv)(\\?.*)?$/i.test(src)) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[Layer.image] '${src}' is a video file, not a static image. Use Layer.video('${src}', options) instead.`,\n\t\t\t\t);\n\t\t\t} else if (/\\.(mp3|wav|ogg|m4a|aac)(\\?.*)?$/i.test(src)) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[Layer.image] '${src}' is an audio file, not a static image. Use Layer.audio('${src}', options) instead.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn withAnimation({\n\t\t\tid: options.id ?? autoId(\"img\"),\n\t\t\tkind: \"media\",\n\t\t\tinputHandleId: src,\n\t\t\tdataType: \"Image\",\n\t\t\tfit: options.fit ?? \"cover\",\n\t\t\t...options,\n\t\t});\n\t},\n\tsvg: (\n\t\tsrc: string,\n\t\toptions: Partial<MediaNode> = {},\n\t): AnimatableNode<MediaNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"svg\"),\n\t\t\tkind: \"media\",\n\t\t\tinputHandleId: src,\n\t\t\tdataType: \"SVG\",\n\t\t\tfit: options.fit ?? \"contain\",\n\t\t\t...options,\n\t\t}),\n\tlottie: (\n\t\tsrc: string,\n\t\toptions: Partial<MediaNode> = {},\n\t): AnimatableNode<MediaNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"lottie\"),\n\t\t\tkind: \"media\",\n\t\t\tinputHandleId: src,\n\t\t\tdataType: \"Lottie\",\n\t\t\tfit: options.fit ?? \"contain\",\n\t\t\t...options,\n\t\t}),\n\taudio: (\n\t\tsrc: string,\n\t\toptions: Partial<MediaNode> = {},\n\t): AnimatableNode<MediaNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"audio\"),\n\t\t\tkind: \"media\",\n\t\t\tinputHandleId: src,\n\t\t\tdataType: \"Audio\",\n\t\t\tvolume: options.volume ?? 1,\n\t\t\t...options,\n\t\t}),\n\ttext: (\n\t\tcontentOrOptions:\n\t\t\t| string\n\t\t\t| TextSpan[]\n\t\t\t| (string | TextSpan)[]\n\t\t\t| Partial<TextNode>,\n\t\tmaybeOptions: Partial<TextNode> = {},\n\t): AnimatableNode<TextNode> => {\n\t\tconst isArray = Array.isArray(contentOrOptions);\n\t\tconst isObj =\n\t\t\t!isArray &&\n\t\t\ttypeof contentOrOptions === \"object\" &&\n\t\t\tcontentOrOptions !== null;\n\t\tconst options = isObj\n\t\t\t? (contentOrOptions as Partial<TextNode>)\n\t\t\t: maybeOptions;\n\n\t\tlet textContent = \"\";\n\t\tlet spans: TextSpan[] | undefined = options.spans;\n\n\t\tif (isArray) {\n\t\t\tconst normalized = normalizeTextSpans(\n\t\t\t\tcontentOrOptions as (string | TextSpan)[],\n\t\t\t);\n\t\t\ttextContent = normalized.text;\n\t\t\tspans = normalized.spans;\n\t\t} else if (isObj) {\n\t\t\tif (options.spans && !options.text) {\n\t\t\t\tconst normalized = normalizeTextSpans(options.spans);\n\t\t\t\ttextContent = normalized.text;\n\t\t\t} else {\n\t\t\t\ttextContent = (options.text as string) ?? \"\";\n\t\t\t}\n\t\t} else {\n\t\t\ttextContent =\n\t\t\t\ttypeof contentOrOptions === \"string\"\n\t\t\t\t\t? contentOrOptions\n\t\t\t\t\t: String(contentOrOptions ?? \"\");\n\t\t}\n\n\t\treturn withAnimation({\n\t\t\tid: options.id ?? autoId(\"text\"),\n\t\t\tkind: \"text\",\n\t\t\tfontFamily:\n\t\t\t\toptions.fontFamily ?? FontManager.getAll()[0]?.family ?? \"Inter\",\n\t\t\tfontSize: options.fontSize ?? 48,\n\t\t\tfill: options.fill ?? \"#ffffff\",\n\t\t\t...options,\n\t\t\ttext: options.text ?? textContent,\n\t\t\tspans: options.spans ?? spans,\n\t\t});\n\t},\n\tcaption: (\n\t\tsrc: string,\n\t\toptions: Partial<MediaNode> = {},\n\t): AnimatableNode<MediaNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"caption\"),\n\t\t\tkind: \"media\",\n\t\t\tinputHandleId: src,\n\t\t\tdataType: options.dataType ?? \"Caption\",\n\t\t\tfontFamily:\n\t\t\t\toptions.fontFamily ?? FontManager.getAll()[0]?.family ?? \"Inter\",\n\t\t\tfontSize: options.fontSize ?? 48,\n\t\t\tfill: options.fill ?? \"#ffffff\",\n\t\t\t...options,\n\t\t}),\n\tshape: (\n\t\tshapeType:\n\t\t\t| \"rect\"\n\t\t\t| \"circle\"\n\t\t\t| \"ellipse\"\n\t\t\t| \"polygon\"\n\t\t\t| \"star\"\n\t\t\t| \"arrow\"\n\t\t\t| \"path\" = \"rect\",\n\t\toptions: Partial<ShapeNode> & {\n\t\t\t/** Alias of `fillColor`: a color or a CSS gradient string. */\n\t\t\tfill?: string;\n\t\t} = {},\n\t): AnimatableNode<ShapeNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"shape\"),\n\t\t\tkind: \"shape\",\n\t\t\tshapeType: options.shapeType ?? shapeType,\n\t\t\t...options,\n\t\t\t// `fill` and `fillColor` are the same thing; either may hold a\n\t\t\t// color or a CSS gradient.\n\t\t\tfillColor: options.fillColor ?? options.fill ?? \"#3b82f6\",\n\t\t}),\n\tflex: (options: Partial<FlexNode> = {}): AnimatableNode<FlexNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"flex\"),\n\t\t\tkind: \"flex\",\n\t\t\tdir: options.dir ?? \"column\",\n\t\t\tchildren: options.children ?? [],\n\t\t\t...options,\n\t\t}),\n\tbox: (options: Partial<BoxNode> = {}): AnimatableNode<BoxNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"box\"),\n\t\t\tkind: \"box\",\n\t\t\tbackground: options.background ?? \"transparent\",\n\t\t\tchildren: options.children ?? [],\n\t\t\t...options,\n\t\t}),\n\tsection: (\n\t\tsource: string | MediaNode | Composition,\n\t\ttargetOrOptions: ObjectTrackSignals | SectionOptions = {},\n\t\toptions: SectionOptions = {},\n\t): SectionNode => {\n\t\tlet realSource: string | MediaNode = source as string | MediaNode;\n\t\tif (\n\t\t\tsource &&\n\t\t\ttypeof source === \"object\" &&\n\t\t\t\"toSpec\" in source &&\n\t\t\t\"children\" in source\n\t\t) {\n\t\t\tconst compMedia = (\n\t\t\t\t((source as Composition).children || []) as LayoutNode[]\n\t\t\t).find(\n\t\t\t\t(c) =>\n\t\t\t\t\tc.kind === \"media\" &&\n\t\t\t\t\t(c.dataType === \"Video\" || c.dataType === \"Image\"),\n\t\t\t) as MediaNode | undefined;\n\t\t\tif (compMedia) {\n\t\t\t\trealSource = compMedia;\n\t\t\t}\n\t\t}\n\n\t\tconst isTracked =\n\t\t\ttargetOrOptions !== null &&\n\t\t\ttypeof targetOrOptions === \"object\" &&\n\t\t\t\"bounds\" in targetOrOptions;\n\t\tconst opts: SectionOptions = isTracked\n\t\t\t? options\n\t\t\t: (targetOrOptions as SectionOptions);\n\t\tconst target = isTracked\n\t\t\t? (targetOrOptions as ObjectTrackSignals)\n\t\t\t: undefined;\n\n\t\tconst padding = opts.padding ?? 0;\n\t\tconst src =\n\t\t\ttypeof realSource === \"string\"\n\t\t\t\t? realSource\n\t\t\t\t: (realSource?.inputHandleId ??\n\t\t\t\t\t(realSource as { src?: string })?.src ??\n\t\t\t\t\t\"\");\n\t\tconst dataType =\n\t\t\ttypeof realSource === \"object\" && realSource?.dataType\n\t\t\t\t? realSource.dataType\n\t\t\t\t: \"Video\";\n\t\tconst compW =\n\t\t\t(opts.compositionWidth as number) ??\n\t\t\t(opts.compWidth as number) ??\n\t\t\t(isTracked ? (opts.width as number) : undefined) ??\n\t\t\t1920;\n\t\tconst compH =\n\t\t\t(opts.compositionHeight as number) ??\n\t\t\t(opts.compHeight as number) ??\n\t\t\t(isTracked ? (opts.height as number) : undefined) ??\n\t\t\t1080;\n\n\t\tconst effList: Effect[] = Array.isArray(opts.effects)\n\t\t\t? ([...opts.effects] as Effect[])\n\t\t\t: opts.effects\n\t\t\t\t? [opts.effects as Effect]\n\t\t\t\t: [];\n\n\t\tconst innerX = target\n\t\t\t? target.bounds.screenX.multiply(-1).add(padding)\n\t\t\t: typeof opts.x === \"number\"\n\t\t\t\t? -opts.x\n\t\t\t\t: opts.x &&\n\t\t\t\t\t\ttypeof (opts.x as { multiply?: unknown }).multiply === \"function\"\n\t\t\t\t\t? (opts.x as { multiply: (n: number) => unknown }).multiply(-1)\n\t\t\t\t\t: 0;\n\n\t\tconst innerY = target\n\t\t\t? target.bounds.screenY.multiply(-1).add(padding)\n\t\t\t: typeof opts.y === \"number\"\n\t\t\t\t? -opts.y\n\t\t\t\t: opts.y &&\n\t\t\t\t\t\ttypeof (opts.y as { multiply?: unknown }).multiply === \"function\"\n\t\t\t\t\t? (opts.y as { multiply: (n: number) => unknown }).multiply(-1)\n\t\t\t\t\t: 0;\n\n\t\tconst innerMedia = (\n\t\t\tdataType === \"Image\"\n\t\t\t\t? Layer.image(src, {\n\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\twidth: compW,\n\t\t\t\t\t\theight: compH,\n\t\t\t\t\t\tfit: opts.fit ?? \"cover\",\n\t\t\t\t\t\tx: innerX as number,\n\t\t\t\t\t\ty: innerY as number,\n\t\t\t\t\t})\n\t\t\t\t: Layer.video(src, {\n\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\twidth: compW,\n\t\t\t\t\t\theight: compH,\n\t\t\t\t\t\tfit: opts.fit ?? \"cover\",\n\t\t\t\t\t\tx: innerX as number,\n\t\t\t\t\t\ty: innerY as number,\n\t\t\t\t\t})\n\t\t).withEffects(effList);\n\n\t\tconst boxWidth = target\n\t\t\t? target.bounds.screenWidth.add(padding * 2)\n\t\t\t: opts.width !== undefined\n\t\t\t\t? opts.width\n\t\t\t\t: compW;\n\n\t\tconst boxHeight = target\n\t\t\t? target.bounds.screenHeight.add(padding * 2)\n\t\t\t: opts.height !== undefined\n\t\t\t\t? opts.height\n\t\t\t\t: compH;\n\n\t\tconst boxChildren = [innerMedia, ...(opts.children ?? [])];\n\n\t\tconst boxId =\n\t\t\topts.id ??\n\t\t\t(target ? autoId(`section-track-${target.trackId}`) : autoId(\"section\"));\n\n\t\tlet box = Layer.box({\n\t\t\tid: boxId,\n\t\t\tposition: (opts.position as \"absolute\" | \"relative\") ?? \"absolute\",\n\t\t\twidth: boxWidth as number,\n\t\t\theight: boxHeight as number,\n\t\t\tx: target ? undefined : (opts.x as number),\n\t\t\ty: target ? undefined : (opts.y as number),\n\t\t\tborderRadius: opts.borderRadius ?? 0,\n\t\t\tborderColor: opts.borderColor,\n\t\t\tborderWidth: opts.borderWidth,\n\t\t\topacity: (opts.opacity as number) ?? 1,\n\t\t\toverflow: \"hidden\",\n\t\t\tchildren: boxChildren,\n\t\t});\n\n\t\tif (target) {\n\t\t\tbox = box.pinToObject(target, {\n\t\t\t\tanchor: \"topLeft\",\n\t\t\t\toffsetX: -padding,\n\t\t\t\toffsetY: -padding,\n\t\t\t\thideWhenLost: opts.hideWhenLost ?? true,\n\t\t\t\tsmoothFrames: opts.smoothFrames,\n\t\t\t});\n\t\t}\n\n\t\tconst sectionNode = box as SectionNode;\n\t\tObject.defineProperty(sectionNode, \"innerMedia\", {\n\t\t\tvalue: innerMedia,\n\t\t\tenumerable: true,\n\t\t\twritable: false,\n\t\t});\n\t\tObject.defineProperty(sectionNode, \"effects\", {\n\t\t\tget: () => effList,\n\t\t\tenumerable: true,\n\t\t});\n\t\tObject.defineProperty(sectionNode, \"addEffect\", {\n\t\t\tvalue: (effect: Effect) => {\n\t\t\t\teffList.push(effect);\n\t\t\t\tinnerMedia.effects = effList;\n\t\t\t\treturn sectionNode;\n\t\t\t},\n\t\t\tenumerable: true,\n\t\t\twritable: false,\n\t\t});\n\t\tObject.defineProperty(sectionNode, \"withEffect\", {\n\t\t\tvalue: (effect: Effect) => sectionNode.addEffect(effect),\n\t\t\tenumerable: true,\n\t\t\twritable: false,\n\t\t});\n\t\tObject.defineProperty(sectionNode, \"withEffects\", {\n\t\t\tvalue: (effects: Effect[]) => {\n\t\t\t\tfor (const eff of effects) {\n\t\t\t\t\tsectionNode.addEffect(eff);\n\t\t\t\t}\n\t\t\t\treturn sectionNode;\n\t\t\t},\n\t\t\tenumerable: true,\n\t\t\twritable: false,\n\t\t});\n\n\t\treturn sectionNode;\n\t},\n\ttrackedRegion: (\n\t\tsource: string | MediaNode,\n\t\ttarget: ObjectTrackSignals,\n\t\toptions: TrackedRegionOptions = {},\n\t): SectionNode => {\n\t\treturn Layer.section(source, target, options);\n\t},\n\tblurTrackedRegion: (\n\t\tsource: string | MediaNode,\n\t\ttarget: ObjectTrackSignals,\n\t\toptions: Partial<BlurProps> & {\n\t\t\tborderRadius?: number;\n\t\t\tpadding?: number;\n\t\t\tborderColor?: string;\n\t\t\tborderWidth?: number;\n\t\t} = {},\n\t): SectionNode => {\n\t\t// Section styling is not a Blur prop; keep it out of the effect config.\n\t\tconst { padding, borderRadius, borderColor, borderWidth, ...blurOptions } =\n\t\t\toptions;\n\t\treturn Layer.section(source, target, {\n\t\t\tpadding: padding ?? 8,\n\t\t\tborderRadius: borderRadius ?? 12,\n\t\t\tborderColor,\n\t\t\tborderWidth,\n\t\t\teffects: [\n\t\t\t\tnew Blur({\n\t\t\t\t\tstrength: blurOptions.strength ?? 25,\n\t\t\t\t\tblurType: blurOptions.blurType ?? \"Gaussian\",\n\t\t\t\t\t...blurOptions,\n\t\t\t\t}),\n\t\t\t],\n\t\t});\n\t},\n\t/**\n\t * A line, area, bar, scatter, candlestick, pie or donut chart. Returns a box\n\t * of ordinary nodes (bars are boxes, lines and slices are path shapes,\n\t * labels are text), so it positions, animates and composites like any layer.\n\t * `props` applies to that box: position, id, timing, effects.\n\t */\n\tchart: (\n\t\toptions: ChartOptions,\n\t\tprops: Partial<BoxNode> = {},\n\t): AnimatableNode<BoxNode> =>\n\t\tbuildChart(options, props, FontManager.getAll()[0]?.family ?? \"Inter\"),\n\tcamera: (options: Partial<CameraNode> = {}): AnimatableNode<CameraNode> =>\n\t\twithAnimation<CameraNode>({\n\t\t\tid: options.id ?? autoId(\"camera\"),\n\t\t\tkind: \"camera\",\n\t\t\tmode: options.mode ?? \"lookAt\",\n\t\t\tpitch: options.pitch ?? 0,\n\t\t\tyaw: options.yaw ?? 0,\n\t\t\troll: options.roll ?? 0,\n\t\t\t...options,\n\t\t}),\n\tlight: (options: Partial<LightNode> = {}): AnimatableNode<LightNode> =>\n\t\twithAnimation<LightNode>({\n\t\t\tid: options.id ?? autoId(\"light\"),\n\t\t\tkind: \"light\",\n\t\t\tlightType: options.lightType ?? \"point\",\n\t\t\tcolor: options.color ?? \"#ffffff\",\n\t\t\tintensity: options.intensity ?? 1.0,\n\t\t\t...options,\n\t\t}),\n\tambientLight: (\n\t\tcolor: string = \"#ffffff\",\n\t\tintensity: number = 0.5,\n\t\toptions: Partial<LightNode> = {},\n\t): AnimatableNode<LightNode> => Light.ambient(color, intensity, options),\n\t/**\n\t * Scenes back to back with transitions between them; see `Transition`.\n\t * `comp.add(Layer.sequence([{ scene: hero(), duration: 90 },\n\t * { scene: next(), duration: 120, transition: Transition.push(\"left\") }]))`.\n\t * The result's `totalFrames` is the sequence length.\n\t */\n\tsequence: (\n\t\tentries: SequenceEntry[],\n\t\toptions?: SceneSequenceOptions,\n\t): SequenceNode => sequence(entries, options),\n\t/** See {@link Light.environment}: `Layer.environment(\"studio\", { exposure: 0.3 })`. */\n\tenvironment: (\n\t\tpresetOrOptions: EnvironmentPreset | EnvironmentOptions = \"studio\",\n\t\toptions: EnvironmentOptions = {},\n\t): AnimatableNode<LightNode> => Light.environment(presetOrOptions, options),\n\tdirectionalLight: (\n\t\toptions: Partial<LightNode> = {},\n\t): AnimatableNode<LightNode> => Light.directional(options),\n\tpointLight: (options: Partial<LightNode> = {}): AnimatableNode<LightNode> =>\n\t\tLight.point(options),\n\tspotLight: (options: Partial<LightNode> = {}): AnimatableNode<LightNode> =>\n\t\tLight.spot(options),\n\tcube: (options: Cube3DOptions): AnimatableNode<BoxNode> =>\n\t\tLayer3D.cube(options),\n\tcarousel3d: (options: Carousel3DOptions): AnimatableNode<BoxNode> =>\n\t\tLayer3D.carousel(options),\n\tplane3d: (options: Plane3DOptions): AnimatableNode<BoxNode> =>\n\t\tLayer3D.plane(options),\n\tprism3d: (options: Prism3DOptions): AnimatableNode<BoxNode> =>\n\t\tLayer3D.prism(options),\n\tmodel: (options: Partial<Model3DNode> = {}): AnimatableNode<Model3DNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"model3d\"),\n\t\t\tkind: \"model3d\",\n\t\t\tis3D: options.is3D ?? true,\n\t\t\tmodelFormat: options.modelFormat ?? \"auto\",\n\t\t\tloop: options.loop ?? true,\n\t\t\tscale: options.scale ?? 1.0,\n\t\t\tscaleX: options.scaleX ?? 1.0,\n\t\t\tscaleY: options.scaleY ?? 1.0,\n\t\t\tscaleZ: options.scaleZ ?? 1.0,\n\t\t\topacity: options.opacity ?? 1.0,\n\t\t\t// material and twoSided stay unset unless given: the model's own\n\t\t\t// materials (toon, single-sided, …) decide, falling back to lit.\n\t\t\t...options,\n\t\t}),\n\tobj: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"obj\",\n\t\t\t...options,\n\t\t}),\n\tfbx: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"fbx\",\n\t\t\t...options,\n\t\t}),\n\tgltf: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"gltf\",\n\t\t\t...options,\n\t\t}),\n\tglb: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"glb\",\n\t\t\t...options,\n\t\t}),\n\tstl: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"stl\",\n\t\t\t...options,\n\t\t}),\n\tply: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"ply\",\n\t\t\t...options,\n\t\t}),\n\tvox: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"vox\",\n\t\t\t...options,\n\t\t}),\n\tthreeDS: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"3ds\",\n\t\t\t...options,\n\t\t}),\n\toff: (\n\t\tsrc: string,\n\t\toptions: Partial<Model3DNode> = {},\n\t): AnimatableNode<Model3DNode> =>\n\t\tLayer.model({\n\t\t\tsrc,\n\t\t\tmodelFormat: \"off\",\n\t\t\t...options,\n\t\t}),\n};\n\n/** World settings for `Layer.environment` (see `LightNode` for every field). */\nexport type EnvironmentOptions = Partial<\n\tPick<\n\t\tLightNode,\n\t\t| \"id\"\n\t\t| \"preset\"\n\t\t| \"top\"\n\t\t| \"horizon\"\n\t\t| \"bottom\"\n\t\t| \"intensity\"\n\t\t| \"softboxes\"\n\t\t| \"rotation\"\n\t\t| \"exposure\"\n\t\t| \"toneMapping\"\n\t\t| \"fog\"\n\t\t| \"bloom\"\n\t\t| \"startFrame\"\n\t\t| \"durationFrames\"\n\t>\n>;\n\nexport const Light = {\n\t/**\n\t * The scene's world: a procedural studio environment that lights and\n\t * reflects off every surface, plus exposure, tone mapping and fog. Adding\n\t * one switches the scene to physically based shading (GGX, real\n\t * `roughness` / `metallic`, `emissive` that blooms past white).\n\t */\n\tenvironment: (\n\t\tpresetOrOptions: EnvironmentPreset | EnvironmentOptions = \"studio\",\n\t\toptions: EnvironmentOptions = {},\n\t): AnimatableNode<LightNode> => {\n\t\tconst opts =\n\t\t\ttypeof presetOrOptions === \"string\"\n\t\t\t\t? { preset: presetOrOptions, ...options }\n\t\t\t\t: { ...presetOrOptions, ...options };\n\t\treturn withAnimation({\n\t\t\tkind: \"light\",\n\t\t\tlightType: \"environment\",\n\t\t\tpreset: \"studio\",\n\t\t\tintensity: 1,\n\t\t\t...opts,\n\t\t\tid: opts.id ?? autoId(\"environment\"),\n\t\t});\n\t},\n\tambient: (\n\t\tcolor: string = \"#ffffff\",\n\t\tintensity: number = 0.5,\n\t\toptions: Partial<LightNode> = {},\n\t): AnimatableNode<LightNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"light-ambient\"),\n\t\t\tkind: \"light\",\n\t\t\tlightType: \"ambient\",\n\t\t\tcolor,\n\t\t\tintensity,\n\t\t\t...options,\n\t\t}),\n\tdirectional: (options: Partial<LightNode> = {}): AnimatableNode<LightNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"light-directional\"),\n\t\t\tkind: \"light\",\n\t\t\tlightType: \"directional\",\n\t\t\tcolor: options.color ?? \"#ffffff\",\n\t\t\tintensity: options.intensity ?? 1.0,\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? -1000,\n\t\t\tz: options.z ?? -1000,\n\t\t\ttargetX: options.targetX ?? 0,\n\t\t\ttargetY: options.targetY ?? 0,\n\t\t\ttargetZ: options.targetZ ?? 0,\n\t\t\t...options,\n\t\t}),\n\tpoint: (options: Partial<LightNode> = {}): AnimatableNode<LightNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"light-point\"),\n\t\t\tkind: \"light\",\n\t\t\tlightType: \"point\",\n\t\t\tcolor: options.color ?? \"#ffffff\",\n\t\t\tintensity: options.intensity ?? 1.0,\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? 0,\n\t\t\tz: options.z ?? -500,\n\t\t\tradius: options.radius ?? 1000,\n\t\t\tdecay: options.decay ?? 1.0,\n\t\t\t...options,\n\t\t}),\n\tspot: (options: Partial<LightNode> = {}): AnimatableNode<LightNode> =>\n\t\twithAnimation({\n\t\t\tid: options.id ?? autoId(\"light-spot\"),\n\t\t\tkind: \"light\",\n\t\t\tlightType: \"spot\",\n\t\t\tcolor: options.color ?? \"#ffffff\",\n\t\t\tintensity: options.intensity ?? 1.0,\n\t\t\tx: options.x ?? 0,\n\t\t\ty: options.y ?? -500,\n\t\t\tz: options.z ?? -1000,\n\t\t\ttargetX: options.targetX ?? 0,\n\t\t\ttargetY: options.targetY ?? 0,\n\t\t\ttargetZ: options.targetZ ?? 0,\n\t\t\tangle: options.angle ?? 45,\n\t\t\tpenumbra: options.penumbra ?? 0.2,\n\t\t\tradius: options.radius ?? 2000,\n\t\t\tdecay: options.decay ?? 1.0,\n\t\t\t...options,\n\t\t}),\n};\n\nexport {\n\ttype PreviewCloseReason,\n\ttype PreviewOptions,\n\ttype PreviewSession,\n\ttype PreviewSource,\n\tstartPreview,\n} from \"./preview/index.js\";\nexport {\n\ttype AudioQaStats,\n\tcomputeGridLayout,\n\ttype FrameGridOptions,\n\ttype FrameGridRenderable,\n\ttype FrameSamplePoint,\n\tformatQaReport,\n\tHeadlessMediaRenderer,\n\tHeadlessWebGPURenderer,\n\ttype QaIssue,\n\ttype QaSegment,\n\trenderFrameGrid,\n\trenderSemaphore,\n\tresolveSamplePoints,\n\ttype VideoQaOptions,\n\ttype VideoQaReport,\n\ttype VideoQaStats,\n} from \"./renderer/index.js\";\n\nexport function section(\n\tsource: string | MediaNode | Composition,\n\ttargetOrOptions: ObjectTrackSignals | SectionOptions = {},\n\toptions: SectionOptions = {},\n): SectionNode {\n\treturn Layer.section(source, targetOrOptions, options);\n}\n\nexport function blurRegion(\n\tsourceOrLayer: string | AnimatableNode<MediaNode>,\n\ttarget: ObjectTrackSignals,\n\toptions: Partial<BlurProps> & {\n\t\tborderRadius?: number;\n\t\tpadding?: number;\n\t\tborderColor?: string;\n\t\tborderWidth?: number;\n\t} = {},\n): AnimatableNode<MediaNode> | AnimatableNode<BoxNode> {\n\tif (typeof sourceOrLayer === \"object\" && \"blurRegion\" in sourceOrLayer) {\n\t\treturn (sourceOrLayer as AnimatableNode<MediaNode>).blurRegion(\n\t\t\ttarget,\n\t\t\toptions,\n\t\t);\n\t}\n\treturn Layer.blurTrackedRegion(sourceOrLayer as string, target, options);\n}\n\nexport function editTrackedRegion(\n\tsource: string | MediaNode,\n\ttarget: ObjectTrackSignals,\n\toptions: TrackedRegionOptions = {},\n): SectionNode {\n\treturn Layer.section(source, target, options);\n}\n\nexport const Effect = Object.assign(CoreEffect, effectFactories, {\n\tblur: (config?: BlurProps) => new Blur(config),\n\tvignette: (config?: VignetteProps) => new Vignette(config),\n\tcolorBalance: (config?: ColorBalanceProps) => new ColorBalance(config),\n\tcolorKey: (config?: ColorKeyProps) => new ColorKey(config),\n\tlevels: (config?: LevelsProps) => new Levels(config),\n\tfilmGrain: (config?: FilmGrainProps) => new FilmGrain(config),\n\tcurves: (config?: CurvesProps) => new Curves(config),\n\tselectiveColor: (config?: SelectiveColorProps) => new SelectiveColor(config),\n\tgradientMap: (config?: GradientMapProps) => new GradientMap(config),\n\tshadowsHighlights: (config?: ShadowsHighlightsProps) =>\n\t\tnew ShadowsHighlights(config),\n\tapplyLut: (config?: ApplyLUTProps) => new ApplyLUT(config),\n\tunsharpMask: (config?: UnsharpMaskProps) => new UnsharpMask(config),\n\thighPass: (config?: HighPassProps) => new HighPass(config),\n\thalftoneScreen: (config?: HalftoneScreenProps) => new HalftoneScreen(config),\n\ttileOffset: (config?: TileOffsetProps) => new TileOffset(config),\n\tmotionBlur: (config?: MotionBlurProps) => new MotionBlur(config),\n\tssao: (config?: SSAOProps) => new SSAO(config),\n\tpbrGlass: (config?: PBRGlassProps) => new PBRGlass(config),\n\tdepthOfField: (config?: DepthOfFieldProps) => new DepthOfField(config),\n\tcrop: (config?: CropProps) => new Crop(config),\n\tvision: (config?: VisionProps) => new Vision(config),\n\trelight3d: (config?: Relight3DProps) => new Relight3D(config),\n\tmodulate: (config?: ModulateProps) => new Modulate(config),\n\tdeflicker: (config?: DeflickerProps) => new TemporalDeflicker(config),\n\tcustom: (op: string, config: Record<string, unknown> = {}) =>\n\t\tnew CustomEffect(op, config),\n});\n\nexport type Effect<TConfig extends object = Record<string, unknown>> =\n\tCoreEffect<TConfig>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,2BAAW,IAAI,KAAqB;AAE1C,SAAgB,OAAO,QAAwB;CAC9C,MAAM,KAAK,SAAS,IAAI,OAAO,IAAI,KAAK;AACxC,UAAS,IAAI,QAAQ,EAAE;AACvB,QAAO,GAAG,OAAO,QAAQ;;;;;;;;;;;;;;ACa1B,SAAgB,KACf,SACA,GAAG,QACU;CACb,MAAM,QAAoB,EAAE;AAE5B,MAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;EACxC,MAAM,MAAM,QAAQ;AACpB,MA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