@nodaro/shared 3.30.0 → 3.32.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.
- package/README.md +17 -0
- package/dist/chunk-2NIQO2J3.cjs +54 -0
- package/dist/chunk-2NIQO2J3.cjs.map +1 -0
- package/dist/chunk-2OJIVO7R.cjs +32 -0
- package/dist/chunk-2OJIVO7R.cjs.map +1 -0
- package/dist/chunk-2RF4Z7KG.cjs +803 -0
- package/dist/chunk-2RF4Z7KG.cjs.map +1 -0
- package/dist/chunk-3CUFITU7.js +1905 -0
- package/dist/chunk-3CUFITU7.js.map +1 -0
- package/dist/chunk-3RYKIUAE.js +86 -0
- package/dist/chunk-3RYKIUAE.js.map +1 -0
- package/dist/chunk-44I73CQS.cjs +194 -0
- package/dist/chunk-44I73CQS.cjs.map +1 -0
- package/dist/chunk-5AUSSJIM.cjs +3372 -0
- package/dist/chunk-5AUSSJIM.cjs.map +1 -0
- package/dist/chunk-5PC6JBGJ.cjs +1419 -0
- package/dist/chunk-5PC6JBGJ.cjs.map +1 -0
- package/dist/chunk-5RU2HCW2.js +30 -0
- package/dist/chunk-5RU2HCW2.js.map +1 -0
- package/dist/chunk-5THUHJ3E.js +46 -0
- package/dist/chunk-5THUHJ3E.js.map +1 -0
- package/dist/chunk-5U7VLG43.js +141 -0
- package/dist/chunk-5U7VLG43.js.map +1 -0
- package/dist/chunk-6DAWSVX2.cjs +103 -0
- package/dist/chunk-6DAWSVX2.cjs.map +1 -0
- package/dist/chunk-6DKDOWBL.js +1567 -0
- package/dist/chunk-6DKDOWBL.js.map +1 -0
- package/dist/chunk-6IJOPRZP.cjs +197 -0
- package/dist/chunk-6IJOPRZP.cjs.map +1 -0
- package/dist/chunk-7G7G42KS.js +86 -0
- package/dist/chunk-7G7G42KS.js.map +1 -0
- package/dist/chunk-AINCI23X.js +2171 -0
- package/dist/chunk-AINCI23X.js.map +1 -0
- package/dist/chunk-AROWPFO2.js +773 -0
- package/dist/chunk-AROWPFO2.js.map +1 -0
- package/dist/chunk-AVQK77G6.cjs +2000 -0
- package/dist/chunk-AVQK77G6.cjs.map +1 -0
- package/dist/chunk-C57NEO3X.js +3327 -0
- package/dist/chunk-C57NEO3X.js.map +1 -0
- package/dist/chunk-CK3GK34R.js +1381 -0
- package/dist/chunk-CK3GK34R.js.map +1 -0
- package/dist/chunk-E2TGXG6X.cjs +1770 -0
- package/dist/chunk-E2TGXG6X.cjs.map +1 -0
- package/dist/chunk-EK362Q45.cjs +38 -0
- package/dist/chunk-EK362Q45.cjs.map +1 -0
- package/dist/chunk-FBV5DF6D.js +95 -0
- package/dist/chunk-FBV5DF6D.js.map +1 -0
- package/dist/chunk-FG4E7MTG.cjs +4 -0
- package/dist/chunk-FG4E7MTG.cjs.map +1 -0
- package/dist/chunk-G6IIVKMO.js +26 -0
- package/dist/chunk-G6IIVKMO.js.map +1 -0
- package/dist/chunk-HGC5JNVA.cjs +1503 -0
- package/dist/chunk-HGC5JNVA.cjs.map +1 -0
- package/dist/chunk-HSHCCBIV.js +255 -0
- package/dist/chunk-HSHCCBIV.js.map +1 -0
- package/dist/chunk-IEBZHTPE.js +254 -0
- package/dist/chunk-IEBZHTPE.js.map +1 -0
- package/dist/chunk-ISJDAFKS.js +1604 -0
- package/dist/chunk-ISJDAFKS.js.map +1 -0
- package/dist/chunk-J6KHW2E5.cjs +1963 -0
- package/dist/chunk-J6KHW2E5.cjs.map +1 -0
- package/dist/chunk-J7BMO73N.cjs +114 -0
- package/dist/chunk-J7BMO73N.cjs.map +1 -0
- package/dist/chunk-JL4C5VJ7.cjs +488 -0
- package/dist/chunk-JL4C5VJ7.cjs.map +1 -0
- package/dist/chunk-JSGIEF6Z.cjs +1087 -0
- package/dist/chunk-JSGIEF6Z.cjs.map +1 -0
- package/dist/chunk-JSNV5O2F.cjs +34 -0
- package/dist/chunk-JSNV5O2F.cjs.map +1 -0
- package/dist/chunk-JWA5SGCS.js +203 -0
- package/dist/chunk-JWA5SGCS.js.map +1 -0
- package/dist/chunk-JX5YZ4DH.cjs +430 -0
- package/dist/chunk-JX5YZ4DH.cjs.map +1 -0
- package/dist/chunk-KHCBJ7KD.js +42 -0
- package/dist/chunk-KHCBJ7KD.js.map +1 -0
- package/dist/chunk-KU6S7IYV.cjs +210 -0
- package/dist/chunk-KU6S7IYV.cjs.map +1 -0
- package/dist/chunk-LKAIXWK3.js +181 -0
- package/dist/chunk-LKAIXWK3.js.map +1 -0
- package/dist/chunk-LPW3XNC2.js +471 -0
- package/dist/chunk-LPW3XNC2.js.map +1 -0
- package/dist/chunk-M36G6SRP.js +447 -0
- package/dist/chunk-M36G6SRP.js.map +1 -0
- package/dist/chunk-MRXGWL42.cjs +4 -0
- package/dist/chunk-MRXGWL42.cjs.map +1 -0
- package/dist/chunk-NB72XWXQ.cjs +54 -0
- package/dist/chunk-NB72XWXQ.cjs.map +1 -0
- package/dist/chunk-NEJ2PV4C.cjs +211 -0
- package/dist/chunk-NEJ2PV4C.cjs.map +1 -0
- package/dist/chunk-NT6IJH4L.cjs +273 -0
- package/dist/chunk-NT6IJH4L.cjs.map +1 -0
- package/dist/chunk-O5MP52U2.cjs +526 -0
- package/dist/chunk-O5MP52U2.cjs.map +1 -0
- package/dist/chunk-O7PUQLJ3.cjs +818 -0
- package/dist/chunk-O7PUQLJ3.cjs.map +1 -0
- package/dist/chunk-PQHS255G.js +1369 -0
- package/dist/chunk-PQHS255G.js.map +1 -0
- package/dist/chunk-PRYE7AZQ.cjs +1227 -0
- package/dist/chunk-PRYE7AZQ.cjs.map +1 -0
- package/dist/chunk-Q4CDQ2KO.js +21 -0
- package/dist/chunk-Q4CDQ2KO.js.map +1 -0
- package/dist/chunk-QELDJGDK.cjs +1714 -0
- package/dist/chunk-QELDJGDK.cjs.map +1 -0
- package/dist/chunk-QJRP44ZO.js +769 -0
- package/dist/chunk-QJRP44ZO.js.map +1 -0
- package/dist/chunk-QNGNOU4Z.js +29 -0
- package/dist/chunk-QNGNOU4Z.js.map +1 -0
- package/dist/chunk-RJL7RCEM.cjs +159 -0
- package/dist/chunk-RJL7RCEM.cjs.map +1 -0
- package/dist/chunk-RN3RMBJZ.js +1164 -0
- package/dist/chunk-RN3RMBJZ.js.map +1 -0
- package/dist/chunk-S5DMKUWK.cjs +1273 -0
- package/dist/chunk-S5DMKUWK.cjs.map +1 -0
- package/dist/chunk-SES6GDBQ.cjs +624 -0
- package/dist/chunk-SES6GDBQ.cjs.map +1 -0
- package/dist/chunk-TNPDV7I4.cjs +2346 -0
- package/dist/chunk-TNPDV7I4.cjs.map +1 -0
- package/dist/chunk-TZBIY5C3.js +187 -0
- package/dist/chunk-TZBIY5C3.js.map +1 -0
- package/dist/chunk-TZE673G6.js +3 -0
- package/dist/chunk-TZE673G6.js.map +1 -0
- package/dist/chunk-ULXI7A6Q.cjs +1047 -0
- package/dist/chunk-ULXI7A6Q.cjs.map +1 -0
- package/dist/chunk-VIWSWVAW.js +1782 -0
- package/dist/chunk-VIWSWVAW.js.map +1 -0
- package/dist/chunk-VWGNPMJZ.cjs +19 -0
- package/dist/chunk-VWGNPMJZ.cjs.map +1 -0
- package/dist/chunk-WDIBOWAA.js +1054 -0
- package/dist/chunk-WDIBOWAA.js.map +1 -0
- package/dist/chunk-WNG7HRVA.cjs +25 -0
- package/dist/chunk-WNG7HRVA.cjs.map +1 -0
- package/dist/chunk-WNVQ3SMB.cjs +96 -0
- package/dist/chunk-WNVQ3SMB.cjs.map +1 -0
- package/dist/chunk-WRSWH7US.cjs +285 -0
- package/dist/chunk-WRSWH7US.cjs.map +1 -0
- package/dist/chunk-XAMC4S53.js +17 -0
- package/dist/chunk-XAMC4S53.js.map +1 -0
- package/dist/chunk-XNISPHTZ.js +1039 -0
- package/dist/chunk-XNISPHTZ.js.map +1 -0
- package/dist/chunk-Y2PM3FFL.js +3 -0
- package/dist/chunk-Y2PM3FFL.js.map +1 -0
- package/dist/chunk-YBPBK5KI.js +1030 -0
- package/dist/chunk-YBPBK5KI.js.map +1 -0
- package/dist/chunk-YHRG7UOC.js +31 -0
- package/dist/chunk-YHRG7UOC.js.map +1 -0
- package/dist/chunk-YWNYGYI7.cjs +31 -0
- package/dist/chunk-YWNYGYI7.cjs.map +1 -0
- package/dist/chunk-YYV35XOS.js +122 -0
- package/dist/chunk-YYV35XOS.js.map +1 -0
- package/dist/chunk-Z2OL5AJD.cjs +133 -0
- package/dist/chunk-Z2OL5AJD.cjs.map +1 -0
- package/dist/chunk-Z4AZW6FY.js +920 -0
- package/dist/chunk-Z4AZW6FY.js.map +1 -0
- package/dist/chunk-ZDFHA2EC.js +572 -0
- package/dist/chunk-ZDFHA2EC.js.map +1 -0
- package/dist/chunk-ZNZDQAXN.js +175 -0
- package/dist/chunk-ZNZDQAXN.js.map +1 -0
- package/dist/chunk-ZRL2UFTH.cjs +1073 -0
- package/dist/chunk-ZRL2UFTH.cjs.map +1 -0
- package/dist/chunk-ZT77RY6R.js +404 -0
- package/dist/chunk-ZT77RY6R.js.map +1 -0
- package/dist/entries/apps.cjs +155 -0
- package/dist/entries/apps.cjs.map +1 -0
- package/dist/entries/apps.d.cts +283 -0
- package/dist/entries/apps.d.ts +283 -0
- package/dist/entries/apps.js +10 -0
- package/dist/entries/apps.js.map +1 -0
- package/dist/entries/captions.cjs +124 -0
- package/dist/entries/captions.cjs.map +1 -0
- package/dist/entries/captions.d.cts +354 -0
- package/dist/entries/captions.d.ts +354 -0
- package/dist/entries/captions.js +3 -0
- package/dist/entries/captions.js.map +1 -0
- package/dist/entries/catalogs.cjs +165 -0
- package/dist/entries/catalogs.cjs.map +1 -0
- package/dist/entries/catalogs.d.cts +385 -0
- package/dist/entries/catalogs.d.ts +385 -0
- package/dist/entries/catalogs.js +4 -0
- package/dist/entries/catalogs.js.map +1 -0
- package/dist/entries/credits.cjs +592 -0
- package/dist/entries/credits.cjs.map +1 -0
- package/dist/entries/credits.d.cts +1429 -0
- package/dist/entries/credits.d.ts +1429 -0
- package/dist/entries/credits.js +11 -0
- package/dist/entries/credits.js.map +1 -0
- package/dist/entries/edl.cjs +409 -0
- package/dist/entries/edl.cjs.map +1 -0
- package/dist/entries/edl.d.cts +1199 -0
- package/dist/entries/edl.d.ts +1199 -0
- package/dist/entries/edl.js +4 -0
- package/dist/entries/edl.js.map +1 -0
- package/dist/entries/entities.cjs +530 -0
- package/dist/entries/entities.cjs.map +1 -0
- package/dist/entries/entities.d.cts +1371 -0
- package/dist/entries/entities.d.ts +1371 -0
- package/dist/entries/entities.js +5 -0
- package/dist/entries/entities.js.map +1 -0
- package/dist/entries/i18n.cjs +48 -0
- package/dist/entries/i18n.cjs.map +1 -0
- package/dist/entries/i18n.d.cts +69 -0
- package/dist/entries/i18n.d.ts +69 -0
- package/dist/entries/i18n.js +3 -0
- package/dist/entries/i18n.js.map +1 -0
- package/dist/entries/llm-models.cjs +177 -0
- package/dist/entries/llm-models.cjs.map +1 -0
- package/dist/entries/llm-models.d.cts +435 -0
- package/dist/entries/llm-models.d.ts +435 -0
- package/dist/entries/llm-models.js +4 -0
- package/dist/entries/llm-models.js.map +1 -0
- package/dist/entries/media.cjs +335 -0
- package/dist/entries/media.cjs.map +1 -0
- package/dist/entries/media.d.cts +518 -0
- package/dist/entries/media.d.ts +518 -0
- package/dist/entries/media.js +6 -0
- package/dist/entries/media.js.map +1 -0
- package/dist/entries/model-catalog.cjs +247 -0
- package/dist/entries/model-catalog.cjs.map +1 -0
- package/dist/entries/model-catalog.d.cts +202 -0
- package/dist/entries/model-catalog.d.ts +202 -0
- package/dist/entries/model-catalog.js +6 -0
- package/dist/entries/model-catalog.js.map +1 -0
- package/dist/entries/models.cjs +833 -0
- package/dist/entries/models.cjs.map +1 -0
- package/dist/entries/models.d.cts +287 -0
- package/dist/entries/models.d.ts +287 -0
- package/dist/entries/models.js +8 -0
- package/dist/entries/models.js.map +1 -0
- package/dist/entries/nodes.cjs +789 -0
- package/dist/entries/nodes.cjs.map +1 -0
- package/dist/entries/nodes.d.cts +1600 -0
- package/dist/entries/nodes.d.ts +1600 -0
- package/dist/entries/nodes.js +16 -0
- package/dist/entries/nodes.js.map +1 -0
- package/dist/entries/organizations.cjs +80 -0
- package/dist/entries/organizations.cjs.map +1 -0
- package/dist/entries/organizations.d.cts +466 -0
- package/dist/entries/organizations.d.ts +466 -0
- package/dist/entries/organizations.js +3 -0
- package/dist/entries/organizations.js.map +1 -0
- package/dist/entries/pipeline.cjs +594 -0
- package/dist/entries/pipeline.cjs.map +1 -0
- package/dist/entries/pipeline.d.cts +2617 -0
- package/dist/entries/pipeline.d.ts +2617 -0
- package/dist/entries/pipeline.js +5 -0
- package/dist/entries/pipeline.js.map +1 -0
- package/dist/entries/scene3d.cjs +704 -0
- package/dist/entries/scene3d.cjs.map +1 -0
- package/dist/entries/scene3d.d.cts +4284 -0
- package/dist/entries/scene3d.d.ts +4284 -0
- package/dist/entries/scene3d.js +3 -0
- package/dist/entries/scene3d.js.map +1 -0
- package/dist/entries/social.cjs +714 -0
- package/dist/entries/social.cjs.map +1 -0
- package/dist/entries/social.d.cts +1366 -0
- package/dist/entries/social.d.ts +1366 -0
- package/dist/entries/social.js +5 -0
- package/dist/entries/social.js.map +1 -0
- package/dist/entries/types.cjs +13 -0
- package/dist/entries/types.cjs.map +1 -0
- package/dist/entries/types.d.cts +162 -0
- package/dist/entries/types.d.ts +162 -0
- package/dist/entries/types.js +4 -0
- package/dist/entries/types.js.map +1 -0
- package/dist/entries/ugc.cjs +279 -0
- package/dist/entries/ugc.cjs.map +1 -0
- package/dist/entries/ugc.d.cts +575 -0
- package/dist/entries/ugc.d.ts +575 -0
- package/dist/entries/ugc.js +6 -0
- package/dist/entries/ugc.js.map +1 -0
- package/dist/entries/video.cjs +549 -0
- package/dist/entries/video.cjs.map +1 -0
- package/dist/entries/video.d.cts +1791 -0
- package/dist/entries/video.d.ts +1791 -0
- package/dist/entries/video.js +8 -0
- package/dist/entries/video.js.map +1 -0
- package/dist/entries/workflow.cjs +574 -0
- package/dist/entries/workflow.cjs.map +1 -0
- package/dist/entries/workflow.d.cts +1733 -0
- package/dist/entries/workflow.d.ts +1733 -0
- package/dist/entries/workflow.js +5 -0
- package/dist/entries/workflow.js.map +1 -0
- package/dist/fan-out-meta-Bu6VyXcZ.d.cts +19 -0
- package/dist/fan-out-meta-Bu6VyXcZ.d.ts +19 -0
- package/dist/gemini-omni-voices-zeRXxSbZ.d.cts +174 -0
- package/dist/gemini-omni-voices-zeRXxSbZ.d.ts +174 -0
- package/dist/image-overlay-layers-CyBfRhxJ.d.cts +208 -0
- package/dist/image-overlay-layers-CyBfRhxJ.d.ts +208 -0
- package/dist/index.cjs +7731 -26444
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -23733
- package/dist/index.d.ts +32 -23733
- package/dist/index.js +40 -24641
- package/dist/index.js.map +1 -1
- package/dist/model-catalog-flJYaa-g.d.cts +561 -0
- package/dist/model-catalog-flJYaa-g.d.ts +561 -0
- package/dist/presentation-types-0ENOCjoj.d.cts +61 -0
- package/dist/presentation-types-0ENOCjoj.d.ts +61 -0
- package/dist/presentation-utils-BIqiCzSA.d.cts +90 -0
- package/dist/presentation-utils-BdiObtwq.d.ts +90 -0
- package/dist/scene-node-types-DjenYFLO.d.cts +1949 -0
- package/dist/scene-node-types-DjenYFLO.d.ts +1949 -0
- package/dist/supported-fonts-CRoF1gOy.d.cts +16 -0
- package/dist/supported-fonts-CRoF1gOy.d.ts +16 -0
- package/dist/types-BRlFPEru.d.cts +511 -0
- package/dist/types-BRlFPEru.d.ts +511 -0
- package/dist/types-DffyGSy5.d.cts +67 -0
- package/dist/types-DffyGSy5.d.ts +67 -0
- package/package.json +102 -1
- package/src/__tests__/add-captions-plan.test.ts +6 -2
- package/src/__tests__/caption-edge-dash.test.ts +23 -0
- package/src/__tests__/entity-image-handle.test.ts +61 -1
- package/src/__tests__/fixtures/root-exports.baseline.json +4625 -0
- package/src/__tests__/input-field-extra-keys.test.ts +1 -0
- package/src/__tests__/json-kinds.test.ts +10 -0
- package/src/__tests__/model-seed-capability.test.ts +34 -0
- package/src/__tests__/no-internal-imports.test.ts +1 -1
- package/src/__tests__/node-aspect-ratio.test.ts +25 -0
- package/src/__tests__/node-preset-extract.test.ts +8 -0
- package/src/__tests__/node-run-routes.test.ts +63 -0
- package/src/__tests__/node-runtime-keys.test.ts +70 -0
- package/src/__tests__/package-entries.test.ts +50 -0
- package/src/__tests__/pitch-tempo-pricing.test.ts +21 -0
- package/src/__tests__/presentation-utils.test.ts +14 -0
- package/src/__tests__/preview-gate-use-case.test.ts +151 -0
- package/src/__tests__/producer-types.test.ts +15 -0
- package/src/__tests__/run-continuation.test.ts +7 -1
- package/src/__tests__/seedance-draft.test.ts +74 -0
- package/src/__tests__/site-capture-node.test.ts +58 -0
- package/src/__tests__/ugc-clip-saved-list.test.ts +19 -0
- package/src/__tests__/ugc-lane-wires.test.ts +228 -0
- package/src/__tests__/ugc-node-wires.test.ts +606 -0
- package/src/__tests__/ugc-run-state.test.ts +85 -7
- package/src/__tests__/video-analysis-catalog-sync.test.ts +1 -1
- package/src/__tests__/video-analysis-pricing.test.ts +6 -6
- package/src/__tests__/voice-changer-pro-quote.test.ts +79 -0
- package/src/__tests__/workflow-export-strip.test.ts +14 -0
- package/src/add-captions-plan.ts +9 -3
- package/src/caption-edge-dash.ts +33 -0
- package/src/credit-estimators/index.ts +22 -1
- package/src/credit-estimators/pitch-tempo.ts +15 -1
- package/src/credit-estimators/speech.ts +72 -4
- package/src/credit-estimators/unit-quote.ts +52 -0
- package/src/credit-estimators/video-sfx.ts +15 -0
- package/src/credit-estimators/voice-changer-pro-quote.ts +138 -0
- package/src/entity-image-handle.ts +50 -1
- package/src/entries/apps.ts +63 -0
- package/src/entries/captions.ts +34 -0
- package/src/entries/catalogs.ts +65 -0
- package/src/entries/credits.ts +104 -0
- package/src/entries/edl.ts +42 -0
- package/src/entries/entities.ts +144 -0
- package/src/entries/i18n.ts +31 -0
- package/src/entries/llm-models.ts +63 -0
- package/src/entries/media.ts +36 -0
- package/src/entries/model-catalog.ts +89 -0
- package/src/entries/models.ts +266 -0
- package/src/entries/nodes.ts +245 -0
- package/src/entries/organizations.ts +9 -0
- package/src/entries/pipeline.ts +43 -0
- package/src/entries/scene3d.ts +27 -0
- package/src/entries/social.ts +297 -0
- package/src/entries/types.ts +26 -0
- package/src/entries/ugc.ts +14 -0
- package/src/entries/video.ts +59 -0
- package/src/entries/workflow.ts +172 -0
- package/src/fan-out-rows.ts +2 -0
- package/src/index.ts +25 -1838
- package/src/json-kinds.ts +13 -0
- package/src/model-catalog.ts +97 -36
- package/src/model-constants.ts +3 -0
- package/src/node-mappable-fields.ts +1 -0
- package/src/node-preset-export.ts +2 -2
- package/src/node-preset-extract.ts +6 -4
- package/src/node-run-routes.ts +78 -0
- package/src/node-runtime-keys.ts +50 -1
- package/src/normalize-node-params.ts +30 -0
- package/src/presentation-utils.ts +8 -0
- package/src/preview-gate.ts +92 -14
- package/src/producer-types.ts +26 -2
- package/src/run-continuation.ts +21 -0
- package/src/seedance-draft.ts +64 -0
- package/src/site-capture-node.ts +82 -0
- package/src/social-post.ts +13 -0
- package/src/ugc-lane-wires.ts +246 -0
- package/src/ugc-node-wires.ts +653 -0
- package/src/ugc-run-state.ts +65 -8
- package/src/video-analysis-pricing.ts +31 -29
- package/src/workflow-export.ts +3 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/combine-transitions.ts","../src/edl-multicam.ts","../src/speaker-layouts.ts","../src/edl.ts","../src/edit-plan-review.ts"],"names":[],"mappings":";AAiCO,IAAM,mBAAA,GAAoD;AAAA;AAAA,EAE/D;AAAA,IACE,EAAA,EAAI,KAAA;AAAA,IACJ,KAAA,EAAO,KAAA;AAAA,IACP,KAAA,EAAO,IAAA;AAAA,IACP,KAAA,EAAO,OAAA;AAAA,IACP,MAAA,EAAQ,IAAA;AAAA,IACR,WAAA,EAAa;AAAA,GACf;AAAA,EACA;AAAA,IACE,EAAA,EAAI,MAAA;AAAA,IACJ,KAAA,EAAO,MAAA;AAAA,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,KAAU,aAAA,CAAc,IAAI,CAAA;AACpG,EAAA,OAAO,cAAA,GAAiB,EAAE,aAAA,EAAe,IAAA,KAAS,EAAE,aAAA,EAAe,IAAA,EAAM,SAAA,EAAW,MAAA,EAAU;AAChG;AASO,SAAS,iBAAA,CAAkB,WAAoB,IAAA,EAA8B;AAClF,EAAA,MAAM,KAAA,GAAQ,aAAA,CAAc,SAAA,EAAW,IAAI,CAAA;AAC3C,EAAA,IAAI,KAAA,CAAM,MAAA,KAAW,MAAA,EAAQ,OAAO,EAAE,EAAA,EAAI,KAAA,EAAO,MAAA,EAAQ,CAAC,kBAAkB,CAAA,EAAG,QAAA,EAAU,EAAC,EAAE;AAC5F,EAAA,IAAI,KAAA,CAAM,MAAA,KAAW,SAAA,EAAW,OAAO,EAAE,EAAA,EAAI,KAAA,EAAO,MAAA,EAAQ,CAAC,KAAA,CAAM,KAAK,CAAA,EAAG,QAAA,EAAU,EAAC,EAAE;AACxF,EAAA,IAAI,KAAA,CAAM,MAAA,CAAO,IAAA,KAAS,OAAA,EAAS,OAAO,EAAE,EAAA,EAAI,IAAA,EAAM,MAAA,EAAQ,EAAC,EAAG,QAAA,EAAU,EAAC,EAAE;AAC/E,EAAA,MAAM,QAAA,GAAW,qBAAA,CAAsB,IAAA,EAAM,SAAS,CAAA,CAAE,IAAA;AACxD,EAAA,OAAO,YAAY,QAAQ,CAAA;AAC7B","file":"chunk-PQHS255G.js","sourcesContent":["/**\n * Catalog of every transition the combine-videos node supports.\n *\n * `id` is the stable identifier used in workflow JSON, Zod validation, and\n * the preview-CSS class suffix. `xfade` is the FFmpeg `xfade transition=`\n * name (or `null` for `cut`, which goes through the concat demuxer).\n *\n * The 5 original ids (`cut`, `fade`, `dissolve`, `dip-to-black`,\n * `dip-to-white`) are kept for back-compat with workflows saved before the\n * picker shipped.\n */\n\nexport type CombineTransitionGroup =\n | \"fades\"\n | \"wipes\"\n | \"slides\"\n | \"shapes\"\n | \"smooth\"\n | \"slices\"\n | \"reveals\"\n | \"covers\"\n | \"effects\"\n\nexport interface CombineTransition {\n readonly id: string\n readonly label: string\n /** FFmpeg `xfade transition=` name. `null` = special path (concat demuxer for cut). */\n readonly xfade: string | null\n readonly group: CombineTransitionGroup\n readonly common?: boolean\n readonly description: string\n}\n\nexport const COMBINE_TRANSITIONS: readonly CombineTransition[] = [\n // ===== Fades & Dips =====\n {\n id: \"cut\",\n label: \"Cut\",\n xfade: null,\n group: \"fades\",\n common: true,\n description: \"Hard cut — instant switch with no blend. Default, fastest.\",\n },\n {\n id: \"fade\",\n label: \"Fade\",\n xfade: \"fade\",\n group: \"fades\",\n common: true,\n description: \"Smooth alpha cross-fade between two clips. Classic clean blend.\",\n },\n {\n id: \"dissolve\",\n label: \"Dissolve\",\n xfade: \"dissolve\",\n group: \"fades\",\n common: true,\n description: \"Random-pixel dissolve. Grainy, organic feel — good for memory beats.\",\n },\n {\n id: \"dip-to-black\",\n label: \"Dip to Black\",\n xfade: \"fadeblack\",\n group: \"fades\",\n common: true,\n description: \"Fade through black. Use between scenes or time jumps.\",\n },\n {\n id: \"dip-to-white\",\n label: \"Dip to White\",\n xfade: \"fadewhite\",\n group: \"fades\",\n common: true,\n description: \"Fade through white. Bright, ethereal — flashbacks, dream beats.\",\n },\n {\n id: \"fadegrays\",\n label: \"Fade through Greys\",\n xfade: \"fadegrays\",\n group: \"fades\",\n description: \"Desaturates to grey at the midpoint, then re-saturates into B.\",\n },\n\n // ===== Wipes =====\n {\n id: \"wipe-left\",\n label: \"Wipe Left\",\n xfade: \"wipeleft\",\n group: \"wipes\",\n common: true,\n description: \"Hard edge sweeps from right to left, revealing the next clip.\",\n },\n {\n id: \"wipe-right\",\n label: \"Wipe Right\",\n xfade: \"wiperight\",\n group: \"wipes\",\n common: true,\n description: \"Hard edge sweeps from left to right.\",\n },\n {\n id: \"wipe-up\",\n label: \"Wipe Up\",\n xfade: \"wipeup\",\n group: \"wipes\",\n description: \"Edge sweeps from bottom to top.\",\n },\n {\n id: \"wipe-down\",\n label: \"Wipe Down\",\n xfade: \"wipedown\",\n group: \"wipes\",\n description: \"Edge sweeps from top to bottom.\",\n },\n {\n id: \"wipe-tl\",\n label: \"Wipe Top-Left\",\n xfade: \"wipetl\",\n group: \"wipes\",\n description: \"Diagonal wipe from top-left corner.\",\n },\n {\n id: \"wipe-tr\",\n label: \"Wipe Top-Right\",\n xfade: \"wipetr\",\n group: \"wipes\",\n description: \"Diagonal wipe from top-right corner.\",\n },\n {\n id: \"wipe-bl\",\n label: \"Wipe Bottom-Left\",\n xfade: \"wipebl\",\n group: \"wipes\",\n description: \"Diagonal wipe from bottom-left corner.\",\n },\n {\n id: \"wipe-br\",\n label: \"Wipe Bottom-Right\",\n xfade: \"wipebr\",\n group: \"wipes\",\n description: \"Diagonal wipe from bottom-right corner.\",\n },\n\n // ===== Slides =====\n {\n id: \"slide-left\",\n label: \"Slide Left\",\n xfade: \"slideleft\",\n group: \"slides\",\n common: true,\n description: \"Next clip pushes A off-screen, sliding in from the right.\",\n },\n {\n id: \"slide-right\",\n label: \"Slide Right\",\n xfade: \"slideright\",\n group: \"slides\",\n common: true,\n description: \"Next clip pushes A off-screen, sliding in from the left.\",\n },\n {\n id: \"slide-up\",\n label: \"Slide Up\",\n xfade: \"slideup\",\n group: \"slides\",\n description: \"Next clip pushes A upward off-screen.\",\n },\n {\n id: \"slide-down\",\n label: \"Slide Down\",\n xfade: \"slidedown\",\n group: \"slides\",\n description: \"Next clip pushes A downward off-screen.\",\n },\n\n // ===== Smooth (gradient-edge wipes) =====\n {\n id: \"smooth-left\",\n label: \"Smooth Left\",\n xfade: \"smoothleft\",\n group: \"smooth\",\n description: \"Soft-edged wipe sweeping leftward — gentler than a hard wipe.\",\n },\n {\n id: \"smooth-right\",\n label: \"Smooth Right\",\n xfade: \"smoothright\",\n group: \"smooth\",\n description: \"Soft-edged wipe sweeping rightward.\",\n },\n {\n id: \"smooth-up\",\n label: \"Smooth Up\",\n xfade: \"smoothup\",\n group: \"smooth\",\n description: \"Soft-edged wipe sweeping upward.\",\n },\n {\n id: \"smooth-down\",\n label: \"Smooth Down\",\n xfade: \"smoothdown\",\n group: \"smooth\",\n description: \"Soft-edged wipe sweeping downward.\",\n },\n\n // ===== Shapes (circles, rectangles, openings) =====\n {\n id: \"circle-open\",\n label: \"Circle Open\",\n xfade: \"circleopen\",\n group: \"shapes\",\n common: true,\n description: \"Circular iris opens to reveal next clip from the center.\",\n },\n {\n id: \"circle-close\",\n label: \"Circle Close\",\n xfade: \"circleclose\",\n group: \"shapes\",\n description: \"Circular iris closes inward over the current clip.\",\n },\n {\n id: \"circle-crop\",\n label: \"Circle Crop\",\n xfade: \"circlecrop\",\n group: \"shapes\",\n description: \"Circular mask crops A then expands as B.\",\n },\n {\n id: \"rect-crop\",\n label: \"Rectangle Crop\",\n xfade: \"rectcrop\",\n group: \"shapes\",\n description: \"Rectangular mask crops A then expands as B.\",\n },\n {\n id: \"horz-open\",\n label: \"Horizontal Open\",\n xfade: \"horzopen\",\n group: \"shapes\",\n description: \"Two horizontal bars split apart from the center to reveal B.\",\n },\n {\n id: \"horz-close\",\n label: \"Horizontal Close\",\n xfade: \"horzclose\",\n group: \"shapes\",\n description: \"Top and bottom bars meet at the center.\",\n },\n {\n id: \"vert-open\",\n label: \"Vertical Open\",\n xfade: \"vertopen\",\n group: \"shapes\",\n description: \"Two vertical bars split apart from the center to reveal B.\",\n },\n {\n id: \"vert-close\",\n label: \"Vertical Close\",\n xfade: \"vertclose\",\n group: \"shapes\",\n description: \"Left and right bars meet at the center.\",\n },\n {\n id: \"diag-tl\",\n label: \"Diagonal Top-Left\",\n xfade: \"diagtl\",\n group: \"shapes\",\n description: \"Diagonal slash sweep originating top-left.\",\n },\n {\n id: \"diag-tr\",\n label: \"Diagonal Top-Right\",\n xfade: \"diagtr\",\n group: \"shapes\",\n description: \"Diagonal slash sweep originating top-right.\",\n },\n {\n id: \"diag-bl\",\n label: \"Diagonal Bottom-Left\",\n xfade: \"diagbl\",\n group: \"shapes\",\n description: \"Diagonal slash sweep originating bottom-left.\",\n },\n {\n id: \"diag-br\",\n label: \"Diagonal Bottom-Right\",\n xfade: \"diagbr\",\n group: \"shapes\",\n description: \"Diagonal slash sweep originating bottom-right.\",\n },\n\n // ===== Slices =====\n {\n id: \"hl-slice\",\n label: \"Horizontal Left Slice\",\n xfade: \"hlslice\",\n group: \"slices\",\n description: \"Horizontal strips slice in from the left.\",\n },\n {\n id: \"hr-slice\",\n label: \"Horizontal Right Slice\",\n xfade: \"hrslice\",\n group: \"slices\",\n description: \"Horizontal strips slice in from the right.\",\n },\n {\n id: \"vu-slice\",\n label: \"Vertical Up Slice\",\n xfade: \"vuslice\",\n group: \"slices\",\n description: \"Vertical strips slice in from the bottom.\",\n },\n {\n id: \"vd-slice\",\n label: \"Vertical Down Slice\",\n xfade: \"vdslice\",\n group: \"slices\",\n description: \"Vertical strips slice in from the top.\",\n },\n\n // ===== Reveals =====\n {\n id: \"reveal-left\",\n label: \"Reveal Left\",\n xfade: \"revealleft\",\n group: \"reveals\",\n description: \"A slides leftward off-screen, revealing the static B underneath.\",\n },\n {\n id: \"reveal-right\",\n label: \"Reveal Right\",\n xfade: \"revealright\",\n group: \"reveals\",\n description: \"A slides rightward off-screen, revealing B.\",\n },\n {\n id: \"reveal-up\",\n label: \"Reveal Up\",\n xfade: \"revealup\",\n group: \"reveals\",\n description: \"A slides upward, revealing B.\",\n },\n {\n id: \"reveal-down\",\n label: \"Reveal Down\",\n xfade: \"revealdown\",\n group: \"reveals\",\n description: \"A slides downward, revealing B.\",\n },\n\n // ===== Covers =====\n {\n id: \"cover-left\",\n label: \"Cover Left\",\n xfade: \"coverleft\",\n group: \"covers\",\n description: \"B slides in from the right and covers A in place.\",\n },\n {\n id: \"cover-right\",\n label: \"Cover Right\",\n xfade: \"coverright\",\n group: \"covers\",\n description: \"B slides in from the left and covers A.\",\n },\n {\n id: \"cover-up\",\n label: \"Cover Up\",\n xfade: \"coverup\",\n group: \"covers\",\n description: \"B slides up from below and covers A.\",\n },\n {\n id: \"cover-down\",\n label: \"Cover Down\",\n xfade: \"coverdown\",\n group: \"covers\",\n description: \"B slides down from above and covers A.\",\n },\n\n // ===== Effects =====\n {\n id: \"pixelize\",\n label: \"Pixelize\",\n xfade: \"pixelize\",\n group: \"effects\",\n description: \"Both clips pixelate to chunky blocks at the midpoint, then sharpen into B.\",\n },\n {\n id: \"radial\",\n label: \"Radial Wipe\",\n xfade: \"radial\",\n group: \"effects\",\n description: \"Clock-hand sweep around the center.\",\n },\n {\n id: \"hblur\",\n label: \"Blur\",\n xfade: \"hblur\",\n group: \"effects\",\n description: \"Heavy horizontal blur at midpoint — dreamy speed-blur look.\",\n },\n {\n id: \"distance\",\n label: \"Distance\",\n xfade: \"distance\",\n group: \"effects\",\n description: \"Distance-field morph between A and B. Subtle dimensional warp.\",\n },\n {\n id: \"zoom-in\",\n label: \"Zoom In\",\n xfade: \"zoomin\",\n group: \"effects\",\n description: \"B zooms outward from a point in A.\",\n },\n {\n id: \"squeeze-h\",\n label: \"Squeeze Horizontal\",\n xfade: \"squeezeh\",\n group: \"effects\",\n description: \"A squeezes horizontally to a line, then B expands.\",\n },\n {\n id: \"squeeze-v\",\n label: \"Squeeze Vertical\",\n xfade: \"squeezev\",\n group: \"effects\",\n description: \"A squeezes vertically to a line, then B expands.\",\n },\n]\n\n/** All valid transition ids, sorted in catalog order. Use this for Zod enums. */\nexport const COMBINE_TRANSITION_IDS: readonly string[] = COMBINE_TRANSITIONS.map((t) => t.id)\n\n/** Ordered list of group tab keys. `common` is a virtual tab, prepended in UI. */\nexport const COMBINE_TRANSITION_GROUP_ORDER: readonly CombineTransitionGroup[] = [\n \"fades\",\n \"wipes\",\n \"slides\",\n \"smooth\",\n \"shapes\",\n \"slices\",\n \"reveals\",\n \"covers\",\n \"effects\",\n]\n\nexport const COMBINE_TRANSITION_GROUP_LABELS: Record<CombineTransitionGroup, string> = {\n fades: \"Fades & Dips\",\n wipes: \"Wipes\",\n slides: \"Slides\",\n smooth: \"Smooth\",\n shapes: \"Shapes\",\n slices: \"Slices\",\n reveals: \"Reveals\",\n covers: \"Covers\",\n effects: \"Effects\",\n}\n\nconst TRANSITIONS_BY_ID: ReadonlyMap<string, CombineTransition> = new Map(\n COMBINE_TRANSITIONS.map((t) => [t.id, t]),\n)\n\nexport function getCombineTransition(id: string): CombineTransition | undefined {\n return TRANSITIONS_BY_ID.get(id)\n}\n\n/**\n * Resolve the FFmpeg `xfade transition=` name for a given transition id.\n * Returns `null` for `cut` (handled via the concat demuxer instead of xfade).\n * Throws for unknown ids — callers validate input via Zod first.\n */\nexport function resolveXfadeName(id: string): string | null {\n const entry = TRANSITIONS_BY_ID.get(id)\n if (!entry) {\n throw new Error(`Unknown combine-videos transition: ${id}`)\n }\n return entry.xfade\n}\n\n/**\n * Map a `transition` PARAMETER-NODE pick (the @nodaro/prompts creative\n * catalog — prose-hint transitions for AI video prompts) onto the ffmpeg\n * xfade vocabulary above. The two vocabularies are deliberately different\n * (the picker describes shots, this table describes blends); only the\n * visually-faithful subset maps — everything else falls back to `cut`.\n *\n * Consumed by the slideshow node (its transition TYPE comes from a wired\n * transition parameter node; unwired defaults to cut). Kept here — not in\n * @nodaro/prompts — because the dependency points prompts → shared, and the\n * ids are plain strings on both sides.\n */\nexport const PICKER_TO_COMBINE_TRANSITION: Readonly<Record<string, string>> = {\n \"none\": \"cut\",\n \"auto\": \"dissolve\", // an explicitly wired \"auto\" wants A blend — the classic slideshow default\n \"cross-dissolve\": \"dissolve\",\n \"fade-to-black\": \"dip-to-black\",\n \"fade-to-white\": \"dip-to-white\",\n \"iris\": \"circle-open\",\n \"wipe\": \"wipe-left\",\n \"pixelate-reform\": \"pixelize\",\n \"dissolve-to-mist\": \"hblur\",\n \"match-cut\": \"cut\",\n \"smash-cut\": \"cut\",\n \"freeze-frame-jump\": \"cut\",\n}\n\n/**\n * Resolve ANY transition string a slideshow may receive — a combine id\n * (already valid), a picker id (mapped), or anything else (→ cut).\n */\nexport function resolveSlideshowTransition(value: string | undefined | null): string {\n if (!value) return \"cut\"\n if (COMBINE_TRANSITION_IDS.includes(value)) return value\n return PICKER_TO_COMBINE_TRANSITION[value] ?? \"cut\"\n}\n\n","/**\n * Multicam helpers over the EDL contract (`edl.ts`): folding measured source\n * offsets into an EDL (D19) and resolving what each on-screen slot of a\n * segment shows (D20). Pure — no I/O. Type-only imports from `edl.ts` keep the\n * module graph free of runtime cycles.\n */\nimport type { Edl, EdlRegion, EdlSegment, EdlSource } from \"./edl.js\"\n\n// ─────────────────────────────────────────────────────────────────────────\n// D19 — source offsets\n// ─────────────────────────────────────────────────────────────────────────\n\nconst hasOwn = (o: object, k: string): boolean => Object.prototype.hasOwnProperty.call(o, k)\nconst isFiniteNumber = (v: unknown): v is number => typeof v === \"number\" && Number.isFinite(v)\n\n/** audio-sync → EDL source offsets (D19: masterMs = sourceMs + offsetMs).\n * `offsets` are measured against ONE common reference (audio-sync's `reference`, which need not be the master).\n * ANCHORED SET: anchor = opts.anchor ?? the unique role:\"master-audio\" source ?? none.\n * - The anchor's own offsetMs is NEVER changed (the segments are on its clock).\n * - Every other provided source s: offsetMs = round((anchor.offsetMs ?? 0) + offsets[s] − (offsets[anchor] ?? 0)).\n * - No anchor: offsetMs = round(offsets[s]) verbatim (offsets already relative to the master clock).\n * SET, never ADD (re-running is idempotent). Returns a new Edl; never mutates; never throws.\n * `ignored[].reason` is a documented open string: \"unknown-source\" | \"not-finite\" | \"anchor-unknown\" | \"anchor-not-finite\".\n * opts.anchor not in edl.sources → NOTHING applied, ignored = [{ sourceId: anchor, reason: \"anchor-unknown\" }].\n * offsets[anchor] present but non-finite → NOTHING applied, ignored = [{ sourceId: anchor, reason: \"anchor-not-finite\" }]. */\nexport function mergeEdlSourceOffsets(\n edl: Edl,\n offsets: Readonly<Record<string, number>>,\n opts?: { readonly anchor?: string },\n): {\n readonly edl: Edl\n /** The source the offsets were anchored to — present whenever one resolved (it exists in `edl.sources`). */\n readonly anchor?: string\n /** Source ids whose `offsetMs` was set, in `offsets` key order. */\n readonly applied: readonly string[]\n readonly ignored: ReadonlyArray<{ readonly sourceId: string; readonly reason: string }>\n} {\n const sources: readonly EdlSource[] = Array.isArray(edl?.sources) ? edl.sources : []\n const rows: Readonly<Record<string, unknown>> = offsets && typeof offsets === \"object\" ? offsets : {}\n const byId = new Map<string, EdlSource>()\n for (const s of sources) if (s && typeof s === \"object\" && !byId.has(s.id)) byId.set(s.id, s)\n\n let anchor: string | undefined\n if (opts?.anchor !== undefined) {\n if (!byId.has(opts.anchor)) {\n return { edl: { ...edl }, applied: [], ignored: [{ sourceId: opts.anchor, reason: \"anchor-unknown\" }] }\n }\n anchor = opts.anchor\n } else {\n const masters = sources.filter((s) => s && typeof s === \"object\" && s.role === \"master-audio\")\n if (masters.length === 1) anchor = masters[0].id\n }\n\n // The anchor's own measurement is the rebase point; an absent one reads as 0.\n let reference = 0\n if (anchor !== undefined && hasOwn(rows, anchor)) {\n const a = rows[anchor]\n if (!isFiniteNumber(a)) {\n return { edl: { ...edl }, anchor, applied: [], ignored: [{ sourceId: anchor, reason: \"anchor-not-finite\" }] }\n }\n reference = a\n }\n const anchorOffsetMs = anchor !== undefined ? (byId.get(anchor)?.offsetMs ?? 0) : 0\n\n const next = new Map<string, number>()\n const applied: string[] = []\n const ignored: Array<{ sourceId: string; reason: string }> = []\n for (const sourceId of Object.keys(rows)) {\n if (sourceId === anchor) continue // never changed: the segments are on its clock\n if (!byId.has(sourceId)) {\n ignored.push({ sourceId, reason: \"unknown-source\" })\n continue\n }\n const measured = rows[sourceId]\n const offsetMs = isFiniteNumber(measured)\n ? Math.round(anchor !== undefined ? anchorOffsetMs + measured - reference : measured)\n : Number.NaN\n // A non-finite result (the measurement, or a non-finite anchor offsetMs it\n // is rebased onto) is never written.\n if (!Number.isFinite(offsetMs)) {\n ignored.push({ sourceId, reason: \"not-finite\" })\n continue\n }\n next.set(sourceId, offsetMs)\n applied.push(sourceId)\n }\n\n const merged: Edl = Array.isArray(edl?.sources)\n ? { ...edl, sources: edl.sources.map((s) => (s && typeof s === \"object\" && next.has(s.id) ? { ...s, offsetMs: next.get(s.id)! } : s)) }\n : { ...edl }\n return { edl: merged, ...(anchor !== undefined ? { anchor } : {}), applied, ignored }\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// B4 — audio-sync offsets onto a planner's sources\n// ─────────────────────────────────────────────────────────────────────────\n\n/** Below this, a measured offset is not trusted (audio-sync's own\n * \"check it by ear\" line). */\nexport const AUDIO_SYNC_MIN_CONFIDENCE = 0.5\n\n/** One source row as a planner (edit-plan) sends it. */\nexport interface AudioSyncOffsetSource {\n readonly id: string\n readonly role?: string\n /** Set = a hand-set offset, which always wins over a measured one. */\n readonly offsetMs?: number\n}\n\n/** Why measured offsets could not be applied. Every code names the source to\n * fix, so a caller can phrase it with its own label (`describeAudioSyncOffsetIssue`). */\nexport type AudioSyncOffsetIssue =\n | { readonly code: \"not-audio-sync\" }\n | { readonly code: \"invalid-offset\"; readonly sourceId: string }\n | { readonly code: \"anchor-offset\"; readonly sourceId: string; readonly offsetMs: number }\n | { readonly code: \"anchor-unmeasured\"; readonly sourceId: string }\n | { readonly code: \"weak-match\"; readonly sourceId: string; readonly confidence: number; readonly anchor: boolean }\n | { readonly code: \"unmeasured\"; readonly sourceId: string }\n\nexport type AudioSyncOffsetsResult<S> =\n | {\n readonly ok: true\n /** The sources, with the measured offsets written onto `offsetMs`. */\n readonly sources: S[]\n /** The source whose clock the offsets are anchored to. */\n readonly anchor?: string\n /** Source ids that took a measured offset. */\n readonly applied: readonly string[]\n }\n | { readonly ok: false; readonly issues: readonly AudioSyncOffsetIssue[] }\n\ninterface SyncRow { readonly offsetMs: number; readonly confidence: number }\n\n/** audio-sync's result (an object, or the JSON string a canvas handle carries)\n * → its rows by source id, the reference included; null when it is not one. */\nfunction readAudioSyncRows(sync: unknown): Map<string, SyncRow> | null {\n let value = sync\n if (typeof value === \"string\") {\n try { value = JSON.parse(value) } catch { return null }\n }\n if (!value || typeof value !== \"object\") return null\n const { reference, offsets } = value as { reference?: unknown; offsets?: unknown }\n if (!Array.isArray(offsets)) return null\n const rows = new Map<string, SyncRow>()\n for (const row of offsets) {\n if (!row || typeof row !== \"object\") return null\n const { sourceId, offsetMs, confidence } = row as Record<string, unknown>\n if (typeof sourceId !== \"string\" || !isFiniteNumber(offsetMs)) return null\n if (!rows.has(sourceId)) rows.set(sourceId, { offsetMs, confidence: isFiniteNumber(confidence) ? confidence : 0 })\n }\n // The reference is measured by definition (its own offset is 0).\n if (typeof reference === \"string\" && reference && !rows.has(reference)) rows.set(reference, { offsetMs: 0, confidence: 1 })\n return rows\n}\n\nconst handSet = (s: AudioSyncOffsetSource): boolean => isFiniteNumber(s.offsetMs)\n\n/** The source whose clock a planner's plan is on: the `master-audio` source,\n * else the first (edit-plan's `masterProbeSource`). */\nfunction plannerClockSource<S extends AudioSyncOffsetSource>(sources: readonly S[]): S | undefined {\n return sources.find((s) => s.role === \"master-audio\") ?? sources[0]\n}\n\n/** B4 — audio-sync's measured offsets → a planner's `sources[].offsetMs`\n * (decided 2026-09-25). The planner makes its plan on its MASTER's clock:\n * the `master-audio` source, else its first source (edit-plan's own rule) —\n * the ANCHOR. Every other source gets `offsetMs = measured(s) − measured(anchor)`\n * (D19 via `mergeEdlSourceOffsets`), so audio-sync's reference need not be the\n * master. Never out of sync silently — each of these is an issue instead:\n * - a source with a hand-set `offsetMs` keeps it (it always wins);\n * - a source audio-sync did not measure → \"unmeasured\";\n * - a measured source under `AUDIO_SYNC_MIN_CONFIDENCE` → \"weak-match\";\n * - the anchor unmeasured / weak, when any source needs it → \"anchor-…\";\n * - a hand-set non-zero offset on the anchor → \"anchor-offset\" (its clock is the plan's).\n * Rows for sources the planner does not have are ignored. Pure; never throws. */\nexport function applyAudioSyncOffsets<S extends AudioSyncOffsetSource>(\n sources: readonly S[],\n sync: unknown,\n): AudioSyncOffsetsResult<S> {\n const rows = readAudioSyncRows(sync)\n if (!rows) return { ok: false, issues: [{ code: \"not-audio-sync\" }] }\n const list = Array.isArray(sources) ? sources.filter((s): s is S => !!s && typeof s === \"object\") : []\n const anchor = plannerClockSource(list)\n if (!anchor) return { ok: true, sources: [...list], applied: [] }\n\n const issues: AudioSyncOffsetIssue[] = []\n // A hand-set offset that is not a number (a \"500\" from a JSON file) would\n // otherwise be read as absent, or summed as a string.\n for (const s of list) if (s.offsetMs !== undefined && !handSet(s)) issues.push({ code: \"invalid-offset\", sourceId: s.id })\n if (handSet(anchor) && anchor.offsetMs !== 0) {\n issues.push({ code: \"anchor-offset\", sourceId: anchor.id, offsetMs: anchor.offsetMs! })\n }\n const measured: Record<string, number> = {}\n for (const s of list) {\n if (s.id === anchor.id || handSet(s)) continue\n const row = rows.get(s.id)\n if (!row) issues.push({ code: \"unmeasured\", sourceId: s.id })\n else if (!(row.confidence >= AUDIO_SYNC_MIN_CONFIDENCE)) issues.push({ code: \"weak-match\", sourceId: s.id, confidence: row.confidence, anchor: false })\n else measured[s.id] = row.offsetMs\n }\n // The anchor's own measurement is the rebase point — needed only when some\n // source takes a measured offset.\n if (Object.keys(measured).length > 0) {\n const row = rows.get(anchor.id)\n if (!row) issues.push({ code: \"anchor-unmeasured\", sourceId: anchor.id })\n else if (!(row.confidence >= AUDIO_SYNC_MIN_CONFIDENCE)) issues.push({ code: \"weak-match\", sourceId: anchor.id, confidence: row.confidence, anchor: true })\n else measured[anchor.id] = row.offsetMs\n }\n if (issues.length > 0) return { ok: false, issues }\n if (Object.keys(measured).length === 0) return { ok: true, sources: [...list], anchor: anchor.id, applied: [] }\n\n // One arithmetic implementation: the D19 anchored SET.\n const pseudo = { version: 1, clock: \"master\", sources: list, segments: [] } as unknown as Edl\n const merged = mergeEdlSourceOffsets(pseudo, measured, { anchor: anchor.id })\n const byId = new Map(merged.edl.sources.map((s) => [s.id, s.offsetMs]))\n const applied = new Set(merged.applied)\n return {\n ok: true,\n sources: list.map((s) => (applied.has(s.id) ? { ...s, offsetMs: byId.get(s.id)! } : s)),\n anchor: anchor.id,\n applied: merged.applied,\n }\n}\n\n/** Why edit-plan's sources cannot be planned as given: an audio-sync issue,\n * or a transcript made from a recording that is off the plan's clock. */\nexport type EditPlanSourceIssue =\n | AudioSyncOffsetIssue\n | { readonly code: \"transcript-off-clock\"; readonly sourceId: string; readonly masterId: string; readonly offsetMs: number }\n\n/** B4 — the ONE check every edit-plan caller runs before dispatch (the\n * orchestrator, the editor, MCP, the SDK), so a plan that would render out of\n * sync fails before charging (decided 2026-09-25):\n * - `offsets` given (audio-sync's result; null/\"\" when wired but empty) →\n * `applyAudioSyncOffsets`;\n * - the master's own offset must be 0 (the plan follows its clock);\n * - `transcriptSourceId` (the recording the transcript was made from, when\n * known) must be on the master's clock: the master itself, or a source\n * whose offset is 0. Unknown → assumed the master's.\n * `transcriptSourceId` is echoed back only when it names one of the sources,\n * for the caller to stamp on the transcript. Pure; never throws. */\nexport function resolveEditPlanSources<S extends AudioSyncOffsetSource>(\n sources: readonly S[],\n opts: { readonly offsets?: unknown; readonly transcriptSourceId?: string } = {},\n):\n | { readonly ok: true; readonly sources: S[]; readonly transcriptSourceId?: string }\n | { readonly ok: false; readonly issues: readonly EditPlanSourceIssue[] } {\n const list = Array.isArray(sources) ? sources.filter((s): s is S => !!s && typeof s === \"object\") : []\n const anchor = plannerClockSource(list)\n const issues: EditPlanSourceIssue[] = []\n let planned: S[] = [...list]\n if (opts.offsets !== undefined) {\n const synced = applyAudioSyncOffsets(list, opts.offsets)\n if (synced.ok) planned = synced.sources\n else issues.push(...synced.issues)\n } else {\n for (const s of list) if (s.offsetMs !== undefined && !handSet(s)) issues.push({ code: \"invalid-offset\", sourceId: s.id })\n if (anchor && handSet(anchor) && anchor.offsetMs !== 0) {\n issues.push({ code: \"anchor-offset\", sourceId: anchor.id, offsetMs: anchor.offsetMs! })\n }\n }\n const spoken = opts.transcriptSourceId ? planned.find((s) => s.id === opts.transcriptSourceId) : undefined\n if (spoken && anchor && spoken.id !== anchor.id && handSet(spoken) && spoken.offsetMs !== 0) {\n issues.push({ code: \"transcript-off-clock\", sourceId: spoken.id, masterId: anchor.id, offsetMs: spoken.offsetMs! })\n }\n if (issues.length > 0) return { ok: false, issues }\n return { ok: true, sources: planned, ...(spoken ? { transcriptSourceId: spoken.id } : {}) }\n}\n\n/** The recording a transcript was made from, traced on a canvas: the node\n * feeding the transcribing node, through clock-preserving hops (extract-audio).\n * Undefined when the producer is not a transcriber or the trace is ambiguous\n * (more than one upstream) — the caller then assumes the master's clock. */\nexport function editPlanTranscriptOrigin(\n producerId: string,\n typeOf: (nodeId: string) => string | undefined,\n edges: ReadonlyArray<{ readonly source: string; readonly target: string }>,\n): string | undefined {\n if (typeOf(producerId) !== \"transcribe\") return undefined\n let current = producerId\n for (let hop = 0; hop < 4; hop++) {\n const upstream = [...new Set(edges.filter((e) => e.target === current).map((e) => e.source))]\n if (upstream.length !== 1) return undefined\n const up = upstream[0]!\n if (typeOf(up) !== \"extract-audio\") return up\n current = up\n }\n return undefined\n}\n\n/** A plain-language line for one issue; `labelOf` turns a source id into the\n * name the user sees (a canvas node's label, say). */\nexport function describeAudioSyncOffsetIssue(issue: EditPlanSourceIssue, labelOf: (sourceId: string) => string = (id) => id): string {\n switch (issue.code) {\n case \"transcript-off-clock\":\n return `the transcript was made from \"${labelOf(issue.sourceId)}\", which is ${issue.offsetMs} ms off the master \"${labelOf(issue.masterId)}\" — the plan follows the master's clock, so transcribe \"${labelOf(issue.masterId)}\", or mark \"${labelOf(issue.sourceId)}\" as master audio`\n case \"not-audio-sync\":\n return \"the offsets carry no Audio Sync result — pass its job's output_data.json (on the canvas: connect Audio Sync's Offsets output and run it)\"\n case \"invalid-offset\":\n return `the offset set on \"${labelOf(issue.sourceId)}\" is not a number of milliseconds`\n case \"anchor-offset\":\n return `\"${labelOf(issue.sourceId)}\" is the master (the plan follows its clock), so its offset must be 0, not ${issue.offsetMs} ms`\n case \"anchor-unmeasured\":\n return `audio-sync did not measure \"${labelOf(issue.sourceId)}\", the master the other sources are timed against — add it to audio-sync's sources`\n case \"weak-match\":\n return issue.anchor\n ? `audio-sync's match for \"${labelOf(issue.sourceId)}\", the master the other sources are timed against, is too weak to trust (confidence ${issue.confidence}; ${AUDIO_SYNC_MIN_CONFIDENCE} needed) — set the other sources' offsets by hand, or mark a better-recorded source as master audio`\n : `audio-sync's match for \"${labelOf(issue.sourceId)}\" is too weak to trust (confidence ${issue.confidence}; ${AUDIO_SYNC_MIN_CONFIDENCE} needed) — set its offset by hand`\n case \"unmeasured\":\n return `\"${labelOf(issue.sourceId)}\" was not measured by audio-sync — wire it into audio-sync, or set its offset by hand (0 if it started with the master)`\n }\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// D20 — slot resolution\n// ─────────────────────────────────────────────────────────────────────────\n\nexport const EDL_FULL_FRAME: EdlRegion = Object.freeze({ x: 0, y: 0, w: 1, h: 1 })\n\nexport interface EdlResolvedSlot {\n readonly source: string\n readonly region: EdlRegion\n /** \"resolver\" = the caller's `regionFor` (v3 per-segment tracks). */\n readonly regionFrom: \"slot\" | \"segment\" | \"resolver\" | \"speaker\" | \"source\" | \"full\"\n readonly speaker?: string\n readonly weight?: number\n}\n\nexport interface ResolveEdlSlotsOptions {\n /** speaker-view's per-speaker framing table (a node SETTING, not an EDL field), keyed by (source, speaker) so a\n * wide-shot region never lands on a close-up camera framing the same person. */\n readonly speakerRegions?: ReadonlyArray<{ readonly source: string; readonly speaker: string; readonly region: EdlRegion }>\n /** v3 hook: a per-(segment, slot) region, e.g. from a face track. Undefined = no opinion. */\n readonly regionFor?: (q: { readonly segment: EdlSegment; readonly source: string; readonly speaker?: string }) => EdlRegion | undefined\n}\n\n/** A valid in-frame box: finite, 0..1, w/h > 0, x+w ≤ 1, y+h ≤ 1 — with the\n * same edge tolerance `validateEdl` accepts, so the two never disagree. */\nfunction isInFrameRegion(r: unknown): r is EdlRegion {\n if (!r || typeof r !== \"object\") return false\n const { x, y, w, h } = r as Record<string, unknown>\n for (const v of [x, y, w, h]) if (!isFiniteNumber(v) || v < 0 || v > 1) return false\n const box = r as EdlRegion\n return box.w > 0 && box.h > 0 && box.x + box.w <= 1 + 1e-9 && box.y + box.h <= 1 + 1e-9\n}\n\ntype Rung = EdlResolvedSlot[\"regionFrom\"]\n\n/** D20 — the ONE region-precedence implementation:\n * slot.region ▷ segment.region (single-slot only) ▷ regionFor ▷ speakerRegions[(source, speaker)] ▷ source.region ▷ full frame.\n * Slots = layout.slots when non-empty, else ONE implicit slot from segment.video (no video → []).\n * A slot's speaker = slot.speaker ?? (single slot ? segment.speaker : undefined); no speaker → the speaker rung is skipped.\n * A rung whose region is not a valid in-frame box (finite, 0..1, w/h > 0, x+w ≤ 1, y+h ≤ 1) falls through to the next.\n * Unknown source id → the source rung is skipped. Pure; never throws on its own. */\nexport function resolveEdlSegmentSlots(edl: Edl, segment: EdlSegment, opts?: ResolveEdlSlotsOptions): readonly EdlResolvedSlot[] {\n if (!segment || typeof segment !== \"object\") return []\n const sources: readonly EdlSource[] = Array.isArray(edl?.sources) ? edl.sources : []\n const layoutSlots = Array.isArray(segment.layout?.slots) ? segment.layout!.slots! : []\n const slots: NonNullable<NonNullable<EdlSegment[\"layout\"]>[\"slots\"]> =\n layoutSlots.length > 0\n ? layoutSlots\n : typeof segment.video === \"string\" && segment.video\n ? [{ source: segment.video }]\n : []\n const single = slots.length === 1\n\n const out: EdlResolvedSlot[] = []\n for (const slot of slots) {\n if (!slot || typeof slot !== \"object\") continue\n const source = slot.source\n const speaker = slot.speaker ?? (single ? segment.speaker : undefined)\n\n // Each rung is evaluated lazily, top-down; the first valid box wins.\n const rungs: ReadonlyArray<readonly [Rung, () => unknown]> = [\n [\"slot\", () => slot.region],\n [\"segment\", () => (single ? segment.region : undefined)],\n [\"resolver\", () => opts?.regionFor?.({ segment, source, ...(speaker !== undefined ? { speaker } : {}) })],\n [\"speaker\", () =>\n speaker === undefined\n ? undefined\n : Array.isArray(opts?.speakerRegions)\n ? opts.speakerRegions.find((row) => row && row.source === source && row.speaker === speaker)?.region\n : undefined],\n [\"source\", () => sources.find((s) => s && typeof s === \"object\" && s.id === source)?.region],\n ]\n let region: EdlRegion = EDL_FULL_FRAME\n let regionFrom: Rung = \"full\"\n for (const [from, read] of rungs) {\n const candidate = read()\n if (isInFrameRegion(candidate)) {\n region = candidate\n regionFrom = from\n break\n }\n }\n out.push({\n source,\n region,\n regionFrom,\n ...(speaker !== undefined ? { speaker } : {}),\n ...(slot.weight !== undefined ? { weight: slot.weight } : {}),\n })\n }\n return out\n}\n","/**\n * Speaker-view presentation registries — the STRUCTURAL vocabulary behind an\n * EDL segment's `layout` (see `EdlLayout` in `edl.ts`).\n *\n * What lives here is structure only: which layout ids exist, how many slots\n * each takes, which output aspects a renderer exists for, which speaker-switch\n * ids exist and whether they consume output time, and the atomic emphasis\n * styles. Taste — default emphasis, which transitions are allowed or preferred\n * for a show, timing defaults — is deliberately NOT here.\n *\n * Every list is widened ADDITIVELY. That is why a finding judged against one of\n * these registries is a validation WARNING, never an issue: an older validator\n * must never reject an EDL written by a newer producer that knows more ids.\n * An executor that cannot honour an id refuses it itself.\n */\nimport type { Edl } from \"./edl.js\"\nimport { COMBINE_TRANSITIONS } from \"./combine-transitions.js\"\nimport { resolveEdlSegmentSlots } from \"./edl-multicam.js\"\n\nexport const EDL_TARGET_ASPECTS = [\"16:9\", \"9:16\", \"1:1\", \"4:5\"] as const\nexport type EdlTargetAspect = (typeof EDL_TARGET_ASPECTS)[number]\n\nconst TARGET_ASPECT_SET: ReadonlySet<string> = new Set(EDL_TARGET_ASPECTS)\n\n/** Narrow an open `Edl.meta.targetAspect` (or any value) to a known aspect. */\nexport function isEdlTargetAspect(v: unknown): v is EdlTargetAspect {\n return typeof v === \"string\" && TARGET_ASPECT_SET.has(v)\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Layouts\n// ─────────────────────────────────────────────────────────────────────────\n\nexport interface SpeakerLayoutSheet {\n readonly id: string\n /** Inclusive slot-count range when a segment lists `layout.slots`. */\n readonly minSlots: number\n readonly maxSlots: number\n /** The output aspects this layout is DRAWN for (a renderer exists) — not \"looks good\". Widened additively. */\n readonly aspects: readonly EdlTargetAspect[]\n}\n\nexport const SPEAKER_LAYOUTS: readonly SpeakerLayoutSheet[] = [\n { id: \"single\", minSlots: 1, maxSlots: 1, aspects: EDL_TARGET_ASPECTS },\n { id: \"side-by-side\", minSlots: 2, maxSlots: 2, aspects: [\"16:9\", \"1:1\"] },\n { id: \"stacked\", minSlots: 2, maxSlots: 2, aspects: [\"9:16\", \"4:5\", \"1:1\"] },\n { id: \"grid\", minSlots: 2, maxSlots: 6, aspects: EDL_TARGET_ASPECTS },\n { id: \"pip\", minSlots: 2, maxSlots: 2, aspects: EDL_TARGET_ASPECTS },\n]\n\nexport const SPEAKER_LAYOUT_IDS: readonly string[] = SPEAKER_LAYOUTS.map((l) => l.id)\n\nconst LAYOUTS_BY_ID: ReadonlyMap<string, SpeakerLayoutSheet> = new Map(SPEAKER_LAYOUTS.map((l) => [l.id, l]))\n\nexport function getSpeakerLayout(id: string): SpeakerLayoutSheet | undefined {\n return LAYOUTS_BY_ID.get(id)\n}\n\n/** Omitted query fields are unconstrained. */\nexport function speakerLayoutAllows(\n sheet: SpeakerLayoutSheet,\n q: { readonly aspect?: EdlTargetAspect; readonly slotCount?: number },\n): boolean {\n if (q.aspect !== undefined && !sheet.aspects.includes(q.aspect)) return false\n if (q.slotCount !== undefined && !(q.slotCount >= sheet.minSlots && q.slotCount <= sheet.maxSlots)) return false\n return true\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Speaker switches (EdlLayout.transition.type)\n// ─────────────────────────────────────────────────────────────────────────\n\n/** The one prefix of the time-consuming (cross-source blend) switch family. */\nconst XFADE_SWITCH_PREFIX = \"xfade:\"\n\n/** D17: a switch consumes output time iff it is in the `xfade:*` family. THE one overlap rule (edl.ts uses it). */\nexport function speakerSwitchOverlaps(type: string): boolean {\n return typeof type === \"string\" && type.startsWith(XFADE_SWITCH_PREFIX)\n}\n\nexport interface SpeakerSwitchSheet {\n /** \"cut\" | \"pan\" | \"zoom\" | `xfade:${combine id}` */\n readonly id: string\n /** = `speakerSwitchOverlaps(id)`, derived, never hand-set. */\n readonly overlaps: boolean\n /** true only for `pan`: an eased sweep between two regions of ONE picture source. */\n readonly requiresSameSource: boolean\n}\n\nconst switchSheet = (id: string, requiresSameSource: boolean): SpeakerSwitchSheet => ({\n id,\n overlaps: speakerSwitchOverlaps(id),\n requiresSameSource,\n})\n\n/** `cut` / `pan` / `zoom` consume no time (pan: a geometry tween inside ONE\n * source; zoom: a tween inside each segment). The `xfade:*` family is DERIVED\n * from every combine-videos transition that is a real ffmpeg xfade (so never\n * `cut`, which has no xfade) — it is never hand-listed here. */\nexport const SPEAKER_SWITCHES: readonly SpeakerSwitchSheet[] = [\n switchSheet(\"cut\", false),\n switchSheet(\"pan\", true),\n switchSheet(\"zoom\", false),\n ...COMBINE_TRANSITIONS.filter((t) => t.xfade !== null).map((t) => switchSheet(XFADE_SWITCH_PREFIX + t.id, false)),\n]\n\nexport const SPEAKER_SWITCH_IDS: readonly string[] = SPEAKER_SWITCHES.map((s) => s.id)\n\nconst SWITCHES_BY_ID: ReadonlyMap<string, SpeakerSwitchSheet> = new Map(SPEAKER_SWITCHES.map((s) => [s.id, s]))\n\n/** A plain lookup: `undefined` for an unknown id (never throws). */\nexport function getSpeakerSwitch(id: string): SpeakerSwitchSheet | undefined {\n return SWITCHES_BY_ID.get(id)\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Emphasis (EdlLayout.emphasis.style)\n// ─────────────────────────────────────────────────────────────────────────\n\n/** Atomic emphasis styles; `layout.emphasis.style` is a \"+\"-joined set of\n * them. `none` stands alone (it means \"no emphasis\"), and an atom appears at\n * most once. */\nexport const SPEAKER_EMPHASIS_STYLES = [\"none\", \"scale\", \"border\", \"dim\"] as const\nexport type SpeakerEmphasisStyle = (typeof SPEAKER_EMPHASIS_STYLES)[number]\n\nconst EMPHASIS_STYLE_SET: ReadonlySet<string> = new Set(SPEAKER_EMPHASIS_STYLES)\n\n/** Split a `+`-joined style into its atoms: trimmed, empties dropped. */\nexport function parseSpeakerEmphasisStyle(style: string): readonly string[] {\n if (typeof style !== \"string\") return []\n return style\n .split(\"+\")\n .map((atom) => atom.trim())\n .filter((atom) => atom.length > 0)\n}\n\n/** At least one atom, every atom a known `SPEAKER_EMPHASIS_STYLES` id, no\n * atom repeated, and `none` only on its own (\"none+scale\" contradicts itself). */\nexport function isKnownSpeakerEmphasisStyle(style: string): boolean {\n const atoms = parseSpeakerEmphasisStyle(style)\n if (atoms.length === 0 || !atoms.every((atom) => EMPHASIS_STYLE_SET.has(atom))) return false\n if (new Set(atoms).size !== atoms.length) return false\n return !(atoms.includes(\"none\") && atoms.length > 1)\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Registry-derived findings\n// ─────────────────────────────────────────────────────────────────────────\n\nconst isObject = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\"\n\n/** Registry-derived findings — ALL warning-class. Pure; never throws (guard non-array sources/segments the\n * way validateEdl does). `validateEdl` already includes these in its `warnings`; call this directly only\n * when you want the presentation findings alone. */\nexport function speakerPresentationWarnings(edl: Edl): readonly string[] {\n const warnings: string[] = []\n if (!isObject(edl)) return warnings\n // Guard a raw object that skipped normalizeEdl, exactly as validateEdl does.\n const safe: Edl = {\n ...edl,\n sources: Array.isArray(edl.sources) ? edl.sources : [],\n segments: Array.isArray(edl.segments) ? edl.segments : [],\n }\n\n const rawAspect = isObject(safe.meta) ? safe.meta.targetAspect : undefined\n const aspect = isEdlTargetAspect(rawAspect) ? rawAspect : undefined\n if (rawAspect != null && aspect === undefined) {\n warnings.push(`meta.targetAspect \"${String(rawAspect)}\" is not a known target aspect (known: ${EDL_TARGET_ASPECTS.join(\", \")})`)\n }\n\n safe.segments.forEach((seg, i) => {\n if (!isObject(seg) || !isObject(seg.layout)) return\n const at = `segment[${i}] \"${seg.id}\"`\n const layout = seg.layout\n\n // 1. The layout mode, its slot count, and the output aspect.\n const sheet = typeof layout.mode === \"string\" ? getSpeakerLayout(layout.mode) : undefined\n if (!sheet) {\n warnings.push(`${at}: unknown layout mode \"${String(layout.mode)}\" (known: ${SPEAKER_LAYOUT_IDS.join(\", \")})`)\n } else {\n const slotCount = Array.isArray(layout.slots) ? layout.slots.length : 0\n if (slotCount > 0 && !speakerLayoutAllows(sheet, { slotCount })) {\n const range = sheet.minSlots === sheet.maxSlots ? `${sheet.minSlots}` : `${sheet.minSlots}–${sheet.maxSlots}`\n warnings.push(`${at}: layout \"${sheet.id}\" takes ${range} slot(s), got ${slotCount}`)\n }\n if (aspect !== undefined && !speakerLayoutAllows(sheet, { aspect })) {\n warnings.push(`${at}: layout \"${sheet.id}\" is not drawn for targetAspect ${aspect} (drawn for: ${sheet.aspects.join(\", \")})`)\n }\n }\n\n // 2. The switch into this segment.\n if (isObject(layout.transition)) {\n const type = layout.transition.type\n const sw = typeof type === \"string\" ? getSpeakerSwitch(type) : undefined\n if (!sw) {\n warnings.push(`${at}: unknown layout transition \"${String(type)}\" (known: ${SPEAKER_SWITCHES.filter((s) => !s.overlaps).map((s) => s.id).join(\", \")}, or ${XFADE_SWITCH_PREFIX}<id> for a combine-videos transition that is a real ffmpeg xfade — never ${XFADE_SWITCH_PREFIX}cut)`)\n } else if (sw.requiresSameSource && i > 0) {\n // Only a one-picture → one-picture boundary has a defined \"picture\n // source\"; any other shape (multi-slot, no video) is not judged here.\n const prev = safe.segments[i - 1]\n const cur = resolveEdlSegmentSlots(safe, seg)\n const before = isObject(prev) ? resolveEdlSegmentSlots(safe, prev) : []\n if (cur.length === 1 && before.length === 1 && cur[0].source !== before[0].source) {\n warnings.push(`${at}: switch \"${sw.id}\" moves within ONE picture source, but the previous segment shows \"${before[0].source}\" and this one \"${cur[0].source}\"`)\n }\n }\n }\n\n // 3. The emphasis style.\n if (isObject(layout.emphasis) && !isKnownSpeakerEmphasisStyle(layout.emphasis.style as string)) {\n const style = String(layout.emphasis.style)\n const atoms = parseSpeakerEmphasisStyle(layout.emphasis.style as string)\n warnings.push(atoms.length > 0 && atoms.every((a) => EMPHASIS_STYLE_SET.has(a))\n ? `${at}: emphasis style \"${style}\" — \"none\" must stand alone and no style may repeat`\n : `${at}: unknown emphasis style \"${style}\" (a \"+\"-joined set of: ${SPEAKER_EMPHASIS_STYLES.join(\", \")})`)\n }\n })\n\n return warnings\n}\n","import { speakerSwitchOverlaps, speakerPresentationWarnings } from \"./speaker-layouts.js\"\nimport type { EdlTargetAspect } from \"./speaker-layouts.js\"\n\n/**\n * EDL — the edit decision list contract.\n *\n * WHY THIS EXISTS\n * The podcast-editing primitives (transcript-driven cut, clip finding,\n * multicam, speaker view) compose because they share ONE data shape: every\n * analysis node produces an EDL, every render node consumes one. This module\n * is that shape plus the pure functions that read it. It is structural\n * vocabulary — no prompts, no heuristics, no editorial judgment — which is why\n * it lives in the Apache-licensed `@nodaro/shared` (the wire shape of\n * `/v1/edl/*`, an SDK type, an MCP output). Every published version is an\n * irrevocable grant, so the three resolved decisions (see below) all land in\n * version 1: renaming a field, or adding a REQUIRED one, later would be a\n * breaking major bump — so every later field is optional and additive.\n *\n * This module is PURE — no I/O, no ffmpeg, no network. The executors\n * (`apply-edl`, `speaker-view`) turn an EDL into pixels; they live in the app\n * and the plugins.\n *\n * DESIGN DECISIONS baked into v1 (so multicam and speaker view extend the\n * contract additively rather than with a breaking bump):\n * - D17 OVERLAP: a crossfade consumes time from the outgoing segment (ffmpeg\n * `xfade`, as combine-videos already does), so the rendered timeline is\n * SHORTER than the sum of segment durations. `edlDurationMs` subtracts the\n * overlap transitions; cut/pan/zoom consume no time (pan: a geometry tween\n * inside ONE source; zoom: a tween inside each segment); only the `xfade:*`\n * family and a segment `crossfade` overlap.\n * - D19 CLOCK/SOURCE/SIGN: `Edl.clock` says whether `segments` are on the\n * source master clock or an output clock; `Transcript.sourceId` says which\n * source a transcript came from; the offset sign is `masterMs = sourceMs +\n * offsetMs(source)`, applied by the remap functions.\n * - D20 PRECEDENCE/RENAME: region precedence\n * `slot.region ▷ segment.region (single-slot only) ▷ a caller's per-slot\n * resolver (v3 tracks) ▷ regions[(source, speaker)] ▷ source.region ▷ full\n * frame`, implemented ONCE by `resolveEdlSegmentSlots` (edl-multicam.ts);\n * `segment.region` is invalid when the segment's layout has more than one\n * slot; `slots[].weight` (0..1, active = 1) replaces the design's\n * `slots[].emphasis` so it no longer collides with `layout.emphasis`\n * ({ style, durationMs }).\n * - P3-8 FOLLOW (decided 2026-10-06, field added decided 2026-10-09): a\n * slot a renderer framed on a face track names that track in\n * `slots[].follow` (`EdlSlotFollow`). It records what the render followed;\n * the path itself is recomputed from the tracks, and `slot.region` keeps a\n * static region, so a reader that ignores `follow` still gets a sane frame.\n *\n * Time is INTEGER MILLISECONDS everywhere. There is no seconds→ms guessing\n * (`normalizeEdl` never reinterprets a unit — an implausible value is a\n * validation error, not a silent 1000× edit).\n */\n\nexport const EDL_VERSION = 1 as const\n\n/** A crop region, as fractions 0..1 of the source frame. */\nexport interface EdlRegion {\n readonly x: number\n readonly y: number\n readonly w: number\n readonly h: number\n}\n\nexport const EDL_SOURCE_ROLES = [\"master-audio\", \"camera\", \"wide\", \"screen\"] as const\nexport type EdlSourceRole = (typeof EDL_SOURCE_ROLES)[number]\n\nconst KNOWN_SOURCE_ROLES: ReadonlySet<string> = new Set(EDL_SOURCE_ROLES)\n\n/** A media input to the edit. Ids are minted once (by `edit-plan`) and never\n * re-derived, so downstream nodes resolve media from `url` in the data, not\n * from canvas handle order. Keep the `url` key: the cloud relay re-hosts\n * private media by walking `url`-suffixed fields. */\nexport interface EdlSource {\n readonly id: string\n readonly url: string\n readonly kind: \"video\" | \"audio\"\n /** This source's origin on the master clock. `masterMs = sourceMs + offsetMs`. Default 0. */\n readonly offsetMs?: number\n /** Known roles: EDL_SOURCE_ROLES. Open (`string & {}`) so an EDL written by a newer producer still type-checks\n * and still validates — an unknown role is a WARNING (validateEdl); an executor that cannot honour it refuses it. */\n readonly role?: EdlSourceRole | (string & {})\n /** Speaker labels this source frames (multicam). Empty = unknown. */\n readonly speakers?: readonly string[]\n /** A static crop for this source (speaker-view v1 framing). */\n readonly region?: EdlRegion\n}\n\nexport type EdlSlotFollowMotion = \"static\" | \"glide\"\n\n/** Module-private on purpose: the follow contract is types only (decided\n * 2026-10-09), so no runtime value joins the published surface. */\nconst FOLLOW_MOTIONS = [\"static\", \"glide\"] as const satisfies readonly EdlSlotFollowMotion[]\nconst KNOWN_FOLLOW_MOTIONS: ReadonlySet<string> = new Set(FOLLOW_MOTIONS)\n\n/** The face track a slot followed (P3-8). `sourceId` is the slot's own video\n * source; `trackId` is a track id of the speaker-track set the render read\n * (unique in that set); `motion` is how it followed: `static` = one region\n * per segment from the track, `glide` = a moving crop along it. Additive and\n * optional: an EDL without it is unchanged. */\nexport interface EdlSlotFollow {\n readonly sourceId: string\n readonly trackId: string\n readonly motion: EdlSlotFollowMotion\n}\n\n/** How a segment is presented on screen (speaker-view, phase 2). `mode` and\n * `transition.type` are ids from the `SPEAKER_LAYOUTS` / `SPEAKER_SWITCHES`\n * registries (speaker-layouts.ts); `emphasis.style` is a `+`-joined set of\n * atomic `SPEAKER_EMPHASIS_STYLES` (e.g. \"scale+border\"). Unknown ids are\n * validation WARNINGS, and `mode` stays an open string on purpose. v1 leaves\n * layout undefined (single camera). */\nexport interface EdlLayout {\n /** \"single\" | \"side-by-side\" | \"stacked\" | \"grid\" | \"pip\" | … */\n readonly mode: string\n readonly slots?: ReadonlyArray<{\n readonly source: string\n readonly region?: EdlRegion\n readonly speaker?: string\n /** D20: 0..1, the active slot = 1. (Was `emphasis`; renamed to avoid\n * colliding with `layout.emphasis`.) */\n readonly weight?: number\n /** P3-8: the face track this slot followed. `region` then holds the\n * static region an older reader draws. */\n readonly follow?: EdlSlotFollow\n }>\n /** A \"+\"-joined set of \"none\" | \"scale\" | \"border\" | \"dim\" | …, eased over durationMs. */\n readonly emphasis?: { readonly style: string; readonly durationMs: number }\n /** Into THIS segment. \"cut\" | \"pan\" | \"zoom\" consume no time; \"xfade:<id>\" overlaps (D17).\n * `durationMs` never consumes timeline time for the non-overlap types: it\n * is the tween length for `pan` / `zoom` and is ignored for `cut`. */\n readonly transition?: { readonly type: string; readonly durationMs?: number }\n}\n\nexport interface EdlSegment {\n readonly id: string\n /** On the MASTER clock. */\n readonly inMs: number\n /** Exclusive, > inMs. */\n readonly outMs: number\n /** `EdlSource.id` supplying picture. Omit = audio-only EDL. */\n readonly video?: string\n /** `EdlSource.id` supplying sound. Default: the unique `role:\"master-audio\"` source, else `video`. */\n readonly audio?: string\n /** Dominant speaker label (informational). */\n readonly speaker?: string\n /** Into THIS segment. Only \"crossfade\" consumes time (D17); never on segments[0].\n * `durationMs` is optional and inert for \"cut\". */\n readonly transition?: { readonly type: \"cut\" | \"crossfade\"; readonly durationMs?: number }\n /** Per-segment crop override — SINGLE-slot only (D20). */\n readonly region?: EdlRegion\n readonly layout?: EdlLayout\n /** Free tags: \"hook\", \"chapter:2\", … (removed spans live in `Edl.dropped`). */\n readonly labels?: readonly string[]\n}\n\nexport interface EdlDropped {\n readonly inMs: number\n readonly outMs: number\n readonly reason: \"silence\" | \"filler\" | \"false-start\" | \"tangent\" | \"manual\" | string\n}\n\nexport interface Edl {\n readonly version: 1\n /** D19: are `segments` on the source master clock, or an already-rendered output clock? */\n readonly clock: \"master\" | \"output\"\n readonly sources: readonly EdlSource[]\n /** The ordered output timeline. Output time = cumulative segment durations, less overlap transitions. */\n readonly segments: readonly EdlSegment[]\n readonly dropped?: readonly EdlDropped[]\n /** Set when this EDL was re-cut from a rendered output (speaker-view after apply-edl). */\n readonly derivedFrom?: { readonly edlId: string; readonly clock: \"output\" }\n readonly meta?: {\n readonly title?: string\n readonly hook?: string\n /** Known aspects: `EDL_TARGET_ASPECTS`. Open (`string & {}`) so an EDL\n * written by a newer producer still type-checks — an unknown aspect is a\n * validation WARNING (validateEdl), never an issue. */\n readonly targetAspect?: EdlTargetAspect | (string & {})\n readonly platform?: string\n readonly notes?: string\n }\n}\n\n/** The `clips` mode's response/SDK shape. On the canvas the node emits a bare\n * `Edl[]` (T5: the `list` fan-out reads a top-level JSON array), and the\n * cloud relay writes `output_data` as this object — the unwrap to the bare\n * array happens in the output extractors, never in `output_data`. */\nexport interface EdlClipSet {\n readonly version: 1\n readonly clips: readonly Edl[]\n}\n\n/** The `chapters` mode's `output_data` shape — a plain `data` list. */\nexport interface ChapterSet {\n readonly version: 1\n readonly chapters: ReadonlyArray<{ readonly startMs: number; readonly title: string }>\n}\n\n/** The normalized JSON form of a transcribe result. */\nexport interface Transcript {\n readonly version: 1\n /** D19: which `EdlSource` this transcript was made from (drives the offset in remap). */\n readonly sourceId?: string\n readonly language?: string\n readonly words: ReadonlyArray<{\n readonly text: string\n readonly startMs: number\n readonly endMs: number\n readonly speaker?: string\n readonly confidence?: number\n }>\n readonly segments?: ReadonlyArray<{\n readonly startMs: number\n readonly endMs: number\n readonly text: string\n readonly speaker?: string\n }>\n /** Raw speaker label → the display name the words and segments now carry,\n * published by a node that renamed the speakers (Camera Switch), so a later\n * node can still find a speaker's original label. Absent = not renamed. */\n readonly speakerNames?: Readonly<Record<string, string>>\n}\n\n/** Duration (seconds) implied by a transcript — the LATEST word/segment `endMs`\n * across the whole transcript, in seconds. The edit-plan reserve's duration\n * fallback BENEATH the master-source ffprobe (`computeEditPlanReserveId`): the\n * authoritative reserve basis is a probe of the master media, exactly like the\n * plugin route; this transcript clock is used only in `buildPayload` (which\n * cannot ffprobe) and when that probe can't run, for a MASTER source node that\n * exposes no length of its own (a `reference-audio`/youtube or direct-URL\n * master carries its length in neither `data.duration` nor\n * `metadata.durationSeconds` — see `editPlanSourceDurationSec` — and its live\n * orchestrator output is a bare URL). The transcript is a REQUIRED edit-plan\n * input and is the timing map of that same master, so its last word's `endMs`\n * is a lower bound on the source's own clock.\n *\n * Accepts `unknown` because the cloud plugin's Zod is the transcript's schema\n * authority; this reads defensively and returns `undefined` for any shape it\n * can't measure (so the caller falls back to the ceiling bucket — the safe\n * over-reserve direction). Takes the MAX endMs rather than the last element so\n * an out-of-order words array can't under-report. NOTE the direction: a\n * transcript's last spoken word ends at or before the true media end (trailing\n * music/silence is not transcribed), so this can UNDER-estimate; bucket\n * round-up is the headroom, and the cloud re-probe money-gate refuses (never\n * overcharges) if the probed master still exceeds the reserved bucket. */\nexport function transcriptDurationSec(transcript: unknown): number | undefined {\n if (!transcript || typeof transcript !== \"object\") return undefined\n const t = transcript as { words?: unknown; segments?: unknown }\n let maxEndMs = 0\n const scan = (rows: unknown): void => {\n if (!Array.isArray(rows)) return\n for (const row of rows) {\n const endMs = (row as { endMs?: unknown } | null)?.endMs\n if (typeof endMs === \"number\" && Number.isFinite(endMs) && endMs > maxEndMs) {\n maxEndMs = endMs\n }\n }\n }\n // Max over BOTH words AND segments — a segment tail can extend past the last\n // word (mirrors the plugin's own `transcriptDurationMs`, which maxes both), so\n // scanning segments only when words is empty would under-report.\n scan(t.words)\n scan(t.segments)\n return maxEndMs > 0 ? maxEndMs / 1000 : undefined\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Pure functions\n// ─────────────────────────────────────────────────────────────────────────\n\n/** Is this segment-transition an OVERLAP (time-consuming) one? Only a\n * crossfade is. */\nfunction segmentTransitionOverlaps(t: EdlSegment[\"transition\"]): boolean {\n return !!t && t.type === \"crossfade\" && (t.durationMs ?? 0) > 0\n}\n\n/** Is this layout-transition an OVERLAP one? Only the `xfade:*` family\n * (a real cross-source blend) — THE one rule, `speakerSwitchOverlaps`;\n * `cut`/`pan`/`zoom` consume no output time. */\nfunction layoutTransitionOverlaps(t: EdlLayout[\"transition\"]): boolean {\n return !!t && speakerSwitchOverlaps(t.type) && (t.durationMs ?? 0) > 0\n}\n\n/** The overlap duration consumed at the boundary INTO this segment (D17).\n * A segment may carry at most one of the two transition fields\n * (validated), so we take whichever is present. */\nfunction overlapMsInto(seg: EdlSegment): number {\n if (segmentTransitionOverlaps(seg.transition)) return seg.transition!.durationMs ?? 0\n if (layoutTransitionOverlaps(seg.layout?.transition)) return seg.layout!.transition!.durationMs ?? 0\n return 0\n}\n\n/** Rendered duration of the edit, in ms. Σ segment durations minus the\n * overlap transitions (D17: an `xfade`/`crossfade` compresses the timeline\n * by its duration per boundary; `cut`/`pan`/`zoom` do not). Total over BOTH\n * the segment- and layout-transition fields.\n *\n * Derived FROM `segmentOutputStarts` so the invariant\n * `outputStart(last) + dur(last) === edlDurationMs` holds by construction on\n * every input — including a normalized-but-not-yet-validated EDL (the reserve\n * runs this before validate). The two must never be two independent overlap\n * implementations that can drift. */\nexport function edlDurationMs(edl: Edl): number {\n const starts = segmentOutputStarts(edl)\n if (starts.length === 0) return 0\n const last = edl.segments[edl.segments.length - 1]\n return Math.max(0, Math.round(starts[starts.length - 1] + Math.max(0, last.outMs - last.inMs)))\n}\n\n/** The output-clock start time of each segment (index-aligned to\n * `edl.segments`), accounting for D17 overlap: the transition INTO segment k\n * pulls its duration back from the boundary. `outputStart(0) = 0`;\n * `outputStart(n) + dur(n) === edlDurationMs`. The one output clock every\n * remap reads — a player seeking a rendered cut reads it too. */\nexport function edlSegmentOutputStarts(edl: Edl): number[] {\n return segmentOutputStarts(edl)\n}\n\nfunction segmentOutputStarts(edl: Edl): number[] {\n const starts: number[] = []\n let cursor = 0\n edl.segments.forEach((seg, i) => {\n // The transition into THIS segment overlaps the previous one.\n if (i > 0) cursor -= overlapMsInto(seg)\n starts.push(Math.max(0, Math.round(cursor)))\n cursor += Math.max(0, seg.outMs - seg.inMs)\n })\n return starts\n}\n\nconst inRange = (v: number, lo = 0, hi = 1) => v >= lo && v <= hi\n\nfunction regionIssues(r: EdlRegion, where: string): string[] {\n const out: string[] = []\n for (const [k, v] of Object.entries(r) as Array<[keyof EdlRegion, number]>) {\n if (!Number.isFinite(v) || !inRange(v)) out.push(`${where}: region.${k}=${v} out of 0..1`)\n }\n if (r.w <= 0 || r.h <= 0) out.push(`${where}: region has non-positive w/h`)\n if (r.x + r.w > 1 + 1e-9) out.push(`${where}: region extends past right edge (x+w>1)`)\n if (r.y + r.h > 1 + 1e-9) out.push(`${where}: region extends past bottom edge (y+h>1)`)\n return out\n}\n\n/** Library-produced (never construct one yourself — fields may be added). `ok` is `issues.length === 0`;\n * warnings never flip it. Issues = facts intrinsic to the EDL. Warnings = judgements against a REGISTRY\n * (source roles, speaker layouts/switches/emphasis, target aspects) that a newer version may widen — so an\n * older validator never rejects a newer EDL. */\nexport interface EdlValidation {\n readonly ok: boolean\n readonly issues: readonly string[]\n readonly warnings: readonly string[]\n}\n\n/** Structural validation. Coercion (defaults, clamping) is `normalizeEdl`'s\n * job; this reports what is still wrong after normalization. Segment ORDER is\n * the output timeline order and is NOT required to be monotonic on the master\n * clock — a legitimate multicam/clips EDL revisits earlier source time — so\n * the only per-segment ordering rule is `outMs > inMs`.\n *\n * The transition duration bound is the per-boundary ffmpeg-`xfade` limit: the\n * blend must be shorter than the adjacent material, so we validate at\n * `0.9 · min(the two adjacent segments)`. (combine-videos uses a more\n * conservative GLOBAL `0.9 · min(all clips)`; the per-boundary bound here is\n * the correct one, and the `apply-edl` executor must clamp per-boundary too —\n * copying combine's global-min would let validate pass a transition the\n * renderer then silently shortens, the R5 silent-edit this bound prevents.)\n * It applies only to overlap transitions; `cut`/`pan`/`zoom` are unbounded. */\nexport function validateEdl(edl: Edl): EdlValidation {\n const issues: string[] = []\n const warnings: string[] = []\n\n // A public validator reports, it does not throw: guard a raw object that\n // skipped normalizeEdl (missing/typed-wrong sources/segments).\n if (!Array.isArray(edl.segments) || !Array.isArray(edl.sources)) {\n edl = {\n ...edl,\n sources: Array.isArray(edl.sources) ? edl.sources : [],\n segments: Array.isArray(edl.segments) ? edl.segments : [],\n }\n }\n\n if (edl.version !== EDL_VERSION) issues.push(`version must be ${EDL_VERSION}`)\n if (edl.clock !== \"master\" && edl.clock !== \"output\") issues.push(`clock must be \"master\" or \"output\"`)\n\n const sourceIds = new Set<string>()\n let masterAudioCount = 0\n for (const s of edl.sources) {\n if (sourceIds.has(s.id)) issues.push(`duplicate source id \"${s.id}\"`)\n sourceIds.add(s.id)\n if (!s.url || !s.url.trim()) issues.push(`source \"${s.id}\": url is empty (media resolves from url)`)\n if (s.role === \"master-audio\") masterAudioCount++\n else if (s.role != null && !KNOWN_SOURCE_ROLES.has(s.role)) {\n warnings.push(`source \"${s.id}\": unknown role \"${s.role}\" (known: ${EDL_SOURCE_ROLES.join(\", \")})`)\n }\n if (s.region) issues.push(...regionIssues(s.region, `source \"${s.id}\"`))\n if (s.offsetMs !== undefined && !Number.isFinite(s.offsetMs)) issues.push(`source \"${s.id}\": offsetMs not finite`)\n }\n if (masterAudioCount > 1) issues.push(`more than one source has role:\"master-audio\" (${masterAudioCount})`)\n\n if (edl.segments.length === 0) issues.push(\"segments is empty\")\n\n edl.segments.forEach((seg, i) => {\n const at = `segment[${i}] \"${seg.id}\"`\n if (!(seg.outMs > seg.inMs)) issues.push(`${at}: outMs (${seg.outMs}) must be > inMs (${seg.inMs})`)\n if (seg.inMs < 0) issues.push(`${at}: inMs negative`)\n if (seg.video && !sourceIds.has(seg.video)) issues.push(`${at}: video source \"${seg.video}\" not in sources`)\n else if (seg.video) {\n const vs = edl.sources.find(s => s.id === seg.video)\n if (vs && vs.kind !== \"video\") issues.push(`${at}: video source \"${seg.video}\" is kind:\"${vs.kind}\", must be video`)\n }\n if (seg.audio && !sourceIds.has(seg.audio)) issues.push(`${at}: audio source \"${seg.audio}\" not in sources`)\n // A segment with no explicit audio must have a fallback: a master-audio source or its own video.\n if (!seg.audio && masterAudioCount === 0 && !seg.video) {\n issues.push(`${at}: no audio source and no master-audio/video fallback`)\n }\n\n // Transition rules.\n if (i === 0 && (seg.transition || seg.layout?.transition)) {\n issues.push(`${at}: segments[0] cannot have a transition (\"into this segment\" has no predecessor)`)\n }\n if (seg.transition && seg.layout?.transition) {\n issues.push(`${at}: both EdlSegment.transition and EdlLayout.transition set (pick one)`)\n }\n // The 0.9·min(adjacent) bound is the ffmpeg-xfade constraint and applies\n // ONLY to overlap transitions (crossfade / xfade:*). `cut`/`pan`/`zoom`\n // consume no time (overlapMsInto === 0) and their durationMs is inert, so\n // they are never bounded here.\n const ov = overlapMsInto(seg)\n if (ov > 0 && i > 0) {\n const prev = edl.segments[i - 1]\n const minAdj = Math.min(seg.outMs - seg.inMs, prev.outMs - prev.inMs)\n if (ov > 0.9 * minAdj + 1e-9) {\n issues.push(`${at}: overlap transition durationMs (${ov}) exceeds 0.9·min(adjacent segment)=${(0.9 * minAdj).toFixed(1)} — ffmpeg xfade would error / be clamped`)\n }\n }\n\n // Region rules (D20).\n if (seg.region) {\n issues.push(...regionIssues(seg.region, at))\n if (seg.layout?.slots && seg.layout.slots.length > 1) {\n issues.push(`${at}: segment.region is invalid when the layout has >1 slot (put the region on the slot)`)\n }\n }\n\n // Layout slot rules.\n for (const slot of seg.layout?.slots ?? []) {\n if (!sourceIds.has(slot.source)) issues.push(`${at}: slot source \"${slot.source}\" not in sources`)\n else {\n const src = edl.sources.find(s => s.id === slot.source)\n if (src && src.kind !== \"video\") issues.push(`${at}: slot source \"${slot.source}\" is kind:\"${src.kind}\", slots must be video`)\n }\n if (slot.weight !== undefined && !inRange(slot.weight)) issues.push(`${at}: slot.weight=${slot.weight} out of 0..1`)\n if (slot.region) issues.push(...regionIssues(slot.region, `${at} slot \"${slot.source}\"`))\n if (slot.follow) issues.push(...followIssues(slot.follow, slot.source, `${at} slot \"${slot.source}\"`))\n }\n })\n\n // segments ∩ dropped = ∅ (on the master clock).\n for (const d of edl.dropped ?? []) {\n if (!(d.outMs > d.inMs)) issues.push(`dropped range [${d.inMs},${d.outMs}) is not positive`)\n for (const seg of edl.segments) {\n if (seg.inMs < d.outMs && d.inMs < seg.outMs) {\n issues.push(`dropped range [${d.inMs},${d.outMs}) overlaps kept segment \"${seg.id}\" [${seg.inMs},${seg.outMs})`)\n break\n }\n }\n }\n\n // Registry-class findings (layouts, switches, emphasis, target aspect).\n warnings.push(...speakerPresentationWarnings(edl))\n\n return { ok: issues.length === 0, issues, warnings }\n}\n\n/** Validate a clip set (the `clips` mode output). */\nexport function validateEdlClipSet(set: EdlClipSet): EdlValidation {\n const issues: string[] = []\n const warnings: string[] = []\n if (set.version !== EDL_VERSION) issues.push(`clipset version must be ${EDL_VERSION}`)\n if (set.clips.length === 0) issues.push(\"clipset has no clips\")\n set.clips.forEach((clip, i) => {\n const r = validateEdl(clip)\n if (!r.ok) issues.push(...r.issues.map(m => `clip[${i}]: ${m}`))\n warnings.push(...r.warnings.map(m => `clip[${i}]: ${m}`))\n })\n return { ok: issues.length === 0, issues, warnings }\n}\n\nfunction offsetFor(edl: Edl, sourceId: string | undefined): number {\n if (!sourceId) return 0\n return edl.sources.find(s => s.id === sourceId)?.offsetMs ?? 0\n}\n\n/**\n * Map an instant on `sourceId`'s clock to the rendered output clock, or `null`\n * if that instant was dropped (falls in no kept segment). Applies the D19\n * offset (`masterMs = sourceMs + offsetMs`) and the D17 overlap compression.\n * `sourceId` omitted ⇒ the instant is already on the master clock.\n */\nexport function remapMsThroughEdl(edl: Edl, sourceMs: number, sourceId?: string): number | null {\n const masterMs = sourceMs + offsetFor(edl, sourceId)\n const starts = segmentOutputStarts(edl)\n for (let i = 0; i < edl.segments.length; i++) {\n const seg = edl.segments[i]\n if (masterMs >= seg.inMs && masterMs < seg.outMs) {\n return Math.round(starts[i] + (masterMs - seg.inMs))\n }\n }\n return null\n}\n\n/**\n * The inverse of `remapMsThroughEdl`: the master-clock instant the rendered\n * output plays at `outputMs`, or `null` before the start, at or past the end,\n * and for a non-finite time. Inside a crossfade both segments play; the\n * INCOMING one (the later segment) is the one named, since the cut has moved\n * to it. On an EDL that never revisits master time (a Tighten cut),\n * `remapMsThroughEdl(edl, outputMsToMasterMs(edl, t)) === t` for every output\n * instant `t`; an EDL that re-reads a span maps two output instants to one\n * master instant, and the remap names the first.\n */\nexport function outputMsToMasterMs(edl: Edl, outputMs: number): number | null {\n if (!Number.isFinite(outputMs) || outputMs < 0) return null\n const starts = segmentOutputStarts(edl)\n for (let i = edl.segments.length - 1; i >= 0; i--) {\n const seg = edl.segments[i]\n const dur = Math.max(0, seg.outMs - seg.inMs)\n if (outputMs >= starts[i] && outputMs < starts[i] + dur) return Math.round(seg.inMs + (outputMs - starts[i]))\n }\n return null\n}\n\n/**\n * Remap a transcript onto the rendered output: drop words that fall entirely\n * in removed material, clip a word that straddles a cut to its kept part (a\n * word running across two TOUCHING segments — contiguous on both the master\n * and the output clock — is not cut, and keeps its full length), and apply\n * the source offset (via `transcript.sourceId`). Captions, chapters and\n * clip offsets all depend on this one function.\n */\nexport function remapTranscriptThroughEdl(edl: Edl, transcript: Transcript): Transcript {\n const off = offsetFor(edl, transcript.sourceId)\n const starts = segmentOutputStarts(edl)\n /** Segment `j + 1` continues segment `j` on BOTH clocks: master time with no\n * jump, output time with no overlap. */\n const touches = (j: number): boolean => {\n const a = edl.segments[j]\n const b = edl.segments[j + 1]\n return b.inMs === a.outMs && starts[j + 1] === starts[j] + Math.max(0, a.outMs - a.inMs)\n }\n\n const mapWord = (w: Transcript[\"words\"][number]): (Transcript[\"words\"][number]) | null => {\n const startMaster = w.startMs + off\n const endMaster = w.endMs + off\n // A zero-width word is a point: keep it if the instant is kept (consistent\n // with remapMsThroughEdl, which returns non-null for a kept instant).\n if (startMaster === endMaster) {\n for (let i = 0; i < edl.segments.length; i++) {\n const seg = edl.segments[i]\n if (startMaster >= seg.inMs && startMaster < seg.outMs) {\n const out = Math.round(starts[i] + (startMaster - seg.inMs))\n return { ...w, startMs: out, endMs: out }\n }\n }\n return null\n }\n // Find the first kept segment that intersects [startMaster, endMaster) and\n // clip the word to that kept part — extended across every following\n // segment that TOUCHES it (decided 2026-10-08): the next segment resumes\n // the master clock exactly where this one ends and starts on the output\n // exactly where this one ends (no overlap into it), so the word plays\n // through unbroken and keeps its full length. A Speaker View turn split is\n // the common case. A jump in the master clock, or a crossfade / xfade into\n // the next segment, still clips the word to its first kept part.\n for (let i = 0; i < edl.segments.length; i++) {\n const seg = edl.segments[i]\n const lo = Math.max(startMaster, seg.inMs)\n let hi = Math.min(endMaster, seg.outMs)\n if (lo < hi) {\n for (let j = i; hi < endMaster && j + 1 < edl.segments.length && touches(j); j++) {\n hi = Math.min(endMaster, edl.segments[j + 1].outMs)\n }\n return {\n ...w,\n startMs: Math.round(starts[i] + (lo - seg.inMs)),\n endMs: Math.round(starts[i] + (hi - seg.inMs)),\n }\n }\n }\n return null\n }\n\n const words: Transcript[\"words\"][number][] = []\n for (const w of transcript.words) {\n const mapped = mapWord(w)\n if (mapped) words.push(mapped)\n }\n\n // A transcript SEGMENT (chapter-ish span) can straddle a cut and/or several\n // kept ranges. Take the ENVELOPE of every kept intersection: the earliest\n // kept output start to the latest kept output end. Endpoint-probing (map\n // start and end independently) inverts across a crossfade and collapses a\n // straddler to ~1ms; the envelope avoids both.\n const mapSegment = (s: NonNullable<Transcript[\"segments\"]>[number]) => {\n const startMaster = s.startMs + off\n const endMaster = s.endMs + off\n let outLo: number | null = null\n let outHi: number | null = null\n for (let i = 0; i < edl.segments.length; i++) {\n const seg = edl.segments[i]\n const lo = Math.max(startMaster, seg.inMs)\n const hi = Math.min(endMaster, seg.outMs)\n if (lo < hi) {\n const a = Math.round(starts[i] + (lo - seg.inMs))\n const b = Math.round(starts[i] + (hi - seg.inMs))\n if (outLo === null || a < outLo) outLo = a\n if (outHi === null || b > outHi) outHi = b\n }\n }\n if (outLo === null || outHi === null) return null\n return { ...s, startMs: outLo, endMs: outHi }\n }\n\n const segments = transcript.segments\n ?.map(mapSegment)\n .filter((s): s is NonNullable<typeof s> => s !== null)\n\n return { ...transcript, words, ...(segments ? { segments } : {}) }\n}\n\n/** Speaker turns: consecutive same-speaker words merged across gaps shorter\n * than `mergeGapMs`, then turns shorter than `minTurnMs` dropped. */\nexport function speakerTurns(\n transcript: Transcript,\n opts: { minTurnMs: number; mergeGapMs: number },\n): Array<{ speaker: string; startMs: number; endMs: number }> {\n const turns: Array<{ speaker: string; startMs: number; endMs: number }> = []\n for (const w of transcript.words) {\n const speaker = w.speaker ?? \"spk\"\n const last = turns[turns.length - 1]\n if (last && last.speaker === speaker && w.startMs - last.endMs <= opts.mergeGapMs) {\n last.endMs = Math.max(last.endMs, w.endMs)\n } else {\n turns.push({ speaker, startMs: w.startMs, endMs: w.endMs })\n }\n }\n return turns.filter(t => t.endMs - t.startMs >= opts.minTurnMs)\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Normalization (coerce, never reject; runs at every write site)\n// ─────────────────────────────────────────────────────────────────────────\n\nconst num = (v: unknown, fallback = 0): number => (typeof v === \"number\" && Number.isFinite(v) ? v : fallback)\nconst clamp01 = (v: number) => Math.min(1, Math.max(0, v))\nconst str = (v: unknown): string | undefined => (typeof v === \"string\" ? v : undefined)\n\nfunction normalizeRegion(r: unknown): EdlRegion | undefined {\n if (!r || typeof r !== \"object\") return undefined\n const o = r as Record<string, unknown>\n if ([\"x\", \"y\", \"w\", \"h\"].some(k => typeof o[k] !== \"number\")) return undefined\n const x = clamp01(num(o.x))\n const y = clamp01(num(o.y))\n // Fit the box inside the frame so the result always passes validateEdl\n // (per-axis clamping alone can leave x+w>1). A degenerate box is dropped.\n const w = Math.min(clamp01(num(o.w)), 1 - x)\n const h = Math.min(clamp01(num(o.h)), 1 - y)\n if (w <= 0 || h <= 0) return undefined\n return { x, y, w, h }\n}\n\n/**\n * Coerce an unknown value into a well-formed `Edl`: fill defaults, drop unknown\n * fields, clamp regions to 0..1. All times are integer ms — there is NO\n * seconds→ms guessing (an integer-seconds EDL would silently become a\n * 1000×-longer edit; the contract is ms-only and a value that cannot be a\n * plausible ms EDL is a validation error, not a reinterpretation).\n *\n * Segment ORDER is preserved verbatim: it is the output timeline order, and a\n * multicam/clips EDL legitimately revisits earlier source time, so re-sorting\n * would corrupt it. (`dropped` has no ordering semantics and is left as-is.)\n */\nexport function normalizeEdl(input: unknown): Edl {\n const o = (input && typeof input === \"object\" ? input : {}) as Record<string, unknown>\n\n const sources: EdlSource[] = Array.isArray(o.sources)\n ? o.sources.map((raw, i) => {\n const s = (raw ?? {}) as Record<string, unknown>\n const src: EdlSource = {\n id: str(s.id) ?? `src-${i}`,\n url: str(s.url) ?? \"\",\n kind: s.kind === \"audio\" ? \"audio\" : \"video\",\n ...(s.offsetMs !== undefined ? { offsetMs: Math.round(num(s.offsetMs)) } : {}),\n ...(str(s.role) ? { role: s.role as EdlSource[\"role\"] } : {}),\n ...(Array.isArray(s.speakers) ? { speakers: s.speakers.filter((x): x is string => typeof x === \"string\") } : {}),\n ...(normalizeRegion(s.region) ? { region: normalizeRegion(s.region) } : {}),\n }\n return src\n })\n : []\n\n const segments: EdlSegment[] = Array.isArray(o.segments)\n ? o.segments.map((raw, i) => {\n const s = (raw ?? {}) as Record<string, unknown>\n const region = normalizeRegion(s.region)\n // A transition \"into\" segments[0] carries no information (no\n // predecessor), so strip it here rather than letting validateEdl 400 a\n // fixable EDL — LLM/hand-written EDLs routinely attach one to every\n // segment. Same for a layout transition on the first segment.\n const isFirst = i === 0\n const t = isFirst ? undefined : (s.transition as Record<string, unknown> | undefined)\n const layout = normalizeLayout(s.layout, isFirst)\n const seg: EdlSegment = {\n id: str(s.id) ?? `seg-${i}`,\n inMs: Math.round(num(s.inMs)),\n outMs: Math.round(num(s.outMs)),\n ...(str(s.video) ? { video: str(s.video) } : {}),\n ...(str(s.audio) ? { audio: str(s.audio) } : {}),\n ...(str(s.speaker) ? { speaker: str(s.speaker) } : {}),\n ...(t && (t.type === \"cut\" || t.type === \"crossfade\")\n ? { transition: { type: t.type as \"cut\" | \"crossfade\", durationMs: t.type === \"cut\" ? 0 : Math.round(num(t.durationMs)) } }\n : {}),\n ...(region ? { region } : {}),\n ...(layout ? { layout } : {}),\n ...(Array.isArray(s.labels) ? { labels: s.labels.filter((x): x is string => typeof x === \"string\") } : {}),\n }\n return seg\n })\n : []\n\n const dropped: EdlDropped[] | undefined = Array.isArray(o.dropped)\n ? o.dropped.map(raw => {\n const d = (raw ?? {}) as Record<string, unknown>\n return { inMs: Math.round(num(d.inMs)), outMs: Math.round(num(d.outMs)), reason: str(d.reason) ?? \"manual\" }\n })\n : undefined\n\n const meta = o.meta && typeof o.meta === \"object\" ? (o.meta as Edl[\"meta\"]) : undefined\n\n return {\n version: EDL_VERSION,\n clock: o.clock === \"output\" ? \"output\" : \"master\",\n sources,\n segments,\n ...(dropped ? { dropped } : {}),\n ...(o.derivedFrom && typeof o.derivedFrom === \"object\"\n ? { derivedFrom: { edlId: str((o.derivedFrom as Record<string, unknown>).edlId) ?? \"\", clock: \"output\" } }\n : {}),\n ...(meta ? { meta } : {}),\n }\n}\n\n/** A slot's `follow` is structurally sound: the slot's own source (the crop\n * is on that frame — a follow of another camera cannot describe the render),\n * a track id, a known motion. */\nfunction followIssues(follow: EdlSlotFollow, slotSource: string, at: string): string[] {\n const f = follow as unknown as Record<string, unknown>\n const issues: string[] = []\n if (f.sourceId !== slotSource) issues.push(`${at}: follow.sourceId ${JSON.stringify(f.sourceId)} is not the slot's source \"${slotSource}\"`)\n if (typeof f.trackId !== \"string\" || !f.trackId.trim()) issues.push(`${at}: follow.trackId is empty`)\n if (typeof f.motion !== \"string\" || !KNOWN_FOLLOW_MOTIONS.has(f.motion)) {\n issues.push(`${at}: follow.motion ${JSON.stringify(f.motion)} is not one of ${FOLLOW_MOTIONS.join(\", \")}`)\n }\n return issues\n}\n\n/** `follow` with its three fields, unknown keys dropped; undefined when any\n * field is missing or malformed (never guessed: an unknown motion is not a\n * motion this contract can describe). */\nfunction normalizeFollow(input: unknown): EdlSlotFollow | undefined {\n if (!input || typeof input !== \"object\") return undefined\n const o = input as Record<string, unknown>\n const sourceId = str(o.sourceId)\n const trackId = str(o.trackId)\n if (!sourceId || !trackId || typeof o.motion !== \"string\" || !KNOWN_FOLLOW_MOTIONS.has(o.motion)) return undefined\n return { sourceId, trackId, motion: o.motion as EdlSlotFollowMotion }\n}\n\nfunction normalizeLayout(input: unknown, dropTransition = false): EdlLayout | undefined {\n if (!input || typeof input !== \"object\") return undefined\n const o = input as Record<string, unknown>\n // Default the mode to \"single\" rather than dropping the whole layout — a\n // layout with slots/transition but no mode would otherwise lose them (and an\n // omitted xfade would silently lengthen the timeline).\n const mode = str(o.mode) || \"single\"\n const slots = Array.isArray(o.slots)\n ? o.slots\n .map(raw => {\n const s = (raw ?? {}) as Record<string, unknown>\n const source = str(s.source)\n if (!source) return null\n const region = normalizeRegion(s.region)\n const follow = normalizeFollow(s.follow)\n return {\n source,\n ...(region ? { region } : {}),\n ...(str(s.speaker) ? { speaker: str(s.speaker) } : {}),\n ...(s.weight !== undefined ? { weight: clamp01(num(s.weight)) } : {}),\n ...(follow ? { follow } : {}),\n }\n })\n .filter((x): x is NonNullable<typeof x> => x !== null)\n : undefined\n const emphasis = o.emphasis && typeof o.emphasis === \"object\"\n ? { style: str((o.emphasis as Record<string, unknown>).style) ?? \"none\", durationMs: Math.round(num((o.emphasis as Record<string, unknown>).durationMs)) }\n : undefined\n const transition = !dropTransition && o.transition && typeof o.transition === \"object\"\n ? { type: str((o.transition as Record<string, unknown>).type) ?? \"cut\", durationMs: Math.round(num((o.transition as Record<string, unknown>).durationMs)) }\n : undefined\n return {\n mode,\n ...(slots ? { slots } : {}),\n ...(emphasis ? { emphasis } : {}),\n ...(transition ? { transition } : {}),\n }\n}\n\n/** A time field as integer ms: a finite, non-negative number or numeric\n * string; `undefined` for anything else. */\nfunction timeMs(v: unknown): number | undefined {\n const n = typeof v === \"number\" ? v : typeof v === \"string\" && v.trim() !== \"\" ? Number(v) : Number.NaN\n return Number.isFinite(n) && n >= 0 ? Math.round(n) : undefined\n}\n\n/** A word's or segment's span: `startMs`/`endMs` (or the `start`/`end`\n * aliases). A zero-width span is a point and is kept; `undefined` only for a\n * broken one — a missing or unusable time, or an end before its start. */\nfunction spanMs(o: Record<string, unknown>): { startMs: number; endMs: number } | undefined {\n const startMs = timeMs(o.startMs ?? o.start)\n const endMs = timeMs(o.endMs ?? o.end)\n if (startMs === undefined || endMs === undefined || endMs < startMs) return undefined\n return { startMs, endMs }\n}\n\n/**\n * Coerce an unknown value into a `Transcript` — THE transcript reader\n * (decided 2026-10-08). The Cloud plugin's `coerceTranscript` reads by the\n * same rule, so the app and the plugin read one transcript the same way.\n * ms-only, as `normalizeEdl`; the `start`/`end` aliases are read when\n * `startMs`/`endMs` are absent. A zero-width word or segment (also one that\n * rounds to zero width) is a POINT and is kept, as before. Only a broken one\n * is dropped, never clamped: a missing start or end, a time that is not a\n * finite, non-negative number, or an end before its start. Words come out\n * sorted by start time (stable). A renamed transcript's `speakerNames` map is\n * kept (its non-empty string entries).\n */\nexport function normalizeTranscript(input: unknown): Transcript {\n const o = (input && typeof input === \"object\" ? input : {}) as Record<string, unknown>\n const words: Transcript[\"words\"][number][] = []\n if (Array.isArray(o.words)) {\n for (const raw of o.words) {\n if (!raw || typeof raw !== \"object\") continue\n const w = raw as Record<string, unknown>\n const span = spanMs(w)\n if (!span) continue\n words.push({\n text: str(w.text) ?? \"\",\n ...span,\n ...(str(w.speaker) ? { speaker: str(w.speaker) } : {}),\n ...(typeof w.confidence === \"number\" ? { confidence: w.confidence } : {}),\n })\n }\n words.sort((a, b) => a.startMs - b.startMs)\n }\n const segments = Array.isArray(o.segments)\n ? o.segments.flatMap(raw => {\n if (!raw || typeof raw !== \"object\") return []\n const s = raw as Record<string, unknown>\n const span = spanMs(s)\n return span ? [{ ...span, text: str(s.text) ?? \"\", ...(str(s.speaker) ? { speaker: str(s.speaker) } : {}) }] : []\n })\n : undefined\n const speakerNames = speakerNamesOf(o.speakerNames)\n return {\n version: EDL_VERSION,\n ...(str(o.sourceId) ? { sourceId: str(o.sourceId) } : {}),\n ...(str(o.language) ? { language: str(o.language) } : {}),\n words,\n ...(segments ? { segments } : {}),\n ...(speakerNames ? { speakerNames } : {}),\n }\n}\n\n/** A renamed transcript's raw → display map: entries whose label and name are\n * both non-empty strings; undefined when none is left. Built with\n * `Object.fromEntries`, so every label (even `__proto__`) stays an own entry. */\nfunction speakerNamesOf(v: unknown): Record<string, string> | undefined {\n if (!v || typeof v !== \"object\" || Array.isArray(v)) return undefined\n const entries = Object.entries(v as Record<string, unknown>).filter(\n (e): e is [string, string] => e[0].length > 0 && typeof e[1] === \"string\" && e[1].length > 0,\n )\n return entries.length > 0 ? Object.fromEntries(entries) : undefined\n}\n","/**\n * A person's review of an Edit Plan, and the ONE rule that makes it win.\n *\n * The planner's output stays on `data.generatedJson`, untouched. A review edit\n * lives beside it on `data.editedEdl` (TA13, decided 2026-10-04), tagged by\n * `kind` and fingerprinted with `basis` — the hash of the plan it was made\n * against. An edit whose basis no longer matches (the plan was re-run) is\n * ignored by construction, so no writer has to remember to clear it for the\n * read to be right. The edit is run-result data (TA14, decided 2026-10-04):\n * `editedEdl` is in `EXECUTION_DATA_KEYS`, so it stays out of undo, presets,\n * templates and exports, and Clear results wipes it.\n *\n * - Tighten: `{v:1, kind:\"edl\", basis, edl:{segments, dropped}}`. The resolved\n * plan is the planner's EDL with the edit's segments and dropped spans;\n * sources, clock and meta always come from the plan (an edit never stores\n * sources).\n * - Clips: `{v:1, kind:\"clips\", basis, clips:[{keep, hook?}]}`, index-aligned\n * with the plan's clips, holding decisions only. The list a fan-out reads\n * stays on the PLAN's indices, with `\"\"` at every dropped clip (TA16,\n * decided 2026-10-04), so an edge selector picks the same clips it picked\n * for the preview. `json` holds the kept clips only, so a scalar read (the\n * first item) is the first kept clip. An edited hook travels as `meta.hook`\n * (TA20, decided 2026-10-04: text only).\n * - Chapters have no review: an edit never applies.\n *\n * Every read of an Edit Plan's saved output calls `editPlanSavedOutput`, on\n * both engines; `extractGeneratedJsonAsList` stays generic.\n */\nimport { validateEdl, type Edl, type EdlDropped, type EdlSegment, type EdlValidation } from \"./edl.js\"\n\nexport const EDITED_EDL_VERSION = 1 as const\n\n/** A Tighten plan's review: the kept segments and the dropped spans. */\nexport interface EditedEdlCut {\n readonly v: typeof EDITED_EDL_VERSION\n readonly kind: \"edl\"\n /** `editPlanBasis` of the `generatedJson` this edit was made against. */\n readonly basis: string\n readonly edl: {\n readonly segments: readonly EdlSegment[]\n readonly dropped: readonly EdlDropped[]\n }\n}\n\n/** One clip's review decision, at the clip's index in the plan. */\nexport interface EditedClipDecision {\n readonly keep: boolean\n /** The clip's hook as the person rewrote it (text only); absent = the plan's. */\n readonly hook?: string\n}\n\n/** A clip set's review: one decision per planned clip, index-aligned. */\nexport interface EditedClipSet {\n readonly v: typeof EDITED_EDL_VERSION\n readonly kind: \"clips\"\n /** `editPlanBasis` of the `generatedJson` this edit was made against. */\n readonly basis: string\n readonly clips: readonly EditedClipDecision[]\n}\n\n/** What `data.editedEdl` on an Edit Plan holds. */\nexport type EditedEdl = EditedEdlCut | EditedClipSet\n\n/**\n * How the review edit stood when the plan was resolved:\n * - `none`: there is no edit;\n * - `applied`: the edit was made on this plan and wins;\n * - `stale`: it was made on another plan (a re-run, including one that\n * changed the clip count or the plan's mode) and is ignored;\n * - `invalid`: it is malformed, or, made on this plan, it does not fit its\n * kind or shape; it is ignored.\n */\nexport type EditPlanEditStatus = \"none\" | \"applied\" | \"stale\" | \"invalid\"\n\n/** An Edit Plan's output as every reader receives it. */\nexport interface EditPlanSavedOutput {\n /** Tighten: the EDL. Clips: the kept clips. Chapters: the chapter set. */\n readonly json: unknown\n /** Clips only: one JSON string per PLANNED clip, `\"\"` where a clip is dropped. */\n readonly listResults?: string[]\n}\n\nexport interface ResolvedEditPlanOutput extends EditPlanSavedOutput {\n readonly status: EditPlanEditStatus\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// basis: FNV-1a-64 over the key-sorted JSON\n// ─────────────────────────────────────────────────────────────────────────\n\n/** JSON text with every object's keys sorted, at every depth. `workflows.nodes`\n * is JSONB, which does not keep key order, so the stored plan can come back\n * with its keys in another order; its canonical text does not. Values follow\n * `JSON.stringify`: an undefined or function value drops its key (and is\n * `null` inside an array), and a non-finite number is `null`. */\nfunction canonicalJson(value: unknown): string | undefined {\n if (value === null) return \"null\"\n switch (typeof value) {\n case \"string\":\n case \"boolean\":\n return JSON.stringify(value)\n case \"number\":\n return Number.isFinite(value) ? JSON.stringify(value) : \"null\"\n case \"object\": {\n const toJSON = (value as { toJSON?: unknown }).toJSON\n if (typeof toJSON === \"function\") return canonicalJson((value as { toJSON: () => unknown }).toJSON())\n if (Array.isArray(value)) return `[${value.map((item) => canonicalJson(item) ?? \"null\").join(\",\")}]`\n const parts: string[] = []\n for (const key of Object.keys(value).sort()) {\n const text = canonicalJson((value as Record<string, unknown>)[key])\n if (text !== undefined) parts.push(`${JSON.stringify(key)}:${text}`)\n }\n return `{${parts.join(\",\")}}`\n }\n default:\n return undefined\n }\n}\n\n/** FNV-1a-64 over the UTF-8 bytes of `text`, as 16 lowercase hex digits. The\n * 64-bit state is two 32-bit halves: the prime is 2^40 + 435, so\n * `h × prime = h × 435 + (h << 40)` (mod 2^64), and every partial product\n * stays an exact double. */\nfunction fnv1a64(text: string): string {\n let hi = 0xcbf29ce4\n let lo = 0x84222325\n const mix = (byte: number): void => {\n lo = (lo ^ byte) >>> 0\n const loProduct = lo * 435\n const carry = Math.floor(loProduct / 0x1_0000_0000)\n hi = (hi * 435 + carry + ((lo << 8) >>> 0)) >>> 0\n lo = loProduct >>> 0\n }\n for (let i = 0; i < text.length; i++) {\n let code = text.charCodeAt(i)\n // A surrogate pair is one code point; a lone surrogate encodes as U+FFFD,\n // as TextEncoder does.\n if (code >= 0xd800 && code <= 0xdbff) {\n const next = i + 1 < text.length ? text.charCodeAt(i + 1) : 0\n if (next >= 0xdc00 && next <= 0xdfff) {\n code = 0x10000 + ((code - 0xd800) << 10) + (next - 0xdc00)\n i++\n } else code = 0xfffd\n } else if (code >= 0xdc00 && code <= 0xdfff) code = 0xfffd\n if (code < 0x80) mix(code)\n else if (code < 0x800) {\n mix(0xc0 | (code >> 6))\n mix(0x80 | (code & 0x3f))\n } else if (code < 0x10000) {\n mix(0xe0 | (code >> 12))\n mix(0x80 | ((code >> 6) & 0x3f))\n mix(0x80 | (code & 0x3f))\n } else {\n mix(0xf0 | (code >> 18))\n mix(0x80 | ((code >> 12) & 0x3f))\n mix(0x80 | ((code >> 6) & 0x3f))\n mix(0x80 | (code & 0x3f))\n }\n }\n return hi.toString(16).padStart(8, \"0\") + lo.toString(16).padStart(8, \"0\")\n}\n\n/**\n * The basis of every plan object already hashed. Hashing walks the whole plan\n * (about 20 ms on a large one), and both engines read the same saved plan\n * object many times: each review edit is a new `editedEdl` object over an\n * unchanged plan, and a run reads a seeded plan at every wire. Keyed by the\n * plan OBJECT, so it relies on a plan never being mutated in place: the editor\n * never mutates node data (a new plan is a new object), and the server reads\n * `generatedJson` as stored. A copy of a plan is another object and is hashed\n * on its own.\n */\nconst basisByPlan = new WeakMap<object, string>()\n\n/**\n * The fingerprint of an Edit Plan's stored output (`data.generatedJson`, as\n * unwrapped): FNV-1a-64 of the UTF-8 bytes of its key-sorted JSON, as 16\n * lowercase hex digits. Equal for any key order, so a JSONB round trip keeps\n * it; any change to a value, or to array order, changes it.\n */\nexport function editPlanBasis(plan: unknown): string {\n if (typeof plan !== \"object\" || plan === null) return fnv1a64(canonicalJson(plan) ?? \"\")\n const cached = basisByPlan.get(plan)\n if (cached !== undefined) return cached\n const basis = fnv1a64(canonicalJson(plan) ?? \"\")\n basisByPlan.set(plan, basis)\n return basis\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// The envelope\n// ─────────────────────────────────────────────────────────────────────────\n\ntype PlanShape = \"edl\" | \"clips\" | \"other\"\n\nconst isRecord = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v)\n\nfunction planShape(plan: unknown): PlanShape {\n if (Array.isArray(plan)) return \"clips\"\n if (isRecord(plan) && Array.isArray(plan.segments)) return \"edl\"\n return \"other\"\n}\n\ntype EnvelopeCheck =\n | { readonly status: \"none\" }\n | { readonly status: \"applied\"; readonly edited: EditedEdl }\n | { readonly status: \"stale\" | \"invalid\"; readonly issue: string }\n\n/** Is `edited` an edit of THIS plan? The envelope (version, basis, kind),\n * then the basis, then the plan's shape and the alignment. The basis comes\n * before the shape and the clip count because a re-run that changes the clip\n * count or the plan's mode is a re-plan (`stale`), not a malformed edit; once\n * the basis matches, a shape or count mismatch really is `invalid`. Never\n * looks inside the cut's segments (that is `validateEdl`'s). */\nfunction checkEnvelope(edited: unknown, plan: unknown): EnvelopeCheck {\n if (edited === undefined || edited === null) return { status: \"none\" }\n if (!isRecord(edited)) return { status: \"invalid\", issue: \"editedEdl must be an object\" }\n if (edited.v !== EDITED_EDL_VERSION) return { status: \"invalid\", issue: `editedEdl.v must be ${EDITED_EDL_VERSION}` }\n if (typeof edited.basis !== \"string\" || edited.basis.length === 0) {\n return { status: \"invalid\", issue: \"editedEdl.basis must be a non-empty string\" }\n }\n if (edited.kind !== \"edl\" && edited.kind !== \"clips\") {\n return { status: \"invalid\", issue: `editedEdl.kind must be \"edl\" or \"clips\"` }\n }\n if (edited.basis !== editPlanBasis(plan)) {\n return { status: \"stale\", issue: \"editedEdl.basis does not match the plan: the plan changed since this edit was made\" }\n }\n const shape = planShape(plan)\n if (edited.kind === \"edl\") {\n if (shape !== \"edl\") return { status: \"invalid\", issue: `an \"edl\" edit needs a Tighten plan (one EDL); this plan is ${describeShape(shape)}` }\n const edl = edited.edl\n if (!isRecord(edl) || !Array.isArray(edl.segments) || !Array.isArray(edl.dropped)) {\n return { status: \"invalid\", issue: \"editedEdl.edl must hold a segments array and a dropped array\" }\n }\n } else if (edited.kind === \"clips\") {\n if (shape !== \"clips\") return { status: \"invalid\", issue: `a \"clips\" edit needs a clip set; this plan is ${describeShape(shape)}` }\n const clips = edited.clips\n if (!Array.isArray(clips)) return { status: \"invalid\", issue: \"editedEdl.clips must be an array\" }\n const planned = (plan as readonly unknown[]).length\n if (clips.length !== planned) {\n return { status: \"invalid\", issue: `editedEdl.clips holds ${clips.length} decisions; the plan has ${planned} clips` }\n }\n const bad = clips.findIndex(\n (c) => !isRecord(c) || typeof c.keep !== \"boolean\" || (c.hook !== undefined && typeof c.hook !== \"string\"),\n )\n if (bad >= 0) return { status: \"invalid\", issue: `editedEdl.clips[${bad}] must be {keep: boolean, hook?: string}` }\n }\n return { status: \"applied\", edited: edited as unknown as EditedEdl }\n}\n\nfunction describeShape(shape: PlanShape): string {\n return shape === \"edl\" ? \"a Tighten plan\" : shape === \"clips\" ? \"a clip set\" : \"neither (a chapter list, or no plan)\"\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// The resolver\n// ─────────────────────────────────────────────────────────────────────────\n\n/** The plan's clip set as one JSON string per clip — today's list output. */\nfunction plannedList(plan: readonly unknown[]): string[] {\n return plan.map((clip) => (typeof clip === \"string\" ? clip : JSON.stringify(clip)))\n}\n\nfunction asOutput(plan: unknown): EditPlanSavedOutput {\n return Array.isArray(plan) ? { json: plan, listResults: plannedList(plan) } : { json: plan }\n}\n\n/** A clip with the person's hook, never mutating the plan's clip. */\nfunction withHook(clip: unknown, hook: string | undefined): unknown {\n if (hook === undefined) return clip\n let value = clip\n if (typeof clip === \"string\") {\n try {\n value = JSON.parse(clip)\n } catch {\n return clip\n }\n }\n if (!isRecord(value)) return clip\n const meta = isRecord(value.meta) ? value.meta : {}\n return { ...value, meta: { ...meta, hook } }\n}\n\n/**\n * An Edit Plan's output with the person's review applied: what every edit-plan\n * read hands downstream, on both engines.\n *\n * The edit applies when its shape matches the plan's kind and its `basis` is\n * this plan's. It applies even when the cut it holds is not a well-formed EDL:\n * the render then refuses it with its own issues, where falling back to the\n * planner's cut would silently render what the person removed. A stale or\n * invalid edit is ignored, and the plan is read as planned.\n */\nexport function resolveEditPlanOutput(plan: unknown, editedEdl: unknown): ResolvedEditPlanOutput {\n const check = checkEnvelope(editedEdl, plan)\n if (check.status !== \"applied\") return { status: check.status, ...asOutput(plan) }\n const edited = check.edited\n if (edited.kind === \"edl\") {\n const json = { ...(plan as Record<string, unknown>), segments: edited.edl.segments, dropped: edited.edl.dropped }\n return { status: \"applied\", json }\n }\n const rows = (plan as readonly unknown[]).map((clip, i) => {\n const decision = edited.clips[i]!\n return decision.keep ? withHook(clip, decision.hook) : undefined\n })\n return {\n status: \"applied\",\n json: rows.filter((clip) => clip !== undefined),\n listResults: rows.map((clip) => (clip === undefined ? \"\" : typeof clip === \"string\" ? clip : JSON.stringify(clip))),\n }\n}\n\n/**\n * An Edit Plan node's SAVED output — the one read every edit-plan reader makes\n * of `data` (a node outside the run, the editor's own read of the canvas).\n * `undefined` when the node holds no plan. With no edit it is exactly the plan:\n * `{json}`, plus `listResults` (one JSON string per clip) for a clip set.\n */\nexport function editPlanSavedOutput(data: Readonly<Record<string, unknown>>): EditPlanSavedOutput | undefined {\n const plan = data.generatedJson\n if (plan === undefined) return undefined\n const { status: _status, ...output } = resolveEditPlanOutput(plan, data.editedEdl)\n return output\n}\n\n/**\n * What a result writer writes when a plan lands on an Edit Plan node: the plan\n * itself, and `editedEdl: undefined` ONLY when the plan is not the one the\n * person's review was made on (its `editPlanBasis` differs from\n * `editedEdl.basis`; an edit that names no plan counts as different). The same\n * plan landing again, for example a reopen while the run is still live after\n * the plan finished, keeps the review (decided 2026-10-05). On a keep the patch\n * does not name `editedEdl` at all, so a merging write leaves the review as it\n * is. Pass the review the node holds now.\n *\n * The one place a review is cleared: `frontend/src/lib/__tests__/\n * edit-plan-saved-output-sites.test.ts` fails on a clearing write anywhere else.\n */\nexport function editPlanResultPatch(\n plan: unknown,\n editedEdl: unknown,\n): { readonly generatedJson: unknown; readonly editedEdl?: undefined } {\n const basis = isRecord(editedEdl) ? editedEdl.basis : undefined\n const madeOnThisPlan = typeof basis === \"string\" && basis.length > 0 && basis === editPlanBasis(plan)\n return madeOnThisPlan ? { generatedJson: plan } : { generatedJson: plan, editedEdl: undefined }\n}\n\n/**\n * Check a review edit before it is saved. The envelope (version, kind), the\n * basis, then the plan's shape and one decision per clip, and, for a Tighten edit,\n * the structural `validateEdl` of the edited cut — the Edit Plan's own\n * \"well-formed\" rule (TA1 a, decided 2026-10-04); what a given render can draw\n * is the render's rule, not this one. Issues are English, like `validateEdl`'s.\n */\nexport function validateEditedEdl(editedEdl: unknown, plan: unknown): EdlValidation {\n const check = checkEnvelope(editedEdl, plan)\n if (check.status === \"none\") return { ok: false, issues: [\"there is no edit\"], warnings: [] }\n if (check.status !== \"applied\") return { ok: false, issues: [check.issue], warnings: [] }\n if (check.edited.kind === \"clips\") return { ok: true, issues: [], warnings: [] }\n const resolved = resolveEditPlanOutput(plan, editedEdl).json as Edl\n return validateEdl(resolved)\n}\n"]}
|