@bylqwjc/media-editor-react 1.0.12

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 (434) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +51 -0
  3. package/dist/index.cjs +282 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +54 -0
  6. package/dist/index.d.ts +54 -0
  7. package/dist/index.js +240 -0
  8. package/dist/index.js.map +1 -0
  9. package/filerobot.css +1669 -0
  10. package/node_modules/@media-editor/client/LICENSE +21 -0
  11. package/node_modules/@media-editor/client/README.md +27 -0
  12. package/node_modules/@media-editor/client/dist/index.cjs +60 -0
  13. package/node_modules/@media-editor/client/dist/index.cjs.map +1 -0
  14. package/node_modules/@media-editor/client/dist/index.d.cts +24 -0
  15. package/node_modules/@media-editor/client/dist/index.d.ts +24 -0
  16. package/node_modules/@media-editor/client/dist/index.js +35 -0
  17. package/node_modules/@media-editor/client/dist/index.js.map +1 -0
  18. package/node_modules/@media-editor/client/package.json +23 -0
  19. package/node_modules/@media-editor/core/LICENSE +21 -0
  20. package/node_modules/@media-editor/core/README.md +14 -0
  21. package/node_modules/@media-editor/core/dist/browser.cjs +505 -0
  22. package/node_modules/@media-editor/core/dist/browser.cjs.map +1 -0
  23. package/node_modules/@media-editor/core/dist/browser.d.cts +100 -0
  24. package/node_modules/@media-editor/core/dist/browser.d.ts +100 -0
  25. package/node_modules/@media-editor/core/dist/browser.js +883 -0
  26. package/node_modules/@media-editor/core/dist/browser.js.map +1 -0
  27. package/node_modules/@media-editor/core/dist/chunk-MGKYVYOH.js +371 -0
  28. package/node_modules/@media-editor/core/dist/chunk-MGKYVYOH.js.map +1 -0
  29. package/node_modules/@media-editor/core/dist/chunk-USY6UDGL.js +87 -0
  30. package/node_modules/@media-editor/core/dist/chunk-USY6UDGL.js.map +1 -0
  31. package/node_modules/@media-editor/core/dist/chunk-XCBM7P7N.js +592 -0
  32. package/node_modules/@media-editor/core/dist/chunk-XCBM7P7N.js.map +1 -0
  33. package/node_modules/@media-editor/core/dist/engine.cjs +540 -0
  34. package/node_modules/@media-editor/core/dist/engine.cjs.map +1 -0
  35. package/node_modules/@media-editor/core/dist/engine.d.cts +325 -0
  36. package/node_modules/@media-editor/core/dist/engine.d.ts +359 -0
  37. package/node_modules/@media-editor/core/dist/engine.js +315 -0
  38. package/node_modules/@media-editor/core/dist/engine.js.map +1 -0
  39. package/node_modules/@media-editor/core/dist/filerobot.cjs +818 -0
  40. package/node_modules/@media-editor/core/dist/filerobot.cjs.map +1 -0
  41. package/node_modules/@media-editor/core/dist/filerobot.d.cts +88 -0
  42. package/node_modules/@media-editor/core/dist/filerobot.d.ts +88 -0
  43. package/node_modules/@media-editor/core/dist/filerobot.js +473 -0
  44. package/node_modules/@media-editor/core/dist/filerobot.js.map +1 -0
  45. package/node_modules/@media-editor/core/dist/index.cjs +1276 -0
  46. package/node_modules/@media-editor/core/dist/index.cjs.map +1 -0
  47. package/node_modules/@media-editor/core/dist/index.d.cts +242 -0
  48. package/node_modules/@media-editor/core/dist/index.d.ts +264 -0
  49. package/node_modules/@media-editor/core/dist/index.js +682 -0
  50. package/node_modules/@media-editor/core/dist/index.js.map +1 -0
  51. package/node_modules/@media-editor/core/dist/platform-presets-B-o4C6uY.d.cts +80 -0
  52. package/node_modules/@media-editor/core/dist/platform-presets-B-o4C6uY.d.ts +80 -0
  53. package/node_modules/@media-editor/core/dist/state-B85vkf7_.d.cts +936 -0
  54. package/node_modules/@media-editor/core/dist/state-B85vkf7_.d.ts +1027 -0
  55. package/node_modules/@media-editor/core/node_modules/zod/LICENSE +21 -0
  56. package/node_modules/@media-editor/core/node_modules/zod/README.md +208 -0
  57. package/node_modules/@media-editor/core/node_modules/zod/index.cjs +33 -0
  58. package/node_modules/@media-editor/core/node_modules/zod/index.d.cts +4 -0
  59. package/node_modules/@media-editor/core/node_modules/zod/index.d.ts +4 -0
  60. package/node_modules/@media-editor/core/node_modules/zod/index.js +4 -0
  61. package/node_modules/@media-editor/core/node_modules/zod/package.json +118 -0
  62. package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.cjs +138 -0
  63. package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.d.cts +164 -0
  64. package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.d.ts +164 -0
  65. package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.js +133 -0
  66. package/node_modules/@media-editor/core/node_modules/zod/v3/errors.cjs +17 -0
  67. package/node_modules/@media-editor/core/node_modules/zod/v3/errors.d.cts +5 -0
  68. package/node_modules/@media-editor/core/node_modules/zod/v3/errors.d.ts +5 -0
  69. package/node_modules/@media-editor/core/node_modules/zod/v3/errors.js +9 -0
  70. package/node_modules/@media-editor/core/node_modules/zod/v3/external.cjs +22 -0
  71. package/node_modules/@media-editor/core/node_modules/zod/v3/external.d.cts +6 -0
  72. package/node_modules/@media-editor/core/node_modules/zod/v3/external.d.ts +6 -0
  73. package/node_modules/@media-editor/core/node_modules/zod/v3/external.js +6 -0
  74. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
  75. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  76. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  77. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  78. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
  79. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  80. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  81. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  82. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
  83. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  84. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  85. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  86. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
  87. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  88. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  89. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  90. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
  91. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  92. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  93. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  94. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.cjs +137 -0
  95. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.d.cts +85 -0
  96. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.d.ts +85 -0
  97. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.js +133 -0
  98. package/node_modules/@media-editor/core/node_modules/zod/v3/index.cjs +33 -0
  99. package/node_modules/@media-editor/core/node_modules/zod/v3/index.d.cts +4 -0
  100. package/node_modules/@media-editor/core/node_modules/zod/v3/index.d.ts +4 -0
  101. package/node_modules/@media-editor/core/node_modules/zod/v3/index.js +4 -0
  102. package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.cjs +111 -0
  103. package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.d.cts +3 -0
  104. package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.d.ts +3 -0
  105. package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.js +109 -0
  106. package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.cjs +2 -0
  107. package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.d.cts +102 -0
  108. package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.d.ts +102 -0
  109. package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.js +1 -0
  110. package/node_modules/@media-editor/core/node_modules/zod/v3/types.cjs +3775 -0
  111. package/node_modules/@media-editor/core/node_modules/zod/v3/types.d.cts +1031 -0
  112. package/node_modules/@media-editor/core/node_modules/zod/v3/types.d.ts +1031 -0
  113. package/node_modules/@media-editor/core/node_modules/zod/v3/types.js +3693 -0
  114. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/checks.cjs +32 -0
  115. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/checks.d.cts +1 -0
  116. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/checks.d.ts +1 -0
  117. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/checks.js +1 -0
  118. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/coerce.cjs +47 -0
  119. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/coerce.d.cts +17 -0
  120. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/coerce.d.ts +17 -0
  121. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/coerce.js +17 -0
  122. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/compat.cjs +57 -0
  123. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/compat.d.cts +46 -0
  124. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/compat.d.ts +46 -0
  125. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/compat.js +27 -0
  126. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/errors.cjs +67 -0
  127. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/errors.d.cts +30 -0
  128. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/errors.d.ts +30 -0
  129. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/errors.js +41 -0
  130. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/external.cjs +70 -0
  131. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/external.d.cts +13 -0
  132. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/external.d.ts +13 -0
  133. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/external.js +18 -0
  134. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/index.cjs +33 -0
  135. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/index.d.cts +4 -0
  136. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/index.d.ts +4 -0
  137. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/index.js +4 -0
  138. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/iso.cjs +60 -0
  139. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/iso.d.cts +22 -0
  140. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/iso.d.ts +22 -0
  141. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/iso.js +30 -0
  142. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/parse.cjs +32 -0
  143. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/parse.d.cts +23 -0
  144. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/parse.d.ts +23 -0
  145. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/parse.js +6 -0
  146. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/schemas.cjs +1109 -0
  147. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/schemas.d.cts +630 -0
  148. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/schemas.d.ts +630 -0
  149. package/node_modules/@media-editor/core/node_modules/zod/v4/classic/schemas.js +1006 -0
  150. package/node_modules/@media-editor/core/node_modules/zod/v4/core/api.cjs +1039 -0
  151. package/node_modules/@media-editor/core/node_modules/zod/v4/core/api.d.cts +284 -0
  152. package/node_modules/@media-editor/core/node_modules/zod/v4/core/api.d.ts +284 -0
  153. package/node_modules/@media-editor/core/node_modules/zod/v4/core/api.js +906 -0
  154. package/node_modules/@media-editor/core/node_modules/zod/v4/core/checks.cjs +591 -0
  155. package/node_modules/@media-editor/core/node_modules/zod/v4/core/checks.d.cts +278 -0
  156. package/node_modules/@media-editor/core/node_modules/zod/v4/core/checks.d.ts +278 -0
  157. package/node_modules/@media-editor/core/node_modules/zod/v4/core/checks.js +565 -0
  158. package/node_modules/@media-editor/core/node_modules/zod/v4/core/core.cjs +67 -0
  159. package/node_modules/@media-editor/core/node_modules/zod/v4/core/core.d.cts +49 -0
  160. package/node_modules/@media-editor/core/node_modules/zod/v4/core/core.d.ts +49 -0
  161. package/node_modules/@media-editor/core/node_modules/zod/v4/core/core.js +61 -0
  162. package/node_modules/@media-editor/core/node_modules/zod/v4/core/doc.cjs +39 -0
  163. package/node_modules/@media-editor/core/node_modules/zod/v4/core/doc.d.cts +14 -0
  164. package/node_modules/@media-editor/core/node_modules/zod/v4/core/doc.d.ts +14 -0
  165. package/node_modules/@media-editor/core/node_modules/zod/v4/core/doc.js +35 -0
  166. package/node_modules/@media-editor/core/node_modules/zod/v4/core/errors.cjs +226 -0
  167. package/node_modules/@media-editor/core/node_modules/zod/v4/core/errors.d.cts +208 -0
  168. package/node_modules/@media-editor/core/node_modules/zod/v4/core/errors.d.ts +208 -0
  169. package/node_modules/@media-editor/core/node_modules/zod/v4/core/errors.js +195 -0
  170. package/node_modules/@media-editor/core/node_modules/zod/v4/core/function.cjs +102 -0
  171. package/node_modules/@media-editor/core/node_modules/zod/v4/core/function.d.cts +52 -0
  172. package/node_modules/@media-editor/core/node_modules/zod/v4/core/function.d.ts +52 -0
  173. package/node_modules/@media-editor/core/node_modules/zod/v4/core/function.js +75 -0
  174. package/node_modules/@media-editor/core/node_modules/zod/v4/core/index.cjs +44 -0
  175. package/node_modules/@media-editor/core/node_modules/zod/v4/core/index.d.cts +15 -0
  176. package/node_modules/@media-editor/core/node_modules/zod/v4/core/index.d.ts +15 -0
  177. package/node_modules/@media-editor/core/node_modules/zod/v4/core/index.js +15 -0
  178. package/node_modules/@media-editor/core/node_modules/zod/v4/core/json-schema.cjs +2 -0
  179. package/node_modules/@media-editor/core/node_modules/zod/v4/core/json-schema.d.cts +87 -0
  180. package/node_modules/@media-editor/core/node_modules/zod/v4/core/json-schema.d.ts +87 -0
  181. package/node_modules/@media-editor/core/node_modules/zod/v4/core/json-schema.js +1 -0
  182. package/node_modules/@media-editor/core/node_modules/zod/v4/core/parse.cjs +87 -0
  183. package/node_modules/@media-editor/core/node_modules/zod/v4/core/parse.d.cts +25 -0
  184. package/node_modules/@media-editor/core/node_modules/zod/v4/core/parse.d.ts +25 -0
  185. package/node_modules/@media-editor/core/node_modules/zod/v4/core/parse.js +57 -0
  186. package/node_modules/@media-editor/core/node_modules/zod/v4/core/regexes.cjs +103 -0
  187. package/node_modules/@media-editor/core/node_modules/zod/v4/core/regexes.d.cts +62 -0
  188. package/node_modules/@media-editor/core/node_modules/zod/v4/core/regexes.d.ts +62 -0
  189. package/node_modules/@media-editor/core/node_modules/zod/v4/core/regexes.js +95 -0
  190. package/node_modules/@media-editor/core/node_modules/zod/v4/core/registries.cjs +56 -0
  191. package/node_modules/@media-editor/core/node_modules/zod/v4/core/registries.d.cts +35 -0
  192. package/node_modules/@media-editor/core/node_modules/zod/v4/core/registries.d.ts +35 -0
  193. package/node_modules/@media-editor/core/node_modules/zod/v4/core/registries.js +51 -0
  194. package/node_modules/@media-editor/core/node_modules/zod/v4/core/schemas.cjs +1748 -0
  195. package/node_modules/@media-editor/core/node_modules/zod/v4/core/schemas.d.cts +1041 -0
  196. package/node_modules/@media-editor/core/node_modules/zod/v4/core/schemas.d.ts +1041 -0
  197. package/node_modules/@media-editor/core/node_modules/zod/v4/core/schemas.js +1717 -0
  198. package/node_modules/@media-editor/core/node_modules/zod/v4/core/standard-schema.cjs +2 -0
  199. package/node_modules/@media-editor/core/node_modules/zod/v4/core/standard-schema.d.cts +55 -0
  200. package/node_modules/@media-editor/core/node_modules/zod/v4/core/standard-schema.d.ts +55 -0
  201. package/node_modules/@media-editor/core/node_modules/zod/v4/core/standard-schema.js +1 -0
  202. package/node_modules/@media-editor/core/node_modules/zod/v4/core/to-json-schema.cjs +854 -0
  203. package/node_modules/@media-editor/core/node_modules/zod/v4/core/to-json-schema.d.cts +88 -0
  204. package/node_modules/@media-editor/core/node_modules/zod/v4/core/to-json-schema.d.ts +88 -0
  205. package/node_modules/@media-editor/core/node_modules/zod/v4/core/to-json-schema.js +849 -0
  206. package/node_modules/@media-editor/core/node_modules/zod/v4/core/util.cjs +539 -0
  207. package/node_modules/@media-editor/core/node_modules/zod/v4/core/util.d.cts +183 -0
  208. package/node_modules/@media-editor/core/node_modules/zod/v4/core/util.d.ts +183 -0
  209. package/node_modules/@media-editor/core/node_modules/zod/v4/core/util.js +493 -0
  210. package/node_modules/@media-editor/core/node_modules/zod/v4/core/versions.cjs +8 -0
  211. package/node_modules/@media-editor/core/node_modules/zod/v4/core/versions.d.cts +5 -0
  212. package/node_modules/@media-editor/core/node_modules/zod/v4/core/versions.d.ts +5 -0
  213. package/node_modules/@media-editor/core/node_modules/zod/v4/core/versions.js +5 -0
  214. package/node_modules/@media-editor/core/node_modules/zod/v4/index.cjs +22 -0
  215. package/node_modules/@media-editor/core/node_modules/zod/v4/index.d.cts +3 -0
  216. package/node_modules/@media-editor/core/node_modules/zod/v4/index.d.ts +3 -0
  217. package/node_modules/@media-editor/core/node_modules/zod/v4/index.js +3 -0
  218. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ar.cjs +142 -0
  219. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ar.d.cts +4 -0
  220. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ar.d.ts +4 -0
  221. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ar.js +116 -0
  222. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/az.cjs +141 -0
  223. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/az.d.cts +4 -0
  224. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/az.d.ts +4 -0
  225. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/az.js +115 -0
  226. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/be.cjs +190 -0
  227. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/be.d.cts +4 -0
  228. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/be.d.ts +4 -0
  229. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/be.js +164 -0
  230. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ca.cjs +144 -0
  231. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ca.d.cts +4 -0
  232. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ca.d.ts +4 -0
  233. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ca.js +118 -0
  234. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/cs.cjs +161 -0
  235. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/cs.d.cts +4 -0
  236. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/cs.d.ts +4 -0
  237. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/cs.js +135 -0
  238. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/de.cjs +142 -0
  239. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/de.d.cts +4 -0
  240. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/de.d.ts +4 -0
  241. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/de.js +116 -0
  242. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/en.cjs +145 -0
  243. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/en.d.cts +5 -0
  244. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/en.d.ts +5 -0
  245. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/en.js +117 -0
  246. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/eo.cjs +144 -0
  247. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/eo.d.cts +5 -0
  248. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/eo.d.ts +5 -0
  249. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/eo.js +116 -0
  250. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/es.cjs +143 -0
  251. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/es.d.cts +4 -0
  252. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/es.d.ts +4 -0
  253. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/es.js +117 -0
  254. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fa.cjs +148 -0
  255. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fa.d.cts +4 -0
  256. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fa.d.ts +4 -0
  257. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fa.js +122 -0
  258. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fi.cjs +148 -0
  259. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fi.d.cts +4 -0
  260. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fi.d.ts +4 -0
  261. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fi.js +122 -0
  262. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr-CA.cjs +143 -0
  263. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr-CA.d.cts +4 -0
  264. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
  265. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr-CA.js +117 -0
  266. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr.cjs +142 -0
  267. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr.d.cts +4 -0
  268. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr.d.ts +4 -0
  269. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr.js +116 -0
  270. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/he.cjs +143 -0
  271. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/he.d.cts +4 -0
  272. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/he.d.ts +4 -0
  273. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/he.js +117 -0
  274. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/hu.cjs +143 -0
  275. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/hu.d.cts +4 -0
  276. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/hu.d.ts +4 -0
  277. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/hu.js +117 -0
  278. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/id.cjs +142 -0
  279. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/id.d.cts +4 -0
  280. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/id.d.ts +4 -0
  281. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/id.js +116 -0
  282. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/index.cjs +84 -0
  283. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/index.d.cts +39 -0
  284. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/index.d.ts +39 -0
  285. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/index.js +39 -0
  286. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/it.cjs +143 -0
  287. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/it.d.cts +4 -0
  288. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/it.d.ts +4 -0
  289. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/it.js +117 -0
  290. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ja.cjs +141 -0
  291. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ja.d.cts +4 -0
  292. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ja.d.ts +4 -0
  293. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ja.js +115 -0
  294. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/kh.cjs +143 -0
  295. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/kh.d.cts +4 -0
  296. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/kh.d.ts +4 -0
  297. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/kh.js +117 -0
  298. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ko.cjs +147 -0
  299. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ko.d.cts +4 -0
  300. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ko.d.ts +4 -0
  301. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ko.js +121 -0
  302. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/mk.cjs +144 -0
  303. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/mk.d.cts +4 -0
  304. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/mk.d.ts +4 -0
  305. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/mk.js +118 -0
  306. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ms.cjs +142 -0
  307. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ms.d.cts +4 -0
  308. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ms.d.ts +4 -0
  309. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ms.js +116 -0
  310. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/nl.cjs +143 -0
  311. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/nl.d.cts +4 -0
  312. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/nl.d.ts +4 -0
  313. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/nl.js +117 -0
  314. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/no.cjs +142 -0
  315. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/no.d.cts +4 -0
  316. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/no.d.ts +4 -0
  317. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/no.js +116 -0
  318. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ota.cjs +143 -0
  319. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ota.d.cts +4 -0
  320. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ota.d.ts +4 -0
  321. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ota.js +117 -0
  322. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pl.cjs +143 -0
  323. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pl.d.cts +4 -0
  324. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pl.d.ts +4 -0
  325. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pl.js +117 -0
  326. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ps.cjs +148 -0
  327. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ps.d.cts +4 -0
  328. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ps.d.ts +4 -0
  329. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ps.js +122 -0
  330. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pt.cjs +142 -0
  331. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pt.d.cts +4 -0
  332. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pt.d.ts +4 -0
  333. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pt.js +116 -0
  334. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ru.cjs +190 -0
  335. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ru.d.cts +4 -0
  336. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ru.d.ts +4 -0
  337. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ru.js +164 -0
  338. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sl.cjs +143 -0
  339. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sl.d.cts +4 -0
  340. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sl.d.ts +4 -0
  341. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sl.js +117 -0
  342. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sv.cjs +144 -0
  343. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sv.d.cts +4 -0
  344. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sv.d.ts +4 -0
  345. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sv.js +118 -0
  346. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ta.cjs +143 -0
  347. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ta.d.cts +4 -0
  348. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ta.d.ts +4 -0
  349. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ta.js +117 -0
  350. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/th.cjs +143 -0
  351. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/th.d.cts +4 -0
  352. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/th.d.ts +4 -0
  353. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/th.js +117 -0
  354. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/tr.cjs +143 -0
  355. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/tr.d.cts +5 -0
  356. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/tr.d.ts +5 -0
  357. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/tr.js +115 -0
  358. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ua.cjs +143 -0
  359. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ua.d.cts +4 -0
  360. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ua.d.ts +4 -0
  361. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ua.js +117 -0
  362. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ur.cjs +143 -0
  363. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ur.d.cts +4 -0
  364. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ur.d.ts +4 -0
  365. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ur.js +117 -0
  366. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/vi.cjs +142 -0
  367. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/vi.d.cts +4 -0
  368. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/vi.d.ts +4 -0
  369. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/vi.js +116 -0
  370. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-CN.cjs +142 -0
  371. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-CN.d.cts +4 -0
  372. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
  373. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-CN.js +116 -0
  374. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-TW.cjs +143 -0
  375. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-TW.d.cts +4 -0
  376. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
  377. package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-TW.js +117 -0
  378. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/checks.cjs +34 -0
  379. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/checks.d.cts +1 -0
  380. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/checks.d.ts +1 -0
  381. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/checks.js +1 -0
  382. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/coerce.cjs +47 -0
  383. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/coerce.d.cts +7 -0
  384. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/coerce.d.ts +7 -0
  385. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/coerce.js +17 -0
  386. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/external.cjs +62 -0
  387. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/external.d.cts +11 -0
  388. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/external.d.ts +11 -0
  389. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/external.js +13 -0
  390. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/index.cjs +32 -0
  391. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/index.d.cts +3 -0
  392. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/index.d.ts +3 -0
  393. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/index.js +3 -0
  394. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/iso.cjs +60 -0
  395. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/iso.d.cts +22 -0
  396. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/iso.d.ts +22 -0
  397. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/iso.js +30 -0
  398. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/parse.cjs +8 -0
  399. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/parse.d.cts +1 -0
  400. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/parse.d.ts +1 -0
  401. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/parse.js +1 -0
  402. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/schemas.cjs +839 -0
  403. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/schemas.d.cts +356 -0
  404. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/schemas.d.ts +356 -0
  405. package/node_modules/@media-editor/core/node_modules/zod/v4/mini/schemas.js +732 -0
  406. package/node_modules/@media-editor/core/node_modules/zod/v4-mini/index.cjs +17 -0
  407. package/node_modules/@media-editor/core/node_modules/zod/v4-mini/index.d.cts +1 -0
  408. package/node_modules/@media-editor/core/node_modules/zod/v4-mini/index.d.ts +1 -0
  409. package/node_modules/@media-editor/core/node_modules/zod/v4-mini/index.js +1 -0
  410. package/node_modules/@media-editor/core/package.json +42 -0
  411. package/node_modules/@media-editor/image/LICENSE +21 -0
  412. package/node_modules/@media-editor/image/README.md +48 -0
  413. package/node_modules/@media-editor/image/dist/chunk-5TBO732O.js +1 -0
  414. package/node_modules/@media-editor/image/dist/index-CU3vkvDR.d.ts +44 -0
  415. package/node_modules/@media-editor/image/dist/index.css +1 -0
  416. package/node_modules/@media-editor/image/dist/index.d.ts +2 -0
  417. package/node_modules/@media-editor/image/dist/index.js +364 -0
  418. package/node_modules/@media-editor/image/dist/lazy.css +1 -0
  419. package/node_modules/@media-editor/image/dist/lazy.d.ts +8 -0
  420. package/node_modules/@media-editor/image/dist/lazy.js +1 -0
  421. package/node_modules/@media-editor/image/package.json +29 -0
  422. package/node_modules/@media-editor/video/LICENSE +21 -0
  423. package/node_modules/@media-editor/video/README.md +55 -0
  424. package/node_modules/@media-editor/video/dist/chunk-EK7ODJWE.js +1 -0
  425. package/node_modules/@media-editor/video/dist/index-CX2iAapm.d.ts +51 -0
  426. package/node_modules/@media-editor/video/dist/index.d.ts +4 -0
  427. package/node_modules/@media-editor/video/dist/index.js +16919 -0
  428. package/node_modules/@media-editor/video/dist/lazy.d.ts +10 -0
  429. package/node_modules/@media-editor/video/dist/lazy.js +1 -0
  430. package/node_modules/@media-editor/video/dist/legacy.js +65 -0
  431. package/node_modules/@media-editor/video/package.json +29 -0
  432. package/package.json +48 -0
  433. package/style.css +1 -0
  434. package/theme.css +1214 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/overlay-render.ts","../src/export-form.ts","../src/frame-compositor.ts","../src/fullscreen.ts"],"names":["DEG2RAD"],"mappings":";;;AAOA,IAAMA,QAAAA,GAAU,KAAK,EAAA,GAAK,GAAA;AAE1B,SAAS,WAAA,CAAY,GAAA,EAA+B,KAAA,EAAe,KAAA,EAAe;AAChF,EAAA,GAAA,CAAI,WAAA,GAAc,KAAA;AAClB,EAAA,GAAA,CAAI,SAAA,GAAY,KAAA;AAChB,EAAA,GAAA,CAAI,OAAA,GAAU,OAAA;AACd,EAAA,GAAA,CAAI,QAAA,GAAW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API;零框架依赖)。\n * 交互画布与导出 PNG 共用 drawOverlays,保证所见即所得。\n * 坐标系 = 最终输出空间(旋转/裁剪/缩放后),导出 PNG 即按输出分辨率渲染。\n */\nimport type { OverlayT } from './state';\n\nconst DEG2RAD = Math.PI / 180;\n\nfunction strokeStyle(ctx: CanvasRenderingContext2D, color: string, width: number) {\n ctx.strokeStyle = color;\n ctx.lineWidth = width;\n ctx.lineCap = 'round';\n ctx.lineJoin = 'round';\n}\n\nfunction drawArrowHead(ctx: CanvasRenderingContext2D, x1: number, y1: number, x2: number, y2: number, width: number) {\n const angle = Math.atan2(y2 - y1, x2 - x1);\n const len = Math.max(12, width * 3.5);\n ctx.beginPath();\n ctx.moveTo(x2, y2);\n ctx.lineTo(x2 - len * Math.cos(angle - Math.PI / 7), y2 - len * Math.sin(angle - Math.PI / 7));\n ctx.moveTo(x2, y2);\n ctx.lineTo(x2 - len * Math.cos(angle + Math.PI / 7), y2 - len * Math.sin(angle + Math.PI / 7));\n ctx.stroke();\n}\n\nfunction normalizeOverlayRotation(deg: number): number {\n if (!Number.isFinite(deg)) return 0;\n let next = deg % 360;\n if (next > 180) next -= 360;\n if (next < -180) next += 360;\n return Math.abs(next) < 0.001 ? 0 : next;\n}\n\nexport function getOverlayRotation(o: OverlayT): number {\n return normalizeOverlayRotation((o as { rotation?: number }).rotation ?? 0);\n}\n\nexport function overlayBBox(o: OverlayT): { x: number; y: number; w: number; h: number } {\n switch (o.type) {\n case 'pen': {\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n for (let i = 0; i < o.points.length; i += 2) {\n minX = Math.min(minX, o.points[i]); maxX = Math.max(maxX, o.points[i]);\n minY = Math.min(minY, o.points[i + 1]); maxY = Math.max(maxY, o.points[i + 1]);\n }\n return { x: minX, y: minY, w: maxX - minX, h: maxY - minY };\n }\n case 'line':\n case 'arrow':\n return { x: Math.min(o.x1, o.x2), y: Math.min(o.y1, o.y2), w: Math.abs(o.x2 - o.x1), h: Math.abs(o.y2 - o.y1) };\n case 'rect':\n case 'ellipse':\n case 'sticker':\n return { x: o.x, y: o.y, w: o.w, h: o.h };\n case 'text':\n return { x: o.x, y: o.y, w: o.text.length * o.fontSize * 0.6, h: o.fontSize * 1.2 };\n }\n}\n\nfunction overlayCenter(o: OverlayT): { x: number; y: number } {\n const b = overlayBBox(o);\n return { x: b.x + b.w / 2, y: b.y + b.h / 2 };\n}\n\nfunction rotatePoint(x: number, y: number, cx: number, cy: number, deg: number): { x: number; y: number } {\n const rad = deg * DEG2RAD;\n const cos = Math.cos(rad);\n const sin = Math.sin(rad);\n const dx = x - cx;\n const dy = y - cy;\n return { x: cx + dx * cos - dy * sin, y: cy + dx * sin + dy * cos };\n}\n\nfunction scalePoint(x: number, y: number, cx: number, cy: number, ratio: number): { x: number; y: number } {\n return { x: cx + (x - cx) * ratio, y: cy + (y - cy) * ratio };\n}\n\n/** 单个对象绘制;sticker 的位图经 imageCache 提供(加载由调用方负责) */\nexport function drawOverlay(\n ctx: CanvasRenderingContext2D,\n o: OverlayT,\n imageCache?: Map<string, HTMLImageElement>\n): void {\n const rotation = getOverlayRotation(o);\n if (rotation) {\n const c = overlayCenter(o);\n ctx.save();\n ctx.translate(c.x, c.y);\n ctx.rotate(rotation * DEG2RAD);\n ctx.translate(-c.x, -c.y);\n drawOverlayBase(ctx, o, imageCache);\n ctx.restore();\n return;\n }\n drawOverlayBase(ctx, o, imageCache);\n}\n\nfunction drawOverlayBase(\n ctx: CanvasRenderingContext2D,\n o: OverlayT,\n imageCache?: Map<string, HTMLImageElement>\n): void {\n switch (o.type) {\n case 'pen': {\n strokeStyle(ctx, o.color, o.width);\n ctx.beginPath();\n ctx.moveTo(o.points[0], o.points[1]);\n for (let i = 2; i < o.points.length; i += 2) ctx.lineTo(o.points[i], o.points[i + 1]);\n ctx.stroke();\n break;\n }\n case 'line':\n case 'arrow': {\n strokeStyle(ctx, o.color, o.width);\n ctx.beginPath();\n ctx.moveTo(o.x1, o.y1);\n ctx.lineTo(o.x2, o.y2);\n ctx.stroke();\n if (o.type === 'arrow') drawArrowHead(ctx, o.x1, o.y1, o.x2, o.y2, o.width);\n break;\n }\n case 'rect': {\n strokeStyle(ctx, o.color, o.width);\n ctx.strokeRect(o.x, o.y, o.w, o.h);\n break;\n }\n case 'ellipse': {\n strokeStyle(ctx, o.color, o.width);\n ctx.beginPath();\n ctx.ellipse(o.x + o.w / 2, o.y + o.h / 2, Math.abs(o.w / 2), Math.abs(o.h / 2), 0, 0, Math.PI * 2);\n ctx.stroke();\n break;\n }\n case 'text': {\n ctx.fillStyle = o.color;\n ctx.font = `bold ${o.fontSize}px -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif`;\n ctx.textBaseline = 'top';\n // 描边提升可读性\n ctx.strokeStyle = 'rgba(0,0,0,0.45)';\n ctx.lineWidth = Math.max(2, o.fontSize / 16);\n ctx.lineJoin = 'round';\n ctx.strokeText(o.text, o.x, o.y);\n ctx.fillText(o.text, o.x, o.y);\n break;\n }\n case 'sticker': {\n if (o.emoji) {\n ctx.font = `${Math.min(o.w, o.h)}px -apple-system, \"Apple Color Emoji\", \"Segoe UI Emoji\", sans-serif`;\n ctx.textBaseline = 'top';\n ctx.fillText(o.emoji, o.x, o.y);\n } else if (o.src) {\n const img = imageCache?.get(o.src);\n if (img) ctx.drawImage(img, o.x, o.y, o.w, o.h);\n }\n break;\n }\n }\n}\n\nexport function drawOverlays(\n ctx: CanvasRenderingContext2D,\n overlays: OverlayT[],\n imageCache?: Map<string, HTMLImageElement>\n): void {\n for (const o of overlays) drawOverlay(ctx, o, imageCache);\n}\n\n/** sticker 位图预加载(dataURL → HTMLImageElement) */\nexport async function loadOverlayImages(overlays: OverlayT[]): Promise<Map<string, HTMLImageElement>> {\n const cache = new Map<string, HTMLImageElement>();\n const srcs = [...new Set(overlays.filter((o) => o.type === 'sticker' && o.src).map((o) => (o as { src?: string }).src!))];\n await Promise.all(\n srcs.map(\n (src) =>\n new Promise<void>((resolve) => {\n const img = new Image();\n img.onload = () => {\n cache.set(src, img);\n resolve();\n };\n img.onerror = () => resolve();\n img.src = src;\n })\n )\n );\n return cache;\n}\n\n/** 导出:把 overlays 渲染成输出分辨率的透明 PNG Blob(无 overlay 返回 null) */\nexport async function renderOverlaysToPng(\n overlays: OverlayT[] | undefined,\n width: number,\n height: number\n): Promise<Blob | null> {\n if (!overlays?.length) return null;\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n if (!ctx) return null;\n const cache = await loadOverlayImages(overlays);\n drawOverlays(ctx, overlays, cache);\n return new Promise((resolve) => canvas.toBlob((b) => resolve(b), 'image/png'));\n}\n\n/** 命中检测(选中/拖动用):返回最上层命中的 overlay 下标,无命中 -1 */\nexport function hitTestOverlay(overlays: OverlayT[], x: number, y: number, tolerance = 12): number {\n for (let i = overlays.length - 1; i >= 0; i--) {\n const o = overlays[i];\n if (hitOne(o, x, y, tolerance)) return i;\n }\n return -1;\n}\n\nfunction near(px: number, py: number, x: number, y: number, tol: number): boolean {\n return Math.abs(px - x) <= tol && Math.abs(py - y) <= tol;\n}\n\nfunction nearSegment(x: number, y: number, x1: number, y1: number, x2: number, y2: number, tol: number): boolean {\n const dx = x2 - x1;\n const dy = y2 - y1;\n const len2 = dx * dx + dy * dy || 1;\n const t = Math.max(0, Math.min(1, ((x - x1) * dx + (y - y1) * dy) / len2));\n const cx = x1 + t * dx;\n const cy = y1 + t * dy;\n return (x - cx) ** 2 + (y - cy) ** 2 <= tol * tol;\n}\n\nfunction hitOne(o: OverlayT, x: number, y: number, tol: number): boolean {\n const rotation = getOverlayRotation(o);\n if (rotation) {\n const c = overlayCenter(o);\n const p = rotatePoint(x, y, c.x, c.y, -rotation);\n return hitOneBase(o, p.x, p.y, tol);\n }\n return hitOneBase(o, x, y, tol);\n}\n\nfunction hitOneBase(o: OverlayT, x: number, y: number, tol: number): boolean {\n switch (o.type) {\n case 'pen': {\n for (let i = 0; i + 3 < o.points.length; i += 2) {\n if (nearSegment(x, y, o.points[i], o.points[i + 1], o.points[i + 2], o.points[i + 3], tol + o.width / 2)) return true;\n }\n return false;\n }\n case 'line':\n case 'arrow':\n return nearSegment(x, y, o.x1, o.y1, o.x2, o.y2, tol + o.width / 2);\n case 'rect':\n case 'ellipse':\n return x >= o.x - tol && x <= o.x + o.w + tol && y >= o.y - tol && y <= o.y + o.h + tol;\n case 'text':\n return x >= o.x - tol && x <= o.x + o.text.length * o.fontSize * 0.6 + tol && y >= o.y - tol && y <= o.y + o.fontSize + tol;\n case 'sticker':\n return near(x, y, o.x + o.w / 2, o.y + o.h / 2, Math.max(o.w, o.h) / 2 + tol);\n }\n}\n\n/**\n * 贴纸图片等比落盒:长边 = boxSide、短边按原始宽高比,下限 8px。\n * 上传任意比例图片不再被压成正方形(drawImage 是拉伸语义,入库 w/h 必须等比)。\n */\nexport function fitStickerBox(natW: number, natH: number, boxSide: number): { w: number; h: number } {\n const side = Math.max(8, boxSide);\n if (!(natW > 0) || !(natH > 0)) return { w: side, h: side };\n const k = side / Math.max(natW, natH);\n return { w: Math.max(8, Math.round(natW * k)), h: Math.max(8, Math.round(natH * k)) };\n}\n\n/**\n * 缩放 overlay(选中后拖右下角把手):以对象左上角为锚,按 ratio 等比。\n * sticker/rect/ellipse 改 w/h;text 改 fontSize;pen/line/arrow 不支持(原样返回)。\n */\nexport function scaleOverlay(o: OverlayT, ratio: number): OverlayT {\n const r = Math.max(0.05, ratio);\n const c = overlayCenter(o);\n switch (o.type) {\n case 'pen':\n return { ...o, points: o.points.map((v, i) => (i % 2 === 0 ? c.x + (v - c.x) * r : c.y + (v - c.y) * r)) };\n case 'line':\n case 'arrow': {\n const p1 = scalePoint(o.x1, o.y1, c.x, c.y, r);\n const p2 = scalePoint(o.x2, o.y2, c.x, c.y, r);\n return { ...o, x1: p1.x, y1: p1.y, x2: p2.x, y2: p2.y };\n }\n case 'rect':\n case 'ellipse':\n case 'sticker':\n return { ...o, w: Math.max(8, o.w * r), h: Math.max(8, o.h * r) };\n case 'text':\n return { ...o, fontSize: Math.min(512, Math.max(8, o.fontSize * r)) };\n default:\n return o;\n }\n}\n\n/** 旋转 overlay:以对象 bbox 中心为视觉锚点;坐标本身不变,绘制/命中检测按 rotation 处理。 */\nexport function rotateOverlay(o: OverlayT, deg: number): OverlayT {\n return { ...o, rotation: normalizeOverlayRotation(deg) };\n}\n\n/** 平移 overlay(拖动选中对象) */\nexport function translateOverlay(o: OverlayT, dx: number, dy: number): OverlayT {\n switch (o.type) {\n case 'pen': {\n const points = o.points.map((v, i) => (i % 2 === 0 ? v + dx : v + dy));\n return { ...o, points };\n }\n case 'line':\n case 'arrow':\n return { ...o, x1: o.x1 + dx, y1: o.y1 + dy, x2: o.x2 + dx, y2: o.y2 + dy };\n case 'rect':\n case 'ellipse':\n case 'sticker':\n return { ...o, x: o.x + dx, y: o.y + dy };\n case 'text':\n return { ...o, x: o.x + dx, y: o.y + dy };\n }\n}\n","/**\n * 把引擎导出计划 + 浏览器端 File 组装成服务端约定的 FormData\n * (video_0../audio_0../overlay/editState),供 @media-editor/client.exportVideo 直接发。\n * 触碰 DOM(overlay → canvas PNG),故归 @media-editor/core/browser,React/Vue 共用。\n */\nimport type { VideoEditorEngine } from './engine';\nimport { outputSize } from './transform';\nimport { renderOverlaysToPng } from './overlay-render';\n\n/**\n * @param videoFiles 以「原始 srcIdx」为下标的视频 File 数组(引擎按 videoSrcOrder 取并重排)\n * @param audioFiles 同上(音频)\n */\nexport async function buildVideoExportFormData(\n engine: VideoEditorEngine,\n videoFiles: ReadonlyArray<File | undefined>,\n audioFiles: ReadonlyArray<File | undefined> = [],\n): Promise<FormData> {\n const plan = engine.getExportPlan();\n const fd = new FormData();\n\n plan.videoSrcOrder.forEach((srcIdx, slot) => {\n const f = videoFiles[srcIdx];\n if (f) fd.append(`video_${slot}`, f, f.name || `video_${slot}.mp4`);\n });\n plan.audioSrcOrder.forEach((srcIdx, slot) => {\n const f = audioFiles[srcIdx];\n if (f) fd.append(`audio_${slot}`, f, f.name || `audio_${slot}`);\n });\n\n // overlays 烧成输出分辨率透明 PNG(服务端叠加)\n const out = outputSize(plan.state.canvas, plan.state);\n const overlay = await renderOverlaysToPng(plan.state.overlays, out.w, out.h);\n if (overlay) fd.append('overlay', overlay, 'overlay.png');\n\n fd.append('editState', JSON.stringify(plan.state));\n return fd;\n}\n","/**\n * 帧合成器(框架无关 canvas)—— 把「源帧 → 输出画布 + 完整效果链 + overlays」绘到 canvas。\n * 从 SocialEcho VideoFramePreview.drawFinalFrame 抽出,供实时预览与封面导出复用。\n *\n * 效果链与 ffmpeg 导出严格同构:源→画布 cover 归一 → flips → rotate → crop → scale + 调色/滤镜 css。\n */\nimport type { VideoEditStateT } from './state';\nimport { rotatedSize, outputSize, fitRects, DEG2RAD, type FitMode } from './transform';\nimport { drawOverlays } from './overlay-render';\nimport { buildFilterCss } from './filters';\n\n/** drawImage 可接受的源(video / image / canvas) */\nexport type FrameSource = CanvasImageSource;\n\n/**\n * 把一帧合成绘到 canvas(物理分辨率 = 输出尺寸 × k)。\n * @param srcDims 活动源原始分辨率(逐片段可能不同)\n * @param canvasDims 输出画布(= 首素材分辨率),全局效果链的「源 dims」\n * @param k 物理像素倍率(预览用 ≤1 控带宽,封面导出用 1 全分辨率)\n * @param imageCache 贴纸图片缓存(loadOverlayImages 产出)\n */\nexport function drawVideoFrame(\n canvas: HTMLCanvasElement,\n source: FrameSource,\n srcDims: { w: number; h: number },\n canvasDims: { w: number; h: number },\n state: VideoEditStateT,\n k = 1,\n imageCache?: Map<string, HTMLImageElement>,\n withOverlays = true,\n): void {\n const out = outputSize(canvasDims, state);\n canvas.width = Math.max(2, Math.round(out.w * k));\n canvas.height = Math.max(2, Math.round(out.h * k));\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n\n const rb = rotatedSize(canvasDims.w, canvasDims.h, state.rotation);\n const crop = state.crop ?? { x: 0, y: 0, width: rb.w, height: rb.h };\n const fit: FitMode = state.scale?.fit ?? 'force';\n const { src, dst } = fitRects({ width: crop.width, height: crop.height }, out, fit);\n\n if (fit === 'contain') {\n ctx.fillStyle = '#000';\n ctx.fillRect(0, 0, canvas.width, canvas.height); // 黑边(在 filter 前,免被调色串扰)\n }\n\n ctx.filter = buildFilterCss(state.filters, state.filterPreset);\n ctx.save();\n if (fit === 'contain') {\n ctx.beginPath();\n ctx.rect(k * dst.x, k * dst.y, k * dst.width, k * dst.height);\n ctx.clip();\n }\n ctx.translate(k * dst.x, k * dst.y);\n ctx.scale((k * dst.width) / src.width, (k * dst.height) / src.height);\n ctx.translate(-(crop.x + src.x), -(crop.y + src.y));\n ctx.translate(rb.w / 2, rb.h / 2);\n ctx.rotate(state.rotation * DEG2RAD);\n ctx.scale(state.flipX ? -1 : 1, state.flipY ? -1 : 1);\n // 源帧 cover 居中裁剪铺满画布(与 ffmpeg 逐片段归一同构);srcDims===canvas 时为恒等映射\n const cov = fitRects({ width: srcDims.w, height: srcDims.h }, { w: canvasDims.w, h: canvasDims.h }, 'cover');\n ctx.drawImage(\n source,\n cov.src.x,\n cov.src.y,\n cov.src.width,\n cov.src.height,\n -canvasDims.w / 2,\n -canvasDims.h / 2,\n canvasDims.w,\n canvasDims.h,\n );\n ctx.restore();\n ctx.filter = 'none';\n\n if (withOverlays && state.overlays?.length) {\n ctx.setTransform(k, 0, 0, k, 0, 0);\n drawOverlays(ctx, state.overlays, imageCache);\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n }\n}\n\n/** seek 一个 video 到 t 秒,resolve 于 seeked */\nfunction seekVideo(el: HTMLVideoElement, t: number): Promise<void> {\n return new Promise((resolve) => {\n const onSeeked = () => {\n el.removeEventListener('seeked', onSeeked);\n resolve();\n };\n el.addEventListener('seeked', onSeeked);\n el.currentTime = Math.min(Math.max(0, t), el.duration || t);\n });\n}\n\n/**\n * 抽 count 张等距缩略图(dataURL,jpeg)。供时间轴缩略图条 / 封面条。\n * 传入**专用离屏 video 元素**(勿用主预览源,seek 会打断播放)。\n */\nexport async function generateThumbnails(\n videoEl: HTMLVideoElement,\n count: number,\n maxW = 160,\n): Promise<string[]> {\n const dur = videoEl.duration;\n if (!dur || !isFinite(dur) || count <= 0) return [];\n const natW = videoEl.videoWidth || 16;\n const natH = videoEl.videoHeight || 9;\n const w = Math.min(maxW, natW);\n const h = Math.max(1, Math.round((w * natH) / natW));\n const canvas = document.createElement('canvas');\n canvas.width = w;\n canvas.height = h;\n const ctx = canvas.getContext('2d');\n if (!ctx) return [];\n const out: string[] = [];\n for (let i = 0; i < count; i++) {\n await seekVideo(videoEl, (dur * (i + 0.5)) / count);\n ctx.drawImage(videoEl, 0, 0, w, h);\n out.push(canvas.toDataURL('image/jpeg', 0.6));\n }\n return out;\n}\n","/**\n * 全屏切换按钮(框架无关 DOM)。点按对 host 进/出全屏;监听 fullscreenchange 切图标和 host 状态类。\n * 图片/视频 mount 共用:默认可作为覆盖按钮,也可放进宿主自己的返回工具栏。\n */\nexport interface FullscreenToggle {\n button: HTMLButtonElement;\n dispose: () => void;\n}\n\nexport interface FullscreenToggleOptions {\n mode?: 'overlay' | 'inline';\n className?: string;\n}\n\nexport function createFullscreenToggle(host: HTMLElement, options: FullscreenToggleOptions = {}): FullscreenToggle {\n const mode = options.mode ?? 'overlay';\n const btn = document.createElement('button');\n btn.type = 'button';\n btn.className = ['me-fullscreen-toggle', options.className].filter(Boolean).join(' ');\n btn.dataset.meFullscreenToggle = 'true';\n btn.dataset.mode = mode;\n btn.title = '全屏 / 退出全屏';\n btn.style.cssText = [\n mode === 'overlay' ? 'position:absolute;left:8px;bottom:8px;z-index:30;' : 'position:static;',\n 'width:32px;height:32px;padding:0;',\n 'display:inline-flex;align-items:center;justify-content:center;',\n 'border:1px solid var(--me-border,#26262b);border-radius:6px;',\n 'background:var(--me-chip,#1c1c20);color:var(--me-fg,#e7e7ee);',\n 'cursor:pointer;font-size:15px;line-height:1;opacity:0.9;font:inherit;',\n ].join('');\n\n host.classList.add('me-fullscreen-host');\n\n const sync = () => {\n const isFullscreen = document.fullscreenElement === host;\n btn.textContent = isFullscreen ? '×' : '⛶';\n btn.setAttribute('aria-label', isFullscreen ? '退出全屏' : '全屏');\n host.classList.toggle('me-is-fullscreen', isFullscreen);\n host.dataset.meFullscreen = isFullscreen ? 'true' : 'false';\n };\n sync();\n const onChange = () => sync();\n const onClick = () => {\n const action =\n document.fullscreenElement === host ? document.exitFullscreen?.() : host.requestFullscreen?.();\n void action?.catch?.(() => {});\n };\n btn.addEventListener('click', onClick);\n document.addEventListener('fullscreenchange', onChange);\n\n return {\n button: btn,\n dispose: () => {\n document.removeEventListener('fullscreenchange', onChange);\n btn.removeEventListener('click', onClick);\n btn.remove();\n host.classList.remove('me-fullscreen-host', 'me-is-fullscreen');\n delete host.dataset.meFullscreen;\n },\n };\n}\n"]}
@@ -0,0 +1,371 @@
1
+ import { z } from 'zod';
2
+
3
+ // src/state.ts
4
+ var StrokeCommon = {
5
+ color: z.string().max(32),
6
+ width: z.number().positive().max(200)
7
+ };
8
+ var RotationCommon = {
9
+ rotation: z.number().min(-180).max(180).optional()
10
+ };
11
+ var TimedOverlayCommon = {
12
+ startAt: z.number().min(0).optional(),
13
+ endAt: z.number().min(0).optional(),
14
+ timelineTrack: z.number().int().min(0).max(99).optional()
15
+ };
16
+ var Overlay = z.discriminatedUnion("type", [
17
+ // 自由画笔:扁平点序列 [x0,y0,x1,y1,...]
18
+ z.object({ type: z.literal("pen"), points: z.array(z.number()).min(4), ...StrokeCommon, ...RotationCommon }),
19
+ z.object({ type: z.literal("line"), x1: z.number(), y1: z.number(), x2: z.number(), y2: z.number(), ...StrokeCommon, ...RotationCommon }),
20
+ z.object({ type: z.literal("arrow"), x1: z.number(), y1: z.number(), x2: z.number(), y2: z.number(), ...StrokeCommon, ...RotationCommon }),
21
+ z.object({ type: z.literal("rect"), x: z.number(), y: z.number(), w: z.number(), h: z.number(), ...StrokeCommon, ...RotationCommon }),
22
+ z.object({ type: z.literal("ellipse"), x: z.number(), y: z.number(), w: z.number(), h: z.number(), ...StrokeCommon, ...RotationCommon }),
23
+ z.object({
24
+ type: z.literal("text"),
25
+ x: z.number(),
26
+ y: z.number(),
27
+ text: z.string().max(500),
28
+ color: z.string().max(32),
29
+ fontSize: z.number().positive().max(512),
30
+ startAt: z.number().min(0).optional(),
31
+ endAt: z.number().min(0).optional(),
32
+ timelineTrack: z.number().int().min(0).max(99).optional(),
33
+ ...RotationCommon
34
+ }),
35
+ // emoji 字符 或 dataURL 图片二选一
36
+ z.object({
37
+ type: z.literal("sticker"),
38
+ x: z.number(),
39
+ y: z.number(),
40
+ w: z.number().positive(),
41
+ h: z.number().positive(),
42
+ emoji: z.string().max(16).optional(),
43
+ src: z.string().optional(),
44
+ startAt: z.number().min(0).optional(),
45
+ endAt: z.number().min(0).optional(),
46
+ timelineTrack: z.number().int().min(0).max(99).optional(),
47
+ ...RotationCommon
48
+ }),
49
+ z.object({
50
+ type: z.literal("filter"),
51
+ x: z.number(),
52
+ y: z.number(),
53
+ w: z.number().positive(),
54
+ h: z.number().positive(),
55
+ filterPreset: z.string().max(32).optional(),
56
+ ...TimedOverlayCommon,
57
+ ...RotationCommon
58
+ }),
59
+ z.object({
60
+ type: z.literal("adjust"),
61
+ x: z.number(),
62
+ y: z.number(),
63
+ w: z.number().positive(),
64
+ h: z.number().positive(),
65
+ brightness: z.number().min(-1).max(1).default(0),
66
+ contrast: z.number().min(-1).max(1).default(0),
67
+ saturation: z.number().min(-1).max(1).default(0),
68
+ temperature: z.number().min(-1).max(1).default(0),
69
+ tint: z.number().min(-1).max(1).default(0),
70
+ vibrance: z.number().min(-1).max(1).default(0),
71
+ gamma: z.number().min(-1).max(1).default(0),
72
+ highlights: z.number().min(-1).max(1).default(0),
73
+ shadows: z.number().min(-1).max(1).default(0),
74
+ whites: z.number().min(-1).max(1).default(0),
75
+ blacks: z.number().min(-1).max(1).default(0),
76
+ lightSense: z.number().min(-1).max(1).default(0),
77
+ sharpen: z.number().min(0).max(1).default(0),
78
+ clarity: z.number().min(0).max(1).default(0),
79
+ grain: z.number().min(0).max(1).default(0),
80
+ fade: z.number().min(0).max(1).default(0),
81
+ vignette: z.number().min(0).max(1).default(0),
82
+ ...TimedOverlayCommon,
83
+ ...RotationCommon
84
+ })
85
+ ]);
86
+ var Clip = z.object({
87
+ srcIdx: z.number().int().min(0).max(7),
88
+ in: z.number().min(0),
89
+ out: z.number().min(0)
90
+ });
91
+ var AudioClip = z.object({
92
+ srcIdx: z.number().int().min(0).max(2),
93
+ track: z.number().int().min(0).default(0),
94
+ startAt: z.number().min(0),
95
+ in: z.number().min(0),
96
+ out: z.number().min(0),
97
+ speed: z.number().min(0.5).max(2).default(1),
98
+ volume: z.number().min(0).max(2),
99
+ fadeIn: z.number().min(0).default(0),
100
+ fadeOut: z.number().min(0).default(0)
101
+ });
102
+ var Transition = z.object({
103
+ type: z.enum(["none", "fade", "slide", "wipe", "flip", "clockWipe", "star", "circle", "rectangle"]).default("none"),
104
+ duration: z.number().min(0).max(2).default(0.4)
105
+ });
106
+ var ExportSettings = z.object({
107
+ fileName: z.string().max(120).optional(),
108
+ format: z.enum(["mp4", "mov", "mxf"]).default("mp4"),
109
+ width: z.number().int().min(2).max(8192).optional(),
110
+ height: z.number().int().min(2).max(8192).optional(),
111
+ frameRate: z.number().int().min(12).max(120).default(30),
112
+ videoBitrateKbps: z.number().int().min(100).max(5e4).optional(),
113
+ audioBitrateKbps: z.number().int().min(32).max(1024).optional(),
114
+ audioCodec: z.enum(["aac", "mp3"]).default("aac")
115
+ }).optional();
116
+ var VideoEditState = z.object({
117
+ clips: z.array(Clip).min(1).max(50),
118
+ audioClips: z.array(AudioClip).max(8).default([]),
119
+ /** 输出画布(=首素材分辨率,偶数);全局 crop/rotation 的"源 dims" */
120
+ canvas: z.object({
121
+ w: z.number().int().min(2).max(4096),
122
+ h: z.number().int().min(2).max(4096)
123
+ }),
124
+ crop: z.object({
125
+ x: z.number().min(0),
126
+ y: z.number().min(0),
127
+ width: z.number().positive(),
128
+ height: z.number().positive()
129
+ }).optional(),
130
+ scale: z.object({
131
+ width: z.number().positive(),
132
+ height: z.number().positive(),
133
+ fit: z.enum(["contain", "cover", "force"])
134
+ }).optional(),
135
+ /** 任意角度(度)。UI = 90° 步进按钮 + ±45° 刻度盘叠加 */
136
+ rotation: z.number().min(-180).max(180).default(0),
137
+ flipX: z.boolean().default(false),
138
+ flipY: z.boolean().default(false),
139
+ filters: z.object({
140
+ brightness: z.number().min(-1).max(1).default(0),
141
+ contrast: z.number().min(-1).max(1).default(0),
142
+ saturation: z.number().min(-1).max(1).default(0),
143
+ temperature: z.number().min(-1).max(1).default(0),
144
+ tint: z.number().min(-1).max(1).default(0),
145
+ vibrance: z.number().min(-1).max(1).default(0),
146
+ gamma: z.number().min(-1).max(1).default(0),
147
+ highlights: z.number().min(-1).max(1).default(0),
148
+ shadows: z.number().min(-1).max(1).default(0),
149
+ whites: z.number().min(-1).max(1).default(0),
150
+ blacks: z.number().min(-1).max(1).default(0),
151
+ lightSense: z.number().min(-1).max(1).default(0),
152
+ sharpen: z.number().min(0).max(1).default(0),
153
+ clarity: z.number().min(0).max(1).default(0),
154
+ grain: z.number().min(0).max(1).default(0),
155
+ fade: z.number().min(0).max(1).default(0),
156
+ vignette: z.number().min(0).max(1).default(0)
157
+ }).default({
158
+ brightness: 0,
159
+ contrast: 0,
160
+ saturation: 0,
161
+ temperature: 0,
162
+ tint: 0,
163
+ vibrance: 0,
164
+ gamma: 0,
165
+ highlights: 0,
166
+ shadows: 0,
167
+ whites: 0,
168
+ blacks: 0,
169
+ lightSense: 0,
170
+ sharpen: 0,
171
+ clarity: 0,
172
+ grain: 0,
173
+ fade: 0,
174
+ vignette: 0
175
+ }),
176
+ /** 预设滤镜 id(见 filters.ts);与 filters 手调叠加 */
177
+ filterPreset: z.string().max(32).optional(),
178
+ overlays: z.array(Overlay).max(200).optional(),
179
+ transitions: z.array(Transition).max(49).default([]),
180
+ /** 原视频声音开关(与音乐混音共存) */
181
+ keepAudio: z.boolean().default(true),
182
+ /** 封面时刻 = 输出时间轴 */
183
+ poster: z.object({ time: z.number().min(0) }).optional(),
184
+ exportSettings: ExportSettings
185
+ }).superRefine((s, ctx) => {
186
+ s.clips.forEach((c, i) => {
187
+ if (c.out <= c.in) {
188
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: `clips[${i}].out \u5FC5\u987B\u5927\u4E8E in`, path: ["clips", i, "out"] });
189
+ }
190
+ });
191
+ s.audioClips?.forEach((a, i) => {
192
+ if (a.out <= a.in) {
193
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: `audioClips[${i}].out \u5FC5\u987B\u5927\u4E8E in`, path: ["audioClips", i, "out"] });
194
+ }
195
+ });
196
+ if (s.canvas.w % 2 !== 0 || s.canvas.h % 2 !== 0) {
197
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: "canvas \u5BBD\u9AD8\u5FC5\u987B\u4E3A\u5076\u6570", path: ["canvas"] });
198
+ }
199
+ if (s.exportSettings?.width != null && s.exportSettings.width % 2 !== 0) {
200
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: "exportSettings.width \u5FC5\u987B\u4E3A\u5076\u6570", path: ["exportSettings", "width"] });
201
+ }
202
+ if (s.exportSettings?.height != null && s.exportSettings.height % 2 !== 0) {
203
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: "exportSettings.height \u5FC5\u987B\u4E3A\u5076\u6570", path: ["exportSettings", "height"] });
204
+ }
205
+ });
206
+ function defaultVideoEditState() {
207
+ return {
208
+ clips: [],
209
+ audioClips: [],
210
+ canvas: { w: 2, h: 2 },
211
+ rotation: 0,
212
+ flipX: false,
213
+ flipY: false,
214
+ filters: {
215
+ brightness: 0,
216
+ contrast: 0,
217
+ saturation: 0,
218
+ temperature: 0,
219
+ tint: 0,
220
+ vibrance: 0,
221
+ gamma: 0,
222
+ highlights: 0,
223
+ shadows: 0,
224
+ whites: 0,
225
+ blacks: 0,
226
+ lightSense: 0,
227
+ sharpen: 0,
228
+ clarity: 0,
229
+ grain: 0,
230
+ fade: 0,
231
+ vignette: 0
232
+ },
233
+ transitions: [],
234
+ keepAudio: true
235
+ };
236
+ }
237
+
238
+ // src/timeline.ts
239
+ var MIN_CLIP = 0.1;
240
+ function clipDuration(c) {
241
+ return c.out - c.in;
242
+ }
243
+ function totalDuration(clips) {
244
+ return clips.reduce((s, c) => s + clipDuration(c), 0);
245
+ }
246
+ function clipStartsAt(clips, idx) {
247
+ let s = 0;
248
+ for (let i = 0; i < idx && i < clips.length; i++) s += clipDuration(clips[i]);
249
+ return s;
250
+ }
251
+ function locateOutput(clips, t) {
252
+ if (!clips.length || t < 0) return null;
253
+ let acc = 0;
254
+ for (let i = 0; i < clips.length; i++) {
255
+ const d = clipDuration(clips[i]);
256
+ if (t < acc + d) return { idx: i, srcTime: clips[i].in + (t - acc) };
257
+ acc += d;
258
+ }
259
+ if (Math.abs(t - acc) < 1e-9 || t <= acc) {
260
+ const last = clips.length - 1;
261
+ return { idx: last, srcTime: clips[last].out };
262
+ }
263
+ return null;
264
+ }
265
+ function splitAtOutput(clips, t) {
266
+ const loc = locateOutput(clips, t);
267
+ if (!loc) return clips;
268
+ const c = clips[loc.idx];
269
+ if (loc.srcTime < c.in + MIN_CLIP || loc.srcTime > c.out - MIN_CLIP) return clips;
270
+ return [
271
+ ...clips.slice(0, loc.idx),
272
+ { ...c, out: loc.srcTime },
273
+ { ...c, in: loc.srcTime },
274
+ ...clips.slice(loc.idx + 1)
275
+ ];
276
+ }
277
+ function removeClip(clips, idx) {
278
+ if (clips.length <= 1 || !clips[idx]) return clips;
279
+ return clips.filter((_, i) => i !== idx);
280
+ }
281
+ function duplicateClip(clips, idx) {
282
+ const c = clips[idx];
283
+ if (!c) return clips;
284
+ return [...clips.slice(0, idx + 1), { ...c }, ...clips.slice(idx + 1)];
285
+ }
286
+ function reorderClips(clips, from, to) {
287
+ if (from === to || !clips[from] || to < 0 || to >= clips.length) return clips;
288
+ const next = [...clips];
289
+ const [moved] = next.splice(from, 1);
290
+ next.splice(to, 0, moved);
291
+ return next;
292
+ }
293
+ function trimClipEdge(clips, idx, edge, srcT, srcDuration) {
294
+ const c = clips[idx];
295
+ if (!c) return clips;
296
+ const next = clips.map((x) => ({ ...x }));
297
+ if (edge === "in") {
298
+ next[idx].in = Math.min(Math.max(srcT, 0), next[idx].out - MIN_CLIP);
299
+ } else {
300
+ next[idx].out = Math.max(Math.min(srcT, srcDuration), next[idx].in + MIN_CLIP);
301
+ }
302
+ return next;
303
+ }
304
+ function clampAudioClip(a, srcDuration, total) {
305
+ const out = Math.max(Math.min(a.out, srcDuration), MIN_CLIP);
306
+ const inn = Math.min(Math.max(a.in, 0), out - MIN_CLIP);
307
+ const startAt = Math.min(Math.max(a.startAt, 0), Math.max(0, total - MIN_CLIP));
308
+ const duration = Math.max(MIN_CLIP, out - inn);
309
+ const speed = Math.min(Math.max(Number(a.speed) || 1, 0.5), 2);
310
+ const track = Number.isInteger(a.track) && a.track >= 0 ? a.track : 0;
311
+ const fadeIn = Math.min(Math.max(Number(a.fadeIn) || 0, 0), duration);
312
+ const fadeOut = Math.min(Math.max(Number(a.fadeOut) || 0, 0), Math.max(0, duration - fadeIn));
313
+ return { ...a, track, in: inn, out, startAt, speed, fadeIn, fadeOut };
314
+ }
315
+ function overlayDurationEnd(overlays = []) {
316
+ return (overlays ?? []).reduce((maxEnd, overlay) => {
317
+ if (overlay?.type !== "text" && overlay?.type !== "sticker") return maxEnd;
318
+ const startAt = Number.isFinite(overlay?.startAt) ? Math.max(0, Number(overlay.startAt)) : 0;
319
+ const endAt = Number.isFinite(overlay?.endAt) ? Math.max(startAt, Number(overlay.endAt)) : startAt;
320
+ return Math.max(maxEnd, endAt);
321
+ }, 0);
322
+ }
323
+ function contentDuration(clips, audioClips = [], overlays = []) {
324
+ const video = totalDuration(clips);
325
+ const audioEnd = audioClips.reduce((m, a) => Math.max(m, a.startAt + (a.out - a.in)), 0);
326
+ const overlayEnd = overlayDurationEnd(overlays);
327
+ return Math.max(video, audioEnd, overlayEnd);
328
+ }
329
+ function usedVideoSrcIndices(clips) {
330
+ return [...new Set(clips.map((c) => c.srcIdx))].sort((x, y) => x - y);
331
+ }
332
+ function remapSrcIndices(clips, used) {
333
+ const map = new Map(used.map((s, i) => [s, i]));
334
+ return clips.map((c) => ({ ...c, srcIdx: map.get(c.srcIdx) ?? 0 }));
335
+ }
336
+
337
+ // src/history.ts
338
+ var MAX_DEPTH = 100;
339
+ function createHistory(initial) {
340
+ return { past: [], present: initial, future: [] };
341
+ }
342
+ function pushHistory(h, next) {
343
+ if (next === h.present) return h;
344
+ const past = [...h.past, h.present];
345
+ if (past.length > MAX_DEPTH) past.shift();
346
+ return { past, present: next, future: [] };
347
+ }
348
+ function replacePresent(h, next) {
349
+ if (next === h.present) return h;
350
+ return { ...h, present: next };
351
+ }
352
+ function canUndo(h) {
353
+ return h.past.length > 0;
354
+ }
355
+ function canRedo(h) {
356
+ return h.future.length > 0;
357
+ }
358
+ function undo(h) {
359
+ if (!canUndo(h)) return h;
360
+ const past = h.past.slice(0, -1);
361
+ return { past, present: h.past[h.past.length - 1], future: [h.present, ...h.future] };
362
+ }
363
+ function redo(h) {
364
+ if (!canRedo(h)) return h;
365
+ const [next, ...future] = h.future;
366
+ return { past: [...h.past, h.present], present: next, future };
367
+ }
368
+
369
+ export { AudioClip, Clip, MIN_CLIP, Overlay, VideoEditState, canRedo, canUndo, clampAudioClip, clipDuration, clipStartsAt, contentDuration, createHistory, defaultVideoEditState, duplicateClip, locateOutput, pushHistory, redo, remapSrcIndices, removeClip, reorderClips, replacePresent, splitAtOutput, totalDuration, trimClipEdge, undo, usedVideoSrcIndices };
370
+ //# sourceMappingURL=chunk-MGKYVYOH.js.map
371
+ //# sourceMappingURL=chunk-MGKYVYOH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/state.ts","../src/timeline.ts","../src/history.ts"],"names":[],"mappings":";;;AAmBA,IAAM,YAAA,GAAe;AAAA,EACnB,KAAA,EAAO,CAAA,CAAE,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,OAAA,EAAS,IAAA,EAAK;AAC/B;AAEO,SAAS,QAAW,CAAA,EAAwB;AACjD,EAAA,OAAO,CAAA,CAAE,KAAK,MAAA,GAAS,CAAA;AACzB;AAEO,SAAS,QAAW,CAAA,EAAwB;AACjD,EAAA,OAAO,CAAA,CAAE,OAAO,MAAA,GAAS,CAAA;AAC3B;AAEO,SAAS,KAAQ,CAAA,EAA2B;AACjD,EAAA,IAAI,CAAC,OAAA,CAAQ,CAAC,CAAA,EAAG,OAAO,CAAA;AACxB,EAAA,MAAM,IAAA,GAAO,CAAA,CAAE,IAAA,CAAK,KAAA,CAAM,GAAG,EAAE,CAAA;AAC/B,EAAA,OAAO,EAAE,IAAA,EAAM,OAAA,EAAS,CAAA,CAAE,IAAA,CAAK,EAAE,IAAA,CAAK,MAAA,GAAS,CAAC,CAAA,EAAG,QAAQ,CAAC,CAAA,CAAE,SAAS,GAAG,CAAA,CAAE,MAAM,CAAA,EAAE;AACtF;AAEO,SAAS,KAAQ,CAAA,EAA2B;AACjD,EAAA,IAAI,CAAC,OAAA,CAAQ,CAAC,CAAA,EAAG,OAAO,CAAA;AACxB,EAAA,MAAM,CAAC,IAAA,EAAM,GAAG,MAAM,IAAI,CAAA,CAAE,MAAA;AAC5B,EAAA,OAAO,EAAE,IAAA,EAAM,CAAC,GAAG,CAAA,CAAE,IAAA,EAAM,CAAA,CAAE,OAAO,CAAA,EAAG,OAAA,EAAS,IAAA,EAAM,MAAA,EAAO;AAC/D","file":"chunk-MGKYVYOH.js","sourcesContent":["/**\n * editor-core/state —— 视频编辑状态模型 v2(纯 TS,零框架依赖)\n *\n * SDK 分层约定:本目录(editor-core)是未来 Vue/任意框架适配的共享核心,\n * 只允许纯 TS + zod,禁止 import React/Next/DOM 类型。\n *\n * v2 = 多素材输出时间轴(CapCut 简化版):\n * - clips:视频片段列表,**数组顺序 = 输出拼接顺序**(x 轴是输出时间,不是源时间)。\n * 每个片段 = { srcIdx: 第几个上传的视频文件, in/out: 该源内的时间区间 }。\n * EditState 只存索引引用——File/objectURL 是浏览器运行时的事,不进状态。\n * - audioClips:音乐轨。startAt = 在输出时间轴上的落点;volume 0-2(导出真值,预览钳 1)。\n * - canvas:输出画布 = 第一个素材的分辨率(偶数)。所有片段先 cover 居中裁剪铺满画布,\n * 再统一过全局效果链 —— crop/rotation/outputSize 的「源 dims」一律指 canvas。\n * - 全局效果(crop/scale/rotation/flips/filters/overlays)作用于拼接后的整条输出。\n * - poster.time = 输出时间轴时刻。\n * overlays 坐标存「最终输出空间」,导出时客户端渲染成输出分辨率透明 PNG 烧入。\n */\nimport { z } from 'zod';\n\nconst StrokeCommon = {\n color: z.string().max(32),\n width: z.number().positive().max(200),\n};\nconst RotationCommon = {\n rotation: z.number().min(-180).max(180).optional(),\n};\n\nexport const Overlay = z.discriminatedUnion('type', [\n // 自由画笔:扁平点序列 [x0,y0,x1,y1,...]\n z.object({ type: z.literal('pen'), points: z.array(z.number()).min(4), ...StrokeCommon, ...RotationCommon }),\n z.object({ type: z.literal('line'), x1: z.number(), y1: z.number(), x2: z.number(), y2: z.number(), ...StrokeCommon, ...RotationCommon }),\n z.object({ type: z.literal('arrow'), x1: z.number(), y1: z.number(), x2: z.number(), y2: z.number(), ...StrokeCommon, ...RotationCommon }),\n z.object({ type: z.literal('rect'), x: z.number(), y: z.number(), w: z.number(), h: z.number(), ...StrokeCommon, ...RotationCommon }),\n z.object({ type: z.literal('ellipse'), x: z.number(), y: z.number(), w: z.number(), h: z.number(), ...StrokeCommon, ...RotationCommon }),\n z.object({\n type: z.literal('text'),\n x: z.number(),\n y: z.number(),\n text: z.string().max(500),\n color: z.string().max(32),\n fontSize: z.number().positive().max(512),\n ...RotationCommon,\n }),\n // emoji 字符 或 dataURL 图片二选一\n z.object({\n type: z.literal('sticker'),\n x: z.number(),\n y: z.number(),\n w: z.number().positive(),\n h: z.number().positive(),\n emoji: z.string().max(16).optional(),\n src: z.string().optional(),\n ...RotationCommon,\n }),\n]);\nexport type OverlayT = z.infer<typeof Overlay>;\n\n/** 视频片段:srcIdx 指向上传文件序(服务端交叉校验 < 实际文件数) */\nexport const Clip = z.object({\n srcIdx: z.number().int().min(0).max(7),\n in: z.number().min(0),\n out: z.number().min(0),\n});\nexport type ClipT = z.infer<typeof Clip>;\n\n/** 音乐片段:startAt = 输出时间轴落点;in/out = 音频源内区间 */\nexport const AudioClip = z.object({\n srcIdx: z.number().int().min(0).max(2),\n startAt: z.number().min(0),\n in: z.number().min(0),\n out: z.number().min(0),\n volume: z.number().min(0).max(2),\n});\nexport type AudioClipT = z.infer<typeof AudioClip>;\n\nexport const VideoEditState = z\n .object({\n clips: z.array(Clip).min(1).max(50),\n audioClips: z.array(AudioClip).max(8).default([]),\n /** 输出画布(=首素材分辨率,偶数);全局 crop/rotation 的\"源 dims\" */\n canvas: z.object({\n w: z.number().int().min(2).max(4096),\n h: z.number().int().min(2).max(4096),\n }),\n crop: z\n .object({\n x: z.number().min(0),\n y: z.number().min(0),\n width: z.number().positive(),\n height: z.number().positive(),\n })\n .optional(),\n scale: z\n .object({\n width: z.number().positive(),\n height: z.number().positive(),\n fit: z.enum(['contain', 'cover', 'force']),\n })\n .optional(),\n /** 任意角度(度)。UI = 90° 步进按钮 + ±45° 刻度盘叠加 */\n rotation: z.number().min(-180).max(180).default(0),\n flipX: z.boolean().default(false),\n flipY: z.boolean().default(false),\n filters: z\n .object({\n brightness: z.number().min(-1).max(1),\n contrast: z.number().min(-1).max(1),\n saturation: z.number().min(-1).max(1),\n gamma: z.number().min(-1).max(1).default(0),\n })\n .default({ brightness: 0, contrast: 0, saturation: 0, gamma: 0 }),\n /** 预设滤镜 id(见 filters.ts);与 filters 手调叠加 */\n filterPreset: z.string().max(32).optional(),\n overlays: z.array(Overlay).max(200).optional(),\n /** 原视频声音开关(与音乐混音共存) */\n keepAudio: z.boolean().default(true),\n /** 封面时刻 = 输出时间轴 */\n poster: z.object({ time: z.number().min(0) }).optional(),\n })\n .superRefine((s, ctx) => {\n // 同源可多次引用(复制语义),唯一硬约束 out > in;画布偶数(h264)\n s.clips.forEach((c, i) => {\n if (c.out <= c.in) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, message: `clips[${i}].out 必须大于 in`, path: ['clips', i, 'out'] });\n }\n });\n s.audioClips?.forEach((a, i) => {\n if (a.out <= a.in) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, message: `audioClips[${i}].out 必须大于 in`, path: ['audioClips', i, 'out'] });\n }\n });\n if (s.canvas.w % 2 !== 0 || s.canvas.h % 2 !== 0) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'canvas 宽高必须为偶数', path: ['canvas'] });\n }\n });\n\nexport type VideoEditStateT = z.infer<typeof VideoEditState>;\n\n/**\n * 客户端初始占位:首个素材 metadata 加载前 clips 为空、canvas 为最小值,\n * **不过 schema**(clips min1)——服务端只收显式提交的完整状态,不受影响;\n * 首源加载完成后编辑器会用真实 clips/canvas 重建 history。\n */\nexport function defaultVideoEditState(): VideoEditStateT {\n return {\n clips: [],\n audioClips: [],\n canvas: { w: 2, h: 2 },\n rotation: 0,\n flipX: false,\n flipY: false,\n filters: { brightness: 0, contrast: 0, saturation: 0, gamma: 0 },\n keepAudio: true,\n };\n}\n","/**\n * editor-core/timeline v2 —— 输出时间轴纯函数(多素材 clips/audioClips 操作)。\n * 从 UI 抽出,Vue/React 壳共用;全部不可变(返回新数组)。\n *\n * 模型:clips 数组顺序 = 输出拼接顺序;输出时间轴 x = Σ前序片段时长。\n * 所有 \"t\" 参数除特别说明外都是**输出时间**;trimClipEdge 的 srcT 是源时间。\n */\nimport type { ClipT, AudioClipT } from './state';\n\nexport const MIN_CLIP = 0.1; // 片段最短时长(秒)\n\n/** 片段时长 */\nexport function clipDuration(c: ClipT): number {\n return c.out - c.in;\n}\n\n/** 输出总时长 */\nexport function totalDuration(clips: ClipT[]): number {\n return clips.reduce((s, c) => s + clipDuration(c), 0);\n}\n\n/** 第 idx 个片段在输出时间轴上的起点(前缀和) */\nexport function clipStartsAt(clips: ClipT[], idx: number): number {\n let s = 0;\n for (let i = 0; i < idx && i < clips.length; i++) s += clipDuration(clips[i]);\n return s;\n}\n\n/**\n * 输出时间 t → 所属片段与源内时刻。\n * 交界时刻归后段(前段已播完);t === total 归末段(srcTime = out);\n * t 越界或 clips 为空返回 null。\n */\nexport function locateOutput(clips: ClipT[], t: number): { idx: number; srcTime: number } | null {\n if (!clips.length || t < 0) return null;\n let acc = 0;\n for (let i = 0; i < clips.length; i++) {\n const d = clipDuration(clips[i]);\n if (t < acc + d) return { idx: i, srcTime: clips[i].in + (t - acc) };\n acc += d;\n }\n // 恰好等于总时长 → 末段终点(播放头停在结尾的合法位置)\n if (Math.abs(t - acc) < 1e-9 || t <= acc) {\n const last = clips.length - 1;\n return { idx: last, srcTime: clips[last].out };\n }\n return null;\n}\n\n/** 在输出时刻 t 处把所属片段一分为二;距两端 <MIN_CLIP 返回原数组 */\nexport function splitAtOutput(clips: ClipT[], t: number): ClipT[] {\n const loc = locateOutput(clips, t);\n if (!loc) return clips;\n const c = clips[loc.idx];\n if (loc.srcTime < c.in + MIN_CLIP || loc.srcTime > c.out - MIN_CLIP) return clips;\n return [\n ...clips.slice(0, loc.idx),\n { ...c, out: loc.srcTime },\n { ...c, in: loc.srcTime },\n ...clips.slice(loc.idx + 1),\n ];\n}\n\n/** 删除第 idx 个片段;只剩一段时不可删,返回原数组 */\nexport function removeClip(clips: ClipT[], idx: number): ClipT[] {\n if (clips.length <= 1 || !clips[idx]) return clips;\n return clips.filter((_, i) => i !== idx);\n}\n\n/** 复制第 idx 个片段,插到原段之后 */\nexport function duplicateClip(clips: ClipT[], idx: number): ClipT[] {\n const c = clips[idx];\n if (!c) return clips;\n return [...clips.slice(0, idx + 1), { ...c }, ...clips.slice(idx + 1)];\n}\n\n/** 拖拽重排:把第 from 段移动到第 to 位 */\nexport function reorderClips(clips: ClipT[], from: number, to: number): ClipT[] {\n if (from === to || !clips[from] || to < 0 || to >= clips.length) return clips;\n const next = [...clips];\n const [moved] = next.splice(from, 1);\n next.splice(to, 0, moved);\n return next;\n}\n\n/**\n * 拖片段把手:把第 idx 段的 in/out 改到源时刻 srcT。\n * in 钳 [0, out-MIN_CLIP];out 钳 [in+MIN_CLIP, srcDuration]。\n */\nexport function trimClipEdge(\n clips: ClipT[],\n idx: number,\n edge: 'in' | 'out',\n srcT: number,\n srcDuration: number\n): ClipT[] {\n const c = clips[idx];\n if (!c) return clips;\n const next = clips.map((x) => ({ ...x }));\n if (edge === 'in') {\n next[idx].in = Math.min(Math.max(srcT, 0), next[idx].out - MIN_CLIP);\n } else {\n next[idx].out = Math.max(Math.min(srcT, srcDuration), next[idx].in + MIN_CLIP);\n }\n return next;\n}\n\n/**\n * 音乐片段钳制:in/out 在源时长内且 out-in≥MIN_CLIP;\n * startAt ∈ [0, max(0, total-MIN_CLIP)] —— 允许尾部悬出输出末尾(导出 amix duration=first 截断)。\n */\nexport function clampAudioClip(a: AudioClipT, srcDuration: number, total: number): AudioClipT {\n const out = Math.max(Math.min(a.out, srcDuration), MIN_CLIP);\n const inn = Math.min(Math.max(a.in, 0), out - MIN_CLIP);\n const startAt = Math.min(Math.max(a.startAt, 0), Math.max(0, total - MIN_CLIP));\n return { ...a, in: inn, out, startAt };\n}\n\n/**\n * 时间轴内容时长 = max(视频总长, 音乐悬出末端)。\n * 用于内容宽度/适应缩放/标尺——音乐尾部悬出视频末尾时也要看得见;\n * 播放头/seek 仍以视频总长为界(导出 amix duration=first 同语义)。\n */\nexport function contentDuration(clips: ClipT[], audioClips: AudioClipT[] = []): number {\n const video = totalDuration(clips);\n const audioEnd = audioClips.reduce((m, a) => Math.max(m, a.startAt + (a.out - a.in)), 0);\n return Math.max(video, audioEnd);\n}\n\n/** clips 实际引用到的视频源序号(升序去重)——导出前压缩上传用 */\nexport function usedVideoSrcIndices(clips: ClipT[]): number[] {\n return [...new Set(clips.map((c) => c.srcIdx))].sort((x, y) => x - y);\n}\n\n/** 把 clips 的 srcIdx 重映射为 used 中的序号(与压缩后的上传文件序对齐) */\nexport function remapSrcIndices(clips: ClipT[], used: number[]): ClipT[] {\n const map = new Map(used.map((s, i) => [s, i]));\n return clips.map((c) => ({ ...c, srcIdx: map.get(c.srcIdx) ?? 0 }));\n}\n","/**\n * editor-core/history —— 不可变快照 undo/redo 栈(纯函数)。\n * 泛型,对 EditState 的 JSON 快照工作;壳层(React/Vue)只持有 History<T> 并 set 回去。\n */\n\nexport interface History<T> {\n past: T[];\n present: T;\n future: T[];\n}\n\nconst MAX_DEPTH = 100;\n\nexport function createHistory<T>(initial: T): History<T> {\n return { past: [], present: initial, future: [] };\n}\n\n/** 写入新状态(清空 redo 栈);浅比较相同引用则原样返回 */\nexport function pushHistory<T>(h: History<T>, next: T): History<T> {\n if (next === h.present) return h;\n const past = [...h.past, h.present];\n if (past.length > MAX_DEPTH) past.shift();\n return { past, present: next, future: [] };\n}\n\n/**\n * 替换当前态但不入栈(高频拖拽的中间帧用):\n * 拖动过程 replacePresent 持续刷新,pointerup 时再 pushHistory 定格一步。\n */\nexport function replacePresent<T>(h: History<T>, next: T): History<T> {\n if (next === h.present) return h;\n return { ...h, present: next };\n}\n\nexport function canUndo<T>(h: History<T>): boolean {\n return h.past.length > 0;\n}\n\nexport function canRedo<T>(h: History<T>): boolean {\n return h.future.length > 0;\n}\n\nexport function undo<T>(h: History<T>): History<T> {\n if (!canUndo(h)) return h;\n const past = h.past.slice(0, -1);\n return { past, present: h.past[h.past.length - 1], future: [h.present, ...h.future] };\n}\n\nexport function redo<T>(h: History<T>): History<T> {\n if (!canRedo(h)) return h;\n const [next, ...future] = h.future;\n return { past: [...h.past, h.present], present: next, future };\n}\n"]}
@@ -0,0 +1,87 @@
1
+ // src/transform.ts
2
+ var DEG2RAD = Math.PI / 180;
3
+ function rotatedSize(w, h, deg) {
4
+ const norm = normalizeDeg(deg);
5
+ if (norm === 0 || norm === 180) return { w, h };
6
+ if (norm === 90 || norm === 270) return { w: h, h: w };
7
+ const rad = norm * DEG2RAD;
8
+ return {
9
+ w: Math.round(Math.abs(w * Math.cos(rad)) + Math.abs(h * Math.sin(rad))),
10
+ h: Math.round(Math.abs(w * Math.sin(rad)) + Math.abs(h * Math.cos(rad)))
11
+ };
12
+ }
13
+ function normalizeDeg(deg) {
14
+ return (deg % 360 + 360) % 360;
15
+ }
16
+ function evenize(n) {
17
+ const v = Math.round(n);
18
+ return v - v % 2;
19
+ }
20
+ function clampRect(rect, bounds, minSize = 40) {
21
+ const width = Math.min(Math.max(minSize, rect.width), bounds.w);
22
+ const height = Math.min(Math.max(minSize, rect.height), bounds.h);
23
+ const x = Math.min(Math.max(0, rect.x), bounds.w - width);
24
+ const y = Math.min(Math.max(0, rect.y), bounds.h - height);
25
+ return { x: Math.round(x), y: Math.round(y), width: Math.round(width), height: Math.round(height) };
26
+ }
27
+ function centeredMaxRect(bounds, aspect) {
28
+ let width = bounds.w;
29
+ let height = width / aspect;
30
+ if (height > bounds.h) {
31
+ height = bounds.h;
32
+ width = height * aspect;
33
+ }
34
+ return {
35
+ x: Math.round((bounds.w - width) / 2),
36
+ y: Math.round((bounds.h - height) / 2),
37
+ width: Math.round(width),
38
+ height: Math.round(height)
39
+ };
40
+ }
41
+ function fitRects(crop, out, fit) {
42
+ const fullSrc = { x: 0, y: 0, width: crop.width, height: crop.height };
43
+ const fullDst = { x: 0, y: 0, width: out.w, height: out.h };
44
+ if (fit === "cover") {
45
+ return { src: centeredMaxRect({ w: crop.width, h: crop.height }, out.w / out.h), dst: fullDst };
46
+ }
47
+ if (fit === "contain") {
48
+ return { src: fullSrc, dst: centeredMaxRect({ w: out.w, h: out.h }, crop.width / crop.height) };
49
+ }
50
+ return { src: fullSrc, dst: fullDst };
51
+ }
52
+ function outputSize(source, state) {
53
+ if (state.scale) return { w: evenize(state.scale.width), h: evenize(state.scale.height) };
54
+ if (state.crop) return { w: evenize(state.crop.width), h: evenize(state.crop.height) };
55
+ const r = rotatedSize(source.w, source.h, state.rotation);
56
+ return { w: evenize(r.w), h: evenize(r.h) };
57
+ }
58
+
59
+ // src/filters.ts
60
+ var FILTER_PRESETS = [
61
+ { id: "bw", label: "\u9ED1\u767D", vf: "hue=s=0", css: "grayscale(1)" },
62
+ {
63
+ id: "sepia",
64
+ label: "\u590D\u53E4",
65
+ vf: "colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131",
66
+ css: "sepia(0.85)"
67
+ },
68
+ { id: "warm", label: "\u6696\u9633", vf: "colorbalance=rs=.15:gs=.04:bs=-.15", css: "sepia(0.25) saturate(1.25) brightness(1.03)" },
69
+ { id: "cool", label: "\u51B7\u8C03", vf: "colorbalance=rs=-.14:bs=.16", css: "hue-rotate(12deg) saturate(0.95) brightness(1.02)" },
70
+ { id: "vivid", label: "\u9C9C\u8273", vf: "eq=saturation=1.45:contrast=1.08", css: "saturate(1.45) contrast(1.08)" }
71
+ ];
72
+ function findFilterPreset(id) {
73
+ return id ? FILTER_PRESETS.find((p) => p.id === id) : void 0;
74
+ }
75
+ function buildFilterCss(filters, presetId) {
76
+ const presetCss = findFilterPreset(presetId)?.css ?? "";
77
+ return [
78
+ `brightness(${1 + filters.brightness})`,
79
+ `contrast(${1 + filters.contrast})`,
80
+ `saturate(${1 + filters.saturation})`,
81
+ presetCss
82
+ ].filter(Boolean).join(" ");
83
+ }
84
+
85
+ export { DEG2RAD, FILTER_PRESETS, buildFilterCss, centeredMaxRect, clampRect, evenize, findFilterPreset, fitRects, normalizeDeg, outputSize, rotatedSize };
86
+ //# sourceMappingURL=chunk-USY6UDGL.js.map
87
+ //# sourceMappingURL=chunk-USY6UDGL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/transform.ts","../src/filters.ts"],"names":[],"mappings":";AAKO,IAAM,OAAA,GAAU,KAAK,EAAA,GAAK;AAG1B,SAAS,WAAA,CAAY,CAAA,EAAW,CAAA,EAAW,GAAA,EAAuC;AACvF,EAAA,MAAM,IAAA,GAAO,aAAa,GAAG,CAAA;AAE7B,EAAA,IAAI,SAAS,CAA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AA,IAChC,CAAA,SAAA,EAAY,CAAA,GAAI,OAAA,CAAQ,UAAU,CAAA,CAAA,CAAA;AAAA,IAClC;AAAA,GACF,CACG,MAAA,CAAO,OAAO,CAAA,CACd,KAAK,GAAG,CAAA;AACb","file":"chunk-USY6UDGL.js","sourcesContent":["/**\n * editor-core/transform —— 旋转/坐标换算纯函数。\n * 与 ffmpeg 的 rotw/roth 同公式,保证预览画布与导出尺寸一致。\n */\n\nexport const DEG2RAD = Math.PI / 180;\n\n/** 旋转 deg 度后的外接框尺寸(= ffmpeg rotate 滤镜 ow=rotw/oh=roth) */\nexport function rotatedSize(w: number, h: number, deg: number): { w: number; h: number } {\n const norm = normalizeDeg(deg);\n // 90 倍数精确交换,避免浮点\n if (norm === 0 || norm === 180) return { w, h };\n if (norm === 90 || norm === 270) return { w: h, h: w };\n const rad = norm * DEG2RAD;\n return {\n w: Math.round(Math.abs(w * Math.cos(rad)) + Math.abs(h * Math.sin(rad))),\n h: Math.round(Math.abs(w * Math.sin(rad)) + Math.abs(h * Math.cos(rad))),\n };\n}\n\n/** 角度归一化到 [0,360) */\nexport function normalizeDeg(deg: number): number {\n return ((deg % 360) + 360) % 360;\n}\n\n/** h264 偶数像素对齐 */\nexport function evenize(n: number): number {\n const v = Math.round(n);\n return v - (v % 2);\n}\n\n/** 把 rect 钳制在 bounds 内(裁剪框拖拽用) */\nexport function clampRect(\n rect: { x: number; y: number; width: number; height: number },\n bounds: { w: number; h: number },\n minSize = 40\n): { x: number; y: number; width: number; height: number } {\n const width = Math.min(Math.max(minSize, rect.width), bounds.w);\n const height = Math.min(Math.max(minSize, rect.height), bounds.h);\n const x = Math.min(Math.max(0, rect.x), bounds.w - width);\n const y = Math.min(Math.max(0, rect.y), bounds.h - height);\n return { x: Math.round(x), y: Math.round(y), width: Math.round(width), height: Math.round(height) };\n}\n\n/** 给定纵横比,在 bounds 内求居中最大 rect(比例预设落框用) */\nexport function centeredMaxRect(\n bounds: { w: number; h: number },\n aspect: number\n): { x: number; y: number; width: number; height: number } {\n let width = bounds.w;\n let height = width / aspect;\n if (height > bounds.h) {\n height = bounds.h;\n width = height * aspect;\n }\n return {\n x: Math.round((bounds.w - width) / 2),\n y: Math.round((bounds.h - height) / 2),\n width: Math.round(width),\n height: Math.round(height),\n };\n}\n\nexport type FitMode = 'cover' | 'contain' | 'force';\n\n/**\n * scale 的 fit 语义 → 源/目标矩形对(预览画布与 ffmpeg 严格同语义):\n * - cover:源侧取目标比例的居中最大区(= ffmpeg scale:force_original_aspect_ratio=increase + 居中 crop),不变形\n * - contain:目标侧居中留黑边(= ffmpeg scale:decrease + pad)\n * - force:双全幅拉伸(= ffmpeg scale=W:H)\n * src 坐标相对 crop 区原点;dst 坐标相对输出原点。\n */\nexport function fitRects(\n crop: { width: number; height: number },\n out: { w: number; h: number },\n fit: FitMode\n): {\n src: { x: number; y: number; width: number; height: number };\n dst: { x: number; y: number; width: number; height: number };\n} {\n const fullSrc = { x: 0, y: 0, width: crop.width, height: crop.height };\n const fullDst = { x: 0, y: 0, width: out.w, height: out.h };\n if (fit === 'cover') {\n return { src: centeredMaxRect({ w: crop.width, h: crop.height }, out.w / out.h), dst: fullDst };\n }\n if (fit === 'contain') {\n return { src: fullSrc, dst: centeredMaxRect({ w: out.w, h: out.h }, crop.width / crop.height) };\n }\n return { src: fullSrc, dst: fullDst };\n}\n\n/** 导出产物的最终输出尺寸(决定 overlay PNG 的分辨率) */\nexport function outputSize(\n source: { w: number; h: number },\n state: {\n rotation: number;\n crop?: { width: number; height: number } | undefined;\n scale?: { width: number; height: number } | undefined;\n }\n): { w: number; h: number } {\n if (state.scale) return { w: evenize(state.scale.width), h: evenize(state.scale.height) };\n if (state.crop) return { w: evenize(state.crop.width), h: evenize(state.crop.height) };\n const r = rotatedSize(source.w, source.h, state.rotation);\n return { w: evenize(r.w), h: evenize(r.h) };\n}\n","/**\n * editor-core/filters —— 预设滤镜表(数据驱动)。\n * vf = ffmpeg 滤镜片段(导出真值);css = 浏览器预览近似。\n * 全部使用 ffmpeg-static 6.x 标配滤镜(hue/eq/colorbalance/colorchannelmixer)。\n */\n\nexport interface FilterPreset {\n id: string;\n label: string;\n vf: string;\n css: string;\n}\n\nexport const FILTER_PRESETS: FilterPreset[] = [\n { id: 'bw', label: '黑白', vf: 'hue=s=0', css: 'grayscale(1)' },\n {\n id: 'sepia',\n label: '复古',\n vf: 'colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131',\n css: 'sepia(0.85)',\n },\n { id: 'warm', label: '暖阳', vf: 'colorbalance=rs=.15:gs=.04:bs=-.15', css: 'sepia(0.25) saturate(1.25) brightness(1.03)' },\n { id: 'cool', label: '冷调', vf: 'colorbalance=rs=-.14:bs=.16', css: 'hue-rotate(12deg) saturate(0.95) brightness(1.02)' },\n { id: 'vivid', label: '鲜艳', vf: 'eq=saturation=1.45:contrast=1.08', css: 'saturate(1.45) contrast(1.08)' },\n];\n\nexport function findFilterPreset(id: string | undefined): FilterPreset | undefined {\n return id ? FILTER_PRESETS.find((p) => p.id === id) : undefined;\n}\n\n/**\n * 拼出 canvas/CSS 用的 filter 字符串(预览与帧合成共用)。\n * brightness/contrast/saturation 来自手调 [-1,1] → 1+v;叠加预设 css。\n * gamma 无 CSS 等价(仅 ffmpeg 导出生效),此处不含。\n */\nexport function buildFilterCss(\n filters: { brightness: number; contrast: number; saturation: number },\n presetId?: string,\n): string {\n const presetCss = findFilterPreset(presetId)?.css ?? '';\n return [\n `brightness(${1 + filters.brightness})`,\n `contrast(${1 + filters.contrast})`,\n `saturate(${1 + filters.saturation})`,\n presetCss,\n ]\n .filter(Boolean)\n .join(' ');\n}\n"]}