@higgsfield/video-editor-mcp 1.0.7 → 1.1.1-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/THIRD_PARTY_NOTICES.md +24 -24
  2. package/dist/cli.mjs +134 -125
  3. package/dist/index.html +136 -133
  4. package/dist/launcher.mjs +90 -90
  5. package/dist/server.mjs +1553 -1389
  6. package/node_modules/@higgsfield/higgsedit/README.md +181 -1
  7. package/node_modules/@higgsfield/higgsedit/dist/capture-page.js +902 -314
  8. package/node_modules/@higgsfield/higgsedit/dist/chunk-2JYLVSVV.mjs +1594 -0
  9. package/node_modules/@higgsfield/higgsedit/dist/chunk-2WKNH7OL.mjs +16 -0
  10. package/node_modules/@higgsfield/higgsedit/dist/{chunk-OMKZ5BXM.mjs → chunk-5LTTL3Q3.mjs} +1 -1
  11. package/node_modules/@higgsfield/higgsedit/dist/chunk-7PYXSJS7.mjs +717 -0
  12. package/node_modules/@higgsfield/higgsedit/dist/{chunk-MLJAIZGP.mjs → chunk-BH2QF635.mjs} +33 -326
  13. package/node_modules/@higgsfield/higgsedit/dist/{chunk-WZR5PZM7.mjs → chunk-BV5COOQZ.mjs} +250 -161
  14. package/node_modules/@higgsfield/higgsedit/dist/{chunk-HTCYVKFX.mjs → chunk-C3GSB3XZ.mjs} +8 -7
  15. package/node_modules/@higgsfield/higgsedit/dist/{chunk-CYH2EUQV.mjs → chunk-DVN4LUXV.mjs} +13 -4
  16. package/node_modules/@higgsfield/higgsedit/dist/chunk-F4CMIG5G.mjs +36 -0
  17. package/node_modules/@higgsfield/higgsedit/dist/chunk-IEPPEDEU.mjs +33 -0
  18. package/node_modules/@higgsfield/higgsedit/dist/{chunk-UVAZ6I6U.mjs → chunk-KIWGVAPJ.mjs} +16 -12
  19. package/node_modules/@higgsfield/higgsedit/dist/{chunk-L6QDNSL3.mjs → chunk-L5LWBA6A.mjs} +5 -5
  20. package/node_modules/@higgsfield/higgsedit/dist/chunk-LMQR3DHT.mjs +37 -0
  21. package/node_modules/@higgsfield/higgsedit/dist/chunk-LTKMGZ6T.mjs +58 -0
  22. package/node_modules/@higgsfield/higgsedit/dist/{chunk-VI6IV6JP.mjs → chunk-MV2JTTBQ.mjs} +65 -47
  23. package/node_modules/@higgsfield/higgsedit/dist/{chunk-4D6AXU4B.mjs → chunk-NARTAWRN.mjs} +50 -30
  24. package/node_modules/@higgsfield/higgsedit/dist/{chunk-27NBQ5FA.mjs → chunk-NUXTKQNM.mjs} +33 -21
  25. package/node_modules/@higgsfield/higgsedit/dist/chunk-OCIZ36XD.mjs +40 -0
  26. package/node_modules/@higgsfield/higgsedit/dist/{chunk-MK6PL7N4.mjs → chunk-OF6RMSM2.mjs} +19 -17
  27. package/node_modules/@higgsfield/higgsedit/dist/{chunk-6BETMESC.mjs → chunk-P2BGHTRR.mjs} +2 -2
  28. package/node_modules/@higgsfield/higgsedit/dist/{chunk-EKFC4S4M.mjs → chunk-PAHMD6SU.mjs} +5 -0
  29. package/node_modules/@higgsfield/higgsedit/dist/{chunk-QVLAEV3U.mjs → chunk-PFQYUJQL.mjs} +3 -4
  30. package/node_modules/@higgsfield/higgsedit/dist/chunk-QJTILFBS.mjs +335 -0
  31. package/node_modules/@higgsfield/higgsedit/dist/chunk-QQ3GGKDN.mjs +21 -0
  32. package/node_modules/@higgsfield/higgsedit/dist/chunk-TH7TK67K.mjs +23 -0
  33. package/node_modules/@higgsfield/higgsedit/dist/{chunk-SIMO6I3D.mjs → chunk-UDL5AHKO.mjs} +163 -158
  34. package/node_modules/@higgsfield/higgsedit/dist/chunk-UMWOUQN3.mjs +60 -0
  35. package/node_modules/@higgsfield/higgsedit/dist/{chunk-3AIM3THH.mjs → chunk-VLM5EOWJ.mjs} +4 -4
  36. package/node_modules/@higgsfield/higgsedit/dist/chunk-WENFTPXQ.mjs +403 -0
  37. package/node_modules/@higgsfield/higgsedit/dist/chunk-YLVXQIPX.mjs +464 -0
  38. package/node_modules/@higgsfield/higgsedit/dist/editor/.vite/manifest.json +559 -506
  39. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/agent-corner-bottom-q4hZltI-.svg +431 -0
  40. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/agent-corner-top-BJYI-I24.svg +431 -0
  41. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/confirmation-BTnwl3LS.css +1 -0
  42. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/drag-Bt_t4HZO.css +1 -0
  43. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/local-B3OTAV_A.css +1 -0
  44. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/menubar-2Y1Y2XJt.css +1 -0
  45. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/model-DdE4hCgf.css +1 -0
  46. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/{IconText1-CzbCrP7v.css → notifications-B08L1jSe.css} +1 -1
  47. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/{panel-g852pZf_.css → panel-BRN_AbBM.css} +1 -1
  48. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/panel-CYELNqrv.css +1 -0
  49. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/panel-DYLpT6oA.css +1 -0
  50. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/panel-v84HaGTZ.css +1 -0
  51. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/IconChainLink1-Bxb1Or0F.js +1 -0
  52. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/{IconCheckmark2Medium-daaES9uF.js → IconCheckmark2Medium-hegaz9mQ.js} +1 -1
  53. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/{IconChevronDownSmall-BhTBJk26.js → IconChevronDownSmall-DaruzJwU.js} +1 -1
  54. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/IconClosedCaptioning-BPqcqKsD.js +1 -0
  55. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/{IconCrossMedium-acfnCXOM.js → IconCrossMedium-BsPFJzc6.js} +1 -1
  56. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/IconOpenaiFilled-D1fzthmi.js +1 -0
  57. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/{IconPause-pTeVSvUe.js → IconPause-ClNg8pao.js} +1 -1
  58. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/{IconPlayFilled-CwdgIuDG.js → IconPlayFilled-CHb-7GSx.js} +1 -1
  59. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/IconSparklesSoftFilled-o7o33KRn.js +1 -0
  60. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/ai-composer-B9h-eaki.js +567 -0
  61. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/auto-layout-BO20Tg4B.js +1 -0
  62. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/{button-CjG6GcgF.js → button-Cg0U0zpV.js} +1 -1
  63. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/canvas-Bw4CVzfw.js +1 -0
  64. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/capabilities-BCd4-zPF.js +1 -0
  65. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/commands-QeSqAbCt.js +1 -0
  66. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/components-tXMtIZNL.js +51 -0
  67. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/confirmation-CO2PHR_z.js +1 -0
  68. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/dom-6aoQn29n.js +1 -0
  69. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/drag-Dw8b_vO2.js +1 -0
  70. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/{editing-CjWbiCxv.js → editing-Cy-SaOyB.js} +1 -1
  71. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/edits-CqLBqir0.js +1 -0
  72. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/export-dialog-BjBskOe3.js +2 -0
  73. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/factories-Bw_iQrUL.js +1 -0
  74. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/id3-CSR0NCRI.js +2 -0
  75. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/import-DP49i4ke.js +1 -0
  76. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/import-error-CMz9sLPe.js +1 -0
  77. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/ingest-DsmIc415.js +1 -0
  78. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/jsx-runtime-B5yqYJvp.js +1 -0
  79. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/{media-Bwjxu-0U.js → media-DQw6vU_T.js} +1 -1
  80. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/menubar-D31srALX.js +1 -0
  81. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/meters-D0nZVEJs.js +1 -0
  82. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/mode-DEG6doKF.js +1 -0
  83. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/model-Duf9fszJ.js +2 -0
  84. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/model-DyAkLA69.js +1 -0
  85. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/notifications-DqWZNIrK.js +9 -0
  86. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/palette-HT83gWgL.js +1 -0
  87. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-B5Mvm6dg.js +7 -0
  88. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-BC90wyvd.js +1 -0
  89. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-Bw_ZJ2JI.js +3 -0
  90. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-DNS060Nt.js +3 -0
  91. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-DSgxIrEq.js +2 -0
  92. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-DgBttE5O.js +1 -0
  93. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-assets-_T2bHsHW.js +771 -0
  94. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-inspector-DfHvAt5X.js +2 -0
  95. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-nBZvHlkA.js +1 -0
  96. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-timeline-DsCpJVSt.js +327 -0
  97. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-viewport-CEhZwZ67.js +280 -0
  98. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/projects-2_tW9Do7.js +1 -0
  99. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/react-dom-1uB7Vbbb.js +1 -0
  100. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/schemas-CddYAOcj.js +64 -0
  101. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/session-BpFeKAI2.js +1 -0
  102. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/src-BLG3tYBa.js +2 -0
  103. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/styles-e2n2A_JN.js +284 -0
  104. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/supercomputer-CuV0zYKd.js +24 -0
  105. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/tabs-XeAgs9cs.js +1 -0
  106. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/toggle-DbNEaSIl.js +1 -0
  107. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/transport-C8Ll3qFl.js +69 -0
  108. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/transport-bar-Dv1LPFbu.js +1 -0
  109. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/useOpenInteractionType-HWSfSsp2.js +1 -0
  110. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/useRenderElement-D4SOg3N_.js +1 -0
  111. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/value-EB7YmAdS.js +1 -0
  112. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/writeback-support-fj5rA9k3.js +1 -0
  113. package/node_modules/@higgsfield/higgsedit/dist/editor/editor-B-WAkLt7.js +372 -0
  114. package/node_modules/@higgsfield/higgsedit/dist/higgsedit.mjs +39 -24
  115. package/node_modules/@higgsfield/higgsedit/dist/jsx/hooks.d.ts +26 -0
  116. package/node_modules/@higgsfield/higgsedit/dist/jsx/index.d.ts +17 -0
  117. package/node_modules/@higgsfield/higgsedit/dist/jsx/inspect.d.ts +42 -0
  118. package/node_modules/@higgsfield/higgsedit/dist/jsx/jsx-runtime.d.ts +28 -0
  119. package/node_modules/@higgsfield/higgsedit/dist/jsx/svg.d.ts +9 -0
  120. package/node_modules/@higgsfield/higgsedit/dist/jsx/time.d.ts +6 -0
  121. package/node_modules/@higgsfield/higgsedit/dist/jsx/types.d.ts +420 -0
  122. package/node_modules/@higgsfield/higgsedit/package.json +28 -20
  123. package/package.json +4 -3
  124. package/plugin/.codex-plugin/plugin.json +1 -1
  125. package/plugin/plugin.json +1 -1
  126. package/plugin/skills/video-editing/references/caption-titling.md +1 -1
  127. package/plugin/skills/video-editing/references/local-setup.md +3 -3
  128. package/node_modules/@higgsfield/higgsedit/dist/chunk-C6SASQHE.mjs +0 -424
  129. package/node_modules/@higgsfield/higgsedit/dist/chunk-FZ5U36SQ.mjs +0 -83
  130. package/node_modules/@higgsfield/higgsedit/dist/chunk-QLPCYN6K.mjs +0 -292
  131. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/edit-drag-D2EV5ddd.css +0 -1
  132. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/editor-CuRHT75g.css +0 -1
  133. package/node_modules/@higgsfield/higgsedit/dist/editor/assets/panel-DnuQD7ja.css +0 -1
  134. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/FieldControl-B0fenhBJ.js +0 -2
  135. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/IconChainLink1-Cwv1X7hi.js +0 -1
  136. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/IconEyeOpen-BqTT9_VV.js +0 -1
  137. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/IconEyeSlash-Whv58c1m.js +0 -1
  138. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/IconPencil-Dr17k_7e.js +0 -1
  139. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/IconPlay-BroH3ziH.js +0 -1
  140. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/IconPlusSmall-43T9aE3d.js +0 -1
  141. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/IconText1-BaP_p9DW.js +0 -1
  142. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/IconTrashCan-DX2w2AIC.js +0 -1
  143. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/ai-composer-C-l0eIdP.js +0 -560
  144. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/captions-Cd-bDG3G.js +0 -1
  145. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/clip-highlight-DpAvcA4x.js +0 -1
  146. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/components-e3ZbUVns.js +0 -1
  147. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/disposables-CwUPjcuA.js +0 -1
  148. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/drag-HLBkto5o.js +0 -1
  149. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/dropdown-BJ04G_X3.js +0 -1
  150. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/edit-drag-Bg6LggKC.js +0 -1
  151. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/edits-a2IixhrN.js +0 -1
  152. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/export-dialog-4I4gqI5V.js +0 -2
  153. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/face-tracker-DzVfjVOO.js +0 -1
  154. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/fit-imported-media-CaCB0x0b.js +0 -1
  155. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/generation-queue-DuL2F4-_.js +0 -1
  156. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/import-error-CMARA0Hy.js +0 -1
  157. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/jsx-runtime-B-hcVAMW.js +0 -1
  158. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/menubar-Bs26OdwP.js +0 -1
  159. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/meters-YEr9OQjq.js +0 -1
  160. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/paints-DS2Msf91.js +0 -67
  161. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/palette-CcS9IcAC.js +0 -1
  162. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-7M3uQokX.js +0 -1
  163. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-BBK1NyG-.js +0 -1
  164. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-CHZTs7By.js +0 -4
  165. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-DaSOa3MP.js +0 -2
  166. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-DlK3RYVo.js +0 -1
  167. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-Dst5OKWu.js +0 -2
  168. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-H_ZoDiKK.js +0 -2
  169. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-Rn9Z7Eek.js +0 -3
  170. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-assets-FAghGFG3.js +0 -678
  171. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-inspector-DEqULBNF.js +0 -260
  172. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-timeline-0GYNz1uc.js +0 -333
  173. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/panel-viewport-DOWjJi5-.js +0 -317
  174. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/projects-BBJc7h5_.js +0 -2
  175. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/session-B9sZaFKC.js +0 -1
  176. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/supercomputer-CX-LCL6Y.js +0 -24
  177. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/tabs-CvKQ-eas.js +0 -1
  178. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/toggle-CrzrwiDZ.js +0 -1
  179. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/transport-BgRfk-Qq.js +0 -69
  180. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/transport-bar-C9nqAfE2.js +0 -1
  181. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/typography-C5-w9LOu-kD3uLKkf.js +0 -1
  182. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/useOpenInteractionType-DbrQ6Ehu.js +0 -1
  183. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/useRenderElement-bbxXdYq0.js +0 -1
  184. package/node_modules/@higgsfield/higgsedit/dist/editor/chunks/writeback-support-BZfNpkmB.js +0 -1
  185. package/node_modules/@higgsfield/higgsedit/dist/editor/editor-Csn2_T_e.js +0 -293
  186. package/node_modules/@higgsfield/higgsedit/dist/export-settings.mjs +0 -75
  187. package/node_modules/@higgsfield/higgsedit/dist/history.mjs +0 -295
  188. package/node_modules/@higgsfield/higgsedit/dist/media-upload.mjs +0 -381
  189. package/node_modules/@higgsfield/higgsedit/dist/proxy.mjs +0 -170
@@ -0,0 +1,567 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["chunks/panel-DSgxIrEq.js","chunks/jsx-runtime-B5yqYJvp.js","chunks/notifications-DqWZNIrK.js","chunks/react-dom-1uB7Vbbb.js","assets/notifications-B08L1jSe.css","chunks/ingest-DsmIc415.js","chunks/factories-Bw_iQrUL.js","chunks/useRenderElement-D4SOg3N_.js","chunks/components-tXMtIZNL.js","chunks/IconCheckmark2Medium-hegaz9mQ.js","chunks/dom-6aoQn29n.js","chunks/useOpenInteractionType-HWSfSsp2.js","chunks/button-Cg0U0zpV.js","chunks/tabs-XeAgs9cs.js","editor-B-WAkLt7.js","chunks/capabilities-BCd4-zPF.js","chunks/session-BpFeKAI2.js","chunks/src-BLG3tYBa.js","chunks/value-EB7YmAdS.js","chunks/schemas-CddYAOcj.js","chunks/import-error-CMz9sLPe.js","chunks/edits-CqLBqir0.js","chunks/asset-op-C6YhYJcd.js","chunks/import-DP49i4ke.js","chunks/editing-Cy-SaOyB.js","chunks/model-Duf9fszJ.js","assets/local-B3OTAV_A.css","chunks/toggle-DbNEaSIl.js","chunks/media-DQw6vU_T.js","chunks/IconChevronDownSmall-DaruzJwU.js","chunks/IconCrossMedium-BsPFJzc6.js","assets/panel-v84HaGTZ.css"])))=>i.map(i=>d[i]);
2
+ import{t as e}from"./session-BpFeKAI2.js";import{d as t,g as n,l as r,n as i}from"./schemas-CddYAOcj.js";import{t as a}from"./dom-6aoQn29n.js";import{Ct as o,Et as s,Ft as c,St as l,Tt as u,Ut as d,wt as f}from"../editor-B-WAkLt7.js";import{t as p}from"./panel-4DTzhYdA.js";import{t as m}from"./mode-DEG6doKF.js";var h=`fable-ai-composer-styles`,g=`
3
+ .ai-reframe-anchor {
4
+ /* A nonzero anchor lets the menu track layout shifts when the viewport resizes. */
5
+ position: fixed; width: 1px; height: 1px; padding: 0; border: 0;
6
+ pointer-events: none; opacity: 0;
7
+ }
8
+ .ai-reframe-menu.q-dropdown-popup { width: 180px; }
9
+
10
+ .ai-account-wrap {
11
+ display: flex;
12
+ flex-direction: column;
13
+ gap: 7px;
14
+ width: 100%;
15
+ box-sizing: border-box;
16
+ }
17
+
18
+ .ai-settings-popover {
19
+ position: fixed;
20
+ top: calc(44px + env(safe-area-inset-top, 0px));
21
+ left: min(300px, calc(100vw - 388px));
22
+ margin: 0;
23
+ z-index: 900;
24
+ width: 380px;
25
+ max-width: calc(100vw - 16px);
26
+ max-height: calc(100vh - 60px - env(safe-area-inset-bottom, 0px));
27
+ overflow-y: auto;
28
+ box-sizing: border-box;
29
+ padding: 8px;
30
+ border-radius: 12px;
31
+ }
32
+
33
+ .ai-settings-popover::backdrop { background: transparent; }
34
+
35
+ .ai-settings-header {
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: space-between;
39
+ padding: 6px 7px 8px;
40
+ }
41
+
42
+ .ai-account-row { display: flex; align-items: center; gap: 8px; min-height: 24px; }
43
+ .ai-account-spacer { flex: 1; }
44
+ .ai-account-label { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
45
+ .ai-inline-error { padding: 0 7px; }
46
+
47
+ .ai-generation-history {
48
+ display: flex;
49
+ flex-direction: column;
50
+ gap: 2px;
51
+ max-height: 220px;
52
+ overflow-y: auto;
53
+ border-radius: 10px;
54
+ padding: 5px;
55
+ }
56
+ .ai-history-state { padding: 10px; }
57
+ .ai-history-job { display: flex; align-items: center; gap: 8px; border-radius: 7px; padding: 7px 8px; }
58
+ .ai-history-job:hover { background: var(--color-q-background-tertiary); }
59
+ .ai-history-job-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; }
60
+ .ai-history-job-prompt,
61
+ .ai-history-job-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
62
+
63
+ .ai-overlay {
64
+ position: fixed;
65
+ left: 50%;
66
+ bottom: calc(max(200px, 30vh) + 22px);
67
+ transform: translateX(-50%);
68
+ width: min(900px, calc(100vw - 48px));
69
+ display: flex;
70
+ flex-direction: column;
71
+ gap: 8px;
72
+ z-index: 800;
73
+ }
74
+
75
+ .ai-composer {
76
+ display: flex;
77
+ flex-direction: column;
78
+ gap: 4px;
79
+ }
80
+
81
+ .ai-composer[hidden] { display: none; }
82
+
83
+ .ai-composer-main {
84
+ display: flex;
85
+ align-items: stretch;
86
+ gap: 4px;
87
+ min-width: 0;
88
+ }
89
+
90
+ .ai-compose-card {
91
+ position: relative;
92
+ display: flex;
93
+ flex-direction: row;
94
+ flex: 1;
95
+ gap: 4px;
96
+ min-width: 0;
97
+ min-height: 112px;
98
+ box-sizing: border-box;
99
+ padding: 4px;
100
+ border-radius: 24px;
101
+ }
102
+
103
+ .ai-composer-close {
104
+ position: absolute;
105
+ top: var(--hf-space-300);
106
+ right: var(--hf-space-300);
107
+ z-index: 2;
108
+ display: inline-flex;
109
+ align-items: center;
110
+ justify-content: center;
111
+ width: var(--hf-space-800);
112
+ height: var(--hf-space-800);
113
+ padding: 0;
114
+ border-radius: 50%;
115
+ }
116
+
117
+ .ai-compose-content {
118
+ display: flex;
119
+ flex: 1;
120
+ flex-direction: column;
121
+ gap: 6px;
122
+ min-width: 0;
123
+ padding: 12px;
124
+ border-radius: 20px;
125
+ }
126
+
127
+
128
+
129
+ .ai-edit-chip {
130
+ display: inline-flex;
131
+ flex-direction: row;
132
+ align-items: center;
133
+ gap: 8px;
134
+ align-self: flex-start;
135
+ min-width: 0;
136
+ max-width: calc(100% - var(--hf-space-1000));
137
+ min-height: var(--hf-space-800);
138
+ border: 0;
139
+ border-radius: 8px;
140
+ padding: 4px 8px;
141
+ }
142
+
143
+ .ai-edit-chip .ai-edit-name { font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
144
+
145
+ .ai-edit-chip .ai-edit-asset {
146
+ color: var(--color-q-text-tertiary);
147
+ max-width: 200px;
148
+ min-width: 0;
149
+ overflow: hidden;
150
+ text-overflow: ellipsis;
151
+ white-space: nowrap;
152
+ }
153
+
154
+ .ai-tool-config {
155
+ display: flex;
156
+ flex-direction: column;
157
+ gap: var(--hf-space-300);
158
+ min-width: 0;
159
+ }
160
+
161
+ .ai-tool-header {
162
+ display: flex;
163
+ align-items: center;
164
+ gap: 8px;
165
+ min-width: 0;
166
+ min-height: var(--hf-space-800);
167
+ padding-right: var(--hf-space-1000);
168
+ }
169
+
170
+ .ai-tool-header > strong { flex-shrink: 0; }
171
+
172
+ .ai-tool-header > span {
173
+ min-width: 0;
174
+ }
175
+
176
+ .ai-tool-options {
177
+ display: flex;
178
+ flex-wrap: wrap;
179
+ gap: 4px;
180
+ }
181
+
182
+ .ai-preset-grid {
183
+ display: grid;
184
+ grid-template-columns: repeat(3, minmax(0, 1fr));
185
+ gap: 4px;
186
+ max-height: 220px;
187
+ overflow-y: auto;
188
+ }
189
+
190
+ .ai-preset {
191
+ display: grid;
192
+ grid-template-columns: 36px minmax(0, 1fr);
193
+ grid-template-rows: auto auto;
194
+ gap: 2px 6px;
195
+ padding: 5px;
196
+ border: 1px solid transparent;
197
+ text-align: left;
198
+ }
199
+
200
+ .ai-preset.selected {
201
+ border-color: var(--color-q-border-focus);
202
+ }
203
+
204
+ .ai-preset .q-media {
205
+ grid-row: 1 / 3;
206
+ width: 36px;
207
+ height: 36px;
208
+ }
209
+
210
+ .ai-preset > span,
211
+ .ai-preset > small {
212
+ overflow: hidden;
213
+ text-overflow: ellipsis;
214
+ white-space: nowrap;
215
+ }
216
+
217
+
218
+
219
+ .ai-frames { display: flex; gap: 4px; }
220
+
221
+ .ai-frame-chip {
222
+ display: inline-flex;
223
+ align-items: center;
224
+ gap: 6px;
225
+ min-height: 28px;
226
+ box-sizing: border-box;
227
+ border: 1px solid transparent;
228
+ border-radius: 8px;
229
+ padding: 4px 8px;
230
+ color: var(--color-q-text-tertiary);
231
+ cursor: pointer;
232
+ user-select: none;
233
+ }
234
+
235
+ .ai-frame-chip:hover { background: var(--color-q-background-tertiary); }
236
+ .ai-frame-chip.filled { border-style: solid; color: var(--color-q-text-primary); }
237
+ .ai-frame-chip.dragover { border-color: var(--color-q-border-focus); color: var(--color-q-text-primary); }
238
+
239
+ .ai-frame-chip img {
240
+ width: 20px;
241
+ height: 20px;
242
+ object-fit: cover;
243
+ border-radius: 4px;
244
+ flex: none;
245
+ }
246
+
247
+ .ai-frame-icon { display: inline-flex; align-items: center; font-size: var(--hf-type-size-100); }
248
+
249
+
250
+
251
+ .ai-prompt-wrap { position: relative; flex: 1; min-height: 34px; }
252
+ .ai-prompt-wrap:first-child { margin-top: var(--hf-space-800); }
253
+ .ai-frames:first-child { padding-inline-end: var(--hf-space-1000); }
254
+
255
+ .ai-prompt {
256
+ --q-textarea-min-height: var(--hf-space-2000);
257
+ width: 100%;
258
+ }
259
+
260
+ .ai-prompt-control {
261
+ min-height: var(--hf-space-2000);
262
+ padding: var(--hf-space-300);
263
+ border: 0;
264
+ background: var(--hf-color-overlay-dim-soft);
265
+ }
266
+
267
+ .ai-prompt-control:focus-within {
268
+ box-shadow: inset 0 0 0 var(--hf-border-width-thin) var(--hf-color-border-focus);
269
+ }
270
+
271
+ .ai-prompt-input {
272
+ width: 100%;
273
+ background: transparent;
274
+ border: none;
275
+ outline: none;
276
+ resize: none;
277
+ font: inherit;
278
+ font-size: var(--hf-type-size-200);
279
+ line-height: var(--hf-type-line-height-500);
280
+ min-height: var(--hf-space-1400);
281
+ max-height: 160px;
282
+ padding: 0;
283
+ display: block;
284
+ }
285
+
286
+ .ai-history {
287
+ position: absolute;
288
+ bottom: calc(100% + 8px);
289
+ left: 0;
290
+ right: 0;
291
+ border-radius: var(--radius-lg, 12px);
292
+ padding: 6px;
293
+ max-height: 220px;
294
+ overflow-y: auto;
295
+ z-index: 20;
296
+ }
297
+
298
+ .ai-history-item {
299
+ padding: 7px 10px;
300
+ border-radius: 6px;
301
+ cursor: pointer;
302
+ white-space: nowrap;
303
+ overflow: hidden;
304
+ text-overflow: ellipsis;
305
+ }
306
+
307
+ .ai-history-item:hover { background: var(--color-q-brand-primary); color: var(--color-q-text-inverse); }
308
+ .ai-history-empty { padding: 7px 10px; }
309
+
310
+
311
+
312
+ .ai-controls {
313
+ display: flex;
314
+ flex-wrap: wrap;
315
+ align-items: center;
316
+ gap: 4px;
317
+ min-width: 0;
318
+ overflow: visible;
319
+ }
320
+
321
+ .ai-reference-chip {
322
+ position: relative;
323
+ width: 28px;
324
+ height: 28px;
325
+ flex: none;
326
+ overflow: hidden;
327
+ border-radius: 8px;
328
+ background: var(--color-q-background-tertiary);
329
+ }
330
+
331
+ .ai-reference-chip > img { width: 100%; height: 100%; object-fit: cover; }
332
+
333
+ .ai-reference-chip > button {
334
+ position: absolute;
335
+ inset: 0 0 auto auto;
336
+ display: inline-flex;
337
+ align-items: center;
338
+ justify-content: center;
339
+ width: 16px;
340
+ height: 16px;
341
+ padding: 0;
342
+ border: 0;
343
+ border-radius: 0 8px 0 6px;
344
+ background: var(--hf-color-transparent-dark-70);
345
+ color: var(--color-q-text-on-overlay-secondary);
346
+ cursor: pointer;
347
+ }
348
+
349
+ .ai-reference-chip > button:focus-visible {
350
+ outline: 2px solid var(--color-q-border-focus);
351
+ outline-offset: 2px;
352
+ }
353
+
354
+ .ai-kind {
355
+ flex: none;
356
+ width: 72px;
357
+ box-sizing: border-box;
358
+ padding: 4px;
359
+ border-radius: 24px;
360
+ background: var(--color-q-background-secondary);
361
+ }
362
+
363
+ .ai-kind .q-tabs-list {
364
+ display: flex;
365
+ flex-direction: column;
366
+ height: 100%;
367
+ }
368
+
369
+ .ai-kind .q-tabs-tab {
370
+ flex: 1;
371
+ min-height: 52px;
372
+ }
373
+
374
+ .ai-kind .q-tabs-tab-content {
375
+ flex-direction: column;
376
+ align-items: center;
377
+ justify-content: center;
378
+ gap: 4px;
379
+ }
380
+
381
+ .ai-pill {
382
+ min-height: 28px;
383
+ max-width: min(11.875rem, 100%);
384
+ white-space: nowrap;
385
+ }
386
+
387
+ .ai-pill > span { display: inline-flex; align-items: center; gap: 5px; }
388
+ .ai-pill > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
389
+
390
+ .ai-menu-positioner { z-index: 900; }
391
+
392
+ .ai-menu {
393
+ min-width: 225px;
394
+ max-height: 260px;
395
+ }
396
+
397
+ .ai-menu.models { min-width: 300px; }
398
+
399
+ .ai-audio {
400
+ display: inline-flex;
401
+ align-items: center;
402
+ gap: 7px;
403
+ color: var(--color-q-text-tertiary);
404
+ cursor: pointer;
405
+ font: inherit;
406
+ min-height: 28px;
407
+ background: var(--color-q-background-tertiary);
408
+ border: none;
409
+ border-radius: 8px;
410
+ padding: 4px 8px;
411
+ }
412
+
413
+ .ai-audio.on { color: var(--color-q-text-primary); }
414
+
415
+ .ai-audio .knob-track {
416
+ width: 26px;
417
+ height: 15px;
418
+ border-radius: 999px;
419
+ background: var(--color-q-background-secondary-strong);
420
+ position: relative;
421
+ transition: background 0.15s;
422
+ flex: none;
423
+ }
424
+
425
+ .ai-audio.on .knob-track { background: var(--color-q-brand-primary); }
426
+
427
+ .ai-audio .knob {
428
+ position: absolute;
429
+ top: 2px;
430
+ left: 2px;
431
+ width: 11px;
432
+ height: 11px;
433
+ border-radius: 50%;
434
+ background: var(--color-q-text-inverse);
435
+ transition: transform 0.15s;
436
+ }
437
+
438
+ .ai-audio.on .knob { transform: translateX(11px); }
439
+
440
+ .ai-submit {
441
+ margin-inline-start: auto;
442
+ min-height: var(--hf-space-800);
443
+ border-radius: 12px;
444
+ display: flex;
445
+ flex-direction: column;
446
+ align-items: center;
447
+ justify-content: center;
448
+ gap: 2px;
449
+ flex: none;
450
+ }
451
+ .ai-submit-icon { display: none; }
452
+
453
+ .ai-submit .q-button-label-frame {
454
+ display: flex;
455
+ flex-direction: column;
456
+ align-items: center;
457
+ }
458
+
459
+ .ai-submit small {
460
+ font-size: var(--hf-type-size-050);
461
+ font-weight: 400;
462
+ line-height: 12px;
463
+ text-transform: none;
464
+ opacity: 0.7;
465
+ }
466
+
467
+ @media (max-width: 760px) {
468
+ .ai-overlay { width: min(680px, calc(100vw - 24px)); }
469
+ .ai-settings-popover { left: 8px; }
470
+ .ai-compose-card { flex-direction: column; }
471
+ .ai-kind { width: 64px; }
472
+ .ai-controls { flex-wrap: wrap; }
473
+ }
474
+
475
+
476
+
477
+ .ai-jobs { display: flex; flex-direction: column; gap: 6px; }
478
+
479
+ .ai-job {
480
+ position: relative;
481
+ overflow: hidden;
482
+ display: flex;
483
+ flex-direction: row;
484
+ align-items: center;
485
+ gap: 10px;
486
+ border-radius: var(--radius-lg, 12px);
487
+ padding: 8px 12px;
488
+ }
489
+
490
+ .ai-job.active::after {
491
+ content: "";
492
+ position: absolute;
493
+ inset: 0;
494
+ background: linear-gradient(100deg, transparent 20%, var(--hf-color-overlay-hover) 50%, transparent 80%);
495
+ animation: ai-shimmer 1.6s linear infinite;
496
+ pointer-events: none;
497
+ }
498
+
499
+ @keyframes ai-shimmer {
500
+ from { transform: translateX(-100%); }
501
+ to { transform: translateX(100%); }
502
+ }
503
+
504
+ .ai-job-icon {
505
+ flex: none;
506
+ width: 14px;
507
+ display: inline-flex;
508
+ align-items: center;
509
+ justify-content: center;
510
+ color: var(--color-q-text-danger);
511
+ }
512
+
513
+ .ai-job-icon.ok { color: var(--color-q-text-success); }
514
+
515
+ .ai-job-body { flex: 1; min-width: 0; }
516
+
517
+ .ai-job-prompt {
518
+ white-space: nowrap;
519
+ overflow: hidden;
520
+ text-overflow: ellipsis;
521
+ }
522
+
523
+ .ai-job-meta {
524
+ margin-top: 2px;
525
+ white-space: nowrap;
526
+ overflow: hidden;
527
+ text-overflow: ellipsis;
528
+ }
529
+
530
+ .fshell[data-design="higgsfield"] .ai-kind { display: none; }
531
+ .fshell[data-design="higgsfield"] .ai-compose-card {
532
+ padding: var(--hf-space-300);
533
+ border: var(--hf-border-width-thin) solid var(--hf-color-border-default);
534
+ border-radius: var(--hf-radius-500);
535
+ background: var(--color-background-secondary);
536
+ box-shadow: var(--hf-shadow-overlay);
537
+ }
538
+ .fshell[data-design="higgsfield"] .ai-compose-content {
539
+ gap: var(--hf-space-400);
540
+ padding: 0;
541
+ background: transparent;
542
+ }
543
+ .fshell[data-design="higgsfield"] .ai-prompt {
544
+ font-size: var(--hf-type-size-200);
545
+ line-height: 16px;
546
+ }
547
+ .fshell[data-design="higgsfield"] .ai-controls {
548
+ gap: var(--hf-space-200);
549
+ }
550
+ .fshell[data-design="higgsfield"] .ai-pill,
551
+ .fshell[data-design="higgsfield"] .ai-audio {
552
+ min-height: var(--hf-space-800);
553
+ border-radius: var(--hf-radius-full);
554
+ }
555
+ .fshell[data-design="higgsfield"] .ai-submit {
556
+ width: var(--hf-space-1000);
557
+ min-height: var(--hf-space-1000);
558
+ height: var(--hf-space-1000);
559
+ border-radius: var(--hf-radius-full);
560
+ background: var(--color-q-brand-primary);
561
+ color: var(--color-q-background-primary);
562
+ box-shadow: none;
563
+ }
564
+ .fshell[data-design="higgsfield"] .ai-submit-icon { display: block; }
565
+ .fshell[data-design="higgsfield"] .ai-submit-label,
566
+ .fshell[data-design="higgsfield"] .ai-submit small { display: none; }
567
+ `;function _(e){a(e,h,g)}var v=r({projectId:t().min(1),sceneId:t().min(1),clipIds:i(t().min(1)).min(1).max(20)}).optional(),y=new Set([`queued`,`in_progress`,`completed`,`failed`,`canceled`]);function b(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Invalid generation payload`);let t=e;if(typeof t.jobId!=`string`||typeof t.modelId!=`string`||typeof t.label!=`string`)throw Error(`Generation payload needs jobId, modelId, and label`);if(t.kind!==`video`&&t.kind!==`image`)throw Error(`Generation kind must be video or image`);if(typeof t.status!=`string`||!y.has(t.status))throw Error(`Invalid generation status`);if(typeof t.duration!=`number`||!Number.isFinite(t.duration)||t.duration<0)throw Error(`Generation duration must be non-negative seconds`);if(t.start!==void 0&&(typeof t.start!=`number`||!Number.isFinite(t.start)||t.start<0))throw Error(`Generation start must be non-negative seconds`);if(t.createdAt!==void 0&&(typeof t.createdAt!=`number`||!Number.isFinite(t.createdAt)))throw Error(`Generation createdAt must be finite`);if(typeof t.projectId!=`string`||t.projectId.length===0)throw Error(`Generation payload needs projectId`);return t}function x(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Invalid import payload`);let t=e;if(typeof t.jobId!=`string`||t.jobId.length===0)throw Error(`Import payload needs jobId`);if(t.start!==void 0&&(typeof t.start!=`number`||!Number.isFinite(t.start)||t.start<0))throw Error(`Import start must be non-negative seconds`);return t.start===void 0?{jobId:t.jobId}:{jobId:t.jobId,start:t.start}}function S(i,a,h){let g=new d,y=u(i,a);g.add({dispose:()=>y.dispose()}),g.add(i.provide(`capability:ai/timeline-results`,{attach:y.attachResult,prepare:y.prepareSources,cancelPreparation:y.cancelPreparation})),g.add(i.provide(n,y.generationQueue)),g.add(i.provide(s,y.toolGeneration)),g.add(i.provide(o,{pending:y.pending,draft:y.draft,dismiss:y.dismiss,regenerate:y.regenerate})),g.add(i.provide(f,{items:y.projectGenerations})),g.add(i.commands.register(`fable.ai-composer.create-video`,()=>y.createVideo())),g.add(i.commands.register(`fable.ai-composer.open`,()=>y.open.set(!0))),g.add(i.commands.register(`fable.ai-composer.toggle`,()=>y.open.set(!y.open.get()))),g.add(i.commands.register(`fable.ai-composer.settings`,()=>y.settingsOpen.set(!y.settingsOpen.get()))),g.add(i.commands.register(`fable.ai-composer.trackExternalGeneration`,e=>y.trackExternal(b(e)))),g.add(i.commands.register(`fable.ai-composer.importTrackedGeneration`,async e=>{let t=x(e);return await y.importTracked(t.jobId,t.start)})),g.add(i.commands.register(`fable.ai-composer.adapt-to-timeline`,e=>y.adaptToTimeline(r({projectId:t().min(1),sceneId:t().min(1)}).parse(e)))),g.add(i.commands.register(`fable.ai-composer.reframe-vertical`,e=>y.transformSelection({action:`reframe`,aspect:`9:16`},v.parse(e)))),g.add(i.commands.register(`fable.ai-composer.reframe-square`,e=>y.transformSelection({action:`reframe`,aspect:`1:1`},v.parse(e)))),g.add(i.commands.register(`fable.ai-composer.reframe-wide`,e=>y.transformSelection({action:`reframe`,aspect:`16:9`},v.parse(e))));for(let e of Object.keys(c))g.add(i.commands.register(`fable.ai-composer.${e}`,t=>y.requestClipAction(e,v.parse(t))));return g.add(i.commands.register(`fable.ai-composer.auto-cut`,e=>y.requestClipAction(`auto-cut`,v.parse(e)))),g.add(i.commands.register(`fable.ai-composer.edit`,e=>y.requestClipAction(`edit`,v.parse(e)))),g.add(i.commands.register(`fable.ai-composer.scene-lighting`,e=>y.openTool(`scene-lighting`,v.parse(e)))),g.add(i.commands.register(`fable.ai-composer.edit-draw`,async()=>{if(!h)return y.toggleEditApp(`edit-video`);let t=await i.require(e);await m(h,t,`draw`),y.open.set(!1)})),g.add(i.commands.register(`fable.ai-composer.edit-backdrop`,()=>i.commands.execute(`fable.ai-composer.remove-background`))),g.add(i.commands.register(`fable.ai-composer.edit-remove`,()=>y.openTool(`scene-lighting`))),g.add(i.extensions.register(`panel`,`fable.ai-composer.panel`,p(()=>l(()=>import(`./panel-DSgxIrEq.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31])),{props:()=>({controller:y}),styles:_}))),g}export{S as activate};
@@ -0,0 +1 @@
1
+ import{n as e,s as t,t as n}from"./jsx-runtime-B5yqYJvp.js";import{t as r}from"./react-dom-1uB7Vbbb.js";import{n as i}from"./capabilities-BCd4-zPF.js";import{c as a,d as o,h as s,l as c,s as l,t as u,u as d}from"./components-tXMtIZNL.js";import{d as f,p,y as m}from"../editor-B-WAkLt7.js";var h=t(e(),1),g=t(r(),1),_=n(),v={direction:`row`,gap:16,padding:{top:16,right:16,bottom:16,left:16},align:`start`,justify:`start`};function y(e){return e.layoutSizing??{width:`fixed`,height:e.kind===`text`||e.kind===`group`&&e.autoLayout!=null?`hug`:`fixed`}}function b(e,t){return e?e[t]===`hug`?{available:!1,reason:`Fill ${t} is unavailable because the parent hugs its ${t}.`}:{available:!0,reason:null}:{available:!1,reason:`Fill is only available inside an Auto Layout parent.`}}function x(e,t,n,r,i,a){for(let o=0;o<e.length;o++){let s=e[o],c=[...n,o],l=i??(s.kind===`group`&&s.component!=null?s:null),u=a||s.locked;if(s.id===t){let e=l!==null&&l.id!==s.id,t=r?.autoLayout!=null,n=t?y(r):null,i=s.kind===`group`&&s.component==null&&!e,a=i?s.autoLayout??null:null;return{clip:s,path:c,parent:r,locked:u,sealed:e,canOwnLayout:i,canEditSizing:!e&&(t||a!==null),layout:a,sizing:y(s),widthFill:b(n,`width`),heightFill:b(n,`height`)}}if(s.kind===`group`){let e=x(s.children,t,[...c,`children`],s,l,u);if(e)return e}}return null}function S(e,t){return C(e,t)}function C(e,t){for(let n=0;n<(e?.scenes.length??0);n++){let r=e.scenes[n];for(let e=0;e<r.tracks.length;e++){let i=r.tracks[e],a=x(i.clips,t,[`scenes`,n,`tracks`,e,`clips`],null,null,i.locked);if(a)return a}}return null}function w(){return globalThis.crypto?.randomUUID?.()??`auto-layout-${Date.now().toString(36)}`}function T(e,t,n,r,i=null){let a=C(e,t);if(!a||a.locked||a.sealed)return null;let o=r(a);return o===a.clip?null:{id:w(),name:n,coalesceKey:i,ops:[{op:`set`,path:a.path,value:o}]}}function E(e,t){if(!e?.canOwnLayout||!e.layout)return null;if(t===`gap`)return e.layout.gap;let n=t.slice(8);return e.layout.padding[n]}function D(e,t,n){if(!e.canOwnLayout||!e.layout)return e.clip;let r=e.clip;if(t===`gap`)return{...r,autoLayout:{...e.layout,gap:n}};let i=t.slice(8);return{...r,autoLayout:{...e.layout,padding:{...e.layout.padding,[i]:n}}}}var O=[{value:`row`,label:`Horizontal`},{value:`column`,label:`Vertical`}],k=[{value:`start`,label:`Start`},{value:`center`,label:`Center`},{value:`end`,label:`End`}],A=[...k,{value:`space-between`,label:`Space between`}];function j(e){return[{value:`fixed`,label:`Fixed`},{value:`hug`,label:`Hug`},{value:`fill`,label:`Fill`,disabled:!e.available,title:e.reason??void 0}]}function M({canOwnLayout:e,layout:t,sizing:n,disabled:r,pending:i,error:s,onAdd:f,onRemove:p,onLayoutChange:m,onNumericLayoutChange:g,onSizingChange:v}){let y=r||i,b=(0,h.useRef)({}),[x,S]=(0,h.useState)(null),C=e=>r||i&&x!==e,T=(e,n)=>{let r=Math.max(0,n);if(g){g(e,r,b.current[e]??null);return}if(!t)return;if(e===`gap`){m({...t,gap:r});return}let i=e.slice(8);m({...t,padding:{...t.padding,[i]:r}})},E=e=>({onGestureStart:()=>{b.current[e]=`auto-layout:${e}:${w()}`,S(e)},onGestureEnd:()=>{delete b.current[e],S(t=>t===e?null:t)}});return(0,_.jsxs)(_.Fragment,{children:[e&&(0,_.jsx)(d,{title:`Auto Layout`,actions:t&&(0,_.jsx)(u,{disabled:y,onClick:p,children:`Remove Auto Layout`}),children:t?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(c,{label:`Direction`,children:(0,_.jsx)(o,{value:t.direction,options:O,disabled:y,label:`Auto layout direction`,onChange:e=>m({...t,direction:e})})}),(0,_.jsx)(c,{label:`Gap`,children:(0,_.jsx)(a,{label:`Auto layout gap`,value:t.gap,min:0,disabled:C(`gap`),onCommit:e=>T(`gap`,e),...E(`gap`)})}),(0,_.jsx)(c,{label:`Padding`,children:[`top`,`right`,`bottom`,`left`].map(e=>(0,_.jsx)(a,{label:`Auto layout padding ${e}`,title:e,value:t.padding[e],min:0,disabled:C(`padding.${e}`),onCommit:t=>T(`padding.${e}`,t),...E(`padding.${e}`)},e))}),(0,_.jsx)(c,{label:`Align`,children:(0,_.jsx)(o,{value:t.align,options:k,disabled:y,label:`Auto layout alignment`,onChange:e=>m({...t,align:e})})}),(0,_.jsx)(c,{label:`Justify`,children:(0,_.jsx)(o,{value:t.justify,options:A,disabled:y,label:`Auto layout justification`,onChange:e=>m({...t,justify:e})})})]}):(0,_.jsx)(u,{className:`w-full`,disabled:y,onClick:f,children:`Add Auto Layout`})}),n&&(0,_.jsxs)(d,{title:`Layout sizing`,children:[(0,_.jsx)(c,{label:`Width`,children:(0,_.jsx)(o,{value:n.value.width,options:j(n.widthFill),disabled:y,label:`Layout width`,onChange:e=>v({...n.value,width:e})})}),!n.widthFill.available&&(0,_.jsx)(l,{children:n.widthFill.reason}),(0,_.jsx)(c,{label:`Height`,children:(0,_.jsx)(o,{value:n.value.height,options:j(n.heightFill),disabled:y,label:`Layout height`,onChange:e=>v({...n.value,height:e})})}),!n.heightFill.available&&n.heightFill.reason!==n.widthFill.reason&&(0,_.jsx)(l,{children:n.heightFill.reason})]}),r&&(0,_.jsx)(l,{children:`Auto Layout is unavailable because this layer or an ancestor is locked.`}),(0,_.jsx)(`span`,{role:`status`,className:`sr-only`,children:i?`Applying Auto Layout…`:``}),s&&(0,_.jsx)(`div`,{role:`alert`,className:`fui-auto-layout-error`,children:s})]})}function N(e){return e instanceof Error?e.message:String(e)}function P(e,t){let n=(0,h.useRef)(null),[r,i]=(0,h.useState)(0);return(0,h.useLayoutEffect)(()=>{if(e||r===0||!n.current)return;let{target:t,fallback:i}=n.current;n.current=null;let a=t?.isConnected&&!t.matches(`:disabled`)?t:null,o=i?.isConnected?i:null;(a??o)?.focus()},[e,r]),{capture:()=>{let e=t.current,r=e?.ownerDocument.activeElement;n.current={target:r,fallback:e?.closest(`[role="dialog"]`)??e}},restoreAfterCommit:()=>i(e=>e+1)}}function F({clipId:e,enableOnOpen:t=!1}){let n=m(),r=f(i),a=p(t=>S(t,e)),[o,s]=(0,h.useState)(!1),[c,u]=(0,h.useState)(null),[d,g]=(0,h.useState)(0),y=(0,h.useRef)(!1),b=(0,h.useRef)(!1),x=(0,h.useRef)(!0),C=(0,h.useRef)(!1),w=(0,h.useRef)([]),O=(0,h.useRef)(0),k=(0,h.useRef)(null),A=P(o,k);(0,h.useEffect)(()=>(x.current=!0,()=>{x.current=!1}),[]),(0,h.useEffect)(()=>{O.current+=1,w.current=[];let e=r?.onEvent(e=>{(e?.type===`opened`||e?.type===`closed`)&&(O.current+=1,w.current=[],x.current&&g(e=>e+1))});return()=>{e?.dispose(),O.current+=1,w.current=[]}},[e,r]);let j=async(t,i)=>{if(b.current)return;let a=r?.snapshot();if(!a)return;let o=T(a,e,t,i);if(!o){u(`Auto Layout is unavailable for this layer.`);return}A.capture(),b.current=!0,s(!0),u(null);try{await n.commands.execute(`document.apply`,o)}catch(e){x.current&&u(N(e))}finally{b.current=!1,x.current&&(s(!1),A.restoreAfterCommit())}},F=async()=>{if(C.current)return;C.current=!0,b.current=!0;let t=!1,i=!1;try{for(;w.current.length>0;){let a=w.current.shift();if(!x.current||a.lifecycle!==O.current)continue;let o=r?.snapshot();if(!o)break;if(E(S(o,e),a.field)===a.value)continue;let c=T(o,e,`Edit Auto Layout`,e=>D(e,a.field,a.value),a.coalesceKey);if(!c){w.current=[],x.current&&a.lifecycle===O.current&&u(`Auto Layout is unavailable for this layer.`);break}t||(i=a.coalesceKey===null,i&&A.capture(),t=!0,s(!0),u(null));try{await n.commands.execute(`document.apply`,c)}catch(e){w.current=[],x.current&&a.lifecycle===O.current&&u(N(e));break}}}finally{C.current=!1,b.current=!1,x.current&&t&&(s(!1),i&&A.restoreAfterCommit())}},I=(e,t,n)=>{let r={field:e,value:t,coalesceKey:n,lifecycle:O.current},i=w.current.at(-1);n!==null&&i?.field===e&&i.coalesceKey===n?w.current[w.current.length-1]=r:w.current.push(r),F()},L=()=>{j(`Add Auto Layout`,e=>e.canOwnLayout&&e.layout===null?{...e.clip,autoLayout:{...v,padding:{...v.padding}}}:e.clip)};return(0,h.useEffect)(()=>{t&&!y.current&&a&&a.layout===null&&(y.current=!0,L())},[t,a?.clip.id]),a?!a.canOwnLayout&&!a.canEditSizing?a.sealed?(0,_.jsx)(l,{children:`Component internals are sealed. Select the component instance to size it as one layout child.`}):null:(0,_.jsx)(`div`,{ref:k,className:o&&!a.locked?`fui-auto-layout-busy`:void 0,children:(0,_.jsx)(M,{canOwnLayout:a.canOwnLayout,layout:a.layout,sizing:a.canEditSizing?{value:a.sizing,widthFill:a.widthFill,heightFill:a.heightFill}:null,disabled:a.locked,pending:o,error:c,onAdd:L,onRemove:()=>void j(`Remove Auto Layout`,e=>e.canOwnLayout?{...e.clip,autoLayout:null}:e.clip),onLayoutChange:e=>void j(`Edit Auto Layout`,t=>t.canOwnLayout?{...t.clip,autoLayout:e}:t.clip),onNumericLayoutChange:I,onSizingChange:e=>void j(`Change layout sizing`,t=>!t.canEditSizing||e.width===`fill`&&!t.widthFill.available||e.height===`fill`&&!t.heightFill.available?t.clip:{...t.clip,layoutSizing:e})},`${e}:${d}`)}):(0,_.jsx)(l,{children:`Layer not found.`})}function I({selectionIds:e,onReady:t}){let n=m(),[r,i]=(0,h.useState)(null),a=(0,h.useRef)(null),o=(0,h.useRef)(null);return(0,h.useEffect)(()=>{let r=o.current?.ownerDocument.activeElement,s=!0;return a.current??=n.commands.execute(`fable.transport.groupAutoLayout`,{clipIds:[...e]}),a.current.then(e=>{s&&(typeof e==`string`?t(e):i(`Select at least two unlocked top-level layers in the same scene.`))}).catch(e=>{s&&i(N(e))}).finally(()=>{r?.isConnected&&r.focus()}),()=>{s=!1}},[n,t,e]),(0,_.jsx)(`div`,{ref:o,children:r?(0,_.jsx)(`div`,{role:`alert`,className:`fui-auto-layout-error`,children:r}):(0,_.jsx)(l,{children:`Grouping and adding Auto Layout…`})})}function L({clipIds:e}){let t=m(),[n,r]=(0,h.useState)(!1),[i,a]=(0,h.useState)(null),o=(0,h.useRef)(!1),s=(0,h.useRef)(!0),c=(0,h.useRef)(null),f=P(n,c);(0,h.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let p=async()=>{if(!o.current){f.capture(),o.current=!0,r(!0),a(null);try{typeof await t.commands.execute(`fable.transport.groupAutoLayout`,{clipIds:[...e]})!=`string`&&s.current&&a(`Select at least two unlocked top-level layers in the same scene.`)}catch(e){s.current&&a(N(e))}finally{o.current=!1,s.current&&(r(!1),f.restoreAfterCommit())}}};return(0,_.jsx)(`div`,{ref:c,children:(0,_.jsxs)(d,{title:`Auto Layout`,children:[(0,_.jsx)(u,{className:`w-full`,disabled:n,onClick:()=>void p(),children:n?`Adding Auto Layout…`:`Add Auto Layout`}),(0,_.jsx)(l,{children:`Keeps current positions. Reflows when you edit layout or content.`}),i&&(0,_.jsx)(`div`,{role:`alert`,className:`fui-auto-layout-error`,children:i})]})})}function R({x:e,y:t,clipId:n,selectionIds:r,enableOnOpen:i=!1,onClose:a}){let o=(0,h.useRef)(null),c=(0,h.useRef)(null),u=(0,h.useRef)(a);u.current=a;let[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(n??null),[v,y]=(0,h.useState)({left:e,top:t}),b=(0,h.useRef)(null);(0,h.useLayoutEffect)(()=>{f(s(o.current))},[]),(0,h.useLayoutEffect)(()=>{let n=c.current;if(!n)return;let r=n.ownerDocument.defaultView??window;b.current??=n.ownerDocument.activeElement;let i=()=>{let i=n.getBoundingClientRect();y({left:Math.max(8,Math.min(e,r.innerWidth-i.width-8)),top:Math.max(8,Math.min(t,r.innerHeight-i.height-8))})};i();let a=new r.ResizeObserver(i);return a.observe(n),r.addEventListener(`resize`,i),n.focus(),()=>{a.disconnect(),r.removeEventListener(`resize`,i)}},[d,e,t]),(0,h.useEffect)(()=>{let e=c.current;if(!e)return;let t=e.ownerDocument.defaultView??window,n=n=>{n.target instanceof t.Node&&!e.contains(n.target)&&(e.querySelector(`:focus`)?.blur(),u.current())};return t.addEventListener(`pointerdown`,n,!0),()=>t.removeEventListener(`pointerdown`,n,!0)},[d]),(0,h.useEffect)(()=>()=>{b.current?.isConnected&&b.current.focus()},[]);let x={position:`fixed`,...v,zIndex:1e3};return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{ref:o,hidden:!0}),d&&(0,g.createPortal)((0,_.jsxs)(`div`,{ref:c,role:`dialog`,"aria-label":`Auto Layout settings`,tabIndex:-1,className:`fui-auto-layout-popover`,"data-theme":`default-dark`,style:x,onContextMenu:e=>e.preventDefault(),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),a())},children:[(0,_.jsxs)(`div`,{className:`fui-component-popover-head`,children:[(0,_.jsx)(`span`,{className:`fui-component-popover-title`,children:`Auto Layout`}),(0,_.jsx)(`button`,{type:`button`,className:`fui-component-close`,"aria-label":`Close Auto Layout`,onClick:a,children:`×`})]}),p?(0,_.jsx)(F,{clipId:p,enableOnOpen:i}):r&&r.length>1?(0,_.jsx)(I,{selectionIds:r,onReady:m}):(0,_.jsx)(l,{children:`Select an ordinary group or at least two layers.`})]}),d)]})}export{L as n,S as r,R as t};
@@ -1 +1 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";import{d as r,t as i}from"./useRenderElement-bbxXdYq0.js";function a(e){return i(e.defaultTagName??`div`,e,e)}var o=n(),s=e(t(),1),c={primary:`q-button-primary`,secondary:`q-button-secondary`,tertiary:`q-button-tertiary`,outline:`q-button-outline`,ghost:`q-button-ghost`,danger:`q-button-danger`,dangerSoft:`q-button-danger-soft`,brandSoft:`q-button-brand-soft`,marketingPrimary:`q-button-marketing-primary`,marketingSecondary:`q-button-marketing-secondary`,marketingTertiary:`q-button-marketing-tertiary`,marketingGhost:`q-button-marketing-ghost`,specialBrand:`q-button-special-brand`,specialPink:`q-button-special-pink`},l={xxs:`q-button-xxs`,xs:`q-button-xs`,sm:`q-button-sm`,md:`q-button-md`,lg:`q-button-lg`},u=new Set([`marketingPrimary`,`marketingSecondary`]);function d(e={},...t){let{variant:n=`primary`,size:i=`sm`,iconOnly:a=!1}=e,o=i===`xxs`&&u.has(n)?`xs`:i;return r(`q-button`,c[n],l[o],a&&`q-button-icon-only`,...t)}function f(e){let{as:t,asChild:n,variant:r,size:i,iconOnly:c,className:l,children:u,start:f,end:p,ref:m,...h}=e,g=d({variant:r,size:i,iconOnly:c},l),_=f!=null||p!=null,v=_?(0,o.jsxs)(o.Fragment,{children:[f,_&&!c&&u!=null?(0,o.jsx)(`span`,{className:`q-button-label-frame`,children:u}):u,p]}):u;return a({render:n?u:t?(0,s.createElement)(t):void 0,defaultTagName:`button`,ref:m,props:{className:g,...!n&&(t===void 0||t===`button`)?{type:`button`}:{},...n?{}:{children:v},...h}})}export{a as n,f as t};
1
+ import{n as e,s as t,t as n}from"./jsx-runtime-B5yqYJvp.js";import{f as r,t as i}from"./useRenderElement-D4SOg3N_.js";function a(e){return i(e.defaultTagName??`div`,e,e)}var o=n(),s=t(e(),1),c={primary:`q-button-primary`,secondary:`q-button-secondary`,tertiary:`q-button-tertiary`,outline:`q-button-outline`,ghost:`q-button-ghost`,danger:`q-button-danger`,dangerSoft:`q-button-danger-soft`,brandSoft:`q-button-brand-soft`,marketingPrimary:`q-button-marketing-primary`,marketingSecondary:`q-button-marketing-secondary`,marketingTertiary:`q-button-marketing-tertiary`,marketingGhost:`q-button-marketing-ghost`,specialBrand:`q-button-special-brand`,specialPink:`q-button-special-pink`},l={xxs:`q-button-xxs`,xs:`q-button-xs`,sm:`q-button-sm`,md:`q-button-md`,lg:`q-button-lg`},u=new Set([`marketingPrimary`,`marketingSecondary`]);function d(e={},...t){let{variant:n=`primary`,size:i=`sm`,iconOnly:a=!1}=e,o=i===`xxs`&&u.has(n)?`xs`:i;return r(`q-button`,c[n],l[o],a&&`q-button-icon-only`,...t)}function f(e){let{as:t,asChild:n,variant:r,size:i,iconOnly:c,className:l,children:u,start:f,end:p,ref:m,...h}=e,g=d({variant:r,size:i,iconOnly:c},l),_=f!=null||p!=null,v=_?(0,o.jsxs)(o.Fragment,{children:[f,_&&!c&&u!=null?(0,o.jsx)(`span`,{className:`q-button-label-frame`,children:u}):u,p]}):u;return a({render:n?u:t?(0,s.createElement)(t):void 0,defaultTagName:`button`,ref:m,props:{className:g,...!n&&(t===void 0||t===`button`)?{type:`button`}:{},...n?{}:{children:v},...h}})}export{d as n,a as r,f as t};
@@ -0,0 +1 @@
1
+ import{n as e,s as t,t as n}from"./jsx-runtime-B5yqYJvp.js";import{r}from"./dom-6aoQn29n.js";var i=t(e(),1),a=n();function o(e,t,n){let i=r(e),a=!1,o=0,s=!1,c=0,l=0,u=1,d=()=>{if(a=!1,o=0,s)return;let r=Math.max(1,Math.round(c*u)),i=Math.max(1,Math.round(l*u));e.width!==r&&(e.width=r),e.height!==i&&(e.height=i),n(t,{width:c,height:l,dpr:u})},f=()=>{s||a||(a=!0,o=i.requestAnimationFrame(d))},p=()=>{if(s)return;let t=i.devicePixelRatio||1,n=e.clientWidth,r=e.clientHeight;(n!==c||r!==l||t!==u)&&(u=t,c=n,l=r,f())},m=new ResizeObserver(p);m.observe(e),p();let h=null,g=()=>{p(),_()},_=()=>{h=i.matchMedia(`(resolution: ${u}dppx)`),h.addEventListener(`change`,g,{once:!0})};return _(),{invalidate:f,dispose(){s=!0,o&&i.cancelAnimationFrame(o),m.disconnect(),h?.removeEventListener(`change`,g)}}}function s({draw:e,onPointerDown:t,onPointerMove:n,onPointerUp:r,onPointerCancel:s,onPointerEnter:c,onPointerLeave:l,onWheel:u,onContextMenu:d,className:f,invalidate:p,canvasRef:m}){let h=(0,i.useRef)(null),g=(0,i.useRef)(e);g.current=e;let _=(0,i.useRef)(u);_.current=u;let v=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=h.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let n=o(e,t,(e,t)=>g.current(e,t)),r=n.invalidate,i=e=>_.current?.(e);return e.addEventListener(`wheel`,i,{passive:!1}),v.current=r,p&&(p.current=r),m&&(m.current=e),()=>{n.dispose(),e.removeEventListener(`wheel`,i),v.current=null,p&&(p.current=null),m&&(m.current=null)}},[p,m]),(0,i.useEffect)(()=>{v.current?.()}),(0,a.jsx)(`canvas`,{ref:h,className:f,style:{width:`100%`,height:`100%`,display:`block`},onPointerDown:t,onPointerMove:n,onPointerUp:r,onPointerCancel:s,onPointerEnter:c,onPointerLeave:l,onContextMenu:d})}export{s as t};
@@ -0,0 +1 @@
1
+ var e=`capability:document.session`,t=`capability:document.placement`,n=`capability:engine.frames`,r=`capability:engine.audio`,i=`capability:storage/local`;export{i as a,n as i,e as n,r,t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./asset-op-C6YhYJcd.js";function t(e,t,n){let r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function n(e,n,r,i,a){if(a<=0)return 0;if(a>=1)return 1;let o=a;for(let s=0;s<8;s++){let s=t(o,e,r)-a;if(Math.abs(s)<1e-5)return t(o,n,i);let c=1-o,l=3*c*c*e+6*c*o*(r-e)+3*o*o*(1-r);if(Math.abs(l)<1e-6)break;o=Math.min(1,Math.max(0,o-s/l))}let s=0,c=1;for(let n=0;n<24;n++)o=(s+c)/2,t(o,e,r)<a?s=o:c=o;return t(o,n,i)}function r(e){let t=e<0?0:e>1?1:e,n=7.5625,r=2.75;if(t<1/r)return n*t*t;if(t<2/r){let e=t-1.5/r;return n*e*e+.75}if(t<2.5/r){let e=t-2.25/r;return n*e*e+.9375}let i=t-2.625/r;return n*i*i+.984375}function i(e,t){switch(e.kind){case`linear`:return t;case`hold`:return 0;case`steps`:return e.count>0?Math.min(1,Math.floor(t*e.count)/e.count):t;case`cubic-bezier`:return n(e.x1,e.y1,e.x2,e.y2,t);case`bounce`:return r(t);default:return t}}function a(e){if(e.length<4||e.charCodeAt(0)!==35)return null;let t=e.slice(1),n,r,i,a=255;if(t.length===3||t.length===4)n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16),t.length===4&&(a=parseInt(t[3]+t[3],16));else if(t.length===6||t.length===8)n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16),t.length===8&&(a=parseInt(t.slice(6,8),16));else return null;return Number.isNaN(n)||Number.isNaN(r)||Number.isNaN(i)||Number.isNaN(a)?null:[n,r,i,a/255]}function o(e){return Math.round(Math.min(Math.max(e,0),255)).toString(16).padStart(2,`0`)}function s(e,t,n){let r=a(e),i=a(t);if(!r||!i)return n<1?e:t;let s=r.map((e,t)=>e+(i[t]-e)*n),c=`#${o(s[0])}${o(s[1])}${o(s[2])}`;return s[3]>=1?c:`${c}${o(s[3]*255)}`}function c(e,t){let n=e.length;if(n===0)return null;let r=e[0];if(n===1||t<=r.time)return r.value;let a=e[n-1];if(t>=a.time)return a.value;let o=0;for(;o+1<n&&e[o+1].time<=t;)o++;let c=e[o],l=e[o+1],u=l.time-c.time,d=u>1e-9?(t-c.time)/u:1,f=i(c.easing,d);return typeof c.value==`number`&&typeof l.value==`number`?c.value+(l.value-c.value)*f:typeof c.value==`string`&&typeof l.value==`string`?s(c.value,l.value,f):f<1?c.value:l.value}function l(e,t){return e.trim.start+e.speed*(t-e.timeRange.start)}function u(e){return e.kind===`media`||e.kind===`audio`}function d(e){return u(e)?e.speed:1}function f(e,t){return u(t)?e.assets.find(e=>e.id===t.assetId)?.duration??null:null}function p(e){return e.scenes.find(t=>t.id===e.activeSceneId)??e.scenes[0]??null}function m(e,t){for(let n=0;n<e.scenes.length;n++){let r=e.scenes[n];for(let e=0;e<r.tracks.length;e++){let i=r.tracks[e];for(let a=0;a<i.clips.length;a++)if(i.clips[a].id===t)return{scene:r,sceneIndex:n,track:i,trackIndex:e,clip:i.clips[a],clipIndex:a}}}return null}function ee(e,t){return e.tracks[t]?.id??null}function h(){return crypto.randomUUID()}function g(e){return e}function _(e,t){return{id:h(),name:e,ops:t,coalesceKey:null}}function v(e,t){return[`scenes`,e,`tracks`,t,`clips`]}function y(e){return e.slice().sort((e,t)=>e.timeRange.start-t.timeRange.start)}var b=1e-6;function te(e,t,n,r){let i=e.clips.filter(e=>e.id!==t).map(e=>({start:e.timeRange.start,end:e.timeRange.start+e.timeRange.duration})).sort((e,t)=>e.start-t.start),a=null,o=(e,t)=>{if(t-e<-1e-6)return;let r=S(n,e,Math.max(e,t));(a===null||Math.abs(r-n)<Math.abs(a-n))&&(a=r)},s=0;for(let e of i)o(s,e.start-r),s=Math.max(s,e.end);return o(s,1/0),a??n}function x(e,t){let n=t.timeRange.start,r=n+t.timeRange.duration,i=0,a=1/0;for(let o of e.clips){if(o.id===t.id)continue;let e=o.timeRange.start,s=e+o.timeRange.duration;s<=n+b&&(i=Math.max(i,s)),e>=r-b&&(a=Math.min(a,e))}return{prevEnd:i,nextStart:a}}function S(e,t,n){return Math.min(Math.max(e,t),n)}function C(e,t,n,r){let i=m(e,t);if(!i||i.clip.locked||i.track.locked||!Number.isFinite(n)||n<0)return null;if(i.track.id===r)return i.clip.timeRange.start===n?null:_(`Move clip`,[{op:`set`,path:[...v(i.sceneIndex,i.trackIndex),i.clipIndex,`timeRange`,`start`],value:n}]);let a=i.scene.tracks.findIndex(e=>e.id===r);if(a===-1)return null;let o={...i.clip,timeRange:{...i.clip.timeRange,start:n}},s=i.scene.tracks[a];return s.locked||!R(s,o)?null:_(`Move clip`,[{op:`remove`,path:v(i.sceneIndex,i.trackIndex),index:i.clipIndex},{op:`set`,path:v(i.sceneIndex,a),value:g(y([...s.clips,o]))}])}function w(e,t){let n=new Set(e.tracks.map(e=>e.name)),r=e.tracks.length+1;for(;n.has(`Track ${r}`);)r++;return{id:h(),name:`Track ${r}`,clips:t,locked:!1,hidden:!1,muted:!1,solo:!1,mode:`default`,volume:1}}function T(e,t,n,r){let i=n.under===null?t.tracks.length:t.tracks.findIndex(e=>e.id===n.under);if(i===-1)return null;let a=w(t,r);return{ops:[{op:`insert`,path:[`scenes`,e.scenes.indexOf(t),`tracks`],index:i,value:g(a)}],trackId:a.id}}function ne(e,t,n,r){let i=m(e,t);if(!i||i.clip.locked||i.track.locked)return null;let a={...i.clip,timeRange:{...i.clip.timeRange,start:n}},o=T(e,i.scene,r,[a]);return o?_(`Move clip to new track`,[{op:`remove`,path:v(i.sceneIndex,i.trackIndex),index:i.clipIndex},...o.ops]):null}function re(e,t,n){let r=m(e,t);if(!r||r.clip.locked||r.track.locked)return null;let i={...r.clip,timeRange:{start:n.start,duration:n.duration}};return u(i)&&n.trimStart!==null&&n.trimEnd!==null&&(i={...i,trim:{start:n.trimStart,end:n.trimEnd}}),_(`Trim clip`,[{op:`set`,path:[...v(r.sceneIndex,r.trackIndex),r.clipIndex],value:g(i)}])}function ie(e,t,n){if(n===0||!Number.isFinite(n))return null;for(let r of t){let i=m(e,r);if(!i||i.clip.locked||i.track.locked||i.clip.timeRange.start+n<0)return null;let a=i.clip.timeRange.start+n,o=a+i.clip.timeRange.duration;if(i.track.clips.some(e=>!t.includes(e.id)&&e.timeRange.start<o-b&&e.timeRange.start+e.timeRange.duration>a+b))return null}let r=new Set(t),i=[],a=0;for(let t=0;t<e.scenes.length;t++){let o=e.scenes[t];for(let e=0;e<o.tracks.length;e++){let s=o.tracks[e];if(!s.clips.some(e=>r.has(e.id)))continue;let c=s.clips.map(e=>r.has(e.id)?(a++,{...e,timeRange:{...e.timeRange,start:e.timeRange.start+n}}):e);i.push({op:`set`,path:v(t,e),value:g(y(c))})}}return a===0?null:_(a>1?`Move clips`:`Move clip`,i)}function ae(e,t,n){let r=m(e,t);if(!r||r.clip.locked||r.track.locked)return null;let i=r.clip.timeRange.start+r.clip.timeRange.duration,a=n.start+n.duration-i;if(a&&r.track.clips.some(e=>e.id!==t&&e.locked&&e.timeRange.start>=i-b))return null;let o={...r.clip,timeRange:{start:n.start,duration:n.duration}};u(o)&&n.trimStart!==null&&n.trimEnd!==null&&(o={...o,trim:{start:n.trimStart,end:n.trimEnd}});let s=r.track.clips.map(e=>e.id===t?o:e.timeRange.start>=i-b&&a!==0?{...e,timeRange:{...e.timeRange,start:e.timeRange.start+a}}:e);return _(`Ripple trim`,[{op:`set`,path:v(r.sceneIndex,r.trackIndex),value:g(y(s))}])}function E(e,t){return Math.abs(e.timeRange.start+e.timeRange.duration-t.timeRange.start)<=b}function D(e,t){let n=null,r=null;for(let i of e.clips)i.id!==t.id&&(E(i,t)&&(n=i),E(t,i)&&(r=i));return{left:n,right:r}}function oe(e,t,n,r){let i=1/(r>0?r:30),a=t.timeRange.start+i,o=n.timeRange.start+n.timeRange.duration-i;if(u(t)){let n=f(e,t);n!==null&&(o=Math.min(o,t.timeRange.start+(n-t.trim.start)/t.speed))}return u(n)&&(a=Math.max(a,n.timeRange.start-n.trim.start/n.speed)),{lo:a,hi:o}}function se(e,t,n,r){let i=m(e,t),a=m(e,n);if(!i||!a||i.track.locked||i.clip.locked||a.clip.locked||i.sceneIndex!==a.sceneIndex||i.trackIndex!==a.trackIndex)return null;let o=a.clip.timeRange.start;if(r===o)return null;let s=r-o,c={...i.clip,timeRange:{start:i.clip.timeRange.start,duration:r-i.clip.timeRange.start}};u(c)&&(c={...c,trim:{start:c.trim.start,end:c.trim.end+c.speed*s}});let l={...a.clip,timeRange:{start:r,duration:a.clip.timeRange.duration-s}};return u(l)&&(l={...l,trim:{start:l.trim.start+l.speed*s,end:l.trim.end}}),_(`Roll edit`,[{op:`set`,path:[...v(i.sceneIndex,i.trackIndex),i.clipIndex],value:g(c)},{op:`set`,path:[...v(a.sceneIndex,a.trackIndex),a.clipIndex],value:g(l)}])}function O(e,t){let n=f(e,t);return{lo:-t.trim.start,hi:n===null?0:n-t.trim.end}}function k(e,t,n){if(n===0)return null;let r=m(e,t);if(!r||r.track.locked||r.clip.locked||!u(r.clip))return null;let i={start:r.clip.trim.start+n,end:r.clip.trim.end+n};return _(`Slip clip`,[{op:`set`,path:[...v(r.sceneIndex,r.trackIndex),r.clipIndex,`trim`],value:g(i)}])}function A(e,t,n,r){let i=1/(r>0?r:30),{left:a,right:o}=D(t,n),s=x(t,n),c=-n.timeRange.start,l=1/0;if(a){if(c=Math.max(c,i-a.timeRange.duration),u(a)){let t=f(e,a);t!==null&&(l=Math.min(l,(t-a.trim.end)/a.speed))}}else c=Math.max(c,s.prevEnd-n.timeRange.start);let d=n.timeRange.start+n.timeRange.duration;return o?(l=Math.min(l,o.timeRange.duration-i),u(o)&&(c=Math.max(c,-o.trim.start/o.speed))):l=Math.min(l,s.nextStart-d),{lo:c,hi:l}}function ce(e,t,n){if(n===0)return null;let r=m(e,t);if(!r||r.track.locked||r.clip.locked)return null;let{left:i,right:a}=D(r.track,r.clip);if(i?.locked||a?.locked)return null;let o=r.track.clips.map(e=>{if(e.id===t)return{...e,timeRange:{...e.timeRange,start:e.timeRange.start+n}};if(i&&e.id===i.id){let t={...e,timeRange:{...e.timeRange,duration:e.timeRange.duration+n}};return u(t)&&(t={...t,trim:{start:t.trim.start,end:t.trim.end+t.speed*n}}),t}if(a&&e.id===a.id){let t={...e,timeRange:{start:e.timeRange.start+n,duration:e.timeRange.duration-n}};return u(t)&&(t={...t,trim:{start:t.trim.start+t.speed*n,end:t.trim.end}}),t}return e});return _(`Slide clip`,[{op:`set`,path:v(r.sceneIndex,r.trackIndex),value:g(y(o))}])}var j=5,M={x:0,y:0,scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0,anchorX:.5,anchorY:.5,flipX:!1,flipY:!1};function N(e,t,n){let r=e.kind===`image`?j:e.duration??j,i={id:h(),name:e.name,opacity:1,blendMode:`normal`,effects:[],timeRange:{start:n,duration:r},animations:[],presetAnimations:[],mask:null,locked:!1,hidden:!1};if(e.kind===`audio`)return{...i,kind:`audio`,assetId:e.id,size:{width:0,height:0},transform:{...M},trim:{start:0,end:e.duration??r},speed:1,preservePitch:!0,volume:1,muted:!1};let a=e.width!=null&&e.width>0?e.width:t.width,o=e.height!=null&&e.height>0?e.height:t.height,s=Math.min(t.width/a,t.height/o);return{...i,kind:`media`,assetId:e.id,size:{width:a,height:o},transform:{...M,x:t.width/2,y:t.height/2,scaleX:s,scaleY:s},trim:{start:0,end:e.duration??r},speed:1,preservePitch:!0,volume:1,muted:!1,cornerRadius:{mixed:!1,uniform:0,tl:0,tr:0,br:0,bl:0}}}var le=5;function P(e){return e.duration>0?e.duration:le}function F(e,t,n){let r=Math.min(1,t.width/e.width,t.height/e.height),i=P(e);return{id:h(),kind:`scene`,sceneId:e.id,name:e.name,opacity:1,blendMode:`normal`,effects:[],timeRange:{start:n,duration:i},trim:{start:0,end:i},speed:1,animations:[],presetAnimations:[],mask:null,locked:!1,hidden:!1,size:{width:e.width,height:e.height},transform:{...M,x:t.width/2,y:t.height/2,scaleX:r,scaleY:r}}}function I(e,t,n){let r=new Set,i=n=>{if(n===t)return!0;if(r.has(n))return!1;r.add(n);let a=e.scenes.find(e=>e.id===n);if(!a)return!1;for(let e of a.tracks)for(let t of e.clips)if(t.kind===`scene`&&i(t.sceneId))return!0;return!1};return i(n)}function L(e,t){return e.activeSceneId===t||!e.scenes.some(e=>e.id===t)?null:_(`Switch scene`,[{op:`set`,path:[`activeSceneId`],value:t}])}function R(e,t){let n=t.kind===`audio`;return e.clips.every(e=>e.kind===`audio`===n)}function z(e,t,n,r){let i=1/(r>0?r:30),a=[];for(let r of e){let e=r.timeRange.start,o=e+r.timeRange.duration;if(o<=t+b||e>=n-b){a.push(r);continue}let s=t-e>=i,c=o-n>=i;if(s&&c){let[e,i]=K(r,t),[,o]=K(i,n);a.push(e,o)}else s?a.push(K(r,t)[0]):c&&a.push(K(r,n)[1])}return a}function B(e,t,n,r){let i=e.scenes.indexOf(t),a=t.tracks.findIndex(e=>e.id===r),o=t.tracks[a];if(!o||o.locked||o.mode===`sequential`||!R(o,n))return null;let s=n.timeRange.start,c=s+n.timeRange.duration,l=o.clips.filter(e=>e.timeRange.start<c-b&&e.timeRange.start+e.timeRange.duration>s+b);if(l.length===0||l.some(e=>e.locked))return null;let u=t.fps>0?t.fps:30,d=y([...z(o.clips,s,c,u),n]);return{envelope:_(`Overwrite clip`,[{op:`set`,path:v(i,a),value:g(d)}]),clipId:n.id}}function V(e,t,n,r,i){if(r.kind===`new-track`){let i=T(e,t,r.slot,[n]);return i&&{ops:i.ops,name:`Add clip to new track`,trackId:i.trackId}}if(r.trackId!==null){let i=B(e,t,n,r.trackId);if(i)return{ops:i.envelope.ops,name:i.envelope.name,trackId:r.trackId}}let a=i.planClipPlacement(e,t.id,n,{preferredTrackId:r.trackId});return a?{ops:a.ops,name:`Add clip`,trackId:a.trackId}:null}function H(e,t,n,r,i){let a=p(e),o=e.assets.find(e=>e.id===t);if(!a||!o)return null;let s=N(o,a,Math.max(0,n)),c=V(e,a,s,r,i);return c?{envelope:_(c.name,c.ops),clipId:s.id}:null}function U(e,t){let n=structuredClone(e),r=e=>{let t=n;for(let n of e)t=t[n];return t};for(let e of t)if(e.op===`set`)r(e.path.slice(0,-1))[e.path[e.path.length-1]]=structuredClone(e.value);else{let t=r(e.path);e.op===`insert`?t.splice(e.index,0,structuredClone(e.value)):e.op===`remove`?t.splice(e.index,1):t.splice(e.to,0,...t.splice(e.from,1))}return n}function W(e,t,n){let r=Math.max(0,n),i=[];for(let n of t){let t=e.assets.find(e=>e.id===n);if(!t||t.kind===`font`||t.kind===`component`)continue;let a=t.kind===`image`?j:t.duration??j;i.push({name:t.name,kind:t.kind,start:r,duration:a}),r+=a}return i}function ue(e,t,n){let r=p(e);if(!r)return[];let i=Math.max(0,n),a=[];for(let n of t){let t=e.scenes.find(e=>e.id===n);if(!t||I(e,r.id,t.id))continue;let o=P(t);a.push({name:t.name,kind:`scene`,start:i,duration:o}),i+=o}return a}function de(e,t,n,r,i){let a=p(e);if(!a)return null;let o=t.map(t=>e.scenes.find(e=>e.id===t)).filter(t=>t!==void 0&&!I(e,a.id,t.id));if(o.length===0)return null;let s=e,c=Math.max(0,n),l=r,u=[],d=[];for(let e of o){let t=p(s);if(!t)return null;let n=F(e,t,c),r=V(s,t,n,l,i);r&&(u.push(...r.ops),d.push(n.id),c+=n.timeRange.duration,s=U(s,r.ops),l.kind===`new-track`&&(l={kind:`track`,trackId:r.trackId}))}return d.length===0?null:{envelope:_(d.length>1?`Add scene clips`:`Add scene clip`,u),clipIds:d}}function fe(e,t,n,r,i){let a=t.map(t=>e.assets.find(e=>e.id===t)).filter(e=>e!==void 0);if(a.length===0)return null;if(a.length===1){let t=H(e,a[0].id,n,r,i);return t?{envelope:t.envelope,clipIds:[t.clipId]}:null}let o=e,s=Math.max(0,n),c=r,l=[],u=[];for(let e of a){let t=p(o);if(!t)return null;let n=N(e,t,s),r=V(o,t,n,c,i);r&&(l.push(...r.ops),u.push(n.id),s+=n.timeRange.duration,o=U(o,r.ops),c.kind===`new-track`&&(c={kind:`track`,trackId:r.trackId}))}return u.length===0?null:{envelope:_(`Add clips`,l),clipIds:u}}function G(t,n,r,i,a){let o=p(t);if(!o)return null;let s=N(n,o,Math.max(0,r)),c=V(t,o,s,i,a);return c?{envelope:_(`Import and add clip`,[e(t,n,g(n)),...c.ops]),clipId:s.id}:null}var pe={kind:`linear`};function me(e,t){let n=[],r=[];for(let i of e){let e=[],a=[];for(let n of i.keyframes)n.time<t?e.push(n):a.push({...n,id:h(),time:n.time-t});let o=e[e.length-1],s=a[0];if(o&&s&&s.time>1e-9){let n=c(i.keyframes,t);n!==null&&(e.push({id:h(),time:t,value:n,easing:pe}),a.unshift({id:h(),time:0,value:n,easing:o.easing}))}e.length>0&&n.push({...i,keyframes:e}),a.length>0&&r.push({...i,id:h(),keyframes:a})}return{left:n,right:r}}function he(e){let t=new Map;return{effects:e.map(e=>{let n=h();return t.set(e.id,n),{...e,id:n}}),idMap:t}}function K(e,t){let n=t-e.timeRange.start,{left:r,right:i}=me(e.animations,n),{effects:a,idMap:o}=he(e.effects),s=i.map(e=>e.effectId===null?e:{...e,effectId:o.get(e.effectId)??e.effectId}),c={...e,timeRange:{start:e.timeRange.start,duration:n},animations:r,presetAnimations:e.presetAnimations.filter(e=>e.direction===`in`)},d={...e,id:h(),timeRange:{start:t,duration:e.timeRange.duration-n},animations:s,effects:a,presetAnimations:e.presetAnimations.filter(e=>e.direction===`out`).map(e=>({...e,id:h()})),mask:e.mask?{...e.mask}:null};if(u(c)&&u(d)){let e=c.trim,n=l(c,t);return[{...c,trim:{start:e.start,end:n}},{...d,trim:{start:n,end:e.end}}]}return[c,d]}function q(e,t,n,r){let i=new Set(r??n),a=1e-6,o=new Set;for(let n of e.tracks)if(!n.locked)for(let e of n.clips){if(e.locked||i.size>0&&!i.has(e.id))continue;let{start:n,duration:r}=e.timeRange;t>n+a&&t<n+r-a&&o.add(e.id)}return o}function ge(e,t,n,r){let i=p(e);if(!i)return null;let a=e.scenes.indexOf(i),o=q(i,t,n,r);if(o.size===0)return null;let s=[],c=[];for(let e=0;e<i.tracks.length;e++){let n=i.tracks[e];if(!n.clips.some(e=>o.has(e.id)))continue;let r=[];for(let e of n.clips){if(!o.has(e.id)){r.push(e);continue}let[n,i]=K(e,t);r.push(n,i),s.push(i.id)}c.push({op:`set`,path:v(a,e),value:g(r)})}return{envelope:_(`Split clip`,c),rightIds:s}}function _e(e,t){let n=new Set(t.filter(t=>{let n=m(e,t);return n!==null&&!n.clip.locked&&!n.track.locked}));if(n.size===0)return null;let r=[];for(let t=0;t<e.scenes.length;t++){let i=e.scenes[t];for(let e=0;e<i.tracks.length;e++){let a=i.tracks[e];a.clips.some(e=>n.has(e.id))&&r.push({op:`set`,path:v(t,e),value:g(a.clips.filter(e=>!n.has(e.id)))})}}return _(n.size>1?`Delete clips`:`Delete clip`,r)}function ve(e,t){let n=new Set(t.filter(t=>{let n=m(e,t);return n!==null&&!n.clip.locked&&!n.track.locked}));if(n.size===0)return null;let r=[];for(let t=0;t<e.scenes.length;t++){let i=e.scenes[t];for(let e=0;e<i.tracks.length;e++){let a=i.tracks[e],o=a.clips.filter(e=>n.has(e.id));if(o.length===0)continue;if(a.clips.some(e=>e.locked&&o.some(t=>t.timeRange.start<e.timeRange.start)))return null;let s=a.clips.filter(e=>!n.has(e.id)).map(e=>{let t=o.reduce((t,n)=>t+(n.timeRange.start<e.timeRange.start?n.timeRange.duration:0),0);return t<=0?e:{...e,timeRange:{...e.timeRange,start:Math.max(0,e.timeRange.start-t)}}});r.push({op:`set`,path:v(t,e),value:g(s)})}}return _(n.size>1?`Ripple delete clips`:`Ripple delete clip`,r)}function ye(e,t,n){let r=n.end-n.start;if(r<=b)return null;for(let i=0;i<e.scenes.length;i++){let a=e.scenes[i],o=a.tracks.findIndex(e=>e.id===t);if(o<0)continue;let s=a.tracks[o];if(s.locked||s.clips.some(e=>e.locked&&e.timeRange.start>=n.end-b))return null;let c=!1,l=s.clips.map(e=>e.timeRange.start<n.end-b?e:(c=!0,{...e,timeRange:{...e.timeRange,start:Math.max(0,e.timeRange.start-r)}}));return c?_(`Close gap`,[{op:`set`,path:v(i,o),value:g(l)}]):null}return null}var be={kind:`cubic-bezier`,x1:0,y1:0,x2:.58,y2:1};function xe(e,t,n,r){let i=m(e,t);if(!i)return null;let a=i.scene.fps>0?i.scene.fps:30,o=i.clip.presetAnimations.filter(e=>e.preset===`volume`&&e.direction!==n&&typeof e.params.transitionId!=`string`).reduce((e,t)=>Math.max(e,t.duration),0),s=S(r,0,Math.max(0,i.clip.timeRange.duration-o)),c=s<.5/a,l=i.clip.presetAnimations.find(e=>e.preset===`volume`&&e.direction===n&&typeof e.params.transitionId!=`string`);if(c&&!l||l&&!c&&l.duration===s)return null;let u=c?i.clip.presetAnimations.filter(e=>e!==l):l?i.clip.presetAnimations.map(e=>e===l?{...e,duration:s}:e):[...i.clip.presetAnimations,{id:h(),preset:`volume`,direction:n,duration:s,easing:be,params:{}}],d=n===`in`?`fade in`:`fade out`;return _(c?`Remove ${d}`:`Set ${d}`,[{op:`set`,path:[...v(i.sceneIndex,i.trackIndex),i.clipIndex,`presetAnimations`],value:g(u)}])}function Se(e,t,n){if(t.kind===`audio`)return!0;if(t.kind!==`media`)return!1;let r=e.assets.find(e=>e.id===t.assetId);return r?.kind===`video`&&n?.(r)!==!1}var J=[`video-audio`,`video`,`photo`,`text`,`shape`,`effect`,`audio`];function*Y(e,t=0){if(e.kind!==`group`)return yield{clip:e,offset:t};for(let n of e.children)yield*Y(n,t+n.timeRange.start)}function Ce(e,t,n){if(t.kind!==`group`)return{type:X(e,t,n),source:t,offset:0};let r=null;for(let i of Y(t)){let a=X(e,i.clip,n);if(t.contentRole===`text`&&a!==`text`)continue;let o=J.indexOf(a);o>=0&&(!r||o<J.indexOf(r.type))&&(r={type:a,source:i.clip,offset:i.offset})}return r??{type:`group`,source:t,offset:0}}function X(e,t,n){switch(t.kind){case`media`:{let r=e.assets.find(e=>e.id===t.assetId);return r?.kind===`image`?`photo`:r?.kind===`audio`?`audio`:!r||t.muted?`video`:n(r)??!0?`video-audio`:`video`}case`audio`:return`audio`;case`text`:return`text`;case`rect`:case`path`:return`shape`;case`adjustment`:return`effect`;case`group`:return`group`;case`scene`:return`scene`}}var we=e=>e===`video-audio`||e===`audio`,Te={muted:[`Mute track`,`Unmute track`],solo:[`Solo track`,`Unsolo track`],locked:[`Lock track`,`Unlock track`],hidden:[`Hide track`,`Show track`]};function Z(e,t){if(e[t])return!0;if(t===`hidden`)return e.clips.length>0&&e.clips.every(e=>e.hidden);if(t===`muted`){let t=e.clips.filter(u);return t.length>0&&t.every(e=>e.muted)}return!1}function Ee(e,t,n){for(let r=0;r<e.scenes.length;r++){let i=e.scenes[r],a=i.tracks.findIndex(e=>e.id===t);if(a===-1)continue;let o=i.tracks[a],s=Z(o,n),c=[{op:`set`,path:[`scenes`,r,`tracks`,a,n],value:!s}];return s&&!o[n]&&(n===`hidden`||n===`muted`)&&o.clips.forEach((e,t)=>{(n===`hidden`||u(e))&&c.push({op:`set`,path:[...v(r,a),t,n],value:!1})}),_(Te[n][+!!s],c)}return null}function De(e){let t=p(e);if(!t)return null;let n=e.scenes.indexOf(t),r=w(t,[]);return _(`Add track`,[{op:`insert`,path:[`scenes`,n,`tracks`],index:t.tracks.length,value:g(r)}])}function Oe(e,t){for(let n=0;n<e.scenes.length;n++){let r=e.scenes[n],i=r.tracks.findIndex(e=>e.id===t);if(i!==-1)return r.tracks[i].locked?null:_(`Delete track`,[{op:`remove`,path:[`scenes`,n,`tracks`],index:i}])}return null}function Q(e){return[`scenes`,e,`markers`]}function $(e,t){for(let n=0;n<e.scenes.length;n++){let r=e.scenes[n];for(let e=0;e<r.markers.length;e++)if(r.markers[e].id===t)return{scene:r,sceneIndex:n,marker:r.markers[e],markerIndex:e}}return null}function ke(e,t){let n=p(e);if(!n)return null;let r=e.scenes.indexOf(n),i={id:h(),time:Math.max(0,t),label:`Marker ${n.markers.length+1}`,color:null,note:null};return{envelope:_(`Add marker`,[{op:`insert`,path:Q(r),index:n.markers.length,value:g(i)}]),markerId:i.id}}function Ae(e,t){let n=$(e,t);return n?_(`Remove marker`,[{op:`remove`,path:Q(n.sceneIndex),index:n.markerIndex}]):null}function je(e,t,n){let r=$(e,t);if(!r)return null;let i=Math.max(0,n);return i===r.marker.time?null:_(`Move marker`,[{op:`set`,path:[...Q(r.sceneIndex),r.markerIndex,`time`],value:i}])}function Me(e){let t=p(e);if(!t)return null;let n=e.scenes.indexOf(t),r=t.tracks.reduce((e,t)=>e+t.clips.filter(e=>e.kind===`adjustment`).length,0),i={id:h(),kind:`adjustment`,name:`Adjustment ${r+1}`,transform:{x:t.width/2,y:t.height/2,scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0,anchorX:.5,anchorY:.5,flipX:!1,flipY:!1},size:{width:t.width,height:t.height},opacity:1,blendMode:`normal`,effects:[],timeRange:{start:0,duration:Math.max(t.duration,5)},animations:[],presetAnimations:[],mask:null,locked:!1,hidden:!1},a={id:h(),name:`Adjustment ${r+1}`,clips:[i],locked:!1,hidden:!1,muted:!1,solo:!1,mode:`default`,volume:1};return{envelope:_(`Add adjustment layer`,[{op:`insert`,path:[`scenes`,n,`tracks`],index:t.tracks.length,value:g(a)}]),clipId:i.id}}export{we as A,O as B,ce as C,re as D,Ee as E,x as F,q as H,Ce as I,oe as L,m as M,R as N,te as O,u as P,ue as R,xe as S,ge as T,ee as U,d as V,Z as W,Ae as _,fe as a,se as b,De as c,Oe as d,G as f,ne as g,je as h,Me as i,W as j,Se as k,ye as l,ie as m,p as n,de as o,C as p,f as r,ke as s,D as t,_e as u,ve as v,k as w,L as x,ae as y,A as z};