@cueframe/kernel 0.2.57 → 0.2.59-rc.0

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 (370) hide show
  1. package/dist/THIRD_PARTY_NOTICES.md +111 -0
  2. package/dist/_members/account-model/testing/conversationStoreContract.d.ts +3 -4
  3. package/dist/_members/account-model/testing/restorePointStoreContract.d.ts +3 -4
  4. package/dist/_members/account-model/validators/index.d.ts +0 -1
  5. package/dist/_members/animate/index.d.ts +0 -2
  6. package/dist/_members/authoring/index.d.ts +1 -1
  7. package/dist/_members/authoring/prompts/index.d.ts +0 -1
  8. package/dist/_members/authoring/resources.d.ts +2 -11
  9. package/dist/_members/cloud-import/CloudImportService.d.ts +0 -1
  10. package/dist/_members/cloud-import/index.d.ts +0 -2
  11. package/dist/_members/component-runtime/allowedImports.d.ts +6 -0
  12. package/dist/_members/component-runtime/allowedImports.d.ts.map +1 -1
  13. package/dist/_members/component-runtime/browserIdentity.d.ts +2 -12
  14. package/dist/_members/component-runtime/browserIdentity.d.ts.map +1 -1
  15. package/dist/_members/component-runtime/canonicalIdentity.d.ts +8 -1
  16. package/dist/_members/component-runtime/canonicalIdentity.d.ts.map +1 -1
  17. package/dist/_members/component-runtime/contracts.d.ts +2 -1
  18. package/dist/_members/component-runtime/contracts.d.ts.map +1 -1
  19. package/dist/_members/component-runtime/identity.d.ts +2 -3
  20. package/dist/_members/component-runtime/identity.d.ts.map +1 -1
  21. package/dist/_members/component-runtime/importPolicy.d.ts +5 -0
  22. package/dist/_members/component-runtime/importPolicy.d.ts.map +1 -1
  23. package/dist/_members/component-runtime/template/bind.d.ts +22 -0
  24. package/dist/_members/component-runtime/template/bind.d.ts.map +1 -0
  25. package/dist/_members/component-runtime/template/checks.d.ts +71 -0
  26. package/dist/_members/component-runtime/template/checks.d.ts.map +1 -0
  27. package/dist/_members/component-runtime/template/extract.d.ts +35 -0
  28. package/dist/_members/component-runtime/template/extract.d.ts.map +1 -0
  29. package/dist/_members/component-runtime/template/index.d.ts +6 -0
  30. package/dist/_members/component-runtime/template/index.d.ts.map +1 -0
  31. package/dist/_members/component-runtime/template/schema.d.ts +1581 -0
  32. package/dist/_members/component-runtime/template/schema.d.ts.map +1 -0
  33. package/dist/_members/component-runtime/template/testing/fixtures.d.ts +33 -0
  34. package/dist/_members/component-runtime/template/testing/fixtures.d.ts.map +1 -0
  35. package/dist/_members/component-runtime/template/testing/index.d.ts +3 -0
  36. package/dist/_members/component-runtime/template/testing/index.d.ts.map +1 -0
  37. package/dist/_members/component-runtime/template/testing/templateApplyContract.d.ts +53 -0
  38. package/dist/_members/component-runtime/template/testing/templateApplyContract.d.ts.map +1 -0
  39. package/dist/_members/component-runtime/testing/sourcePolicyCases.d.ts +15 -0
  40. package/dist/_members/component-runtime/testing/sourcePolicyCases.d.ts.map +1 -0
  41. package/dist/_members/component-runtime/webglProbe.d.ts.map +1 -1
  42. package/dist/_members/compose/index.d.ts +1 -1
  43. package/dist/_members/compose/primitiveRegistry.d.ts +0 -2
  44. package/dist/_members/composition/audio/audioMix.d.ts +0 -1
  45. package/dist/_members/composition/audio/mixStaging.d.ts +0 -5
  46. package/dist/_members/composition/fixtures/index.d.ts +0 -1
  47. package/dist/_members/composition/graphics-plan/index.d.ts +0 -2
  48. package/dist/_members/composition/graphics-plan/schemas.d.ts +4 -4
  49. package/dist/_members/composition/invariants/etag.d.ts +0 -1
  50. package/dist/_members/composition/invariants/index.d.ts +0 -1
  51. package/dist/_members/composition/ops/compositionOps.d.ts +0 -1
  52. package/dist/_members/composition/ops/compositionOps.shared.d.ts +6 -0
  53. package/dist/_members/composition/ops/index.d.ts +2 -1
  54. package/dist/_members/composition/primitive-catalog/index.d.ts +2 -3
  55. package/dist/_members/composition/primitive-catalog/types.d.ts +3 -1
  56. package/dist/_members/composition/projection/behind-readiness.d.ts +0 -6
  57. package/dist/_members/composition/timeline/link.d.ts +0 -4
  58. package/dist/_members/composition/timeline/plan.d.ts +0 -1
  59. package/dist/_members/composition/validators/brandKit.d.ts +11 -4
  60. package/dist/_members/composition/validators/brandKitBody.d.ts +543 -0
  61. package/dist/_members/composition/validators/cardHtml.d.ts +11 -0
  62. package/dist/_members/composition/validators/composition.d.ts +2 -5
  63. package/dist/_members/composition/validators/css-tree-subpaths.d.ts +16 -0
  64. package/dist/_members/composition/validators/index.d.ts +0 -3
  65. package/dist/_members/composition/validators/session.d.ts +3 -3
  66. package/dist/_members/composition/validators/webhook.d.ts +4 -4
  67. package/dist/_members/composition-ops/alphaLayers.d.ts +0 -5
  68. package/dist/_members/composition-ops/index.d.ts +2 -2
  69. package/dist/_members/composition-ops/opRecorder.d.ts +23 -3
  70. package/dist/_members/core/render/exportSettings.d.ts +4 -2
  71. package/dist/_members/core/render/index.d.ts +1 -1
  72. package/dist/_members/core/render/vcam/requiredRegion.d.ts +0 -1
  73. package/dist/_members/director/ai-sdk/index.d.ts +0 -1
  74. package/dist/_members/director/ai-sdk/messages.d.ts +0 -1
  75. package/dist/_members/director/domain/chat.d.ts +0 -78
  76. package/dist/_members/director/domain/index.d.ts +0 -1
  77. package/dist/_members/errors/registry.d.ts +42 -0
  78. package/dist/_members/foundation/canonical/index.d.ts +14 -0
  79. package/dist/_members/foundation/index.d.ts +1 -1
  80. package/dist/_members/foundation/primitives/index.d.ts +0 -2
  81. package/dist/_members/foundation/testing/index.d.ts +1 -0
  82. package/dist/_members/foundation/testing/knownRed.d.ts +13 -0
  83. package/dist/_members/mcp/adapter.d.ts +21 -0
  84. package/dist/_members/mcp/compositionOps.d.ts +10 -0
  85. package/dist/_members/mcp/server.d.ts +0 -2
  86. package/dist/_members/mcp/wait.d.ts +3 -1
  87. package/dist/_members/media-model/generation.d.ts +0 -25
  88. package/dist/_members/nle-export/xml-utils.d.ts +0 -8
  89. package/dist/_members/plane/conformance.d.ts +20 -0
  90. package/dist/_members/primitives/backgrounds/dynamic-grid/config.d.ts +1 -1
  91. package/dist/_members/primitives/effects/blur/config.d.ts +1 -1
  92. package/dist/_members/primitives/effects/color-grade/config.d.ts +2 -2
  93. package/dist/_members/primitives/effects/grain/config.d.ts +3 -3
  94. package/dist/_members/primitives/effects/particles/config.d.ts +2 -2
  95. package/dist/_members/primitives/effects/stage-camera/config.d.ts +6 -6
  96. package/dist/_members/primitives/effects/vignette/config.d.ts +1 -1
  97. package/dist/_members/primitives/index.d.ts +1 -11
  98. package/dist/_members/primitives/layouts/flex-layout/config.d.ts +3 -3
  99. package/dist/_members/primitives/layouts/picture-in-picture/config.d.ts +2 -2
  100. package/dist/_members/primitives/lib/index.d.ts +1 -1
  101. package/dist/_members/primitives/lib/tokens.d.ts +0 -16
  102. package/dist/_members/primitives/lib/types.d.ts +1 -1
  103. package/dist/_members/primitives/scenes/device-showcase/config.d.ts +7 -7
  104. package/dist/_members/primitives/text/cinematic-title/config.d.ts +3 -3
  105. package/dist/_members/primitives/text/karaoke/config.d.ts +1 -1
  106. package/dist/_members/primitives/text/kinetic-type/config.d.ts +3 -3
  107. package/dist/_members/primitives/text/stat-counter/config.d.ts +1 -1
  108. package/dist/_members/primitives/text/text-effect/config.d.ts +2 -2
  109. package/dist/_members/primitives/transitions/grid-pixelate-wipe/config.d.ts +1 -1
  110. package/dist/_members/primitives/ui-blocks/badge-pop/config.d.ts +3 -3
  111. package/dist/_members/primitives/ui-blocks/terminal-simulator/config.d.ts +2 -2
  112. package/dist/_members/primitives/ui-blocks/toast-notification/config.d.ts +2 -2
  113. package/dist/_members/render-harness/cardAssetAdmission.d.ts +1 -0
  114. package/dist/_members/render-harness/cardAssetAdmission.d.ts.map +1 -1
  115. package/dist/_members/render-harness/cardRender.d.ts.map +1 -1
  116. package/dist/_members/render-harness/materializeSources.d.ts.map +1 -1
  117. package/dist/_members/render-harness/mediaServer.d.ts +6 -1
  118. package/dist/_members/render-harness/mediaServer.d.ts.map +1 -1
  119. package/dist/account-model/testing.js +15 -5
  120. package/dist/account-model/validators.js +5 -7
  121. package/dist/account-model.js +5 -7
  122. package/dist/animate/preparation-facts.js +1 -1
  123. package/dist/animate.js +2 -6
  124. package/dist/authoring/composer.js +1 -1
  125. package/dist/authoring/context.js +8 -6
  126. package/dist/authoring/models/defaults.d.ts +1 -0
  127. package/dist/authoring/models/defaults.js +7 -0
  128. package/dist/authoring/models.js +5 -3
  129. package/dist/authoring/motion.d.ts +1 -0
  130. package/dist/authoring/motion.js +25 -0
  131. package/dist/authoring/prompts.js +4 -14
  132. package/dist/authoring/providers.js +1 -1
  133. package/dist/authoring/resource-routing.js +2 -2
  134. package/dist/authoring/resources.js +4 -22
  135. package/dist/authoring/scene.js +3 -2
  136. package/dist/authoring.js +662 -218
  137. package/dist/brand-derivation/constants.js +1 -1
  138. package/dist/brand-derivation.js +1 -1
  139. package/dist/{chunk-TKFLSGAS.js → chunk-25JH5QZA.js} +2 -2
  140. package/dist/{chunk-LBJ5LI5V.js → chunk-2K2GBFLU.js} +17 -8
  141. package/dist/{chunk-RAXHCRVV.js → chunk-2PAP5LO5.js} +1 -1
  142. package/dist/{chunk-JPMVNMF3.js → chunk-3HLDIIWA.js} +1 -1
  143. package/dist/{chunk-PTVTWQ4T.js → chunk-3JEUNKDK.js} +2 -2
  144. package/dist/chunk-3VWJ3H4X.js +68 -0
  145. package/dist/{chunk-S5H6GH6M.js → chunk-3Z7CN54H.js} +1 -1
  146. package/dist/{chunk-FVDFPJHT.js → chunk-46WBCUPE.js} +1 -1
  147. package/dist/chunk-4VBLQIM5.js +30 -0
  148. package/dist/{chunk-N2OZDD44.js → chunk-6HA55CRU.js} +4 -5
  149. package/dist/{chunk-WL2MLKWU.js → chunk-6HPEMDQW.js} +1 -1
  150. package/dist/chunk-6KZCXAYL.js +257 -0
  151. package/dist/{chunk-IEXAKOEX.js → chunk-6QGARSV6.js} +2 -15
  152. package/dist/{chunk-3YVIAWET.js → chunk-7II5OM7R.js} +13 -1
  153. package/dist/{chunk-VLJOIUHL.js → chunk-7PSQUTL5.js} +3 -3
  154. package/dist/{chunk-UFD4EZHM.js → chunk-AFUITAH6.js} +4 -5
  155. package/dist/{chunk-HGCYZMII.js → chunk-AK6QPX7A.js} +9 -9
  156. package/dist/{chunk-EC6VFQE6.js → chunk-BZVOCVQV.js} +1 -0
  157. package/dist/{chunk-RBWS5XHE.js → chunk-CAF7BRNE.js} +2 -2
  158. package/dist/chunk-CEO47DIE.js +199 -0
  159. package/dist/chunk-CIOUDOGN.js +12 -0
  160. package/dist/{chunk-BDFAA747.js → chunk-DCKADD5B.js} +1 -1
  161. package/dist/{chunk-7AZLFN26.js → chunk-EISHFHU5.js} +20 -20
  162. package/dist/chunk-EQH37KNZ.js +224 -0
  163. package/dist/{chunk-EXY4JJPH.js → chunk-F6PLDBAK.js} +2 -11
  164. package/dist/{chunk-DAARYRNT.js → chunk-FKSXKS35.js} +6 -6
  165. package/dist/{chunk-KBDUEU4W.js → chunk-FZB7UX44.js} +1 -1
  166. package/dist/chunk-H2ZZXISB.js +24 -0
  167. package/dist/{chunk-WSMCZRJ2.js → chunk-I2HNC4PQ.js} +1 -1
  168. package/dist/{chunk-VXGA7LQQ.js → chunk-IUJABAG2.js} +14 -10
  169. package/dist/{chunk-MZB4ZXYW.js → chunk-IVFMOHAC.js} +1 -9
  170. package/dist/{chunk-UKDBU7HM.js → chunk-JNBNDHEF.js} +3 -3
  171. package/dist/{chunk-JWMWVP64.js → chunk-KC4LNZL5.js} +4 -9
  172. package/dist/{chunk-GCQ7Z7S7.js → chunk-KKATUGRU.js} +3 -9
  173. package/dist/{chunk-Q5P5UFOP.js → chunk-KLQ53NX3.js} +13 -1
  174. package/dist/{chunk-UMXES6ED.js → chunk-LVMWPFV4.js} +1 -1
  175. package/dist/chunk-NECN7TT4.js +367 -0
  176. package/dist/{chunk-4ZE564YF.js → chunk-NM7NWXGF.js} +0 -146
  177. package/dist/{chunk-KSRFYFUZ.js → chunk-NY6EI5YW.js} +4 -4
  178. package/dist/{chunk-4PV3UYJF.js → chunk-ONSGT6UJ.js} +257 -226
  179. package/dist/{chunk-VZ7TYX6Z.js → chunk-P3EFZDM5.js} +0 -17
  180. package/dist/{chunk-BEFSJMFF.js → chunk-P6RVYHLT.js} +9 -9
  181. package/dist/{chunk-TBHSOEYK.js → chunk-PLWDYWK6.js} +4 -34
  182. package/dist/{chunk-KYRDKK2D.js → chunk-Q6CJ6HCU.js} +1 -6
  183. package/dist/{chunk-FWSJLHSV.js → chunk-R642352J.js} +1 -1
  184. package/dist/{chunk-XELS2BGA.js → chunk-R6HTIP3N.js} +1 -3
  185. package/dist/{chunk-RL5SO653.js → chunk-RQRPSSRT.js} +1 -1
  186. package/dist/chunk-RR7UBEBV.js +172 -0
  187. package/dist/{chunk-FHMTAZD4.js → chunk-RWJHZCOR.js} +1 -71
  188. package/dist/{chunk-73DQTUWY.js → chunk-TIAJMEQ4.js} +2 -22
  189. package/dist/{chunk-2ESYSVXG.js → chunk-U67V476Y.js} +2 -15
  190. package/dist/{chunk-N54EGUVM.js → chunk-U7KSOA2L.js} +4 -21
  191. package/dist/{chunk-K66NLMGX.js → chunk-UGWJC4GA.js} +62 -18
  192. package/dist/chunk-VBYINB74.js +136 -0
  193. package/dist/{chunk-W2245F6G.js → chunk-WTQRLFR2.js} +1 -1
  194. package/dist/{chunk-Z4G3VM3H.js → chunk-X2RTLS6K.js} +2 -23
  195. package/dist/chunk-XHMKPTHV.js +20 -0
  196. package/dist/{chunk-R7G2PNEZ.js → chunk-XOT2VWCO.js} +13 -28
  197. package/dist/{chunk-E63UEO5C.js → chunk-XQGQ5EFS.js} +16 -1
  198. package/dist/chunk-XR76OZKC.js +21 -0
  199. package/dist/chunk-ZCEYEIRB.js +179 -0
  200. package/dist/{chunk-IMIUHG2E.js → chunk-ZPJQ3TQL.js} +1 -3
  201. package/dist/cloud-import.js +1 -16
  202. package/dist/component-runtime/browserOptions.js +4 -3
  203. package/dist/component-runtime/contracts.js +2 -2
  204. package/dist/component-runtime/identity/browser.js +2 -17
  205. package/dist/component-runtime/identity.js +5 -7
  206. package/dist/component-runtime/importPolicy.js +3 -3
  207. package/dist/component-runtime/mediaResolution.js +1 -1
  208. package/dist/component-runtime/render.js +8 -7
  209. package/dist/component-runtime/sourceAdmission.js +3 -3
  210. package/dist/component-runtime/template/testing.d.ts +1 -0
  211. package/dist/component-runtime/template/testing.js +383 -0
  212. package/dist/component-runtime/template.d.ts +1 -0
  213. package/dist/component-runtime/template.js +251 -0
  214. package/dist/component-runtime.js +27 -28
  215. package/dist/compose.js +22 -39
  216. package/dist/composition/audio.js +4 -8
  217. package/dist/composition/brand-kit.js +1 -1
  218. package/dist/composition/brief.js +1 -1
  219. package/dist/composition/card-html.d.ts +1 -0
  220. package/dist/composition/card-html.js +15 -0
  221. package/dist/composition/depth.js +1 -1
  222. package/dist/composition/floors.js +2 -2
  223. package/dist/composition/fonts.js +1 -1
  224. package/dist/composition/graphics-plan.js +4 -44
  225. package/dist/composition/invariants.js +5 -12
  226. package/dist/composition/ops.js +7 -5
  227. package/dist/composition/primitive-catalog.js +4 -6
  228. package/dist/composition/projection.js +3 -5
  229. package/dist/composition/reframe/coverage.js +1 -1
  230. package/dist/composition/reframe/kenBurns.js +1 -1
  231. package/dist/composition/reframe/shotScale.js +1 -1
  232. package/dist/composition/reframe/trajectory.js +1 -1
  233. package/dist/composition/reframe.js +1 -1
  234. package/dist/composition/scene/budget-policy.js +1 -1
  235. package/dist/composition/scene.js +1 -1
  236. package/dist/composition/timeline.js +4 -8
  237. package/dist/composition/validators/brand-kit-body.d.ts +1 -0
  238. package/dist/composition/validators/brand-kit-body.js +18 -0
  239. package/dist/composition/validators/graphic-kinds.js +1 -1
  240. package/dist/composition/validators.js +16 -69
  241. package/dist/composition-ops.js +17 -15
  242. package/dist/composition.js +21 -83
  243. package/dist/context-7SWSVJ6Z.js +17 -0
  244. package/dist/core/render.js +13 -9
  245. package/dist/core/select.js +3 -3
  246. package/dist/core.js +9 -9
  247. package/dist/director/ai-sdk.js +7 -11
  248. package/dist/director/domain.js +9 -17
  249. package/dist/director.js +9 -21
  250. package/dist/{dist-LAJ2363K.js → dist-6FO67KVA.js} +1 -1
  251. package/dist/errors.js +2 -2
  252. package/dist/foundation/canonical.d.ts +1 -0
  253. package/dist/foundation/canonical.js +7 -0
  254. package/dist/foundation/primitives.js +4 -6
  255. package/dist/foundation/testing.d.ts +1 -0
  256. package/dist/foundation/testing.js +7 -0
  257. package/dist/foundation.js +7 -9
  258. package/dist/{magic-string.es-SDTMJBWP.js → magic-string.es-KVSW34UD.js} +1 -1
  259. package/dist/mcp/adapter.js +8 -16
  260. package/dist/mcp/composition-ops.d.ts +1 -0
  261. package/dist/mcp/composition-ops.js +11 -0
  262. package/dist/mcp/core.js +2 -2
  263. package/dist/mcp/curation.js +1 -1
  264. package/dist/mcp/executor.js +1 -1
  265. package/dist/mcp/scene-shot.js +3 -3
  266. package/dist/mcp/server.js +6 -30
  267. package/dist/mcp/wire-schema.js +13 -2
  268. package/dist/mcp.js +11 -33
  269. package/dist/media-model/generation.js +6 -8
  270. package/dist/media-model/media-kind.js +1 -1
  271. package/dist/media-model/testing.js +2 -2
  272. package/dist/media-model/transcriptSearch.js +1 -1
  273. package/dist/media-model.js +6 -8
  274. package/dist/nle-export/xml.js +1 -1
  275. package/dist/nle-export.js +2 -2
  276. package/dist/perception.js +1 -1
  277. package/dist/plane/conformance.js +8 -4
  278. package/dist/plane/contract.js +1 -1
  279. package/dist/plane.js +8 -4
  280. package/dist/primitives/backgrounds.js +3 -3
  281. package/dist/primitives/captions.js +5 -5
  282. package/dist/primitives/effects.js +4 -4
  283. package/dist/primitives/hero-text.js +4 -4
  284. package/dist/primitives/layouts.js +4 -4
  285. package/dist/primitives/lib/easings.js +1 -1
  286. package/dist/primitives/lib/frameScale.js +1 -1
  287. package/dist/primitives/lib/index.js +7 -13
  288. package/dist/primitives/lib/palette.js +2 -2
  289. package/dist/primitives/lib/preview.js +1 -1
  290. package/dist/primitives/lib/schema.js +1 -1
  291. package/dist/primitives/lib/seeded-random.js +1 -1
  292. package/dist/primitives/lib/text/contrast.js +3 -3
  293. package/dist/primitives/lib/text/fill.js +1 -1
  294. package/dist/primitives/lib/text/fitText.js +1 -1
  295. package/dist/primitives/lib/text/marker.js +1 -1
  296. package/dist/primitives/lib/text/motion.js +1 -1
  297. package/dist/primitives/lib/text/recolor.js +1 -1
  298. package/dist/primitives/lib/text/stage.js +1 -1
  299. package/dist/primitives/lib/text/typeface.js +1 -1
  300. package/dist/primitives/lib/tokens.js +4 -11
  301. package/dist/primitives/lib.js +7 -13
  302. package/dist/primitives/scenes.js +5 -5
  303. package/dist/primitives/subject-foreground.js +1 -1
  304. package/dist/primitives/text.js +4 -4
  305. package/dist/primitives/transitions.js +3 -3
  306. package/dist/primitives/ui-blocks.js +5 -5
  307. package/dist/primitives/workspace.js +1 -1
  308. package/dist/primitives.js +18 -32
  309. package/dist/render-harness/cardAssetAdmission.js +4 -4
  310. package/dist/render-harness/cardFonts.js +3 -3
  311. package/dist/render-harness/renderInputAssets.js +4 -4
  312. package/dist/render-harness.js +100 -82
  313. package/dist/src-XI5MULKD.js +71 -0
  314. package/package.json +51 -61
  315. package/dist/_members/account-model/validators/workingComposition.d.ts +0 -11
  316. package/dist/_members/animate/animations/index.d.ts +0 -9
  317. package/dist/_members/animate/easing/index.d.ts +0 -3
  318. package/dist/_members/animate/mobjects/index.d.ts +0 -4
  319. package/dist/_members/animate/scene/internal.d.ts +0 -29
  320. package/dist/_members/authoring/prompts/graphics.d.ts +0 -9
  321. package/dist/_members/cloud-import/cloudConfig.d.ts +0 -2
  322. package/dist/_members/composition/autozoom/index.d.ts +0 -25
  323. package/dist/_members/composition/graphics-plan/instantiateMotif.d.ts +0 -34
  324. package/dist/_members/composition/invariants/time.d.ts +0 -14
  325. package/dist/_members/composition/types/index.d.ts +0 -8
  326. package/dist/_members/composition/validators/font.d.ts +0 -58
  327. package/dist/_members/composition/validators/registry.d.ts +0 -79
  328. package/dist/_members/composition/validators/render.d.ts +0 -2068
  329. package/dist/_members/director/ai-sdk/chunks.d.ts +0 -14
  330. package/dist/_members/director/domain/ports.d.ts +0 -32
  331. package/dist/_members/director/testing/contract.d.ts +0 -52
  332. package/dist/_members/director/testing/index.d.ts +0 -1
  333. package/dist/_members/foundation/codes/index.d.ts +0 -10
  334. package/dist/_members/nle-export/server/index.d.ts +0 -1
  335. package/dist/_members/nle-export/server/pack-zip.d.ts +0 -6
  336. package/dist/_members/render-harness/assetRefs.d.ts +0 -26
  337. package/dist/_members/render-harness/assetRefs.d.ts.map +0 -1
  338. package/dist/_members/render-harness/remotion-runtime.d.ts +0 -87
  339. package/dist/authoring/build-tools.d.ts +0 -1
  340. package/dist/authoring/build-tools.js +0 -27
  341. package/dist/authoring/capabilities.d.ts +0 -1
  342. package/dist/authoring/capabilities.js +0 -11
  343. package/dist/authoring/pipelineTrace.d.ts +0 -1
  344. package/dist/authoring/pipelineTrace.js +0 -7
  345. package/dist/authoring/tools.d.ts +0 -1
  346. package/dist/authoring/tools.js +0 -30
  347. package/dist/chunk-AXRSCHQX.js +0 -661
  348. package/dist/chunk-DV7ZFVL4.js +0 -116
  349. package/dist/chunk-GF52TW4I.js +0 -51
  350. package/dist/chunk-JOURGVOR.js +0 -27
  351. package/dist/chunk-LBN5KQC6.js +0 -384
  352. package/dist/chunk-OSMXQV5V.js +0 -18
  353. package/dist/chunk-QDBVYZSF.js +0 -128
  354. package/dist/chunk-RERR5JLM.js +0 -197
  355. package/dist/chunk-U3JPILZS.js +0 -15
  356. package/dist/chunk-Y4HPN4BC.js +0 -364
  357. package/dist/composition/autozoom.d.ts +0 -1
  358. package/dist/composition/autozoom.js +0 -76
  359. package/dist/composition/fixtures.d.ts +0 -1
  360. package/dist/composition/fixtures.js +0 -154
  361. package/dist/composition/types.d.ts +0 -1
  362. package/dist/composition/types.js +0 -0
  363. package/dist/context-6HPUO36M.js +0 -15
  364. package/dist/director/testing.d.ts +0 -1
  365. package/dist/director/testing.js +0 -22
  366. package/dist/foundation/codes.d.ts +0 -1
  367. package/dist/foundation/codes.js +0 -7
  368. package/dist/nle-export/server.d.ts +0 -1
  369. package/dist/nle-export/server.js +0 -25856
  370. /package/dist/{chunk-FTVZF4GO.js → chunk-S432RE6G.js} +0 -0
@@ -0,0 +1,383 @@
1
+ import {
2
+ bindTemplate,
3
+ findReferences,
4
+ parseTemplateDocument
5
+ } from "../../chunk-NECN7TT4.js";
6
+ import "../../chunk-CEO47DIE.js";
7
+ import {
8
+ contractFacts
9
+ } from "../../chunk-XR76OZKC.js";
10
+ import {
11
+ CANVAS2D_COMPONENT_MANIFEST_V2
12
+ } from "../../chunk-BZVOCVQV.js";
13
+ import "../../chunk-ZCEYEIRB.js";
14
+ import "../../chunk-6KZCXAYL.js";
15
+ import "../../chunk-AFUITAH6.js";
16
+ import "../../chunk-WPZKOVYF.js";
17
+ import "../../chunk-B7J5UUUV.js";
18
+ import "../../chunk-EQH37KNZ.js";
19
+ import "../../chunk-WREYUH2E.js";
20
+ import {
21
+ CURRENT_MATTE_BAKE_VERSION
22
+ } from "../../chunk-IVFMOHAC.js";
23
+ import "../../chunk-DKBFAQCW.js";
24
+ import "../../chunk-ILO4NEZ3.js";
25
+ import "../../chunk-XQGQ5EFS.js";
26
+ import "../../chunk-VG2ND6PX.js";
27
+ import {
28
+ parseSceneShotSpecV2
29
+ } from "../../chunk-CL5Y6V6K.js";
30
+ import "../../chunk-2L7PYYJK.js";
31
+ import "../../chunk-OOL7ZUG7.js";
32
+ import "../../chunk-U67V476Y.js";
33
+
34
+ // ../execution/component-runtime/src/template/testing/fixtures.ts
35
+ function minimalTemplate() {
36
+ return {
37
+ v: 1,
38
+ slug: "warp",
39
+ name: "Warp",
40
+ composition: { v: 1, format: { aspectRatio: "16:9", fps: 30, resolution: "fhd" }, tracks: [
41
+ { id: "video", kind: "video", name: "Source", contents: [
42
+ {
43
+ id: "main",
44
+ kind: "video",
45
+ startTime: 0,
46
+ duration: 8,
47
+ source: { kind: "media", mediaId: "{{source}}", trim: { start: 4, end: 12 }, muted: false }
48
+ }
49
+ ] }
50
+ ] },
51
+ parameters: [{ name: "source", type: "media", kind: "video", required: true }],
52
+ components: {}
53
+ };
54
+ }
55
+ function withComponent(doc, opts = {}) {
56
+ const { slot, slotKind } = opts;
57
+ doc.components.c1 = {
58
+ source: {
59
+ version: 2,
60
+ componentId: "c1",
61
+ tsxSource: "export default () => null;",
62
+ manifest: { ...CANVAS2D_COMPONENT_MANIFEST_V2, assets: slot ? { [slot]: { kind: slotKind ?? "image", required: true } } : {} }
63
+ },
64
+ name: "C1",
65
+ description: "fixture component",
66
+ category: "text",
67
+ propSchema: { type: "object" }
68
+ };
69
+ doc.composition.tracks.push({ id: "comp", kind: "overlay", name: "C", contents: [{
70
+ id: "c",
71
+ kind: "overlay",
72
+ startTime: 0,
73
+ duration: 2,
74
+ source: { kind: "component", componentId: "c1", props: {}, ...slot ? { assets: { [slot]: `{{${slot}}}` } } : {} }
75
+ }] });
76
+ return doc;
77
+ }
78
+ function sceneWithImageSlot(slot) {
79
+ return parseSceneShotSpecV2({
80
+ version: 2,
81
+ referenceSize: { width: 1920, height: 1080 },
82
+ environment: { kind: "photographic-studio-v1" },
83
+ backdrop: { kind: "solid", color: "#000000" },
84
+ layers: [{
85
+ kind: "page",
86
+ id: "p",
87
+ transform: { position: [0, 0, 0], rotation: [0, 0, 0], scale: 1 },
88
+ width: 720,
89
+ height: 900,
90
+ surfaces: { content: { source: "image", assetSlot: slot } }
91
+ }]
92
+ });
93
+ }
94
+ var video = (durationSec = 30) => ({ mediaId: "m1", kind: "video", durationSec });
95
+ var withTrack = (doc, track) => {
96
+ doc.composition.tracks.push(track);
97
+ return doc;
98
+ };
99
+ var overlay = (params) => ({ id: "t", kind: "overlay", name: "T", contents: [{
100
+ id: "o",
101
+ kind: "overlay",
102
+ startTime: 0,
103
+ duration: 2,
104
+ source: { kind: "overlay", primitiveId: "heroText", params }
105
+ }] });
106
+ var withParams = (doc, ...ps) => {
107
+ doc.parameters.push(...ps);
108
+ return doc;
109
+ };
110
+ var TEMPLATE_BINDING_FIXTURES = [
111
+ {
112
+ name: "minimal-video",
113
+ doc: minimalTemplate,
114
+ media: { source: video() },
115
+ expect: { at: [["tracks.0.contents.0.source.mediaId", "m1"]] }
116
+ },
117
+ {
118
+ name: "text-inline-and-whole-leaf",
119
+ doc: () => withTrack(
120
+ withParams(minimalTemplate(), { name: "title", type: "string", required: true }, { name: "size", type: "number", required: true }),
121
+ overlay({ text: "Hi {{title}}!", fontSizePct: "{{size}}" })
122
+ ),
123
+ values: { title: "Sam", size: 27 },
124
+ media: { source: video() },
125
+ expect: { at: [["tracks.1.contents.0.source.params", { text: "Hi Sam!", fontSizePct: 27 }]] }
126
+ },
127
+ {
128
+ name: "escaped-brace",
129
+ doc: () => withTrack(minimalTemplate(), overlay({ text: "\\{{not a ref}}" })),
130
+ media: { source: video() },
131
+ expect: { at: [["tracks.1.contents.0.source.params.text", "{{not a ref}}"]] }
132
+ },
133
+ {
134
+ name: "image-swap-strips-trim",
135
+ doc: () => {
136
+ const doc = minimalTemplate();
137
+ doc.parameters[0] = { name: "logo", type: "media", kind: "image", required: true };
138
+ doc.composition.tracks[0] = { id: "img", kind: "image", name: "Logo", contents: [{
139
+ id: "l",
140
+ kind: "image",
141
+ startTime: 0,
142
+ duration: 3,
143
+ fit: "contain",
144
+ source: { kind: "media", mediaId: "{{logo}}", trim: { start: 0, end: 3 }, playbackRate: 1 }
145
+ }] };
146
+ return doc;
147
+ },
148
+ media: { logo: { mediaId: "m2", kind: "image" } },
149
+ expect: { at: [["tracks.0.contents.0.fit", "contain"], ["tracks.0.contents.0.source.trim", void 0], ["tracks.0.contents.0.source.playbackRate", void 0]] }
150
+ },
151
+ {
152
+ name: "missing-required",
153
+ doc: minimalTemplate,
154
+ media: {},
155
+ expect: { error: { code: "template_values_invalid", fields: [{ param: "source", reason: "required" }] } }
156
+ },
157
+ {
158
+ name: "kind-mismatch",
159
+ doc: minimalTemplate,
160
+ media: { source: { mediaId: "m1", kind: "image" } },
161
+ expect: { error: { code: "template_media_kind_mismatch" } }
162
+ },
163
+ {
164
+ name: "short-media",
165
+ doc: minimalTemplate,
166
+ media: { source: video(10) },
167
+ expect: { error: { code: "template_values_invalid", fields: [{ param: "source", reason: "media is 10s, template trims to 12s" }] } }
168
+ },
169
+ {
170
+ name: "short-media-no-trim",
171
+ doc: () => {
172
+ const doc = minimalTemplate();
173
+ delete doc.composition.tracks[0].contents[0].source.trim;
174
+ return doc;
175
+ },
176
+ media: { source: video(5) },
177
+ expect: { error: { code: "template_values_invalid", fields: [{ param: "source", reason: "media is 5s, clip needs 8s" }] } }
178
+ },
179
+ {
180
+ name: "asset-slot-image",
181
+ doc: () => withParams(withComponent(minimalTemplate(), { slot: "screen", slotKind: "image" }), { name: "screen", type: "media", kind: "image", required: true }),
182
+ media: { source: video(), screen: { mediaId: "m9", kind: "image" } },
183
+ expect: { at: [["tracks.1.contents.0.source.assets", { screen: "m9" }]] }
184
+ },
185
+ {
186
+ name: "asset-slot-kind-mismatch",
187
+ doc: () => withParams(withComponent(minimalTemplate(), { slot: "screen", slotKind: "image" }), { name: "screen", type: "media", kind: "image", required: true }),
188
+ media: { source: video(), screen: { mediaId: "m9", kind: "video" } },
189
+ expect: { error: { code: "template_media_kind_mismatch" } }
190
+ },
191
+ {
192
+ name: "scene-shot-slot",
193
+ doc: () => withTrack(
194
+ withParams(minimalTemplate(), { name: "shot", type: "media", kind: "image", required: true }),
195
+ { id: "s", kind: "overlay", name: "S", contents: [{
196
+ id: "sc",
197
+ kind: "overlay",
198
+ startTime: 0,
199
+ duration: 4,
200
+ source: { kind: "component", componentId: "scene-x", props: { scene: sceneWithImageSlot("shot") }, assets: { shot: "{{shot}}" } }
201
+ }] }
202
+ ),
203
+ media: { source: video(), shot: { mediaId: "m5", kind: "image" } },
204
+ expect: { at: [["tracks.1.contents.0.source.assets", { shot: "m5" }]] }
205
+ },
206
+ {
207
+ name: "undeclared-reference",
208
+ doc: () => withTrack(minimalTemplate(), overlay({ text: "{{nope}}" })),
209
+ media: { source: video() },
210
+ expect: { error: { code: "template_parameter_undeclared" } }
211
+ },
212
+ {
213
+ name: "misplaced-reference",
214
+ doc: () => {
215
+ const doc = withParams(minimalTemplate(), { name: "len", type: "number", required: true });
216
+ doc.composition.tracks[0].contents[0].duration = "{{len}}";
217
+ return doc;
218
+ },
219
+ values: { len: 8 },
220
+ media: { source: video() },
221
+ expect: { error: { code: "template_values_invalid" } }
222
+ },
223
+ {
224
+ name: "preset-base-with-override",
225
+ doc: () => {
226
+ const doc = withParams(minimalTemplate(), { name: "title", type: "string", required: true }, { name: "layout", type: "enum", required: true, options: ["split", "stacked"] });
227
+ doc.presets = { warm: { label: "Warm", values: { title: "Warm", layout: "split" } } };
228
+ return withTrack(doc, overlay({ text: "{{title}}", layout: "{{layout}}" }));
229
+ },
230
+ values: { title: "Mine" },
231
+ preset: "warm",
232
+ media: { source: video() },
233
+ expect: { at: [["tracks.1.contents.0.source.params", { text: "Mine", layout: "split" }]] }
234
+ },
235
+ {
236
+ name: "unknown-preset",
237
+ doc: minimalTemplate,
238
+ preset: "nope",
239
+ media: { source: video() },
240
+ expect: { error: { code: "template_values_invalid", fields: [{ param: "preset", reason: "unknown preset nope" }] } }
241
+ },
242
+ {
243
+ name: "enum-outside-options",
244
+ doc: () => withParams(minimalTemplate(), { name: "layout", type: "enum", required: true, options: ["split"] }),
245
+ values: { layout: "stacked" },
246
+ media: { source: video() },
247
+ expect: { error: { code: "template_values_invalid", fields: [{ param: "layout", reason: "expected one of split" }] } }
248
+ },
249
+ {
250
+ name: "boolean-whole-leaf-and-inline",
251
+ doc: () => withTrack(withParams(minimalTemplate(), { name: "on", type: "boolean", required: true }), overlay({ show: "{{on}}", note: "on={{on}}" })),
252
+ values: { on: "true" },
253
+ media: { source: video() },
254
+ expect: { at: [["tracks.1.contents.0.source.params", { show: true, note: "on=true" }]] }
255
+ }
256
+ ];
257
+ function readFixturePath(value, path) {
258
+ return path.split(".").reduce((v, key) => v == null ? void 0 : v[key], value);
259
+ }
260
+
261
+ // ../execution/component-runtime/src/template/testing/templateApplyContract.ts
262
+ var kit = (name) => ({
263
+ kitId: "ignored",
264
+ name,
265
+ colors: { primary: "#111111", secondary: "#222222", accent: "#f7c948", background: "#000000", text: "#ffffff" },
266
+ headingFont: { fontFamily: "Inter", fontWeight: 700 },
267
+ bodyFont: { fontFamily: "Inter", fontWeight: 400 }
268
+ });
269
+ function contractDoc() {
270
+ const doc = minimalTemplate();
271
+ doc.parameters.push({ name: "title", type: "string", required: true, default: "Hello" });
272
+ doc.composition.tracks.push({ id: "t", kind: "overlay", name: "T", contents: [{
273
+ id: "o",
274
+ kind: "overlay",
275
+ startTime: 0,
276
+ duration: 2,
277
+ source: { kind: "overlay", primitiveId: "heroText", params: { text: "{{title}}" } }
278
+ }] });
279
+ doc.brandKit = kit("Document kit");
280
+ doc.presets = { granite: { label: "Granite", values: { title: "Granite" }, brandKit: kit("Granite kit") } };
281
+ return parseTemplateDocument(doc);
282
+ }
283
+ var source = { mediaId: "m1", kind: "video", durationSec: 30 };
284
+ var SAMPLE_SHA = "b".repeat(64);
285
+ var CONTRACT_MATTE_KEY = "4aa54bdd6d0d";
286
+ function matteCase(bakeVersion, sha256) {
287
+ const doc = minimalTemplate();
288
+ doc.parameters[0] = {
289
+ name: "source",
290
+ type: "media",
291
+ kind: "video",
292
+ required: true,
293
+ sample: { url: "https://cdn.cueframe.ai/samples/contract.mp4", sha256: SAMPLE_SHA, mimeType: "video/mp4" },
294
+ prepared: { mattes: { [CONTRACT_MATTE_KEY]: { url: "https://cdn.cueframe.ai/mattes/contract.mp4", sha256: "c".repeat(64), mimeType: "video/mp4", bakeVersion } } }
295
+ };
296
+ return { doc: parseTemplateDocument(doc), values: {}, media: { source: { ...source, sha256 } } };
297
+ }
298
+ function logicalMedia(doc, composition) {
299
+ const out = structuredClone(composition);
300
+ const media = new Set(doc.parameters.filter((p) => p.type === "media").map((p) => p.name));
301
+ for (const ref of findReferences(doc)) {
302
+ if (!ref.wholeLeaf || !media.has(ref.name)) continue;
303
+ const parent = ref.path.slice(0, -1).reduce((v, k) => v?.[k], out);
304
+ const leaf = ref.path[ref.path.length - 1];
305
+ if (typeof parent?.[leaf] === "string" && parent[leaf].length > 0) parent[leaf] = `media:${ref.name}`;
306
+ }
307
+ return out;
308
+ }
309
+ function runTemplateApplyContract(harness) {
310
+ const { describe, it, expect, makeLane, kind } = harness;
311
+ const fact = contractFacts(it, harness.knownRed);
312
+ describe(`template apply contract (${kind})`, () => {
313
+ fact("contract_apply_reads_back_bound_composition", async () => {
314
+ const lane = await makeLane();
315
+ const doc = contractDoc();
316
+ await lane.apply({ doc, values: { title: "Sam" }, media: { source } });
317
+ const stored = await lane.readBack();
318
+ expect(stored && logicalMedia(doc, stored.composition)).toEqual(logicalMedia(doc, bindTemplate(doc, { title: "Sam" }, { source })));
319
+ });
320
+ fact("contract_apply_preset_kit_over_document_kit", async () => {
321
+ const lane = await makeLane();
322
+ const doc = contractDoc();
323
+ const plain = await lane.apply({ doc, values: {}, media: { source } });
324
+ const granite = await lane.apply({ doc, values: {}, media: { source }, preset: "granite" });
325
+ expect(plain.brandKit?.name).toBe("Document kit");
326
+ expect(granite.brandKit?.name).toBe("Granite kit");
327
+ if (kind === "server" || plain.brandKit?.kitId !== void 0) expect(plain.brandKit?.kitId).toBe(`template:${doc.slug}`);
328
+ if (kind === "server" || granite.brandKit?.kitId !== void 0) expect(granite.brandKit?.kitId).toBe(`template:${doc.slug}:granite`);
329
+ });
330
+ fact("contract_apply_refuses_missing_media", async () => {
331
+ const lane = await makeLane();
332
+ await expect(lane.apply({ doc: contractDoc(), values: {}, media: {} })).rejects.toMatchObject({ code: "template_values_invalid" });
333
+ });
334
+ if (kind === "server") {
335
+ const server = async () => {
336
+ const lane = await makeLane();
337
+ if (!lane.server) throw new Error(`${lane.name}: a server lane supplies lane.server`);
338
+ return { lane, server: lane.server };
339
+ };
340
+ fact("contract_apply_installs_component_once", async () => {
341
+ const { lane, server: s } = await server();
342
+ const doc = parseTemplateDocument(withComponent(contractDoc()));
343
+ await lane.apply({ doc, values: {}, media: { source } });
344
+ await lane.apply({ doc, values: {}, media: { source } });
345
+ expect(await s.readComponentVersionCount("c1")).toBe(1);
346
+ });
347
+ fact("contract_apply_refuses_differing_component", async () => {
348
+ const { lane, server: s } = await server();
349
+ await s.seedComponent("c1", "export default () => 1;");
350
+ const doc = parseTemplateDocument(withComponent(contractDoc()));
351
+ await expect(lane.apply({ doc, values: {}, media: { source } })).rejects.toMatchObject({ code: "template_component_conflict" });
352
+ expect(await s.readComponentVersionCount("c1")).toBe(1);
353
+ expect(await lane.readBack()).toBe(null);
354
+ });
355
+ fact("contract_apply_brandKitId_over_both_kits", async () => {
356
+ const { lane, server: s } = await server();
357
+ const brandKitId = await s.seedBrandKit("Org kit");
358
+ const applied = await lane.apply({ doc: contractDoc(), values: {}, media: { source }, preset: "granite", brandKitId });
359
+ expect(applied.brandKit?.name).toBe("Org kit");
360
+ });
361
+ }
362
+ if (kind === "desktop") {
363
+ fact("contract_apply_refuses_stale_matte", async () => {
364
+ const lane = await makeLane();
365
+ await expect(lane.apply(matteCase(`stale-${CURRENT_MATTE_BAKE_VERSION}`, SAMPLE_SHA))).rejects.toThrow(/bakeVersion/);
366
+ });
367
+ fact("contract_apply_matte_only_on_its_sample", async () => {
368
+ const lane = await makeLane();
369
+ expect((await lane.apply(matteCase(CURRENT_MATTE_BAKE_VERSION, SAMPLE_SHA))).mattes).toEqual([CONTRACT_MATTE_KEY]);
370
+ expect((await lane.apply(matteCase(CURRENT_MATTE_BAKE_VERSION, "d".repeat(64)))).mattes ?? []).toEqual([]);
371
+ });
372
+ }
373
+ });
374
+ }
375
+ export {
376
+ CONTRACT_MATTE_KEY,
377
+ TEMPLATE_BINDING_FIXTURES,
378
+ minimalTemplate,
379
+ readFixturePath,
380
+ runTemplateApplyContract,
381
+ sceneWithImageSlot,
382
+ withComponent
383
+ };
@@ -0,0 +1 @@
1
+ export * from "../_members/component-runtime/template/index.js";
@@ -0,0 +1,251 @@
1
+ import {
2
+ MATTE_KEY,
3
+ PRESET_NAME,
4
+ TEMPLATE_MAX_BYTES,
5
+ TemplateDocumentSchema,
6
+ TemplateError,
7
+ TemplateParameterSchema,
8
+ bindTemplate,
9
+ checkReferences,
10
+ coerceParameterValue,
11
+ findReferences,
12
+ parseTemplateDocument
13
+ } from "../chunk-NECN7TT4.js";
14
+ import "../chunk-CEO47DIE.js";
15
+ import "../chunk-BZVOCVQV.js";
16
+ import "../chunk-ZCEYEIRB.js";
17
+ import "../chunk-6KZCXAYL.js";
18
+ import "../chunk-AFUITAH6.js";
19
+ import "../chunk-WPZKOVYF.js";
20
+ import "../chunk-B7J5UUUV.js";
21
+ import "../chunk-EQH37KNZ.js";
22
+ import "../chunk-WREYUH2E.js";
23
+ import {
24
+ CURRENT_MATTE_BAKE_VERSION
25
+ } from "../chunk-IVFMOHAC.js";
26
+ import "../chunk-DKBFAQCW.js";
27
+ import "../chunk-ILO4NEZ3.js";
28
+ import "../chunk-XQGQ5EFS.js";
29
+ import "../chunk-VG2ND6PX.js";
30
+ import "../chunk-CL5Y6V6K.js";
31
+ import "../chunk-2L7PYYJK.js";
32
+ import "../chunk-OOL7ZUG7.js";
33
+ import "../chunk-U67V476Y.js";
34
+
35
+ // ../execution/component-runtime/src/template/extract.ts
36
+ function extractTemplate(args) {
37
+ const escape = (v) => typeof v === "string" ? v.replaceAll("{{", "\\{{") : Array.isArray(v) ? v.map(escape) : v && typeof v === "object" ? Object.fromEntries(Object.entries(v).map(([k, x]) => [k, escape(x)])) : v;
38
+ const composition = escape(args.composition);
39
+ const clips = /* @__PURE__ */ new Map();
40
+ for (const track of composition.tracks) for (const clip2 of track.contents) clips.set(clip2.id, clip2);
41
+ const clip = (id) => {
42
+ const found = clips.get(id);
43
+ if (!found) throw new Error(`clip ${id} is not in the composition`);
44
+ return found;
45
+ };
46
+ const parameters = [];
47
+ for (const m of args.mediaParams) {
48
+ const source = clip(m.clipId).source;
49
+ const holder = m.slot === void 0 ? source : source?.assets;
50
+ const key = m.slot ?? "mediaId";
51
+ if (typeof holder?.[key] !== "string" || holder[key].length === 0) {
52
+ throw new Error(`clip ${m.clipId} has no media at source.${m.slot === void 0 ? "mediaId" : `assets.${m.slot}`}`);
53
+ }
54
+ parameters.push({ name: m.name, type: "media", kind: m.kind, required: m.required ?? true, default: holder[key], ...m.label ? { label: m.label } : {} });
55
+ holder[key] = `{{${m.name}}}`;
56
+ }
57
+ for (const t of args.textParams) {
58
+ const parent = t.leafPath.slice(0, -1).reduce((v, k) => v?.[k], clip(t.clipId));
59
+ const leaf = t.leafPath[t.leafPath.length - 1];
60
+ if (parent == null || !(leaf in parent)) throw new Error(`clip ${t.clipId} has no leaf ${t.leafPath.join(".")}`);
61
+ parameters.push({
62
+ name: t.name,
63
+ type: t.type,
64
+ required: t.required,
65
+ default: t.default ?? parent[leaf],
66
+ ...t.options ? { options: t.options } : {},
67
+ ...t.label ? { label: t.label } : {},
68
+ ...t.min !== void 0 ? { min: t.min } : {},
69
+ ...t.max !== void 0 ? { max: t.max } : {}
70
+ });
71
+ parent[leaf] = `{{${t.name}}}`;
72
+ }
73
+ const doc = parseTemplateDocument({
74
+ v: 1,
75
+ slug: args.slug,
76
+ name: args.name,
77
+ ...args.description ? { description: args.description } : {},
78
+ composition,
79
+ parameters,
80
+ components: args.components
81
+ });
82
+ const { misplaced, mediaSiteErrors } = checkReferences(doc);
83
+ if (misplaced.length || mediaSiteErrors.length) {
84
+ throw new TemplateError("template_values_invalid", [...misplaced.map((m) => `reference outside a string leaf: ${m}`), ...mediaSiteErrors].join("; "));
85
+ }
86
+ return doc;
87
+ }
88
+
89
+ // ../execution/component-runtime/src/template/checks.ts
90
+ var TEMPLATE_PROBES = Object.freeze([
91
+ { name: "red", rgb: [230, 40, 40] },
92
+ { name: "green", rgb: [40, 200, 60] },
93
+ { name: "blue", rgb: [40, 80, 230] },
94
+ { name: "yellow", rgb: [240, 220, 40] },
95
+ { name: "magenta", rgb: [220, 40, 220] },
96
+ { name: "cyan", rgb: [40, 210, 220] },
97
+ { name: "orange", rgb: [245, 140, 30] },
98
+ { name: "violet", rgb: [130, 60, 200] }
99
+ ]);
100
+ var TEMPLATE_CHECK_LIMITS = Object.freeze({
101
+ /** A pixel matches a probe when every channel is within this distance. */
102
+ probeTolerance: 36,
103
+ /** A parameter is seen when some frame shows at least this many probe pixels, counted at full output resolution (a 20x20 patch). */
104
+ minFullResPixels: 400,
105
+ /** Below this many full-resolution probe pixels (about 64x64) the parameter is seen but flagged as barely visible. */
106
+ lowFullResPixels: 4096,
107
+ /** A pixel changed between two frames when some channel moved more than this. */
108
+ diffThreshold: 24,
109
+ /** Consecutive sampled frames that differ in fewer pixels than this count as not moving. */
110
+ stillDiff: 2e-3,
111
+ /** A frame is blank when this fraction of its pixels sits within `blankSpread` of its mean colour (a uniform frame). */
112
+ blankShare: 0.999,
113
+ blankSpread: 8,
114
+ /** More blank sampled frames than this fraction fails the template. */
115
+ blankFraction: 0.2,
116
+ /** The last-to-first change may be at most this many times the average neighbouring change. */
117
+ seamRatio: 2.5
118
+ });
119
+ function templateCheckFrames(durationInFrames, loop, stride = 5) {
120
+ if (!Number.isInteger(durationInFrames) || durationInFrames < 4) throw new Error("A template check needs at least 4 frames.");
121
+ if (!Number.isInteger(stride) || stride < 1) throw new Error("stride must be a positive integer.");
122
+ const frames = /* @__PURE__ */ new Set();
123
+ for (let f = 0; f < durationInFrames; f += stride) frames.add(f);
124
+ if (loop) for (const f of [0, 1, durationInFrames - 2, durationInFrames - 1]) frames.add(f);
125
+ return [...frames].sort((a, b) => a - b);
126
+ }
127
+ function assignTemplateProbes(parameters) {
128
+ const visual = parameters.filter((p) => p.type === "media" && (p.kind === "image" || p.kind === "video"));
129
+ if (visual.length > TEMPLATE_PROBES.length) {
130
+ throw new Error(`A template check supports at most ${TEMPLATE_PROBES.length} image or video parameters; this template has ${visual.length}.`);
131
+ }
132
+ return Object.fromEntries(visual.map((p, i) => [p.name, TEMPLATE_PROBES[i]]));
133
+ }
134
+ function assertFrame(input, frame) {
135
+ if (frame.rgba.length !== input.width * input.height * 4) {
136
+ throw new Error(`Frame ${frame.frame} has ${frame.rgba.length} bytes; expected ${input.width * input.height * 4}.`);
137
+ }
138
+ }
139
+ function probeCoverage(rgba, probe, tolerance = TEMPLATE_CHECK_LIMITS.probeTolerance) {
140
+ const [r, g, b] = probe.rgb;
141
+ let hits = 0;
142
+ for (let i = 0; i < rgba.length; i += 4) {
143
+ if (Math.abs(rgba[i] - r) <= tolerance && Math.abs(rgba[i + 1] - g) <= tolerance && Math.abs(rgba[i + 2] - b) <= tolerance) hits++;
144
+ }
145
+ return hits / (rgba.length / 4);
146
+ }
147
+ function changedFraction(a, b) {
148
+ const threshold = TEMPLATE_CHECK_LIMITS.diffThreshold;
149
+ let changed = 0;
150
+ for (let i = 0; i < a.length; i += 4) {
151
+ if (Math.abs(a[i] - b[i]) > threshold || Math.abs(a[i + 1] - b[i + 1]) > threshold || Math.abs(a[i + 2] - b[i + 2]) > threshold) changed++;
152
+ }
153
+ return changed / (a.length / 4);
154
+ }
155
+ function isBlankFrame(rgba) {
156
+ const n = rgba.length / 4;
157
+ let r = 0;
158
+ let g = 0;
159
+ let b = 0;
160
+ for (let i = 0; i < rgba.length; i += 4) {
161
+ r += rgba[i];
162
+ g += rgba[i + 1];
163
+ b += rgba[i + 2];
164
+ }
165
+ r /= n;
166
+ g /= n;
167
+ b /= n;
168
+ const spread = TEMPLATE_CHECK_LIMITS.blankSpread;
169
+ let near = 0;
170
+ for (let i = 0; i < rgba.length; i += 4) {
171
+ if (Math.abs(rgba[i] - r) <= spread && Math.abs(rgba[i + 1] - g) <= spread && Math.abs(rgba[i + 2] - b) <= spread) near++;
172
+ }
173
+ return near / n >= TEMPLATE_CHECK_LIMITS.blankShare;
174
+ }
175
+ function analyzeTemplateFrames(input) {
176
+ if (input.frames.length < 2) throw new Error("A template check needs at least two frames.");
177
+ if (!(input.scale > 0 && input.scale <= 1)) throw new Error("scale must be within (0, 1].");
178
+ const frames = [...input.frames].sort((a, b) => a.frame - b.frame);
179
+ for (const frame of frames) assertFrame(input, frame);
180
+ const byFrame = new Map(frames.map((f) => [f.frame, f.rgba]));
181
+ const failures = [];
182
+ const warnings = [];
183
+ const pixels = input.width * input.height;
184
+ const toFullRes = (coverage) => coverage * pixels / (input.scale * input.scale);
185
+ const slots = {};
186
+ for (const [name, probe] of Object.entries(input.slots)) {
187
+ let peak = 0;
188
+ let seenFrames = 0;
189
+ for (const frame of frames) {
190
+ const coverage = probeCoverage(frame.rgba, probe);
191
+ peak = Math.max(peak, coverage);
192
+ if (toFullRes(coverage) >= TEMPLATE_CHECK_LIMITS.minFullResPixels) seenFrames++;
193
+ }
194
+ const peakFullResPixels = Math.round(toFullRes(peak));
195
+ const seen = peakFullResPixels >= TEMPLATE_CHECK_LIMITS.minFullResPixels;
196
+ slots[name] = { seen, peakCoverage: peak, peakFullResPixels, framesSeen: seenFrames };
197
+ const percent = (peak * 100).toFixed(2);
198
+ if (!seen) failures.push(`Media parameter ${name} never appears (peak ${peakFullResPixels} px, ${percent}% of the frame).`);
199
+ else if (peakFullResPixels < TEMPLATE_CHECK_LIMITS.lowFullResPixels) warnings.push(`Media parameter ${name} is barely visible (peak ${peakFullResPixels} px, ${percent}% of the frame).`);
200
+ }
201
+ const blank = frames.filter((f) => isBlankFrame(f.rgba)).length;
202
+ const blankFraction = blank / frames.length;
203
+ if (blankFraction > TEMPLATE_CHECK_LIMITS.blankFraction) {
204
+ failures.push(`${Math.round(blankFraction * 100)}% of sampled frames are blank.`);
205
+ }
206
+ let still = true;
207
+ for (let i = 1; i < frames.length; i++) {
208
+ if (changedFraction(frames[i - 1].rgba, frames[i].rgba) >= TEMPLATE_CHECK_LIMITS.stillDiff) {
209
+ still = false;
210
+ break;
211
+ }
212
+ }
213
+ if (still) warnings.push("Nothing moves between sampled frames.");
214
+ let seam = null;
215
+ if (input.loop) {
216
+ const last = input.durationInFrames - 1;
217
+ const needed = [0, 1, last - 1, last];
218
+ if (needed.some((f) => !byFrame.has(f))) throw new Error(`A loop check needs frames ${needed.join(", ")}.`);
219
+ const across = changedFraction(byFrame.get(last), byFrame.get(0));
220
+ const neighbours = (changedFraction(byFrame.get(last - 1), byFrame.get(last)) + changedFraction(byFrame.get(0), byFrame.get(1))) / 2;
221
+ const ratio = across === 0 ? 0 : across / Math.max(neighbours, TEMPLATE_CHECK_LIMITS.stillDiff);
222
+ seam = { ratio };
223
+ if (ratio > TEMPLATE_CHECK_LIMITS.seamRatio) {
224
+ failures.push(`The loop jumps at its seam: the last-to-first change is ${ratio.toFixed(1)}x the neighbouring frames.`);
225
+ }
226
+ }
227
+ return { slots, blankFraction, still, seam, failures, warnings };
228
+ }
229
+ export {
230
+ CURRENT_MATTE_BAKE_VERSION,
231
+ MATTE_KEY,
232
+ PRESET_NAME,
233
+ TEMPLATE_CHECK_LIMITS,
234
+ TEMPLATE_MAX_BYTES,
235
+ TEMPLATE_PROBES,
236
+ TemplateDocumentSchema,
237
+ TemplateError,
238
+ TemplateParameterSchema,
239
+ analyzeTemplateFrames,
240
+ assignTemplateProbes,
241
+ bindTemplate,
242
+ changedFraction,
243
+ checkReferences,
244
+ coerceParameterValue,
245
+ extractTemplate,
246
+ findReferences,
247
+ isBlankFrame,
248
+ parseTemplateDocument,
249
+ probeCoverage,
250
+ templateCheckFrames
251
+ };